Posts

Showing posts from July, 2012

command line - Set Environment Variables Windows -

first off, i'd apologise if has been covered. it's difficult filter through existing issues similar one. so in windows there 2 (as far i'm aware) ways set environment variables. first 1 through command prompt , second through system properties in control panel. the former more desirable me have issue variable lasts , exists in session. gets considerably annoying when have re-set java path every time. the latter have resort to, takes time , once in blue moon i'll forget locate menu. is there have in command prompt set permanently? possibly flag or switch append command? the setx command can modify environment variables persistently: setx provides command-line or programmatic way directly , permanently set system environment values. it's quite powerful tool read notes on page though because there few little catches using it.

regex - Non-greedy match from end of string with regsub -

i have folder path following: /h/apps/new/app/k1999 i want remove /app/k1999 part following regular expression: set folder "/h/apps/new/app/k1999" regsub {\/app.+$} $folder "" new_folder but result /h : many elements being removed. i noticed should use non-greedy matching, change code to: regsub {\/app.+?$} $folder "" new_folder but result still /h . what's wrong above code? non-greedy means try match least amount of characters , increase amount if whole regex didn't match. opposite - greedy - means try match characters can , reduce amount if whole regex didn't match. $ in regex means end of string. therefore something.+$ , something.+?$ equivalent, 1 more retries before matches. in case /app.+ matched /apps , first occurrence of /app in string. can fix being more explicit , adding / follows /app : regsub {/app/.+$} $folder "" new_folder

arrays - Output goes stray at START and at END of a java loop -

i writing code translating signals 1 form form. code works fails ends. input: string [] test = {"b","100","b","b","2","3","100","b","200","b","3","17","b","10" }; required output: b/101 b/1 b/106 b/201 b/21 b/11 got output: b/1 b/101 b/1 b/106 b/201 b/21 comparison of required output , got output first term b/1 not required in got output. b/11 missing @ end in required output. algorithm: "b" replaced "b/", , followed addition of numbers appearing in strings "2", "3","100" gives 105 , "1" added "b" hence 106 , final result becomes 'b/106'. i new comer java , programming. need required output. this code: public class signalconversion { public static void main(string args[]) { string [] test ={"b...

wix - Second elevation dialog -

i have simple application in i'm installing exe , running @ end of installation. when installation finished shows second elevation dialog app.exe don't want show, here wix code. <?xml version="1.0" encoding="utf-8"?> <!-- following 3 sections how to: add file installer topic--> <directory id="targetdir" name="sourcedir"> <directory id="programfilesfolder"> <directory id="applicationrootdirectory" name="my application name"/> </directory> </directory> <directoryref id="applicationrootdirectory"> <component id="app.exe" guid="12345678-1234-1234-1234-222222222223"> <file id="app.exe" source="mysourcefiles\app.exe" keypath="yes" checksum="yes"/> </component> </directoryref> <feature id="mainapplication" title="main a...

How to enable FinderSync Extension in the System Preference in Cocoa - Objective C -

Image
i integrating findersync extension in cocoa application show badges in files , folders. @ below 2 scenario: 1) when run application using findersync extension (like demofindersync) @ blue popup in below image, in case extension added in system preference check mark , called principal class "findersync.m" well. 2) when run application using application scheme (like demoapp) @ blue popup in below image, in case extension added in system preference without check mark , principal class "findersync.m" not call , findersync extension not work in case. so have idea how enable finder extension in system preference using second scenario. any appreciated..!! non-debug scheme (#if !debug): system("pluginkit -e use -i com.domain.my-finder-extension"); when running under debugger give path extension directly: nsstring *pluginpath = [[[nsbundle mainbundle] builtinpluginspath] stringbyappendingpathcomponent:@"my finder extensi...

magento - How to change page title for blog in neotheme nblog -

Image
i have magento site, have installed neotheme's nblog magento extension . extension uses " frontend url key's " value blog page title. want change title of wish. digged extension code no solution. appreciated. instead of hard coding 'title' value blog, can create option in extension's back-end configuration add blog page title. required make following changes:- 1.under community/neotheme/blog/etc/system.xml around line no. 149 add '' tag(underneath: tag) 'new blog page title option' in configuration:- <blog_page_title translate="label" module="neotheme_blog"> <label>blog page title</label> <comment><![cdata[this appear title blog page only]]></comment> <frontend_type>text</frontend_type> <sort_order>56</sort_order> <show...

c# - Error in my XAML Project -

i made windows app , done changes when start debug(run) app, following error occurred can please. error 1 not write output file 'c:\users\muhammadashbal\documents\visual studio 2012\projects\hotel\hotel\obj\debug\intermediatexaml\hotel.exe' -- 'access denied. ' c:\users\muhammadashbal\documents\visual studio 2012\projects\hotel\hotel\csc hotel i tried many ways in vain. try below: a) open vs administrator , build , run. b) open project folder, check property of folder, un-check read option , try building solution.

ios - selected row in custom cell doesn't pass complete data from segue to another view controller -

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath{ self.data= [self.namelist objectatindex:indexpath.row]; self.data= [self.rolllist objectatindex:indexpath.row]; [self performseguewithidentifier:@"detailvc" sender:self]; } i've displayed student's name , roll number in custom cell. when select 1 row pass data uiviewcontroller , display in labels. i've 1 nsobject type file called 'name' , i've 1 variable called 'data' of type 'name'. here's code in didselectrowatindexpath namelist overlapped rolllist stored on same variable self.data . if rolllist line removed works good. when store rolllist in self.data overlap other. where, self.namelist variable of type nsmutablearray contains name of student , similarly, self.rolllist contains student's roll. below code pass data segue. here detailvc destinationviewcontroller , vc....

php - How can i get campaign's web id when campaign is created using API in Mailchimp? -

i using api version 1.3 of mailchimp create campaign programmatically in php. i using mcapi class method campaigncreate() create campaign. campaign created , returns campaign id in response string. but need web id (integer value of campaign id) can use open campaign using link on website. for example: lets want redirect user link - https://us8.admin.mailchimp.com/campaigns/show?id=941117 , need id value 941117 when new campaign created.for getting string 6ae9ikag when new campaign created using mailchimp api please let me know if knows how campaign web id (integer value) using mailchimp api in php thanks i found answer wanted share here.hope helps someone i campaign id string when createcampaign() method of mcapi class used. you need use below code web id (integer value of campaign id) $filters['campaign_id'] = $campaign_id; // string value of campaign id $campaign = $api->campaigns($filters); $web_id = $campaign['data'][0]['web_...

php - Check is value iside an object array -

my array this stdclass object ( [lc_anuradhapura] => array ( [0] => attr_balapitiya-boat-rides [1] => attr_bird-watching-in-kandalama ) [lc_bentota] => array ( [0] => attr_city-tour [1] => attr_colombo-national-museum ) [lc_colombo] => array ( [0] => attr_cultural-show [1] => attr_cycling ) ) i need check 'attr_cycling' inside 'lc_colmbo'. it's need check dynamically, through common loop. var found = false; loop: (var in obj) { if (obj.hasownproperty(i)) { (var j = 0; j < obj[i].length; j++) { if (obj[i][j] === "attr_cycling") { found = true; break loop; } } } }

apache - Testing a ftp client program in Java -

i have java app reads files kept on remote server using ftp protocol, used org.apache.commons.net.ftp.ftpclient to write ftp client side code, dont know how test it. you can test putting logs after connect, login, listing files etc, , in catch block print stack trace until connections issues resolved.

c++ - Define an object in a .cpp file -

header file class universe { public: universe(); ~universe(); private: chunkmanager chunkmanager; }; i want initialize chunkmanger without using default constructor. however, constructor want use takes object. how make chunkmanager object use correct constructor in .cpp file? want this: universe::universe(){ world = new b2world(b2vec2(0, 0)); world->setallowsleeping(false); //i want because constructor want takes world object chunkmanager = new chunkmanager(world); player = new player(world); } chunkmanager in header object not pointer, chunkmanager = new chunkmanager(world); wrong. you can leave object , initialize this: universe::universe() : chunkmanager(world) { but don't have world yet (unless can pass parameter). easiest solution make header have pointer: private: chunkmanager* chunkmanager; and .cpp ok. edit: assume kenny ostram getting @ in comments since you've dynami...

java - Method stops being called -

i made method creates object every time called, spawning stop when boolean variable equal true, when set variable false method spawn characters not called anymore, don't understand since it's on render method should update every frame. public void update() { deltatime = gdx.graphics.getdeltatime(); timer += 1 * deltatime; if(endgame==false) { //when game starts works. if (timer >= rtime) { newenemy0();//this method spawning timer -= rtime; rtime = rfloat.nextint(3) + 1 * 1f; rposition1 = rfloat.nextint(700) + 1; } }/*when thing happen endgame==true, when click button false when put false nothing happens*/ //this newrnemy method creates new sprite using pools. public void newenemy0(){ sprite enemy= pools.obtain(sprite.class); enemy.setsize(80,80); enemy.setposition(rposition1, 150)...

java - How do I print an array multiple times? -

my following code else's, able figure out how print correct range, want print range (array) multiple times. public class lottery { public static void main(string[] args) { int[] lottery = new int[6]; int randomnum; (int = 0; < 6; i++) { randomnum = (int) math.ceil(math.random() * 59); // random number created here. (int x = 0; x < i; x++) { if (lottery[x] == randomnum) // here, code checks if same random number generated before. { randomnum = (int) math.ceil(math.random() * 59);// if random number same, number generated. x = -1; // restart loop } } lottery[i] = randomnum; } (int = 0; < lottery.length; i++) system.out.print(lottery[i] + " "); } } the output, expected 6 integers in row: 12 52 46 22 7 33 i have unfortunately not been able find directly relevant question. absolute java beginner, please gentle...

excel - Automate trigger from email that has been replied -

i new in vba. ask on how trigger email has been reply. scenario : have coding below send email recipient (column b) if there "yes" in column c. for each cell in columns("b").cells.specialcells(xlcelltypeconstants) if cell.value "?*@?*.?*" , _ lcase(cells(cell.row, "c").value) = "yes" set outmail = outapp.createitem(0) on error resume next outmail .to = cell.value .subject = "reminder" .body = "dear " & cells(cell.row, "a").value _ & vbnewline & vbnewline & _ "please contact discuss bringing " & _ "your account date" 'you can add files '.attachments.add ("c:\test.txt") .send 'or use display end question : h...

jquery - How can i make my sub-menu show and hide when click on main item? -

$('.slideout-menu li').click( function() { $(this).children('.mobile-sub-menu').show(); }, function() { $(this).children('.mobile-sub-menu').hide(); }); .slideout-menu { position: absolute; top: 100px; left: 0px; width: 100%; height: 100%; background: rgb(248, 248, 248); z-index: 1; } .slideout-menu .slideout-menu-toggle { position: absolute; top: 12px; right: 10px; display: inline-block; padding: 6px 9px 5px; font-family: arial, sans-serif; font-weight: bold; line-height: 1; background: #222; color: #999; text-decoration: none; vertical-align: top; } .slideout-menu .slideout-menu-toggle:hover { color: #fff; } .slideout-menu ul { list-style: none; font-weight: 300; border-top: 1px solid #dddddd; border-bottom: 1px solid #dddddd; } .slideout-menu ul li { /*border-top: 1px solid #dddddd;*/ border-bottom: 1px...

cron - Crond execute shell many times -

i have following timey.cpp code in redhat 2.6.32 x86_64: using namespace std ; int main() { while( 1 ){ char x[64]={0} ; strcpy( x,"1234567890") ; std::string s = x ; std::cout << "(" << x << ")" << std::endl ; struct timeval localtimex ; long secs,usecs ; gettimeofday(&localtimex,0x00) ; secs = localtimex.tv_sec ; usecs = localtimex.tv_usec ; //long mills = (time.tv_sec * 1000) + (time.tv_usec / 1000 ) ; printf("secs=(%d),usecs=(%d)\n",secs,usecs) ; sleep( 1 ) ; } //while } in /home/informix/test , compiled g++ --std=c++0x timey.cpp -o timey.exe , , shell timey.sh : source /etc/bashrc nohup /home/informix/test/timey.exe & then run timey.sh by: /home/informix/test/timey.sh and take if timey.exe runs by: ps -ef | grep timey it seems timey.exe runs expected: informix...

How to insert multiple rows and files into mysql using php array? -

how insert multiple rows , upload files mysql database using php array? i want add 'add more' option in form same fields got duplicates down it, , can insert multiple rows file uploads mysql database. here code : <?php // @author - chetanaya aggarwal ?> <?php include('header_dashboard.php'); ?> <?php include('session.php'); ?> <?php $get_id = $_get['id']; ?> <body id="home"> <?php include('navbar_client.php'); ?> <div class="container-fluid"> <div class="row-fluid"> <?php include('device_sidebar.php'); ?> <div class="span9" id="content"> <div class="row-fluid"> <!-- block --> <div class="block"> ...

html5 - How do i change the Navbar Position when Bootstrap in responsive case -

please im new bootstrap v3 , change navbar place when goes responsive want float right in same line of logo inside header from : logo - navbar - to logo navbar <div class="container"> <div id="content"> <div class="row"> <div id="header"> <div id="logo" class="col-lg-4 col-sm-4"> <a href="#"><img src="<?php echo base_url(); ?>public/img/logo.png" id="logo"></a> </div> <div id="client-num" class="col-lg-4 text-center"> <h1>accueil fièrement plus de 1500 sites web!</h1> </div> <div id="tollfree...

html - changing margin-top of element while scrolling ,javascript -

Image
i want attach element bottom of navbar navbar fixed so in top when scroll problem how change margin-top of element top bottom of nav bar .. , bottom fixed .. (it hidden if scoll lot ) heigth of element smaller when scroll here did $(document).on('scroll', function (e) { $('.imagebleu').css('opacity', ($(document).scrolltop() / 500)); $('.imagebleu').css('margin-top', ($('.navbar').heigh()+$(document).scrolltop())); }); if need more code post here link page http://rechmed.byethost9.com/android_connect/ the part contain text nav bar , other part .imagebleu element have same opacity , because element under navbar navbar opacity doesn't same it so want add margin changes scrolling fix element on bottom of navbar thank much i did solution based on layers (with z-index) .imagebleu { background-color: #3498db; border-color: transparent; opacity: 0; height: 100%; width:100%; marg...

Jenkins java.lang.Exception: State is invalid -

seeing error when going jenkins. java.lang.exception: state invalid the solution super simple i'm missing. couldn't find results when googling exception (unless failed @ too). right our jenkins being served on 2 urls, 1 works fine , other throws exception defined above. the issue needed change of configs new url. though apache points right port, application needs know url it's being ran on.

java - Android application becomes slow after multiple callbacks - what's wrong here? -

i have application parses through user's facebook messages, , due extremely annoying limitation facebook api lets receive 25 messages per api call, have use weird quasi-recursive method parse through messages can handle pagination. issue arose when attempted make application sleep in scenario exceeded requests before trying again. i noticed app shoot out fast, parsing through several api calls per second. app dragged on , requests hit several hundreds, slowed crawl of maybe 1 per 5 seconds. see slowing me down here? relevant portions of code: i start parsing service, makes initial request 25 messages (and links every 1 after that) , calls retrievemsgs(). @override public int onstartcommand(intent intent, int flags, int startid){ if(intent!=null) { id = intent.getstringextra("id"); } session session = session.getactivesession(); new request(session, id + "/comments", null, httpmethod.get, new request.callback() { @ove...

Different results on each system using file functions in C. Linux vs. Mac -

i writing file parsing program parse data. however, needs run natively on mac os machine. however, while code run fine on both ubuntu 14.04 , mac 10.10. mac machine give garbage data, sometimes. using gcc on linux gives correct data time. the source data follows, [6/30/2015 11:20:09 pm] stream begin [6/30/2015 11:20:09 pm] 00-00-ff-70-fc-a9-01-ec-ff-6c-fc-cc-01-fb-ff-70-fc-d4-01-fb [6/30/2015 11:20:09 pm] 00-01-ff-74-fc-c8-02-0b-ff-68-fc-b5-01-ff-ff-70-fc-b5-02-03 [6/30/2015 11:20:09 pm] 00-02-ff-6c-fc-b9-02-03-ff-6c-fc-d0-02-17-ff-64-fc-c4-01-f4 [6/30/2015 11:20:10 pm] 00-03-ff-68-fc-c4-01-ff-ff-59-fc-c8-01-ec-ff-5c-fc-e0-02-1b [6/30/2015 11:20:10 pm] 00-04-ff-5c-fc-dc-02-22-ff-5c-fc-d4-02-1e-ff-59-fc-c4-02-17 [6/30/2015 11:20:10 pm] 00-05-ff-60-fc-c4-02-13-ff-60-fc-c8-02-1b-ff-5c-fc-d0-02-1e [6/30/2015 11:20:10 pm] 00-06-ff-68-fc-d4-02-1e-ff-68-fc-c0-02-22-ff-60-fc-c4-02-0f [6/30/2015 11:20:10 pm] 00-07-ff-5c-fc-d0-02-03-ff-64-fc-b1-02-13-ff-59-fc-bd-01-ff the desired outpu...

c# - DownloadFile The process cannot access the file because it is being used by another process -

i have downloader downloading files , runs fine part, ever start throwing exceptions. exception is: [11:15:34 a.m.] >> [error startdownloadfile] exception occurred during webclient request. | system.io.ioexception: process cannot access file 'a:\users\user\downloads\test\file.extention' because being used process. @ system.io.__error.winioerror(int32 errorcode, string maybefullpath) @ system.io.filestream.init(string path, filemode mode, fileaccess access, int32 rights, boolean userights, fileshare share, int32 buffersize, fileoptions options, security_attributes secattrs, string msgpath, boolean bfromproxy, boolean uselongpath, boolean checkhost) @ system.io.filestream..ctor(string path, filemode mode, fileaccess access, fileshare share, int32 buffersize, fileoptions options, string msgpath, boolean bfromproxy) @ system.io.filestream..ctor(string path, filemode mode, fileaccess access) @ system.net.webclient.downloadfile(uri address, string filename)...

powershell - Trying to use $using in SetScript DSC Script Resource -

i trying use $using on setscript script resource , script failing generate mof file. my code: script add_admin_account { getscript = { return $null; } setscript ={ $admingrp=[adsi]"winnt://localhost/administrators,group"; $usr=[adsi]"winnt://domain\username,user"; $using:admingrp.add($using:usr.path) } testscript = { $check_user_added = (net localgroup administrators | select-string "domain\username" -simplematch).tostring() if ($check_user_added) { write-verbose "user $check_user_added part of admin group"; return $true; } else { return $false; } ...

logging - Override Spark log4j configurations -

i'm running spark on yarn cluster , having log4j.properties configured such logs default go log file. however, spark jobs want logs go console without changing log4j file , code of actual job. best way achieve this? thanks, all. i know there have @ least 4 solutions solving problem. you modify log4j.properties in spark machines when running job on spark better attach log4j file configuration file submit spark example bin/spark-submit --class com.viaplay.log4jtest.log4jtest --conf "spark.driver.extrajavaoptions=-dlog4j.configuration=file:/users/feng/sparklog4j/sparklog4jtest/target/log4j2.properties" --master local[*] /users/feng/sparklog4j/sparklog4jtest/target/sparklog4jtest-1.0-jar-with-dependencies.jar try import log4j logic code. import org.apache.log4j.logger; import org.apache.log4j.level; put logger sparkcontext() function logger.getlogger("org").setlevel(level.info); logger.getlogger("akka").setlevel(leve...

Read Domains Froms Excel File and Open in IE -

i have excel file which looks this: visted domains comments yahoo.com google.com hotmail.com all of columns populated. i trying read domain excel file, open in ie. once it's visited, write 'yes' under 'visited' column. so far, current script read excel file, , opens in ie. once close current ie window, opens next url. $excelobject = new-object -comobject excel.application $excelobject.visible = $true $excelobject.displayalerts = $false $excelfile = "c:\users\muafzal\documents\files\emie\analyzing\list.xlsx" $workbook = $excelobject.workbooks.open($excelfile) $sheet = $workbook.worksheets.item(1) $row = [int]2 $domain = @() # beginnt bei 2,1... 3,1... 4,1 { $domain += $sheet.cells.item($row,2).text ; $row = $row + [int]1 } until (!$sheet.cells.item($row,1).text) foreach($url in $domain){ #start ie , make visible $ie = new-object -com "internetexplorer.application" $ie.vi...

Convert sRGB PDF to a different RGB color profile -

i have pdf srgb color profile, , convert different rgb color profile. far have tried use ghostscript various parameter values no luck--for example have attempted following: gs \ -dsafer \ -dbatch \ -dnopause \ -dnocache \ -sdevice=pdfwrite \ -scolorconversionstrategy=rgb \ -dprocesscolormodel=/devicergb \ -soutputiccprofile=/colorprofiles/custom/applergb.icc \ -soutputfile=output.pdf \ input.pdf the command above runs without error leaves color space unaffected; output.pdf still has original srgb color profile embedded. is such conversion possible ghostscript (or other tool can used programmatically)? if so, going wrong?

c++ - Universal references with functions -

what type of "univ" in code below? template<typename t> void func(t&& univ) { // ?? } int sum(int a, int b) { return a+b; } int main() { func(sum); } i didn't know universal references worked functions. func(sum); equivalent func(&sum); or rvalue reference binding else simple pointer? i don't know how put more words... the type reference function taking 2 int s , returning , int or, comment says: int(&)(int, int)

PHP - array to 'unique' -

i have array looks following: array(43197) { [0]=> array(4) { ["id"]=> string(5) "10038" ["country"]=> string(7) "andorra" ["city"]=> string(16) "andorra la vella" ["name"]=> string(25) "andorra la vella heliport" } [1]=> array(4) { ["id"]=> string(5) "10040" ["country"]=> string(20) "united arab emirates" ["city"]=> string(17) "abu dhabi emirate" ["name"]=> string(11) "ras sumeira" } [2]=> array(4) { ["id"]=> string(5) "10041" ["country"]=> string(20) "united arab emirates" ["city"]=> string(13) "dubai emirate" ["name"]=> string(27) "burj al arab resort helipad" } [3]=> array(4) { ["id"]=> string(5) ...

ios - How do I keep the keyboard from covering my UI instead of resizing it? -

in ios, xamarin.forms resizes screen when keyboard comes when root node scrollview . when root node not scrollview keyboard hides part of ui. how keep happening? the way fix custom renderer listens keyboard showing , adds padding while it's there. in pcl project, keyboardresizingawarecontentpage.cs : using xamarin.forms; public class keyboardresizingawarecontentpage : contentpage { public bool cancelstouchesinview = true; } in ios project, ioskeyboardfixpagerenderer.cs : using foundation; using myproject.ios.renderers; using uikit; using xamarin.forms; using xamarin.forms.platform.ios; [assembly: exportrenderer(typeof(keyboardresizingawarecontentpage), typeof(ioskeyboardfixpagerenderer))] namespace myproject.ios.renderers { public class ioskeyboardfixpagerenderer : pagerenderer { nsobject observerhidekeyboard; nsobject observershowkeyboard; public override void viewdidload() { base.viewdidload(); ...

Read and print XML with only small changes using PHP -

i've been looking simple way print xml url, came, few changes. have feed: <products> <product> <name>product example</name> <image>http://example.com</image> </product> </products> i want take , print out this: <products> <product> <name>product example</name> <image>http://example.com?utm_campaign=changes</image> </product> </products> is possible? thanks! you can load xml file using simplexml_load_file() doc : http://php.net/manual/fr/function.simplexml-load-file.php it permits create object xml loaded. modify want on, use dom_import_simplexml() transform domelement. doc : http://www.php.net/manual/en/function.dom-import-simplexml.php using domelement::savexml() returning xml result. doc : http://php.net/manual/fr/domdocument.savexml.php don't know if it's easiest way, work. thanks.

dom - Capture PHP links without image links -

$url = 'http://www.test.com/'; $dom = new domdocument; @$dom->loadhtmlfile($url); $links = $dom->getelementsbytagname('a'); foreach ($links $link) { i using above script capture links on page, found there duplicate links. on page, there picture linked, followed text link goes same link. there easy way capture text link, not image link? as saying, might take approach of cleaning dupes in result set. not sure on scraping if link only used image? you count occurrences. $url = 'http://www.test.com/'; $dom = new domdocument; @$dom->loadhtmlfile($url); $links = $dom->getelementsbytagname('a'); $distinctlinks = []; foreach ($links $link) { $distinctlinks[$link] = (int) $distinctlinks[$link] + 1; }

Magento 1.9 - empty cart page using localhost -

i'm using magento ce 1.9 , cart keeps emptying when click on cart page. happens on localhost , not problem in production (which uses ssl). here's happens: add product shopping cart click continue shopping product in mini-cart navigate cart page application render empty cart page (and mini-cart empty well) i've tried changing increasing cookie lifetime 1 day , setting validate http_user_agent yes. else can do?

sql - How do I use window function to get max price and its id? -

i have query select adate, factoryid, purchid, itemname, max(price) price tableb catnum = 9 group adate, factoryid, purchid, itemname order adate, factoryid, purchid, itemname but want id row. in perfect world: select id, adate, factoryid, purchid, itemname, max(price) price tableb catnum = 9 group adate, factoryid, purchid, itemname order adate, factoryid, purchid, itemname but know won't work. so tried this: select id, adate, factoryid, purchid, itemname, max(price) over(partition adate, factoryid, purchid, itemname) price tableb catnum = 9 that doesn't work. price duplicated ids. , query result set goes 4000 rows 11000. so obviously, got window function wrong somehow. first did wrong , secondly, of course, how fix it? select * ( select *, row_number() on (partition adate, factoryid, purchid, itemname order price desc, id desc) rn tableb catnum = 9 ) q rn = 1

git - Android studio cannot ignore gradle_project_sync_data.bin -

i have started move project android studio since google announced won't support eclipse anymore. i have enabled version control, added remote , added git ignore file what should in .gitignore android studio project? , seems work fine apart 2 annoying files build/intermediates/dex-cache/cache.xml build/intermediates/gradle_project_sync_data.bin according git ignore both should ignored not what doing wrong? here gitignore .gradle /local.properties /.idea/workspace.xml /.idea/libraries .ds_store /build /captures

gps - Android - Determining when user increases its speed, and when it decreases -

for android app need determine when user increases speed , when decreases it, don't need find exact speed value, know if has increased, decreased or it's same. first solution came register listener gps , in onlocationchanged() method calculate speed , check see if greater or equal, didn't worked, beacuase speed inaccurate. solution tried use accelerometer measure steps in 2 seconds, , compare measure previous one, see greater, didn't found exact algorithm. found approximation android pedometer github code sample: https://github.com/bagilevi/android-pedometer , wasn't accurate. so, solution should use? what's effective way of counting steps accelerometer? thank you.

Why my way to update local files with Github is not working? -

first have master branch in remote repo on internet. , know if changed local files, how update local changes remote repo. problem is, if don't want new changes in local tracked files, how return using updating remote repo in github? i have tried following things: i use git checkout origin master to master repo. i make sure 1 tracked file, named main_32.f90 changed little bit in comment line. then use git pull it turns out date. already up-to-date. i checked main_32.f90, not original 1 changed 1 in comment line. means git pull not working. so how it? if don't want keep local changes, can hard reset pointer, branch, sha1, etc discard changes. git reset --hard head . use this kind of aliases have pretty view of working tree if console fan , don't want use gui suggested other users.

objective c - Should I use nullable/nonnull in implementation file -

i want use objective-c nullability feature. should annotate nullable/nonnull implementation file or interface? the reason declare nullability have warning feedbacks compiler unit (see https://developer.apple.com/swift/blog/?id=25 ). as best practice, should set nullable , nonnull (or _nullable , _nonnull) in declarations. so should interfaces, depending on coding standards, may implement class-scoped (or category-scoped) methods without declaring them, , in case declaration implementation , should declare nullability values. you can declare nullability implementations declared in interfaces, in opinion degrades maintainability.

C++11 for loop through vector of unique_ptr -

having trouble correctly looping through vector of unique_ptrs own custom object. i've provided pseudo-code below isn't fleshed out, focus on loop. i'd use c++11 "for" loop, , iterate on vectors - or i've heard, providing own iterators better? don't know how when have separate classes. if i'm keeping vector in manager class, should define iterator methods? in object class, or manager class? want make sure data stays const, actual values aren't able changed. // class our data class geosourcefile { // data, doesn't matter double m_dnumber; int m_nmyint; } // singleton manager class class gsfmanager { public: // gets pointer vector of pointers geosourcefile objects const std::vector<std::unique_ptr<geosourcefile>>* getfiles( ); private: // vector of smart pointers geosourcefile objects std::vector<std::unique_ptr<geosourcefile>> m_vgeosourcefiles; } void app::ondrawevent { ...

javascript - JS handle catching all the errors in all pages with angular -

i using angular js , trying catch errors in pages, problem not catch errors in pages, example doing referenceerror in 1 of controllers , not catch this. $rootscope.$on("$statechangestart", function() { window.onerror = function( msg, url, line, col, error ) { var = !col ? '' : '\ncolumn: ' + col; += !error ? '' : '\nerror: ' + error; var data = { msg : msg, url : url, line: line + } alert('error'); var suppresserroralert = true; return suppresserroralert; }; } how can make work? don't use window.onerror, instead use $exceptionhandler. angular has global $exceptionhandler factory catches errors happen inside controllers, services, etc. any uncaught exception in angular expressions delegated service. angular.module('exceptionoverride', []).factory('$exceptionhandler', function() { return function(exception, ca...

CMake could not find OpenGL in Ubuntu -

i want install vtk in ubuntu. cmake sends me error : cmake error @ /usr/share/cmake-2.8/modules/findpackagehandlestandardargs.cmake:108 (message): not find opengl (missing: opengl_gl_library opengl_include_dir) call stack (most recent call first): /usr/share/cmake-2.8/modules/findpackagehandlestandardargs.cmake:315 (_fphsa_failure_message) /usr/share/cmake-2.8/modules/findopengl.cmake:161 (find_package_handle_standard_args) rendering/opengl/cmakelists.txt:196 (find_package) cmake error: following variables used in project, set notfound. please set them or make sure set , tested correctly in cmake files: opengl_include_dir (advanced) used include directory in directory /home/pilou/documents/src/vtk-6.2.0/geovis/core i have hence installed freeglut3 , build-essential (as have seen on internet). nothing has changed. how find opengl write own link cmake? else install vtk? ok need install freeglut3-dev instead of freeglut3 ! contains...

javascript - Marionette. Add methods to view via behaviors -

so have: class mysuperbehavior extends marionette.behavior bunch of classes extends marionette.itemview , uses mysuperbehavior , tralalaview , trololoview etc i want create method mysuperbehavior every instance of tralalaview , trololoview can use. how can correctly? sample code illustrate: var mysuperbehavior = marionette.behavior.extend({ awesomenonstaticmethod: function(){ console.log(this); } }); we suppose correct linking of classes var tralalaview = marionette.itemview.extend({ behaviors: { somebehavior: { behaviorclass: mysuperbehavior } } // methods here }); var instoftralala = new tralalaview(); console.log(instoftralala.awesomenonstaticmethod()); // want i did that: var mysuperbehavior = marionette.behavior.extend({ initialize: function(options, view){ this.view.awesomenonstaticmethod = this.awesomenonstaticmethod } awesomenonstaticmethod: fu...

sorting - Sort list by values preserving names in R -

consider list l like: l<-list(a=24,b=12,c=30,d=1) how sorted version on values of such list, preserving names? in result list order of elements should then: d , b , a , c corresponding sequence 1,12,24,30. you can use order . assuming length of each list element 1 showed in example l[order(unlist(l))]

python - How to print the number of columns and lines in a csv file? -

i python newbie might sound silly question, have csv file , want script print number of lines , number of columns in file. script: import csv op = open(test06242015.csv) rd = csv.reader(op) row in rd: list = [] list.append(row) print list items in row: print len(row) op.close() i getting right answer (320), prints out 320 times each row (below): [['19.385', '19.227', '18.308', ...]] 320 320 320 320 320 320 320 320 (...and keeps going) how can make 320 prints out once? also, how can read number of rows well? thanks lot! you printing length of row inside inner loop, try printing outside inner loop. example - for row in rd: list = [] list.append(row) print list items in row: pass # or whatever other logic want, if not want remove loop print len(row)

How to convert a 2d array of integers to an image in java? -

i have array of positive integers. how display image? not range of values array contains or size of array. similar question asked here . not know possible values without searching possibly large array. best way of doing regards efficiency , length of code? here small example of data be 0 2 4 6 8 10 12 14 16 2 2 6 6 10 10 14 14 18 4 6 4 6 12 14 12 14 20 6 6 6 6 14 14 14 14 22 8 10 12 14 8 10 12 14 24 10 10 14 14 10 10 14 14 26 12 14 12 14 12 14 12 14 28 14 14 14 14 14 14 14 14 30 16 18 20 22 24 26 28 30 16 18 18 22 22 26 26 30 30 18 take here . int xlenght = arr.length; int ylength = arr[0].length; bufferedimage b = new bufferedimage(xlenght, ylength, 3); for(int x = 0; x < xlenght; x++) { for(int y = 0; y < ylength; y++) { int rgb = (int)arr[x][y]<<16 | (int)arr[x][y] << 8 | (int)arr[x][y] b....

bluetooth - Transport protocols, MQTT, COAP, power requirements and wireless interfaces -

if have device 3 wireless interfaces 1) zigbee 2) gsm , 3) bluetooth. is there limitations transport protocol use protocols mqtt, coap, xmpp? can use coap on zigbee , gsm example? , mqtt on bluetooth , gsm? i understand each interface has different power requirements protocol have power requirement also? assume device battery powered. thanks the same problem troubles me. want know if mqtt can work on bluetooth or wifi-direct on android. according iot tiny devices: let's talk mqtt-sn , mqtt-sn designed support non-tcp/ip based protocol zigbee or bluetooth(not sure), , coap needs ip protocol. hope you.

mysql - PHP - BLOB image rotation when uploading from phone -

Image
disclaimer: understand storing images in directory vs. database better way go, please humour me sake of learning. thank in advance help. i'm having issue rotating image when uploading database blob , displaying when user logs in. i have tested multiple methods of upload , found following: the image rotated when: 1) choosing file, clicking "take photo" mobile device. the image not rotated when: 1) choosing file, clicking "from gallery" mobile device. 2) screenshot of image taken , uploaded using desktop computer. 3) image imported using application such iphoto , uploaded. upload.php - upload image database. <?php require_once "../config/config.php"; session_start(); if(empty($_session['id'])) { header("location: ../login/login.html"); } else { $id = $_session['id']; } include "fetchavatar.php"; if(!empty($_files['avatar']['name']) && (isset($_post['uplo...