Posts

Showing posts from April, 2014

Specifying Sd card mountable as removable disk in android manifest -

my android app requires device has sdcard , sdcard mountable on pc or mac filesystem (removable disk) . because there program windows mobile app writes sd card user has run pc , program works on files on mounted sd card , disks on pc windows. this problem on tablets because not of them can mount sdcard removable disk on pc without requiring special drivers on pc tablet. majority of ics phones pc seems mount disk removable storage limit app api 8 - api15 (phones only) is there way specify in manifest of android app app should work ics android phone , not ics tablets users having tablets can not download android market ? thanks, you try specifying screen sizes in manifest file http://developer.android.com/guide/topics/manifest/supports-screens-element.html . reason it's hard differentiate because tablets , phones run same software. might want why devices don't mount removable disks.

write data to excel file in java using apache POI -

i having problem here while writing data excel sheet using apache poi. want call function several times write data excel sheet have created. is there way can move pointer next row every time @ end of function??? my code given below... public static void excellog(string filename , string message) { string dest="d:\\testexcel.xls"; hssfworkbook myworkbook = new hssfworkbook(); hssfsheet mysheet = myworkbook.createsheet(); hssfrow myrow = null; hssfcell mycell = null; string exceldata [][] = new string [1][2]; exceldata[0][0]=filename; exceldata[0][1]=message; myrow = mysheet.createrow(rownum); (int cellnum = 0; cellnum < 2 ; cellnum++){ mycell = myrow.createcell((short) cellnum); mycell.setcellvalue(exceldata[rownum][cellnum]); } rownum++; try{ fileoutputstream out = new fileoutputstream(dest); myworkbook.write(out); out.close(); }catch(exception e){ e.pri...

How to export users from oracle database. (Oracle 10g express edition) -

Image
i trying export user database, showing but if trying export entire database completing. want export 1 user. how fix problem oracle character set. thanking you! to export 1 user can type following: exp system/<system_password>@<database> file=<user>.dmp owner=<user> the export utility ask no further questions.

javascript - Overriding jquery .load() function - handle callback -

i have overloaded .load() funciton of jquery meet crossdomain requirements. (function ($) { var _load = $.fn.load; $.fn.load = function(url, params, callback) { if (url.match('^http')) { $(this).load("read_page.php?p="+url); return this; } else{ return _load.apply(this, arguments); } } })(jquery); the "read_page.php" calls php curl page crossdomain. the part of code calling above overrided function is: $(trg).load(user_folder+shw+qs, function(){ showerr("updation successfull", trg); $(".diverr").css("border-color","#4f8a10"); $(".diverr").css("background","url(images/img_suc.png) no-repeat 10px 50%, left;"); $(".diverr").css("background-color","#dff2bf"); ...

Linq to ... and Lambda Expressions -

i have big question has been puzzling me long time , can't seem straight answer anywhere , sure if can answer authority , examples not me thousands of developers come. want know characteristics of following concepts , differences between them linq linq sql linq entities linq objects lambda expressions also, in particular, can tell constructs such these fall above categories construct 1 var result = n in nums n < 5 orderby n select n; construct 2 entities.person.where(p => p.firstname == "john").first(); your learned clarifications eagerly awaited. i'm sure there over-simplifications here, it's worth: linq api designed dealing data sets. iqueryable , instance, comes system.linq namespace. linq ... different implementations parse same linq instructions perform different operations based on how data stored. linq sql parse .where instruction produce sql query where clause, while ...

objective c - CGContextStrokePath triggers EXC_BAD_ACCESS in iOS > 5 -

this question has answer here: assigning existing cgcolor cgcolor property works in ios simulator, not ios device. why? 3 answers i have custom uibutton class adds gradient , gloss effect uibutton code works in ios 4 , on ios5 simulator when run on ios 5 devices gives me exception exc_bad_access , exception triggered line : cgcontextstrokepath(context); any appreciated , here's code - (void)drawrect:(cgrect)rect { cgcontextref context = uigraphicsgetcurrentcontext(); cgfloat actualbrightness = _brightness; if (self.selected) { actualbrightness -= 0.10; } cgcolorref blackcolor = [uicolor colorwithred:0.0 green:0.0 blue:0.0 alpha:1.0].cgcolor; cgcolorref highlightstart = [uicolor colorwithred:1.0 green:1.0 blue:1.0 alpha:0.7].cgcolor; cgcolorref highlightstop = [uicolor colorwithred:0.0 green:0.0 blue:0.0 alpha:0.0]....

How to display only specific div with python webkit -

i got: self.webview = webkit.webview() self.scrolledwindow = self.builder.get_object("scrolledwindow") self.scrolledwindow.add(self.webview) self.webview.open(advsearchuri) self.webview.show() and it's displaying whole site right, want show content's of specific div , hide rest. simplest way this? using execute_script can inject javascript webview. show or hide divs would: js_code = "document.getelementbyid('foo').style.display = 'none';" self.webview.execute_script(js_code)

uislider - Custom MPVolumeView Thumb Image not vertically centered since iOS 5.1 -

Image
i'm building application needs mpvolumeview control volume. worked before ios 5.1 since 5.1 update thumb image no longer vertically centered. tried few things changing imagine dimensions, resizing views (and slider) nothing seems work, thumb not vertically centered anymore. way centered thumb if use default ios one. i tried adding uislider view exact min, max , thumb image , 1 centered fine. here code mpvolumeview: mpvolumeview *volumeview; volumeview = [[[mpvolumeview alloc] initwithframe:volumeviewholder.bounds] autorelease]; [volumeviewholder addsubview:volumeview]; uiview *volumeviewslider; (uiview *view in [volumeview subviews]) { if ([[[view class] description] isequaltostring:@"mpvolumeslider"]) { volumeviewslider = view; } } [(uislider *)volumeviewslider setthumbimage:sliderhandleicon forstate:uicontrolstatenormal]; [(uislider *)volumeviewslider setminimumtrackimage:lefttrackimage forstate:uicontrolstatenormal]; [(uislider ...

java - Using JBoss ESB, how do I get multiple objects out of smooks and use them as params to an ejb? -

this part of jboss-esb.xml file: <action name="hotelavailrq_to_hotelavailrequest" class="org.jboss.soa.esb.smooks.smooksaction"> <property name="smooksconfig" value="requestconverters/hotelavailrq_to_hotelavailrequest.xml" /> <property name="resulttype" value="java" /> <!-- <property name="javaresultbeanid" value="hotel" /> --> <!-- <property name="set-payload-location" value="map" /> --> <property name="mappedcontextobjects" value="hotel,daterange" /> <property name="reportpath" value="c:\documents , settings\barrowj\esb-workspace\esb\smooks-in-report.html" /> </action> <action name="print-result" class="org.jboss.soa.esb.actions.systemprintln" > <property name="message" ...

jquery - Next/previous item on iPad -

i'm using fancybox 2.0 display photo galleries. ok on browser, next/previous arrows can clicked change pictures. however behaviour quite not on ipad: 1 touch required display arrows , second 1 required go next/previous picture. is there way use "native" way on ipad (swipe left/right) expected result? help. jz

Powershell test if executable in path -

in script i'm run command pandoc -ss readme.txt -o readme.html but i'm not sure if pandoc installed. (pseudocode) if (pandoc in path) { pandoc -ss readme.txt -o readme.html } how can real? you can test through get-command (gcm) if (get-command "pandoc.exe" -erroraction silentlycontinue) { pandoc -ss readme.txt -o readme.html } if you'd test non-existence of command in path, example show error message or download executable (think nuget): if ((get-command "pandoc.exe" -erroraction silentlycontinue) -eq $null) { write-host "unable find pandoc.exe in path" } try (get-help gcm).description in powershell session information get-command.

objective c - Backup complete iPhone AdressBook programmatically -

i need backup contacts records (numbers, names, image, ...) programmatically. read adressbook.framework, there easy way make backup contacts? 1.one way of doing create vcard string contacts. this: abaddressbookref addressbook = abaddressbookcreate(); cfarrayref peopleforbackup = abaddressbookcopyarrayofallpeople(addressbook); cfdataref vcards = (cfdataref)abpersoncreatevcardrepresentationwithpeople(peopleforbackup); vcardstring = [[nsstring alloc] initwithdata:(nsdata *)vcards encoding:nsutf8stringencoding]; and write string file backup. 2.delete current contacts address book: abaddressbookref addressbook = abaddressbookcreate(); cfarrayref people = abaddressbookcopyarrayofallpeople(addressbook); int arraycount = cfarraygetcount(people); abrecordref abrecord; (int = 0; < arraycount; i++) { abrecord = cfarraygetvalueatindex(people, i); abaddressbookremoverecord(addressbook,abrecord, null); } cfrelease(people); 3.to restore backup read vcard file strin...

mysql - SQL select query about grouping 2 columns -

i trying head around query - seems pretty straight forward the table below captures user watched video topic_user_id | topic_id | user_id 1 | 10 | 3 2 | 10 | 4 3 | 11 | 5 4 | 11 | 3 5 | 12 | 6 6 | 13 | 6 7 | 14 | 7 8 | 11 | 8 9 | 11 | 9 10 | 14 | 10 11 | 15 | 11 12 | 16 | 11 13 | 17 | 11 now find out how many users watched particular video - have following query. how many users have watched particular video select count(distinct(user_id)) 'number of users',topic_id topic_user user_id not null group topic_id output number of users | topic_id 2 | 10 4 | 11 1 | 12 1 | 13 2 | 14 1 | 15 ...

objective c - Does "alloc" methods produce an instance ? -

when write: myclass *obj = [[myclass alloc]init]; i can split in 2 parts: [myclass alloc] --->> produce something [theproduct init]; so alloc class methods , being init instance method suppose must called on instance...in case result of [myclass alloc] . i'm confused that. are conjectures correct? +alloc allocates , zeroes memory instance of class. instance uninitialized —it's not ready used object until initialize -init or related.

Which equality test does Ruby's Hash use when comparing keys? -

i have wrapper class around objects want use keys in hash. wrapped , unwrapper objects should map same key. a simple example this: class attr_reader :x def initialize(inner) @inner=inner end def x; @inner.x; end def ==(other) @inner.x==other.x end end = a.new(o) #o object allows o.x b = a.new(o) h = {a=>5} p h[a] #5 p h[b] #nil, should 5 p h[o] #nil, should 5 i've tried ==, ===, eq? , hash no avail. hash uses key.eql? test keys equality. if need use instances of own classes keys in hash, recommended define both eql? , hash methods. hash method must have property a.eql?(b) implies a.hash == b.hash. so... class attr_reader :x def initialize(inner) @inner=inner end def x; @inner.x; end def ==(other) @inner.x==other.x end def eql?(other) self == other end def hash x.hash end end

css - hr makes the parent div resize to 100% in IE7 -

Image
i have following div <body> <span style="border:1px solid red; display:inline-block"> text<br /> <hr /> more text </span> </body> in "normal" web browsers, width of div calculated fit text. , hr 100% of div. but in ie7 hr causes div expand 100% of body. is there clever css need add somewhere behaves correctly in ie7? please note, can't set fixed width. the width property of <hr> tag has been deprecated, you're styling options limited on <hr> tag. 15.3 rules: hr element index of attributes a more modern approach use border property of <div> instead. image rendered ie 7: image rendered chrome 19: jsfiddle demo html <body> <div style="border:1px solid red; float:left;"> <p> text </p> <p class="border-top"> more text </p> </div> </body>​​​ css ...

list - C# dictionary keeps erasing values after every iteration -

so have problem... trying consolidate 5 or bilingual dictionaries, in html format, single, multilingual dictionary, english source language. this, decided set dictionary, , map each non-english word it's english counterpart(key) [see code below]. 1 public void consolidatedictionary(string directorypath) 2 { 3 directoryinfo directory = new directoryinfo(directorypath); 4 string key = string.empty; 5 string value = string.empty; 6 dictionary<string, list<string>> languages = new dictionary<string, list<string>>(); 7 list<string> temp = new list<string>(); 8 foreach (fileinfo file in directory.enumeratefiles()) 9 { 10 htmldocument doc = new htmldocument(); 11 doc.load(file.fullname); 12 13 foreach (htmlnode node in doc.documentnode.selectnodes(".//wordunit")) 14 { 15 foreach (htmlnode child in node.selectnodes(".//word")) 16 { 17 if ...

Google Review on my Website -

i wondering if knows of way feed google reviews website? kinda of testimonial type page. or if feed slider reviews awesome. ideas? i needed reviews similar application, created jquery plugin fetch reviews , allows options passed in filtering. google-places jquery plugin this question kind of old maybe else

dynamics crm 2011 - How to perform an ODATA expand in LinqPad -

i'm using linqpad connect odata services on local crm organization , don't know how perform "joins" or traverse relationships using linqpad. here url organizationdata.svc/new_locationset?$select=new_state_new_location/new_region$expand=new_state_new_location which works fine in browser. here i'm doing in linqpad: from l in new_locationset s in l.new_state_new_location select s.new_region but i'm getting error: an expression of type 'linqpad.user.new_state' not allowed in subsequent clause in query expression source type 'system.data.services.client.dataservicequery<linqpad.user.new_location>'. type inference failed in call 'selectmany'. any ideas? i've found linqpad odata documentation extremely lacking... you need project out want expand, e.g.: from p in products select new {p.name, categoryname = p.category.name} or products.select(p => new { p.name, categoryname = p.category.name}) w...

android - Dialog themed activity : postive and negative buttons -

i'm trying theme activity alertdialog . problem i'm facing can't find way put 2 buttons on bottom of window positive , negative buttons of alertdialog i've added line activity in manifest (i'm using sherlock library): android:theme="@style/theme.sherlock.dialog" and activity looking dialog, can't find theme set on buttons. have idea of ? alright, if you're developping application hc/ics, without sherlock, answer here : https://gist.github.com/2348305 just theme using style="?android:attr/buttonbarstyle" for container, style="?android:attr/buttonbarbuttonstyle" for buttons and android:divider="?android:attr/dividerhorizontal" android:showdividers="middle" for root layout

xcode - Add Distance from current location to NSMutableArray -

i'm trying load distance current location array, seem missing something. tableview shows "?", should show if currentloc not working, nslog showing correct location. please help update: must have deleted reload tableview, fixed "?", 0.00 km. still missing something. currentloc correct inside locationmanager, lose when try calculate distance in array. #import "authorviewcontroller.h" #import "author.h" #import <sqlite3.h> @implementation authorviewcontroller @synthesize theauthors; @synthesize currentloc; - (void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { currentloc = newlocation; if (newlocation.horizontalaccuracy <= 100.0f) { [locmgr stopupdatinglocation]; } nslog(@"lat: %f, long: %f", currentloc.coordinate.latitude, currentloc.coordinate.longitude); [self.tableview reloaddata]; } - (void)locationmanager:(cllocati...

Can Git differentially store GZip files? -

does git store text compressed gzip binary files or can tell it's text , store changes between updates files? git not attempt binary files. in fact, doesn't attempt text files. doesn't store updates @ all. store full contents of every single file, delta-compression across entire object store. data that's stored on-disk in fact updates (hence "delta-compression"), git sees full files. that said, no, git not attempt decompress gzipped-compressed files in order re-compress itself. means text that's compressed gzip have same performance other compressed format (e.g. images), say, there won't savings.

bash - Restart a bunch of servers, keeping only a few down during the restart -

consider following script: for host in $(get-all-hosts) (restart-server $host; wait-for-server-to-come-up $host) & done as might guess, restart-server restarts server , command wait-for-server-to-come-up blocks until server (e.g., grep -m 1 'server up' <(tail -f /path/to/log) ). this script restarts servers simultaneously. i'm curious what's simplest way modify script stop after fixed number of servers, , wait 1 server come before proceeding next restart maximum of, say, 4 servers down @ given time. 1 way know of doing restart in chunks of 4 , wait on of pids in each chunk, i'm hoping it's not hard smarter. some scratch work toward solution: second try, using ideas dennis's link. ideal vanilla bash solution: mkfifo mfifo exec 3<>mfifo echo >&3 echo >&3 echo >&3 host in $(get-all-hosts) read (restart-server $host; wait-for-server-to-come-up $host; echo >&3) & done <&3 my biggest rem...

javascript - This is a conditional statement with 2 conditions, I need to add a 3rd -

first, not js apologies in advance noob question. like title says, have line: stringvalue = numericvalue >= 1000 ? numericvalue.tostring().substr(0, numericvalue.tostring().length - 3) + "tb" : numericvalue + "gb"; basically, if value on 1000, appends "tb", , under 1000 appends "gb". need third condition if it's under 50 gets rid of text altogether. i can see if/else statement, can't quite decode , figure out how add in third condition. in advance! this should work: stringvalue = numericvalue >= 1000 ? numericvalue.tostring().substr(0, numericvalue.tostring().length - 3) + "tb" : (numericvalue > 50 ? numericvalue + "gb" : numericvalue);

asp.net - Update one cell after adding the new row with same values in gridview -

Image
i want make shopping cart datatable, wrote following code here make list of products public datatable shoppingcartlist(string proname , string country, string area ,string address,int quantity,decimal price,datetime date) { datatable dt = new datatable(); if (httpcontext.current.session["shoppinglist"]==null) { dt.columns.add("proname"); dt.columns.add("odate"); dt.columns.add("ocountry"); dt.columns.add("oarea"); dt.columns.add("oaddress"); dt.columns.add("quantity"); dt.columns.add("price"); dt.columns.add("subtotal"); dt.constraints.add("proid_pk", dt.columns[0], true); } else { dt = (datatable)httpcontext.current.session["shoppinglist"]; datarow dr = dt.newrow(); dr[0] = proname; dr[1] = date; dr[2] = country; dr[3]...

jsf - Session bean gets lost on HTTPS-DNS combo -

i have application goes this f5 load balancer - ihs(a&b) - websphere 7(a&b) - jsf when try log app via https-dns (which works fine via http) session bean gets lost, i'm out of ideas of possibly causing if access app via https-dns in firefox or chrome bean there , beautiful, bean gets lost (null) in ie7/8. besides (i dont know if relevant or no) if access via https-ip app works fine in ie7/8. its worth mentioning have no control on configuration of of layers, im developer , im trying figure out since (obviously) people of layer's support tell me "its not our problem, app" without brief check of conf, despite same ear gets deployed 2 identical environments (dev-testing) , in latter acting weird. any light on appreciated, thank you. just let know problem was: turns out problem session cookie wasnt been stored in ie, , after lot of google magic, found out the dns cannot have underscores on it and changing dns from mysite_testing to ...

c - Need explanation for the output -

possible duplicate: could explain these undefined behaviors (i = i++ + ++i , = i++, etc…) #include<stdio.h> void main() { int a=5; printf("%d\t%d\t%d\n",a,a++,++a); } output of above program showing 7 6 7 in gcc version 4.4.3 (ubuntu 4.4.3-4ubuntu5). why showing instead of 7 6 6 ? your program can show likes , output correct. the behaviour undefined; allowed happen. what's undefined? incrementing a twice in argument list printf() . the behaviour of void main() @ best implementation-defined. return type of main() should int . iso/iec 9899:2011 (c 2011) standard § 6.5 expressions ¶2 if side effect on scalar object unsequenced relative either different side effect on same scalar object or value computation using value of same scalar object, behavior undefined. if there multiple allowable orderings of subexpressions of expression, behavior undefined if such unsequenced side effect occurs in of o...

Android chat/MUD client - WCF or Socket viable? -

i trying create text-based multiplayer game android (similar oldschool muds). have basic wcf service working - can make request on android app , server responds blob of xml data. however, unsure if workable strategy down road - if using wcf, limited app side number , frequency of requests make server. socket connection seem provide duplex communication need unsure how implement (and i've read android may not support duplex socket communication describe?). in case, guidance here appreciated. how reasonably hope poll wcf service android phone on 3g? fast enough chat between multiple users through server? is there android socket code can into? can host own socket server using either visual studio (iis?) or eclipse?

ms word - OpenTBS and Special Characters (PHP) -

i'm using opentbs modify word templates php. need update strings in word document values have in mysql database. working well, when have special characters such é, à, ô, outputs sequence of weird caracters. for example é gives me é. anybody knows how fix that? thanks by default, opentbs assumes data merged ascii encoded. data utf-8 encoded, have specify when loading template. example: $tbs->loadtemplate('document.docx', opentbs_already_utf8); you have check php script utf-8 encoded. more details given in manual .

javascript - How to select latest checked radio button in multiple radio buttons with jQuery -

in from, how select jquery latest radiobutton selected user <form id = "myform"> <h3>time work?</h3> <p> <input type="radio" name="work" value="hourly" /> <input type="radio" name="work" value="daily" /> <input type="radio" name="work" value="weekly" /> </p> <h3>your age?</h3> <p> <input type="radio" name="age" value="old" /> <input type="radio" name="age" value="young" /> <input type="radio" name="age" value="child" /> </p> </form> i tried $('input:checked', '#myform').val(); and $('input[type='radio']:checked', '#myform').val(); but select value of first question! help? try : <script type="tex...

client - Java RMI and ClassNotFoundException -

i starting learn how use rmi, , have question. have following directory structure: compute.jar client | org\examples\rmi\client |--> computepi // client main |--> pi // implements task org\examples\rmi\compute |--> compute // interface |--> task // interface server | org\examples\rmi\engine |--> computeengine // server main, implements compute org\examples\rmi\compute |--> compute // interface |--> task // interface here's main method in computepi class: if (system.getsecuritymanager() == null) { system.setsecuritymanager(new securitymanager()); } try { string name = "compute"; // args[0] = 127.0.0.1, args[1] irrelevant registry registry = locateregistry.getregistry(args[...

java - Validating a form in JSP -

i'm validating simple form using spring , hibernate in jsp (using simpleformcontroller ) of hibernatevalidator explained here . form containing 1 field follows. <%@page contenttype="text/html" pageencoding="utf-8" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@taglib uri="http://www.springframework.org/tags/form" prefix="form" %> <form:form method="post" id="userform" name="userform" action="temp.htm" commandname="validationform"> <table> <tr> <td>user name:<font color="red"><form:errors path="username" /></font></td> </tr> <tr> <td><form:input path="username" /></td> </tr> <tr> <td><input typ...

ruby on rails - RoR: Cannot change_column in postgres, fine in MySQL (MySQL for development, Postgres on Heroku) -

i had column called "prize": create_table :contests |t| t.text :prize i realized integer , wanted set default value: def change change_column :contests, :prize, :integer, :default => 200 this works fine on local machine, using mysql db. however, when push production site (which hosted on heroku, gives me postgres db) following error: pgerror: error: column "prize" cannot cast type "pg_catalog.int4" : alter table "contests" alter column "prize" type integer in article: http://www.postgresonline.com/periodical.php?i_id=3 discuss use of using solve problem. don't know how can that, , whether appropriate i'm trying do. any insight figuring out appreciated. thanks! ringo first should use same db in both environments prevent kind of surprises. to run raw sql in migrations see example http://guides.rubyonrails.org/migrations.html#using-the-up-down-methods

c++ - new to CPP: Compiler error -

compilation fails following output. any thoughts please.. pstore.cpp pstore.cpp(169) : error c2220: warning treated error - no 'object' file generated pstore.cpp(169) : warning c4091: '' : ignored on left of 'bool' when no variable declared pstore.cpp(169) : error c2143: syntax error : missing ';' before 'inline function header' pstore.cpp(170) : error c4430: missing type specifier - int assumed. note: c++ not support default-int pstore.cpp(170) : error c2556: 'int pstore::getversion(std::string &)' : overloaded function differs return type 'bool pstore::getversion(std::string &)' ../include\pstore.h(48) : see declaration of 'pstore::getversion' pstore.cpp(170) : error c2371: 'pstore::getversion' : redefinition; different basic types ../include\pstore.h(48) : see declaration of 'pstore::getversion' here code snippet: bool pstore::getversion(std::string& version) { ampi_in...

php - regular expression to match querysting includes array -

preg_match(#(?:([a-za-z-]+):)?(?://(?:([a-za-z0-9_!$&\'()*+,;=._~%-]+)(?::([a-za-z0-9_!$&\'()*+,;=._~%-]*))?@)?([a-za-z0-9-._]+)(?::([0-9]*))?)?([a-za-z0-9_!$&\'()*@+,:;=._~/%-]*)(?:\\?([0-9a-za-z!$&\'()*@+,:;=._~%-]*))?(?:\\#(.*))?#, $uri, $m)); the regex above used match urls , result supposed m[1] = scheme m[2] = user m[3] = pass m[4] = host m[5] = port m[6] = path m[7] = querystring m[8] = fragment it works except when querystring includes array, example: ?ar[k1]=v1&ar[k2]=v2 my questions are: 1.what meaning of sharp # in regex 2.how can modify regex make matches querystring include array 1.the sharp (# 2nd) in regex meaning part of url scheme://username:password@domain:port/path?query_string # fragment_id 2. parse url , return components

how to read and write Android myself contact -

i working android contacts, android 4.0.3. in contact app, can create, add, edit , see myself contact in it. when tried myself contact app using contentresolver, did not work. how can read , write myself contact? in advance. edit: here code contacts list list = new arraylist(); uri uri = contacts.content_uri; string[] projection = new string[] { contacts._id, contacts.lookup_key, contacts.display_name, contacts.has_phone_number, contacts.photo_id, contacts.last_time_contacted, contacts.times_contacted }; string sortorder = contacts.display_name + " collate localized asc"; if (sortcolumn != null) { if (sortcolumn.equals(contacts.last_time_contacted) || sortcolumn.equals(contacts.times_contacted)) sortorder = "" + sortcolumn + " collate localized desc"; } cursor cursor = null; try { cursor = context.ge...

JPA (openjpa), DB2, update, commit = Invalid cursor name? -

trying perform simple update on object jpa (websphere-openjpa, db2): public t update(t t) { synchronized(this) { this.em.gettransaction().begin(); t = this.em.merge(t); this.em.gettransaction().commit(); } return t; } but getting "invalid cursor name" sql exception during transaction commit. ideas means? [3/07/12 12:17:27:586 est] 00000025 webapp e com.ibm.ws.webcontainer.webapp.webapp logservleterror srve0293e: [servlet error]-[jaxrsapplication]: <openjpa-2.1.2-snapshot-r422266:1179900 fatal store error> org.apache.openjpa.persistence.rollbackexception: transaction has been rolled back. see nested exceptions details on errors occurred. failedobject: prepstmnt 125018062 update cchdevt.tcc_property set comments = ?, last_updated = ? property_name = ? [org.apache.openjpa.jdbc.kernel.jdbcstoremanager$cancelpreparedstatement_] @ org.apache.openjpa.persistence.entitymanagerimpl.commit(entitymanagerimpl.java:593) @ com.qbe...

java - Wifi Socket address not valid,Android -

whenever create serversocket , watch socket address calling getlocalsocketaddress() , see: 0.0.0.0/0.0.0.0:xxxxx( xxxx random port no) my code server is: try{ boolean end = false; serversocket ss = new serversocket(0); system.out.println("program running, server address:" + ss.getlocalsocketaddress().tostring()); while(!end){ //server waiting client here, if needed socket s = ss.accept(); system.out.println("socket connected !"); bufferedreader input = new bufferedreader(new inputstreamreader(s.getinputstream())); printwriter output = new printwriter(s.getoutputstream(),true); //autoflush string st = input.readline(); system.out.println("tcp example client: "+st); output.println("good bye , fish :)"); s.close(); } ss.close(); } catch (exception ex) { ex.printstacktrace(); } dont assign "0" in serversocket...

oracle how to know transaction committed? -

possible duplicate: oracle: how find out if there transaction pending? in oracle, if issue update command in sql plus, how can know if committed or not ? for example, codes below, how can know these 25 rows committed or not ? update countries set name = 'ddd' 25 rows updated thanks use commit statement after commit e.g update countries set name = 'ddd'; commit; , after perform select statement see if have persisted database

ios - How to read the response headers every time using AFNetworking? -

while using 3rd party api, have requirement cancel traffic when custom response header set value. trying find nice place check once in code (and not in every success/failure block, works fine). understand, done overriding -(void)enqueuehttprequestoperation:(afhttprequestoperation *)operation in custom afhttpclient subclass, when implement that: -(void)enqueuehttprequestoperation:(afhttprequestoperation *)operation { nslog(@"[request url]\n%@\n", [operation.request.url description]); nslog(@"[response headers]\n%@\n", [[operation.response allheaderfields] descriptioninstringsfileformat]); [super enqueuehttprequestoperation:operation]; } the response headers nil . can me that? at moment when operations being created , enqueued in afhttpclient , not have response server--that assigned when request operation executed. although requirement cancel traffic seems unorthodox (at least if outside of conventions of http), easy accomplish: i...

java - SearchByEmail print -

i have employeestore class stores details employee's in company such name, id , e-mail. need method search hashmap e-mail addresses of employees , print out individual employee matching address. i got code search map in answer can't manage print employee. here code: public class employeestore { hashmap<string, employee> map; public employeestore() { map = new hashmap<string, employee>(); } //.... public void add(employee employee) { map.put(employee.getemployeename(), employee); } public employee searchbyname(string name) { employee employee = map.get(name); system.out.println(employee); return employee; } public employee searchbyemail(string email) { (employee employee : map.values()) { if (email.equals(employee.getemployeeemail())) { return employee; } system.out.println(employee); } employee e...

Any Plugin or suggested Design for user to perform an Custom action on Wordpress content -

i need make wordpress website having lots of recipes.user allowed read , click on "cooked" button associated particular article. store user have cooked recipe , show when showing recipe. is there plugin available can store user activities on content(like have comments plugin) or else should best way this? take @ wp favorite posts plugin allows visitors add favorite posts. and set label "cooked" instead of "add favorites" , easiest way if custom coding it's matter of saving recipe post id in user meta using update_user_meta

sql - In a MySQL db, how to add a new column and make it a primary key? -

in mysql db, how add new column , make primary key? db has 4 columns, 1 of primary key. alter table foo add column bar int, drop primary key, add primary key(bar); better run in 1 query if table large make things faster.

networking - Multithreaded TCP server in C#? -

i need , running mt tcp server implemented in c#, proof of concept. looking open source implementation of such multi-threaded tcp server in c#. i came across link , decade old!. can't seem find more recent. aware of more recent implementation of mt tcp server? there relatively complete sample of highly scaleable tcp server @ http://msdn.microsoft.com/en-us/library/system.net.sockets.socketasynceventargs.aspx .

asp.net mvc - How can I get the list of all actions of MVC Controller by passing ControllerName? -

how can list of actions of controller? search cannot find example/answer. see example recommended using reflection don't know how. here trying do: public list<string> actionnames(string controllername){ } you haven't told why need 1 possibility use reflection: public list<string> actionnames(string controllername) { var types = in appdomain.currentdomain.getassemblies() t in a.gettypes() typeof(icontroller).isassignablefrom(t) && string.equals(controllername + "controller", t.name, stringcomparison.ordinalignorecase) select t; var controllertype = types.firstordefault(); if (controllertype == null) { return enumerable.empty<string>().tolist(); } return new reflectedcontrollerdescriptor(controllertype) .getcanonicalactions().select(x => x.actionname) .tolist(); } obviously know reflection not fast if intend call metho...

c++ - Specializing only a part of a template function's implementation -

i'm wondering if anyhow possible partially specialize templated method behaviour in case 1 of template parameter it's of type. template<class t> void foo(t& parameter) { /* generic - types - stuff */ if(t int) // pseudo-code, typeinfo? boost? { /* specific int processing might not compile other types */ } /* again common stuff */ } any suggestion welcome. thanks if want specialize part of function have factor out part of function specialized implementations: template<class t> void bar(t &t) {} void bar(int &i) { /* specific int processing might not compile other types */ } template<class t> void foo(t &t) { /* generic - types - stuff */ bar(t); /* again common stuff */ }

http - Request multiple S3 files into one request -

is there way multiple files s3 (or cdn) in 1 request? for example, have 4 files on s3: example.com/cdn/one.js example.com/cdn/two.js example.com/cdn/three.js example.com/cdn/four.js i able request combination of them @ time. have include them separately: <script src="example.com/cdn/one.js" /> <script src="example.com/cdn/two.js" /> but include them 1 request: example.com/cdn/code.js?one&two i've considered combining needed combinations single files, there way many combinations realistic. i've considered combining of them 1 file, ridiculously large. first of all: question more js thing related s3 / cdns in general. , answer question: you can't "combine" them in 1 http request. if don't want concatenate , minify them should take @ requirejs , handle loading of scripts – it's async , won't block browser rendering. this great article async loading: css-tricks.com - thinking async giv...