Posts

Showing posts from September, 2015

python - Skip/pass over view function so the next can execute in Flask -

i have flask app has following: @app.route('/') def home(): return "homepage" @app.route('/<slug>') def feature(slug): return "feature: " + slug @app.route('/<path:url>') def catch(url): return "catch: " + url this works in in following true: get / => "homepage" get /test1 => "feature: test1" get /test/2 => "catch: test/2" eventually, database driven. features, retrieved , displayed based on slug. catch , they'll loaded database , may result in behaviour such redirect, or return 404. none of problem. my question this: in /test1 example, i'd achieve following behaviour: attempt load database slug matches test1 if exists, fine. display. if not exist, i'd "fall through" catch view function. point 3 part don't know how achieve. seems ought exist, can't find kind of "fall through next matching view function&q

expression - bash variable evaluating with quote for special character -

below simple bash script test few password in rar file. when password contains special character (!), see option (-p) parsed quote ('). #!/bin/bash -x pwd=`echo sei{0..9}{0..9}b{0..9}axq!zx` #pwd=sei03b4axq!zx file="test.rar" eachpwd in $pwd eval unrar x "$file" -p"$eachpwd" id 2>/dev/null 1>/dev/null c=$? if [ $c = 0 ] echo "success" exit fi echo $eachpwd $c done output + eachpwd in '$pwd' + eval unrar x test.rar '-psei49b4axq!zx' id + c=10 + '[' 10 = 0 ']' + echo 'sei49b4axq!zx' 10 question how code such that, during eval not unrar x test.rar '-psei49b4axq!zx' id instead unrar x test.rar -psei49b4axq!zx id evaluated expression update 1 tried below code, still quote(!) on -p option refuses budge. passwords=( sei{0..9}{0..9}b{0..9}axq!zx ) file=test.rar password in "${passwords[@]}"; if unrar x "$file" -

c# - Connection String Trouble MetaDataException -

i got 2 models in project. when added second models got error in account page: system.data.metadataexception: specified schema not valid. errors: (8.6): error 0040: nclob type not qualified namespace or alias. primitive types can used without qualification. @ line 34 of `initializesimplemembershipattribute.cs` : using (var context = new userscontext()) ligne 33 : { ligne 34 : if (!context.database.exists()) ligne 35 : { ligne 36 : // create simplemembership database without entity framework migration schema and connection string : <connectionstrings> <add name="defaultconnection" connectionstring="user id=devart;password=1234;data source=localhost:1521" providername="devart.data.oracle" /> <add name="entities" connectionstring="metadata=res://*/models.modelmae.csdl|res://*/models.modelmae.ssdl|res://*/models

html - jQuery appending multiple line string -

i'm trying append string html element. works fine when it's 1 line string, when try break apart stops working. <div><h4 >list do:</h4><span id="added"></span></div> this doesn't work: var addtext = "<ol> <li>item1</li> <li>item2</li> </ol>" $("span#added").html(addtext); can make work. want add lot of html code, , i'd readable? try : var addtext = "<ol>\ <li>item1</li>\ <li>item2</li>\ </ol>";

ruby - How does Domino deal with a dashed class name -

i'm attempting create , use domino abstract login page describe :index, :type => :request before visit '/' blah_email_login('user1') end ... def blah_email_login(user) dom::email_link.find_by_name 'mail'.click .... end module dom class email_link < domino selector 'a' attribute :tab-label end here html <a class="tab-label fz-xs accent " href="https://mail.blah.com/..." id="blah"><span class="tab-icon img-sprite"></span><em class="strong tab-link-txt y-link-1 " title="mail">mail</em></a> the process cannot take dash indicated error pre run c:\blah.rb:93:in `<class:email_link>': undefined local variable or method `label' dom::email_link:class (nameerror) when attempted alter attribute to attribute :'tab-label' i got ... c:/railsinstaller/ruby1.9.3/lib/ruby/gems/1.9.1/gems/domino-0.5.0/lib/

c++ - auto vectorization - array reduction -

i'm trying vectorize simple reduction loop: #ifndef poissonsolverjacobi_hpp #define poissonsolverjacobi_hpp #include <stdlib.h> class p{ public: p(); void iterate(); protected: float* m_func; unsigned int m_maxit; }; p::p(){ m_func=(float*)calloc(5000,sizeof(float)); m_maxit=5000; } void p::iterate(){ float err(0.); for(unsigned int i(0);i< m_maxit;i++){ err+=m_func[i]; } } #endif using following compiling command gcc 4.6.3 -march=x86_64: g++ -c -o3 -msse2 -ftree-vectorizer-verbose=2 -fassociative-math -funsafe-math-optimizations could me point out why fails?

openssl - SSL convert url to .crt -

how can convert url .crt file? https://mxr.mozilla.org/mozilla/source/security/nss/lib/ckfw/builtins/certdata.txt?raw=1 please not perl. have openssl & jvakeyutil want create truststore.jks http://curl.haxx.se/docs/caextract.html has want. contains data converted in format want. if want convert data @ source code of mk-ca-bundle perl program used create converted data.

flash - Actionscript 3.0: Cannot get key input -

guys. created little game. nothing happening thought, because im not getting keyboard input. spend time trying create own taht didnt work. copy/pasted code official actionscript 3.0 reference page, tweaked game (but didnt touch related keyboard stuff). thing game returns in cosnole false import flash.ui.keyboard; import flash.events.event; import flash.events.keyboardevent; stop(); var left = false; var right = false; var speed = 0.3; player.addeventlistener(keyboardevent.key_down, keydf); player.addeventlistener(keyboardevent.key_up, keyuf); player.addeventlistener(event.enter_frame, updf); function keydf(event:keyboardevent):void { trace("test0"); if(event.keycode == keyboard.d) { trace("test1"); left = true; } if(event.keycode == keyboard.a) { right = true; } } function keyuf(event:keyboardevent):void { trace("test2"); if(event.keycode == keyboard.d) { left = false; } if(ev

html - Debugging CSS with multiple CSS files -

in our application use bootstrap , there multiple css files used. recently, had issue there border created around input box. border css input types over-ridden in particular css file. i tried use chrome dev tools identify css file input box picking (for color) reason not identifying correct css files. borders, shape , size mentioning inheriting parent never mentioning parent css file. is there better tool correctly points css component using? is there better tool correctly points css component using? firebug great & developed. works in firefox, should not big deal basic css debugging purposes. in general there no 1 tool debug things this. jumping around tool tool things right. it’s nature of front-end web development. but in general, might not have touch parent css deal issue. target element in css—if not being targeted—and use !important force new setting override others parent styles. however, balance, "!important" declaration (the de

node.js - Breaking up node module code (for a library/api client) -

i'm writing node module consume rest api service. intents , purposes might it's twitter (though it's not). the api not small. on dozen endpoints. given want offer convenience methods each of endpoints need split code on multiple files. 1 file far large. right testing pattern outline below, appreciate advice other means might break code. goal extend prototype of single object, using multiple files. here's "model" i'm using far, don't think idea: twitterclient.js function twitterclient(){ this.foo = "bar"; } require("fs").readdirsync("./endpoints").foreach(function(file) { require("./endpoints/" + file)(twitterclient); }); var exports = module.exports = twitterclient; endpoints/endpointa.js etc module.exports = function(twitterclient){ twitterclient.prototype.somemethod = function(){ //do things here } } the basic idea file in endpoints folder automatically loaded , twitterclient p

Using a Java EE Bean to Save a List of Form Data and print out data in a JSF XHTML DataTable -

here how application works. 1.user fills out "voter registration" xhtml form. 2.when user clicks submit, values saved through using sessionscoped cdi java-ee file. here contents of file: import java.io.serializable; import javax.enterprise.context.sessionscoped; import javax.inject.named; @named @sessionscoped public class voterbean implements serializable{ private string firstname; private string lastname; private string address; private string city; private string state; private string zip; private string phone; private string affil; public voterbean(){ } public string getfirstname(){ return firstname; } public string getlastname(){ return lastname; } public string getaddress(){ return address; } public string getcity(){ return city; } public string getstate(){ return state; } public string getzip(){ return zip; } public string get

heatmap - Plotting z as a color with R on a rGoogleMap -

Image
i have function , want plot x , y . z should represented color. there package work me ? f = function(a,b){ dnorm(a^2+b^2) } x = seq(-2, 2, 0.1) y = seq(-2, 2, 0.1) z = outer(x, y, f) persp(x, y, z) i want plot function on map generated rgooglemaps . maybe there more specific package use? something this? library(ggmap) # loads ggplot2 library(rgooglemaps) # getgeocode london.center <- getgeocode("london") london <- get_map("london", zoom=12) x <- seq(-2,2,0.1) df <- expand.grid(x=x,y=x) df$z <- with(df,f(x,y)) df$x <- london.center[2]+df$x/20 df$y <- london.center[1]+df$y/20 ggp <- ggmap(london)+ geom_tile(data=df,aes(x=x,y=y,fill=z), alpha=0.2)+ scale_fill_gradientn(guide="none",colours=rev(heat.colors(10)))+ stat_contour(data=df, aes(x=x, y=y, z=z, color=..level..), geom="path", size=1)+ scale_color_gradientn(colours=rev(heat.colors(10))) plot(ggp) this solution uses g

How do I completely hide the chart title in a HighCharts chart? -

i notice that: title: { text: title, } can customise content of title if need chart without title? should do? try remove code above , got "chart title" instead of having nothing - expected. thanks, title: { text: '' } or title: { text: null }

ios7 - Does CGGlyph depend on the font size? -

cgglyph typedef unsigned short. every font can (or @ least could) specify different cgglyph value same character. within same font, value of cgglyph depend on font size? basically want show same character different font sizes. can set font size cgcontextsetfontsize() , reuse cgglyph value? cgglyph holds index of glyph inside font. because inside font, order of glyphs (individual character designs) can -- in particular, unrelated character code represents. that is, order of characters in fonts unrelated encoding. character code of "a" 65 (in ascii) not mean "the 65th character in font glyph "a". unicode it's impossible make work way: unicode of curly left double quote, example, u+201c, or 8220 in decimal. so there 1 or more tables inside each font translate between logical index of glyph (simply counting characters appear in file itself) , 1 or more encodings . (where encoding predefined set, such "unicode", "macroman&qu

lua - How to change image based on number of taps in Corona? -

i'm using corona sdk , have this. when tap on image number increases. wonder how change image once reached amount of clicks? display.setstatusbar(display.hiddenstatusbar) local newbutton = display.newimage ("button.png",0,0) newbutton.x = display.contentwidth - 60 newbutton.y = display.contentheight - 62.5 local number = 0 local textfield = display.newtext(number, 30, 30, native.systemfont, 25) local function movebuttonrandom(event) number = number + 1 textfield:removeself() textfield = display.newtext(number, 30, 30, native.systemfont, 25) end newbutton:addeventlistener("tap", movebuttonrandom) the best practice use sprite , when increment point, tell sprite play next frame. there multiple tutorial on working imagesheets , sprites here: http://coronalabs.com/resources/tutorials/images-audio-video-animation/ rob

matplotlib - python pyplot.quiver: Scaling of two superimposed vector fields -

i want plot 2 vector fields in 1 quiver plot. working: each point, there 2 vectors in different colors. problem is, scaling not same: e.g. vector (1,0) first field ( sol ) displayed length (1,0) field 2 ( res ). how can make quiver plot both fields same scale, (1,0) res has same physical length on plot (1,0) sol ? my code: import numpy np matplotlib import pyplot plt #res , sol 2 vector fields dimension (ny, nx ,2) step=3 #not vectors should plotted. every third 1 (in x , y direction) x,y = np.meshgrid(np.arange(0,nx,step), np.arange(0,ny,step)) q=plt.quiver(x,y,sol[::step,::step,0], sol[::step,::step,1], color='r') w=plt.quiver(x,y,res[::step,::step,0], res[::step,::step,1], color='b') plt.quiverkey(q, 0.4, 0.15, 1, r'text1', labelpos='s') plt.quiverkey(w, 0.6, 0.15, 1, r'text2', labelpos='s') plt.show() you have 2 solutions: normalize input data , scale it tell quiver how scale data soluti

php - mod_rewrite redirect to clean URLs -

i'm using mod_rewrite in .htaccess create following clean urls. .htaccess rewriteengine on rewriterule ^home$ /index.php [l] rewriterule ^groups$ /groups.php [l] rewriterule ^contact$ /contact.php [l] rewriterule ^personalise$ /personalise.php [l] rewriterule ^terms$ /terms.php [l] all works i've been trying original links redirect smooth links. example, if visits www.mydomain.com they'll redirected www.mydomain.com/home , likewise if trail domain index.php or other page name. i've had @ few different rules don't seem work, i'm not familiar module. ideas appreciated! i giving 2 of these new rules: to redirect index.php /home to remove .php extension your full .htaccess: rewriteengine on rewritecond %{the_request} \s/+index\.php[\s?] [nc] rewriterule ^ /home [r=301,l,ne] rewritecond %{the_request} \s/+(.*?)\.php[\s?] [nc] rewriterule ^ /%1 [r=301,l,ne] rewriterule ^home$ /index.php [l] rewriterule ^groups$ /groups.php [l] rewr

XAML call TabItem Unload event programmatically -

i'm quite new xaml i'm hoping simple question. my main window has tabcontrol , on cases, call unload event on tab. the mainview xaml looks this: <window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:views="clr-namespace:namespace.project1.views" x:class="namespace.project1.views.mainwindow" width="500" height="500" title="hello world"> <grid> <tabcontrol x:name="mytabs" horizontalalignment="stretch" verticalalignment="stretch" > <tabitem header="live" name="childview"> <views:childview horizontalalignment="stretch" verticalalignment="stretch" /> </tabitem> <tabitem header="playback" name

python - Cython memoryviews on Windows -

when trying use cython on windows (anaconda-based install, using tdm-gcc need support openmp), ran error when using typed memoryviews. test1.pyx def test(int x): pass test2.pyx def test(int[:] x): pass both modules can compiled basic setup.py (using cythonize), while test1 can imported no problem, importing test2 raises following: python3 -c "import test2" (<- note use of python3 -- haven't tried python2) traceback (most recent call last): file "<string>", line 1, in <module> file "stringsource", line 275, in init test2 (test2.c:13146) unicodedecodeerror: 'utf-8' codec can't decode byte in position 1: invalid start byte. with nothing special @ line 13146 of test.c, apparently. is known issue? or doing wrong? welcome. (crossposted cython-users) clarifications: again, please note using python 3 (in fact, bug doesn't appear python 2). i using clean install conda environment, using python 3.4.1 ,

jQuery UI Dialog Buttons not showing -

Image
i'm attempting use jquery ui dialog box within version of x-cart. problem buttons dialog not show whatsoever. here latest jsfiddle showcasing functionality trying implement. http://jsfiddle.net/iiminov/jsa3a/65/ when go , implement version of x-cart following errors, , hence buttons not show: uncaught typeerror: undefined not function the line in occurs upon this: as not debugging javascript/jquery hoping here shed light on how fix issue?

Neo4j: Issue updating from 2.0.1 to 2.1.1 -

right after updating neo4j 2.0.1 2.1.1, got error: starting neo4j server failed: startup failed due preflight task [class org.neo4j.server.preflight.performupgradeifnecessary]: unable upgrade database (windows vista x64) while store upgrades not required 2.1 update, may if make following configuration changes. in neo4j.properties configuration file, uncomment second line below. # enable able upgrade store older version #allow_store_upgrade=true make sure backup database folder before proceeding restart database.

entity framework 6 - DbContext constructor connection string error keyword name not supported -

the entity framework documentation states can use named parameter when supplying connection string: public class bloggingcontext : dbcontext { public bloggingcontext() : base("name=bloggingcompactdatabase") { } } i don't bother named parameter: public tspdbcontext() : base("viktorvooey") { } but thought i'd give go confirmation: public tspdbcontext() : base("name=viktorvooey") { } and fails saying keyword not supported : name this on ef6. i'm sort of stuck between not caring still wanting know "what's that" same. i came across post because had same error. msdn documentation ef 6 dbcontext explcitly states 'name=' part of constructor string parameter supported , means: the name can passed in form 'name=myname', in case name must found in config file or exception thrown. in other words "name=" prefix forces ef config

javascript - How to make the code shorter with keeping loop? -

how make code shorter keeping loop? var age = prompt("what age"); (var i=18; i<=age ; i++){ alert ("welcome"); break } (var i=18; i>age ; i++){ alert ("sorry, under 18"); break } an awful lot of example code seems wrong. using loops should using conditionals , loop conditions not trigger until numeric overflow, except unconditionally break loops anyway (which further suggests want using conditionals, not loop). what want this: if( age >= 18) { alert("welcome"); } else { alert("sorry, under 18"); }

c++ - delete in threads gives a segmentation fault -

this program counts occurrence of word in line. runs expected, have 2 concerns: delete tmp commented of (line 57). if uncommented , compiled, executable gives "segmentation fault". oddly, doesn't crash while running in gdb nor valgrind . lines 65 , 66: ideally these threads need joined. but, getting correct output though not joined. how behaves shared (volatile) variable? #include <iostream> #include <stdio.h> #include <string.h> #include <pthread.h> #include <unistd.h> #include <fstream> #include <new> #define max_buff 1000 using namespace std; volatile int tcount=0; pthread_mutex_t mymux; typedef struct data { string line; string arg; }tdata; void *calcwordcount(void *arg) { tdata *tmp = (tdata *)arg; string line = tmp->line; string s = tmp->arg; int startpos = 0; int finds = 0; while ((startpos = line.find(s, startpos)) != std::string::npos) { ++finds;

javascript - on('click') function fires on second click -

i have problem, got li toggles whenever element clicked, problem i'm trying navigate window center li when "click" element click. it's working problem is, script works on second click? my theory since li in display:none , it's not reading on first click, rather on second click. there anyway solve in way fire toggle plus window navigation @ same time? and there way move dynamically(animate) in smooth way? thanks guys! sample jsfiddle $(document).on('click', "#click", function(){ var viewportheight = $(window).height(), foo = $('ul li:nth-child(2)'), elheight = foo.height(), eloffset = foo.offset(); $(window).scrolltop(eloffset.top + (elheight/2) - (viewportheight/2)); $(foo).slidetoggle(); }); first mate try set visibility: hidden; not display none if not work too, try set timer work when click directly, time call calculate function again ... , work .. can test more easy .. add under

ios - Call event every random number -

im trying work out how event every random number. using following random number between 50 + 100 int x = (arc4random() % 50) + 50; i want call selector based on returned value so. [_hero schedule:@selector(randomanimation) interval:x]; im trying work out in head how rerun schedule after random time new random time . in _hero class randomanimation method : -(void) randomanimation { // animation stuff here // int x = (arc4random() % 50) + 50; [self scheduleonce:@selector(randomanimation) delay:x]; } and fire sequence [_hero randomanimation]; edit : if dont want expose randomanimation method, fire animation when object added scene : -(void) onenter { [super onenter]; [self randomanimation]; }

How to highlight spaces in a tag? (CSS only) -

i have tag <span class="block" style="width:12px;height:17px">&nbsp;tttt&nbsp;ttt&nbsp;ttttt</span> i want highlight &nbsp; . how can using css ? well there no such way select space, if reason want then, can try this: <span class="block" style="width:12px;height:17px"><span style="background-color:#f00;">&nbsp;</span>tttt<span style="background-color:#f00;">&nbsp;</span>ttt&nbsp;ttttt</span> put   within span <span style="background-color:#f00;">&nbsp;</span>

ruby - Why does the Gemfile semantic versioning operator (~>) produce inconsistent results with one number? -

the gemspec semantic versioning operator ~> (aka twiddle-wakka , aka pessimistic operator) allows gem version constrained yet allow upgrades. i have seen can read as: "~> 3.1" => "any version 3.x, @ least 3.1" "~> 3.1.1" => "any version 3.1.x, @ least 3.1.1" but 1 number, rule breaks down: "~> 3" => "any version x, @ least 3" *not true!* "~> 3" => "any version 3.x" *true. why?* if wanted "any version 3.x", use "~> 3.0", consistent. stands, change of operation @ 1 number inconsistent , undocumented. moreover, if wanted "any version higher or equal 3" (so 3.x, 4.x etc...) tempted use ">=" operator, told is evil . is there reason behaviour? edit: i'm giving david finding culprit file in rubygems. there "feature" silently expands "3" "3.0" ( line 148 i

php - twilio from number required -

trying basic function using twilio , have come across problem. wants number, though have supplied it. thoughts? <?php require_once('services/twilio.php'); $twilionumber = "somevalidnumber"; $dest = "somevaliddestination"; $accountsid = "validsid"; $authtoken = "validtoken"; $client = new services_twilio($accountsid, $authtoken); try { $message = $client->account->messages->create( $twilionumber, $dest, "hello world!"); } catch (services_twilio_restexception $e) { echo $e->getmessage(); } ?> results in: php warning: invalid argument supplied foreach() in /var/www/html/sms/services/twilio.php on line 248 'from' phone number required. the docs bit misleading. change account->messages->create to account->messages->sendmessage and works fine.

2d - Adventure game in QML only? -

i implement simple 2d adventure game desktop , android using qml(qt modeling language). the game have different places, e.g. kitchen , cellar. place has typically background image, , objects in place. these might things need find , collect, or can simple sprites, bird flying through room. i have written small first version 1 place, works fine. extend game. i implement places isolated , separately, can switch between places, e.g. go kitchen cellar, , places can added. i looking appropriate way in qml only, seems there none. does have idea, how this? google hasn't helped me far. i kinda agree kakadu not concrete question. wanted reply though, because question sounds similar small side project i'm working on, i'm using flickable view onto levels, , each level can item, image, etc. when player gets either edge of level, current level sets opacity 0 , sets parent property null. new level sets parent flickable (view). so, there ways this, , i'd recomm

RPM packages: distinguish “requested install” from “installed to satisfy dependencies” -

how can determine packages installed because i requested installation , packages automatically installed in order satisfy dependencies ? (this same this question debian systems. ) at least of centos 5 don't believe there such ability or marking in rpm/yum. you can find out, using package-cleanup --leaves yum-utils package, installed packages leaves in rpm database. (add --all have include non-library packages in list.)

javascript - Meteor Fiber Email -

i'm attempting send simple email (locally, environment variables aren't set), , get: error: meteor code must run within fiber. try wrapping callbacks pass non-meteor libraries meteor.bindenvironment. here's code meteor.methods({ sendinviteemail: function(emails) { console.log("[sendinviteemails], ", emails); if (emails !== void 0) { console.log("[sendinviteemails] calling meteor method: sendemail"); return meteor.call("sendemail", emails, "email@gmail.com", "test", "test"); } }, sendemail: function(to, from, subject, text) { this.unblock(); email.send({ to: to, from: from, subject: subject, text: text, }); }, }); i'm on calling sendinviteemail (will checking validaty on server) client , passing data sendemail (which why have bit of redudancy currently). code docs.meteor.com, i'm wondering why present fiber issue. tha

objective c - Accessing the same view controller in a Storyboard by a subclass -

hullo, create new target project without overcrowding main view controller #ifdef's. thinking of splitting functions weaker superclass , have new target use top one. how configure new target attach top view controller view controller in storyboard instead of bottom 1 in old target? you have invoke , set view controller manually so: uistoryboard *storyboard = [uiapplication sharedapplication].keywindow.rootviewcontroller.storyboard; uiviewcontroller *myviewcontroller = [storyboard instantiateviewcontrollerwithidentifier:@"yourviewcontrolleridentifier"]; [[uiapplication sharedapplication].keywindow.rootviewcontroller presentviewcontroller:myviewcontroller animated:yes completion:nil];

php - Unexpected HTML result using List view JQuery -

my implementation @ : http://i.cs.hku.hk/~hsbashir/project_work/listview/list_view.html the first entry when list hardcoded. second , third ones when extracted server using xmlhttp object. unable understand why in 2nd & 3rd list formatting different. original html: <!doctype html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.css"> <script src="http://code.jquery.com/jquery-1.10.2.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.2/jquery.mobile-1.4.2.min.js"></script> <script> lastrecord=0; function loadnews(){ var xmlhttp; if (window.xmlhttprequest) { xmlhttp = new xmlhttprequest(); } else { xmlhttp = new activexobject("microsoft.xmlhttp"

osx - Postgresql installed on Mac OS X but no /usr/local/psql -

i have postgresql installed on mac os x, , can see it's installed because have running on port 5432. however, it's not using /usr/local/postgres it's root it's supposed to. how can tell it's installed? there problematic not being installed in location? here query show locations of files postgresql "knows" internally: select current_setting('data_directory') data_directory, current_setting('config_file') config_file, current_setting('hba_file') hba_file, current_setting('ident_file') ident_file, current_setting('external_pid_file') external_pid_file; you can check location of postmaster process command line with: ps aux | grep bin/postgres | head -n 1 | sed -e 's/.*[[:digit:]] //' pg_config located in same directory, can find out location of else there.

ios - Crash with "Symbol not found: _OBJC_CLASS_$_NSMutableURLRequest" -

i have installed app xcode 5.1.1 in debug mode on ipad 3 ios 7.1.1, show below in crash log. in day of installing app working fine. not using ipad 2 days , today crashes on splash screen, @ first second. restart of ios not helped. any ideas why happening? re-add cfnetwork , foundation frameworks project, in case, maybe it's other? bug in ios? incident identifier: 24087ce7-3ebe-4ffb-abc0-091495f774bf crashreporter key: 4d82b50f4190912e3298f7f5ba036ac01d4e6116 hardware model: ipad3,3 process: eau4 [131] path: /var/mobile/applications/ed697cb6-a7d5-4e54-be8f-e9b7f3d0d38c/eau4.app/eau4 identifier: com.develoer.ipad version: 4.0 (4.0) code type: arm (native) parent process: launchd [1] date/time: 2014-06-09 22:38:35.028 +0100 os version: ios 7.1.1 (11d201) report version: 104 exception type: exc_breakpoint (sigtrap) exception codes: 0x0000000000000001, 0x00000000e7ffdefe triggered th

javascript - Performance issues when hiding columns in jQuery DataTables -

i'm using datatable.column(index).visible(false) method hide columns in application. few hundred rows takes 5 seconds hiding couple of columns. know if possible speed up? maybe try setting http://datatables.net/reference/option/autowidth false?

php - Preg_match_all grab value from string -

example: $word = "your ip address=10.0.0.1</br>my ip address=127.0.0.1</br>"; how can taking ip address string using preg_match_all? a pragmatic attempt in case match between = , </br> : preg_match_all('~=(.*?)</br>~', $string, $matches); var_dump($matches); note ? marks ungreedy match. if omit following match: 10.0.0.1</br>my ip address=127.0.0.1 of course need preg_match_all() every match (ip) not first.

c++ - how to render sprites as true spheres? -

Image
i'm trying render fluid simulator liquid effect, here render result: but want result here geometry , pixel shader [maxvertexcount(4)] void maings(point gsps_input ginput[1],inout trianglestream<gsps_output> tristream) { float size = 0.065; matrix mv = view; float3 right = normalize(float3(mv._11,mv._21,mv._31)); float3 = normalize(float3(mv._12,mv._22,mv._32)); // float3 poseye = mul( float4(ginput[0].pos.xyz, 1.0),world).xyz; // float halfwidth = size/length(poseye); float halfheight = size/length(poseye); // float4 v[4]; v[0] = float4(ginput[0].pos + halfwidth*right - halfheight*up, 1.0f); v[1] = float4(ginput[0].pos + halfwidth*right + halfheight*up, 1.0f); v[2] = float4(ginput[0].pos - halfwidth*right - halfheight*up, 1.0f); v[3] = float4(ginput[0].pos - halfwidth*right + halfheight*up, 1.0f); // // gsps_output output; [unroll] for(int i=0; i<4; ++i) { // output.pos = m

Concatenating html object arrays with javascript -

i'm attempting merge 2 arrays made of html objects. reason using .concat() not work me. here's simple pen demonstrate problem: http://codepen.io/anon/pen/kieyb note: tried searching remotely similar found nothing answered question. i figure can ole fashion way using for-loops rather not re-invent wheel. var x = document.getelementbyid("hello"); var items = x.getelementsbyclassname("one"); //alert(items.length); var items2 = x.getelementsbyclassname("two"); //alert(items2.length); items = items.concat(items2); //alert(items.length); items , items2 nodelist or htmlcollection objects, not arrays. not contain .concat() method. have .length property , support [x] indexing, not have other array methods. a common workaround copy them actual array follows: // convert both arrays have full complement of array methods var array1 = array.prototype.slice.call(x.getelementsbyclassname("one"), 0); var array2 = array.pr

How can I Get the details from Root-CA-Cert certificate (x509) chain using c#? -

let's have 3 certificates (in base64 format) root | --- ca | --- cert (client/signing/whatever) how can data certificate chain in c#? (all 3 certs may in computer cert store) how can details root-ca-cert certificate (x509) chain using c#? how can data certificate chain in c#? ... how can details root-ca-cert certificate (x509) chain using c#? you can use .net's x509certificate class . has methods getcerthash , getpublickey , getserialnumber , geteffectivedatestring (i.e., notbefore), getexpirationdatestring (i.e., notafter ); , properties issuer , subject . for purposes of displaying information, there no difference between root certificate, intermediate certificate or server certificate. ca self signed (some hand waiving), means issuer , subject same. can root trust in intermediate, , not self signed. intermediate , server certificates, issuer , subject different. also, better visualization: root or ca | --- intermediate

angularjs - How to set value to $rootScope from text field on button click -

following want do, in javascript style. @ loading html div (token) should show ever value in $rootscope.token .then when ever button pressed after typing text in input field (tokeninp), need update $rootscope.token , displayed value in html. document.getelementbyid("token").innerhtml = $rootscope.token; function settoken(){ $rootscope.token = document.getelementbyid("tokeninp").value; document.getelementbyid("token").innerhtml = $rootscope.token; } how using angularjs (im new it) in html <span ng-bind="token"></span> <input type='text' ng-model='tokenvalue'> </input> <input type="button" ng-click='modifiedtokenvalue ()'/> in controller $scope.token = $rootscope.token; $scope.modifiedtokenvalue = function(){ $rootscope.token = $scope.tokenvalue; $scope.token = $scope.tokenvalue; };

math - Encoding mathematical properties in RDF -

Image
i have been trying find solution adding relationships, such x has unit a < 20 existing ontology, but, not find solution far. an existing knowledge graph - rdf - has many concepts , relationships. in attempt improve accuracy of inferences, trying add key properties few of concepts. example: concept x causes concept y. and, know concept y has property abc < 30 always. please suggest on how add kind of relationships few concepts in knowledge graph - rdf as mentioned in answer functions manipulate rdf collections in sparql , can mathematics in sparql, query language rdf. encoding arbitrary mathematical formulas (which title suggests), might interested in wenzel, ken, , heiner reinhardt. " mathematical computations linked data applications openmath ." joint proceedings of 24th workshop on openmath , 7th workshop on mathematical user interfaces (mathui). 2012. all said, you're describing here (that value of of property have value le

javascript - Google charts combine line and candlestick chart -

i have combine candlestick , line chart want show annotations values. possible display if how display annotation yes, can that. use combochart "line" , "candlestick" data series. use "annotation" role columns annotate data points.

c# - Pass xml as a parameter to a stored procedure in SQL Server -

i trying pass xml parameter c# code stored procedure in sql server doesn't work. public static void savereceipttrans(string psitecode, string xml) { try { string dbkey = "sn"; string connstr = encryption.decryptstring(configurationmanager.connectionstrings[dbkey].connectionstring); string cmdstr = "prc_pt_fac_iu"; sqlparameter[] sqlparams = new sqlparameter[1]; sqlparams[0] = new sqlparameter("@preceiptswithfactorynamecode", sqldbtype.xml); sqlparams[0].direction = parameterdirection.input; sqlparams[0].value = xml; int = sqlhelper.executenonquery(connstr, commandtype.storedprocedure, cmdstr, sqlparams); } catch (exception ex) { utillogging.logexception(ex, "error -> ", psitecode); } } but no operations done on tables through stored procedure if there no

.htaccess - htaccess convert request to clean url and add slash at the end of the url -

ok , searched more 4 days , more 20 posts here in stach or in websites without kind of success first here htaccess file rewriteengine on rewriterule ^([a-za-z0-9_]+)/?$ index.php?page=$1 [nc] rewriterule ^([a-za-z0-9_]+)\/([a-za-z0-9_]+)\/?$ index.php?page=$1&action=$2 [nc] i tried many codes 1 worked me can call request , works me www.example.com/pagename => www.example.com/index.php?page=pagename here questions , please provide me information "in detail" understand code well 1- how convert request automatically www.example.com/index.php?page=pagename www.example.com/pagename 2- if tried add slash @ end shows me page without images or styling mean www.example.com/pagename => works www.example.com/pagename/ => doesn't work that's :) for first part need 301 rule this: rewritecond %{the_request} /index\.php\?page=([^\s&]+) [nc] rewriterule ^ /%1? [r=301,l] for second part use absolute path in css, js, images files r

Excel VBA Paste Special -

i trying eliminate manual process user doing. have vba button when clicked parse text on sheet sheet. the procedure goes: 1. copy contents html site 2. paste contents clipboard "paste special" text excel sheet 3. click button they doing hundred of times day , requested if can step 1 , step 3. what needed replicate paste special "text" sheet, possible? entirely possible. case of using .pastespecial format:="text" http://msdn.microsoft.com/en-us/library/office/ff839476(v=office.15).aspx

.net - How to declare dynamic array in c# -

i working on silverligth5 (my previous experience c++)and have create dynamic array size decided dynamically. until have static , it's this: string[] position = new string[20]; //it must dynamic don't want fix 20 (int = 0; < pv.root.parameter.count; i++) { if (name == pv.root.parameter[i].name) { position[i] = name; } } as can seen way have size 20 , want of same length pv.root.parameter.count . how achieve ? edit/ problem when try achieve through list : have problem @ line : if (pv.root.parameter[loopcount].name == position[loopcount]) { rowgrid.opacity=0.3; } because surely not work position[loopcount] because position list , cannot indexed this. how index ? pass pv.root.parameter.count instead of 20 array length. string[] position = new string[pv.root.parameter.count]; or use list , if don't want fixed size.

ios - Core Motion Swift Closure issue -

i'm trying convert old game application built in obj-c new swift code. i'm having issues understanding swift closures , how use them example in the"startaccelerometerupdatestoqueue" method. i have initialized motion manager in way motionmanager!.accelerometerupdateinterval = (1/40) then in viewdidload of view controller var queue:nsoperationqueue motionmanager?.startaccelerometerupdatestoqueue(queue, withhandler: {(accelerometerdata : cmaccelerometerdata, error : nserror) in }) the "startaccelerometerupdatestoqueue" giving me error , i'm pretty sure didn't understand correct closure syntax. any ideas? actually, got signature wrong – arguments closure need optionals (since passed objective-c, nil ). because of that, arguments provide don't match existing method signature, , because of error. take @ ios 8 api docs , provide swift signatures: func startaccelerometerupdatestoqueue(_ queue: nsoperationqueue!,

JSF session timeout and primefaces push -

i have session timeout set in web.xml <session-config> <session-timeout>1</session-timeout> </session-config> and track down implementation of httpsessionlistener. tested , see creation , destroying of each session - work fine. but, after adding push services in app, etc: xhtml: <p:socket channel="/chat-notif"> <p:ajax event="message" global="false" update="label-chat-new-msg :f_chat_list :form-chat-conversation" /> </p:socket> bean: eventbus eventbus = eventbusfactory.getdefault().eventbus(); eventbus.publish(push_chat__message, "new-msg"); resource: @pushendpoint(chatcontroller.push_chat_message) public class chatmessageresource { @onmessage(encoders = { jsonencoder.class }) public string onmessage(string finis) { return finis; } } session has never timeout , since push on periodic interval communicate client page , update session idle

Order sql table by descending order in C# -

Image
since id column ordered asc order, want change ordering desc order. have following table i'm using following code in order perform desc ordering, nothing happens in table. private void button4_click(object sender, eventargs e) { string columnname = textbox9.text; try { using (sqlconnection cn = new sqlconnection(@"data source=(localdb)\v11.0;attachdbfilename=|datadirectory|\produkt.mdf;integrated security=true")) { cn.open(); using (sqlcommand command = new sqlcommand("select id, navn, varenr, antal, enhed, priseksklmoms, konto produkttable order [" + columnname + "] desc", cn)) { command.executenonquery(); } } } catch (exception ex) { messagebox.show("error\n" + ex.message, "error", messageboxbuttons.ok, messageboxicon.error);

java - Object initialization failed in static block -

i want create array of class objects , initialize without using method wrote code this: package test; public class test2 { private test2() { } static test2[] arr = new test2[10]; static { (test2 ob : arr) { ob = new test2(); } (test2 ob : arr) { system.out.println(ob); } } public static void main(string args[]) { } } but when run program, o/p: null null null null .... why happening? seems constructor not called when create new object for (test2 ob : arr) { gives copy of reference each element in arr . when write ob = new test2(); you're changing ob referring to. doesn't change what's in original array. you need write code arr[n] = new test2(); instead.

javascript - How to clear specific line in Canvas : HTML5 -

i totally new canvas element. able draw line in canvas, not able clear specif line. whole canvas become blank. tried this: html: <canvas id="cvs" width="400" height="400"></canvas> <hr /> <input type="submit" id="redrowa" value="draw a" /> <input type="submit" id="redrowb" value="draw b" /> <hr /> <input type="submit" id="cleara" value="clear a" /> <input type="submit" id="clearb" value="clear b" /> script $(document).ready(function(){ canvas = document.getelementbyid("cvs"); $("#redrowa").on("click",function(){ = canvas.getcontext('2d'); a.translate(0.5, 0.5); a.beginpath(); a.setlinedash([2,10]); a.moveto(10,10); a.lineto(300,10); a.lineto(300,300); a.stroke();

POST is not defined in RFC 2068 and is not supported by the Servlet API -

in running eclipse rap application , error in firefox 29: http error: 501 problem accessing /rap. reason: method false,"ctrlkey":false,"altkey":false}],["set","w1",{"cursorlocation":[630,69]}]]} not defined in rfc 2068 , not supported servlet api how can fix error? thanks. looks you're constructing wrongly http request indeed false,"ctrlkey":false,"altkey":false}],["set","w1",{"cursorlocation":[630,69]}]]} get not valid http method

random - Lua - Getting one value from a table and assigning it to another with no repeats -

Image
specifically, garry's mod, don't think matters in problem. want 1 player, , set value random player (so every player has random 'target'). want no repeats, , player not assigned self. better illustrate: the difference picture want each player assigned random player, more player1 => player 5, player 3 => player 2, etc. here code @ moment, leaves 1 person unpicked: validtargets = {} targetlist = {} local swap = function(array, index1, index2) array[index1], array[index2] = array[index2], array[index1] end getshuffle = function(numelems) local shuffle = {} = 1, numelems shuffle[#shuffle + 1] = end ii = 1, numelems swap(shuffle, ii, math.random(ii, numelems)) end return shuffle end function assigntargets() local shuffle = getshuffle(#playing) k,v in ipairs(shuffle) targetlist[k] = v end synctargets() end function synctargets() k,v in pairs(targetlist) net.start(&q

How can I search a Google Cloud Bucket? -

the "objects list" function (seen here: https://developers.google.com/storage/docs/json_api/v1/objects/list ) entirely inadequate searching on google cloud (ironically, since google) perhaps missing how search properly? have start doing own indexing? update: a friend mentioned watchall() call capturing changes , presumably indexing them. main question remains: there better way search buckets? i pretty sure search functionality not available on cloud storage. , not make sense either (a service slow lot cloud storage). need see cloud storage service unlimited hard drive unlikely fail. when think it, cannot search file or content on computer drive without walking files (by using tools find command). modern os provide search functionalities indexing hard drive files on fly when modification comes up. if want indexing cloud storage content, need make (by using watch functionality , appengine search index instance).

r - prevent the name of model.matrix to appear in the results on a regression -

is possible use model matrix in regression without having name of model matrix in regression results? i need go through such procedure have interactions have no observation. (i.e) results of interaction na . a related question can found here . here data illustrate point: mydata <- read.csv("http://www.ats.ucla.edu/stat/data/binary.csv") str(mydata) gre_ <- mydata$gre-mean(mydata$gre) <- model.matrix(~-1+gre_:factor(rank),data=mydata)[,-c(2)] summary(glm(admit~gpa+gre+factor(rank)+a,data=mydata, family=binomial)) results call: glm(formula = admit ~ gpa + gre + rank + a, family = binomial, data = mydata) deviance residuals: min 1q median 3q max -1.6449 -0.8886 -0.6332 1.1706 2.1949 coefficients: estimate std. error z value pr(>|z|) (intercept) -3.0039781 1.4012928 -2.144 0.0321 * gpa 0.7634679 0.3297215 2.315 0.0206 * gre 0.0016098