Posts

Showing posts from February, 2014

jquery - How to make resizable Fancybox v2 image and border change size together? -

i'm trying create resizable fancybox v2 window using jquery ui. the thing happens - change image size or border size separately. html: <a rel="gallery" title="image" class="fancybox" href="http://fancyapps.com/fancybox/demo/2_b.jpg"><img src="http://fancyapps.com/fancybox/demo/2_s.jpg" alt=""/></a> resizable image: http://jsfiddle.net/g2pjr/ js: $(".fancybox").fancybox({ arrows: false, autoresize: false, aftershow: function () {$('.fancybox-image').resizable();} }); resizable border: http://jsfiddle.net/hrvka/ js: $(".fancybox").fancybox({ arrows: false, autoresize: false, aftershow: function () {$('.fancybox-skin').resizable();} }); how force image change size border? jquery ui resizable widget includes alsoresize option bind resizable .fancybox-wrap selector , alsoresize .fancybox-inner , .fancy

jquery - Why does quicksand get image positions wrong? -

i've got quicksand set sort list, can see demo here (this drupal site developing locally, had make static html page things don't quite right, can see issue): website if make browser's width 1090px (on actual site issue happens across broader range of resolutions, on demo seems happen @ 1090px - @ least in chrome) , click "all" you'll notice images wobble little bit, when should not move @ all. how can fix this? don't forget add "position: relative;" parent container. in case: <div class="mm_quicksand_container"> this div should have "position: relative;" on it. should rid of little wobble/hitch see when finishes animating.

c# - Moving Picturebox on a Grid is inaccurate because Mouse Positions are inaccurate -

i have application put pictureboxes on panel. after implemented drag&drop pictureboxes, wanted add grid option conviniently move pictureboxes on panel. code used is private void pb14_mousemove(object sender, mouseeventargs e) { if (e.button == mousebuttons.left) { if (grid) { if (mouseposition.x % 10 == 0) { pblist[14].location = new point(plist[parent].pointtoclient(new point(mouseposition.x, mouseposition.y)).x, pblist[14].location.y); } if (mouseposition.y % 10 == 0) { pblist[14].location = new point(pblist[14].location.x, plist[parent].pointtoclient(new point(mouseposition.x, mouseposition.y)).y); } } else { ... } } } plist list of panels, plist[parent] parent in picturebox (out of pictureboxlist) pblist[14] is. the

jquery - javascript change color of textbox -

