Posts

Showing posts from August, 2014

what is the best size to use for an Android application icon -

Image
what best size use android application icon? 72*72? i want install application on high resolution screen (hdpi). thanks have here , here . 72 x 72px correct hdpi, actual content within being 60px 60px. you'd want support other densities though avoid upsetting people other devices.

git - Versioning file system with Amazon S3 as backend -

i'm trying make following work on debian computers , 1 os x laptop. what have kind of versioning file system uses amazon s3 backend. what thinking use s3fs (using fuse) mount bucket, make filesystem uses git makes new commit everytime write file (i complete version history x days). mounted folder should show latest version of files. 1 of problems don't know how solve (due lack of experience, assume) synchronise files local folder. of course, download files not bandwidth friendly. another problem current version of s3fs not seem work macfuse. further, not happen prevent files becoming corrupt if 2 computers write file @ same time. if have understood correctly, git implements kind of file locking , not depend on file locking of operating system. what outline make work? files store these way .tex-files , vector images. i know there solutions in existence (like dropbox) don't closed source. first, let me not recommend blindly running git on s3. git prod...

streaming - How to capture microphone input in VLC? -

i'm trying capture microphone input in vlc media player via http interface , stream far have arrived @ nothing. possible? which platform? i'm on mac know sure possible vlc 2.0 other platforms should work well. haven't tested commands though. mac: use vlc 2.0.0 or later , utilize qtsound module: vlc -vvv qtsound:// win: use sth like: vlc dshow:// :dshow-vdev="none" :dshow-adev="your audio device" linux: use sth like: vlc alsa://plughw:0,0

Java: how to locate an element via xpath string on org.w3c.dom.document -

how locate element/elements via xpath string on given org.w3c.dom.document? there seems no findelementsbyxpath() method. example /html/body/p/div[3]/a i found recursively iterating through child node levels quite slow when there lot of elements of same name. suggestions? i cannot use parser or library, must work w3c dom document only. try this: //obtain document somehow, doesn't matter how documentbuilder b = documentbuilderfactory.newinstance().newdocumentbuilder(); org.w3c.dom.document doc = b.parse(new fileinputstream("page.html")); //evaluate xpath against document xpath xpath = xpathfactory.newinstance().newxpath(); nodelist nodes = (nodelist)xpath.evaluate("/html/body/p/div[3]/a", doc.getdocumentelement(), xpathconstants.nodeset); (int = 0; < nodes.getlength(); ++i) { element e = (element) nodes.item(i); } with following page.html file: <html> <head> </head> <body> <p> ...

math - Calculating Largest Possible Rectangle -

i'm uploading images website. they're sorts of different dimensions. how can determine largest 4:3 rectangle out of particular image without rotating image? if aspect ratio less 4:3, keep original width , use height of width*3/4 . if aspect ratio greater 4:3, keep original height , use width of height*4/3 .

web services - Call webservice from gps device -

i have web service want call gps device. have hosted web service on hosted server , web service has method called upload. method accept string parameter. currently calling web service mobile phone url http://www.abc.com/default.asmx/upload?str=1,73.0667,33.6 now want call web method gps device, problem gps device accept ip address , port no. not accept url , web method. create proxy service callable gps device ("ip address , port no."), in turn makes desired webservice call, whatever formatting data needed, , returns gps device in whatever format want gps device.

winforms - Odd DataGridView vertical scrolling behavior -

i have windows forms datagridview. fill , update using code below, pretty straightforward , done on ui thread. for strange reason size of vertical scrollbar (wich set visible when needed) not reflect amount rows available. if scroll way down, still cannot see last rows. can tell selecting lines below (and bringing them view) using arrow down key. what possibly reason this. need sort of beginudate or suspendlayout or something? control embedded through interop in mfc application. andy idea how track down problem? known bug? google doesn't think so, seems. here code use. adding or inserting row: int newrowindex = insertat; if (insertat < 0 || insertat > this.datagridview.rows.count) { newrowindex = this.datagridview.rows.add(); } else { this.datagridview.rows.insert(insertat, 1); } removing row: this.datagridview.rows.remove(index); clearing: this.datagridview.rows.clear(); updating row: this.datagrid[0, rowindex].value = somestring; this.d...

How can I load an image and write text to it using Java? -

i've image located @ images/image.png in java project. want write method signature follow byte[] mergeimageandtext(string imagefilepath, string text, point textposition); this method load image located @ imagefilepath , @ position textposition of image (left upper) want write text , want return byte[] represents new image merged text. try way: import java.awt.graphics2d; import java.awt.point; import java.awt.image.bufferedimage; import java.io.bytearrayoutputstream; import java.io.fileoutputstream; import java.io.ioexception; import java.net.url; import javax.imageio.imageio; public class imagingtest { public static void main(string[] args) throws ioexception { string url = "http://icomix.eu/gr/images/non-batman-t-shirt-gross.jpg"; string text = "hello java imaging!"; byte[] b = mergeimageandtext(url, text, new point(200, 200)); fileoutputstream fos = new fileoutputstream("so2.png"); f...

mod rewrite - Always WWW modrewrite php -

i want force www in urls. i'm having problems writing. know code trick. rewritecond %{http_host} ^example.com rewriterule ^(.*)$ http://www.example.com/$1 but want put in $_get['page'] rewriterule ^(.*)$ /index.php?page=$1 [l] how should put together? this should job rewritecond %{http_host} ^example.com rewriterule ^(.*)$ http://www.example.com/$1 rewritecond %{request_uri} !^/index.php rewriterule .* index.php?page=$0 [l]

c - Valgrind errors caused by pclose() on Mac OS X -

