Posts

Showing posts from June, 2013

iPhone: File Picker (Again) -

ive seen number of questions/answers stating there no nsopenpanel on iphone, , open images using uiimagepickercontroller (http://stackoverflow.com/questions/3393829/how-to-open-a-dialog-box-in-iphone). is aware of tutorial on custom picker, tuned file system objects (for example, files - , not date or not image). have come across knock off of mark , lemarche's slot machine picker. jeff i haven't seen tutorial on subject, you'll need use nsfilemanager's - (nsarray *)contentsofdirectoryatpath:(nsstring *)path error:(nserror **)error , related methods nstableviewcontroller display them. of cocoa views handy hierarchy not available in ios, can make or find custom uitableviewcells nesting or can indent directory contents. as mentioned above can't see documents outside app directories. application contents may read only, limiting directories such application documents.

php - How to change layout for a single action? -

i have action , don't want use usual layout it. can indicate in action want use different layout default one? how can it? check out zend documentation layouts . change layout: $this->_helper->layout->setlayout('foobaz'); disable layout: $this->_helper->layout->disablelayout();

.net - Can I post a public message to my Facebook application? -

can post public message application, , if so, automatically send message public feeds of users of application have authorized offline_access,publish_stream ? note : when user clicks application's "subscribe" button explicitly doing informational updates published feeds, request offline_access,publish_stream , have authorize that. this question sending 1 message @ once instead of iterating on each user of application. i think can done pages. technical part: yes, possible send application feed message through facebook api. to perform need give "publish_stream" permission account you're sending message from. after can schedule messages sent without authentication. sociel part: users see messages in feeds until explicitly hide application streaming.

Very large SOAP response - Android- out of memory error -

i have application need download large amount of data via soap call webservice application when first run. response sent function converts xml , stores data in db file. the data more 16mb in size , have java.lang.outofmemoryerror everytime. modifying webservice give out smaller amounts of data not option. is there way able download large data? inputstream perhaps? this code public protocol[] getprotocols() { string method_name = "getprotocols"; string soap_action = "urn:protocolpedia#getprotocols"; log.d("service", "getprotocols"); soapobject response = invokemethod(method_name, soap_action); return retrieveprotocolsfromsoap(response); } private soapobject invokemethod(string methodname, string soapaction) { log.d(tag, "invokemethod"); soapobject request = getsoapobject(methodname); soapserializationenvelope envelope = getenvelope(request); return makecall(envelope, methodname, soapact

python - Why don't scripting languages output Unicode to the Windows console? -

the windows console has been unicode aware @ least decade , perhaps far windows nt. reason major cross-platform scripting languages including perl , python ever output various 8-bit encodings, requiring trouble work around. perl gives "wide character in print" warning, python gives charmap error , quits. why on earth after these years not call win32 -w apis output utf-16 unicode instead of forcing through ansi/codepage bottleneck? is cross-platform performance low priority? languages use utf-8 internally , find bother output utf-16? or -w apis inherently broken such degree can't used as-is? update it seems blame may need shared parties. imagined scripting languages call wprintf on windows , let os/runtime worry things such redirection. turns out even wprintf on windows converts wide characters ansi , before printing console ! please let me know if has been fixed since bug report link seems broken visual c test code still fails wprintf , succeeds writeconsolew

visual studio - Is it possible to auto-update the dependecy graph in VS2010 after changed made in the project? -

the dependency graph great feature included in vs2010. when create dependecy graph, possible update when change code in solution? no, snapshot of code @ time generate it. refresh, must generate new one.

web services - Transfering files greater than 100mb as byte[] array to an asmx webservice -

i using 3.5 asp.net webapplication transer files byte array axmx 1.1 webservice gives following error on invoking method "the underlying connection closed: unexpected error occurred on send" the bytearray length 120788413 when call same method smaller file, i.e. byte array length 3128994 works fine. is there way in 1.1 asmx webservice increase message recieving request length? the 1.1 webservice cannot upgraded cant use wcf have use same service, in webservice have added <httpruntime executiontimeout="30720" maxrequestlength="1024000"/> in system.web element also have added section <microsoft.web.services2> <diagnostics> <trace enabled="true" input="inputtrace.webinfo" output="outputtrace.webinfo"/> </diagnostics> <messaging> <maxrequestlength>1024000</maxrequestlength> </messaging><!-- 1gb --> </microsoft.web.serv

cocoa - core data sql debug = 1 results -

dear community. mean log bellow working application? mean troubles? seen work fine. 2011-02-09 09:43:14.122 snow[4316:1a03] coredata: annotation: to-many relationship fault "codesvsdestinationslist" objectid 0x200b8d740 fulfilled database. got 1 rows i imagine you're being confused word 'fault'. has specific meaning in context of core data. here's apple's documentation on subject.

php - How can I filter metacharacters from user input in xss attack? -

on site on admin login page if this http://www.domain.com/admin/index.php/%22onclick=document.location="http://www.google.com"> and click somewhere page redirects. read need filter metacharacters, after hours of googling still can't find out how can stop this. above see isn't doing get or post . how can block this?

asp.net ajax - Access the caller DOM-object from the OnBegin function from AjaxAction -

problem: access dom-object called ajaxaction in onbegin function. here 1 solution: question parameters in onbegin ajaxoptions there cleaner way access it? examples these not work: function begincontactlist(args) { // onbegin // highlight selected group $('#leftcolumn li').removeclass('selected'); $(this).parent().addclass('selected'); // animate $('#tabs-1').fadeout('normal'); } because this object not contain information dom. checkout answer question, there talk automatically inject additional parameters ajax context: asp.net mvc : ajax actionlink- target html attribute

Convert variables from c# to c++ -

c# public sealed class rc5 { private readonly uint[] _bufkey = new uint[4]; private readonly uint[] _bufsub = new uint[26]; }; c++(errors) class rc5 { protected: unsigned __int32[] _bufkey = new unsigned __int32[4]; unsigned __int32[] _bufsub = new unsigned __int32[26]; }; of course got errors in c++ code , don't know how make right can me please?! thanks in c++ array "marker" must follow variable name, not type name. you have 2 ways in c++ instantiate array: a) make fix array: class rc5 { protected: unsigned __int32 _bufkey[4]; unsigned __int32 _bufsub[26]; }; b) allocate on heap: class rc5 { public: rc5() : _bufkey(new unsigned __int32[4]), _bufsub(new unsigned __int32[26]) { } virtual ~rc5() { delete [] _bufkey; delete [] _bufsub; } protected: unsigned __int32 *const _bufkey; unsigned __int32 *const _bufsub; };

vb.net - any API to send mail on WinCE 5.0 -

any api send mail on wince 5.0? the sdf has mail namespace . forewarned never implemented attachments (it not hard do, never got around it).

Can spring framework override Annotation-based configuration with XML-based configuration? -

can spring framework override annotation-based configuration xml-based configuration? need change dependency of bean defined via annotations , not author of bean. this should ok. spring bean context allows redefine beans, "later" definitions overriding "earlier ones". should apply xml-defined beans annotation-defined beans, if they're mixed. for example, if have @configuration public class myannotatedconfig { @bean public object beana() { ... } } <bean class="com.xyz.myannotatedconfig"/> <bean id="beana" class="com.xyz.beana"/> in case, xml definition of beana should take precedence.

javascript - Regexp: Check for digits and whitespaces -

i using following regexp make sure string contains 5 digits. works perfect, however, need allow whitespaces: 123 45 , 12345 need pass test. string.match(/^\d{5}$/g); thanks you remove whitespace , try match rest: string.replace(/\s/g, "").match(/^\d{5}$/g)

sql query to sort timestamp -

select b.id st,a.appname name_st , b.no_clicks clicks, b.first_usage ft , b.last_usage lu (select appname, appid oneclick_apps) , (select application_id id, count(*) no_clicks, to_char( min(accessed_time),'dd-mm-yyyy hh:mm:ss') first_usage, to_char( max(accessed_time),'dd-mm-yyyy hh:mm:ss') last_usage user_db upper(user_id) upper('e243378') group user_application ) b b.id = a.appid order lu asc is query....which sorts in ascending order...only in terms of year...what modifications should make sorts entire dd:mm:yyyy hh:mm:ss ? select b.id st, a.appname name_st, b.no_clicks clicks, b.first_usage ft , b.last_usage lu (select appname, appid oneclick_apps) a, (select application_id id, count(*) no_clicks, to_char( min(accessed_time),'dd-mm-yyyy hh:mm:ss') first_usage, to_char( max(accessed_time),'dd-mm-yyyy hh:mm:ss') last_usage user_db upper(user_id) upper('e

tomcat - How to preserve xml configuration when redeploying using update? -

i'm using tomcat manager deploy war files. update war use following url: http://localhost:8080/manager/deploy?path=/example&war=file:/path/example.war&update=true the problem using this, xml configuration (under catalina/localhost/example.xml), erased. how can preserve it? place configuration in webapp's meta-inf/context.xml , tomcat take care of rest.

Flatten SQL Server Table to a string -

i have table like: id | value ---------------- 1 | 1 2 | 2 3 | 3 what need create single string these values, in format: '1: one, 2: two, 3: three' i know how using cursors, used column in view, it's not performant option. pointers? with t(id,value) ( select 1, 'one' union select 2, 'two' union select 3, 'three' ) select stuff( (select ', ' + cast(id varchar(11)) + ': ' + value t xml path ('')) , 1, 2, '')

osx - Java Sockets: Socket.close() terminates connection different on Windows and Mac? -

situation follows: have java application, communicates on tcp microcontroller tcp stack on it. stack on controller works fine, can sort out. problem is: when terminate connection controller, use socket.close() , connection terminated, no problem. on mac, works too, when check wireshark, there regular termination process [fin,ack] - [ack] , followed [tcp dup ack] packet, that, claimed wireshark, belongs [fin,ack] packet. happens on mac , not happen on windows machine on vm on mac or on netbook... are there tweaks use not letting dup-ack packet transmitted? jerks stack in controller claiming closed session still active , after 10 times connecting controller, stack has no more space accept new connections. i'd thankful if give me hint! well, if problem in os-provided tcp stack (which believe is) may try telnet mac device , close connection. see whether dup ack still emitted. if is, swapping java versions/vendors (for example) won't good... ...oh, , maybe y

ruby - Image histogram with mini_magick or image_science? -

is possible fetch histogram of image mini_magick or image_science? i afraid mini_magicks usage of mogrify not allow such information retrieval. image_science hardly documented , seems limited thumbnail scaling , cropping only. one route take, iterate on each pixel , extract values, in ruby. requires information on pixels, cannot in mini_magick either. i can fallback either rmagick or im_magick, either less popular/unknown or reportedly bad in performance. for record: part of earlier question finding entropy of parts of images . a workaround use mini_magick convert file png format, store result in temporary file, , use "almost-pure ruby" png library or actually-pure ruby chunky_png go on result. both libraries make easy iterate on image pixel pixel. i'm suspecting specified mini_magick/image_science because these lot easier install than, say, rmagick. reason workaround might work you, then, png , chunky_png pain-free installs due lack of depende

asp.net - Change onclick of an image -

i have html img <img id="btnviewspec" alt="view spec sheet"src="/images/viewspec.jpg" style="cursor: pointer;" /> i need alter onclick target different aspx pages based on what's read database. like: if dbread("keywords").tostring.contains("glove") me.btnviewspec.attributes.add("onclick", ("window.open('/specsheet/displaypdf.aspx?pa=/specsheet/glovespec.aspx?pid=" & intproductid & "','wnemailinfo', 'menubar=no,width=820,height=500,toolbar=no,scrollbars=yes,status=yes')")) else me.btnviewspec.attributes.add("onclick", ("window.open('/specsheet/displaypdf.aspx?pa=/specsheet/clothingspec.aspx?pid=" & intproductid & "','wnemailinfo', 'menubar=no,width=820,height=500,toolbar=no,scrollbars=yes,status=yes')")) end if problem can't code behind recognize image. tried register in d

How can i jump to a webpages anchor <a> tag using ShellExecute in C++? -

i'm opening webpage succesfully in manner, example shellexecute(null, "open", "http://www.google.com", null, null, sw_shownormal); however need able jump anchor tag, 'mypage.html#middle'. when append end of url string, webpage opens @ file specified, , won't jump tag, nor in address bar. thanks. okay, i've managed achieve using different technique. when using method have define browser open with, might considered issue concerned deploying large number of users (fortunately, in case isn't true). shellexecute(null, "open", "iexplore", urlstring, null, sw_shownormal); where 'urlstring' web address, anchor @ end. thanks all.

c# - Displaying course details later than today's date -

i'm using vsta c# on infopath 2010 form, whereby using cascading drop downs (course title & course details) information displayed. so when user selects course title drop down, course details populated starttime, endtime, location , development category information sharepoint 2010 list. now problem have want user view course details today , onwards, , not view course details past. code whereby display coursedetails. i've tried declaring datetime variable , using compare string converts datetime today, make later datetime variable, gives me error after select course title, says "object reference not set instance of object". troubleshooting tips: "use new keyword create object instance. check determine if object null before calling method. gengeral exception" using (web = site.openweb()) { try { //spsecurity.runwithelevatedprivileges(new spsecurity.codetorunelevated(delegate()

webforms - Django set data from db into field -

i trying fill 2 <input type="text"> fields value database, default django forms. i tried set query, gets value when starts , won't take db after values changed id db. my forms looks like: s_size = forms.integerfield(initial=sizes.objects.get(id=1).small) m_size = forms.integerfield(initial=sizes.objects.get(id=1).medium) any appreciated. you should pass in initial data view, described in documentation : class myform(forms.form): s_size = forms.integerfield(i) m_size = forms.integerfield() ... def my_view(request): s_size_value = sizes.objects.get(id=1).small m_size_value = sizes.objects.get(id=1).medium form = myform(initial={'s_size': s_size_value, 'm_size': m_size_value})

.net 4.0 - ASP.net Ajax Partial Rendering using UpdatePanel not working in WebKit browsers -

i part of developer team quite large online system using asp.net(4). asp.net ajax breaks down webkit browsers , getting full page postbacks when should getting partial updatepanels. i starting believe has application configuration , following reasons. if move ajax enabled controls new project work expected browsers, including webkit. i created static .aspx file nothing updatepanel,scriptmanager , button making literal visible on click. i no javascript errors browser, , see http request asp.net-ajax (scriptresource.axd) in both firebug , chrome developer tools i tried ye'old safari fix this highly referenced thread edit: after bit more testing , http sniffing noticed major difference between test application , actual application. test application generates 2 additional .axd files not generated actual application. these webresource.axd, seem contain data related async postback. however case webkit browsers. webresource.axd files generated firefox can see them in

python - How can I disable a model field in a django form -

i have model this: class mymodel(models.model): regular = 1 premium = 2 status_choices = ((regular, "regular"), (premium, "premium")) name = models.charfield(max_length=30) status = models.integerfield(choices = status_choices, default = regular) class myform(forms.modelform): class meta: model = models.mymodel in view initialize 1 field , try make non-editable: myform = myform(initial = {'status': requested_status}) myform.fields['status'].editable = false but user can still change field. what's real way accomplish i'm after? use html readonly attribute: http://www.w3schools.com/tags/att_input_readonly.asp or disabled http://www.w3.org/tr/html401/interact/forms.html#adef-disabled you can inject arbitrary html key value pairs via widget attrs property: myform.fields['status'].widget.attrs['readonly'] = true # text input myform.fields['status'].widget.att

ruby - Getting Rails 3 and Passenger to work on CentOS 5.4 - Apache Error -

using ruby 1.8.7 on centos 5.4. trying rails 3 app on passenger. i have gone through steps error in apache log file passenger error (ext/common/applicationpool/../spawnmanager.h:220): not start spawn server: /usr/lib/ruby/: permission denied (13) [ pid=18207 thr=3086812880 file=ext/apache2/helperagent.cpp:354 time=2011-02-09 09:27:18.541 ]: not start spawn server: write() failed: broken pipe (32) in 'passenger::spawnmanager::spawnmanager(const std::string&, const boost::shared_ptr<passenger::serverinstancedir::generation>&, const passenger::accountsdatabaseptr&, const std::string&, const passenger::analyticsloggerptr&, int, const std::string&)' (spawnmanager.h:540) in 'passenger::applicationpool::pool::pool(const std::string&, const boost::shared_ptr<passenger::serverinstancedir::generation>&, const passenger::accountsdatabaseptr&, const std::string&, const passenger::analyticsloggerptr&, int, const s

java - Regex that matches a string and not a word -

i'd see internal libraries used in java project searching through code for import com.mycompany.someproject.path.classname; let's project's title 'myproject'. regex match lines begin with import com.mycompany. and exclude: myproject.path... matched lines be: import com.mycompany.tool.path.someclass; import com.mycompany.sallysproject.path.someotherclass; and exclude internal project imports: import com.mycompany.myproject.* this should work: import com\.mycompany\.(?!myproject\.).* explanation: import com\.mycompany\. - line must start import com.mycompany. . pretty self-explanatory; note need escape periods -- \. -- match periods, , not "any character". (?!myproject\.) - called "negative lookahead". overall match succeed if pattern inside parentheses (except ?! ) not match. .* - after import com.mycompany. (except myproject. ) matched.

ruby on rails - Class and Module with the same name - how to choose one or another? -

i have encountered following situation: there modulea::moduleb::classc.do_something in definition of do_something need use model application def do_something ... data = order.all ... end but there exists module modulea::order so error undefined method `all' modulea::order:module i found solution doing def do_something ... data = kernel.const_get('order').all ... end that returns model. question is: what's best way it? there cleaner solution? (despite fact, having same name class , module it's not greatest idea, cannot changed here...) prefix class name :: in do_something method... def do_something ... data = ::order.all ... end

c++ - Retrieve value of QTableWidget cells which are QLineEdit widgets -

i create qlineedit,set validator , put on table code: ui->moneytablewidget->setcellwidget(rowsnum, 1, newqlineedit); then i've got another class manipulating table's data doing sum of every value of column. here's code: int calculator::calculatepricessum(qtablewidget &moneytablewidget){ double total = 0; qwidget *tmplineedit; qstring *tmpstring; for(int row=0; row<moneytablewidget.rowcount(); row++){ tmplineedit = (qlineedit*)moneytablewidget.cellwidget(row,1); tmpstring = tmplineedit.text(); total += tmpstring->todouble(); } return total; } but building fails error: /home/testpec/src/nokia qt/moneytracker-build-simulator/../moneytracker/calculator.cpp:11: error: cannot convert ‘qlineedit*’ ‘qwidget*’ in assignment why convertion error? another subquestion: passing table reference saves memory right? problem? im developing nokia smartphone , think passing object value waste o

java - How to force jboss to load classes from jars in webapp's lib -

i trying deploy web application on jboss-6.0.0final , deployed on apache tomcat . have 2 jars 1 contains same package org.apache.axis . putting 1 jar in <jboss-home>/server/default/lib & jar in <my-app-war>web-inf/lib . it required put both jars in class path. no way remove 1 of jar. need keep both jars. & giving me following error java.lang.classcastexception: org.apache.axis.attachments.attachmentsimpl cannot cast org.apache.axis.attachments.attachments @ org.apache.axis.axisfault.makefault(axisfault.java:101) @ org.apache.axis.client.call.invoke(call.java:1828) i think due conflict of same classes in 2 different jars. now, want know way can force jboss load classes of particular package axis.jar exist in /web-inf/lib. how can that? i'll share quite simple , straight forward process had followed when came across same situation. 1> create jboss-web.xml file. <class-loading java2classloadingcompliance="false&qu

asp.net mvc - pre-conditions and database interaction -

let me ask something, if have scenario this: scenario: listing questions user has answered questions given logged user called "vintem" , have following projects | project | | project 1 | | project 2 | when visit projects page should see | project | | project 1 | | project 2 | what in case create projects must seen in projects page? suppose using repository pattern call repository create projects? or simulate creation of projects using watin? in case of calling repository directly, connection database have same 1 in web project right? can't have test db , dev db in case. thanks your given there set context. not have use same constructs when or then. if wished insert projects in db straight sql, doesn't matter. wouldn't user watin set projects. make tests more brittle changes ui effect test. run slower you using repository

What is the best way of storing session geolocation results from an IP using rails? -

i'm working on location based app , i'd store location of user ip address in rails. i'm using geokit , i'm able location via ip of user i'm wondering best way store information without storing database (so first time/unregistered users can benefit location features without being registered/logged in). the best example can give how groupon or livingsocial "know" first time visit apps. location via ip , store in session. best way? if so, how go using rails/geokit? let me know if need more info. thanks! is there reason can't push user session , refer in absence of registration? create caching table associates physical ips locations , refer well.

Jquery containment problem with Image rotation -

Image
hi all. using below code rotate drag/dropped image.the rotation working fine,but when start rotating ,the image moves outside "div" container .anything missing. //moving outside container first time.after dragging inside div,then rotates inside div var test = 5; var mousedown = false; $(function() { $('.frame').mousedown(function(e) { mousedown = true; }); $('.frame').mouseup(function(e) { mousedown = false; }); $('.frame .rotatable').live('mousemove', function(e) { if ((mousedown) && (e.ctrlkey)) { test = test + 10; var currentid; document.getelementbyid('angle').value = test; $(this).rotate({ angle: test }); var currentid = $(this).attr('id'); var id = currentid.substring(8); var deleteimage = 0; var angle = test; savecoords(e

php - error for drupal 6 local -

this error appears when finished setup of local site notice: trying property of non-object in d:\xampp\htdocs\cities\includes\theme.inc on line 92 why?? what solution ???????? that means file doesn't exist.

java - PDF page size is not exact the one provided -

i need create pdf itext fixed dimensions: height: 95 mm = 3.74 in width: 50 mm = 1.96 in so i've done in code: float width = mmtopt(95); float height = mmtopt(50); rectangle rectanglepage = new rectangle(width, height); document document = new document(rectanglepage, 0, 0, 0, 0); where mmtopt() function (according documentation 70pt=1in=2.54cm): public static float mmtopt(float mm){ //70pt = 25.4mm return ((70f * mm) / 25.4f); } the problem when open pdf generated going file/properties can see says page size 3.64 x 1.91 in. not exact size i'm setting (it's 2 or 3 mm shorter - though it's little it's important because file must have dimensions). what can happening? how can solve problem? thanks. it's 72 dots == 1 inch, not 70.

sql - Load Data Infile - negative decimal truncated (to positive number) -

i having trouble loading decimal data database - specifically, negative numbers getting truncated, , can't figure out. here query looks like: > create table if not exists mytable (id int(12) not null auto_increment, mydecimal decimal(13,2),primary key(id)); > load data infile 'data.dat' table mytable fields terminated ';'; and data.dat i'm loading: ;000000019.50 ; ;000000029.50-; ;000000049.50 ; when completes, giving me warning "data truncated column 'mydecimal' @ row 2." , when @ data, it's stored positive number. ideas how fix this? the best way handle data abnormalities in input file load them local variable, set actual column value based on transformation of local variable. in case, can load strings local variable, either leave alone or multiply negative 1 depending on whether ends minus sign. something should work you: load data infile 'data.dat' table m

Downloadable WPF Control that provide 3D Effects for vertical scrolling? -

Image
are there wpf control downloads provide 3d effects vertical scrolling? open source project thriple josh smith library of 3d controls , panels, use in wpf applications. these reusable components make easy incorporate 3d in user interfaces. each component in library accompanied sample applications, allow experiment them.

jquery - Cloud Carousel and iPad/iPhone touch events -

really love carousel: http://www.professorcloud.com/mainsite/carousel.htm works how need demo apart need add touch/wipe events ios , android. basically if user wipes (is correct terminology?) left or right, carousel moves in direction, if press left or right button. i looked using plugin: http://plugins.jquery.com/project/touchwipe-iphone-ipad-wipe-gesture and tried tweak (hack) carousel plugin listen these events $(container).bind('touchwipe',this,function(event){ wipeleft: function() { alert("left"); } }); but generates syntax error. don't know enough creating plugins know allowed here. from can tell in plugin, scroll left/right functionality here // setup buttons. $(options.buttonleft).bind('mouseup',this,function(event){ event.data.rotate(-1); return false; }); $(options.buttonright).bind('mouseup',this,function(event){ even

internet explorer - IE 8 making tons of extra DNS requests with "NotSupported" returned -

i have scenario user using ie 8 , trying access external sharepoint site , authenticating ntlm. login works fine, , resources downloading, takes forever (it's 3 minutes) sharepoint page load. i ran ms visual roundtrip analyzer on user's desktop , found there tons of dns requests being made domain of external sharepoint site, , returns "dns notsupported". doesn't happen in firefox, , page loads absolutely fine. is there ie 8 dns setting has change? why these dns requests made? thanks!

will my site be slow in amazon cloud if server is not in my country -

i want use , try cloud computing . there 2 options gae , amazon , hate google data store don't use that. but amazon don't have cloud in australia . if buy service in . will site slow if people access country aws has endpoint in southeast asia majority of services. if you're in australia, that's 1 want hit. you said "amazon", assume you're talking ec2 , s3. if you're talking elastic beanstalk, it's currently us-only, it's not rocket surgery figure out they'll roll out other regions @ point.

android - Multiple activity instances and FLAG_ACTIVITY_REORDER_TO_FRONT -

suppose current task stacks has 4 activity instances, a0, a1, b0, c0, c0 @ top of stack. a0, a1 instances of activity a, b0 instance of activity b, , c0 instance of activity c0. now c0 creates intent flag_activity_reorder_to_front , starts activity a: intent intent = new intent(this, a.class); intent.setflag(intent.flag_activity_reorder_to_front); startactivity(intent); my question is, instance brought front, a0 or a1? task stacks become a0, b0, c0, a1 or a1, b0, c0, a0? thanks. empirical evidence says brings most recent instance front. in example, if activity stack starts out this: a0, a1, b0, c0 (front of task) and c0 starts intent.flag_activity_reorder_to_front , instance a1 brought front , activity stack looks this: a0, b0, c0, a1 when use flag, android looks instance of activity (starting front of task , scanning back/root of task). first instance finds brought front. if doesn't find instance in activity stack create new one.

Adding a Using Statement To Dispose Linq DataContext in a Compiled Query -

i using compiled queries in linq sql. pretty standard stuff this: public static readonly func<mydatacontext,int,ienumerable<mytype>> getsomestuff = compiledquery.compile<mydatacontext,int,ienumerable<mytype>> ( (datacontext,userid) => (from u in dc.tabletype u.userid == userid select u) ); then later calling this: using(var c = new mydatacontext()) { var qr = mycompiledqueriesclass.getsomestuff(c,12345); //etc.. } what move using statement inside compiled query i'm stuck best way this. ideas?

ruby on rails - Whenever gem won't update crontab tasks -

i have been using whenever gem on 2+ year old slice @ slicehost. can't same on new slice. main differences i'm running rvm on both mbp , slice. running rails 3. i've got rubygems v 1.5.0 , latest versions of rvm , ruby 1.9.2p136, capistrano , every other package out there. i have tried million things, read docs , of i'm using whenever gem version 0.6.2. have looked @ questions on related topics on google. here code in deploy.rb: namespace :deploy ... desc "update crontab file" task :update_crontab, :roles => :db run "cd #{release_path} && whenever --update-crontab #{application}" end end after 'deploy:update_code', 'deploy:update_crontab' here error message after running 'cap deploy' failed: "rvm_path=$home/.rvm/ $home/.rvm/bin/rvm-shell '1.9.2' -c 'cd /home/deploy/public_html/lasource/releases/20110209201551 && /home/deploy/.rvm/gems/ruby-1.9.2-p136/bin/whene

python - Django trans problems - not working in 100% cases -

i've got problem using django's {% trans %} template function. have values translated in messages file , gets translated in cases. not of them. i'm trying debug issue. have block of code - in i'm iterating through form's fields , outputting them: <tr> <td>{{ hdr_data|safe }} {% trans row_field.label_tag %}</td> <td>{{ row_field }}</td> <td>{{ row_field.errors}}</td> </tr> if suppose want print _row_field.label_tag_ string "abc", have translated "zxf" above code still prints "abc". if sth this: <tr> <td>{{ hdr_data|safe }} {% trans 'abc' %}</td> <td>{{ row_field }}</td> <td>{{ row_field.errors}}</td> </tr> the translation ok - "zxf". i've been trying check what's wrong label_tag, , string: <label for="id_abc">abc</label>

user interface - Problem with Java GUI implementation -

i have problem code trying run - trying make 3 buttons, put them on gui, , have first buttons colour changed orange, , buttons next colour change white , green. every click thereafter result in colours moving 1 button right. code far follows, skipping colours in places , not behaving @ expected. can offer help/guidance please ? import java.awt.*; import javax.swing.*; import java.awt.event.*; public class buttonjava extends jbutton implements actionlistener { private int currentcolor=-1; private int clicks=0; private static final color[] colors = { color.orange, color.white, color.green }; private static buttonjava[] buttons; public buttonjava( ){ setbackground( color.yellow ); settext( "pick me" ); this.addactionlistener( ); } public static void main(string[] args) { jframe frame = new jframe ("jframe"); jpanel panel = new jpanel( ); frame.setdefaultcloseoperation( jframe.exit_on_close); buttons = new

php - Wordpress custom post type categories -

hey. using custom post type in wordpress. register custom post type this: register_post_type("lifestream", array( 'label' => 'lifestream', 'public' => true, 'hierarchical' => true, 'menu_position' => 5, 'supports' => array('title','editor','author','thumbnail','comments','custom-fields'), 'taxonomies' => array('category','post_tag'), 'query_var' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'caller_get_posts' => 1 )); register_taxonomy_for_object_type('category', 'lifestream'); register_taxonomy_for_object_type('post_tag', 'lifestream'); in theme (the loop template) combine posts , c

c# - Largest Prime Factor algorithm optimization -

i'm trying improve interesting algorithm as can. for now, have this: using system; class program { static void main() { ulong num, largest_pfact; uint = 2; string strnum; console.write("enter number: "); strnum = console.readline(); num = ulong.parse(strnum); largest_pfact = num; while (i < math.sqrt((double) largest_pfact)) { if (i % 2 != 0 | == 2) { if (largest_pfact % == 0) largest_pfact /= i; } i++; } console.writeline("largest prime factor of {0} is: {1}", num, largest_pfact); console.readline(); } } so ideas? thanks! edit : implemented ben's algorithm, eveyone help! i've got faster algorithm here . it eliminates square root , handles repeated factors correctly. optimizing further: static private ulong maxfactor (ulong n) { unc

debugging - Is it a good habit to run in debug mode? -

i saw comment on question (i forget one) encouraging asker avoid testing his/her code in debug harness unless strictly necessary, citing effect of acting crutch. there's said developing skill deduce cause of bugs without "direct" evidence. i'm quite fan of debuggers myself (in fact, tend run without if strictly necessary), got thinking relative merits of each approach. debugger pros starting obvious, takes less time 0 in on faults, exceptions , crashes tracing provides nice alternative littering code commented-out print statements performance overhead can give wiggle room, i.e. if program responsive while debugging, in wild debugger cons performance overhead can make iterations slower (edit) tunnel vision : debugging symptom can distract deducing cause when crash occurs long after or far defect it may "help" initializing variables or otherwise masking bugs, leading surprises later on conversely, there's odd bug only crops in debug c

database - Rails: transfer data from one schema to another -

i'm migrating php app rails. new app has different schema. anybody have experience data 1 schema another? right now, i'm looking @ dumping csv files , writing ruby scripts handle insertion on other side. i've considered using navicat export/import temp database new schema (if it's simple enough), dump database , insert values new database using db:seed. i figure gonna total pain whichever way go -- hoping minimize angst. in advance! update: decided export navicat xml, use nokogiri create seed files seed_fu. check out dr. nic's magic model gem. http://magicmodels.rubyforge.org/dr_nic_magic_models/ then use rake tasks iterate through csvs , insert using newly generated models.

c# - Hosting a .NET 4.0 Web Service in IIS 6 -

i trying host 2nd website (outside of default web site, used) web service supported .net 4. iis 6. the default web page using .net 2.0. in iis 6 can have 2 seperate websites running different versions of .net creating 2 distinct application pools. i've done this. however running common problem asp.net tab not appear in iis. tab allows set version of .net site uses. my workaround change .net version each site references through command line: aspnet_regiis -s (site path) the other solution problem switch iis 64-bit mode, causes asp.net tab appear. problem switching iis 64-bit not jive existing website, after reconfiguring iis reference following directory, microsoft.net/framework64 as opposed to microsoft.net/framework is experienced hosting seperate pages on 1 server this? nightmare. can 2nd page work, original default page fails, , vice versa. i have iis in 32-bit mode , ran following cmd line: c:\windows\microsoft.net\framework\v4.0.30319>aspnet_regiis

series of commands using commons-exec -

i new apache commons-exec. is there way can send series of commands remote machine without authenticating each time? would order: ssh a@b command1 command2 but apparently commons-exec needs this: ssh a@b \n command1 ssh a@b \n command2 any idea? try ssh a@b "command1; command2" this common way execute multiple command on remote system via ssh within script. should work case well.

LINQ: Selecting "Deep" in a hierarchical object? Selecting all childs that have the same parent? -

can help? i have class file called member stores object reference , object reference of parent. have list contains "many" members. flat file system, works great linq can see give me childs has parent of x. using object reference field of parent property. now thinking of recreating class file , adding new field hold list of member , remove parent property - way have 1 object there other objects object. hope makes sense? :-) so if have new object, how use linq childs of specific parent? direct descendent? , possible flatten file i.e return items single objects part of list. i love hear anyones comments on method better, i.e. have , hierarchy approach. thanks in advance anytime hierarchical collections, remember there multiple different data structures handle type of problem. there 1 that's rather complex, provides amazing performance. consists of dictionary keyed off integers containing entire collection. objects keep parent relationship, , have hashs

.NET calling SharePoint Web Service gets an HTTP 401 Unauthorized exception -

i trying call sharepoint lists service list definition , data. sharepoint site companies have no control on it. here know server's security: server https:// server accepts windows active directory credentials when logging in... i have tried basic, digest, credentialcache, networkcredential, unsafeauthenticatedconnectionsharing, usedefaultcredentials, preauthenticate... not sure proper config is... the error receive http 401 unauthorized. uri url = new uri(baseaddress + "/_vti_bin/lists.asmx", urikind.absolute); lists.lists client = new lists.lists(); // works credentialcache cache = new credentialcache(); cache.add(url, "ntlm", new networkcredential(context.username, context.password, context.domain)); client.usedefaultcredentials = false; client.credentials = credentialcache.defaultcredentials; // doesn't work ever

multithreading - What is the difference between semaphore and mutex in implementation? -

i read mutex , binary semaphore different in 1 aspect, in case of mutex locking thread has unlock, in semaphore locking , unlocking thread can different? which 1 more efficient? assuming know basic differences between sempahore , mutex : for fast, simple synchronization, use crticial section. to synchronize threads across process boundaries, use mutexes. to synchronize access limited resources, use semaphore. apart fact mutexes have owner, 2 objects may optimized different usage. mutexes designed held short time; violating can cause poor performance , unfair scheduling. example, running thread may permitted acquire mutex, though thread blocked on it. semaphores may provide more fairness, or fairness can forced using several condition variables.

wpf - How can I style a custom control based on if any of its children have focus? -

we have custom canvas has specialized nodes behave lot standard mdi application's windows. desired behavior if of child controls of "window" have focus, "window" said active. now isfocused property doesn't seem cascade, meaning if child control has focus, it's container not set 'focused' can't use that. same reason, can't set isfocused property on container believe steal child. my thought create new dp called haschildwithfocus or that, in code-behind, listen bubbled events , set flag. not sure that's best way go. (we may implement combination attached property/attached behavior kinda thing.) but of course better if ask control 'hey... or of children have focus?' so can you? you can use uielement.iskeyboardfocuswithin directly this: <grid> <grid.resources> <style x:key="panelstyle" targettype="border"> <setter property="borderbrush

android - Creating a custom dialog box that displays a full view image -

i trying create custom dialog box displays image in full-view , has select cancel button. custom dialog box should displayed when image clicked allow user view selected image in full-view. image view should 1 selected gridview. select button display toast message , cancel button allow user exit dialog. idea allow user see image in full-view before or makes final choice on picture like. however, having several problems trying this. code shown below: package com.newapp; import android.app.activity; import android.app.dialog; import android.content.dialoginterface; import android.content.context; import android.os.bundle; import android.view.view; import android.widget.adapterview; import android.widget.baseadapter; import android.widget.gridview; import android.widget.imageview; import android.widget.toast; import android.widget.adapterview.onitemclicklistener; import android.widget.imageview; import android.widget.button; public class mainactivity extends acti

javascript - jQuery data() vs Objects (Performance) -

i wondering way more efficient using jquery data bind data object or using kind of object. trying create kind of model app. here object code var persondata = function () { var = {}, _name = 0, _age = 0.0, _domid = false; that.data = initdata(); //this initing data options function initoptions () { return { name: _name, age: _age, domid: _domid } } that.setname = function (name) { that.data.name = name; } that.getname = function () { that.data.name; } // forgot add dom id, there id binding that.setdomelementid = function (id) { that.data.domid = id; } //add getters , setter return that; } thanks opinions by way there plugin generating getters , setters in textmate javascript jquery's .data() attaching data dom elements. if you're not touching dom, don't touch .data() . also, don't think ki

python - Missing type to str.format() behavior -

according python docs here , when leaving type out, defaults type of 'g' floating point arguments. however, print("{0:.2}".format(14.9)) prints "1.5e+01", while print("{0:.2g}".format(14.9)) prints "15" is issue of documentation being incorrect or there reason it? according source code , documentation bug. correct description behaviour without floating point specifier "like 'g', @ least 1 digit after decimal point".

c# - What is the maximum size of an array while using Array.sort() method? -

in application have array 5000 elements. have sort these elements.but getting error of "array index out of bound exception". can tell me can maximum size array sort? should use arraylist ?? there no specific limit - constrained memory here, , @ point array exists, isn't limitation of array.sort . example: int[] arr = new int[500000]; random rand = new random(); (int = 0; < arr.length; i++) arr[i] = rand.next(); array.sort(arr); // works fine i suspect might (for example) have icomparable[<t>] implementation throwing error internally? or alternatively, perhaps error has nothing @ do array.sort , , have considered wrong line cause. the exception's .stacktrace should reveal everything, of course. and no: shouldn't use arraylist here. or pretty anywhere else.

html - Move table rows up and down - Jquery/Javascript -

can please tell me how move table rows , down through jquery/javascript. i have table , each row radio button there in first td. onclicking up/down arrows selected rows should move up/down. looking forward ideas... first selected row: var radio; // assuming there's 1 form in page, replace 0 whatever // , inputs have name 'radiogroupname' (var in document.forms[0].radiogroupname) { if (documents.forms[0].radiogroupname[i].checked) { radio = documents.forms[0].radiogroupname[i].parentnode.parentnode; break; } } to shift up: var prev = radio.previoussibling; var par = radio.parentnode; if (prev) { par.removechild(radio); par.insertbefore(radio, prev); } to shift down: var next = radio.nextsibling; var par = radio.parentnode; par.removechild(radio); if (next.nextsibling) par.insertbefore(radio, next.nextsibling); else par.appendchild(radio);

c++ - Can't read unicode (japanese) from a file -

hi have file containing japanese text, saved unicode file. i need read file , display information stardard output. i using visual studio 2008 int main() { wstring line; wifstream myfile("d:\sample.txt"); //file containing japanese characters, saved unicode file //myfile.imbue(locale("japanese_japan")); if(!myfile) cout<<"while opening file error encountered"<<endl; else cout << "file opened" << endl; //wcout.imbue (locale("japanese_japan")); while ( myfile.good() ) { getline(myfile,line); wcout << line << endl; } myfile.close(); system("pause"); return 0; } this program generates random output , don't see japanese text on screen. oh boy. welcome fun, fun world of character encodings. the first thing need know

Bookmarks permission for Google Chrome -

i looking build google chrome extension fetches bookmarks the browser , sent them server synchronization perspective,but seem complain me of " permission error " " api method " used in " background.html ", though have set necessary permission in " manifest.json " here my manifest.json like { "name" : "sync bookmark", "background_page": "background.html", "version" : "1.0", "content_script" : { "css" : ["bookmark.css"], "js" : ["js/jquery.js","js/bookmark.js"] }, "browser_action" : { "default_icon" : "images/bookmark.png", "default_title" : "syn bookmark", "default_popup" : "bookmark.html" }, "permission" : [ "bookmarks", "management", "unlimit