Posts

Showing posts from June, 2014

Selenium is having trouble interacting with DevExpress -

i attempting run tool selenium (with iedriverserver ) on ie browser application. application made out of devexpress components. one component of application in particular gridview . large component, , contains numerous nested sub-components, such header combo boxes, peripheral buttons, peripheral text fields, data grid of rows+columns. in using selenium , using such calls "<webelement>.click()", "<webelement>.gettext()" , "<webelement>.sendkeys()" on these devexpress sub-components. however, there general problem these devexpress sub-components (many times) not react selenium calls. i wondering if there's different approach in getting selenium particularly operate on devexpress components. perhaps, there's type of overall setting performed. if has insight this, appreciate information. thanks.

c# - How to prevent repeating code -

i beginner programmer , feel repeating code( downloadfiles() ) in below example: var files = downloadfiles(); var retrycount = 0; while (files == null && retrycount < 3) { retrycount++; console.writeline("retrying {0} time", retrycount); files = downloadfiles(); } my application downloading files via httpwebrequest` , supposed retry download 3 times if no files retrieved. i need expert opinion here: i repeating code downloadfiles() could snippet of code written more efficiently? this may seem trivial want develop programming practices. you not repeating code, encapsulated download logic in method, , looping on method. bad things have been inline downloadfiles method or unroll while loop.

Is there a more efficient way to run my PHP IF...ELSEIF statement? -

this snippet added shopping cart renders select box 4 choices quantity , refreshes page. originally, there simple input box users use manipulate quantities small cluster of users weren't hitting "update cart" before proceeded checkout decided more proactive. ux practices , ajax methods aside, i'm curious if redundancy of these options necessary in php. how make more efficient? <select name="quantity" onchange="return updatecart();"> <?php if($this->getqty() == 1) : ?> <option value="1" selected="selected">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <?php elseif($this->getqty() == 2) : ?> <option value="1">1</option> <option value="2" selected="selected">2</option> <option value="3...

javascript - Undefined Property after new object construction using 'this' in constructor with self-executing function inside Object.defineProperty -

i'm attempting use typescript-like structure emulate enumeration in self-executing function 'value:' property. checked on examples of ecmascript5 / crockford object.defineproperty() use in constructor (using 'this') not find much. far can tell, self-executing function should fill both objects 10 properties, , closure correct ('this' not window object). here's design pattern: var player = {}; var foo = function () { this.levelindex; object.defineproperty(this, 'levelindex', { value: (function (levelindex) { levelindex[levelindex.one = 0] = 'one'; levelindex[levelindex.two = 1] = 'two'; levelindex[levelindex.three = 2] = 'three'; levelindex[levelindex.four = 3] = 'four'; levelindex[levelindex.five = 4] = 'five'; // setup player object properties of levelindex // before becomes non-enumerable: ...

Facebook API / iOS SDK / retrieve page posts without login -

is possible retrieve facebook page posts in ios application without having use facebook login? i using tumblr api works fine , delivers pictures , texts has been posted. any appreciated. thanks. facebook sdk says, need valid access token if post public. use app access token. read how request app access token here.

java - how to send intent in two different class at fragment -

i have variable sent through ntent, , sent 2 different classes, how? intent this: case 0: position = new latlng (-8.447159, 112.651799); args.putparcelable ("place_position", position); = new intent (getactivity (), mapsmenu.class); a.putextra ("lat", args); a.putextra ("post", "cave"); a.putextra ("location", "south beach goa china in malang"); break; key 'post' sent class a, while key 'location' , 'lat' sent class b, use fragment of actionsherlock, variable sent class b, while class not appear, following source code: public class extends sherlocklistfragment { listview list; list<hashmap<string, string>> alist = new arraylist<hashmap<string, string>>(); imageview imdetail; string pos; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-gen...

javascript - Offseting the content in Angular -

is there way have offcanvas offset content without putting entirety of content inside it? what mean is, in order of offcanvas offset main content has inside offcanvas inner-wrap div, however, angular, difficult implement. i'd rather not implement indexcontroller inside offcanvascontroller , every other single piece of content. is there way offcanvas push main content right do, without need include said content inside offcanvas? i have index.html, header.html , offcanvas.html, follows: header.html: <div data-ng-include="'/public/system/views/offcanvas.html'"></div> <!-- offcanvas included, before main navigation --> <div class="page-header" data-ng-controller="headercontroller"> <div class="desktop"> <ul class="title-area"> <li class="name"> <h1><a ui-sref="home" mean-token="'site-title'...

asp.net - how to set default value of a dropdownlist in VB -

i'm trying set default value of dropdownlist (updatedistributor) in vb. updatedistributor.datavaluefield doesn't seem work. drop down list remained blank sub page_load(byval sender object, byval e eventargs) if not ispostback dim titlesearch string = "select distrubtorcode titles isbn = 986765654" dim table datatable = database.selectrows(titlesearch) if table.rows.count > 0 updatedistributor.datavaluefield = table.rows(0)("distrubtorcode") end if end if dim sqlupdatedistrubtor = "select distinct distrubtorcode titles " mydata = database.selectrows(sqlupdatedistrubtor) each row datarow in mydata.rows updatedistributor.items.add(new listitem((row)("companyname"), (row)("companyname"))) next end sub in end came - guess placed information in wrong spot before too! combobox.text = "yourtext" worked ! - ty sub page_load(byv...

html - PHP Export query to Excel -

i need insert rule in excel. have vary dates , if date last background red. need row[4] for($i=1; $i<=$aux; $i ++){ $sql = mysql_query("select * tables = $id = ".$i) or die(mysql_error()); $row=mysql_fetch_array($sql); $html .= '<tr><td>'.$row[0].'</td> <td>'.$row[1].'</td> <td>'.$row[2].'</td> <td>'.$row[3].'</td> <td>'.$row[4].'</td> if want write proper excel worksheet in php formulas , not, take @ pear package: spreadsheet_excel_writer http://pear.php.net/package/spreadsheet_excel_writer writing forumulas: integer worksheet::writeformula( integer $row , integer $col , string $formula , mixed $format=0) more info: http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.spreadsheet-excel-writer-worksheet.writeformula.php

java - creating nested hashmap from text file: not all data stored, may be over written -

i need read 2 files, add them hashmap , make comparison. it's large file manually. here java code : /** * @param args command line arguments */ public static void main(string[] args) throws filenotfoundexception, ioexception { // todo code application logic here bufferedreader in1 = new bufferedreader(new filereader("comparetheresults/595231gov_nov_13_assessed.txt")); bufferedreader in2 = new bufferedreader(new filereader("comparetheresults/627231farsidetect.txt")); hashmap<string, hashmap<string, arraylist<string>>> hmap1 = new hashmap<string, hashmap<string, arraylist<string>>>(); hashmap<string, hashmap<string, arraylist<string>>> hmap2 = new hashmap<string, hashmap<string, arraylist<string>>>(); arraylist<string> rel= new arraylist<string>(); string id = null; string line = null;...

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

i read alot other solution still confused should mine... #include <opencv2/objdetect/objdetect.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/imgproc/imgproc.hpp> #include <iostream> #include <stdio.h> using namespace std; using namespace cv; int main(int argc, const char** argv) { //create cascade classifier object used face detection cascadeclassifier face_cascade; //use haarcascade_frontalface_alt.xml library face_cascade.load("haarcascade_frontalface_alt.xml"); //setup video capture device , link first capture device videocapture capturedevice; capturedevice.open(0); //setup image files used in capture process mat captureframe; mat grayscaleframe; //create window present results namedwindow("outputcapture", 1); //create loop capture , find faces while (true) { //capture new image frame capturedevice >> captureframe; ...

c# - Using operator sealed with the members of the class -

i've found in troelsen's book, operator sealed can used on members of class protect virtual methods override . but if don't want override virtual methods, sense make virtual ? you might have situation this: public class { public virtual void mymethod() { //... } } public class b : { public override void mymethod() { //... } } public class c : b { public override void mymethod() { //... } } but if want inheriting class c not able override b 's mymethod , while still allowing b override a 's? can do: public class b : { public sealed override void mymethod() { //... } } with change made, can no longer override method in c .

continuous integration - How do I Setup an Agent Requirement in TeamCity that detects if an Application is installed? -

i have build environment multiple agents. set agent requirement in build detects if software installed. in cases can in env.path particular string. software doesn't modify path. i realize after install software edit buildagent.properties file set particular property, i'd more automatic. the specific instance have build uses msdeploy deploy websites, won't work if msdeploy isn't installed. how can specify in build need agent has msdeploy installed? you can build simple agent plugin. here few suggestions: extend agentlifecycleadapter , implement agentinitialized method implement logic of detection necessary application (for example based on file existence) inside agentinitialized method use agent.getconfiguration().addconfigurationparameter() report agent parameter server if detection logic can implemented through file detection, can use filewatcher monitor specific files , report parameters based on them without restart of agent

haskell - apply a list of functions to a value one after another -

this question has answer here: most idiomatic implementation of `[a -> a] -> (a -> a)` 2 answers is there built in function apply list of functions value 1 after another? using this, seems quite inelegant me. -- applyfunctions [(*2), (+3), (*4)] 1 == ((1 * 2) + 3 ) * 4 applyfunctions :: [(a -> a)] -> -> applyfunctions [] x = x applyfunctions [f] x = f x applyfunctions (f:fs) x = applyfunctions fs (f x) you can use foldl (flip ($)) foldl (flip ($)) 1 [(*2), (*3), (*4)] --yields 24

Azure Powershell Cmds Not working in ISE -

it seems windows azure powershell console not have same configuration ise. for instance, after opening console windows following cmdlet works: get-azurevmimage now when enter ise open ise application same cmdlet not found. get-azurevmimage : term 'get-azurevmimage' not recognized name of cmdlet, function, script file, or operable program. check spelling of name, or if path included, verify path correct , try again. i can see console window contains following modules: moduletype name exportedcommands ---------- ---- ---------------- binary azure {add-azureaccount, add-azurecacheworkerrole, add-azurecertificate, ad... manifest microsoft.powershell.management {add-computer, add-content, checkpoint-computer, clear-content...} manifest microsoft.powershell.security {convertfrom-securestring, convertto-securestring, get-acl, get-authe... manifest microsoft....

c++ - Which is faster for checking whether a condition is true? -

(1) if (!cond) or (2) if (cond == false) seems see lot of people using (1). isn't less optimal? in c++, if (...) statement evaluates true long whatever in parentheses non-zero value. so, in (1), has happen is do logical not on cond check whether result non-zero (whether bits on) whereas, in (2), has happen is check whether cond 0 (whether bits off) now, time taken check whether bits off greater or equal time check whether bits on. therefore, question whether time perform logical not makes difference, on average. which should use optimize code? tested clang -o3 : int main () { int i; cin >> i; if (i == 0) return -1; } produces leaq 4(%rsp), %rsi movl $_zst3cin, %edi callq _znsirseri cmpl $1, 4(%rsp) sbbl %eax, %eax popq %rdx ret while int main () { int i; cin >> i; if (!i) return -1; } produces leaq 4(%rsp), %rsi movl $_zst3cin, %edi callq _znsirseri cmpl $...

c# - Recognize touch as MouseDown event -

i building puzzle game in c#, winforms touch screen. i able handle touch events on mouse handlers, in fact, did nothing @ all, recognizes touches. however, there issue can't figure out. mouse_down, happens when move bit finger, , did not recognize instant when touch screen. does has faced problem? should implement touch events recognition? if so, please point me documentation or examples? many in advance one suggestion sounds plausible solution override wndproc , search wm_touch event. more details here: https://stackoverflow.com/a/15785333/3330348

xml - Search values ​​without repeating value of the first parameter -

i'm using xsl 1.0 respective values ​​of each parameter xml below. notes below current results of second parameter value of first repeating. use function choose not find value = 'null' my xml: <individuo param='1' > <data> <f16> <row f1='breast' f2='63'/> </f16> </individuo> <individuo param='2' > <data> <f16> <row f1='beddle' f2='40'/> </f16> </individuo> my xsl code: <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:rdf="http://xxx#" version="1.0"> <xsl:strip-space elements="*"/> <xsl:output method="xml" indent="yes"/> <!-- begin rdf document --> <xsl:template match="/"> <xsl:element name="rdf:rdf"> <rdf:description rdf:about="http://xxx"> <xsl:apply-te...

c# - How to get a Listbox to read to a Listbox -

i trying open selected textfile , have text input sent listbox... wrote code textbox worked great converting listbox doesnt seem work much. left default item names in order better understanding of going on. private void button1_click(object sender, eventargs e) { if (openfiledialog1.showdialog() == system.windows.forms.dialogresult.ok) { label1.text = openfiledialog1.filename; listbox1.items.add = file.readalltext(label1.text); } } listbox1.items.addrange(file.readalllines(label1.text));

How can I mock WCF client? -

i have wcf client: using (servicereference1.service1client host = new servicereference1.service1client()) { host.dosomething(); } i can't mock 'host' because type of servicereference1.service1client - isn't interface. i can set 'host' interface type: using (servicereference1.iservice1 host = new servicereference1.service1client()) { host.dosomething(); } but have error: servicereference1.iservice1 type used in using statement must implicity convertible system.idisposable. what can do? make sure iservice1 implements idisposable

python - Using multiple for tags in tables with django -

i'm new django, , working on project have items appended multiple lists , display them in table. using tag there quite few items in each list. however, when run code, first item on list repeats on , over, second item repeats on , over, , on. have feeling because used multiple tags. heres code: <table> {% x in result.netincomear %} {% y in result.d2 %} <tr> <td>{{ x }}</td> <td>{{ y }}</td> </tr> {% endfor %} {% endfor %} </table> any ideas went wrong? thanks. the inner loop should use outer loop variable: {% x in result.netincomear %} {% y in x.d2 %} upd (after looking @ result variable): you need change result variable passed template, use zip() join 2 lists: result = zip(df['date'], df['net income']) return render_to_response('ui/search.html', {"result": result}, context) then, in template iterate on result way: <table> {% x in result ...

Locate Bluetooth in android -

i have code bluetooth service (it can sent , received data file), want development it, want locate of bluetooth client conect service similar bluetooth radar. i need android document. please share document or source code me. thanks. from android doc site : public methods : distanceto(location dest) returns approximate distance in meters between location , given location.

android - how to remove and add a button from the screen without affecting other buttons? -

i'm dynamically creating buttons , place them randomly on screen. want remove button when it's being clicked , create one, when that, other buttons (the ones bellow him percise) change position (moving 1 row). how can modify code other buttons wont change position when click button? want add new button in same row of 1 removed. i'm using linear layout, when add button adds bottom , fill blank row pushing rows. in following code remove button after few seconds: private void creategreenbutton() { random r = new random(); int hidedelay = r.nextint(1000) + 1000; final button greenbutton = new button(this); greenbutton.settext("button"); greenbutton.setonclicklistener(greenbuttonclick(greenbutton)); layout.addview(greenbutton, new linearlayout.layoutparams( linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content)); // place buttons randomly on screen layout.getviewtreeobserver().add...

java - Array of points to image -

i'm stuck trying convert array of points represent drawing(simple 2d black lines) taken mobile phone. pass array of points server emails drawing person. i can't find way convert array of points image, png, or else. , upload static server can insert in email , send other person. i'm looking canvas on android on serverside can output image. preferably java, @ point take anything. an ex of array of points: { "drawing_objects": [ [ { "x": 177, "y": 246 }, { "x": 177, "y": 246 }, { "x": 177, "y": 246 } ], [ { "x": 870, ...

php - Cascade on delete sql -

this question has answer here: mysql foreign key constraints, cascade delete 3 answers im working on small website involves use of databases, i'm using 2 tables users, in first table add users , information, , in second 1 add user id course id . my question how can add cascade on delete , in table? create table if not exists `students` ( `studentid` int(11) not null auto_increment, `fname` varchar(255) collate utf8_unicode_ci not null, `lname` varchar(64) collate utf8_unicode_ci not null, `studentcode` varchar(16) collate utf8_unicode_ci not null, `courseid` int(11) not null, primary key (`studentid`) ) engine=innodb default charset=utf8 collate=utf8_unicode_ci auto_increment=27 ; create table if not exists `idtables` ( `id` int(11) not null auto_increment, `courseid` varchar(255) collate utf8_unicode_ci not null, `studentid` char(64) col...

android - how to go on next edit text when i press enter -

edittext nameedit = new edittext(this); nameedit.sethint("first name"); blur.addview(nameedit); nameedit.setwidth(32); nameedit.setems(50); marginlayoutparams params3 = (marginlayoutparams) nameedit.getlayoutparams(); params3.leftmargin = 16; params3.topmargin = 125; nameedit.setlayoutparams(params3); typeface font33=typeface.serif; nameedit.settypeface(font33); here when press enter edit text become longer rether go next edittext view..... want gone on next edit text view when press enter....* looks you're creating edittext programmatically. need set ime options setimeoptions() method. since (as understand it) not want allow multiple lines, should setmaxlines() . in case be: edit.setmaxlines(1); edit.setimeoptions(editorinfo.ime_action_next);

mamp - How to use HMVC for Codeigniter 2.1.* when index.php is moved? -

i trying build codeigniter application index.php inside "public" folder /applications/mamp/htdocs/public/ in website root. have setup vhosts etc point index.php file. wanted go module based approach , ended using modular extensions - hmvc . placed core files , third party files in corresponding folders, , created modules folder in application folder. proceeded create "login" module inside modules folder alongwith required "controllers/login.php" , "models" , "views" class login extends mx_controller{ public function index() { log_message('error','reached module'); } } now when try load http://localhost/login , error log in apache_error.log saying file not exist: /applications/mamp/htdocs/public/login http://localhost works fine displaying welcome screen of codeigniter gniter this path structure : application/modules └── login ├── config │   └── routes.php ├── controller...

javascript - Find an object in array of objects using underscore.js -

have following sctructure var myarr = [ {code: 'uy', name: "testdfdgf"}]; i need pull object out of array code='uy'. what proper way using _underscore.js (i don't want traverse through array) thank you from underscorejs.org findwhere_.findwhere(list, properties) looks through list , returns first value matches of key-value pairs listed in properties. if no match found, or if list empty, undefined returned. _.findwhere(publicservicepulitzers, {newsroom: "the new york times"}); => {year: 1918, newsroom: "the new york times", reason: "for public service in publishing in full many official reports, documents , speeches european statesmen relating progress , conduct of war."} so essentially: var codeuy = _.findwhere(myarr, {code: 'uy'}); underscore traverse array find this, don't think can around it, should stop @ first match;

Replicating Python functions in C++ -

this question has answer here: how can extend stl classes have own methods? [duplicate] 2 answers i've switched c oop languages - c++ , python 3.4 i noticed there quite-a-lot things python c++ can't beat 1 of them being ease of calling functions. so i've decided somehow implement python-way of making function calls in c++, using stl. i started off 'string' class. in python, can this: str="hello world " str.strip().split() and first, strip-off trailing whitespaces @ end of string , split string in 2 halves @ at whitespace now that's neat , i'd love able call functions way, ie, object.func1().func2().func3() , on as have absolutely no idea stl class 'string', started off own made class 'mystring' class mystring { string str; public: //constructor mystring(string str) { set...

mysql - Performing an operation within EACH GROUP of rows -

i have table below. +------------+------------------+-------------------------------+-------------+ | day | workflow_step_id | unix_timestamp(finished_time) | workflow_id | +------------+------------------+-------------------------------+-------------+ | 2014-04-30 | 1 | 1398852780 | 1 | | 2014-04-30 | 17 | 1398871213 | 2 | | 2014-04-30 | 6 | 1398872807 | 1 | | 2014-04-30 | 22 | 1398898676 | 2 | | 2014-04-30 | 11 | 1398898234 | 1 | | 2014-04-30 | 16 | 1398866813 | 2 | | 2014-04-30 | 5 | 1398869940 | 1 | | 2014-04-30 | 21 | 1398893419 | 2 | | 2014-04-30 | 10 | 1398894136 | 1 | | 2014-04-30 |...

What is time unit returned by Python's timeit module for multiple repetitions? -

i read time unit returned timeit module seconds. however, if have multiple repetitions, e.g. min(timeit.timer('my_function(t)', 'from __main__ import my_function, t') .repeat(repeat=50, number=1000))) would have divide result 1000 actual seconds per loop, or account that? yes, total time returned. have divide 1000 if want have time per iteration of loop. simple test have showed easily: >>> timeit.timeit("import time; time.sleep(1)", number=1) 1.0000581741333008 >>> timeit.timeit("import time; time.sleep(1)", number=5) 5.000285863876343 >>> timeit.repeat("import time; time.sleep(1)", number=5, repeat=3) [5.000285863876343, 5.003287076950073, 5.000286102294922]

php - Transpose CSV data vertical to horizontal by productid -

i have csv file online needs te transposed php because needs done every hour (cronjobs). i use csv import products opencart 'csv-import' module karapuz. my current csv looks this: productid;imageurl;sequence;lastupdate 6867;[urllink0];0;19-08-2013 6867;[urllink1];1;19-08-2013 6867;[urllink2];2;20-03-2012 6867;[urllink3];0;19-08-2013 6867;[urllink4];1;19-08-2013 6867;[urllink5];2;19-08-2013 6867;[urllink6];3;20-03-2012 6867;[urllink7];4;20-03-2012 6867;[urllink8];2;20-03-2012 6867;[urllink9];0;19-08-2013 6867;[urllink10];1;20-03-2012 8352;[urllink11];0;19-03-2013 8352;[urllink12];1;20-03-2012 9970;[urllink13];0;19-08-2013 9970;[urllink14];1;20-03-2012 9970;[urllink15];0;19-08-2013 9970;[urllink16];1;19-08-2013 9970;[urllink17];2;20-03-2012 9970;[urllink18];3;20-03-2012 9970;[urllink19];0;19-03-2013 9970;[urllink20];0;19-08-2013 9970;[urllink21];1;19-08-2013 9970;[urllink22];2;20-03-2012 9970;[urllink23];3;20-03-2012 9970;[urllink24];5;20-03-2012 9970;[urllink25];6;20-0...

javascript - JQuery Datatable set height on column after fnUpdate -

i have jquery datatable, initializeby setting bautowidth false. after creating table need loop on edit 1 of columns each row add radio button. through loop: var rows = searchtable.fngetnodes(); for(var row in rows) { var rowtext = otable.fngetdata(rows[row],0); var htmldata = $.parsehtml(rowtext); var myid = $(htmldata).attr("id"); var replacehtml = '<input type="radio" id="' + myid +'" />'; otable.fnupdate(replacehtml ,parseint(row),0); } $("#my-table").css("width","100%"); fnupdate destroys widths set in datatable definition, why reset width after loop, column width's still incorrect. there way can reset width per column after loop? after looking around, didn't find answer/function setting width on column after fnupdate. in case got around setting column width in css file div: .radio-div{ input{width: 50px; display: inline-block;} p{margin-top: 5px;} }

f# - Function working for all numerical data types -

i've written simple function reverses given number: let reversenumber x = let rec innerfunc acc elem = if elem = 0 acc else let rem = elem % 10 innerfunc (10 * acc + rem) (elem / 10) innerfunc 0 x the problem works ints. e.g. int64 need create version uses 0l , 10l instead of 0 , 10 respectively. i've heard it's possible write more generic functions using inline keyword , languageprimitives, latter doesn't contain neither reminder operation nor 'genericten' (although might obtained 'genericone + genericone + ... ). could ? ignoring completeness of @kvb's linked answers, minimal work make generic: module numericliteralg = let inline fromzero () = languageprimitives.genericzero let inline fromone () = languageprimitives.genericone let inline reversenumber (x:^a) = let ten:^a = 1g + 1g + 1g + 1g + 1g + 1g + 1g + 1g + 1g + 1g let rec innerfun...

c# - No mapping exists from object type System.Web.UI.WebControls.ListItem -

i don´t know what's seems problem have error. can give little help? protected void send_click(object sender, eventargs e) { string userid; membershipuser p = membership.getuser(user.identity.name); userid = p.provideruserkey.tostring(); string cnnstring = configurationmanager.connectionstrings["defaultconnection"].connectionstring; sqlconnection conn = new sqlconnection(cnnstring); string sql = "insert [noticia] (cod_empregado,titulo,tipo_cliente,tipo_animal,data_noticia,descricao) values (@cod_empregado,@titulo,@tipo_cliente,@tipo_animal,@data_noticia,@descricao) "; sqlcommand comando = new sqlcommand(sql, conn); conn.open(); comando.parameters.add(new sqlparameter("@cod_empregado", userid)); comando.parameters.add(new sqlparameter("@titulo", titulo.text)); comando.parameters.add(new sqlpara...

android - Start timer on a button click and stop it with 10 button clicks -

so far have button tap counter working , stops @ 10 taps. problem timer. every time press button resets timer. want button start timer on first click , stop timer on 10th click, stumped , not know how code this. know how can working? java code: package com.example.thirtytapgametest; import android.os.bundle; import android.os.handler; import android.os.systemclock; import android.view.view; import android.widget.imagebutton; import android.widget.textview; import android.app.activity; public class mainactivity extends activity { private int mcount = 0; private imagebutton startbutton; private textview timervalue; private long starttime = 0l; private handler customhandler = new handler(); long timeinmilliseconds = 0l; long timeswapbuff = 0l; long updatedtime = 0l; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); final textview counttextview = (textview) findviewbyid(r...

xml - Java time manipulation - subtracting 2 strings -

i pulling 2 time values (as strings) xml file using xpath, these values (for example) follows: 00:07 08:00 00:07 equal 7 minutes 08:00 means 8am, no date associated or needed (that handled elsewhere) each of these values subject change in each xml file read. attempting follows: i need subtract or add (depending on situation) 7mins 8am , give me hh:mm time (eg: 07:53 or 08:07) in string can output csv next need produce 2 additional strings, 1 min before , 1 min after (eg: 07:52 , 07:54 or 08:06 , 08:08) need output csv i have tried , can think of in relation time interpretation , manipulation minutes subtracted/added time , +/- 1 min there, being complete novice totally stuck despite reading , testing as find. spent last 2 days working joda time first time must missing fundamental cannot desired result either. the question - how can achieve this? some sample code gets me reading xml , printing time fileinputstream file = null; try { file = new fil...

java - Applying blur using RenderScript in Android creates weird output -

i'm attempting apply blur image using renderscript class. here code use (where this.image original bitmap) bitmap inputimage = this.image; int height = inputimage.getheight(); int width = inputimage.getwidth(); bitmap blurredimage = bitmap.createbitmap(width, height, bitmap.config.argb_8888); renderscript rs = renderscript.create(context); scriptintrinsicblur theintrinsic = scriptintrinsicblur.create(rs, element.u8_4(rs)); allocation tmpin = allocation.createfrombitmap(rs, inputimage); allocation tmpout = allocation.createfrombitmap(rs, blurredimage); theintrinsic.setradius(25.f); theintrinsic.setinput(tmpin); theintrinsic.foreach(tmpout); tmpout.copyto(blurredimage); this.image = blurredimage; return true; this input , output function http://imgur.com/a/ewjv6 for reason, appears double image , keep green channel or something. fidling around blur radius doesn't work, , can't find wrong code (which copied wo...

javascript - Refresh SPAN content automatically -

i'm stuck in problem here tried google answers , nothing did work out. specially because prefer pure javascript solution if possible... have menu, cart. menu shows like: cart (0) 0 number of items inside cart. items number query sql table 'cart', save users products added cart. don't lose items on cart when session closes. want update menu span everytime add inside cart, without need refresh page. items being added way: in table products displayed have: <td id="add'.htmlspecialchars($row['id'], ent_quotes, 'utf-8').'"> <label><a href="javascript:addtocart('.htmlspecialchars($row['id'], ent_quotes, 'utf-8').')"><b><img src="/img/cart.gif" /></b></a></label> </td> so call javascript:addtocart passing 'id' of product parameter. function does: function addtocart(id) { document.getelementbyid('add'+id).innerhtml=...

Pointers in ABAP (like this in java) -

could tell me how define pointer in abap oo? in java have no problems it, eg. this.name or this.somemethod() . probably asking called self reference. in abap available using keyword me . example in java: this.somemethod(); example in abap: me->somemethod( ).

python - Mouse event in DrawingArea with PyGtk -

i want x , y coordinates when click on drawingarea. looking examples , found code following import gtk class ventana(gtk.window): def __init__(self): super(ventana, self).__init__() self.set_title('test') self.set_size_request(800, 600) self.set_position(gtk.win_pos_center) self.connect('destroy', gtk.main_quit) self.drawing_area = gtk.drawingarea() self.drawing_area.set_size_request(780, 500) self.drawing_area.modify_bg(gtk.state_normal, gtk.gdk.color_parse('white')) self.drawing_area.connect('button-press-event', self.on_drawing_area_button_press) fixed = gtk.fixed() fixed.put(self.drawing_area, 10, 10) self.add(fixed) self.show_all() def on_drawing_area_button_press(self, widget, event): print event.x, ' ', event.y def main(): ventana() gtk.main() if __name__ == '__main__': main() when r...

actionscript 3 - Which method is better for offline storage in flex -

i working in mobile application in need store data in offline. i've searched in web , found 3 methods store data offline. shared object sqllite database store in binary file now, know method offline storage in flex. if store large data video, audio , text in offline storage. and why method better storing data? i not used shared object, can tell use of each options shared object used store data object. sqllite database used storing textual data. binary file is more useful because performs , store large amount of data.

sql - Rails get records using date ranges -

this question has answer here: rails reports can't find column there 3 answers in rails application have table named jobtech , in table have 2 columns jobstartdate , jobfinishdate . want show job starting date today , jobs finishing date today. have tried lot things didn't solution. can tell how this? my table structure like: class createjobteches < activerecord::migration def change create_table :job_teches |t| t.integer :job_id t.integer :technician_id t.date :jobstartdate t.time :jobstarttime t.date :jobfinishdate t.time :jobfinishtime t.integer :dueby t.integer :jobscheduled t.timestamps end end end i have tried like: jobtech.where("jobstartdate >= ? , jobfinishdate <= ?", date.yesterday, date.today) try this jobtech.where("jobstartdate = ? ...

css - text-overflow:ellipsis with MathJax? -

is possible text-overflow:ellipsis work mathjax? here (non-working) example ( on jsfiddle ) the html: <!doctype html> <script src="http://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-ams-mml_htmlormml"></script> <div id="test"> \[ \text{2014-01-05} \quad \begin{cases} \text{lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum} \\ \text{lorem ipsum} \\ \text{lorem ipsum} \\ \end{cases} \] </div> <div id="test"> lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum </div> and css: #test{ display: inline-block; width: 20em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } as can see, text-overflow:ellipsis ...

c++ - What name lookup rule apply to the name in the definition of static const data member -

there quote described name lookup applied data member of const static data member after quialified-id of data member: sec. 3.4.1/13: a name used in definition of static data member of class x (9.4.2) (after qualified-id of static member) looked if name used in member function of x. but can define in-class static const data member: class { static const int = x;//x name defined arbitrary const int }; rule sec. 3.4.1/13 not apply name x lookup. what rule applied actually? please give reference corresponding clause standard. for instance, following code valid: #include <stdio.h> const int a=5; class { public: static const int b=a;//b unqualified-id of data-member }; int main(){ printf("%d\n",a::b); } //5 the following code valid: #include <stdio.h> class { public: static const int a=7; static const int b=a; }; int main(){ printf("%d\n",a::b); } //7 but following invalid: #include <stdio.h> class ...

c - How to see the output console (I.E. stdout) when debugging with Xcode 5? -

Image
i've searched questions asking this, i've seen many answers opening console i'm showing on screenshot, see console of command line debugger lldb, not application's output. printf line buffered , requires \n or flush force print output. if change code include following line after every printf work way want. printf("something want in console"); // either of next 2 lines should work putchar('\n'); fflush(stdout);

ruby on rails - Updating multiple check_box_tag in show page -

i trying update multiple check boxes in show page . stuck on how , lot of online has confused me. still rails noob. im using rails 4. *edit* the error missing template lottery/create, application/create {:locale=>[:en], :formats=>[:html], :handlers=>[:erb, :builder, :raw, :ruby, :jbuilder, :coffee]}. here controller page class lotterycontroller < applicationcontroller before_filter :authenticate_user, :only => [:new, :show,:update] def new @winner = lottery.pickwinner() end def show @conferences = conference.all #@lead = lead.all @leads = lead.new end def update end end and show.html.erb page controller <body> <%= form_tag %> <% @conferences.each |c| %> <table class = 'table table-striped table-responsive table-bordered table- condensed'> <h1> conference : <%= c.name %> </h1> <tr> <td><b>first name</...