Posts

Showing posts from May, 2010

php - correct htaccess query string code -

is correct code htaccess setting header noindex nofollow rewritecond %{query_string} (^|&)cart? [nc] rewriterule .* - [e=my_set_header:1] header set x-robots-tag "noindex, nofollow" env=my_set_header so following url cannot indexed search engines. http://www.mysite.com/cart?qty=1&id_product=8&token=7775324f4cd8c884155af53ca90e44ad&add actually moz analytics crawling these types of url in <a href="http://www.mysite.com/cart?qty=1&id_product=8&token=7775324f4cd8c884155af53ca90e44ad&add">add cart</a> as duplicate page content. dont know why these url add cart url , these nothing content. also need suggestion online tutorial on playing htaccess . thanks. /cart isn't query_string request uri. can use rule instead: rewritecond %{query_string} .+ rewriterule ^cart/?$ - [e=my_set_header:1]

php - MySQL: Select date plus 6 months if less than now() plus 1 month -

i have given date: 2013-12-20 this issue date of product product expiries in 6 months date of issue. expiration date not stored want check given issue date if expiring in next month of now(). so guess add 6 months issue date , check + interval of 1 month if expiring? here tried: select * `products` date_add(`issue_date`,interval 6 month) < date(now() + interval 1 month) order `issue_date` asc what i'm doing wrong? select * products now() <= date_add(issue_date, interval 7 month) && now() >= date_add(issue_date, interval 6 month) order issue_date asc; the first item has returned has due date today (so issue date + 6 months = today); than due date tomorrow (so issue date + 6 months + 1 day = today); ... than due date 1 month today(so issue date + 6 months + 1 month = issue date + 7 months = today)

how to check that behavior is undefined in c? -

i know following undefined because trying read , write value of variable in same expression, is int a=5; a=a++; but if why following code snippet not undefined int a=5; a=a+1; as here trying modify value of a , write @ same time. also explain why standard not curing or removing undefined behavior , in spite of fact know undefined? long story short, can find every defined behavior in standard. not mentioned there defined - undefined. intuitive explanation example: a=a++; you want modify variable a 2 times in single statement. 1) a= //first time 2) a++ //second time if here: a=a+1; you modify variable once: a= // (a+1) - doesn't change value of why don't standard define a=a++ behavior? one of possible reasons is: compiler can perform optimizations. more cases define in standard, less freedom compiler has optimize code. because different architectures can have different increasing instructions implementations, compiler wouldn't use...

Information Extraction from Text into Structured Data with Python -

i'm near total outsider of programming, interested in it. work in shipbrokering company , need match between positions (which ship open @ where, when) , orders (what kind of ships needed @ where, when kind of employment). , send , receive such info (positions , orders) emails , our principals , co-brokers. there thousands of such emails each day. matching reading emails manually. i want build app matching us. one important part of app information extraction email text. ==> question how use python extract unstructured info structured data. sample email of order [annotation in brackets, not included in email]: email subject: 20k dwt requirement, 20-30/mar, santos-conti content: acct abc [account name] abt 20,000 mt deadweight [size of ship needed] delivery make santos [delivery point/range, owners deliver ship charterers here] laycan 20-30/mar [laycan (the time spread in delivery can accepted] 1 time charter grains [what kind of empolyment/t...

email - Using HTML from Python Code -

i trying mail html code python. till 900 characters coming fine in mail. however, increasing characters missing of characters. example : #!/usr/bin/env python import os,logging,sys subprocess import popen, pipe import shutil,configparser,shlex,subprocess mail import sendmail str="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" str+="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" str+="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" str+="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" str+="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" str+="0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789" str+=...

codeigniter - getting a value from an array in model -

i need value of array in model compare value.how can it? code in model: function get_order(){ $this->db->select('order'); $this->db->order_by('order','desc'); $this->db->limit(1); $query=$this->db->get('section'); i need last order record $query.i tried code not show . echo $query['order']; thanks help try this, function get_order() { $result = $this->db->select('order'); ->order_by('order','desc'); ->limit(1) ->get('section') ->row(); return $result->order; } this function return order . hope helps :)

linux - what does the flag IRQF_SAMPLE_RANDOM specify while registering interrupt handlers? -

in request_irq() register interrupt handlers, why use flag irqf_sample_random , entropy pool? the entropy pool collects randomness /dev/random , /dev/urandom devices. in outdated kernels, have used irqf_sample_random tell kernel times @ device generates interrupts unpredictable. since kernel version 3.6, kernel handles interrupt randomness automatically, , flag no longer exists.

Mule Deployment properties file -

i have seen strange behaviour in mule application. created sample mule project(created flows) , opened mule-deploy.properties file "config.resources" value empty. but same above mentioned key value getting updated "configuration xml file name" when run mule project. is behaviour or updates need done. can clarify? regards vikram there known issues/features around mule-deploy.properties , mule studio. currently expected when running project mule studio mule-deploy.properties-config.resources automatically populated configuration files. there open issues on here: https://www.mulesoft.org/jira/browse/studio-3297 can vote on.

Request.form doesn't return a value with Visual Studio 2013 in code behind -

