Posts

Showing posts from February, 2010

java - How to get the list of available folders in a mail account using JavaMail -

i using javamail api connect personal account. have list of folders (labels) in gmail account created + default folders inbox, drafts etc. how can list available folders (the default , user created)? i can access particular folder using api: folder inbox = store.getfolder("inbox"); . there other api list of folders available in mail account? here code works. give handle labels. go deeper in folder , may perform folder.list() or can use store.getdefaultfolder().list("*") retrieve folders , sub-folders suggested in other answer. properties props = system.getproperties(); props.setproperty("mail.store.protocol", "imaps"); session session = session.getdefaultinstance(props, null); store store = session.getstore("imaps"); store.connect("imap.gmail.com", "yourmailid@gmail.com", "ur_p@zzwrd"); system.out.println(store); folder[] f = store.getdefaultfolder().list(); for(folder fd:f) system.o...

c# - How to change SOAPException ResponseCode -

i using soapexception handle invalid inputs , other kind of exception handling in web service. it's working fine , able format , return proper information client. following method similar 1 explained here http://www.codinghorror.com/blog/2004/08/throwing-better-soap-exceptions.html now want change response code returns when soapexception happens ( responsecode: 500 internal server error ). following default response code getting in addition own custom xml data when soapexception occurs. want change responsecode 200.. possible , how? responsecode: 500 (internal server error) connection:close content-length:494 cache-control:private content-type:text/xml; charset=utf-8 date:tue, 25 jan 2011 06:59:30 gmt server:asp.net development server/8.0.0.0 x-aspnet-version:2.0.50727 in support of john sauders' word of warning above, according ws-i basic profile: "r1126 instance must use "500 internal server error" http status code if r...

php - What would be a good strategy for a variable for prefixing a static resource? -

we scaling website , plan future may want host our images in sub-domain (or perhaps separate domain altogether, e.g. cdn ). reference images in our html/php code using following html: <img src="/images/ourlogo.jpg" alt="our logo" /> i thinking of starting company convention move to: <img src="<?php echo stat_img;?>ourlogo.jpg" alt="our logo" /> where stat_img global php constant, defined identical current situation, i.e. define('stat_img', '/images/'); but later changed such as: define('stat_img', 'http://www.superfastcdn.com/'); will run issues doing this? things have thought about: i can see there'll many more string appends in code base - don't expect it'll noticeable in terms of performance. it makes code uglier ( especially in example php , html have been mixed ). one issue need explicitly use https images (or vice version). example, if put images in ema...

.net 4.0 - Intellisense supported TextBox in WPf -

i started wpf 4.0. have textbox shall enter linq expressions. want enable intellisense support in texteditor. bringing popup has list of items. have anyother way in wpf. thanks. no, none of built-in controls provide intellisense functionality. it's feature provided code editors, , doubt microsoft intends re-implement visual studio. you'll have write yourself. see here sample: intellisense-like method selection pop-up window a commercial control package option. example: actipro's wpf syntaxeditor

Postgresql query in 10 seconds -

is there way create query run ten seconds ? don't need real data way run query long time can test how system works in time. i prefer not create huge table , make simple select this. tricks? pg_sleep : select pg_sleep(10); but not generate load on system if that's real goal.

asp.net mvc - path to controller action -

it no problem use html.actionlink in view obtain right path controller action. wondering whether possible in other layers (e.g. controller). asking because generating <ul> recursively data access render 'link tree structure'. thanks! christian in controller can use urlhelper create url. string html = string.empty; urlhelper url = new urlhelper(httpcontext.request.requestcontext); string edit = url.action(constants.action_edit, constants.ctrl_mycontroller, new { someid }); html += "<a href=\"" + edit + "\">edit</a> "; this create string html link inside. in example use constants give correct action , controller, of course "normal" string. let me know if need more scenarios

android - adding a layout in another layout -

this question has answer here: how split main.xml other xmls? 1 answer how add 1 layout in layout.i created layout in tblrow.xml.so want add rows in menu.xml.i want add rows depending upon no of rows.how can that.if add how can identify each row.please me.i need solution in java not in xml. code is <tablerow android:id="@+id/tblrowmovies" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="@drawable/btn_backgrnd" android:clickable="true" android:focusable = "true" android:layout_weight="1.0"> <imageview android:layout_width="wrap_content" android:layout_height="fill_parent" android:src="@drawable/movie" android:layout_gravity="center_vertical|center_horizontal"/> <textview android:layout_width="wra...

java - Getting the current offset in the HTMLDocument of a JTextComponent -

