Posts

Showing posts from July, 2013

underscore.js - How to remove a particular value from an array in Node.js -

i have array of values var test =[]; test [1] = [ {"myself":true,chat_user:11,"message":"hi"}, {"myself":true,chat_user:11,"message":"evida"}, {"myself":false,chat_user:11,"message":"yes"}, ] test [6] = [ {"myself":true,chat_user:13,"message":"hi"}, {"myself":true,chat_user:13,"message":"evida"}, {"myself":false,chat_user:13,"message":"yes"}, ] test [9] = [ {"myself":true,chat_user:22,"message":"hi"}, {"myself":true,chat_user:22,"message":"evida"}, {"myself":false,chat_user:22,"message":"yes"}, ] now have remove entry test[6] , need remaining array ie test [1] = [ {"myself":true,chat_user:11,"message":"hi"}, {"myself...

android - AlertDialog broken layout on some devices -

Image
i'm experiencing problems following approach create alertdialog: alertdialog.builder alertdialog = new alertdialog.builder(this) .settitle(r.string.deletion_title) .setmessage(r.string.options_deleteexternalconfirm) .setpositivebutton(r.string.yes, new dialoginterface.onclicklistener() { public void onclick(dialoginterface dialog, int which) { utils.deleteexternaldir(); dialog.cancel(); } }) .setnegativebutton(r.string.no, null); alertdialog.show(); while dialog looks ok on devices, has layout problems on others (namely galaxy s4 - gt-i9505 android 5.0.1), see attached picture: . what reason , how can fix it? (other adding padding custom dialog when build.product.equals("gt-i9505") since there might phones out there have same issue unknown me) it turned out problem android:fitssystemwindows , android lollipop in this answer .

java - Relate to an arbitrary Map.Entry in Neo4j using Spring Data Neo4j -

i'm trying store properties nodes in neo4j graph, can reached using spring data rest api. (and later i'd find object same properties in graph.) json representation of object should like { //... "properties": { "key": "value" } //... } the simplest way @data @nodeentity public class objectwithproperties { //... @relatedto map<string, object> properties; //... } obviously, not work, map.entry not @nodeentity. is there easy way achieve this? there dynamicproperties field value one-level map of string-value pairs. stored node-properties not relationships other nodes.

windows - Microsoft products cannot connect via https -

we're having problem here few hours on google suggest common unresolved. since upgrading windows 8.1, no microsoft product can connect site via secure channel, tls channels. internet explorer 11 can connect http web sites (e.g. msn), not connect https web sites (e.g. login.live.com, google). attempting connect https site results in 'this page cannot displayed'. other browsers, example firefox , chrome, can connect https web sites well. on own wouldn't issue, use firefox (which our default browser anyway), every single microsoft product uses same settings , transports internet explorer, , none of can connect secure sites either. this means windows update won't work, , cannot register microsoft software (e.g. office, visual studio, etc). attempting results in 'a communication error has occurred.' sometimes gives error code, example attempting activate office gives 'a communication error has occured. please verify have connectivity internet , ...

excel - delete element from variant in vba -

i have variant has list of source dim source variant source = range("a4:a" & rowcount) sometimes rowcount 4 in case reassigning source to source = range("a4:a5") now want delete last row source(2)/source(2,1) how can delete it? i tried erase source clears everything i processing data in source , populating few dict items have make changes in many places if source not array since have used each in many places how can have first element alone or remove last element? you can't use redim preserve because 1 cell variant set range in 2d. use .value or .value2 proper array , buffer variable erase , transfer in source data : dim source variant, a() redim a(0) if rowcount<>4 source = range("a4:a" & rowcount).value else source = range("a4:a5").value a(0)=source(1,1) redim source(1 1, 1 1) source(1,1)=a(0) end if

indexing - Getting Matlab to return values in a table based on other values in the same table -

i'm looking date/time in maximum temperature occurs in table 2 columns: date/time , temperature. its: date/time temperature 3/4/15 1000 27 3/4/15 1100 28 3/4/15 1200 29 ... ... so in other words how can program spit out date/time in maximum temperature occurs me?

.net - Whatsapp api for VB.net -

i want send message whatsapp contact through vb.net windows application form. there api whatsapp integrate vb.net? there no official api sending whatsapp messages programmatically. there unofficial api , banned whatsapp(according information).

android - Add request header within DefaultRedirectHandler.getLocationURI callback -

i have following scenario: android httpclient redirected alternative location, redirection url comes url parameter has propagated http header in redirection request. way interfere override defaultredirecthandler.getlocationuri handler. question: how within public uri getlocationuri(httpresponse response, httpcontext context) i can modify out-coming request. you have create implementation of redirecthandler , overwrite getlocationuri() . can redirect url by header locationheader = response.getfirstheader("location"); string location = locationheader.getvalue(); extract url parameter location , httprequest by basichttprequest request = (basichttprequest) context.getattribute( executioncontext.http_request); header.addheader();

AngularJS .destroy() shows console error, but works? -

i use destroy() function this: $scope.cities[i].destroy(); then when use app works fine, console says: $scope.cities[i] undefined however without it, doesn't work. should ignore error? more code $scope.somefunction= function (id) { (var = 0; < $scope.cities.length; i++) { if ($scope.cities[i] == id) { $scope.splicecities(i); $scope.cities[i].destroy(); } } $scope.splicecities = function(i) { $scope.cities.splice(i, 1); }; } function called on ng-click on country. splice mutates array, i index points element when calling destroy() . if i pointed last element before splice, error. fortunately splice returns elements spliced out array, try this: $scope.somefunction = function (id) { (var = 0; < $scope.cities.length; i++) { if ($scope.cities[i].id == id) { var spliced = $scope.cities.splice(i, 1); spliced[0].destroy(); break; ...

php - i want to array key and array value comma separated string -

i have array , want convert string. try string php implode() function not desired result. output want arraykey-arrayvalue , arraykey-arrayvalue , arraykey-arrayvalue , on long array limit end. array ( [1] => 1 [2] => 1 [3] => 1 ) $data = implode(",", $pdata); //it creating string $data=1,1,1; // want below $string=1-1,2-1,3-1; you gather key pair values inside array implode it: foreach($array $k => $v) { $data[] = "$k-$v"; } echo implode(',', $data);

filter - JIRA: How can i list down the tasks in which my name was mentioned in comment section? -

jira: how can list down tasks in name mentioned in comment section? in jira, in many tasks mentioned in comment not assigned task me. so, want create filter can see list of tasks in name mentioned in task. know how this? in advance! depending on version of jira have. in general command in text field is: textfield ~ "text" where textfield jira text field description, comment, summary or custom field name more on subject: https://confluence.atlassian.com/display/jira/advanced+searching#advancedsearching-comments

javascript - How can I continue a text string in a JSON object onto another line? -

i have json object defining this: "cover": { "h1": "xxx", "p1": "very long text" + "more long text" } i tried split text onto 2 lines visual studio error messages saying "missing comma after object member" turn on text wrapping in editor / ide. word wrap msdn json isn't javascript, it's data. doesn't make sense screw around data integrity this. enabling word wrap / configuring editor pretty-print json better options. prefer sublime text 3 working it.

javascript - Error: getaddrinfo ENOTFOUND in nodejs soap -

i using following code , getting error. var soap = require('soap'); var url = 'http://ws.strikeiron.com/globaladdressverification5?wsdl'; soap.createclient(url, function(err, client){ console.log(err) console.log(client) }); error: { [error: getaddrinfo enotfound ws.strikeiron.com] code: 'enotfound', errno: 'enotfound', syscall: 'getaddrinfo', hostname: 'ws.strikeiron.com' } undefined i have set npm proxy & .npmrc has following entries: proxy=http://localhost:3128/ https-proxy=http://localhost:3128/ kindly help.

keil - How Can I download Hex file output of IAR compiler to MCU by using ULink -

ulink programmer used keil compiler flash arm based cpus. keil creates .axf object file output. using iar compiler in project , creates different output file. how can flash mcu iar compiler output using ulink programmer? regards unfortunately, it's not possible. ulink2 supported keil µvision - none other. if decide work exlusive iar, should buy j-link. visit below link more details: http://www.keil.com/forum/24905/ although there other approach program arm microcontroller such flash magic , etc.

python 3.x - AttributeError: 'str' object has no attribute 'words' -

i'm using python34. want frequency of words csv file show error. here code.anyone me solve problem. from textblob import textblob tb import math words={} def tfidf(word, blob, bloblist): return tf(word, blob) * idf(word, bloblist) def tf(word, blob): return blob.words.count(word) / len(blob.words) def n_containing(word, bloblist): return sum(1 blob in bloblist if word in blob) def idf(word, bloblist): return math.log(len(bloblist) / (1 + n_containing(words, bloblist))) bloblist = open('afterstopwords.csv', 'r').read() i, blob in enumerate(bloblist): print("top words in document {}".format(i + 1)) scores = {word: tfidf(word, blob, bloblist) word in blob.words} sorted_words = sorted(scores.items(), key=lambda x: x[1], reverse=true) word, score in sorted_words[:3]: print("\tword: {}, tf-idf: {}".format(word, round(score, 5))) and error is: top words in document 1 traceback (most recent c...

twitter bootstrap - Select2 v4 in jqGrid edit modal window issue -

i know issue jqueryui modal window , select2. i'm using fix https://github.com/select2/select2/issues/1246#issuecomment-71710835 . i'm trying integrate select2 jqgrid , edit modal window , noticed input field loosing focus on keydown , no text entered. i'm using latest build of select2 v4.0.0. clicked on select2 - list opened , input has focus started search text (keydown) - input looses focus , no text appears strange, on same modal window, when select2 multiple type, it's working fine select2 created on jqgrid datainit event: datainit: function (elem) { $(elem).css({ width: "500px" }).select2({ data: stacjedlaidzampoc, allowclear: false, tags: false, minimuminputlength: 0, placeholder: "wskaż stację", templateresult: function (repo) { if (repo.loading) { return repo.text; } return $(repo.text2); }, templateselection: function (repo) { return $(repo.text2); }, minimumresultsforsearch: 5 }).on(...

dependencies - How to fix dependency conflict issue while installing php-pecl-sphinx.x86_64 on php56w -

i have installed php56w using webtatic repository https://webtatic.com/packages/php56/ but when tried install available php-pecl-sphinx.x86_64 package on linux system linux production 3.10.0-123.8.1.el7.x86_64 #1 smp mon sep 22 19:06:58 utc 2014 x86_64 x86_64 x86_64 gnu/linux i getting dependency conflict error this important line: error: php56w-common conflicts php-common-5.4.16-23.el7_0.3.x86_64 more details: [root@production basesite]# yum install php-pecl-sphinx.x86_64 loaded plugins: fastestmirror loading mirror speeds cached hostfile * base: mirror.1000mbps.com * epel: mirror.nl.leaseweb.net * extras: mirror.netrouting.net * updates: mirror.netrouting.net * webtatic: uk.repo.webtatic.com resolving dependencies --> running transaction check ---> package php-pecl-sphinx.x86_64 0:1.3.2-1.el7 installed --> processing dependency: php(zend-abi) = 20100525-64 package: php-pecl-sphinx-1.3.2-1.el7.x86_64 --> processing dependency: php(api) = 20100412-64 ...

php - How to get the number of times a query execute -

in php, there way total number of times query executed in 24 hours? try having table. lets name executetb column: exid ( int , primary , auto-increment ) executionnumber ( int ) datetimeexec column (which should have datetime data type) if page access, system should run query check if there existing data in executetb today. , standby current number of execution before run main query: $today = date("y-m-d"); if($stmt = $connection->prepare("select exid, executionnumber executetb date(datetimeexec) = ? ")){ $stmt->bind_param("s",$today); $stmt->execute(); $stmt->store_result(); $check = $stmt->num_rows; if($check == 0){ /* if no existing data today */ $exact = date("y-m-d h:i:s"); /* current date , time */ $executionnumber = 0; /* start 0 */ if($stmt2 = $connection->prepare("insert executetb (executionnumber, datetimeexec) values (?)")){ $stmt2->bin...

php - Getting error while connecting zend framework with MSSQL on linux machine -

i getting issue while doing database(mssql) connectivity linux machine. its working fine on window environment. not working on linux environment. i using following configuration linux in zend framework. i added 4 sqlserver extension linux machine, not working. extension="libessqlsrv.so" extension="libessqlsrv_a.so" extension="libessqlsrvs.so" extension="libessqlsrv_ssl.so" resources.db.adapter = pdo_mssql resources.db.params.pdotype = dblib resources.db.params.driver_options.pdo::attr_errmode=pdo::errmode_exception resources.db.params.host = pnpdevdb1.cbwvg2df689q.us-west-2.rds.amazonaws.com resources.db.params.dbname = dbname resources.db.params.username = "user" resources.db.params.password = "pwd" please suggest how can resolve it.

objective c - iOS OpenGLES not rendering images on iPhone 5s+ -

i followed tutorial first short bit on setting basic 2d game engine: basic 2d game engine tutorial , completed first bit render basic image screen. works fine on iphone 4s , iphone 5 simulator not simulator newer that. i decided download finished project see if works on newer devices , does. try , figure out wrong deleted bare bones on project , still worked. the next thing did delete in project , ported on code project directly. still renders image fine! have 2 x-code projects running exact same code (i change code in 1 project , affects other one.) despite still works in 1 project on iphone5s+ device simulator not other one. they both work fine on iphone 4s simulator (i changed background color prove both running on same code.) this seems silly me, running exact same code , of settings identical. have idea going on make opengl-es not work on specific device simulators? it might 64/32bit issue. areas you've cast pointers or used float instead of cgfloat. ...

javascript - function error() { [native code]} -

i have asp.net web site in c#. on dropdownlist onchange() event i'm calling jquery function, throws: function error(){[native code]} <script type="text/javascript"> function getdescription(a) { alert(a); // dropdown item selected value var id = (!isnan($(a).val())) ? parseint($(a).val()) : 0; $.ajax({ type: 'post', contenttype: "application/json; charset-8;", url: 'wt.aspx/getref', data: "{ 'id':'" + id + "'}", success: function (data) { alert(data); }, error: function (data) { alert(error); } }); } </script> wt.aspx/getref [webmethod] public string getref(int id) { datatable dt = new datatable(); sqlparameter[] p = new sqlparameter[1]; p[0] = new sqlpara...

Google Sites - Using Forms -

i building google sites page simple form in can upload attachments. how go having users fill out form , attach .jpeg automatically add new jpeg file home page? thank you! there no way can attach .jpeg file google form, on similar project. but! can make special form created html , javascript, can add file submit button. took me days before got show started: google forms file upload complete example it asked question similar topic. http://www.labnol.org/internet/receive-files-in-google-drive/19697/ this page, finaly understood going on. just way. have lot more scripting that. ideas start. working on uploading google site. if have anymore problems, please contact me. can show source codes working on right now. have nice day , luck sripting ;)

ftp - How to deal with "+FTPOPEN: 2" response from gprs module -

i trying connect ftp server gprs module. ftpopen? command returning error message +ftpopen: 2 wich couldnt find description in google , dont know idea how solve it. here sample of commands wich i'm sending. at+mipcall=1,"internet.beeline.uz"\r at+ftpopen="demo.wftpserver.com","demo-user","demo-user",,,,\r at+ftpopen?\r did here meet problem before? device model: g610, version: q50-00, manufacturer: fibocom step 1: find exact model name , version number of gprs module. make note of , update question information because extremely important background information. step 2: find official @ command documentation corresponding gprs module. manufacturer ought have them available on web site. step 3: read documentation got. this general way deal problems that. commands standardized 3gpp (like at+cpbr etc) might away reading standard document, manufacturers not comply 100% , lots of commands optional, authoritati...

cocoa - ARC: How do you release a WindowController when the user closes the Window? -

i'm trying translate old code arc. old code in windowcontroller: @interface preferencescontroller () <nswindowdelegate> @end @implementation preferencescontroller -(void)windowwillclose:(nsnotification*) notification { [self autorelease]; } @end my appdelegate has strong pointer windowcontroller: @property(strong) preferencescontroller* preferencesctrl; in preferencescontroller, need declare (weak) pointer appdelegate, , this: -(void) windowwillclose:(nsnotification *)notification { [[self appdelegate] setpreferencesctrl:nil]; } well, thoughts right. but can give make more simple. set application delegate nswindowdelegate. @interface appdelegate : nsobject <nsapplicationdelegate, nswindowdelegate> @property (strong) preferencescontroller* preferencesctrl; @end @implementation appdelegate - (void)doaction { // create window // ... self.preferencesctrl.window.delegate = self; // set window delegate } - (v...

How to uninstall pow (node) on mac osx -

Image
how uninstall pow ( http://pow.cx/ ) on mac osx? encounter firewall warning of norton due unix executable file called "node" seems related pow. tried uninstall command "$ curl get.pow.cx/uninstall.sh | sh" in terminal, on uninstall manual of pow website. showed below. please me this. please run command curl get.pow.cx/uninstall.sh | sh you missing uninstall.sh in terminal command(from screen shot)

javascript - How do I handle an exception thrown for an undefined function? -

in infamous validation directive, below, pass name of required validation function parameter attribute based directive: mybigapp.directive("mlngvalidations", function ($compile) { var valattributes = { phonenumber: function (element) { element.attr("ng-pattern", "/^[0-9]+$/"); element.attr("ng-minlength", 5); element.attr("ng-maxlength", 8); } } return { priority: 10000, terminal: true, link: function (scope, element, attrs) { var validationtype = attrs.mlngvalidations; valattributes[validationtype](element); element.removeattr("ml-ng-validations"); $compile(element)(scope); } }; }); if declare element mispelled validation function, e.g: <input type="text" class="form-control" ml-ng-validations="phoonenumber" /> i non unexpected exce...

ember.js - Getting ID of Parent Object in Route -

i have ember 1.11 app created ember-cli 0.2.3. have following in router.js file: this.route('ownedgames', function() { this.route('gameplays', {path: ":owned_game_id/plays"}, function() { }); }); this allows me use following url: http://localhost:4200/ownedgames/1/plays when visit url, getting following error: uncaught error: assertion failed: value #each loops on must array. passed '<ember-bgg@model:owned-game::ember470:1>' (wrapped in (generated ownedgames.gameplays controller)) here route gameplay import ember 'ember'; export default ember.route.extend({ model: function(params) { console.log("getting game plays store"); return this.store.find('gameplay', {ownedgame: params.owned_game_id}); } }); and how i've modeled fixture data: ownedgame.reopenclass({ fixtures: [ { id: "1", rating: "8.25", game: "1", plays: [1,2]}, ...

flash - In Actionscript 3, what happens if different events change the value of a variable at the same time? -

what happens if 2 events occur @ same time change value of variable? for instance, have 2 objects: a , b , loaded stage , stage variable named varx . the following code embedded in a 's fifth frame: stage.varx = 9 in other hand, have, in b 's fifth frame, following code: stage.varx = 2 so, what'll varx 's value, when both movieclips reach fifth frame? tl;dr a , b won't enter fifth frame @ same exact time, unless you're doing unusual. either a or b first, , whichever come last overwrite first one's value. make sure don't depend on them firing in order. you're doing unusual, it's still non-issue. this answered assuming you're referring single program multiple objects in stage. if you're talking multiple programs trying share sort of global stage state instead (i'm not sure whether share same stage object or not), can't sure, work same way. flash generally not use multi-threading. in fa...

php - laravel 5 configuration service providers for local only -

i read laravel 5 doc on configuration based on environment http://laravel.com/docs/5.0/configuration#environment-configuration i understand how .env files can used configure variables how configure service providers loaded based on environment? for example in ''local'' environment use debugbar plugin needs service provider don't want define in config/app.php production. in laravel 4.2 create config/local/app.php doesn't seem work anymore, alternative? i believe if set app_debug false in .env file debugbar go away automatically. also wrote middleware class take care of that. the handle method in case: public function handle($request, closure $next) { if (app()->environment('production')) \debugbar::disable(); else \debugbar::enable(); return $next($request); } then add list of middleware in app/http/kernel.php , you're go. i have additional conditions , more environments exact code not teste...

linux - Vagrant synced folder ls command -

i trying understand how syncing works vagrant , how workflow going , having trouble. have @ console: vagrant@vagrant-ubuntu-trusty-64:~$ pwd /home/vagrant vagrant@vagrant-ubuntu-trusty-64:~$ ls vagrant@vagrant-ubuntu-trusty-64:~$ ls -a . .. .bash_logout .bashrc .cache .profile .ssh vagrant@vagrant-ubuntu-trusty-64:~$ ls /vagrant vagrantfile vagrant@vagrant-ubuntu-trusty-64:~$ cd /vagrant vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ls vagrantfile vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ls -a . .. .vagrant vagrantfile vagrant@vagrant-ubuntu-trusty-64:/vagrant$ pwd /vagrant vagrant@vagrant-ubuntu-trusty-64:/vagrant$ how make sense? in directory /home/vagrant. why getting different results typing ls , ls /vagrant. in home directory type ls -a , there no folder called vagrant, can cd /vagrant new vagrant directory. when pwd don't full path of current directory. missing?

javascript - How to force browsers prefetch images in first 6 parallel connections -

Image
i've found lot of techniques preload images both css , js, none of them able preload images way need, or more in order need. simply put browser preload images , stuff in 1 block, the order in each image downloaded browser totally on own calculation, (and totally reasonably) top elements in document downloaded first. unfortunately quite true in tests <img> elements only; other elements background images it's not that, if images used background <body> element example. the solution far worked way needed place <img> elements right after <body> tag , set them style="display:none" . this working, rather ugly , terribly rough way imo achieve this. i'm bit concerned seo, since bots find right @ start of document hidden images purpose (i'm preloading images preloaders effects "loading.." small logo image). i quite charmed super brilliant solution saw preload images pseudo element on body body:before , use multiple b...

Rails and Heroku - Destroy a single record from production database -

is possible destroy single record production pg database using activerecord command console? know can locally running following command in rails console: > user.find(1).destroy however, have tried running production db: > heroku run rake user.find(1).destroy but not work. appreciated. thanks! run console on heroku first with: $ heroku run rails console then can delete record same query: > user.find(1).destroy if there multiple apps configured folder, have specify app --app=<app name> in heroku command line: $ heroku run rails console --app=<app name>

How to access iOS evironment variables or runtime arguments with react-native? -

i want load different configuration depending on evironent (dev, qa, prod). before react-native used node_env , enfivy. in react-native there of isn't global process variable. how access ios evironment variables or runtime arguments react-native? thanks, georg i think should write native module can environment variables , export them js.

c# - Best way to manage resources(Not necessarily RESX files) in .Net solution -

this sounded trivial question did not come across solid/best practice solution on how asking question here. now, let's imagine have work couple of ".txt" files in our code in class library. now, think there 3 major ways handle this: just put in bin/debug/resources folder of calling application , in code use "resources\*.txt". think simplest , unobtrusive way handle this. however, there many trivial problems it: when check in source control not check-in files inside bin/debug folder so in case, adding folder 1 level above , writting post-build scripts efficient option guess? add resources folder on same level bin folder . way can manage using source control. when need reference through our code becomes tricky we can reference files assuming binary folder's structure bin/debug , reference resources folder ..\..\resources but structure not guaranteed if binary folder structure bin/ (without debug folder in it) ../../resources going fail ...

ios - Why is frame width of the view alway 600 by 600 with autolayout -

i making basic minesweeper app practice / fun in swift. want make size of board (10 tiles wide) adapts ios screen. to i'm setting size of each tile getting tilecontainer view.frame.width , / 10. my problem tilecontainer view set 600, no matter what. on storyboard set tilecontainer equal width of view container, ctr click & dragging view , selecting equal width. keeps width of tilecontainer set @ 600, regardless of device i'm testing on. (which problem, width should change depending on screen width not constant 600) does know how can proper width of screen regardless of device it's being used on? when using auto-layout, subviews laid out after viewdidlayoutsubviews function. therefore, if call tilecontainer.frame.size before that, such in viewdidload , 600 600 (which default size in storyboard). viewdidlayoutsubviews : called notify view controller view has laid out subviews. reference override func viewdidlayoutsubviews() { super.viewdi...

reactjs - Testing React with mocha with --watch option, shows warnings only the first time -

Image
i'm testing react component mocha. i'm trying catch warnings (through console ), related "failed proptype" , other warnings react can give. i've had recur other methods of testing since test show warnings first time. here's test code: var jsdom = require('mocha-jsdom'); var { expect, assert } = require('chai'); var sinon = require('sinon'); describe('deck', function() { jsdom(); var react = require('react/addons'); var testutils = react.addons.testutils; var deck, card, othermock; var renderer, result; beforeeach(function() { deck = require('../app/components/deck.js'); card = require('../app/components/card.js') othermock = react.createclass({ render: function() { return null } }); renderer = react.addons.testutils.createrenderer(); renderer.render( <deck> <othermock /> ...

bash script loop through two variables in lock step -

i'm trying write bash script loops through 2 variables: #!/bin/bash in sd fd dir && j in storage file director echo "restarting bacula $j daemon" /sbin/service bacula-$i restart echo done the code above wrong. want & j move in lock step 1 another. can me way achieve this? thanks #!/bin/bash a=(sd fd dir) b=(storage file director) k in "${!a[@]}" echo "restarting bacula ${b[k]} daemon" /sbin/service "bacula-${a[k]}" restart echo done

java - BufferedReader reads only once -

i'm tryin read configuration file , strings file. configuration file used determine if content in string file correct. i created package named stringacceptor, part of code follows: public static boolean isaccepted(file config, file lines_file, string string) throws exception { //bufferedreader para obtener las líneas del archivo conf = new bufferedreader(new filereader(config)); //bufferedreader para determinar la cantidad de líneas en el archivo lines = new bufferedreader(new filereader(lines_file)); //validación de archivo de configuración del afd while(lines.ready()){ lines.readline(); line_number = line_number + 1; } while(conf.ready()){ try{ here start reading lines , assigning values corresponding variables then created java file use package , send information stringacceptor determine if string accepted or not. code class uses package follows. after importing needed package , determining option excecu...

flash - object visible actionscript -

hello making simple actionscript game , want reveal image when click on movieclip. i trying use object.visible = false; method doesnt seem working me . basically when click on "clown" movie clip, want "elephant" image appear function myclickfunction(event:mouseevent) { if (clown.visible){ clown.visible = false; } else { elephant.visible = true; } } your logic bit muddled. if understand you're looking for, should able change following have clown disappear , elephant appear when clown clicked. function myclickfunction(event:mouseevent) { if (clown.visible){ clown.visible = false; elephant.visible = true; } }

Getting no matching results for query mysql php -

this question has answer here: when use single quotes, double quotes, , backticks in mysql 10 answers i trying find matching results query in database , put in table form made, no matching results back. ran query in phpmyadmin , got desired output. used var_dump on $result variable , following: resource(4) of type (mysql result). here code: <?php function rendersearchform($search, $search_by, $search_by, $error){ ?> <!doctype html5> <head> <title>search query</title> </head> <body> <?php //display errors if($error != ''){ echo '<div style="padding:4px; border:1px solid red; color:red;">' . $error . '</div>'; } ?> <form action="" method="post"> <div> <p>search for:</p> <strong>name: *</strong> <...

ruby on rails - FactoryGirl with Paperclip setting the wrong image content type -

i have class seatingchart attached chart_image in factory seatingchart trying create chart_image rack::test::uploadedfile , getting error: failures: 1) seatingchart has minimum valid factory failure/error: expect(build :seating_chart).to be_valid expected #<seatingchart id: nil, name: "konklab", created_at: nil, updated_at: nil, venue_id: nil, chart_image_file_name: "logoimage.jpg", chart_image_content_type: "text/plain", chart_image_file_size: 28555, chart_image_updated_at: "2015-05-13 23:29:01"> valid, got errors: chart image content type invalid, chart image invalid the factory seatingchart is factorygirl.define factory :seating_chart name { faker::app.name } chart_image rack::test::uploadedfile.new rails.root.join('app', 'assets', 'images', ...

mongodb - scalable meanjs on digitalocean -

i'm trying learn deployment process can guarantee headackeless scaling of meanjs application (not in level people in big companies, not @ hobby level). so long understood, solution work on: 1. having mongodb on digitalocean on ubuntu 2. having meanjs application (all other mongodb) in docker then 1 can scale! because mongodb clustered separately , docker keeps scaling of application easy. well, know sounds trivial , that's why i'm asking here: want go , learn docker , want make sure before investing time on above assumed solution! do think guarantee easy scaling, say, simple online multiplayer game on meanjs please? thank you. there no off shelf solution. you can use docker swamp small deployment brings additional issues of monitoring , networking. so here did: create script generate haproxy config when start/stop instance have mongo in cluster or replica or whatever. database not need scaled dynamically. have single mongo server scale , when ca...

Deploy meteor project only as android app but not as a website -

i working on project using meteor , want deploy web app not website, there way of doing it? the simple answer yes. guess know how. broad topic specific application, users, , of needs. have specific question can update with?

html - Can not change class with jquery and waypoints -

i have problem frustrating me. body so: <div class='chapter'> <div class='side side-right'> <image src="./image1"> <div> <div class='side side-left'> chapter 1 </div> </div> and in javascript, have: $(document).ready( function(){ $(".chapter").waypoint(function(e){ if (e=="down" ) {$(this).find(".side-right").addclass("current"); console.log(e);} if (e=="up" ) {$(this).find(".side-right").removeclass("current");console.log(e);} } ); however, class not seem change. console prints "up" or "down" based on how scroll, not notice class changing. any idea wrong? help. i using jquery.js , jquery.waypoints.js k. this not html element inside waypoint handler, instance of waypoint class. @ element, use $(this.element) .

c# - RTS touch camera movement -

i've been trying head around solution camera movement. these parameters needs work , thoughts had tried: camera movement / not world movement raycast move camera accurately along terrain touch movement works "grabbing" terrain towards or "pushing" away screen space world space not work because of angle of camera so thoughts have lead me devise solution grab vector3 point ray hits ground under finger on fingerdown move camera in opposite direction real world distance between origin , movingpoint. if makes sense. i'm pretty confused either confirm or deny idea , give clear way forward =) i'm using asset called leantouch (brilliant piece of free scripts) touch inputs , far brain wants go: (lol) var finger = lean.leantouch.fingers [lean.leantouch.fingers.count - 1]; var ray = finger.getray (); int layermask = (1 << 8); physics.raycast (ray, out hit, mathf.infinity, layermask); initialhit = hit.transform.position; btw i'm workin...

javascript - Match a character the same amount of times that a previous character has been matched -

i in need way interpret x ^ y (i aware there such solutions available, challenging myself go "library-free"). thought using regexp, such: (\(*\w+\)*|\(*math.pow\(\w+,\w+\)\)*=*)+\s*\^\s*(\(*\w\)*)+\)* ( http://regexr.com/3b0dl ) , replace string "math.pow($1,$2)" . now, works cases i've tested far, save following: 1 - paren surrounding expression (2 ^ (5)) which replaces thus: math.pow((2,(5))) which evaluates (2,(5) . there way can fix regexp matches ) many times matched ( in second catch group? 2 - multiple iteration (2 ^ 3) ^ 5 is replaced with math.pow((2,3)) ^ 5 which leaves unevaluated ^ . figure may done while(input.match("^"){...} sort thing, want know if possible via regexp. thank in advance help.

r - How to make the error bars move with the barplot when re-ordering factors? -

i plotting barplot error bars. , here's got far. problem error bars not appear in place should be. if don't force id levels, removing df2id <- factor(df2$id, level = c('gary','jack', 'alice')) line, looks fine. id = c(rep('gary',10), rep('jack',10), rep('alice',10)) #gary has lowest mean , sd, alice has highest mean , sd var1 = c(rnorm(1:10)*1+10,rnorm(1:10)*10+20, rnorm(1:10)*100+30) df <-data.frame(id = id, var1 = var1) df2 <- ddply(df, 'id', summarise, mean = mean(var1), sd = sd(var1)) df2$id <- factor(df2$id, level = c('gary','jack', 'alice')) limits <- aes(ymax = df2$mean + df2$sd, ymin = df2$mean - df2$sd) ggplot(df2, aes(y=mean, x=id))+geom_bar(stat='identity')+ geom_errorbar(limits)+ facet_grid(.~id) but need keep line can re-order sequence of panels. how can make error bars re-ordered too? you should never use data.frame$column ggplot, forces...

Open graph custom story review, without facebook login -

Image
i'm confused whether it's compulsory use facebook login on site, if want user able explicitly publish custom story. for example, i've created custom "review" action. hasn't been approved yet, works developer/test accounts. i want user share story on facebook: if yes clicked, fb.ui(method: 'share_open_graph', ... ) called, brings dialog: is alone not acceptable case using/approving custom story? when attempt submit action review, i'm forced declare app uses facebook login. have no need call fb.login() anywhere. above process implicitly constitute facebook login? if not, why need shoehorn facebook login app, when want accomplish? edit - evidence: note how submit review greyed out, until tick checkbox: here's snippet documentation : this example open graph action rejected for: listing website not use facebook login... so after really laborious review process , culminated in some direct support , ...

javascript - Click on a element with same class that matches text and exit in Protractor -

i able find text using element.all(by.repeater()) in protractor , using each check matching text. problem exiting once match done , clicking on matched element. i tried using .each() , unable exit iteration. any suggestions? in case, each() not choice. it sounds filtering , example: element.all(by.repeater("test in tests")).filter(function (elm) { return elm.gettext().then(function (text) { return text === "desired text"; }); }).then(function(filteredelements) { filteredelements[0].click(); });

javascript - How to open a Kendo window at mouse pointer -

is there way open kendo ui window @ mouse pointer? i can see in telerik demo window api , can open on center of page, want open @ mouse pointer. first, keep current mouse position stored somewhere: var currentmousepos = { x: -1, y: -1 }; $(document).mousemove(function(event) { currentmousepos.x = event.pagex; currentmousepos.y = event.pagey; }); then, when opening kendo window: $("#window").closest(".k-window").css({ top: currentmousepos.y, left: currentmousepos.x });

Why am I still getting java.lang.NoClassDefFoundError: android.support.v7.appcompat.R$attr? -

Image
so i'm developing cheesy app make posts train myself in android before work on firm's real app project. i'm running bug that's giving me difficult time though. i given list of library dependencies use, , have build.gradle file set load them in. syncs fine, assume it's done right best of knowledge: dependencies { compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:22.1.1' compile 'com.google.android.gms:play-services:7.3.0' compile 'com.squareup.okhttp:okhttp:2.3.0' compile 'com.squareup.retrofit:retrofit:1.7.0' compile 'com.google.code.gson:gson:2.3' compile 'com.squareup.dagger:dagger:1.2.2' compile 'com.squareup.dagger:dagger-compiler:1.2.2' compile 'com.squareup.picasso:picasso:2.5.2' compile 'com.android.support:recyclerview-v7:22.1.1' compile 'com.squareup:otto:1.3.7' comp...

ruby on rails - How to save RMagick processed image using Paperclip without writing to a file -

i have been trying upload file (output of rmagick processing ) s3 using paperclip. keep getting error no handler found http://upload.wikimedia.org/wikipedia/commons/thumb/4/48/ebay_logo.png/800px-ebay_logo.png= >800px-ebay_logo.png png 800x349 800x349+0+0 directclass 8-bit 37kb basically, in system - user uploads logo using external url, process logo , trim whitespace , upload s3 system. have been using temp file middle man, want directly: in model, this: def fetch_and_trim_logo puts "logo #{logo}" if logo_changed? response = restclient.get logo if response.code == 200 img = magick::image::read(logo)[0] puts "this image #{img.columns}x#{img.rows} pixels" trimmed_img = img.trim puts "trimmed image #{trimmed_img.columns}x#{trimmed_img.rows} pixels" temp_file = tempfile.new(["trimmed_image",".png"]) trimmed_img.wr...

Collapse nested directories in bash -

often after unzipping file end directory containing nothing directory (e.g., mkdir foo; cd foo; tar xzf ~/bar.tgz may produce nothing bar directory in foo ). wanted write script collapse down single directory, if there dot files in nested directory complicates things bit. here's naive implementation: mv -i $1/* $1/.* . rmdir $1 the problem here it'll try move . , .. , ask overwrite ./.? (y/n [n]) . can around checking each file in turn: ifs=$'\n' file in $1/* $1/.*; if [ "$file" != "$1/." ] && [ "$file" != "$1/.." ]; mv -i $file . fi done rmdir $1 but seems inelegant workaround. tried cleaner method using find : for file in $(find $1); mv -i $file . done rmdir $1 but find $1 give $1 result, gives error of mv: bar , ./bar identical . while second method seems work, there better way achieve this? turn on dotglob shell option, allows pattern match files beginning . . s...