Posts

Showing posts from April, 2014

how to autobuild an associated polymorphic activerecord object in rails 3 -

how to autobuild an associated polymorphic activerecord object in rails 3 - class itemsource < activerecord::base belongs_to :product, :polymorphic => true end class randomproduct < activerecord::base has_one :item_source, :as => :product, :autosave => true, :dependent => :destroy end what i'd is call: a = randomproduct.find(1) a.item_source and if item_source doesn't exist (= nil), build automatically (build_item_source). previously, did alias_chain_method, that's not supported in rails 3. oh, , tried no avail: class randomproduct < activerecord::base has_one :item_source, :as => :product, :autosave => true, :dependent => :destroy module autobuilditemsource def item_source super || build_item_source end end include autobuilditemsource end in rails 3, alias_method_chain (and alias_method , , alias ) work fine: class user < activerecord::base has_one :profile, :inverse_of => :...

Javascript animation of CSS classes? -

Javascript animation of CSS classes? - is possible animate replacement of class in javascript? let's consider have this: .class1 {background-color:blue;} .class2 {background-color:red;} is there javascript library can ease alter between 2 classes? wouldn't create user's computer explode? if not, way of achieving that? server-generated javascript file? yes, jquery can when have jqueryui loaded well. see demo here: http://jqueryui.com/demos/addclass/ here's illustration specific css. http://jsfiddle.net/hhept/ div { width: 100px; height: 100px; } .class1 {background-color:blue;} .class2 {background-color:red;}​ <div class='class1'></div> $('div').addclass('class2', 1000); javascript css

java - What's the problem with this code? -

java - What's the problem with this code? - hi when run next code getting numberformatexception can help me out in debugging code. import java.io.*; public class case1 { public static void main(string args[]) { char ch='y';int i=0; bufferedreader bf=new bufferedreader(new inputstreamreader(system.in)); system.out.println("ch before while:::"+ch); while(ch=='y'||ch=='y'){ try{ system.out.println("enter option"); i=integer.parseint(bf.readline()); system.out.println("after"+i); switch { case 1 ystem.out.println("1"); break; case 2 ystem.out.println("1"); break; } system.out.println("do u want continue(y/y"); ch=(char)bf.read(); system.out.println("ch after execution:::"+ch); } catch(numberformatexception e){e.printstacktrace();} catch(ioe...

iphone - cellForRowAtIndexPath always return nil -

iphone - cellForRowAtIndexPath always return nil - i have created sample application insert 12 rows in tableview.and inserted fine.when after inserted rows dont want changes in text during scrolling of tableview.so checked indexpath row has value of uitableviewcell , if has values means homecoming cell otherwise created new uitableviewcell. my sample code below - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1; } // customize number of rows in table view. - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { nslog(@"globalcount = %d",globalcount); homecoming globalcount; } - (uitableviewcell *)tableview:(uitableview *)tv cellforrowatindexpath:(nsindexpath *)indexpath { uitableviewcell *obj = (uitableviewcell*)[tableview cellforrowatindexpath:indexpath]; if(obj!=nil) { nslog(@"cell indexpath row = %d",indexpath.row); nslog(@"cell text = %d",obj.textlabel.t...

python - Pandas Difference in DataFrames -

python - Pandas Difference in DataFrames - i trying figure out how display differences between 2 pandas dataframes. there can't seem figure out how display additional info rows contain difference. here have far: compare dataframe dataframe b: dataframe a: date id_1 id_2 value 1-jan 1 1 5 2-jan 1 2 6 3-jan 1 3 4 4-jan 1 4 2 5-jan 1 5 8 dataframe b: date id_1 id_2 value 1-jan 1 1 5 2-jan 1 2 6 3-jan 1 3 4 4-jan 1 4 2 5-jan 1 5 55 current output: date column 5-jan value 8 55 desired output: date id_1 id_2 5-jan 1 5 8 55 current code: #stack column(s) dataframes not equal ne_stacked = (df1 != df2).stack() #create new dataframe ne_stacked changed = ne_stacked[ne_stacked] #change column names changed.index.names = ['date', 'column'] #create array dataframes not equal diff_loc = np.where(df1 != df2) #create 'from' column changed_from...

java - Application/JSON is Unsupported Media Type in restful webservice -