in swing application i'm using jtextpane htmldocument backend. @ 1 point i'm inserting sort of placeholders programmatically document document.insertstring(...) for reason, using htmleditorkit.inserthtml() method doesn't make text appear in jtextpane. what i'd know position i'm inserting in document , is, html document written in background. can jtextpane.getcaretposition() but gives me offset in document visible frontend, not resulting one. it has no sence because result document's html text can different. e.g. end of line "\n" or "\r\n" depending on os , jvm settings. html skips e.g. double spaces or spaces between tags. 2 tags without space between them , line break between them has same offset in document. can add custom tag specific id , search result document's html text id.

java - JAXB generated classes serializable with JAX-WS binding -

having jaxb-ri , cxf. wsdl first. want generated class of mine implement serializable . have following binding xml, works (the sei class name gets changed) <jaxws:bindings xmlns:xsd="http://www.w3.org/2001/xmlschema" ...> <bindings node="wsdl:definitions/wsdl:porttype[@name='foo']"> <!-- change generated sei class --> <class name="ifooservice" /> </bindings> </jaxws:bindings> no, in context, , should add. tried: <xsd:annotation> <xsd:appinfo> <jaxb:globalbindings> <xjc:serializable uid="12343" /> </jaxb:globalbindings> </xsd:appinfo> </xsd:annotation> and <jxb:globalbindings> <jxb:serializable/> </jxb:globalbindings> both inside , outside <bindings> tag - either serializable not added, or classes not generated @ (without error). see this thread so, how ...

ruby on rails - Eager loading in "both directions" -

eager loading not work expect. i have products has_many variants , , of course each variant belongs_to product . i use code load product , variants: products = product.includes(:variants) this works: products , variants loaded 2 queries. however, product of each variant not loaded, following code causes sql-query: puts products[0].variants[0].product.title why that, , how can fix it? suppose product.includes(:variants => :product) work, causes 1 big , unnecessary sql-query, since product-data available. active record eager loading association on level you've specified. in point of view, variant.product treated level of association. so, if want eager loading it, you'd have do: products = product.includes({:variants => :product})

mapkit - OverlayView in iPhone -

what meaning of term overlayview in iphone can 1 give me detailed description from apple documentation: the mkoverlay protocol defines specific type of annotation represents both point , area on map. overlay objects data objects contain geographic data needed represent map area. example, overlays can take form of common shapes such rectangles , circles. can describe polygons , other complex shapes. you use overlays layer more sophisticated content on top of map view. example, use overlay show boundaries of national park or trace bus route along city streets. map kit framework defines several concrete classes conform protocol , define standard shapes. because overlays annotations, have similar usage pattern annotations. when added map view using addoverlay: method, view detects whenever overlay’s defined region intersects visible portion of map. @ point, map view asks delegate provide special overlay view draw visual representation of overlay. if add overla...

javascript - cancel postback in linkbutton when binding to jquery click event -

i have linkbutton binding click event using jquery, page still posts no matter try... according this should able use event.preventdefault however nothing seems work , posts back, but alert here example <asp:linkbutton runat="server" text="test" id="lnktest"></asp:linkbutton> <script> $(document).ready(function () { var lnk = $('#<%=this.lnktest.clientid %>'); lnk.unbind('click.test').bind('click.test', function (event) { alert("click"); event.preventdefault(); event.stoppropagation(); return false; }); }); </script> update okay after further investigation seems work expected when run in standalone page, using this script, , appears causing conflict.. that script moves href='javascript:... click handler, im guessing order handlers assigned may have it... edit: i've tried reproducing without success. else in code differs this demo ...

iphone - How to access data from ViewController in subview? -

i have viewcontroller contains instance variable containing dictionary object bunch of data. view complex , contains several subviews instantiate , embed seperate view files(to avoid having thousand lines of ui code in actual viewcontroller) - how these subviews, exists in own files, access dictionary object viewcontroller? when im editing descriptionview.m file - how access contents of locationdata dictionary object viewcontroller? hope understand mean. here's snippet viewcontroller: caseviewcontroller.h #import "descriptionview.h" @interface caseviewcontroller : uiviewcontroller { nsdictionary *locationdata; descriptionview *descriptionview; } @property (nonatomic, retain) nsdictionary *locationdata; @property (nonatomic, retain) descriptionview *descriptionview; @end caseviewcontroller.m - (void)loadview { uiview *view = [[uiview alloc] init]; descriptionview = [[descriptionview alloc] initwithframe:cgrectmake(0, 130, 320, 237)]; ...

php - Zendframe work include path Error on Hosting -

i trying implement oauth using zendframe work. script running great on localhost whereas when hosting same files on server (online) giving me include path error. not figuring out might problem. error : warning: require_once(zend/http/client.php) [function.require-once]: failed open stream: no such file or directory in thank you you have add path in zend framework installed include path: set_include_path('/path/where/zend/directory/is' . path_separator . get_include_path()); the include path php searches when include script. also, it's may have upload zend framework hosting server, hosting provider may not have installed it.

algorithm - Days Between Dates Java (homework) -