i think i'm getting blind....! what's wrong following code? visual studio 2013 "searchbox" doesn't return value vs 2008 works well. code behind partial class _default inherits page protected sub button1_click(byval sender object, byval e system.eventargs) handles button1.click response.write(request.form("searchbox")) end sub end class html page <%@ page validaterequest="false" title="home page" language="vb" masterpagefile="~/site.master" autoeventwireup="true" codefile="default.aspx.vb" inherits="_default" %> <asp:content id="bodycontent" contentplaceholderid="maincontent" runat="server"> <asp:textbox id="searchbox" runat="server"></asp:textbox> <asp:button id="button1" runat="server" text="search" /> </asp:content> it can't wor...

javascript - Find all jQuery scope stuff -

as know jquery scope contains namespace jquery plugins. there way list jquery loaded stuff in jquery scope? best example of question phpinfo() in php, lists loaded stuff of php. this should okay for (var plugin in $.fn) { if ($.fn.hasownproperty(plugin)) { console.log(plugin); } } if es5 supported, can use var plugins = object.keys($.fn).sort().join(", "); console.log(plugins); i think produces nicest output

I seem to have some misconceptions about `static` in C++ -

i seem have misconceptions how static keyword works in c++; specifically, need understand problem following code: #include <iostream> struct a{ int a; a(int ain) : a(ain) { } a() : a(1) { } static geta() { return a(2); } }; struct b { static a = a::geta(); }; int main() { std::cout << b::a.a << std::endl; } had static worked expected to, above code sample have printed 2 , exited - instead, following compiler error message: g++ -c -o syntax.o syntax.cpp syntax.cpp:17:21: error: ‘a::geta()’ cannot appear in constant-expression static a = a::geta(); ^ syntax.cpp:17:26: error: function call cannot appear in constant-expression static a = a::geta(); ^ syntax.cpp:17:26: error: invalid in-class initialization of static data member of non-integral type ‘a’ syntax.cpp:17:26: error: initializer invalid static member constructor syntax.cpp:17:26: error: (an out ...

comparison - TSQL compare varchar in digit form -

basically did comparison in tsql below if ('500' > '400') print('no problem') else print('error') so, in situation, comparison should no problem if ('2500' > '400') print('no problem') else print('error') however, when situation above appeared, 'error' print. basically, code comparison base on first character of strings. can explain? extra question : if insist compare strings without casting int or double . how can it? when compare varchar values, comparison lexicographical i.e. according alphabetical order. therefore, if treat 2 numeric values strings, compared strings too. means need convert strings numeric type if want compare numeric value.

Replacement of table values in R? -

the following codes: female=(1) male=(2) r <- sapply(list(female, male), length) distribution = sample(c(female, male), size = 100, prob = rep(c(0.2, 0.8) / r, r), replace = true) summary(distribution) distribution[distribution == "1"] <- "f" i replace 1s "f" , 2s "m". how can it? please help. i think have change vector's type character first: distribution <- as.character(distribution) distribution[distribution == "1"] <- "f" distribution[distribution == "2"] <- "m"

javascript : stop http request when click submit -

