Posts

Showing posts from March, 2014

c# - Is Stopwatch.ElapsedTicks threadsafe? -

c# - Is Stopwatch.ElapsedTicks threadsafe? - if have shared system.diagnostics.stopwatch instance, can multiple threads phone call shared.elapsedticks in safe manner , accurate results? is there difference in terms of thread-safety/accuracy between using shared instance of stopwatch in way, , using static gettimestamp() method? i'm measuring intervals of around 180ms, , finding using shared instance giving me larger spread of results, including important number shorter expect. the machine has multiple cpus (2 * intel x5550 it's worth) from msdn: "any instance members not guaranteed thread safe." c# stopwatch

osx - Layer size/bounds during a core animation -

osx - Layer size/bounds during a core animation - i working on mac app mac os x 10.6+ , need redraw contents of caopengllayer while animation occurring. think i've read on necessary parts, not working me. set animation follows: [catransaction setanimationduration:slide_duration]; cabasicanimation *drawanim = [cabasicanimation animationwithkeypath:@"drawit"]; [drawanim setfromvalue:[nsnumber numberwithfloat:0]]; [drawanim settovalue:[nsnumber numberwithfloat:1]]; [drawanim setduration:slide_duration]; [chartview.chartviewlayer addanimation:drawanim forkey:@"drawit"]; chartframe.origin.x += controlframe.size.width; chartframe.size.width -= controlframe.size.width; chartview.chartviewlayer.frame = cgrectmake(chartframe.origin.x, chartframe.origin.y, chartframe.size.width, chartframe.size.height); the drawit property cu...

wolfram mathematica - Removing background noise from image -

