Posts

How to intercept KeyPressEvent in Java GWT? -

i new java , in our code using gwt. we using keypressevent process key_enter request. seems, each enter request, 2 events fired keypressevent . expect 1 event should fired, since enter 1 time. the following code. please check , let me know, need correct .. void onenter(keypressevent event) { if(event.getnativeevent().getkeycode() == keycodes.key_enter) { //(seems times code called) //domy stuff } } if use event.getcharcode() instead of event.getnativeevent().getkeycode() , returns 0. any idea how fix. thanks, i prefer using keyupevent because user can't distinguish keypressevent here solution: void onkeyup(keyupevent event) { if(event.getnativekeycode() == keycodes.key_enter) { // handle key press } }

Transferring file using sockets from C++ application to Java application -

i'm trying transfer file using sockets c++ application java application. wrote simple code in c++ send file: int main() { int sock; struct sockaddr_in sa; char* memblock; /* create socket on send. */ sock = socket(pf_inet, sock_dgram, ipproto_udp); if (sock < 0) { printf("opening datagram socket"); exit(1); } /* construct name of socket send to. */ sa.sin_family = af_inet; sa.sin_addr.s_addr = htonl(0x7f000001); sa.sin_port = htons(4444); /* send messages. */ file *file; unsigned long filelength = 0; file = fopen(file_path, "rb"); if (!file) { printf("error opening file.\n"); return 1; } // file length. fseek(file, 0, seek_end); filelength = ftell(file); printf("file length is: %d.\n", filelength); fseek(file, 0, seek_set); memblock = (char*)malloc(sizeof(char)*filelength); if (memblock == null) {fputs...

java - HttpConnection - javax.microedition, returning -1 for getLength() method -

i trying program simple mobile application (j2me) in java. idea access website via url input , read contents of website buffer. here's problem. works fine url's not others? example below (wikipedia) works fine. take "http://java.com/en/about/" example , "httpconnection hc" returns -1 getlenght() there no content read buffer? here's code: string url = "http://en.wikipedia.org/wiki/rss"; //sets httpconnection , inputstream using url variable httpconnection hc = null; inputstream = null; try { hc = (httpconnection) connector.open(url); = hc.openinputstream(); } catch (ioexception ie) { system.out.println(ie.getmessage()); } //reader object created read input inputstream reader rdr = new inputstreamreader(is); //variable "content" store html code string content = ""; //get lenght of d...

ios - How to compare two case insensitive strings? -

i have 2 string objects containing same string case different,now wanna compare them ignoring case sensitivity,how that??here code... #import <foundation/foundation.h> void main() { nsstring *mystring1 = @"mphasis"; nsstring *mystring2 = @"mphasis"; if ([mystring1 caseinsenstivecompare:mystring2]) { nslog (@"its equal"); } else { nslog (@"its not equal"); } } if caseinsensitivecompare: in docs you'll see returns nscomparisonresult rather bool. in docs , you'll see want nsorderedsame. if ([mystring1 caseinsensitivecompare:mystring2] == nsorderedsame) should trick. or compare lowercase strings robert suggested.

How to create a Blackberry notification message that opens the app like twitter does? -

Image
does know actual code create local notification in blackberry app has customized application icon , when user clicks on notification in inbox, goes directly specific page in application? similar how twitter blackberry works, whereby can notified of new tweets via inbox , on clicking on link brings tweets list in twitter app. thanks. what you're looking referred message list integration or message folders. note name "message folder' little misleading. isn't create "folder" user has go (that threw me off first); rather creates message in inbox describe. best user experience you'll want create application notification icon . the package name concern net.rim.blackberry.api.messagelist . need implement applicationmessage you've requested. there example of how in sample source code ships jde, project name "messagelistdemo". jdes dating (at least) os 4.5 have sample app. if want use new notification bar integration os6, make ...

erlang - Nitrogen - Dynamically creating Events -

i beginner erlang/nitrogen. toying bidding system mnesia db. on index page have following code , various items , properties created dynamically database: %% -*- mode: nitrogen -*- -module (index). -compile(export_all). -include_lib("nitrogen/include/wf.hrl"). main() -> #template { file="./site/templates/bare.html" }. title() -> "meir panim gala dinner silent auction". body() -> header = [#panel{id=header, body=[#h1{text="meir panim gala dinner silent auction"}]}], {atomic, items} = item_database:get_all(), elements = lists:map(fun(x) -> {item, index, title, _, picture, _, _, reserve, currentbid} = x, #panel{id=items, body=[ #span{id=title, text=title}, #image{id=image, image= "images/" ++ picture}, #span{id=currentbid, text="current bid: £" ++ integer_to_list(currentbid)}, #span{id=reserve, text="reser...

asp.net mvc - MVC3 - Reading GET Variables Into Controller Action -

i have controller action /responses/insert , want able variables url , save them database. the url this: /responses/insert?pass=blah&msisdn=blah&sender=blah&message=blah&dca=blah&msg_id=blahsource_id=blah here model: public class response { public int responseid { get; set; } public string msisdn { get; set; } public string sender { get; set; } public string message { get; set; } public string dca { get; set; } public string msg_id { get; set; } public string source_id { get; set; } } can offer advice on how code controller action? // // get: /response/insert public actionresult insert() { return view(); } thanks much! paul edit 1 - solved (thanks lukled) public actionresult insert(response response) { if (modelstate.isvalid) { responserepository.insertorupdate(response); responserepository.save(); return redirecttoaction("index"); ...