i'm getting valgrind errors when attempting pclose() pipe open popen() . errors occur on mac os x, not on linux. consider following example: #include <stdlib.h> #include <stdio.h> int main() { file *fp; char buf[4096]; if (!(fp = popen("ls", "r"))) exit(-1); while (fscanf(fp, "%s", buf) == 1) printf("%s\n", buf); pclose(fp); return 0; } i following valgrind errors on mac (os x 10.6.7, valgrind version 3.6.0), except if remove pclose() call: ==21455== conditional jump or move depends on uninitialised value(s) ==21455== @ 0xb1992: pclose (in /usr/lib/libsystem.b.dylib) ==21455== 0x1f16: main (in ./a.out) ==21455== ==21455== syscall param wait4(pid) contains uninitialised byte(s) ==21455== @ 0x504fa: wait4 (in /usr/lib/libsystem.b.dylib) ==21455== 0x1f16: main (in ./a.out) however, don't errors on linux system valgrind version 3.5.0. any ideas on causing errors on mac? updat...

iphone - How can I have a UISegmentedControl swap views in and out, AND still have the ability to rotate orientation? -

i have looked around @ number of posts on topic, have been unable fix issues having. presenting modal view uiviewcontroller. i've setup view have uisegmentedcontrol on top right ideally allow me switch view (inside of modal view). in order not cover toolbar @ top, have made simple uiview in ib, , laid out dimensions don't overlap toolbar. thinking if add view want add uiview when uisegmentedcontrol selected, life great: -(ibaction) indexdidchangeforsegmentedcontrol:(uisegmentedcontrol*)seg{ int selectednum = seg.selectedsegmentindex; if([[self.view1 subviews] objectatindex:0] != nil){ [[[self.view1 subviews] objectatindex:0] removefromsuperview]; } if(selectednum == 0){ [self.view1 addsubview:[(dialoginfo*)[viewsarray objectatindex:seg.selectedsegmentindex] view]]; }else if(selectednum == 1){ [self.view1 addsubview:[(dialogmetadata*)[viewsarray objectatindex:seg.selectedsegmentindex] view]]; }else if(selectednum == 2){ [self.view1 addsubview:[(dialogv...

jsf - Navigation not working -

i have simple jsf application. works fine, not navigation. behaves <navigation-rule> s not there. in faces-config.xml have navigation rules like: <navigation-rule> <from-view-id>/view/party/create/create.xhtml</from-view-id> <navigation-case> <from-outcome>edit</from-outcome> <if>#{partycreate.partytypesearch.code == partytypedao.organisation.code}</if> <to-view-id>/view/party/create/edit-organisation.xhtml</to-view-id> <redirect /> </navigation-case> </navigation-rule> but when click button on create.xhtml page, message: unable find matching navigation case from-view-id '/view/party/create/create.xhtml' action '#{partycreate.displayparty}' outcome 'edit' what can causing it? have second application settings pretty same, , there navigation works fine. how can debug check wrong? there no error messages while initialization etc. the decla...

gnu make - variable target in a makefile -

i trying compile set of targets. seems first one. below cut down of makefile shows error. objects = abc def ghi sources = abc.c def.c ghi.c $(objects): $(sources) @echo target $@, source $< in shell, $ touch abc.c def.c ghi.c $ make when run make following output: target abc, source abc.c so seems running first target. if replace $< $^, output is: target abc, source abc.c def.c ghi.c my question, possible perform expansions on variables (%: %) pattern? try this: objects = abc def ghi all: $(objects) $(objects):%:%.c @echo target $@, source $< the trouble was the default target (which make chooses if type `make`) first target in makefile, `abc`. you made all sources prerequisites of every object. is, 3 sources prerequisites of `abc`. prerequisites of `def` , of `ghi`.

zeromq - Python Multi-Processing Question? -

i have folder 500 input files (total size of files ~ 500[mb]). i'd write python script following: (1) load of input files memory (2) initializes empty python list later used ... see bullet (4) (3) start 15 different (independent) processes: each of these uses same input data [from (1) ] -- yet uses different algorithms processes it, generating different results (4) i'd independent processes [from step (3) ] store output in same python list [same list initialized in step (2) ] once 15 processes have completed run, have one python list includes results of 15 independent processes. my question is, possible above efficiently in python ? if so, can provide scheme / sample code illustrates how so? note #1: running on strong, multi-core server; goal here use processing power while sharing memory { input data , output list } among independent processes. note #2: working in linux environment ok whipped using zeromq demonstrate single subscriber...

iphone - Animating a table view section header -

i have created table view section header. uiview container wrapped elements go on section header. this container view returned - (uiview *)tableview:(uitableview *)tableview viewforheaderinsection:(nsinteger)section and working fine. now want header appear in fade in, table appears. so, declare alpha = 0 container , on viewdidappear: (ah, table inside view controller appearing). - (void)viewdidappear:(bool)animated { [super viewdidappear:animated]; [uiview animatewithduration:1.0 animations:^{ [self.tableheader setalpha:1.0f]; }]; } nothing happens , header continues invisible. i have tried add: [self.tableview beginupdates]; //and [self.tableview beginupdates]; before , after mentioned animation, without success. it appears me table header not updating , continues invisible. first, put nslog on both viewdidappear , tableview:viewforheaderinsection: you gonna see viewdidappear executes first, once tableview ...

javascript - Goto page with textfield value as hash -

ok, should easy me doesn't seem so... because i'm close deadline , have lot do. this i'm trying do; have html form textfield , button - whenever button clicked or enter pressed goto particular page text field's value on end hash. for instance; user enters "test" , presses enter or hits button , page goes "google.com#test" <html> <head> <script type="text/javascript"> function do_it() { var hash = document.getelementbyid("hash_input").value; window.location = "http://google.com#"+hash; } </script> </head> <body> <input id="hash_input" type="text"></input> <input type="button" onclick="do_it()" value="go"></input> </body> </html>

visual studio 2010 - Debug symbols not loaded when converting to .net 4 -

i have .net 3.5 project in c# hits breakpoints fine when f5 in visual studio 2010. however, when change project target framework .net4, , hit f5, breakpoints not hit. if mouse on breakpoint icon see no debug symbols have been loaded document. if change target framework .net3.5, breakpoints hit expected. pointers should why is? click debug, windows, modules, right-click assembly, , click symbol load info.

How to expand the hidden rows in excel using vba? -

i have spreadsheet, has 100 rows. among these 100 rows, 10 rows required displayed @ first, other 90 rows should collapsed(hidden) @ first. if user wants read whole 100 rows, he/she can click button expand spreadsheet of 10 rows 100 rows. how implement kind of function in vba? you use command button: private sub commandbutton1_click() '// label button "show rows" me.commandbutton1 if .caption = "show rows" .caption = "hide rows" rows("11:100").hidden = false else .caption = "show rows" rows("11:100").hidden = true end if end end sub or toggle button: private sub togglebutton1_click() '// label "show/hide rows" rows("11:100").hidden = not togglebutton1.value end sub

iphone - Different name for ipad application -

i have developed ipad application. want submit application on apple store. application name quite long enough "*** ***** *****" can not seen on ipad screen. can have different app name display *** **** on ipad , different apple store submission. kindly help. thank in advance... in info.plist, key "bundle display name", that's name show under icon. when submit appstore, they'll let pick name. 1 not override name on info.plist.

How to set JSP response locale in Jetty 7/8? -

if set http response locale programmatically in servlet follows: @override protected void doget(httpservletrequest request, httpservletresponse response) throws ioexception, servletexception { response.setlocale(some_locale); // .. etc } then under jetty 7 , later, jsps trying read locale via expression ${pagecontext.response.locale} server's default locale instead of 1 set above. if use jetty 6 or tomcat, works fine. here's full code demonstrate problem: public class myservlet extends httpservlet { // use dummy locale that's unlikely user's default private static final locale test_locale = new locale("abcdefg"); @override protected void doget(final httpservletrequest request, final httpservletresponse response) throws ioexception, servletexception { // set known response locale response.setlocale(test_locale); // publish interesting locales jsp request attributes debugging ...

php cli reading files and how to fix it? -

while using php cli in ubuntu got apache web server cant read file can while using in browser. , error shows nothing , next used code testing purposes : <? $handle = fopen("testfile.txt", "r"); if ($handle) { while (($buffer = fgets($handle, 4096)) !== false) { echo $buffer; } if (!feof($handle)) { echo "error: unexpected fgets() fail\n"; } if(!is_readable($handle) { die("not readable"); } fclose($handle); } ?> how fix ? edit : after removing '@' before fopen got following error fopen(testfile.txt): failed open stream: no such file or directory in /var/www/log/ka.php on line 2 when run script through cli, uses shell's working directory, in opposition file's directory (which apache hands current directory). important you, since fopen call depends on relative path; , relative paths resolved relatively working directory, not script. to have script behave apache, eit...

android - Intent.putExtra List -

possible duplicate: how put list in intent i want pass list 1 activity another. far have not been successful. code. //desserts.java private list<item> data; @override public void oncreate(bundle icicle) { //code data.add(new item(10, "dessert1")); data.add(new item(11, "dessert2")); data.add(new item(12, "dessert3")); data.add(new item(13, "dessert4")); data.add(new item(14, "dessert5")); data.add(new item(15, "dessert6")); data.add(new item(16, "dessert7")); data.add(new item(17, "dessert8")); data.add(new item(18, "dessert9")); data.add(new item(19, "dessert10")); data.add(new item(20, "dessert11")); //some more code } @override public void onclick(view v) { intent view_order_intent = new intent(this, thirdpage.class); view_order_intent.putextra("data", data); startactivity(view_order_intent); } but not able put dat...

apache - "Connection reset on log" from Commons DBCP -

i using spring, hibernate crud operations , using apache 'basicdatasource' connection pooling problem when use below following configuration in datasource <property name="maxactive" value="100"/> <property name="maxwait" value="10000"/> <property name="removeabandoned" value="true"/> <property name="removeabandonedtimeout" value="60"/> <property name="logabandoned" value="true"/> <property name="maxidle" value="10"/> than after using connections m getting error of "connection reset on log" takes long time back. and if m removing following lines datasource <property name="removeabandoned" value="true"/> <property name="removeabandonedtimeout" value="60"/> <property name="logabandoned" value="true...

javascript - How to fix header of table -

possible duplicate: how freeze table header i having table getting populated through ajax call, having fallowing structure- <table> <thead> <tr> <th colspan="4">current</th> <th colspan="4">new/requested</th> </tr> <tr> <th nowrap="nowrap">rsd &nbsp;&nbsp;&nbsp;&nbsp;</th> <th nowrap="nowrap">crsd &nbsp;&nbsp;&nbsp;&nbsp;</th> <th nowrap="nowrap">msd &nbsp;&nbsp;&nbsp;&nbsp;</th> <th nowrap="nowrap">open qty &nbsp;&nbsp;&nbsp;&nbsp;</th> <th nowrap="nowrap">crd &nbsp;&nbsp;&nbsp;&nbsp;</th...

Giving controls to a game from a java code -

i want know how can give controls (key values up, down, left, right arrow keys etc) installed desktop application game own java program? game installed on system , want give key values directly code. check out api: http://download.oracle.com/javase/1.4.2/docs/api/java/awt/robot.html

Problem importing images using New Magento Import -

i trying import products using import/export in enterprise version 1.10. import/export same included in 1.5. my issue when import file,images not importing correctly. i use "/imagename.jpg" in image column. put images in media/import folder. what strange when export file , show me same image name in image column "/imagename.jpg" , there no image showing in product->images in admin. any appreciated. first of make sure import file has prepending slash image “sku”,"image" “abc123”,"/abc123.jpg" try follow these steps: list sample product on store. export csv sample (for go to: system>import/export>dataflow - profiles select export products) open , edit csv, make sure use openoffice calc - allow edit , save in utf-8 format. add additional products line line. in image field put /myimage.jpg - forward slash , image name ensure place product images in folder: public_html/media/import now need import csv (for go ...

wcf - At least one security token in the message could not be validated -

server config: <?xml version="1.0"?> <configuration> <system.servicemodel> <behaviors> <servicebehaviors> <behavior name="servicecredentialsbehavior"> <servicecredentials> <servicecertificate findvalue="cn=cool" storename="trustedpeople" storelocation="currentuser" /> </servicecredentials> <servicemetadata httpgetenabled="true" /> </behavior> </servicebehaviors> </behaviors> <services> <service behaviorconfiguration="servicecredentialsbehavior" name="service"> <endpoint address="" binding="wshttpbinding" bindingconfiguration="messageandusername" name="securedbytransportendpoint" contract="iservice"/> </service...

c# - Why is the resource stream always null? -

hopefully simple have tried , tried , keep failing. attempting create stream object in c# application copy css file specific location. css file embedded in resources. regardles of have tried stream object null. can please point in right direction looking @ below? thanks :) burrows111 assembly assemb = assembly.getexecutingassembly(); stream stream = assemb.getmanifestresourcestream(thisnamespace.properties.resources.clockingsmapstyle); // null!!!! filestream fs = new filestream("to store in location", filemode.create); streamreader reader = new streamreader(stream); streamwriter writer = new streamwriter(fs); writer.write(reader.readtoend()); this works me: streamreader reader; streamwriter writer; stream stream; assembly assembly = assembly.getexecutingassembly(); using (stream = assembly.getmanifestresourcestream("namespace.stylesheet1.css")) using (reader = new streamreader(stream)) using (writer = new streamwriter("test.css")) { ...

javascript - Jquery find+length/size returns 0 -

i have divs created dynamically way: //here goes loop, , works fine $("#result_main_search").append('<div class="singleresult_main_search"> <a href="http://somesite.com/" class="linktosight">' + sightslist[i]+ '</a> – ' + '<img src="/images/balloon.gif" rel="'+ +'" class="balloon_img_main_search" /></div>'); after loop, try set href attribute each link: $('.singleresult_main_search').each(function() { $.get("_ajax_get_sight_link.php", {'id':$("img", this).attr('rel')}, function(data) { alert($(this).find('.linktosight').length); $(this).find('a').attr('href', data); alert(data); }); }) _ajax_get_sight_data.php accepts id, returns link ( alert(data) works fine) . alert tells how .linktosight elements in current div gives 0 (by saying...

android - How to read EPUB book using EPUBLIB? -

i found solution reading epub books in android using epublib. able read subtitles of book. didn't find way read line line of content. how can acheive this? sample code getting titles of book is private void logtableofcontents(list<tocreference> tocreferences, int depth) { if (tocreferences == null) { return; } (tocreference tocreference : tocreferences) { stringbuilder tocstring = new stringbuilder(); stringbuilder tochref=new stringbuilder(); (int = 0; < depth; i++) { tocstring.append("\t"); tochref.append("\t"); } tocstring.append(tocreference.gettitle()); tochref.append(tocreference.getcompletehref()); log.e("sub titles", tocstring.tostring()); log.e("complete href",tochref.tostring()); //logtableofcontents(tocreference.getchildren(), depth + 1); } } got code http://www.siegmann.nl/epublib/android ...

ruby on rails - open-uri open command run on a domain, against the same domain -

ive built form on webpage allows user enter url , information url's css returned. tool works fine, apart 1 issue have noticed. when enter url of site script hosted (tested locally, on staging server , on production server), open-uri command 'open' returns timeout::error. isn't hugely surprising, i'm guessing getting locked somewhere along line , in process of running script , opening current url, processes getting tied little. for reference, here method timeout occurs: # loads nokogiri xml object if hasn't been loaded def site begin timeout(10) @site ||= nokogiri::html(open(url)) end rescue timeout::error return nil end end my question is, how enable script able 'open' domain script running on? need create thread or process particular aspect of tool, if how ensure rest of script isn't run until receive valid 'open' command? thanks suggestions or tips on this. i wonder if you're gett...

iphone - error in zxing api -

i have downloaded zxing apis net , included 6 needed frameworks, still getting error like: 'avcapturedevice' undeclared (first use in function). 'avcapturetorchmodeon' undeclared (first use in function) plz guide me how solve. thanks. you need add avfoundation framework. if have done this, check enabled target building.

Windows Task Manager shows process memory keeps growing even though there are no memory leaks -

my application keeps consuming more , more memory seen in windows task manager , crashes due outofmemory. when check leaks using memoryvalidator (from www.softwareverify.com) no leaks detected. why happening? just because there growing amount of memory usage doesn't mean 'leaking'. accumulating large number of live objects and/or large ones (containing lots , lots of data). if can provide more information language(s) using , application doing can perhaps out more specific information! update per comments well, you'll want make sure garbage collection happening correctly. i'd suggest libgc library perhaps. http://developers.sun.com/solaris/articles/libgc.html the other thing think of being cause of maintaining references objects somewhere unintentionally piling up.

android - Cannot play video inside WebView using iframe tag? -

i using following data display in webview . these html tags along iframe referring video. now problem when click on it, shows play button cannot play video. can play video inside webview or not? &lt;p&gt;&lt;/p&gt;&lt;p&gt; because of jon’s pro-growth, business-friendly policies,&amp;nbsp;utah&#039;s economy expanded @ more triple national rate , named best state business by&amp;nbsp;&lt;em&gt;forbes.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;iframe height=241 src=&quot;http://player.vimeo.com/video/25349114&quot; frameborder=0 width=425&gt;&lt;/iframe&gt;&lt;/p&gt;&lt;br /&gt; &lt;p&gt;america needs dose of same medicine. today, our nation has second highest corporate tax rate in developed world. have convoluted , confusing regulations. &lt;!--break--&gt;&lt;!--break--&gt;&lt;p&gt;&lt;/p&gt; when try run url in android browser o...

Android Finish activity error -

so have problem getting activity finish , go parent(right term?) activity. it gets thread activitythread.performresumeactivity(ibinder, boolean) line: 2241 , gives me invocationtargetexception.(throwable) line:50 following error java.lang.runtimeexception: unable resume activity {com.android.market.companionpushup/com.android.market.companionpushup.workoutactivity}: java.lang.illegalstateexception: database /data/data/com.android.market.companionpushup/databases/exercise data closed so guess i'm confused, how have error dealing database when trying finish activity , go original activity (but never hits onresume method in original activity). the code called start new activity public void takerest(int time, int addtime) { intent = new intent(this, timeractivity.class); i.putextra("time", time); i.putextra("addtime", addtime); startactivity(i); } then custom timer runs until click button skip rest of timer. @ point never goes ori...

.net - UnauthorizedAccessException when writing text file to C:\ on Windows 7 -

i have moved windows 7. .net application fails writing log file c:\ my tracelistener throwing exception. a first chance exception of type 'system.unauthorizedaccessexception' occurred in mscorlib.dll what do? running application studio , think must inherit rights , admin on pc. if have uac enabled won't able write files c:\ , if you're admin, unless start program in elevated mode activate admin privileges. files shouldn't placed in root of c: , best create subdirectory , give access rights (to account, not administrators group). if want have file on c:\ , not run elevated, can use windows explorer grant (your account, not administrators group) write access c:\ .

sitecore - Extranet users in Page Editor -

i give extranet users access edit fields in pages using page editor, how do this? i've managed give user access page editor can not life of me figure out make fields editable. see ribbon, cannot edit fields the user has following role: sitecore\author if getting error "do not have priviledges language," should check user or role's permission on language item. edit: check language read , language write access /sitecore/system/languages/en. in security and/or access viewer tool, use columns ribbon button add language read , language write columns display.

pattern searching in perl -

use strict; use warnings; open(file1, "/cygdrive/c/cpros/mola.txt"); $line = <file1>; print $line; close(file1); open(file1, ">/cygdrive/c/cpros/mola.txt"); if ($line = ~ /karthik/) { print file1 ("1"); } else { print file1 ("0"); } close(file1); i have stored hello world in mola.txt file still printing 1 pattern karthik not saved in file why printing 1 ? how make search patterns? =~ separate operator, shouldn't have whitespace between characters. whitespace, condition of if statement becomes assignment yields true.

qt - Returning QVariantList in Visual Studio 2008 crashes -

we have function converts json objects retrieved c library qvariants. data types work fine---booleans, numbers, strings, objects/maps---except lists. when function returns list, crashes on exit of function due "invalid address specified rtlvalidateheap", presume means double free has occurred. the following code demonstrates error: qvariant no_crash() { qvariantmap map; map["hello"] = "world!"; qdebug() << map; return map; } // qmap(("hello", qvariant(qstring, "world!") ) ) qvariant crash() { qvariantlist list; list << "hello world!"; qdebug() << list; return list; } // (qvariant(qstring, "hello world!") ) i have seen posts this, seem visual studio 2010 , not being compatible binary version of qt sdk. have tried qt 4.7.3 downloaded http://qt.nokia.com/downloads/sdk-windows-cpp . the crash occurs when list goes out of scope; long return value propagated ...

asp.net - Hide Checkbox Icon for a ListItem in checkboxlist -

Image
is there way hide checkbox icon listitem , display value-text. like below - checkbox items hidden. i figure out disable (grey-out) or hide (invisible) list item not hide checkbox icon (square) i did part of project , accomplished via setting attribute when creating listitem , using css style it. li.attributes.add("id", "removecheckbox"); since attribute added part of tag, can use following descriptor in css. #removecheckbox { color: gray; } #removecheckbox input { display: none; } of course, can format css way you'd like, should started. if you'd more information using selectors in css, check out this reference w3.org . hth!

ruby - Ternary operator -

i have array d = ['foo', 'bar', 'baz'] , , want put elements string delimited , , and @ last element become foo, bar , baz . here i'm trying do: s = '' d.each_with_index { |x,i| s << x s << < d.length - 1? == d.length - 2 ? ' , ' : ', ' : '' } but interpreter gives error: `<': comparison of string 2 failed (argumenterror) however, works += instead of << , ruby cookbook says that: if efficiency important you, don't build new string when can append items onto existing string. [and on]... use str << var1 << ' ' << var2 instead. is possible without += in case? also, there has more elegant way of doing code above. you're missing parenthesis: d = ['foo', 'bar', 'baz'] s = '' d.each_with_index { |x,i| s << x s << (i < d.length - 1? (i == d.length - 2 ? ' ...

crystal reports - Java Reporting Component Retain Color Depth -

in visual studio .net there crystal report option retain color depth. there equivalent option in java reporting component? using printoutputcontroller export pdf. appears retaining color depth, , not to. reduce overall size of pdf. any appreciated. contacted sap , stated there no equivalent option. this relevant when report contains several images. consider loading , rescaling images pojos. can reduce size significantly. further compression can used if still not acceptable level.

addclass - jQuery, 960.gs - Apply 'alpha' and 'omega' classes to every 1st and 4th div -

i creating layout using 960 grid system , have div items displayed automatically. need able apply 'alpha' class first , 'omega' class fourth e.g. div-alpha,div,div,div-omega,div-alpha,div,div,div-omega. using code below applying alpha class of divs : var n = $("div.item").length; $('div .item').filter(function(index) { return n % 5 == 1; }).addclass('alpha'); $('div .item').filter(function(index) { return n % 5 == 5; }).addclass('omega'); how can achieve this? many in advance. you do: var divs = $("div.item"); var length = divs.length divs.eq(3).addclass('omega'); divs.eq(0).addclass('alfa'); divs.eq(length-1).addclass('omega'); if there container contains divs use nth-child() selector

Architecture design for a simple android application -

i want design package arhitecture simple android application. login , choose type of restaurant (fast food/ chinesse/ indian etc ) after can see restaurants type choose , can add restaurant favorite. can see restaurant menu /news/pics thinking of 5 packages: activity handler persistency service util the activity send requeests handler , handler objject in persistency (is list of restaurant created ) or ask info server (a service class request) in case set persistency (i think use cahe manager ) in util have classes xml parser etc in persistency created classes restaurant, user , news not sure if done , have advice me ? lot

android - FINE_LOCATION has less accuracy than COARSE_LOCATION -

as per understanding of accessing location on android: the location provider needs permission access_coarse_location, has lower accuracy, faster in retrieving location. the gps provider needs permission access_fine_location, has higher accuracy, , slower in retrieving location. so understand better, ran following code //go through list of location providers "best" 1 list<string> locationproviders = locationmanager.getallproviders(); (string locationproviderinit : locationproviders) { log.d(debug_tag, "found locationprovider:" + locationproviderinit); location lastknownlocation = locationmanager.getlastknownlocation(locationproviderinit); if (lastknownlocation != null) { log.d(debug_tag, "accuracy: " + lastknownlocation.getaccuracy()); log.d(debug_tag, "time: " + lastknownlocation.gettime()); } } while network location provider consistently give accuracy of 60.0, gps location provider gives acc...

asp.net - Opening web project set to IIS directory in machine without IIS, pointing to embedded server -

i can open web project in tfs; however, in qa environment have change use iis. in local dev environment, don't have iis , can't install it. new company rules deny access in qa me , can't open web project fix in machine. when open project receive "the web application project ... configured use iis. access local iis web sites, must run visual studio in context of administrator account." open administrator vs asks virtual directory creatred on iis. the ngm link can help, if need step-by-step way go .csproj file property. make writable, open in text editor , search <useiis>true</useiis> turn <useiis>false</useiis> . open solution, latest version , when receive warning, keep local version of modified .csproj. can check-in modified .csproj stop troubles in next latest version. bye

c# - Attempted to read or write protected memory in Oracle 11g with ODP.NET -

i developing application supposed run long periods , make extensive usage of oracle (11g) database via odp.net. it happens, though, once in while (every 2 or 3 days) system.accessviolationexception thrown odp.net , application needs restarted. here stack trace: unhandled exception: system.reflection.targetinvocationexception: exception has been thrown target of invocation. ---> system.accessviolationexception: attempted read or write protected memory. indication other memory corrupt. @ oracle.dataaccess.client.opssql.prepare2(intptr opsconctx, intptr& opserrctx, intptr& opssqlctx, intptr& opsdacctx, oposqlvalctx*& poposqlvalctx, string pcommandtext, intptr& putf8commandtext, opometvalctx*& popometvalctx, int32 prmcnt) @ oracle.dataaccess.client.oraclecommand.executenonquery() the rest of stack trace different time time , refers internal calls application. now, i've made fair amount of research before asking here, have found nothing conclusive...

iphone - How to create a rich Text Editor using the new iOS 5 for the iPad? -

if want create rte using new ios beta developers. how can that? the same way on ios 4, apple didn't release new rich text editing stuff developers (annoyingly). the new rich text editing apple added ios in mail app (which announced in keynote, not under nda). have @ of these. egotextview : http://www.cocoacontrols.com/platforms/ios/controls/egotextview bctextview : http://www.cocoacontrols.com/platforms/ios/controls/bctextview jtextview : http://codaset.com/jer/jtextview http://www.cocoacontrols.com/search?utf8=%e2%9c%93&q=rich+text&commit=search

jsp - Format Spring:message argument -

how can format arguments of <spring:message> ? i have message this: message.mymessage=this {0} message {1} {2} multiple arguments my jsp has following: <spring:message code="message.mymessage" arguments="<fmt:formatnumber value='${value1}' currencysymbol='$' type='currency'/>,${value2},${value3}" htmlescape="false"/> which doesn't display value1 , number formatted. i not sure can add fmt tag inside argument list. the arguments attribute of <spring:message> can contain jsp el expressions, not jsp tags. try un-nesting it. can assign result of <fmt:formatnumber> variable, e.g. <fmt:formatnumber var="formattedvalue1" value='${value1}' currencysymbol='$' type='currency'/> <spring:message code="message.mymessage" arguments="${formattedvalue1},${value2},${value3}" htmlescape=...

php - cloning form elements and the return a template file -

i building website, on click of link can clone form elements, wanting know that, when send $_post controller , check information submitted correct, how return template has enough elements errors can rectified, example original form looks this, <fieldset class="entry"> <label for="email_address">email address</label> <input type="text" name="email_address[]" value="" class="text small"/> <label for="firstname">firstname</label> <input type="text" name="firstname[]" value="" class="text small"/> <label for="surname">surname</label> <input type="text" name="surname[]" value="" class="text small"/> </fieldset> how can return correct amound of fieldsets based on $_post? to answer this: how can retu...

.net - When is it worth implementing a WIF solution? -

i'm trying build / architect security solution intranet application , i'm wondering if implementing wif level solution worth it, given requirements. essentially, have following things considerations the general platform asp.net mvc 3 / windows servers / sql server 2008 r2 database. information comes our system outside vendor provides workflow software solution since vendor software covers part of company's typical workflow, they'll sending data rest call. our end uses wcf rest calls receive data. a vpn tunnel supposed built outside vendor's servers part of security. there's pressure top vpn isn't enough security. also, there authorization issues (some users shouldn't have access data), should have identifies users on our end vendor's end insure information right person, proper rights make these changes. the outside vendor has own security system, nothing can tap into, i'm not sure what, if anything, can synchronize security. the pie...

jsf 2 - Why outputText wrapped in div is not rendered? -

do have idea why following outputtext component not rendered when wrapped inside div? <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html"> <h:head> <title>welcome</title> </h:head> <h:body> <div> <h:outputtext>this line not rendered</h:outputtext> </div> </h:body> </html> for example, html page rendered following: <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><h...

php - $_POST empty, sending form values with Ajax -

html <form action='insert.php' method='post'> <p><b>client:</b><input type='text' name='idclient'/> <p><b>total:</b><br /><input type='text' name='total'/> <p><input type='submit' value='save' id="btnsave"/> <input type='hidden' value='1' name='submitted' /> </form> php (insert.php) <?php echo file_get_contents('php://input'); include_once "connect.php"; if ($db_found){ if (isset($_post['submitted'])) { foreach($_post $key => $value) { $_post[$key] = mysql_real_escape_string($value); } $sql = "insert `mytable` ( `idclient` , `total` , ) " . "values( {$_post['idclient']} , {$_post['total']} ) ...

How to escape white space in nmake -

i´m trying use nmake call mstest test="%vs90comntools%..\ide\mstest.exe" test: $(test) /testcontainer:test.dll when run nmake got: $ nmake test 'c:\program' not recognized internal or external command, double quote doesn´t work right edit: thanks "eric melski". created like: test_="%vs90comntools%..\ide\mstest.exe" test="$(test_)" /nologo /noresults test: $(test) /testcontainer:test.dll put double quotes around usage of $(test) well: test="%vs90comntools%..\ide\mstest.exe" test: "$(test)" /testcontainer:test.dll works nmake 7 , 8.

javascript - Get the input type of a textbox -

i making chrome extension trying listen mouse clicks using message passing. i want know if possible obtain input type of textbox when mouse ic clicked on textbox ? the type of input property on element. for example, can open chrome inspector on page , type in console: var firstinput = document.getelementsbytagname('input')[0]; firstinput.type; // outputs "text" edit: bind click on these elements , type event.target property of event.

reporting services - Using MS ReportViewer with MFC -

i support legacy mfc c++ application (vs2005) , want call ssrs reports (ms reporting services). hoping use ms report viewer control, works .net. i’ve come ideas, keep thinking i’m working against conventional knowledge. i’m hoping second opinion. we have report server setup (remote server processing). nice call reports directly mfc application (i.e. show summary report customer, etc). right now, calling internet explorer directly parameter(s) in url. it’s simple, works, it’s rather limiting. example, can’t setup printer options. i’ll mention our project not compile /clr option – use few 3rd-party libraries , between , others way many linking errors. it’s not feasible try working project. i came idea of creating simple c# application wraps reportviewer, , control via few command line options (server, report name). however, doesn’t parameters – i’d have come way of sending parameters , our wrapper program have parse them out, etc. i thought creating dll , calling m...

objective c - Erasing Cocoa Drawing done by NSRectFill? -

i have nsbox , inside of drawing small rectangles, nsrectfill() . code looks this: for (int = 0; <= 100; i++){ int x = (rand() % 640) + 20; int y = (rand() % 315) + 196; array[i] = nsmakerect(x, y, 4, 4); nsrectfill(array[i]); } this loop creates 100 randomly placed rectangles within grid. have been trying create sort of animation, created code running on , over, creating animation of randomly appearing rectangles, code: for (int = 0; <= 10; i++) { [self performselector:@selector(executeframe) withobject:nil afterdelay:(.05*i)]; } the first loop thing inside executeframe function, way. so, need erase rectangles between frames, number of them stays same , moving. tried doing drawing background again, calling [mynsbox display]; before calling executeframe , made seem though no rectangles being drawn. calling after did same thing, did switching in setneedsdisplay instead of display. cannot figure 1 out, appreciated. by way, addit...

jquery - data.success undefined -

working on submission form ajax, json , php. data handled db, script, alert(data.success), says data.success undefined. if alert(data), shows need there {"success":"http:\/\/myaddress.com"} function confirmsubmit() { $.ajax({ type: 'post', url: 'index.php?route=payment/authorize/send', data: $('#authorize :input'), beforesend: function() { var img = '<?php echo $text_wait; ?>'; $('#authorize_button').attr('disabled', 'disabled'); $('#authorize').before('<div class="wait"><img src="catalog/view/theme/default/image/loading_1.gif" alt="" /> ' + img + '</div>'); alert('start'); }, success: function(data) { if (data.error) { alert('errors...'); alert(data.error); $('#authorize_button').attr('disabled...

MongoDB C# driver - serialization of POCO references? -

i'm researching mongodb @ moment. it's understanding official c# driver can perform serialization , deserialization of pocos . haven't found information on yet how reference between 2 objects serialized. [i'm talking represented 2 seperate documents, id links, rather embeded documents. can serialization mechanism handle kind of situation? (1): class thing { guid id {get; set;} string name {get; set;} thing relatedthing {get; set;} } or have sacrifice oop, , this? (2) : class thing { guid id {get; set;} string name {get; set;} guid relatedthing_id {get; set;} } update: just couple of related questions then... a) if serializer able handle situation (1). example of how without using embedding? b) if using embedding, possible query across 'things' regardless of whether 'parents' or embedded elements? how such query like? the c# driver can handle serializing class containing reference instance of (1). h...

PHP echo file contents -

i have pdf file located off webpage's root. want serve file in ../cvs users using php. here code have sofar: header('content-type: application/pdf'); $file = file_get_contents('/home/eamorr/sites/eios.com/www/cvs/'.$cv); echo $file; but when call php page, nothing gets printed! i'd serve pdf file stored name in $cv (e.g. $cv = 'xyz.pdf' ). the ajax response php page returns text of pdf (gobbldy-gook!), want file, not gobbldy-gook! i hope makes sense. many in advance, here's ajax i'm using $('#getcurrentcv').click(function(){ var params={ type: "post", url: "./ajax/getcv.php", data: "", success: function(msg){ //msg gobbldy-gook! }, error: function(){ } }; var result=$.ajax(params).responsetext; }); i'd user prompted download file. don't use xhr (ajax), link script 1 below. http headers...

perl - Using Google Latitude API to get friends' locations -

i'm thinking writing perl script use google latitude api track bunch of people doing big bike ride. the idea share location, script uses api, logs in me , polls google everyone's position every 60 seconds or so. but, i've been looking on google latitude api , looks can , set own location. case? each of users need authenticate using oauth application. once have done that, use latitude api on each individual account pull necessary data. there no way data on user has not individually allowed application access data (that is, no way poll friends locations). http://code.google.com/apis/latitude/faq.html#oauthaccess

flex - How does Flash Builder determine which sdk libraries to include? -

when creating new project in flash builder, how determine sdk libraries include in build path? if create new plain actionscript project , select flex 4.1 following libraries show in build path: playerglobal textlayout osmf flash-integration flex utilities if go , switch flex 3.5 includes: playerglobal flex utilities if make new flex web project , select flex 3.5 includes: playerglobal framework automation automation_agent automation_dmv automation_flashflexkit datavisualization qtp rpc utilities are these values hardcoded in flash builder or somehow reading them sdk config files? looked through xml config files flex-config.xml , air-config.xml , doesn't information exists anywhere. thanks. yes, it's built framework swc's. can find references , they're linked in under /frameworks/build.xml file in framework directory. so edit build file, rebuild swcs , use , they'll link how like. for example, (from flex 4....

Trouble adding a Workflow Activity to the Toolbox from a PowerShell Script -

i’m creating powershell script (for nuget) can add system.activities workflow activities toolbox. currently i’m installing them c# code written cmdlet causes problems when try uninstall package since nuget has assembly loaded , can’t deleted. my goal powershell don’t have load assembly. i’m close except last line add toolbox item blows "object must implement iconvertible." leads me believe thinks i’m passing wrong type.. know $toolbox interface working because add tab toolbox. function addactivity ( [string] $activity, [string] $assemblyfullname, [string] $name, [string] $category, [string] $bitmappath) { write-host "argument list" write-host $activity write-host $assemblyfullname write-host $name write-host $category write-host $bitmappath write-host "loading assemblies" $assembly = [reflection.assembly]::load("microsoft.visualstudio.shell.interop") write-host "get toolbox service...

webserver - Which is the proper HTTP response code for redirection? -

when web server wishes redirect user's browser, status code (ie, "200 ok") should place in response header? reading seems answer 1 of 3xx codes, each of codes seems have different description. matter used long "location" in response header? to save me lot of typing - read this , this . nb - not 3xx codes redirection. semantics of 301, 302, 303 , 307 similar.

mysql - How can I count the number of entities that don't have certain attributes grouped by a common attribute in an EAV(ish) schema? -

i'm trying count region of number of files don't contain "important" attributes given following dataset: files ------------------------------------ id | file | region ------------------------------------ 1 | data.xml | eastern 2 | 2011-01-01-report.xml | eastern 3 | regional report.xml | western 4 | data.xml | central 5 | 2010 summary.xml | eastern file_attributes -------------------------------------------- file_id | attribute | value | importance -------------------------------------------- 1 | patients | 18 | 0 1 | deaths | 17 | 1 2 | clients | 5 | 0 3 | refunds | 12 | 1 5 | deaths | 4 | 1 i can count of number of files have important attributes this: select region , count(f.id) file_count , count(distinct if(fa.importance = 1, f.id)) files_w_important_attr , count(distinct if(fa.importance = 0, f.id)) files_w_u...

image processing - Algorithm to detect corners of paper sheet in photo -

what best way detect corners of invoice/receipt/sheet-of-paper in photo? used subsequent perspective correction, before ocr. my current approach has been: rgb > gray > canny edge detection thresholding > dilate(1) > remove small objects(6) > clear boarder objects > pick larges blog based on convex area. > [corner detection - not implemented] i can't think there must more robust 'intelligent'/statistical approach handle type of segmentation. don't have lot of training examples, 100 images together. broader context: i'm using matlab prototype, , planning implement system in opencv , tesserect-ocr. first of number of image processing problems need solve specific application. i'm looking roll own solution , re-familiarize myself image processing algorithms. here sample image i'd algorithm handle: if you'd take challenge large images @ http://madteckhead.com/tmp case 1 http://madteckhead.com/tmp/img_0773_sml.jpg case 2...