Posts

Showing posts from June, 2015

c - Why is my input delayed when sent to process via pipes? -

i'm writing program operating systems project meant modem keyboard in type key , outputs fsk-modulated-audio-signal corresponding ascii value of key. how i've set program forks process , execs program called minimodem ( see here info). parent set non canonical input mode , gets user input character @ time. each character sent child via pipe. i'll paste code now: #include <stdlib.h> #include <fcntl.h> #include <errno.h> #include <unistd.h> #include <stdio.h> #include <sys/ioctl.h> #include <string.h> #include <termios.h> extern char* program_invocation_short_name; static struct termios old, new; void init_termios(int echo); void reset_termios(void); int main(int argc, char* argv[]) { pid_t pid; int my_pipe[2]; char* baud = "300"; if (argc == 2) { if(atoi(argv[1]) == 0) { printf("use: %s [baud]\n",program_invocation_short_name); return exit_success; } baud = argv[1]; } i

android - xml box layout or other suggestions -

i programming android app making work-fiches, main screen needs show summary of:working hours, parts used, remarks, ... , how can design in xml these boxes best way? need title, summary content, clickable,... android design guidelines doesn't give me solution it, difficult find example of know xml attributes use, frame layout helping me first seems give me problems now, thanks ideas in advance. i suggest go relative layout , best layout present requires minimum no. of lines compared other layouts , align views respect each other. if want views divided in proportion recommended use linear layout using weight concept.

python - bitwise NOR Gate - what does & mean? -

this question has answer here: how bitwise nor gate in python (editing python maths work me) 2 answers i'm trying understand code answer received yesterday: 2nd: how make bitwise nor gate 1st: how bitwise nor gate in python (editing python maths work me) a=0b01100001 b=0b01100010 bin((a ^ 0b11111111) & (b ^ 0b11111111)) i understand except: the & between 2 values and ^ 11111111 ( know 0b base 2 ) can please explain these? how nor works? the expression x nor y can broken using and , or , , not : x nor y == not(x or y) == not(x) , not(y) so, given values: a=0b01100001 b=0b01100010 a nor b not(a) , not(b) . think how not(a) ? need flip bits. way flip bits? xor(^) . how? 0 ^ 1 == 1 1 ^ 1 == 0 so, taking xor of bit 1 flip bit. i.e. not(somebit) == xor somebit . so, in case, take xor of each bits in a , b 1 not

c++ - How to create a static constant member std::string array? -

i cannot believe sounds simple can hard. class outputhandler { private: static std::string const errorprefixes[] = {"info", "warning", "error", "crash"}; }; how do properly? various documentations understand cannot initialize static member objects, regardless of them being constant. write initialization outside class, definition: class outputhandler { private: static std::string const errorprefixes[]; }; std::string const outputhandler::errorprefixes[] = {"info", "warning", "error", "crash"}; (the definition of course subject one-definition-rule , must appear in 1 single translation unit, e.g. outputhandler.cpp .)

depth function usage in opengl es 2.0 -

i tried use gldepthfunc in opengl es 2.0 (at pc emulator) , don't understand behavior. in init function call define these values: glcleardepthf( 0.5f ); glclearcolor ( 1.0f, 0.0f, 0.0f, 0.0f ); and in drawing function code: glclear ( gl_color_buffer_bit | gl_depth_buffer_bit); glenable( gl_depth_test ); gldepthfunc(gl_lequal); gluniform4fv(unifcolor, 1, vercolor); gldrawarrays ( gl_triangle_fan, 0, 4 ); eglswapbuffers i'm drawing green square (half of screen size). when z value of drawn square 0.5. i expect depth test true , i'll see green square drawn, see red screen (the color used in clear color). when define clear depth value 1.0 receive expected behaviour: grren squar on red screen, think depth used needed (all initialzed defines depth). what can problem? thanks there things go wrong. there might precision issues. however, have guess here: i'm drawing green square (half of screen size). when z value of drawn square 0.5. wrrit

vb.net - Complex MsgBoxResult.No function VISUAL BASIC -

