Posts

Showing posts from September, 2014

sql server - Priority queue in SQL -

i implementing queueing system multiple priorities. query can return x rows at least y rows of each priority. for example: lets queue has 3 priorities (high, medium , low), , 3, 2 , 1 rows each priority respectively. if table looked this: ----------------- | id | priority | ----------------- | 1 | high | | 2 | high | | 3 | high | | 4 | high | | 5 | medium | | 6 | medium | | 7 | low | ----------------- three simple queries unioned return (1, 2, 3, 5, 6, 7). select top 3 id tbl priority = 'high' union select top 2 id tbl priority = 'medium' union select top 1 id tbl priority = 'low' however problem occurs when table doesn't contain enough of particular priority: ----------------- | id | priority | ----------------- | 1 | high | | 2 | high | | 3 | high | | 4 | high | | 5 | medium | | 6 | low | | 7 | low | ----------------- i have return (1, 2, 3, 4, 5, 6). using highest ...

timeout - Java Prime Factorization: Program timing out? -

before blasted not following rules, did utilize search function , see there multiple threads on exact problem. however, none of them answered specific question. i'm working on euler problem #3, need find highest prime factor of 600851475143. i don't need solving problem. have made brute force method (could better, know) solving it. the program returns correctly of tests did smaller numbers (7 digits , less). however, when enter 600851475143 long input, program never gives me return. number big entered? causing happen? thought because using int tags instead of long, changing didn't alter result. i'm sure simple , i'm missing it, curious what's happening. thank in advance :) //euler 3: largest prime factor import java.io.*; import java.util.scanner; import java.lang.math; public class euler3 { public static void main(string[] args) { scanner scn = new scanner(system.in); system.out.println("enter number!"); ...

Google Maps direct url with 8 locations loaded -

what looking specific parameters need go directly google maps 8 locations (address or lat/long coordinates) set driving directions. doable or mere pie in sky thinking? see this description of available google maps parameters saddr: - start daddr: - destination to: - waypoints example

python - What is the advantage of PyTables? -

