Posts

Showing posts from March, 2010

c - Is my understanding on the use of the symbol table and relocation table correct? -

c - Is my understanding on the use of the symbol table and relocation table correct? - i'm having hard time understanding linking/loading concept. could tell me if next statements on utilize of symbol , relocation tables correct? in relocatable object file, symbol table must contain entries variables , functions accessed/called other object files. listing of variables , functions not used outside object file optional. this means if programme consists of 1 object file, symbol table can omitted. in relocatable object file, relocation table holds adresses of locations of assembled code have updated during loading. in non-relocatable object file, relocation table can ommitted. however, object must loaded adress space hardcoded instructions. thanks time! the first part (about extern elements beingness required) correct. corollary programs consisting of single object file, however, not exclusively true: @ to the lowest degree 1 symbol must available external

Trying to make confirmation box with JavaScript, JQuery…not working -

Trying to make confirmation box with JavaScript, JQuery…not working - i'm new-ish jquery , js, basic i'm missing. in html have form: <form action="" method="post" onsubmit="return confirm_del()"> //….etc….. <button type="submit" class="btn btn-sm btn-danger">delete</button> </form> i want create confirmation box delete button. have following, text of confirmation box: <div id='confirmation_dialogue'> pressing 'delete' delete item database. action cannot undone <br><br> pressing cancel not alter database. </div> under that, have next in order handle onsubmit function: <script type="text/javascript"> function confirm_del(){ alert("cd"); $("#confirmation_dialogue").dialog({ autoopen : false, modal : true, title : "<div class='widget-header'><h4>

twitter bootstrap - "glyphicon glyphicon-search" button is not attached to text field -

twitter bootstrap - "glyphicon glyphicon-search" button is not attached to text field - i have in navbar-right search field button. however, button below search field. how possible attach button search field? <div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand" href="{{url_for('home')}}">test</a> </div> <div class="navba

r - Creating a factor/categorical variable from 4 dummies -

r - Creating a factor/categorical variable from 4 dummies - i have info frame 4 columns, let's phone call them v1-v4 , 10 observations. 1 of v1-v4 1 each row, , others of v1-v4 0. want create new column called newcol takes on value of 3 if v3 1, 4 if v4 1, , 0 otherwise. i have many sets of variables v1-v4 solution short possible easy replicate. this 4 columns add together 5th using matrix multiplication: > cbind( mydf, newcol=data.matrix(mydf) %*% c(0,0,3,4) ) v1 v2 v3 v4 newcol 1 1 0 0 0 0 2 1 0 0 0 0 3 0 1 0 0 0 4 0 1 0 0 0 5 0 0 1 0 3 6 0 0 1 0 3 7 0 0 0 1 4 8 0 0 0 1 4 9 0 0 0 1 4 10 0 0 0 1 4 it's generalizable getting multiple columns.... need rules. need create matric the same number of rows there columns in original info , have 1 column each of new factors needed build each new variable. shows how build 1 new column sum of 3 times 3rd co

internet explorer - Why IE10 fires beforeunload event when clicking on anchor element with javascript href and how to prevent it -

internet explorer - Why IE10 fires beforeunload event when clicking on anchor element with javascript href and how to prevent it - in order track when user leaves page, hear beforeunload event. works fine until user, uses ie10 , clicks on empty link (anchor) javascript in href parameter instead of url. example: <a href="javascript:void(0)">empty link js in href</a> this case makes ie10 sometimes fire beforeunload event. chrome/ie11 work fine (0 beforeunload s), while ie10 fires time time, if click fast. here jsfiddle seek it. know why happen , how prepare it? happy remove/replace such anchors in mark-up, impossible in case. thanks. technically, ie10 may considered right because are unloading page... kind of. if link were: <a href="javascript:'blah';"> then end on new page content 'blah'. how javascript: links work. void returns nil ( undefined ), , when javascript: link returns nil not replace pag

mysql - Can't do a mysqldump from a PHP Script (Big data) -

mysql - Can't do a mysqldump from a PHP Script (Big data) - i'm trying create database dump php script, when seek dump database construction works fine, when seek dump info application crashes, tried using options : --opt , --quick, didn't work me. ideas ? run before script: ini_set('memory_limit', '-1'); you may need line create sure php doesn't time out: set_time_limit(0); php mysql database dump