this couple days off when run program. advice on doing wrong? i know there simpler way it, i'm trying show actual steps in finding days between. homework assignment, cannot use date-time libraries. public class daysbetween { public static void main (string []args) { long months1 = long.parselong(args[0]); long days1 = long.parselong(args[1]); long year1 = long.parselong(args[2]); long months2 = long.parselong(args[3]); long days2 = long.parselong(args[4]); long year2 = long.parselong(args[5]); long daysbetween = 0; long leapyearcounter = 0; boolean leapyear1 = false; boolean leapyear2 = false; boolean valid1 = true; boolean valid2 = true; int earlier = 0; // tests see date earlier if (year1 == year2){ if (months1 == months2) { if (days1 == days2) { daysbetween = daysbetween; } ...

java - Determine datetime pattern based on locale -

i have following jsf code display date using pattern. <f:convertdatetime pattern="e, d mmm, yyyy" timezone="#{localebean.timez one}" /> i pass pattern via localebean also. there way determine specific pattern based on locale? thanks public localebean() { this.defaulttimezone = timezone.getdefault(); this.strlocale = locale.getdefault().tostring(); this.timezone = defaulttimezone.getdisplayname(); } you can try dateformat.getdateinstance . example: simpledateformat f = (simpledateformat)dateformat.getdateinstance(dateformat.short, locale.uk); system.out.println(f.topattern()); f = (simpledateformat)dateformat.getdateinstance(dateformat.short, locale.us); system.out.println(f.topattern()); prints: dd/mm/yy m/d/yy

iphone - What would be the reverse of CGRectUnion()? -

i can combine rect1 rect2 using cgrectunion() , combined rect3 fine. is possible subtract rect1 rect3 (which contains rect1) , remaining part of rect? as brad larson said, can't in quartz, because cgrect functions work nothing rects , component parts (points, sizes, , single numbers). if programming mac, suggest using api named hishape . it's modern successor quickdraw regions, , such, capable of non-rectangular shapes. unfortunately, though hishape still available on 64-bit mac os x, not available on ios. if need this, have write yourself, including own hishape-like not-necessarily-rectangular shape class.

iphone - Remote wipe of application data in iOS -

i working on enterprise application, client has requirement of wiping data stored application, device, remotely. is, in case when user reports lost device. if forget service side implementation of it, possible remote wipe of data stored in application sandbox. deleting files present in application resources sqllite files , certificates? i browsing net , came along this site claims in product. if can done, how should approach problem? remote wipe feature has been added apple in ios 4.2 onwards using mobile me. don't think doing through remote notifications. in case there wouldn't sure shot guarantee, data deleted device. the best way encrypt data on iphones disk , decrypt in memory (since ios 4 there similar mechanism built in). before let user use data, ask server if iphone allowed encrypt data (a better approach server gives iphone key decrypt data, attacker won't find in code). if server denies request, app wipes stored data , done. this of course ...

vb.net - Toggle Button Control -

can change button control toggle-button? is there simple way change button property make toggle button? according this post on osix need use checkbox set it's appearance button . in code: checkbox checkbox1 = new system.windows.forms.checkbox(); checkbox1.appearance = system.windows.forms.appearance.button; (c# code see how works). but can properties dialog in designer.

when using OmniAuth in rails application why I always met Errno::ETIMEDOUT -

i have rails dummy application, , i've add omniauth gemfile. i've add <%= link_to "sign in twitter", "/auth/twitter" %> in application layout file. also i've add omniauth.rb file in config\initializers folder. rails.application.config.middleware.use omniauth::builder provider :twitter, 'mykey', 'mysecert' end after restart of rails server rails s , visit http://localhost:3000/auth/twitter i've met errno::etimedout , saying operation timed out - connect(2) my computer can visit twitter website meanwhile. can me going wrong here? thank much. that because of network issue. after connected vpn, fine.

database - Best way to develop Java with a DB -

i've experience toplink translate objects database , vica versa. part of jsp site , did ejb stuff to. question: work stuff toplink in java desktop application or more common use native sql stuff java? maybe experience of prof. developpers might good. need develop application client. i'm doing in java , i'm gonna store data in database. thanks orm nice if data model structured, not overly complex and, of all, if have control on it. legacy databases or poorly modelled ones harder represented orm, , doing discouraged, application add further complexities on implied model itself. if comfortable orm tool such hibernate , database done, go it. sure save lot of boilerplate code , have nice query optimization code under hood. otherwise, may want use jdbc directly or other framework simplify jdbc use still using plain sql. such situations recommend mybatis .

java - How can I decompile many jars at once? -

well, guess subject says :) the ideal solution find jars within folder (they might in sub-folders), , write sources found single "src" directory, of course maintaing package folders. concrete use case: decompile eclipse plugin jars download jad decompiler . unjar jar files (using command jar xvf ) directory. let's call ${unjar.dir} . create directory jad write out decompiled sources. let's call ${target.dir} . execute following command: jad -o -r -sjava -d${target.dir} ${unjar.dir}/**/*.class options are: -o - overwrite output files without confirmation -r - restore package directory structure -s <ext> - output file extension (default: .jad)

