Posts

Showing posts from May, 2011

Calling Cpanel UAPI method -

i have following simple script list ftp accounts unable work have following error tries call constructor include '/usr/local/cpanel/php/cpanel.php'; $cpanel = new cpanel(); // connect cpanel - once. // list ftp account information. $list_ftp_accts = $cpanel->uapi('ftp', 'list_ftp'); echo "<pre>"; print_r($list_ftp_accts); fatal error: uncaught exception 'runtimeexception' message 'there problem fetching env variable containing path socket' in /usr/local/cpanel/php/cpanel.php:146 stack trace: #0 /public_html/uapi.php(4): cpanel->__construct() #1 {main} thrown in /usr/local/cpanel/php/cpanel.php on line 146 line 146 in cpanel.php $socketfile = getenv('cpanel_phpconnect_socket'); according a post on cpanel forums , can use liveapi within cpanel's document root, meaning code need in either /usr/local/cpanel/base/frontend/ or /usr/local/cpanel/base/3rdparty/ . ran while trying use

android - unity game crash seems randomly when change scene -

i have 2 scene : levelselect scene , game play scene in game play scene , when user failure , can replay. make ugui button reload current scene. button code scenemanager.loadscene(1) , sometime crash. not alltime ,seems when fail game , press restart button, 3 or maybe 4 times game crash. not in android ,in wp81 or unity editor crash too. i trouble week ... help!!!! here android logcat info : ( anyway more error info ? thank link,keyword , help.) 01-28 00:32:35.205: i/aee/aed(24328): pid: 22948, tid: 22973, name: unitymain 01-28 00:32:35.205: i/aee/aed(24328): signal 11 (sigsegv), code 2 (segv_accerr), fault addr 0x80ff5fc1 01-28 00:32:35.286: i/aee/aed(24328): r0 80ff5f51 r1 000065f0 r2 a40697a0 r3 a40697a0 01-28 00:32:35.286: i/aee/aed(24328): r4 a3fc7f10 r5 00000003 r6 00000000 r7 3f800000 01-28 00:32:35.286: i/aee/aed(24328): r8 845940dc r9 000003e8 sl ffffef20 fp 89839020 01-28 00:32:35.286: i/aee/aed(24328): ip 00000000 sp 84968828 lr 83ca87a4 pc 83ca87fc cpsr 000e0010

jquery - Onclick is being called several times even when i have called it only once -

