Posts

Showing posts from April, 2010

java - Why do I need to call a close() or shutdown() method? -

i'm new in java background in c++ in high school years. i'm trying make , chose java programming language. i've done homework , lot "destructors" java, finalize() method, , close() or shutdown() methods. still think don't have idea of how should work (more info below of course) ok, concrete question why need call close() or shutdown() methods? in particular case i'm working class didn't develop handles smart card reader, i've seen case of file management, have call close() method, similar. isn't calling close() method same idea freeing memory in c++ (that sucks)? meaning, have take care of deletion or destruction of object... isn't gc for? it option class i'm trying use smart card reader not best, might better class implements finalize() method when no longer used , ready gc, frees memory (most native code) and/or frees hardware resources gc might not know how do. but file management classes? used , maintained, w

d3.js - Scatterplot is not updating the number of circles -

so here code, in gist, can save html file , try it: https://gist.github.com/babakinks/5407967 so @ beginning assuming default number scatter plot circles, , draw scatter plot var numdatapoints = 50; then @ bottom , have listener redraws scatter plot random new values, , works.. but wanted improve such can type how many circles draw in text box , should draw many circles, not same 50 began with. doesn't listen me! yes redraw circles new random values still drawing same number of circles had @ first . don't know how fix part, pretty new d3.js . way expecting work wrong? //on click, update new data d3.select("#drawbtn") .on("click", function() { you need add enter() , remove() selections: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>yguyghggjkgh</title> <script src="http://d3js.org/d3.v3.min.j

c# - format currency in specific way for only one culture -

i working on multi lingual application shows product prices in different currencies. use .net library format currencies based upon culture eg. cultureinfo current = cultureinfo.currentculture; return value.value.tostring("c", current); a russian client not happy how displays example want 100 руб. showing , not 100,00 р @ moment. is there easy way modify how price string generated without affecting other conversions culture currency? you can use custom price format cultures. example: if have culture table in db. should add custompriceformat column default value "{0:c}". in case can change price formats of cultures. can use this: var pricestring = string.format(currentculture.custompriceformat, d); for russian culture custompriceformat "{0:n} руб".

python yahoo weather xml parse works with 2.7.1 but not 2.6.1 -

#!/usr/bin/env python import subprocess import urllib xml.dom import minidom city_id = '23396898' temp_type = 'c' weather_url = 'http://xml.weather.yahoo.com/forecastrss?w=' + city_id +' &u=' + temp_type weather_ns = 'http://xml.weather.yahoo.com/ns/rss/1.0' dom = minidom.parse(urllib.urlopen(weather_url)) ycondition = dom.getelementsbytagnamens(weather_ns, 'condition')[0] current_outdoor_temp = ycondition.getattribute('temp') print(current_outdoor_temp) this works fine when run on machine running python 2.7.1 not on machine running 2.6.1. problem actual number wrong. have verified i'm pulling elements correctly , can other numeric values without issue. run on 2.7.1 , 12 current celsius temp run in 2.6.1 , 54. what has me more confused works fine fahrenheit in both environments. if put f temp_type work fine. i've confirmed happens on multiple machines. identical deployments issue other 2.6.1. can give me i

sql - Data type mismatch in criteria expression for Access AutoNumber -

rentreturncommand.commandtext = "update customerorder set status = '" &_ orderstatuscombobox.text & "' cid = " & cidtextbox.text & " , compid = " &_ compidtext.text rentreturncommand.executenonquery() rentreturncommand.executenonquery() shows error. i've looked possible solutions change this, nothing works. cid listed in access database autonumber. i know autonumber tends cause problem type of sql involved, need query in program. if type "fred" in textbox, error take place. 2 things validating user input , using query parameters.

Why does javascript change objects into other things when added? -

something interesting adding empty arrays in javascript pointed out me, , have no idea why works way does. adding empty arrays results in string. in other terms, [] + [] returns "" i booted console test it, , sure enough, works. further discovered behavior not limited empty arrays. arrays of numbers, strings, arrays, , objects turn strings when added other array. examples are: [1] + [] //returns "1" [1] + [2] //returns "12" [1,2,3] + [2] //returns "1,2,32" [{foo:'bar'},'foo','bar'] + [] //returns "[object object],foo,bar" it occurs other objects, when added else, if object on right hand side. if it's on left hand side, object turned 0. 'foo' + {foo:'bar'} //returns "foo[object object]" 1 + {foo:'bar'} //returns "1[object object]" {foo:'bar'} + 1 //returns 1 {foo:'bar'} + 'foo' //returns nan this happens unless assign object

php - Apache mod_rewrite for a specific domain under same directory -

