Posts

Showing posts from January, 2015

php - Get Comments on Properties -

i wondering if possible (easily) in php comments on class' properties e.g.: /** * test class * * @param int $testid primary * @param string $name * @param int $age * @param char $gender * @param date $dob */ class test extends dataobject { /** * * want * */ public $testid = 0; public $name = ""; public $age = 0; public $gender = "m"; public $dob = ""; } i'm trying see if can comment property testid easily? see reflectionproperty::getdoccomment something like: $prop = new reflectionproperty('test', 'testid'); print $prop->getdoccomment(); there's no doccomment parser built in, wrote 1 here if you're interested.

processing - Arduino multi-dimensional array crash -

i have block of code effect: int piecex = 0; int piecey = 0; int board[8][47] = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}}; if (piecex > 0 &

uiimageview - Load image after the json is parsed and presented -

i know how load image without delaying user. i have been trying load image url, after view appear , user info showed, when user clicks button view showed without delay. thanks use nsurlconnection downloading: nsurlrequest* req = [nsurlrequest requestwithurl:url]; nsoperationqueue* q = [nsoperationqueue mainqueue]; [nsurlconnection sendasynchronousrequest:req queue:q completionhandler:^(nsurlresponse *resp, nsdata *d, nserror *err) { if (d) { uiimage* im = [uiimage imagewithdata:d]; // image } }]; the download happens on background thread, user not delayed , (most important) main thread not blocked; once download complete, completion handler happens on main thread safe stick image interface or set property or whatever.

R - My conditional and nested for loop take too long. How to vectorize? -

i have following code for loop contains conditional if-statement included last 10 loop cycles search change in logical pattern, , increment counter on true: for(ii in 100:sp) { if(start(ii) == 1 && mean(start(ii-11:ii-1)) == 0) { count = count + 1 } } the value of sp 3,560,400 ; meaning loop of 3 million plus times. load time enormous, 40 minutes execute loop. how can optimize code using perhaps vectorization? thank help. edit i have included of code here can see happening: # store current directory initial.dir<-getwd() # change new directory setwd("h:/r/range") # load necessary libraries - sound library(sound) library(ttr) ##################################################### # load .wav file / set output file ##################################################### # set output file sink("rangetmp3.out") # load dataset sndsample <- loadsample('range.wav') fs <- rate(sndsample) nbits <- bits(sn

In Django, how can I manually create users for my project? -

i process of users manually rather having automated registration process. have looked @ documentation , there command line facility creating super user. can create ordinary users command line or equivalent manual process? you can create user in django create_user() helper function comes django. can refer link more information available in django documentation. another way can dumping user lists directly in database. let if use mysql database, can dump data csv format mysql database.

Ruby Uninitialized Constant NameError for Class Name -

i want inherit sub-class parent-class. here code. 3 classes created in 3 separate files. class transportation #codes end class plane < transportation #codes end class boat < transportation #codes end and when running code, got error boat, no issue plane when have plane created: uninitialized constant transportation (nameerror) can me issue? thanks there no reason code fail, unless definition of transportation in file. if case, , these in different files, don't forget require file transportation class before other file usage in it. as mentioned, there 3 different files. you can create file has required libraries. perhaps in bin/transport_simulator.rb file. require 'transportation' require 'boat' require 'plane' now required in proper order, , files classes subclass transportation know class.

Powershell script to backup and replace files -

i'm working on project deployment tool automatically adds ".update" extension if same file exists on destination. e.g. root web.config web.config.update connection.config connection.config.update i perform following post-deploy via powershell: backup *.config. replace existing *.config *.update file. below desired ouput: root web.config web.config.update connection.config connection.config.update root web.config connection.config backup web.config connection.config could please how above achieved using powershell? the following code perform want. backs existing config files backup folder named based on current date. replace existing config files deleting them , renaming update files. $root_folder = 'c:\temp\root' # create backup folder $backup_directory = new-item -path "$root_folder\backup_$(get-date -format yyyymmdd)&quo

c# - Override event in UIElement initialization statement -

i created secondarywindow dynamically has windowstyle set none . hence, want set content dragmove-able overriding onmouseleftbuttondown . i not figure out how include override function within secondarywindow initialization statement public class mainwindow { window secondarywindow = new window { windowstyle = system.windows.windowstyle.none, content = new myusercontrol(), topmost = true, // failed attempt base.onmouseleftbuttondown += (object sender, mousebuttoneventargs e) => { base.onmouseleftbuttondown(e); base.dragmove(); } }; } your question more asked 'how add handler event in object initializer?'. 'object initializer' refers syntax this: foo newfow = new foo { foo.property = somevalue }; just make sure don't misunderstand something, onmouseleftbuttondown += smth not override event, adds event handler event. that being said: can&

jpa - How do you expose a Grails domain model using OData? -

ideally there plugin automatically exposed grails domain model odata can't see one. there odata4j let expose pojos or jpa odata uses jax-rs , jersey under covers , i'm not sure how use inside grails application. i use apache olingo . follow java example , modify groovy/grails such: class datacontroller { def action() { // create odata handler , configure demoedmprovider , processor def odata = odata.newinstance() def edm = odata.createservicemetadata(new demoedmprovider(), []) def handler = odata.createhandler(edm) handler.register(new demoentitycollectionprocessor()) // let handler work handler.process(request, response) return false } }

python - Django South: schemamigration hanging for model changes -

i following south tutorial . able steps under "the first migration" successfully. however, when modify schema , run schemamigration again: python manage.py schemamigration southtut --auto the command never completes. don't error messages. here's modification made model in south tutorial: class knight(models.model): name = models.charfield(max_length=100) of_the_round_table = models.booleanfield() foo = models.integerfield() # added field here's log of initial migration: $ python manage.py schemamigration southtut --initial creating migrations directory @ 'c:\users\jp\documents\project\southtut\migrations'... creating __init__.py in 'c:\users\jp\documents\project\southtut\migrations'... + added model southtut.knight created 0001_initial.py. can apply migration with: ./manage.py migrate southtut (django-test) jp@jp-pc ~/project $ (django-test) jp@jp-pc ~/project $ python manage.py migrate southtut running migrations sou

asp.net mvc - MVC4 - Uploading Image - Generic GDI+ Error -

i'm trying upload image , when try image.save(), "generic gdi+" error. great. // action handles form post , upload [httppost] public actionresult index(httppostedfilebase file, string filename) { // verify user selected file if (file != null && file.contentlength > 0) { string location = "~/content/images/specials/" + "rttest" + ".jpg"; bitmap bitmap = new bitmap(file.inputstream); image image = (image)bitmap; image.save(stream, system.drawing.imaging.imageformat.jpeg); image.save(location); } // redirect index action show form once again return redirecttoaction("index"); } the location of "~/content/images/specials/..." inaccessible gdi+ because isn't physical path. need use server.mappath() map virtual path physical path. string locat

ios - How to share the ViewController class in TabBar with NavigationController? -

since newbie in iphone development, need advice. app has 2 tabs which first tab show tables of items has lat/long , url. when select item in tables, show location callout in mapview. in mapview, selecting callout can show website in webview. second tab show items located on mapview @ 1 time. in mapview, selecting 1 callout , show website in webview. my storyboard layout is, navigationcontroller -> tabbarcontoller firsttab) tableview ->(segue"showdetail")->(*1 leads mapview of secondtab) secondtab) mapview ->(segue"showweb")-> webview mapview , webview of each tab shares same class. on storyboard, segue tableviewcontroller of first tab leads mapviewcontroller of second tab. first tab can show annotation on mapview, , show website on webview. second tab shows annotations on mapview when push callout of 1 annotation, exception throwed says 'could not find navigation controller

Setting up Point Cloud Library with Visual Studio -

i trying use point cloud library visual studio. downloaded all-in-one 64 bit installer, visual studio 10 , installed them. cannot run on visual studio 2010, have tried tutorial on official page no luck. i want add includes , lib location, .lib files in properties of solution. i have done before opencv, pcl don't know files , folders have add. also .dll files have add path of system variables. cmake didn't work, , prefer not use it. you have add include directories project @ project properties / configuration properties / vc++ directories / include directories field - here specify path pcl/include directory , 3rd party include directories (see pcl/3rdparty folder) you have add library directories on same settings page ( library directories field) - here specify path pcl/lib directory , non-header-only 3rd party libs (namely boost, flann, vtk) you have tell linker, libs use. can done on project properties / configuration properties / linker / input /

c - For a structure variable,why is the initializer {21,19,3.6} same as {{21,19},3.6},but not vice-versa? -

in following example,i've illustrated using 2 structures test1 , test2 .the first has 2 elements-an integer array sized two,and float element.the second structure has 3 elements,2 integers , 1 float. i initialize 2 structure variables s1 , s2 test1 as: s1={{23,52},2.5},s2={21,19,3.6}; both work fine though s2 have taken out braces enclose array elements.it works fine without warning , output correct.but when initialize 2 variables test2 follows: v1={{23,52},2.5},v2={21,19,3.6}; i incorrect output when try print out values of v1 , these warnings had got upon compilation: warning: braces around scalar initializer| warning: (near initialization 'v1.list1')| warning: excess elements in scalar initializer| warning: (near initialization 'v1.list1')| ||=== build finished: 0 errors, 4 warnings ===| based on premise,please clear following doubt arise: question: if using v1={{23,52},2.5} instead of v1={23,52,2.5} confuses compiler whether first

android - How do I parse the url in the given code to read as per the output defined in the code? -

i new android , want parse url using json . exceptions when run code , application says unfortunately myapp has stopped running. have posted logcat . want read course code:101, course title : "blahblah" semesters offered : semester 1, semester 2, semester 3 import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.net.httpurlconnection; import java.net.malformedurlexception; import java.net.url; import java.net.urlconnection; import java.util.arraylist; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.httpclient; import org.apache.http.client.responsehandler; import org.apache.http.client.methods.httppost; import org.apache.http.impl.client.basicresponsehandler; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.params.basichttpparams; import org.apache.http.params.httpparams; import org.json.jsonarray; import org.json.jsonexception; import org.json.jsonobje

Sorting on a count field in web2py -

i have following code in web2py. trying retrieve how many types of items have in table , count of how many of each of them there are. count = db.table.field1.count() rows=db((some criteria).select(db.table.field2, count, groupby=db.table.field2) print rows the print of is: table.field2, count(table.field1) 4,3 6,4 9,2 now sort high low count field, outcome be: 6,4 4,3 9,2 what's best way it? rows=rows.sort(lambda row: row.count(table.field1)) did not work me. instead of row.count(table.field1) , use row['count(table.field1)'] or row[count] (see here ). note, can have database sorting using orderby argument: rows = db(query).select(db.table.field2, count, groupby=db.table.field2, orderby=count) and descending order: orderby=~count

DOM onLoad event without jquery -

html code : <html> <head> </head> <body> <script type="text/javascript" src="/js/colorbook.js"></script> <script type="text/javascript"> book.init(); </script> </body> </html> js code : var book = (function(){ init = function(){ console.log ( "initialized") }return init(); }()); question : above code works. unable understand how?. can of js guys me here or guide me how should start debug code understand it. ok per comment. javascript have there executed sequentially browser reads incoming data stream. being said, javascript contained within first script tag executed. second script tag executed in sequence well. so right can @ book.init() being last provided javascript call executed. i tried js code in jsfiddle , not work check this fiddle see mean. what happening in js code last () @ end of var book declarati

autocomplete - Chrome not prefilling form -

i have form have chrome autofill or prefill (i'm using mac chrome 26.0.1410.65 on mountain lion). purpose of demonstrate autocomplete standards: i'd show either fields prefilled on load, or if user starts typing first name auto-fill both names. i'm using autocomplete , entire page below, 2 fields. i submit, next time visit page, have start typing each field drop-down auto-complete. no matter on first field, have tab second , start typing there. i'd fill in fields (well, both) when accept value in first field. how that? see happening in commercial websites, starting type in single field , pre-fills many other fields. (even if there yellow background) <!doctype html> <html> <head><title>autofill test</title></head> <body> <form name="nameform" action="?go" method="post"> <input type="text" name="givenname" autocomplete="given-name"

asp.net - Page redirection in multiple project under single solution -

Image
i have multiple web application under single solution - odcportal startup project. in odcportal home.aspx page in button event, trying redirect csp_home.aspx page. getting resource cannot found error. code - response.redirect(string.format("http://{0}/csp/csp_home.aspx", request.url.host)); response.redirect("~/odcportal/csp/csp_home.aspx"); nothing working me. please 1 me. in advance gulrej in case 2 project independent each other, redirection must use full url or must host them on iis , 1 of them virtual application of onther one. for iis configuration see asp.net , iis configuration , deploying asp.net websites on iis 7.0

iphone - iOS - Notified when wifi or network radios become active (not just available) -

i writing app needs 'phone home' every once , while not @ specific time . therefor wondering if there way register notified when either wifi or cell radios become active (not available) due other apps transferring data, piggy off these requests transmit data. i might misunderstanding functionality of iphone in general here. assumed radio entered low power (stand or sleep) mode when not being requested applications. feel reachability.h/.m initiate request connect host (such google.com) therefore waking radio , wasting energy. has apple not provided registration method triggers when radio 'wakes' , starts transmitting data application use opportunity transfer pending data without explicitly waking radio itself? thanks if app in foreground (running) make network call. since iphone won't let run in background, doesn't matter if there call describe. in app delegate implement applicationdidbecomeactive: make call home.

c++ - How to perform a deep copy of a char *? -

i'm little confused on how perform deep copy of char *. have: appointment(appointment& a) { subject = new char; *subject = *(a.subject); } appointment(appointment& b) { location = new char; *location = *(b.location); } char *subject; char *location; i'm trying perform deep copy of char pointers subject , location. work? if not, advice on how go doing this? since using c++ should using std::string string needs. the following code wrote appointment(appointment& a) { subject = new char; *subject = *(a.subject); } will not think do, above allocate 1 character ( new char ) assign first character of a.subject ( *subject = *(a.subject) ) in order copy string char* points must first determine string length, allocate memory hold string , copy characters. appointment(appointment& a) { size_t len = strlen(a.subject)+1; subject = new char [len]; // allocate string , ending \0 strcpy_s(subject,len,a.subject); } an alternati

iOS - Changing frame of a subview of a subclassed UIView (using storyboard with auto layout enabled) -

i building custom progress bar (subclass of uiview). add uiimageview uiview uses repeating images display progress. view added storyboard , can display fine, if try change frame displays whatever shown in storyboard file (i.e. if storyboard view has yellow background, code of uiview subclass changes green, if try change frame of uiimageview in code reflect current progress defaults yellow background) i tried using these no luck: [self updateconstraints]; [self layoutsubviews]; update i know need setup constraint use autolayout. however, needs done programmatically creating subclassed uiview way. here code trying, know close can't quite work: [self addconstraint: [nslayoutconstraint constraintwithitem:self.progressview attribute:nslayoutattributewidth relatedby:nslayoutrelationlessthanorequal toitem:nil attribute:nslayoutattributewidth

javascript - I want to use the gallery swipe in home page -

the thing that,how can use photoswipe javascript on page load rather when trigred tag. there way or have search alternatives? if understand question correctly change autostartslideshow: true because default set false stated in documentation of photoswipe. autostartslideshow: automatically starts slideshow mode when photoswipe activated. default = false

filtering data with check boxes using jquery -

i attempting filter div items depending on whether check boxes checked or not, default checked. i have managed filtering work struggling append error message if no results found (if no check box checked) no results found, please reset filter , search again i have placed code here http://jsfiddle.net/3wcdc/25/ thank in advanced can me, it's appreciated. html <div id="categorycontent"> <div class="product">brand1</div> <div class="product">brand2</div> <div class="product">brand3</div> <div class="product">brand4</div> <h2>brands:</h2> <input type="checkbox" name="brand" value="brand1"/>brand1 </br> <input type="checkbox" name="brand" value="brand2"/>brand2 </br> <input type="checkbox" name="brand" value="brand3"/>brand3

android - Seek Bar Increase Height -

i'm working seek bar works fine. want increase height of progress bar, native height not high. so wow can change height of progress bar, either dynamically or through xml? you can via xml. it work fine in application.do simple integration in xml have mentioned progress bar tag. first, need define style of progress bar in values->styles.xml of project. like: <style name="tallerbarstyle" parent="@android:style/widget.seekbar"> <item name="android:indeterminateonly">false</item> <item name="android:progressdrawable">@android:drawable/progress_horizontal</item> <item name="android:indeterminatedrawable">@android:drawable/progress_horizontal</item> <item name="android:minheight">8dip</item> <item name="android:maxheight">20dip</item> </style> edit maxheight desired height want achieve. then in progressbar add: androi

testing - How to practice with Xpath Match Assertion in SoapUI? -

Image
i have tested contains assertion without issues don't know how validate webservices using xpath match assertion in soapui. can please tell me how workout 'xpath match' assertion in soapui? i'm using json requests. updated: please find attachments 1) json response 2) assertion error message please tell me how validate identifier , please provide correct xpath expression , expected results thanks in advance! in xpath expression field need insert xpath expression =) , in expected result field need insert expected result of applying xpath expression response of request. for example, if response contains this: [ { "id": "112", "username": "user1", }, { "id": "233", "username": "user2", } ] and want verify, response contains user id = 112, need add in xpath expression //id[text() = '112'] , in expected result - 112

c# - JIT optimizations for dictionaries with value type keys -

are there optimizations done jitter avoid boxing , reject branches of code cannot taken depending on generic argument is? e.g. in default equality comparer used dictionary<int, tvalue> comparer implementation genericequalitycomparer<int> , understand because int implements iequatable<t> . equals method of comparer looks this: public override bool equals(t x, t y) { if ((object) x != null) { if ((object) y != null) return x.equals(y); else return false; } else return (object) y == null; } what jitted version of method like? in case t value type, can optimised comparing x y, , ignoring comparisons null? using custom comparer trivial implementation of equals , gethashcode(), worse performance dictionary default comparer! random benchmark noise, difference appeared quite consistent. public bool equals(int a, int b) { return == b; } public int gethashcode(int obj) { return obj; } even stranger when created reverse engi

javac - Execute two seperate classes with one single java command -

is possible execute 2 separate classes 1 single java command? i run few java programs concurrently (it should start @ same time) project. example: have 2 java programs a.java , b.java . compile javac a.java b.java run java b however doesn't work. how else can this? no, java command not work that. instead have c.java calls both a & b classes.

How to transliterate on c# .net 4.0? -

i new programming. these code: public string thanglishtotamillist(char[] characters, int length) { var dict1 = new dictionary<string, string>(); dict1.add("a", "\u0b85"); // அ dict1.add("aa", "\u0b86"); // ஆ dict1.add("a", "\u0b86"); // ஆ dict1.add("i", "\u0b87"); // இ dict1.add("ee", "\u0b88"); // ஈ dict1.add("i", "\u0b88"); // ஈ dict1.add("u", "\u0b89"); // உ ... list<string> list = new list<string>(); string[] array; var valueofdictone = ""; (int = 0; < length; i++) { try { valueofdictone = dict1[characters[i].tostring()]; list.add(valueofdictone); } catch { list.add(ch

c# - How do I get a list of found words using Lucene.Net? -

i have indexed documents. have content: document 1: green table stood in room. room small. document 2: green tables stood in room. room large. i'm looking "green table". find document1 , document2. want show phrases found. found in first document - "green table". found in second document - "greens table". how list of founds words ("green table" , "greens table")? i'm using lucene.net version 3.0.3. you can use highlighter mark "found words". if want find them reason can still use highlighter , using regex (or simple substring loop) extract words. for example: query objquery = new termquery(new term("content", strquery)); queryscorer scorer = new queryscorer(objquery , "content"); simplehtmlformatter formatter = new simplehtmlformatter("<b>","</b>"); highlighter = new highlighter(formatter, scorer); highlighter.textfragmenter = ne

in app purchase - How can we implement the "time-limited free" feature in Android app? -

my situation is, have implemented in-app billing product "remove ads" in app 0.99. now wanna make free in period of time advertisement. however, google play console not allow adjust product's price below 0.99. so, after survey, think implement feature server. i means, check users' account our server before calling google's in-app billing service. therefore question : above think, i'm not sure if there other better or easier solution issue? example, maybe no need server? or using own server way implement "time-limit free" feature? thanks you~! there 2 ways: if have own server can implement unique user , removes adds days if planning charge monthly/annually can implement subscription have trial period implemented google.

javascript - Swap multiple rows at same time using Jquery -

i have list of items , want set order of items in list. if select multiple items @ same multiple items should move respectively or down. i using code move , down. in case if first , third item selected returns false because adding check if previous current item null should not move , if next current not available should not move down. $('#selectedtab tr').each(function () { var currenttr = $(this).find('td.backgroundcolor').parent(); if (currenttr.text() == null) { } else { debugger; var previoustr = ""; if (obj.value == "move up") { previoustr = currenttr.prev(); //if (previoustr.length == 0) // return false; } else { previoustr = currenttr.next(); if (previoustr.length == 0) return false;

java - Using variable to specify the R object -

i'm new java. pardon me asking such simple question. to set background-image of view, can by int thebutton = r.drawable.button1; button.setbackgroundresource(thebutton); but how can done if want use variable specify r object? int = 1; int thebutton = r.drawable["button"+a]; //this i'll in javascript... button.setbackgroundresource(thebutton); try : string variable="button" + a; int button = getresources().getidentifier(variable, "drawable", getpackagename()); //whatever want do..

c# - Xml Signature for XmlElement fails to verify -

i apologize in advance rather lengthy block of code, it's smallest compilable example produce. omitted error checking original code. i'm using visual studio 2012 , .net 4.5, although nothing new 4.5, should work version. i trying sign xml documents' elements protect them tampering. don't want protect whole document, elements. maybe different elements different keys. however, when sign 3 example elements , try verify them, first 1 verifies, other 2 fail. make worse, first 1 succeeds if modify after being signed. have googled lot, read lot of tutorials , asked theoretical question here , don't have clue i'm doing wrong. can spot mistake? note: i'd more happy offer same bounty that's on friday's question solving this. the certificate created executing: "c:\program files (x86)\microsoft sdks\windows\v7.1a\bin\makecert" -r -pe -n "cn=xmldsig_test" -b 01/01/2013 -e 01/01/2014 -sky signing -ss my the test xml file is:

c# - Oledb Read False Value From Excel Sheet -

i trying read excel sheet already opened in window explorer using oledbreader following code system.data.oledb.oledbconnection mcon; mcon.connectionstring = ("provider=microsoft.ace.oledb.12.0;data source=" + openfiledialog1.filename + ";extended properties=\"excel 12.0;hdr=no;imex=1\";"); strselectquery = "select top 20 * [$sheet1]"; if (mcon.state == connectionstate.closed) { mcon.open(); } dataadapter = new system.data.oledb.oledbdataadapter(strselectquery, mcon); dataadapter.fill(mdtable); dataadapter.dispose(); mcon.close(); here reads 03-aug-12 41124 // excel column has genral format 07:29:19 0.31202546296 //excel column has genral format 359307046362750 3.5930704636e+014 // excel column has number format decimal place 0 if excel file closed reads value in correct format. why doing ?

Android sequence task -

i have code public class restaurantlistfragment extends listfragment { arraylist<restaurant> restaurants; sqldatahelper datahelper; gpstracker gps; public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { return inflater.inflate(r.layout.restaurant_list, null); } public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); // uses call gps service . if not enable . display dialog user . gps = new gpstracker(getactivity()); double userlatitude = gps.getlatitude(); double userlongitude = gps.getlongitude(); // want after user enable gps service . run code below . toast.maketext(getactivity(), userlatitude + " " + userlongitude, toast.length_short).show(); datahelper = new sqldatahelper(getactivity(), "restaurantdb"); restaurants = new arraylist<restaurant>(); datahelper.opendb(); cursor cursor = datahelper.quer

vba - MS Access GUI macro for starting external program? -

i having trouble finding information creation of ms access gui macro (vb) starting external program. suggestions? use shell() function: result = shell("c:\my\program\to\run.exe") see here more information.

multithreading - Why Unit test of WebServer project shows strange behaviour? -

i writing unit test of project http threadpooled web server . using junit in maven . in mean while stuck in 1 place, , doubt follows, there 1 class named webserver , task start server, makes threadpool, , starts listening on port client request. when make thread same, in test class under annotation @beforeclass , expected wait client request , comes out shows test completes. public class webservertest { @beforeclass public static void webserverstarter() { system.out.println("before class : webserverstarter"); new thread(new webserver()).start(); } @afterclass public static void webservercleanup() { system.out.println("after class : webserverstarter"); } } i don't understand why not waits client request. please me in writing unit test testing http threadpooled webserver. the @before executed before every single test. if want use 1 single webserver, make object!

r - Efficiently inserting default missing rows in a data.table -

suppose i've got following data.table : dt <- data.table(id=c(1,1,1,1,1,1,2,2,2,2), wday=c("mon","tue","wed","thu","fri","sat","mon","tue","thu","fri"), val=c(2,3,5,8,6,2,3,4,2,6)) id wday val 1: 1 mon 2 2: 1 tue 3 3: 1 wed 5 4: 1 thu 8 5: 1 fri 6 6: 1 sat 2 7: 2 mon 3 8: 2 tue 4 9: 2 thu 2 10: 2 fri 6 this result of aggregation of data.table . represents count ( val ) of variable depending on week day ( wday ) different individuals ( id ). problem is, during operations i've lost week days count 0. so question : how update data.table object efficiently inserting, each id, many rows there missing week days val=0 ? the result following : id wday val 1: 1 mon 2 2: 1 tue 3 3: 1 wed 5 4: 1 thu 8 5: 1 fri 6 6: 1 sat 2 7: 1 sun 0 8: 2 mon 3 9: 2

java - Value of 1024 has one bit more in binary representation that value of 1 -

the output of following code: system.out.println( long.tobinarystring( double.doubletorawlongbits( 1 ) ) ); system.out.println( long.tobinarystring( double.doubletorawlongbits( 1024 ) ) ); is: 11111111110000000000000000000000000000000000000000000000000000 100000010010000000000000000000000000000000000000000000000000000 why code prints 1 bit more value of 1024? why code prints 1 bit more value of 1024? this because leading 000000's dropped long.tobinarystring. double 64-bit, can have 63 leading zeros. e.g. 000000000000000000000000000000000000000000000000000000000000000000000001 printed 1

python - Can someone tell me what's wrong with the following code? -

everything works intended except when info2 written, "143f" line doesn't exist leads info2 not existing written format ruined. with open("saved") f: open("autolist","a") f1: line in f: ff=false if "062" in line: trim=line.find('"',64) info=line[64:endof] print info f1.write(info+":") if "143f" in line: trim=line.find('"',71) info2=line[71:endof] f1.write(info2+"\n") if line "143f" doesn't exist i'd want write "\n" instead of nothing. reason doesn't work. how's else clause: if "143f" in line: endof=line.find('"', 71) info2=line[71:endof] f1.write(info2 + "\n") else: f1.write('\n') or, since you're writing

xslt - Inline javascript in xsl -

i have have inline script in xsl stylesheet file problem xsl tries transform script , causes errors. <script id="template-upload" type="text/x-tmpl"> {% (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-upload fade"> <td class="preview"><span class="fade"></span></td> <td class="name"><span>{%=file.name%}</span></td> <td class="size"><span>{%=o.formatfilesize(file.size)%}</span></td> {% if (file.error) { %} <td class="error" colspan="2"><span class="label label-important">error</span> {%=file.error%}</td> {% } else if (o.files.valid && !i) { %} <td>

google chrome - How can I enable Cross-Origin data access with PageSpeed Service? -

Image
i have page uses html canvas , javascript extract colours image. i've ensured images pulled server directly, rather cdn. i've set server headers access-control-allow-origin:* . working until enabled google's pagespeed service. triggering script (clicking on 1 of icons) produces dreaded unable image data canvas because canvas has been tainted cross-origin data. error (it works fine when bypassing pagespeed however). i've disabled image hosting in pagespeed control panel, seemed work, morning i'm seeing error again. i've ensured .js file manipulates canvas excluded pagespeed optimizations. know can disable pagespeed url, seems rather heavy handed (especially so, given there pages below base url need optimizations, there's no way can see exclude 1 url while including subdirectories in pagespeed). how can find out what's triggering error? in other words, chrome think cross-origin data coming from?

c# - .NET javascript runtime with XML parsing/editing -

i have found javascript runtime .net ironjs, javascript .net or jurassic. seems none of them support xml parsing/editing. there's javascript engine .net supports xml? i have choose use 'xml < script>' javascript library pure javascript xml library. with can use .net javascript runtime xml parsing/editing, including library in runtime.

cocos2d iphone - Kobold2d: KKInput anyTouchEndedThisFrame -

the anytouchendedthisframe must buggy i´ve tried now, , reckonize touch that´s ended if move finger, if touch , let go @ same spot not reckonize it, if wrong please correct me -(void) moveobjecttonewposition:(kkinput *)input { if (input.anytouchendedthisframe) { [self touchesended:[input locationofanytouchinphase:kktouchphaseany]]; } if (input.anytouchbeganthisframe) { [self touchesbegan:[input locationofanytouchinphase:kktouchphasebegan]]; } it has never worked me, should implement method simple use -(void) cctouchesbegan:(nsset *)touches withevent:(uievent *)event { nsset *alltouches = [event alltouches]; uitouch * touch = [[alltouches allobjects] objectatindex:0]; cgpoint location = [touch locationinview: [touch view]]; location = [[ccdirector shareddirector] converttogl:location]; } -(void) cctouchesmoved:(nsset *)touches withevent:(uievent *)event { } -(void) cctouchesended:(nsset *)touches withevent:(uievent *)e

Difference between -D and -d environment variables in Java -

i understood how environment variables works in java, setting -dvariable , getting system.getproperty("variable"). i've seen examples "-d" variable using lowercase, , wonder what's difference between that? found no answer googling.. in advance java -help prints: -d= set system property if invoked -d prints error messages: unrecognized option: -d another option starting d: -dsa | -disablesystemassertions disable system assertions (this cannot used set variables).

topic modeling - The output of cvb in mahout 0.7 -

i'm running mahout 0.7 on hadoop 1.0.4. want see result of reuters dataset topic modeling task. however, i'm getting kinda useless result when use vectordump tools in mahout. i've read following set of instructions example: run cvb in mahout 0.8 . after executing vectordump tools, receive huge file in output contains following lines: {0.01:5.726429339702471e-12,0.05:6.196569958376538e-9,...} i'm not sure if actual output supposed see reuters dataset. the same thing has happened , solution simple: latest version in svn server: http://svn.apache.org/repos/asf/mahout/trunk that happens because there bug of vectorsize in mahout 0.7.

Creating temporary URL link in Opera browser -

window.url.createobjecturl() doesn't work in opera! want link video file html5 'video' tag selected via 'input file' html tag. i'm able link video in chrome, firefox, ie10 using window.url.createobjecturl() . there snippet can use solve problem. please me! try following snippet: if(navigator.getusermedia){ if(!window.url) window.url = {}; if(!window.url.createobjecturl) window.url.createobjecturl = function(obj){return obj;}; }

ruby on rails - MySQL - cannot log in to MySQL on Lion OS X -

i have installed rails app mysql database on lion os x. in config/database.yml database set user (root) + password. when try log in mysql terminal: mysql -uroot or mysql -u root , get error 1045 (28000): access denied user 'root'@'localhost' (using password: no) i tried set new password, got again same error message. how can log in terminal mysql , browse tables in databases? thanks