Posts

c++ - store byte[4] in an int -

c++ - store byte[4] in an int - i want take byte array 4 bytes in it, , store in int. for illustration (non-working code): unsigned char _bytes[4]; int * combine; _bytes[0] = 1; _bytes[1] = 1; _bytes[2] = 1; _bytes[3] = 1; combine = &_bytes[0]; i not want utilize bit shifting set bytes in int, point @ bytes memory , utilize them int if possible. in standard c++ it's not possible reliably. strict aliasing rule says when read through look of type int , must designate int object (or const int etc.) otherwise causes undefined behaviour. however can opposite: declare int , fill in bytes: int combine; unsigned char *bytes = reinterpret_cast<unsigned char *>(&combine); bytes[0] = 1; bytes[1] = 1; bytes[2] = 1; bytes[3] = 1; std::cout << combine << std::endl; of course, which value out of depends on how scheme represents integers. if want code utilize same mapping on different systems can't utilize memory aliasing; you...

android - JSONObject put method in try block causing error but catch block not executed -

android - JSONObject put method in try block causing error but catch block not executed - this issue driving me little crazy 1 of fine people point me in right direction. attempting prepare jsonobject passed client server. next problematic method stripped downwards essentials: private jsonobject getjsonparam(int id) { jsonobject param = new jsonobject(); seek { param.put("functioncode", 50); param.put("id", id); homecoming param; } grab (jsonexception e) { e.printstacktrace(); } grab (throwable e) { e.printstacktrace(); } homecoming null; } i have traced code in debug mode. in actual method, set many more paramters in jsonobject , until lastly param.put() method effort insert id. when current execution line, can visualize param variable , looks good. when perform step function execute lastly param.put call, jumps homecoming null statement. have set breakpoints...

mysql - Issue in retrieve data from sql database in php -

mysql - Issue in retrieve data from sql database in php - i have created register form using php. have index.php,submit.php,functions.php , script. now works fine, , need retrieve info database , display in front end end. i new php, , learning. please help me this. this data.php: <?php include ('condb.php'); $query = mysql_query("select * test id='".$_get['id']."'"); $row = mysql_fetch_array($query); ?> <body> <h3>employee detail</h3> <p>emp name:</p> <?php echo $row['fname'];?> <p>lastname:</p> <?php echo $row['lname'];?> </body> <?php ?> and action.php: <?php include('condb.php'); extract($_post); $que=mysql_query("insert test (id, fname, lname) values ('$id', '$fname', '$lname')") or die("error msg!"); if($que) { ...

batch file - git command to get local path of repository -

batch file - git command to get local path of repository - is there way path of local repository git can executed batch file? set gitbin="c:\program files (x86)\git\bin" set repodir1=c:\randompath1\repository1 set repodir2=c:\randompath2\repository2 pushd %tgacoredir% @echo on %gitbin%\git pull @if %errorlevel% neq 0 ( goto :pullerror ) i'd repodir1 , repodir2 git, developers can run script, if have local repositories in different locations 1 another. there way repodir1 , repodir2 don't have hardcoded in .bat file? this command should want git rev-parse --show-toplevel git batch-file repository

2D Binary Tree in SML -

2D Binary Tree in SML - i having hard time figuring out how implement 2d binary tree using sml this have far tycon mismatch. datatype btree = empty | node of int * btree * btree; fun addnode (i:int, empty) = node(i, empty, empty) | addnode(i:int, node(j, left, right)) = if = j node(i, left, right) else if < j node(j, addnode(i, left), right) else node(j, left, addnode(i, right)); fun printinorder empty = () | printinorder (node(i,left,right)) = (printinorder left; print(int.tostring ^ " "); printinorder right); datatype twotree = empty | node of int * twotree * twotree * btree; fun add2node(int:i, int:j, empty) = node(i, btree, empty, empty) | add2node(int:i, int:j, node(k, btree, left, right)) = if = k node(i, addnode(j, root), left, right) else if < k node(k, root, add2node(i, j, left), right) else node(k, root,...

css - Aligning HTML special charaters bottom relative to parent -

css - Aligning HTML special charaters bottom relative to parent - so i'm building website client in wordpress , design has square total stops on few headings font have used has round total stops. i have solved issue shortcode '[stop]' , homecoming next code: <span class="square-stop">&#9632;</span> this html square symbol ■ wrapped in span styling. but can seem align bottom text. see illustration here: http://jsfiddle.net/9a8x844n/ <h1>this heading of kind<span class="square-stop">&#9632;</span></h1> use next css align square: h1{ position:relative; } .square-stop { font-size: 0.7em; position: absolute; bottom: 0; } html css special-characters vertical-alignment symbols

sql server 2008 - how to update a database with dataset changes -

sql server 2008 - how to update a database with dataset changes - i have table general_ledg 4 fields. created dataset named general_ledgdataset , dragged on form. when create changes info in dataset, should update database . not updating. tried next code when update button clicked private con new sqlclient.sqlconnection("server=.\sqlexpress;attachdbfilename=c:\program files\microsoft sql server\mssql10.sqlexpress\mssql\data\nxtrading.mdf;integrated security=true;user instance=true") con.open() general_ledgtableadapter.update(general_ledgdataset) me.general_ledgdataset.acceptchanges() sql-server-2008 ado.net dataset