Posts

Showing posts from February, 2012

openerp - Custom module doesn't show up in the list of apps -

i trying install module odoo 8 odoo 9. i copied on whole folder addons folder in odoo 9 , expecting can somehow install module in odoo 9 doesn't show in list of apps install. there changed in structure of odoo have prepare module show in apps list? thanks in advance. you not see modules/apps because must update list of modules. first need restart server . after login administrator , activate developer mode . go settings(top menu) -> update apps list(left menu) -> refresh page(or better: logout, clear cache, restart server etc. :) ). after steps must see modules. hope you.

android - Select an area on bitmap with 4 points using Matrix.setPolyToPoly -

Image
i playing bitmap on android , facing issue when selecting area on bitmap using 4 points. not sets of 4 points work me. in cases, result blank bitmap instead of cropped bitmap (like in picture) , there not error in logcat(even memory error). here basic code used transformation. import android.app.activity; import android.graphics.bitmap; import android.graphics.bitmapfactory; import android.graphics.canvas; import android.graphics.matrix; import android.widget.imageview; public class cropimageactivity extends activity { private imageview mcroppedimageview; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.crop); setupviews(); docropping(); } private void docropping() { bitmap srcbitmap = bitmapfactory.decoderesource(getresources(), r.drawable.sample); //target size int bitmapwidth = 400; int bitmapheight = 400; bitmap bitmap = bitmap.createbitmap(bitmapwidth, bitmaphei...

jQuery checking the length of array before each? -

quick question, need if statement .length below? var $colspans = $("td[colspan='0']"); if($colspans.length){ $colspans.each(function(){ no, since length 0 ans it's not $colspans null , you're not in danger of trying call on nothing. won't iterate because there's nothing to iterate over.

Add count as property to javascript object -

i have 2 arrays: one categories one datarecords every data record belongs specific category. with every use of filter (e.g. searchfield ) on datarecords , want add total count of records per category each category-object , can display them on every tab-pane (e.g. text: algemeen , value: 'general , countfiltered: 2 ) i made fiddle this. till no count-filtered, locally constant error corresponding line 78 in fiddle: uncaught (in promise) type error: cannot read property '0' of undefined how can achieve this? this isn't think here: var filtered = results.filter(function (results) { return (results.category.tolowercase() == this.categories[cat].value.tolowercase()); }); you can either pass in thisarg filter : var filtered = results.filter(function (results) { return (results.category.tolowercase() == this.categories[cat].value.tolowercase()); }, this); or in es6 can use arrow function : var filtered = results.filter(...

subquery - How Can I Replicate This SQL Sub Query In Neo4j -

i new neo4j , graph databases, have background in relational databases. my question request advice on how replicate sql server query efficiently in neo4j. i starting new project think suited neo4j due number of friend-of-a-friend type relationships have store. using neo4j 1.8.1 , c# write application one part of project has section has structure comparable twitter, , need help. i use twitter analogy explain problem: i have list of text blobs (tweets) , each blob can in 0, 1 or many categories (hash tags). unlike twitter, have users linked 0, 1 or many categories. i conceive graph looking this: t = text blob node, c = category node, u = user node t-------c-------u \_____/ \_____ / \ \ t-------c-------u \_____ \ t-------c-------u _____/ \_____ / \ t u when application running, estimate there 10,000,000 records (i archive more this), 100 categories , 1000 users. currently have simple sql server database test this: ...

What is returning "nothing" from Excel.Range.find in c# -

what nothing mean me, when api tells me function returns nothing? need use try-catch block call function? give me issue if try set equal nothing? basically...what proper way of handling "nothing"? excel.range headers = exsheet.range[exsheet.cells[1], exsheet.cells[numcols]]; excel.range columnheader; //some code... columnheader = headers.find(columnlist[i]); documentation- this method returns nothing if no match found. excel.range.find upon reading documentation see method returns microsoft.office.interop.excel.range fine, know ran problems earlier function returned range ( range.specialcells ) had use try-catch block in order ensure wouldn't crash program if no special cells found. see what's equivalent of nothing? : for reference types, equivalent of vb's nothing c#'s null. value types, it's default value - 0, false, etc. so according documentation, should fine when check null .

debugging - Android Studio 1.5 "View Bitmap" downscaled -

Image
i having issue "view bitmap" preview functionality of android studio. having bitmap 29000 , height 255. when click "view bitmap" in debugger on bitmap class, see downscaled version. yes aware 29k width lot, working android studio < 1.5, guess setting somewhere. here info bitmap in debugger view and here bitmap when click on "view bitmap". as see dimensions not right. debug preview bitmap way smaller 1 want see. any suggestion how fix that?

apache - Check if stream from HttpServletResponse was download by client - JAVA -

basically, system generates url's download files server. make using struts result of type 'stream'. work great. want notice each file downloaded, if downloaded. i've been searching while don't know how continue. i'm beginner this. ** new action: ** public string download(){ try { string path = init.getwebinfpath() + uploadmanager.getinstance().getproperty("upload_dir") + content.getzipfile(); file = new fileinputstream(new file(path)); } catch (exception e) { return error; } long overallsize = null; try { overallsize = file.getchannel().size(); } catch (ioexception e) { e.printstacktrace(); } response.setcontenttype("application/zip"); response.addheader("content-disposition", "attachment; filename=\""+content.getzipfile()+"\""); response.setheader(...

html - Arrange DIVs in the right position -

Image
i'm having huge problems trying arrage divs, found thing not simple seems, put div , inside div 2 , you're done. image bellow shows how want page structured: sur1. surf2: surfleft, surfright. surf3. surf4 . means line , , means divs should 1 next another. , can't center image vertical , horizontall middle on surfright surf 2 parent. @font-face { font-family: font; src: url(montserrat-regular.ttf); } p.title1 { font-size: 2.5em; margin: 0; } p.title2 { font-size: 3em; } .i1 { height: 400px; float: right; display: block; margin-top: 150px; } div.surf1 { display: block; background-image: url("surf1.jpg"); background-position: center; background-size: cover; height: 600px; } div.surf2 { width: fit-content; position:absolute; background: #41c3ac; height: 600px; } div.surfleft { float:left; display: block; width: 45%; padding-top: 80px; he...

linux - How to write PHP script for cronjob that uses cat /dev/null > to reset log files -

i use assistance in making php script add cronjob include multiple, (10 15), commands such as: line1: cat /dev/null > /var/www/vhosts/website.com /logs/access_log.webstat line2: cat /dev/null > /var/www/vhosts/website.com/logs/big_access_log line3: cat /dev/null > /var/log/plesk-roundcube/largefile.log and on. commands work great command line, doing daily time consuming , files grow way large though being rotated. assistance appreciated, thank you. could possibly use shell_exec command complete these actions: example: <?php $output = shell_exec('cat /dev/null > /var/www/vhosts/website.com /logs/access_log.webstat'); echo "<pre>$output</pre>"; ?> then create cron job run them @ interval times.

python - QtGui.QMovie gif stops when function executes -

i want show loading gif until function completed. the code have self.loadinggif = qtgui.qlabel(mainwindow) movie = qtgui.qmovie("hashupdate.gif") self.loadinggif.setmovie(movie) self.loadinggif.setalignment(qtcore.qt.aligncenter) self.gridlayout_2.addwidget(self.loadinggif, 4, 1, 1, 1) movie.start() self.myfunction() the problem gif shows not playing. starts play when function completed. how can make gif play while function executing ? the gif stops playing because function self.myfunction blocking qt event loop. event loop part of qt (among other things) processes mouse/keyboard events, handles redrawing of widgets (like buttons when hover on them or click on them) , updating current frame displayed when playing animation. so qt event loop responsible executing code in response various things happen in program, while executing code, can't else. so need change code. there several solutions this: run myfunction in secondary thread doesn...

Mapping between Spark configurations and parameters -

when launch spark in command line, found parameter num-executors acts similar spark.executor.instances in configuration file. same? if so, can find full mapping between such pairs of same functionality? from the documentation the spark shell , spark-submit tool support 2 ways load configurations dynamically. first command line options, such --master, shown above. spark-submit can accept spark property using --conf flag, uses special flags properties play part in launching spark application. running ./bin/spark-submit --help show entire list of these options. so, there way fewer command line options such --executor-cores there spark options such spark.executor.cores , , documentation says, -- options running ./bin/spark-submit --help . run - tell not cl options usable in every situation (something confused me lot). can set property not have special command line option so: --conf spark.executor.cores=16 . here incomplete table - must read through com...

angularjs - Grouping ng-repeat Items into sets to populate table with set number of records per row -

i converting mvc angularjs. have model passed view , take model , used linq group set of 4 items. so, if have 12 records, 3 sets of 4 records. reason. insert 4 records per row in table. here mvc code @foreach (var productgroup in ((model.select((e, i) => new { product = e, grouping = (i / 4) }).groupby(e => e.grouping)) { <tr> @foreach (var product in productgroup) { <td> <div><br /></div> <img src=@product.product.thumbnail style="width: 200px; height: 200px" /> <div><br /></div> <div class="col-md-6"> <p><strong>@product.product.descriptionline1<br></strong></p> <p><small>@product.product.descriptionline2<br></small></p> </div> </td> } </tr> }...

javascript - JS - How to split a string with more commas than I want -

i have string list of items. items in list contain strings represent numbers. var list = '"one","two","3,842","3,549","3,653","4,443","3,994","3,935"' i tried splitting so: list.split(',') // result: [""one"", ""two"", ""3", "842"", ""3", "549"", ""3", "653"", ""4", "443"", ""3", "994"", ""3", "935""] which not intended. i like: ["one","two","3,842","3,549","3,653","4,443","3,994","3,935"] // or better: ["one", "two", 3842, 3549, 3653, 4443, 3994, 3935] how correctly split string array above? try this : var list = '"one","two...

c# - Find certain text in PDF, then return page number found on to another section NOTE: Uses Docotic.pdf -

in following code, user input search string (barcodedata). string truncated first 5 characters, , used jobnumber. jobnumber, name of pdf scanning barcodedata. what like, 'find it' button execute below code, return value found startpagedata. i can't tell if program isn't scanning pdf search string, or if value isn't returning program. using bitmiracle.docotic.pdf; using system; using system.collections.generic; using system.componentmodel; using system.data; using system.diagnostics; using system.io; using system.drawing; using system.linq; using system.text; using system.threading.tasks; using system.web; using system.windows.forms; using acrobat; namespace barcodereader { public partial class form1 : form { public string stringstofind; public string pathtofile; public form1() { initializecomponent(); } private void barcodedata_textchanged(object sender, eventargs e) { ...

fetch Youtube subscribers count by JSON API in PHP -

i want subscriber count value json file: http://gdata.youtube.com/feeds/api/users/googlechrome?v=2&alt=json this did it's not working. $youtube_url = json_decode( file_get_contents( 'http://gdata.youtube.com/feeds/api/users/googlechrome?v=2&alt=json' ), true ); $youtube_data = $youtube_url['entry']['yt$statistics']['subscribercount']; php code: function get_yt_subs($username) { $xmldata = file_get_contents('http://gdata.youtube.com/feeds/api/users/' . strtolower($username)); $xmldata = str_replace('yt:', 'yt', $xmldata); $xml = new simplexmlelement($xmldata); $subs = $xml->ytstatistics['subscribercount']; return($subs); } example of usage: php code: get_yt_subs('3moeslam')

javascript - How to get the real height of a text? -

referring go example http://jsfiddle.net/uzgjx/ the result height of box containing text (the 1 can see if select text mouse..) wichi higher real height of text. there way real height jquery or plain js? in example tryed with text.height() and text[0].getboundingclientrect().height with no luck, says 19px instead of 14px get computed font-size text element instead: parseint(window.getcomputedstyle(text[0]).fontsize, 10); font-size represents size of em square font. should noted that, while glyphs stay inside bounds of em square, may exceed bounds. doesn't occur on vertical dimentions, though. give try: http://jsfiddle.net/uzgjx/1/ . tip: screenshot , copy favourite image editor, select pixels height of text , compare value given in fiddle.

Testing AngularJS directives that directly consume services -

i have directive makes use of service: mydirective = (myservice) -> compile: () -> stuff = myservice.getstuff() mydirective.$inject = ['myservice'] app = a.module 'myapp' app.directive 'mydirective', mydirective i want able test myservice.getstuff called. for tests controllers, have been able do: angular.mock.inject ($controller) -> mycontroller = $controller 'mycontroller', $scope: $scope mockme: mockmethod: () -> assert.ok() done() if similar directive, following error: angular.mock.inject ($directive) -> mydirective = $directive 'mydirective', $scope: $scope myservice: getstuff: () -> assert.ok() done() error: unknown provider: $directiveprovider <- $directive any ideas how can reference directive , inject mocks in it? before tests doing: angular.mock.module 'myapp' i have been able solve going directive -> controller ->...

forms - Scala example of inputRadioGroup in Play2.1 -

i'm browsing around in documentation can't find example of how use inputradiogroup in controller. i guess should use this helper. how bind form in controller? show radio group represents grades 1 - 5 controller: object sms extends controller { val testform: form[test] = form ( mapping( "firstname" -> nonemptytext, "lastname" -> nonemptytext, "password" -> tuple( "main" -> text(minlength = 6), "confirm" -> text ).verifying( "passwords don't match", passwords => passwords._1 == passwords._2 ), "email" -> tuple( "main" -> (text verifying pattern("^([0-9a-za-z]([-\\.\\w]*[0-9a-za-z])*@([0-9a-za-z][-\\w]*[0-9a-za-z]\\.)+[a-za-z]{2,9})$".r, error="a valid email req")), "confirm" -> text ).verifying( "emails don't match", em...

php - Session not recognized -

i spent 45 minutes yesterday trying research , troubleshoot this, has idea can try. it started out 1 of php scripts detecting session $_session empty, stopped executing rest , threw error me. this entire project has worked on server @ least half year without problems, , no update code or server has been made since then. here's did then: created new php file testing, made sure there nothing before or after <?php ?> container, , wrote code: session_start(); var_dump($_session); $_session['test'] = 5; then ran file repeatedly, , came empty session. i had run before, checked folder session files located on server (in case /var/lib/php5 ), made sure had correct directory owner , permissions, deleted files in , restarted apache. no dice... i ran file again few times, , each run created new session file, , session file did contain test=5 entry, sessions write correctly. so checked browser cookies. there , working far can tell - both phpsessid cookie , c...

printing - How to combine two strings in Fortran -

here's example in python3 of want in fortran: str1 = "hello" str2 = " world!" print(str1 + str2) # , result "hello world!" when do: print "(a)", str1, str2 it puts on separate line. if knows how please answer. the literal answer string concatenation, using // operator, given in answer. note, particularly, want trim first argument. but there interesting concept question raises, , format reversion . with format (a) have 1 format item. in output list str1, str2 have 2 output items. in general output statement apply each format item (with repeat counts) corresponding output item. so, str1 processed first format item a , , string appears. come second output item str2 we've used single format item, reaching end of format item list. result see format reversion: is, go first item in list. after, crucially, start new line. so, if want print 2 items 1 line (with no space or blank line between them) use (ne...

python shapely parallel_offset not found -

i'm trying use shapely parallel_offset, sems it's not found. i've included imports found in examples, doesn't recognize parallel_offset. from matplotlib import pyplot shapely.geometry import linestring descartes import polygonpatch line=linestring([(0,0),(0,1),(1,1),(2,0)]) offset = line.parallel_offset(1,'left',join_style=2) and get: $ python parallel_offset.py traceback (most recent call last): file "parallel_offset.py", line 6, in <module> offset = line.parallel_offset(1,'left',join_style=2) attributeerror: 'linestring' object has no attribute 'parallel_offset' what doing wrong? this feature has 2 requirements both need met: shapely >= 1.2.8 geos >= 3.2.0

prevent meteor from downloading package updates -

i have meteor app on laptop (where development work on app), , able work and/or give demos of in situations not have internet connection. how can prevent meteor automatically trying download updates packages when run it, can run app without issues in "offline" situation? note different client (browser) being "offline" in sense can't connect server. in situation, client , server on same machine , client have access server. machine disconnected internet, attempts automatically download package updates incur @ least delay, if not errors, , i'd prevent that. use meteor_offline_catalog environment var that. suggest not set permanently, rather use once. so if run meteor this: meteor_offline_catalog=1 meteor shouldn't update packages or meteor releases.

javascript - Is data cached on server or client or not at all in AngularJS when an error occurs in a promise? -

keep in mind, i'm running old version of angularjs (1.0?), things may have changed, have code looks like: promise = $http.get(urlformattedstring).success(function (data) { data.foreach(function (result) { //do result , $scope}); promises.push(promise); $q.all(promises).then(function (data) { //do when works! }; when no errors thrown, "works", question happens when 1 of promises throws error (say 1 out of 20)? let's make more interesting (and closer application) , assume each promise requesting data database (mongodb in case). if have re-run everything, mean data needs fetched again? relying on database cache data repeated requests run faster? or maybe server (nodejs in case) caches data? along these lines, when data sent client server? upon success of promises or data returned client each promise separately? , if so, angular caching? just laying out here makes me realize pretty complex , ...

c# - How do I find a certain Child image in a Canvas? -

i have canvas has 400 children. each of children rectangle , filled image. if want find image, how go doing that? //my code fill rectangle image img = new image(); img.source = new bitmapimage(new uri(@"hero.png", urikind.relative)); img.margin = rec.margin; imagebrush imgbrush = new imagebrush(); imgbrush.imagesource = img.source; rec.fill = imgbrush; //my attempt @ finding rectangle foreach (rectangle rec in canvas1.children) { if (rec.fill = imagebrush.imagesourceproperty) // tried compare rectangle image's source { } } you may use names for every specific image using findname method object wantednode = stackpanel.findname("dog");

javascript - Bootstrap menu links not clickable -

i'm using bootstrap theme, , kind of edited needs. internal links (on same page) working, external links not clickable left mouse button. when right click , open link in different tab work. have no clue on did wrong, have not massively destroyed code, edited needs( link ). <li><a href="#body">home</a></li> <li><a href="#info">information</a></li> <li><a href="#server">server</a></li> <li><a href="#packages">packages</a></li> <li><a href="//xxxxx">forum</a></li> <li><a href="//xxxxx/">donate</a></li> the links # infront of them work externals not. anyone has idea on how fix this? as using singlepagenav() function need add external class external link. updated html <li><a href="#body" class="current">home</a></li> ...

r - Runif generating NaN terms -

i have matrix of baseline values different parameters, 1 column x 305 row matrix, , want use runif generate matrix of random numbers (100 each parameter value) between +- 10% of initial parameter value. problem there nan terms randomly interspersed in output when there shouldn't be, , warning message: warning message: in runif(n = 30500, min = lower, max = upper) : nas produced this code far: baseline <- scan("baseline.txt") baseline <- as.matrix(baseline) base <- t(baseline) upper <- 1.1 * base lower <- 0.9 * base matrice2 <- matrix(runif(n=30500, min = lower, max = upper), nrow=305) (i had take t(baseline) resulting matrice2 in right form passed function i'm using later). numbers in baseline range -0.281 800. anyone have ideas why generating nan ? using exact code before took time off holidays, , working then. edit: baseline.txt data, 305 row x 1 column text file baseline [,1] [1,] 0.400000000 [2,] 0.8...

java - How to get the current configuration of a thread pool via its HystrixThreadPoolKey? -

is there way retrieve hystrixthreadpoolproperties instance (or other property container) specific hystrixthreadpoolkey ? so default thread pool properties overlaid configuration provided executing command with: hystrixcommand.setter.withgroupkey(<some group>) .andthreadpoolkey(hystrixthreadpoolkey) .andthreadpoolpropertiesdefaults(...) i've tried following approach: hystrixpropertiesstrategy hystrixpropertiesstrategy = hystrixpropertiesstrategydefault.getinstance(); hystrixthreadpoolproperties hystrixthreadpoolproperties = hystrixpropertiesstrategy.getthreadpoolproperties(hystrixthreadpoolkey, hystrixthreadpoolproperties.setter()); this seems recover default hystrix configuration threadpool not property changes i've made specific specific pool key corresponds to. this case though i'm able verify thread pool indeed picking configuration when execute commands run it. the version of hystrix using 1.5.0-rc.5, , couldn'...

special characters - What is the purpose of double colons in Lua? -

i have been aware version 5.3 lua had come out not long ago hadn't had reason visit documentation online until now. may wrong, not believe remember usage of double-colons :: used abundantly there. i see considered "special token" others (greater than, less than, asterisks, etc) know for. what purpose of using them in lua? :: used 1 thing in lua *: declaring labels jumping goto . goto label ::label:: the goto statement transfers program control label. syntactical reasons, labels in lua considered statements too: stat ::= goto name stat ::= label label ::= ‘::’ name ‘::’ a label visible in entire block defined, except inside nested blocks label same name defined , inside nested functions. goto may jump visible label long not enter scope of local variable. labels , empty statements called void statements , perform no actions. * don't consider extensive use extended bnf in documentation use in lua itself.

ios - What's the best design pattern for scrolling images in UITableViewController? -

i've created app uses table view show images. these images stored in database. however, now, not scalable application because i'm querying 25 images , storing them array , putting them in table view. if had 100,000 images not practical. thinking accommodate lot of images following: 1) first query 25 images , store in array , view them in table view. 2) then, scroll down table view query next 25 images while i'm scrolling down. 3) when scrolled down past first 25 images, delete first 25 images beginning. 4) then, start again @ step 1 until there no more images in database if scroll up, opposite, , query last 25 images (remembering put them in reverse order in array of course). i'm sure problem has been solved before, i'm not sure if solution okay. guys think scalable? if not, problems run doing , what's better way it? thank help. a simpler pattern load more images once user has scrolled bottom of app, i.e. once scroll bottom see spinner ,...

javascript - Trying to generate a button-group with Bootsrap and AngularJS to redirect to different URLs -

i trying create button group of 2 (using bootstrap , angularjs) that, when clicking on them, each redirect different url. have following code (copied relevant pieces): app.controller('linkcontroller',function(link, $scope, $location){ $scope.go = function(){ $location.url(link); }; }); <div class="btn-group btn-group-lg" data-ng-controller = "linkcontroller"> <button type="button" class="btn btn-primary" data-ng-click = "go('test1.html')">click1</button> <button type="button" class="btn btn-primary" data-ng-click = "go('test2.html')">click2</button> </div> however, doesn't work, , not sure why. might not passing arguments correctly, tried without passing link , still didn't work. appreciate help! are trying pass url ?, if so, : app.controller('linkcontroller',function(l...

session - php prepared statement inserting with trim or date() etc. php strict standards error -

hopefully easy question, haven't been able find answer. i'm learning use prepared statements rather mysqli_escape. have code: $stmt = $dbc->prepare("select the_table email=? "); $stmt->bind_param("s", strtolower(trim($_request['email']))); i error message "php strict standards: variables should passed reference in". am correct in thinking you're not supposed use strtolower / trim etc in bind param line? important? less secure first have separate: $email = strtolower(trim($_request['email']))); i kind of thought should try , keep $_post, $_request bits in bind_param line. i same issue in page with: $stmt->bind_param("s", date("y-m-d") ); lastly , separately , safe use insert $_session variable directly? these have been set previously, can hacked? if i've set $_session['admin']="off" earlier, , later use in query admin=? bind_param says ("s",...

java - Exporting Gephi to GraphML not maintaining Node colour -

Image
i'm using gephi create graphmodel , export .graphml file. when create .graphml file colour attribute not maintained. the following how create gephi graphmodel graphclass (comprised of edges of type e, , nodes of type v) , export .graphml file. in case create random k-tree public void testcreategraph() throws exception { ktree k1 = new ktree(4); (int = 0; < 95; i++) { k1.addrandomvertex(); } graphmlcreator<kvertex,kedge<kvertex>> creator = new graphmlcreator(); creator.create(k1); creator.sendtodb(); } public void create(graphclass<v,e> g){ graph = graphmodel.getundirectedgraph(); this.addnodes(g.getvertices()); this.addedges(g.getedges()); } private void addedges(collection<e> edges){ (e e: edges){ node n0 = graph.getnode(e.getendpoints().getfirst().getlabel()); node n1 = graph.getnode(e.getendpoints().g...

How to get absolute path on a zsh prompt? -

i'm switching bash zsh. i want update new zsh prompt , looked around find way, have found "solutions" via oh-my-zsh. the goal: location: ~/dir_1/dir_1_1/dir_1_1_1 what have: location: dir_1_1_1 the code (source) : ps1='${ssh_connection+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[green]%}location: %c%{$reset_color%}$(git_prompt_info) ' as horacio chavez mentioned in comment above, want here: http://zsh.sourceforge.net/doc/release/prompt-expansion.html details on how change displayed path in zsh. in case if looking path relative home folder, include %~ in zsh-theme file. prompt this: ps1='${ssh_connection+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[green]%}location: %~%{$reset_color%}$(git_prompt_info) ' note, changed 1 character in prompt. %c swapped %~ . %c give current directory ( see document link above, or here ) for full path use %/

reactjs - React Native: undefined is not an object (evaluating '_this.setState') -

i'm @ bit of loss why i'm getting error message in simulator code below. line # indicated in comment. this.setstate seems in correct object format. fetchdata: function() { fetch(apiurl) .then((response) => response.json()) .then((responsedata) => { this.collectresponses(responsedata); }) .then((responseobject) => { this.sortpredictions(responseobject); }) .then((predictionsobj) => { this.setstate({ // error here! castroinktlm: predictionsobj['5728'], churchinktlm: predictionsobj['5726'], churchinj: predictionsobj['4006'], churchinn: predictionsobj['4448'], montgout: predictionsobj['6994'], church37in: predictionsobj['7073'], church37out: predictionsobj['5667'], castro37out: predictionsobj['3325'], castro33in: predictionsobj['3255'],...

json - Meaning of Registry returned 403 for PUT -

i trying add new tag package's dist-tags. @ first warning, registry returned 403 . why happening? can add a_new_tag dist-tags? $ cat package.json { "name": "@kilojoules/tutorial_npm", "version": "1.0.5", "repository": { "type": "git", "url": "thefieldentry" }, "description": "for tutorial!", "main": "index.js", "scripts": { "test": "node test.js" }, "author": "", "license": "isc", "dependencies": { "@linclark/pkg": "^1.0.2" }, "devdependencies": {} } $ npm dist-tag add @kilojoules/tutorial_npm@1.0.5 a_new_tag npm err! linux 4.2.0-c9 npm err! argv "/home/ubuntu/.nvm/versions/node/v4.1.1/bin/node" "/home/ubuntu/.nvm/versions/node/v4.1.1/bin/npm" "dist-tag" "add...

python - Django Rest Framework: Correct way to serialize ListFields -

based on drf documentation have created list of email_id stored in model in following way models.py class userdata(models.model): emails = models.charfield(max_length=100,blank=false) in serializers.py file class userserializer(serializers.modelserializer): emails = serializers.listfield(child = serializers.emailfield()) while posting data, drf page shows data in expected format, i.e "emails": [ "bal@bal.com" ], but, if query same data using python or rest client. data in following format data = json.load(urllib2.urlopen("http://localhost:8000/blah/id")) in [46]: d['emails'] out[46]: [u'[', u'u', u"'", u'b', u'a', u'l', u'@', u'b', u'a', u'l', u'.', u'c', u'o', u'm', u"'", u']'] ideally, should have been d['emails'] = ['bal@bal.com'] ...

jquery - Can I serve gzipped JSON from GitHub Pages? -

i have json file on github pages, it's 2 mb uncompressed. access file via jquery's $.get() method. i'd gzip file, shrinks 500 kb, when put gzipped file on github pages, $.get() doesn't work error: uncaught syntaxerror: unexpected token i think problem github pages doesn't set content-encoding: gzip header on json file, , request thinks it's dealing plain json file. there way either: force github pages add content-encoding: gzip header .json file, or configure ajax request knows it's dealing gzipped json file, though server hasn't told content zipped github pages gziping html, css, js, json,... it's useless try better gziping json yourself. a 1.3m json sent 357kb 1 github pages. see here , click on "load json" link.

Delete cookie created in PHP using javascript action -

i created cookie in php: function set_newuser_cookie() { if ( !is_admin() && !isset($_cookie['sitename_newvisitor'])) { setcookie( 'sitename_newvisitor', 1, time()+3600*24*365, cookiepath, cookie_domain, false); } } add_action( 'init', 'set_newuser_cookie'); i want delete cookie in javascript file after click event, so: $('.tbf-main-logo-image').on('click', function() { document.cookie = 'sitename_newvisitor=;expires=thu, 01-jan-70 00:00:01 gmt;'; }); i have been on every stack overflow thread pertaining issue , have tried: adding path cookie, made delete_cookie function, using jquery $.removecookie . nothing seems working. 1 thought perhaps everytime header loading recreating cookie? no, shouldn't because have if statement looking cookie name. help!

sql - Looping between different lists in python -

i'm trying pull different data sets sql python using different lists. example have following data: years = [2006, 2007, 2008] 2006 = [a, b, c, d, e] 2007 = [d, e, f, g, h, i, j, k] 2008 = [e, f, g] then pull data in, i'm using following formulas: df = pd.read_sql('select %s table' % (str(x)), con=conn) i'd string, str(x), loop through each year first, use list corresponding year. so, first should 2006 , loop through 2006 list (a, b, c, d, e), run rest of program, move on 2007 , 2008. i've used loops before not sure how loop between different lists. if understand correctly, might want express data hierarchically: years = { 2006: ['a', 'b', 'c', 'd', 'e'], 2007: ['d', 'e', 'f', 'g', 'h', 'i', 'j', 'k'], 2008: ['e', 'f', 'g'], } you loop on years , on letters each year this: for year, letters in y...

Git-svn - import full history -

problem by default git svn clone imports history branch creation onwards, despite fact, history files present in svn repository prior branch creation. our svn branch created svn copy , if matters. my attempts i've tried --no-minimize-url , --follow-parent , without success. produced git repository same without these params, starting branch creation. desired result git repository full history svn repository creation. update actual command line git svn clone http://svnserver/repo/dir1/dir2/project . what helped -t argument resulting command git svn clone http://svnserver/repo/ -t dir1/dir2/project many ! by default git svn clone imports history branch creation onwards, despite fact, history files present in svn repository prior branch creation. yes. true. git svn try import branches branches if told so. manpage of git-svn: when cloning svn repository, if none of options describing repository layout used (--trunk, --tags, --branches, ...

matlab - Activate a specific figure when returning from a nested function -

i have plotting function inside imshow() command. the plot , image should in separate figures. at return inside function current figure of plot imshow() puts image onto same figure of plot , kills plot. what can done make imshow() open or existing own figure, while keeping such manner of nested function calling? well, apparently, i've found answer time done question, because find interesting enough , find nothing answering i'm writing answer well. the algo this: open figure before imshow(nested_function()); upon starting nested_function() save handle previous figure fh_prev = gcf; example do plots along nested_function() before return nested_function() activate previous figure command figure(fh_prev);

jquery - How to render form in Bootstrap modal in Rails? -

i using bootstrap modal in rails app. code have right now: index page: <button type="button" class="btn btn-primary" data-amount="30" data-toggle="modal" data-target=".bs-example-modal-sm">process payment</button> <%= render 'point_transactions/payment'%> jquery bootstrap modal: $('#mymodal').on('shown.bs.modal', function() { $('#myinput').focus() }) my form processing braintree payment <div class="modal fade bs-example-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mysmallmodallabel"> <div class="modal-dialog modal-sm"> <div class="modal-content"> <%=form_for point_transactions_path, url: point_transactions_path |f| %> <div id="payment-form"></div> <br> <%=f .submit 'submit', class: 'bt...

zend framework2 - ZF2 ServiceManager Factory Object Instance stored or Lazy Loaded? -

i working on large project db has many tables accessed in different modules different reasons. came idea of using service manager point factory classes instantiate tablegateway models , return them on request, lazy loading tablegateway model. however still unsure whether or not factories in servicemanager lazy loaded or they're instantiated servicemanager? i.e., if have in configuration file array( 'service_manager' => array( 'factories => array( 'giftcard_table' => 'giftcard\factory\giftcardtablefactory', ), ), ); will new instance of giftcard\factory\giftcardtablefactory created every time call $sm->get('giftcard_table') ? or gets instantiated along servicemanager @ beginning of every http request regardless of whether call $sm->get('giftcard_table') or not? the factories instantiated when request them via service manager's get method. method calls create...

MySQL SELECT rows which respond to specific MULTIPLE values in one of the columns -

i've looked on web, , in stackoverflow well, , have found many similar topics, none answers needs. i'm sending out there, knowing there's little thing i'm missing in order work. let's imagine following table: location | title | description | quantity ============|===========|=============|========== shelf | apple | red | 2 drawer | banana | yellow | 4 shelf | kiwi | green | 2 cupboard | lemon | yellow | 1 fridge | melon | orange | 3 drawer | peach | orange | 1 what want select table items either in drawer or on shelf (so drawer , shelf ) , order them by, example, first, location ascending and, second, quantity descending. so have (after searching on web) following code, 1 doesn't return error, but doesn't return items either: select * items location = 'shelf' , location = 'drawer' o...

javascript - selectize.js doesn't work with remote url -

i'm using selectize this: $('#category_field').selectize({ valuefield: 'name', searchfield: 'name', delimiter: "/", options: [], load: function(query,callback) { if(!query.length) return callback(); $.ajax({ url: '/categories/autocomplete', type: 'get', datatype: 'jsonp', data: { }, error: function() { callback(); }, success: function(res) { callback(res.movies); } }); } } ); "#category_field" form input of type text. i verified ajax request being made , response server looks this: [ { "_id": { "$oid": ...

osx - How do I launch multiple instances of Xamarin Studio on the Mac (Visual Studio for Mac)? -

this question has answer here: how can launch multiple instances of monodevelop on mac? 10 answers i'd have multiple copies of xamarin studio running simultaneously. once 1 copy running, double-clicking xamarin studio icon in /applications or clicking currently-running dock icon brings current 1 foreground. just want tool? if want download you, there ms solution launcher or older xamarin studio launcher v3 . presumably, similar script below comes in nice pre-built app distinct icon copy application folder. well, can set target opening .sln files, allowing launch new xamarin studio instance when double-click solution file. do yourself just described monodevelop , can force new instance command line. well, applescript side-trip described monodevelop , can in form of app icon. the difference between monodevelop script , new xamarin studio version...