Posts

Showing posts from March, 2013

javascript - Knockout bind HTML datepicker min and max -

i have 2 html date pickers having trouble with. trying set value , apply minimum , maximum criteria knockout. after research found the proper date format proper format value, min, , maximum. trouble is, min , max not seem work. here html date picker: <input type="date" data-bind="value: mindate, min: mindaterange, max: maxdaterange" /> the format of dates yyyy-mm-dd in accordance link sent. if manually apply min , max attributes date format works fine. have idea doing wrong? you can't use min , max because there no such bindinghandlers. can use attr bindinghandler: <input type="date" data-bind="value: mindate, attr: { min: mindaterange, max: maxdaterange }" />

MATLAB solve Ordinary Differential Equations -

how can use matlab solve following ordinary differential equations? x''/y = y''/x = -( x''y + 2x'y' + xy'') with 2 known points, such t=0: x(0)= x0, y(0) = y0; t=1: x(1) = x1, y(1) = y1 ? doesn't need complete formula if difficult. numerical solution ok, means, given specific t, can value of x(t) , y(t). if matlab hard this, mathematica ok. not familiar mathematica, prefer matlab if possible. looking forward help, thanks! i asked same question on stackexchange, haven't answer yet. https://math.stackexchange.com/questions/812985/matlab-or-mathematica-solve-ordinary-differential-equations hope can problem solved here! what have tried is: ---------matlab syms t >> [x, y] = dsolve('(d2x)/y = -(y*d2x + 2dx*dy + x*d2y)', '(d2y)/x = -(y*d2x + 2dx*dy + x*d2y)','t') error using sym>convertexpression (line 2246) conversion 'sym' returned mupad error: error: unexpected &

java - JAR file messes GUI? -

Image
i've got homework make simple login window. after finished coding tried exporting file runnable jar file, , after running jar file saw had messed gui. jpasswordfield fills entire jframe reason. have no clue might problem because runs fine ide. help? here code (works fine in eclipse ide):` public class login extends jframe { private static final long serialversionuid = 1l; private static jtextfield user = new jtextfield(); private static jpasswordfield pass = new jpasswordfield(); private static jbutton loginbtn = new jbutton("login"); protected string[] args; private static jframe frame = new jframe("log in"); public login(){ loginbtn.addactionlistener(new actionlistener(){ @suppresswarnings("deprecation") public void actionperformed(actionevent e){ if(user.gettext().equals("admin") && pass.gettext().equals("nimda")){ //system.out.println("hello admin!&quo

ios - using PFQueryTableViewController as detailviewController of UITableView -

