Posts

Showing posts from May, 2012

Cloning queue in c# -

i have following code: queue<string> oldqueue = new queue<string>(); oldqueue.enqueue("one"); oldqueue.enqueue("two"); oldqueue.enqueue("three"); queue newqueue = oldqueue; string newstring = newqueue.dequeue(); the problem once dequeue item newqueue , item dequeued oldqueue . there way "clone" queue in way removing item 1 queue keep it's clone queue unchanged? queue reference type, newqueue , oldqueue holds pointer same object. same ;-) see answer how "deep cloning" using reflection: deep copy using reflection in extension method silverlight?

rest - Jersey integration with Spring MVC -

i want create website able work rest android application. these rest-calls want make use of seperate servlet web.xml <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>stage xt-i</display-name> <welcome-file-list> <welcome-file>/web-inf/jsp/index.jsp</welcome-file> </welcome-file-list> <listener> <listener-class> org.springframework.web.context.contextloaderlistener </listener-class> </listener> <servlet> <servlet-name>spring</servlet-name> <servlet-class>

linux - Can someone identify this unix command? -

at university, output our submitted code being compared correct output using (i think) unix command. problem don't know or means (i don't think it's diff) rivers passed stage width 10 rivers failed stage b width 10 --- rivers.expf 2013-04-25 18:15:49.093265000 +1000 +++ rivers.outf 2013-04-25 18:15:49.082424000 +1000 @@ -22,4 +22,3 @@ beyond fixing. - i've got above output. imagine --- refers 1 file, while +++ refers other, , 22, 4 line number, minus sign @ end mean? ("beyond fixing" in last lines of input file) the output showing "unified diff": http://en.wikipedia.org/wiki/diff#unified_format it can generated diff -u many programs can generate kind of output. the minus sign @ end indicates file missing newline compared reference file.

.net - C# Flow Diagram of Objects -

i have objects more or less follows: public class object1 { public string connectionin1 { get; set; } public string connectionin2 { get; set; } public string connectionin3 { get; set; } public string connectionout1 { get; set; } public string connectionout2 { get; set; } public string connectionout3 { get; set; } public dynamic property1 { get; set; } public dynamic property2 { get; set; } public dynamic property3 { get; set; } } objects connected each other via connectionin , connectionout property. need let user use flowchart environment place objects on flowsheet, , connect them. there flowcharting library .net allow me place objects on flowsheet, , set properties specific object on flow sheet , connect objects? i keep application open source commercial solution not option me... you haven't specified that, if you're using wpf, please take @ graph# . i've been using while myself , it's not bad @ all.

Normalization of Many to Many relation in sql -

Image
i have product table contains 2 column productid desc 1 fan 2 table 3 bulb i have table contains supplier information supplierid desc 1 abc 2 xyz 3 hjk now 1 supplier can supply multiple products , 1 product can supplied multiple suppliers achieve have created table tbl_supplier_product supplierid productid 1 1 1 2 2 1 2 2 2 3 is way link table supplier , product table through primary composite key. in table primary key composite key (supplierid , productid) or should add column row id each record , use primary key , add unique constraint columns supplierid , productid supplierid productid row id 1 1 1 1 2 2 2 1 3 2 2 4 2 3 5 unique constraint(supplierid, productid) what relatio

ejb 3.0 - What are the steps in writing Desktop client for Jboss 7.1 -

i created standalone client glassfish 3.2, want application deployed on jboss. interested in answer guide me build standalone application interact ejb 3 application deployed on jboss 7.1 my sub question is: should preferred choice creating standalone client: ejb 3.0 or webservices ? it seems me, you're mixing things here. first, mean "standalone client"? if deploy on application server, not standalone, it's piece of server software can used clients. next, client of business code (which example implemented in ejb), can of course local or remote ejb, again piece of server software using functionality. if want used outside, have provide access example in form of web service. and finally, speak of "jboss 7.1" , "glassfish 3.2" , created application - go , drop usage of ejb3.0 , jee5 , make use of current jee6 ejb3.1 , of it's related technology. included rest api example might choice implementing client. client in turn can &quo

java - Fetch not repeated rows in hibernate -

i fetch list query in hibernate without repeated elements. currently have like: select t table t join fetch t.list tl tl.userid=:userid , tl.tableid=t.id this works good! problem returns same object many times userid in tl so lets userid found 3 times in tl getting: t tl1 tl2 tl3 t tl1 tl2 tl3 t tl1 tl2 tl3 and want get: t tl1 t tl2 t tl3 or one: t tl1 tl2 tl3 i guess possible in hibernate havent manage yet. thanks in advance do write select distinct t table t join fetch t ....... -----^------ hql order clause , distinct clause helpful further.

ios - Is it possible to customize swiping gesture recognition that triggers UIScrollView scroll? -

