Posts

Showing posts from February, 2012

shopping cart - Magento howto fetch / change / overwrite the totals.phtml calculation? -

i had added product calculated 2 attributes , uses own calculated price. problem had rewrite grandtotal , subtotal calculation... example overwritting stuff. i hope here @stackoverflow magento guru had solved problem :-) i had changed /app/design/frontend/default/gutlauf/template/checkout/cart/item/ default.phtml layout of cart items done. but have problem /app/design/frontend/default/gutlauf/template/checkout/cart/ totals.phtml <table id="shopping-cart-totals-table"> <col /> <col width="1" /> <tfoot> <?php echo $this->rendertotals('footer'); ?> </tfoot> <tbody> <?php echo $this->rendertotals(); ?> </tbody> </table> how can own calculation ? figured out blocks tax/checkout_grandtotal tax/checkout_subtotal tax/checkout_tax for example /app/design/frontend/default/gutlauf/template/tax/checkout/grandtotal.phtml <?php echo $this-...

tfs2010 - Build details in custom section of TFS 2010 Build Summary page -

can me in putting build information in custom section of build summary page. for suppose, calculation on test results, based on need show output in custom section of build summary. please help. you can creating vs addin: tfs2010 – customizing build details view – summary view

php - how to catch the general node/add form? -

i have custom module , want catch node/add , inside form hook_nodeapi() doesn't show up. i need this, restrict access general node creation overview form. setting rights no solution me, because users need right "create content" take @ hook_form_alter . should able you're looking for.

mysql - How to choose multiple table structure for fastest query response -

i have database in listing events geography (currently around 100000 events in database). @ moment it's in nicely normalised schema: event in table tevent has foreign key fkvenue points @ venue in table tvenue has foreign key fkcity , , on tregion , tcountry . the query find countries events therefore complex, no less 3 inner joins: select r.fkcountry,count(distinct e.id) tevent e inner join tvenue v on e.fkvenue=v.id inner join tcity cy on v.fkcity=cy.id inner join tregion r on cy.fkregion=r.id group r.fkcountry order count(distinct e.id) desc i'm trying find ways of speeding things up, , thought might helpful map events directly country. i've created map table teventcountry , following simpler resulting syntax: select ec.fkcountry,count(distinct e.id) tevent e inner join teventcountry ec on ec.fkevent=e.id group ec.fkcountry order count(distinct e.id) desc to surprise, had exact opposite effect: new query took 5 times long older, more complex query. c...

javascript - Problem getting distanceFrom in Google Map api -

i try distance between 2 points using google maps api, function load_points(){ var geocoder = new gclientgeocoder(); var firstzip, secondzip; geocoder.getlatlng(document.getelementbyid("firstzip").value, function(point) { if (!point) { alert("this point not geocoded"); } else { firstzip = point; var marker = new gmarker(point); map.addoverlay(marker); } }); geocoder.getlatlng(document.getelementbyid("secondzip").value, function(point) { if (!point) { alert("this point not geocoded"); } else { secondzip = point; var marker = new gmarker(point); map.addoverlay(marker); } }); alert(new glatlng(firstzip).distancefrom(new glatlng(secondzip))); } the problem when try seems first executed alert , after g...

java - How to add a view to a specifc point on mapView -