java - Application/JSON is Unsupported Media Type in restful webservice - i trying create restful-jersey webservice. have pass json object webservice. @post @path("/savevehicletrackingdata") @consumes(mediatype.application_json) @produces(mediatype.text_plain) public string savevehicletrackingdata(vehicletracking vehicletracking) { homecoming vehicletracking.tostring(); } when seek try create request service, says http status 415 - unsupported media type. please help. also, should type of single argument of method savevehicletrackingdata. ps: using postman create http request. http://goo.gl/vwxnxq update : pointed out peeskillet, missing thing here json provider. next challenge have is, how integrate json provider in project. after researching little, found fasterxml jackson 1 of json provider. this image reference. had post. basically when utilize raw, default text/plain . json in drop down, select syntax high...

c++ - Can a std::ifstream/FILE* change size? -

c++ - Can a std::ifstream/FILE* change size? - say have next code (which opens file, gets size, , reads in 1 go): std::ifstream file(path, std::ios_base::binary | std::ios_base::ate); std::istream::streampos file_size = file.tellg(); file.seekg(0); char* buffer = new char[file_size]; file.read(buffer, file_size); is possible file alter size in between file.tellg() , file.read() calls (i.e. programme modifies file)? is, if file.read() succeeds, guaranteed file.gcount() == file_size ? and extending c* (i.e. doing fopen("rb") , fseek() , ftell() , rewind() , fread() ), if fread() succeeds, homecoming file size (as reported ftell() )? i'm leaning towards beingness implementation defined, i'm curious if c++ standard (or c standard, c++ standard refers file -related functions) makes guarantees here or not. *i'm working in c++, , there 2 ways me work files: std::fstream , file* . c++ standard defers c standard regarding file* functions, why br...

ms access - Return none null entries with expression builder -

ms access - Return none null entries with expression builder - i have excel table has column called "wire", column marked "x" if wire nowadays list of materials. imported table microsoft access web app. primary info below. want display materials don't have x marked in wire column.. how write look that? using kind of iif() look not filter form (web based, or in plain old regular access). simply build query, , set in query grid false column. (assuming yes/no or true/false column). once build query form based on query homecoming materials have column false. ms-access expressionbuilder

linux kernel - How to verify if the pointer is pointing to the process address table -

linux kernel - How to verify if the pointer is pointing to the process address table - i trying write own scheme phone call under arch linux system, next format of scheme call: long getpeuid(pid_t pid, uid_t *uid) which used euid of calling process's parent process. i know have verify 3 things first: check if pointer pointing user space. that can done access_ok() . check if pointer pointing calling process's address space. check if calling process has permission write space pointer pointing to. i found syscall copy_to_user() can re-create kernel space variable user space, but not sure if syscall checks other prerequisites first. also, not sure how can calling process's parent process euid. know getppid() parent process id, not sure how proceed that. can give me hint on this? thanks in advance! edit: a follow question, if want check if effective uid of parent process root, see if euid equals 0, right? edit: another question, allowed p...

html - Top Margin Not Moving on Both Divs -

html - Top Margin Not Moving on Both Divs - ok, have 2 divs, 'about-wrap' , 'tc-wrap'. can alter top-margin of about-wrap not tc-wrap. have found old question said needed float divs, about-wrap works without it, , tc-wrap doesn't work it. here html: <div id="about-wrap"> <div class="about"> <p></br><h1><bold>about us</bold></h1></p> <p class="about-us"><h5>next gen founded in late 2014 ng fearr (then known ng feariess). began xbox 360 clan, trying grow in xbox one. multi-cod players, , play modern warfare 3 , 2, advanced warfare , black ops 2. although next gen began 1 founding member, has rapidly grown , has on 25 clan members. </br></br> in next gen, our primary focus sniping/feeding. have rc , looking snipers. if join, please submit clips , contact us. info seek outs, please contact our le...

css - Background Attachment Fixed—Google Chrome -

css - Background Attachment Fixed—Google Chrome - currently on firefox , safari background-attachment: fixed property working, not responding on chrome. here page works in ff & safari http://prestonmcpeak.com/work/enigma.html this desired effect i'm looking working in 3 browsers: http://codyhouse.co/demo/alternate-fixed-scroll-background/index.html i have feeling has position tag somewhere on page. <section class="project-header "> <div class="project-background show-for-large-up"></div> <section class="enigma"></section> </section> .project-header { section { position: fixed; height: 100%; width: 100%; top: 0; left: 0; z-index: -1; &.enigma { background-size: contain; background-attachment: fixed; ...