How to add article title to URL using link_to in Rails app? -

i trying follow answer question how link_to in rails output seo friendly url? but don't result. in rails 3 app have: # routes.rb match '/articles/:id/:title' => 'articles#show' resources :articles # articles/index.html.haml - @articles.each |article| = link_to article.title, article, :title => article.title however, after restarting server, links don't have title: /articles/1, /articles/2 what wrong? your link_to using route resources :articles . if want use custom route you've defined, name route, , use in link_to : # routes.rb match '/articles/:id/:title' => 'articles#show', :as => :article_with_title # articles/index.html.erb link_to article.title, article_with_title_path(article, :title => article.title) also, may want consider looking using friendly_id . you, more transparently.

api - What do web browser engine use to render html? -

i've been wondering : librairies/apis used web browser engines (gecko, webkit ...) render images, text, buttons & stuff ? think it, webpages rendered pixel pixel identically across operating systems. yet buttons, drop lists , text native on platforms. the main trident (ie , derivats) webkit (safari, chrome) khtml (kde konqueror) base webkit presto (opera) you can read more here: http://en.wikipedia.org/wiki/web_browser_engine these engines create object structure of html , use components build page, browser engine not render pixel pixel uses buttons, comboboxes, image elements of in them self render buffer , imagebuffers collapsed screen. some engines use plattforms own components (trident) other use own different skins different plattforms. for actual rendering know ie uses windows controlls , gecko noted uses cairo. i assume webkit might use gtk or qt not sure , opera have no idea assume use form of framework or toolkit.

vb.net - How can i read the decimal character of my computer? -

i decimal character vb.net in greek decimal character "," while in other countries have "." decimal character. so how can read, .net decimal character? use cultureinfo.currentculture.numberformat.numberdecimalseparator .

asp.net - IIS express requests take 4 times longer to execute -

i have uploaded wcat results run on windows 7, same script, ts: included xsl in zip . sorry. here have noticed: iis express has slighter higher requests per second, , total transactions served normal iis. iis express executing 100 requests @ time, while normal iis on windows 7 limited 10 designed. iis express using 30% higher cpu, because of additional requests handles @ time. but on average express requests take longer complete..up 4 times longer. see request execution time performance counter , time analysis (first , last byte). iis express able beat iis in total requests served because can handle more requests @ time! theories on what's happening: could fact iis express printing each request command line window trace set none slowing down? i noticed lot of additional modules registered in iis express applicationhost.config not in iis applicationhost.config . debugging/tracing modules causing problem? i notice iis express not have filecache , httpcach...

java - Make ImageView visible for set amount of time -

i have onclick method set in xml layout file triggers vibration of phone 100ms @ point have imageview visibility set visible can seen. want imageview set gone again when vibration has stopped. how go this? you can start method @ same time: public void timerdelayremoveview(float time, final imageview v) { handler handler = new handler(); handler.postdelayed(new runnable() { public void run() { v.setvisibility(view.gone); } }, time); }

python - GQL: Not equal filter on a multivalued property -