an when ontouch event occurs on mapview, want layout have specified drawn above user has touched the below have started, not know how place popup view on x , y values retrieved event. guys have ideas? @override public boolean ontouchevent(motionevent ev, mapview mapview) { int x = (int)ev.getx(); int y = (int)ev.gety(); viewgroup parent=(viewgroup)map.getparent(); view popup=getlayoutinflater().inflate(r.id.popup, parent, false); ((viewgroup)map.getparent()).addview(popup); you can set mapview.layoutparams() values of x , y , call mapview's addview layoutparams. mapview.layoutparams params = new mapview.layoutparams(width, height, x, y, alignment); mapview.addview(popup, params);

javascript - Multiply numbers with more than 4 decimal points -

possible duplicate: round number in javascript n decimal places this may easy guys, my question is: how can control decimal places in floating point value. ex.: result returning 0.365999999999999; need show 4 decimal numbers. check demo: demo (i accept others ways calculate that) thanks! you can use .tofixed var number = 0.365999999999999; var rounded = number.tofixed(4); // 0.3660

c# - unexpected result in mef -

i beginner in mef. write code cant understand why program show result. namespace consoleapplication1 { public class meftest { [import] public string text { get; set; } [import] public iextension ext { get; set; } public void showtext() { assemblycatalog asscatalog = new assemblycatalog(typeof(extension2).assembly); compositioncontainer container = new compositioncontainer(asscatalog); compositionbatch batch = new compositionbatch(); batch.addpart(this); container.compose(batch); console.writeline(text); console.writeline(ext.text); } } class program { static void main( string[] args ) { meftest mef = new meftest(); mef.showtext(); console.readkey(); } } public interface iextension { string text { get; set; } } [export] pub...

java - Why does Throwable.getMessage() occasionally return null? -

i have method throws exception: this.items[index] = element; and have unit test asserts exception ought thrown thrown: try { dosomethingwithindex(-1); assert.fail("should cause exception"); } catch (indexoutofboundsexception expected) { assert.assertnotnull(expected.getmessage()); } this test runs part of continuous build , sometimes, fails because getmessage() in fact returns null. why happen? code can never throw exception null message. edit my original code example misleading, thrown exception coming directly indexing array. can reproduce same behavior custom thrown exception though. i added suggested code: catch (indexoutofboundsexception expected) { if (expected.getmessage() == null) { expected.printstacktrace(); } assert.assertnotnull(expected.getmessage()); } the console output missing stack trace in addition cause. here's full output: java.lang.arrayindexoutofboundsexception found answer on simil...

javascript - $.getScript, possible to give included script an id? -

via jquery's $.getscript method, can give included script dom id? so generated code should be: <script type="text/javascript" id="xxxxxx" src="..."></script> i know document.write line myself, $.getscript must there reason right? (cross browser compatibility, etc?) i think has maybe been answered/discussed before here: why call $.getscript instead of using <script> tag directly? . getscript allows dynamically load script in situations it's either desirable delay loading of script, in situations want status callback on when script has been loaded or in situations couldn't use script tag. getscript has downsides in it's subject same-origin policy whereas script tag not. if have seen other web pages put id on script tag (smugmug.com), i've seen flagged non-standard when testing standard's compliance. seems work , used others, i'm guessing isn't standard.

php - curl, crowbar...passing to jquery -

<?php function get_html($url) { $curl = curl_init(); curl_setopt ($curl, curlopt_url, 'http://127.0.0.1:10000/?url=' . $url . '&delay=3000&view=as-is'); curl_setopt($curl, curlopt_returntransfer, 1); $html = curl_exec ($curl); return $html; } ?> im using php code access html using crowbar...my question is, how pass html jquery processing (scraping). my jquery starts document.ready(function(), work since crowbar loads dom in browser? this of jquery code: $(document).ready(function(){ var title = $('title').text(); $.ajax({ type: "post", url: "tosql.php", data: {title:title} }); }); im getting title (for test purposes) because pass php stored in mysql yes, jquery can manipulate in dom after loads via document.ready wrapper. if need easier manipulation, have crowbar render data object or array inside of <script> tags. if have more code show can give more comp...

sharepoint designer - Acessing/Starting Workflows in SPD 2010 -

we have migrated moss 2007 moss 2010. migration successful. unfortunately have discovered cannot access workflows associated sites in spd 2010. workflows appear in spd 2010 under list workflows, error unable load workflow action server. have looked error , have made sure wss.actions well-formed. there else has had problem? after view more days of researching, tried few things suggested. 1 of solutions recycle application pools , restart timer service of server. doing granted me access workflows when using prod url in spd 2010. problem can not start workflow using dev url. if else has had issuse after migrating moss 2010, suggest recycling app pools see if helps. the problem ending being different applications versions. user trying use spd 2007 sharepoint 2010.

ruby on rails - SSH in Engine Yard -

i've got large problems ruby on rails deployment on ey. support has said need ssh in clear errors... following: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ warning: remote host identification has changed! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ possible doing nasty! eavesdropping on right (man-in-the-middle attack)! possible rsa host key has been changed. fingerprint rsa key sent remote host 80:4c:5f:dd:98:bb:cb:01:6c:a9:11:41:29:56:66:86. please contact system administrator. add correct host key in /users/jameshughes/.ssh/known_hosts rid of message. offending key in /users/jameshughes/.ssh/known_hosts:1 rsa host key ec2-184-73-167-153.compute-1.amazonaws.com has changed , have requested strict checking. host key verification failed. [process completed] how add correct key known_hosts file? update please see @womble's comment below , reply. @womble notes, if use stricthostkeychecking no open man in middle attac...

validation - Validate PHP form field if not left empty -

i have bit of problem php form validation use with. i got optional field should validated if user fills it, otherwise form should processed normal. here's validation field: if (!preg_match("/(0?\d|1[0-2]):(0\d|[0-5]\d) (am|pm)/i", '$start')) : $errors->add('submit_error', __('<strong>error</strong>: time incorrect', 'appthemes')); endif; might simple, @ moment can't head around how can bypass validation if field left empty. ideas? if(!empty($your_field) && !preg_match(...)) php tests if field null before testing regex. if field null php jump next instruction.

Logrotate does not auto rotate when based on log size -

i have custom application (myapp) writing logs file '/var/log/myapp'. can see logs being written , works fine. trying setup logrotate file , have created config file '/etc/logrotate.d/myapp', contents of - /var/log/myapp { missingok size +10k start 0 nocompress create 0600 root root rotate 10 postrotate /etc/init.d/rsyslog restart > /dev/null 2>&1 || true endscript } now if logrotate -dv /etc/logrotate.d/myapp don't see errors such , when logrotate -f /etc/logrotate.d/myapp executed i.e., forceful logrotate log rotated. when log file size exceeds 10k log not automatically rotated. appreciated. logrotate rotates logs specified in /etc/logrotate.d/ according time interval configured in /etc/logrotate.conf . on distros, default value week. can override time interval in specific config using e.g. 'daily' in config file. log files not rotated until logrotate has known files @ least long time specifie...

model view controller - spring 3.0 MVC seems to be ignoring messages.properties -

spring 3.0 mvc first of all, haven't found documentation regarding messages.properties @ springsource i've found overriding error messages has been on various forums. if has reference messages.properties documented that'd fantastic. maybe messages.properties comes not spring java spec? i have tried following advice on jsr-303 type checking before binding goal replace type mismatch error messages own user friendly error messages my situation follows: model public class test { private int numberbomb; public int getnumberbomb() { return numberbomb; } public void setnumberbomb(int numberbomb) { this.numberbomb = numberbomb; } } myservlet.xml <mvc:annotation-driven/> jsp <form:form id="test" method="post" modelattribute="test"> <form:errors path="*"/> <form:label path="numberbomb">numberbomb</form:label> <form:input path="num...

statistics - Easiest way to create an irregular time series graph (R? GGPLOT? ITS?) -

Image
i'm graphic designer trying use r create graphs complicated excel. i'm trying create irregular time series step chart. i've had no problems creating regular time series chart, reason, irregular dates throwing off. i'm starting basic text file 2 columns of data: 01-04-1940 4 05-29-1963 35 12-02-2002 24 i've loaded data using d <- read.delim("file.txt", header = true) and i've converted first column in unix time using d$date <- as.date(d$date, format = "%m-%d-%y") but @ point, can't find more information anywhere on how proceed. i've seen r package "its," cannot find documentation on beyond technical descriptions of classes involved. i'd appreciate if experience in r point out few lines of code need create graph. thanks! ggplot deals quite nicely data in date format. here suggestions: d <- data.frame( date = c("01-04-1940", "05-29-1963", "12-02...

iphone - Animating TableView Instead of Plain Reloading -

i trying animate reloading of table view. currently, download array of table view items , if user reloads table view manually, downloads separate array, compares current newly downloaded, , if different, reloads table view newly downloaded array. there easy way to, somehow, compare arrays , insert/delete rows (animated, of course) accordingly? i found apple's table view programming guide useful question: http://developer.apple.com/library/ios/#documentation/userexperience/conceptual/tableview_iphone/manageinsertdeleterow/manageinsertdeleterow.html

visual c++ - How to Convert from unsigned char* to array<unsigned char>^? -

how convert array of unsigned chars array<unsigned char>^ ? thanks in advance! just create managed array, , copy data. simple. array<byte>^ makemanagedarray(unsigned char* input, int len) { array<byte>^ result = gcnew array<byte>(len); for(int = 0; < len; i++) { result[i] = input[i]; } return result; } yes, i'm sure there's way use marshal class copy you, or pointer managed array can pass memcpy , works, , doesn't require research on msdn verify it's correct.

channelfactory - Configure WCF without using config file and instantiating proxy client with default constructor -

i not sure possible honest, i wondering if there way of removing use of config file without having override creation of client proxy. let me give example: in client app have wcf dal project. wrapper wcf server client app consume. @ present client app need bindings , endpoints given in config file , (in our projects) following wrap wcf service: public myobject getmyobject(int id) { using(var service = new myobjectdataserviceclient()) { return service.getmyobject(id); } } this create call server , object back. if client app didn't have bindings , endpoints blow up. change each creation of data service client create binding , endpoint, or create our own chanelfactory means changing current wcf dal layer code. my goal try , create way of inserting process wcf dal layer handle bindings , endpoints without consuming code having change, whilst removing need config file. my thoughts far try , use tt file create partial class of data service client ...

bash - Send string to stdin -

is there way in bash: /my/bash/script < echo 'this string sent stdin.' i'm aware pipe output echo such this: echo 'this string piped stdin.' | /my/bash/script you can use one-line heredoc cat <<< "this coming stdin" the above same as cat <<eof coming stdin eof or can redirect output command, like diff <(ls /bin) <(ls /usr/bin) or can read as while read line echo =$line= done < some_file or simply echo | read param

json - WCF - JSONP Content-Length Issue -

scenario: web service needed calculate values , send results json. these calls made cross-domain i'm using jsonp. problem i'm having occurs both on same domain , cross-domain. problem: i'm having issue getting json data wcf service. while on local machine works fine, when on server response service cut short (if run through visual studio on server though, it's fine). the content length seems set length of response before wrapping in jquery callback function (example data below). local: jquery151017220264650085249_1309423933796({"d":"[\"flat\",\"terrace\",\"semi\",\"detached\",\"bungalow\"]"}); local: jquery151017220264650085249_1309423933797({"d":"[\"new build\",\"2000 2010\",\"1990 2000\",\"1970 1990\",\"1950 1970\",\"pre 1950\"]"}); live: jquery1510246237260361726_1309424024004({"d":"[\...

c# - Reading incoming data from socket? -

i have socket client , wondering correct approach read incoming data it. currently using follow function: private void _readresponsepackets() { while (_socket.connected) { try { byte[] bytes = new byte[1500]; _socket.receive(bytes); if (bytes.length > 0) loginserverpackets.enqueue(bytes); } catch (exception ex) { _log.write(errortype.error, "[loginclient] " + ex.tostring(), true); } } } that called own thread: thread _readdatathread = new thread(_readresponsepackets); _readdatathread.start(); as can see merelly reading , pilling packets received on queue list further threaded question here is: should use thread.sleep in read function or leave ? would impact more on performance or memory usage or using thread.sleep ? any other toughts ? please check following link, socket in blocking mode, don't need use thread.sleep. list...

javascript - Is there a way to show a font that is not supported by a browser? -

i want use font called bpreplay , i'm guessing it's not supported @ least 1 major browser, if not of them. is there way using css or javascript/jquery or other way allow browser support , use font on website users see font want them too? thanks! you can use @font-face property use custom font. each browser needs diferent type of font. can read more here , find fonts compatible browsers here

XML to javascript array with jQuery -

i new xml , ajax , newcomer javascript , jquery. among other job duties design our website. deadline near, , way can think of project ajax. have document full of xml objects such 1 repeating: <item> <subject></subject> <date></date> <thumb></thumb> </item> i want create array of elements , child elements. i've been reading jquery tutorials on ajax hours , don't know start because assume level of javascript proficiency. if show me easiest way loop through elements , put children array, i'd appreciate tons. using jquery, $.ajax() xml file, , on success pass retrieved data each , like: var tmpsubject, tmpdate, tmpthumb; $.ajax({ url: '/your_file.xml', type: 'get', datatype: 'xml', success: function(returnedxmlresponse){ $('item', returnedxmlresponse).each(function(){ tmpsubje...

php - mysql OR clause respective to AND clause -

i have form filtering/sorting database records. i'm filtering posts author, category, , tags. i'm using and clause author , category , or clause tags (multiple tags can entered) a query looks this select * (`posts`) `author` = 'dan' , `category` = 'technology' , `tags` '%ebook%' or `tags` '%ipad%' or `tags` '%apple%' the query above returns posts contain tag searched regardless of author or category. i want return posts containing tags ebook, ipad, apple within author name dan , category technology . how possible in mysql? add brackets around or's select * (`posts`) `author` = 'dan' , `category` = 'technology' , ( `tags` '%ebook%' or `tags` '%ipad%' or `tags` '%apple%' )

android - Reloading List of Bitmaps -

i have initialization activity loads ~10 bitmaps on network. bitmaps stored in static variable , main activity started. after pressing or home main activity , navigating app, initialization process starts over. looks main activity being destroyed onpause() called. i've tried serializing bitmaps, they're big. what's best way save , restore many bitmaps without having go through initialization process again? you should use disk cache store them see android training class displaying bitmaps efficiently , lesson caching bitmaps .

jquery - Masonry Plugin: Resizing div wont cause reshuffle -

have masonry items wrapped in 1000px wide div, have button resize div 2000x using jquery's addclass() , problem masonry won't reshuffle items fill 1000px space, know resize works because resizing browser window causes reshuffle. masonry: $(function(){ $('#container').masonry({ // options itemselector : '.item', columnwidth : 240 }); }); button: $("a.button").toggle(function(){ $(this).addclass("flip"); $("div#container").fadeout("fast", function() { $(this).fadein("fast").addclass("resize"); }); css: width: 1000px; /* default */ width: 2000px !important; /* on button press */ i tried running ('a').click on masonry function using same button, , seems work problem still there. any advice? i'm stumped :/ i believe need run masonry function agian when re-size button clicked. $("a.button").toggle(function...

javascript - Tab into a textarea not highlighting the text -

basically, when tab through form, every input field text highlighted, doesn't happen textareas. or ideas appreciated. i've included textarea html below in case. <textarea onblur="if(this.value==''){this.value='embed code'}" onclick="if(this.value=='embed code'){this.value=''}" name="post.code">embed code</textarea> use onfocus instead of onclick , getting focus tabbing not dispatch click event (so onclick handler isn't called). note html5 has placeholder attribute script doing. to select text in textarea, add handler focus event: <textarea ... onfocus="this.select()" ... note may annoy users don't expect happen textarea elements.

How to validate two textfields value in struts validation.xml file? -

i using struts jquery ajax plugin validation . need validation 2 textfield minamt , maxamt. need put validation maxamt greater minamt. make xml this. <validator type="fieldexpression" short-circuit="true"> <param name="fieldname">disslab.maxamt</param> <param name="fieldname">disslab.minamt</param> <param name="expression">disslab.maxamt.greaterthan(disslab.minamt)</param> <message>not valid max amt</message> </validator> but not working. read simple example here , in code <validator type="fieldexpression"> <param name="fieldname">personbean.carmodels</param> <param name="expression"><![cdata[personbean.carmodels.length > 0]]></param> <message>you must select @ least 1 car model.</message> </validator> this working fine. can provide ...

android - format ISO date/time and later compare to phone's date/time -

i've got string of date/time in iso-8601 format, like: 2011-04-15t20:08:18z i want format more readable date/time , able compare later phone's local time. i'm bit confused what's been deprecated , hasn't. need use calendar object? can walk me through how this? following code snippet can use stringbuffer sbdate = new stringbuffer(); sbdate.append(cdate); string newdate = sbdate.substring(0, 19).tostring(); string rdate = newdate.replace("t", " "); string ndate = rdate.replaceall("-", "/"); ndate give date in normal format, compare 2 dates continue like long epoch = new java.text.simpledateformat("yyyy/mm/dd hh:mm:ss").parse(ndate).gettime(); date currentdate = new date(); long diffinseconds = (currentdate.gettime() - epoch) / 1000; string elapsed = ""; long seconds = diffinseconds; long mins = diffinseconds / 60; long hours = diffinseconds / 3600; long days = diffinseconds / 86400; ...

media player - Samsung Galaxy S kill my android app on music play -

i have written app plays background music mediaplayer. testing app , works on htc desire perfectly, when try test on samsung galaxy s dies nullpointer exception on following part: mp_bg_music.play(); yes, had used mediaplayer.create , said work on htc desire! idea why samsung galaxy s fail run same program htc desire? there additional things should aware of before try play music? need grant more uses-permission app? the solution change aac mp3

ruby on rails - Build custom error messages in model files (example: using the 'pluralize' method) -

i using ruby on rails 3.0.7 , use pluralize method in model file in order build custom error messages. for example, following: name_min_lenght = 2 # value '2' plan change (maybe dynamically... if possible) in future development validates :name, :length => { :minimum => name_min_lenght, :too_short => "is short (minimum #{pluralize(name_min_lenght, 'character')})", }, how can that? advisable? why? i'm inclined agree wukerplank looks bit overengineered, it's still interesting question. according this post can use helpers in controller methods: put in class applicationcontroller: def helper.instance end class helper include singleton include actionview::helpers::texthelper end then can use so: def check_for_max_donkeys if donkey.find_fit_donkeys.size == app_settings['max_fit_donkeys'] flash_error "the maximum of #{help.pluralize(app_settings['...

objective c - Link to SQLite database created with Firefox -

i'm trying start sqlite , firefox add-on create new database. don't see how call database in code, once tables created firefox. i opened sqlite manager in firefox. created tables. now, how can link them code this, example: -(void) getquestions:(sqlite3_stmt *)reqcompilee { while(sqlite3_step(reqcompilee) == sqlite_row) { nsstring * mytexte = [[nsstring alloc] initwithutf8string: (char*)sqlite3_column_text(reqcompilee, 1)]; you every thing here implementing sqllite in project. in tutorial find other important links.

How do I access an JSON array with boost::property_tree? -

int main(int argc, char *argv[]) { qcoreapplication a(argc, argv); // string s = "{\"age\":23,\"study\":{\"language\":{\"one\":\"chinese\",\"subject\":[{\"one\":\"china\"},{\"two\":\"eglish\"}]}}}"; string s = "{\"age\" : 26,\"person\":[{\"id\":1,\"study\":[{\"language\":\"chinese\"},{\"language1\":\"chinese1\"}],\"name\":\"chen\"},{\"id\":2,\"name\":\"zhang\"}],\"name\" : \"huchao\"}"; ptree pt; stringstream stream(s); read_json<ptree>( stream, pt); int s1=pt.get<int>("age"); cout<<s1<<endl; string s2 = pt.get<string>("person."".study."".language1"); cout<<s2<<endl; now want value of langu...

java - Who and how handle the exception when we use throws? -

class test{ public static void main(string[] cv) throws ioexception{ bufferedreader br=new bufferedreader(new inputstreamreader(system.in)); string s=br.readline(); } } when we're writing throws handling ioexception here ? whe use try-catch can handle in catch block. here how , handling ? when have method throws clause, other method calls method has either handle exception (by catching it) or throwing furter having throws clause type of exception (so that, in turn, method calls 1 again has same, etc.). when main method has throws clause, jvm take care of catching exception, , default print stack trace of exception. when want special handling when main throws exception, can set uncaught exception handler: thread.setdefaultuncaughtexceptionhandler(new uncaughtexceptionhandler() { @override public void uncaughtexception(thread t, throwable e) { system.err.printf("thread %s threw uncaught exception!%n", t.getname()); e.pr...

scrollview - Android: HorizontalScrollView Scrolling Issue -

i have custom horizontalscrollview , linearlayout child, , initial 9 custom views under linearlayout . when scroll right, need add 3 more child views linearlayout , , remove first 3 children, such 9 child views present @ time. we added detection points based on view ids, in such way if currentviewid > lastchildid - 0.33f * viewsizelimit viewsizelimit = 9 . if valid, that's time add/remove views linearlayout . first issue encountered when remove views linearlayout , children shifted left. if currentviewid = 7 , , current view on detection zone add 3 views end, , remove 3 views front. currentviewid = 4 due shift. we added scrollby method of horizontalscrollview compensate view shift , works if scrolling not fast. here's example logs: 07-01 17:01:34.304: info/gta(2476): currentviewid: 6 07-01 17:01:34.304: info/gta(2476): scroll distance: 8 07-01 17:01:34.373: info/gta(2476): currentviewid: 6 07-01 17:01:34.383: info/gta(2476): scroll distance: 41 07-01 17:...

touchscreen - Android touch screen listener problem -

i've created little program show user fingers on screen, problem x,y values other fingers not being modified. doing wrong? thank you! public class testandoactivity extends activity implements ontouchlistener { /** called when activity first created. */ private textview txtv; private textview txtv2; private int nf = 0; private map<integer, string> info; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); info = new hashmap<integer, string>(); setcontentview(r.layout.main); this.txtv = (textview)this.findviewbyid(r.id.textview); this.txtv2 = (textview)this.findviewbyid(r.id.textview2); this.txtv.setontouchlistener(this); } public boolean ontouch(view v, motionevent event) { int actioncode = event.getaction() & motionevent.action_mask; int pid = event.getaction() >> motionevent.action_pointer_id_shift; info.put(pid, pid + ": x=" + event.getx() + " y=...

java - XJC non-transient non-serializable instance field data -

after generating java classes received: public class myclass { @xmlelement(name = "data", required = true) @xmlschematype(name = "date") protected xmlgregoriancalendar data; @xmlelement(name = "time", required = true) protected xmlgregoriancalendar time; ......... findbugs warns myclass defines non-transient non-serializable instance field data. warning acceptable or need fix? thanks. it's fine ignore warning, these special classes designed different serialization method (xml). might set findbugs ignore entire generated package.

c - how to analysis this excerpt of Ruby source code about === method -

i found example , metaphor of object#=== operatorare confusing, i'm begin read source code, i'm new c, tell me how analysis code: value rb_equal(value obj1, value obj2) { value result; if (obj1 == obj2) return qtrue; result = rb_funcall(obj1, id_eq, 1, obj2); if (rtest(result)) return qtrue; return qfalse; } value generic type of ruby objects in c (as opposed c types int ). can deduce rb_equal function comparing 2 ruby objects ( obj1 , obj2 ). if 2 objects equal qtrue (the represantion of ruby's true in c) returned. if not rb_funcall call equality method ( id_eq ) on obj1 . if result truthy (checked rtest(result) ) qtrue returned. if hit end of function 2 objects not same, we'll return false ( qfalse ).

c++ - Virtual function acting weird in inheritance? -

lemme explain problem giving example: #include <iostream> class pc { public: pc():data(0) { } virtual void display() { std::cout<<"the data :"<<data<<std::endl; } protected: int data; }; class smartpc:private pc { public: smartpc():pc() { } void convert() { pc* temp=static_cast<pc*>(this); temp->display(); } void display() { std::cout<<"the data (in bb):"<<a<<std::endl; } }; int main() { smartpc smrtpc; pc* minipc= static_cast<pc*>(&smrtpc); smrtpc.convert(); } according scott meyers : static_cast<pc*>(this); create temp base copy of smartpc. temp->display(); executed display() function of derived class. why so? shouldn't execute function of base's display() , since object copy of base of smartpc? another question if add line temp->data; in convert() function , s...

Filter child select box value from parent using Jquery -

i have 2 selection boxes,one contains country names , contains state names of countries. <select id="parent"> <option value="country1">country1</option> <option value="country2">country2</option> <option value="country3">country3</option> </select> <select id="child"> <option value="country1 state1">country1 state1</option> <option value="country1 state2">country1 state2</option> <option value="country2 state1">country2 state1</option> <option value="country2 state2">country2 state2</option> <option value="country3 state1">country3 state1</option> </select> then if select country1 parent selection box, state selection box has need show states of country1 alone , remove other states it. i need find child values partial match , verify parent value.. $...

asp.net - How to extract the database file when using SQLExpress in Visual Studio -

i have made database in sqlexpress , master database . create cd project need database file. not able find file please suggest solution thanks! you'll need .mdf , .ldf in sql server installation directory, if you've created in master database, i'd recommend creating different database , moving there instead. master db shouldn't used stuff that.

php - Cannot create a zend framework project from the command line -

i have done configurations required run zend framework project on server,and working fine.but when try create new project command line, c:\wamp\www> zf create project myproject its not creating project.also not giving error.i have set paths of php.exe , zf.bat. c:\wamp\www> zf show version not doing anything. there not information in online documentation. it related permission, depending on zf.bat is, have experienced issues when trying call bat or similar files under c:/ folders. if that's not problem, , not receiving error messages in prompt when calling zf tool, check event viewer, can more info error there.

fetch - Manually update UITableView (Replace NSFetchedResultsController logic) -

i used combination of queue , resultscontroller update , display coredata objects. got exceptions , problems (see thread nsoperationqueue , nsfetchedresultscontroller ). after long research found out nsfetchedresultscontroller problem , decided write own update logic uitableview. my new strategie is: - when view loads fetch objects core data array , display them - after 20 seconds try load new data web , update core data (inside of second thread / or nsoperation) thread uses own objectcontext... main context ignore changes! - after fetch objects again in temporary array - need update uitableview don't know how... have compare both arrays , update, delete or insert cells.. its important me have nice animations insert , delete. case objects in 1 section!! possible have view "cars" , "hotels" => 2 sections different objects (2 datasource arrays) can please provide me example updating uitableview. i used: - (void)controller:(nsfetchedresultscontrol...

iphone - Problem in getting file path within the app -

everyone i working on app supports viewing of document files (doc, text , others). have registered app these file types, if emails document file me, use didfinishlaunchingwithoptions method path of file. problem if application running in background? how file path caused app become active opening file? best regards use "application:openurl:sourceapplication:annotation:" app delegate; following text taken apple's documentation application:openurl:sourceapplication:annotation: asks delegate open resource identified url. - (bool)application:(uiapplication *)application openurl:(nsurl *)url sourceapplication:(nsstring *)sourceapplication annotation:(id)annotation discussion if application launched result of application requesting open url resource, uiapplication first sends application application:didfinishlaunchingwithoptions: message , invokes method. method supplies delegate of handling application bundle id of source application annotation inform...

asp.net mvc 3 - Compile-time error: rendering a partial view within a partial view -

i trying render partial page inside partial page. have in layout page call partial createmenu , here pass model layout page. works perfect. inside createmenu partial trying call menuitem same syntax fails. visual studio shows path red (i know 100% exists). how can render partial inside partial. menupartial's call render: @html.partial("~/models/default/usercontrols/_menuitem.cshtml", model.modules[i]) model.modules[i] consists of mvcmodule objects. menuitem: @model models.default.classes.mvcmodule <li class="@{if (model.canexpand) {<text>fullwidth</text>} else {<text>nodrop</text>}} first_fullwidth"> ... this results in compilation error: compiler error message: cs0115: "asp._page_models_default_usercontrols__menuitem_cshtml.execute()": es wurde keine passende methode zum Überschreiben gefunden. line 46: public override void execute() { sorry german text. have tried ou...

OpenCV createsamples example -

i trying run createsamples example opencv library. can load in 1 image @ time , seems work fine. however, when try load in collection of images parse error. not sure if in collection file invalid or if missing elsewhere. below exact format of text document. text document details: target1.jpg 1 0 0 1296 1152 target2.jpg 1 0 0 1890 709 command line call: -info "c:\users\seb\desktop\learning samples\target\target.txt" -num 10 -vec "c:\users\seb\desktop\learning samples\target\target.vec" -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 20 -h 20 any appreciated. the parse error because when not specify number of pos image samples want generate, createsamples use default value 1000. if annotation text document contains less 1000 bounding boxes of objects, parse error. can still use .vec file training cascade. problem information of number incorrect. there 2 ways fix it. you manually count number of object boundi...

android - Custom IDs in ListView -

i'm trying populate listview products. can it, need them have custom id's (the ones sqlite database). how can this? code without id implementation far: arraylist<string> productnamelist = new arraylist<string>(); arraylist<string> productidlist = new arraylist<string>(); cursor results = mydbhelper.getproducts(); listview lv = (listview) findviewbyid(r.id.productlist); while (results.movetonext()){ productnamelist.add(results.getstring(results.getcolumnindex("name"))); productidlist.add(results.getstring(results.getcolumnindex("id"))); } lv.setadapter(new arrayadapter<string>(this,android.r.layout.simple_list_item_1 , productnamelist)); you should use simplecursoradapter: string[] columns = new string[] { "_id", "name" }; int[] = new int[] { android.r.id.text1, android.r.id.text2 }; simplecursoradapter madapter = new simplecursoradapter(...

objective c - Cast with "char", instead of directly NSString? -

i have code self.text = [nsstring stringwithutf8string:(char *)sqlite_column_text(init_statement, 0)]; i'm wondering why use stringwithutf8string: , char * stuff, instead of directly using nsstring here? presumably sqlite library not returning nsstring s, being c library knows nothing of objective c.

javascript - Pulling a single variable off a webview in android? -

i need pull value hidden div tag when using webview. have turned on javascript in webview activity not liking "". how can achieve goal? public class buttonone extends activity{ webview wb = null; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.buttons); wb = new webview(this); wb.getsettings().setjavascriptenabled(true); wb.setwebviewclient(new hellowebviewclient()); wb.getsettings().setjavascriptenabled(true); wb.loadurl("http://ishopstark.com/mobileapp.php?category=1"); setcontentview(wb); } private class hellowebviewclient extends webviewclient { public boolean shouldoverrideurlloading(webview view, string url) { view.loadurl(url); <script type="text/javascript"> { var varsendtext = document.getelementbyid("sendtextcoupon").value; } </script> return...

iphone - Problem capturing single/double taps inside a ScrollView -

i'm posting message because i've been reading forum , haven't been able find similar problem. need able discriminate taps , double taps (this standard thing) problem whatever reasons have scroll view inside scrollview. so, had sub-class scrollview in order touchedbegin method called. i have class called photoviewcontroller (a sub-class of baseviewcontroller) class contains class called customscrollview (a subclass of scrollview). needed sub-class customscrollview scrollview in order override touchesbegin method, , able capture touches made user. i tried calling touchesbegin method customscrollview using return [super touchesbegan:touches withevent:event] inside touchesbegin method, when touchesbegin method inside photoviewcontroller gets called it's parameters empty (and can't discriminate if user made single or double tap, need) i have class, called photoviewcontroller: @class photoviewcontroller @interface photoviewcontroller : baseviewcontroller ...

model view controller - Most efficient way to implement a 'logged-in' check with MVC in PHP? -

i know questions similar have been asked, have been searching through internet , can't seem find i'm looking for. the common answer put in controller. liked particular solution stackoverflow had sessioncontroller , nonsessioncontroller , both extending main controller sessioncontroller checking if user logged in before dispatch. does mean controller this? class sessioncontroller { ... function view() { //view thread stuff } function post() { if loggedin { //post thread stuff } } { in situation, looks nonsessioncontroller useless, , model used when every action controller handles either strictly users or non-users, unlike forum example. so guess question is, general concept of controller above efficient way of dealing login checks when using mvc? i think idea have 1 controller checks session , login, , 1 doesn't. i put login check in constructor of session controller wa...

android - Which listener gets triggered when the mapview's dimensions change from their initial (zero) state? -

i'm implementing lazy drawing of overlays based on user's current viewing rectangle. viewing rectangle gets initialized based on dimensions of mapview follows: rect viewrectangle = new rect(0, 0, mapview.getwidth(), mapview.getheight()); through debugging, width , height of mapview remain constant (except when there's orientation change) except initial creation of mapview dimensions (width , height) zero. unfortunately, despite attempts @ holding off initialization until of other ui components have been created, can't seem find proper place creation of viewing rectangle. not want place initialization within drawing of overlays because seems theoretically inefficient (with allocation overhead , potentially triggering garbage collection) create temporary objects every lazy-drawing call (triggered zooming, panning, , restful data refreshes). is there listener gets triggered when dimensions of mapview changed 0 state? i've tried multitude of different search...

.net - Mixed mode applications initialize error -

first programmers. my problem confusing. i have windows xp sp3 , .net 3.5 sp1 installed on system. when compile c++/cli source code /clr:safe option, produced executable assembly work well, mean run when mix native c++ , managed c++ code , compile source code /clr or /clr:pure mode, generated assembly works while , after while following message comes out when again try run executable assembly "the application failed initialize properly, 0xc000007b. please click ok terminate application." note: error message comes out when compile code /clr or /clr:pure modes , mix native , managed code. have checked , cleaned system viruses problem not solved. please me find out real problem? thanks advance... yes visual c++ redistributable version 2008 installed on x86 windows-xp 32bit machine! using visual c++ 2008 express sp1 development tool. tools come vc++ 2008 express sp1 not run , give same error. noticed error pops when build mixed mode or pure mode c++/cli executab...

javascript - jQuery Not Executing Function As Expected -

im sure have problems code. im not sure how mix raw javascript jquery. here relevant code in js file: $(document).ready(function() { $('#show-video').click(function(event) { jquery('.player-hold').slidedown("slow"); $('#book').slidedown('slow', function() { playvideo(); }); jquery('.features').slideup("slow"); }); }); function onplayerstatechange(newstate) { if(newstate == 0) { jquery('.player-hold').slideup("slow"); jquery('.features').slidedown("slow"); } } function playvideo() { if (ytplayer) { ytplayer.playvideo(); } } function onyoutubeplayerready(playerid) { ytplayer = document.getelementbyid("ytplayer"); ytplayer.addeventlistener("onstatechange", "onplayerstatechange"); ytplayer.setplaybackquality("highres"); ytplayer.cuevideob...

ruby - Using rails methods with Haml::Engine -

i want have rake task reads haml file , creates static html file out of it. reason want dynamically localize error pages in manner described here http://devcorner.mynewsdesk.com/2010/01/13/rails-i18n-and-404500-error-pages/ here method writing error pages. def write_error_page(status, locale = nil) dest_filename = [status.to_s, locale, "html"].compact.join(".") file.open(file.join(rails.root, "public", dest_filename), "w") |file| path = file.join(rails.root, "app", "views", "errors", "#{status}.haml") file.print haml::engine.new(file.read(path)).render end end the problem haml::engine not have rails methods available. when try read haml file, error every rails method in file (i want use methods image_tag, form_for , i18n.translate). i noticed similar issue had been solved here: rails haml engine rendering however, when try solution mentioned in link above, following error: ...

javascript - Heading to another page in PHP -

i curious know if there way using javascript make php go page ? because head works when first function called, resorted javascript go page. php must have similar function no ? <?php session_start(); session_destroy(); echo '<script language="javascript"> <!-- window.location="home.php"; //--> </script>'; ?> you have mistake. header('location: some_location.php'); needs first things that's being output, meaning, if echo before this, wont work, other wise work. so just: header('location: some_location.php');

java - Problem with rich tree onselect -

i've new problem rich:tree... there how id data selected row javascript? mean, have bean id, , name atributes, example... , use tree showing names (but injet bean)... when click in element, want call javascript function named 'teste'... , there want id, selected row... function teste(){ var selectedid = ? } is there how id js function?

multithreading - Load modules in Perl at run time and share it between threads -

is possible load modules @ run time, require '/file_path/file_name.pm'; , , share memory between threads? basically, have pool of threads, if thread#1 decides load module, want module available threads! "no, it's not possible. either module must loaded before thread created, or each thread must individually load module." thanks dave mitchell 1

asp.net - Link to image database -

i have following page: @{ if (request["id"].isint()) { var imgid = request["id"].asint(); //data var db = database.open("amsdarquiteturaconnectionstring"); var image = db.querysingle("select * images [id] = @0", imgid); if (image.mimetype.startswith("image")) { response.addheader("content-disposition", "inline; filename=" + image.name); } else { response.addheader("content-disposition", "attachment; filename=" + image.name); } response.binarywrite((byte[])image.file); } } i'm using plugin image zoom in, , need make link point image. <a rel="images" title="myimage" href="projectimage?id=@img.id"></a> the problem when click on link see meaningless code. how make link point picture in database? you need est...

Is there a rich ftp client library for Python? -

i'm familiar ftplib , works great simple interface need file properties , rich ftp client. know of ftp client library? use mlsd command. have parse it's easy. # note portions of mlsd data case insensitive... def parseinfo(info): fact in info.split(';'): if not fact: continue name, value = fact.split('=', 1) yield name.lower(), value ftp = ftplib.ftp(host, user, passwd) dirinfo = {} def callback(line): info, fname = line.split(' ', 1) dirinfo[fname] = dict(parseinfo(info)) ftp.retrlines('mlsd {}'.format(path), callback) print(dirinfo) that's rich ftp gets.

How to use Checkbox as button click event using JQuery/Ajax - MVC2 -

this code output content enter text box display when click button. want lik when select checkbox value entered in text box rendered. //view page: in page jquery request&responce type , displaying 2 text box , 1 check box , 1 button <script type="text/javascript"> $(function(){ $('#selectall').change(function () { alert("value changed");//when run script witht alert function getting output code unable output expect var options = { target: '#result-user', // id of div going display result beforesubmit: showrequest, success: showresponse, type: 'post', resetform: true }; $('#form-user').ajaxform(options); // id of form wish submit }); }); function showrequest(formdata, jqform, options) { $("#result-user").empty().html('loading....'); $("#form...

c# - What is the purpose of accessors? -

can me understand get & set ? why needed? can make public variable. warning : assuming know object-oriented programming . what are properties? properties language elements allow avoid repetitive getxyz() accessors , setxyz() mutators techniques found in other languages, java. why exist? they aim solve following problems: saying get , set in beginning of every access or mutation of value annoying , distracting. in java, say: class person { private int _age; public void setage(int value) { /*check value first, set _age*/ } public int getage() { return this._age; } } and consistently say: if (person.getage() > blah || person.getage() < 10) { person.setage(5); } after while, get , set become rather annoying. providing direct access actual variable breaks encapsulation, that's not option. how used? they used just variables . read/write them variables. how created? they created methods . define pair of meth...