Posts

c++ - Linked List error when inserting for the last time -

so have part of code here this loop 5 times (max = 5) insert word link list. for ( int = 0 ; < max ; i++ ) { string alphabet = g->returnalphabets(); l[i]->addwords(alphabet[i]); } and have insert word part here string line; fstream myfile ("words.txt"); while (!myfile.eof()) { getline(myfile,line); if ( alphabet == line[0] ) { listnode *newnode = new listnode; if ( head == null ) { newnode->item = alphabet; newnode->next = null; head = newnode; } else { newnode->item = line; prev = cur; prev->next = newnode; } cur = newnode; } } myfile.close(); my problem gives me error on last loop. meaning on max = 4, insert node. rest of loop fine. when decrease max 4 meaning loop 4 times, program error-free when program loops 5 times gives error. anyone can poin...

Using Angularjs $http in browser console -

i've testing angularjs services in browser console during development quick verification. way inject service console describe in this question or var $inj = angular.injector(['myapp']); var serv = $inj.get('myservice'); serv.dosomething(); that working angularjs 1.0.7. however, after upgrading 1.1.5, doesn't work anymore services uses $http service, no xhr sent. i've tested injecting $http directly, doesn't work. angularjs changelog seems have no record on issue. may know what's problem here? update: it seems angularjs 1.0.7 uncompressed version doesn't work well. tested working version angularjs 1.0.7 minified. it works uncompressed also. $http = angular.element(document.body).injector().get('$http'); then $http.get(...) // or post or whatever

java - Cannot connect to a local sesame local store -

i want create sparql endpoint locally tomcat on computer , sesame2.7.3 apis, there problem encountered. after have created native datastore on computer, want connect datastore , execute sparql queries on it, , code in java, following error message tomcat. exception javax.servlet.servletexception: error instantiating servlet class com.jelly.web.rdfservlet org.apache.catalina.valves.errorreportvalve.invoke(errorreportvalve.java:103) org.apache.catalina.connector.coyoteadapter.service(coyoteadapter.java:293) org.apache.coyote.http11.http11processor.process(http11processor.java:861) org.apache.coyote.http11.http11protocol$http11connectionhandler.process(http11protocol.java:606) org.apache.tomcat.util.net.jioendpoint$worker.run(jioendpoint.java:489) java.lang.thread.run(thread.java:680) root cause java.lang.noclassdeffounderror: org/openrdf/repository/repositoryexception java.lang.class.getdeclaredconstructors0(native method) java.lang.class.pri...

You don't have permission to access /marcon/assets/images/pic.jpg in apache php -

i getting error don't have permission access /marcon/assets/images/pic.jpg in apache php on local fedora 17, php,mysql , apache(not xampp installation). error occuring new files copying directory.the older files /marcon/assets/images/header.jpg accessible fine. checked permissions , 777 (now) still doesn't work. wierd error. subdirectory , other images work fine. newer files don't work this happens when embed image when access directly. works other files in directory. not newer ones edit: ironically problem doesn't occur if check files github , clone project again. works hunky dory. it selinux issue: try $ ls -z file1 you should similar to: drwxr-xr-x. apache apache unconfined_u:object_r:httpd_sys_content_t:s0 scripts if no try: chcon -r -t httpd_sys_content_t /marcon/assets/images

c++ - Issues with OpenGL referencing when compiling in Ubuntu terminal -

i working on compiling directory of c++ files , headers. thought installed opengl, glut , glew keep getting referencing errors when running it. here doing , errors compiler sending me: user@linux-machine:~/documents/hw$ make g++ -g framework.o poly_line.o shader_program.o circle.o controller.o main.o scene.o view.o -lglew -lglut -lglu -o hw framework.cpp:84: error: undefined reference 'glgeterror' check_gl.h:30: error: undefined reference 'glgeterror' check_gl.h:43: error: undefined reference 'glgeterror' poly_line.cpp:23: error: undefined reference 'glgenbuffers' poly_line.cpp:28: error: undefined reference 'glbindbuffer' poly_line.cpp:29: error: undefined reference 'glbufferdata' poly_line.cpp:54: error: undefined reference 'glenable' poly_line.cpp:55: error: undefined reference 'glenable' poly_line.cpp:56: error: undefined reference 'glblendfunc' poly_line.cpp:57: error: undefined reference 'glhint...

multithreading - Python 2.7.5 - Run multiple threads simultaneously without slowing down -

i'm creating simple multiplayer game in python. have split processes using default thread module in python. noticed program still slows down speed of other threads. tried using multiprocessing module not of objects can pickled. is there alternative using multiprocessing module running simultaneous processes? here options: mpi4py: http://code.google.com/p/mpi4py/ celery: http://www.celeryproject.org/ pprocess: http://www.boddie.org.uk/python/pprocess.html parallel python(pp): http://www.parallelpython.com/

java - activate/deactivate sonar maven plugin by profile? -