i got uitableview 8 textlabel albumname(displaying array),now want use 'selected album name' parse class name(using initwithcoder method),and display corresponding class value should retrived parsetableview rows. did code: - (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"detailalbum"]) { nsindexpath *indexpath = [tableview indexpathforselectedrow]; myparsetableviewcontroller *detailscreen =segue.destinationviewcontroller; uitableviewcell *cell = (uitableviewcell *)[tableview cellforrowatindexpath:indexpath]; detailscreen.classname = cell.textlabel.text; nslog(@"selected label :%@",detailscreen.classname); } } and in pfquerytableviewcontroller.h @interface myparsetableviewcontroller : pfquerytableviewcontroller @property (nonatomic,strong) nsstring *classname; @end pfquerytableviewcontroller.m - (id)initwithcoder:(nscoder *)acoder { self = [super ini

vb.net - Getting a null reference exception trying to push a zero to a stack -

well on last day of school trying finish program , can't life of me past null reference exception. code supposed average [count] numbers entered user using stack of integers. throwing null reference exception because attempted count of stack empty, added line push 0 on it. program stops @ line same error (nullreferenceexception). if change stack accept strings works fine, need accept integers. can :) module module1 sub main() dim count integer = 16 dim stack new stack(of integer) stack.push(0) console.writeline("please enter " & count & " numbers") while stack.count - 1 = count stack.push(console.readline) if not isnumeric(stack.peek) console.writeline(stack.pop & " not number please try again.") end if loop end sub end module you're declaring variable named stack , not creating stack object. instead (with new k

Javascript Window.open: Accessing DOM -

i have been experimenting window.open popups. have tried following code [with shortened url shown here]: var sub=window.open('http://youtube.com...','subscribe boss gamerz','height=170,width=390'); sub.document.body.style.overflow = "hidden"; sub.focus(); which opens new popup not remove scrollbars intended to. instead, chromium gives me error message in console: uncaught securityerror: blocked frame origin "http://example.com" accessing frame origin "swappedout://". frame requesting access has protocol of "http", frame being accessed has protocol of "swappedout". protocols must match. how can make function properly?

ios - Mach-O-Link error -

Image
i'm working on app includes in app purchases. being tired of having copy paste same class files in projects decided create static library. i followed several of available guides on web on how create static library ios seem running problems. undefined symbols architecture armv7: "_objc_class_$_nwstorepackage", referenced from: objc-class-ref in storetableviewcontroller.o ld: symbol(s) not found architecture armv7 clang: error: linker command failed exit code 1 (use -v see invocation) the same error displayed arm64 architecture i linked library, added header files. updated header search paths, updated framework paths. don't know more can do... used following script. # define output folder environment variable universal_outputfolder=${build_dir}/${configuration}-universal # step 1. build device , simulator versions xcodebuild -target ${project_name} only_active_arch=no -configuration ${configuration} -sdk iphoneos build_dir="${build_dir}&qu

PHP Counter overwraps/overflows only 1 byte of data, counter resets (race condition) -

i know simple question downloaded php counter script http://www.stevedawson.com/scripts/text-counter.php which first result on google php counter scripts , worked great expected. i tried see if messes holding refresh in browser after 255 requests overflowed 0. how fix script? think culprit filesize() gets 1 byte of data doesn't make sense since 255 3 bytes of data right? since saves in plain-text format? why overflow? it's php shouldn't overflow automatically mutate bigger datatype. <?php $ordercountfile = "order_num_count.txt"; if (file_exists($ordercountfile)) { $fil = fopen($ordercountfile, r); $dat = fread($fil, filesize($ordercountfile)); echo $dat+1; fclose($fil); $fil = fopen($ordercountfile, w); fwrite($fil, $dat+1); } else { $fil = fopen($ordercountfile, w); fwrite($fil, 1); echo '1'; fclose($fil); } ?> yeah started remake script

python - Convert OrderedDict to normal dict preserving order? -

how convert ordereddict normal dictionary while preserving same order? the reason asking because when fetch data api, json string, in use json.loads(str) return dictionary. dictionary returned json.loads(...) out of order , randomly ordered. also, i've read ordereddict slow work want use regular dict in same order original json string. slightly off-topic: there anyway convert json string dict using json.loads(...) while maintaining same order without using collections.ordereddict ? when convert ordereddict normal dict , can't guarantee ordering preserved, because dicts unordered. why ordereddict exists in first place. it seems you're trying have cake , eat too, here. if want order of json string preserved, use answer question linked in comments load json string directly ordereddict . have deal whatever performance penalty carries (i don't know offhand penalty is. may neglible use-case.). if want best possible performance, use dict . it's g

c++ - If file exist, work with it, if no, create it -

fstream datoteka; datoteka.open("informacije.txt", fstream::in | fstream::out | fstream::app); if(!datoteka.is_open()){ ifstream datoteka("informacije.txt") datoteka.open("my_file.txt", fstream::in | fstream::out | fstream::app); }/*i'm writing in file outside of if statement. so should create file if not created before, , if created write file. hello there, wanted program check if file exists, sothe program open if , can write in it, if file not opened( have not been created before ) program create it. problem when create .csv file, , finish writing , wanted check if written there, file cannot opened. in .txt file, blank. datoteka.open(filename, std::fstream::in | std::fstream::out | std::fstream::app); works fine. #include <fstream> #include <iostream> using namespace std; int main(void) { char filename[ ] = "informacije.txt"; fstream appendfiletoworkwith; appendf

php - Modificate files inside zip file , other way -

i need know if possible other way ............ i try modificate files inside zip file , try using class zip , works $zip = new ziparchive; $res = $zip->open('test.zip'); if ($res === true) { $zip->extractto('./', 'test.txt'); $fp=fopen("test.txt","a"); fputs($fp,"hello"."\n"); fclose($fp); $zip->addfile('test.txt'); $zip->close(); unlink ("test.txt"); } but question it´s if it´s posible no create temp file modificate, extract , repack , etc, , modificate inside of zip file target file want change if no possible zip files no problem if can other file format tar , etc , need format let me compress many files inside , modificate in contents thank´s best regards if compress files (and change size within container), regular archive formats won't let modify files in-place, because modification cause size change , file won't fit well. filesystems support per-

php - Can't connect on database on my localhost -

i have php script: <?php $host = $_get['host']; $username = $_get['username']; $pass = $_get['pass']; $con = mysql_connect($host, $username, $pass); if (!$con) { echo 'connection failed!'; } else { echo 'connected successfully!'; } mysql_close($con); ?> running on remote server , when execute , try connect database located on pc error: warning: mysql_connect() [function.mysql-connect]: can't connect mysql server on '109.60.110.255' (4) in /home/a6859995/public_html/zavrsni/connect.php on line 12 how can fix that? i recommend use pdo this: class_config.php: class class_config { public static $db_host = 'localhost'; public static $db_name = 'yourdbname'; public static $db_user = 'youruser'; public static $db_pass = 'yourpass'; } class_pdo.php: require_once "class_config.php"; class class_pdo { public static function db

How to extract value from soap request in xslt sheet? -

i have managed fields under sar element in following xslt stylesheet want iterate till 'file' tag , retrieve value. following soap request , xslt stylesheet. please me build xslt stylesheet can iterate untill 'file' element , retrieve value. soap request: <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema"> <soap:header> <nicheheaders xmlns="http://schemas.microsoft.com/nichelite/soap/"/> </nicheheaders> </soap:header> <soap:body> <sendsar xmlns="http://schemas.microsoft.com/sendsar/soap/"/> <sardetails> <applicationid ="anxxxxxxxx"/> <lifeassured="two"/> <partyid="2bchg"/> <sar> <filetype="pdf"/> <filename="abcd"/> <file> <insert base64 encod

recursion - Recursive PHP function gets only first values -

i'm having issue below code. i'm trying time now, , believe must blind , not see obvious. can point @ obvious thing? function ought categories , it's names. takes ids correctly, names first category , first subcategory. function collect($id, $current = null) { global $db_1; $s = "select category.id id, category_i18n.name name category,category_i18n category.parent_id= '$id' , category.visible = '1' , category_i18n.culture='en' , category.id = category_i18n.id order category.order_asc asc"; $r = mysql_query($s, $db_1); $row = mysql_fetch_array($r); $children = array(); if (mysql_num_rows($r) > 0) { while ($row) { $children['name'] = $row['name']; $children[$row['id']] = collect($row['id']); } } else { $children['name'] = $row['name']; } return $children; } edit: edit2: after changes i&

jsf - javax.el.ELException for property not found -

i have following html file: <h:body> <h:form id="loginform"> <p:growl id="msg" showdetail="true" life="3000" /> <p:panel header="login" style="width: 360px;"> <h:panelgrid id="loginpanel" columns="2"> <h:outputtext value="username" /> <p:inputtext id="username" value="#{loginbean.uname}" ></p:inputtext> <p:spacer></p:spacer> <p:message for="username" ></p:message> <h:outputtext value="password" /> <p:password id="password" value="#{loginbean.password}" feedback="false"></p:password> <p:spacer></p:spacer> <p:message for="password"></p:message>

ios - Use Json_create always get NULL frome json-string in cocos2dx 2.2.3 -

my code @ follow cclog("info: %s",infostr.c_str()); const char * buf=infostr.c_str(); cocos2d::extension::json* mjs = cocos2d::extension::json_create(buf); cocos2d::extension::json* item = json_getitem(mjs,"results"); cocos2d::extension::json* array1 = json_getitemat (item, 0); cocos2d::extension::json* itemnode = json_getitem(array1,"version"); float floatvalue = itemnode->valuefloat; cclog("floatvalue: %f",floatvalue); the result of cclog("info: %s",infostr.c_str()); @ follow: { "resultcount": 1, "results": [ { "kind": "software", "features": [], "supporteddevices": [ "iphone4s", "ipadwifi", "ipadthirdgen4g", "iphone5", "ipadmini4g", "ipadfourthgen4g", "ipodtouchthirdgen",

javascript - jQuery won't select tag? -

jquery telling me cannot find tag i'm asking select. have similar select works fine. here's selecting code: $(".pagename.ent0#1401183013"); here's tag looks like: <div class="pagename ent0" id="1401183013">/</div> when write console.log($(".pagename.ent0#1401183013").length) gives me 0. it's on timer there continuous pile of these tags same attributes, tells me 0 every time. copy+paste examples output. i tried in jsfiddle and, expected, worked fine, in implementation doesn't. var inputlog = json.parse('<?php echo $jslog ?>'); var numofpings = 0; var inputlogstartind = -1; var thissecond = '<?php echo $starttime ?>'; for(var = 0; < inputlog.length; i++){ if(inputlog[i].time >= thissecond){ inputlogstartind = i; thissecond = inputlog[i].time; break; } } if(inputlogstartind!=-1){ var bncenxcoord = '70%'; var bncstxcoord

hadoop - Linux command for distcp time -

i trying use intra-cluster distributed copying distcp - /homeappl/home/user/hadoop-2.2.0/bin/hadoop distcp file:///wrk/user/random.file file:///wrk/user/output18 is there command find out how time taken distributed copying take place? the bash command time or find job in jobtracker/yarn , how long took. time hadoop distcp file:///wrk/user/random.file file:///wrk/user/output18

How to fix Java Erorr Message -

i installed java on pc when run java program says error.i tried following code public class main { public static void main(string[] args) { system.out.print("this example..."); } } the code have not have problem @ all. public class main { public static void main(string[] args) { system.out.print("this example..."); } } possible error filename.java, make sure main.java because classname must identical file name.

javascript - Related paths for dependencies in RequireJS define -

in requirejs module, want load related files dependencies. files in same folder module define(). module , related files maybe move location. how can set define's dependencies related paths? movablemodule.js now: define('movablemodule', [ "changable/path/to/my/modules/relatedfile1", "changable/path/to/my/modules/relatedfile2" ], function(){ console.log("movablemodule loaded"); }); movablemodule.js want this: define('movablemodule', [ "./relatedfile1", "./relatedfile2" ], function(){ console.log("movablemodule loaded relatively!"); }); as know calling require.config , using baseurl change routes in modules, yes? , if no, don't know how use in case. you should configure requirejs define different paths. request module, name : require.config({ baseurl: "/", paths: { "relatedfile1": "changable/pat

maven - Executing storm program but cannot find a class -

i cloned project https://github.com/storm-book/examples-ch02-getting_started , when execute command mvn exec:java -dexec.mainclass="topologymain" -dexec.args="src/main/resources/words.txt" i got following error message. [info] scanning projects... [info] [info] using builder org.apache.maven.lifecycle.internal.builder.singlethreaded.singlethreadedbuilder thread count of 1 [info] [info] ------------------------------------------------------------------------ [info] building getting-started 0.0.1-snapshot [info] ------------------------------------------------------------------------ [info] [info] --- exec-maven-plugin:1.3:java (default-cli) @ getting-started --- [warning] warning: killafter deprecated. need ? please comment on mexec-6. [warning] java.lang.classnotfoundexception: topologymain @ java.net.urlclassloader$1.run(urlclassloader.java:217) @ java.security.accesscontr

groovy - How to find in a collection? -

i have following variable , collection def currentproduct = "item1" def currentpresentation = "crema" def curentmeasure = "1ml" def items = [[product:"item1", presentation:"crema", measure:"1ml", quantity:5, total:77.50], [product:"item1", presentation:"spray", measure:"habracadabra", quantity:9, total:158.40]] i need quantity value in map product, presentation , measure equal variable values, can me thanks time here go: items.find { it.product == currentproduct && it.presentation == currentpresentation && it.measure == curentmeasure}?.quantity

javascript - Full width video background: A non-HTML5, purely jQuery solution...maybe -

long time stack overflow creeper. community has come incredibly elegant solutions rather perplexing questions. i'm more of css3 or php kinda guy when comes handling dynamically displayed content. ideally solid knowledge base of jquery and/or javascript able answer 1 best. here idea, along thought process behind it: create full screen (width:100%; height:auto; background:cover;) video background. instead of going using html5's video tag, flash fallback, iframe, or .gif, create series of images, animation render output of cinema4d, if put in sequential order create seamless pseudo-video experience. in before "that's .gif, you're idiot" guy. i believe jquery/javascript solve this. or not possible write script recognizes (or adds) div class of image, sets image display .0334ms (29.7 frame rate) sets image in z space while @ same time firing in next image within sequential class order display .0336ms; , on , forth until of images (or "frames")

node.js - var socket = io.connect('http://yourhostname/');? -

i try socket.io again since v.1.0 released. as doc, https://github.com/automattic/socket.io server side: var server = require('http').server(); var io = require('socket.io')(server); io.on('connection', function(socket){ socket.on('event', function(data){}); socket.on('disconnect', function(){}); }); server.listen(5000); client side var socket = io.connect('http://yourhostname.com/'); in development, surely var socket = io.connect('http://localhost:5000/'); it works, i'm uncomfortable hardcoding hostname(subdomain.domain) in client code(/index.js). the index.js hosted http-sever , socket.io bundled http-server in configuration. is there smart way not hardcode hostname code in relative path? thanks. edit: when try: var socket = io.connect('./'); the connection error: get http://.:5000/socket.io/?eio=2&transport=polling&t=1401659441615-0 net::err_name_not_resolved

single page application - Durandal 2 upgrade redirect issue -

hello , taking @ issue. i have been migrating spa application use durandal 2.0 library, following sage advice oft savior, john papa . , have completed upgrade process, find strange behavior (or lack of behavior) when try navigate using menu buttons. isn't happening browser doesn't redirect new page. interesting thing browser address bar populated , if click in address bar , press enter (hard reload), redirected expected. i've looked around , not caused due security check/redirect have seen other discussing elsewhere. durandal code unmodified. js on pages can quite trivial: define([], function () { console.log("welcome loaded"); var vm = { title: 'welcome' }; return vm; }); so guess in configuration of durandal. main.js: require.config({ paths: { 'text': '../scripts/text', 'durandal': '../scripts/durandal', 'plugins': '../scripts/durandal

IntelliJ Idea Scala files not available in 'New' context menu -

i new both intellij , scala. attending course "functional programming principles in scala" on coursera. downloaded zip file sample assignment, contained sample scala project. i imported project (i guess) in intellij. however, when right-click on package in project explorer, there no scala-related templates. can select "new java class", xml files , forms. does know why happens , if there way create new scala class or object template? thanks. import project selecting build.sbt file - not project folder, not eclipse project file. imported correctly.

android - Displaying a TextView immediately after another -

Image
i first time developer android, can i've been learning developing. of code doesn't have xml layout, had no problem patching rookie mistakes. said, rookie mistakes has caught me in regards 2 textviews when designed them gui interface designer (my major rookie mistake). my display_city tv , display_today_date tv seem have symbiotic relationship each other. removal of either 1 crash app. seem dependent on each other changing each other's positioning impossible (at least myriad of things have tried such setting layout margins). <textview android:id="@+id/display_city" android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margintop="20dip" android:layout_above="@+id/display_today_date" android:layout_below="@+id/get_data" android:layout_centerhorizontal="true" android:gravity="center_horizontal" /> <textview an

Android Sqlite Database record deleted after updating the apk version -

i have tried implement persistence layer of application after updating apk via google play, database record can maintained. when comes ti implementation, erases data after updating apk version. please tell me way , restore sqlite records? the below code private static final string database_name = "hkgadddlden.sqlite"; private static final int database_version = 6; private dao<history, integer> hdao = null; private dao<favourite, integer> fdao = null; private dao<lm, integer> ldao = null; private dao<iconplus, integer> idao = null; public databasehelper(context context) { super(context, database_name, null, database_version); } @override public void oncreate(sqlitedatabase database,connectionsource connectionsource) { // database.execsql("create table history(t_id integer, topic text, page integer, primary key(t_id));"); // database.execsql("create table lm(t_id i

javascript - retrieve variable with ajax load function -

i want retrieve variable meja barang.php, saying 'notice: undefined index: meja in c:\xampp\htdocs\goeladjawa\barang.php on line 3'.... this javascript var htmlobjek; var menu; var meja; var harga; var jumlah; var stok; $(function(){ $("#barang").load("barang.php"); $("#tambah").click(function(){ if(jumlah > stok) { alert("stok tidak terpenuhi"); $("#jumlah").focus(); exit(); } else if(jumlah < 1) { alert("jumlah pesan tidak boleh 0"); $("#jumlah").focus(); exit();} harga=$("#harga").val(); stok=$("#stok").val(); jumlah=$("#jumlah").val(); meja=$("#meja").val(); $("#status").html("sedang diproses. . ."); $("#loading").show(); $.ajax({ url: "tambah.php", data: {menu:menu,meja:meja,harga:harga,jumlah:jumlah}, cache: false, success: fun

debugging - File is locked by Python debugger -

i have problem understanding strange file locking behavior in python debugger. i have 2tb image file, script reads. works perfect, until want read same file different hex editor. if file opened in hex editor before start script, fine. if try open file during script paused @ breakpoint, system hangs , becomes slow. can kill pyhon , hex editor terminal, slow , takes 10 minutes. the same problem apperares after stop script , extensively kill python instances. disk, image situated remained locked , it's not possible unmount (only diskutil force command), system hangs if try open file anywhere else. also can't start scripts 1 after another, next scripts stops working , hangs system. i have wait 10 minutes able work file again. i tried find process locks file "sudo lsof +d" command doesn't list anything. here more details: — system mac os x 10.9. python 3.4. use eclipse pydev develop script. — use open('image.dmg', mode='rb') command open

c# - WinRT - Roaming App Settings - Are they persisted across versions? -

i reading msdn article "accessing app data winrt": http://msdn.microsoft.com/en-us/library/windows/apps/hh464917.aspx in section roaming app data says: if app data on device updated new version because user installed newer version of app, app data copied cloud. system not update app data other devices on user has app installed until app updated on devices well. it says roaming app data deleted if app not used 30 days. i think "roaming app data" refers applicationdata.current.roamingfolder . i don't understand if same thing applies roaming settings ( applicationdata.current.roamingsettings.values ). not shared across versions? deleted after not using app 30 days? roamingsettings use same engine roaming application folder. so, same restrictions apply. data may expired after 30 days if not accessed. i'd suggest consider roaming settings convenience, , if 30 days issue, keep important settings locally , consider roaming

spring - Allow a user access to their resources -

i developing webapp spring/hibernate , restrict access on resource-specific basis. example, user able view/edit resources created or "team". how 1 implement this? have keep additional attribute in tables "owner" field? , if so, if want allow access resources broad domain (a user can access team's resources)? others more strict access control implemented (a user can access own resources)? is there simple, practice incorporate queries? (i.e. filter maybe?)

How to add menu text only in mobile using bootstrap -

check screenshot http://i.stack.imgur.com/3myet.jpg iam using following bootstrap menu code. i want add text 'menu' in mobile only. how that? <div class="row"> <div class="navbar navbar-default"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li><a href="index.html">menu 1</a></li> <li><a href="about.html">menu 2</a></li> <li><a href="food.html">menu 3</a></li> &

java - Comparing two different objects using contains(Object o) returns false, when equals(Object o) returns true -

[fixed problem below] i have class: class doc() { private string d; doc(string d) { d = d; } @override public boolean equals(object o) { if (o instanceof string) { if (o.equals(d)) return true; else return false; } else return false; } @override public int hashcode() { ... } } if run test, initiating doc() using e.g. "abc" parameter , use doc().equals("abc") returns true - expect. if use: arraylist docs = new arraylist<doc>(); doc d = new doc("123"); docs.add(d); system.out.println(docs.contains("123")); it returns false, , quite unsure of why. have tried adding output .equals() method check if used, , is. code hashcode() bogus (i know should proper, i'm not sure how) - ever going use equals() . i read somewhere equals() checks hashcode() , however; if add system.out.println(".") first line in hashcode() doesn't output anything, doesn't seem called.

mysql - Redistribute votes while eliminating candidates -

consider thought. have ranking choice voting system, candidates doesn't meet threshold eliminated during different rounds. in example have 6 candidates running 2 seats in primary election. @ point have reached round 4 (with no winner) candidates 3 , 5 have been eliminated. in round candidate 4 being eliminated , his/hers votes redistributed candidates marked second or third choice on each ballot candidate 4 marked first choice. we grab ballots candidate 4 first choice (which happens 4 ballots). this: candidate 4: 4 1 6 3 2 5 4 3 1 6 2 5 4 5 6 2 3 1 4 3 1 5 6 2 the redistributed votes (in bold): 4 1 6 3 2 5 4 3 1 6 2 5 4 5 6 2 3 1 4 3 1 5 6 2 now problem: need write mysql query grabs these values , counts number of votes each given candidate recieves through redistribution. i.e. result mysql query should this: candidate 1: 3 votes candidate 6: 1 vote edit: query need know candidates 3 , 5 eliminated heading next column find other candidate. how write m

Knapsack Branch and Bound C Program Error Output -

i have source code knapsack branch , bound in c program : int fnbound(int icp,int icw,int ik,int imax,int aip[9],int iitem,int aiw[9]) { float iub; if(ik+1) iub=icp+(imax - icw)*(aip[ik+1]/(float)aiw[ik+1]); else iub=icp; return iub; } void fnbranch_bound(int ik,int icp,int icw,int imax,int aiw[9],int aipr[9],int iitem) { static int ssol[9]; static int sfp,sfw; int ii,ij; if(icw+aiw[ik]<=imax) { ssol[ik]=1; if(ik) fnbranch_bound(ik+1,icp+aipr[ik],icw+aiw[ik],imax,aiw,aipr,iitem); if(ik==iitem && (icp+aipr[ik])>sfp) { printf("\nsolution vectors : "); for(ii=0;ii;) printf(" %d ",ssol[ii]); sfp=icp+aipr[ik]; sfw=icw+aiw[ik-1]; printf("\nprofit : %d",sfp); printf("\nweight : %d",sfw); } } if (fnbound(icp,icw,ik,imax,aipr,iitem,aiw)>sfp) { ssol[ik]=0; if(ik)fnbranch_bound(ik+1,icp,icw,imax,aiw,aipr,iitem); if(ik==iitem && icp>sfp) { sfp=icp; sfw=icw; for(ij=0;ij;) printf(" %d ",ssol[ij]); printf("\npro

ios - ios7 data fetch from my server in background mode for every one hour -

i'm developing iphone app make phone call app using voip. have connect server every 1 hour register device , make available incoming calls @ time. in ios7 how possible connect server every 1 hour if in background mode. appreciated. thanks, jirune there specific information in ios app programming guide on implementing voip app - to configure voip app, must following: enable support voice on ip background modes section of capabilities tab in xcode project. (you can enable support including uibackgroundmodes key voip value in app’s info.plist file.) configure 1 of app’s sockets voip usage. before moving background, call setkeepalivetimeout:handler: method install handler executed periodically. app can use handler maintain service connection. configure audio session handle transitions , active use. once socket configured voip usage, ios manage in background, keeping alive , notifying app when there traffic

extjs - How to use a custom storeId with MVC? -

given store this, @ runtime, storeid app.store.entities instead of entities : ext.define('app.store.entities', { extend: 'ext.data.store', storeid: 'entites', the documentation states: note when store instatiated controller, storeid overridden name of store. this not true when store required in controller with stores: ['app.store.entities'], but when asynchroneously created this.getstore('app.store.entities') this expected behavior, don't fact, behavior forces use of either the qualfied name app.store.entities or stick rigid naming convention and directory structure. the problem the problem have app grows quite large, , having store definitions in 1 store folder no longer option. i'd refactor have folder structure follows. /app /plugin1 /store /settings /details /model /view /plugin2 /store /items /setti

javascript - Getting values of hidden checkboxes jQuery -

i have form several checkboxes. values need true default have made them hidden as: <input type=checkbox name="<%= _key %>" checked="checked" style="display:none" /> to retrieve values i'm doing: var form_data = {} $('form').find("input").each(function(i, e) { if (e.checked) form_data[e.name] = e.value; }); but hidden input fields not coming. doing wrong? how can correct it? also im using underscore.js don't think problem has it. for simplicity can this: $(function(){ // put code in doc ready var form_data = {} $('form').find(":checkbox:checked").each(function(i, e) { form_data[e.name] = e.value; }); }); so here suggesting loop through checked elems , put names & values in javascript object. but if interested in hidden checked checkboxes $('form').find(":checkbox:checked:hidden") .

Bash Script to find all .zip files in a folder, search the .zip contents and move them to another folder -

i need write linux script find *.zip files inside specified folder. then, search " _xx.xml " files inside zip file. , move these zip files containing " *_xx.xml " directory. try one: folder='/path/to/somewhere' another='/path/to/another' find "$folder" -type f -iname '*.zip' | while read file; unzip -lqq "$file" '*_xx.xml' >/dev/null && echo mv -v "$file" "$another"/ done remove echo when find working already.

ios - Call controller function from other class -

i have question: i have open controller called login.xib, has method showerrorpopup should triggered when data server says login or password wrong or there no internet. but problem web request processed in other class file - dataservices.m the question is, how can trigger showerrorpopup other class file? you can set controller in dataservices.m. declare un variable of type "login" in dataservices.m, like: @property (nonatomic) login *mylogin; then when call dataservices: dataservices *ads = [[dataservices alloc] init]; ads.mylogin = self; //if call login. then, in function in dataservices. -(void)myfunction { if (self.mylogin && [self.mylogin respondtoselector:@"afunction"]) { [self.mylogin performselector:@"afunction"]; //... } hope helps.

url - How can I get query string values in JavaScript? -

is there plugin-less way of retrieving query string values via jquery (or without)? if so, how? if not, there plugin can so? you don't need jquery purpose. can use pure javascript: function getparameterbyname(name, url) { if (!url) url = window.location.href; name = name.replace(/[\[\]]/g, "\\$&"); var regex = new regexp("[?&]" + name + "(=([^&#]*)|&|#|$)"), results = regex.exec(url); if (!results) return null; if (!results[2]) return ''; return decodeuricomponent(results[2].replace(/\+/g, " ")); } usage: // query string: ?foo=lorem&bar=&baz var foo = getparameterbyname('foo'); // "lorem" var bar = getparameterbyname('bar'); // "" (present empty value) var baz = getparameterbyname('baz'); // "" (present no value) var qux = getparameterbyname('qux'); // null (absent) note: if parameter present s