Posts

ruby - Sinatra Restarting Webrick Server after ctrl-c -

require 'sinatra' require 'rubygems' class testserver < sinatra::application set :port, 22340 '/' "hello world" end run! if app_file == $0 end very simple application ruby 2.0.0-p0 , sinatra 1.4.2 when ctrl-c webrick server restarts on default port... see output below lm-bos-00715009:server joshughes$ ruby test.rb [2013-04-19 16:07:48] info webrick 1.3.1 [2013-04-19 16:07:48] info ruby 2.0.0 (2013-02-24) [x86_64-darwin11.4.2] == sinatra/1.4.2 has taken stage on 22340 development backup webrick [2013-04-19 16:07:48] info webrick::httpserver#start: pid=63798 port=22340 ^c == sinatra has ended set (crowd applauds) [2013-04-19 16:07:56] info going shutdown ... [2013-04-19 16:07:56] info webrick::httpserver#start done. [2013-04-19 16:07:56] info webrick 1.3.1 [2013-04-19 16:07:56] info ruby 2.0.0 (2013-02-24) [x86_64-darwin11.4.2] == sinatra/1.4.2 has taken stage on 4567 development backup webrick [2013-04-19 16:07:...

php - SQL query based on array -

this question has answer here: can bind array in() condition? 19 answers i have array called $restaurantarray contains selection of restaurant id's. is there anyway can execute mysql query return rows if id equal 1 of these restaurant id's in array? thanks. you can use in mysql query. implode array $restaurantarray string, using comma delimiter; cover string brackets; , use result string input query. like // uncomment if data needs sanitized // $restaurantarray = array_map("mysql_real_escape_string", $restaurantarray); $input = '(' . implode(',', $restaurantarray) . ')'; $query = "select foo id in $input";

C++ multiple undefined reference error MinGW -

i have add graphics.h , winbgim.h libraries, , libbgi.a mingw. can found here . archive has folders indicate directory should placed under /mingw . have added -lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32 link options, specified in following link: http://www.infobits.ro/medii-mingw-developer-studio3.php . (sorry, it's in romanian, images quite easy understand). when try run following code: #include <graphics.h> #include <iostream> using namespace std; int main() { int gdriver = detect, gmode; initgraph(&gdriver, &gmode, ""); if (graphresult()) { cout<<"tentativa nereusita ..."; } else { cout<<"everything working!"; setcolor(red); moveto(0,0); lineto(getmaxx(),getmaxy()); } cout<<endl<<"press close"; getch(); return 0; } i error log "undefined reference error". error log is: c:\oji\mingwstudio...

java - Where are JavaDocs generated by Gradle if default is not set? -

i running gradle javadoc task (through java plugin) cannot find output. in gradle documnetation states default destination directory ${project.docsdir}/javadoc , cannot find ${project.docsdir} set. output location when ${project.docsdir} not set? update: had built project using idea plugin builds project build directory excluded/hidden; excludes/hides .gradle directory. explains complied classes disappearing to. build/docs/javadoc output directory.

c++ - Optimising boost::python::object instances -

i started using boost's python library wrap parts of rather large c++ library. quite chance, discovered every python object created boost python, @ least bigger size of python list. simple types using noddy_noddytype example c-python api docs , can quite expose new object type instance, noddy_noddyobject . using raw c-python api, small , simple custom python object can be:- >>> import noddy, sys >>> print sys.getsizeof( noddy.noddy ) # pytypeobject size? 872 >>> print sys.getsizeof( noddy.noddy() ) # pyobject size 16 and compare base object:- >>> print sys.getsizeof( object ) 872 >>> print sys.getsizeof( object() ) 16 that's expected, when expose noddy_noddyobject using boost python? >>> print sys.getsizeof( noddy.noddy ) 904 >>> print sys.getsizeof( noddy.noddy() ) 80 say what?!! that's not ideal... object instances 5 times bigger need be! (this differ on non-64-bit machin...

How to check command line arguments in a kdb script? -

i want check number of command arguments in q script , return error message if .z.x doesn't match intended number of arguments. far came line: if[count .z.x < 4; '`badusage] "arguments ok" i never past if statement, returns `badusage, regardless of number of arguments i'm using. how check correct number of arguments, print error message , exit script? its because statements evaluated right left. .z.x < 4 evaluated first, , count of result. q)count .z.x < 4 0 q)4 > count .z.x 1b

c# - Expanders in WPF -

i new wpf , working on projects our ui. quote problem 1.) have openfiledialog box in user can select dll or text files. 2.) if select dll fine , user operates in normal way, if user selects text files have processing on text files. 3.) there few steps on text file around 4-5 steps. after steps convert specfic file , user proceeds in normal way. what have done when user selects text files openfiledialog processing , show in expander status image, labels (this label contains command executed),etc. but problem expander shows after every process completes, not show real time how ti changes. started coding in wpf learning stuff , dont show how bring step step , how update ui when corresponding valeus changes in processing. snippet of code: browser_button() { if ( button == ok ) see if text or dll if dll continue if text files processing 4-5 steps expander contains processing logic give result of each stage. } expander_expander(object,event) { ...