oracle10g - ORA-27100: shared memory realm already exists oracle -

oracle10g - ORA-27100: shared memory realm already exists oracle - i'm trying start our db after performing shutdown abort on oracle 10g server, atm i'm getting next message: ora-27100: shared memory realm exists linux error: 17: file oracle 10g running under centos 6.x anyone know leads solving issue? found this link since dont have extensive background on oracle db administration rather confirm if should follow instructions. thanks in advance. you need set environment before startup. oraenv right tool that. # oracle user . oraenv (don't forget dot) --> input sid (if don't know, cat /etc/oratab) sqlplus / sysdba startup forcefulness --performs shutdown abort + startup bjarte oracle oracle10g

java - Resolving dependencies in Eclipse for Fitnesse -

java - Resolving dependencies in Eclipse for Fitnesse - my goal run unit tests in fitnesse.responders.run.slimresponder testing dataflex slimrunner implementation. downloaded fitnesse source code, , made new java project in eclipse. able compile selecting run ant build (2) on build.xml file. in order resolve include errors in problems view in eclipse, ended manually adding dozens of external jars hand. found maven/ivy had apparently downloaded jars part of ant build. somehow these not added java build path. it seems reasonable me assume there should easier way set java build path add together jar files manually, since build.xml apparently contains info already. missing? the fitnesse readme.md mentions using apache ivy dependency management. download ivyde eclipse marketplace, , set (use ivy.xml part of fitnesse source code). java eclipse maven ivy fitnesse

c++ - How to detect cast from bool -

c++ - How to detect cast from bool - i found error in code think should marked warning. compiled /w4 don't show warning (only unreferenced formal parameter). #include <cstdio> void a(int item, unsigned int count, unsigned team_count) { printf("a, count, team count\n"); } void a(int item, unsigned int count=1, bool is_team=true) { printf("a, count, is_team\n"); homecoming a(item, count, is_team ? count : 0); } int main() { a(0, false); // <- bool unsigned int homecoming 0; } here bool casted unsigned int. there way observe that? tried cppcheck don't find this. the standard says acceptable §4.7/p4 integral conversions: if source type bool, value false converted 0 , value true converted one. regarding how observe (since it's not error) , depending on use-case, either clang-tooling or write wrapper template deduction magic on lines of: #include <cstdio> #include <type_traits> templ

javascript - How to show the total value of multiple text field? -

javascript - How to show the total value of multiple text field? - how can show total value of id="total" in id="grand". whole code. html , javascript should used. don't know how add together value of each. javascript exeuted when user checked checkbox. value of checkbox multiplied value of dropdown value. product displayed in input id="total". want sum value in input id=total , display in input id="grand" <p><center><font size="5">total amount: <input type="text" id="grand" name="grand" value="p0.00"></input></p> <table border=1> <tr> <td colspan=3><h2>specialty cakes</h2></td> </tr> <tr> <td><center><img src=special\blackforest_small.jpg ><br>black forest</td> <td><input type="checkbox" id="check1" name="check1" value="550.00&q

javascript - highCharts:when color of data set undefiend,slice is white in piechart -

javascript - highCharts:when color of data set undefiend,slice is white in piechart - i wanna set color each info in piechart , , in slices wanna show default color. read in highcharts api must set undefined , not work me. $('#container').highcharts({ chart: { type: 'pie' }, series: [{ data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, { y: 216.4, color: undefined }, 194.1, 95.6, 54.4] }] }); demo samira jan, color: undefined makes 1 piece color default! not illustration you. go link: http://jsfiddle.net/8qufv/ javascript jquery highcharts

sql - Fastest way to select row with max value at primary key field -

sql - Fastest way to select row with max value at primary key field - i have got table: create table spots( datetime timestamp, market varchar(15), spot numeric(10, 5), primary key (market, datetime) ); i need select row p_market maximum value of datetime filed, less or equal p_datetime , have got 2 opts this: select * spots market = p_market , datetime = ( select max(datetime) spots market = p_market , datetime <= p_datetime ); and select * spots market = p_market , datetime <= p_datetime order datetime descending limit 1; so, question - variant improve performance perspective. postgres supports window function, should theoretically calculated incrementally rows processed, should provide performance boost on big info sets: select * (select *, rank() on (order datetime desc) rk spots market = p_market , datetime <= p_datetime) t spots rk = 1 sql performance postgresql gre