i have code wont work. problem be? syntax wrong or whole method wrong? <input checked="checked" class="form-field" id="iscurrentlysmokingrightnej" name="iscurrentlysmokingright" type="radio" value="nej"> <input class="form-field" id="iscurrentlysmokingrightja" name="iscurrentlysmokingright" type="radio" value="ja"> <input id="iscurrentlysmokingrighttextbox" name="iscurrentlysmokingright" type="text" style="background-color: rgb(0, 255, 0); float: right; width: 50px;"> javascript: $(document).on("change", "iscurrentlysmokingrightnej", function() { var elem = document.getelementbyid("iscurrentlysmokingrightnej"); var ele = $("#iscurrentlysmokingrighttextbox"); if (elem.checked) { ele.css("background-color", "rgba(0, 255, 0, 1)");

python - Plotting surface of implicitly defined volume -

having volume implicitly defined x*y*z <= 1 for -5 <= x <= 5 -5 <= y <= 5 -5 <= z <= 5 how go plotting outer surface using available python modules, preferably mayavi? i aware of function mlab.mesh, don't understand input. requires 3 2d arrays, don't understand how create having above information. edit: maybe problem lies unsufficient understanding of meshgrid()-function or mgrid-class of numpy. see have use them in way, not grasp purpose or such grid represents. edit: i arrived @ this: import numpy np mayavi import mlab x, y, z = np.ogrid[-5:5:200j, -5:5:200j, -5:5:200j] s = x*y*z src = mlab.pipeline.scalar_field(s) mlab.pipeline.iso_surface(src, contours=[1., ],) mlab.show() this results in isosurface (for x*y*z=1) of volume though, not quite looking for. looking method draw arbitrary surface, "polygon in 3d" if there such thing. i created following code, plots surface (works mayavi, too). need modify code part

c++ - Mex compilation macro -

i wish include header file when code compiled via mex command in matlab. if it's compiled directly visual studio not want included. is there macro can that? i'd of sort: #ifdef mex_compile_flag #include "mexdependent.h" #end you can use macro matlab_mex_file this. mex.h work properly, macro must defined if , if compiled object linked mex file. mex command makes sure define when calls compiler.

javascript - jQuery .toggle() equivalent in Google Closure -

i rewriting of javascript files rid of jquery , use google closure instead. have got date picker user can toggle show or hide. @ moment following code being used: if (this.open == open) return false; $(this.eldatepicker).toggle(open); this.open = open; return true; where el.datepicker element date picker inside, in case div. i looking way rewrite piece of code change jquery google closure. idea's how should possible? you should able do goog.style.showelement(this.eldatepicker, !goog.style.iselementshown(this.eldatepicker)); source: google closure style.js doc

jquery mobile radio button onchange event does not fire -

i have implemented jquery mobile shopsystem generates different radio buttons payment methods this: <input type="radio" name="newmethodofpayment" onchange="openwaitscreen();jquery('#theform').submit();return false;" value="1000" title="paypal" checked="checked" id="paymentmethod1000"> by testing desktop browsers works fine when choosing different payment methods when using iphone, example, page reloads , checked radio button not checked. i don't it. makes me crazy.

c# - How to get HttpRequestMessage data -

i have mvc api controller following action. i don't understand how read actual data/body of message? [httppost] public void confirmation(httprequestmessage request) { var content = request.content; } from this answer : [httppost] public void confirmation(httprequestmessage request) { var content = request.content; string jsoncontent = content.readasstringasync().result; }

batch file - copy specific value from text1 to text2 by dos -

i need copy specific value text1 text2 dos batch. text1 that; 20130701,xxxx,xxxx,xxx 20130702,yyyy,yyy,yyyyyyy i want copy "20130701" line text1 text2 , using dos command. help. this create text2.txt lines text1.txt start 20130701 findstr "^20130701" <"text1.txt" >"text2.txt" original answer below: set text1=20130701,xxxx,xxxx,xxx set text2=20130702,yyyy,yyy,yyyyyyy set text3=%text1:~0,8%%text2:~8% echo %text3%

PayPal guest payments outside US -

i need process payments customers have credit cards, not paypal account - , need not required sign paypal either. have found in docs far, seems need so-called adaptive payments that. work rest api , can outside (i live in austria)? both paypal payments standard , paypal express checkout support guest transactions; don't need adaptive payments this. i suggest take @ express checkout documentation , including getting started guide have available.

XOR encryption Javascript and PHP fails with some keys -

i'm trying crypt/decrypt $session_key string, generated random function, in php , javascript. works not strings. $session_key, in example, result it's different. can see result opening browser console. <?php function xor_this($str, $key) { $result = ''; ($i = 0; $i < strlen($str); $i++) { $tmp = $str[$i]; ($j = 0; $j < strlen($key); $j++) { $tmp = chr(ord($tmp) ^ ord($key[$j])); } $result .= $tmp; } return $result; } #session_key generated substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz"), 0, 40) $session_key = 'h9pyae6kcex5g7081snjcfbpvfux3brtmdydwwhq'; $password = '9b06a9342b5ac4a825088a0f0c2a2e7cc091393f'; echo xor_this($session_key, $password); ?> <html> <script> function xor_this(str,key) { var xor = ""; (var = 0; < str.length; ++i) { tmp

Is there an eval() equivalent in apex/Salesforce? -

i've looked this, , seems there no directly related function available since apex typed, wondering if had found workaround. i'm designing credit risk object , client wants able insert expressions such "150 + 3" instead of "153" when updating fields speed things on end. unfortunately, i'm new salesforce, i'm having trouble coming ideas. feasible? you allow hand-entering of soql statements , use dynamic soql process them. require bit more "150 + 3." otherwise in javascript , pass value apex calculated number.

c# - Issue with AppDomain.CreateInstanceFromAndUnwrap -

i'm using appdomain.createinstancefromandunwrap() create object in different appdomain . couldn't work because kept throwing following error @ me: could not load file or assembly 'comon, version=2.0.4960.27874, culture=neutral, publickeytoken=null' or 1 of dependencies. module expected contain assembly manifest. however, found because tries load dll (which has same name .net assembly). this how call method: _script = (script)_appdomain.createinstancefromandunwrap(assembly.getexecutingassembly().location, "comon.scripting.script"); it works fine long there isn't native dll file same name .net assembly. why happen when i'm passing full path , filename of .net assembly? when i'm passing full path , filename of .net assembly? that's not how method works. first argument display name of assembly. not file name. msdn article recommends take @ assembly.fullname learn more display names. so normal clr search rules

taking first column of one file and making it the first column of a second file in perl or unix -

examples: file 1 : contig01 contig02 contig03 contig04 file 2: (tab delimitated) 9.8 5.4 5.7 8.7 5.6 4.5 6.4 4.6 3.4 4.3 2.4 4.5 3.4 3.6 6.5 3.5 i want file merges them get contig01 9.8 5.4 5.7 8.7 contig02 5.6 4.5 6.4 4.6 etc the files in same order thanks you want paste command. $ cat <<eof >file1 > contig01 > contig02 > contig03 > contig04 > eof $ cat <<eof >file2 > 9.8 5.4 5.7 8.7 > 5.6 4.5 6.4 4.6 > 3.4 4.3 2.4 4.5 > 3.4 3.6 6.5 3.5 > eof $ paste file1 file2 contig01 9.8 5.4 5.7 8.7 contig02 5.6 4.5 6.4 4.6 contig03 3.4 4.3 2.4 4.5 contig04 3.4 3.6 6.5 3.5

php - Upload file doesn't save to specify folder, throw error -

the error warning: move_uploaded_file(uploads/cv/23456543555555curriculum vitae.doc): failed open stream: no such file or directory in c:\wamp\www\job-application\include\application.class.php on line 121 warning: move_uploaded_file(): unable move 'c:\wamp\tmp\php7ea1.tmp' 'uploads/cv/23456543555555curriculum vitae.doc' in c:\wamp\www\job-application\include\application.class.php on line 121 the code follows below; $allowedextsdoc = array("docx", "pdf", "doc"); $temp = explode(".", $_files["file"]["name"]); $extensiondoc = end($temp); $uploaddircv = 'uploads/cv/'; $uploadfilecv = $uploaddircv . basename($phone.$_files['file']['name']); if (in_array($extensiondoc, $allowedextsdoc)) { if ($_files["file"]["error"] > 0) {

visual studio 2012 - Porting old Code to Cocos2d-x rc0 2.1.3 giving error -

i have old code. porting new cocos2d-x rc0 2.1.3 .it giving me errors in following lines: 1. in gamescene.cpp ccscene *scene = ccscene::node(); gamescene *layer = gamescene::node(); 2. in gamescene.cpp userpaddle_->runaction(ccmoveto::actionwithduration(0.3 * diffx / gamearea_.size.width, destposition)); 3. in gamescene.cpp ccpoint location = touch->locationinview(touch->view()); 4. in gamescene.cpp if (ccrect::ccrectcontainspoint(toucharea_, location)) 5. in gamescene.cpp if (ccrect::ccrectintersectsrect(ballrect, cc_sprite_rect(paddle))) 6. in appdelegate.cpp pdirector->setopenglview(&cceglview::sharedopenglview()); 7. in gamescene.h // implement "static node()" method manually layer_node_func(helloworld); for full list of cocos2d-x api changes, please refer http://www.cocos2d-x.org/projects/cocos2d-x/wiki/api_change_list_from_v1x_to_2x and http://www.cocos2d-x.org/projects/cocos2d-x/wiki/about_static_constructo

sql server - Error: No process is on the other end of the pipe -

i'm using sql server 2012 (localhost only) , sql server management studio (ssms) view table picture contains binary values (pictures), 928 rows in size not large. , table has problem. it shows below error, both locally , pc, after restarting sql server: msg 233, level 20, state 0, line 0 a transport-level error has occurred when receiving results server. (provider: shared memory provider, error: 0 - no process on other end of pipe.) i start checking consistency of data. run dbcc checkdb against db. may have corruption in table. can try selecting against msdb.dbo.suspect_pages

Magento: How to filter a collection (sales/order) by a certain category? -

i spend lot of hours solve problem, don't :( need selection of ordered items special category. how can filter collection e.g. categoryid '44' ? here code: <?php require_once '/home/web/public_html/app/mage.php'; mage::app(); //$_category = mage::getmodel('catalog/category')->load($category_id); $salescollection = mage::getmodel("sales/order")->getcollection(); echo $salescollection->getselect(); foreach ($salescollection $order) { $items = $order->getallitems(); ... ?> thanks helping me, best, rik here's 1 (perhaps) not elegant approach doing so... first grab products in category want $category_id = 44; $category = mage::getmodel("catalog/category")->load($category_id); $products = mage::getmodel("catalog/product")->getcollection() ->addcategoryfilter($category); next collect product ids can use them $product_ids = array(); foreach ($products $product) $produc

urllib - Python: Traceback namerror -

traceback <most recent call last>: file "wexec.py", line 37, in <module> urlopen = urllib.urlopen('%xs' % (hcon)) nameerror: name 'hcon' not defined i problem doing code in python: def hell(): hcon = raw_input(fore.red + style.bright + "website: ") h1 = httplib.httpconnection('%s' % (hcon)) urlopen = urllib.urlopen('%s' % (hcon)) hell() as can see, don't see problem @ all. giving error. do?

java - Hadoop Streaming Memory Usage -

i'm wondering memory used in following job: hadoop mapper/reducer heap size: -xmx2g streaming api: mapper: /bin/cat reducer: wc input file 350mbyte file containg single line full of a 's. this simplified version of real problem we've encountered. reading file hdfs , constructing text -object should not amount more 700mb heap - assuming text use 16-bit per character - i'm not sure imagine text uses 8-bit. so there these (worst-case) 700mb line. line should fit @ least 2x in heap i'm getting out of memory errors. is possible bug in hadoop (e.g. unaccary copies) or don't understand required memory intensive steps? would thankful further hints. the memory given each child jvm running task can changed setting mapred.child.java.opts property. default setting -xmx200m , gives each task 200 mb of memory. when saying - input file 350mbyte file containg single line full of a's. i'm assuming file has single line

c# - Why the backgroundworker cancel button dosent cancel the backgroundworker operation? -

i added 2 lines in top of form1: backgroundworker1.workerreportsprogress = true; backgroundworker1.workersupportscancellation = true; in button click event start added: timer2.enabled = true; if (this.backgroundworker1.isbusy == false) { this.backgroundworker1.runworkerasync(); } this dowork event: private void backgroundworker1_dowork(object sender, doworkeventargs e) { backgroundworker worker = sender backgroundworker; if (worker.cancellationpending) { e.cancel = true; return; } if (filescontent.length > 0) { (int = 0; < filescontent.length; i++) { file.copy(filescontent[i], path.combine(contentdirectory, path.getfilename(filescontent[i])), true); } } windowsupdate(); createdriverslist(); gethosts

SSIS Package behaving strangely when running through agent but fine from BIDS on the same server -

this question has answer here: executing ssis 2012 package has script components external application 1 answer my package runs correctly bids when schedule run sql agent, fails following error message. message executed user: strw067029\system. microsoft (r) sql server execute package utility version 10.0.5500.0 32-bit copyright (c) microsoft corp 1984-2005. rights reserved. started: 11:00:36 error: 2013-07-31 11:00:45.39 code: 0xc000f427 source: envoy data flow task ssis.pipeline description: run ssis package outside of business intelligence development studio must install standard edition of integration services or higher. end error dtexec: package execution returned dtser_failure (1). started: 11:00:36 finished: 11:00:45 elapsed: 9.282 seconds. package execution failed. step failed. i using same machine both tasks , sql server instan

NHibernate insert childs objects -

i need insert object child, child not persisted in database, how insert parent object , child in same save() method? example: public class parent { public virtual int id; public virtual child child; } public class child { public virtual int id; } public class test { public void insertparent() { parent p = new parent(); child c = new chield(); p.child = c; //here need insert parent , child because nobody persisted in database service.save(p); } }

c++ - How to call a function from a header file -

how call function source file header file? //h.h extern string pic; class takepic { public: void warpic(); void artpic(); void fatepic(); void painpic(); void nopic(); }; // second part of same header calls function takepic picture; void picturetype() { if (pic == "war") { picture.warpic(); } else if (pic == "fate") { picture.fatepic(); } else if (pic == "pain") { picture.painpic(); } else if (pic == "art") { picture.artpic(); } else { picture.nopic(); } } when says linker not working. error linker command failed exit code 1. what happens if change void picturetype() to inline void picturetype() you should tell whole error message, , perhaps try searching before asking question.

java.util.scanner - Java Scanner.next(), printing from while loop -

i started scripting little piece parse old-style .vmg files*. thought start scanner utility @ first chomp out messages 1 one. got. import java.io.file; import java.io.ioexception; import java.util.scanner; public class strip { public static void main(string[] args) { try { file file = new file("all.vmg"); scanner sc = new scanner(file); // sc.usedelimiter("begin:vmsg"); while (sc.hasnext()) { string string = sc.next(); system.out.println(string); } } catch (ioexception e) { e.printstacktrace(); } } } it compiles , runs fine. although not print out single thing. first used delimiter commented. thought there might problem that. uses it's default whitespace delimiter. no lines printed anyhow. have guess reason hasnext doesn't evaluate true?. * .vmg files text files in general format of

Determine whether code is html or php and return value -

in wordpress theme having option textarea user can write code , store database string. so here output want check whether code written php or html tag or anything. may force user wrap them php code <?php ... ?> , remove before output it. html can write straight. here looking , don't know how determine if(get_option()){ $removed_php_tag = preg_replace('/^<\?php(.*)\?>$/s', '$1', $code); return eval($removed_php_tag); } esle if(get_option()) { return $code; } if eval() answer you're asking wrong question. if want output html wrote in text box, use echo or print .

Trying to parse JSON data in iOS -

here code , json result in app. nsarray* logindata = [json objectforkey:@"logindata"]; //2 nslog(@"logindata: %@", logindata); //3 and logindata array comes through this: logindata: { code = 200; goodlogin = 1; } how value of goodlogin? thanks in advance the logindata posted isn't actual json (unless there other way display don't know), understand of example, call [json objectforkey:@"logindata"]; should return nsdictionary, not nsarray. so, more like nsdictionary *logindata = [json objectforkey:@"logindata"]; nsnumber *goodlogin = [logindata objectforkey:"goodlogin"]

osx - Executing shell commands with NSTask - Objective-C Cocoa -

i have been searching days , hours this, have seen lot of examples of this, cannot figure out how nstask works, let's wanted execute command killall dock or defaults write com.apple.finder appleshowallfiles yes that, how go doing this. i know how execute external shell script (sh) need more sophisticated , use nstask instead. thanks help!! you like: nstask *task = [[nstask alloc] init]; [task setlaunchpath:@"/bin/bash"]; [task setarguments:@[ @"-c", @"/usr/bin/killall dock" ]]; [task launch]; exactly launch path , arguments provide dictated command want run , parameters.

Creating a new dictionary from a dictionary with multiple values per key -

i have dictionary looks basically d = {'book1': [('chapverse1', 'verse1'),('chapverse2','verse2')] 'book2': [('chapverse1', 'verse1'),('chapverse2','verse2')]} what need create second dictionary values inside based on book in. like: read through d if book in d create newdict values book. any appreciated. in python 2.7 well it's unclear want do, i'll try guess: >>> d = { 'book1': [('chapverse1', 'verse1'),('chapverse2','verse2')], 'book2': [('chapverse1', 'verse1'),('chapverse2','verse2')] } >>> d2 = {k: dict(v) k, v in d.items()} >>> d2 { 'book1': {'chapverse1': 'verse1', 'chapverse2': 'verse2'}, 'book2': {'chapverse1': 'verse1', 'chapverse2': 'verse2'} } edit

c++ - How to export libraries with components in CMAKE? -

i have tried finding information on official cmake wiki searching (currently waiting boost download can wade through source looking how it). hoping here may able how done, or point me in right direction answers! i have project has several components. right now, project has subdirectories libraries, , applications. attempting refactor project , have applications in individual repositories , have libraries exported. how other projects make possible use following command (specifically, specifying components): find_package (boost required components system date_time filesystem) i use same system own project: find_package (project required components view gui execution analysis) any provide appreciated. a guide how write finders may found in /usr/share/cmake/modules/readme.txt (or in cmake sources, if distro not include file). particularly explains how write correct module w/ supporting "standard" syntax ( require , components & etc) using find_pack

How to intercept connection to a Wifi network most efficiently on Android -

i want perform action when phone connects wifi network. far can see have 2 broadcast intent intercept satisfy this: 1. wifi state changed. 2. connectivity changed. the problem want intercept wifi connected events. receiver triggered on change wifi, including disconnection, don't care about.i feel waste of cpu time. are there more specific intents, "wifi connected"? or alternatively, can add intent filter achieve this? thanks! you can determine type of network event requesting informations. first, make sure registered intentfilter on wifimanager.network_state_changed_action action , bind proper broadcastreceiver . then in receiver's onreceive method, can check if received event networkinfo.state.connected event : @override public void onreceive(context context, intent intent) { networkinfo networkinfo = intent.getparcelableextra(wifimanager.extra_network_info); if (networkinfo != null && networkinfo.getstate().equals(ne

sql - Do I need to specify ON DELETE NO ACTION on my Foreign Key? -

i have following ddl using sql server 2012: create table subject ( [subjectid] int identity (1, 1) not null, [name] nvarchar (50) not null, constraint [pk_subject] primary key clustered ([subjectid] asc) ) create table topic ( [topicid] int identity (1, 1) not null, [name] nvarchar (50) not null, [subjectid] int not null, constraint [pk_topic] primary key clustered ([topicid] asc) ) alter table [topic] check add constraint [fk_topicsubject] foreign key([subjectid]) references [subject] ([subjectid]) on delete no action what want sql server stop me deleting parent if reference parent exists in child? example want delete on subjectid=3 in subject fail if there children subjectid's of 3. for unclear , cannot seem find answer. need add "delete no action" or can not remove these 3 words. i'm asking question in similar question had response should define trigger on parent. thought defining foreign key stop me deleting p

php - how to require_once in codeigniter -

i trying extend library in codeigniter. way seems include original library using require_once load extended library using $this->load->library() right have tried require_once('ion_auth.php'); require_once('home/site_name/public_html/folder_name/application/libraries/ion_auth.php') require_once('/home/site_name/public_html/folder_name/application/libraries/ion_auth.php') but unfortunately not luck..... keep getting error message: require_once(...) [function.require-once]: failed open stream: no such file or directory weird thing though works on local xampp environment not on actual server. use codeigniter's built in constant, apppath require_once(apppath.'libraries/ion_auth.php');

python - django integrity error, i know why, but dont know how to solve -

Image
i changed former user model inherits django's user model. from django.contrib.auth.models import user class userprofile(user): #fields.. but other models pointing former model , if want migrate, getting error: (user_id)=(9) not exist in auth_user table. reasonable error message. should now? stuck. using django version 1.4 i made screenshot of error: you don't version of django you're using; if you're using 1.5, need set auth_user_model setting tell django use (see auth docs more info). if you're on earlier version, don't want subclass user model @ all, create profile (like class name indicates) separate model , link foreignkey (see old profile docs more on that). did change name of model when added parent class? want set name of table in userprofile matches old name. django model docs : to save time, django automatically derives name of database table name of model class , app contains it. model’s database table name co

ruby on rails - Naming form helper text f.input -

i using <%= f.input :firstname %> where firstname field in user model however, text beside input box comes firstname, there way change text beside input box first_name instead? if using simple_form gem try out <%= f.input :firstname, label: 'first_name' %>

opengl - Common lisp: portability -

question if make 2d game in common lisp (uses: lispbuilder-sdl, quicklisp, cffi) using clozure cl on windows, able easily port other platforms (linux/iphone(maybe)/android) later? lisp "suitable" installable programs? information the game use opengl graphics. it'll use sdl input/opengl initialization, , either sdl or openal audio. might end using own library instead of sdl later. writing few c++ libraries cffi (to wrap functionality in "portable" way) not problem. reasoning i'm really, tired of c++. want try (that not python) simpler syntax + more power. have game project in mind, want know whether choosing lisp game means serious trouble if decide distribute/port game later. --edit-- additional info what mean "suitable" , "installable programs"? i'm not sure how cffi/quicklisp play if try turn finished program can run onto machine installable package (windows installer on windows, example). quicklisp, ex

perl - Write a simple mod_perl handler -

i want write simple mod_perl handler returns local time described on page ( http://perl.apache.org/docs/2.0/user/handlers/intro.html ), have locate file access it. i'm using ubuntu don't have directory called myapache2. locate file try functionality? this example. need create files yourself. (you'll see example refers "file:myapache2/currenttime.pm"). mkdir -p example-lib/myapache2 touch example-lib/myapache2/currenttime.pm then paste contents example file created. in order run under mod_perl, you'll have let server know myapache2 located. should able add apache config: perlswitches -i/path/to/example-lib don't forget restart apache before test out.

How do I make JQuery UI Slider update Meteor Collection (MongoDB) without disappearing -

i have 2 meteor.collections in app. 1 contains bunch of "slider" objects, define title, max, min, base value, , step each slider. now, have 2 problems. first making sliders show in first place. i've tried put following code: sliders.find().foreach(function(slider) { $("#"+slider._id).slider({ min:slider.min, max:slider.max, value:slider.base, step:slider.step, change:function(event,ui) { data.update({_id:data.findone({slider:event.target.id})._id}, {$set:{value:ui.value}}); } }); }); in meteor.startup, @ end of client.js file, in $(document).ready() block, , nothing seems work. when paste javascript console, however, works. anyways, that's first problem. my second problem whenever slide slider, slider disappears. can keep dragging mouse around change value, once let go of clicker, can't change value anymore. i've tried using above way

Differences between PowerShell ISE and Powershell.exe when using IO.FileSystemWatcher -

i have following powershell script running fine in ise, mean runs , waits files created before processing them. problem try run command line exits @ $oncreated = register-objectevent $fsw created -sourceidentifier filecreated -action call. how can run commandline indefinitely e.g. waiting , processing each new file meets criteria in target folder? i must missing something, first attempt @ using powershell advice on how working cmd line appreciated. if have suggestions on improvements i'd love hear them too. #variables $folder = 'c:\de\live' $filter = 'lock.txt' $data_in = 'c:\de\live\data.txt' $data_out = 'c:\de\live\rmin\data.txt' $destination = 'c:\de\live\rmin\lock.txt' #setup file system watcher on live dir watching file name , last write $fsw = new-object io.filesystemwatcher $folder, $filter -property @{ includesubdirectories = $false notifyfilter = [io.notifyfilters]'filename, lastwrite' } write-host "-

php - Associative Array with Variable Values -

i have been looking on place need i'm not getting anywhere. not sure if because thing want isn't allowed or don't' know how word find solution. i creating excel export has lot of worksheets there lot of repetitive code made foreach loop. problem array have has variables inside , need code put specific variables spots need it. $y1953 =& $workbook->add_worksheet('1953'); $y1958 =& $workbook->add_worksheet('1958'); $y1963 =& $workbook->add_worksheet('1963'); $y1978 =& $workbook->add_worksheet('1978'); $y1988 =& $workbook->add_worksheet('1988'); $y2003 =& $workbook->add_worksheet('2003'); $yearlist = array($y1953 => '1953', $y1958 => '1958', $y1963 => '1963', $y1978 => '1978', $y1988 => '1988', $y2003 => '2003'); foreach ($yearlist $year => $yearnum){ $line = 1; # start on line 2 # w

PHP Variable declared outside of any function, not visible from functions -

been struggling make simple code work, face problem global/local reach of 1 variable. here code try work. code contained in php file called ajax procedure javascript. none of variables appears in below chunks of code. $location = "./treewindow/tree_structure.xml"; function openxml($url) { if (file_exists($url)) { $xml = simplexml_load_file($url); } else { echo("failed open xml @ ".$url); exit; } } function cubicleavailablespace() { openxml($location); } when call last function: cubicleavailablespace(); i get: failed open xml @ why variable $location not recognized in function cubicleavailablespace()?! thought considered "visible" functions within php code... now, sure easy, tried whole afternoon make work... looked around place, not find reply helped me (though there many such cases in website) of course, when replace variable actual value ("./treewindow/tree_structure.xml"), works: xml file @ righ

html - HAML link_to is not clickable -

i'm new haml, need rails project. don't understand why code not provide clickable link in header of column. example: %table#movies %thread %tr %th <%= link_to "name", :sort => "name" %> %th year %th rating and on... all displays plain text of wrote instead link in name column. extremely stupid question, find solution anywhere, sorry or if there way send :sort parameter within simple html 'a' tag, please tell. thanks. if want append rails output html tag must use syntax ( http://haml.info/docs/yardoc/file.reference.html#inserting_ruby_ ) change %th <%= link_to "name", :sort => "name" %> to %th= link_to "name", :sort => "name"

java - How to retrieve @Reference fields / which is best @Reference or @Embedded and SubQuery in MorphiaQuery -

i have mongodb 2 model classes user , userinfo .... criteria in user class have retrieve multiple fields around 10 fields "firstname","lastname",etc , in userinfo model class retrieve 1 field " age ". at moment referenced userinfo class's object user class stated below in structure , stores in db {"firstname","john"},{"lastname","nash"},{userinfo: userinfoid} if make embedded relation store userinfo's fields , think retrieve 1 ("age") field unwanted embed userinfo's fields inturn make application slow think. can please guide me scenario use whether @reference or @embedded, think embedded slow down response db in websites given reference annotation slows down querying time , needs sort of lazy loading all, structure below: class user extends model{ public string firstname; public string lastname; public string logintime; public string logouttime; public string emailid;

exception - Why does Salesforce prevent me from creating a Push Topic with a query that contains relationships? -

when execute code in developer console pushtopic pushtopic = new pushtopic(); pushtopic.apiversion = 23.0; pushtopic.name = 'test'; pushtopic.description = 'test'; pushtopic.query = 'select id, account.name case'; insert pushtopic; system.debug('created new pushtopic: '+ pushtopic.id); i receive message: fatal error system.dmlexception: insert failed. first exception on row 0; first error: invalid_field, relationships not supported: [query] the same query runs fine on query editor, when assign push topic invalid_field exception. if bottom line exception message says, relationships not supported push topic objects, how create push topic object return data i'm looking for? why salesforce prevents because require them join tables, joins in salesforces database expensive due multi-tenancy. when add new feature not support joins requires more optimization of feature. push topics still quite new system , need real time, s

How to convert hts voice to Flite for android voice -

our company time ago has developed tts voice hts engine. exploring see if there's way use tts engine on android. far there no success. i found festival can use hts voices , flite can also. flite android uses seemingly different file format (.flitevox extension), found no clues on , how convert hts voices it. our voice composed of files .pdf , .inf , .win files. so question is, there way convert hts voices flitevox format? or in case of negative answer, there other tts engine android can support directly or indirectly hts voices? ok, project owner said here , unlike hts-patched flite pc, can use hts voices, flite android not support them. , since formats different, not inter-convertible. way use hts voices on android, port hts-patched flite on android.

Get files from Google Drive SDK using C# .NET -

i'm doing application access google drive , file web application. i'm doing in c# .net 4. how this? thanks please follow c# quickstart start project. guide set authentication. then, use files.get() retrieve metadata of file has downloadurl download content of file. sample code of retrieving metadata , downloading content available in c# in documentation files.get() .

ios - Parallax view scrolling (Yahoo weather like) -

this not strictly programming question more "how accomplish this" question. i curious (and working on app require this) how left-right parallax scrolling implemented. know mean check yahoo weather app (it's free - no worries there). are using 1 view controller or separate controller each view shown there? easiest way implement this? have found this topic here kinda explains bit when getting information servers? when views changed or @ startup of app? any information how implement such scrolling appreciated. it's simple actually: subclass uiscrollview add uiview *parallaxview; @property add cgfloat parallaxfactor @property override layoutsubviews call super, , use self.scrolloffset*parallaxfactor position parallaxview that's it! i've made multifunctional uiscrollview subclass myself that's simple use, perfect case! on github: https://github.com/leonardpauli/lpparallaxscrollview good luck!

shell - Assign new value to variable fails -

why not work: if [ $_type == 1 ] || [ $_type == 2 ]; $_type=$(echo "outbound"); fi or if [ $_type == 1 ] || [ $_type == 2 ]; $_type=echo "outbound"; fi or if [ $_type == 1 ] || [ $_type == 2 ]; $_type="outbound"; fi i'm receiving error: line 251: 2=outbound: command not found in posix shells such bash, $ not part of variable-name, it's notation expanding variable (to obtain value); so, example, echo "$_type" prints value of variable _type . don't use $ when you're assigning variable. need: if [[ "$_type" = 1 || "$_type" = 2 ]] ; _type=outbound fi

javascript - email is not displaying inside image -

hi have page after confirmation email displaying. want display email inside image link. for have used code, email variable null here. <html> <head> <script type="text/javascript"> var formdata = function() { var query_string = (location.search) ? ((location.search.indexof('#') != -1) ? location.search.substring(1, location.search.indexof('#')) : location.search.substring(1)) : ''; var elements = []; if(query_string) { var pairs = query_string.split("&"); for(i in pairs) { if (typeof pairs[i] == 'string') { var tmp = pairs[i].split("="); var querykey = unescape(tmp[0]); querykey = (querykey.charat(0) == 'c') ? querykey.replace(/\s/g, "_") : querykey; elements[querykey] = unescape(tmp[1]); } } } return { display: funct

Remove Aloha-Editor Blue Focus Outline -

i'm new aloha (wysiwyg) editor , know how remove/disable blue outline editing field on focus. i've managed disable yellow highlight outlines, couldn't find way disable blue on focus border outline. any friendly advice? thanks. this blue outline made "highlighteditables" plugin's css src/plugins/common/highlighteditables/css/highlighteditables.css : .aloha-editable-active, .aloha-editable-active[contenteditable=true]:focus { outline: #80b5f2 solid 5px !important; } check when running inspector in web browser, selecting element , disabling style helps. note ugly programming style !important :( unfortunately, can can choose plugins load choose javascript, css of plugins enabled during build merged aloha.css , loaded. one way fix build editor yourself. basic introduction described in section "4.3 customized builds" of develop aloha editor guide . as building aloha requires effort, may interested in quick workaround us

My jQuery listener won't recognize my trigger click -

i trying dialog box pop if forgets fill out field on form using c# , aspx. trigger in header , looks this. function checksalesman() { alert("alert!!!!!!!!!"); $('#opener').trigger('click'); } this clicks hidden button. button has id opener. listener have in body of code. used trigger dialog box. $("#opener").click(function () { alert("opendialog!"); stopsubmit(); $("#dialog").dialog("open"); }); the reason down here because right above javascript tag in, dialog box gets established. have tried have listener in header not work there. under dialog box established place can work. i have tried move the trigger underneath listener , trigger function never run. trigger function called aspx label having code below inserted .text attribute. <script>checksalesman()</script> i have tried moving both listener , trigger header, , body, , filled both were. none of has

eclipse - Spring bean loading issue in BIRT designer -

i have issue spring not loading beans correctly when run script in birt scripted data source, running ok on own. here's minimal test case: the spring bean: package test; import org.springframework.stereotype.component; @component public class testcomponent { } the context provider: package test; import org.springframework.context.applicationcontext; import org.springframework.context.support.classpathxmlapplicationcontext; public class springcontextholder { private static applicationcontext ac; public static applicationcontext getapplicationcontext() { if( ac == null ) { ac = new classpathxmlapplicationcontext("classpath:beans.xml"); } return ac; } } beans.xml: <beans .......> <context:component-scan base-package="test"></context:component-scan> <context:annotation-config /> </beans> and test program simple eclipse java project having spring , related jars

mysql - Preventing duplicates via a custom foreign key in has_many :through -

i'm trying implement two-way has_many :through association between user model , location model using userlocations join table. enable setting user locations built in activerecord methods, ie. @user.locations = [<location 1>, <location 2>, ...] . goal not associate locations users individually, rather users add , remove them, 1 or more @ time, via field: :zip_code . means when user adds zip code, activerecord should insert single record userlocations (something insert user_locations (user_id, zip_code) values (1, 12345) ). then, when @user.locations called, activerecord should join :zip_code , matching location(s). current implementation works, except 1 insert userlocations generated each location associated zip code. class user < activerecord::base has_many :user_locations has_many :locations, through: :user_locations end class userlocation < activerecord::base belongs_to :user belongs_to :location, primary_key: :zip_code, foreign_key: :zip

How to write a PHP ternary operator -

how write php ternary operator elseif portion? i see basic examples if , else portions of php ternary operator this: echo (true) ? "yes" : "no"; //prints yes echo (false) ? "yes" : "no"; //prints no how "elseif" portion ternary operator? <?php if($result->vocation == 1){ echo "sorcerer"; }else if($result->vocation == 2){ echo 'druid'; }else if($result->vocation == 3){ echo 'paladin'; }else if($result->vocation == 4){ echo 'knight'; }else if($result->vocation == 5){ echo 'master sorcerer'; }else if($result->vocation == 6){ echo 'elder druid'; }else if($result->vocation == 7){ echo 'royal paladin'; }else{ echo 'elite knight'; } ?> a ternary not solution want. not readable in code, , there better solutions available. why not use array lookup "map" or &quo

python - Accessing the original value of the unicode string when subclassing unicode -

try class work so: >>> original = u"abcd-123-foo" >>> suffix = suffixcomparingunicodestring("foo") >>> suffix == original # if original ends suffix, true true i know it's silly. please bear me. anyway, can't figure out how actual, er, string (not str , mind) within unicode object. can fine: >>> class suffixcomparingunicodestring(unicode): ... def __init__(self, x): ... super(suffixcomparingunicodestring, self).__init__(x) ... self._myval = x ... def __eq__(self, other): ... return isinstance(other, unicode) , other.endswith(self._myval) ... >>> suffixcomparingunicodestring("foo") == u"barfoo" true how can without storing value myself? unicode call underlying character sequence? since subclassing unicode , instances of sufficcomparingunicodestring can used other unicode string. can use other.endswith(self) in __eq__() implementa

php - RecursiveIteratorIterator and nested RecursiveArrayIterators -

i've been messing recursivearrayiterators handling nested objects trees. following code bothering me result returning of values i'm expecting. mainly, root node seems never iterated over. have feeling i've been staring @ bit long wanted make sure on right track this. class container extends \recursivearrayiterator { protected $_alias; public function __construct( $alias = null ) { if( is_null( $alias ) ) { $alias = uniqid( 'block_' ); } $this->_alias = $alias; } public function getalias() { return $this->_alias; } } try { $root = new container( 'root_level' ); $block = new container( 'first_level' ); $child = new container( 'second_level' ); $child_of_child_a = new container( 'third_level_a' ); $child_of_child_b = new container( 'third_level_b' ); $child->append( $child_of_child_a ); $child->app

windows - Tutorials for creating right-click command in powershell -

are there resources on programming user account in windows 8? use exe, 'png2eps.exe' within system path, , allow right-click context convert png eps file trivially. the argument of course file i'm right clicking on. kind of how 1 can convert postscript file pdf using acrobat distiller. that simple! copy png2eps.exe system folder(e.g. c:\windows\ or c:\windows\system32). after that, create txt file , put in it: windows registry editor version 5.00 [hkey_classes_root\.png\shell\png2eps] @="convert png eps now!" [hkey_classes_root\.png\shell\png2eps\command] @="png2eps cmd \"%1\"" where: cmd - cmd switches , options png2esp. \"%1\" - input file name shell. save txt, , change extension reg(e.g. before: file.txt after: file.reg). 2click on reg file , import registry. menu item "convert png eps now!" see in context menu if call selected png file(s).

sql - Empty result set when Joining two table with Non-match Foreign key -

i joining 2 tables using foreign key. table_1 might have row null foreign key. means when join 2 tables based on foreign key won't results it. problem when use join 2 tables in linq, empty result set. i want able row in table_1 if join result no match table_2. i tried use defaultifempty in join of table_2, still empty result set. how can join 2 tables , still result if table_1 contains null in foreign key use join 2 table? thanks hi try left join table2 table1 class program { static void main(string[] args) { list<table1> table_1 = new list<table1>(); table_1.add(new table1() { id = 1, name = "lion" }); table_1.add(new table1() { id = 2, name = "elephant" }); list<table2> table_2 = new list<table2>(); table_2.add(new table2() { id = 1, class = "carnivorous" }); table_2.add(new table2() { id = 2, class = "herbivorous" }); table_2.add(