Posts

Showing posts from April, 2014

javascript - What's the best way to stop a click event propagating in IE9 beta? -

dojo.stopevent no longer appears stop default action of click event (or submit event) in ie9. how has event handling changed ie8 ie9 , what's best way stop event in ie9? event.preventdefault() doesn't appear stop click event happening either. this should resolved of dojo 1.6 rc1. give try. http://download.dojotoolkit.org/release-1.6.0rc1/ http://bugs.dojotoolkit.org/ticket/12257

c++ - Lightweight spinlocks built from GCC atomic operations? -

i'd minimize synchronization , write lock-free code when possible in project of mine. when absolutely necessary i'd love substitute light-weight spinlocks built atomic operations pthread , win32 mutex locks. understanding these system calls underneath , cause context switch (which may unnecessary quick critical sections spinning few times preferable). the atomic operations i'm referring documented here: http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/atomic-builtins.html here example illustrate i'm talking about. imagine rb-tree multiple readers , writers possible. rbtree::exists() read-only , thread safe, rbtree::insert() require exclusive access single writer (and no readers) safe. code: class intsettest { private: unsigned short lock; rbtree<int>* myset; public: // ... void add_number(int n) { // aquire once locked==false (atomic) while (__sync_bool_compare_and_swap(&lock, 0, 0xffff) == false); // perform...

Java Date format of '2010-10-11T22:10:10.000Z' -

what date format '2010-10-11t22:10:10.000z' ? that's iso8601 date format. if you're looking parse date in format (your question doesn't make intentions clear), have @ these other questions.

php - PDO::PARAM for type decimal? -

i have 2 database fields `decval` decimal(5,2) `intval` int(3) i have 2 pdo queries update them. 1 updates int works ok $update_intval->bindparam(':intval', $intval, pdo::param_int); but can't update decimal field. i've tried 3 ways below, nothing works $update_decval->bindparam(':decval', $decval, pdo::param_str); $update_decval->bindparam(':decval', $decval, pdo::param_int); $update_decval->bindparam(':decval', $decval); it seems problem database type decimal ? there pdo::param field of type decimal ? if not, use workaround? there isn't pdo::param decimals / floats, you'll have use pdo::param_str .

Drupal 6 & 7 unset Javascript from header -

edit: question applies drupal 6 & 7, though code example drupal 6. people have provided answers useful both versions of drupal. i'm working in drupal creating mobile theme drupal 6 website , trying remove unnecessary core , module javascript , css through preprocess_page function in template.php file. css files removed, can't seem javascript removed. here's i've got. in example, removed except the ajax scripts. any idea i'm doing wrong? <?php function mytheme_preprocess_page(&$vars) { //////// remove unneccesary drupal head files mobile version // css $css = drupal_add_css(); // core unset($css['all']['module']['modules/user/user.css']); unset($css['all']['module']['modules/node/node.css']); unset($css['all']['module']['modules/system/defaults.css']); unset($css['all']['module']['modules/system/system.css']); ...

jquery - How can you pass GET values to another url in php? GET value forwarding -

ok, i'm using jquery's ajax function , it's having trouble passing url http address. i'm hoping "get" values , send them url — so: local php file begin passed values, in turn forwards values url. maybe curl answer? don't know. it's got short answer know. pseudo code: //retrieve values $var retrieve [get] //passing url send values url ($var, url_address) edit: it's cross scripting solution javascript. if want redirect user: header('location: http://example.com/page.php?' . http_build_query($_get, '', '&')); die(); if want fetch page, use this: file_get_contents('http://example.com/page.php?' . http_build_query($_get, '', '&'));

How do I sign exes and dlls with my code signing certificate -

(i purchased code signing cert thawte , have been going out of mind frustration @ whole process. what have them are: .spc / .p7b file .pvk file (note not have pfx file them. god knows why, have been fighting tech support week) in case find "help" links on site , @ ms signcode.exe useless me because can't find exe on machine, have signtool.exe. unfortunately mystified @ command line parameters listed on ms site . specifically, parameters use , values? tried thought obvious not work @ all. i can signing wizard work, need work non-interactively in hudson ci batch file. it doesn't seem should difficult, far black magic. thanks help first, can generate own pfx file using pvk2pfx tool described @ http://msdn.microsoft.com/en-us/library/ff549703(vs.85).aspx something like pvk2pfx -pvk cert.pvk -spc cert.spc -pfx cert.pfx -pi password ought trick. secondly, signtool tool you're after. http://msdn.microsoft.com/en-us/library...

How do I set the socket timeout in PHP? -

i need set timeout on client.recv in tcp server. last parameter of fsockopen resource fsockopen ( string $hostname [, int $port = -1 [, int &$errno [, string &$errstr [, float $timeout = ini_get("default_socket_timeout") ]]]] )

memory - In C++, why is `new` needed to dynamically create an object rather just allocation? -

i've got trivial class hierarchy: class base { public: virtual int x( ) const = 0; }; class derived : public base { int _x; public: derived( int x ) : _x(x) { } int x( ) const { return _x; } }; if use malloc allocate instance of derived , , try access polymorphic function x , program crashes (i segmentation fault): int main( ) { derived *d; d = (derived*) malloc( sizeof(derived) ); *d = derived( 123 ); std::cout << d->x() << std::endl; // crash return 0; } of course actual application lot more complex (it's sort of memory pool). i'm pretty sure it's because of way allocate d : didn't use new . i know of placement new operator, must need, i've never used , have got questions: why application crashing, if don't use new ? what new do? why can't use assignment operator assign value of derived( 123 ); memory area pointed d ? would need use new non-polymorphic types? how pod...

actionscript 3 - Find closest number in range? -

what best way find closes value in range... for example have array 0, 90, 180, 270, 360.. , number 46... what best way find 90 in array? (in actipnscript 3) how want define closest? if mean least difference, loop through each value, compute absolute value of difference, keep note of smallest value seen. if list sorted magnitude, stop when see difference that's greater smallest found, esle loop through entire set.

C++ simple program help String Data -

thanks helping me in advance! used java , c# c++ different. trying part b of lab: http://cs.binghamton.edu/~sgreene/cs240-2010f/labs/lab2.html is idea assigned in part b? dont know missing in header file deals indef endif, etc. did research , dont seem miss anything. , lastly, lab assignment mean when says: "in [] operator, index should checked confirm between 0 , 9. if not, string "undefined" should returned instead." thanks ok here updated files #include "tenstrings.h" using namespace std; //default constructor tenstrings::tenstrings() { public: tenstrings str[10]; str[0] = "string 1"; str[1] = "string 2"; str[2] = "string 3"; str[3] = "string 4"; str[4] = "string 5"; str[5] = "string 6"; str[6] = "string 7"; str[7] = "string 8"; str[8] = "string 9"; str[9] = "string 10"; } ; main.cpp --------...

actionscript 3 - Differences between timeline code vs Document class code -

i'm trying explain differences between writing timeline code vs document class code, far have: timeline code: - doesn't require package , class declaration document class code: - requires package , class declaration timeline code: - starts working on top-most line document class code: - starts working constructor function timeline code: - loops, conditionals , event listeners can **outside** of function document class code: - loops, conditionals , event listeners must **inside** function are these correct, , there else trip people making transition? time line code old , not recommended way not structured way code. still, timeline code: - can not define access control modifier functions or variables, default, public(as far know) document class code: - can define access control modifier timeline code: - code runs every time control come in frame document class code: - document class being initialized once timeline code: - variable's lifeti...

java - Polymorphism - access specifier changed in derived class -

hi wanted undertand following behavior.. have defined same method - gg() in base , derived class different access class base { // thing **private** integer gg(){ //return } } class derived{ // **public** integer gg(){ //return } } in main method when initialize variable base d = new derived() and attempt call d.gg() says base.gg() private. modifying access specifier make method calls revert base class method?. when change access specifer of gg() in base class public, calls method in derived class polymorphism should. from read polymorphism, ok make access specifier less restrictive in derived class case here . accessing object through reference-to-base-class means intend access via interface specified base class. if you've declared method private in base class, can't access via reference-to-base! consider absurdity ensue if weren't case: base b; if (some condition) { b = new base(); } else { b = new der...

javascript - dynamically added HTML elements won't be affected by plugins ! -

there plugins such flowplayer overlay asks put "rel" attribute html element make trigger events ... problem , when create dynamically elements have rel attribute ,, won't trigger ... solution !? you should use live() method trigger events dynamically created elements. example: $('selector').live('click', function(){ // code ......................... });

jquery - How can I add some html to an exact position within a page? -

i trying figure out how add : <p id="sab-contact-tab"><a href="/contact" class="smcf-link"></a></p> right after : <div id="footer"> here code: jquery(document).ready(function() { var prependhtml = "<p id="sab-contact-tab"><a href="/contact" class="smcf-link"></a></p>"; jquery(prependhtml).prepend("#footer"); }); is code correct? if not right code? thanks, michael sablatura var prependhtml = "<p id="sab-contact-tab"><a href="/contact" class="smcf-link"></a></p>"; should var prependhtml = '<p id="sab-contact-tab"><a href="/contact" class="smcf-link"></a></p>'; or var prependhtml = "<p id=\"sab-contact-tab\"><a href=\"/contact\" class=\"smcf...

.net - Regex file extension filter -

i trying create regex take files not have list of extensions. in particular, trying filter out filenames end in .csv i have browsed around hour , been unable figure out. using .net regex. the following should trick. tested .net. ^.*\.(?!csv).*$ be sure include ignorecase regexoptions make case insensitive.

ios - How to increase the font size of Tab Bar title? -

can increase font size of tabbar title? it's not possible; you'd have build own tab bar , design tabs yourself. , if do, how you'll work uitabbarcontroller or other way different question.

Why memory alignment of 4 is needed for efficient access? -

i understand why data need aligned (and efforts made accomplish padding) can reduce number of memory accesses assumes processor can fetch addresses multiples of 4(supposing using 32-bit architecture). , because of assumption need align memory. my question is: why can access addresses multiple of 4(efficiency, hardware restriction, one)? which advantages of doing this? why cannot access addresses available? memory constructed hardware (ram) attached memory busses. wider bus, fewer cycles required fetch data. if memory 1 byte wide, you'd need 4 cycles read 1 32-bit value. on time memory architectures have evolved, , depending on class of processor (embedded, low power, high performance, etc.), , cache design, memory may quite wide (say, 256 bits). given wide internal bus (between ram or cache) , registers, twice width of register, fetch value in 1 cycle regardless of alignment if have barrel shifter in data path. barrel shifters expensive, not processors have them;...

xml - XSL transformation problem due to xmlns -

i'm having issue xslt transformation doesn't want work when data-source uses specific xmlns. what doing wrong here? (the transformation done our sap mii enterpricy system) xsl <?xml version="1.0"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform" xmlns:s="http://www.wbf.org/xml/b2mml-v02" exclude-result-prefixes="s"> <xsl:output method="html" omit-xml-declaration="yes" encoding="utf-8" indent="yes" /> <xsl:template match="/"> <xsl:value-of select="s:/productionschedule/id" /> </xsl:template> </xsl:stylesheet> data <?xml version="1.0"?> <productionschedule xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xm...

visual studio 2008 - C++: How to create multi-type and multi-dimensional array format? -

i'm trying read similar array format php uses: "data" => array( "keyname1" => "string", "somearraykeyname" => array( "keyname1" => "more strings", "keyname2" => "bla bla", "moar" => array( "first" => 1, "second" => 2, "third" => "3", ), "keyname3" => 25, ), "keyname2" => 13.37, "keyname3" => 1337, "array without keynames" => array( "keke", "lala", "lolo", ), ); but stumbled upon on multiple possible types problem. how can done in c++ best way ? i thinking create struct possible types each element: struct generaltype { char whichtype; // type using value int intval; float floatval; str...

sql - How execute query with subqueries in zend framework -

hi need write sql zend_db_select, dont know how can write subqueries. appreciate help. thanks. select * advert categoryid in ( select id `tree` `lft` between (select lft tree id = '2') , (select rgt tree id = '2')) // create main query $select = new zend_db_select(); //create subquery $subselect = new zend_db_select(); // using subquery in main query $select->where('table.field in(?)', $subselect->assemble());

Reverse massive text file in Java -

what best approach reverse large text file uploaded asynchronously servlet reverses file in scalable , efficient way? text file can massive (gigabytes long) can assume mulitple server/clustered environment in distributed manner. open source libraries encouraged consider i thinking of using java nio treat file array on disk (so don't have treat file string buffer in memory). also, thinking of using mapreduce break file , process in separate machines. if uploaded , can length @ beginning, create empty full-sized file front , write starting , working way front using seek you'd want define block size (like 1k?) , reverse in memory before writing out file.

Beginner to asp.net.. What should i choose webforms or mvc? -

possible duplicates: advice on using asp.net webforms or mvc how decide right, webforms or mvc when doing asp.net i new web development , asp.net... going through asp.net website , 'n' number of question here in stackoverflow regarding webforms or mvc .... still beginner can't idea choose? what should choose webforms or mvc? if mvc,what should know before getting started it? if webforms,what should know before getting started it? in terms of specific reasons consider web forms new projects: 1) if using sharepoint. today sharepoint sites more naturally integrate web forms web-parts/pages in them. sharepoint team add mvc support in future - if site/solution integrates sharepoint today or new version coming out you'll find web forms easier to-do this. 2) if building application existing server control or set of server controls can provide lot of functionality. true lot of reporting scenarios (where can leverage charting controls) dat...

php - Make an array of two -

i'd make array tells site's pages show in php. in $sor["site_id"] i've got 2 or 4 chars-lenght strings. example: 23, 42, 13, 1 in other array (called $pages_show ) want give site_ids other id. $parancs="select * pages order id"; $eredmeny=mysql_query($parancs) or die("hibás sql:".$parancs); while($sor=mysql_fetch_array($eredmeny)) { $pages[]=array( "id"=>$sor["id"], "name"=>$sor["name"], "title"=>$sor["title"], "description"=>$sor["description"], "keywords"=>$sor["keywords"] ); // makes pages array information page. $shower = explode(", ",$sor["site_id"]); // explode site_id $pages_show[]=array( "id"=>$sor["id"], "where"=>$shower //to 'where' want put explode's elements one-by-one, result down ); this script gives me following result: array (3) 0 =...

javascript - Get Imagesize in jQuery -

i want imagesize in jquery, have code. works point of alert (v); i wonder wrong rest when v contains value. var v = $('#xxx input').val(); alert (v); var newimg = new image(); newimg.src = v; var height = newimg.height; var width = newimg.width; alert ('the image size '+width+'*'+height); thanks jean your code image size won't work. image loads asynchronously, height , width not available immediately. you'll need following: var newimg = new image(); var height, width; newimg.onload = function() { height = newimg.height; width = newimg.width; window.alert('the image size '+width+'*'+height); }; newimg.src = v;

iphone - How can I delete video stored in the photo library? -

i have saved video in photo library. -(void)exportvideo:(id)sender { nsstring *path = [documents_folder stringbyappendingstring:@"/air.mp4"]; nslog(@"path:%@", path); nslog(@"export button clicked"); uisavevideoatpathtosavedphotosalbum(path, self, @selector(video:didfinishsavingwitherror: contextinfo:), nil); } - (void)video:(nsstring *)videopath didfinishsavingwitherror:(nserror *)error contextinfo:(void *)contextinfo { nslog(@"finished saving video error: %@", error); } now need delete video have stored programmatically. how can delete video ? there functions it? thank you. there no public methods in iphone sdk delete items photo library.

javascript - Extension dialogs: across-session info, "pre-load" event and how to center startup dialog? -

i working on small extension personal consumption , practice. provide information every time firefox starts using modal dialog. know frowned upon, know-how. have few question regarding things---i feel there better ways them. kindly share wisdom: i have created small dialog xul, , have event listener registered load event of main window. display dialog, use: window.opendialog("chrome://myext/content/prompt.xul", "dialogname", "chrome,dialog,modal,centerscreen,resizable", params).focus(); problem 1: can never start dialog on center screen (even if have centerscreen enabled), starts top left---it nice have in middle---something firefox's password-on-startup request. how can achieve that? i modal window open once per session, if there multiple instances of firefox. have done accomplish is, once dialog runs, set extension preference, , check before opening dialog on "load" event of new window. problem 2: make sure somehow do...

bdd - finding download box element with capybara in cucumber test -

i have link downloads file. click link displays dialog box "save" , "open" option , "cancel" , "ok" button. want find "ok" , "cancel" button cucumber test. i took below link didn't helped much. how test confirm dialog cucumber? **features code** , want click "ok" **steps code** /^i want click "([^\"]*)"$/ |option| retval = (option == "ok") ? "true" : "false" page.evaluate_script('window.confirm = function() { return true; }') page.click("ok") end the issue dialogue talking not part of webpage @ all. part of browser. really, part of user interface outside control of webpage. all can test webpage point of requesting download, browser request subsequently not can script cuke. sorry.

iphone - Why are controls (null) in awakeFromNib? -

this follow on question regarding why not set uicontrols in awakefromnib. answer can see below controls nil in awakefromnib , although initialised correct objects time viewdidload . setup view same do, should doing different access them here, xib(nib) designed , saved current version of image builder. code: @interface iphone_test_awakefromnibviewcontroller : uiviewcontroller { uilabel *mylabel; uiimageview *myview; } @property(nonatomic, retain)iboutlet uilabel *mylabel; @property(nonatomic, retain)iboutlet uiimageview *myview; @end . @synthesize mylabel; @synthesize myview; -(void)awakefromnib { nslog(@"awakefromnib ..."); nslog(@"mylabel: %@", [mylabel class]); nslog(@"myview : %@", [myview class]); //[mylabel settext:@"awake"]; [super awakefromnib]; } -(void)viewdidload { nslog(@"viewdidload ..."); nslog(@"mylabel: %@", [mylabel class]); nslog(@"myview : %@", ...

php - Ajax request to self-page not working -

i have php page follow javascript code in it: $("#savebutton").click(function() { hlalert('saving...'); $.getjson("<?php echo $php_self; ?>", { ajax: 1, classes: $("#alllessons").serialize() }, function(output) { if (output.status == false) { hlalert(output.message); } else { hlalert('saved!.'); } }); }); for whatever real not work. javascript before , after exectute these seemingly not. not failed status returned. hlalert() function displays twitter alert message. at top of php page have code <?php if ($_get['ajax'] == 1) { // parse ajax values // output json , die } // regular page code i tried changing names of passed values in getjson call, doesn't anything. i've tried putting page getjson calls different file ,...

winforms - C# Drag and Drop - e.Data.GetData using a base class -

i using c# , winforms 3.5 i have list of user controls derived 1 base class. these controls can added various panels , i'm trying implement drag-drop functionality, problem i'm running in on dragdrop event. for drageventargs e.data.getdata(typeof(baseclass)) doesn't work. wants: e.data.getdata(typeof(derivedclass1)) e.data.getdata(typeof(derivedclass2)) etc... is there way can around this, or better way architect it? you can wrap data in common class. example, assuming base class called dragdropbasecontrol public class dragdropinfo { public dragdropbasecontrol control { get; private set; } public dragdropinfo(dragdropbasecontrol control) { this.control = control; } } and drag drop can initiated following in base class dodragdrop(new dragdropinfo(this), dragdropeffects.all); and can access data in drag events using following e.data.getdata(typeof(dragdropinfo)); have understood requirement correctly?

email - In remote host: Connection could not be established with host smtp.gmail.com [Connection timed out #110] -

after deploying gettin error below when try send mail: 500 | internal server error | swift_transportexception connection not established host smtp.gmail.com [connection timed out #110] stack trace * @ () in sf_root_dir/lib/vendor/symfony/lib/vendor/swiftmailer/classes/swift/transport/streambuffer.php line 235 ... 232. } 233. if (!$this->_stream = fsockopen($host, $this->_params['port'], $errno, $errstr, $timeout)) 234. { 235. throw new swift_transportexception( 236. 'connection not established host ' . $this->_params['host'] . 237. ' [' . $errstr . ' #' . $errno . ']' 238. ); * @ swift_transport_streambuffer->_establishsocketconnection() in sf_root_dir/lib/vendor/symfony/lib/vendor/swiftmailer/classes/swift/transport/streambuffer.php line 70 ... 67. break; 68. case self::type_so...

memory management - iPhone: custom UITableViewCell with Interface Builder -> how to release cell objects? -

the official documentation tells me i've these 3 things in order manage memory "nib objects" correctly. @property (nonatomic, retain) iboutlet uiuserinterfaceelementclass *anoutlet; "you should either synthesize corresponding accessor methods, or implement them according declaration, , (in iphone os) release corresponding variable in dealloc." - (void)viewdidunload { self.anoutlet = nil; [super viewdidunload]; } that makes sense normal view. however, how gonna uitableview custom uitableviewcells loaded through .nib-file? there iboutlets in mycustomcell.h (inherited uitableviewcell), not place load nib , apply cell instances, because happens in mytableview.m so still release iboutlets in dealloc of mycustomcell.m or have in mytableview.m? also mycustomcell.m doesn't have - (void)viewdidunload {} can set iboutlets nil, while mytableview.m does. are iboutlets properties of cell? if release them in mycustomcell's...

javascript - Move my slider thumbnails as new slide comes into view -

script: jquery cycle slider: http://jquery.malsup.com/cycle/ i'm using following code move slider thumbnails container left "130px" before next slide comes view. margin reset "0px" when last slide reached. works well, container not shift until third slide. this code i'm using: function onbefore(currelement, nextelement, opts, isfoward) { var currentslide = opts.currslide + 1; if(currentslide == opts.slidecount) { jquery(".slider-nav").animate({marginleft: '0'}); } else if(currentslide > 1 && currentslide != opts.slidecount) { jquery(".slider-nav").animate({marginleft: '-=133'}); } } how can have shift once second slide comes view. note: replacing "> 1" in code above "> 0" shifts container page loads. i'm not sure of context in function called. think want following code: function onbefore(currelement, nextelement, opt...

Usage of Minidump within a COM Object -

i'm developing com dll add-in msoffice. since i'm not creating logs within add-in add crash report generator add-in. hopefully 'minidump' best choice, have never use minidump inside com object. i appreciate if can point out possibilities of creating such crash dump minidump inside com object. thank you i suspect should able use technique described here , create minidump. the actual implementation straightforward. following simple example of how use minidumpwritedump . #include <dbghelp.h> #include <shellapi.h> #include <shlobj.h> int generatedump(exception_pointers* pexceptionpointers) { bool bminidumpsuccessful; wchar szpath[max_path]; wchar szfilename[max_path]; wchar* szappname = l"appname"; wchar* szversion = l"v1.0"; dword dwbuffersize = max_path; handle hdumpfile; systemtime stlocaltime; minidump_exception_information expparam; getlocaltime( &stlo...

asp.net - How to create a web service which returns JSON rather than XML for GET and POST (no AJAX)? -

i create web service returns results json in asp.net http , post bindings. in other words webservice return json if 1 types it's url in browser. xml representation done automatically in net 3.5. i know can use scriptmethod (as shown below) make ajax calls return json, not i'm after. [webmethod] [scriptmethod(responseformat = responseformat.json)] public someclass example() ok, saying (if understand correctly), web service uses soap, , json not part of soap. json it's own protocol. don't want use web service framework? if can use simple httphandler returns data in form of json here example of http://johnnycoder.com/blog/2008/12/16/httphandler-json-data/

android - Anyone try playing animated gifs manually? -

i need display simple animation (about 20 frames, each frame being 40 x 40 pixels in size). ideally use animated gif this, android < 2.2 not support it, amazingly. i'm wondering if has experience composing individual frames manual animation. believe have do. experience playback being choppy? kind of don't want start if results going poor. thanks there's facility in android doing this. see graphics documentation on frame animation: http://developer.android.com/guide/topics/resources/animation-resource.html it includes sample project can run can determine if performance sufficient needs.

timezone - Get Standard Time Zone Name using C# -

i need std time zone name time zone using c#.. for ex if give +05.30.0 means show std indian time zone... the timezone has standardname property. please refer examples @ |msdn . edit: if want timezone names , can use workaround underlined here . also, check this class easy manipulation of timezones.

Chrome on Linux - query the browser to see what tabs are open? -

i running chromium (the open source chrome version) on ubuntu linux. can write programme see tabs have open? write programme monitor how time i'm spending on things. there command line programme, way invoke chromium-browser command, or dbus incantation tell me tabs have open , url each tab at? indeed there command line option can open door running chrome (chromium) process --remote-shell-port . through "debugging back-door" may able list of open tabs. look @ chromedevtools further inspiration. update: chrome devtools deprecated , not supported anymore since version >17.0.950.* see webkit-protocol manual if new debug-framework provides similar manners accomplish task.

If we have too much commented code in .net would it effect code performance? -

if have commented code in .net effect code performance? it effect time takes compile code (by c#/vb compiler) il. c# , vb.net there no difference in runtime performance, guaranteed.

processing an image using CUDA implementation, python (pycuda) or C++? -

i in project process image using cuda. project addition or subtraction of image. may ask professional opinion, best , advantages , disadvantages of two? i appreciate everyone's opinions and/or suggestions since project important me. general answer: doesn't matter. use language you're more comfortable with. keep in mind, however, pycuda wrapper around cuda c interface, may not up-to-date, adds potential source of bugs, … python great @ rapid prototyping, i'd go python. can switch c++ later if need to.

c++ - IXSomething vs ISomething -

i stumbled upon documentation com objects have 2 kinds of interfaces, 1 starting i , second ix . documentation says ix derived iunknown , , i derived idispatch . is better use ix interfaces if use c++? far understand i interfaces designed scripting languages in case? there other differences? the x belongs next word. feed vs xfeed. "extended", version 2 of api.

Dynamic change of class of <TR> with Jquery -

this first post, , first please forgive me poor english. i have problem can't fix: i have <table> of questions, the first question visible (class:visible), others hidden (class:hidden) $(document).ready(function(){ $('.hidden').hide(); when people click on first question, want second question appear (and first question turn grey, using 'done' class). $('.visible:not(.done)').click(function(){ $(this).addclass('done'); $('.hidden:first').toggle(500).removeclass('hidden').addclass('visible'); }) the first question done (class:done) , 2nd question should 1 react click(), , on... doesn't work: other <tr> appear when click on 1st <tr> . can give me hand on problem ? thank you. since adding classes dynamically , click event handler class selector based have use .live() event. $('.visible:not(.done)').liv...

How to find a function in javascript files -

i have many javascript files referenced in html file. there call function x . how can find x is? additional description: it's not local site , don't have js, can download js , search files. i'd use method firebug, etc. search files x function name. previous poster said - firebug firefox special friend when developing web.

optimization - Is there a way to instruct Eclipse to off-load memory when minimized? -

i use eclipse lot of plug-ins , have more 1 windows open @ time, , memory usage huge , system hangs of time. in firefox can set flag config.trim_on_minimize=true , whenever firefox minimized ram memory usage reduced. (ie swapped), wondering there option in eclipse same?. thanks. i assume work on windows. seems operating system (at least windows xp) tend swap java desktop application aggressively when minimized. bringing application has kind of 'sluggishness'. to prevent behaviour 'fix' implemented in eclipse. can read in bug 85072 . not think can change this. one question: when system starts hanging, physical memory gone , entire system slows down or eclipse? in latter case maybe gc slows eclipse if have free memory may try add more memory eclipse (increase -xmx value in eclipse.ini file).

java - j2me problem with using network objects -

i trying use j2me's io package whenever try create object example datainputstream = null; it shows me error stating datainputstream cannot resolved type i tried using inputstream object same error shows , when use connector objects doesn't show error i using s60 v3 fp2 sdk please me. thanks! make sure import datainputstream . import java.io.datainputstream; if you're using , ide should tell before try compile can't find datainputstream , , ide give option resolve import you.

javascript - Confused with ECMAScript Language Specification Function Calls section -

i reading ecmascript language specification function calls section can rephrase or detailed explains following sentense me? the production callexpression : memberexpression arguments evaluated follows: evaluate memberexpression. let's take code example. var john = { name: 'john', greet: function(person) { alert("hi " + person + ", name " + this.name); } }; john.greet("mark"); take above code example, production callexpression mean? memberexpression in case, john.greet? thanks! the memberexpression john.greet . it's saying is: step 1: figure out function call. :-) john part important, because comes later. here's complete quote recent specification (your link 3rd edition, has been superceded 5th edition ; didn't change though): let ref result of evaluating memberexpression. let func getvalue(ref). let arglist result of evaluating arguments, producing intern...

math - Find the max of 3 numbers in Java with different data types -

say have following 3 constants: final static int my_int1 = 25; final static int my_int2 = -10; final static double my_double1 = 15.5; i want take 3 of them , use math.max() find max of 3 if pass in more 2 values gives me error. instance: // gives me error double maxofnums = math.max(my_int1, my_int2, my_double2); please let me know i'm doing wrong. math.max takes 2 arguments. if want maximum of three, use math.max(my_int1, math.max(my_int2, my_double2)) .

c++ - Syntax explanation -

in code: struct tagpaint { }paint,//<<<--------------what's (paint)? *ppaint;//<<<-------------and this(*ppaint)? i mean declare variable name paint of type tagpaint , pointer called ppaint tagpaint? thanks. paint variable of type tagpaint. ppaint pointer type tagpaint. if want them define types, need: typedef struct tagpaint { ... } paint, * ppaint; but c usage - should not writing code in c++. , in c, defining type hides fact pointer considered bad style.

c# - Changing the Default View Engine's view search behavior -

i'm working asp.net mvc 2. have bunch of partial views render based on different conditions within same controller. i'd not put physical partial view files in controller's other views. i know when want viewresult using view() or partialview() methods default view engine search through folder in views directory associated controller (i.e. if controller called register in register folder under views) , in shared folder. is there way change behavior, or perhaps tell view -- heck, give specific file render? possible? perhaps sub-folder under shared folder work... can specify custom location "search views" in asp.net mvc?

Delphi Prism getting Unknown Identifier "DllImport" error -

i'm trying call window's sendmessage method in delphi prism, i've declared class follow: type myutils = public static class private [dllimport("user32.dll", charset := charset.auto)] method sendmessage(hwnd:intptr; msg:uint32; wparam:intptr; lparam:intptr):intptr; external; protected public end; when tried compile, error unknown identifier "dllimport" i used example, how call function createprocess in delphi prism? , syntax looks same. there setting need enable, or have syntax error? make sure import (use) system.runtime.interopservices . that's dllimport attribute defined.

testing - Unit tests vs Functional tests -

what difference between unit tests , functional tests? can unit test test function? unit test - testing individual unit, such method (function) in class, dependencies mocked up. functional test - aka integration test, testing slice of functionality in system. test many methods , may interact dependencies databases or web services.

java - ANDROID: inside Service class, executing a method for Toast (or Status Bar notification) from scheduled TimerTask -

i trying execute {public void} method in service, scheduled timertask periodically executing. this timertask periodically checks condition. if it's true, calls method via {classname}.{methodname}; however, java requires, method needs {pubic static} method, if want use {classname} {.dot} the problem method notification using toast(android pop-up notification) , status bar use these notifications, 1 must use context context = getapplicationcontext(); but work, method must not have {static} modifier , resides in service class. so, basically, want background service evaluate condition scheduled timertask, , execute method in service class. can me what's the right way use service, invoking method when condition satisfied while looping evaluation? here lines of codes: the timertask class (watchclipboard.java) : public class watchclipboard extends timertask { //declaration private static getdefinition getdefinition = new getdefinition(); @overrid...

jQuery slider messing up my css gradient? -

i put jquery slider in page, , when add new div underneath , add float: left gradient stops right there. here's link . and when don't add float: left gradient background normal :s... css: body { height: 100%; border-top: 1px solid white; margin:0; background-repeat: no-repeat; font-family: 'aandachtbold'; -webkit-font-smoothing: antialiased; background: #cdd6de;!important; background: -webkit-gradient(linear, 0 0, 0 bottom, from(#f4f5f5), to(#cdd6de));fixed !important; background: -moz-linear-gradient(#f4f5f5, #cdd6de);fixed !important; background: linear-gradient(#f4f5f5, #cdd6de);fixed !important; -pie-background: linear-gradient(#f4f5f5, #cdd6de);fixed !important; behavior: url(/pie.htc); } javascript: <script src="js/jquery-1.4.4.min.js"></script> <script src="js/slides.min.jquery.js"></script> <script src="js/jquery.easing.1.2.js"></script...

Porting iOS app to Android -

we made quit big ios application 2000+ objective c classes. wondering there best practice guide port android ? looking @ visual paradigm (uml) reverse engineers objective c files uml. enterprise architect allows me generate code(headers + declaration) popular language java or c++. there other approaches yet ? also, our app heavily using uinavigation , uiview controllers, wondering there similar model , implementation on android. thanks far, guenter in honesty, think planing going make crappy code insanely hard maintain. realize sounds lot of work, gonna easier in long run, "port" concept of app android , write ground up.

iphone - NSURLConnection retry request -

how can request retry on nsurlconnection? in connectiondidfinishloading method possible store , later retry connection? i looked @ [connection start], did not seem anything. connection object still contain original request? thanks it's not stated explicitly, still documentation suggests nsurlconnection instance isn't intended reused: nsurlconnection retains delegate when initialized. releases delegate when connection finishes loading, fails, or canceled. if delegate released, there's no point in reanimating connection object.

Javascript functions -

i have 3 javascript functions: validateclk() , validateampm() , getclks() and on 2 occurring events, executed follows: onchange - executes validateclk() , validateampm() onclick - executes getclks() ( getclks() returns boolean value) all 3 functions run correctly, problem is, after getclks() has finished execution , returns boolean, next function postclocks() doesn't run. i'm sure code postclocks() correct well. if don't use return statement getclks() getclks() function doesn't work expected. please :( <script type='text/javascript'> function validateclk() { .... var clks = clocks.value; if (clks == "") { alert('enter time'); } else { ... } } </script> <script type='...'> function validateampm() { ... var ampm= ap.value; if (ampm=="") { alert('enter or pm'); } ...

jquery - Applying fancybox on future elements? -

is possible apply fancybox(or lightbox alternative) on elements loaded hquery's load() ? if so, how? assuming you're loaded elements classed "loadedelement" $(".loadedelement").live("load", function() { // implement lightbox code }); or if want implement lightbox before images have finished loading, change "load" "ready"

garbage collection - destructors on gc-ed lua objects -

i know lua gc-ed. know lua can deal c objects via userdata. here question: there anyway register function it's called when c userdata object gc-ed lua? [basically destructor]. thanks! yes, there metamethod called __gc purpose. see chapter 29 - managing resources of programming in lua (pil) more details. the following snippet creates metatable , registers __gc metamethod callback: lual_newmetatable(l, "someclass"); lua_pushcfunction(l, some_class_gc_callback); lua_setfield(l, -2, "__gc");

user experience - WPF: Editable ComboBox; how to make search/auto-fill functionality case sensitive? -

say have combobox , so: <combobox iseditable="true" height="30"> <comboboxitem>robot</comboboxitem> <comboboxitem>robot</comboboxitem> </combobox> if user comes along , starts typing lower-case r combobox when empty, combobox predictably auto-fills word robot . great. now same user comes along , starts typing upper-case r combobox when again empty. unpredictable, combobox auto-fills lower-case word robot . not great. desperately want auto-fill robot , wpf not seem want smile down upon me. no matter (caps lock, shift+key), combobox auto-fill lower case robot , provided lower case robot precedes upper case robot in combobox's items collection. is there way prevent this? behavior maddening , makes absolutely abysmal user experience. in .net 4 can set istextsearchcasesensitive=true on combobox (or indeed itemscontrol)

r - Applying an aggregate function over multiple different slices -

i have data array contains information people , projects such: person_id | project_id | action | time -------------------------------------- 1 | 1 | w | 1 1 | 2 | w | 2 1 | 3 | w | 2 1 | 3 | r | 3 1 | 3 | w | 4 1 | 4 | w | 4 2 | 2 | r | 2 2 | 2 | w | 3 i'd augment data couple of more fields called "first_time" , "first_time_project" collectively identify first time action person seen , first time developer saw action on project. in end, data should this: person_id | project_id | action | time | first_time | first_time_project ------------------------------------------------------------------------ 1 | 1 | w | 1 | 1 | 1 1 | 2 | w | 2 | 1 | 2 1 | ...

c++ - when to use const char * -

if have function api expects 14 digit input , returns 6 digit output. define input const char *. correct , safe thing do? why not want char * seems more prudent use const char * in case since api providing. different input values generate 6 digit codes. when const char *c telling compiler not making changes data c points to. practice if not directly modifying input data.

arrays - Can JavaScript data be attached to HTML elements? -

i have array (below) var img_name = new array("images/test.jpg", "images/test.jpg"); var imgtotal = img_name.length; var rnd_no = math.floor(imgtotal*math.random()); var ojimg = img_name[rnd_no]; what need pass piece of information , attach body tag. so. if test1.jpg loaded need pass "light" body tag , if other image selected need pass "dark". alows user in cms select light or dark theme depending on image. image output randomly. how nested arrays: var img_name = [["images/test1.jpg", "light"], ["images/test2.jpg", "dark"]]]; var imgtotal = img_name.length; var rnd_no = math.floor(imgtotal*math.random()); var ojimg = img_name[rnd_no][0]; var cssclass = img_name[rnd_no][1];

How do you convert binary to decimal if the binary was 1.01? -

what 1.01 binary in decimal? just remember use positional numbering system. 1101 = 2^0 + 2^2 + 2^3 = 1 + 4 + 8 = 13 1.01 = 2^0 + 2^(-2) = 1 + 1/4 = 1.25

mysql - Pagination w/ query data in url for initial search submission not holding but all subsequent pages have url params -

how can paramaters passed url on first submission? all subsequent pagination requests (such when hit next>>) display proper url parameters (/35/0/...): .../plans/search/35/0/0/0/97378/page:2 but on first search results page, parameters not passed (but results correct), url looks this: .../plans/search/ so when try sort on first page: <?php $this->paginator->sort('sort monthly cost','monthly_cost');?> the results cleared because no parameters present. every subsequent page (starting @ page:2) sort works fine because params in url. i need know how pass params url on initial search. i've been trying variations of in view: $this->paginator->options(array('url' => $this->passedargs)); but can't them pass.. solved! in view, had instance of: options = array('url'=>$searchdetails); ?> below paginator counter near page footer. i took same: options = array('url'=>$s...

php - Combining Data from two MySQL tables -

i'm trying combine data 2 tables in mysql php. i want select data (id, title, post_by, content , created_at) "posts" table. then select comment_id count "comments" table if comment_id equals posts id. finally, echo/print on order: <? echo $row->title; ?> posted <? echo $row->post_by; ?> on <? echo $row->created_at; ?> cst <? echo $row->content; ?> <? echo $row->comment_id; ?> comments | <a href="comment.php?id=<? echo $row->id; ?>">view/post comments</a> i'm uncertain how "combine" data 2 tables. have tried numerous things , have spent several evenings , have had no luck. any appreciated! select p.id, p.title, p.post_by, p.content, p.created_at, count(c.comment_id) posts p left join comments c on p.post_id = c.comment_id group p.id, p.title, p.post_by, p.content, p.created_at

java - Error database not open -

hey i'm trying insert data in sqlite database, everytime try insert logcat shows error. error ir shown on service gets calllog data , insert in db. error: 02-15 17:07:51.658: error/androidruntime(25392): java.lang.illegalstateexception: database not open and error in line of service class: db.insert(datahandlerdb.table_name_2, null, values); here service: public class theservice extends service { private static final string tag = "theservice"; private static final string log_tag = "theservice"; private handler handler = new handler(); private sqlitedatabase db; class thecontentobserver extends contentobserver { public thecontentobserver(handler h) { super(h); openhelper helper = new openhelper(getapplicationcontext()); sqlitedatabase db = helper.getwritabledatabase(); } @override public boolean deliverselfnotifications() { return tru...