tinkering little gae's datastore i've found can't think proper way filter out results using inequality filter '!=' on multivalued property: class entry(db.model): ... tags = db.stringlistproperty() e1 = entry() e2 = entry() e1.tags = ['tag1', 'tag2', 'tag3'] e2.tags = ['tag1', 'tag3', 'tag4'] # want exclude results containing 'tag2' db.gqlquery("""select * entry tags != 'tag2' """) the problem query returns both e1 , e2 want e2 . i think happens because inequality filter evaluates (true if @ least 1 value != 'tag2'. there's way apply filter all? (true if values != 'tag2')? i know gae's datastore not relational i'd know how cleverly solve/think kind of queries. thanks ;) i've thought bunch , don't think there way (please correct me if i'm wrong). non-clever solution not use stringlis...

xcode - Cant create cocos2d project after installation -

i'va got problem cocos2d installation. i went terminal , installed 0.99.4, seems installed perfectly, because said done! when try make new project in xcode, cant find cocos2d templates. if try copy them manually , build error: " command /developer/platforms/iphoneos.platform/developer/usr/bin/gcc-4.2 failed exit code 1 " try these links, http://iphonedev.net/2009/07/28/how-to-install-cocos2d-08-project-template/

visual studio 2008 - How to install run sql on windows mobile -

how transfer , install database ( sdf ) on windows mobile 6 pda theere no "install" of file - it's single file. copy device via activesync/wmdc or storage mechanism. ssing file requires consuming application have sql compact binaries installed. microsoft supplies simplistic on-device query analyzer, iirc comes redistributables. if need else, need bit more clear in question. edit once install redistributables on pc, various cab files , binaries sql compact stored here: %program_files%\microsoft sql server compact edition\v3.5

security - Conversion from cert file to pfx file -

is possible convert cert file pfx file? tried importing cerf file ie, never shown under "personal" tab, cannot export there. i looking if there alternatives available. fyi, cerf file created using "keytool" , doing export cert file. this article describes 2 ways of creating .pfx file .cer file: maxime lamure: create own .pfx file clickonce create public & private keys (you prompt define private key’s password): makecert.exe -sv mykey.pvk -n "cn=.net ready!!!" mykey.cer create pfx file public , private key pvk2pfx.exe -pvk mykey.pvk -spc mykey.cer -pfx mypfx.pfx -po toto programmaticaly in c# writing byte array directly file: byte[] certificatedata = certificate.export(x509contenttype.pfx, "yourpassword"); file.writeallbytes(@"c:\yourcert.pfx", certificatedata); and (if you're using ie 8) might want have @ answer on so: how make ie8 trust self-signed certificate in 20 irritati...

Using Magento just for checkout -

i wondering if possible use magento checkout process. i making e-commerce site has 1 product , plan display on home page "buy now" button populate cart , jump straight checkout. realize magento overkill task, slick checkout , integration paypal website payments pro allowing users stay on site throughout. however, want use magento for, not cms functions or else, etc. can done (if so, how) or there better option? thanks help, brian sure can! modify template remove of page chrome , use homepage single landing page. say, huge overkill, possible.

Is it possible to develop an iOS app with bluetooth capabilities? -

would following possible? let's have scale bluetooth capabilities, when turn on, sends weight via bt. is technically possible develop ios app pairs scale , receives data it? according apple: technical q&a qa1657: using external accessory framework bluetooth devices. q: understand external accessory framework in ios 3.0 , later allow application communicate bluetooth devices. why doesn't application see bluetooth accessory sitting next iphone? a: external accessory framework designed allow ios applications communicate hardware accessories developed under apple's mfi licensee program. mfi compliant accessories can implemented wired devices, meaning plug in ios device's 30-pin connector, or wireless devices, whereby use bluetooth communication channel. either way, application uses external accessory framework not notified of accessory's presence unless accessory identifies being mfi comp...

c# - How to get ratio of width x height of an image on disk / file? -

i have userpictures saved file on hdd. (not in database). i height , width of *.jpg-files, how that? (background: must calculate ratio between hight , width bring specified height , width without stretching it). many formats support header info others don't so... image img = system.drawing.image.fromfile(path); int height = img.height; int width = img.width;

javascript - Why does Internet Explorer not send HTTP post body on Ajax call after failure? -

we able reliably recreate following scenario: create small html page makes ajax requests server (using http post) disconnect network , reconnect monitor packets ie generates after failure after failed network connection, ie makes next ajax request sends http header (not body) when doing http post. causes sorts of problems on server partial request. google issue bing , you'll find lots of people complaining "random server errors" using ajax or unexplained ajax failures. we know ie (unlike other browsers) sends http post 2 tcp/ip packets. header , body sent separately. in case directly after failure, ie sends header . so question - why behave way? seems wrong based on http spec , other browsers don't behave way. bug? surely creates havoc in serious ajax based web application. reference information: there similar problem, triggered http keep-alive timeouts shorter 1 minute , documented here: http://us.generation-nt.com/xmlhttprequest-post-sometimes...

postgresql - About clustered index in postgres -

i'm using psql access postgres database. when viewing metadata of table, there way see whether index of table clustered index? i heard primary key of table automatically associated clustered index, true? note postgresql uses term "clustered index" use vaguely similar , yet different sql server. if particular index has been nominated clustering index table, psql's \d command indicate clustered index, e.g., indexes: "timezone_description_pkey" primary key, btree (timezone) cluster postgresql not nominate indices clustering indices default. nor automatically arrange table data correlate clustered index when nominated: cluster command has used reorganise table data.

java - Need to get data into Quickbooks -

i'm looking existing java (or jvm'able language) library create iif files import quickbooks. free or commercial. know of something? update: after reading comment on question, looked @ ipp , sdk options intuit provides , not have made more difficult. here need do. need take data database , export sort of format can import quickbooks. doesn't need automatic process quickbooks application/database won't on server (linux) web applications runs on. there number of free options if you're comfy rolling own (or using intuit test apps). if download quickbooks sdk , includes examples of sending quickbooks xml documents instruct quickbooks add customers, add transactions, etc. etc. etc. examples easily extended allow copy/paste in xml document or load xml document disk. you build actual xml files in java. if wanted fancy, use jaxb (or equivalent xsd class generator) generate java classes included .xsd documents, , able things like: invoiceadd inv = ...

curve fitting - MATLAB can't seem to find csaps() in MATLAB 7.10.0 student edition -

