Posts

Showing posts from June, 2010

properties - Objective-C property name mapping -

i wonder if there easy , fast way map property name adopted protocol property comes base class? suppose example: @protocol proto <nsobject> @property (nonatomic, readonly, strong) nsstring *objectid; @end ... @interface mybase : nsobject @property (nonatomic, readonly, strong) nsstring *objectid; @end ... @interface myclass : mybase<proto> @end in case guess don't need - property there getter , setter promise have them given when adopting protocol fulfilled. if property in mybase called objid , not objectid ? there language tricks using dynamic , synthesize , getter= or other way make refer base class' property without manually defining getter/setter in myclass , returning/setting base class' property? rationale: want cover third party library protocol layer used ui can change provider similar 1 under hood (or provide simulator testing). protocols define replicate api of library, property names include naming don't want in interface...

ios - Why would all views in a view have userInteractionEnabled set to NO -

i have view , unknown reason, it's not receiving touches. when debugged view, i've found out views' userinteractionenabled set no . problem that, haven't set anywhere; neither in interface builder (triple checked) , code. problem started when first created regular uiviewcontroller in interface builder, without subclass or custom code. know it's near impossible tell without code samples, project heavily complicated, , i've said, problem appearing in regular uiviewcontroller (no subclass) i've set in interface builder, there no relevant code mean anything. rest of app works fine, though. what can possibly cause views in regular, default view controller become userinteractionenabled = no ? found answer myself after traversing window's recursive description more carefully. had scroll view, , inside that, content view, , other views inside. i'm on pure auto layout, scroll view's content view needs calculate it's own intrinsic size....

ios - How to download video from M3u8 file? -

i have following m3u8 file. http://pastie.org/10114441 i want download video file above file. have google lot , found m3u8 parser . did't me. i have done following things. nsstring *str = [nsstring stringwithcontentsoffile:[[nsbundle mainbundle] pathforresource:@"1" oftype:@"m3u8"] encoding:nsutf8stringencoding error:nil]; m3u8segmentinfolist *list= [m3u8parser m3u8segmentinfolistfromplanstring:str baseurl:[nsurl urlwithstring:@"http://hls.ted.com/talks/2238.m3u8?sponsor=ripple"]]; nslog(@"%@",list); but returns nil. can me download video.? hotstar uses m3u8 file type. in site can watch online video can't download. found way download video site. download zip file. extract zip file , check property (361 files 33 folders). open hotstarlivestreamer.php in explorer , download again , replace it. open hotstarlivestreamer.bat. (note : if not work open admin). paste hotstat playable video url (eg. http://www.ho...

How to display database in php in order to show it in android app -