filesystems - Batch file recognition -

filesystems - Batch file recognition - edit: found problem - re-create across network, took time. when add together timeout 4 > nul or similar, fine. i've got interesting case playing around batch file, next things: move jar directory adds jars in directory string (for classpath) runs jar the problem i'm getting doesn't find new jars while building string, finds existing jars, if run twice it's fine. to observe jars, i'm using this: set cp= %%a in ("jars/*.jar") phone call :concat jars/%%a :concat set cp=%cp%;%1 if has explanation or solution, i'd hear it! see !var! vs %var% & seperates commands on line. && executes command if previous command's errorlevel 0. || (not used above) executes command if previous command's errorlevel not 0 > output file >> append output file < input file | output of 1 command input of command ^ escapes of above, includi...

ios - Why does NSLog show screen width and screen height as 0? -

ios - Why does NSLog show screen width and screen height as 0? - so wrote next piece of code, displays reddish square in middle, intended be. however, when "nslog"ed output of screen size of device onto console, found value 0. why that? let container = uiview() allow redsquare = uiview() allow bluesquare = uiview() override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. allow screensize : cgsize = uiscreen.mainscreen().applicationframe.size allow screenwidth = screensize.width allow screenheight = screensize.height nslog("screenwidth = %f, screenheight = %f", screenwidth, screenheight); self.container.frame = cgrect(x: 50, y: 50, width: screenwidth-100, height: screenwidth-100) self.view.addsubview(container) // set reddish square frame // want bluish square have same position redsquare // lets reuse bluesquare.frame self.redsquare.frame = cgrect(x: 0...

matlab - Why does using `solve` with a multivariate system of equations error unexpectedly? -

matlab - Why does using `solve` with a multivariate system of equations error unexpectedly? - while trying solve scheme of equations 2 variables , 2 unknowns (izhikevich nullclines), encountered unexpected error: warning: 4 equations in 2 variables. , warning: explicit solution not found. this unexpected because stated, providing 2 equations 2 variables, should well-formed scheme of equations. my relevant lines of code follows: syms uu vv [solvv, soluu] = solve([0.04*vv^2 + 5*vv + 140 - uu + i(t) == 0, a(t)*(b(t)*vv - uu) == 0], [vv, uu]); the finish error trace is: warning: 4 equations in 2 variables. \> in c:\program files\matlab\r2012b\toolbox\symbolic\symbolic\symengine.p>symengine @ 54 in mupadengine.mupadengine>mupadengine.evalin @ 97 in mupadengine.mupadengine>mupadengine.feval @ 150 in solve @ 160 in q3_new @ 37 in run @ 64 warning: explicit solution not found. \> in solve @ 169 in q3_new @ 37 in run @ 64 confused, went matla...

c - Putting a #endif inside a #if -

c - Putting a #endif inside a #if - is possible set #endif within #if block's 'content' not pair #endif #if? #if (some_condition) #if (another_condition) #endif // pair endif #if (some_condition) #if (some_condition) #endif // pair endif #if (another_condition) #endif // pair endif #if (some_condition) if not possible how conditionally compile #if ... #endif pair? this doing. i modifying code base of operations bought company. compile , without modifications using macro shown below. #if (my_company_edits_enabled) // modified code goes here #else // unmodified code company #endif in way compile in/out modifications while maintaining readability edits. using same #if #else #endif blocks everywhere. came across code beingness compiled in, in original unmodified code base, based on macro value. #if (feature_a_is_enabled) // line 1 // line 2 #endif but want compile code [line 1 , line 2] regardless of macro value feature_a_is_enabled my...

php - Mysql - Duplicated row only in output -