i have code using csaps() , matlab's cubic smoothing spline fitting function want give student matlab 7.10.0 (r2010a). for reason function doesn't seem exist, though student has curve fitting toolbox installed: edu>> ver ------------------------------------------------------------------------------------- matlab version 7.10.0.499 (r2010a) matlab license number: student operating system: microsoft windows xp version 5.1 (build 2600: service pack 3) java vm version: java 1.6.0_12-b04 sun microsystems inc. java hotspot(tm) client vm mixed mode ------------------------------------------------------------------------------------- matlab version 7.10 (r2010a) simulink version 7.5 (r2010a) control system toolbox version 8.5 (r2010a) curve fitting toolbox version 2.2 (r2010a) image processin...

.net - Why is List(T).Clear O(N)? -

according the msdn documentation on list<t>.clear method : this method o(n) operation, n count. why o(n)? ask because assume clearing list<t> accomplished allocating new t[] array internally. no other class have reference array, fail see harm in approach. now, maybe stupid question... allocating t[] array o(n)? reason not have thought so; maybe (is lack of c.s. degree showing right now?). if so, suppose explain since, according same documentation quoted above, capacity of list remains unchanged, means array of equal size need constructed. (then again, doesn't seem correct explanation, documentation should have said "where n capacity "— not count *). i suspect method, rather allocating new array, zeroes out elements of current one; , i'm curious know why be. *hans passant pointed out in comment lukeh's answer docs correct. clear zeroes out elements have been set in list<t> ; not need "re-zero" elements past ...

java - Apache http client or URLConnection -

this question has answer here: urlconnection or httpclient : offers better functionality , more efficiency? 5 answers i need download web page on android app , having hard time deciding whether use android apache http client or java's urlconnection. any thoughts? for things i'd httpclient way go. there situations , edge cases i'd fall urlconnection . examples of edge cases here , here edit similar question has been asked before: httpclient vs httpurlconnection . i assume httpurlconnection faster httpclient built on top of standard java libraries. however find httpclient code quicker , easier write , maintain. according comments below, core elements of httpclient have been performance optimised. if performance major concern best bet write 2 clients, 1 using each method, benchmark them both. if this, please let know results. ...

Simple Facebook Integration -

i want integrate friends website (photographer) facebook. i've been trying find answer in facebook developers guide, doesn't seem clear me. what need if: i want have button per photo album has i want publish news enters in cms facebook wall do need application? or can accomplish plugins? thanks in advance. the button can just added inserting code snipped facebook take care of rest. if want more liked pages send updates , have statistics, need register app , supply app id meta tag in website. open graph notation used. to publish news post can obtain permament token , publish using graph api, there alternative , easier methods

html - Positioning fixed header -

this tricky one, me @ least. have page needs scroll horizontally. @ top of page menu needs stay in same place whole time centered on page. if use jq unsure how achieve appears need position same div 2 different ways. here page: http://www.coflash.com/testing/raycollins/gall1.php the scrollbar not appearing reason either, works fine in old code on site: http://www.raycollinsphoto.com any ideas? for scroll add in body overflow-x:scroll; show horizontal scroll bar. about header can use position:fixed; , width:100% , z-index:10; final css #headerwrap be: #headwrap { background-color: #1c1c1c; position: fixed; width: 100%; /* take width of screen */ z-index: 10; /* in small screens images override header */ }

PostgreSQL: Select data with a like on timestamp field -

i trying select data table, using "like" on date field "date_checked" (timestamp). have error : sqlstate[42883]: undefined function: 7 error: operator not exist: timestamp without time zone my request : select my_table.id my_table my_table.date_checker '2011-01-%' i don't want use : select my_table.id my_table my_table.date_checker >= '2011-01-01 00:00:00' , my_table.date_checker < '2011-02-01 00:00:00' it's not "wanting use" < , > timestamps, operators can converted index scans, , string-match... well, can, ewwww. well, error occurring because need explicitly convert timestamp string before using string operation on it, e.g.: date_checker::text '2011-01-%' and suppose create index on (date_checker::text) , expression become index scan but.... ewwww.

environment - Getting all the total and available space on Android -

to knowledge, on android, there is: internal memory apps , cache internal sd card on phones (not removable) external sd card music , photos (removable) how total , available each check exist (some phones not have internal sd card) thanks here how internal storage sizes: statfs statfs = new statfs(environment.getrootdirectory().getabsolutepath()); long blocksize = statfs.getblocksize(); long totalsize = statfs.getblockcount()*blocksize; long availablesize = statfs.getavailableblocks()*blocksize; long freesize = statfs.getfreeblocks()*blocksize; here how external storage sizes (sd card size): statfs statfs = new statfs(environment.getexternalstoragedirectory().getabsolutepath()); long blocksize = statfs.getblocksize(); long totalsize = statfs.getblockcount()*blocksize; long availablesize = statfs.getavailableblocks()*blocksize; long freesize = statfs.getfreeblocks()*blocksize; short note free blocks: the total number of bl...

fileapi - HTML5 File API - availability and abilities -

i did reading on file api , i'm wondering when major browsers going support or supports already: firefox, since 3.6 chrome, since 8.0 ? opera, ie ? is supposed successor/alternative of uploaders based on flash, plupload or sfwupload ? advantage , disadvantage of in case ? is able reliably handle blobs (byte streams) / files when inputstreams read filereader, have same consistency native file load filesystem? mean encoding issues etc. after user submits file, can freely use without restrictions javascript? instance save file variable , later send via xhr ? i've read in specifications, i'd hear opinions of has experiences it. i'm implement complicated user interface , file api there way lesser work on server side... but i'm not sure if should use or not because of ? opera, ie ? i have no idea when/if ie support this, may forced public demand. according spec blob (raw data) 1 way read in file ( http://www.w3.org/tr/fileapi/#dfn-blob ). ...

slide - jQuery sliding arrow under menu -

this 1 gonna hard, because have no demo of this, believe i'm saying ;) there many sites arrow below active menu item (the site you're browsing now). point when hover on menu item - arrow sliding active 1 hovered 1 , comes on mouseout (or stays here after clicking). how work? i guess arrow below active element additional class added while refreshing page display new content? sliding? :) thanks lot. try googling "jquery lavalamp" ................

