Posts

Showing posts from June, 2011

linq - Logic of applying Group by in Sql Queries -

i asking beginner level of question confused whenever want use aggregate function group by. getting right results not pretty sure how group working here. requirement count of sent items based on messagegroup columns. messageid senderid messagegroup message _____________________________________________________________________________ 1 2 67217969-e03d-41ec-863e-659ca26e660f hi 2 2 67217969-e03d-41ec-863e-659ca26e660f hello 3 2 67217969-e03d-41ec-863e-659ca26e660f bye 4 1 c45dc414-9320-40a5-8f8f-9c960d6deffe tc 5 1 8486d16b-294b-45a5-8674-e7024e55f39b shutup actually want count sent messages.here senderid=2 has sent 3 messages want show single count have used messagegroup , doing groupby , getting count. i have used linq query:: return db.tblmessage.where(m => m.senderid == 2 ).groupby(m => m.message...

php - PHPExcel Save a xls file to a specific folder -

i want save xls file specific folder on server using php excel using following code : $objwriter = phpexcel_iofactory::createwriter($this->excel, 'excel5'); //force user download excel file without writing server's hd $objwriter->save('‪c:/xampp/htdocs/timesheet/files/test.xls'); but keep on getting following error : a php error encountered severity: warning message: fopen(â€Âªc:/xampp/htdocs/timesheet/files/test.xls): failed open stream: invalid argument filename: pps/root.php line number: 90 fatal error: uncaught exception 'phpexcel_writer_exception' message 'can't open â€Âªc:/xampp/htdocs/timesheet/files/test.xls. may in use or protected.' in c:\xampp\htdocs\timesheet\application\third_party\phpexcel\shared\ole\pps\root.php:93 stack trace: #0 c:\xampp\htdocs\timesheet\application\third_party\phpexcel\writer\excel5.php(226): phpexcel_shared_ole_pps_root->save('???c:/xampp/htd...') #1 c:\xampp\htdoc...

clojure - Overlapping partition in core.async -

in clojure can overlapping partitions of collection tuning step argument partition : (partition 3 1 (range 20)) ;; ((0 1 2) (1 2 3) (2 3 4) (3 4 5) ...) core.async have partition function since doesn't accept step argument, can't overlapping partitions: (let [c (chan)] (go (doseq [n (range 20)] (>! c n))) (go-loop [p (async/partition 3 c)] (when-let [v (<! p)] (prn v) (recur p)))) ;;[0 1 2] ;;[3 4 5] ;;[6 7 8] i realise having mean being able read same value channel more once. i'm aware create own function reads many values channel want , build own partitions. however wondering if there way achieve core api provided core.async. ps. sliding-buffer doesn't trick can't peek @ whole buffer @ once. one way of doing create function reads channel, buffers values , puts new channel. i'm not sure how idiomatic though. for example, function below put! vector output channel whenever required n items have b...

convert byte array to structure in c -

i developing client-server application in c. i want send structure client character array , convert character array structure @ server side. i have following structures typedef struct mail{ char cc[30]; char bcc[30]; char body[30]; } typedef struct msg_s{ int msgid; mail mail_l; } i want send msg1 client. unsigned char data[100]; struct msg_s msg1 ; msg1.msgid=20; // suppose data in mail structure filled. data = (unsigned char*)malloc(sizeof(msg1)); memcpy(data, &msg1, sizeof(msg1)); write(socketfd , data , sizeof(data)); when data @ server side, how convert structure? i want same in both c , java language. if possible, please suggest me article read this, , name of concept if missing. i see many errors, first, character array declaration inside struct mail doesn't following c convention it should like, typedef struct mail{ char cc[30]; char bcc[30]; char body[30]; } ...

http - How to solve with statuses/update Code 403 => Error 220 ,Your credentials do not allow access to this resource -

my code working functionality of post tweet, follower. last 2 days posting tweet got following error: i treid alot of ways , still t same problem. public function old_old_posttweet($text){ $this -> init(); $return = $this-> twitter -> sendtweet($text); return $return; } first function worked before without problems. public function curl_posttweet($text){ $cmd = "curl --request 'post' 'https://api.twitter.com/1.1/statuses/update.json' --data 'status=maybe+he%27ll+finally+find+his+keys.+%23peterfalk' --header 'authorization: oauth oauth_consumer_key=\"ntnu3bxxxxxxxxbkp2rua\", oauth_nonce=\"8aff955397bxxxxxxxx940cc6ded24\", oauth_signature=\"x8%2b%2foxxx5wm%2bgxxxxxkgxlu6o%3d\", oauth_signature_method=\"hmac-sha1\", oauth_timestamp=\"1395641319\", oauth_token=\"2336351089-5zsk2elxxxxxxxxxxxxxxxxxxxxxcirz0v12ba33\", oauth_version=\...

javascript - How can I send "push notifications" to a specific users webpage? -

i'm not sure begin. i'd able update users current page when user either updates database or sends specific get/post request (i write either way). i thinking server sent events made quick test using php server , realized couple things. first need event loop based server because using php i'd have create loop keep checking database specific change. second realized server intensive should method. so explicitly ask questions... is possible update users current page when else sends request php file on server? how? if need event loop based server best option? node.js? is possible sockets if not sse? sse makes more sense because i'm not looking user feedback. thanks websockets , signalr asp.net you. check out options here

vb.net - AT Command for Searching Signal Quality (Not Strength) -

i trying make application can measure signal, operator sim, apn, , other modem via serialport. want signal quality (not strength) such umts, hspa, hsdpa, or other. knows? if possible, tell me @ command can used on kind of application? at+creg has parameter gives indication of current access technology. documented in section 7.2 of standard @ command reference, ts 27.007. +creg: ,< stat>[,[< lac>],[< ci>],[< act>][,< cause_type>,< reject_cause>]] the parameter "act" has following values: 0 gsm 1 gsm compact 2 utran (= umts) 3 gsm w/egprs 4 utran w/hsdpa 5 utran w/hsupa 6 utran w/hsdpa , hsupa 7 e-utran (= lte)

c# - Return a list in MVC causes an error -

i trying return list of schedule in education system. have schedule model in project property: public partial class schedule { public schedule() { this.classtimes = new hashset<classtime>(); this.scores = new hashset<score>(); } public int id { get; set; } public int teacherid { get; set; } public int lessonid { get; set; } public int classid { get; set; } public int degreeid { get; set; } public int facultyid { get; set; } public int semesterid { get; set; } public int majorid { get; set; } public system.datetime dateofexame { get; set; } public string capacity { get; set; } public string locationofexame { get; set; } public virtual class class { get; set; } public virtual icollection<classtime> classtimes { get; set; } public virtual degree degree { get; set; } public virtual faculty faculty { get; set; } public virtual lesson lesson { get; set; } public virtual ...

javascript - JS Form Validation not working for simple html form -

i have simple html form 1 filed. form follows- <table> <form action="insert.php" method="post" name="discover" onsubmit="return discover()"> <tr><td></td><td><input type="text" name="name"></td></tr> <tr><td></td><td><br><br><p class="submit"><input type="submit" id="submit" name="commit" value="register"></p><br><br><br></td></tr> </form> </table> the validation js file is- function discover() { var stu_name=document.forms["discover"]["name"].value; if (stu_name==null || stu_name=="" || stu_name.length<7) { alert("please provide full name"); return false; } } i have included...

c# - deserializing Static properties using json.net? -

hi guys have json 1 below { "totals": { "tokentype": "string", "tokendenomination": "double", "count": "int" }, "idcode": "string", "key": "string" } and c# code deserialize in object internal class gettokenrootinfo { public static totals totals{ get; set;} public static string idcode{ get; set;} public static string key{ get; set;} } when use jsonconvert.deserializeobject<gettokenrootinfo>(json); nothing being set , every var null. but if remove static types works. can 1 tell me reason why static types not working when deserializing object? if want deserialize static members on class, can explicitly mark them [jsonproperty] attribute, , allow work: internal class gettokenrootinfo { [jsonproperty("totals")] public static totals totals { get; set; } [jsonproperty("idcode")] ...

excel - Application.StatusBar freezes in VBA -

of late have been writing macros require substantial amount of time execute. (upwards of 5 minutes longer). 1 of things found useful in such cases (other wait) have application.statusbar tell me if moving or hung. however, many times, application.statusbar gets frozen @ value while program moves ahead. how can rectified? there anyway can prevent statusbar keeps moving long program moving? in advance. i found freeze happens @ code when have many items in loop. got around using following code: for rownum = 1 totalrows colnum = 1 totalcols 'code if colnum = 1 if rownum mod 50 = 0 , colnum = 1 application.statusbar = format(rownum / totalrows, "0%")& " completed." end if else: exit end if next colnum next rownum the loop updates status bar once every 50 rows. helped code run lot faster , eliminated screen freezing up

c# - The array dont save my numbers -

i trying learn c# , doing questions googeld. task do: *"beginner level: task make dice game user throws 3 each 12-sided dice (numbers shall randomly selected , stored in array / field or list). add total of dice , show on screen. create function / method accepts figure (the total sum of dice). function / method should return text "good throw" if figure higher or equal 20. in other cases, text "sorry" returned. call function / method in main method , prints total , text. advanced level: extension of task must use class simulate dice. user shall have option of writing x y-sided dice himself. if total sum of roll of dice generates score is> 50% of maximum score, words "good throw" displayed. logic can in main method. create class described in class diagram , use appropriate way in code."* the thing cant work, array in class not save numbers im typing in... reslut 0. think have done big misstake cant see... this main code: static voi...

php - Why does CakePHP add New Rows when 'post' is replaced by 'get'? -

i edit row on post table or add new row edit() function in postscontroller. function looks this: public function edit($id = null) { // has form data been posted? if ($this->request->is('post')) { //replaced 'post' 'get' in line // if form data can validated , saved... if ($this->post->save($this->request->data)) { // set session flash message , redirect. $this->session->setflash('updated post!'); return $this->redirect('/posts'); } } // if no form data, find post edited // , hand view. $this->set('post', $this->post->findbyid($id)); } i replaced 'post' 'get' see happen , went on creating new rows without taking me form. still flash message 'updated post!' , without taking form data. if code in edit.ctp required, here is: <?php echo $this->form->create('post'); echo $this->form->input('id', array(...

unit testing - How to use EasyMock in android -

i use easymock-3.2.jar in android test project. find in home: 2013-07-11: easymock 3.2 available. add @mock annotations , android support. however , got exception when use it. java.lang.noclassdeffounderror: org.easymock.easymock i googled lot , , add dexmaker-1.0.jar objenesis-1.2.jar cglib-nodep-2.2.2.jar or cglib-2.2.jar but exception still there.who can me? lot. put library easymock-3.2.jar dexmaker-1.0.jar dexmaker-mockito-1.0.jar in tests/libs. , work. be careful , it's in tests/libs , not in tests/lib. throw java.lang.noclassdeffounderror: org.easymock.easymock if position them in tests/lib.

c# - asp.net Request.Browser.Browser returning as mozilla in IE11 -

i have issue ie11 browser detection. i'm using request.browser.browser name of it, returns mozilla . please advice! internet explorer identifies mozilla browser. check here : http://msdn.microsoft.com/library/ms537503.aspx hope, helps you. have nice day. :)

c# - Trying to call child's event without calling parents event -

i have usercontrol embedded in control. both of these control have mouseup events hooked when press usercontrol, automatically parent control mouseup event fired. how can stop this? the mouseup event has bubbling routing strategy, means bubble descendants ancestors. stop propagation, mark event handled in child's event handler: e.handled = true; you can learn more event routing strategies on msdn .

Excel Conditional forward based on date older then -

i have excel document containg following data (a1)week no (b1)name (c1)save untill (d1)description 13 name 1 2014-06-30 description 1 14 name 2 2014-01-30 description 2 15 name 3 2013-12-31 description 3 16 name 4 2014-03-31 description 4 17 name 5 2014-06-30 description 5 the goal is to color the row green if "save untill" date more 180 days based on current date. to color row red if "save untill" date less 180 days based on current date. i cant figure out, hope guys can me out! regards niklas in case use following applied a2:d6 or whatever full range is: for red colored cells use: =$c2<today()+180 for green colored cells use: =$c2>today()+180 the absolute reference ($c2) allows entire row highlighted color instead of cell.

How to set up nested subfolder to subdomain Nginx 301 redirects -

i'm trying set nginx redirects rewrite url several older forum setups new forum. older forums ran subfolders, while current forum running subdomain of same site. so, example, want any request site.com/ask redirected front page of forum.site.com. since i'm dealing 3 old forums, tried set nested redirect this: location ~ ^/\~([^/]+)/(.*)$ { location ~ ^/\~ask/(.*)$ { rewrite ^(.*)$ http://forum.site.com$1 permanent; } location ~ ^/\~forum/(.*)$ { rewrite ^(.*)$ http://forum.site.com$1 permanent; } location ~ ^/\~qa/(.*)$ { rewrite ^(.*)$ http://forum.site.com$1 permanent; } } with above rules, first 1 works , partially. example, request site.com/ask gets redirected forum.site.com, fine, request to, say, site.com/ask/what-is-this goes forum.site.com/404. request site.com/forum , site.com/qa not work @ all. i'm sure there's simpler way of doing this, don't want spend several days trying figure out. your input wel...

c# - Facing Issue with ShowModalDialog -

i want display webpage modal popup. response.write("<script type='text/javascript'>detailedresults=window.showmodaldialog('newfile.aspx','data','left=(screen.width) ? (screen.width - 800) / 2 : 0,top=(screen.height) ? (screen.height - 700) / 2 : 0,width=1000, height=500, toolbar=no, menubar=no, titlebar=no, location=no, addressbar=no');</script>"); while using above code. able display web page modal popup, issue opens third window web page of same name , not modal popup. please me in resolving issue. in advance. rather writing script out response use registerstartupscript instead: page.clientscript.registerstartupscript(this.gettype(), "detailedresults", "<script type='text/javascript'>detailedresults=window.showmodaldialog('newfile.aspx','data','left=(screen.width) ? (screen.width - 800) / 2 : 0,top=(screen.height) ? (screen.heig...

javascript - How to restore default value of text field - jQuery -

i have page table having <input type="text"> fields. have button next each field. allow user change text of input fields. when user click button next input field, corresponding input field's value need restored default (previous) value. tried make array index input field's name. array can store default values, , can retrieved , restored corresponding fields. tried using keyup(function() , know triggers each time key pressed. here html; <input class="zx" type="text" name="qwer" value="google" /><button class="cncl">x</button><br /> <input class="zx" type="text" name="qwer" value="yahoo" /><button class="cncl">x</button><br /> <input class="zx" type="text" name="qwer" value="bing" /><button class="cncl">x</button><br /> <input class=...

algorithm - Minimax: what to do with equal scores in endgame? -

Image
as far understood, minimax algorithm in simplest form works following way: traverse game tree bottom-up , if it's player's turn, assign maximum score of child nodes current node, else minimum score. leaves scored according game output, let's +1 win, 0 draw, -1 loss. choose move leads node highest score. of course impractical traverse whole game tree, heuristic used. assume near end of game. have found problems simple approach. for example, playing chess , player (playing white) has reached position: it players turn. there mate in 1 qg7, node qg7 gets score of 1. instance, ke1 legal move. reply c5, qg7# still available. , because qg7 gets score of 1, c5, ke1. so have @ least 2 moves score of 1 (ke1 , qg7). let's algorithm considers king moves first , chooses first move highest score. mean, in position, player not checkmate opponent, random king moves until opponent prevent checkmate (with queening pawn). the fundamental problem is, checkmate in 1 (qg7) has ...

javascript - Defer execution for ES6 Template Literals -

i playing new es6 template literals feature , first thing came head string.format javascript went implementing prototype: string.prototype.format = function() { var self = this; arguments.foreach(function(val,idx) { self["p"+idx] = val; }); return this.tostring(); }; console.log(`hello, ${p0}. ${p1}`.format("world", "test")); es6fiddle however, template literal evaluated before it's passed prototype method. there way can write above code defer result until after have dynamically created elements? i can see 3 ways around this: use template strings designed used, without format function: console.log(`hello, ${"world"}. ${"test"}`); // might make more sense variables: var p0 = "world", p1 = "test"; console.log(`hello, ${p0}. ${p1}`); // or function parameters actual deferral of evaluation: const welcome = (p0, p1) => `hello, ${p0}. ${p1}`; console.log(welcome("world...

python - radio button and display widgets on designer-qt4 -

i have shell script old text-based user interface: want replace shell code python , create graphical user interface using qt designer tool , pyside. i able add menu bar, tab , radio buttons. when user selects radio button show in text box brief description of selection means; when selects radio button different description on same text box should appear , on. my questions are: what widget should use text box ? thinking @ text browser display widget, i'm not sure. label ? text edit ? when connect radio button text browser can see interesting slots under text browser such inserthtml or insertplaintext, select signal clicked() on radio button disappear , i'm not able find them again. i tried connect button label widget, i'm not able find kind of settext slot. reading documentation know settext exists, cannot use inside code. thanks kind of support. qt has several different built-in apis showing messages user, suggest give consideration these before t...

ipc - Interprocess communication in Unix/AIX -

is possible achieve inter process communication using terminal or serial ports in aix or unix? i achieve using commands/scripting 1 process writes string on terminal , process reads same terminal , processes string. know using pipe possible not have enough idea on that. also there way can determine ports/terminals available in aix machine? or possible create new terminal @ run time (not boot time) used above 2 processes? i think want pty's? or, option unix domain sockets. the answer first question "no"... not really. when write out tty, output sent out real device , not available read back. the list of tty's on system is: lsdev -cctty creating tty's @ run time possible not want either. tty child of serial port , can not add serial ports arbitrarily. real things. aix , power systems, can add devices while system (hot swap) getting (i'm assuming) way far off original topic. the basic different between pty , unix domain socket pty m...

jQuery fire checkbox click with value -

i need fire checkbox click value open dialog...can explain why not working? form: <span class="wpcf7-form-control-wrap obj"> <span class="wpcf7-form-control wpcf7-checkbox wpcf7-validates-as-required wpcf7-exclusive-checkbox"> <span class="wpcf7-list-item first"> <label> <input type="checkbox" name="obj" value="value 1" /> <span class="wpcf7-list-item-label">value 1</span> </label> </span> <span class="wpcf7-list-item"> <label> <input type="checkbox" name="obj" value="value 2" /> <span class="wpcf7-list-item-label">value 2</span> </label> </span> <span class="wpcf7-list-item last"> ...

ms access - RecordCont returns the pointer to current record and not the number frecords -

i'm working on access 2003. in routine called click in form button , tried retrive result of query make operation them. in every place ( ms online documentation) explained retrive number of record in recordset u must use recordcount metod on recordset instance. wonder why executing following code obtain number of current position of cursor; also, why record set not filtered ? dim db dao.database dim rs dao.recordset set db = currentdb() set rs = db.openrecordset("query42") dim idimp integer dim x integer x = rs.recordcount 'x= 1 (rs pints first record) rs.filter = "[idimp]= 125 " ' move first , last ' understend happens in recordset , make test on recordcount rs.movefirst x = rs.recordcount 'x= 1 (rs points first record) rs.movelast x = rs.recordcount 'x= 1234 (rs points last record) ' have recordcount= number of records must first execute move.last...? i don't work vary on vbasic , somtimes i'd use acces s...

javafx - Label text position -

Image
i have label image , text final label label = new label(labeltext); label.settextalignment(textalignment.center); imageview liveperformicon = new imageview(mainapp.class.getresource("/images/folder-icon.png").toexternalform()); label.setgraphic(liveperformicon); i visual result: how can change text position? want set text below image? label.setcontentdisplay(contentdisplay.top); play see effect of different alignment settings: import javafx.application.application; import javafx.geometry.insets; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.control.combobox; import javafx.scene.control.contentdisplay; import javafx.scene.control.label; import javafx.scene.image.imageview; import javafx.scene.layout.borderpane; import javafx.scene.layout.gridpane; import javafx.scene.text.textalignment; import javafx.stage.stage; public class labelgraphicalignmenttest extends application { @override public void start(stage primar...

New visitors Mixpanel vs Google Analytics -

i can't figure out why there's quite significant (~30%) difference between new visits figure mixpanel , ga. here's how implemented metrics mixpanel: if(!mixpanel.get_property("first visit")) { mixpanel.register_once({ "first visit": $.now() }); mixpanel.track("visit"); } is there wrong code? there better way it? want implement signup funnel mixpanel (first visit -> sign form -> sign up), can't afford tracking every single visit, track first one. though daily "visit" events differ 30% new visitors analytics , spoils funnel. your code functioning correctly(i've checked) difference due way both services track users google analytics relies exclusively on keeping track of users via cookie (the average time of cookie expires in 30 days). with mixpanel, can utilize user_id or other id makes sense business last longer cookie. here differences in mixpanel , google analytics https://mixp...

php - upload multiple files with Varien_File_Uploader -

this question related previous question i'd created tab form in admin using template file. content of template file is: <div class="entry-edit"> <div class="entry-edit-head"> <h4 class="icon-head head-edit-form fieldset-legend">images</h4> </div> <div class="fieldset"> <div class="hor-scroll"> <table class="form-list container"> <tr class="wrapper-tr"> <td class="value"> <input type="file" name="images[]"/> </td> <td class="label"> <span class="remove">remove</span> </td> </tr> </table> <input type="button" class=...

Sync Web Service automatically in android -

my name arivalagan , i'm stuck in 1 concept,i want use auto sync in android application,web service synchronization happen automatically,can 1 give solution? what mean autosync? depending on that, can use: timer or alarm launch events (polling) an android service run sync processes in background (polling) push notifications sync on demand

iphone - How to know in our Application in Photos app is updated -

my application based on photos app, i using photos photos app , in our app adding tag in photos, how can check in photos app photo deleted or added via camera, is there method know photos app updated (delete photo or add photo).

mysql - how to get data from another table based on condition -

i have 2 tables user_info: user_id user_name address 1 pavan bangalore 2 balu chennai 3 badra hyd item_info: item_id user_id state 1 1 0 2 1 1 3 1 2 4 2 1 i have 1 method gettotaldetails,suppose if login admin need this: user_id user_name address item_id state 1 pavan bangalore 1 0 1 pavan bangalore 2 1 1 pavan bangalore 3 2 2 balu chennai 4 1 3 badra hyd null null can show me how write query above data set? you can :- select user_id, username, address, item_id, state user_info left join item_info using (user_id) demo

Streaming live wih Raspberry PI Camera on a C# Application -

i'm trying use raspberry pi guide car c# application computer. raspberry , computer booth connected router. want receive live streaming raspberry camera computer can control car. i've seen how broadcast on browser, want receive live streaming directly c# application. there way this? i'm making assumptions here since there's not detail in question, but, if want stream raspberry pi, it's easy using ffmpeg. there's thousand command line parameters, trick; ffmpeg -y -loglevel warning -f dshow -i video="screen-capture-recorder" -vf crop=690:388:136:0 -r 30 -s 962x388 -threads 2 -vcodec libx264 -vpre baseline -vpre my_ffpreset -f flv rtmp:///live/mystream.sdp see here more docs: https://trac.ffmpeg.org/wiki/streamingguide on c# side, need receive video stream. there's quite few options rtmp and/or rtsp, here's one: https://code.google.com/p/rtmp-mediaplayer/ there many others. depending on you're doing video (overlays? visio...

vb.net - TreeView Group by root -

Image
i'm trying achive simple here. want treeview groups root item children show under common root. in example below have 4 students , 3 coaches. 2 of students belong same coach. want 2 students 2 show under same root rather creating doing. can this? current code: '//loads data treeview2.nodes.clear() dim connection oledbconnection = new oledbconnection("provider=microsoft.ace.oledb.12.0;data source=./academydatabase.accdb;persist security info=false;") dim command oledbcommand = new oledbcommand("select distinct coach, fullname student order coach") command.connection = connection command.connection.open() '//run command dim datareader oledbdatareader = command.executereader() '//run command dim rows integer = 0 while datareader.read() dim columns integer treeview2.nodes.add(datareader(0).tostring()) columns = 1 datareader.fieldcount - 1 treeview2.nodes(row...

sql - ORA-00904 Invalid Identifier - Update Statement With Two Tables -

i'm working peoplesoft campus solutions, , need update 22,000 rows of data. data between tables of acad_plan_vw , acad_prog. students listed on both, ids match between two. basically trying when id, academic career, student career number, effective sequence, , effective date match, , academic plan (their degree, stored on acad_plan_vw) specific value, update acad_prog on acad_prog table x value. i tried interesting combinations of statements, getting errors. after researching, found out sqltools doesn't statements within update statements, rewrote make connections manually. i'm assuming i'm doing right, unless need reword it. the statement have is: update ps_acad_prog set ps_acad_prog.acad_prog = 'ugds' ps_acad_plan_vw.emplid = ps_acad_prog.emplid , ps_acad_plan_vw.acad_career = ps_acad_prog.acad_career , ps_acad_plan_vw.stdnt_car_nbr = ps_acad_prog.stdnt_car_nbr , ps_acad_plan_vw.effseq = ps_acad_prog.effseq , ps_acad_plan_vw.effdt = ps_acad_prog.ef...

java - How to update jlabel while running animation? -

i have little animation rectangle, jlabel blue background, moving down screen. running thread this. now, want have jlabel shows current position of rectangle. public void run() { pnl.requestfocus(); x = (int) p.getx(); //find location of rectangle y = (int) p.gety(); while (y < 450) { rectanglelabel.setlocation(x, y); //reset location of rectangle y += 10; try { thread.sleep(100); } catch (interruptedexception e) { } } } now want insert code inside while statement. locationlabel.settext(string.valueof(450-y)); but every time do, jlable updates rectangle doesnt move anymore. how go about? try : run example import javax.swing.*; import java.lang.*; class testthread extends jframe implements runnable{ jlabel rectanglelabel,locationlabel; int x,y=0; testthread() { setvisible(true); setlayout(null); rectanglelabel=new jlabel(...

android - ScrollView not working in Relative Layout -

i'm working on login page app . scrollview isn't working , i'm unable find out why. i've tried changing layout_height of scrollview wrap_content , arbitrary value 900dp , same relative layout inside still no luck. when soft keyboard appears , fill in details in 1st edittext view , want scroll down fill second 1 without closing soft keyboard. page isn't scrolling. here code <?xml version="1.0" encoding="utf-8"?> <scrollview xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillviewport="true"> <relativelayout android:layout_width="match_parent" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin...

javascript - what are the conditions to be a true array -

javascript not have true array. because when tested out thing in google console surprised see there no difference between object , array. var obj = {}; var arr = []; typeof obj; //object typeof arr; //object i curious know why so? and do javascript possess false array? and is typeof wrong , mean not differentiate between object , array? and what conditions true array? thanks! javascript dynamic language , objects flexible. , there no gurantee that, object have of particular type. because can duck typing . if want know if object array or not, can use object.prototype.tostring.call(obj) == '[object array]'; this taken underscore.js library's _.isarray function. since popular , used, method should reliable. if environment supports ecma 5.1, can use array.isarray function, this array.isarray(obj);

c++ - Is this a good way to lock a loop on 60 loops per second? -

i have game bullet physics physics engine, game online multiplayer though try source engine approach deal physics sync on net. in client use glfw fps limit working there default. (at least think it's because glfw). in server side there no graphics libraries need "lock" loop simulating world , stepping physics engine 60 "ticks" per second. is right way lock loop run 60 times second? (a.k.a 60 "fps"). void world::run() { m_isrunning = true; long limit = (1 / 60.0f) * 1000; long previous = milliseconds_now(); while (m_isrunning) { long start = milliseconds_now(); long deltatime = start - previous; previous = start; std::cout << m_objects[0]->getobjectstate().position[1] << std::endl; m_dynamicsworld->stepsimulation(1 / 60.0f, 10); long end = milliseconds_now(); long dt = end - start; if (dt < limit) { std::this_thre...

Creating a new Maven Scala project in Eclipse results in 4 errors -

Image
edit 2: seem have discovered problem: jar files downloaded m2 repository corrupt: it seems me causing problems. why corrupt? , how can fix that? edit: i've ran mvn eclipse:clean eclipse:eclipse in project, , completed successfully... , introduced 5 additional errors: on pc i've created scala maven project using m2eclipse , scala ide plugins eclipse. don't remember errors. pushed github. i proceeded clone project on laptop, first greeted (error) message: after selecting yes , seemed logical step, these errors appeared: what's going on , how can fix it? (linux, elementary os) it possibly difference in scala versions used . scala ide based on specific version of scala. looks project pom.xml requires different version of scala. a solution either update pom.xml version of ide or upgrade scala ide if possible. the other possibility downloaded jars corrupted.

jquery - Append draggable to droppable after swap -

i've searched question couldn't find yet. please correct me if i'm wrong. can more people if question gets answered. i'll explain situation first: html <div id="p1" class="base"> <!-- box --> <div class="card">1</div> <!-- dynamically created div --> </div> <div id="p2" class="base"> <div class="card" style="background-color: green">2</div> </div> i have multiple boxes act droppable. when click on box, div created , appended box , div draggable. i've figured out how drag div between multiple boxes. here problem: when there's each box has div dropped it, want able swap div between boxes , append them box new box. for example: box 1 has div 1 , box 2 has div 2. want swap them box 1 has div 2 , box 2 has div 1 appended them child. i made example shows how have code: http://jsfiddle.net/h7ysb/ $(".card"...

c# - GridView Column.Count is always 0 after databind with a datatable -

i trying show/hide gridview columns conditionally. i creating dynamic datatable , binding gridview later, on post back, checking condition , want show/hide few columns of gridview, column.count alway 0! the code have below - aspx page <asp:gridview id="gridview1" runat="server"> </asp:gridview> .cs page protected void button1_click(object sender, eventargs e) { datatable adt = new datatable() adt = createdatatable(); //datatable has 21 columns gridview1.datasource = adt; gridview1.databind(); int temp = gridview1.columns.count; //always 0 } not sure wrong code if set autogeneratedcolumns property true count show 0. from msdn the columns property (collection) used store explicitly declared column fields rendered in gridview control. can use columns collection programmatically manage collection of column fields. in case, didn't declared columns explicitly. can columns count inside , ou...

parsing - Get array of tokens -

is there way store tokens have been passed on parser after lexing process (preferably in order in data structure array)? furthermore, possible convert these tokens string literals? if so, guidance regarding how go highly appreciated. yes , yes. each token contains pointer next token, tokens form linked list. if want them in array, can traverse list , put tokens array. each token has image field contains character sequence token represents. see javacc faq question 5.2 more detail. http://www.engr.mun.ca/~theo/javacc-faq/javacc-faq-moz.htm#tth_sec5.2

Groovy GStrings and numberformat -

i'm writing script in groovy process files , have following method create resulting filename static string formatfilename(string prefix, int counter, string extension) { string counters = string.format('%04d', counter) return "$prefix-$counters$extension" } is there more elegant way of formatting counter in gstring? frankly, there's not can here. making shorter nitpicking. as mentioned in tim_yates ' comment, make one-liner return "$prefix-${string.format('%04d', counter)}$extension" i can think of 1 way make shorter, give on gstrings , use sprintf instead, example of groovy goodness. namely, extension method of object class . personally, find easier read braces mashup. return sprintf("%s-%04d%s", prefix, counter, extension)

ios - NSBundle mainBundle pathForResource: Not working unless @2x included -

i have files named: landing_load1@2x ...landing_load4@2x in project. (no non-retina files) this code works: for(int x=1; x < 5; x++){ nsstring * imagetitle = [nsstring stringwithformat:@"landing_load%i@2x", x]; uiimage * loadingimage = [uiimage imagewithcontentsoffile:[[nsbundle mainbundle] pathforresource:imagetitle oftype:@"png"]]; [loadingimages addobject:loadingimage]; } but doesn't work: for(int x=1; x < 5; x++){ nsstring * imagetitle = [nsstring stringwithformat:@"landing_load%i", x]; uiimage * loadingimage = [uiimage imagewithcontentsoffile:[[nsbundle mainbundle] pathforresource:imagetitle oftype:nil]]; [loadingimages addobject:loadingimage]; } and doesn't work: for(int x=1; x < 5; x++){ nsstring * imagetitle = [nsstring stringwithformat:@"landing_load%i", x]; uiimage * loadingimage = [uiimage imagewithcontentsoffile:[[nsbundle mainbundle] pathforresource:imagetitle oft...

java - Copying array contents to a new array -

i trying write method called reallocate, takes array called thedirectory, , copies it's contents on new array named newdirectory, has twice capacity. thedirectory set newdirectory. this have far, stuck on how copy content across newdirectory, appreciated. private void reallocate() { capacity = capacity * 2; directoryentry[] newdirectory = new directoryentry[capacity]; //copy contents of thedirectory newdirectory thedirectory = newdirectory; } thanks in advance. you can use system.arraycopy that. api here . simple example destination array double capacity: int[] first = {1,2,3}; int[] second = {4,5,6,0,0,0}; system.arraycopy(first, 0, second, first.length, first.length); system.out.println(arrays.tostring(second)); output [4, 5, 6, 1, 2, 3]

java - Ant properties override -

i have question, have build.properties have property test=true; , ant target should called in case test true. want have value default one. possible somehow change value in jenkins? tried set test=false, seems there no effect. suggestions? in scenario have modify ant script below, work expected. if not try similar kind of logic set default , dynamic values ant. if pass value jenkins if -dtest=true otherwise default assign value false <condition property="test" value="${test}" else="false"> <isset property="${test}" /> </condition>

mysql - If statement on variables for insert into table php -

i have number of variables being inserted mysql table, on 1 of variables need insert table, there way if $x = y 'a' else 'b' within insert statement? use different variable result, use in query. $tmp = ($x == 'y' ? 'a' : 'b'); /* if $x==y $tmp = else $tmp = b */ $q = "insert tbl set coloumn = $tmp";

calling c from python with ctypes: passing vectors -

i want call c function python using ctypes. documentation don't understand how pass pointer vectors. function want call is: double f(int n, double* x) { int i; double p=1; (i=0; i< n; ++) p = p * x[i]; return p; } i have modified function void pointer, becomes f(int, void*) internal cast double. following: def f(x): n = len(x) libc = '/path/to/lib.so' cn = c_int(n) px = pointer(x) cx = c_void_p(px) libc.restype = c_double l = libc.f(cn, cx) return l i assume x numpy array, not sure how numpy array organized in memory , if best solution. edit: none of proposed methods work numpy array, maybe due how defining array: x = np.array([], 'float64') f = open(file,'r') line in f: x = np.append(x,float(line)) but of them work if have explicit list [1,2,3,4,5] , rather list has been defined somewhere else , referred x based on @sven marnach's answer : #!/usr/bin/env python import cty...

java - Is there a Logback Layout that Creates JSON Objects with Message Parameters as Attributes? -

i want send log events loggly json objects parameterized string messages. our project has lot of code looks this: string someparameter = "1234"; logger.log("this log message parameter {}", someparameter); we're using logback our slf4j backend, , logback's jsonlayout serialize our ilogevent objects json. consequentially, time our log events shipped loggly, this: { "message": "this log message parameter 1234", "level": info, .... } while work, sends different message string every value of someparameter , renders loggly's automatic filters next useless. instead, i'd have layout creates json looks this: { "message": "this log message parameter {}", "level": info, "parameters": [ "1234" ] } this format allow loggly group log events message this log message parameter together, regardless of value of someparameter . it l...

Starting the ActiveMQ broker, results in an error -

i trying start activemq broker on windows machine following instructions @ http://activemq.apache.org/getting-started.html#gettingstarted-startingactivemq after downloading windows binaries, changed installation directory , launched broker using bin/activemq instructed. launch fails , after scanning wall of text found following error. error | failed start apache activemq ([localhost, id:[computer id]:1], java.io.ioexception: transport connector not registered n jmx: failed bind server socket: amqp://0.0.0.0:5672?maximumconnections=1 000&wireformat.maxframesize=104857600 due to: java.net.bindexception: address al ready in use: jvm_bind) the address in use caused me believe amqp broker, such rabbitmq or qpid(both of installed), might have allocated connection restarted computer no success on eliminating error. can give me ideas on try activemq running properly. i try running netstat -anb command prompt , see if can find using port 5672.

python - Kivy demo pictures - I am trying to modify the Class Rule <Picture> and clear the canvas.after -

i modified pictures demo example kivy. changed canvas.before canvas.after in .kv file hide pictures white cover. added button in .py file clear canvas.after on_press remove white cover , show pictures. problem can access root class in .kv file floatlayout:. need access class rule : in order able clear canvas.after using canvas.after.class() function. here .py file: #!/usr/bin/kivy ''' pictures demo ============= basic picture viewer, using scatter widget. ''' import kivy kivy.require('1.0.6') glob import glob random import randint os.path import join, dirname kivy.app import app kivy.uix.button import button kivy.logger import logger kivy.uix.scatter import scatter kivy.properties import stringproperty # fixme shouldn't necessary kivy.core.window import window class picture(scatter): '''picture class show image white border , shadow. nothing here because inside picture.kv. check rule named <picture> insi...