Posts

Showing posts from March, 2012

eclipse - JST do not rendering -

good evening everybody. this first approach java ee , jsf. created today project 1 xhtml page , should show string of value contained in table of database. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <h:body> <h1>#{allperson.name}</h1> </h:body> </html> what broswer shows me "#{allperson.name}". here code of managedbean package view; import javax.ejb.ejb; import javax.faces.bean.managedbean; import javax.faces.bean.requestscoped; import session.manager1local; @managedbean @requestscoped public class allperson { @ejb private manager1local m; public string

Can a primitive value be considered an object in java? -

when started out using java, implied me have 2 different types: objects (strings, classes, println, etc) primitive values (int, double, char) i got exam professor difference mean difference between 2 choices answers. when asked professor clarify, told me primitive values can objects. who right here , can give me proof? proof official sounding , choose answer awarding proverbial internets. can primitive value considered object? the answer no. the jls states there two kinds of types in java programming language: primitive types (§4.2) , reference types (§4.3). there are, correspondingly, two kinds of data values can stored in variables, passed arguments, returned methods, , operated on: primitive values (§4.2) , reference values (§4.3). those primitive types , values are predefined java programming language , named reserved keyword and reference types , values can 1 of class types (§8), interface types (§9), type variables (§4.4), , a

c# - Building FFmpeg.NET .dll -

i need use ffmpeg functions in c# (to precise, in gtk#). downloaded wrapper ffmpeg.net . after try build ffmpeg.net.2008.sln(reference: build dll in visual studio 2008, use in gtk#), following errors: error 1 error prj0019: tool returned error code "performing makefile project actions" ffmpeg.net error 2 referenced assembly "c:\users\zhenya\documents\ffmpegdotnet-94877\bin (debug shared)\ffmpeg.net.dll" not found. if assembly produced 1 of projects, please make sure build project before building one. how fix these issues? or how correctly build wrapper .dll? ffmpeg .net includes old version ffmpeg. use ffmpeg.exe directly. example void runffmpeg() { ffmpegprocess = new process { enableraisingevents = true, startinfo = { filename = getffmpegpath(), arguments = ffmpegparams.tostring(),

css - Do large HTML elements take up more processing power or memory? -

i have large html element inside fixed width div overflow set hidden, so: #container{ width:100px; height:100px; overflow:hidden; } #largebox{ width:100000px; height:100px; } <div id="container"> <div id="largebox"> </div> </div> the inner div large because content within dynamically generated , scrolls using javascript buttons. large div size potentially take more memory or processing power render? better off adding size need javascript? i came here because can't think of way test solely html render speeds. might overlooking chrome developers tools though. used test this? jsfiddle proof conclusion: no, large html elements not appear affect render size or memory in large amount, can cause quirkiness. in fiddle, tested adding different numbers of elements dom, tested time took manipulate dom element, , tested time takes basic math(to test memory). example output (in chrome 32): the first 3 tests use sm

gcc - Open / lunch mutiple pdf file at ones with C? -

i trying lean c. i has make lille program / daemon. the meaning .pdf in 'taskfolder'-->(rootfolder). will open / lunch on start-up via 'evince'. do need lead abort threading or there better way this? i has try system("envice 1.pdf && envice 2.pdf ..."); but still open pdf files 1 @ time. the code this. #include <stdio.h> #include <stdlib.h> #include <dirent.h> #include <string.h> #define rootfolder ((const unsigned char *)"/home/myusername/taskfolder/") #define luncherapp ((const unsigned char *)"evince ") int main() { dir *d; struct dirent *dir; char *ext; d = opendir(rootfolder); if(d) { int i=0; char *tmp; while((dir = readdir(d)) != null) { ext = strchr(dir->d_name, '.'); if((ext != null) && (ext != 0) && (strcmp(strchr(ext ,'.'), ".pdf") == 0))

c# - wp - convert image to grayscale according to slider value -

i'm trying convert image colored grayscale grayscale level depended on slider level. of tutorial found in internet making absolute grayscale. answers, appreciate it you should use interpolation between full-color image , grayscale version coefficient determined slider's value. example, if convert grayscale using colormatrix , described here , then, partially grayed image, should apply interpolated matrix. say, "slider=0" full-color , "slider=1" grayscale, matrix apply defined: <color_matrix_to_apply> = slider * <grayscale_matrix> + (1 - slider) * <identity_matrix> as colormatrix not provide ariphmetic operations, should implement formula "manually", each item of matrices. matrixtoapply.matrix00 = slider * grayscalematrix.matrix00 + (1 - slider) * identitymatrix.matrix00; ... matrixtoapply.matrix44 = slider * grayscalematrix.matrix44 + (1 - slider) * identitymatrix.matrix44;