html5 - How to make a DIV float on top of another DIV without pushing down the CSS Underneath -

please take @ following example: http://jsfiddle.net/mvfvd/ i want "overlayedframefooter" div ontop of frame, in way doesn't add height surrounding items. any ideas? live demo i added position:relative #frame . i added width:100%; text-align:center #overlayedframefooter . i changed position:relative position:absolute on #overlayedframefooter . see here explanation of why works.

Splitting up visual blocks of text in java -

Image
i have block of text i'm trying interpret in java (or grep/awk/etc) looking following: differently, plaques of rn8 , rn9 mutants , human coronavirus oc43 more divergent of wild-type size, indicating suppressor mu- sars-cov, human coronavirus hku1, , bat coronaviruses tations, in isolation, not noticeably deleterious hku4, hku5, , hku9 (fig. 6b). thus, not mem- -- able effect on viral phenotype. potentially related obser- sented existence of interaction between nsp9 vation mutation a2u, neutral itself, nsp8 (56). hexadecameric complex of sars-cov nsp8 , lethal in combination aacaag insertion (data not nsp7 has been found bind double-stranded rna. and i'd split 2 parts: left , right. i'm having trouble coming regex or other method split block of text visually split, not obvious programming language. lengths of lines variable. i've considered looking first block , finding second looking multiple spaces, i'm...

bit fields - Is this the most optimal way? C bitfields -

i made function set or clear specific number of bits in dword. function works. don't need making work. however, wondering if method i've chosen fastest possible way. it's rather hard me explain how works. there 2 arrays containing dwords filled bits on left , right side of dword (with binary 1's). makes mask bits filled except ones want set or clear, , sets them bitwise operators based on mask. seems rather complicated such simple task, seems fastest way come with. it's faster setting them bit bit. static dword __dwfilledbitsright[] = { 0x0, 0x1, 0x3, 0x7, 0xf, 0x1f, 0x3f, 0x7f, 0xff, 0x1ff, 0x3ff, 0x7ff, 0xfff, 0x1fff, 0x3fff, 0x7fff, 0xffff, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, 0xffffffff }; static dword __dwfilledbitsleft[] = { 0x0, 0x80000000, 0xc0000000, 0xe0000000, 0xf0000000, 0xf8000000, 0xfc000000, 0xfe000000,...

vb.net - How to smoothly drag an image box in WPF? -

i'm working wpf 4 , vb.net 2010. project consists of full-screen windows 640x480 grid in center. in project, want have various image boxes (which have item .png images in them), user can drag around , drop in various places on grid. in essence, need able make possible item clicked , dragged around grid, image box still visible , same size user moves around. should never able leave grid. need able determine if object on object, when mouse button released, dragged object "dropped", , triggers particular block of code. how do this? something similar 'project', using c# from http://pastie.org/1498237 // xaml <window x:class="myproject.window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="window1" height="500" width="500"> <grid> <canvas x:name="mycanv"> ...

What packaging tool should I use for a Mac/Windows Java app? -

i have java desktop app runs on both macos , windows. i understand cannot have 1 distribution each, not requirement. i need know tool or tools best use when delivering java app each. the tool should install prerequisites (in case, java , jars) , native respective operating system. as os x's java situation: currently, jdk 6 bundled in os. presumably, next version of os still include jdk 6. it's publicly stated os have well-defined place install multiple copies of java runtimes, public interface choosing of java version, etc. see here . apple started contributing own code open jdk community, jdk 7 should available separate download, see here .  so, you're not expected include java runtime java app then. you're not supposed install java in ramdom place on filesystem, example. as how should deploy java apps on os x: double-clicking jar works. however, won't pretty, because have generic java icon in dock. don't want that. you should ...