i've made button1 if click on it starts timer. in timer_tick typed label7.text = "l o d n g". i've made exit (button2). want code if label7.text = "l o d n g" msgboxresult.no in button2 button1.enabled = true . here video how want that: http://www.youtube.com/watch?v=4uryhd0xa8i&feature=youtu.be here code button2 (exit) dim msg string dim title string dim style msgboxstyle dim response msgboxresult msg = "are sure want exit?" ' define message exit." style = msgboxstyle.defaultbutton2 or _ msgboxstyle.question or msgboxstyle.yesno title = "exit" ' display message. response = msgbox(msg, style, title) if response = msgboxresult.no if label7.text = "l o d n g" button1.enabled = true button5.enabled = false textbox1.enabled = true end if end if if response = msgboxresult.yes me

jquery - Code is working fine in chrome, but not in IE and Firefox -

i have code here. working fine in chrome, not in ie , firefox. $(document).ready(function(){ $(".thumb").click(function(){ alert ("reached here."); var cat_id = $(this).attr('id'); // category id alert (cat_id); }); }); <a href="#" class="thumb" id = "20" name="df" > <img src="images/dry_fruits.png" alt="title #0" width="75" height="75"/> </a> its not hitting alert in firefox , ie. can please me identify issue. any highly appreciated. devesh keeping done in 1 call $(document).ready ensures no problems race-conditions etc in order functions added called. if 1 function adds element dom , require presence might conflicts , unexpected behavior due varying calling order...

c - A Linux thread without a stack -

of course, necessary have stack of sort - want have (userland) thread have complete (or near possible complete) control on memory allocation. best way this? avoid using automatic variables , use heap everything, think: there better way? take loop @ protothreads , thing looking for. out of interest trying do? embedded platform?

java - String comparison isn't working properly? -

this question has answer here: how compare strings in java? 23 answers so i'm trying have user input string, print backwards , compare new strings see if palindrome or not... doesn't seem working , i'm not sure why... public static void main(string[] args) { scanner input = new scanner (system.in); system.out.print("enter word: "); string word = input.next(); stringbuilder drow = new stringbuilder(word); drow.reverse(); system.out.println(drow); system.out.print(" "); string x = drow.tostring(); if (word == x) { system.out.println("that word palindrome"); } else { system.out.println("that word not palindrome"); } thanks why isn't working... word == x asks if literally same string (i.e. 2 references pointing same object in memory), not if identically

rpc - send compressed message using avro -

i have pojo in need send end-poind (some server). have decided using avro. so far have created avro schema , generated datafilewriter: genericrecord user1 = new genericdata.record(schema); user1.put("name", "jenny"); user1.put("favorite_color", "green"); genericrecord user2 = new genericdata.record(schema); user2.put("name", "kevin"); user2.put("favorite_color", "red"); datumwriter<genericrecord> datumwriter = new genericdatumwriter<genericrecord>(schema); datafilewriter<genericrecord> datafilewriter = new datafilewriter<genericrecord>(datumwriter); datafilewriter.create(schema, schemafile); datafilewriter.append(user1); datafilewriter.append(user2); this have far , i'm missing following: i compress data before sending it, rather doing using snappy , how should combine code? update: added these lines: // use snappy compression codecfactory codecfactory = code

How to get date value from SQLite in java -

i have simple table in database: create table [informacjezdziekanatu] ( [_id] integer not null primary key autoincrement, [datawstawienia] date not null, [datamodyfikacji] date not null, [tresc] varchar2 not null); in application want value of datawstawienia column. using such method: try { resultset result = stat.executequery("select * informacjezdziekanatu order _id desc limit 5"); int id; date datawst; date datamod; string tresc; for(int j = 0 ; j < 5 ; j++) { result.next(); object[] lista = new object[4]; id = result.getint("_id"); datawst = result.getdate("datawstawienia"); datamod = result.getdate("datamodyfikacji"); tresc = result.getstring("tresc"); lista[0] = id; lista[1] = datawst; lista[2] = datamod; lista[3] = tresc; dane[j] = list

php - Sqlite database does not return PRIMARY field value -

i have sqlite db. i'm using sqlite3 extension connect in php. database program used until invoices. took out sqlite file program , wrote own web based inteface. everything seems ok, except when created new table existing database. database created, add new entries , lastinsertrowid() gave proper last insert ids. however, when started select entries new table, ids (primary key) empty. i opened database sqlite database browser , odd. maybe first give db schema: create table if not exists koszty ( id numeric primary key desc, data numeric, nazwa text, wartosc_netto numeric unsigned, podatek numeric unsigned, typ numeric unsigned, filename text, opis text ) when opened db there strange table sqlite_autoindex_koszty_1 seems correspond table only. old tables not have it. on other hand there sqlite_sequence table seems store autoincrement ids. all tables have name here , ai value except koszty. what reason? how fix db. me doing wro

regex - Permanent redirect of page dependent on parameters -

i want redircet www.mysite.com/abc/mypage.php?id=123 www.mysite.com/newpage.htm i've tried in .htaccess file doesn't work. (i 404) redirectpermanent /abc/mypage\.php\?id=123 /newpage.htm what correct syntax? no cannot match query_string using redirect directive. can use mod_rewrite instead: rewriteengine on rewritecond %{the_request} ^[a-z]{3,}\s/+abc/mypage\.php\?id=123[&s] [nc] rewriterule ^ /newpage.htm? [r=302,l]

json - How to write a JSONObject to a file, which has JSONArray inside it, in Java? -

i have json file, need read, edit , write out again. reading works fine, struggle write part of json array in data. i use json.simple library work json in java. the file looks this: { "maxusers":100, "maxtextlength":2000, "maxfilesize":2000, "services": [ { "servicename":"Яндекc", "classname":"yandexconnector.class", "isenabled":true }, { "servicename":"google", "classname":"googleconnector.class", "isenabled":false } ] } when try write json-data (variable obj ) file, services array broken. writing code: jsonobject obj = new jsonobject(); obj.put("maxusers", this.getmaxusers()); obj.put("maxtextlength", this.getmaxtextlength()); obj.put("maxfilesize", this.getmaxfilesize());

c# - WPF - Canvas optimisation solution -

i have trouble wpf project. better understood, have big drawing spaces in archicad - drawed many electrical components (motors, cable, serrated wheel, gears, electrical plates , other). export project adobe illustrator (.ai), , import file blend. example small gear have code : <canvas x:name="_30_gear_left_no__1" height="234" canvas.left="67" canvas.top="243" width="476"> <path data="m7.208,0.334l6.814,0.466 6.393,1.557 6.312,1.881 5.237,1.253 4.777,1.451 2.15,3.027c1.727,3.495 1.358,4.007 1.049,4.556 0.654,5.323 0.38,6.146 0.236,6.996l0.184,7.649c0.17,8.048 0.238,8.446 0.384,8.817 0.535,9.162 0.773,9.461 1.075,9.686l0.507,10.253 0.507,10.713 1.461,11.243 0.901,12.29 1.033,12.553 2.018,13.144 1.953,13.538 4.581,15.049 4.898,14.702 5.894,15.312 6.288,15.312 6.843,14.276 7.799,14.786 8.193,14.589 8.589,13.111 9.77,13.406 10.099,13.078 10.033,11.633 10.468,11.213 11.478,11.37 11.807,10.91 11.214,10.013 11.28,9.728 1

How to get a url parameter in Magento controller? -

is there magento function value of "id" url: http://example.com/path/action/id/123 i know can split url on "/" value, i'd prefer single function. this doesn't work: $id = $this->getrequest()->getparam('id'); it works if use http://example.com/path/action?id=123 magento's default routing algorithm uses three part urls. http://example.com/front-name/controller-name/action-method so when call http://example.com/path/action/id/123 the word path front name, action controller name, , id action method. after these 3 methods, can use getparam grab key/value pair http://example.com/path/action/id/foo/123 //in controller var_dump($this->getrequest()->getparam('foo')); you may use getparams method grab array of parameters $this->getrequest()->getparams()

c++ - Windows - redirect domain request to localhost without modifying etc/hosts -

i need programmaticaly (c++) add kind of dns-resolving rule, redirect requests of specific domain localhost. there methods without modyfing etc/hosts file on windows? you install local dns server machine (for example: bind). change ip settings on machine use own local dns server (127.0.0.1) instead of normal dns servers. create new domain (with name of dns name redirected) on local dns server, , include address record in zone file of domain, specifying desired ip address (127.0.0.1). there 1 more step might neccessary: if machine cannot reach internet dns servers directly, through normal dns servers, have configure dns request forwarding local dns server, every domain request forwarded original dns servers.

sprite kit - What would be the best approach for outlining or dropshadowing a font? -

i'm not finding support dropshadow or outline of font in sprite kit. dropshadow, i'm guessing create second sklabelnode , offset behind other. is there way utilize skeffectnode outline or dropshadow ? possibly make sklabelnode child of skeffectnode ? update : i able decent dropshadow using second sklabelnode behind first, black , offset. still interested in other potential options, seems work well. this doing, works , simple. - (sklabelnode *) makedropshadowstring:(nsstring *) mystring { int offsetx = 3; int offsety = 3; sklabelnode *completedstring = [sklabelnode labelnodewithfontnamed:@"arial"]; completedstring.fontsize = 30.0f; completedstring.fontcolor = [skcolor yellowcolor]; completedstring.text = mystring; sklabelnode *dropshadow = [sklabelnode labelnodewithfontnamed:@"arial"]; dropshadow.fontsize = 30.0f; dropshadow.fontcolor = [skcolor blackcolor]; dropshadow.text = mystring; drops

java - Box2d fixture position -

how position of every fixture of 1 body in libgdx box2d? seems fixtures not have position getter. sory if question noobish started learning box2d. from box2d body list of fixtures. each fixture shape . if shape of type circleshape have getposition() method can use. however, position retrieved relative position of box2d body in b2world.

gcc - Matlab - dyld: Library not loaded: /usr/local/opt/mpfr2/lib/libmpfr.1.dylib -

i trying compile matlab program using mex. facing following error , wondering if have suggestions. have installed latest version of mpfr @ /usr/local/opt/mpfr still picking /usr/local/opt/mpfr2 . the error below: dyld: library not loaded: /usr/local/opt/mpfr2/lib/libmpfr.1.dylib referenced from: /usr/local/cellar/gcc48/4.8.1/gcc/libexec/gcc/x86_64-apple-darwin12.5.0/4.8.1/cc1plus reason: incompatible library version: cc1plus requires version 4.0.0 or later, libmpfr.1.dylib provides version 3.0.0 g++-4.8: internal compiler error: trace/bpt trap: 5 (program cc1plus) /applications/matlab_r2012b.app/bin/mex: line 1326: 15075 abort trap: 6 /usr/local/bin/g++-4.8 -c -i/applications/matlab_r2012b.app/extern/include -i/applications/matlab_r2012b.app/simulink/include -dmatlab_mex_file -fno-common -fexceptions -arch x86_64 -isysroot /applications/xcode.app/contents/developer/platforms/macosx.platform/developer/sdks/macosx10.8.sdk/ -mmacosx-version-min=10.7 -dm

Mimicking an ajax call with Curl PHP -

i'm scraping site using curl (via php) , information want list of products default showing first few ones. rest passed user when click button full list of products, triggers ajax call return list. here in nutshell js use: headers['__requestverificationtoken'] = token; $.ajax({ type: "post", url: "/ajax/getproductlist", datatype: 'html', data: json.stringify({ historypageindex: 1, displayperiod: 0, productstype: }), contenttype: 'application/json; charset=utf-8', success: function (result) { $(target).html(""); $(target).html(result); }, beforesend: function (xmlhttprequest) { if (headers['__requestverificationtoken']) { xmlhttprequest.setrequestheader("__requestverificationtoken", headers['__requestverificationtoken']); } } }); here php script: curl_setopt($ch, curlopt_useragent, $useragent); curl_setopt($ch, curlopt_returntransfer, true); curl_setopt($ch, curlopt_fol

asp.net mvc - CQRS where to put domain / business logic -

i developing framework mvc application. part of framework, have created dummy application. following onion architecture , solid principle cqrs. first project mvc , cqrs. following chain of responsibility in cqrs. at present not sure part should keep business logic. example. have command of debit account bank account. have created command debitaccount , handler idebitaccounthandler. idebitaccounthandler implemented in infrastructure layer required dependencies debitaccounthandler. here have core logic of checking balance before debiting account. want implement in core not change infrastructure. now should implement logic , load required dependencies. commands interfaces without method body, contain on method of handle/execute. i feel newbie question , arising due limited understanding of patterns. each command represents use case. command handler doesn't contain logic; takes care of infrastructural concerns, , delegates domain. you want logic in domain model

java - How to code MVC Web Api Post method for file upload -

i following this tutorial on uploading files server android, cannot seem code right on server side. can please me code web api post method work android java uploader? current web api controller class looks this: using system; using system.collections.generic; using system.io; using system.linq; using system.net; using system.net.http; using system.threading.tasks; using system.web; using system.web.http; namespace wsiswebservice.controllers { public class filescontroller : apicontroller { // api/files public ienumerable<string> get() { return new string[] { "value1", "value2" }; } // api/files/5 public string get(int id) { return "value"; } // post api/files public string post([frombody]string value) { var task = this.request.content.readasstreamasync(); task.wait(); stream requeststream

Building a page parser with php. want to use some jquery/ajax -

allright guys! have been searching, , have troubles finding solution problem. , in advance, sorry bad english. im building small parser news articles 1 specific news site. , want code prepared add other news pages well, thats why is. i want page reload content without refreshing page. , know takes while retrieve content selected url. thats why want add progressbar jqueryui (i know allot ask for). progressbar optional. and im using simple html dom parser <?php //page load time $starttime = explode(' ', microtime()); $starttime = $starttime[1] + $starttime[0]; ?> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8"/> <title>svd parser</title> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> <link rel=&q

Store very big numbers in an integer in C -

i need store large number integer in c program, unsigned long int still small, need large data type still work modulo operator (%). there several libraries can gmp openssl's bn if need cryptographic purposes (e.g. rsa hinted need of modulo arithmetic), openssl bn ideally suited

html - css add space above footer -

i have css code html add space above footer since tables stick footer directly. please make sure every time add table space should there. between tables , footer. you can view code @ http://jsfiddle.net/hadinetcat/e8jd3/6/ css code <style type='text/css'> .container3 { float:left; width:100%; /*background:green;*/ overflow:hidden; position:relative; } .container2 { float:left; width:100%; background:#ffa500; position:relative; right:45%; } .container1 { float:left; width:100%; /*background:red;*/ position:relative; right:40%; } .col1 { float:left; width:26%; position:relative; left:87%; overflow:hidden; height:570px; } .col2 { float:left; width:50%; position:relative; left:90%; overflow:hidden; } .col3 { float:left; width:26%; position:relative; left:80%; overflow:hidden; } .footer { border:1px solid orange; position: relative; padding:0px; margin-top:-5px; font-size:15px; } .signout { position: abso

Read PayPass with Mifare-reader -

is possible read identification information of paypass card mifare-reader? i don't need private or bank financial information read paypass card. need identity different cards. there library named "winscard".you should use it. win32 api communicating smartcards within windows platform in form scardxxx.similar implementation linux developed under muscle project pc/sc lite api. work in windows platform. following functions used: scardestablishcontext scardlistreaders scardconnect scardreconnect scarddisconnect scardreleasecontext scardtransmit

javascript - jQuery Slider to auto slide between navigation links -

i have jquery slider on website. i managed make slider move automatically between 2 navigation links, there 4 navigation links. how can make it moves orderwise first navigation link till fourth link defined delay. here html code navigation links @ bottom: <div id="mi-slider" class="mi-slider"> <ul> <li><a href="#"><img src="images/1.jpg" alt="img01"><h4>boots</h4></a></li> <li><a href="#"><img src="images/2.jpg" alt="img02"><h4>oxfords</h4></a></li> <li><a href="#"><img src="images/3.jpg" alt="img03"><h4>loafers</h4></a></li> <li><a href="#"><img src="images/4.jpg" alt="img04"><h4>sneakers</h4></a></li> </ul>

css3 - How to give the webpage a light in the darkness effect using mouse cursor -

i'm interested in making effect of totally dark webpage (and in dark mean dark night without lights @ all) , give mouse cursor light effect light surrounding. should use achieve kind of effect? i've tried looking answer in css , on web haven't found similar. thing found this plugin wordpress it's fixed , can't customized or used. i know old thread, interested in making effect myself, , whipped something on jsfiddle think accomplishes task. the code @ jsfiddle, , copied here explanations. pretty simple. html i created div id light , used wrapper div, called content , containing lorum ibsum. <div id="light"></div> <div class="content"> <h1>flashlight test</h1> <p>pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. donec eu libero sit amet quam egestas semp

java - Implement the following method to sort the rows in a twodimensional array -

i have been working on problem day , cannot find out next. have sorting rows not sort last row completely. here code.i know once or gets feel stupid .thank you public class sort2drow { public static void main (string [] args) { int[][] matrix = {{3,5,6}, {4,1,2},{9,8,7}}; system.out.println("before sort"); for(int row = 0; row <matrix.length; row++){ for(int col = 0; col <matrix[row].length; col++){ system.out.print(matrix[row][col] + " "); } system.out.println(); } system.out.println();//spacer system.out.println("after sort method"); sortrow(matrix); } public static int[][] sortrow(int[][] m) { int temp = 0; for(int row = 0; row < m.length ; row++) { for(int col = 0; col < m.length -1; col++){ if(m[row][col] > m[row][col + 1]) { temp = m[row][col]; m[r

java - Shiro persist permission - what to save in the DB? -

i have created 3 roles application: admin, user, guest. each of these 3 roles have set of permissions. want persist these roles permissions database. how persist permissions? role r = new role("admin"); permission p1 = new wildcardpermission("account:create"); permission p2 = new wildcardpermission("file:delete"); r.addpermission(p1); r.addpermission(p2); //etc do save database following strings "account:create" , "file:delete" , instantialize permission them when query object? if case, why there no way original string permission object? if call p1.tostring(), returns "[account]:[create]" considered different permission "account:create".

computer vision - Draw ellipses on people using Expectation Maximization with OpenCV -

i have few doubts how approach goal. have outside camera recording people , want draw ellipse on every person. right feature points of people frame (i them using mask have feature points on people), set em algorithm , train samples (the feature points extracted). number of clusters twice number of people image (i before start em algorithm using other methods such pixel counting codebook). my question is (a) have train first frame , use predict in following frames? or, (b) use train feature points in every frame? right doing option b) (i don't use predict) because don't know how use predict. if a), can me , after how draw ellipses?. if b), can me drawing ellipse every person? since right know got different ellipses same person using cov, mean, etc (one arm, example). what want achieve paper using gaussian model: http://ieeexplore.ieee.org/xpl/login.jsp?tp=&arnumber=5580105&tag=1&url=http%3a%2f%2fieeexplore.ieee.org%2fxpls%2fabs_all.jsp%3farnumber%

c - I am trying to create a interactive shell -

i trying create interactive shell program prompts user command, parses command, , executes child process. here code have im not sure go after pleae !!!! int shell(char *cmd_str ){ int commandlength=0; cmd_t command; commandlength=make_cmd(cmd_str, command); cout<< commandlength<<endl; cout << command.argv[0]<< endl; if( execvp( command.argv[0], command.argv)==-1) //if command executed nothing runs after line { commandlength=-1; }else { cout<<"work"<<endl; } cout<< commandlength<<endl; return commandlength; } assuming shell() being run within child process called fork() , you'll need ensure parent process waits child process terminate. see wait(2) family of functions. additionally, you'll want retrieve exit status of said child process (again, see wait(2) ). you can try implement stream redirection. assuming exercise, i'll leave additional research on how implement these things user :) -- dup

css - How to do mobile first with Bourbon Neat Framework -

i've been using bourbon neat desktop first layout worked fine. however, mobile first versions, starting mobile , working way up. default grid 12 columns , mobile use grid of 4. tried changine grid 4 , scaling 12 didn't work. is there better way mobile first other creating standard desktop layout, putting mobile media query each css selector , starting mobile version , building way? you should create new breakpoints new-breakpoint mixin neat. instead of using max-width in examples, can use min-width. for example: @import "bourbon/bourbon"; @import "neat/neat"; $mobile: new-breakpoint(min-width 0px 4); $tablet: new-breakpoint(min-width 760px 8); .main { background: grey; @include media( $mobile ) { @include span-columns(4); background: white; } @include media( $tablet ) { @include span-columns(8); background: black; color: white; } } in example .main have white background , consist out of 4 columns. when

bash - Compiling a program in a loop with qsub -

i want compile program in bash loop. when run program command line compile when use qsub doesn't compile. is there missing? regards, john bash file #!/bin/bash #$ -n runtest #$ -m e #$ -r y cd /afs/crc.nd.edu/user/private/ndpicmcc/safecode thisdir="safecode" t=2000 originalguiline="pres = 7.6e1" oldguiline="$originalguiline" guifile="guivars.f90" (( = -3 ; <= 1 ; i=i+1 )) p="7.6e$i" newguiline="pres = $p" sed -i "s/$oldguiline/$newguiline/g" "$guifile" oldguiline="$newguiline" make clean >& /dev/null make 1d >& /dev/null make 1d ./pressurepic cp "anode_ele_eng.csv" "../results/t_${t}_p_${p}_energies.csv" done sed -i "s/$oldguiline/$originalguiline/g" "$guifile" makefile cc=ifort options = -warn noalign -au

Read file c# windows 8 -

few weeks ago asked similar question in topic write , read file , question answered, i'm trying read file , use if function, @ moment can read textblock pressing button read file , transfer txtblock, want know how able read not using way. @ moment here. private async task readfile() { // local folder. storagefolder local = windows.storage.applicationdata.current.localfolder; if (local != null) { // datafolder folder. var datafolder = await local.getfolderasync("level"); // file. var file = await datafolder.openstreamforreadasync("level.txt"); // read data. using (streamreader streamreader = new streamreader(file)) { this.textblock1.text = streamreader.readtoend(); } } } private async void button_click(object sender, routedeventargs e) { await readfile(); if (textbloc

c# 4.0 - Excel ListObject Update When Source Changes -

i have excel worksheet listobject on it. have bound list when update element in list, listobject not refresh unless call refreshdatarow. i have tried using bindingsource , setting datasource of bindingsource list still not reflect changes listobject. is there method can bind collection listobject , have update on-screen when change element in underlying collection in code (without calling refreshdatarow). regards alan you might want check this msdn article , says: the listobject updated automatically when bound data source, such datatable, raises events when data changes. if bind listobject data source not raise events when data changes, must call refreshdatarow or refreshdatarows method update listobject. so should provide source meeting requirements.

x11 - what are the alternatives besides openGLUT and x-windows for creating windows in linux environment? -

while learning computer graphics in linux environment, have choice use openglut or x-windows creating windows. what other choices (libraries) available create windows in linux environment besides openglut , x-windows? use qt or gtk or perhaps libsdl , fox-toolkit , fltk (or other widget toolkit ....) most of them above x11 don't want use directly. btw, x11 might become phased out , replaced wayland , mir or else (but gtk , qt compatible evolution). alternatively, consider providing web html5 interface (so use http server library wt , libonion etc....)

java - Loading the postgreSQL JDBC driver -

i trying load jdbc postgresql driver java program. know on internet. have tried many solutions, none of them have worked me. the problem error: exception in thread "main" java.lang.noclassdeffounderror: classes/com/freire/test/jdbcexample/class caused by: java.lang.classnotfoundexception: classes.com.freire.test.jdbcexample.class @ java.net.urlclassloader$1.run(urlclassloader.java:202) @ java.security.accesscontroller.doprivileged(native method) @ java.net.urlclassloader.findclass(urlclassloader.java:190) @ java.lang.classloader.loadclass(classloader.java:306) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:301) @ java.lang.classloader.loadclass(classloader.java:247) and code looks this: package com.freire.test; import java.sql.drivermanager; import java.sql.connection; import java.sql.sqlexception; public class jdbcexample { public static void main(string[] argv) { system.out.println("jdbc connection testing");

asp.net - Code shortening in aspx page -

( i'm not native english speaker, text may not natural ) i'm doing localization of asp.net project. efficiency of language translation, i'm extracting strings in .aspx global resource file. ( named resource file 'stringtable.resx'. ) in process, strings in aspx page changes follows : before : admin id after : <asp:literal runat="server" text="<%$ resources:stringtable, str_admin_id %>"> the 'after code' looks little bit long, want shorten code. ( example, remove runat="server" statement, remove resource name, etc... ) in c/c++ case, 1 can use #define macro. is there way in .aspx page? ( not in code behind file ) idea appreciated. ====== below own answer ======================================== i'm using vs2008, can't use <%: syntax in .net 4.0. and introduce alternative solution ( i'm not sure best solution ) first, added directive in upper portion of .aspx file.

javascript - Change event handler firing only once, jQuery -

i'm trying execute code when select element in dropdown menu. i'm using jquery's change(). problem once execute function first time. not respond other selected items (aka other changes). made test block @ bottom , code fire on every change. doing wrong in first change code? jsfiddle: http://jsfiddle.net/nysteve/qhuml/#base side question; noticed when ask question , select answer, of them appear on profile , questions not though selected answer. take time them register? function timetohexcolor() { var color = math.floor(math.random() * 999999); if (color >= 0 && color <= 9 || color >= 1000 && color <= 9999) { color = "#00" + color; } else if (color >= 10 && color <= 99 || color >= 10000 && color <= 99999) { color = "#0" + color; } else if (color >= 100 && color <= 999) { color = "#000" + color; } else if (color > 999999)

ios - iPad App showing a strange icon not in project -

Image
when updating app ios7 changed icon set. to this, migrated use xcasset , removed original icons project tree. however, icon shown nothing has been added project. can help? additional info looks stuff may needed here - didn't need second target in teh project. add xcasset copy bundle resource in build phase of target.

php - Could not include font definition file: times -

Image
i got problem when used tcpdf in drupal 6. i changed halvetica times. read theads error. configured configuration file @ config/tcpdf_config.php change k_path_main /sites/all/modules/pdf-idcard/tcpdf/ path correct? thanks response!

How to count the #of of items in a list without using python's method while ignoring the items that come after a certain item -

this our review homework test. have absolutely no idea how have been away quite while. if tell me need learn able complete task. program output how many places need visit before la dodgers stadium on way. places visited after la dodgers stadium don't count. must output number of places visited have have names more 1 word (ex. san jose.) catch must use while loop in case - may not use python's find method. sample >>> places= ["home","in-n out burger", "john's house", "santa monica pier", "staples center", "la dodgers stadium", "home" ] >>> placescount(places) 6 places la dodgers stadium 5 multi-word names here's did: places= ["home","in-n out burger", "john's house", "santa monica pier", "staples center", "la dodgers stadium", "home" ] def placescount(places): placestogo = 0 in

objective c - Multiple PickerView in UITableView on iOS 7 -

Image
with ios 7 apple suggest use uidatepicker , uipickerview inline within uitableviewcell showed here: ios 7 - how display date picker in place in table view? i have table view n rows dynamically allocated. each row represent object fetched core data. want display uipickerview below each row user tapped in let user select in range of values. i've thought adopt apple's way , insert uipickerview every 2 rows it's pretty weird , causes issues. how can 'follow' normal succession retrieving each object main nsarray _list contains each object fetched core data? is there 'better' way implement without having insert tons of uipickerview ? this image explains better, hope. take @ sample code linked to. don't insert picker every other row. there 1 picker appears below input row you're editing. picker appears during editing. after read code, maybe ask more specific question...?

c# - WPF ListView Sorting issue with Cell Templated TextBox -

there problem wpf listview. listview bound datatable db. there no mvvm here. everthing in codebehind. in listview, 3rd column has celltemplate. , column bound tax percentage column in datatable. tax percentage column of type varchar [this based on other business logic hence cannot change datatype]. <gridviewcolumn.celltemplate> <datatemplate> <textbox name="txt1" text="{binding taxpercent, mode=twoway, updatesourcetrigger=propertychanged}" previewtextinput="txt1_previewtextinput" width="105"> <textbox.borderbrush> <multibinding converter="{staticresource textcomparer}"> <binding path="taxpercent" mode="twoway" /> <binding path="taxpercent_val" mode="twoway"/> </multibinding> </textbox.borderbrush

java - How to check if each element in a string array is an integer? -

i'm attempting error check determines whether the elements of array integers, i've been stuck long time though. ideas on how started helpful. scanner scan = new scanner(system.in); system.out.print("please list @ least 1 , 10 integers: "); string integers = scan.nextline(); string[] newarray = integers.split(""); using string made scanner, loop on space-delimited list , check each element integer. if pass, return true; otherwise return false. credit isinteger check goes determine if string integer in java public static boolean containsallintegers(string integers){ string[] newarray = integers.split(" "); //loop on array; if value isnt integer return false. (string integer : newarray){ if (!isinteger(integer)){ return false; } } return true; } public static boolean isinteger(string s) { try { integer.parseint(s); } catch(numberformatexception e) { return false; }

c# - What are the best practices to parse data into objects in data access layer? -

i adding new features old asp.net application uses n-tier architecture. basic example can given as object public class test { public int id{get;set;} public int name{get;set;} } data access layer public static list<test> gettests() { list<test> list = new list<test>(); try { //codes sqldatareader dr = com.executereader(); while(dr.read()) list.add(filltestrecord(dr)) //codes } catch{} return list; } private static test filltestrecord(idatarecord dr) { test test = new test(); try{test.id = convert.toint32(dr["id"]);} catch{} try{test.name = convert.toint32(dr["name"]);} catch{} return test; } the development requires me add new fields object classes , re-usability use 1 fill*record method each type of object. method can called many other dal methods idatarecord might not contain columns of object. hence put try-catch block every proper