php - Mysql - Duplicated row only in output - i tired select 1 name table problem output duplicated 3 or 4 times same result e.g ( in phpmyadmin there 5 row when phone call output duplicated 5 row 20 row this code used <?php $sql = "select * attendance, users "; $result = $db->prepare($sql); $result->execute(); while ($row = $result->fetch()) { $status = $row['status']; $notes = $row['notes']; $datetime= $adminfunctions->displaydate($row['timestamp']); echo "<tr><td><a href='" . $configs->getconfig('web_root') . "admin/adminuseredit.php?usertoedit=" . $row['username'] . "'>" . $row['student_name'] . "</a></td>"; echo "<td><div class='shorten'><a href='#'>" . $status . "</a></div></td><td>" . $notes . "</td><td...

oauth - SignIn / Consent Window does not close on mobile -

oauth - SignIn / Consent Window does not close on mobile - i have web app eg www.webapp.com uses hello.js sign in users. works desktop , mobile devices long utilize browser navigate site. problem: can install device (eg "add homescreen" on android or ios). when run homescreen, authentication/consent screen gets stuck on blank page , "connecting" message. manifest.json file has display: standalone i have manually close popup, , utilize "back" button on phone login screen. response token etc. there expected. why popup screen not closing? how can forced close without user intervention? is there can done create work html5 "installed" apps? oauth hello.js

video streaming - How to enable config file for Android MPlayer -

video streaming - How to enable config file for Android MPlayer - i have downloaded mplayer android market , works quite well. inspection of libmplayer.so (downloaded android app) appears reference command-line options, mplayer.conf, log.txt, , else needed set options , log output, it's unclear how enable these. when apps ported linux android, there standard procedure enabling config files? reference links: mplayer – changing ‘ao=’ codec order in mplayer.conf not appear work per user config? how execute dex file in android command? how start android application command line? you might find config files in (hidden) .mplayer or mplayer folder in home directory. however.. i suggest buying mx player. supports video formats , streaming, , lets utilize custom version of ffmpeg. in recent version of mx player dts & dolby sound codec supports removed official mx-player. if video has dts/dtshd/ac3/eac3/mlp sound tracks won't play audio. ffmpeg vers...

jquery - How to prevent focusout when focusin fires on the same element? -

jquery - How to prevent focusout when focusin fires on the same element? - i'm attaching .active class div wrapped around input , label. my problem when element clicked within wrapped div, focusout fire, , causing slight flicker of styling. $('body') .on('focusin', '.formlabel', function() { $(this).addclass('active'); }) .on('focusout', '.formlabel', function() { $('.formlabel').removeclass('active'); }); here's example: http://jsbin.com/mamacogimo/1/edit?html,js,output - click label , item dropdown. notice bluish background flickers. is there anyway prevent flickering? you can utilize timeout, so: var timeout; $('body').on('focusin', '.formlabel', function() { $(this).addclass('active'); cleartimeout(timeout); }).on('focusout', '.formlabel', function(e) { timeout = settimeout(function() { $(...

javascript - Reveal.js canvas not showing -

javascript - Reveal.js canvas not showing - i utilize ajax read file names of photographs in directory array. run loop , add together section each photograph follows: $("div.slides").append("<section class='future'><img src='"+filepath+"'></img></section>"); i enable navigate.right button (as disappears, well): $(".navigate.right").addclass("enabled"); even though utilize autoslide:5000, cannot see autoslideplayer canvas. doing wrong? i have started using reveal.js , still getting head around it. javascript canvas reveal.js

graph - Neo4j - Path count performances -

graph - Neo4j - Path count performances - i'm working neo4j 2.1.7. i'm trying count paths starting node , terminating same node (i.e. loops), maximum given path length. my (very simple) query is match p=(n:mylabel) -[r*..maxlength]- (n) homecoming n.myid, count(p) the entire graph has 200k nodes, while mylabel nodes 50k, i'm having poor performance low values of maxlength (5 or 6). how can improve? thanks in advance this global graph query, create exponential results. e.g. if have 100 rels per node, 6 steps out 100^6 = 1.000.000.000.000 paths find per node , go on nodes. i recommend instead @ shortestpath, so, doing 50k times still lot, seek utilize profile output query plan see amount of info touch. match (n:mylabel) match shortestpath((n)-[*..maxlength]- (n)) homecoming n.myid, count(*) it might neo4j 2.2 new query planner improve @ that. graph neo4j cypher database-performance

css - Unable to highlight/copy text in iPhone Safari on mobile site -

css - Unable to highlight/copy text in iPhone Safari on mobile site - i have mobile site i'm testing on iphone, , unlike other sites, i'm not able hold finger on screen 'copy' menu appear (with draggable handles select area copy). nil happens @ on site. i've tried adding next style sheet hasn't made difference: -webkit-user-select: text; i should state have next in style sheet , within page head: -webkit-text-size-adjust: none; i've got these didn't want content scalable, , wanted content span 100% of device width. would implementation of of above causing lack of selectable text on site? out of interest, tried flickr mobile website not scalable , uses 100% of device width site, , doesn't seem come draggable/select area copying when hold finger on text. does have thought why or how can create text content (or content actually) selectable copying/pasting? thanks are there elements may obscuring items overlaying them, ...

android - I am not able to open database and query on it -

android - I am not able to open database and query on it - strong text i not able open database , query on it. want access row of table passed different java file using intent value. please help ! import java.io.file; import java.util.arraylist; import android.app.activity; import android.database.cursor; import android.database.sqlite.sqlitedatabase; import android.os.bundle; import android.widget.listview; import android.widget.toast; public class finish_kitchen extends activity { gridview gridview; private imageadapter imageadapter; private sqlitedatabase db; private static string db_path = "/mnt/sdcard/kitchen_data.db"; private cursor c; private string path; private listview listview1; private arraylist<string> steps; private arraylist<string> image_path; private arraylist<string> audio_path; private int count; @override protected void oncreate(bundle savedinstancestate) { // todo au...

javascript - JSON parse not getting value from array -

javascript - JSON parse not getting value from array - i'm executing json parse on array returned php function , doesn't seem working. here's php function: class="snippet-code-html lang-html prettyprint-override"> <!doctype html> <html> <head> </head> <body> <?php $bname = $_request["bname"]; $link = mysqli_connect('localhost', 'root', '123'); $servername = "localhost"; $username = "root"; $password = "123"; $dbname = "success"; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } // php execution $sql = "select id, bname, bicon, rafrica, rasia, roceania, reurope, rsouthamerica, rnorthamerica, traffic, revenue...

javascript - How to shuffle arrays in array of objects? -

javascript - How to shuffle arrays in array of objects? - i have array of objects similar this: [ { name: 'apple', colors: ['red', 'green', 'yellow'] }, { name: 'orange', colors: ['orange'] } ] i shuffle colors of each object. using next code: _.each(fruits, function (elem) { elem.colors = _.shuffle(elem.colors); }); however, code not work chaining, turns colors object, , requires anonymous function think eliminated. there way create code simpler? that's how implement in chainable way lodash: var r = _(a) .map(function(i) { homecoming _.assign(i, { colors: _.shuffle(i.colors) }); }) .value(); jsfiddle: http://jsfiddle.net/bo8xf2as/ javascript lodash

c - warning for not using free() malloc -

c - warning for not using free() malloc - are there safeguards built gcc check memory leaks? if how can utilize them? when compile "gcc -wall -o run run.c", compiler not seem care if allocated heap-space beingness freed @ end of code. not find simple fixes on google. thanks much time. edit: google searches did point valgrind among other tools. curious why compiler cant deal issue. newbie, seemed simple plenty task check if every "malloc" has "free" associated it. there 2 ways analyze code problems - static analysis , run-time analysis. static analysis reads code - compilers well. run-time analysis code problems happens when code linked against set of libraries see code runs under surveillance. finding memory leaks hard static analysis not run-time analysis package. other run-time analyses things code coverage - parts of code run? gcov this, valgrind , electrical fence memory problems leaks. so, no, there no compiler safeguards...

threadpoolexecutor - Single thread pool in Windows universal app -

threadpoolexecutor - Single thread pool in Windows universal app - how create single thread pool , execute task on it? basically, want task.run() serialise calls executed on 1 single thread. threadpoolexecutor windows-universal

mysql - results.php shows all old queries -

mysql - results.php shows all old queries - i created website search bar using php mysql, results page shows old queries. tried other computers , search queries still appear. not have duplicate keywords should not issue. how can results page dump old queries? <?php $input = $_get['input'];//note self $input in name of search feild $terms = explode(" ", $input); $query = "select * search "; foreach ($terms $each){ $i++; if ($i == 1) $query .= "keywords '%$each%' "; else $query .= "or keywords '%$each%' "; } // connecting our mysql database mysql_connect("localhost", "pti_user", "policetech1"); mysql_select_db("pti_db"); $query = mysql_query($query); $numrows = mysql_num_rows($query); if ($numrows > 0){ ...

Post into wordpress blog via C# & WordPressSharp -

Post into wordpress blog via C# & WordPressSharp - i'm using wordpresssharp , trying add together content wordpress blog. i'm having problem adding content. helper.wordpressconfigurations.posttowordpress(1, "testing", "content description"); here post method public static post setpost(int posttype, string title, string content) { string type = posttype == 1 ? "post" : "page"; int categoryid = 0; switch ("".tolowerinvariant()) { case "arrow": categoryid = 4; break; default: categoryid = 0; break; } homecoming new post { posttype = "post", // "post" or "page" title = title, content = content, publishdatetime = datetime.now, status = "publish"//, // "draft" or "publish", //terms = terms }; } having exception in wordpres...

c++ - Using doxygen with Visual Studio 2010 -

c++ - Using doxygen with Visual Studio 2010 - i have difficulties using efficiently doxygen visual studio 2010 , c++. it seems there no other function commenting "un/comment lines". illustration generating comment stubs, adding /// after new line. also, wonder needed display comments within intellisense feature in vs2010? according msdn documentation, comments using // or /* delimiters displayed next associated fellow member in intellisense members list. you can utilize doxygen's xml output or xml documentation generated visual studio intellisense input. the /doc documentation explains how utilize xml documentation intellisense: to utilize generated .xml file intellisense, create file name of .xml file same assembly want back upwards , set .xml file in same directory assembly. when assembly referenced in visual studio project, .xml file found. atomineerutils 1 of best visual studio add-ins doxygen/javadoc/docxml documentation. it...

actionscript 3 - AS3 - Error #1010: A term is undefined and has no properties -

actionscript 3 - AS3 - Error #1010: A term is undefined and has no properties - i maintain getting next error: typeerror: error #1010: term undefined , has no properties. @ finalgame_fla::maintimeline/pulse() [finalgame_fla.maintimeline::frame1:183] i have checked code multiple times , can't seem figure out wrong because high score table still displays right entries. below code showing variables defined , code causing problem. defining variables & arrays var playername:string="anonymous"; var allscores:array = new array(); var nameboxes:array = new array(mcscoreboard.player1, mcscoreboard.player2, mcscoreboard.player3, mcscoreboard.player4, mcscoreboard.player5); var scoreboxes:array = new array(mcscoreboard.score1, mcscoreboard.score2, mcscoreboard.score3, mcscoreboard.score4, mcscoreboard.score5); var sr:sharedobject=sharedobject.getlocal("previousresults"); if (sr.data.allscores!=undefined) { allscores = sr.data.all...

C programming sorting an array of structs based on 4 strings -

C programming sorting an array of structs based on 4 strings - edit: forgot mention begins circular linked list! need sort array of contact structs, defined below, in next order: last name first name email phone number how go this, in efficient way? which sorting method best fit, in terms of big o order? here struct definition: struct contact { char firstname[256], lastname[256], email[256], phonenumber[256]; struct contact *pprev; struct contact *pnext; }; it looks info organized in list (due pprev , pnext). qsort() cannot used on lists. for lists mergesort way go: long list contains more 1 element, split 2 lists, sort each of them, merge 2 sorted lists one: since both lists sorted heads have compared. compare heads of 2 lists, remove smaller 1 , append sorted list. complexity o(n*log n) c arrays string sorting struct

Simply returning success or failure from ajax call in rails -

Simply returning success or failure from ajax call in rails - i have little ajax phone call calls rails: $.ajax({ type: "post", url: '...', data: ({ ... }), success: function(response, status) { console.log(status); } }); in rails controller i'm deleting entry database, , want homecoming if successful or not. what's best way? should homecoming json in respond_to? if so, have contain? best way signify success in way set next in controller... def destroy # ... code ... respond_to |format| format.json { head :ok } end end ruby-on-rails ajax json

scala - ":" in type parameter -

scala - ":" in type parameter - in scala-arm project, see code this: def managed[a : resource : manifest](opener : => a) : managedresource[a] = new defaultmanagedresource(opener) can explain meaning of [a : resource : manifest] ? def managed[a : resource : manifest](opener : => a) : managedresource[a] = new defaultmanagedresource(opener) means def managed[a](opener : => a)(implicit r: resource[a], m: manifest[a]) : managedresource[a] = new defaultmanagedresource(opener) you can link text 7.4 context bounds , view bounds more information. scala context-bound

c# - Autocomplete textbox -

c# - Autocomplete textbox - i need develop autocomplete textbox customcontrol. please ideas or sample code. need fetch info database populate control do need develop one, or need use one? if using imortant part perhaps the autocomplete sample @ asp.net ajax site might help you. c# asp.net

Completely standalone Clang on Linux -

Completely standalone Clang on Linux - is possible have clang standalone on linux system, if using libc++ , libc++abi requires linkage libgcc_s ? no, not possible right now. some things glibc or linux kernel not build clang (yet). you can rid of libgcc_s linking libc++-abi against compiler-rt , instead of libgcc . clang

recursion - Finding kth smallest element using Java -

recursion - Finding kth smallest element using Java - i'm trying create code finding kth smallest element using partitions. when run code, think works pretty fine less 5 numbers, whenever utilize bigger data--like on 100 or 10000 datas--and seek find kth number, keeps giving me java.lang.stackoverflowerror message, or finish wrong answer. here code: import java.util.scanner; public class test2 { public static int partition(double arr[], int begin, int end){ int pivotindex = begin; double pivot = arr[pivotindex]; begin++; int p = begin; int r = (int) end; while (p <= r){ while (p <= r && arr[p] < pivot) p++; while(p<=r && arr[r] > pivot) r--; if (p > r){ swap(arr, pivotindex, r);} else {swap(arr, p, r); } ...

angularjs - TypeError: undefined is not a function when using Firebase.push() -

angularjs - TypeError: undefined is not a function when using Firebase.push() - following lynda.com building data-driven app angularjs. using meetingscontroller seek , force info firebase , i'm getting next error: typeerror: undefined not function @ g.$scope.addmeeting (meetings.js:10) this points meetings.push line meetingscontroller myapp.controller('meetingscontroller', function($scope, $firebaseobject) { var ref = new firebase('https://attendanced****.firebaseio.com/meetings'); var meetings = $firebaseobject(ref); $scope.meetings = meetings; $scope.addmeeting = function() { meetings.push({ name: $scope.meetingname, date: firebase.servervalue.timestamp }).then(function() { $scope.meetingname=''; }); }; //addmeeting }); i have changed controller course of study given code due firebase removing $firebase , replacing $asobject() $firebaseobject. saw fi...

take action when two specific values are selected in a Qlikview listbox -

take action when two specific values are selected in a Qlikview listbox - quick qlikview 11 question: have listbox associated customers (a column database table). of course, customers tables has many different values, interested in showing "yes" in textbox when values "customer a" , "customer b" selected user listbox. tried far: =if(customers="customer a" , customers="customer b", "yes", "no") this doesn't work. (i obtain "no" result instead of "yes", despire fact 2 mentioned values selected listbox) help much appreciated. give thanks you. well, found work: if( substringcount ( getfieldselections(customers),'customer a,customer b') >= 1 or substringcount ( getfieldselections(customers),'customer b,customer a') >= 1 , 'yes', 'no') if has other ideas, sense free mention them. 1 possible solution. listbox qlikview

XML and XSL Views in Ruby on Rails -

XML and XSL Views in Ruby on Rails - i'm pretty new ruby , can't seem find solution this. have xml , xsl file i'm trying link main page of site. set 'members' view , set name of view files members.xsl , index.xml.erb . i'm trying figure out how link , show xml file main page view (using header , footer set in app/views/index.html/erb loads ok). info isn't beingness pulled database, it's hard coded in xml , html view hard coded in xsl file. from main page i'm trying link xml file using following: <p><a class="button" href="<%= link_to 'members', controller: '/members' %>">members</a></p> if go http://localhost:3000/members error: missing template members/index, application/index {:locale=>[:en], :formats=>[:html], :variants=>[], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :jbuilder]}. searched in: * "c:/sites/test/app/views" and...

php - how to detect error in ajax file? -

php - how to detect error in ajax file? - i utilize ajax saving value in db, problem appear in kind of work it's hard understand error because doesn't show error usual php file. how can error? php file handle ajax request: if(isset($_post['present'])){ $user_id=(int)$_post['user_id']; $date_id=(int)$_post['date_id']; $attendance_id=(int)$_post['attendance_id']; $attendance=new attendance(); $attendance->id=$attendance_id; $attendance->user_id=$user_id; $attendance->date_id=$date_id; $present_ok=$attendance->save(); echo $present_ok; } if it's ok should homecoming true, , info should saved on db when alert data, there nil show , nil changes in db. php ajax

javascript - Access / process (nested) objects, arrays or JSON -

javascript - Access / process (nested) objects, arrays or JSON - i have (nested) info construction containing objects , arrays. how can extract information, i.e. access specific or multiple values (or keys)? for example: var info = { code: 42, items: [{ id: 1, name: 'foo' }, { id: 2, name: 'bar' }] }; how access name of sec item in items ? preliminaries javascript has 1 info type can contain multiple values: object. array special form of object. (plain) objects have form {key: value, key: value, ...} arrays have form [value, value, ...] both arrays , objects expose key -> value structure. keys in array must numeric, whereas string can used key in objects. key-value pairs called "properties". properties can accessed either using dot notation var value = obj.someproperty; or bracket notation, if property name not valid javascript identifier name [spec], or nam...

php - MySQL order by where greater than a phrase alphabetically? -

php - MySQL order by where greater than a phrase alphabetically? - how can mysql select statement order name it's alphabetically greater grapes? * result should orange. apple grapes orange pear pineapple i can't order name . have order name starting after grapes. you can using limit 1 , clause : select name youtable name > 'grapes' order name limit 1 php mysql

C++ OpenGL Color at each Vertex not drawn -

C++ OpenGL Color at each Vertex not drawn - i'm new opengl , @ moment i'm trying understand vao , vbo. the vao collection of vbo. each vbo attribute of object, coordinates of vertices of object, color @ each object's vertex, etc. in code below, vertex struct define 2 properties of vertex, position , color of vertex. therefore, 2 vbos needed store these information. my problem is: i'm able draw triangle on screen, color @ each vertex doesn't seem drawn. why happen? #include <stdlib.h> #include <stdio.h> #include <string.h> #include <gl/glew.h> #include <glfw/glfw3.h> #include <glm/glm.hpp> // create vertex buffer gluint vertexbuffer; struct vertex{ gldouble position[3]; glfloat color[3]; }; static const glfloat vertex_data[] = { -0.7f, -0.7f, 0.0f, 0.7f, -0.7f, 0.0f, 0.0f, 1.0f, 0.0f }; void setupgeometry(){ const struct vertex triangle[3] = { {{-0.7, -0.7, 0.0}, {1.0f, 0.0f, 0.0f}}...

image - Formatting Figures in LaTeX -

image - Formatting Figures in LaTeX - what want give graph label of 'figure 1.1' \begin{figure} \caption{} \includegraphics[width=5in,scale=0.5]{picture1.pdf} \end{figure} however produces 2 problems: 1) before put \includegraphics[width=5in,scale=0.5]{picture1.pdf} and inserted image nicely middle of page of text. using above procedure seems forcefulness image top of page. there someway can disable this? 2) labelling of figure comes out 'figure 1.1:'. don't want colon there. want 'figure 1.1'. there someway supress colon? according documentation of caption package, can alter formatting in multiple ways. when loading package, may define global options such. \usepackage[options]{caption} after loading package, global options. \captionsetup{options} when want specific options, i.e. single caption, utilize \captionsetup{options} within \begin{figure} , \end{figure} . to alter separator none, want utilize labe...

How to select Text sentences from original document that are split and numbered in Matlab? -

How to select Text sentences from original document that are split and numbered in Matlab? - i have text document, split text document separate sentences after total stop , displayed them, code used follows: sentences = regexp(f,'\s.*?[\.\!\?]','match') char(sentences) now did processing , got selected number of sentences in form of number 1,2,3,4,...n stored in 1d cell arrays follows: output= out{1}= 1,2 out{2}= 2, 4 out{n}= n.. these 1,2,4 sentence numbers, want select , display sentence # 1,2 , 4 sentences suppose have 10 sentences output should 3 sentences now. there many ways select , display indexed sentences. instance: 1- for loop for = 1:numel(out{1}) fprintf('%s\n', sentences{out{1}}); end 2- in 1 line, cellfun : cellfun(@(x) fprintf('%s\n',x), sentences(out{1})); best, matlab

java - android passing variables from inside database class -

java - android passing variables from inside database class - i trying pass values within database(that extends sqliteopenhelper ) class. using cursor info database giving null values other activities. here database: has default values within , inserted public class databasemaster extends sqliteopenhelper { sqlitedatabase db; private static final string log = "databasehelper"; // database version private static final int database_version = 1; // database name private static final string database_name = "rates"; // table names public static final string key_er_id = "er_id"; public static final string key_er_usedornew = "used_or_new"; public static final string key_er_tenor = "er_tenor"; public static final string key_er_rate = "er_rate"; // asuransi rate public static final string key_as_id = "as_id"; public static final string key_as_regional =...