now have form validation when click submit shows error sends request server. if(test == true) .......; else{ if(!adviceblock){ el.insert({after:'<div class="validation-advice">the price should equal or greater <?php echo $minprice; ?>.</div>'}); el.addclassname('validation-failed'); } how can stop request when submit button clicked ? you need prevent event listening to: event.preventdefault() or, equally, return false function return false;

ibm mobilefirst - IBM Worklight - Build failure: "There are multiple skins for android with the same name" -

Image
while trying build android environment, following error occurs: fwlst1040e: android build failed: there multiple skins android same name: android.phone how resolve problem? make sure in worklight project, have 1 skin folder same name, in application-descriptor.xml

iphone - Basic Expression Language Within iOS -

i looking create basic expression language can leverage within ios application. pulling these values in file @ runtime. in past have leveraged regular expressions this, has own limitations (as have 2 operands , operator). want have bit more robust support expressions following: some examples: valuea != valueb (valuea == valueb) && (valuec != valued) valuea >= valueb basically, want provide dictionary expression evaluator , have pull values variables dictionary. any thoughts on efficient way done? i've done 5 minutes of research morning on coreparse , parsekit, new both (and parser generators whole). you use nspredicate , example: nsstring *expr = @"($valuea == $valueb) && ($valuec != $valued)"; nspredicate *predicate = [nspredicate predicatewithformat:expr]; nsdictionary *vars = @{@"valuea": @7, @"valueb" : @7, @"valuec": @3, @"valued": @4}; bool result = [predicate evaluatewithobject:n...

vb.net - Save file path on show dialog -

Image
i want save path on text box after directory 1: whenever try close application , open again path not there.i want show every time open application. private sub btnrootbrowse1_click(sender system.object, e system.eventargs) handles btnbrowse1.click rootfolderbrowserdialog.showdialog() txtpath1.text = rootfolderbrowserdialog.selectedpath end sub you need save data (in case txtpath1.text) hard-drive (file or database) , reload in next execution. can easy when use application-setting : in solution explorer, double-click "my project" in left pane click "setting" in table, fill in fields needed, example case: name: directorylocation type: string scope: user value: empty. sample code using: public sub new() initializecomponent() 'load hard-disk txtpath1.text = my.settings.directorylocation end sub private sub btnrootbrowse1_click(sender system.object, e system.eventargs) handles btnbrowse1.click ...

How to copy Notes and Activities while converting Contact to Lead in Microsoft Dynamics CRM 2011 -

i have requirement copy notes , activities while converting lead contact , vice versa. when qualifying lead contact use custom plugin triggered qualifylead event. there no out of box solution convert contact lead use custom on-demand dialog. dialog unable run custom plugin (which copy notes , activities contact lead). please me find way copy stuff contact lead. you can create custom workflow activity code of custom plugin , uses step inside on-demand dialog. you can start here: http://msdn.microsoft.com/en-us/library/gg328515.aspx

javascript - convert string into place google maps -

i have searchbox , maps, when user write place searchbox map should moved place user has selected. and code: var input = document.getelementbyid('addressinput'); var searchbox = new google.maps.places.searchbox((input)); var places = searchbox.getplaces(); google.maps.event.addlistener(searchbox, 'places_changed', function () { places = searchbox.getplaces(); if (places[0].geometry.viewport) { map.fitbounds(places[0].geometry.viewport); } else { map.setcenter(places[0].geometry.location); map.setzoom(17); // why 17? because looks good. } }); so when user change place in searchbox works fine the problem when arrive page contains map first time because have string 'orlando' or 'chicago, illinois' (i string page) , put value searchbox document.getelementbyid('addressinput').value='orlando'; but don't place specifics because not place_changed event how can transform string place? th...

ios - viewWillDisappear network activity is causing jerk effect in UI -

i'm performing network activity in viewwilldisappear event, causing jerk(delay) in coming animation, can use performselectorwithdelay network activity in viewwilldisappear event? after animation block completes network operation start. safe?

I can't edit a node content into an XML file with Java -

i'm trying edit xml file java, thing need edit content & replace them want inside (i want replace nodes in deutsh french [for expample <fr>de1</fr> <fr>fr1</fr> ]) i tried use : node.settextcontent(value); node.setnodevalue(value); but doesn't work @ there other function might work in editing these nodes below ? here's code : (int = memory; < nodes.getlength(); i++) { node node = nodes.item(i); if ((langu.equals(node.getnodename()))) //langu = "fr" { test = node.gettextcontent(); if(iscorrect()){} else if ((manualtr.clickcount >= 0) ){ trash = test; node.settextcontent(value); // node.setnodevalue("test"); memory += manualtr.clickcount; ...

java - Apache Poi: Text is added to .doc file before it's content but not after it -

i need add simple text (from .txt or .doc file) .doc file code simple : public static void main(string[] args) throws ioexception { poifsfilesystem fs = new poifsfilesystem(new fileinputstream("/home/amira/work/apps-579/word/test1.doc")); hwpfdocument doc = new hwpfdocument(fs); range range = doc.getrange(); characterrun run = range.insertafter("hello world!!! works well!!!"); run.setbold(true); run.setitalic(true); run.setcapitalized(true); outputstream out = new fileoutputstream("/home/amira/work/apps-579/word/sampleafter.doc"); doc.write(out); out.flush(); out.close(); } the new sampleafter.doc created contains content of test1.doc : "hello world!!! works well!!!" string has not been added . i tried use range.insertbefore(string text) method works , string added before content of test1.doc. i don't it. there explanation issue. here's content of test1.doc : voilà mon premier test le 24/03/24 here's ...

asp.net web api - C# WebApi2 action not found -

i have action: [actionname("find")] [httpget] public override ihttpactionresult find(string number) { //get customer number... } this route: config.routes.maphttproute( name: "apibyaction", routetemplate: "api/{controller}/{action}", defaults: new { action = "get" } ); this trace: system.web.http.request;;;http://localhost:12345/api/customers/find?number=100 system.web.http.controllers;defaulthttpcontrollerselector;selectcontroller;route='controller:customer,action:find' system.web.http.controllers;defaulthttpcontrollerselector;selectcontroller;customer system.web.http.controllers;httpcontrollerdescriptor;createcontroller; system.web.http.controllers;httpcontrollerdescriptor;createcontroller;customercontroller system.web.http.controllers;customercontroller;executeasync; system.web.http.action;apicontrolleractionselector;selectaction; system.web...

java - LDAP: error code 50 - cannot be added due to insufficient access rights -

i trying add account opends running of windows. when tried add user, following errors. new opends. tips apprecitated org.springframework.ldap.uncategorizedldapexception: operation failed; nested exception javax.naming.nopermissionexception: [ldap: error code 50 - entry uid=test@example.com,ou=people,o=drive,dc=company,dc=com cannot added due insufficient access rights]; remaining name 'uid=test@example.com, ou=people, o=drive' thanks in advance... you have insufficient permissions on account using perform modify event.

RSA encryption with given modulus and exponent values in Objective-C -

i have modulus , exponent , have rsa encrypt plain text public key. how generate public key 2048 bits length given modulus , exponent values in objective-c. have tried openssl throwing exception " the data decrypted exceeds maximum modulus of 256 bytes " below code far have tried. didn't find option set key size 2048. -(nsstring*)performrsaencryptionfordata:(nsstring *)plaintext withmodulus:(nsstring*)mod andexponent:(nsstring*)exp{ //plaintext = @"abcd"; nsmutablestring *hexmod = [nsmutablestring string]; nsmutablestring *hexexp = [nsmutablestring string]; const char* utf8mod = [mod utf8string]; const char* utf8exp = [exp utf8string]; while ( *utf8mod ) [hexmod appendformat:@"%02x" , *utf8mod++ & 0x00ff]; while ( *utf8exp ) [hexexp appendformat:@"%02x" , *utf8exp++ & 0x00ff]; const char *plain = [plaintext utf8string]; //char crip[]=""; rsa * pubkey = rsa_new(); bignum * modul = bn_new(); bignum * expon = bn_...

mongodb - Couldn't connect to new shard ReplicaSetMonitor no master found for set -

i'm trying deploy sharded cluster in mongodb i followed tutorial here http://docs.mongodb.org/manual/tutorial/convert-replica-set-to-replicated-shard-cluster/ first deployed replica set test data on separate machine ip 192.168.1.212 and status after finished deploying it firstset:primary> rs.status(); { "set" : "firstset", "date" : isodate("2014-03-24t10:54:06z"), "mystate" : 1, "members" : [ { "_id" : 1, "name" : "localhost:10001", "health" : 1, "state" : 1, "statestr" : "primary", "uptime" : 117, "optime" : timestamp(1395650164, 10507), "optimedate" : isodate("2014-03-24t08:36:04z"), "self" : true }, { "_id" : 2, ...

Display Alert dialog box in just of progress dialog completed android -

hello friends want display alert dialog box in of complete progress dialog box. progress complete upto 100 want ask/inform information through alert dialog box.i in both dont know how integrate both please me .. in advance. code following lv.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adapterview<?> parent, view view, int position, long id) { no = 1; int = lv.getselecteditemposition(); toast.maketext(getapplicationcontext(), "item " + + " selected", toast.length_short).show(); system.out.println("progress start"); progressdoalog.setmax(100); progressdoalog.setmessage("connecting please wait...."); progressdoalog .setprogressstyle(progressdialog.style_horizontal); progressdoalog.show(); progress...

javascript - Standard Properties and Methods on HTML elements does not work with FullCalendar 'element' -

i'm working jquery fullcalendar , tried use call function eventrender , call element.getattribute() in code sample. but says uncaught typeerror: object [object object] has no method 'getattribute' why happening ? this standard properties , methods on html elements not work element object. the fullcalendar documentation says element newly created jquery <div> used rendering. has been populated correct time/title. can't call methods , properties on element code : <script> $(document).ready(function() { var date = new date(); var d = date.getdate(); var m = date.getmonth(); var y = date.getfullyear(); $('#calendar').fullcalendar({ editable: true, events: [ { title: 'first', start: new date(2014, 1, 24, 8), end: new date(2014, 2, 3, 8) }, { title: 'second', start: new date(2014,...

c# - Parallel.Foreach and Task conflict -

i uploading images cloud in parallel execution : // make taskfactory use ui thread's context var uifactory = new taskfactory(taskscheduler.fromcurrentsynchronizationcontext()); parallel.foreach(finalfilenames, new paralleloptions { maxdegreeofparallelism = 4 }, path => { count++; /* calculate percentage of upload done */ double ipercentdone = (int)(((float)count / itotalfiles) * 100); // send progress report ui thread. uifactory.startnew(() => uploadprogress.value = ipercentdone; lblprogress.content = count.tostring(cultureinfo.invariantculture) + " file(s) uploaded " + itotalfiles + " file(s)"; } }); the problem facing is, ui blocked when doing this. reason seems working in same thread.. if wrap parallel.foreach in "task.factory.new", making async calls, not requirement. please l...

html - CSS - My div wont place in top left corner -

when i'm trying place header-div in top left corner, there white space between header-div , top, , left. how move div corner? body { width:100%; height:190%; } #header{ display:block; background-color: #1b1b1b; width:100%; height:50px; } it seems struggling margin , padding. try add margin , padding in body. body { width: 100%; height: 190%; margin: 0; padding: 0; } here demo.

ios - App crash in ASIHttpRequest class -

Image
i using asihttprequest class in application handle server communication. getting application crash sometimes. here screenshot of crash: i cant why happening. can 1 tell me? exc_bad_access crashes due retain/release issues typically. tips on how track them down - https://developer.apple.com/library/mac/qa/qa1367/_index.html you don't want ship app asihttprequest. believe support died out long time ago. @ using sdk or maybe try afnetworking.

c# - render conditional asp:content -

i need render conditional asp:content how can please? **if( culture=fr)** <asp:content contentplaceholderid="altcolumncontent" id="altcolcontent" runat="server"> <div class="altbloc"> content 1 </div> <!-- end: alternative bloc --> </asp:content> **if(culture=en)** <asp:content contentplaceholderid="altcolumncontent" id="altcolcontent" runat="server"> <div class="altbloc"> content 2 </div> </asp:content> when, put 2 asp:content same contentplaceholderid have erros. regards if want change content based on culture property value, there no need render different content tags, , better move if statement inside , render different content inside based on culture value? this pseudo-block demonstration <asp:content contentplaceholderid="altcolumncontent" id="altcolcontent" runat=...

How to set the opacity of a ListView row in android? -

i want set opacity of each , every listview row using android:alpha . tried doing row doesn't transparent background. have colorful background of layout , want glass or transparent type of row of listview. how can it?. don;t want use adapters this. please suggest simple methods. view backgroundimage = findviewbyid(r.id.background); drawable background = backgroundimage.getbackground(); background.setalpha(80);

mysql - Exclude from results if condition is met -

i have suppliers table many different suppliers in wanted show 1 particular supplier rather other if both present. there way compare results in select statement ? something along lines of: select supplier, price table if in supplier (supplier1,supplier2) select supplier table supplier <> supplier1 is possible in mysql or better create array , way ? thanks, rick edit @jim at moment i'm selecting , results like: supplier name | supplier price acme company | $12 acme company (northwest) | $12 bobs company | $13 craigs company | $15 acme company , acme company (northwest) same company, in cases both appear in results (they not) preference have acme companys price displayed. if want 1 row returned, can fancy sort , select first result: select supplier, price table supplier in (supplier1, supplier2) order (case when supplier = 'supplier1' 1 when supplier = 'supplier2' 2 end) desc limit 1; thi...

ibm mobilefirst - Worklight v6.1 - Workbench -

i using worklight 6.1.0.1 ibm mobile test workbench 8.5.1.2. trying create test workbench project app worklight, following docs ( https://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2fcom.ibm.worklight.mobtest.doc%2ftopics%2ft_wl_creating_mobile_test_project_from_wizard.html ), not appear option create "ibm mobile test workbench" are sure mtww installed in eclipse shell. mtww has different installation wl studio (please read https://pic.dhe.ibm.com/infocenter/wrklight/v6r1m0/index.jsp?topic=%2fcom.ibm.worklight.installconfig.doc%2finstall_config%2ft_install_imtww.html )

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

i using signpost oauth access data magento server. have read various tutorials on same , reach point open browser user can enter credentials. however, per requirement have automate part. hence, user should not browser page. have set-up done on server side ( magento ), hit url , returned call page. same through program in android. i have tried below, consumer = new commonshttpoauthconsumer(key, secret); provider = new commonshttpoauthprovider(oauth_init_url,access_token_url, authorize_url); try { provider.retrieverequesttoken(consumer, oauth.out_of_band); log.d("tokens" , consumer.gettoken() + " -- " + consumer.gettokensecret()); } and request tokens. dont know how bypass next step. tried directly accessing accesstoken (stupid of me) provider.retrieveaccesstoken(consumer, "mycallback://callback"); no luck, ends in oauth.signpost.exception.oauthnotauthorizedexception: authorization failed (server replied 401). ...

sql - How do I enable the MySQL slow query log? -

this question has answer here: how can enable mysql's slow query log without restarting mysql? 7 answers my mysql version details are server: localhost via unix socket software: mysql software version: 5.0.96-community-log - mysql community edition (gpl) protocol version: 10 how enable mysql slow query log? version 5.1.6 , above: 1. enter mysql shell , run following command: set global slow_query_log = 'on'; 2. enable other desired options. here common examples: log details queries expected retrieve rows instead of using index: set global log_queries_not_using_indexes = 'on' set path slow query log: set global slow_query_log_file ='/var/log/mysql/slow-query.log'; set amount of time query needs run before being logged: set global long_query_time = '20'; (default 10 seconds) 3. confi...

asp.net - Execute async tasks in a web garden -

i have function executes async task run , return results public bool checknetworkdrive(string drive) { var task = new task<bool>(() => { return checknetworkdrivemethod(drive); }); task.start(); //make async call check network path avoid lock in case of not exist if (task.wait(5000) && task.result) return true; return false; } in local host works fine in webgarden not seems work , can’t figure exact reason, can or suggest alternative ! ps, check method check network path, if it’s not responding block whole code, why need fire , async wait method. sorry inconvenience, turned out problem not parallel task in particular,i'm using window identity impersonation access network drives , somehow task seems lose impersonation after passed impersonated user task worked fine. i found helped how set user identity tasks when calling task.waitall()

jquery - Append a variable values with string using javascript -

i have below string. window.location="./getdata?geo=abc&tab=xyz"; now have abc , xyz in var below: var geo="abc"; var tab="xyz"; now how can append var above string instead of hard coding them inside string? thanks! try below: var geo="abc"; var tab="xyz"; window.location="./getdata?geo=" + geo + "&tab=" + tab; '+' symbol used concotinate string

android - eglMakeCurrent failed when using genymotion -

when im using genymotion application emulating android apps, after times crashes messages like: "launcher has stopped", or " has stopped" , in console see massega time when messages shown. "eglmakecurrent failed" when googled found can cause of problems fglrx driver, , whas recomended switch xserver-xorg-video-ati here link: http://www.drevlyanin.ru/post/67048917668/genymotion-ubuntu-eglmakecurrent-failed i works amount of time , in low use< , @ first launch after ubuntu reboot (i guess services reboted, adb kill-services not helped) this state in mode: sudo aticonfig --px-dgpu will update if: sudo aticonfig --px-igpu and update question soon....

ios - how to replace an image on an image view when score changes? -

i have 2 images 1 gold 1 green, when score 100 image must gold image if score goes below 100 points image must change green image. } if (score < 100) { closeonechange.text = @"correct!"; } else { closeonechange.text = @"perfect!"; } the green image called greenone.png how done? if have 2 uiimageview s can use hidden property hide/show them required: if (score < 100) { closeonechange.text = @"correct!"; imageview1.hidden = no; imageview2.hidden = yes; } else { closeonechange.text = @"perfect!"; imageview1.hidden = yes; imageview2.hidden = no; } if have single uiimageview , can change image on fly: if (score < 100) { closeonechange.text = @"correct!"; imageview.image = [uiimage imagenamed:@"correct"]; } else { closeonechange.text = @"perfect!"; imageview.image = [uiimage imagenamed:@"perfect"]; }

javascript - Best way to know if a user has logged off -

i wondering best way detect browser log off, have timer set invalidates session after 30 minutes. if user didn't not log off exited browser? user opens same browser on same computer, before 30 minutes, because setting of going left off toggled on in browser settings. so far, have timer set every 30 minutes, have log out button, other best way log off or know if user exited browser. reason asking because there lot of security issues related setting in chrome, firefox, etc. lets users go left off. when browser crashes or forced quit, if open next day, go left off if click "restore" button when browser prompts because quit unexpectedly. what session hijacking? currently using java / jsp javascript / jquery on websphere. the way using websockets . websocket maintains constant connection between user's browser , server , raises event on connection close. you can using node.js's socket.io library. if user closes browser, tcp connection break , even...

c# - Several tasks cancellation -

there 1 top task launches task. var token = _cancellationtokensource.token; _task = new task(() => workaction(this, token), token); //top level task the inner task implementation is: public string finddevice(iprogressviewmodel progressviewmodel, cancellationtoken cancellationtoken) { (int = 0; < orderedcomportslist.count; i++) { try { cancellationtoken.throwifcancellationrequested(); } catch (operationcanceledexception) { return null; } string curport = orderedcomportslist[i]; if (innerisdeviceonline(devicemodelid, curport)) //the real long work return curport; progressviewmodel.currentvalue = i; } return null; } with implementation cancellation occur when last innerisdeviceonline ended. how implement finddevice make cancellable immediately? update 1. can that: bool? result = null; ...

spring - Double value getting set to 0 -

here firerules() method within orderresponsevo object inserted in session calculate earnings based on totalorderprice. private void firerules(productresponsevo orderresponsevo,orderdetailsvo orderdetailsvo{ orderresponsevo.setdiscounts(null); facthandle fact= vbdiscsession.insert(orderresponsevo); vbdiscsession.fireallrules(); calculatediscounts(orderresponsevo); orderdetailsvo.setearnings(orderresponsevo.getearnings()); orderdetailsvo.setinvoiceamount(orderresponsevo.getinvoice()); vbdiscsession.retract(fact); } here .drl file 2 rules written calculate add discounts based on totalordervalue , default rule fired everytime print totalorderprice //created on: mar 21, 2014 package com.mit.rules.vb import com.mit.vb.admin.order.bean.productresponsevo import com.mit.vb.admin.order.bean.discountvo import com.mit.vb.admin.order.bean.orderresponsevo //list import classes here. dialect "mvel" //declare global variables here rule "discount" ...

C++ got pointer instead of value -

i wondering why pointer value (324502) in var signallengthdebugvar1 instead of expected integer value (2)? struct shmlengthofsignalname { int signallength; }; //... byte* pbuf = null; //... int main(void){ //... pbuf = (byte*) mapviewoffile(hmapfile, file_map_all_access, 0, 0, buf_size); //... jobasignal sig1; printf("value signallength: %d \r\n", pbuf[30]); // 2 const shmlengthofsignalname * signalnamelengthptr = (const shmlengthofsignalname *)(pbuf + 30); int signallengthdebugvar1 = signalnamelengthptr->signallength; // content: 324502 maybe pointer? int signallengthdebugvar2 = (int) pbuf[30]; // content 2 sig1.setnamelength(signallengthdebugvar2); } when print value, you're reading single byte @ pbuf + 30 : // takes pbuf[30], converts byte's value int, , prints printf("value signallength: %d \r\n", pbuf[30]); // 2 later, when cast pointer , dereference it, you're accessing a fu...

Casting screen from Android mobile to Android Tablet -

i need develop 2 applications "sender" , "receiver". these 2 perform screen mirroring sender receiver. how can this? there in-built apis / libraries available same? can use miracast achiave this? if, yes please guide me. assumption: both device remain on same wifi. to collect ui sender, can try creating looks mirroringframelayout the cwac-layouts library . designed update separate mirror view on same device has mirroringframelayout , such having mirroringframelayout on touchscreen , mirror shown on external display via presentation . the problem encounter performance, current approach draws entire mirrorframelayout contents bitmap , shown mirror . require ship new bitmaps across network connection on every ui change, slow. so, while approach easy, may need more aware of ui doing can ship on smaller updates. the best approach may stop thinking of "screen mirroring" entirely, , instead focus on "operation mirroring". exa...

dart, a nice way of replacing keys and values in maps? -

i have map , want go through both values , keys , replace occurrences of particular objects meet set criteria other objects, if find key meets specific criteria. want swap key different object still points @ same value object in map, if find value want replace want original key point @ replacement value. here code works simplified example looks quite ugly, there nicer way of achieving this, meaning method doesn't require extract every key , value want replace , write replacements in. nicer able iterate of map once rather iterating on keys, , iterating on keys , values replaced? void main(){ //replace values of instance object , keys starting "t" same key minus "t" var m = { "one": new a(), "two": new a(), "three": new b(), "four": new b() }; mapkeyandvalueswapper(m, keymeetscondition: (k) => k.startswith("t"), valuemeetscondition: (v) => v a, keyreplacer: (k) ...

xmpp - Candy chat installation failed -

i have installed open fire server , http://domain.com/http-bind fine. , strophe working fine.tried setup using setup guide: [candy setup guide][1]. i stucked in connecting . candy installation guide [1]: http://candy-chat.github.io/candy/#setup "candy setup guide" strophe connecting. sent: <body rid='797907051' xmlns='http://jabber.org/protocol/httpbind' to='example.com' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/> sent: <body rid='797907051' xmlns='http://jabber.org/protocol/httpbind' to='example.com' xml:lang='en' wait='60' hold='1' content='text/xml; charset=utf-8' ver='1.6' xmpp:version='1.0' xmlns:xmpp='urn:xmpp:xbosh'/> sent: <body rid='797907051' xmlns='http://jabber.org/protocol/h...

string index out of bounds error in java (charAt) -

quick question. have code in program: input = joptionpane.showinputdialog("enter word below") int = 0; (int j = 0; j <= input.length(); j++) { system.out.print(input.charat(i)); system.out.print(" "); //don't ask this. i++; } input being user input i being integer value of 0, seen running code produces error: exception in thread "main" java.lang.stringindexoutofboundsexception: string index out of range: 6 @ java.lang.string.charat(unknown source) @ program.main(program.java:15) if change charat int 0 instead of i , not produce error... can done? problem? replace: j <= input.length() ... ... j < input.length() java string character indexing 0-based, loop termination condition should @ input 's length - 1. currently, when loop reaches penultimate iteration before termination, references input character @ index equal input 's length, throws stringindexoutofboundse...

sharepoint - CAML Query - Delete 1 Item -

camlquery: "<query><where><and><eq><fieldref name='item' /> <value type='lookup'>" + itemid + "</value></eq><eq> <fieldref name='author' /><value type='integer'> <userid /></value></eq></and></where><orderby> <fieldref name='id' ascending='false' /></orderby> <rowlimit>1</rowlimit></query>", my issue is delete multiple rows , not 1 all appreicated in end had quite horrible workaround: function deleteitem(itemid) { $().spservices({ operation: "getlistitems", async: false, weburl: "myurl", listname: "basket", camlviewfields: "<viewfields><fieldref name='title' /><fieldref name='item' /> <fieldref name='item:title' /></viewfields>", camlquery: ...

php - Ignoring initial loading of PHP_SELF -

i learning php , have page reloads itself. want know if can ignore function on initial loading of page , call once form submit button has been clicked. the page passed 'ticketid' , loads information it. want able add note using following form method: <form method="post" action="<?php echo htmlspecialchars($_server["php_self"]);?>"> <strong>add note:</strong> <textarea name="note" rows="5" cols="40" value=><?php echo htmlspecialchars($note);?></textarea> <span class="error">*<?php echo $noteerr;?></span><br> the user clicks on submit button submit note processing: <button type='submit' name='ticketid' value= <?php echo $_post['ticketid'];?> >view</button> </form> the 'ticketid' passed page reload information. if submit button pressed , no note has been entered want message ...

How to format Javascript date object to String, coming from a Java GregorianCalendar object, through JSON -

i have parsed object, containing gregoriancalendar object, java, json, , onwards javascript object. object have in javascript looks when printed in console.log() object dayofmonth: 27 hourofday: 0 minute: 0 month: 4 second: 0 year: 2014 is there way format through similar java's simpledateformat, pattern dd/mm-yy? or better approach parse calendar-object string before turning json-format in first place? i'd take second approach ( gregoriancalendar.gettime() preferred string format ) new date(datestring); within javascript once need date object. makes smaller transmission. appears either way work you.. aren't losing data.

configuration files - Getting error while compiling Glib 2.36.3 -

i've given required environment variable given below answer i'm compiling following code: ./configure --prefix="/home/qemu/support_libs/libs/glib" export cflags="-i`pwd`/../../support_libs/libs/gettext/include" export libffi_cflags="-i`pwd`/../../support_libs/libs/libffi/lib/libffi-3.0.13/include" export libffi_libs="-l`pwd`/../../support_libs/libs/libffi/lib -lffi" export zlib_cflags="-i`pwd`/../../support_libs/libs/zlib/include" export zlib_libs="-l`pwd`/../../support_libs/libs/zlib/lib -lz" export ld_library_path="`pwd`/../../support_libs/libs/gettext/lib:`pwd`/../.. /support_libs/libs/zlib/lib" ldflags="-l`pwd`/../../support_libs/libs/gettext/lib" i have taken care of necessary dependecy i'm getting error you must have either have gettext support in c library, or use *** gnu gettext library. (http://www.gnu.org/software/gettext/gettext.htm ...

C: const initializer and debugging symbols -

in code reviews ask option (1) below used results in symbol being created (for debugging) whereas (2) , (3) not appear @ least gcc , icc. (1) not true const , cannot used on compilers array size. there better option includes debug symbols , const c? symbols: gcc f.c -ggdb3 -g ; nm -a a.out | grep _sym 0000000100000f3c s _syma 0000000100000f3c - 04 0000 stsym _syma code: static const int syma = 1; // 1 #define symb 2 // 2 enum { symc = 3 }; // 3 gdb output: (gdb) p syma $1 = 1 (gdb) p symb no symbol "symb" in current context. (gdb) p symc no symbol "symc" in current context. and completeness, source: #include <stdio.h> static const int syma = 1; #define symb 2 enum { symc = 3 }; int main (int argc, char *argv[]) { printf("syma %d symb %d symc %d\n", syma, symb, symc); return (0); } the -ggdb3 option should giving macro debugging information. different kind of debugging information (it has different - t...

java - How to work with non generic lists -

i have work older interface specifying methods bare list parameter. void updateparameter(list param1, list param2); obviously need implement them same signature. @override public void updateparameter(list param1, list param2) { updateparam1( param1 ); updateparam2( param2 ); } but new code? should keep working these old lists. should new method's signature take generic lists? private void updateparam1( list<string> param1 ) { ... } should explicitly convert/cast them? what best practices here? i stick philosophy of "don't let defects passed down stream". somewhere, unsafe type cast must happen (even if done under hood compiler). why not possible? way code downstream can clean , have problem in 1 place instead of scattered throughout code base. follows principle of "fail fast". @override public void updateparameter(list param1, list param2) { list<string> param1typesafe = (list<string>)param1; list...

app inventor - Column Design multiple screen -

overview: creating game app 6 different screens. want create 2 columns , 3 rows app inventor implement this. this tried screen1: alighhorizontal - left block1: alignhorizontal -left, alignvertical - top block2: alignhorizontal -left, alignvertical - top this places 2 blocks. 1 on top left , 1 underneath it. result wanted 1 block left , 1 block beside it. edit* 6 columns -> 2 columns i being overall extremely ignorant it's pretty simple have put objects inside horrizontalarrangement , arrange horrizontaly.

java - Printing multiple files -

i working on jsp/servlet application have document management type product , want batch print i.e. multiple files(pdf, images, words etc.) @ time(without opening print dialog box). i had searched lot , found applets might requires certification installation. how achieve this?

c# - How to "query" a (game) server for data, by sending a message and recieving info like status, players online, etc -

Image
a small c# game making runs client , server. send message server possible , have server return stats such players online, status, server name, etc, able create list of online servers simple stats. the similar example can think of minecraft: we use lidgren library handle connections servers, however, connecting them takes far long. there quick way send request server , have reply simple stats in order make server list above? as lidgren connections thick, meaning establishes link own protocols before returning connections you, best have stated use different method. one of fastest solutions built directly on udp socket (see udpclient this) on fire out requests list of endpoints, , parse returns. note udp connectionless , issues no guarantees returns (one may dropped). offer checksum capability don't have worry corrupted responses. game server polling application such this, i'd udp work fine, , in fact unspoken industry standard way. fire wireshark , launc...

actionscript 3 - Action Script 3. After clicking button set It to "selected" state -

i have created button different up, over, down , hit images. up, on , down states working correctly, "hit" states don't work. mean after button clicked, return "up" state, not holing in "hit" state. what's problem? i've tried: my_btn.selected = true; - doesn't helped. my_btn.downstate; - doesn't helped too. my_btn.enabled = false; - disable button, still show button's "up" state. could me, please? thank you. hit 'state' used hitting area, means whatever draw there, used mask button clickable. the standard flash button not have 'selected' state. maybe need skin button component or create own.

Defining global constants in Postgresql stored function/procedures? -

i have set of functions have created in postgresql. able configure behavior , limits global constants. so far, have implemented functions these, functions call retrieve constant value: create or replace function slice_length() returns integer $$ begin return 50; end; $$ language plpgsql immutable; i wondering, there better/smarter way achieve this? take @ other answer. uses same approach do. create constant string entire database

floating point - PostgreSQL round(v numeric, s int) -

which method postgres round(v numeric, s int) use? round half up round half down round half away zero round half towards zero round half even round half odd i'm looking documentation reference. sorry, don't see hint of in documentation, a @ code indicates it's using round half away zero ; carry added digits , thereby increasing absolute value of variable, regardless of sign is. simple experiment (psql 9.1) confirms this: test=# create table nvals (v numeric(5,2)); create table test=# insert nvals (v) values (-0.25), (-0.15), (-0.05), (0.05), (0.15), (0.25); insert 0 6 test=# select v, round(v, 1) nvals; v | round -------+------- -0.25 | -0.3 -0.15 | -0.2 -0.05 | -0.1 0.05 | 0.1 0.15 | 0.2 0.25 | 0.3 (6 rows) interesting, because round(v dp) uses half even : test=# create table vals (v double precision); create table test=# insert vals (v) values (-2.5), (-1.5), (-0.5), (0.5), (1.5), (2.5); insert 0 6 test=# select...