Image
i've created custom subclass uiscrollview , implemented touchesbegan , touchesmoved , touchesended , touchescancelled methods. however i'm not satisfied how things work. particularly, when mentioned methods getting called , when uiscrollview decide scroll(drag). uiscrollview scrolls if difference between first touch point , last touch point little in vertical direction. can swipe horizontally , uiscrollview going scroll or down depending on small difference.(which fine in normal use cases) both of these swipes cause uiscrollview scroll downwards. however i'm interested possible adjust somehow, behaves this: basically near horizontal swiping gets picked touchesbegan , related methods , not initiate scroll. green swiping direction still initiate scrolling... edit: i forgot mention, touchesbegan , relatives called if hold finger short period of time on screen , move around. not classical swiping gesture... ivan, think trying same effect

Gradually increase/decrease animation speed? [Android] -

i working on animated effect on android, know if there's other way gradually increase/decrease animation speed? is possible specify first 3 second rate of change slow, , rest goes fast? use interpolator . case recommend acceleratedecelerateinterpolator animation anim = animationutils.loadanimation(this, r.anim.your_animation); anim.setinterpolator(new acceleratedecelerateinterpolator()); image.startanimation(anim); as interpolator, can build own! public class myinterpolator extends interpolator { public myinterpolator(int valuecount) { super(valuecount); } public float getinterpolation (float input) { return (float)(math.cos((input + 1) * math.pi) / 2.0f) + 0.5f; } } using wolfram alpha can play parameters.

android - Serialization / Deserialization & Proguard -

with 1 of app, had problem 1 of serialized classes when try update apk. indeed, there problems related objects saved previous version of apk , new version of apk. in latest apk (in production on android market), i've forgot configure proguard.cfg serializable class (and static final long serialversionuid member)... so when try in new apk reload previous stored serializable class, i've invalidclassexception problem in stacktrace ddms : 04-24 18:17:40.120: w/system.err(1204): java.io.invalidclassexception: cu; incompatible class (suid): cu: static final long serialversionuid =6593847879518920343l; expected cu: static final long serialversionuid =0l; 04-24 18:17:40.125: w/system.err(1204): @ java.io.objectinputstream.verifyandinit(objectinputstream.java:2380) 04-24 18:17:40.125: w/system.err(1204): @ java.io.objectinputstream.readnewclassdesc(objectinputstream.java:1662) 04-24 18:17:40.125: w/system.err(1204): @ java.io.objectinputstream.readclassdesc(obj

osx - Sort of NDIS Intermediate Miniport on Mac OS X -

we have solution of intermediate network layer implemented ndis im on windows. investigating how thing ported mac os x. ideally, should intermediate driver/kext right on top of ethernet-capable adapter, , below ip/arp/whatsoever, operating ethernet frames. some tutorial/sample preferred, passthru sample wdk, although hints appreciated. no, not filter/firewall, it's not vpn, it's new , quite complicated intermediate layer operating @ level. i suggest read network kernel extensions programming guide . see nke architecture in "network kernel extensions overview" section. looks need interface filter or may virtual interface . see "networking" chapter (chapter 13) in "os x , ios kernel programming" book (by ole henry halvorsen , douglas clarke). far remember there example of simple ethernet controller driver.

How to get array values in Ruby On Rails -

i working on localization concept in rails , need of localization values in html pages. generated array in controller below format., #array use store localization values @alertmessages = [] #array values... {:index=>"wakeup", :value=>"wake up"} {:index=>"tokenexpired", :value=>"token expired"} {:index=>"timezone", :value=>"time zone"} {:index=>"updating", :value=>"updating"} {:index=>"loadmore", :value=>"load more"} #....more in html pages want localization values below or other type, <%= @alertmessages['wakeup'] %> so, display value ' wake up ', but not working.. can 1 please... it's easier use hash ( http://api.rubyonrails.org/classes/hash.html ), array named indexes (or keys). so this: @alertmessages = { :wakeup => "wake up", :tokenexpired => "token expired", .

html - MySQL and Form with equation -

so have form looks this section | length | number dropdown of sections | integer | integer then have sql looks this section (list of sections) | weight (weight of section) | cost (cost of section) the user chose section dropdown, enter number of section required , length of section. user click button add data table underneath form. on click need chosen section's length multiplied number multiplied weight, , chosen section's length multiplied number , cost. displayed in table this section | total length | weight | cost 152x152x25 | 5000 | 25 | 600 it must able add quite few entries table. sadly, i'm designer , not programmer, if help, appreciate it. edit 1. answers used (152x152x25|5000|25|600) example. 2. i'm going use normal linux server deliver html page containing form , table. there "print" print table , "send" email table. plan on populating sql database myself.

android - The Key does not match any allowed key -

i getting invalid android_key parameter. key cdg3* * *** etg not match allowed key. configure app key hashes @ https://developers.facebook.com/apps/2487 **2958. steps have completed in window system 1. keytool -export -alias myalias -keystore c:\users\mayank.android\mykeystore | c:\openssl-0.9.8k_x64\bin\openssl sha1 -binary | c:\openssl-0.9.8k_x64\bin\openssl enc -a -e got hash key wjpx* * +dd+77dtph8sm8k= facebook app configuration filled name package name class name hash key wjpx* * +dd+77dtph8sm8k= got app id 2487***2958 what else need do. are facing problem when running on emulator or android device? if on android devices, hashkey piece of code below, learnt https://developers.facebook.com/docs/android/getting-started . the keytool executed in windows machine emulator run on machine. @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); // add code print out key hash try { packageinfo info = getpack

jquery - Wordpress validation error display -

in wordpress forms there no inline validation notify user. validation server based , form refreshes , error messages displayed on top of form. is there plugin change jquery based validation. searching , couldn't find such plugin. please advise. thanks you use popular contact form 7 plugin , install jquery validation contact form 7 plugin adds jquery validation in contact form 7 forms. update: for validation of custom forms found this javascript form validation script.

Mobile application authentication & session management from java application -

i'm looking suggestions below listed problem i have web application developed on java & current web application developed below features authentication (login/logout) session management dashboard subscription , profile edit some crud functionality. now, i'm planning mobile app same futures. since current application can able provide restful service crud operations. let me know best approach achieve authentication & session management in mobile app? thanks in advance suggestions. have day.

c# - How to make IsolatedStorageSettings persist even after the device is turned off? -

first page of application requests login id , password store using isolated storage. want application remember login credentials if device switched off i.e once user logs in, application should store login values , on user's next visit login page should not appear , directly second page should displayed. can me this??? thanks in advance see question: " for how long data in isolated storage persistent ". if restart windows phone emulator equivalent deleting application. not happen on real phone.

silverlight - ListView - Selected Item in the middle -

i'm building windows store app using xaml. have scrollable listview has selecteditem set on start. now, have 2 requirements: i selected item visible in addition should displayed in middle of list when possible (it's not possible first element). the first requirement can partially fulfill using list's layoutupdated event , list.scrollintoview(item) method, doesn't allow me scroll down list manually until item unselected. for 2nd requirement have no ideas. ok, found out how achieve that: http://fczaja.blogspot.com/2013/05/xaml-listview-scroll-selecteditem-to.html

