Posts

Showing posts from April, 2014

jquery - Input field value's length -

is there way jquery find out width of text inserted in input field of type text? need info because need perform work when achieved. helpful me find jquery event occurring when user entering 1 more character in input field make first character of whole value invisible? please see example http://jsfiddle.net/j58ht/2/ <input style="width: 35px;" type="text"> <span></span> $('input').on('keyup',function(){ var input = $(this); input.next("span").text(input.val().length + " chars"); }); try entering characters 123456 in input field. when entering char 6 first char 1 invisible. i need event, when value overlaps input. you can find length of value using jquery's val() method returns current value of form element string. can use length property string. $('input').on('keyup',function(){ alert('this length ' + $(this).val().length); }); here

java - Google App Engine Datastore too slow persistence -

i'm developing gae/j app using jdo manage datastore. offers number of endpoints interact data , on. i'm developing javascript client endpoints. situation: first have endpoint method token getsessiontoken(user usr) , generates session token, assigns user , stores both user , session token in datastore. then have endpoint method info getinfo(token token) receives session token, checks if session token corresponds user , if so, returns info. problem from javascript client, call first method , fine. call second method retreved session token, , receive error saying session token doesn't correspond user... i've checked , realised error happens because new session token has not been persisted yet! question my current solution make javascript client call second method once, , if receives error, wait while , call again... there better solution? edit: this code invloved in first method call idea why takes long... endpoint: @apimethod( name =

jquery - Rails 3.2: Why does will_paginate page link disapear after first click -

i'm trying implement jquery ajax rails app , far it's working, there bug unable wrap head around. basically, have books page lists books using will_paginate group them in pages of 5 each. my index.html.erb file books view has snippet of code: <div id="page_paginate"> <%= will_paginate @books %><br /> <%= render @books %> </div> the @books partial saved _book.html.erb , looks this: <div class="books_box"> <h1><%= book.title%><span>(<%=link_to book.author.name, book.author%>)</span></h1> <img alt="image" src="<%= book.image_url %>"> <div class="book_info"> <div class="detail_button"><%= link_to "details", '#' %></div> <div class="like_button"><%= link_to "like", '#' %></div> </div

PHP XML error parsing SOAP payload on line 3: Reserved XML Name -

this question has answer here: xml error parsing soap payload: reserved xml name 3 answers i'm quite new webservices , soap, , followed tutorial , came code: soap server : <?php include("lib/nusoap.php"); include("getdb.php"); function getusers() { $user_id = $_get['user_id']; $result = mysql_query("select * -table name- user_id = '$user_id'"); $try = mysql_fetch_array($result); return join(",", array( $result['username'], $result['password'] )); } $server = new soap_server(); $server->register("getusers"); $server->service($http_raw_post_data); ?> soap client : <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html> <head>

java - Change marker color in Google Maps V2 -

i'm trying change color of marker. i have this: private void addmarker(googlemap map, double lat, double lon, int title, int snippet) { map.addmarker(new markeroptions().position(new latlng(lat, lon)) .title(getstring(title)) .snippet(getstring(snippet))); and add marker: addmarker(map, 40.748963847316034, -73.96807193756104, r.string.title, r.string.snippet); i want change color of marker , thought easy , implement this: private void addmarker(googlemap map, double lat, double lon, int title, int snippet, int icon) { map.addmarker(new markeroptions().position(new latlng(lat, lon)) .title(getstring(title)) .snippet(getstring(snippet)) .icon(bitmapdescriptorfactory.defaultmarker(bitmapdescriptorfactory.(getst

ruby on rails - I18n strange behaviour -

i using i18n redis store, , have strange behavior after updating rails 3.2.13 [6] pry(main)> i18n.t("my_website_field") => "m" [7] pry(main)> $redis.get("en.my_website_field") => "\"my website\"" i getting first letters of translations to knowledge believe redis-store has issues versions of rails (3.2.13 happens 1 of those). since curious why happening opened github change log , took @ logic changed in 3.2.12 -> 3.2.13 update. the main change noticed dependency chain in activesupport i18n. code changed from s.add_dependency('i18n', '~> 0.6') to s.add_dependency('i18n', '= 0.6.1') the other changes (from changelog): add i18n scope `distance_of_time_in_words so if had take educated guess forcing of use of i18n 0.6.1 created type of conflict redis-store. note: i continue issue change logs i18n , post if have more information on subject. can't

Liferay JSP is redirecting me to a page i dont want to be redirect -

i developing liferay portlet. portlet pretty done have big issue jsp redirection. every time query successful redirects not jsp want home jsp page. the question how can make redirect me jsp page want? i using liferay sdk eclipse, tomcat 7 , date liferay any appreciated! thanks in advance! from question seems want redirect jsp controller use :- response.setrenderparameter("jsppage", "jsppath"); let me know if have problem !!!

z3 - Questions about using Z3Py online to apply the Routh-Hurwitz Theorem -

Image
example 1: we apply rh theorem using following code k = real('k') print simplify(and(12 - 3*k >0 , 20 + 0.25*k >0)) and output is: ¬(k ≥ 4) ∧ ¬(k ≤ -80) example 2: we apply rh theorem using following code k, a1, a2, a3 = reals('k a1 a2 a3') a1 = 20 + 1.5*k a2 = 4 a3 = 4*k -100 print simplify(and(a1 > 0 , a3 > 0, a1*a2 > a3)) and output is ¬(k ≤ -40/3) ∧ ¬(k ≤ 25) ∧ ¬(k ≤ -90) example 3: we apply rh theorem using following code k = real('k') a1 = 10 a2 = 30 - 2.4*k a3 = 2 a4 = 100 + 5*k print simplify(and(a4 > 0, a1*a2*a3 > a3**2 + a4*a1**2)) and output is ¬(k ≤ -20) ∧ ¬(k ≥ -2351/137) example 4: we apply rh theorem using following code u, s, d, g, n, b , = reals('u s d g n b a') c1 = 2*u + s + d + g prove(implies(and(u > 0, s > 0, d >0, g >0), c1 > 0)) c2 = u*g + u**2 + s*u + 2*d*u + s*d + s*g + d*g c3 = d*u**2 - n*a*b*s + d*u*g + s*d*u + s*d*g prove(implies(and(u > 0

iphone - UIButton with custom view - addTarget:action:forControlEvents: does not work -

my button follows created label1 created label2 created customview ( uiview ) added label1 , label2 on custom view created mycustombutton( uibutton ) added customview on mycustombutton i have done userinteractionenable custom_view, label1 , label2. then added [mycustombutton addtarget:self action:@selector(onbuttonclick:) forcontrolevents:uicontroleventtouchupinside]; and -(void)onbuttonclick:(uibutton *)sender { } but above function never called when touch button. solution? just minor problem code friend, need add 1 following line code, forget setuserinteractionenabled:no uiview allow click button uilabel *lbl1 = [[uilabel alloc] initwithframe:cgrectmake(0, 0, 100, 30)]; [lbl1 settext:@"one"]; uilabel *lbl2 = [[uilabel alloc] initwithframe:cgrectmake(0, 30, 100, 30)]; [lbl2 settext:@"two"]; uiview * view = [[uiview alloc] initwithframe:cgrectmake(0, 0, 200, 130)]; [view setuserinteractionenabled:no]; [view addsubview:lbl1]; [

java - Using multiple ResourceBundles -

i'm create game, , @ start i'm asking user 1/2/3 number input confirm language selection (1 dutch, 2 french, 3 english). have 3 properties files resourcebundles have no idea how load them game. when user puts in 1 in joptionpane, there should method (or something?) sets "language" dutch (cuz nr 1 inserted), or french if 2 inserted or 3 english. and has work on several app-classes, startplayerapp, startworldmap, etc... in startplayerapp example ask user enter name, after language selection, if picked dutch should ask "wat uw naam?", if picked english "what name?" etc... for works, "hardcoded" in string in normal dutch, it's unilanguage compatible now, not multilanguage :( if me possible (preferably before end of week :p) amazing gesture! it's schoolproject :(!! name resource files reflect language: myresource.properties myresource_fr.properties ... then use resourcebundle , let detect language , load appropr

How to access single character from a string in COBOL? -

how access particular character in string in cobol? for example if string "work" have access character 'w' in string , store in character. need matching character, , not position of character. for example in c, following extract i'th character in string, char data[5] = "work"; char temp; temp = data[3]; temp have value 'k' now need same in cobol. the first thing understand array indices 0 based in c , 1 based in cobol. next cobol , c have differnt ways of representing character strings. in c string stored array of characters, end of string typically represented using binary 0 (null \0). cobol has no such convention. strings stored in named data items of specified length. these items typica

maven - Execute plugin only if another execution succeeds -

i have 2 executions of plugin run in 2 different phases. instance: <executions> <execution> <id>a</id> <phase>pre-integration-test</phase> </execution> <execution> <id>b</id> <phase>post-integration-test</phase> </execution> </executions> i want execute b if succeeds. how do that? resolved using antrun maven plugin delete operations set run on post-integration-test, insert operations set run on pre-integration-test phase , using ant-contrib library. i've put insert operations on trycatch block. if exception caught, delete operations used , fail build. here's code example insertoperation.xml ant script (i won't put "project" , "target" tags, "target" name "dbunit-insert"): // classpath used maven's test scope classpath <taskdef resource="net/sf/antcontrib/antcontrib.proper

python - Can't save a form in Django (object has no attribute 'save') -

the following form: class advancedsearchform(forms.form): valueofres = forms.choicefield (label="res", choices = ((0, 0),(2.2, 2.2)), required= false) the following view: def advancedsearch(request): if request.method == "post": search = advancedsearchform(request.post, request.files) if search.is_valid(): new_search = search.save(commit=false) i'm getting error 'advancedsearchform' object has no attribute 'save' ... why? save available modelform default, , not forms.form what need is: 1. either use ` class advancedsearchform(forms.modelform): valueofres = forms.choicefield (label="res", choices = ((0, 0),(2.2, 2.2)), required= false) class meta: model=search #or whatever object or 2) def advancedsearch(request): if request.method == "post": search_form = advancedsearchform(request.post, request.files) if search.is_valid()

Exchange Web Services and C#: How to get appointments from shared calendar -

i trying list of appointments day on shared calendar. have done own calendar tied user account. tried getting folderid of shared calendar, haven't been able find it. i used access calendar using folderid , worked: console.writeline("listing appointments..."); //open calendar calendarfolder calendar = calendarfolder.bind(service, wellknownfoldername.calendar); //query appointments in next 10 days //finditemsresults<appointment> appointments = calendar.findappointments(new calendarview(datetime.now, datetime.now.adddays(10))); //find appointments , write out subject foreach (appointment appointment in service.finditems(new folderid("folderidhere"), new itemview(int.maxvalue))) console.writeline(appointment.subject); i don't know if work access shared folder, , can't figure out folderid of shared folder. you try : calendarmodule calmodule = (calendarmodule)this.

java - Lock object which fields are actually being read -

we have such situation class pole extends thread { jbutton pole; plansza p; pole neighbours[] = new pole[4]; public pole(plansza p) { this.p = p; pole = new jbutton(); int r,g,b; r=p.rndcolor(); g=p.rndcolor(); b=p.rndcolor(); pole.setbackground(new color(r,g,b)); } public pole() { ; } public void run() { while(true) { thread.yield(); try { thread.sleep((int)p.rndtime()); } catch(interruptedexception e) { ; } if(p.rnd.nextdouble()<=1-p.p) setneighbourscolor(); if(p.rnd.nextdouble()<=p.p) setrandomcolor(); } } public void setrandomcolor() { synchronized(this) { int r,g,b; r = p.rndcolor(); g = p.rndcolor();

Emitting node.js views and scripts as snippets -

i have built node.js app realize "snippets" included in external web applications. means must create javascript scripts included , called external apps call node.js view , scripts/css . does node.js provide way natively or have create script embeds view , related client libraries? enable cross-origin resource sharing: cross-origin resource sharing (cors) specification enables open access across domain-boundaries. if serve public content, please consider using cors open universal javascript/browser access. must read: http://enable-cors.org/#how-expressjs important stuff: access-control-allow-origin access-control-allow-headers

Find all possible paths w/o loops in Graph in Prolog -

i got homework assignment logic course, more or less don't have clue how solve it... query like ?- find(a,[r(a,[b,d]),r(b,[a,c,e]),r(c,[b]),r(d,[a,e]), r(e,[b,d,f]),r(f,[e,g]),r(g,[f])],path). prolog should return possible paths in given graph. terms r(x,list) define graph, meaning nodes in list can reached node x. in case, output be: path = [a,b,c] ; path = [a,b,e,d] ; path = [a,b,e,f,g] ; path = [a,d,e,b,c] ; path = [a,d,e,f,g] ; false. although hang of numerous solutions here on se , on web in general similar problems, i'm somehow dumb figure out how work definition of graph in assignment. i figure find(start,...) should called recursively members of list in r(start,list), total newbie prolog(we did standard family tree stuff...) don't know how that. any appreciated. i'm aware of fact don't have start with, spent half night trying figure out , don't have clue. /edit: for starters, think i'll need kind of base case abort recursion.

file io - Is there a portable way to redirect stdin to string in C++? -

is possible in c++ redirect stdin string in c++? using freopen can redirect stdin file, both scanf , cin use content of file. using manipulations stringstream , cin.rdbuf() can redirect cin string, call cin work string. scanf continue work previous input stream. guess possible unix's pipes it's not available under windows. is possible solve in portable way? this isn't best way it, can make work this: // warning - has side effects (sets noskipws) don't care (its example) ostream& operator<< (ostream& out, istream& in) { in >> noskipws; char c; in >> c; while (in) { out << c; in >> c; } return out; } int main() { ostringstream inputstr; inputstr << cin; inputstr.str(); // contains data stdin return; }

imaging - Why my pixel value of DICOM is beyond 'Largest Image Pixel Value' attribute? -

i'm using dcmtk fetch image data dicom data. have following information sample image: (0028,0002) samples per pixel: 1 (0028,0004) photometric interpretation: monochrome2 (0028,0010) rows: 256 (0028,0011) columns: 256 (0028,0030) pixel spacing: 1.5625\1.5625 (0028,0100) bits allocated: 16 (0028,0101) bits stored: 12 (0028,0102) high bit: 11 (0028,0103) pixel representation: 0 (0028,0106) smallest image pixel value: 1 (0028,0107) largest image pixel value: 1060 (0028,1050) window center: 474 (0028,1051) window width: 1000 (0028,1055) window center & width explanation: algo1 when applied window/center value real pixel value of data, many of them white. iterate on pixel values , found many pixel value (larger 80 percent) beyond largest image pixel value . many of them beyond of 5x of largest! made resulting image near complete white. strangely don't why when divide pixel values 256 resulting image near image expect. can't understand why

c# - IEnumerable list delplayed from enum values -

i have enum class below know how able send enum list of ienumerable dont see number actual name e.g. "monday" on list public enum weekdays { monday = 1, tuesday = 2, wednesday = 3, thursday = 4, friday = 5, saturday = 6, sunday = 7 } you can use enum.getnames() list of names. string []names = enum.getnames(typeof(weekdays));

Limit number of tweets in Tumblr -

i'm using twitter block in tumblr displays latest tweets twitter feed. right displays last 20 tweets want show last 5 tweets. have idea how can that? the code i'm using right below. tried changing .length variable 5 in loop, didn't anything: {block:twitter} <div id="twitter" style="display:none;"> <h3><a href="http://twitter.com/{twitterusername}">latest tweets</a></h3> <div id="tweets"></div> </div> <script type="text/javascript"> function recent_tweets(data) { (i=0; i<data.length; i++) { document.getelementbyid("tweets").innerhtml = document.getelementbyid("tweets").innerhtml + '<a href="http://twitter.com/{twitterusername}/status/' + (data[i].id_str ? data[i].id_str : data[i].id) +

php - Laravel ORM Model Hierarchy? -

i want create one-to-many relationship 1 model. exactly want build hierarchy of categories. for have migration script creates foreign key / column category_id. in database easy. create 1 category "cars". create category "audi" parent id linked id of "cars". but when create function in orm model this: public function category() { return $this->belongs_to('category'); } then create infinite loop. what doing wrong? maybe not possible? thank your suggestions! now got working orm functionality. works fine, view can handle it! public function children() { return $this->has_many('category','category_id'); } public function parent() { return $this->belongs_to('category','category_id'); }

iphone - Add a shadow to CAShapeLayer, so that the inside remains transparent -

i want add glow effect path, blue glow around (os x) interface elements when have focus. i used cashapelayer (rectangular) path: self.borderlayer = [cashapelayer layer]; cgpathref path = cgpathcreatewithrect(self.bounds, null); [self.borderlayer setpath:path]; cgpathrelease(path); in end gives me transparent uiview border around it. (in concrete case it's dashed line additional animation, doesn't matter particular question) i played around shadow properties of calayer, fill whole layer. self.borderlayer.shadowpath = self.borderlayer.path; self.borderlayer.shouldrasterize = yes; what want uiviews surrounding line drops shadow, inside of uiview remains transparent. i having similar problems seeing shadow inside wanted instead of glow. solved using 2 calayers. one, in code, '_bg' background ( in case black opacity of 0.55) , white border. other layer, in code '_shadow', has clear background , adds glow effect. _bg subview of _shadow la

mysql - How to write a query with join, update and order by? -

i have 2 tables: tblrider , tbl_score. tblrider has information riders (competitors) , in tbl_score riders's scores saved. want update column halfpipefinal in tblrider. standard column set on 0, want set on 1 riders 20 best scores. (so 20 best riders can participate in final , have 1 in column halfpiperider) this query: update tblrider join tbl_score on tblrider.riderid = tbl_score.riderid set tblrider.halfpipefinal = 1 `gameid` =35 order `score` desc limit 20;** if run query error: "incorrect usage of update , order by" went looking , apparently can't use update , order in join. looking other way write query without order in it, can't find it. all appreciated. thanks in sql can't have order by part of update itself. can make filter subquery, give alias , join it... update tblrider r join ( select riderid tbl_score gameid = 35 order score desc limit 20 ) s on r.riderid = s.riderid set r.halfpipefinal = 1;

matlab - getting color information from surface plot -

spx = linspace(min(x), max(x),200); spy = linspace(min(y), max(y),200); [xc,yc] = meshgrid(spx,spy); zc = bin2mat(x,y,z,xc,yc); zci = inpaint_nans(zc); figure; surface(xc(1,:),yc(:,1),zc); shading('interp'); axis equal i color associated vertices or faces if used surf2patch function in matlab not sure you're looking for... surf_h = findobj(gca, 'type', 'surf', 'tag', []); cdata = get(surf_h, 'cdata');

php - Symfony form validate selected members of entity -

i using symfony form validating login data tie entity class (which has validation defined members) , need form validate email , password portion. in form class, don't add email , password form. however, when data submitted, still validates them , shows errors @ top of form how not validate other members(city, sex, etc) without changing entity class. so there's entity class : name, email, sex, password, city. fields required login form email , password. still errors other two use validation groups ... entity class : // src/acme/blogbundle/entity/user.php namespace acme\blogbundle\entity; use symfony\component\security\core\user\userinterface; use symfony\component\validator\constraints assert; class user implements userinterface { /** * @assert\email(groups={"registration"}) */ private $email; /** * @assert\notblank(groups={"registration"}) * @assert\length(min=7, groups={"registration"}) */

vb.net - Your license is not valid in diff tool -

i've been trying out semantic merge beta codice software, when try use diff tool (either within visual studio or manually desktop) following error: your license not valid, not able use diff tool. please contact support. i've uninstalled , reinstalled, , don't see newer version or updates product, , working yesterday. need purchase license it, or broken on machine? it seems current license not valid vb.net (it valid csharp ). our first beta, csharp , , maybe generated trial beta. in order vb.net license, need have request new license new language. follow these steps: open semanticmerge tool (resolving merge) click get license button, get new license website you can our website directly. hope helps.

javascript - Backbone.js - Not able to trigger an event in a collection -

i'm new javascript , backbone , came across error. router = backbone.router.extend({ routes: { ":albumid": "load" }, load: function (albumid) { if (controller.collectioninitialized == true) { console.log("reset"); album.trigger("clear"); } var album = new album([], { title: albumid }); controller.trigger("collectioninit"); controller.trigger("switchalbum", albumid); } }); controller = backbone.model.extend({ currentalbum: "", collectioninitialized: false, initialize: function () { console.log("controller initialized"); this.on("switchalbum", function (newalbum) { this.currentalbum = newalbum; }); this.on("collectioninit", function () { this.collectioninitialized = true; }); } }); al

python - While Loop Complications -

i'm writing python program based on accordion style of solitaire. i've written above code , have been playing around last couple hours can't seem make loop run correctly. whatever reason either run through loop once , not ask input again, or run through once, ask input, , no matter input crashes. ideas i'm doing wrong here? here code: import random print("command options:") print("1c - play card c onto pile 1 position back, ignored if invalid") print("3c - play card c onto pile 3 positions back, ignored if invalid") print("c - count of undealt cards") print("d - deal next card") print("h - print screen") print("r - resign game (quit early)") print("x - exit program") cards=['ac','2c','3c','4c','5c','6c','7c','8c','9c','tc','jc','qc','kc','ad','2d','3d',

ruby on rails 3.2 - Compass file to import not found -

i'm undergoing process of upgrading our rails 3.0.* app 3.2.13 in past, have used compass (via compass-rails) gem extensively. our stylesheets located in public/sass , use compass in following way: @import "compass/reset/utilities"; upon upgrading, moving stylesheets app/assets/stylesheets directory one of files @imports compass/reset/utilities receiving following error when attempts compile: sass::syntaxerror: file import not found or unreadable: compass/reset/utilities. load path: blahblahblah (in blahblahblah/app/assets/stylesheets/common/reset.css.scss)" i have compass.rb config file sets sass_dir public/sass i'm not sure how adjust point correct new directory. i have gist available @ https://gist.github.com/naderhen/b0908c55739c78cb45bd reset.scss , compass.rb file in gemfile, have following group :assets gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' gem 'uglifier'

c++ - Off-axis projection with glFrustum -

Image
i trying off-axis projection of scene opengl , gave read document robert kooima's off-axis projection , have better idea of has done there still pieces finding tricky here. got know of off-axis projection code opengl follows: code 1: glmatrixmode(gl_projection);   glloadidentity();             glfrustum(fnear*(-ffov * ratio + headx),    fnear*(ffov * ratio + headx),    fnear*(-ffov + heady),    fnear*(ffov + heady),    fnear, ffar);             glmatrixmode(gl_modelview);   glloadidentity();   glulookat(headx*headz, heady*headz, 0, headx*headz, heady*headz, -1, 0, 1, 0); gltranslatef(0.0,0.0,headz); had been normal perspective projection user @ center of screen, easy understand comprehend.               screen                     |                   |  h = h/2                   |   x----- n -----------                   |                   |  h = h/2                   | with user @ x

php - codeigniter include common file in view -

hi have site developed in codeigniter , wanto store file called common.php javascript/php function use in many pages. have tried in mode: require(base_url().'application/libraries/common.php'); //i have tried include this return me error: a php error encountered severity: warning message: require() [function.require]: http:// wrapper disabled in server configuration allow_url_include=0 i'm going php.ini , turn on allow_url_include, restart apache , when try load page return me error: a php error encountered severity: warning message: require() [function.require]: http:// wrapper disabled in server configuration allow_url_include=0 filename: backend/hotel_view.php line number: 6 php error encountered severity: warning message: require(http://demo.webanddesign.it/public/klikkahotel.com/application/libraries/common.php) [function.require]: failed open stream: no suitable wrapper found filename: backend/hotel_view.php line number: 6 fatal error: requi

excel - How to use a passed through integer in a range when copying cells -

i've looked around on internet , found no sucess. problem im trying copy range of p6 p(value of integer passed in sub) first worksheet values b2 b(the value passed through) of second worksheet: sub copy_cells(length integer) worksheets("sheet2").range("b2: b+length").value = activesheet("sheet1").range ("p6:p+length").value end sub enter code here could use worksheets("sheet2").range(worksheets("sheet2").cells(2, 2), worksheets("sheet2").cells(length, 2)).value = worksheets("sheet1").range(worksheets("sheet1").cells(2, 16), worksheets("sheet1").cells(length, 16)).value

Compiling multiple Objective-C files on the command line with clang -

hopefully simple question. i'm trying learn basic objective-c compiling command line, clang. understand xcode better solution complex projects , plan on moving soon, feel understand language better if can compile manually in terminal, , small introductory programming projects find less of hassle compile in terminal having start new project. so question is: how compile objective-c program consists of multiple files (from command line)? (i'm trying fraction program chapter 7 of kochan's textbook, main.m , fraction.m file both #import "fraction.h", , fraction.h file imports foundation framework.) compile single file use like clang -fobjc-arc main.m -o prog1 but if type , want include files other main.m in project, errors including: ld: symbol(s) not found architecture x86_64 clang: error: linker command failed exit code 1 (use -v see invocation) if try add additional files command arguments, like clang -fobjc-arc main.m fraction.h fraction.m -o prog1

'Segmentation fault' with pthreads and arrary of pointers -

ok, i've hit wall program. using pthreads implement parallel program, have come "segmentation fault" block. //this in main function //{{{{{ //creates array holds pointers bodies body **bodies = new body*[number_of_bodies]; int bodiesperthread = number_of_bodies / number_of_threads; //creates array hold pthreads pthread_t threads[number_of_threads]; //here partition array of bodies each thread for(int j = 0; j < number_of_threads; j++) { if(j == (number_of_threads - 1)) { //create new array hold bodies body **subbodies = new body*[bodiesremaining]; // insert bodies new sub array. for(int = nextindex; < bodiesremaining; i++) subbodies[i] = bodies[i]; // launch thread given sub array. pthread_create(&threads[j], null, &tree::u

android - EditField in RelativeLayout has input lag -

so have layout simple , have weird interactions going on. when type on "search_field" edittext input works expected. when type in search_field2 field input randomly lagged , slow. not every character delayed enough unusable. the difference between 2 edittext fields lagged 1 nested in relative layout. know causing it? <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical" android:layout_margin="10sp" > <edittext android:id="@+id/search_field" android:layout_width="match_parent" android:layout_height="wrap_content" android:ems="10" android:imeoptions="actiondone" android:background="#fff"

c++ - Removing a Specific Instance from a CSpriteList -

so i'm trying code platformer in c++ end of year project first year student. i have group of enemies stored within cspritelist. i want able remove 1 specific example list upon specific action, such on hittest csprite. i have no idea how i've been searching internet week, reddit, irc's, google, no 1 has been able me here. i decided try sign on here , see if can myself here. the engine i'm using can found here . my list initialised as: cspritelist theenemies; i'm working within following loop create destruction: for each (csprite *esprite in theenemies) { if (esprite->hittest(&rexplode)) { // destruction code here } }

CMake: Access variables across sub directories -

i have 2 sub directories root on 1 has line: set(${libname}_publicheaders localizeresource.h ) i want able access variable other subdirectory. how can this? @joakimgebart's answer more common way go this. however, can use get_directory_property directly within second subdir achieve you're after. i see in comment, you've used ${lib_name}_publicheaders , in question have ${libname}_publicheaders . cause of problems, since command should work this: get_directory_property(myvar directory ${cmake_source_dir}/abc definition ${libname}_publicheaders) however, there couple of provisos: this has called after setting variable in subdir. i.e. you'd have ensure add_subdirectory(abc) called before add_subdirectory 1 used. if libname set inside same subdir (abc), you'll need retrieve value first. so, while less common solution, has advantage doesn't "pollute" global namespace subdir-specific variables - works su

PHP Reload Current Page On Form Submit -

i have form on page submit comment, , once user places comment reload page. this got $insertgoto = "employer.php?employer=" . $row_employer_page['employer'] . ""; if (isset($_server['query_string'])) { $insertgoto .= (strpos($insertgoto, '?')) ? "&" : "?"; $insertgoto .= $_server['query_string']; } header(sprintf("location: %s", $insertgoto)); } it works, got error on submit. notice: undefined variable: row_employer_page in /u/students/m/*******/public_html/cis231/project/employer.php on line 51 warning: cannot modify header information - headers sent (output started @ /u/students/m/*******/public_html/cis231/project/employer.php:51) in /u/students/m/*******/public_html/cis231/project/employer.php on line 56 the lines references code posted above. i'm not sure what's going on, reload page how want throws error you can not send headers once you&

c# - How to return IQueryable<T> for further querying -

i'm trying pagedlist.mvc library here https://github.com/troygoode/pagedlist which has usage sample var products = myproductdatasource.findallproducts(); //returns iqueryable<product> representing unknown number of products. thousand maybe? var pagenumber = page ?? 1; // if no page specified in querystring, default first page (1) var onepageofproducts = products.topagedlist(pagenumber, 25); // contain 25 products max because of pagesize typical implmentations of myproductdatasource.findallproducts(); along lines of public iquerable<t> myproductdatasource.findallproducts() { using ( var ctx = new myctx() ) { return ctx.mylist().where( .... ); } } which of course has invalidoperationexception() , dbcontext disposed message looking best practices on how return iqueryable can used here without issues ? you need "move up" scope of data context: public iquerable<t> myproductdatasource.findallproduct

javascript - Ajax request to get HTML doesn't execute scripts -

i've seen question many times here many different answers. code stopped working when moved jquery 1.5.1 1.9.1. $.ajax( { type: 'get', url: mappath($(this).attr('path')), cache: false, data: '{}', datatype: 'html', success: function (result) { result = $.parsehtml(result); $('#dialog').html(result); $('#dialog').dialog('open'); } } }); the result contains link javascript file src attribute. before upgraded script loaded , executed after being added #dialog container. not. 1 suggestion tried after parsehtml() method: $.getscript("/myscript.js"); that works that's not want. loading container shouldn't have know loaded container. if loaded container needs script include script needs run when container loaded. i've tried suggestions of finding script elements eval() them. once parsehtm

intuit - Deductions in Quickbooks Payroll -

we trying import deduction information quickbooks system. don't see looks deductions on page http://developer.intuit.com/qbsdk-current/common/newosr/index.html , , based on internet searches, looks 1 of features missing qb sdk. still accurate? thanks,

java - How do I get my JFrame that displays an array of JPanels to update itself? -

i'm building board game cs course, i've started engine - backbone - , i've perfected it, i'm still stuck on gui part though. in engine, have double array initialises board pieces, , has getwinner , move methods. in gui part, created jframe , set layout gridlayout, , i've double array there checks engine's array , prints board board pieces accordingly.. however, whenever move, engine's array registers move doesn't displayed on jframe.. i've no idea on how it.. here's main class in gui package: package eg.edu.guc.loa.gui; import java.awt.*; import java.util.arraylist; import javax.swing.*; import eg.edu.guc.loa.engine.*; import eg.edu.guc.loa.engine.point; @suppresswarnings("serial") public class loa extends jframe{ static tiles[][] jboard; static board b = new board(); static color temp; static color col1 = color.dark_gray; static color col2 = color.light_gray; static jframe loa = new jframe(); jbut

Crystal Reports : Crosstab refuses not to paginate -

i using crystal reports 11 (xi) , have crosstab has quite few rows it. publishing format excel, pagination doesn't make sense. however, no matter repeats column/crosstab headers every couple dozen lines. i've tried: -increasing page size definition max size (12x18) portrait -turning off pagination in output settings -turning off horizontal pagination -deleting column headers (works) cannot delete crosstab header i'm running out of ideas. if goal create excel file pivoted data crystal reports not best way it. check first 5 minutes of video: http://www.r-tag.com/pages/preview_demo.aspx compares same data presented cross-tab in crystal reports , pivot report based on sql ad-hoc query. ssrs part of comparison , better choice crystal , sql ad-hoc query favorite pivoted data. p.s. proposing alternative because tool free, save development time , create better formatted excel file. if using boe , want keep report there might not work you.

ruby on rails - Validate presence of shipping address unless it's same as billing address -

i have in order class. want validate presence of shipping_address unless it's same billing_address . specs keep failing, however. class order < activerecord::base attr_writer :ship_to_billing_address belongs_to :billing_address, class_name: 'address' belongs_to :shipping_address, class_name: 'address' accepts_nested_attributes_for :billing_address, :shipping_address validates :shipping_address, presence: true, unless: -> { self.ship_to_billing_address? } def ship_to_billing_address @ship_to_billing_address ||= true end def ship_to_billing_address? self.ship_to_billing_address end end but keep getting failed specs (expected example not valid): describe "shipping_address_id" context "when shipping address different billing address" before { @order.ship_to_billing_address = false } it_behaves_like 'a foreign key', :shipping_address_id end end shared_examples 'a foreign key'

javascript - Canvas only drawing in Chrome -

http://jsfiddle.net/mp4yg/5/embedded/result/ heres plugin i've been working on create hub-spoke diagrams. i've avoided asking questions pertaining far (gonna go ahead , pat myself on one) but, i've hit roadblock... my functions working great reason in chrome (and partially in opera). i'm using <canvas> draw lines between circles, none of render outside of chrome. want work in @ least ie 8+, , should work in updated ff , safari, etc. i'm self taught on of suggestions , feedback on code appreciated, although i'm not sure place that.