ios - How to add a scroll view to the existing view controller? -

ios - How to add a scroll view to the existing view controller? - i have added lot of ui elements in controller , have done web service part in implementation code. seems default screen size view controller not sufficient me display information. possible add together scroll view existing controller , if yes please give thought or example, can add together more ui elements. thanks in advance. try create main view scrollview: - (void)loadview { // create , configure scrollview uiscrollview *scrollview = [[uiscrollview alloc] initwithframe:self.view.bounds]; self.view = scrollview; } loadview method subclassed view controllers should configure main view, called automatically before vc loads , shouldn't called directly. after adding elements scrollview want alter content size scrolls this: // horizontal scroll [scrollview setcontetsize:cgsizemake(cgrectgetmaxx(lastelementontheright), scrollview.frame.size.height)]; // vertical scroll [scrollv

mysql - Name-value and key-value pairs both being created in PHP file (for json encode) -

mysql - Name-value and key-value pairs both being created in PHP file (for json encode) - i generating php arrays mysql database, output converted json using json_encode (ultimately utilize twitter typeahead). based upon i've read php arrays, had expected select query generate - record - single key-value pair each column. instead, seem getting both name-value pair , key-value pair. for instance, table 5 columns, set of values single record in form: [fieldname1] => value1 [0] => value1 [fieldname2] => value2 [1] => value2 [fieldname3]] => value3 [2] => value3 [fieldname4]=> value4 [3] => value4 [fieldname5] => value5 [4] => value5 when utilize json_encode generates next json string record - twice long needs because getting both name-value pair , key-value pair (so the value repeated line). "fieldname1":"value1","0":"value1", "fieldname2":"value2","1":"

javascript - How to call a function only after page has finished loading and after another function has been called -

javascript - How to call a function only after page has finished loading and after another function has been called - so i'm using http://kenwheeler.github.io/slick/ , http://instafeedjs.com/ , i'm trying create carousel slider based on instagram feed, problem i'm running since content in #instafeed dynamically loaded, keeps returning undefined in javascript code because hasn't been injected dom yet. how load code after function userfeed.run() has been called , instagram photos have been injected? $(window).bind("load", function() { var userfeed = new instafeed({ get: 'user', userid: 434846375, accesstoken: '#############################', limit: 5, template: '<div style="display: inline-block;"><img src="{{image}}" /></div>' }); // userfeed.run(); $.when(userfeed.run()).done(function() { $('.your-cla

database - Connect to MS Access with PHP not working -

database - Connect to MS Access with PHP not working - i trying connect ms access database php. working when creating scheme dsn how create connection work, when want re-create , utilize php files plus database on different computer? (without creating scheme dsn on computer well) at moment trying way: $conn = odbc_connect("odbc:driver={microosoft access driver (*.mdb)}; dbq=$odbc_name; uid=$uid; pwd=$pwd;"); and getting error: warning: odbc_connect() expects @ to the lowest degree 3 parameters, 1 given in c:\wamp\www\partb\db_connection.php on line 14 the file correctly found line of code: $odbc_name = $_server["document_root"] . "partb\db.mdb"; so problem? why way not working, scheme dsn is? ideas? ok found reply myself. $conn = "provider=microsoft.jet.oledb.4.0; info source=$odbc_name"; the above code makes connection work without scheme dsn. now need reconfigure query statements , good.

Why does android RemoteView class provide only setOnClickPendingIntent -

Why does android RemoteView class provide only setOnClickPendingIntent - android's remoteview class provides method setonclickpendingintent instead of setonclicklistener . reason ? what's advantage of using pendingintent in case ? iirc a remote view not running in applications process, hence has utilize ipc tell app clicked. asynchronous , "pending" click, not instant click. name reflects subtle behaviour difference. #setonclickpendingintent(int, android.app.pendingintent) vs #setonclicklistener(android.view.view.onclicklistener) android android-pendingintent remoteview android-remoteview

javascript - Displaying multiple images in PrettyPhoto -

javascript - Displaying multiple images in PrettyPhoto - i building website, , on 1 of pages section show off images. thought prettyphoto looked good, , decided utilize it. right have square 'box' in bootstrap 2 col-md-4 rows (6 total). each image has hover state changes on hover, showing icon click on, , there prettyphoto opens. i not sure how add together multiple images prettyphoto given documentation, there examples of on documentation, haven't had luck implementing them. here code html <div class="row centered"> <div class="col-md-4 portfolio-item web-design"> <div class="he-wrap tpl6"> <img src="images/portfolio-2/crate-of-california.jpg" height="450px" width="600px" class="img-responsive" alt=""> <div class="he-view"> <div class="bg a0" data-an

c# - save row in one table to another table using linq -

c# - save row in one table to another table using linq - you know when drag , drop table datasources window onto usercontrol? visual studio automatically creates datacontext (in view's xaml) bind new elements on page to.this datacontext set collectionviewsource , collectionviewsource draws it's info dataset. same dataset took table when draging , dropping. in scenario created: <usercontrol.resources> <collectionviewsource x:key="signupsviewsource" source="{binding signups, source={staticresource myappndataset}}/> </usercontrol.resources> <grid datacontext="{staticresource signupsviewsource}"> <textbox x:name="idtextbox" text="{binding id, mode=twoway, notifyonvalidationerror=true, validatesonexceptions=true, updatesourcetrigger=propertychanged}"/> <textbox x:name="firstnametextbox" text="{binding firstname, mode=twoway, notifyonvalidationerror=true, validatesonex

ios - Parse Push Notification comes without Payload -

ios - Parse Push Notification comes without Payload - whenever seek send info cloud can't access ios app since userinfo null pointer in either application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject], fetchcompletionhandler handler: (uibackgroundfetchresult) or application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject: anyobject]) . function implemented follows func application(application: uiapplication, didreceiveremotenotification userinfo: [nsobject : anyobject], fetchcompletionhandler handler: (uibackgroundfetchresult) -> void) { pfpush.handlepush(userinfo) println("received notification") handler(uibackgroundfetchresult.newdata) } the info beingness sent this: parse.push.send({ where: pushquery, data: { aps: { alert: "test", sound: "", "content-a

ubuntu - snort 2.9.7.0 unable to load rule from local.conf while in test mode -

ubuntu - snort 2.9.7.0 unable to load rule from local.conf while in test mode - i next 'snort 2.9.6.2 on ubuntu 12 lts , 14 lts' guide run snort in nids mode on ubuntu 12.04. https://s3.amazonaws.com/snort-org-site/production/document_files/files/000/000/050/original/snort_2.9.6.2_on_ubuntu.pdf?awsaccesskeyid=akiaixacied2spmsc7ga&expires=1415002618&signature=ifhemzwyl%2bb1pulrndhcb7dkgtk%3d to test snort, created simple rule cause snort generate alert whenever snort sees icmp \echo request" or \echo reply" messages. wrote next line empty /etc/snort/rules/local.conf: alert icmp whatever -> $home_net (msg:"icmp test"; sid:10000001; rev:001;) now tested configuration file 1 time again has not loaded rule local.conf. typed next command: sudo snort -t -c /etc/snort/snort.conf i should have got next output: +-------------------[rule port counts]--------------------------------------- | tcp udp icmp ip |

html5 - Smoothly rotating a canvas element on setInterval() -

html5 - Smoothly rotating a canvas element on setInterval() - i trying replicate effect: http://codepen.io/kenjispecial/pen/enrbq i have segment class: function segment (x, y, length) { this.x = x; this.y = y; this.length = length; this.rotation = 0; this.color = '#fff'; } i utilize fill screen vertical lines (made out of segments) , rotate each of them 45deg clockwise using function , setinterval: function drawsegments(segment) { segment.rotation = angle; segment.draw(ctx); } setinterval(function(){ angle += 45 * math.pi / 180; }, 800); it works (i.e. lines rotated on each 800ms) there no animation between transitions.. tried somethig this, unfortunately doesn't work... for (var = 0; < 360; i++) { angle += * math.pi / 180; } so, problem - how animate each rotation of segments? here link live demo: http://codepen.io/gbnikolov/pen/kegzj html5 animation canvas

asp.net - Intermittant fire of javascript code behind button -

asp.net - Intermittant fire of javascript code behind button - help. have these buttons on webpage, nested within asp paginated gridview updatepanel surrounding them. not set of of everthing there works button3 causing me problems. <asp:button id="button1" runat="server" text="filter jobs" cssclass="mybuttonblue" style="width: 115px;" /> <asp:button id="button3" runat="server" text="reset filter" cssclass="mybuttonblue" style="width: 115px;" onclientclick="resetfilter();" /> <asp:button id="button2" runat="server" text="add new job" cssclass="mybuttonblue" style="width: 135px; float: right;" onclick="btnnewjob" /> if @ button3, have onclientclick (as know) on runtime converts onclick="" run javascript code. the button set run "resetfilter()"... .. <script>

css - Change color in drop-down where jquery change multiply drop-down-menu -

css - Change color in drop-down where jquery change multiply drop-down-menu - i utilize jquery alter multiply drop-down-menus 1 selection. , utilize 1 drop-down-menu alter others. i added diffrent background color each option. , when alter alternative on drop-down-menu contral them backround color won't displayed on other drop-down-menus. how can achive this? heres jquery function addmessage(msg, clear){ if (clear !== null && clear) { $('#msgs').html(""); } $('#msgs').append(msg+"<br/>"); } function onselectchange(){ var stext = $("#s_make option:selected").val(); addmessage("you selected: " + stext); switch (stext) { case "opt_1": $("#s_score > option[value='xml_multi_01.php']").attr('selected','selected'); break; case "opt_2": $("#s_score

iphone - How to unzip string data in iOS? -

iphone - How to unzip string data in iOS? - can help me please? have problem unzip string data. i tried lots of code unzip string info unable found solution. i trying parse info soap web service. , returns below info : <?xml version="1.0" encoding="utf-8"?><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:body><testgetnearbydonorlistresponse xmlns="tempuri.org"> <testgetnearbydonorlistresult>h4siaaaaaaaeam2yxw/iobsg71fa/3dexwpxk5jycb66ljfpaggauiwg7l66jbsr+ubokj399etamwlhfo3manwbthzoipgj9z2vax18zlj4smqpivyygzhrgcsffbhihy4bq2quy7vxsf3rly0mjf88nnfsooj9rfuk/xxegho8ly+ey/iysaiq5uwzuv6v0dpehxxoespazb9gw8lskws88avync7wrv5wpj8ldfvygny3791m1tns1symfb+npupbza/jnwubz5k2zzp3bnjxryzw+7vszz03tsyozvkw7dgqwhrfbddc7ydcwlbkokpibbdgpeqqfaiiytoa3mhilcdwrvyonrgvl0wpcieq6umeurtq

word vba - vba WScript.Shell run .exe file with parameter -

word vba - vba WScript.Shell run .exe file with parameter - i running vba macro word 2013. i'm trying run executable file requires argument/parameter of filename. example, c:\myfilefilter.exe filetobefiltered.htm utilize shell run because want vba code wait until executable finished running before resuming vba code. lastly 3 lines in code below examples of of syntax have tried not work. think problem space between executable programme , file filters. know right syntax or way wait executable programme finish. if need more info, please ask. dim wsh object set wsh = vba.createobject("wscript.shell") dim waitonreturn boolean: waitonreturn = true dim windowstyle integer: windowstyle = 1 dim errorcode integer dim strprogramname string dim strmyfile string phone call shell("""" & strprogramname & """ """ & strmyfile & """", vbnormalfocus, waitonreturn""") wsh.run

java - Chaining together channels removes the file_originalFile header -

java - Chaining together channels removes the file_originalFile header - i have requirement want utilize ftp , set file in dynamic local-directory. want add together age filter. not allow old files through. works file properly. added custom filter , checked file objects creation date using code: int agelimit = integer.parseint(props.getproperty("file.age")); basicfileattributes view = null; seek { view = files.getfileattributeview( paths.get(f.getabsolutepath()), basicfileattributeview.class).readattributes(); } grab (ioexception e1) { // todo auto-generated grab block e1.printstacktrace(); } filetime ft = view.creationtime(); if (((new date()).gettime() - (((ft.to(timeunit.milliseconds))/* / 10000l) - 11644473600000l*/))) > agelimit * (24 * 60 * 60 * 1000))// file creation

svn - Subversion diff : Can't specify revision -

svn - Subversion diff : Can't specify revision - i have directory 'data', this: $ svn info info ... revision: 666 ... so can see managed subversion, , @ revision 666. see changes between 2 specific versions (i.e. files below directory have been changed between revisions): $ svn diff data@648 data@649 now error, data@648 not under version control. seems svn doesn't interpret 648 revision information. i checked man page svn diff, , explicitly mentions form diff pfad-alt[@revalt] url-neu[@revneu] what did wrong? svn

Show data from database in div tags using asp.net ajax updatepanel -

Show data from database in div tags using asp.net ajax updatepanel - i creating online marketplace selling , purchasing physical products , online services. (combined olx type , freelancing website) using asp.net webforms. in content area of .aspx file, need show ads records database in form of divs within update panel tags. <asp:scriptmanager id="scriptmanager2" runat="server"></asp:scriptmanager> <asp:updatepanel id="updatepanel2" runat="server"> <div> //here need append each image, title pair </div> </asp:updatepanel> this aspx.cs page load function. @ end, i've created instance of class advertisement defined in c# class library project. using instance, m calling method of class, protected void page_load(object sender, eventargs e) { string username = (string)session["username"]; if (session["username"] == null) { re

javascript - Three.js skybox seems broken after rotating camera -

javascript - Three.js skybox seems broken after rotating camera - js , i'm trying create simple skybox based on this demo. seems ok far except 1 thing when rotate photographic camera (i'm using orbitcontrols.js) , z value not minimum possible textures deed weird , seem broken. source: var camera, scene, renderer, controls, skybox; var toradians = function(deg) { homecoming deg * math.pi / 180 } var todegrees = function(radians) { homecoming radians * (180 / math.pi); } var init = function() { // scene scene = new three.scene(); scene.fog = new three.fogexp2( 0xffffff, 0.00010); // photographic camera photographic camera = new three.perspectivecamera(45, window.innerwidth / window.innerheight, 1, 20000 ); camera.position.z = 5000; scene.add( photographic camera ); // skydome var urlprefix = "http://three.dev/skybox/textures/"; var urls = [urlprefix + "px.png", urlprefix + "nx.png&quo

python - downloading file using ftp -

python - downloading file using ftp - i writing python script logged in using ftp , download file.but whenever run script,it says have provided wrong user name or passwd.i inputting right password still unable run script.my code is: import os,getpass urllib.request import urlopen filename='68544.jpg' password=getpass.getpass('??') at line below script failed run , whenever run address in browser runs fine. remoteaddr='ftp://kamal:%s@localhost/%s;type=i'%(password,filename) remotefile=urlopen(remoteaddr) localfile=open(filename,'wb') localfile.write(remotefile.read()) localfile.close() remotefile.close() def ftp_connect(path): link = ftp(host = 'example.com', timeout = 5) #keep low timeout link.login(passwd = 'ftppass', user = 'ftpuser') debug("%s - connected ftp" % strftime("%d-%m-%y %h.%m")) link.cwd(path)

Python Matrix solving {A}[x] = [B] where parts of x and B are known -

Python Matrix solving {A}[x] = [B] where parts of x and B are known - in python possible solve {a}[x]=[b] known matrix, b known vector , x unknown vector. but possible solve {a}[x]=[b] if know 3x3 matrix, x = [v1 5 v3] , b = [0 i2 0] ? thank much help. it's feasible cut down columns , rows , go downwards route rather suggest alternative approach here. reformulate problem quadratic problem in 3n unknowns. utilize cvxopt solve it. trying minimize 2-norm of residual r = ax-b x , b vector in n variables. define 0 = row_i of * x - b_i - r_i introduce constraints on x , b e.g. b_1 = 0 x_2 = 0.3*x1 etc. and minimize sum r_i^2 you sum abs(r_i) , introduce set of n variables , solve linear problem in 4n dimensions python matrix equation-solving

c++ - How are the iostate bits affected by fstream.close() and subsequent .open()? -

c++ - How are the iostate bits affected by fstream.close() and subsequent .open()? - i've got ofstream object i'm periodically reopening, new filename. know .clear() resets iostate goodbit . however, it's not clear me if state affected .close , .open . in particular, can check .fail() after .close() determine whether should ::remove file? don't want maintain corrupted or partial files. and if badbit and/or failbit unaffected .close , should explicitly .clear them before calling .open(newpath) ? found out bits cleared .open , formally since c++11 informally implementations did anyway. from [ifstream.members] / 5: void close(); effects: calls rdbuf()->close() and, if function returns null pointer, calls setstate(failbit) (which may throw ios_base::failure (27.5.5.4)). summing [filebuf.members] / 6: basic_filebuf<chart,traits>* close(); if is_open() == false , returns null pointer. if of calls made funct

Why is my parent process not waiting the second time? C/Unix -

Why is my parent process not waiting the second time? C/Unix - so, trying create kid process, have execute execl , run ls. after ls done, create kid process , have run cat command on file. sec wait(pid) not seem wait sec kid process finish before finishing. here code , output #include <fcntl.h> int main(){ int pid; printf("in parent process, creating kid now...\n"); pid = fork(); if (pid==0){ printf("now in kid process...\n"); execl("/bin/ls","ls","-l",(char*)0); } wait(pid); printf("ls kid process complete\n"); printf("in parent process\n"); printf("creating kid process\n"); pid=fork(); if(pid==0){ execl("/bin/cat","cat","f1",(char*)0); } wait(pid); homecoming 0; } here output in parent process, creating kid now... in kid process... "contents of ls" ls kid process finish in parent process creating kid process [username@host ~

c# - Ghostscript.NET Multithreading Issue -

c# - Ghostscript.NET Multithreading Issue - the longest part of monthly process run automated slicing , conversion of pdfs images. each pdf read in, converted 3 different pdfs, , 3 converted images placed in e-mails customers. pdfs unique per-customer, , send monthly pdf @ to the lowest degree 15,000 (frequently more 22k) customers. our pdf generation , slicing multithreaded, i've been looking parallelizing remaining bits of it. to end, have converted our process utilize ghostscript.net, purports library supports parallelizing ghostscript. to end, wrapped code in parallel.foreach() loop, each iteration through loop works on different initial pdf: ghostscriptversioninfo gsversioninfo = ghostscriptversioninfo.getlastinstalledversion(ghostscriptlicense.gpl | ghostscriptlicense.afpl, ghostscriptlicense.gpl); ghostscriptprocessor processor = null; seek { //sargs array of arguments ghostscript processor = new ghos

playframework - Disabling lazy load in Play application -

playframework - Disabling lazy load in Play application - by default play application started (compiled, global 's onstart called, etc.) after http request it. is there way disable lazy load , create play app compile code , startup 1 time application process run? ps: using play 2.3. update: ryan pointed out lazy load happens in dev. mode. nevertheless still need disable it, despite relevant apps running in dev. mode. lazy loading applies in dev mode ( play run ). production mode not lazy. https://www.playframework.com/documentation/2.3.x/production playframework playframework-2.3

Odd field in struct? c++ -

Odd field in struct? c++ - hi wondering if explain me field in struct looks this: struct illustration { void (someclass::*somemethod)(); }; what , how/why utilize it? thanks. this construction contains pointer function void homecoming type , without parameters. we set pointer address of actual function , execute function via pointer time later. function pointers convenient thing providing different functions handle task depending on circumstances. c++

php - How to add a delimiter in twig to a string? -

php - How to add a delimiter in twig to a string? - i have time in format hhmm string , add together " : " after hours. there simple filter split string after 2 characters , add together delimiter? you can split position this {% set bar = "aabbcc"|split('', 2) %} {# bar contains ['aa', 'bb', 'cc'] #} as described in doc so can like: {% set bar = "1203"|split('', 2) %} {# bar contains ['12', '03'] #} now let's do: {{ bar[0]~":"~bar[1] }} this output: 12:03 better if build macro or twig extension function hope help php symfony2 twig

Json Validation with PlayFramework in Scala -

Json Validation with PlayFramework in Scala - can please help me prepare next code: case class person(name:string,email:option[string]) implicit val personformat:format[person] = ( (__ \ "name").format[string] ~ (__ \ "email").formatnullable[string](email) // code doesn't compile here )(person.apply,unlift(person.unapply)) apparently formatnullable doesn't work readconstraints, how can resolve ? email read[string] while require format[string] here. format combination of read , write cases symmetrical. isn't case here because validation reading json, not writing it. cannot write single format . to around this, write read , write separately: implicit val personreads: reads[person] = ( (jspath \ "name").read[string] ~ (jspath \ "email").readnullable[string](email) )(person.apply _) implicit val personwrites: writes[person] = ( (jspath \ "name").write[string] ~ (j

Java - how should a method with return treat exceptions -

Java - how should a method with return treat exceptions - i'm doing exercises exception handling , nil working. i'd know how method homecoming should implement exception, instance: public class class{ double n1, n2, result; public double sum(double n1, double n2){ this.n1 = n1; this.n2 = n2; result = n1 + n2; homecoming result; } } this b e class , method, then..what if want create exception makes sure no letters input (the scanner in main class). i tried next code: public double sum(double n1, double n2){ try{ this.n1 = n1; this.n2 = n2; result = n1 + n2; }catch(numberformatexception e){ system.out.println("error!"); homecoming 0; } homecoming result; } but whenever execute , input letter, next error occurs: exception in thread "main" java.util.inputmismatchexception @ java.util.scanner.throwfor(scanner.java:909) @ java.util.scanner.next(scanner.java:153

java - Collapse 2D ArrayList -

java - Collapse 2D ArrayList - i have object contains dynamically allocated 2d arraylist . it has getter: arraylist<integer> getlist() i'd function collapse 2d arraylist 1d arraylist . java have such thing or stuck doing this: public arraylist<integer> getlist(){ arraylist<integer> result = new arraylist<integer>(); for(int = 0; < list_.size(); i++){ for(int j = 0; j < list_.get(i).size(); j++){ result.add(list_.get(i).get(j)); } } homecoming result; } without java 8, have utilize loops. using addall(..) rid of 1 of them though. public arraylist<integer> getlist(){ arraylist<integer> result = new arraylist<integer>(); for(arraylist<integer> : list_){ result.addall(i); } homecoming result; } also, generic types such arraylist must object types, hence integer, not int. java arraylist multidimensional-array dynamic-arrays

json - trouble extracting recursive data structures in scala with json4s -

json - trouble extracting recursive data structures in scala with json4s - i have json format consists of map -> map -> ... -> int arbitrary number of maps per key. keys strings , leaf types ints. depth of map construction varies per key in map. example, key "a" type map[string, int] , key "b" type map[string, map[string, int]]. know can parse format map[string, any], i'm trying preserve types create these structures easier merge later in code. i can't seem define nested construction in such way not throw error on json4s extract. i'm not quite sure if problem in construction definition or if i'm not doing json extract correctly. here code sealed trait nestedmap[a] case class elem[a](val e : a) extends nestedmap[a] case class nmap[a](val e : map[string, nestedmap[a]]) extends nestedmap[a] // xxx next line doesn't seem help or wound case class empty extends nestedmap[nothing] implicit val formats = defaultformats val s

javascript - Message callback returns a value infrequently - Chrome Extension -

javascript - Message callback returns a value infrequently - Chrome Extension - i'm building chrome extension communicates nodejs server through websockets. point of track browsing history content. seems work, (30% of time) callback in function passed onmessage.addlistener doesn't fire correctly. allow me show code: background.js var socket = io('http://localhost:3000/'); var tabload = function (tab) { socket.emit('page load', tab); }; var tabupdate = function (tabid, changeinfo, tab) { var url = tab.url; if (url !== undefined && changeinfo.status == "complete") { tab.user_agent = navigator.useragent; tab.description = ''; tab.content = ''; socket.emit('insert', tab); } }; socket.on('inserted', function(page){ socket.emit('event', 'requesting page content\n'); //page = {tab: page, id: docs._id}; chrome.tabs.sendmessage(page