benchmarking - Convert List<Integer> to int[] - Pure Java vs ArrayUtils benchmark issue -

i had optimise api call in high performance system did list<integer> int[] conversion. initial finding expected average amount of elements pure java seemed lot faster used apache commons arrayutils. factor 100-200 , sort of amazed. problem ran test on 1 pair of conversions @ time, restarting little test program each number of elements wanted test. doing that, pure java way faster number of elements several k's started out. sat down write nicer test program runs , outputs results number of different sized lists in 1 go , results quite different. it seems arrayutils slower on first run, faster on subsequent runs regardless of list size, , regardless of number of element on first run. you can find test class here: http://pastebin.com/9eylzqkv please me pick holes in it, don't why output get. many thanks! you need account loading times , warmup in code. built in classes may called first , may loaded, , warmed up. a loop not optimised until has been r

newsletter - Magento: where can I set some params/vars to "newsletter_subscr_success.html" email template? -

i need customize "newsletter_subscr_success.html" email template , need pass variables it. the problem don't know sent can push parameters/variables. where can find it? if have variables in controllers files or models or model/observer.php, should in format, $emailtemplatevariables['any_string'] = "this string"; now, grab variable newsletter_subscr_success.html, give <div>{{var any_string}}</div> , done!

php - How to pass through web service call to another server? -

there 2 web applications (examplea.com , exampleb.com). i'd pass through every call made examplea.com exampleb.com - in fact examplea.com work proxy server. both applications build on zend framework 1.11.11 , use zend_soap_*. i make 302 redirect (and anyway) but, believe, there no guarantee ws client follow redirect. why not change ip of examplea.com same exampleb.com & add alias examplea.com vhost of exampleb.com

sql - XACT_ABORT OFF ACID incompatible? -

i'm new here please gentle! :) ok, i've got sql server community/world 2 years (sql server dev , dba - 2005+ versions) , have discovered acid theory , wondering how hell sql server acid compatible? default comes xact_abort off option, right? , here's example msdn : if object_id(n't2', n'u') not null drop table t2; go if object_id(n't1', n'u') not null drop table t1; go create table t1 (a int not null primary key); create table t2 (a int not null references t1(a)); go insert t1 values (1); insert t1 values (3); insert t1 values (4); insert t1 values (6); go set xact_abort off; go begin transaction; insert t2 values (1); insert t2 values (2); -- foreign key error. insert t2 values (3); commit transaction; go select * t2; and result set: a 1 3 where atomicity in case? did got whole acid theory wrong perhaps? p.s.:the r

sql - strtodate mysql function not exsit .. mysql query -

i have table price rooms , there 3 seasons (deafult , low , hight ) , want search 2 dates total price diffrent days , seasons .. this table , query http://sqlfiddle.com/#!2/7ebc2/1 how can calculate total price 5 days (mysql ) hotel booking system select sum(coalesce(prices.room_price , def.room_price) ) totalprice (select strtotime('2013-05-07' , '%y-%m-%d') thedate union select strtotime('2013-05-08' , '%y-%m-%d') thedate ) dates left outer join sh_rooms_price prices on dates.thedate between prices.start_season , prices.end_season , dayname(dates.thedate) = prices.day_of_week join sh_rooms_price def on def.season_price = 'default' , def.id_hotel = 5544 , def.day_of_week = dayname(dates.thedate) error appear: strtotime not exist strtotime not valid function in mysql. defined php. try using str_to_date . the modified query works fine. select sum(coalesce(prices.room_pric