i have put code inside resize function in jquery. click function called multiple times. when click on desired link toggle takes place many times if ($(window).width() <=768){ if ($('body').hasclass('page-search-ads')){ if ($('#-clasifika-results-simple-search-form img').hasclass('funnel')) { } else { $('#-clasifika-results-simple-search-form').append("<img class='funnel' src='" + drupal.settings.basepath + "sites/all/themes/clasifika/images/filter.png'/>"); } $('.funnel').click(function(){ $('.vehicle-cat, .vehicle-brand, .city-name-filter, .vehicle-mileage,.overall-cat,.city-name,.boat-bed,.boat-type,.boat-brand,.nautical-length,.overall-year,.airplane-type,.fashion-cat,.airplane-brand,.airframe-time,.propeller-hours,.monthly-salary,.amount-slider,.area-slider').slidetoggle(); console.log(&

how to retrieve int value from Sharedpreferences in Android -

i trying save , value sharedpreference far storing data concern working i'm helpless while retrieving value. //setting constant private static final string wallpaper_pref_file = "wallpaper"; //method storing key value pair private void savewallpaper(int wallpaperid) { pref = getsharedpreferences(wallpaper_pref_file, mode_private); editor = pref.edit(); editor.putint("wallpaperid", wallpaperid1); editor.commit(); } // call method getsharedpreferences() value in oncreate() of activity . sharedpreferences getpreff = getsharedpreferences(wallpaper_pref_file, mode_private); //default value int resid1 = r.drawable.chat_composer; int resid = getpreff.getint("wallpaperid", resid1); //do operations resid look have typo in retrieval - wallpaerid. fix , should work. (even better, use constant string in both saving , retrieving avoid problem).

c# - correct way of looping trough a list and remove items -

i wrote function go trough list , remove list items if conditions met. program crashed on it, , after while concluded outer loop, goes through items in list. while @ same routine list of item can shorter. // lijst list of struct contains value .scanned , .price (int = 0; < lijst.count; i++) { if (lijst[i].scanned == false) { // (removed deletion of list item here) if (lijst[i].price > (int)nudminimum.value) { totaal++; lbldebug.text = totaal.tostring(); } lijst.removeat(i); //<-moved here } } now wonder whats correct this, without getting index out of range errors. you might looking for (int = lijst.count - 1 ; >= 0 ; i--) { if (lijst[i].scanned == false) { if (lijst[i].price > (int)nudminimum.value) { totaal++; lbldebug.text = totaal.tostring(); } lijst.removeat(i); } } question in comment: why other direction loop wor

serialization - How to delete Serializable entity exposed with Spring data rest and spring data mongo -

i have been experiencing error using spring data rest. cannot delete entities implement java.io.serializable. public class data implements serializable{ @id public string id; public string value; ... getters , setters here ... } my spring data repository follows: @repositoryrestresource public interface datarepository extends mongorepository<data,string>{ } the funny thing if remove "serializable" interface, can delete entities using delete http method. can delete if replace serializable interface custom interface. if introduce serializable method, when delete, gives me following error: {"cause":null,"message":"target bean not of type of persistent entity!"} java.lang.illegalargumentexception: target bean not of type of persistent entity! @ org.springframework.util.assert.istrue(assert.java:68) ~[spring-core-4.2.4.release.jar:4.2.4.release] @ org.springframework.data.mapping.model.basicpersistententity.

windows - Create file for every script instance -

i've created script below obtain folder size of c:\users linux tool du. script distributed via gpo users. xcopy \\0.0.0.0\netlogon\gnu-core-utils\du.exe c:\profile-size-script\ /i /s /y xcopy \\0.0.0.0\netlogon\gnu-core-utils\libintl3.dll c:\profile-size-script\ /i /s /y xcopy \\0.0.0.0\netlogon\gnu-core-utils\libiconv2.dll c:\profile-size-script\ /i /s /y c: cd c:\profile-size-script du -hs c:\users\* > \\0.0.0.0\userfolder\%username%.txt lines explained below: copies file called du.exe location c:\profile-size-script copies file called libintl3.dll same location. copies file called libiconv2.dll change drive c: in case cmd starts @ different drive letter. change same folder size use du folder size , echo output \0.0.0.0\userfolder\%username%.txt. the issue script not creating new file each user appending firstly created file %username%.txt i think you're looking this: xcopy \\0.0.0.0\netlogon\gnu-core-utils\du.exe c:\profile-size-script\ /i /s

windows - how to run the python script from batch command? -

@echo off setlocal enabledelayedexpansion set error=0 #set test_lang=eng ged subst /d h: 2>nul net use h: /delete /yes 2>nul net use h: \\10.165.128.44\_ance_7" 2>nul if not exist h:\ ( echo [error] problem mounting s: drive! cannot start test! goto end ) verify > nul h: echo. echo running framework_errors_with_ids.py call python framework_errors_with_ids.py -l if not "%errorlevel%"=="0" echo errorlevel %errorlevel% if not "%errorlevel%"=="0" set error=1 :end exit /b %error% the above .bat code. mounts server drive h , later calls python script. below python script framework_errors_with_ids.py : searches .log starts vcalogparser_output name. later checks scenario failed, if writes test case id output file. working fine without batch command on pc. if mount server pc , run batch command executing , printing empty output.txt. can me ?

linux - run nginx in docker with another application -

i have application needs serve on port :5000 here's dockerfile from ubuntu:14.04 run apt-get update run apt-get install -y nginx add ./nginx.conf /etc/nginx/sites-available/default run service nginx restart run go github.com/a/mycmd expose 5000 and run sudo docker run --publish 5000:5000 --rm app /go/bin/mycmd and here's nginx config file: limit_req_zone $binary_remote_addr zone=limit:10m rate=2r/s; server { listen 80; set_real_ip_from 0.0.0.0/0; real_ip_header x-forwarded-for; real_ip_recursive on; server_name 123.13.13.13 example.com; location / { proxy_read_timeout 3000s; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $remote_addr; proxy_pass http://127.0.0.1:5000; limit_req zone=limit burst=5 nodelay; } } then expect redirect traffic webserver (port 80 ) app port 5000 , seems nginx doesn't reverse proxy correctly. tr

jquery - Javascript string as closure function -

i generating highcharts json using server-side technology php. from browser sending ajax request fetch complete highcharts json , rendering it. for e.g ajax response [ { "plotoptions":{ "enabled":false, "series":{ "stacking":"", "point":{ "events":{ "click":"function(e){console.log(e.point.config); console.log(e.point.category)}" } } } }, "chart":{ "type":"column", "renderto":"lefttopcontainer", "polar":false }, "series":[ { "name":"netpos", "data":[6700,8200,11500] } ], "title":{ "text":"future financial commitments-5y yr view&quo

javascript - Slimbox set max width for "pop-up" image -

This summary is not available. Please click here to view the post.

Testlink- SMTP Error: Could not connect to SMTP host -

i'm admin user in testlink. i'm trying reset password of user. when clicking on reset password button following message appearing. password reset can not done. reason: smtp error: not connect smtp host. please let me know how resolve issue. /* [smtp] */ /** * @var string smtp server name or ip address ("localhost" should work in cases) * configure using custom_config.inc.php * @uses lib/functions/email_api.php */ **$g_smtp_host = '22'; # smtp server must configured** # configure using custom_config.inc.php $g_tl_admin_email = 'amirdjn@gmail.com'; # problem/error notification $g_from_email = 'oai-tools@oneaccess-net.com'; # email sender $g_return_path_email = 'amirdjn@gmail.com'; you can't connect smtp host because smtp server must configured** just set $g_smtp_host in config file: /* [smtp] */ /** * @var string smtp server name or ip address ("localhost" should

Signature verification issue in updating Azure SDK for Visual studio 2013 update 5 -

Image
i trying install azure sdk. have visual studio 2013 update 5. updating through visual studio follows. tool > extensions & updates > updates > microsoft azure sdk 2.8.1 > update. getting error box saying products did not install file failed signature verification. has else faced this? why signature verification failing files & how fix it?

mysql - SQL: Calculate time spent one each page -

i have 2 tables: pages: id | page | date | visit_id ---- ---------- --------- ------------ 1 1 2015-05-07 13:53:50 1 2 2 2015-05-07 13:53:54 1 3 3 2015-05-07 13:54:10 1 4 4 2015-05-07 13:54:49 1 5 1 2015-05-07 14:54:15 2 6 3 2015-05-07 14:54:30 2 7 4 2015-05-07 14:54:37 2 visits: id | end_date ---- --------- 1 2015-05-07 13:54:55 2 2015-05-07 14:54:50 i want average time spend on each page, after running query, final result should this: page count(seconds) 1 9.5 2 16 3 23 4 9.5 the last page user visited it's calculated using end_date in visits table. any ideas how query like? edit: calculation example: page 1

Using functions in 'while' loop python -

so want create code calculate minimum monthly payment , remaining balance, given annual interest rate, principal amount , monthly payment rate. desired output is: month: 1 minimum monthly payment: 168.52 remaining balance: 4111.89 month: 2 minimum monthly payment: 164.48 remaining balance: 4013.2 and on until month 12. i know there's way without defining functions whole function thing messing me wanted try it. current code - a=0 while a<=11: def min_mth_pay(balance,monthlypaymentrate): x = balance * monthlypaymentrate return x def balance(balance,min_mth_pay,annualinterestrate): y=(balance - min_mth_pay)*((annualinterestrate/12)+1) return y +=1 print('month:' + str(a) + 'minimum monthly payment:' + str(x) + 'remaining balance:' + str('y')) i'm not sure if can use fun

javascript - Replacing multiple div content with other content and being able to cycle -

currently have following: <div class="arrowleft"></div> <div class="arrowright"></div> <div class="reviewcomment"> <p>“thank making selling our car painless.”</p> </div> <div class="reviewname"> </div> </div> i've been looking @ different ways work when click 1 of "arrow" buttons, replaces content in "reviewcomment". far i've managed replace content going 1 way. example when gets 5th div's content, won't click first one? i've tried multiple different ways of doing can't seem cycle through like. i can't seem replace content of reviewname @ same time reviewcomment. keep track of comment you're on, , how many comments there are. if total comments == current comment, go first one. ex code: var comments = ['comment 1', 'comment 2', 'comment 3', 'comment 4', 'comment 5']; va

ios - replace object at indexPath - big array with 12 sections -

Image
i have array 12 sections , need replace value @ index. test code: nsmutablearray *hm = [[nsmutablearray alloc] initwithobjects:@{@"first": @[@"test1", @"test2"]}, @{@"second": @[@"test1"]}, nil]; nslog(@"%@", [hm valueforkey:@"first"][0][0] ); [[hm valueforkey:@"first"][0] replaceobjectatindex:0 withobject:@"lol"]; nslog(@"%@", hm); first nslog returns : test1 - ok when replace - crash -[__nsarrayi replaceobjectatindex:withobject:]: unrecognized selector sent instance 0x7fde53d2f700 i need change test1 something. wha doing wrong please? nsmutablearray *hm = [[nsmutablearray alloc] initwithobjects:@{@"first": @[@"test1", @"test2"]}, @{@"second": @[@"test1"]}, nil]; nslog(@"%@", [hm valueforkey:@"first"][0][0] ); //your inner array immutable, change mutable , replace object, that'

windows - PHP session_start on xampp -

whenever put session_start(); php code site won't load anymore. i'm running xampp on windows server 2012. tested same php code on local machines xampp , did work guess there wrong server. when try connect page following errors in apache error.log [thu jan 28 13:20:26.764131 2016] [mpm_winnt:notice] [pid 1296:tid 412] ah00428: parent: child process 2900 exited status 255 -- restarting. [thu jan 28 13:20:28.043237 2016] [ssl:warn] [pid 1296:tid 412] ah01909: 192.168.0.14:443:0 server certificate not include id matches server name [thu jan 28 13:20:28.323966 2016] [mpm_winnt:notice] [pid 1296:tid 412] ah00455: apache/2.4.18 (win32) openssl/1.0.2e php/7.0.1 configured -- resuming normal operations [thu jan 28 13:20:28.323966 2016] [mpm_winnt:notice] [pid 1296:tid 412] ah00456: apache lounge vc14 server built: dec 9 2015 10:17:39 [thu jan 28 13:20:28.323966 2016] [core:notice] [pid 1296:tid 412] ah00094: command line: 'd:\xampp\apache\bin\httpd.

Should a Chef custom resource use attributes as default property values? -

should chef custom resource use chef attributes default property values? can see several options here: have pure library cookbook, custom resources (or lwrps) ever configured writing recipe using chef dsl. have library cookbook default values properties can come chef attributes. allows users set values on chef server, long there's recipe using resources in question. have cookbook provides custom resources, has default recipe uses chef attributes fill in values. i.e. it's recipe uses attributes. in case, recipe (and attributes) in separate cookbook, seems convenient make in 1 cookbook. what's best practice here? i go option 3: https://github.com/poise/poise-monit/blob/master/chef/recipes/default.rb#l17-l22 i use node attributes directly in resources or providers if has global, can think of handful of cases has been case.

javascript - While operator undefined -

i want make small calculator in javascript. got html code looking (for numbers) <button type="button" onclick="calcnum(1)">1</button> <button type="button" onclick="operator('+')">+</button> var mynumbers = []; the calcnumber function this: function calcnum(i) { mynumbers.push(i); var x = document.getelementbyid("screen").innerhtml = mynumbers.join(""); } and operator function this: function operator(op) { var operator = op; var y = document.getelementbyid("screen").innerhtml = operator; } my goal make this: if press 1,2,3 want screen element display "123" (which does) if press "+" want "+" displayed (which does) when operator pressed, , new number pressed want start on new number, right if press "123" , + , "456" get: 123456, instead want display "456", hence starting on new

java - How to check if socket is connected or not using background thread -

i developing application in checking availability of port before reading , writing on socket. using following code check status private boolean isavailable(string host, int port) { try { socket socket = new socket(); socket.connect(new inetsocketaddress(host, port), 1000); isportavailable = socket.isconnected(); } catch (ioexception e) { isportavailable = false; } return isportavailable; } after checking status on onclick() if (isavailable(ip, integer.parseint(portlvr))) { startactivity(new intent(getapplicationcontext(),activitylivingroom.class)); } else toast.maketext(getapplicationcontext(),"connection error !", toast.length_short).show(); but problem if check status on main thread android give me networkonmainthradexception how manage operation using background thread? try this private class socketchecktask extends asynctask<string , integer , boolean>

php - How to call on next page through readmore link -

i'm using script in php. have added readmore option want user clicks on link open new page full article , gallery pictures. want open same window. echo "<div id=message>"; $text = $row["message"]; <?php echo substr($text,0,500);?> <a href="#"?id=<?php echo $row['id']?> title="full story of <?php echo $row['title']?>">read more &raquo;</a> please try following: echo "<div id=message>"; $text = $row["message"]; <?php echo substr($text,0,500);?> <a href="readmorepage.php?id=<?php echo $row['id']?>" title="full story of <?php echo $row['title']?>" target="_self">read more &raquo;</a> although _self default value of same need not write it.

Arduino C++ programm locks up after sending "on" but not "off" -

i have piece of code sending mqtt message. the message same change being changing action between 'on' , 'off'. can end off many times like, when send 'on' locks (even if first message) here code void update_thing(int pin, string thing, string action) { serial.println(thing + " state requested " + action); serial.println(action.c_str()); if (action == "on") { digitalwrite(pin, high); // pin = 5 v, led turns on } else { digitalwrite(pin, low); // pin = 5 v, led turns off } // generate new message sprintf(msg, "{\"state\":{\"reported\":{\"%s\": \"%s\"}}}", thing.c_str(), action.c_str()); if((rc = myclient.publish("$aws/things/myyunlight/shadow/update", msg, strlen(msg), 1, false)) != 0) { serial.println("publish failed!"); serial.println(rc); } } the issue appears lie in

php - How to add a custom ID to a Wordpress page with pagination? -

i have wordpress page. when add custom id url, unwanted 'paged' page. i want overview of custom data api. when click on item, should redirected '/mypage/10'. build plugin shortcodes , retrieves data api , displays it. then want want check if page 'mypage' has id in url. if so, retrieves new data , shows it. looked across internet, can't find want. validate id through parameters using 'mypage?id=10' and check @ api side for: $_get['id'] that should avoid routing issues or having rewrite routes. make sure escape variables properly. update seo purpose as of taken directly wordpress, add custom route rule application, using following: function custom_rewrite_basic() { add_rewrite_rule('^mypage/([0-9]+)/?', 'index.php?page_id=$matches[1]', 'top'); } add_action('init', 'custom_rewrite_basic'); just edit 'index.php?page_id=$matches[1]', match own destination.

sql - Using distinct and case for two separate columns -

i counting cases year using following code: count(case when year(filingdate)=2008 1 else null end) '2008' and want count these cases when column distinct. other column called 'filingdate' imagine this: count(case distinct (docketnumber) when year(filingdate)=2008 1 else null end) '2008', the sample records: docketnumber filingdate 123 2008 123 2008 123 2008 111 2009 112 2009 i recieve = 1 ideas? thanks use option subquery , group by clause select count(case when yearfilingdate = 2008 1 end) '2008' ( select year(filingdate) yearfilingdate, docketnumber dbo.test55 group year(filingdate), docketnumber ) x demo on sqlfiddle

Getting PHP variable value into a PDF file -

using following ajax code im sending variable 'a' php file get_output.php: var a=""; for($i=0;$i<n;$i=$i+1) { var = (a+'. '+ (document.getelementbyid((values[$i])).innerhtml)); } if (window.xmlhttprequest) {// code ie7+, firefox, chrome, opera, safari xmlhttp=new xmlhttprequest(); } else {// code ie6, ie5 xmlhttp=new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readystate==4 && xmlhttp.status==200) { document.getelementbyid("output_container").innerhtml=xmlhttp.responsetext; } } xmlhttp.open("post","get_output.php?q="+a,true); xmlhttp.send(); in get_output.php following code present: <html> <head> </head> <body> <?php $value=$_get["q"]; echo $value; ?> </body> </html> here getting output wanted in variable 'value'. want put variable 'val

ios - App Is Not Scrolling -

this question has answer here: uiscrollview not scrolling 20 answers i trying view controller scroll, won't work. clue what's wrong? uiscrollview *scroll = [[uiscrollview alloc] initwithframe:cgrectmake(0,0,320,480)]; scroll.contentsize = cgsizemake(320, 480); [self.view addsubview:scroll]; ggboxview *boxee = [[ggboxview alloc] initwithframe:cgrectmake(12, 56, 144, 120)]; [scroll addsubview:boxee]; this code part of ggviewcontroller class. you setting frame cgrectmake(0,0,320,480) , content size cgsizemake(320, 480) equal, content size must greater actual size of scrollview in order exhibit scrolling.

c - Why does my producer-consumer blocks? -

that's simple (almost)solution producer-consumer problem. uses wait , signal functions, blocks on 1 of waits. here files: prod.c int *pam; #define max 10 #define max2 12 #define pusty 2 //empty #define s1 0 #define pelny 1 //full #define zapis pam[max+1] //write #define odczyt pam[max] //read int main() { int i; time_t czas; key_t klucz, kluczm; int semid; int shmid; int n=3; printf("producer--------------------------------\n"); if((klucz=ftok(".", 'a')) == -1) {printf("blad ftok (a)\n"); exit(2);}; semid=alokujsem(klucz, n, ipc_creat | 0666); if(semid==-1) {printf("blad semafora - producent\n");exit(1);} kluczm=ftok(".", 'b'); shmid=shmget(kluczm, max2*sizeof(int), ipc_creat | 0666); if(shmid==-1) {printf("blad pamieci dzielonej - producent\n");

java - Kafka Storm Integration -

i trying integrate kafka , storm. i have created spout read kafka messages , emit them them tuples. while running storm topology, getting below exception caused by: java.io.notserializableexception: kafka.javaapi.consumer.zookeeperconsumerconnector @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1184) ~[?:1.8.0_45] @ java.io.objectoutputstream.defaultwritefields(objectoutputstream.java:1548) ~[?:1.8.0_45] @ java.io.objectoutputstream.writeserialdata(objectoutputstream.java:1509) ~[?:1.8.0_45] @ java.io.objectoutputstream.writeordinaryobject(objectoutputstream.java:1432) ~[?:1.8.0_45] @ java.io.objectoutputstream.writeobject0(objectoutputstream.java:1178) ~[?:1.8.0_45] @ java.io.objectoutputstream.writeobject(objectoutputstream.java:348) ~[?:1.8.0_45] @ backtype.storm.utils.utils.javaserialize(utils.java:87) ~[storm-core-0.10.0.jar:0.10.0] ... 2 more you should declare non-serializable fields in spout transient. these

XCode 7 usr/bin/libtool: No such file or directory -

Image
compiling framework gives following (slightly reformatted) error: /users/mehely/library/developer/xcode/deriveddata/<projectname>-cqcwkxegxcnodnetymctxgcbzdxy/build/intermediates/<projectname>.build/release-iphonesimulator/<projectname>.build/script-2901613518e1s7af0061d14e.sh: line 97: /applications/xcode.app/contents/developer/platforms/iphonesimulator.platform/developer/usr/bin/libtool: no such file or directory . i used fix error copying libtool /applications/xcode.app/contents/developer/platforms/iphoneos.platform/developer/usr/bin/ but inside xcode 7 iphoneos.paltform, libtool not anymore present: i can libtool older versions of xcode, cannot sure whether same version of binary. correct approach solve this? as using xcode 7, libtool located in following path: /applications/xcode.app/contents/developer/toolchains/xcodedefault.xctoolchain/usr/bin/libtool what can here copy it, , paste error's specified location: /applications/

Cannot fetch values from dynamically created textboxes in javascript -

form snapshot 2 php code creating textboxes dynamically for($i=0;$i<count($chkselec);$i++) { echo "<td align='center'><input type='text' id='".$columnvalue[$i]."' name='".$columnvalue[$i]."[]' size='5' onchange=addtoaggr('".$columnvalue[$i]."',".$count_var.") required /></td>"; } echo "<td align='center'><input type='text' id='aggr' name='aggr[]' size='7' value='".$rowtext['totalgrade']."' readonly='readonly' disabled/></td>"; this javascript function var i=0; var totalgrade=0; function addtoaggr(val,countvar) { var group6 = document.piscoreform.aggr; for(var i=0;i<2;i++) { for(var j=i;j<countvar;j++) { if(val=='comm') { var gr

mysql - How to select and check values of indiviual rows and add text to it data SQL -

ok have problem when select data table want count data , select the data in table consist of | name | fruits | | ben | apple | | tim | orange | | tim | pear | | tim | grape | so here's how want viewed | name | fruits number | | ben | 1 | | tim | 3 have many fruits| this how want show when run if else statement show this | name | fruits number | | ben | 1 have many fruits| | tim | 3 have many fruits| please me simple problem if((select count(fruits) fruits_table )>1)(select name , (count(fruits) + 'have many fruits') as'fruits number' fruits table group name) else (select name , (count(fruits) + ) as'fruits number' fruits table group name) select name, case when count(*) > 2 concat(count(*), ' have many fruits') else cast(count(*) char) end 'fruits number' mytable group name in fruits example case should work. of course

XPath filter attribute with namespace -

i trying following working alas failing return expected result. although similar questions have asked before restricted being limited xpath 1.0. i looking use xpath first text node inside "subtitle" node. xml follows: <topic class="coverpage"> <subtitle id="idb2907ca1-51fe-472e-bf99-246126937eab"> <xt:deltext xt:action="start" xt:author="james doherty" xt:datetime="2016-01-27t17:07:00" xt:id="fb72fba6-f502-422e-9e91-1731ed007e98"/> ignore <xt:deltext xt:action="end" xt:id="fb72fba6-f502-422e-9e91-1731ed007e98"/> sub-title <xt:instext xt:action="start" xt:author="james doherty" xt:datetime="2016-01-27t14:55:00" xt:id="44ac82c2-acfc-4721-b962-20ac2b18d9f3"/> insert additional text <xt:instext xt:action="end" xt:id="44ac82c2-acfc-4721-b962

sql - Mysql can't assign foreign key? -

hi trying make course_code foreign key, inside of module table so: create table course ( code char(3) not null, name varchar(30) not null, credits tinyint not null, constraint course_pk primary key (code)); create table module ( code char(2) not null, name varchar(30) not null, cost decimal(8,2) not null, credits tinyint not null, course_code char(3) not null, constraint module_pk primary key (code), constraint module_fk foreign key (course_code) references course(code)); the module table course_code references course tables code column, cannot seem work, appreciated, thanks! i don't think makes difference called can't rename 'code' in course table course_code?

Redis TimeoutException on VPN -

whenever try run app through vpn timeoutexception on call idatabase.stringget ( timeout performing get ). when directly connected network have no problem. i have confirmed there no firewall issue because can telnet redis server on port 6379 when connected through vpn.

swift - No such module 'DownPicker' Cocoapods -

Image
all other similar questions did not solve problem.so decided ask own . have opened xcworkspace file correctly . here podfile: # uncomment line define global platform project # platform :ios, '8.0' # uncomment line if you're using swift use_frameworks! target 'washandshine' pod ‘downpicker’,git : https://github.com/darkseal/downpicker end target 'washandshinetests' end target 'washandshineuitests' end my link binary libraries : here bridging header file , don't know how import .m file.is problem? #ifndef header_h #define header_h #import "downpicker.h" //#import "downpicker.m" #import "uidownpicker.h" //#import "uidownpicker.m" #endif /* header_h */ but still says no such module after building ? have done wrong? tried reinstalling still same thing . thing might cause fail in opinion downpicker written in objective c. post combobox component swift (failed downpicker) looks work on swif

javascript - jQuery show and hide dependent on value in C.I drop-down -

working in single view, have following c.i form_dropdown: <?php $international_options = array( '0' => lang('no'), '1' => lang('yes') ); echo form_dropdown('international', $international_options, set_value('international', isset($stockists->international) ? $stockists->international : 0), 'class="span4 selectpicker international"'); ?> and have following file up-loader: <label class="flagupload" for="filename">upload image flag</label> <input class='flagupload' type='file' name='filename' size='20' /> on same view (at bottom of view), have following script: <script> $(document).ready(function() { $("#select.international").change(function() { if ($('#select option:selected').text() == "yes") { $('.flagupload').show(); }

c++ - Why does GPGME / GnuPG use pinentry for password input? -

gpgme uses passphrase_cb method fetch password user operations, require access private keys. callback can overwritten symmetric encryption, in other cases default pinentry used. all effort seems pretty uncomfortable, because gpgme api shall used programming c/c++/... applications. might easier (for programmer use gpgme) in cases if passphrase passed encrypt/sign functions directly. saw other implementations of openpgp (to more precise netpgp) use callback. so wonder if there security specific reason so? gnupg starting 2.1 removed critical private key functionality gpg-agent , reduce attack surface on intimate secrets -- private keys. such callback not expose passphrase application you're writing (which means larger attack surface gnupg be), gnupg gets aware of passphrase. if need control entry of passphrase application, have several choices. implementing pinentry the information flow be: application calls gnupg through gpgme, gnupg requests private key ope

unix - Extract a line if it contains a word in a specified column -

i want extract line if contains word in specified column of textfile. how can on one-liner unix command it? maybe cat , echo , cut , grep several piples or something. i have textfile looked format #sentenceid<tab>sentence1<tab>sentence2<tab>other_unknown_number_of_columns<tab> ... an example of textfile looks this: 021348 english sentence coach . c'est la phrase française avec l'entraîneur . , there several nonsense columns these . 923458 english sentence without word . c'est une phrase d'une autre anglais sans le bus mot . whatever foo bar nonsense columns 2134234 $%^& the command should output if word looking coach in 2nd column: 021348 english sentence coach . c'est la phrase française avec l'entraîneur . , there several nonsense columns these . i can python such, i'm looking unix command or one-liner: outfile = open('out.txt') line in open('in.txt'): if "coach

promise - Exiting Loop with ACID Transactions with Knex SQL Query Builder & Bluebird in Node.js -

we're using knex sql query builder perform acid transaction in node , we're experiencing strange behavior while using loop knex. code below takes array of tables , conditionally performs insert or update. first table 'transactionheader' , processed first. then, rows in 'transactiondetail' table processed within overall transaction. new keys (rowids) accumulated in 'rowids' array. problem : main problem seems impossible exit loop in processtransactiondetail() if there's error returned knex. neither throw nor return exit loop or function. means if there error processing transactiondetail continue process remaining rows before exiting. let rowids: any[] = []; knex.transaction(function(trx) { // process transactionheader if (transactionheader.rowid) { // update transactionheader trx('transaction') .transacting(trx) .update(transactionheader)