java - Admob Adview works. Why? -

yesterday trying admob advertising work on new app. unfortunately, , embarassingly had programmed myself corner using minimal xml files in programming. (its long story why), i.e. did layouts views programatically in java. anyway, when came adding adview had problem since admob guide assumed developers use xml extensively. browsed admob api , blundered around , ended following: ad = new adview(this); ad.setenabled(true); sublayout.addview(ad); simpleadlistener sal = new simpleadlistener(); sal.onreceivead(ad); ad.setadlistener(sal); ad.getadlistener(); ad. setkeywords("keywords relevant app"); ad.requestfreshad(); my question is, code ok? works. mean, i'm displaying ads on app (still unpublished). if has experience admob sdk id advice. you can drop following lines: ad.setenabled(true); simpleadlistener sal = new simpleadlistener(); sal.onreceivead(ad); ad.setadlistener(sal); ad.getadlistener(); this little bit co...

json - Why am I getting a unicode-related ValidationError for python script on one server but not on another? -

i'm running python script retrieve data adwords api, , runs on centos server. using same configuration file , script on ubuntu server, unicode error. there configuration setting need change? traceback (most recent call last): file "adwords_sync.py", line 230, in <module> adwords = adwords(config) file "adwords_sync.py", line 37, in __init__ self.client = adwordsclient(headers=config.api_headers, config=config.api_config, path=config.api_config['home']) file "lib/python2.6/site-packages/adspygoogle/adwords/adwordsclient.py", line 153, in __init__ sanitycheck.validateconfigxmlparser(self._config['xml_parser']) file "lib/python2.6/site-packages/adspygoogle/common/sanitycheck.py", line 96, in validateconfigxmlparser raise validationerror(msg) adspygoogle.common.errors.validationerror: invalid input <type 'unicode'> '1', expecting 1 or 2 of type <str>. the configur...

iphone - CoreTelephony framework available for Facetime too? -

i'm develloping app works facetime. unfortunatly, there not yet facetime frameworks or apis available, i'm working have. must know, when facetime call placed, native phone app job. problem when call over, stays in there. what want to, once call ended, send local notification user ask if wants app, of coretelephony framework. know work-in-progress framework , it's still private one, but: can use framework in app , publish it, without been rejected apple? does framework works facetime too? can't work. here did: i first imported framework in appdelegate header file and then... . - (void)applicationdidenterbackground:(uiapplication *)application{ nslog(@"applicationdidenterbackground"); ctcallcenter *callcenter = [[ctcallcenter alloc] init]; callcenter.calleventhandler=^(ctcall* call){ if (call.callstate == ctcallstatedialing){ nslog(@"call dialing"); } if (call.callstate == ctcallstateconnected){ nslog(@"call c...

How to get the age of uncommitted changes in Mercurial? -

i saw pretty neat command line prompt other day. guy using zsh , customized prompt display how long had been since last commit. think pretty awesome , similar. the catch using git, , prefer mercurial. getting how long it's been since last commit easy enough, misleading. if commit changes, else hour, come codebase, it's been hour since last commit. i'm looking time it's been since changes started. possible through shell or have plugin? you list of files have uncommitted changes, , earliest modified date. however, if changed file 1 minute since last commit, changed same file 5 minutes ago, recent change count. i have prompt hook shows me number of modified files, current revision number, branch , tag name, takes noticeable amount of time execute each time shell prompt shown. can't provide details right though.

hibernate cascade - update child to null -

i have 1 many relationship between event , session. i'd cascade update event fk in session null when delete corresponding event. clue how this? , advance. hibernate or jpa unfortunately don't have cascade type 'set null' should able @preremove on 1 side (owner): @onetomany(mappedby="whatever") public list<someentity> getsomeentity(){ return someentity; } @preremove public void ondelete(){ for(someentity se : getsomeentity()){ se.setowner(null); } } hope helps.

c# - jQuery animate is very slow in both IE and Firefox -

i using jquery animate() function show small text becoming larger , larger, until disappear. i have jquery code here: function gain() { /* using multiple unit types within 1 animation. */ $("#block").animate({ width: "80%", opacity: 0.0, marginleft: "2.6in", fontsize: "15em", borderwidth: "10px" }, 2000, function () { $("#block").removeattr("style"); $("#block").html(""); $("#block").css("color", "white"); $("#block").css("position", "absolute"); $("#block").css("z-index", "-5"); }); } the code use fire function: string script = "$('#block').html('yes!<br/>" + xpreward.tostring() + "xp!');"; scriptmanager.registerstartupscript(buttonlistupdate, typeof(string), "startup", ...