Posts

Showing posts from April, 2013

datetime - All MySQL records from yesterday -

what efficient way records datetime field falls somewhere between yesterday @ 00:00:00 , yesterday @ 23:59:59 ? table: id created_at 1 2016-01-19 20:03:00 2 2016-01-19 11:12:05 3 2016-01-20 03:04:01 suppose yesterday 2016-01-19, in case i'd want return rows 1 , 2. since you're looking date portion, can compare using mysql's date() function . note if have large number of records can inefficient; indexing advantages lost derived value of date() . select * table date(created_at) = date(now() - interval 1 day);

android - Issues trying to create GridLayout with elements of different size -

Image
i'm trying create static grid-like layout in android i'm using gridlayout instead of gridview . this layout i'm trying achieve using code here base. i'm little confused specifying layout_{weight, margin} on every element inside grid, since it's understanding rowspan , colspan parameters should take care of that. not incorrect? any pointers? <?xml version="1.0" encoding="utf-8"?> <gridlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/gridlayout1" android:layout_width="match_parent" android:layout_height="match_parent" android:columncount="2" android:rowcount="2" tools:context=".mainactivity" > <android.support.v7.widget.cardview android:layout_height="wrap_content" android:layout_width="wrap_cont...

c# - DataTable remove columns and re-order the columns -

i want remove unwanted columns datatable , arrange order of columns in pre-defined order for example, table columns below, col2|col1|col3|test|test1|col5|col4|some col name|col6 i want remove test, test1 , col name , reorder datatable below format col1|col2|col3|col4|col5|col6 // need below columns list<string> tablecolumns = new list<string>(); tablecolumns.add("col1"); tablecolumns.add("col2"); tablecolumns.add("col3"); tablecolumns.add("col4"); tablecolumns.add("col5"); tablecolumns.add("col6"); list<datacolumn> tblcolumns = mydatatable.columns.cast<datacolumn>().tolist(); //remove unwanted columns foreach (datacolumn col in tblcolumns) { if (!tablecolumns.contains(col.columnname.trim())) { mydatatable.columns.remove(col); } } now how re-order columns in below order? col1|col2|col3|col4|col5|col6 i tried in below code, fails if items in tablecolumns doesn’t exists in da...

python - Zip() an already initialised list -