i have wrote website using php & yii framework, , there have .htaccess file has mod_rewrite statement use clean url's: options +followsymlinks indexignore */* rewriteengine on rewritecond %{request_filename} -s [or] rewritecond %{request_filename} -l [or] rewritecond %{request_filename} -d rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] for example use domain: www.example.com & popstan.net , , url rewriting these domains works like in dream! however, i'm creating blog, , yii controllers have structure accessing blog articles, blog categories , single blog article: http://example.com/blog/ - lists new articles http://example.com/blog/category/some-category - list articles specific category http://example.com/blog/article/some-alias-path - previews single blog article now, wish use blog, under domain: http://blog.example.com/ , , maintain url structures, , wish not copy website on 2 separate directoryies (ie. blog directory). is po

windows - Find and kill a specific Java process from another Java App -

i have several java processes running on windows machine. have java process supposed monitor other processes , periodically kill or restart new ones. if have java process running com.foo.main1 , 1 running com.foo.main2 - how can monitoring process find , kill main2 process? update: have code can execute command line tasklist.exe , parse it, no matter do, see java.exe process, not class executing update 2: not have ability install non-java programs. it's going lot simpler using os-specific tools , using runtime.exec() run them, i'll try , give platform independent answer: it might possible platform independently using attach api . comes jdk, use include tools.jar jdk on program's classpath. to list of virtual machines on system, use virtualmachine.list() . can get/parse arguments virtual machine descriptor objects returned this. the attach api allows load agents already-running java processes. since want kill java process, can write java agent

php - Identical Zend Navigation code rendering differently on different environments -

anyone got idea causing issue zend navigation. environments provisioned through chef , same os etc, same apache setups etc. on local ubuntu vm, webapp renders correctly. same code fails render navigation on test vm (on aws). when same, i've checked , double checked (and deployed through phing), including scping no-displaying-correctly-code off test onto box, works correctly. i'm totally stuck. know low level quirks how zend renders nav? write temp files or (long shot). issue routing 1 imo. menu doesn't think active, yet using same routes.ini file dev environment, fine. i've tried changing environment settings (development, testing) etc nothing. can't data there no impact on routing. really appreciate insight.. solution! ahh haaaa. nav appears have been broken revision of zend. reason not seen locally, because using vagrant manage vm locally. mounted folder , of course, read-ony filesystem, "ln -s -f symlink" correct vendor of zend silently fa

php - CakePHP adding tables to ACL controlled application -

sorry if noob question, i'm using simple acl controlled application tutorial boilerplate , need add (bake) few more tables. if create new table run "cake bake all" console, how go updating acl well, believe should need update acos table, wrong? there command should use after new models, views , controllers generated? thanks in advance! edit : i'm using aclextras plugin to input of controllers , actions acl. to sync aco using aclextras, run @ command line: php "/cake/lib/cake/console/cake.php" aclextras.aclextras aco_sync

c# - Is there a reason to throw an exception twice? -