asp.net mvc 4 - Generic Search Functionality -

i have requirement in search functionality need implemented following features. search functionality should applicable view generic. the view on implemented in has view entities should populated on search dropdownlist (for example product controller product attributes should populated , theuser view userid, username dropdownlist) it have logical operators greater than, less than, equal etc text box match text entered user. please let me know link or article can refer to. if you're looking implementation in asp.net mvc nice blog it: http://www.palmmedia.de/blog/2012/2/18/aspnet-mvc-generic-filtering-based-on-expressions

java - Create a new file at webcontent or web-inf in a Spring MVC Application -

@requestmapping(value = "/upload", method = requestmethod.post) public @responsebody string upload(multiparthttpservletrequest request, httpservletresponse response) { iterator<string> itr = request.getfilenames(); string filename=itr.next(); multipartfile file = request.getfile(filename); if (!file.isempty()) { try { file filenew=new file(file.getoriginalfilename()); byte[] bytes = file.getbytes(); bufferedoutputstream stream = new bufferedoutputstream(new fileoutputstream(filenew)); stream.write(bytes); stream.close(); system.out.println(filenew.getabsolutepath()); return "you uploaded " + filename + " " + filename + "-uploaded !"; } catch (exception e) { return "you failed upload " + filename + " => " + e.getme

excel - Repeat a specific text x number of times in one column taken from another column of Random text strings -

i have text values in sheet 1, a4:a400 , each value in column there 10 codes in non-consecutive cells in row 1. want formula in "sheet 2" put each text value 10 times in column code in column b , repeat same new text value same 10 cods. like: 1 2 . . . . . . 5310 5200 3310 3456 3600 3 pk64 4 pk967 5 pk106 6 pk369 7 pk250 8 pk222 it should 1 b 2 pk64 5310 3 pk64 5200 4 pk64 3310 5 pk64 3456 6 pk64 3600 7 pk967 5310 8 pk967 5200 9 pk967 3310

ios - Custom UITableViewCell functions are called, but native table is presented -

custom uitableviewcell functions called, native table presented this code in init function: self.answerstable = [[uitableview alloc]initwithframe:cgrectmake(0, 45, 280, 500)]; self.answerstable.datasource = self; self.answerstable.delegate = self; this code in viewdidload function: [self.answerstable registerclass:[answertableviewcell class] forcellreuseidentifier:cellidentifier]; this table delegate functions, called, , cell not nil in end of it: -(nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { return [self.question.answers count]; } -(answertableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { answertableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[answertableviewcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:cellidentifier]; } answerobject* answer = self.que

How to pass list to other activity in Android? -

how pass list list <question> queslist other activity in android. question class like public class question { private int question_id; private string question; private string opta; private string optb; private string optc; private string optd; private string answer; private int category_id; private string youranswer; //getter , setter methods } you can achieve parcelable , serializable there few steps achieve using serializable . step1: create class , implement serializable interface. without implement serializable interface not possible these steps. @suppresswarnings("serial") public class myclass implements serializable { } step2: apply code in first activity when going startactivity(intent); arraylist<myclass> list = new arraylist<mainactivity.myclass>(); list.add(new myclass()); intent intent = new intent(); intent.putextra("myclassl

Why doesn't Node.js UDP client receive messages? -

i'm trying write multicast dns client in node.js . the goal show same logical output of running: % dns-sd -g v4 irkitd2a8.local date: ---thu 20 mar 2014--- 20:38:21.426 ...starting... timestamp a/r flags if hostname address ttl 20:38:22.571 add 2 4 irkitd2a8.local. 192.168.1.43 10 this udp packets under hood: % sudo tcpdump -n udp port 5353 tcpdump: data link type pktap tcpdump: verbose output suppressed, use -v or -vv full protocol decode listening on pktap, link-type pktap (packet tap), capture size 65535 bytes 20:38:22.450804 ip 192.168.1.37.5353 > 224.0.0.251.5353: 0 (qu)? irkitd2a8.local. (33) 20:38:22.571411 ip 192.168.1.43.5353 > 192.168.1.37.5353: 0*- [0q] 1/0/0 192.168.1.43 (43) so wrote this: var port = 5353; var multicast_group = "224.0.0.251"; var dgram = require("dgram"); var client =

paint - Android drawCircle compatibility problems -

i've got custom widget - blinking circle in custom frequency. in ondraw method paint circle. @override protected void ondraw(canvas c) { super.ondraw(c); if (data[mbitindex] == '1'){ c.drawcircle(c.getwidth() / 2, c.getheight() / 2, c.getwidth() / 2, mpaint); } } this works perfect on android 4.2.1, if try on android 2.3, no circle shown. i've done experiments determine problem @override protected void ondraw(canvas c) { super.ondraw(c); if (data[mbitindex] == '1'){ c.drawcolor(mpaint.getcolor()); } } this works expected on both versions of android. but, it's square, not circle, want. how possible draw square, not circle? i've searching on internet, noone has problem before or it's problem. don't this, can explain me mistake? on honeycomb (api 13) or earlier, hardware acceleration buggy , cannot draw circle. disable hardware acceleration view: setlayertype(view.layer_type_software,null); this worked

java - Embed Derby DB with Netbeans Platform Application - Module -

i developed project in netbeans platform application i.e. modules. when run project netbeans 7.4, works fine , doesn't show db exception. now created installer using netbeans 7.4 project. wen install it, db installed not recognizing db , connection url public final static string connectionurl = "jdbc:derby:projectdb;create=true;user=user;password=p@ssword"; . when copy paste db alone in location eg: " d:\project db " , change code connectionurl = "jdbc:derby:d:\\project db; create=true; user=user; password=p@ss" works fine. need create along installer or want project recognize db. when searched got below links https://platform.netbeans.org/tutorials/70/nbm-crud.html https://platform.netbeans.org/tutorials/nbm-crud.html but dint solution. hard tell description, seeing this default schema netbeans issue ?

c# - need to search an entire array not just one -

sorry asking question have problem when i'm comparing string string in array search 1 instance of array, example program allows add patients array when used compare string compare last added patient, can me? this program: public class patient { public string patientidstring; public string firstnamestring; public string lastnamestring; public string datestring; public patient() { patientidstring = ""; firstnamestring = ""; lastnamestring = ""; datestring = ""; } public patient(string idvalue, string firstnameval, string lastnameval, string dateval) { patientidstring = idvalue; firstnamestring = firstnameval; lastnamestring = lastnameval; datestring = dateval; } } //array patient[] patientinfo = new patient[10]; private void button

css - Pseudo element content with JQuery -

this question has answer here: selecting , manipulating css pseudo-elements such ::before , ::after using jquery 18 answers i trying change arrow on :after pseudo element my css legend:after { content: url('/html/img/arrow-fieldset-up.png'); } i trying change with $('legend', selected_fieldset).attr('content','url(/html/img/arrow-fieldset-down.png)') you cannot select pseudo element jquery. instead can add class css: legend.selected:after { content: url('/html/img/arrow-fieldset-down.png'); } then add class when want change content, example when click legend: $('legend').click(function() { $(this).addclass('selected'); })

android - Achartengine graph displaying too much space between values -

Image
i trying plot graph using achartengine. can see image, looks quite ugly.i want , 1. reduce space between values. cannot have space since need add more series it. 2. not plotting negative values, why it's showing lines @ bottom. values displayed @ bottom -1.i want eliminate lines @ bottom. 3. if possible, want change background color of graph black other color. thanks. code included working. string see = pull.trim(); string str = '"' + see + '"'; int[] intarray = new int[str.length()]; for(int i=0; < str.length(); i++){ intarray[i] = character.digit(str.charat(i), 10); } categoryseries series = new categoryseries("my graph"); for(int = 0; <intarray.length; i++){ series.add("bar ", intarray[i]); } xymultipleseriesdataset dataset = new xymultipleseriesdataset(); dataset.addseries(series.toxyseries()); xys

c# - MVC Just populate viewbag once, between page default action result and httppost -

let's populate viewbag object in page action result this public actionresult miemployeedetails() { var employees = _db.geo_employees.select(x => new selectlistitem { value = x.name, text = x.name }).tolist(); viewbag.employees = employees; return view(); } and populate in view such <%= html.dropdownlist("employees") %> that's fine when hit submit button , goes httppost action result i.e. [httppost] public actionresult miemployeedetails(formcollection fc) { return view(); } i null reference exception on viewbag option. in httppost action result need reset viewbag object created in original page load action result ? each request independent. need reinitialize view data if call view again post. exemption data sent client during post

sql - MySQL Select next 2 rows greater than time -

i have database has stored time values train schedule. table: create table if not exists `bahn_hausen` ( `id` int(11) unsigned not null auto_increment, `time` time not null, `day` varchar(12) not null, primary key (`id`) ) engine=myisam default charset=latin1 auto_increment=132 ; now want select next 2 rows after now(): select time bahn_hausen time > now() limit 2 the problem when > last time today (23:45:00), there no row selected. however, want select next 2 values of course (00:15:00 , 00:45:00). works correctly when now() >= 0:00:00 * [edit] *for clarification: problem having sql doesn't recognize 00:15 greater 23:45. how do this? help. your query there. need order by : select time bahn_hausen order time > now() desc, time limit 2;

Why htmlparse and soupselect works for ios and fails to android on titanium -

var htmlparser = require('/htmlparser'); var select = require('/soupselect').select; var handler = new htmlparser.defaulthandler(function(err, dom) { ... } on ios ok, when simulated on android, got message error [error] : tiexceptionhandler: (main) [0,2113] - message: uncaught typeerror: undefined not function it error lib or commonjs? the code of htmlparser , soupselect got here : https://gist.github.com/bob-sims/4406293

Laravel composer signal "11" error symfony osx -

anything try execute in laravel, minor files locally gives message in composer: [symfony\component\process\exception\runtimeexception] process has been signaled signal "11". using osx 10.7.5 any appreciated, always. for example : composer update typed in terminal retrieves error message above make sure check composer cache folder has right permissions files , folders. if ever ran composer sudo or root these cache folders have wrong root permissions. look @ files , folders inside: ll ~/.composer/cache/

google app engine - Gadget OAuth2 from OpenID Authentication -

i updating app oauth2 , have few questions. email address user id in our application. as explained in old docs openid association user id in our app, showing popup storing open_social_id in database , creating temp session key. after user associated, adding open_social_id next user id looking @ temp session key. was/is working fine. https://developers.google.com/google-apps/marketplace/best_practices#gadget_sso but oauth2, since email address (from contacts scope of current user logged in), trying figure out how authenticate @ server? should accompany email address open_social_id , rely on open_social_id everytime in future? right way? or should add oauth2 proxy @ server allow access right scope. thanks. you don't have change much. in old setup, displayed popup passed through openid user's identity , e-mail address. in new setup, show popup oauth2 dance user's identity , e-mail address. because scopes pre-authorized, end user not see consent

java - junit test for apache CommandLineParser example -

here example code using apache commandlineparser public class foo { public static void main(final string[] args) throws exception { options options = new options(); options.addoption("x", true, "comment param x"); options.addoption("y", true, "comment param y"); commandline commandline = null; commandlineparser parser = new posixparser(); try { commandline = parser.parse(options, args); } catch (parseexception e) { throw new runtimeexception("error parsing arguments!"); } if (!commandline.hasoption("x")) { throw new illegalargumentexception("x" + " option missing!"); } string numberofcolumns = commandline.getoptionvalue("x"); : : } junit test code: @test public void testfoo() throws exception { args = new string[2]; args[0] = "x" + "=" +

python - Simulating HTTP POST request produces unexpected result -

--- solved --- it turned out request body had literal r"\n" (repr: "\\n" ) characters in it, , since copy pasted body python string, python thought giving newline characters rather escaped newline characters. the reason causes bad request follows: body json, , in json have escape newline characters definition. when server loads json object raw text, error thrown causing bad request i realised because content-length header different in both cases ( \n 1 char while \\\n 2 chars, although perhaps content-length doesn't matter. also noteworthy when lower content-length sent, bad request returned. believe because json body gets truncated, , server doesn't accept important char (e.g. closing brace or something) --- problem:--- summary: i trying use python simulate post request bitbucket.org performed within firefox web browser. here did: tracked post request using firebug copied post request headers copied post request body (in applic

vb.net - How could I get the first and last letters from a string? -

how can program take first , last letters entered string? example: "i've been told noob!" output: "iebntdiaman!" i tried use split no luck. try this. since have couple of single character words used conditional in order desired output. using string.split method removes empty entries in order prevent 0 length item, taking result , using string.substring method parse out starting , ending chars. sub main() dim splitchar string() = {" "} dim example string = " i've been told noob!" dim output string = "" dim result string() = example.split(splitchar, stringsplitoptions.removeemptyentries) each item in result if item.length > 1 output += item.substring(0, 1) & item.substring(item.length - 1, 1) else output += item.substring(0, 1) end if next console.writeline(output) console.readline() end sub

java - ExceptionHandler doesn't work with Throwable -

ours spring mvc based rest application. trying use exceptionhandler annotation handle errors , exceptions. i have @exceptionhandler(throwable.class) public @responsebody string handleerrors() { return "error"; } this works whenever there exception thrown , doesn't work errors. i using spring 4.0. there work-around? contrary exceptionhandler#value() attribute indicates class<? extends throwable>[] value() default {}; and @exceptionhandler meant handle exception , sub types. spring uses exceptionhandlerexceptionresolver resolve annotated handlers, using following method doresolvehandlermethodexception(httpservletrequest request, httpservletresponse response, handlermethod handlermethod, exception exception) which can see accepts exception . you cannot handle throwable or error types @exceptionhandler configuration. i tell provide own handlerexceptionresolver implementation handle throwable insta

mysql - Get Relation of Followed or Public User -

i working on social app. have users can have private accounts. users can follow each other. fastest way using activerecord or pure sql fetch records of has_many on user either belong following or belong public user. in pseudo code: user.get_all_posts_for_users_being_followed_by(me) + user.get_all_posts_for_public_users i have this: select `posts`.* `posts` ( user_id in (select id users visibility = 'all' union select followable_id follows followable_type = "user" , follower_type = "user" , follower_id = 4 , follows.status = 1) ) but hoping there might faster way handle that, or way rails query methods. you can perform clear query activerecord, recommend use pure version for_now, because it's easy modificate now. need pay attention on this: the query might fas

java.net.ConnectException: Connection refused in TCP socket? -

i have created program send file client server when running file in localhost works , can send file when sending file pc pc shows "java.net.connectexception: connection refused". port number @ both side same , firewall off. port listening when client request connect server socket accepting socket. thank in advance code of program : public class programsocket { public programsocket(serversocket servsock) throws ioexception { system.out.print("server started"); while (true) { final socket sock; try { sock = servsock.accept(); } catch (socketexception e) { break; } new thread(new runnable() { @override public void run() { try { connecttonewclient(sock); } catch (exception e) { e.printstacktrace(); }

php - Using an object as a parameter vs creating the object in the method -

during discussion, wasn't sure if correct when saying: "it's better pass around objects parameters instead of object id's." so thought i'd ask here clarification. what advantages of doing this: public function dosomething(\item $item) { return $item->getsomething() * 2; } over this: public function dosomething($itemid) { $item = \item::getbyid($itemid); // return item based on id if ($item) // check object has been returned { return $item->getsomething() * 2; } } is true 1 benefit can presume object exist, there no need check if does? it's called dependency injection , , main benefit can test dosomething() method in complete isolation injecting " mock " item object method, testing dosomething() isn't dependent on logic of item itself

Calculating collection data before rendering in Meteor.js -

i'm new meteor.js , want understand basics. want calculations data in collection , render dom. should rendered dom {{#each}} loop. how can this? the html looks similar this: {{#each location}} <div>{{name}}</div> <div>{{calculated_distance}}</div> {{/each}} the js: template.list.location = function (){ return collection.find({ location : { $near : { $geometry : { type : "point", coordinates : [long, lat] }, $maxdistance: 430 }}}); } this allows me post data in collection. how access {{calculated_distance}} each document in collection? if understand correctly can use helper: template.list.helpers ({ calculated_distance: function() { var lat = this.location.coordinates.lat; var lng = this.location.coordinates.long; var somecalculation = ... return somecalculation; } }); inside helper have context o

c++ - Xml loaded without values -

i have xml.xml file: <root>root <pai>pai_1 <filho>pai1,filho1</filho> <filho>pai1,filho2</filho> </pai> <pai>pai_2 <filho>pai2,filho1</filho> <filho>pai2,filho2</filho> </pai> </root> this file loaded , saved. file *fp; mxml_node_t *tree; fp = fopen("xml.xml", "r"); tree = mxmlloadfile(null, fp, mxml_no_callback); fclose(fp); fp = fopen("xmlout.xml", "w"); mxmlsavefile(tree, fp, mxml_no_callback); fclose(fp); on xmlout.xml have: <root> <pai> <filho /><filho /> </pai> <pai> <filho /><filho /> </pai> </root> where values? there appears bug in mini-xml 2.8 handling of mxmlloadfd() mxml_no_callback/mxml_text_callback loses text nodes. see minixml bug 502 details. as workar

sqlite - Insert or replace doesn't work -

i need insert or replace existing db, don't work correctly. example: select * tab name = 'foo'; 6530|foo|ok||| insert or replace tab values('foo', 'ok', 1, 2, 3); select * tab name = 'foo'; 6530|foo|ok||| 43523|foo|ok|1|2|3 why insert-replace doesn't "update" existing fields record 6530 , creates new one? the table: create table tab( id integer unique primary key, name text not null, tipo text not null, val1 integer, val2 integer, val3 integer ); you need have unique index on 1 or combination of columns like: create unique index idx_tab on tab (name, tipo); the records gets deleted , inserted new values when same values exists in table. can upsert following: insert or replace tab (id, name, tipo, val1, val2, val3) select old.id, new.name, new.tipo, new.val1, new.val2, val3 ( select 'foo' name, 'ok' tipo, 1 val1, 2 val2, 3 val3 ) new left

javascript - Node.js and asynchronous programming with Q -

is following correct way go things? sign controller action. im creating user , group add user to. notice have method level variables called user , group. rest of code asynchronous using q module. is ok have method level variables or overriden person signing @ same time? exports.postsignup = function(req, res, next) { var user, group; return q.invoke(exports, 'parseuser', req, null) .then(function(u) { user = u; return q.invoke(exports, 'postcreateuser', user).fail(function(err) { throw err; }); }) .then(function() { group = new group(); group.userids = [user._id]; return q.invoke(exports, 'postcreategroup', group).fail(function(err) { throw err; }); }) .then(function() { user.groupid = group._id; group.userids = [ user._id ]; }) .then(function() { return q

jquery - JavaScript code for my Image Gallery -

i making simple gallery page using html , css. coded onto html viewer , working fine when opened in google chrome , ie onmouseover not working. when go on selected thumbnail, supposed display larger image in bottom box not work. i posted question before , got replies. ask if can please give me plain javascript code need put in make work. have code kindly gave works java script code if possible. $(function(){ $('.thumbnails img').hover(function(){ $('#preview').attr('src',$(this).attr('src')); },null); }); thank all! <!doctype html> <head> <title>gallery</title> <style type="text/css"> body { background: #222; margin-top: 100px; } h3 { color: #eee; font-family: verdana; } .thumbnails img { height: 100px; border: 4px solid #555; padding: 1px; margin: 0 10px 10px 0; } .thumbnails img:hover { border: 4px solid #00ccff; cursor:pointer; } .preview img { border: 4px solid #444; padding: 1

ruby on rails - Error installing rvm on osx mavericks with brew -

thanks, error installing rvm on osx mavericks tried suggestion, no matter happen. coles-macbook-pro:~ coleschiffer$ \curl -ssl https://get.rvm.io | bash -s stable --rails downloading https://github.com/wayneeseguin/rvm/archive/stable.tar.gz installing rvm /users/coleschiffer/.rvm/ rvm path line found in /users/coleschiffer/.profile /users/coleschiffer/.bashrc /users/coleschiffer/.zshrc. rvm sourcing line found in /users/coleschiffer/.zlogin. rvm sourcing line not found bash, rerun command '--auto-dotfiles' flag fix it. installation of rvm in /users/coleschiffer/.rvm/ complete: * start using rvm need run `source /users/coleschiffer/.rvm/scripts/rvm` in open shell windows, in rare cases need reopen shell windows. # coleschiffer, # # thank using rvm! # sincerely hope rvm helps make life easier , more enjoyable!!! # # ~wayne, michal & team. in case of problems: http://rvm.io/help , https://twitter.com/rvm_io rvm 1.25.21 (stable) wayne e. seguin

java - SocketConnector 8081 - Address Already in use -

i trying run 2 dropwizard server applications on 2 different ports 8080 , 9000.the first application starts keep getting below exception when try run on port 9000. not understanding why 2 ports being used application , how enforce application use different port number second port info [2014-03-22 17:17:28,031] org.eclipse.jetty.server.abstractconnector: started instrumentedblockingchannelconnector@0.0.0.0:9000 warn [2014-03-22 17:17:28,033] org.eclipse.jetty.util.component.abstractlifecycle: failed socketconnector@0.0.0.0:8081: java.net.bindexception: address in use ! java.net.bindexception: address in use ! @ org.eclipse.jetty.server.bio.socketconnector.newserversocket(socketconnector.java:96) ~[jetty-server-8.1.10.v20130312.jar:8.1.10.v20130312] ! @ org.eclipse.jetty.server.bio.socketconnector.open(socketconnector.java:85) ~[jetty- server-8.1.10.v20130312.jar:8.1.10.v20130312] ! @ org.eclipse.jetty.server.abstractconnector.dostart(abstractconnector.java:316) ~ [j

php - Laravel error when uploading to remote server -

i've uploaded laravel project remote server without ssh acces, following tutorial: http://driesvints.com/blog/laravel-4-on-a-shared-host briefly, i've done: in domain directory i've created '/laravel' directory i've put laravel folders in directory i've put content of public folder in 'public_html' i've edited links of 'bootstrap/paths.php' i've edited links of 'public_html/index.php' everything should work fine now, when visiting site strange error laravel debugging : syntax error, unexpected '[' which alledged located in /home/jamesmr117/domains/jamesmr117.117.axc.nl/laravel/vendor/way/generators/src/way/generators/generatorsserviceprovider.php however, when accessing same project locally, there not single error showing up. know wrong here? thanks!

c++ - Cython wrapping operator<< from multiple namespaces -

how can wrap operator >> overload in cython? //lib.h namespace lib { class point { friend std::istream &operator >> (std::istream &in, point &pt) bool operator == (const point &pos) const ... } } there namespace declared namespace "lib": , how deal std:: namespace? #lib.pxd cdef extern "lib.h" namespace "lib": cdef cppclass point: #friend std::istream &operator >> (std::istream &in, point &pt) bint operator == (const point &pos) const ... here explains multiple cdef extern blocks possible, don't see how work since cannot redefine class. i think easiest solution pretend cython operator<< method of std::istream forgetting friend stuff. c++ compiler sort out pieces. here seems working solution (it compiles didn't went way test it): here lib.h wrapped file: #include <iostream> namespace lib { cla

Display the enum value that is passed to c++ class constructor -

i have written short test code passing enum value class constructor. works compiler. however, output weird. display() not show enum value. shows "the strategy of current agent ". what's wrong code? thank you! #include <iostream> using namespace std; class agent { public: enum strat {buyandhold, momentum, ta}; agent(strat strategy=buyandhold); ~agent(); void display(); private: strat strategy; }; agent::agent(strat strategy) { strategy = strategy; } agent::~agent() { cout << "bye!" << endl; } void agent::display() { cout << "the strategy of current agent "; switch(strategy){ case buyandhold : cout << "buyandhold." << endl; break; case momentum : cout << "momentum." << endl; break; case ta : cout << "ta." << endl; break; } } int main() { agent a(agent::ta); a.display(); return 0; }

osx - Can't install scikit-learn in Python -

hi i'm trying install scikit-learn in python on mac, failed. having idea how fix this? thanks! error message follows. error message command /usr/bin/python -c "import setuptools, tokenize; file ='/private/tmp/pip_build_root/scikit-learn/setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), file , 'exec'))" install --record /tmp/pip-ufi2wg-record/install-record.txt --single-version-externally-managed --compile failed error code 1 in /private/tmp/pip_build_root/scikit-learn storing debug log failure in /users/yuxinsun/library/logs/pip.log pip.log this. (sorry have change little links in pip.log since can't attach more 2 links, think links not crucial) /usr/local/bin/pip run on sun mar 23 02:25:36 2014 downloading/unpacking scikit-learn getting page https://pypi.python.org/simple/scikit-learn/ urls search versions scikit-learn: link - pypi.python.org/simple/s

javascript - I am not able to hide my p tags in javasctript -

i don't know having error when run script says undefined in firebug.not telling me undefined.here javascript. var elements = document.getelementsbyname("p"); var length = elements.length; (var = 0; < length; i++) { elements[i].style.display='none'; } i think want getelementsbytagname : var elements = document.getelementsbytagname("p"); var length = elements.length; (var = 0; < length; i++) { elements[i].style.display='none'; } document.getelementsbyname("p"); returns elements have name attribute of p such as: <span name="p"></span>

java - Is it possible to create a bitmap, add it to canvas and draw it using view.draw? -

for example .. bitmap mypic = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); bitmap newpic = bitmap.createscaledbitmap(mypic, 50, 50, true); canvas mycanv = new canvas(newpic); view myview = (view)findviewbyid(r.id.view1); myview.draw(mycanv); is above feasible? you shouldn't that. recommendation this bitmap mypic = bitmapfactory.decoderesource(getresources(), r.drawable.ic_launcher); mypic = bitmap.createscaledbitmap(mypic,50,50, true); bitmapdrawable draw = new bitmapdrawable(this.getresources(), mypic); view myview = (view) findviewbyid (r.id.view1); myview.setbackground(draw); this way pass view drawable background. if want set bitmap source should make imageview

C++ std::map items in descending order of keys -

how cal use std::map container key value in descending order. as example, if insert following items: [2 , 5] [1 , 34] [3 , 67] they ordered in map like: position 0: [1, 34] position 1: [2, 5] position 2: [3, 67] i can iterate through map reversely, suppose next time inserting [-1 , 60]. placed @ first position? use custom comparator when default order doesn't you. pass third template parameter ( that's defaulted std::less<keytype> ). in case, can use std::greater : std::map<int, int, std::greater<int> > m; example code: #include <map> #include <iostream> int main() { std::map<int, int, std::greater<int>> m { {-1, 77}, {0, 42}, {1, 84} }; (const auto& p : m) std::cout << '[' << p.first << ',' << p.second << "]\n"; } resulting output: [1,84] [0,77] [-1,42]

python - How do you extend a Django project root HTML file in project apps? -

below structure of django app: project/ static/ app1/ app2/ app3/ ... so have django project, , want keep html/css styling uniform across apps in project. how 1 go extending html template residing in project folder each of these apps? i have been successful extending html templates within app folders each respective app. my project settings has static files set located in "/static/" you can put project-common templates in project/templates , add /path/to/project/templates template_dirs setting in settings.py file. prepend root else, gets searched first: template_dirs = ( # don't forget use absolute paths, not relative paths. "/path/to/projects/templates", #other dirs ... ) then go extend application templates usual: {# app1/templates/app1/template1.html #} {% extends "template_in_project_root.html" %} ... the template_dirs setting

stm32 - Flash is corrupting after a couple of immediate resets -

i want store device id inside flash permanently. using internal flash of stm32. can write&read flash in stm32. after writing value flash, , switch off , can read without problem. problem coming couple of different scenario such : when resetting mcu immidieatly after first reset, data inside flash becoming 0. other scenario data disappearing after while (not tested , can not entire conditions) idea flash problem ? ide : keil mdk uvision 4 write function: void eeprom_write(uint32_t data) { /* porgram flash bank1 ********************************************************/ flash_unlockbank1(); /* unlock flash bank1 program erase controller */ nbrofpage = (bank1_write_end_addr - bank1_write_start_addr) / flash_page_size; /* define number of page erased */ flash_clearflag(flash_flag_eop | flash_flag_pgerr | flash_flag_wrprterr); /* clear pending flags */ for(erasecounter = 0; (erasecounter < nbrofpage) && (flashstatus == flash_complete); erasec

Can I create an windows exe application using PHP program and using Database also? -

this question has answer here: convert php script stand-alone windows executable 7 answers i college level student. school life interested website creating, , thats why came learn php language, i'm able create php app in website, want create offline windows app using language , database. but student of college, cse or computer engineering not textual study, thats why cant learn java or c/c++ other else. so profassional programmers, can me out? yes, can. here ways this: command line php — developing shell applications php; php desktop — open source project developing native desktop gui applications using web technologies (php, html5, javascript & sqlite); winbinder — open source extension allows php programmers build native windows applications; phalanger — implementation of php, rewritten in c#. can access c# libs; exeoutput — make

Attempting to deploy Rails app to Heroku - Application Error? -

i'm not sure why happening. tried heroku restart , running herok run rake db:migrate suggested thread, didn't work. just clarify, application works fine on localhost. heroku logs: 2014-03-23t21:07:47.989154+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:150:in `block in tsort_each' 2014-03-23t21:07:47.989154+00:00 app[web.1]: /app/vendor/ruby-2.0.0/lib/ruby/2.0.0/tsort.rb:180:in `each_strongly_connected_component' 2014-03-23t21:07:47.989709+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:49:in `eval' 2014-03-23t21:07:47.989883+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/railties-4.0.3/lib/rails/commands/server.rb:48:in `app' 2014-03-23t21:07:47.989883+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/server.rb:314:in `wrapped_app' 2014-03-23t21:07:47.989709+00:00 app[web.1]: /app/vendor/bundle/ruby/2.0.0/gems/rack-1.5.2/lib/rack/builder.rb:55:i