i use sonar plugin executes if activated in maven profile. sonar runs on every compile. the problem build fail other team members not have sonar application installed locally. pom.xml checked in team members same copy including sonar configuration, don't want them modify purpose of disabling sonar (they might inadvertently check modified copy in). please advise how configure maven (.m2/settings.xml) and/or pom.xml sonar feature can enabled/disabled local profile. here sonar configuration in each project's pom.xml: <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>sonar-maven-plugin</artifactid> <version>1.0</version> <executions> <execution> <id>make-sonar</id> <phase>compile</phase> <goals> <goal>sonar</goal> </goals> </execution> </executions> ...

jsf - How to get rid of ViewState Error -

i used omnifaces handle redirect problem after session expired @ primefaces , works well. problem when try relogin after session timeout occurs , directs me login page, come across following error. after clicking f5, or reloading page error disapperas , directs me homepage. problem come across error after session expires , when click ajax button.afterwards, directs me login page. after write username / password , click login button come across viewstate error blank page gives me following message. i glad if can me. best regards alper kopuz error : 339983964997632919:6839730696265126459

c++ - Finding min and max of a point vector -

i want find min , max value point vector. vector consists of x , y element type. want min , max of x , minmax of y. vector defined as: std::vector<cv::point> location; findnozeroinmat(angles,location); //i tried use gives error minmaxloc(location.cols(0), &minval_x, &maxval_x); minmaxloc(location.cols(1), &minval_y, &maxval_y); i tried location.x didn't work. how can min , max value of x , y seperately? you can use std::minmax_element custom less-than comparison functions/functors: #include <algorithm> bool less_by_x(const cv::point& lhs, const cv::point& rhs) { return lhs.x < rhs.x; } then auto mmx = std::minmax_element(location.begin(), location.end(), less_by_x); and y . mmx.first have iterator minimum element, , mmx.second maximum one. if don't have c++11 support auto need explicit: typedef std::vector<cv::point>::const_iterator pointit; std::pair<pointit, pointit> mmx = std::min...

c# - SqlDataReader null exception -