wolfram mathematica - Removing background noise from image - i have 2 images. first 1 of background noise + content, , sec 1 of background noise. subtract sec image first remove noise content. image in greyscale. i'm confused between various ways handle this, handling of greyscale values in mathematica. 1) firstly, may utilize imagesubtract[imageone, imagetwo] . 2) using imagedifference[imageone, imagetwo] , avoid negative pixel values, image artificial @ places would've had have negative pixels when using imagesubtract . 3) obtain values of each pixel using imagedata , subtract each corresponding value , display result using image . each of these methods yields different results. for images real info types, pixel values can negative, , these 3 operations equivalent: real1 = image[randomreal[1, {10, 10}]]; real2 = image[randomreal[1, {10, 10}]]; imagedata[imagedifference[real1, real2]] == abs@imagedata[imagesubtract[real1, real2]] == abs[imagedata...

c# - Why does FindMimeFromData recognize image/tiff on one host, but doesn't on another one? -

c# - Why does FindMimeFromData recognize image/tiff on one host, but doesn't on another one? - i'm using findmimefromdata urlmon.dll sniffing uploaded files' mime type. according mime type detection in net explorer, image/tiff 1 of recognized mime types. works fine on development machine (windows 7 64bit, ie9), doesn't work on test env (windows server 2003 r2 64bit, ie8) - returns application/octet-stream instead of image/tiff . the above article describes exact steps taken determine mime type, since image/tiff 1 of 26 recognized types, should end on step 2 (sniffing actual data), file extensions , registered applications (and other registry stuff) shouldn't matter. oh , way, tiff files are associated programme (windows image , fax viewer) on test server. it's not reference tiff absent in windows registry. any ideas why doesn't work expected? edit: findmimefromdata used this: public class mimeutil { [dllimport("urlmon.dll...

html - Cross Browser Display Issue -

html - Cross Browser Display Issue - on farther investigation have discovered there in css making navigation display funny -> on innerpage , html below (main page) load fine still beingness driven crazy nav have uploaded total html , css resolve issue, html: <div id="container"> <header> <h1>company</h1> <div id="logo"><a href="http://company.co.nz/">home</a></div> <section id="sales"> <p></p> </section> <section id="searchbox"> <form id="searchboxform"> <fieldset> <input type="text" name="search" id="search" placeholder="search here" /> <input class="submit" type="submit" name="submit" id="submit" value="search" /> ...

box2d - vertices smaller than sprite when rendered on iPhone screen -

box2d - vertices smaller than sprite when rendered on iPhone screen - i using vertex helper edges of sprites. using cocos2d + box2d on iphone. problem getting debug draw on device testing on comes vertices rendered or shown smaller sprites after tracing edges of sprites , using same sprite. ok here screen shot of problem! the greenish triangle supposed fit edges of sprite. code used: this glesdebugdraw code - (void)setupdebugdraw { debugdraw = new glesdebugdraw(ptm_ratio* [[ccdirector shareddirector] contentscalefactor]); world->setdebugdraw(debugdraw); debugdraw->setflags(b2debugdraw::e_shapebit); } #import "box2dsprite.h" @interface stalag :box2dsprite { b2world *world; } - (id)initwithworld:(b2world *)world atlocation:(cgpoint)location; @end #import "stalag.h" @implementation stalag - (void)createbodyatlocation:(cgpoint)location { b2bodydef bodydef; bodydef.type = b2_staticbody; bodydef.position = b2vec2(loc...

mod rewrite - How to make .htaccess RewriteRule without affecting index.php rules -

mod rewrite - How to make .htaccess RewriteRule without affecting index.php rules - i'm using requests in project , want rewrite urls in such simple way: if visit mydomain.com/test request mydomain.com/get.php?txt=test on serverside. here mine .htaccess rewriterule, works ok, problem it's affects index.php, if go main page starts: mydomain.com/get.php?txt=test request , not opening mydomain.com/index.php because of rewriterule. options +followsymlinks rewriteengine on rewriterule (.*)$ get.php?url=$1 [l] i don't want create sublevels in path mydomain.com/1/test, should on next level of root. any help appreciated. give thanks you! the mutual way add together conditions rewrite non-existing resources (files & folders): options +followsymlinks rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule (.*) get.php?url=$1 [l] another possible approach (which work fine your original request) ignor...

Magento: Adding new products programmatically -

Magento: Adding new products programmatically - i trying add together products magento 1.5 programmatically. script cron job, regularly updating , adding products dictated xml file supplied accounts system. i have problem in creating new products. relevant code segment script is: $attributesetid = 4; //$newproduct = mage::getmodel('catalog/product'); $newproduct = new mage_catalog_model_product(); $newproduct->settypeid('simple'); $newproduct->setweight($product->unitweight); $newproduct->setvisibility(mage_catalog_model_product_visibility::visibility_both); $newproduct->setstatus(1); $newproduct->setsku($sku); $newproduct->settaxclassid(0); $newproduct->setwebsiteids(array(0)); $newproduct->setstoreids(array(1)); $newproduct->setstockdata(array( 'is_in_stock' => 1, 'qty' => $xmlproduct->qtyinstock, 'manage_stock...

javascript - How to convert a point to polar coordinates in ECMAScript? -

javascript - How to convert a point to polar coordinates in ECMAScript? - i need turn click location polar coordinate. current algorithm. location location on canvas of click ( {x:evt.clientx, y:evt.clienty} ), center offset of origin 0,0. example, if circle centered on 250, 250, center {x:250, y:250} . scale scale of radius. example, if radius of circle center 50 , scale .5, radius becomes 25. (it's zooming in/out) this.getpolarlocation = function(location){ var unscaledfromcenter = { x: location.x - center.x, y: location.y - center.y }; var angle = this.getangleoncircle(unscaledfromcenter); var dist = math.sqrt(unscaledfromcenter.x * unscaledfromcenter.x + unscaledfromcenter.y * unscaledfromcenter.y) * this.ds.scale; homecoming { angle:angle, dist:dist, tostring: function(){ homecoming "theta: ".concat(angle).concat("; dist: ").concat(dist); } }; } this.getangleoncir...

Drupal 7 - Where is the Menu Description stored? -

Drupal 7 - Where is the Menu Description stored? - for life of me can't seem track downwards "menu description" value's stored in drupal 7! for example: i added new menu link called "cookie" , menu description called "yummy". go drupal database , can't seem locate string "yummy" in menu_custom or menu_links or menu_router infact dumped database , searched string "yummy" , still can't locate this. any help great it should in menu_links table under options field. note not info in field. drupal-7

java - Get reference to Thread Object from its ID -

java - Get reference to Thread Object from its ID - how can reference running thread if know id associated thread? e.g. long threadid = 12342; thread thread = (what goes here?) getthreadfromid(threadid); //i know totally made you have 2 ways it. both quite simple: old way: root thread grouping may access thread.currentthread().getgroup() ..getparent() in loop. , phone call enumerate(thread[]) newer (slower though). for (thread t : thread.getallstacktraces().keyset()) if (t.getid()==id)... the first method has little problem due bug in threadgroup.destroy() , threadgroup may not enumerate @ all. the sec slower , has security flaw, though. java android multithreading

asp.net mvc - Good approach for conditionally setting CSS class mvc -

asp.net mvc - Good approach for conditionally setting CSS class mvc - i know can utilize htmlhelpers access info repository , homecoming appropriate class. <a class="<%= html.getonoffstate(); %>"... but other approaches there? write entire actionlink helper instead of next tag soup: <a class="<%= html.getonoffstate(); %>".. you use: <%= html.toggableactionlink("foo", "bar") %> asp.net-mvc asp.net-mvc-3

How to use Java EE IntelliJ IDEA community edition -

How to use Java EE IntelliJ IDEA community edition - i have community edition of intellij idea doesn't have total support, want compile , recognize java ee classes. far, i've gotten work copying of jar files in glassfish->modules project folder , setting module dependencies on folder. there other way without copying on hundreds of jar files or not possible without upgrading total version? configure global library application server jars , add together global library module dependencies. java-ee intellij-idea

Windows Batch File - Clearing another batch file -

Windows Batch File - Clearing another batch file - quick explanation: i have batch file converting series of swfs mp4s placed batch file via php fwrite. ran every hr on windows task scheduler. example: c: cd "path\moyea\swf video sdk" swf2videocmd "conversion_command_here" cd "path\mysql\bin" mysql --host=hostip --user=user_name --password=hostpw--database=database_name --table=table --execute="update table set processed=1 processid=44;" this works fine, updates sql , runs process. there can many conversions in 1 batch file necessary, they're added dynamically on demand. windows task scheduler runs batch fine aswell. i have secondary batch file task scheduler runs @ same time - clear.bat. clears first 1 conversion job can start afresh new files next time: d: cd "path\youtube\" nul > swf2mp4.bat it clears first batch file fine, returns prompt saying windows cannot access specified device, path or file. i...

javascript - How do I get TextMate to see "require" expressions in CoffeeScript when compiling? -

javascript - How do I get TextMate to see "require" expressions in CoffeeScript when compiling? - when writing coffeescript in textmate , wanting utilize 3rd party javascript library jquery or raphael there need add together "require" so: $ = require 'jquery' this works fine when using coffee -c myfile.coffee commandline, fails in textmate bundle when trying compile error: error: cannot find module 'jquery' @ function._resolvefilename (module.js:317:11) @ function._load (module.js:262:25) @ require (module.js:346:19) @ object. (.:3:7) @ object. (.:4:4) @ module._compile (module.js:402:26) @ object.run (/usr/lib/node_modules/coffee-script/lib/coffee-script.js:62:19) @ /usr/lib/node_modules/coffee-script/lib/command.js:120:29 @ socket. (/usr/lib/node_modules/coffee-script/lib/command.js:154:14) @ socket.emit (events.js:61:17) in example, code in same directory @ root of project. the same occurs when specifying: $ = require ...

ruby - sanitizing content from open(url).read -

ruby - sanitizing content from open(url).read - i using ruby open url , read content. content type of file reading 'text/plain'. the issue contains characters want escape. example, 1 of characters coming in plain text "\240" ascii hyphen. i curious how beingness generated, because don't see hyphen anywhere in text. yet exists invisibly , "\240" shows when utilize puts print text in console. second of all, how escape such instances of weird characters? ideally, want escape characters of form "\[some number]". using "\240".gsub(regexp.new("\\\d+"),"") but doesn't seem work. are there more traditional ways of sanitizing plain text content read opening url? after having play this, found next regular look trick me: str.gsub(/[^\x00-\x7f]/,'') ruby text sanitization

html - Facebook meta tags screws up w3c validiation -

html - Facebook meta tags screws up w3c validiation - <meta property="fb:admins" content="10476" /> w3c told me error line 10, column 16: there no attribute "property" how can prepare it? you can't prepare it, facebook code not valid html. can't create html page passes validation if want utilize facebook scripts on it. unless, of course, rewrite facebook client code have on page code uses valid html elements. html w3c-validation

process - What happens in BASH when you do Ctrl-C (hint, it's not simply sending a SIGINT) -

process - What happens in BASH when you do Ctrl-C (hint, it's not simply sending a SIGINT) - a little background first - when apt-get install downloads company net provides high burst of speed (400-500kb/s) first 10 seconds or before dropping downwards 10th of (40-50kb/s), , after few minutes miserable (4-5kb/s). makes me think sysadmin has implemented sort of network throttling scheme. now know network not erratic, because if start apt-get install foo , ctrl-c after 10 seconds , run apt-get install foo 1 time again (by doing arrow , come in utilize bash history), , keep repeating process few minutes till packages downloaded, can download big packages fast. in particular, after aborting download ctrl-c, apt-get seems able resume download in next invocation. of course, staring @ screen doing ctrl-c come in every 10 seconds gets boring real fast, wrote shell script - #!/bin/sh in `seq 1 100` ; sudo apt-get install foo -y & sleep 10 sudo kill -2...

smtp - Check if mail was successfully sent in VB.NET with SMTPClient -

smtp - Check if mail was successfully sent in VB.NET with SMTPClient - i'm trying create application sends email smtp-server. the server not set fixed, looked according domainpart of email-address email should sent to. example: email to: test@stackoverflow.com domain-part: stackoverflow.com result of mx-record lookup (commandline "nslookup -type=mx stackoverflow.com": stackoverflow.com mx preference = 30, mail service exchanger = stackoverflow.com.s9b1.psmtp.com stackoverflow.com mx preference = 40, mail service exchanger = stackoverflow.com.s9b2.psmtp.com stackoverflow.com mx preference = 10, mail service exchanger = stackoverflow.com.s9a1.psmtp.com stackoverflow.com mx preference = 20, mail service exchanger = stackoverflow.com.s9a2.psmtp.com it quite useful, know if message accepted mailserver , message sent. what able far is, can smtp-server error code (if there error (statuscode 5xx) using system.net.mail.smt...

Pass parameters to Javascript callback functions -

Pass parameters to Javascript callback functions - this have: function populateelement(arg1) { getdata(arg1); } function getdata(query) { var url = "http://foo" + query + "&callback=processdata"; // stuff } function processdata(results) { callbackforgetdata(results); } function callbackforgetdata(result) { // process info } i want pass 2 more arguments function populateelement so: function populateelement(arg1, arg2, arg3) { getdata(arg1); } and have arg2, arg3 available in callbackforgetdata function callbackforgetdata(result) { // process info // utilize arg2, arg3 here } how should this? you can pass them on callback , access them in arguments array function getdata(result) { //result === arg1 //arguments[0] === arg1 //arguments[1] === arg2 //arguments[2] === arg3 //and on } getdata(arg1, arg2, arg3); javascript callback parameter-passing

Create Library of multiple XSD -

Create Library of multiple XSD - i have potential of having quite lot of little xsd's containing individual types of big project. (components) i have biggish number of xsd's requiring big number of these individual xsd's. (screens) i know import each 1 of "components" each "screen" xsd. lot of work on each one. what hoping import each 1 of these "components" single xsd (componentlibrary) , import 1 "componentlibrary" each "screen" xsd. i wrote code thought may have been needed doesn't seem want work. errors undeclared. tf.xsd: <xs:schema targetnamespace="http://namespace.com/tf" xmlns:xs="http://www.w3.org/2001/xmlschema" elementformdefault="qualified"> <xs:complextype name="tftype"> <xs:attribute name="size" type="xs:decimal" /> <xs:attribute name="colour" type="xs:decimal...

ios - Changing CGRectMake (x,x,x,x) to a different location such as (y,y,y,y) -

ios - Changing CGRectMake (x,x,x,x) to a different location such as (y,y,y,y) - i have placed button in view using cgrectmake(x,x,x,x), x beingness location , size of course. when rotate view using -(bool)shouldautorotate... want alter location of button center in portrait mode center in landscape mode. button contains info in label user sets, don't want utilize different view landscape orientation. if set in portrait , rotate horizontal? they'll lose data. question is: how move set? see code below, don't want realloc button. thanks! // date lbldate = [[uilabel alloc] initwithframe:cgrectmake(x, y, width, height)]; lbldate.text = @"date:"; lbldate.backgroundcolor = [uicolor clearcolor]; [contentview addsubview:lbldate]; just set frame equal new rect, e.g. lbldate.frame = cgrectmake(x,y,width,height); ios user-interface orientation rotation cgrect

algorithm for solving systems of linear Diophantine inequalities -

algorithm for solving systems of linear Diophantine inequalities - is there reasonably fast algorithm solving systems of linear diophantine inequalities? this research paper looks you'd read. algorithm linear-programming diophantine

ruby on rails 3 - RoR Setting Windows enviroment -

ruby on rails 3 - RoR Setting Windows enviroment - i'm rails developer , programmed on linux enviroment using netbeans , rvm. seek migration on windows using ide rubymine i've downloaded. there tutorial or instructions set enviroment people me approaching on windows in rails first time? (installing ruby gems etc ? ). tnx there's section on windows instalation in first-class rails tutorial i found blog entry walks process step-by-step when installing on windows myself used this video tutorial tekpub, you'll need pay access it. windows ruby-on-rails-3 ide rubymine

testing - Building a test suite in a large existing Java code base -

testing - Building a test suite in a large existing Java code base - i working on web application existing code base of operations has been around 10 years, there ~1000 class files , ~100,000 lines of code. news code organized well, business logic separate controller domain, , there high level of reusability. bad news there beginnings of test suite (junit); there's maybe 12 dozen tests @ most. the code organized typically enterprise java project. there stuts-esque controller package, model consists of purely info objects, there hibernate database layer largely encapsulated within info access objects, , handful of service packages simple, self contained, , logical. end goal of building test suite move towards continuous integration development process. how go building test suite such application? what tools utilize create process simpler? any suggestions welcome. thanks! start reading working legacy code (short version here). next write couple of end-to-end...

Passing Query string from jquery datatable to server on row delete -

Passing Query string from jquery datatable to server on row delete - i using jquery editable datatable.when ever table row deleted,i want row info , build query string , pass server url.now can row info how pass query string server in ajax request ?? this jquery code using. $(document).ready( function () { otable=$('#example').datatable({ "bprocessing": true, "sajaxsource": "http://localhost/questions/test/listener", "fninitcomplete": function (){ $(otable.fngetnodes()).click(function (){ var apos = otable.fngetposition( ); var adata = otable.fngetdata( apos[0] ); alert(adata[0]); }); }, aocolumns: [ { "bvisible": false} , null, null, null, null ] } ...

mod rewrite - Apache: Except a path from RewriteRule -

mod rewrite - Apache: Except a path from RewriteRule - i'm trying except beingness redirected /portal/ if access /sitemapht/ seems process ^(/$|!sitemapht) wrong, since still redirecting me /portal/ <virtualhost *:80> documentroot "/opt/tomcat-5.5.30/webapps/portal" servername hoteles serveralias hoteles jkunmount /images/*.gif w1 jkunmount /images/*.png w1 jkunmount /images/*.jpg w1 jkunmount /js/*.js w1 jkunmount /styles/*.css w1 jkmount /portal w1 jkmount /portal/* w1 rewriteengine on rewritecond %{request_method} ^(trace|track) rewriterule .* - [f] options +followsymlinks rewriterule ^(/$|!sitemapht) /portal/ [r] rewriterule ^/(?!portal)(.*) /portal/ficha.action/$1 [pt] </virtualhos...

sql - Help with SQLITE query -

sql - Help with SQLITE query - i have 3 tables task , tasktag , tag below.. create table task (task_id text primary key, subject text); create table tasktag (task_tag_id text primary key, task_id text, tag_id text); create table tag (tag_id text primary key, tag text); i want find record in task there 2 matching tags: tag1, tag2 how sql look, have tried can't work using and, can using or.. select * task bring together tasktag on task.task_id = tasktag.task_id bring together tag on tasktag.tag_id = tag.tag_id tag = "tag1" , tag = "tag2" use: select * task bring together tasktag on task.task_id = tasktag.task_id bring together tag on tasktag.tag_id = tag.tag_id tag in ('tag1', 'tag2') grouping task.task_id having count(distinct tag) = 2 the having count(distinct ...) needs equal number of in parameters, or risk seeing false positives (ie duplicates of tag1 count 2, etc). ...

Triggering a jQuery event from iframe -

Triggering a jQuery event from iframe - here's scenario, have events happening within iframe , until working well. ran problem want dispatch event iframe parent. i'm using trigger event iframe: $('body', window.parent.document).trigger('eventname'); //and i've tried $(window.parent.document).find('body').trigger('eventname'); and in parent page i've listening event this: $('body').bind('eventname', myfunction) i know script gets trigger because stuck console.log before , after trigger. iframe on same domain there no problem there. i can phone call function on parent page straight this: window.parent.functionname wondering if possible using using event based solution. solved @cwolves reply working great: parent.$('body').trigger( 'eventname' ); if have jquery loaded in parent frame, try: parent.$('body').trigger( 'eventname' ); if not, seek this,...

Why staging directory is also called Index/Git Index? -

Why staging directory is also called Index/Git Index? - i confused naming of staging directory (git index) in git. is there special meaning such called index? why not called cache / or temp directory can understand more easily? to me, index sth help search things faster, indexing in dbms, how relate staging area??? i did google search still have no much idea. ref link git index the article main git maintainer junio c. hamano, instructive, grasping difference between cache , index: (emphasis mine) when linus started writing git, aim allow him reproduce each , every intermediate state produced original "tarball , patches" workflow used before bitkeeper days. starting 2.6.12 tarball, queues patch-1, patch-2,... 2.6.12 itself, 2.6.12 patch-1 applied, 2.6.12 both patch-1 , patch-2 applied, become 3 versions. but won't scale if have shuffle hundreds of patches day. invented "directory cache"; concept, corresponds "tree" objec...

android - What's a simple way to make a view's layout_width="match_parent" and make the height equal to its width? -

android - What's a simple way to make a view's layout_width="match_parent" and make the height equal to its width? - i view styled similar album fine art in rdio app (img) i don't know how should going this. want load bitmap view, if affects solution @ all. in case (where command has total width of device) can utilize getwindowmanager().getdefaultdisplay().getwidth(); width , manually set height. if you're not using total display width you'll need override onmeasure in view class , set height match width in there, perhaps this: @override protected void onmeasure( int widthmeasurespec, int heightmeasurespec ) { viewwidth = measurespec.getsize( widthmeasurespec ); viewheight = measurespec.getsize( heightmeasurespec ); if(viewwidth != 0) viewheight = viewwidth; setmeasureddimension( viewwidth, viewheight ); } android android-layout

objective c - Trigger done button touch in iPhone -

objective c - Trigger done button touch in iPhone - how can trigger done button touch in iphone? i have asynchronous task pops me little tableview (adds subview). when 1 of textfields focused - keyboard shown , overlays tableview. i tried phone call resignfirstresponder on focused textfield in "textfieldshouldbeginediting" , didn't help. think maybe explicit trigger of done button work. you can animate entire frame of view whenever textfield focused, slides , display table , textfield without hindrance. iphone objective-c ios xcode uitextfield

c# - Ajax calender control doesn't work -

c# - Ajax calender control doesn't work - i downloaded ajax command tool kit binary .net35 , unzipped content. add together new tab in toolbox ajaxcontroltoolkit. click on take items , tick on access info source , browse ajaxcontroltoolkit.dll. set toolscriptmanager , 1 textbox , calenderextender in design. calenderextender doesn't appear in design. seek show calender in design page writing it's code in source page. on debugging show error message. the source code is: <asp:toolkitscriptmanager id="toolkitscriptmanager1" runat="server"> </asp:toolkitscriptmanager> <asp:textbox id="textbox1" runat="server" ontextchanged="textbox1_textchanged"> </asp:textbox> <asp:calendarextender id="calendarextender1" runat="server" popupbuttonid="textbox1" targetcontrolid="textbox1"> </asp:calendarextender> and error message is: ...

ios - how to swap php variable characters around -

ios - how to swap php variable characters around - i trying utilize formula requires me mix characters of variable around. new php , confused lack of format specifications in other languages. the php script beingness passed/(post) 2 objective-c integers app, here php code have far, pretty simple more of proof of concept , figuring out if variable coming script still int or string or whatever heck might be.. confused php , lack of having declare format specifications etc. <?php $inputdate = $_request['userdate']; //example of whats coming in 12345678 //swap 4 characters around //23416587 (this not random) //then send result ?> so, first question be, when $inputdate instantiated '12345678' integer? or can still perform string manipulation mix numbers have shown above? the original value of $_request['userdate']; string. safe, cast (string)$_request['userdate'] or append empty string. order desire, do: $inputdate = (s...

Can C# style object initialization be used in Java? -

Can C# style object initialization be used in Java? - in c# it's possible write: myclass obj = new myclass() { field1 = "hello", field2 = "world", field3 = new myotherclass() { etc.... } } i can see array initialization can done in similar way can similar above done in java too, , if so, what's syntax? that initialization syntax is not present in java. a similar approach utilize double brace initialization, create anonymous inner sub class initializer block: myclass obj = new myclass() {{ // in java these more this: setfieldx(value); field1 = "hello"; field2 = "world"; field3 = new myotherclass() ... }}; be aware though, you're creating subclass. another approach create builder myclass , , have code this: myclass obj = new myclassbuilder(). withfield1("hello"). withfield2("world"). withfield3(new myotherclass()). build(); c# java ini...

php - Strict standards error -

php - Strict standards error - the function parse_users returns array. i doing next in function: return reset($this->parse_users($records)); but strict standards: variables should passed reference in... is because reset() on function? do have way: $users = $this->parse_users($records); homecoming reset($users); or else? that's exactly. reset takes reference array parameter, needs real variable reference -- if pass-by-reference value. php

line wont display on top of background color(css problem) -

line wont display on top of background color(css problem) - setting line won't appear on top of background color,what seems problem?thank you.i have code <div class="setting-wrapper"> <div class="setting-line"></div </div> css .setting-wrapper{ background-color:#e2e9e9; position: absolute; left:450px; top:20px; border:1px solid #dedede; display:block; width:500px; height:400px; -moz-border-radius:5px; -webkit-border-radius: 5px; border-radius:5px; } .setting-line{ margin-top:5px; margin-bottom:5px; width:500px; border-top:solid #e6e6e6 1px; } if <div class="setting-line"></div isn't copy/paste typo, theres missing bracket @ end of closing div . but maybe it's hard see difference between #e2e9e9 , #e6e6e6 (depending on systems color-depth and/or screen capabilities). css

database - Can JavaScript be used to send and store information on a server? -

database - Can JavaScript be used to send and store information on a server? - for example: when inquire question on stackoverflow, input info text box, , info sent server stored , displayed end-user. can process of sending information, , retrieving/displaying written in js? if yes, language or there more efficient ones? if no, process written in? thank in advance. yes. can utilize ajax (http://en.wikipedia.org/wiki/xmlhttprequest) send , receive info server. javascript database data-retrieval

c++ - Is a virtual destructor needed for your Interface, if you always store it in a shared_ptr? -

c++ - Is a virtual destructor needed for your Interface, if you always store it in a shared_ptr? - since boost::/std::shared_ptr have advantage of type-erasing deleter, can nice things like #include <memory> typedef std::shared_ptr<void> gc_ptr; int main(){ gc_ptr p1 = new int(42); gc_ptr p2 = new float(3.14159); gc_ptr p3 = new char('o'); } and correctly delete pointer right deleter beingness saved. if ensure every implementation of interface gets created shared_ptr<interface> (or make_shared<interface> ), need virtual destructor? declare virtual anyways, want know, since shared_ptr delete type initialized (unless custom deleter given). i still follow mutual rule classes meant derived: provide either public virtual destructor or protected non-virtual destructor the reason cannot command of uses, , simple rule means compiler flag if seek delete through wrong level in hierarchy. consider shared_ptr not guara...

ios - Xcode 4 build succeeds, command line build fails? -

ios - Xcode 4 build succeeds, command line build fails? - i have project in xcode 4 (the latest non-beta version) builds fine when built in xcode itself. specifically, ld command correctly uses derived info directory (where build products, including dependent static library, placed). however, when build same project command line, ld command fails, trying utilize /build folder within project, not beingness populated. i've tried adjusting every build setting know about, both in parent , dependent project. any ideas on start debugging this? can provide more info needed. edit 1: total xcode build command: xcodebuild -project appname.xcodeproj -target appname -configuration "config name" where appname , config name both right values build. edit 2: link (ld) commands. when built in xcode (this works): ld /users/james/library/developer/xcode/deriveddata/appname-apkmkuhwuccsbpblulxcsafyxkwa/build/products/debug-iphonesimulator/appname.app/appname...

google chrome - How can I Gmail? -

google chrome - How can I <iframe> Gmail? - i know gmail might set security measures in place prevent this, need set gmail within element. the 2 next methods don't work: <object type='text/html' data='http://mail.google.com/'></object> <iframe src='http://mail.google.com/' frameborder=0 style='width:322px; height:480px;'></iframe> are there other ways? you cannot. gmail, of google's other web services, sets http header: x-frame-options: sameorigin which disallows site beingness framed site other gmail itself. iframe google-chrome gmail

java code problem -

java code problem - i have bean called empbeans.java calls dao class(userdao.java) used inserting info table named emp_leaves.it inserts values based on ename brought session.i have little coding problem.it displaying message "sorry! not apply leave!".is there error in userdao.java ?plz solve. here code. empbeans.java public void apply(actionevent evt) { ename = util.getsession().getattribute("ename").tostring(); boolean done= userdao.apply(this); if ( done ) { reason = ""; leavedate=""; message = "applied leave successfully!"; } else message = "sorry! not apply leave!"; } userdao.java public static boolean apply(empbeans e) { connection con = null; preparedstatement ps=null; preparedstatement ps1=null; seek { con = database.getconnection(); ps1=con.preparestatement("select eid employee ename=?"); ps1.se...

python array_walk() alternative -

python array_walk() alternative - i have list looks this: list = [1,2,3,4] i add together 12 each value. in php can utilize array_walk process each item in array. there similar function or easier way doing loop such as: for in list: thanks use list comprehensions. seek this: list = [i+12 in list] python

java - What's the point of having complex entity classes (in the Hibernate sense) -

java - What's the point of having complex entity classes (in the Hibernate sense) - since classic oop model broken anyway, despite goodies of orm, why need annotate next 2 illustration attributes in entity class: user => collection<photo> photos (one many) => collection<user> friends (one many) as not going utilize ... ever. seemingly, need paging or other types of formatting, guess i'll go like: photodaoinstance.find(searchcriteria); why don't restrict annotation of entity classes attributes corresponding database table contains? rest transient properties. well, if never need them, don't map them. depending on schema/intent, there's no reason map things don't need. if need them later, add together them. depending on usage, might want add together them hql/jpa ql/criteria queries, or might want query in sql. eventually, may need rework or rethink caching performance, that's way things go. create sur...

android - Not opening in WebView but in browser -

android - Not opening in WebView but in browser - i want open next link in webview https://tickets.musiconelive.com/admin/sacvalidatebarcode.asp i using next code that web=(webview)findviewbyid(r.id.web); web.getsettings().setjavascriptenabled(true); web.loadurl("https://tickets.musiconelive.com/admin/sacvalidatebarcode.asp"); but it's not opening in webview , instead opening in browser. how can prepare problem? i think help you. bundle com.adysol; import android.app.activity; import android.os.bundle; import android.webkit.websettings.pluginstate; import android.webkit.webview; public class adysol extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); string url ="http://tickets.musiconelive.com/admin/sacvalidatebarcode.asp"; webview wv=(webview) findviewbyid(r.id.webview1); wv....

c# - Decoding And Encoding Strings - HardCoded KEY for Symmetric Algorithms -

c# - Decoding And Encoding Strings - HardCoded KEY for Symmetric Algorithms - i wrote below class encoding , decoding string info (symmetric algorithm 1 key): using system; using system.collections.generic; using system.linq; using system.web; using system.text; using system.security.cryptography; using system.io; namespace myproject.classes { public static class symmetricencryption { private const string mykey = "bla bla bla"; private static string _algorithmname; public static string algorithmname { { homecoming _algorithmname; } set { _algorithmname = value; } } public static string encryptdata(string cleardata) { // convert string cleardata byte array byte[] cleardata_byte_array = encoding.utf8.getbytes(cleardata); // create algorithm symmetricalgorithm algorithm = symmetricalgorithm.create(algorithmname); algo...

c# - How to send continuous keypress to a program? -

c# - How to send continuous keypress to a program? - i have been using sendkeys.send() & sendkeys.sendwait() send keys foreground programme (a programme different application written). i tried sending continuous key-press sending repeatedly same key delay between them effect not same continuous keypress in application. my question is: how can send continuous key-press program? effect of keypress must same pressing myself key continuously in application. solution edit the solution phone call method: [dllimport("user32.dll")] static extern int sendmessage(intptr hwnd, uint wmsg, uintptr wparam, intptr lparam); with parameters obtained from: public system.diagnostics.process[] p = system.diagnostics.process.getprocessesbyname("process"); p[0].mainwindowhandle hwnd and using spy on window: right clicking on message line in spy shows wmsg, wparam , lparam (all 3 in hexadecimal) sendmessage(p[0].mainwindowhandle, (uint)0x0100, (uint...

table - A Real jQuery "Grid" -

table - A Real jQuery "Grid" - i looking solution real jquery "grid." every table plugin have found far has same kind of construction , usage ( http://stackoverflow.com/questions/159025/jquery-grid-recommendations ) have headers, different buttons, , many more different functions. yet of these can related more excel worksheet- don't consider grid- , not looking for. the closest solution have found grid layout , ability select , drag found here: http://stackoverflow.com/questions/2013902/select-cells-on-a-table-by-dragging as can see in 2 images attached in post the grid more game board/tiled based. what looking jquery plugin makes real tiled based grid , allows selecting/drag-to-select functionality, along (hopefully) event response selection. i have custom built table made, , having problem adding more functionality since lack of back upwards different plugins pertaining dragging , selecting. have tried implementing drag select plugi...