i'm trying write function writes numpy arrays file. use pythonic method of using zip() . following code not work; trying convert **data_lists named arguments (of values 1d numpy arrays , keys labels) list of arrays required zip function. def write_data_file(filename,**data_lists): open("{}.dat".format(filename), "w") f: header = "#" lst in data_lists: header = "{} {} \t".format(header,lst) header = "{} \n".format(header) f.write(header) # following line of code not work row in zip(data_lists[lst] lst in data_lists): f.write("\t".join([str(item) item in row])+ "\n") i can't assign list first below: trial = [data_lists[lst] lst in data_lists] zip(trial) this nothing trial treated single argument. how can zip() treat items in trial individually or otherwise complete this? change: zip(data_lists[lst] ls...

xml - how to add copy of block "discount" in checkout magento -

i need add block (copy of block discount in shoppcard) under existing block. have code, nubby , don't know must add in config.xml , phtml file. so, created file config.xml(still empty) in directory local/andrew/catrt2/ect , add layuot , template in directories frontend/andrew/default/layout/coupon.xml code <?xml version="1.0" ?> <!-- root node magento layout configuration --> <layout version="0.1.0"> <default> <reference name="checkout.cart"> <block type="andrew/cart2_coupon2" name="checkout.cart2.coupon2" as="coupon2" template="coupon2/view.phtml" after="checkout/cart/coupon"/> </reference> </default> </layout> and frontend/andrew/default/templat/view.phtml (empty to) sorry bad english:)

java - What to pass as parameters to constructor from super class -

i'm making abstract super item class, i'm not sure put parameters constructor. because item made of different subjects, i.e. course , student , have different parameters. the constructor course public course(string coursename, int coursenum) { super(); this.coursenum = coursenum; this.coursename = coursename; } and constructor student public student(int studentid, string studentname) { super(); this.studentname = studentname; this.studentid = studentid; } so right super() constructor item not accept parameters, can't right either. i've tried subject, seems give examples variables super class used. it common abstract super class not take constructor parameters. should consider in case, need common interface, not superclass. you should think how use item object , how use student object. think through, item in application, attributes has etc. lead proper class design. item should incorporate common attributes...

multithreading - Looking for a light-weight cross-platform C threading library -

i wanted use openmp this, not appropriate purposes: creating own thread pool. so, needs c89 code with, of course, platform specific code windows , unices. i need c library, no c++, boost c++11, etc. thanks! use posix threads - pthread. there windows implementation. also take on gthread - part of glib.

emgucv - how to convert mat to image in (Emgu CV version 3) in c#? -

in many blogs there question still there no answer it."world of programmers"!!!. image<bgr, byte> imgeorigenal; capture capwebcam = null; imgeorigenal = capwebcam.queryframe();//error line the error :cannot implicitly convert type 'emgu.cv.mat' 'emgu.cv.image i need few lines of tested , working code. thanks the correct answer first comment @david_d sent under question. image<bgr, byte> imgeorigenal = capwebcam.queryframe().toimage<bgr, byte>();

java - Performing a final action after annotation processing -

so have annotation that, although can declared multiple times, needs access same properties file. using static registry in annotation processor track if file has been created, , store writer file. far works fine, problem figuring out when save file. making call roundenv.processingfinished (or whatever method is) @ end of annotation processor, , if returns true save file. problem having that, if source fines generated, , compiler goes new round of processing not contain of annotation, file not ne saved. thinking adding entirely new processing supports every annotation, claims none, , making check there. feel clunky option, since spec indicates processor should support annotations process. there better way of doing this, or should go additional processor model?

osx - How do I enable curl SSL on Mac OS X? -

i'm using terminal on mac os x 10.11.2 , can't process https requests. error: curl: (1) protocol "https" not supported or disabled in libcurl i tried "wrong directory" error: ./configure --with-ssl=/usr/local/ssl any advice helpful. edit: this error when trying install ssl: configure: error: openssl libs and/or directories not found specified! solution: for mac os x 10.6 or later use enable ssl: ./configure --with-darwinssl solution: for mac os x 10.6 or later use enable ssl: ./configure --with-darwinssl

r - Create 3 GGplots in 1 PDF within 1 function -

Image
this question has answer here: r + ggplot: plotting on multiple pages 2 answers i want create .pdf of 2 simple matrices (see below) , 3 simple plots. the problem i’m experiencing if try make 3 ggplots within 1 pdf last plot in pdf. i made examples of both matrices: testm1<-structure(c(3.97324499399863e-10, 3.4941052533535e-09, 0.000223879747651954, 0.000317346286270709, 4.95475331444513e-05, 9.37455248795082e-06, 0.00479174197985962, 0.0117719601999346, 1.95538874649056e-05, 0.0112286943879835, 0.00938438613835775, 4.94275399906971e-05, 0.0707123514324416, 0.272635105975824, 0.0017364758608557, 2429999.00716101, 647545.748442555, 376514.280488326, 357881.804554609, 312416.957044385, 311751.97469005, 307725.707067659, 290422.886020279, 263015.211836681, 257847.262909701, 249313.738258419, 236842.707415477, 229077.242836832, 225838.837415727, 222252.91...

How to split dynamically generated buttons into columns using Javascript? -

i have javascript code generates buttons of 2 types. header button varying amount of content buttons underneath. using css3 split buttons columns '-webkit-column-break' not function in internet explorer or safari. i have approach custom javascript in mind. i'm wondering if it's possible, , how might accomplish it. here pseudo code; create 3 divs - 1, 2, , 3 count header array. divide count 3 find number place in each column. create counter. each header placed increase count 1. if count equal column maximum use div 2. if div2 count equal column maximum use div 3. i can see 1 problem approach doesnt account varying number of columns underneath headers. column 1 , 2 equal length or 3 equal if possible. fixed. here's how did it js fiddle here var mycars = new array(); mycars[0] = "saab"; mycars[1] = "volvo"; mycars[2] = "bmw"; mycars[3] = "porsche"; mycars[4] = "daewoo"; mycars[5] = "mg...

How does the java compiler assign index's in the local variables table? -

alright i'm writing compiler , i'm trying use information in local variables table figure out names/types variables. i have following code: public void noob() { try { int hello = 0; short yo = 1; byte y = 2; int[] e = new int[9]; system.out.println(y + ", " + hello + ", " + yo+", "+e); } catch (exception var6) { var6.printstacktrace(); } } when reading variables table following: localvariable{uid=-1, start=0, end=69, nameindex=30, typeindex=31, varindex=0, name='this', typename='lmain;'} localvariable{uid=-1, start=2, end=60, nameindex=37, typeindex=18, varindex=1, name='hello', typename='i'} localvariable{uid=-1, start=4, end=60, nameindex=38, typeindex=39, varindex=2, name='yo', typename='s'} localvariable{uid=-1, start=6, end=60, nameindex=40, typeindex=41, varindex=3, name='y', typename='b'} localvariable{uid...

python - How do I create a list index that loops through integers in another list -

i have list: sentences = ['the number of adults read @ least 1 novel within past 12 months fell 47%.', 'fiction reading rose 2002 2008.', 'the decline in fiction reading last year occurred among men.', 'women read more fiction.', '50% more.', 'though decreased 10% on last decade.', 'men more read nonfiction.', 'young adults more read fiction.', 'just 54% of americans cracked open book of kind last year.', 'but novels have suffered more nonfiction.'] and have list containing indexes of sequences of sentences in above list contain number. index_groupings = [[0, 1], [4, 5], [8]] i want extract specified sentence sequences in variable "sentences" using indexes in variable "index_groupings" following output: the number of adults read @ least 1 novel within past 12 months fell 47%.fiction reading rose 2002 2008. 50% more.though decreased 10% on last decade. just 54% of a...

ios - Calling Other ViewController opens a black screen -

i have begun development of ios in swift , , stuck on 1 thing. want pass string value 1 viewcontroller other. 1st view controller // on tablecell click func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { commonfunctions.setdefaults("a", value: arr[indexpath.row]) let viewcontroller = secondview(passeddata:arr[indexpath.row]) self.presentviewcontroller(viewcontroller, animated: true, completion: nil) } 2nd viewcontroller var test:string init(passeddata:string){ self.test = passeddata super.init(nibname: nil, bundle: nil) } required init?(coder adecoder: nscoder) { fatalerror("init(coder:) has not been implemented") } override func viewdidload() { super.viewdidload() print(commonfunctions.getdefaults("a")) } i getting string in 2nd viewcontroller problem getting black screen. you getting black screen because initialising secondviewcontro...

c++ - Abstract base class for use with smart pointers (intrusive_ptr) - handling inheritance, polymorphism, cloneability and returning from factory methods -

requirements i writing class called rcobject , stands "reference counted object"; the class rcobject should abstract, serving base class of framework ( ec++3 item 7); creating instances of rcobject subclasses on stack should prohibited ( mec++1 item 27); [ added: ] [ assume bear concrete subclass of rcobject ] [ c.e. here means compilation error ] bear b1; // triggers c.e. (by using mec++1 item 27) bear* b2; // not allowed no way trigger c.e. intrusive_ptr<bear> b3; // recommended bear* bs1 = new bear[8]; // triggers c.e. container< intrusive_ptr<rcobject> > bs2; // recommended intrusive_ptr_container<rcobject> bs3; // recommended class someclass { private: bear m_b1; // triggers c.e. bear* m_b2; // not allowed no way trigger c.e. intrusive_ptr<bear> m_b3; // recommended }; clarified: declaring / ret...

Not-hash-based set collection for storing unique objects with custom equality comparer - C# -

i'm trying store (name: string, value: long) pair in set. public class namevaluepair { public string name; public long value; } public namevaluepaircomparer comparer = new namevaluepaircomparer(); public hashset<namevaluepair> namevalueset = new hashset<namevaluepair>(comparer); two pairs equal if either have equal name or equal value - implemented in namevaluepaircomparer overriding equals method equalitycomparer: public class namevaluepaircomparer : equalitycomparer<namevaluepair> { public override bool equals(namevaluepair x, namevaluepair y) { return (x.value == y.value) || (x.name == y.name); } the problem is: gethashcode(namevaluepair obj) should return same value 2 objects equals return true, given namevaluepair, gethashcode() should return either value.gethashcode() or name.gethashcode(), have know field in both pairs equal: public override int gethashcode(namevaluepair obj) { /* ??? */ /* // using unknow...

linux - Automate scp website file transfer using a shell script -

i have 3 digital ocean droplets, how automate 1 droplet files 2 droplets, write scp shell script. guys have other suggestions or file transfer between 2 droplets? #! /usr/bin/env bash # variables server1user=root server1pswd=killergirls server1ip=123.123.123.123 server1path=/etc/var/html/www/ server2user=root server2pswd=killerboys server2ip=121.121.121.121 server2path=/etc/var/html/www/ echo -e "\n--- first server files transferring now... ---\n" sshpass -p "$server1pswd" scp -r /etc/var/html/www/ server1user@server1ip:$server1path echo -e "\n--- second server files transferring now... ---\n" sshpass -p "$server2pswd" scp -r /etc/var/html/www/ server2user@server2ip:$server2path i prefer program things in python. below have sample of 1 script use deploy hadoop cluster. can expanded adding more files, commands, or ips. note being able print going executed before run it. done debug variable. also note, can accomplished in ...

php - Guzzle 6 progress of download -

i want download large file guzzle , want track progress. don't know if have pass stream or use requestmediator somehow. i tried subscribing event curl.callback.progress, psr 7 request doesn't have event dispatcher. i tried on_stats , callback fired @ end. the progress subscriber plugin deprecated https://github.com/guzzle/progress-subscriber i'm testing following code. $dl = 'http://archive.ubuntu.com/ubuntu/dists/wily/main/installer-amd64/current/images/netboot/mini.iso'; $client = new client([]); $request = new guzzlehttp\psr7\request('get', $dl); $promise = $this->client->sendasync($request, [ 'sink' => '/tmp/test.bin' ]); $promise->then(function (response $resp) use ( $fs) { echo 'finished'; }, function (requestexception $e) { }); $promise->wait(); an hint appreciated. though, not mentioned within documentation, can use "progres...

vb.net - How to Edit Datagrid Records and also in database -

this code loading data database datagrid private sub records_load(byval sender system.object, byval e system.eventargs) handles mybase.load dim connstring string = "provider=microsoft.ace.oledb.12.0; data source=" & my.application.info.directorypath.tostring() & "\backup\database3.accdb;" dim myconn oledbconnection dim da oledbdataadapter dim ds dataset dim tables datatablecollection dim source1 new bindingsource myconn = new oledbconnection myconn.connectionstring = connstring ds = new dataset tables = ds.tables da = new oledbdataadapter("select * [userinfo] order id", myconn) da.fill(ds, "userinfo") 'change items database name dim cb = new oledbcommandbuilder(da) dim view new dataview(tables(0)) source1.datasource = view datagridview1.datasource = view end sub private sub btncreate_click(byval sender system.object, byval e system.eventargs) handles btncreate.c...

wordpress - Prevent automatic login when register in woocommerce -

i making ecommerce website using wordpress , woocommerce. when customer create account checkout page logged in automatically. don't want option. want user login himself not automatically. after searching on google found option use wp approve user plugin , action hook. http://tolinked.com/questions/4804442/prevent-automatic-login-when-register-in-woocommerce-and-redirect-to-login-page but don't want use plugin don't want keep option approve user. there's no need approve user. want don't login user automatically after creating account. thank all.

sql - Calculating sum with uneven rows from multiple table -

Image
i tried adding 2 data tables in vb.net fails when group has 3rd level child (for e.g. if added 12, regular fees,5 in group table) please tell me how can query database when child node creation unlimited @ group table currently trying call calc sub public sub calc ds.fill("select * group") =0 ds.tables("group").count-1 getheadamt(ds.tables("group").rows(i).item(0) next end sub public function getheadamt(byval mcode integer) filldataset("select * [ledgers] undergroup=" & mcode, "gethead") dim closbal double = getledgeramount(mcode) = 0 ds.tables("gethead").rows.count - 1 closbal = closbal + getledgeramount(ds.tables("gethead").rows(i).item(0)) next return math.abs(closbal) end function function getledgeramount(byval mcode integer) dim bal double = trans(string.format(select isnull(sum(amount),0)+isnull(sum(opbal),0) transactions id='{0}'", mcode)) retur...

javascript - How to add multiple files into a array and access files one by one in AngularJs -

i trying add multiple files file array , later on access each files in angularjs.so far have created custom directive read files looking @ posts.it working fine single file.but requirement want upload multiple files , add them array , later on access created file array when accessing data.i newbie angularjs please me achieve this. html code snippet <div class="input input-file "> <span class="button"><input on-read-file="readfilecontent($filecontent)" type="file" id="attachments" name="file" data-ng-model="attachments" onchange="this.parentnode.nextsibling.value = this.value">browse</span> <input type="text" placeholder="attach files" readonly=""> </div> custom directive read input files var mimetype,filename; testmodule.directive('onreadfile', function ($parse) { return { restrict: ...

postgresql - How to resolve bad symbolic reference and No implicit view available from String errors in Play Framework? -

i running play application(2.2.3), getting following errors, not sure why getting these ? how resolve these? errors: 1. bad symbolic reference, signature in javatimecolumn.class refers term time [error] in package java not available [error] may cokpletely missing current classpath, or version [error] classpath might incompatible version used when compiling javatimecolumn.class [error] get[pk[long]]<"id"> ~ [error] ^ 2. no implicit view available string => anorm.parametervalue. [error] 'content -> jsondata.content [error] ^ [error] 2 errors found build.scala: val dependencies ++= seq( "com.typesafe.play" %% "anorm" % "2.4.0", "org.webjars" % "requirejs" % "2.1.1", "org.postgresql" % "postgresql" % "9.4-1200-jdbc41", "postgresql" % "postgresql" % "9.1-901.jdbc4", )

SSIS 2008 Simple csv file to uplod into a database table -

morning all, i new ssis have simple task complete , small problem. i have data flow task has flat file source connected ole de destination object. csv file holds header matches columns in database table. i has problems 3 fields in destination object these needed converted datatype [dt_str] [dt_wstr]. my dataflow objects not produce erros in form of red cross when run package following message immediate/output window ... task failed: employee load warning: 0x80019002 @ package: ssis warning code dts_w_maximumerrorcountreached. execution method succeeded, number of errors raised (4) reached maximum allowed (1); resulting in failure. occurs when number of errors reaches number specified in maximumerrorcount. change maximumerrorcount or fix errors. ssis package "package.dtsx" finished: failure. in properties pant of dft have increased maximunerrorcount 100 still producing error. have 1 row of data in csv test package im confused why doesnt work? any appriechia...

ios - how to add ARC in between of project -

i creating iphone app , in between need use sdwebimage . need use arc. any idea how add arc in between in project? note: in 1 file have below content. #if !__has_feature(objc_arc) #error sdwebimage arc only. either turn on arc project or use -fobjc-arc flag #endif where should add -fobjc-arc flag? select project form project manager | | targets | | build phases | | compile sources | | select file want crate arc. (you can select multiple file name here) | | press "enter" key | | popup box/window displayed | | write here - '-fno-objc-arc' | | ...

Feed an RTSP stream to Wowza Streaming Engine -

i'm getting rtsp live video stream ip camera. url looks rtsp://xxx:80/img/vid.sav want open stream on wowza. how can this? you can make use of stream file , ingest stream wowza. create file called camera.stream , in it, put rtsp url. within wowza engine manager (found @ http://[your-ip]:8088/ ) , go application you've created test , click on stream files. thereafter there option connect. you can refer stream file guide found here .

javascript - How to enable/disable dynamic form element based on dropdown selection -

i crating form view dynamically iterating on array of field objects crating them part of model object. xyzmodel= [ { field: 'abc', type: 'text', displaylabel: 'abc', inputtype: 'text', isrequired: true}, { field: 'xyz', type: 'text', displaylabel: 'xyz', inputtype: 'text', srequired: true}, { field: 'mno', type: 'text', displaylabel: 'mno', inputtype: 'text', isrequired: false,}, { field: 'rsh', type: 'text', displaylabel: 'rsh', inputtype: 'text', isrequired: false, }, { field: 'lyz', type: 'drop_down', displaylabel: 'lyz', inputtype: 'text', isrequired: true, }, { field: 'def', type: 'drop_down', displaylabel: 'def', inputtype: 'text', isrequired: true, }, ] each module have own model object , can have differen...

networking - Port is closed,Android chat Application -

during last couple of months i've been creating own chat application. used xmpp protocol, , implementation used smack library creating android clients , openfire server. i tested app in local network , in network port 5222 (the port openfire uses connection between client , server) open. i moved openfire server host , struggled connect app server, , found port 5222 closed isp , mobile network provider well. here 2 questions: is there solution somehow bypass restriction? in openfire can change port, don't know if there standard port kind of application. i tested isp's ip address this , common ports closed , port 80 well. can use browser , see website. can use ftp (port 21) why can use close ports ?? in general case, instead of: ========= ========= = app 1 = <----------> = app 2 = ========= ========= you do: ========= ========= = app 1 = ----------> = server = ========= ...

javascript - How to use ngModel in ion-checkbox? -

i'm trying use ngmodel, ngmodel doesn't work there. code: <ion-checkbox *ngfor="#item of items" [(ngmodel)]="item.checked"> {{item.name}} </ion-checkbox> but error: exception: expression 'checked in addinterestitem@5:2' has changed after checked. previous value: 'false'. current value: 'false' in [checked in addinterestitem@5:2] example data: this.items = [ {name: 'dancing', checked: false}, {name: 'jazz', checked: false}, {name: 'metal', checked: true}, {name: 'pop', checked: false}, {name: 'rock\'n\'roll', checked: false}, {name: 'folk metal', checked: true} ]; i not familiar <ion-checkbox> . when tried repeat story normal <input type="checkbox" /> , couldn't success applying ngfor input type="checkbox" directly. did, took <ul><li *ngfor="#item of items" > ,...

angularjs - Protractor: Drag-Drop function working with Mozilla and chrome but not with Internet Explorer 11 -

i trying automate drag-drop action using protractor. element's properties are: element needs dragged: <li id="activities-test123" class="ng-binding ng-scope ng-isolate-scope draggable" tooltip-placement="right" ng-attr-tooltip="{{activity.name.length > relationships.namelimit ? activity.name : ''}}" draggable="true" ng-class="{'draggable-disabled': activity.entityhasactivity, 'draggable': !activity.entityhasactivity}" ng-repeat="activity in relationships.activities | toarray:false | filter:searchactivities:strict" tooltip=""> the location element needs dropped: <div class="tree-view ng-isolate-scope" drop="relationships.handledrop" datasource="relationships" droppable=""> <p class="content-help-text ng-hide" ng-hide="relationships.hasentity()">drag entity here</p> <div ui-tree=...

Jquery not appending options to select field from array -

hi have select box , using ajax append options it. first want delete existing options , append new options array. options not showing. my select box: <div class="btn-group"> <select class="selectpicker" id="open_po_number" name="open_po_number" data-style="btn-primary"> </select> </div> my ajax response: var vendor_po_list = response.vendor_po_list; alert(vendor_po_list); $('#open_po_number').find('option').remove(); $.each(vendor_po_list, function(i, item){ $('#open_po_number').append($('<option>', { value: vendor_po_list[i], text: vendor_po_list[i] })); }); i able see array in alert box values not appending select box. how this? want delete existing options first. edit: // console log vendor_po_list = ["po-2", "po-3", "po-4", "po-5", "po-6", "po-7", "po-10...

reactjs - how to use react* to solve while the page is not completed loaded when the page is blank? -

while build page using react, found blank few while when build javascript not completed loaded. guess build package quite large , makes load quite slow. during time page stays in blank, how solve or avoid ? :) there 2 options follow --> 1. make app isomorphic (render pure html on first page load) or 2. display message or loading giff in div loading app (it replaced app when loads).

javascript - DAT.gui - production ready alternative -

i happy user of dat.gui local debugging , controls of charts i'm working on, need has same functionality control int or float range slider pick color but need bit more customizable can style match our product , add new features. is there out there? since dat.gui fulfills needs best bet stick it. it's licensed under apache license v2 free modify it, make closed-source project, etc. can release new code under different license (see wiki license comparisons). as changing styling , adding features, there's nothing stopping adding own css styles override defaults, or adding own js features. edit: looking @ source, appears styles set in style.scss file in gui directory. edit , re-build it, or mess output css file , re-compile whole package (the source page has instructions this).

forms - PHP Stopping a person pressing Submit multiple times -

i have below form, , after form php requests curl can take while. because of keep pressing submit button thinking nothing has happened. causes multiple entries in database. me , let me know put in stop this. i tried javascript solution in first answer stopped php script followed. not wanted. sorry <!doctype html> <html> <head> <meta charset="utf-8"> <link href="css2/style.css" rel='stylesheet' type='text/css' /> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="application/x-javascript"> addeventlistener("load", function() { settimeout(hideurlbar, 0); }, false); function hideurlbar(){ window.scrollto(0,1); } </script> <!--webfonts--> <link href='//fonts.googleapis.com/css?family=open+sans:400,300,600,700,800' rel='stylesheet' type='text.css'/...

thoughtworks cruise - How to set label prefix application version with CruiseControl.NET -

we're using cruise control v1.8.5. have next scenario: checkout source code git repository run scripts build project (e.g. npm install && cordova clean, cordova build, minify css files, compile typescript ...) now want add label on successfull build. therefore found cruisecontrol has labeller option, added: <cb:define name="mylabeller"> <labeller type="defaultlabeller"> <initialbuildlabel>1</initialbuildlabel> <labelformat>0</labelformat> <incrementonfailure>true</incrementonfailure> <labelprefixfile>x:\buildfiles\myproject\version.txt</labelprefixfile> <labelprefixfilesearchpattern>\d\.\d\.\d\.</labelprefixfilesearchpattern> </labeller> </cb:define> but problem that, done before source code retrieved (git) repository. read version project , cruisecontrol regex reads version , outputs like: 1.0.3.buildnumber....

url - Blog Link in magento -

i'm working in magento blog have 2 store views each 1 different country the problem when add blog link in social media page .. must write 1 store view in url how can add blog url match customer store view ex: if customer store view 1 open link .. url (example.com/storeview1/blog) , if customer store view 2 open link .. url (example.com/storeview2/blog) i tried make url (example.com/blog) refers 404 page try this. open admin panel goto system->configuration change current configuration scope storeview1 or storeview2 top of leftbar. search keyword blog under "aheadworks extensions" @ leftbar try change route blog settings. hope how.

c++ - Subtract all contours from image except the one with the largest area -

cv::mat thr; std::vector<std::vector<cv::point> > contours; std::vector<std::vector<cv::vec4i> > hierarchy; int largest_area = 0; int largest_contour_index = 0; cv::findcontours( thr, contours, hierarchy,cv_retr_ccomp, cv_chain_approx_simple ); // find contours in image for( int = 0; < contours.size(); i++ ) // iterate through each contour. { double = contourarea( contours[i], false ); // find area of contour if(a > largest_area) { largest_area = a; largest_contour_index = i; // store index of largest contour } } what should after finding index of largest contour? how can delete other contours inner areas? image binary (cv::mat thr). black background white areas. thanks. in case, deleting contours inner areas equal fill them black. can done drawing contour regions ...

split .csv file using a batch file -

i have huge csv file more columns allowed in excel need split file 2 in order use it. i found code can put in batch file , works problem if data not available in cell takes data next available cell. taking long time. please let me know how code can edited? @echo off setlocal enabledelayedexpansion rem edit value change name of file needs splitting. include extension. set bfn=bigfile.csv rem edit value change number of lines per file. set lpf=5000 rem edit value change name of each short file. followed number indicating in list. set sfn=splitfile rem not change beyond line. set sfx=%bfn:~-3% set /a linenum=0 set /a filenum=1 /f "delims==" %%l in (%bfn%) ( set /a linenum+=1 echo %%l >> %sfn%!filenum!.%sfx% if !linenum! equ !lpf! ( set /a linenum=0 set /a filenum+=1 ) ) endlocal pause also company not allow me download csv splitters or other data. appreciated.

android - Issue with GIF image -

so using gif in app . when install app in other device gif doesn't fit in screen or it's not on place should be. have solution ? class: package com.example.cyril.tryapp; import android.content.context; import android.graphics.canvas; import android.graphics.movie; import android.util.attributeset; import android.view.view; import java.io.inputstream; public class gifview extends view { private inputstream gifinputstream; private movie gifmovie; private int moviewidth = 150, movieheight = 500; private long movieduration; private long mmoviestart; public gifview(context context) { super(context); init(context); } public gifview(context context, attributeset attrs) { super(context, attrs); init(context); } public gifview(context context, attributeset attrs, int defstyleattr) { super(context, attrs, defstyleattr); init(context); }...

cpu usage - Why do Android applications get silently killed when the CPU is near 100%, and how can I avoid this? -

i'm doing heavy number crunching in app, loops forever (occasionally outputting results) , consuming 25% 30% of cpu. works fine. however, run several copies of app @ same time. if run 4 copies, works fine, processor used below 100% however, start 5th copy, 1 of old copies silently killed os. app doesn't receive pause, stop or destroy signals. what expect happen, same running them on pc. example, application alone outputs results in every 10 seconds, , if run many of them, once cpu usage leveled off, take more , more time between results, os rationing cpu time among them. on pc windows or linux start 3 times number of copies required 100% cpu usage, , took longer time between results, worked. is there possibility achieve same on android phone?

how to change the black pixels in the below image to red pixels using opencv libraries with c++ -

Image
i want change black pixels in image red pixels, such ball should white , red. want use opencv libraries , code in c++. have tried converting image rgb. common approach threshold image, in case each pixel intensity less threshold considered being black , recolored red. 1 way find threshold (that divides image's pixel 2 classes ("more black" , "more white") otsu thresholding: int main() { cv::mat input = cv::imread("../inputdata/ball_thresholding.jpg"); cv::mat gray; cv::cvtcolor(input,gray,cv_bgr2gray); cv::mat mask; // compute inverse thresholding (dark areas become "active" pixel in mask) otsu thresholding: double graythres = cv::threshold(gray, mask, 0, 255, cv_thresh_binary_inv | cv_thresh_otsu); // color masked pixel red: input.setto(cv::scalar(0,0,255), mask); // compute median filter remove whitish black parts , darker white parts cv::imshow("input", input); cv:...

header - Change logo size in opencart2 for responsive view -

i tried editing img-responsive max-width 50% in bootstrap.min.css logo size reduces 50% slider image reduces 50% want logo(responsive) 50% add new class logo image in header.tpl. in stylesheet.css make new entry .newstyle { max-width:50%; }

any one help me, getting error with my rails server when i adding authentication -

couldn't find user 'id'=8 extracted source (around line #13): def current_user 13@current_user ||= user.find(session[:user_id]) if session[:user_id] 14end 15 16 def require_user def current_user @current_user ||= user.find(session[:user_id]) if session[:user_id] end def require_user rails.root: c:/users/ab computer/securesite application trace | framework trace | full trace app/controllers/application_controller.rb:13:in current_user' app/controllers/application_controller.rb:17:in require_user' request this error tells you not have user id of 8. open browser developer tools , clear sessions/cookies , try again, in chrome find under resources tab.