c++ - Improving asynchronous execution in CUDA -

Image
i writing programme performs large simulations on gpu using cuda api. in order accelerate performance, tried run kernels simultaneously , asynchronously copy result host memory again. code looks this: #define nstreams 8 #define blockdimx 16 #define blockdimy 16 void domainupdate(float* domain_cpu, // pointer domain on host float* domain_gpu, // pointer domain on device const unsigned int dimx, const unsigned int dimy, const unsigned int dimz) { dim3 blocks((dimx + blockdimx - 1) / blockdimx, (dimy + blockdimy - 1) / blockdimy); dim3 threads(blockdimx, blockdimy); (unsigned int ii = 0; ii < nstreams; ++ii) { updatedomain3d<<<blocks,threads, 0, streams[ii]>>>(domain_gpu, dimx, 0, dimx - 1, // dimx, minx, maxx dimy, 0, dimy - 1, // dim

zend framework2 - Is there any way to override ZF2 application.config.php directives locally? -

i'm working on zf2 project , public/index.php file follows: <?php chdir(dirname(__dir__)); require 'init_autoloader.php'; zend\mvc\application::init(require 'config/application.config.php')->run(); application initialize process starts using application.config.php , know zf2 provides nice way override module configurations locally via filenames modulename.local.php not application.config.php file. for example, in application.config.php have module_listener_options key follows: return array( 'modules' => array( // ... ), 'module_listener_options' => array( 'module_paths' => array( // ... ), 'config_glob_paths' => array( 'config/autoload/{,*.}{global,local}.php', ), 'config_cache_enabled' => true, 'config_cache_key' => 'configuration_cache', 'cache_dir' => __dir__ . '/../data/cac

forms - Viewstate in PHP -

is possible enable viewstate in php? 1 input value , value stays there when refresh page. if yes, brief explanation on how works appreciated. you don't have such thing in php, can use php sessions store variable when page loads , can use values later.

How to transform an R Matrix into an xts/zoo object? -

ai'm having problem transforming xts derived r matrix xts object after running returns function. here's i've got... > class(xtsdata) [1] "xts" "zoo" > head(xtsdata) ts_58_20_b_003_003 ts_58_20_s_021_005 ts_58_20_s_034_013 ts_58_20_s_042_021 2011-01-02 10001.0 10000.0 10000 10000 2011-01-03 10387.5 10001.0 10000 10000 2011-01-04 10387.5 10551.0 10000 10000 2011-01-05 10387.5 10562.5 10000 10000 2011-01-06 10387.5 10562.5 10000 10000 2011-01-07 10387.5 10562.5 10000 10000 > tail(xtsdata) ts_58_20_b_003_003 ts_58_20_s_021_005 ts_58_20_s_034_013 ts_58_20_s_042_021 2013-03-05 21199.0 14905 10274.5

How to download file from internet in java -

i have problem when want download file internet in java. try used this: string stringurl = "http://imageshack.us/a/img841/7762/formd.png"; file file = new file(""); try { url url = new url(stringurl); fileutils.copyurltofile(url, file); } but got i/o exception. best way download file internet , put 'file' object? that's because haven't given file name, , writing file no name makes no sense. file file = new file(""); if replace line like: file file = new file("x.png"); ...then should work.

c# - Mediaelement Playlist repeat how to? -

i can't find solution how reset index when last file has been opened. have mediaelement reads images listbox , when last image has been played want restart. repeatable mediaelement playlist. please help, need one. dictionary<string, string> listbox1dict = new dictionary<string, string>(); public static list<string> images = new list<string> { ".jpg", ".jpe", ".bmp", ".gif", ".png" }; // bildtyper som stöds public static list<string> movies = new list<string> { ".wmv", ".wav", ".swf", ".mp4", ".mpg", ".avi" }; // filmtyper som stöds list<string> paths = new list<string>(); dispatchertimer dispatchertimer = new dispatchertimer(); dispatchertimer nextimagetimer = new dispatchertimer(); int x = 20; //ställa in antal sekunder per bild private int currentsongindex = -1; private void dispatc

jquery waypoints - Sticky header with a switch (like Hongkiat) -

i'm creating sticky header using waypoints in tutorial http://www.webtutorialplus.com/sticky-header-on-scroll-jquery/ but how create header 'swaps'? example: if visit http://www.hongkiat.com/blog/ , scroll down header scrolls, not element visible on page. is you're looking for? working demo $('.showafterthis').waypoint(function() { if ($(".header2").is(":hidden")) { $(".header2").slidedown(100); } else { $(".header2").slideup(100); } });

perl - Apache server preprocessing POSTed FORM data -

i want display progress bar showing live status of file upload. had solution involved perl reading stdin , me ajaxing file every second or , worked fine, hosting providers seem have changed , doesn't work anymore. what appears happening form submits data in entirety , runs script. data being uploaded first , script processes it. on big uploads page seems hang 40 seconds , "uploads" data 40 seconds, while processes data upload (during second phase progress bar works, know perl scripts running) but... if set target of form file doesn't exist, still takes 40 seconds before comes 404, implies first thing apache accept upload? i'm programmer more sysadmin type , advice or comments appreciated. if had guess, sounds provider set reverse-proxy in front of perl web application. lightweight proxy handles file upload in entirety before passing request onto application in order keep resource-intensive processes waiting on network traffic. if that's ca