i have started learning pytables , found interesting. question is: what basic advantages of pytables on database(s) when comes huge datasets? what basic purpose of package (i can same sort of structuring in numpy , pandas, what's big deal pytables)? is helpful in analysis of big datasets? can elaborate of example , comparisons? thank all. what basic advantages of pytables on database(s) when comes huge datasets? effectively, is database. of course it's hierarchical database rather 1-level key-value database dbm (which less flexible) or relational database sqlite3 (which more powerful, more complicated). but main advantage on non-numerics-specific database same advantage of, say, numpy ndarray on plain python list . it's optimized performing lots of vectorized numeric operations, if that's you're doing it, it's going take less time , space. what basic purpose of package quoting first line of the front page (or, if prefer,...

javascript - Grab two randomly generated divs and wrap within custom div -

Image
i trying 2 randomly generated div id's shown below , wrap them within custom div can control. searching around on jquery api solution still no ideas. here's preview of example: okay can see, there 2 <div id="random_string"></div> , 1 custom <div class="wrap_awm"></div> since can't target 2 id's above have no clues how tell jquery, 2 div's above wrap_awm , put them inside of ".wrap_awm". simple that? what you're looking called .prevall() : var $wrap = $('.wrap_awm'); $wrap.prevall(':lt(2)').appendto($wrap); it's combined :lt() selector use first 2 elements.

ios - How to embed images and sounds in an iPhone app? -

i having real hard time understanding how embed many images , sounds in iphone app. when embed, mean want images , sounds downloaded app, , of images appear when app run. other images saved in app's disk space, when user presses button, image or sound accessed , displayed or played. i have read tutorials on using 'core data' , such, seems way create objects can used reference such data items, or storing small files binary data. can please tell me how in xcode can specify directory of images , .mp3s loaded onto phone app, , how can call media code? some example code following solve problem: an app loaded onto phone, , contains 3 buttons. if user presses button #1, sound heard. button #2 plays different sound, , button #3 changes uiimageview different picture. (this isn't homework assignment or something, if code example, need in app , understand process) thanks! i mean want images , sounds downloaded app simply add images , sounds project. mak...

javascript - Uncaught TypeError: object is not a function calling a function on change form input -

i error on this: this function inside jscript.js source in section of index.php function upd(ctd, id, pr){ //$('#sub'+ id).val() = ctd * pr; document.getelementbyid('sub'+ id).value = ctd * pr; } i have form built dinamically. sample of 1 of inputs, id=4 this html inside div loaded ajax 150 times <input name="ct4" id="c4" type="text" value="10" onchange="upd(this.value,4,150);" /> =<span id="sub4">1500</span> http://jsfiddle.net/xcytc/247/ span element doesnot have value attribute, change to: document.getelementbyid('sub'+ id).innerhtml = ctd * pr; see: updated fiddle

Assigning the % operand in python in an iteration -

this question has answer here: creating dynamically named variables user input [duplicate] 2 answers if have array numbers = [1, 2, 3] , loop depend on these numbers , inside loop have , dictionary or object want name numbers in array numbers, how can use percent operand assign values? so like numbers = [1, 2, 3] number in numbers: dictionary_"" = {} where "" number. just using percent operand, dictionary_%g = {} %(number) , not work. how can this? thanks. you can't and/or shouldn't name variables dynamically. can create list or dictionary contains these 3 dictionaries. two-level data structure. numbers = [1, 2, 3] dictionaries = {} number in numbers: dictionaries[number] = {} or, more compactly: dictionaries = {number: {} number in numbers}

javascript - Background Postioning in CSS on Mobile Device -

i have image (background.jpg) on website. appears fine on desktop, doesn't right on mobile. change in stylesheet.css make image, guess, shrink in size appear desktop? current code: #services-top-desktop { background: #fff url(../img/background.jpg) fixed no-repeat center; background-size: cover; } #services-top-mobile { background: #fff url(../img/background.jpg) no-repeat center; } your code uses 2 classes, 1 desktop , other mobile. instead, use generic body class in css body { background-image: url('../img/test.jpg'); background-repeat: no-repeat; background-size: cover; }

curl - Taking a website snapshot with PHP -

this question has answer here: website screenshots 21 answers hello folks , friends so! this development of web spider. need take snapshot of website. have full url, , source code, returning curl request. since html should visualized browser does, believe we're gonna have draw somehow before taking screenshot. is there recommendation or proper approach make this? thanks in advance; chris; you'll more have install php library on server task done, if there available in php. php server-side language, it's not geared type of work. perhaps previous thread can in right direction. website screenshots using php however, if open api services available price-based, github uses: http://url2png.com/plans/

Events do not fire in javascript facebook sdk -

here complete snippet of code using. have read through documentation , still not able figure out this. running code locally on visual studio 2010 , chrome browser. have set site url, canvas url , secure canvas url localhost. have app domain empty. guessing doing wrong , cannot figure out. please me <html> <body> <div id="fb-root"></div> <script> window.fbasyncinit = function() { fb.init({ appid : '129307260602861', status : true, cookie : true, xfbml : true, oauth : true, }); fb.event.subscribe('auth.login', function(response) { fblogin(); //first login time }); fb.event.subscribe('auth.authresponsechange', function(response) { alert('the status of session is: ' + response.status);}); fb.event.subscribe('auth.logout', function(response) { a...

php - I want to have url to point to certain part of my apps in facebook page -

just title.. i want developing facebook apps @ facebook page tab.. just example.. if have store this.. http://www.facebook.com/ryanowebdeveloper/app_273887879387238 (just example found online) i want have url straight point product... think have way can it... mean if open url.. still open facebook page tab show product description , not main page.. and try learn bout app_data & singed_request.. still not understand it.. know how parameter.. duno how link page.. thank in advance , sorry bad english =) you can give url page tab app string information adding ?app_data= or &app_data= , depending on current url, followed string like: ?app_data=product_id=23923|other_info=heresomechars now trick is, query string information not available in app, since facebook opens app in iframe. reason facebook posts app information in signed_request variable. read signed_request , find app_data string. now have access string of information , let code decide depend...

Resolve Wordpress plugins conflict settings tab -

Image
has had problem of enabling 1 wordpress plugin take on settings tab of plugin? i'm referring plugins: trainup , membership whenever enable trainup, membership disappear, luckily page still accessible via same url. bit frustrating thanks menu conflict can reduced using decimal instead of integer values position, e.g. 63.3 instead of 63 more details add_menu_page function can found here: http://codex.wordpress.org/function_reference/add_menu_page

regex - cutting a portion of url using regular expression in perl -

i have following url : http://stagingbugzilla.cpiv.com/html/estverificationpool/estpendingbugs.php?team_name=general%20administration need proper way extract value after "?" need find how explode in perl http://example.com part out of string, , store in own variable, split , save in variable before passing it. don't yourself, use uri module, designed make sense of kind of data. my $uri = uri->new('http://hostname.com/...?...'); $uri->query; # value after '?' $uri->scheme; # "http" $uri->host; # hostname.com

javascript - finding the number of occurrences of same the string stored in a array of objects -

i trying aggregate number of title names , different title sources. successful in removing duplicates array of objects , display original version of title each source single time out duplicates. have fallen short of showing detail abt how many duplicates of each title names there in json. in here have 4 each. unable total duplicates. part else condition of ifexistflag ive added in code. adding fiddle link http://jsfiddle.net/wf4qx/5/ var inputjson = [{ "sources": [{ "title": "title name", "source": "sourcename1", "date": "07-05-2013 00:38:40", "link": "link 1" }, { "title": "title name", "date": "07-05-2013 00:24:17", "source": "sourcename2", "link": "link 2" } ] }, { "sources": [{...

How to download MP4 file that plays through a video player using the curl command -

the following page automatically plays mp4 want download on video player: ` http://www.stylelife.com/phase2xl/media/videoplay.php?content_filename=136433981.mp4 however, when use curl command, doesn't download mp4 curl -o video.mp4 http://www.stylelife.com/phase2xl/media/videoplay.php?content_filename=136433981.mp4 % total % received % xferd average speed time time time current dload upload total spent left speed 100 3615 100 3615 0 0 27704 0 --:--:-- --:--:-- --:--:-- 60250 i've looked through source code on page , relevant part totally confuses me. is, don't know mp4 file located. <a href="mp4:136433981.mp4%3fpolicy%3deyjtdgf0zw1lbnqiolt7iljlc291cmnlijoimtm2ndmzotgxlm1wncisiknvbmrpdglvbii6eyjjcefkzhjlc3mionsiqvdtolnvdxjjzulwijoimjqumjeyljiymy40ns8zmij9lcjeyxrltgvzc1royw4ionsiqvdtokvwb2novgltzsi6mtm2otexmzg4ox19fv19%26signature%3ddgkzwpp4x2g57lropt4df2rsm-ds29eyi9rqa6lauxbbz...

Conditional Statements in Batch File -

i have written ms dos batch file runs series of commands. each command invokes program specific parameters. automate this, combined commands. the structure of batch file shown below: @echo off if %1 == "b1" ( command 1 command 2 command 3 .... ) else ( command command b command c ) i invoke shown below: test.bat b1 if pass b1 argument batch file, process series of commands, command 1, command 2, command 3 , on. similarly, if want execute series of commands mentioned in else section, pass argument: test.bat abc since argument passed batch file not equal b1, start executing else section of batch file. here argument passing (in case, abc) required commands, command a, command b, command c , on parameter. all works pretty good. however, issue facing is, if want terminate batch file in between (by pressing ctrl + c), not prompt me option: want terminate batch operation? y/n for instance, let say, batch file processing series of commands in else section....

opengl - GLSL, combining 2D and 3D textures -

i trying blend 3d texture 2d 1 make terrain. 3d texture has moss, sand, snow , like, interpolated enhance illusion of heights. 2d texture has orange line across meant "road". fragment shader: # version 420 uniform sampler3d maintexture; uniform sampler2d roadtexture; void main() { vec4 diffuse3d = texture3d(maintexture, gl_texcoord[0].stp); vec4 diffuse2d = texture2d(roadtexture, gl_texcoord[1].st); // yes, aware returning 2d texture value // testing purposes // doing gl_fragcolor = diffuse3d + diffuse2d; // or other operation returns 3d texture gl_fragcolor = diffuse2d; } and drawing call: void terrain::draw() { glenableclientstate(gl_vertex_array); glvertexpointer(3, gl_float, sizeof(glm::vec3), &v[0].x); glenableclientstate(gl_normal_array); glnormalpointer(gl_float, sizeof(glm::vec3), &n[0].x); s.enable(); // simple gluseprogram call within shader object glclientactivetexture(gl_texture0); g...

symfony - how to call function of entity repository in form type in symfony2 -

i want call function in form type class. function generate array , written in entity repository class. using array generate dynamic form field. here entity repository class function. public static $rolenamemap = array( self::role_super_admin => 'superadmin', self::role_managemen => 'management', self::role_managers => 'manager', self::role_it_staff => 'itstaff', self::role_cs_customer => 'cscustomer', self::role_cs => 'cs', self::role_dealer => 'dealer', self::role_account_staff => 'accountstaff', self::role_broker_user => 'staff', ); public function getgrouplistarray() { $qb = $this->createquerybuilder('g') ->orderby('g.hierarchy','asc'); $query = $qb->getquery(); $grouplist...

c++ - How to search hash_map containing reference_wrapper? -

i'm using intel tbb concurrent hash map tbb::hash_map<std::string, std::reference_wrapper<clusters>> , want search hash_map using tbb::concurrent_hash_map<std::string, std::reference_wrapper<clusters>>::accessor a; if(table.find(a, operation.get().getkey())) { a->second.get().addoperation(operation); } but gives error: no matching function call ‘std::reference_wrapper<clusters>::reference_wrapper() . problem reference_wrapper has no default constructor find needs. there way can circumvent this? it seems bug in implementation of find() or documentation. either needs mapped type defaultconstructible when shouldn't, or doesn't document needs this. i don't think can fix. workaround, store pointers in map instead of reference wrappers.

c# - Virtual Private Server Using Multiple IP's -

many virtual private server(vps) providers give option of having multiple dedicated ip's. can these ip's used liked proxies application running on vps? for instance, in c#, set httpwebrequest proxy property use specific dedicated ip sending traffic? there have other configuration working?

java ee - Weblogic: Encrypt properties -

weblogic application server 10g , above encrypts data source passwords etc. in configuration files fine. for third party library, have provide credentials via application (ear/war) differ between environments. i'm aware of plan.xml / <env-entry/> approach knowledge, can replace/modify deployment descriptor literal values, not encrypted values - @ least have not found example. all in want "inject" credentials in application as possible supported application server , without "self-build" solutions external properties file etc (like jaspy). is somehow possible via weblogic's plan.xml approach? thanks! a couple things note - if weblogic in development (not production mode) can enter values clear text in configuration files , when server starts encrypt them. if need encryption/decryption methods there plenty of scripts out there can help. here: http://techtapas.blogspot.com/2011/05/how-to-decrypt-weblogic-passwords-with.html that ...

c++ - Using templates for a factory method on derived classes -

i have base class of there many derived classes. pointers base class stored in containers in program can iterate through , call virtual functions on them. i have class adds base class pointers container, when derived classes new ed (not nude ) must return or stored base class pointer. i thinking making simple base class factory method me, using templates: template<class t> //t derived class static t* factory(){ return static_cast<t*>(functionthataddsbaseclasspointertocontainer(new t)); } i see 2 main pros/cons: advantage: don't need override every derived class disadvantage: used incorrectly passing t class type not derived base. is there way ensure t derived inside function factory ? or can expect compiler catch instances t not derived? is general approach acceptable idea, or there better alternative? is there way ensure t derived inside function factory? if functionthataddsbaseclasspointertocontainer takes base...

Http-post parameters and display response in a browser using Silverlight and JavaScript -

while doing silverlight's interoperability javascript i've faced strange behaviour in silverlight out-of-browser (oob) application. goal http-post data specific site. can post data using webclient or httpwebrequest classes. how redirect response external web browser? thought generate dynamic html form post method , invoke javascript function silverlight submit form. unfortunately submits form target="_self" , not target="_blank". code loading generated html string silverlight's webbrowser control: webbrowser wb = parameter webbrowser; if (wb == null) return; wb.navigatetostring(gethtml()); simple test method generate html: private string gethtml () { stringbuilder sb = new stringbuilder (); sb.append ("<!doctype html public \"-//w3c//dtd xhtml 1.0 transitional//en\" \"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd\">"); sb.append ("<html xmlns=\"http://www.w3.org/1999/...

jquery - Is there a way to translate a transform:matrix3d() return into its rotateX, Y and Z values? -

i have app user clicks on div retrieve 3d orientation values map onto 3 sliders. when lookup div's css transform property jquery of course internal matrix3d(). i can extract values 2d transformation matrix() 3d matrix beyond me. know of recipe or library can achieve this? since preferred not paste link, paste code w3c page css3 transforms note pseudo code give quaternions, can convert angles using answer here 20.1. decomposing matrix the pseudocode below based upon "unmatrix" method in "graphics gems ii, edited jim arvo", modified use quaternions instead of euler angles avoid problem of gimbal locks. the following pseudocode works on 4x4 homogeneous matrix: input: matrix ; 4x4 matrix output: translation ; 3 component vector scale ; 3 component vector skew ; skew factors xy,xz,yz represented 3 component vector perspective ; 4 component vector quaternion ; 4 component vector returns false...

plsql - Can we add comments to an object using 'Alter type ' command -

can add comments type object in oracle 10g using 'alter type ' command.? no. syntax alter type is: http://docs.oracle.com/cd/e11882_01/appdev.112/e25519/alter_type.htm comments can added tables, columns, operators, indextypes, materialized views, , mining models. http://docs.oracle.com/cd/b28359_01/server.111/b28286/statements_4009.htm#sqlrf01109 however, can add pl/sql comments type's member methods.

database - Is there a way to log read/write access to a specific column in MySQL? -

is there way in mysql log query accesses column in table? purpose: need refactoring purposes - have change structure of database because not smart enough @ time use unique searchable column names difficult me locate places in php code deal column. if start logging queries access column on time have complete overview of queries use column , therefore able modify php code (assuming possible queries had been run time in period). while wrote misgivings below, question relates "auditing" , "logging". basic statement logging can achieved using general query log , more advanced auditing can performed enterprise audit plugin. triggers not appropriate logging queries have been known implement update/insert change log trails. i think trying find usage programmatically misguided. refactoring not "ongoing" process - it's done once (per refactor goal) , life moves on. tests (e.g. unit/integration) , code-coverage can tell results of refact...

Magento - direct link to add product to cart with control mechanism -

is there chance check if product in cart if used direct link add product cart? example, send customer link, he/she click on 1 time , mystake click again. result is, in cart 2 times more pieces. we use 1 product option, text field, unique (in example - options[8]=ax587ad9) each order/customer, maybe there way check via api. we can use mechanim check before magento frontend, , redirect cart or use link add product cart... example of direct link: http://www.example.com/checkout/cart/add?product=161&qty=1&options[8]=ax587ad9 thanks every suggestion, igor you can check if product in cart or not using event observer. you can use checkout_cart_product_add_before event check if product in cart. config file this <config> ... <frontend> ... <events> <checkout_cart_product_add_after> <observers> <unique_event_name> <class>{{modulename}}/observer</class>...

c++ - ostringstream::write method modifies input parameter -

consider following snippet gets binary data , writes ostringstream object: unsigned char* payload; unsigned long size; getdata(&payload, &size); std::cout << md5(payload, size) << std::endl; std::ostringstream stream; stream.write((const char*)payload, size); std::cout << md5(payload, size) << std::endl; the problem that, 2 printed hash values different form each other, means payload has been changed. tried opening stream in binary mode using std::ostringstream stream(std::ios::out | std::ios::binary) , did not make difference, didn't expect would, anyway. another fact is, different checksum second print statement every time re-run program. first hash same. now, how can write binary data correctly ostringstream? can problem cast const char* ( getdata method takes unsigned char** first parameter)? update: in light of comments, here more explanations: comparing binary diff of original data , data written, saw written data...

sql - Is there a way to set variables in a Select statement that can be used in the same statements WHERE clause? -

i'm looking way set variable in select statement can later used in where clause. here example: select datediff(d,time_stamp,getdate()) var1 report var1 = 5 i noticed order var1 clause, works fine, when try use in statement doesn't work fine, gives error on var1 column. this doesn't work either because doesn't return rows. declare @var1 int select @var1 = datediff(d,time_stamp,getdate()) report @var1 = 5 if make sense you, can tell me in case don't have write redundant code this... select datediff(d,time_stamp,getdate()) report datediff(d,time_stamp,getdate()) = 5 ? are looking this? with qry ( select r.*, datediff(d,time_stamp,getdate()) diff report r ) select * qry diff > 1 sqlfiddle

typoscript - Shortcuts between domains in Typo3 -

i have multi-domain typo3 (4.7.11) installation @ moment 4 domains. configured realurl. configuration working far, cannot have shortcuts between domains. page tree looks this: domain1 pagea ... domain2 shortcut pagea ... the shortcut not working, redirects root page of domain2. believe problem not related realurl, not sure. believe multi-domain setup of typo3 currect, because other page types (including hyperlink page instead of shortcut). usual things included in typoscript setup like config { baseurl = domain2 typolinkcheckrootline = 1 typolinkenablelinksacrossdomains = 1 simulatestaticdocuments = 0 tx_realurl_enable = 1 content_from_pid_allowoutsidedomain = 1 prefixlocalanchors = } any suggestions? not sure more whether should work... thanks in advance, christoph first set config.tx_realurl_enable = 0 to check, if realurl error or typo3 configuration error. normally ts should enough: config.typolinkcheck...

xslt - CMS umbraco - xsl descendant -

i have page folder , links inside -firstpage +folder -page -page -folder -link1 -link2 -link3 -page i want reach link1,link2,link3 in tree. current page firstpage. how do that?? xsl wrote , give me first link in top folder <xsl:template match="/"> <xsl:for-each select="$currentpage/descendant-or-self::* [@isdoc][@level=2]"> <xsl:if test="count(current()/descendant::* [@isdoc]) &gt; 0"> <xsl:variable name="descendantpage" select="current()/descendant::* [@isdoc]"/> <xsl:value-of select="$descendantpage/text"/> </xsl:if> </xsl:for-each> </xsl:template> thank help. edit:new xsl use... <xsl:variable name="fid" select="number(1395)" /> <xsl:variable name="linksfolder" select="$currentpage/descendant-or-self::* [@isdoc][@level=2][@id='$fid']"> <xsl:template match="/"...

caching - Products stopped showing for a couple of hours with Magento -

i've come across strange issue on weekend 1 of our websites stopped displaying products when clicking on product category. 1 of collegues tested , getting usual error message 'there no products matching selection'. tested later in day , working fine. i'm wondering if cache management, don't know how of works. i've not worked on site before magento new me. there feature within 'index managment' looks runs every 24/48 hours. i need able give information client. helps appreciated. hope information enough go on. magento ver. 1.4.1.1 thanks. edit: if manually reindex data on 'product pricing' index. seems solve problem. need workout what's causing stopping in first place. there way can see when index management run , if error given? i think 1 of indexes refreshing. "catalog_category_products". to sure, manually re-index in backoffice, , check whether products appears in front or not. if not, check others inde...

java - Create Feedback Form in android -

i creating feedback form in app. this want : when user fills feedback form , clicks on submit button, user information sent email address without asking user log his/her account i.e. user can send feedback without our email credentials. possible? if yes please give hint. check answer below sending smtp messages (e-mails) in java. can set credentials sender account inside code here, won't need credentials user. https://stackoverflow.com/a/73649/2086735

mysql - Performance improvement for SQL count query -

what type of sql query use turn following; | id | serial | lcn | initlcn | |------|----------|-------|---------| | 1 | | a1 | | | 2 | b | a2 | | | 3 | c | a3 | a1 | | 4 | d | a4 | a2 | | 5 | e | a5 | a1 | |------|----------|-------|---------| into result similar this; | id | count | |------|---------| | 1 | 2 | | 2 | 1 | |------|---------| using low sql skills, have managed write below query extremely slow; select a.id, count (b.id) parent assets left join assets b on (a.lcn = b.initlcn) group a.id order a.id; select t1.id, t1.lcn, count(*) table1 t1 inner join table1 t2 on t1.lcn = t2.initlcn group t1.lcn see working live in sqlfiddle .

Getting outlook message using cURL php -

i want connect outlook.com using curl (php) , message inbox. <?php $url = "https://login.live.com/login.srf?wa=wsignin1.0&ct=1369129355&rver=6.1.6206.0&sa=1&ntprob=-1&wp=mbi_ssl_shared&wreply=https:%2f%2fmail.live.com%2f%3fowa%3d1%26owasuffix%3dowa%252f&id=64855&snsc=1&cbcxt=mail"; $post_fields ="email=xxxx@outlook.com&pass=xxxx"; $cookie_path = "\hotmail_login\cook"; $ch = curl_init(); curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_post, 1); curl_setopt($ch, curlopt_postfields, $post_fields); curl_setopt($ch, curlopt_returntransfer, 1); curl_setopt($ch, curlopt_followlocation, 1); curl_setopt($ch, curlopt_cookiefile, $cookie_path); curl_setopt($ch, curlopt_cookiejar, $cookie_path); curl_setopt($ch, curlopt_ssl_verifyhost, 0); curl_setopt($ch, curlopt_ssl_verifypeer, false); ...

CMake express the "greater or equal" statement -

i know in cmake can check compiler version this if(msvc_version less 1700) ... // msvc lower msvc2012 but how express in cmake syntax? if(msvc_version greater_or_equal_to 1700) ... // msvc greater or equal msvc2012 update cmake 3.7 , later: cmake 3.7 introduced couple of new comparisons if , among them greater_equal : if(msvc_version greater_equal 1700) [...] original answer older cmake versions: if((msvc_version greater 1700) or (msvc_version equal 1700)) [...] or better, avoids repeating condition: if(not (msvc_version less 1700)) [...]

Facebook Query Language using python -

i used following query in https://developers.facebook.com/tools/explorer?fql= select aid album owner = "100001741044617"; and got right output. i tried using same query via python , extract output getting problem. posting python code , output code: import urllib query = "select aid album owner = \"100001741044617\"" print(query) query = urllib.quote(query) print(query) url = "https://graph.facebook.com/fql?q=" +query data = urllib.urlopen(url).read() print(data) output [root@in-air-bimapp106 ~]# python /opt/fql.py select aid album owner = "100001741044617" select%20aid%20from%20album%20where%20owner%20%3d%20%22100001741044617%22 {"error":{"message":"a user access token required request resource.","type":"oauthexception","code":102}} i have generated required access token user_photoes. kindly let me know do. thanks. the access token needs included...

Magento: Adding a JS file to the head in an Ajax call? -

i calling controller using ajax. controller function called testaction(). works nice, function gets called. want add js header in function. approach this: i created handle, adds js file header: <my_handle> <reference name="head"> <action method="addjs"> <script>somefolder/myjs.js</script> </action> </reference> </my_handle> now added code controller add handle in ajax call, this. $layout = $this->getlayout()->getupdate(); $layout->addhandle('my_handle'); normally works pretty good, since ajax call, doesnt seem work (file not included after call returned). question is: how can add javascript file head in ajax call? thanks! since calling controller via ajax load javascript using jquery/javascript: using jquery: method: jquery.getscript() description: load javascript file server using http request, execute it. see official documentation ...

regex - robot.txt syntax not understood -

i getting error on first line of robot.txt user-agent: * my robot.txt follows: user-agent: * disallow: /search/ disallow: /_layouts/ disallow: /blog/_layouts/ disallow: /blog/_layouts/ disallow: /reusablecontent/ disallow: /reports%20list/ disallow: /workflowtasks/ disallow: /sitecollectionimages/ disallow: /documents/forms/ disallow: /pages/forms/ disallow: /internet/ i have figured there space /reports%20list/ . creating issues? not sure. appreciated. the trouble here 3 invisible bytes @ beginning of utf-8 formatted robots.txt file, called bom (byte order mask). bom optional. yes, need file utf-8 formatted, google not optional bom in expected clear , simple robots.txt file , parsing fails. you can read more detailed explanation here .

iphone - Failed to upgrade the iOS application while app is doing network operations using sockets -

when trying update application using itunes , getting error pop-up - unable download application. running error only when app doing network operations using sockets. in other scenarios app either not running or idle, works correctly. from console logs , got following error message - 2013-04-18 10:11:39 gmt+07:00 backboardd <warning>: pid_suspend failed [7104]: unknown error: -1, unknown error: -1 2013-04-18 10:11:39 gmt+07:00 backboardd <warning>: not set priority of [7104] 4096, priority: no such process 2013-04-18 10:11:39 gmt+07:00 backboardd <warning>: application 'uikitapplication:com.avaya.avsipiphonecfe[0xe6ed]' exited abnormally signal 9: killed: 9 any idea why happen? this question addresses similar problem. in short, ios automatically restarts app crashes or exits abnormally, if has background execution flag set. seems leads itunes being unable overwrite old binary new one, because it's still running.

java - Accessing Browser using RegistryEdit -

i accessing ie gui when default browser not set.that time accessing ie (when ie not default browser) using path in regisryedit software\\microsoft\\windows\\shell\\associations\\urlassociations\\http\\userchoice . ie launching gui when default browser not set. in windows xp using software\classes\http\shell\open\command path.it not working? path correct. 1) software\\microsoft\\windows\\shell\\associations\\urlassociations\\http\\userchoice --progid ie.http in windows 7 2) software\\classes\\http\\shell\\open\\command ---nothing shown windows 7. what should access ie(when not set default)from windows xp. you can read path here: hkey_local_machine\software\microsoft\windows\currentversion\app paths\iexplore.exe the ie installed path stored in 'path' value of key.

cassandra - YCSB Execution Error -

when running ycsb, getting following error. followed steps specified in ycsb git hub link, still getting error exception in thread "thread-3" java.lang.nosuchmethoderror: org.slf4j.impl.staticloggerbinder.getsingleton()lorg/slf4j/impl/staticloggerbinder; @ org.slf4j.loggerfactory.bind(loggerfactory.java:128) @ org.slf4j.loggerfactory.performinitialization(loggerfactory.java:108) @ org.slf4j.loggerfactory.getiloggerfactory(loggerfactory.java:279) @ org.slf4j.loggerfactory.getlogger(loggerfactory.java:252) @ org.slf4j.loggerfactory.getlogger(loggerfactory.java:265) @ org.apache.zookeeper.zookeeper.<clinit>(zookeeper.java:93) @ org.apache.hadoop.hbase.zookeeper.recoverablezookeeper.<init>(recoverablezookeeper.java:92) @ org.apache.hadoop.hbase.zookeeper.zkutil.connect(zkutil.java:107) @ org.apache.hadoop.hbase.zookeeper.zookeeperwatcher.<init>(zookeeperwatcher.java:157) @ org.apache.hadoop.hbase.zookeeper.zookeeperw...

ios - Call to function 'ABRecordCopyValue' returns a corefoundation object with a +1 retain count -

i have following code in project - (bool)peoplepickernavigationcontroller: (abpeoplepickernavigationcontroller *)peoplepicker shouldcontinueafterselectingperson:(abrecordref)person { [popcontactsform dismisspopoveranimated:yes]; [ssemailvc setname: (nsstring *)abrecordcopyvalue(person,kabpersonfirstnameproperty)]; abmultivalueref emails = (nsstring *)abrecordcopyvalue(person,kabpersonemailproperty); if (abmultivaluegetcount(emails)>0) { [ssemailvc setemail:(nsstring *)abmultivaluecopyvalueatindex(emails,0)]; }else [ssemailvc setemail:@""]; cfrelease(emails); [peoplepicker dismissmodalviewcontrolleranimated:yes]; [popemailform setpopovercontentsize:cgsizemake(350.0, 225.0)]; return no; } i gettings following warnings 1.call function 'abrecordcopyvalue' returns corefoundation object +1 retain count 2.object leaked:allocated object not referenced later in execution , has retain coun...

ios - Every time I add something to the CoreData file i get sigabrt -

every time add coredata (like adding attribute 1 of entities) sigabrt , thing helps deleting app emulator , cleaning project. added exception breakpoint , function breaks: - (nspersistentstorecoordinator *)persistentstorecoordinator { if (_persistentstorecoordinator == nil) { nsurl *storeurl = [nsurl fileurlwithpath:[self datastorepath]]; _persistentstorecoordinator = [[nspersistentstorecoordinator alloc] initwithmanagedobjectmodel:self.managedobjectmodel]; nserror *error; if (![_persistentstorecoordinator addpersistentstorewithtype:nssqlitestoretype configuration:nil url:storeurl options:nil error:&error]) { nslog(@"error adding persistent store %@, %@", error, [error userinfo]); abort(); } } return _persistentstorecoordinator; } if uncomment abort() app works wont access data, how can fix can add attribute without needing erase every time? edit:added error. 2013-05-21 13:52:35.441 ...

memory management - Mem usage is different from TOP and JMAP for java application -

it's reducer program in hadoop job. "top" command tells me res 4.0g mem, , data 4.5g. , system begins use swap. run reducer -xmx4g option. in same time, use jmap see histogram of objects jmap -histo pid and tells me in total things in heap sum 1.3g mem. repeated several times , result same. why such big difference between top , jmap, remaining memory? i use sun java 7 , in program there's lots of int[] (allocated new). thanks.

disjoint union - Scala variable parameter count Either -

is there implemented variable parameter count scala either in library, mean analogic hlist . don't want implement myself :-) this not directly answer question have considered using scalaz's either type symbol \/ ? can "chain" several types in sum type, this: import scalaz._ lazy val a: int \/ string = ??? // a: scalaz.\/[int,string] = <lazy> lazy val b: int \/ string \/ double = ??? // b: scalaz.\/[scalaz.\/[int,string],double] = <lazy> lazy val c: int \/ string \/ double \/ bigint = ??? // c: scalaz.\/[scalaz.\/[scalaz.\/[int,string],double],bigint] = <lazy> val d1: int \/ string \/ double \/ bigint = -\/(\/-(42d)) // d1: scalaz.\/[scalaz.\/[scalaz.\/[int,string],double],bigint] = -\/(\/-(42d)) import scalaz._ val d2: int \/ string \/ double \/ bigint = 42d.right.left // d2: scalaz.\/[scalaz.\/[scalaz.\/[int,string],double],bigint] = -\/(\/-(42d)) val e1: int \/ string \/ double \/ bigint = -\/(-\/(\/-("42"))) /...

java - Custom Autocomplete Adapter Android -

i wish have auto-complete text-box comes users contact names. code follows. private void getcontactnames() { cursor cursor = getcontentresolver().query(contactscontract.contacts.content_uri,null,null,null,null); _contactadapter = new arrayadapter<string>(this,android.r.layout.simple_dropdown_item_1line); while (cursor.movetonext()) { int nameidx = cursor.getcolumnindex(contactscontract.phonelookup.display_name); string tmp = cursor.getstring(nameidx); _contactadapter.add(tmp); } } setting adapter: autocompletetextview contactname = (autocompletetextview) findviewbyid(r.id.contactname); contactname.setadapter(_contactadapter); when this, adapter has contact names in there (238 contacts). however, when start typing text box, auto complete not show. funny, when test out doing this: string[] ab = new string[] {"aaaaa", "bbbbb"}; _contactadapter = new arrayadapter<string>(this,android....

Open a structure of substructures of matlab with python -

i have structure of substructures output of matlab file. every substructure has 4 variables 3 arrays. access every single value of data python. does have idea on how can that? new in python. have installed numpy , scipy. % ----matlab file example---- main_struct{ substruct1{atr1,atr2[1x64],atr3[50x64],atr4[50x64]} substruct2{atr1,atr2[1x64],atr3[50x64],atr4[50x64]} . . . substructn{atr1,atr2[1x64],atr3[50x64],atr4[50x64]} } thanks in advance. you can read matlab(.mat) files in python, try this: from scipy.io import loadmat mat = loadmat('file.mat') then access structure with: my_struct = mat['variable_name_in_matlab'] after can do >>> print my_struct.shape (1, 1) >>> val = my_struct[0,0] >>> print val ([[1.0]], [[2.0]]) >>> print val['field1'] [[ 1.]] >>> print val['field2'] [[ 2.]] >>> print val.dtype [('fie...

struts2 - display generated report via jaspereports on browser -

i'm developping struts2 app,and want show generated report on browser. i've succefully generate report on disk.but want see @ browser.here code. my index.jsp <body> <a href="html.action">reporting</a> </body> my action databeanlist public class databeanlist extends actionsupport { public arraylist<databean> getdatabeanlist() { arraylist<databean> databeanlist = new arraylist<databean>(); databeanlist.add(produce("manisha", "india")); databeanlist.add(produce("dennis ritchie", "usa")); databeanlist.add(produce("v.anand", "india")); databeanlist.add(produce("shrinath", "california")); databeanlist.add(produce("issam", "casa")); return databeanlist; } /** * method returns databean object, * name , country set in it. */ private databean produce(strin...

What is the best way to study design patterns in C++ which deals with real-life situations? -

eg. if have design basic prototype of robot or basic gadget , book or blog/sites provide info pertaining design oriented programming not ones complex problem or puzzle there lot of things can study in books, websites, etc. when comes learning programming, there's no substitute sitting down , doing it. writing real code solves real problems. artificial problems of course exercises, need have "reality" of things not neat , not solved 1 simple solution - need 2 different solutions 2 different parts of problem. yes, known recipes, solutions , algorithms , (and necessity), no point if lego pieces have aren't fitting make boat, plane or castle in end. and whilst learning other's mistakes thing, never quite learn others own mistakes. once have made mess of things, know , when "start on again" on particular construct.

java - What's the difference between new String(byte[]) and DatatypeConverter.printBase64Binary(byte[])? -

i need pass base64 encoded data xml string value. noticed code below prints different string representation. 1 correct , why? string example = "hello universe!"; byte[] base64data = base64.encodebase64(example.getbytes()); system.out.println(new string(base64data)); system.out.println(datatypeconverter.printbase64binary(base64data)); system.out.println(new string(base64.decodebase64(base64data), "utf-8")); and result: sgvsbg8gdw5pdmvyc2uh u0dwc2jhogdkvzvwzg1wewmyvwg= hello universe! u0dwc2jhogdkvzvwzg1wewmyvwg= decoded sgvsbg8gdw5pdmvyc2uh hello universe! encoded. did encoding twice. there no difference. using api wrong way. don't encode encoded data again.

objective c - Finding place name from google Place search -

i want find place name lat , long.i using google place api. how can achieve this now can search nearby lat , long using https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=-33.8670522,151.1957362&radius=500&types=food&name=harbour&sensor=false&key=addyourownkeyhere you can use mkreversegeocoder name, district, info, etc. of given latitude , longtitude. however, notice deprecated. the viewcontroller should delegate of mkreversegeocoderdelegate. sample usage of mkreversegeocoder is; - (void)viewdidload { cllocationcoordinate2d coordinates; coordinates.latitude = 33.8670522; coordinates.longitude = 151.1957362; cllocation *location = [[cllocation alloc] initwithlatitude:coordinates.latitude longitude:coordinates.longitude]; mkreversegeocoder* rev = [[mkreversegeocoder alloc] initwithcoordinate:location.coordinate]; rev.delegate = self; [rev start]; [super viewdidload]; } - (void)reversegeocoder:...