Image
debugging production code came across had not seen before , not aware of valid purpose. in several methods of 1 of our controllers have try-catch blocks. interesting part there 2 throw statements in 1 of catches. is there reason have 2 throw statements? if so, in circumstance(s) make sense? try { //statements } catch (soapexception se) { //log statement return null; } catch (exception ex) { //log statement throw; throw; } no there no reason throw twice. second throw never reached. it similar having public int getnumber() { return 1; return 2; // never reached } update resharper great tool check things this. in case grey out second throw , tell unreachable.

SQL Server : Join Two Tables and Return With Null Records -

i couldn't figure out how join these 2 tables , result null value want. played around left join , right join , full outer join ..., couldn't work. please see below. table1 : nameid name 1 n1 2 n2 3 n3 4 n4 5 n5 table2 : nameid anotherid value 1 aid-111 1000 2 aid-222 2000 2 aid-222 3000 3 aid-333 4000 4 aid-444 5000 select ... join table1 , table2 anotherid = 'aid-222' this result want: nameid name anotherid value 1 n1 null null 2 n2 aid-222 2000 3 n3 aid-222 3000 4 n4 null null 5 n5 null null please help. thanks! you did not explain why want return value of 2000 instead of 3000 can use left join subquery result: select t1.nameid, t1.name, t2.anotherid, t2.value table1 t1 left join ( select nameid, anotherid, min(value) value table2 anotherid =

mobile safari - iOS6 redirect to secure pages with invalid SSL certificate not working -

i have page takes users insecure page secure page via redirect, not working on ios6 safari. secure page has invalid certificate testing environment, on ios5 , android 4 given option accept invalid certificate. however, on ios6 page seems unresponsive. the flow like go http://www.mydomain.com/mypage click link returns 302 https://www.mydomain.com/mypage desired result: option accept invalid certificate any ideas on how work? you can visit https version of page first , accept certificate. alternative can create root certificate, install on phone via profile, , use root ca create ssl certificate testing domain.

try catch - c++ error handling return values error returned -

i have class have been given error input handling for. it's class has been given it's own "extraction" operator , i've been asked implement code i've been given. problem i'm having code should use looks similar this. try { while (some condition) {....implemented code....} } catch (runtime_error& e) { cerr << e.what() << endl; return 1; } the problem having compiling doesn't seem "return 1" value gives me error of: invalid initialization of non-const reference of type ‘std::istream& {aka std::basic_istream<char>&}’ rvalue of type ‘int’ if remove return value compiles straight program fails execute once hits area trying try statement. mentioned code have there above example code supposed implement assumed straight out of box work. condition while loop was while (!std::cin.fail()) as assumed i'd want keep getting input until fails reason. why return values in case causing problem?

c# - How do I know which prerequisites my application needs? -

so wrote application , created installer. when tried install on other machines, app wouldn't work. after messing around while, seemed needed select visual c++ runtime libraries prerequisite. i'm wondering if may need other prereqs. how on earth know prereqs app need?

objective c - Does -[NSInvocation retainArguments] copy blocks? -

nsinvocation 's -retainarguments method useful when don't run nsinvocation immediately, later; retains object arguments remain valid during time. as know, block arguments should copied instead of retained. question is, -retainarguments know copy instead of retain argument when it's of block type? documentation not indicate does, seems easy , sensible thing do. update: behavior seems have changed in ios 7. tested this, , in ios 6.1 , before, -retainarguments didn't copy parameters of block type. in ios 7 , later, -retainarguments copy parameters of block type. documentation of -retainarguments has been updated copies blocks, not when behavior changed (which dangerous people support older os's). it's supposed (albeit haven't test myself). according documentation : retainarguments if receiver hasn’t done so, retains target , object arguments of receiver , copies of c-string arguments , blocks. (void)retainargumen

objective c - Is CFRelease necessary here to prevent a leak? -

Image
so i've heard new alloc , copy create new memory on heap responsible for. want make sure case c-function in core graphics: myivar=cgdataprovidercopydata(cgimagegetdataprovider(cgimage)); does mean must release later like: cfrelease(myivar); in other words, if re-assign myivar later without release statement, cause leak? regarding comments, i've uploaded screenshot: the commented-out line works fine. prior line have m_parsedimage = cgdataprovidercopydata(cgimagegetdataprovider(cgimage)); works fine. yes, function copy or create in name, convention, returns must release. in case, quick @ docs cgdataprovidercopydata shows: return value new data object containing copy of provider’s data. responsible releasing object. please take moment check docs before posting such questions. save lots of time. :)

css - Dynamic height in JQuery -

i'm having bit of trouble block of jquery code sets height of menu bar based on width of logo contained therein. problem site responsive design, logo's width varies depending on how wide window is...and reason, code works when first load page, doesn't continue resize menu bar logo gets resized page window. appreciated; here's code: $(document).ready(function(){ var logowidth = $('#logo').css('width'); //get width of logo var newheight = parseint(logowidth) * 0.34666667; //calculate resultant height of menu-bar $("#grey-section").height(newheight ); //set new height of menu-bar }); you do $(window).on('resize', function() { var logowidth = $('#logo').css('width'); //get width of logo var newheight = parseint(logowidth) * 0.34666667; //calculate resultant height of menu-bar $("#grey-section").height(newheight ); //set new height of menu-bar }); edit: you'll have leave

ip address - Converting subnet mask prefix with C -

i'd convert prefix /24 255.255.255.0 using bitwise operations. i have tried using unsigned int so: unsigned int mask = -(1 << 32 - prefix); i thinking of creating while loop adds 1 correct place , decrements 0. all appreciated! use unsigned long mask = (0xffffffff << (32 - prefix)) & 0xffffffff; printf("%lu.%lu.%lu.%lu\n", mask >> 24, (mask >> 16) & 0xff, (mask >> 8) & 0xff, mask & 0xff);

Google Maps InfoWindow has horizontal scroll bar -

i have issue horizontal scroll bars appearing on infowindow popup when there lot of content inside. fine when there small amount of content doesn't go below height. seems calculate size before knowing content goes below height, doesn't factor scroll bar width in. i have set width of containing div i'm passing 480px, getting inserted div 460px, hence scroll bar. i've tried width auto well. haven't managed find solution answers other similar questions i've read. i have created jsfiddle show i'm talking about: http://jsfiddle.net/th7yt/1/ having vertical scroll bar acceptable, don't want horizontal one. hopefully able me figure out how rid of it. thanks. for want see code here: html <div id="map-canvas"></div> css #map-canvas { width: 1017px; height: 500px; margin-top: 50px; } .branch-location { width: 480px; padding-top:10px; margin-bottom: 20px; } .branch-location .block-title {

orchardcms - Orchard Pager For Module Admin -

so i've written simple module, , i'm displaying list of specific contentitems through adminmenu. works fine exception of pager. pager displaying count all contentitems, , not filtered list. i'm sure it's simple i'm missing, can't quite figure out. here controller code: public actionresult list(listcontentsviewmodel model, pagerparameters pagerparameters) { var pager = new pager(_siteservice.getsitesettings(), pagerparameters); var query = _contentmanager.query<eventpart>(versionoptions.latest); switch (model.options.orderby) { case contentsorder.modified: query.orderbydescending<commonpartrecord>(cr => cr.modifiedutc); break; case contentsorder.published: query.orderbydescending<commonpartrecord>(cr => cr.publishedutc); break; case contentsorder.created: query.orderbydescending<common

php - What's the way to go when inserting values to multiple tables? -

i'm inserting values onto employees table using in controller: $this->employee->create(); if ($this->coreprogram->save($this->request->data)) { $this->session->setflash('program has been added.'); $this->redirect(array('action' => 'index')); } else { $this->session->setflash('unable add record.'); } however, want insert record table audit . more specifically, current date along employee_id field used employees . best approach this? should create $this->audit->create(); ? or there better way? use insert trigger on employees table inserts audit entry audit table: create trigger tr_employees_ins on dbo.employees insert begin insert dbo.audit( [op] ... employee_id ...) select 'ins' ... employee_id inserted end

java - Compare two binary trees to see if they have the same structure -

Image
another easy 1 can't seem it. need write method compares structures of 2 binary trees , returns weather same or not. data , data types not important structures. here examples: here code have far. think close. public boolean samestructure(orderedset<e> other) { if (other.size() != size) return false; return samestructurehelp(other, root, other.root); } private boolean samestructurehelp(orderedset<e> other, treenode ref, treenode otherref) { if (otherref == null && ref != null) return false; if (otherref != null && ref == null) return false; samestructurehelp(other, ref.left, otherref.left); samestructurehelp(other, ref.right, otherref.right); return true; } what pasted right, missing critical piece: instead of checking left , right subtrees, should return and value, mean if trees rooted in current nodes satisfies condition being same stucture.

php - Getting Paypal Return string into mysql database? -

public function run() { $postfields = 'cmd=_notify-validate'; foreach($_post $key => $value) { $postfields .= "&$key=".urlencode($value); } $ch = curl_init(); curl_setopt_array($ch, array( curlopt_url => $this->_url, curlopt_returntransfer => true, curlopt_ssl_verifypeer => false, curlopt_post => true, curlopt_postfields => $postfields )); $result = curl_exec($ch); curl_close($ch); $fh = fopen('result.txt', 'w'); fwrite($fh, $result . ' -- ' . $postfields); fclose($fh); echo $result; } } ?> i result in text file so: ?cmd=_notify-validate&test_ipn=1&payment_type=instant&payment_date=02:39:41 oct 06, 2011 pdt&payment_status=completed&address_status=confirmed&payer_status=verified&first_name=john&a

ssl - Transport Security with WCF, IIS, along with client authentication.. is it possible or not? -

i can find out few similar questions on regarding this, quite unsure answer this. more , more confused read through different posts on this. asking satisfaction. i have wcf service hosted on iis. , have client connects service , invokes method. try use certificates make use of transport security. on client side have config <bindings> <basichttpbinding> <binding name="testbinding"> <security mode="transport"> <transport clientcredentialtype="certificate" proxycredentialtype="basic"/> </security> </binding> </basichttpbinding> </bindings> <behaviors> <endpointbehaviors> <behavior name="testbehavior"> <clientcredentials> <clientcertificate storelocation="localmachine" storename="my" x509findtype="findbysubjectname" findvalue="client007"/> </clien

asp.net - Download file from server -

i have asp.net/c# page. has textbox accept user input. data processed on server , file generated , saved. initially transmitted file client using response.transmitfile() . however, process disables javascript on page when file downloaded. therefore, have designed .ashx handler download file. now, there 2 buttons on page. user clicks on 1 process , create file. once page postbacks, other button enabled , should clicked download file (invoke handler). what want know how can wire button call handler? note: need send parameter handler query string. parameter available in code behind. if want button, request, take approach: aspx: <asp:button id="btndownloadfile" runat="server" onclick="btndownloadfile_click" /> code-behind: protected void btndownloadfile_click(object sender, eventargs e) { response.redirect(string.format("/file.ashx?id={0}", myparameter); }

x++ - What is the _isMexican boolean for in the Global::Checkpower method? -

quite simply, method for, , _ismexican? online searching has proven futile. http://msdn.microsoft.com/en-us/library/global.checkpower.aspx this has how dynamics ax translates numeric currency values text. try creating new job in aot following contents: static void job1(args _args) { info(global::numeralstotxt_es(120000.45,gendermalefemale::female,0,"mxn",1,0)); } the parameters follows: currency amount gender enclose (not certain) iso currency code ismexican boolean ischeck boolean with ismexican = 1, outputs result: ciento veinte mil 45/100 with ismexican = 0, outputs result: ciento veinte mil con cuarenta y cinco centimos so basically, text formatter translation of currency amounts given language. languages or countries have specific ways want written form appear, boolean influences it. the checkpower method part of logic, , recursively calls iterate on powers of given currency (billions, millions, etc), each time adding proper word

google cloud storage - gsutil error on Windows 7x64 Professional -

windows 7x64 professional gsutil error: c:\users\chris>gsutil.py ls failure: invalid literal int() base 10: ''. i have verified settings according installing gsutil doc. what doing wrong, or wrong installation document should corrected work? python version: 2.7.4 edit: here output of gsutil debug switch: c:\>python c:\gsutil\gsutil -d ls ***************************** warning ***************************** *** running gsutil debug output enabled. *** aware debug output includes authentication credentials. *** not share (e.g., post support forums) debug output *** unless have sanitized authentication tokens in *** output, or have revoked credentials. ***************************** warning ***************************** traceback (most recent call last): file "c:\gsutil\gsutil", line 72, in <module> gslib.__main__.main() file "c:\gsutil\gslib\__main__.py", line 151, in main command_runner.runnamedcommand('ver') file "

axapta - Order by Sum Field -

i try write sql-statement in x++. should this: select table.field1, sum(table.field2) sumfield table table.fieldx = group table.field1 order sumfield; the problem have in x++ orders records before calculating sum of them. know make while select in x++ , order them code, not way want it. can tell me how handle this? sorry, cannot both sort by , group by in x++ select or query. the solution make view (without sort), select on view order by.

linux - Redirect multiple folders to single folder -

i wonder if it's possible following: so, when new hosting, start few folders right? .. , add few more folders, css, js, imgs, assets, media... , on, after 1 year have 20 folders, girlfriend special card, cousin school project, dad's portfolio, few "clients" mom sent them charity page, , on, after few years have 100 folders! crazy!the 80% of of folders active, have many facebook fanpage fancy iframe... , on.. so question, how can send of request folders different folder, have: domain.com      |_css      |_js      |_folder1      |_fancy1      |_mydadprofile      |_mysisterpictures      |_imgs picture... what following domain.com      |_css      |_js      |_oldstuff      |    |_folder1      |    |_mydadportfolio      |    |_fancy1      |    |_mysisterpictures      |_imgs if user request dad's portfolio gets redirection new folder if go facebook fanpage , see iframe page still able see informa

java - Why interface method scope is only public? -

this question has answer here: protected in interfaces 12 answers in interfaces why method access specifier public why not protected ? interface ipractice { void test(); // public protected void test2(); // why not allowed } can 1 explain me this. the whole point of interface exposes methods outside world implementation details can hidden. what happens inside interface should not known outside world.

java - Cannot insert item into array after deleting another item -

i can delete items array, when try insert item fails on nullpointer exception. happens after deleting. inserting items works normally. thank in advance. this determines insert new item array stays in order public int appropriateposition(comparable ap){ int temp = top; if(temp == -1){ temp = 0; } else { for(int = 0; <= top; i++) { if(ap.compareto(sa[i])>0) { temp = + 1; } } } return temp; } this uses index found in appropriatepostion public void insert(comparable a){ int loc = appropriateposition(a); if(full() == true) { int expandedsize = sa.length + incrementamount; comparable[] temparray = new comparable[expandedsize]; for(int i= 0; < sa.length; i++) { temparray[i]= sa[i]; } sa = temparray; } for(int = top; >= loc; i--) { sa[i+1] = sa[i]; } sa[loc]

ruby - how to enable youtube or vimeo embed in ckeditor in rails -

i using ckeditor gem rich textarea in rails application. want attach youtube or vimeo videos , upload video local file system function in ckeditor can't find solution. suggestion? for solve task i'm added toolbar 'iframe' button config.js: ckeditor.editorconfig = function( config ) { config.toolbar_easy = [ ... {name: 'insert', items : [ 'image', 'flash', 'table', 'iframe' ] } ... ]; };

bin/hadoop version throws an error in CYGWIN [WIndows 7] -

when execute following command: anands@tx-d-anands /usr/local/hadoop-1.1.2 $ bin/hadoop version i following error: cygwin warning: ms-dos style path detected: c:\program_files\java\jre6\x0d/bin/java preferred posix equivalent is: /cygdrive/c/program_files/java/jre6\x0d/bin/java cygwin environment variable option "nodosfilewarning" turns off warning. consult user's guide more details posix paths: http://cygwin.com/cygwin-ug-net/using.html#using-pathnames /bin/java: no such file or directoryes\java\jre6 /bin/java: no such file or directoryes\java\jre6 /bin/java: cannot execute: no such file or directorye6 can me this? appreciated! set system environment variable java also set export java_home=c:/program_files/java/jre6 in hadoop-evn.sh file.

shooting intervals in cocos2d without CACurrentMediaTime() -

i have ship , want make shoot every 1 sec. here's did, @property (nonatomic, assign) float lastdamagetime; and in update method, if (cacurrentmediatime - self.lastdamagetime > 1) { self.lastdamagetime = cacurrentmediatime; [self shoot]; } but problem is, pause game right after ship shoot bullet, , 1 sec later, resume game, if statement pass check, , ship shoot bullet immediately. , that's not want. so, can make sure ship fire bullets each sec weather pause game or not? should use cctimer instead? thank in advance answer. you try , schedule shoots ccrepeatforever action, cocos2d deals pause you. it'd (assuming you're inside custom shipsprite ).- ccdelaytime *delay = [ccdelaytime actionwithduration:1.0]; cccallfunc *funcshoot = [cccallfunc actionwithtarget:self selector:@selector(shoot)]; ccrepeatforever *repeat = [ccrepeatforever actionwithaction:[ccsequence actionone:delay two:funcshoot]]; [self runaction:repeat];

air - How to manage Two WindowedApplication in Flex? -

case: 1) there 2 .mxml files (windowed application): 1 log-in(active window/ start window) , other main window. 2) main window has viewstack 3) on log-in successful, log-inhandler called main window. 4) log-inhandler access viewstack id of main window. 5) viewstack id shows null. question: 1) how solve case? you should not use 2 windowed applications make login page mxmlcomponent add login page new nativewindow main app, can communicate it.

node.js - How do I install mailparser module via npm on Windows 7 x64? -

apologies if there obvious i'm missing, i've never encountered error before using npm: c:\work\spark3>npm install mailparser npm http https://registry.npmjs.org/mailparser npm http 304 https://registry.npmjs.org/mailparser npm http https://registry.npmjs.org/encoding npm http https://registry.npmjs.org/mime npm http https://registry.npmjs.org/mimelib npm http https://registry.npmjs.org/iconv npm http 304 https://registry.npmjs.org/mime npm http 304 https://registry.npmjs.org/mimelib npm http 304 https://registry.npmjs.org/encoding npm http 304 https://registry.npmjs.org/iconv npm http https://registry.npmjs.org/iconv-lite/0.2.7 npm http https://registry.npmjs.org/addressparser npm http 304 https://registry.npmjs.org/iconv-lite/0.2.7 npm http 304 https://registry.npmjs.org/addressparser > iconv@2.0.4 install c:\work\spark3\node_modules\mailparser\node_modules\iconv > node-gyp rebuild c:\work\spark3\node_modules\mailparser\node_modules\iconv>node "c:\pr

javascript - How can I pass a filename to wiston logger constructor? -

log.js : var winston = require('winston'); var logger = new (winston.logger)({ transports: [ new (winston.transports.console)({ json: false, timestamp: true }), new winston.transports.file({ filename: **get outside**, json: false }) ], }); module.exports = logger; a.js , want log own logfile var logger = require('./log')('log_to_this_file'); <=== how can pass filename in? logger.info('log file'); b.js , want log own logfile var logger = require('./log')('log_to_another_file'); <=== how can pass filename in? logger.info('log file'); i dont know how write log.js filename outside. how can that? can't add new logger in b.js? var winston = require('winston'); // // configure logger `category1` // winston.loggers.add('category1', { console: { level: 'silly', colorize: 'true', label: 'category one' }, fi

iphone - How can i remove array of dictionary from NSMutableDictionary? -

i have dictionary of array (inside that, array , dictionarry). i added uitableviewcelleditingstyledelete in uitableview, want remove specific array of dictionary dictionary. console view of data: { = ( { address = "talala (gir)"; "main_id" = 1; mobile = 8878876884; name = "amit patel"; }, { address = "junagdh"; "main_id" = 5; mobile = 4894679865; name = "arjun patel"; } ); j = ( { address = "taveli"; "main_id" = 6; mobile = 87886356085878; name = "jasmin patel"; }, {

matlab - Neat way of generating rectangle coordinates from two corner points? -

i'm plotting box in matlab 4 coordinates. there neater way generate these vectors writing them out explicitly? plot( ... [x_min x_max; x_min x_max; x_min x_min; x_max x_max], ... [y_min y_min; y_max y_max; y_min y_max; y_min y_max], ... '-r' ); in case, variables called lat_min , ax_min , means above lines won't fit 80 characters. , i'd that, since i'm going print code. how using rectangle : pos = [ax_min, lat_min, ax_max - ax_min, lat_max - lat_min]; rectangle('position', pos, 'edgecolor', 'r')

android - Fragment webview java script function is not working -

i have dynamically created action bar , tabs. have define class tab fragments below code. public static class tabfragmentclass extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { // todo auto-generated method stub try { linearlayout=new linearlayout(sactivecontext); linearlayout.setlayoutparams(new layoutparams(layoutparams.fill_parent,layoutparams.fill_parent)); linearlayout.setorientation(linearlayout.vertical); customwebview webview=new customwebview(sactivecontext); framelayout layout=webview.createwebview(); (int = 0; < arraylist.size(); i++) { if(sactionbar.getselectedtab().getposition()==i) { webview.initwebview(arraylist.get(i)); mwebviewlist.add(i, webview); break; } } linear

javascript - Windows store app - addEventListener on class -

i realize not possible add addeventlistener on document.getelementbyclassname selector. have several buttons identical functionality. can somehow? ok can use id selector, way i'll have add more code lines "needed". with jquery: $(".class").on("click", somefunction); why not iterate through array returned document.getelementsbyclassname()? var elements = document.getelementsbyclassname('foo'); (var = 0; < elements.length; i++) elements[i].addeventlistner('someevent', eventhandler(evt), false); it might not succinct jquery equivalent gets job done. alternatively, use jquery in app(personally, haven't tried out).

css - How to reset all default styles of the HTML5 button element -

Image
scenario i use <button> element appeares plain text "+" on right end. on click div element expands , reveals information. think button element semanticaley correct represent such ... button ... trigger. problem so have mixed buttons , h2 elements , have got visual problem. after resetting default user agent style's expect every element introduce document looks plain , unstyled. but button element not plain. has text, slightly, text indention. example first, 3 elements <h2><button>text node</button></h2> , 2 above <h2>text node</h2> css * { /*reset's every elements apperance*/ background: none repeat scroll 0 0 transparent; border: medium none; border-spacing: 0; color: #26589f; font-family: 'pt sans narrow',sans-serif; font-size: 16px; font-weight: normal; line-height: 1.42rem; list-style: none outside none;

javascript - I'm not sure that my ajax navigation works fine -

i tried make menu history api. seems me works not fine, , got reasons think so: 1 "title" not changing 2 if click fast on links got blink of page reloaded shouldn't!(but if click slow ok. how prevent reload or blinking?) please tell me waht wrong $(document).ready(function(){ sliderstartup() //menu click $('.navigation').click(function(){ //fill storage var storage = { url: $(this).children('a').attr('href'), title: $(this).children('a').attr('title') }; history.pushstate(null, storage.title, storage.url ); $.ajax({ url: $(this).children('a').prop("href"), cache: false, success: function(data){ //if data return css notation (eg: #id) of location of title name jqobj = $(data); var addsmth = jqobj.find('#central').html(); $("#central").html('').html(addsmth); sliderstartup() } }); return false; }); function sli

Using PHP/MySQL with Google Maps with Autocomplete searchbox -

i using https://developers.google.com/maps/articles/phpsqlajax_v3 <!doctype html > <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title>consultants map</title> <script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> //<![cdata[ var customicons = { restaurant: { icon: 'http://labs.google.com/ridefinder/images/mm_20_blue.png', shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png' }, bar: { icon: 'http://labs.google.com/ridefinder/images/mm_20_red.png', shadow: 'http://labs.google.com/ridefinder/images/mm_20_shadow.png' } }; function load() {

javascript - How to add circle points for multiline chart? -

in example (jsfiddle.net/vinhnguyenle/lg8qe/2/), how can add circle points 2 line charts? add @ bottom of script: svg.selectall("circle.line2") .data(data) .enter().append("svg:circle") .attr("class", "line") .style("fill", "blue") .attr("cx", valueline2.x()) .attr("cy", valueline2.y()) .attr("r", 4.5);

image - LiipImagineBundle and 'filter not defined' -

i installed liipimaginebundle. config.yml: liip_imagine: filter_sets: my_thumb: quality: 75 filters: thumbnail: { size: [120, 90], mode: outbound } appkernel.php: $bundles = array( ... new liip\imaginebundle\liipimaginebundle(), ); and when want use filter: <td><img src="{{ asset('images/zestawy/'~entity.zdjecie) | imagine_filter('my_thumb') }}" /></td> i error: an exception has been thrown during rendering of template ("filter not defined: my_thumb") whats wrong? have set route in routing.yml? _imagine: resource: . type: imagine also make sure have cleared cache php app/console cache:clear --env="dev" php app/console cache:clear --env="prod"

linux - HOW to solve the point in Regex? -

the file is: google.com go.gle.com google.com.google.com b google.com.cloud.com c when use way: grep -nre '^\<google.com\> ' file<br> i can get: 1:google.com but way: grep -nre '^\<go.gle.com\> ' file<br> also : 1:google.com 2:go.gle.com i want result " grep -nre '^\<go.gle.com\> ' file " is: 2:go.gle.com not 1:google.com how solve it? ps: domain name in grep command "google.com" not fixed. maybe "goog.e.com" or ".oogle.com" what you're looking ( literal match ) not possible grep options because grep treat matching pattern regex , hence dot mean any character . you can use -f switch in grep or use fgrep fixed string match result: grep -nf 'go.gle.com ' infile or: fgrep -n 'go.gle.com ' infile alternatively following awk command give output you're looking for: awk 'index($1, "go.gle.com"){pri

ajax - Youtube API, nexturl and XMLHttpRequest -

i've managed upload video youtube via cors , xmlhttprequest can provide progress bar on uploads. after upload gets 100% , video appears in youtube channel, error handler called. i think nexturl parameter has provided part of form action. has come across , have workaround? i've seen ( can upload youtube without full page refresh using formdata? ) on stackoverflow doesn't don't want host videos on our servers. cheers simon

sql - Creating teigger error in mysql 5.59 -

everyone. want count id's count in a(a table) when after inserting record,my sql bleow: create trigger check_data_count after insert on each row begin select @data_count:=count(*) id = new.id; end; as see, had make mistakes(^_^). my mysql version info: ver 14.14 ditrib 5.5.9,for win64(x86).the error message is: error code : 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '' @ line 8 execution time : 00:00:00:000 transfer time : 00:00:00:000 total time : 00:00:00:000 --------------------------------------------------- query : end error code : 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near 'end' @ line 1 execution time : 00:00:00:000 transfer time : 00:00:00:000 total time : 00:00:00:000 at last, everyone. it not possible select, update, delete on same table trigger fired. from mysql reference manual : b.5.9: can trigg

c# - DataServiceCollection to a String -

i have dataservicecollection , want pull out info , put string. private dataservicecollection<p.groups> groups; public dataservicecollection<p.groups> groups() { if (groups == null) { uri proot = new uri("http://localhost:19297/wcfdataservice1.svc/"); p.entities data = new p.entities(proot); var query = (dataservicequery<p.groups>)data.groupsset; groups = new dataservicecollection<p.groups>(); groups.loadasync(query); } return groups; } protected override void loadstate(object navigationparameter, dictionary<string, object> pagestate) { var g = groups(); this.defaultviewmodel["groups"] = g; } i can bind xaml page no problem, want put "g" string. may using linq, g.items.aggregate((i, j) => + delimeter + j) from post: concat strings inside list<string> usin

jquery - breezejs inlineCount is not working (CORS cross domain http request) -

here's query: var query = breeze.entityquery .from("mandates").skip(offset).take(pagesize).inlinecount(true); return manager.executequery(query); in response headers, can see count returned server: x-inlinecount:63 however, in succeed handler when do: var results = data.results; var recordcount = data.inlinecount; results contains correct records. data.inlinecount null. how come ? edit getallresponseheaders not return headers ! i've noticed of them missing, including x-inlinecount. i believe because i'm doing cross-domain http request (website in localhost webapi (web service) on server on domain). how can fixed ? i had same problem. have configure server expose x-inlinecount header. if using project asp .net web api have put next lines in web.config: <system.webserver> <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="