wpf - Order In Chaos Of Control Initialization Steps -

i know when happening inside initalization process of controls when start wpf application? when dp initalized? when binding? when datacontext set? datacontext avaialbe in constructor of control? there kind of order? i realized ran trap once set value on getter/setter of dp inside constructor of control dp value gets updated values gets rolled default value null. so guess contructors initalized first , dependency properties. can me out this? edit: rachel. dp receives value 234 , immedialty rolls null. think because constructor gets called first , subsequently initalizing of dps happens sets dp null because null default value. thinking wrong this? order of initalization steps of control or dependency object. class mysuperdupercoolclass : contentcontrol { public mysuperdupercoolclass() { initalizecomponents(); this.mysuperduperproperty = "234"; } public string mysuperduperproperty { { return (string)getvalue(mysuperduperpropertyproperty);}

java - PrintWriter vs FileWriter in the following context -

this question has answer here: printwriter vs filewriter in java 7 answers what if in next bit of code going substitute (new filewriter (new printwriter pw = new printwriter(new bufferedwriter(new filewriter ("xanaduindeed.txt"))); pw = new printwriter(new bufferedwriter(new printwriter ("xanaduindeed.txt"))); both of them work fine, know of 2 optimize memory usage. (if either of 2 better) in advance. in oracle's jvm: public printwriter(string filename) throws filenotfoundexception { this(new bufferedwriter(new outputstreamwriter(new fileoutputstream(filename))), false); } printwriter 's notable characteristic flush output on every newline (lf or cr or crlf). lowest memory footprint bare filewriter , buffering gives notable improvement in i/o performance.

open android application using url and go to different screen -

how start app using url link , go different activity. have used code <activity android:name=".act1" android:label="activity first" android:screenorientation="landscape" > <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:host="xyz.com" android:pathprefix="/abc/" android:scheme="https" /> </intent-filter> </activity> by using code able open act1 while entering android app want switch act2 , act3. because have use 3 different url , stating screen should act1, act2 , act3 click on url1, url2 , url3 respe

jboss5.x - PersistenceProvider not found Exception in JBOSS AS 5.1.0 GA -

i trying deploy product in jboss 5.1.0 ga using eclipse in linux. previously executed on tomcat 6. while deploying got many errors. had solved 1 one. but classnotfoundexception raised due persistenceprovider. my product environment jpa 1.0. , using toplink-essentials.jar, toplink-essentials-agent.jar. (my toplink version 2.0) please see bug decription... 11:46:08,276 error [abstractkernelcontroller] error installing start: name=persistence.unit:unitname=#entity state=create java.lang.classnotfoundexception: oracle.toplink.essentials.persistenceprovider baseclassloader@12bb617{vfsclassloaderpolicy@bfa9d6{name=vfsfile:/opt/jboss-5.1.0.ga/server/default/deploy/iportman_gpl.war/ domain=classloaderdomain@16877f8{name=defaultdomain parentpolicy=before parent=org.jboss.bootstrap.noannotationurlclassloader@1837697} roots=[memorycontexthandler@19344978[path= context=vfsmemory://3j011-idx41v-hfxjen4j-1-hfxjf9qd-2a real=vfsmemory:

python - How to replace the line in which I'm currently? -

i have python code this: with open('myfile') f: next(f) # skip first line line in f: items = line.split(';') if len(items) < 2: # want replace line s.th. write how replace line s.th. want write? open file in r+ mode, read it's content in list first , after truncation can write new data file. 'r+' opens file both reading , writing if file huge better write new file first , rename. with open('myfile','r+') f: data=f.readlines()[1:] f.truncate(0) #this truncate file f.seek(0) #now file pointer goes start of file line in data: #now write new data items = line.split(';') if len(items) < 2: # here else: f.write(line)

php - After running the script, browser hangs up. Other browsers works -

this question has answer here: php & jquery ajax call without waiting response 2 answers i wrote script exports data database , put xml file. script works in infinite while loop proper break statement (after task done). task takes 10 minuts. when make http request start job, browser i'm using completly freezes - not requested url whole host. in same time other browsers can browse webpage contains script. snippet of php script: while(true) { if($i === $z) { break; } foreach((array)$this->project $project) { makeyourjob(); usleep(1000000); $z++; } usleep(2000000); } script invoked jquery code (i type address of html page contains code): $.get("cron.php"); also tried type cron.php in url bar , browser hangs too. why browser runs script freezes? how avoid this? edit: making

ios - Adding a view between TabBarController & NavigationController -

i have tab bar controller each of view controllers navigation controller. want block of views within 1 of navs (alertview style) black transparent view, should cover nav bar @ top, without covering tab bar @ bottom. so, if @ docs (views of tab bar controller - figure 2) want cover custom content nav bar included. i don't believe there's easy solution this, suggestions appreciated. if want add alertviewstyle 1 of uiviewcontroller should try code: //you can replace uiview custom uiview class uiview *view = [[uiview alloc] initwithframe:cgrectmake(0, 0, self.navigationcontroller.view.frame.size.width, self.navigationcontroller.view.frame.size.height)]; view.backgroundcolor = [uicolor graycolor]; // set desired color [self.navigationcontroller.view addsubview:view];

java - Dependency injection with Jersey 2.0 -

starting scratch without previous jersey 1.x knowledge, i'm having hard time understanding how setup dependency injection in jersey 2.0 project. i understand hk2 available in jersey 2.0, cannot seem find docs jersey 2.0 integration. @managedbean @path("myresource") public class myresource { @inject myservice myservice; /** * method handling http requests. returned object sent * client "text/plain" media type. * * @return string returned text/plain response. */ @get @produces(mediatype.application_json) @path("/getit") public string getit() { return "got {" + myservice + "}"; } } @resource @managedbean public class myservice { void servicecall() { system.out.print("service calls"); } } pom.xml <properties> <jersey.version>2.0-rc1</jersey.version> <project.build.sourceencoding>utf-8</project.bui

yql - Easy Jquery: How to display source -

i'm sure easy question cannot find example me figure out answer: i creating query using yql , want replace of values variables. i'm not sure have correct love jquery display effort can test i've created. this know works: <script> function handleresponse (json) { var ul = document.getelementsbytagname( 'ul' )[0], li = null; ( var = 0; < json.query.count; i++ ) { li = document.createelement( 'avgrent' ); li.innerhtml = json.results[i]; ul.appendchild( li ); } } </script> <script src="http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3d%22http%3a%2f%2fwww.zillow.com%2fwidgets%2fzestimate%2fzestimatesmallwidget.htm%3fdid%3dzillow-shv-small-iframe-widget%26type%3diframe%26forrent%3dtrue%26address%3d'5894%2bdogwood%2bcir%2b35111'%22%20and%20xpath%3d'%2f%2fdiv%5b%40id%3d%22zestimate-rate-container%22%5d%2fspan%5b2%5d'&diagnostics=true'&cal

JQuery: Change URL param without reloading? -

i have question, possible change url via jquery under following conditions: same url load on browser , on reloads page doesn't reload when change parameter if wanna prevent page reloading you'll have use hash "#" and if wanna change url try that: jquery.param.querystring(window.location.href, 'valuea=321&valueb=123'); this return following url: http://bla.com/test.html?valuea=321&valueb=123

java - How to read <text> node values from CCDA xml file using MDHT -

i using mdht parse xml values of ccda file. not able read value non-contributory form <text> <paragraph>non-contributory</paragraph></text> . consider following xml content : ` family history <component> <section> <!-- family history section template --> <templateid root="2.16.840.1.113883.10.20.22.2.15"/> <code code="10157-6" displayname="family history" codesystem="2.16.840.1.113883.6.1" codesystemname="loinc"/> <title>family history</title> <text> <paragraph>non-contributory</paragraph> </text> </section> </component> ` any url or reference appreciated. you not need parse text element. text elements in ccda document used make human readable format. same values present in entry elements of sections. edit: following code may help package org.ope

excel: remove number from plot, set no number in formula -

i have log formular prints out errors values below 0. set these 0 in formula, want have no number, not 0 inserted. how set cell/formula no number? this current formula =wenn(b2>0;log10(b2);) the solution following =if(b2>0;log10(b2);nv()) here explanation: http://office.microsoft.com/de-de/excel-help/nv-funktion-ha102752925.aspx , not find out how according english site.

How can I reduce the width of column in Oracle (SQL Plus) with TIMESTAMP datatype? -

in sql plus output taking more space needs , i'd reduce 50 chars 20. if reduce width 20 won't wide enough default timestamp or timestamp time zone format. when happens, sqlplus wrap value. assume table b has timestamp column ts : column ts format a20 select ts b; ts -------------------- 25-apr-13 11.28.40.1 50000 to cut down width further, decide information want , format accordingly. oracle datetime , timestamp formatting codes listed here . note sqlplus won't let specify date format column statement. that's why used format a20 above. can 19 characters if drop fractional seconds , use 24-hour clock instead of am/pm, , drop time zone: column tsformatted format a20 select to_char(ts, 'mm/dd/yyyy hh24:mi:ss') tsformatted b; tsformatted -------------------- 04/25/2013 11:28:40 if you're willing drop century can 2 of fractional seconds , exact width of 20: column tsformatted format a20 select to_char(ts, 'mm/dd/yy hh24:mi:ss

javascript - jQuery and CSS causing text to move oddly after animation -

i have created fiddle scrolls box down , up, text "hide" , "show" move bit when animation has finished. have tried few different things cannot scroll correctly. $('a#maintoggle').click(function(){ if ($('a#maintoggle').hasclass("down")) { $('a#maintoggle').removeclass("down"); $('a#maintoggle').addclass("up"); $('#contentcollapse').stop(true, true).animate({height: '30px'},1000,function(){ $('#contentcollapse').css("display", "none"); $('a#maintoggle').addclass("hangdown"); }); $('a#maintoggle span').text("show"); $('#maintoggle em').html("<img src='img/show.gif' />"); } // end if else{ $('#contentcollapse').css("display", "block"); curheight = $('#c

C++ send UDP message to node.js UDP server has unrecognizable code -

my node.js udp server's code var port = 515; var host = '127.0.0.1'; var dgram = require('dgram'); var server = dgram.createsocket('udp4'); server.on('listening', function () { var address = server.address(); console.log('udp server listening on ' + address.address + ":" + address.port); }); server.on('message', function (message, remote) { console.log(remote.address + ':' + remote.port +' - ' + message); }); server.bind(port, host); and c++ client's code is: word wversionrequested = makeword(1, 1); wsadata wsadata; int err = wsastartup(wversionrequested, &wsadata); if (err != 0) { return false; } if ( lobyte( wsadata.wversion) != 1 || hibyte( wsadata.wversion) != 1 ) { wsacleanup(); return false; } // server address srvaddress.sin_addr.s_un.s_addr = inet_addr(getprofileudphost()); srvaddress

javascript - Test Google Analytics from localhost -

Image
i've seen this: can test google analytics on localhost address? , getting google analytics see test server followed suggested, nothing works. what did: edited hosts file have several additional domains. created virtual hosts on local apache httpd server. created account in google analytics, created several "properties" (as in websites belong me) in account. wrote testing html page report page view google analytic service. all listings shown below: c:/windows/system32/drivers/etc/hosts 127.0.0.1 ad-test # testing ad banners 127.0.0.1 testing.foo.tv # testing ad banners 127.0.0.1 testing.foo-sdk.tv # testing ad banners the relevant part of httpd.conf <virtualhost *:80> servername ad-test documentroot d:/cygwin/home/wvxvw/projects/admodule <directory "d:/cygwin/home/wvxvw/projects/admodule"> allowoverride order allow,deny allow require granted </directory> <

jquery - Uncaught TypeError: Object [object Object] has no method 'live' -

getting error: uncaught typeerror: object [object object] has no method 'live' from javascript , jquery code: init: function(options) { var form = this; if (!form.data('jqv') || form.data('jqv') == null ) { options = methods._saveoptions(form, options); // bind formerror elements close on click $(".formerror").live("click", function() { //getting error here: //uncaught typeerror: object [object object] has no method 'live' }); } return this; }; why method live missing? .live removed in jquery 1.9 see docs: http://api.jquery.com/live/ try using .on instead: $(document).on('click', '.formerror', function(){ //your event function });

Need help to retrieve data from three MySQL tables -

i have 3 tables named "users","user_hobbies" , "hobbies". below sample tables values; below users table fields id, name , age ╔════╦══════╦═════╗ ║ id ║ name ║ age ║ ╠════╬══════╬═════╣ ║ 1 ║ abc ║ 23 ║ ║ 2 ║ xyz ║ 24 ║ ║ 3 ║ pqr ║ 21 ║ ╚════╩══════╩═════╝ and below user_hobbies table fields id, user_id , hobby_id ╔════╦═════════╦══════════╗ ║ id ║ user_id ║ hobby_id ║ ╠════╬═════════╬══════════╣ ║ 1 ║ 1 ║ 1 ║ ║ 2 ║ 1 ║ 2 ║ ║ 3 ║ 1 ║ 3 ║ ║ 4 ║ 2 ║ 4 ║ ║ 5 ║ 2 ║ 3 ║ ║ 6 ║ 2 ║ 5 ║ ║ 7 ║ 3 ║ 2 ║ ║ 8 ║ 4 ║ 6 ║ ╚════╩═════════╩══════════╝ . below hobbies table fields id , desc ╔════╦═══════════╗ ║ id ║ desc ║ ╠════╬═══════════╣ ║ 1 ║ music ║ ║ 2 ║ chatting ║ ║ 3 ║ cricket ║ ║ 4 ║ badminton ║ ║ 5 ║ chess ║ ║ 6 ║ cooking ║ ╚════╩═══════════╝ . actual requirement need query retrieve name, age, hobby_id

php - Creating a file text with symfony2 and twig -

i generate file text symfony2 controller twig. like normal html templating plain text, , save file somewhere. is possible ? finally got it. i wanted generate bash script. create template in right place such as mybundle/resources/views/mycontroller/mytemplate.sh.twig in scriptgenerator class // load template $template = $this->twig->loadtemplate('mybundle:mycontroller:mytemplate.sh.twig'); // render whole template $script = $template->render($parameters); where want use it, place code. namespace myproject\mybundle\controller; use symfony\bundle\frameworkbundle\controller\controller; use myproject\mybundle\generator\scriptgenerator; class mycontroller extends controller { public function myaction() { $twig = $this->get('twig'); $generator = new scriptgenerator($twig); $parameters = array( 'a parameter' => "whatever" ); $script = $generator->sets

Is it possible to make a script for certain number of rows in Sql Server 2008? -

i have table 100k+ rows of data. possible generate script (inserts) using mssql server 2008 last 1000 rows of data? e.g. tasks > generate scripts... making inserts data in table. script heavy. know can use query > results file. , write program parse results , generate scripts, exist better way? no, i'm pretty sure out of luck far having ssms doing you. said, can select data want, export , manipulation create insert script. sql server 2008 simple as insert mytable (col1, col2) values (1,'test1'), (2,'test2'), (3,'test3'), --997 more it still take work @ least wont have write insert mytable part 1000 times...

wordpress theming - display category name with links in search page -

how display category title , respective links , contents. i have codes , contents on posts working not on category's title/links something link this: <?php /* template name: search */ ?> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?> <?php echo '<a href="'. get_category_link($current_cat_id). '>'. the_category(' ').'</a> '; ?> the_title(); the_excerpt(); <?php endwhile; ?> <?php else : ?> <h2>no posts found.</h2> <?php endif; ?> use get_the_category_list : $categories_list = get_the_category_list( ', ' ); if( $categories_list ) echo $categories_list;

java - Using JSP Hot deployment for application that need frequent update -

is using jsp hot deployment solution publish new or updated content avoid restarting java ee server (cannot hot deploy jar)? should not use jsp code lot of java, have other solution? with tomcat, can use parallel deployment method. able deploy new version , keep older 1 running every users has session on it. it simple when using war files, recommend simple script delete older versions after couple of days exemple, keep few running versions. you can more informations here : http://tomcat.apache.org/tomcat-7.0-doc/config/context.html#parallel_deployment

java - How can I keep a JFrame to specific width and height? -

i made 840 400 frame , added text field. default, java app shrinked size of text field. want fixed respective size. i tried setresizable(false) , setextendedstate() , setbounds() no avail. try setpreferredsize(new dimension(840,400)); if named frame can do name.setpreferredsize(new dimension(840,400));

Limit posting links on facebook pages -

i have created facebook application year php , javascript sdk, auto publicator blogs , pages have 50 pages active, , many facebook pages corresponding each site. these pages maintained different people , publishers, total of 40 people working. the application automatically post link on facebook page pointing url of web every time publish new post on blog or web. so far worked perfect, 1 days have blocked user had authorized application post ... have been reviewing publications database , saw stopped when has reached publication or post 51. i feeling facebook has established maximum limit of 50 publications per user link in total of pages, normal if keep small number of pages, if keep example 60 pages , want publish post in each 1 ridiculous limit ... anyone know this, fear work of months have been broken ...

jquery - Loading all widget assests with a single call? -

i'm wondering if it's @ possible (either natively or through plug-ins) make single call url , have return both css , js files single widget. assuming have control of both request , response of such request. would possible (and if so, how) or overly optimistic? you don't need request? can add stylesheet / js file dynamicly. // js $.getscript("http://www.domain.com/script.js", function(){ alert("script loaded"); }); // css var url = "http://www.domain.com/style.css"; $('head').append( '<link rel="stylesheet" type="text/css" href="' + url + '" />' ); other ways: do ajax call , add js head css done above.

actionscript 2 - Creating level codes with action script 2.0 -

i want create level codes, in sea of fire ( http://armorgames.com/play/351/sea-of-fire ) have text input box instance name "code" , button has code: on (release) { if (code = 96925) { gotoandstop(4); } if (code = 34468) { gotoandstop(5); } if (code = 57575) { gotoandstop(6); } if (code = 86242) { gotoandstop(7); } if (code = 99457) { gotoandstop(8); } if (code = 66988) { gotoandstop(10); } if (code = !96925 && !34468 && !57575 && !86242 && !99457 && !66988) { gotoandstop(3); } } i've tried use code.text instead of code, i've tried quotes around numbers, tried both sends frame 10 if code invalid. you need use conditional operator (==), not equality operator (=) in 'if' condition if 'code' text field need use code.text can put trace check value of code. not understand last if condition instead can use if - else if - else here.

JQuery add a class to a table row depending on <td> value -

i need check text of values in table inside of div. if 1 of values inside <td></td> equals "invalid", want add class "red" <tr> . the html looks - <div id="mydiv"> <table> <tbody> <tr> <td>1</td> <td>good</td> </tr> <tr> <td>2</td> <td>invalid</td> </tr> <tr> <td>3</td> <td>good</td> </tr> </tbody> </table> </div> i have jquery find any table on page, , puts class on <td> . how can change add class <tr> inside <div> ? jquery.each($('tbody tr td'), function () { if (this.textcontent == "invalid") { $(this).addclass("red"); } }); thanks! if

actionscript 3 - Breakout with Flash: I need help to improve my Brick n Ball collision -

i've been stuck on problem long time now, i've searched around alot , tried stuff, nothing works. explanations hard me understand im pretty new programming overall , got alot learn. i have 2 problems 1: ball wont collide bricks when speed fast. 2: ball capable of hitting 2 bricks. both problems related fact 60 fps isnt enough type of collision detection work properly. i need explain in simple way possible need make collision detection prevent happen. here's current collision code: private function checkcollision(): void { grdx = math.floor((ball.x) / 28); grdy = math.floor((ball.y) / 14); ngrdx = math.floor((ball.x + dx) / 28); ngrdy = math.floor((ball.y + dy) / 14); var flipx: boolean = false; var flipy: boolean = false; if ((grdy <= level.length - 1) && (ngrdy <= level.length - 1) && (grdy >= 0 && ngrdy >= 0)) { if (testblock(grdx, ngrdy)) { flipy = true; paddleflag = 1; }