Posts

Showing posts from September, 2014

iphone - iOS subviews are not resized when iAD appears -

i have viewcontroller has 3 views (+ adview). bannerviewdidloadad event triggered , resize views in order make iad visible. however, views not resized , console shows message telling iad may obscured. how bring front , resize views? thank you. - (void)bannerviewdidloadad:(adbannerview *)banner { if (!self.bannerisvisible) { //&& inicibanner self.bannerisvisible = yes; [self.view addsubview:adview]; [uiview beginanimations:@"animatedadbanneron" context:null]; //adview.frame = cgrectoffset(adview.frame, 0, adview.frame.size.height); [uiview commitanimations]; self.view.frame = cgrectmake(0, adview.frame.size.height, self.view.frame.size.width, self.view.frame.size.height - adview.frame.size.height); self.vistab.frame = cgrectmake(0, adview.frame.size.height, self.vistab.frame.size.width, self.vistab.frame.size.height - adview.frame.size.height); self.vistasocial.frame = cgrectmake(0, advi...

javascript - Resizing Unity WebPlayer element when resizing browser -

i'm trying unity webplayer control resize when browser resized. here's code think pertinent: <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript"> <!-- function getunity() { if (typeof unityobject != "undefined") { return unityobject.getobjectbyid("unityplayer"); } return null; } function resizeunity() { //this function assigns innerwidth , height winwidth , winheight getwindowsize(); var unity = getunity(); if(unity != null) { //this not resize @ unity.width = winwidth; unity.height = winheight; } ...

osx - Get iTunes'/Finder's default album art image -

Image
part of application's functionality gets playing itunes track's album art (using scripting bridge). i'm able fine. however, when track isn't playing, i'd default album art both itunes , finder have. possible code? (or if not, how else?) fi'm not sure itunes gets it, believe finder gets indirectly, asking quicklook thumbnail file. so, right answer same thing. either instead of getting album art manually, or fallback if fails, , display quicklook thumbnail. however, if want quick , dirty, can read resource named "generic artwork 512" of type "png" out of quicklook.framework bundle. little protection against apple moving things around in future, can make sure quicklook loaded, resource in open bundle, you'll still need watch each new os release carefully. you draw own similar image—this isn't ui component, you're not confusing user drawing non-standard ui components—but won't ideal. , of course hope image sim...

Recreating Standard Google Map embed with Google Maps API -

so, having been dissapointed lack of customizability of regular google maps "embed" (iframe) code; have started tinkering google maps api v3. really, want show marker business on map, can click , go "place" @ mapsgoogle.com. so pretty much, want recreate functionality of iframe code below. put in hour of reading docs, seems extremely complicated marker associated 'place' the place https://maps.google.com/maps?cid=1311411133662139490 the standard embed <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?cid=1311411133662139490&amp;ie=utf8&amp;hq=&amp;hnear=&amp;t=m&amp;iwloc=a&amp;ll=41.097905,-73.405006&amp;spn=0.006295,0.006295&amp;output=embed"></iframe><br /><small><a href="https://maps.google.com/maps?cid=1311411133662139490...

sql server - selecting multiple rows and columns over a xml variable -

usually use xml variable in filters, because easy work. considering tablea, column1 primary key: declare @xml xml = '<column1>1</column1><column1>2</column1>' select * tablea column1 in (select x.i.value('.', 'bigint') @xml.nodes('/column1') x(i)) or @xml null it works because select on xml returns 2 rows, values 1 , 2. now have tableb, composite primary key, column1 , column2. so: declare @xml xml = '<row><column1>1</column1><column2>2</column2></row><row><column1>3</column1><column2>4</column2></row>' how can write select on xml return each row , columns, like: column1 column2 1 2 3 4 declare @xml xml = '<row><column1 a="a">1</column1><column2>2</column2></row><row>' + '<column1>3</column1><column2>4</column2>...

iphone - iOS - if user allow using his current location or not -

in app in map view want show nearest 10 stores user's current location but first have take current location first can show stores according user's location in first start of app app ask user if allow current location or not must if user allow list stores on map else go main page now using code below: mtmap.showsuserlocation=yes; mymanager=[[cllocationmanager alloc] init]; mymanager.delegate=self; cllocation *location = [mymanager location]; cllocationcoordinate2d coordinate2 = [location coordinate]; nsstring *latitude1 = [nsstring stringwithformat:@"%f", coordinate2.latitude]; nsstring *longitude1 = [nsstring stringwithformat:@"%f", coordinate2.longitude]; nsstring *myurl = [[nsstring alloc] initwithformat:@"http://www.xxxx.com/xxxx/aaaaa.ashx?term=%@,%@",latitude1,longitude1]; nsdata *data = [nsdata datawithcontentsofurl:[nsurl urlwithstring:myurl]]; nsinputstream *datastream=[[nsinputstream alloc]initwithdata:data]; [datastrea...

overlay - how to rezise panel based on the content -

i creating panel html content. want increase panel size based on content put in there. tried using floating:true , overflow:true did not work. any idea how can achieve that? here code: ext.define("infoimage.common.view.actionitems.commonoverlay",{ extend : 'ext.form.panel', requires : [ // 'infoimage.view.workitempanel', 'ext.titlebar', 'ext.button' ], xtype : 'commonoverlay', id : 'commonoverlay', config : { id : 'aboutpanel', layout : 'fit', modal : true, //floating: true, overflow: false, hideonmasktap : false, scrollable : false, showanimation:{ type:'slide', direction:'down', duration:250, easing:'ease-out' }, hideanimation:{ type:'slide', direction:'up', durat...

c# - ServiceHandle is 0 -

i'm trying write simple wcf service self hosted in windows service servicehandle of windows service 0 i need detect hardware change using registerdevicenotification 1 of it's parameters handle, in case servicehandle public partial class myservice : servicebase, imyservice { private servicehost host; public static void main() { servicebase.run(new myservice()); } public myservice() { initializecomponent(); } protected override void onstart(string[] args) { try { host = new servicehost(typeof(myservice), new uri(@"net.pipe://localhost/myservice")); host.open(); } catch (exception e) { eventlog.writeentry("myservice:", e.message); } } protected override void onstop() { host.close(); } #region imyservice members public void register() { //here servicehost 0 } #endregion } what can cause problem? thanks the servicehandle - no matter value - not required host wc...

awk sum numbers after a separator -

i need simple awk calculate sum of number @ end of file looks this: /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101201_015.log.gz:28 /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101202_015.log.gz:28 /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101203_015.log.gz:28 /z02/abcd/stuff/abc_def_02/count/abc_def_02_abcde66.log.20120605_101204_015.log.gz:28 so numbers after ":" need added together echo "....." | awk '-f:' '{total+=$nf}end{print "sumtotal=" total}' you can, of course, leave out "sumtotal=" part, depending on needs. i hope helps.

java - Autocomplete with Ehcache -

i have several autocomplete fields within form i'm developing. largest containing 20k records , smallest containing around 1k. until i've used treemap handle task, i'm finding in efficient. current structure looked this. private sortedmap<string, set<string>> cache; public autocompletecacheserviceimpl() { cache = collections.synchronizedsortedmap(new treemap<string, set<string>>()); } while being populated so, private void populatecache(string id, string name) { int len = name.length(); (int = 1; <= len; i++) { string key = name.substring(0, i).tolowercase(); if(this.cache.containskey(key)) { set<string> exist = cache.get(key); if(!exist.contains(id)) { exist.add(id); } } else { set<string> _e = new hashset<string>(); _e.add(id); this.cache.put(key, _e); }...

collections - Component to iterate and render a nested tree-like object structure in JSF -

given class definition below: public class comment { string username; string comment; list<comment> replies; // ... } is possible use construct jsf page renders data contained in comment instance in tree structure follows? comments userone said blah blah ---- userthree replied blah blah blah ---- userthree replied blah blah blah ---- usertwo said blah blah ---- userone said blah blah if nesting 1 level deep, or has fixed amount of maximum depth, nest jsf repeater components <ui:repeat> or <h:datatable> in each other usual way. <ul> <ui:repeat value="#{bean.comments}" var="comment"> <li>#{comment.username} #{comment.comment} <ul> <ui:repeat value="#{comment.replies}" var="reply"> <li>#{reply.username} #{reply.comment}</li> </ui:repeat> ...

java - Storing in memory database Using ORMLite for Android -

i developing app android. have web service doing database queries , storing in. in beginning of app want load data web service via rest calls , store in local database, preferably orm. have found ormlite , how can used wondering how make database stored in memory data gets wiped when app quits. when use public databasehelper(context context) { super(context, null, null, database_version,r.raw.ormlite_config); } as stated in documentation throws runtimeexception. advice on how accomplish or way go appreciated. i don't think android database apis support in memory database -- though sqlite support it. don't think going useful load h2 onto android in-memory db. i'd suggest persist data , wipe database every time application starts. yes doing unnecessary io shouldn't bad. ormlite supports tableutils.cleartable() method . also, might consider not using orm , store objects in collections if whole point not persist them.

java - Roboguice together with Sherlock? -

i'm trying use roboguice sherlock. cannot start testapp when extending robosherlockfragmentactivity do have take account might have missed? 06-06 10:23:59.700: i/dalvikvm(917): failed resolving lcom/github/rtyley/android/sherlock/roboguice/activity/robosherlockfragmentactivity; interface 1352 'lroboguice/util/robocontext;' 06-06 10:23:59.700: w/dalvikvm(917): link of class 'lcom/github/rtyley/android/sherlock/roboguice/activity/robosherlockfragmentactivity;' failed

javascript - Test the existence of User/System DSN in XPages -

in xpage have editbox user enter name of odbc data source. onblur want test whether user entered value valid/exist in odbc list. if there error/exception, want error displayed in 'display error' control have in xpage. i'm not sure start. never done before(even in lotusscript). enlighten me please? i wouldn't in onblur event. user might want change else , hit slow operation. should do: have test button gray out "save" button until test successful in case: have @ extension library. has rdbms connectivity build in (use it, don't reinvent wheel). copy code there.

c# - How do I change the Textblock value on my splash screen? -

i'm trying make animated splash screen app. have mainpage show popup has animation , textblock. i'd change text of textblock show status of loading, can't change it. ideas? mainpage code namespace animatedsplash { public partial class mainpage : phoneapplicationpage { backgroundworker preloader; popup splashpop; public mainpage() { initializecomponent(); splashpop = new popup(){isopen = true, child = new splash() }; preloader = new backgroundworker(); runpreloader(); } private void runpreloader() { preloader.dowork += ((s, args) => { thread.sleep(10000); }); preloader.runworkercompleted += ((s,args) => { this.dispatcher.begininvoke(()=> { this.splashpop.isopen = false; }); }); preloader.runworkerasync(); } } } splash x...

sharepoint - New-SPWebApplication application pool account is not found -

i trying create new web application using powershell. keep getting error application pool account not found! how solve this? i tried adding new web application defaultapppool follows: new-spwebapplication -name "test webapp" -applicationpool "defaultapppool" -applicationpoolaccount (get-spmanagedaccount "win2k8r2sptest\administrator") but cmdlet get-spmanagedaccount seems return empty string. tried change applicationpool sharepoint 80. i running sharepoint foundation 2010 on standalone installation. how can fix error? you must create managed account first win2k8r2sptest\administrator. here sequence of steps $cred = get-credential 'win2k8r2sptest\administrator' // enter password here $adminma = new-spmanagedaccount -credential $cred new-spwebapplication -name 'test webapp' -applicationpool "defaultapppool" -applicationpoolaccount $adminma i've tested on vanilla sps2010 sp1. think process identical fou...

linux - Output from a bash script looping through multiple directories -

i trying write script loop through multiple directories. main raw_data directory contains ~150 subdirectories (subj001, subj002,...,subj00n), each of has several subdirectories. how can make sure output script given bellow sent specific subdirectory (e.g. subj0012) input taken from, rather current directory (raw_data)? #!/bin/bash dir in ~raw_data/* tractor -d -r -b preproc runstages:1 done thank you. the name of dir want save output in $dir , right? so, send output there via redirection: #!/bin/bash dir in ~raw_data/* ; tractor -d -r- b preproc runstages:1 > $dir/output done you should make sure processing directory, though.

c# - asp.net scrollbars on empty textbox -

i have textbox follows: <asp:textbox id="textbox1" runat="server" width="100px" rows="3" readonly="true" borderstyle="none" borderwidth="0" textmode="multiline" text='<%# eval("notes") %>' backcolor="#222222" forecolor="white"></asp:textbox> how can make vertical scrollbar not displayed when textbox either empty or doesn't need scroll because text fits in 3 lines? you can css specifying overflow:auto; . can manually add attribute cssstylecollection @ textbox1.style in page's code-behind, or can apply cssclass value declaratively , define css class in external stylesheet. here documentation on css overflow : http://www.quirksmode.org/css/overflow.html here documentation on textbox.style property: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.webcontrol.style

Get full accessable path from Android Gallery -

i need access file android gallery , upload url using post. there no problem. new stuff accessing device data. need have hint full path of image selected gallery using intent , startactivityforresult. startactivityforresult(new intent(intent.action_pick, android.provider.mediastore.images.media.internal_content_uri), select_image); to fetch images on sd card.uri be android.provider.mediastore.images.media.external_content_uri onactivityresult method: protected void onactivityresult(int requestcode, int resultcode, intent intent) { super.onactivityresult(requestcode, resultcode, intent); if (resultcode == result_ok) { uri photouri = intent.getdata(); if (photouri != null) { try { bitmap bitmap = mediastore.images.media.getbitmap(this .getcontentresolver(), photouri); //now can upload bitmap server or else. } catch (exception e) { e.printst...

how to read excel file using struts2 Application while it converted to .tmp -

this jsp page... upload excel file...where need uplode 2 different excel file different action... hope tag self explanatory... <body> <s:actionerror /> <s:fielderror /> <s:form action="admin" method="post" enctype="multipart/form-data" theme="simple"> <big>import batch , tan details</big> <br> <s:file name="uploadtobatch" label="select excel file batch import" /> <s:submit action="importbatchandtandetailsadmin" value="import" /> <br> <big>allocate batch</big> <br> <s:file name="uploadtoallocate" label="select excel file allocation" /> <s:submit action="allocateadmin" value="allocate" onclick=""/> </s:form> </body> next strut.xml configuration these 2 actions... <action name="*admin" method="{1}" class="controller.adminac...

html5 - How to handle particular event by the dynamic created button in sencha touch -

i have created 6 buttons dynamically using initialize function,also have assigned different id's each buttons dynamically,i want handle event each button,when click each of different button getting alert message of sixth button id,how handle particular button event. thank you ext.define("dynamicbutton.view.main", { extend: 'ext.panel', initialize: function () { var me = this; me.names = ['button1', 'button2', 'button3', 'button4', 'button5', 'button6']; var toolbar = ext.create('ext.toolbar', { docked: "bottom" }); this.add(toolbar); (var = 0; < me.names.length; i++) { var name = me.names[i]; var button = ext.create('ext.button', { id: 'btn' + name, html: name, handler: function() { alert(button.id); }, scope: }); toolbar.add(button); } }, config: { } }); you can access button through params of handler function : handler: function (button, event) { console...

input - I need calendar similar to this -

i need calendar same functionality one: calendar i want date in input box , clicking on individual values ​​(month, day, year) date changed, , able choose date drop down list. does know of similar? for reason can not use calendar new version avaiable @ http://www.hotscripts.com/listing/convenient-javascript-calendar-date-picker/

ios5 - UIView horizontal centering using autoresizingmask not working -

Image
i having problems in centering uiview in middle of detail view in master-detail application template in ios5. view of width less ipad screen , should appear in center irrespective of device orientation. here's tried.... - (void)viewdidload { [super viewdidload]; [self.view setautoresizingmask:(uiviewautoresizingflexibleleftmargin|uiviewautoresizingflexiblerightmargin)]; [self.view.layer setborderwidth:2.0f]; [self.view.layer setbordercolor:[[uicolor orangecolor] cgcolor]]; // additional setup after loading view, typically nib. uiview *somecontainerview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 600.0f, 56.0f)]; [somecontainerview.layer setborderwidth:2.0f]; [somecontainerview.layer setbordercolor:[[uicolor greencolor] cgcolor]]; [somecontainerview setautoresizingmask:(uiviewautoresizingflexibleleftmargin|uiviewautoresizingflexiblerightmargin)]; [self.view addsubview:somecontainerview]; [self configureview]; } here's h...

c++ - Communicating between qt application and erlang server via erlang port -

i need make client (qt c++) , server (erlang) in ubuntu. server should generic otp server. client should connect server , send data (string) , erlang srv should return same string. please suggest me example code or skeleton implement things. i decided start this: connect(message) -> cmd = "./myqtwindowapp \n", port = open_port({spawn,cmd}, [stream,use_stdio,exit_status]), payload = string:concat(message, "\n"), erlang:port_command(port, payload), receive {port, {data, data}} -> ?dbg("received data: ~p~n", [data]); other -> io:format("unexpected data: ~p~n", [other]); after 15000 -> ?dbg("received nothing~n", []) end. please me client , server. you should use ipc make communication. can open socket ( gen_tcp ) or use d-bus instance. qt have proper classes handle sockets , d-bus.

Cross Compiling C source codes on Windows for Linux using VM Player running ubuntu -

i've project has .c codes generated simulink models (using rtw). executable needs generated lynxos rtos, use cygwin, slow, takes several hours compile & link ~ 650 .c code files , libraries. i wondering if possible put sources & libraries share on vmware player (on windows) running ubuntu or other linux flavor , generate executable ? faster ? the ways can tackle listed fastest slowest: native linux through dual-boot , shared disk virtualbox/vmware player distributed version control pulling sources on vm's disk. virtualbox/vmware player shared or network folder. cygwin. the tradeoff between 2 , 3 disk access. shared folders or network drives slow, compilation purposes. go option 2 unless trivial thing.

can anyone suggest a good program for debugging a C program? -

i need debug c program includes posix threads, socket programming (udp client, server). use ubuntu 12.04 , ide/sdk, qt creator 2.4.1 , netbeans ide 7.1.2. know use gdb debugging. when start debug program, program stops running after 5 min or , neither qt creator or netbeans output error or warning, although use debugging feature , program suppose listen udp port. i use printf line of code, , can see program works suppose , listen udp port , waits. can not figure problem out why stops without reason , since ides using not show debug error, warning, can not think reason. i wonder if can suggest me debug program monitors all/some variables , threads during run time. thank you. gdb isn't comfortable available. to runtime analysis of different types, checking memory access, valgrind ( see here docs ) might tool of choice. update : i'm referring *ix systems. windows gbd works in cygwin enviroment. nativly there vc express, free , includes ide , debugger. ...

switch statement - Name an output column created with case in PostgreSQL -

is possible name output column created case ("switch") in postgresql select statement? appears documentation not possible. example usage of is: select case (column) when 1 'one' end 'thecolumn' table ; it works me (pg-9.1) create table 1 ( 1 integer ); insert one(one) values ( 0), (1), (null); select case 1 when 1 'one' when 0 'zero' else 'other' end the_one one; so, single quotes (that used quote aliased column name) should have been double quotes (or absent). the result: create table insert 0 3 update 3 the_one --------- 1 0 other (3 rows)

c++ - Does crtdbg.h conflict with DirectX? -

i discovered hidden gem crtdbg.h makes memory leak detection easier. unfortunately, when linked directx program today, got errors i've never seen before. 1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error c2059: syntax error : 'constant' 1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error c2091: function returns function 1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(425): error c2802: static member 'operator new' has no formal parameters 1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(426): error c2059: syntax error : 'constant' 1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.h(426): error c2090: function returns array 1>e:\program files (x86)\microsoft directx sdk (june 2010)\include\d3dx10math.inl(1003): error c2761: 'void *(__cdecl *_d3dxmatrixa16::oper...

matlab - Find rows in matrix where entries match certain constraints? -

i have matrix in matlab , want find indeces of rows, some of columns meet specific criteria. example m = 1 5 9 13 2 6 10 14 10 14 11 15 4 8 10 14 now want find incedeces of rows, m(:,3) == 10 , m(:,4) == 14 . the result should be: r = 0 1 0 1 i though like find(ismember(m,[* * 10 14]),1) but ismember() won't work wildcars. r = (m(:,3) == 10 & m(:,4) == 14); should sufficient.

git - Issues while creating repository? -

hi new bitbucket. in beginning, while setting account asked enter email ids...do @ time have enter email id or email ids of people sharing code with. while setting code repository using following steps: mkdir abcproject cd abcproject git init touch readme git add readme git commit -m 'first commit' git remote add origin https://bitbucket.com/userabc/rdf-project.git git push -u origin master but in these steps not getting have put code, sharing. have myself put code within abcproject folder? and statement git push -u origin master gives me error: fatal: https://bitbucket.com/userabc/abcproject/abcproject.git/info/refs not found: did run git update-server-info on server?" for pushing repo..i using following commands, git remote add origin git@github.com:userabc/abcproject.git $ git push origin master it's still giving me same error...(the error same above). meaning of above statement. i new bitbucket. can king enough me out??? (i have code stored o...

unix - How do I run libsvm on linux? -

i'm having trouble installing libsvm, presently im running via ubuntu virtual machine . when follow instructions such on unix systems, "type make' build the svm-train' , `svm-predict'programs. run them without arguments show usages of them". following error output: rather new both libsvm , unix systems appreciated. aaron@aaron-laptop:~$ cd document bash: cd: document: no such file or directory aaron@aaron-laptop:~$ cd documents aaron@aaron-laptop:~/documents$ libsvm-3.12 libsvm-3.12: command not found aaron@aaron-laptop:~/documents$ cd libsvm-3.12 aaron@aaron-laptop:~/documents/libsvm-3.12$ make g++ -wall -wconversion -o3 -fpic -c svm.cpp make: g++: command not found make: *** [svm.o] error 127 aaron@aaron-laptop:~/documents/libsvm-3.12$ open terminal , type these commands in order. sudo apt-get update sudo apt-get install build-essential if still doesn't work, open terminal, type in 'g+' (without quotes) , press button multi...

html - Post photo to facebook page using javascript and graph api -

i using facebook javascript sdk post photo fan page.here's code <form enctype="multipart/form-data" method="post" action="https://graph.facebook.com/<page_id>/feed" target="ifram_name"> <input name="source" type="file" style="font-size:13px;" /> <input type="hidden" name="to" value="113342002047830"/> <input type="hidden" name="access_token" value="user_accesstoken"/> <input type="hidden" name="type" value="photo" /> </form> it says " missing message or attachment ". i have tried changing "action" "https://graph.facebook.com//feed" photo uploaded user's album. can tell missing in code ? you should use photos connection of user , page or album (not feed ) , supply active access_token user/page. <f...

sql - full text search doesn't find anything -

**edit* * ok found problam, min word length search 4, changed 3 finds row 1 data , not row 2 data aswell... -----original question:---- i have myisam table on phpmyadmin this: table name: `users` coulmn name: `name` row 1 data: 'dan' row 2 data: 'dan252' (it's important part of it) now name fulltext index field, im using query: select * `users` match(`name`) against('dan') but phpmyadmin returns: mysql returned empty result set (i.e. 0 rows). ( query took 0.0004 sec ) why it's not finding anything? * edit * ok found problam, min word length search 4, changed 3 finds row 1 data , not row 2 data aswell... match works on columns fulltext indicing. , fulltext indicing works on myisam tables. secondly, 'dan' too short use on match . thirdly, if search term matches more 50% of rows, term considered common , search fails. have read here .

python - Find several strings with regular expressions -

i'm looking or capability match on several strings regular expressions. # find either "-hex", "-mos", or "-sig" # result -hex, -mos, or -sig # see want rid of double quotes around these 3 strings. # other double quoting ok. # i'd like. messwithcommandargs = ' -o {} "-sig" "-r" "-sip" ' messwithcommandargs = re.sub( r'"(-[hex|mos|sig])"', r"\1", messwithcommandargs) this works: messwithcommandargs = re.sub( r'"(-sig)"', r"\1", messwithcommandargs) square brackets character classes can match single character. if want match multiple character alternatives need use group (parentheses instead of square brackets). try changing regex following: r'"(-(?:hex|mos|sig))"' note used non-capturing group (?:...) because don't need capture group, r...

Jquery adds an extra closing tag to span on .text() method -

Image
i'm having problem jquery .text(), .html() methods. when click on specific button change content of span element, adds closing tag, visible in tools such firebug. here's demo: http://jsfiddle.net/kbsrp/ click on button , inspect span tag, you'll see added closing tag. <span>updated text</span> updated text</span> does know, how prevent bug? annoying in cases. this seems bug in chrome's web inspector, why firefox people aren't seeing it. can verify correct state in chrome manually traversing dom, shows web inspector lying: note test, need change active frame dropdown result( fiddle.jshell.net ) . otherwise queries ran on main window.

Java - output from line read in reverse -

the following routine outputs moves chess engine jtextarea public void getengineoutputoriginal(process engine) { try { bufferedreader reader = new bufferedreader (new inputstreamreader (engine.getinputstream ()), 1); string lineread = null; // send engine analysis print method while ((lineread = reader.readline ()) != null) application.showengineanalysis (lineread); } catch (exception e) { e.printstacktrace(); } } sample output be 12 3.49 39/40? 2. b4 (656knps) 12 3.49 40/40? 2. nd5 (656knps) 12-> 3.51 0.04 2. bxf4 be6 3. be3 qa5 4. nd5 qxd2 13 3.51 1/40? 2. bxf4 (655knps) is possible reverse process last line read appears @ top instead of bottom, so: 13 3.51 1/40? 2. bxf4 (655knps) 12-> 3.51 0.04 2. bxf4 be6 3. be3 ...

How to read image from raw UDP packets (captured from SharpPcap) -

i send bitmap image virtual machine local machine, capture image udp packets sharppcap local machine. don't know how rid of protocol header , image displayed. in fact, need read gbytes image ethernet card , display in real-time. want read raw image data ethernet card sharppcap, keep in system buffer , display in gui. current method right?

c++ - What happens in memory when calling a function with literal values? -

suppose have arbitrary function: void somefunc(int, double, char); and call somefunc(8, 2.4, 'a'); , happens? how 8, 2.4, , 'a' memory, moved memory, , passed function? type of optimizations compiler have situations these? if mix , match parameters, such somefunc(myintvar, 2.4, somechar); ? what happens if function declared inline ? it makes no difference values literal or not (unless function inlined , compiler can optimize stuff out). usually, parameters put registers or function parameter stack. regardless of whether explicit values or variables. without optimizations , parameter gets pushed onto parameter stack. in first case, value of x taken first , put register eax , pushed parameter stack. foo prints x . foo(x); 00361a75 mov eax,dword ptr [x] 00361a78 push eax 00361a79 call get_4 (3612b7h) 00361a7e add esp,4 foo(3); 00361a81 push 3 00361a83 call get_4 (3612b7h) 00361a...

BASH: Substituting a variable inside a variable during echo -

i explained question in comments: var= ins="installing $var" echo $ins . # in each echo command want dynamically substitute . # $var variable in $ins variable. want echo $ins # substitution of variable on echo command. is possible? you need function job gracefully. say() { echo "installing $ins" } ins=hello ins=world or this: say() { echo "installing $@" } hello world

openoffice.org - Jodconverter on CentOS 6 - "failed to start and connect" -

i'm trying set jodconverter-beta-4 on centos 6.2 server after days of trying cannot past point @ at. not wizard *nix, please bear me if made novice mistakes. the components have installed openoffice.org using add/remove software are: core brand core modules calc, draw, impress, math, writer spreadsheet, drawing, presentation, equation, word processor libraries extra graphic filters uno i have created symlink in /opt/ ln -s /usr/lib64/openoffice.org3/ openoffice.org3 when execute: java -jar jodconverter-core-3.0-beta-4.jar test.docx test.pdf i following: jun 12, 2012 10:56:40 a.m. org.artofsolving.jodconverter.office.processpoolofficemanager <init> info: processmanager implementation linuxprocessmanager exception in thread "main" org.artofsolving.jodconverter.office.officeexception: failed start , connect @ org.artofsolving.jodconverter.office.managedofficeprocess.startandwait(managedofficeprocess.java:64) @ org.artofsolving.jodco...

Android is there a way to have a list box with a set size, instead of filling the parent or content? -

i have textview on top if more 5 lines of text, scroll. list of text on bottom files remain space. i'm using scrollview textview inside. problem if set top scroll warp content, keep getting bigger if there more 5 lines of text. if set fill parent, button text view not displayed. there way this? <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="tell furtune chat" android:textsize="38px" /> <scrollview android:layout_width="fill_parent" android:layout_height="wrap_content" > <textview android:layout_width="wrap_content" ...

matlab - How a apply a threshold in particular area of an image? -

i have image of 240x20 pixels. have calculated oprtimum threshold find noise in image. after observing particular area of images contain noise 20 70 in x-direction. now want apply threshold in particular area. easy way possible. if understand question correctly, might trick (only tested in octave): bw = im2bw(i(y1:y2, x1:x2, :), threshold); % y1 = start row % y2 = end row % x1 = start column % x2 = end row % last column color images, address color channels % bw extract image threshold applied

postgresql - Script to track Database change -

i need track changes of data in postgresql database. there option in database or script view data , dml well. sorry - have no clue. have different suggestions: log /all/ queries , grep involving update, delete, insert, alter table etc. caveats: may cause performance problems if there lots of queries , log on same raid data and/or wal. not sure if it's easy make regexp 100% catch modifying statements. may difficult catch rollbacks etc. log everything, add configuration file: log_min_duration_statement = 0 . have other log_* configuration variables sane well. the rules/trigger approach (as hinted other user) - believe involves writing rules each , every table - it's of course doable (and should possible create rules through external script if have lot of tables). may bit how slony works - slony trigger-based replication system, should possible use catch changes in db. all changes database ends in wal-file, maybe it's theoretically possible extract out...

java - Multiple client connections for one socket -

i have socket based server accepts client connections. problem server able accept 1 client connection. want accept multiple clients. server code: class conn extends thread{ serversocket ss; socket s; public void run() { status.settext(status.gettext()+"connecting"); try{ while(true) { ss=new serversocket(3000); s=ss.accept(); read r=new read(s); r.start(); } }catch(exception e){} } } in conn class, put like: try { ss = new serversocket(3000); while(true) { s = ss.accept(); read r = new read(s); r.start(); } } catch (exception e) {} open server socket, , in loop, accept incoming connections , process them starting new thread.

Advice on database connection within PHP class -

i playing around oop programming, , have hit hurdle use advice with. i have situation have nested classes. have "company" class, contains array called people. array contains many instances of "person" class. the data both 'company' , 'person', stored within database, , relevant class retrieves information database , when needed. my question quite this: "at point connect database?" i:- a) connect first in php page, pass connection instance of "company" use. b) put username, password etc directly in "company" class , connect there. i have thought latter create multiple connections database - 1 each instance of "company" - answer "a". then, if pass class developer (this learning exercise, not plan do), have connect database himself, , not allow class him. in either case, connection passed each instance of "person" class automatically, or have pass connection each time cre...

iphone - Recovering Non-renewable Subscriptions -

currently i'm working on app social network, users have purchase premium membership unlock features. @ first used auto-renewable subscriptions, app got rejected. told me use non-renewable subscriptions and: non-renewable subscription content must made available ios devices owned single user, indicated in guideline 11.6 of app store review guidelines: 11.6 content subscriptions using iap must last minimum of 7 days , available user of ios devices if choose use user registration meet requirement, please keep in mind not appropriate require user registration. such user registration must made optional. appropriate make clear user registering able access content of ios devices; , provide them way register later, if wish access content on other ios devices @ future time. the logical way transfer subscriptions in case using registration, user can't view content (or purchase subscriptions) without registering , logging in. means registration required. will app...

javascript - Custom checkbox not working in Chrome and Safari browser -

i used below code custom checkbox, html <div class="agree"> <label for="agree_check" class="label_check"><input type="checkbox" class="agree_check" id="agree_check" />agree</label> </div> css .has-js .label_check { padding-left: 34px; } .has-js .label_check { background: url(../images/box1.png) no-repeat; } .has-js label.c_on { background: url(../images/box1-with-mark.png) no-repeat; } .has-js .label_check input { position: absolute; left: -9999px; } script <script type="text/javascript"> var d = document; var safari = (navigator.useragent.tolowercase().indexof('safari') != -1) ? true : false; var gebtn = function(parel,child) { return parel.getelementsbytagname(child); }; onload = function() { var body = gebtn(d,'body')[0]; body.classname = body.classname && bod...

iphone - How to register an app in adobe app measurement or adobe omniture? -

i have following question on adobe omniture how can register iphone app how can view tracks or report of our iphone app what s.account , how can omiture omniture = [[appmeasurement alloc] init]; omniture.account = @"mykey"; omniture.ssl = yes; omniture.trackingserversecure = @"myserver"; omniture.trackingserver = @"myserver"; omniture.currencycode = @"usd"; omniture.debugtracking = yes; omniture.offlinethrottledelay = [nsnumber numberwithint:0]; omniture.offlinelimit = [nsnumber numberwithint:300]; omniture.trackoffline = true; nsdictionary *chrummeasuredict = [configdata objectforkey:@"churnmeasure"]; churnmeasurement *c = [omniture getchurninstancepopulatedefaults:no]; [c setvaluesforkeyswithdictionary:chrummeasuredict]; omniture.usebestpractices = yes; and of course on events have nsmutabledictionary *trackdata = [[nsmutabledictionary alloc]init]; (nsdictionary *datadict in eventdata) { [tra...

Windows phone SMS plugin with extra functions -

i'm using code article, phonegap app. http://blogs.msdn.com/b/glengordon/archive/2011/12/02/phonegap-on-wp7-tip-3-sending-sms-and-intro-to-plugins.aspx the plugin works fine, when sms sent, want return app automatically. possible? if possible send sms without go default integrated sender, better. i'm newbie c# , windows phone apps - please me ;) there no way avoid integrated sms sender due security reasons. user return app after hitting button on sms conversation page (that esured automatically because of stack-controlled nature of paging in wp7, not return after hitting home button (again, behavior cannot prevented in way) , app suspended (possible return holding button , choosing it).