i have problem displaying mysql database running in xampp server, typed code connect doesn't show in php page didn't let me retrive data android app. here's sql query: create table `products` ( `id` varchar ( 32 ) not null, `description` varchar( 1024 ) not null , primary key (`id`), )engine = myisam ; and php code : <?php $username = 'root'; $password = ''; $dbname = 'qrtest'; $dbname = mysql_connect('localhost', $username, $password, $dbname) or die ("unable connect"); echo"connected succesfully!"; mysql_select_db("qrtest", $dbname) or die("can not connect database"); $result = mysql_query("select * products")or die("cannot select table"); while($row = mysql_fetch_assoc($result)) { output[] = $row; } print(json_encode($output)); echo"encoding done"; mysql_close($dbname); ?> it should've shown me this: [{"id":"coca c...

git - How to go to the merge menu if I already close it once in intellij idea? -

Image
i use idea git integration use git. merged brabch develop branch , saw lot of conflicts. cloased merge window , see following file content: <<<<<<< head //for unregistered users unfilled email if (userservice.finduserbyemail(newemail) != null) { return new responseentity<>( msgsource.getmessage("registcontroller.user_exists", null, locale_ru), httpstatus.accepted); } long userid = (long) session.getattribute(user_id); user = userservice.finduserbyid(userid); ======= terminaluser user = null; long userid = (long) session.getattribute(user_id); if (userid == null) { user = userservice.createemptyuser(); session.setattribute(user_id, user.getuserid()); }else { user = userservice.finduserbyid(userid); } >>>...

javascript - Bxslider don't initiated with requirejs -

i have problem bxloader , requirejs . invite module bxslider per require.js in app. unfortunately bxloader doesn't initialize. my view.html <div class="slider5" > <div class="slide"><img src="http://placehold.it/350x150&text=foobar1"></div> <div class="slide"><img src="http://placehold.it/350x150&text=foobar1"></div> </div> main.js requirejs.config({ paths: { jquery: "lib/jquery", "jquery.bxslider":"lib/jquery.bxslider" }, shim: { "jquery.bxslider": { deps: ["jquery"], exports: "bxslider" } after debugging, have found length of slider elements (length == 0): bxslider.js $.fn.bxslider = function(options){ if(this.length == 0) return this; how can be?any thoughts? define(["app",'jquery', "jquery.bxslider", ...

ruby on rails - Using Javascript to change target div id in link_to -

so i'm using rails , nested_form, , have following link_to_add code: <%= f.link_to_add :exptypes, id:"addtab", :data => { :target => "#exptype_new_3" } %> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> add experimental type <script> $('#addtab').click(function() { add_tab('exptype'); }) </script> <% end %> the page source looks this: <li role="presentation"> <a class="add_nested_fields" data-association="exptypes" data-blueprint-id="exptypes_fields_blueprint" data-target="#exptype_new_3" href="javascript:void(0)" id="addtab"> <span class="glyphicon glyphicon-plus" aria-hidden="true"></span> add experi...

android - How can I set Imageview and Textview on same line in LinearLayout -

i want set imageview , textview on same line in linearlayout imageview higher textview. here code: string b[] = cacbuocthuchien.split("#"); (int j = 0; j < b.length; j++) { linearlayout.layoutparams lp = new linearlayout.layoutparams(linearlayout.layoutparams.wrap_content, linearlayout.layoutparams.wrap_content); linearlayout.layoutparams lp2 = new linearlayout.layoutparams(30,30); lp.setmargins(50, 0, 0, 0); imageview img = new imageview(recipesdetailactivity.this); textview tv = new textview(recipesdetailactivity.this); img.setlayoutparams(lp2); img.setimageresource(r.mipmap.testic); tv.setlayoutparams(lp); tv.settext(b[j] + "\n"); layouthuongdan.addview(img); layouthuongdan.addview(tv); } this can use put image in 1 line.. , work in kind of layouts. hope <linerlayout> <textview android:id="@+id/text1" android:layout_width="wrap_content" ...

c++ - Determine Xpath content via libxml -

i found following xml example not sure how xpath data can obtained in c++ (besides using boost ptree xmlparser). /* evaluate xpath expression */ xpathobj = xmlxpathevalexpression(xpathexpr, xpathctx); if(xpathobj == null) { fprintf(stderr,"error: unable evaluate xpath expression \"%s\"\n", xpathexpr); xmlxpathfreecontext(xpathctx); xmlfreedoc(doc); return; } //cout <<"result : "<<xpathobj->stringval<<endl; /* fails bus error */ what contained in xpathobj depends on xpath expression matches. if you're looking text out of it, can iterate on nodes in xpathobj->nodesetval, calling xmlnodelistgetstring, show in example. http://www.xmlsoft.org/tutorial/ar01s05.html

java - Why can't I paint on the panel -

i have made 3 panels south, east , north, trying draw circle on north panel can't figure out why not drawing. here code: want small application draws circles of different sizes , colors chosen user. import com.sun.prism.shader.drawcircle_color_loader; import javax.swing.*; import javax.swing.event.changeevent; import javax.swing.event.changelistener; import java.awt.*; import java.awt.event.mouseevent; import java.awt.event.mouselistener; public class drawing extends jframe implements mouselistener{ private int r = 255, g = 0, b = 0; private jslider colorslider, redslider,greenslider,blueslider; private jlabel colorlabel,redlabel,greenlabel,bluelabel; private int x = 50; private int y = 50; public drawing(){ jframe frame = new jframe("drawing app"); frame.setdefaultcloseoperation(windowconstants.exit_on_close); frame.setsize(800,800); container contentpane = frame.getcontentpane(); jmenubar mb = new jmenubar(); frame.s...

ruby - Trying Foreman Start and get this long error. What gives? -

this happening, i'm newb if explain means , how fix it appreciated. trying launch django project using heroku. after typing foreman start in terminal error recieve: (coffeedapp2)uzers-mbp-3:coffeedapp uzer-y$ foreman start /users/uzer-y/.rvm/gems/ruby-2.2.0@global/gems/psych-2.0.13/lib/psych.bundle: [bug] segmentation fault ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14] -- crash report log information -------------------------------------------- see crash report log file under 1 of following: * ~/library/logs/crashreporter * /library/logs/crashreporter * ~/library/logs/diagnosticreports * /library/logs/diagnosticreports more detail of. -- control frame information ----------------------------------------------- c:0014 p:-17578513380292 s:0070 e:000069 top [finish] c:0013 p:---- s:0068 e:000067 cfunc :require c:0012 p:0115 s:0064 e:000063 method /system/library/frameworks/ruby.framework/versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/ke...

java: constructor ranngeIpScanner in class cannot be applied to given types; -

im new in java have class : public class ranngeipscanner { public static void main(string ipaddress) { string ipaddress = ipaddress; string[] octets = ipaddress.split("\\."); system.out.println(octets); //some more work here ... } } and instantiated in class : ranngeipscanner scanip = new ranngeipscanner("192.198.1.200"); when try compile following error error:(45, 42) java: constructor ranngeipscanner in class com.server.scanner.ranngeipscanner cannot applied given types; required: no arguments found: java.lang.string reason: actual , formal argument lists differ in length forgive me if question little noob didnt know search for thanks in java, main method different constructor class. your code above declares main method, not define constructor. result, java implicitly creates default constructor: public ranngeipscanner() { super(); } note default constructor has no parameters. ...

haskell - Dynamically generating Rules from the content of an (Action a) -

i'm testing porting our build system make shake , have hit roadblock: given following project structure: static/a.js static/b.coffee build/a.js build/b.js that is, various input extensions map identical output extensions, straightforward "build//*.js" %> rule isn't going work. i wanted avoid using priority if possible, , writing ad-hoc build rule checks existence of either possible input felt clunky (especially since situation occurs other filetypes well), wrote following: data staticfilemapping = staticfilemapping string string (filepath -> filepath -> action a) staticinputs :: filepath -> staticfilemapping -> action [filepath] staticinputs dir (staticfilemapping iext _ _) = (findfiles (dir </> "static") [iext]) staticinputtooutput :: staticfilemapping -> filepath -> filepath staticinputtooutput (staticfilemapping _ oext _) = (remapdir ["build"]) . (-<.> oext) statictargets :: filepath -> stat...

javascript - In sails js should we plug a mongoDB database calculating app into a POST Controller? -

the main interface app return variables based on posted client, , subsequent database calculations performed in real time dedicated engine. in sails can plug engine controller used returning calculated variable? what best way implement real time link between client , engine ? sails comes sockets support built in. can transmit data out of controller client via sockets keep in sync. reference page sockets in sails: https://gist.github.com/mikermcneil/6598661 as aside, using sockets, including posting. what 'dedicated engine'? separate service running somewhere else, or logic processing data , handing controller? if want put data processing logic in same app can create service exports whatever data processing functions need. in controller handling post requests can call on services needed, process data, , emit client. sockets logic can go in same controller since communicating client interface. consider moving of sockets. if @ sails docs see has sim...

parsing - How to handle x*, x+, or x? regex-like operators in an LR parser? -

i have implemented recursive descent , peg-like parsers in past, things this: path -> segment+ segment -> slash name segment -> / name -> /\w+/ slash -> / where segment+ means "match 1 or more segment " and there's plain old regular expression matching 1 or more word characters \w+ how typically accomplish same sort of thing lr grammars/parsers? of examples of lr parsers have seen basic, such parsing 1 + 2 * 3 , or (())() , patterns simple , don't seem involve "one or more" functionality (or 0 or more * , or optional ? ). how do in lr parser generally? or lr parsing require lexing phase first (i.e. lr parser requires terminal , nonterminal "tokens"). hoping there way lr parsing without 2 phases that. definition of lr parser talks "input characters" in books/sites i've been reading, see casually/subtly line like: the grammar's terminal symbols multi-character symbols or 'tokens' found in...

android - Creating multiple asynctask for syncing files inside a service -

i have created service call main activity syncs files server. when service called call `new filelist().execute(); provides filelist uploading , downloading. on postexecute of asynctask call 2 further asynctasks uploading , downloading for (int = 0; < files_server.size(); i++) { filename=files_server.get(i); new downloadfilefromurl().execute(file_url+files_server.get(i)); try { thread.sleep(100); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } (int j = 0; j < files_phone.size(); j++) { filepath=files_phone.get(j); new uploadfiletoserver().execute(); try { thread.sleep(100); } catch (interruptedexception e) { // todo auto-generated catch block e.printstacktrace(); } } the code onstartcommand of...

loops - jQuery throwing up "Unexpected token for" as an error -

i have absolutely no idea problem is, following throws "unexpected token for" on loop below. removing loop causes closing }; called unexpected token. $.fn.appext = function() { $(data).find('a').each(function() { fileext = this.href.replace(window.location, '').replace('localhost/program/code', '').split('.')[1]; if ($.inarray(fileext, ext) == -1 && typeof fileext !== 'undefined') { ext.push(fileext); } } // here lies problem apparently (i = 0; < ext.length; i++) { $('#ext').append('<h5>' + ext[i] + '</h5>'); } }; you need add ); close call .each() , add var keywords aren't creating global variables: $.fn.appext = function () { $(data).find('a').each(function () { var fileext = this.href...

Implementing Ruby on website -

so learn ruby see nothing using on website or how connect database that's not local. appreciated. i'm learning ruby use on web. thanks. there's lot of content on google deploying , developing ruby on rails website, recommend searching ruby docs, youtube , google. here few resources may answer question: setting ruby on rails database ruby on rails deploy rails - deplying digitalocean writing web applications ruby on rails this may help: how ask question on stack overflow

prototype - For JavaScript prototypal inheritance, why can't a parent object be created and saved in a child's constructor? -

in javascript code, when instantiation of new child causes constructor execute, create method not seem creating parent object. child not seem inherit parent's member function m . function parent() { parent.prototype.a =2; parent.prototype.m = function() { return this.a++; } } function child() { child.prototype = object.create(parent.prototype); child.prototype.constructor = parent; parent.call(this); } var c = new child(); alert(child.prototype.m()); // 2 alert(child.prototype.m()); // 3 alert(c.m()); // fails!!! your prototype methods , inheritance should defined outside of functions... function parent() { } parent.prototype.a =2; parent.prototype.m = function() { return this.a++; } function child() { parent.call(this); } child.prototype = object.create(parent.prototype); var c = new child(); alert(child.prototype.m()); // 2 alert(child.prototype.m()); // 3 alert(c.m()); // 4

bluetooth lowenergy - Android BLE BluetoothGatt object remains connected and triggers onCharacteristicChanged() even after a call to disconnect() -

i trying disconnect characteristic notifications exiting app. here how doing in exitcleanup() function: if (btgatt != null && mwritechar != null) { boolean b=btgatt.setcharacteristicnotification(mwritechar, false); log.w("appinfo", "exiting , unsubscribing: " + b); } the log shows: exiting , unsubscribing: true . far good. attempt disconnect gatt object altogether using following: if (btgatt != null && btmanager!=null && btmanager.getconnectionstate(btdevice, bluetoothprofile.gatt) != bluetoothprofile.state_disconnected ) { //making sure gatt , bt manager still //also making sure connection state not disconnected btgatt.disconnect(); btgatt.close(); log.w( "appinfo", "finishing. connection state=" + btmanager.getconnectionstate(btdevice, bluetoothprofile.gatt) ); } this things weird. log displays following: finishing. connection state=2 , indicating bluetoothdevice still connected. t...

c - Unable to add fullscreen bitmap to Pebble due to window size -

Image
i'm using pebble sdk 2 , running graphics problems. i'm trying add full screen graphic dimensions 144 x 168, however, when do-- bottom gets clipped. investigating further- root layer has dimensions of 144 x 152 rather 144 x 168 (pebble's fullscreen dimensions). set window full screen, before adding bitmap , calling window_stack_push , status bar should not issue (although, dimensions of status bar supposedly fit space missing). code below: void handle_init(void) { s_main_window = window_create(); window_set_fullscreen(s_main_window, true); window_set_window_handlers(s_main_window, (windowhandlers) { .load = main_window_load, .unload = main_window_unload }); const bool animated = true; window_set_click_config_provider(s_main_window, click_config_provider); window_stack_push(s_main_window, animated); } static void main_window_load(window *window) { // create gbitmap, set created bitmaplayer s_background_bitmap = gbitmap_create_with_r...

Effective queries in machine learning -

i reading ml text has question: if have supervisor can provide label x , should choose x learn fewer queries? so interpret mean: we asked expedite learning process selecting test elements provide discriminatory information. i presume iterative algorithm: i.e. selection of succeeding test elements depends upon elements selected. not clear question is: would selection of succeeding elements also depend on results of prior queries. so question here be: there information-theoretic unique answer above? or there multiple approaches may of similar effectiveness/speed? ** footnote: not homework - independent learning there multiple approaches. in fact, setting machine learning task called active learning . there lot of methods choosing x based on different strategies - see section 3 of this survey paper .

replace / substitute a tag value from one xml file to another xml using php -

need replace / substitute tag value 1 xml file xml i need replace tag value xml file using php file 1 <complete> <list> <change>hello</change> <manage>world</manage> </list> <list> <change>hello1</change> <manage>world1</manage> </list> <list> <change>hello2</change> <manage>world2</manage> </list> </complete> file 2 <complete> <list> <change>duplicate</change> <manage>duplicate</manage> </list> <list> <change>duplicate1</change> <manage>duplicate1</manage> </list> <list> <change>duplicate2</change> <manage>duplicate2</manage> </list> </complete> o/p <complete> <list> <change>duplicate</change> <manage>world</manage>...

ifstream - Getting the user to enter a file C++ -

" assignment prompt user enter filename path on disk. if file not exist in specified location, program should exit suitable error message" hi everyone, i'm having issue, able user enter file name this.. 1. cout<< "enter data file name wish open"; 2. cin >>file; 3. indata.open(file.c_str()); 4. outdata.open(file.c_str()); the second part of question if file not exist, program should make error, how go doing so, file name txt.source, user enters lil.pol how make there error, or other words how make file name desired 1 computer accept? what can try open file , if fails open issue message through std::cerr this: std::ifstream indata(file.c_str()); if(!indata) // failed open { std::cerr << "error: not open file: " << file << std::endl; return 1; // error code } // use indata here (its open)

python - Swinging pendulum does not work -

i having little trouble project. have create pendulum using key handles , code have key's , down don't seem working. "up" suppose make pendulum go faster , "down" makes go slower. code have far. can please help. from tkinter import * # import tkinter import math width = 200 height = 200 pendulumradius = 150 ballradius = 10 leftangle = 120 rightangle = 60 class maingui: def __init__(self): self.window = tk() # create window, may call root, parent, etc self.window.title("pendulum") # set title self.canvas = canvas(self.window, bg = "white", width = width, height = height) self.canvas.pack() self.angle = leftangle # start leftangle self.angledelta = -1 # swing interval self.delay = 200 self.window.bind("<key>",self.key) self.displaypendulum() self.done = false while not self.done: self...

php - Show more than one result from JOIN with if statement -

Image
i have join, gets me more on result: at.tipo atividade, at.data datacadastro, at.user usercadastro, left join atividades @ on (at.produto = '$produto') , (at.tipo = 'cadastra' or at.tipo = 'revisado') and have: if string = 'cadastra' shows something , if string = 'revisado' shows else . <?php if ($row['atividade'] == 'cadastra') { echo '<div id="user-img">'; echo '<img src="http://'.$row['imguser'].'"/></div>'; echo '<div id="user-cadastro" class="greytxt">'; echo 'cadastrado por <br>' .$row['usercadastro']. '<br>em '; echo $row['datacadastro']. '</div>'; } ?> <?php if ($row['atividade'] == 'revisado') { echo '<div id=...

wordpress - Displaying All Data from Custom Post Type Fields through Advanced Custom Fields -

i have looked on google, trying figure out. i've made progress still stuck. i'm pretty new acf , custom post types. have custom post type of attorneys setup through wck. post type has field group field names of attorney_photo , attorney_name , attorney_areas_of_practice . code below, can attorney_name , attorney_areas_of_practice (repeater field) display, not attorney_photo . have info displaying correctly on each attorneys specific page, need page listing of attorneys. not sure doing wrong image part. <?php get_header(); ?> <?php $args = array( 'posts_per_page' => 30, 'order' => 'asc', 'orderby' => 'title', 'post_type' => 'attorneys' ); query_posts($args); if ( have_posts() ) : ?> <?php while ( have_posts() ) : the_post(); ?> <div class="attorney-preview"> <?php $photo = get_post_meta($post->id,'attorney_photo', true); ?> <i...

module - PromptAndInput, cannot convert string into double (C#) -

greetings: new here, , i'm new writing code may not know do's , don'ts please bare me. i'm having issues compiling program. errors have pointed promptandinput("any of text"); cannot implicitly convert string double name = promptandinput( "enter name of customer: "); state = promptandinput( "in state (ny / nj / fl) ? "); if (state != "nj" & state != "nj" & state != "ny" & state != "ny" & state != "fl" & state != "fl") { console.writeline("error"); while (state != "nj" & state != "nj" & state != "ny" & state != "ny" & state != "fl" & state != "fl") { state = promptandinput("in state (ny / nj / fl) ? "); } } itemquantity = promptandinput("how many items purchased?: "); if (itemquantity ...

Table in HTML not presented correctly -

my code generates following html file. can see table tag @ beginning of code, when display in browser, table @ end of page. can 1 explain why happens? <table border = '1'><tr><td>count(*)</td></tr><tr><td>3616</td> </tr> <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title>project 1b</title><meta http-equiv="content- type" content="text/html; charset=iso-8859-1" /></head> <body> <form method="get"> <p><h3>project 1b: queries</h3></p> <p>type sql query in following box: </p> <textarea name="area" rows=20 cols=100>select count(*) movie; </textarea> <p> <input type=...

What does (x^2) do in javascript? -

this question has answer here: javascript, ^ (caret) operator do? 5 answers i writing calculations involving exponents in javascript , due habit of using carets in microsoft excel, typed x^2 in code. still gave me answer wasn't wanted. ^ in javascript? alert(math.pow(3,2)); //result 9 alert(3^2); //result 1 that bitwise xor. use math.pow exponents. if 3^2 doing: 3 xor 2 computers use binary see 11 xor 10 put table: 11 1 ^ 0 = 1 10 1 ^ 1 = 0 -- 01 in simple terms: xor take 2 numbers in binary, , bit true, must different here's list of operators ^ math.pow() takes base , exponent: math.pow(3, 2) --> 3 2 --> 9 math.pow(5, 6) --> 5 6 --> 15,625 math.pow(7, 3) --> 7 3 --> 343

Ruby on Rails, Act-as-Taggable-On and Ancestry (Categories). How to deal with? -

i have model "post" belongs_to "category" model. category model "has_ancestry" because of nested system. i need show on index page of posts, posts params: category=first&tag=anytag(or many more tags) how accomplish this? obviously when i'm on posts list , view list of tags single post , click on tag, have "link_to" page of category tag in params[:tag]. if i'm not in explicit category => post.all) i'm using tags acts-as-taggable-on. how to?

java - PMD can't find rule UseSingleton -

for weird reason pmd giving error: an internal error occurred during: "reviewcode". unable find referenced rule usesingleton; perhaps rule name mispelled? this how rule declared in ruleset.xml: <rule ref="rulesets/java/design.xml/usesingleton"/> i'm using eclipse kepler 4.0.6 pmd plugin version. doing wrong? see answer on bug report #1339 , changelog 5.3.1 : language java, ruleset design.xml: rule “usesingleton” has been renamed “useutilityclass”. see bugs #1059 , #1339. this fixed pmd 5.3.1 , later. for time being, you'll need manually fix ruleset file , replace usesingleton useutilityclass . i'd suggest shutdown eclipse, locate ruleset.xml file in workspace, change it, , start eclipse.

java - order an array to make a somewhat-balanced binary search tree -

although purpose of question not make difference, state anyway. working on making method performs dijkstra's algorithm on graph. algorithm requires set u of unvisited cities. when city visited, must removed list. so want use binary search tree set u because best data structure can think of allow me have big set of cities can search , delete efficiently. the array of cities in alphabetical order, array indexes 1,2,..n, cities[0] = albany ny, cities[n] = yuma az. i created binary search tree use, not self-balancing. if add of elements are, create linked list of height (n-1). therefore, my question following : how can order array if add array in order, or order should add array bst resulting bst closer log(n)? i using following constructor when creating bst: //this constructor initialized bst city array //a node created city object, , appended //the tree bst(city[] cities) { (int = 0; < cities.length; i++) { bstnode newnode = new bstnode(citie...

android - How many registration IDs per device and and user does Google Cloud Messaging (GCM) issue? -

i'm implementing gcm handler on server. google issue new registration id per device or per user? know issue new id per app version , user, extend each device user has app installed on? ultimately, ask because want know how should store registration id user's app sends me server-side. right have implemented such sent id user's registration id, unsure if incorrect way model how gcm handles registration ids. i'm leaning towards being incorrect , i'd have keep record of many ids based on criteria. any input appreciated. basically, gcm issues new registration id per device app installed. answer question, 1 registration id per device. gcm not know own users, implement logic of how sift through messages intended user x , y, if both of them use same device. here's docs : a registration id isn't associated particular logged in user. if unregister , re-register, gcm may return same id or different id—there's no guarantee either way. m...

html - PHP Mail form does not send -

this question has answer here: php mail function doesn't complete sending of e-mail 22 answers i copied message form , php mail website. doesn't seem work. not send or make reaction. tried find error, not familiar php. tried editing $emailfrom =... $_post['email']; doesn't work either.. html: <div id="form-main"> <div id="form-div"> <form class="form" id="form1"> <p class="name"> <input name="name" type="text" class="validate[required,custom[onlyletter],length[0,100]] feedback-input" placeholder="naam"/> </p> <p class="email"> <input name="email" type="...

ios - CGContextClearRect ignores alpha value set in storyboard -

i'm using cgcontextclearrect method in myview's drawrect clear myview background color. however, must explicitly set background color alpha value of myview in code. if set alpha value in storyboard, cgcontextclearrect makes myview black. why alpha value set in storyboard doesn't trick? the drawrect method allows reset view's layer content when flagged refresh. there's no need call cgcontextclearrect clearing layer automatically managed system before calls drawrect method, providing blank canvas view's layer.

What is the fastest way to check an internet connection using C or C++? -

i'm trying write program in c/c++ check internet connection on windows machine. appreciated. thank you. i can show short way, based on microsoft example. in fact, way make sure can connect internet try connect server in internet. applications use google target-server or own server (if have one). modified example connect google on port 80. if program return 0, success, otherwise returns 1. should give startpoint own solution: // example from: // https://msdn.microsoft.com/en-us/library/windows/desktop/ms737591(v=vs.85).aspx #define win32_lean_and_mean #include <windows.h> #include <winsock2.h> #include <ws2tcpip.h> #include <stdlib.h> #include <stdio.h> // need link ws2_32.lib, mswsock.lib, , advapi32.lib #pragma comment (lib, "ws2_32.lib") #pragma comment (lib, "mswsock.lib") #pragma comment (lib, "advapi32.lib") #define default_buflen 512 #define default_port "80" int __cdecl main(int argc, ...

My html file is not pulling in the correct css file...Why is this? -

in html file, pulling in main.css linking it... <link rel="stylesheet" type="text/css" href="main.css"> however, whenever open html file in firefox, pulls in older version of file. yes...i checked whether or not there 2 versions of file in root directory - there aren't. there not main.css file in directories. how possible computer pulling in old version of file , not updating when save new css file? use "ctrl + r" after loading site

android - Multiple Instance of same Activity for different Intent Object -

i have 2 activities in app:- main activity:- shows list of city cityactivity:- showing details of selected city. the problem :- if select city "newyork" in mainactivity takes me cityactivity , shows newyork details. if go , select "san francisco" takes me cityactivity , shows san francisco details. when press of phone device takes me each of cityactivities "new york", "san francisco",... same browsers button does. tried multiple option fix didnt helped me:- a.) calling finish() in cityactivity. b.) adding android:launchmode= "singleinstance" in manifest file. want achieve here if cityactivity newyork object there in memory , try select "san francisco" city, should destroy activity "new york" intent object , create new activity "san francisco" intent object. set intent flag " no history" when starting city activity

java - Getting .servlet.DispatcherServlet noHandlerFound -

i trying learn this tutorial how write rest api. supposed replace ${msg} inside index.jsp file message. the problem when try call servlet @ http://localhost:8080/mahlzeitserver/helloworld/hello getting response tomcat: http status 404 - /mahlzeitserver/web-inf/helloworld.jsp type: status report message: /mahlzeitserver/web-inf/helloworld.jsp description: requested resource not available. i'm note sure why case. if go localhost:8080/mahlzeitserver site gets displayed ${msg} not replaced. here index.jsp file: <html> <body> <h2>hello world2!</h2> <h3>your message : ${msg}</h3> </body> </html> helloworldcontroller.java package com.mahlzeit.server; import org.springframework.stereotype.controller; import org.springframework.ui.modelmap; import org.springframework.web.bind.annotation.pathvariable; import org.springframework.web.bind.annotation.requestmapping; import org.springframework.web.bind.annotati...

jdbc - SPRING jdbcTemplate.update java.sql.SQLException: No value specified for parameter -

i'have solved problem wondered why jdbctemplate not accept query jdbctemplate.update work jdbctemplate.execute, here code example coordinates: string query = "update geodomaindocument set latitude=? , longitude=? url=?"; object[] values = new object[]{0,0,"http://example.com"} jdbctemplate.update(query, values); return exception: org.springframework.jdbc.badsqlgrammarexception: preparedstatementcallback; bad sql grammar [update geodomaindocument set latitude=? , longitude=? url=?]; nested exception java.sql.sqlexception: no value specified parameter 2 but worked same query execute: query = "update geodomaindocument set latitude='"+values[0]+"', longitude='"+values[1]+"' url='http://example.com'"; jdbctemplate.execute(query); ty in advance help. update ok,i'm stupid, it's simple index error. your latitude , longitude of type string. try this object[] values = new object...

c++ - How to get the Euler rotation of a rigid body between 0 to 360 in Bullet Physics? -

i trying rotation of object. using c++ , bullet physics. code: btscalar x, y, z; body[0]->getcenterofmasstransform().getbasis().geteulerzyx(z, y, x); however, rotate object around clockwise number y (y vertical in bullet) axis goes 0 -90 0 90 , 0 every quarter rotation. close need go way 0 360. bullet documentation says: void geteulerzyx (btscalar &yaw, btscalar &pitch, btscalar &roll, unsigned int solution_number=1) const and solution_number solution of 2 possible solutions ( 1 or 2) possible values this because euler angles ambigous. have tried solution 2?

scala - How to define a type that corresponds to Map[String, Option[String]]? -

given following method takes map[string, option[string]] parameter: def mymethod(m: map[string, option[string]]) = { ... } how define new type mymap implements map[string, option[string]] method looks this: def mymethod(m: mymap) = { ... } type mymap = map[string, option[string]]

jdbc - java sql exception parameter not set -

i trying data database in table 2 parameters, when try execute code gives error: parameter not set. think small mistake can't find it. problem 2 parameters, never used 2 before. can me? public static void tabelvullen(int kaartnummer,int datum){ connection con; try { con = drivermanager.getconnection(db, "", ""); preparedstatement s = con.preparestatement("select kaartnummer, datum, maaltijd, prijs logbestanden kaartnummer=? , datum=?"); s.setint(1, kaartnummer); rset = s.executequery(); while(rset.next()){ string[] logboek = new string[4]; logboek[0]=rset.getstring("kaartnummer"); logboek[1]=rset.getstring("datum"); logboek[2]=rset.getstring("maaltijd"); logboek[3]=rset.getstring("prijs"); model.addrow(logboek); } s.close(); con.close(); } catch (sqlexception e) { system.out.p...

Android Facebook Integration Issue in Referencing -

Image
successfully imported facebook sdk eclipse.but there issue in referencing facebook sdk own project.trying referencing facebook sdk project->properties->android->add.when click add facebook not listing in project list.what doing wrong?please me! here screenshot you need set sdk library . right click on facebook sdk , go properties. select "android" tab left panel. there checkbox "is library" check , apply . solve issue

C# Class scope issue? -

i student. our first project using 2 different class files, , second 1 using forms. so, don't have experience either. the object declared , instantiated, object not recognized in of subsequent methods. following code on book. code on book declares/instantiates this: new order = new order( ); i think needs this, still doesn't subsequent references: order neworder = new order( ); this a complete listing of driver , 2 class files: driver: using system; using system.collections.generic; using system.linq; using system.threading.tasks; using system.windows.forms; namespace diner { static class program { /// <summary> /// main entry point application. /// </summary> [stathread] static void main() { application.enablevisualstyles(); application.setcompatibletextrenderingdefault(false); application.run(new ordergui()); } } } ordergui.cs: using s...