Posts

java - object oriented programming in android -

i want use method in 1 of classes in class , code doesn't have error when run project "unfortunately project * hast stopped" error. , when copy method instead of creating object , on run program without problem , can 1 tell me may problem ? public void onclick(view arg0) { string p = "+989357835774"; string m = "test"; sendsms sms = new sendsms(); sms.sms(p, m); } public class sendsms extends activity { public void sms (string phonno , string message){ pendingintent pi = pendingintent.getactivity(this, 0, new intent(this, sendsms.class), 0); smsmanager sms = smsmanager.getdefault(); sms.sendtextmessage(phonno, "+9891100500", message , pi, null); } } these errors : 08-23 19:31:00.065: e/androidruntime(9985): fatal exception: main 08-23 19:31:00.065: e/androidruntime(9985): java.lang.nullpointerexception 08-23 19:31:00.065: e/androidruntime(9985): ...

time - Creating a timer in python -

import time def timer(): = time.localtime(time.time()) return now[5] run = raw_input("start? > ") while run == "start": minutes = 0 current_sec = timer() #print current_sec if current_sec == 59: mins = minutes + 1 print ">>>>>>>>>>>>>>>>>>>>>", mins i want create kind of stopwatch when minutes reach 20 minutes, brings dialog box, dialog box not problem. minutes variable not increment in code. you can simplify whole program using time.sleep : import time run = raw_input("start? > ") mins = 0 # run if user types in "start" if run == "start": # loop until reach 20 minutes running while mins != 20: print ">>>>>>>>>>>>>>>>>>>>>", mins # sleep minute time.sleep(60) # increment minute total mins += ...

ajax - Is it possible to do long polling with XPages? -

the title question, can long polling domino xpages? instead of polling server, query takes place again when first 1 times out. you want deploy own servlet implement this. xpages being based on osgi allows in form of plugin full access user session.

java - Getting some data from HTML using regex -

i trying data html. code: public static void main(string[] args) { final string str = "<div class=\"b-vacancy-list-salary\">\n" + " 50 000\n" + " 70 000\n" + " usd.\n" + " </div>"; system.out.println(arrays.tostring(gettagvalues(str).toarray())); } static final string tag = "<div class=\"b-vacancy-list-salary\">\n"; private static final pattern tag_regex = pattern.compile(tag+"(.+?)</div>"); private static list<string> gettagvalues(final string str) { system.out.println(tag); final list<string> tagvalues = new arraylist<string>(); final matcher matcher = tag_regex.matcher(str); while (matcher.find()) { tagvalues.add(matcher.group(1)); } return tagvalue...

ios - How to see if object is contained in an embedded NSArray, then grab the other items in the set -

i have nsarray contains many nsarrays, each containing pair of nsstrings such following: [["a", "b"], ["u", "a"], ["x", "y"], ...] , , interested first checking see if contains particular object, , grabbing other paired object , putting in array. example, if checking "a" in above array, result array contain ["b", "u"] i know how iterate on each array, trouble deciding how grab paired object inside array... thanks! for (nsarray *innerarray in outerarray){ if ([innerarray containsobject: @"a"]){ //how extract other object , save array? } } if you're sure data have structure describe, can use fact inner array have 2 element - index of "other" element 1-indexofyourelement: for (nsarray *innerarray in outerarray){ nsuinteger ix = [innerarray indexofobject:@"a"]; if (ix!=nsnotfound){ id objecttoadd = innerarray[1-ix]; ...

uiview - Unable to display view when I call it from a separate ViewController in iOS -

i have view controller in application on screen have uiview user required tap on. when that, want call viewcontroller's view, , display on screen user. unfortunately, having trouble displaying view. the name of viewcontroller making call called "mainviewcontroller", , viewcontroller view wish display called, "nextviewcontroller" here code make call: - (void) touchesbegan:(nsset *)touches withevent:(uievent *)event { nslog(@"i touched."); _nextview = [[nextviewcontroller alloc] init]; //this code not being called [self.view addsubview:_nextview.view]; //neither being called } where _nextview property declare in .h file of mainviewcontroller. this method being called, reason because able see log statements print output, reason unable call lines after that. can see i'm doing wrong? thanks in advance reply. you shouldn't add view of view controller view without making view controller child view con...

excel - Skip rows with blank cell in particular column -

please advise me how change code select rows if have value in bc column (ignore complete row if cell in bc column blank): private sub commandbutton3_click() range("a:a,b:b,c:c,e:e,bc:bc").select selection.copy workbooks.add selection.pastespecial paste:=xlpastevalues, operation:=xlnone, skipblanks:=true, transpose:=false selection.pastespecial paste:=xlpasteformats, operation:=xlnone, skipblanks:=true, transpose:=false end sub first run code is. perform row deletions in added workbook: sub dural() dim n long, long, r range n = cells(rows.count, "bc").end(xlup).row = n 1 step -1 set r = cells(i, "bc") if isempty(r) r.entirerow.delete end if next end sub