i have sqldatareader fills multiple textboxes, issue when null exception dont know how handle. sqlcommand command = new sqlcommand("select * zajezd akce='" + akce + "' , rocnik='" + klientclass.rocnik() + "'", spojeni); spojeni.open(); sqldatareader read= command .executereader(); if (read.read()) { s_ub_cen.text = read.getdecimal(59).tostring(); object nulldate = (s_ub_dat.text = read.isdbnull(61) ? string.empty : read.getdatetime(61).toshortdatestring()); } exception: system.data.sqltypes.sqlnullvalueexception: data null. i have 20 textboxes, there easy solution? leave textboxes empty when value null, working fine shortdatstring. i need figure out how handle when value db null: s_ub_cen.text = precti2.getdecimal(59).tostring(); thank much. you need check isdbnull : if(!precti2.isdbnull(59)) { ...

Screen Resolution for different Android Devices -

this question has answer here: application skeleton support multiple screen 2 answers how solve screen resolution problem? i want application run on android device, , layout should not change, i read android blog of supporting multiple screens,but not enough idea. i have created different layout folder layout-small,layout-normal,layout-large,layout-xlarge , created different xml files folder. but when run on tablet takes default normal size xml file,i don't know why? please me solve it, in advance , waiting response <supports-screens android:smallscreens="true" android:normalscreens="true" android:largescreens="true" android:xlargescreens="true" android:anydensity="true" /> add manifest file of app.

Check function parameters for existence and type in JavaScript -

supposed have function defined such as: var x = function (options, callback) { /* ... */ } options needs have properties foo , bar , foo shall of type number , , bar of type string . so, basically, check using following code: var x = function (options, callback) { if (!options) { throw new error('options missing.'); } if (!options.foo) { throw new error('foo missing.'); } if (!options.bar) { throw new error('bar missing.'); } if (!callback) { throw new error('callback missing.'); } // ... } but checks existence, not yet correct types. of course can add further checks, becomes lengthy, , not readable. once start talking optional parameters, gets mess, parameter-shifting , on … what best way deal (supposed want check it)? update to clarify question: know there typeof operator, , know how deal optional parameters. have these checks manually, , - sure - not best can come with. the goal of question was: there ready-made f...

sql - Joining Two query -

select a.enquiry_id,a.ckeck_in,a.check_out,a.hotel_name,a.meal_plan,a.room_type,a.occupancy_type,a.room_qt,a.adults accomodation a.enquiry_id = 74 select q.enquiry_id,q.start,q1.stay_at quick_plan q,quick_plan q1 q.enquiry_id = 74 , q1.enquiry_id = 74 , q.stay_at = q1.start result of 1st query is 74 2013-08-03 2013-08-04 ads cp deluxe double 1 2 and result of 2nd query is 74 ahmedabad agra nw want combine these 2 query result 74 2013-08-03 2013-08-04 ads cp deluxe double 1 2 ahmedabad agra in case easiest way use ctes won't need modification. ;with firstcte ( select a.enquiry_id, a.ckeck_in, a.check_out, a.hotel_name, a.meal_plan, a.room_type, a.occupancy_type, a.room_qt, a.adults accomodation a.enquiry_id = 74 ), secondcte ( select q.enquiry_id, q.start, ...

events - Extjs 4.2 Parameter in listeners function -

i've got problem controller ext.define('app.controller.mycontroller', { init: function() { this.control({ '#myinputfield': { change: this.textfieldchange(parameter) } }) }, textfieldchange: function(parameter) { //do } }); its problem when give parameter here change: this.textfieldchange(parameter) then fire after site load , don't know why. without parameter waiting change event should can any1 me please ? it because: change: this.textfieldchange here giving reference function property change: this.textfieldchange(parameter) here giving result of function property (which if don't use return, undefined ). you can use eopts variable in function definition, custom parameter sending, see in example: ext.define('app.controller.mycontroller', { init: function() { this.control({ '#myinputfield': { ...

css - Custom fonts not rendering in IE8 or IE7 -

my custom fonts not render in ie7 or ie8. getting crazy trying figure out went wrong. here css code @font-face { font-family: 'neutratextdemi'; src: url('customfonts/neutratext-demi.eot'); src: url('customfonts/neutratext-demi.eot?#iefix') format('embedded-opentype'), url('customfonts/neutratext-demi.woff') format('woff'), url('customfonts/neutratext-demi.ttf') format('truetype'), url('customfonts/neutratext-demi.svg#neutratextdemi') format('svg'); } you notice difference if open file in let's chrome , ie8. went through other stack overflow issues , solutions. can't seem solve @ all. in internet explorer 8 , earlier, url must point embedded opentype (eot) file (.eot or .ote format). no other font formats supported. i used arialblack.ttf for below sample: /* generated font squirrel ( http://www.fontsquirrel.com ) on august 26, 2013 */ @...

ruby - Different javascript loading process between Production and Development environments -

i've got issue must come side turning me crazy :-p when i'm in development environment, i've put these lines in application.html.erb have i18n.js working : <%= javascript_include_tag "i18n" %> <%= javascript_include_tag "translations" %> the problem on production environment, doesn't work (it doesn't found i18n.js , 404, know that's normal, due assets pipeline), i've put these lines in application.js : //= require i18n //= require i18n/translations but if leave these that, i've got error in development environment : uninitialized constant simplesideias it works rest of scripts, i18n.js got problem load. what way make them both works ? :p

if statement - if(a,b,c,d) how does this work? -

this question has answer here: what comma operator , do? 8 answers int main(void) { int a=0, b=20; char x=1, y=10; if(a,b,x,y) printf("bye"); return 0; } how "if" condition in above code work work? value of "y" considered "if"? yes, value of comma operator right operand. because none of other operands have side effects, boils down if (y) .

matlab - output in different windows -

Image
can show 3-4 outputs(graphical output, same images) in different windows using matlab.some thing following fig. for more clarification- example- for i=1:10 vid = videoinput('winvideo', 2); set(vid,'framespertrigger',2); start(vid); imagedata=getdata(vid,1); i=rgb2gray(imagedata); figure,imshow(i); end in case 10 frames shown in 10 different figure. not want do. want show frames in same window, if frame changes every time. i not talking figure or subfigure. , output can changed every time in same window. regards, you can call created figure using simple code figure(h) . this, no new figure window created. h = figure; %create figure ... figure(h); %call figure h , draw in it. using code h = figure; i=1:10 vid = videoinput('winvideo', 2); set(vid,'framespertrigger',2); start(vid); imagedata=getdata(vid,1); i=rgb2gray(imagedata); figure(h); imshow(i); end

asp.net - Error : The underlying connection was closed: The connection was closed unexpectedly. -

i tried suggestions in other posts , didn't work. i'm getting error when tried send request , getting response getresponse(). my codes this, protected string createsalerequest(double amount, int installment) { string request = ""; try { xmlnode node = null; xmldocument _msgtemplate = new xmldocument(); _msgtemplate.loadxml("<?xml version=\"1.0\" encoding=\"utf-8\" ?><epaymentmsg versioninfo=\"2.0\" tt=\"request\" rm=\"direct\" ct=\"money\">" + "<operation actiontype=\"sale\"><opdata><merchantinfo merchantid=\"\" merchantpassword=\"\" />" + "<actioninfo><trnxcommon trnxid=\"\" protocol=\"156\"><amountinfo amount=\"0\" currency=\"792\" /></trnxcommon><paymenttypeinfo>" + "<installmentinfo ...

php - MySQL - nested where condition -

i trying delete multiple records data table. problem if need remove 3 records of deposit need not 'deposit' keyword 'balance' keyword. table report: -------------------------------------------------------------------------------------- | report_id action_id action_name balance received given item_name total| -------------------------------------------------------------------------------------- | 1 1 balance 0 10 0 gold 10 | | 2 2 deposit 10 10 0 gold 20 | | 3 3 deposit 20 10 0 gold 30 | | 4 4 balance 0 5 0 silver 5 | | 5 5 deposit 5 5 0 silver 10 | | 6 6 deposit 10 5 0 silver 15 | | 7 1 withdraw 30 ...