Posts

Showing posts from February, 2014

mysql - sql order by rand() with highest value shown more frequently -

as title describes, im looking write sql (mysql db) thats displays random records highest value shown more others. select cpc advertisement order rand(), cpc desc the above code not work expected. heres im after: i have 10 advertisers each setting own cpc (cost per click) budget. advertiser heighest budget have his/hers advert show more others, yet being random. user_id | cpc | ------------------ 1 | 0.10 | 2 | 0.03 | 3 | 0.20 | 4 | 0.04 | 5 | 0.55 | 6 | 0.12 | so user 5 have advert displayed more freqently others 5, 3, 6, 1, 4, 2 - in order of impressions respectively. bit assume google adwords work, higher users budget more impressions he/she have. i know no 1 likes rand() due performance have no more 100 advertisers. regards i best way so: select user_id, cpc advertisement order rand() * cpc desc this make adverts appear randomly, user_id 5 theoretically appear 5.5x more user_id 1, fair.

java - JMX runtime input lookup class is not available because this JRE does not support JMX -

i getting above error when try running application. sure has updating log4j log4j2 since if not reference log4j2.xml file error gone. why getting error? here full stack trace, if helps: 2016-09-12 12:01:26,124 main warn jmx runtime input lookup class not available because jre not support jmx. jmx lookups not available, continuing configuration. java.lang.classcastexception: cannot cast org.apache.logging.log4j.core.lookup.jmxruntimeinputargumentslookup org.apache.logging.log4j.core.lookup.strlookup @ java.lang.class.cast(unknown source) @ org.apache.logging.log4j.util.loaderutil.newcheckedinstanceof(loaderutil.java:168) @ org.apache.logging.log4j.core.util.loader.newcheckedinstanceof(loader.java:301) @ org.apache.logging.log4j.core.lookup.interpolator.<init>(interpolator.java:106) @ org.apache.logging.log4j.core.config.abstractconfiguration.<init>(abstractconfiguration.java:116) @ org.apache.logging.log4j.core.config.defaultconfiguration.&l

ruby on rails - Products specs in admin panel spree -

i've got piece of specs code: https://gist.github.com/mpanasiewicz/9751c1de65e9920d8ad6d6f866ef0ae5 there problem because 302 code instead of 200 or 404(if sth went wrong). think 302 because redirects me. require 'rails_helper' rspec.describe spree::admin::productscontroller, type: :controller describe 'get synchronize' stub_authorization! let!(:variant) { create(:variant) } 'updates @products pkb starpacks details' spree_get :synchronize, id: variant expect(response).to have_http_status(200) end 'returns record not found if product not exist' spree_get :synchronize, id: 0 expect(response).to have_http_status(404) end end end i've got 'stub_authorization!' think doesn't work ideas wrong code? thanks! i think have redirect_to method in update method. redirect responds 302 code. if want code 200 should use render method instead redirect_to , i

caching - Google Memcache vs Local disk cache? -

i want build mobile app. should cache data on google cloud memcache or it's better store data mobile phone local memory ? faster ? , type of data should put in cache in case of mobile app ? thanks you. any data want make available user in offline mode (device not connected internet) should cached on device itself. may want cache data in online mode (e.g. email app may cache emails last 7 days) , updates cache when user refreshes or server pushes new emails. memcache on google cloud use in application server caching data not change don't have keep loading same data database every request, improving performance. it faster access data on local device compared accessing data cloud.

matlab - Indexing Cell arrays for more efficient performance -

i have following code display 9-by-3 cell array: data = cell (9,3); col1 = [2, 3, 5, 7, 8, 11, 12, 15, 16]; col2 = {[1 1], [1 5], [3 9], [4 2], [4 6], [6 2], [7 6], [6 9], [9 9]}; col3 = {[2 3 4 5 8],[1 3 5 8],[1 2 5 7 8],[1 2 3 6 7],[3 4 7 8],[2 4 8 9],[2 4 5 9],[4 5 7 9],[2 6 7 8]}; k = length(data); = 1:k data{i,1} = col1(i); data{i,2} = col2{i}; data{i,3} = col3{i}; end data please, can code more efficiently written using form of indexing? thanks. your have written code assign 9 x 3 cell array, can written as: data2 = [num2cell(col1') col2' col3'] data2 = [ 2] [1x2 double] [1x5 double] [ 3] [1x2 double] [1x4 double] [ 5] [1x2 double] [1x5 double] [ 7] [1x2 double] [1x5 double] [ 8] [1x2 double] [1x4 double] [11] [1x2 double] [1x4 double] [12] [1x2 double] [1x4 double] [15] [1x2 double] [1x4 double] [16] [1x2 double] [1x4 double]

python - Pandas Apply groupby function to every column efficiently -

this question has answer here: apply multiple functions multiple groupby columns 2 answers in pandas can apply groupby functions every column in dataframe such in case of: pt=df.groupby(['group']).sum().reset_index() lets want apply lambda function lambda x: (0 < x).sum() count cells value in them , include count of total items in each group. there more efficient way apply columns other repeating code: import pandas pd df=pd.dataframe({'group':['w', 'w', 'w', 'e','e','e','n'], 'a':[0,1,5,0,1,5,7], 'b':[1,0,5,0,0,2,0], 'c':[1,1,5,0,0,5,0], 'total':[2,2,15,0,1,12,7] }) #check how many items present in group grp=df.groupby(['group']) pt1 = grp['a'].apply(lambda x: (0 < x).sum()).reset_index() pt2 = grp['b'].apply(lambda x: (0 &l

sql server - T-SQL inconsistent sp_send_dbmail results -

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

javascript - Angular.js basic routing -

i have been following tutorial: https://thinkster.io/angular-rails#angular-routing i have not done rails integration yet, question angular. when hello worlds mainctrl without using router, works. when use router, cannot inline angular template display in html page. error here? app.js: angular.module('flappernews', ['ui.router']) .config([ '$stateprovider', '$urlrouterprovider', function($stateprovider, $urlrouterprovider) { $stateprovider .state('home', { url: '/home', templateurl: '/home.html', controller: 'mainctrl' }); $urlrouterprovider.otherwise('home'); }]) angular.module('flappernews', []) .controller('mainctrl', [ '$scope', function($scope){ $scope.test = 'hello world'; }]); index.html: <html> <head> <title>my angular app</title> <link href="http://maxcdn.bootstrapcdn.com/bootstrap

java - How register JacksonFeature on ClientConfig -

how give json on resfull java project using jackson? following article http://www.vogella.com/tutorials/rest/article.html (8.4. create client ) create rest project in java, says return json proceed like: public class todotest { public static void main(string[] args) { clientconfig config = new new clientconfig().register(jacksonfeature.class); client client = clientbuilder.newclient(config); webtarget target = client.target(getbaseuri()); system.out.println(target.path("rest").path("todo").request() .accept(mediatype.application_json).get(string.class)); } private static uri getbaseuri() { return uribuilder.fromuri("http://localhost:8080_com.vogella.jersey.jaxb").build(); } } @xmlrootelement public class todo { private string id; private string summary; private string description; //getter/setter } but jacksonfeature.class not in jackson.jar. i'm using jackson-annotations-2.8.2.jar j

ios - UITableView.visibleCells() is not returning all cells -

i using uitableviewcontroller . uitableview presenting 11 custom cells. 10 of dynamic, 1 static. nevertheless counting rows either with: let cells = self.tableview.visiblecells as? [chatuebersicht] or for (var row = 0; row < gruppennamen.count; row++) { if let cell:chatuebersichtcell = table.cellforrowatindexpath(nsindexpath(forrow: row, insection: 0)) as? chatuebersichtcell { cells.append(cell) } } is returning correct number. returning number 5 each time. think there issue preloading cells. there way overcome this? visiblecells returns reusable cells can see. that's beauty of uitableview - there isn't instance of cell every row of data. you should reevaluate trying , determine whether it's presentational operation or can done working array of data feeds tableview's data source.

Unable to save Paypal sandbox webhook url -

Image
we configuring paypal sandbox webhook , getting error. have tested url using restclient , hitting our test servers. see attached. we tried live , saves our webhook url.

javascript - every() some() and functions returning functions -

i working through nodeschool's functional javascript course. "every some" exercise provides "goodusers" array of objects argument compare list of users (also array of objects). i hoping if me visualize going on in solution: function checkusersvalid(goodusers) { return function allusersvalid(submittedusers) { return submittedusers.every(function(submitteduser) { return goodusers.some(function(gooduser) { return gooduser.id === submitteduser.id; }); }); }; } module.exports = checkusersvalid; these instructions provided: # task return function takes list of valid users, , returns function returns true if of supplied users exist in original list of users. need check ids match. ## example var goodusers = [ { id: 1 }, { id: 2 }, { id: 3 } ] // `checkusersvalid` function you'll define var testallvalid = checkusersvalid(goodusers) testallvalid([ { id: 2 }, { id: 1 }

git - Updating a Rails Engine Version Number -

in rails engine when should version number in lib/myengine/version.rb updated? should updated before every git push? if so, can/should version number updated automation, rather changing number in file every time? that version number represents version of gem. so, if publish new release of engine (using either gem publish or bundler's rake release ), need update version.rb . this doesn't have git , can git push without updating version.rb . though maintaining version number gem not required, convention follow semantic versioning patterns: http://guides.rubygems.org/patterns/#semantic-versioning

indexing - VB6: Grabbing String Starting with x From an Array -

let's have following array, arr contains maximum of 20 substrings. in example, array have 4 substrings: arr = {"aaaa: 1234567" , "bbbb: 2345678" , "cccc: 98765432" , "dddd: 87654321"} note: capitalization not important. i needing assistance finding substring inside array (again, 20 strings possible), starts with cccc: , , assigning entire string it's own variable, let's call var1 . i understand assign var1 = arr(2) , need figure out how determine index number in array meets criteria. what really appreciate (although method happy with), making stand alone function such as: function arrayindex(arrayinput variant, startswith string) byte 'arguments here end function then use in subroutine: var1 = arr(arrayindex(arr, "cccc:")) update 1 here snippet of current code sub t_report '<shortcut = shift+ctrl+t> dim data string, dataarray variant activesession .copy 0,

sql - Why is the where clause of this query evaluating to false? -

i'm trying understand why where clause of redshift query evaluating false , not returning results. create temporary table temp (select 1 id); problem: query returns no results - select * ( select id, false test temp) test = false; while query returns expected 1 row - select * ( select id, (select false) test temp) test = false; and alternatively, works - create temporary table temp2 (select 1 id, false test); select * ( select id, test temp) test = false;

php - Sending Arabic data to database by jQuery -

i have text box named "rep" sends arabic data php file using jquery. problem database encoding latin1_swedish_ci , not utf8 , cannot change because it'll cause problem in viewing previous data. here code: <script language="javascript"> $(function() { $("input[name='rep']").each(function(i) { $(this).change(function($mainelement) { var rep_name = $(this).val(); var item_id = $(this).attr('id'); var request = $.ajax({ method: "post", url: "inc/rep.php", data: { rep: rep_name, id: item_id } }); request.done(function( msg ) { $('#dd').html(msg); }); }); }); }); </script> here php file: <meta http-equiv="content-type" content="text/html; charset=iso-8859-15" /> <?php include "config.php"; if($_post["rep"]){ $rep = $_post["rep"]; $id = $_post["id"]; $mysqltabl

android - No Overflow Button -

i have navigation drawer application not displaying overflow button. have checked , device not have menu button, should appear im not sure why isn't appearing. of code below main layout <?xml version="1.0" encoding="utf-8"?> <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" android:fitssystemwindows="true" tools:opendrawer="start" android:background="@color/colorprimary"> <include layout="@layout/app_bar_brgo" android:layout_width="match_parent" android:layout_height=&

php - jQuery Mobile Form database update stopped working why -

i need help. have been developing form updates database. working fine using jquery mobile form , has stopped working. have stripped form down the bare minimum , still not working. when click on update information placed the browser shown below. update_db.php?niamh=1 database not updated. if click on refresh updates , displays success. if remove jquery header links works ok, jquery problem. sadly working ok couple of hours ago. code below, can 1 please help. html form <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script> <script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script> </head> <body> <form action="update_db.php&qu

Python parse SQL and find relationships -

i've got large list of sql queries in strings, they've been written presto , kinda formatted mysql. i want able tease out table relationships written in queries. let's start simple: select e.object_id, count(*) schema_name.elements e join schema_name2.quotes q on q.id = e.object_id e.object_type = 'something' group e.object_id, q.query order 2 desc; can see things join together, though there's aliases - need scan through , find aliases - that's fine keyword "as" used. so i'd want have returned list of relationships query, each relationship dict: dict = {'sourceschema': 'schema_name', 'sourcetable': "elements", 'sourcecolumn': "object_id", 'targetschema': "schema_name2", 'targettable': "quotes", 'targetcolumn': "id"} i can imagine doing pretty easy, stuff gets more complicated: select e.object_id, count(*) schema_

c - setuid program doesn't work on 2.6 kernel -

i having trouble understanding why setuid program doesn't seem elevating permissions, though id's seem correct. running on 2.6 kernel , fails, works intended on ubuntu 14.04 doing same thing. need program @ times during execution needs elevated permissions, while least privilege default. #include <stdio.h> #include <stdint.h> #include <arpa/inet.h> #include <stdint.h> #include <string.h> #include <stdlib.h> #include <unistd.h> #include <sys/types.h> static uid_t _orig_euid; void save_privilege(void){ _orig_euid = geteuid(); printf("saved privilege: %d\n", _orig_euid); } void drop_privileges(void){ if(seteuid(getuid()) == -1){ exit(0); } printf("dropped privileges %d %d\n", getuid(), geteuid()); } void reacquire_privileges(void){ if(setuid(_orig_euid) == -1){ exit(0); } printf("reacquired privileges %d %d\n", getuid(), geteuid()); } void do_pri

python - How to configure Visual Studio Code to debug Django app in a virtualenv? -

i have possibility debugging of django application in visual studio code. have virtualenv, made change in launch.json file this: { "name": "django", "type": "python", "request": "launch", "stoponentry": true, "pythonpath": "${workspaceroot}/.venv/bin/python2.7", "program": "${workspaceroot}/mysite/manage.py", "args": [ "runserver" ], "debugoptions": [ "waitonabnormalexit", "waitonnormalexit", "djangodebugging", "redirectoutput" ] }, put several break points in code , run it. unfortunately, execution not stopped on line break points. tried same without virtualenv , worked perfectly. please, point out doing wrong here. were able solve issue? for me, following 2 changes worked add absolute path pythonpath us

c# - Get dictionary key if value contains string -

i have dictionary: static dictionary<int, string> players = new dictionary<int, string>(); dictionary.add(1, "chris [gc]"); dictionary.add(2, "john"); dictionary.add(3, "paul"); dictionary.add(4, "daniel [gc]"); i want key of values contains "[gc]" any idea how? thanks. use query below. var itemswithgc = dictionary.where(d => d.value.contains("[gc]")).select(d => d.key).tolist(); foreach (var in itemswithgc) { console.writeline(i); }

mysql - php - Can not insert multiple text inputs into database -

this html code. <form class="form-submit" method="post" action="sign-up-form.php" > <div id="change-color0"> <label><span class="turn-white0">01</span>họ tĂŞn đầy Ä‘ủ của bạn</label> <input type="text" id="input" name="content[]" class="addtodo0"> </div> <div id="change-color1"> <label><span class="turn-white1">02</span>sĂ´́ chĆ°́ng minh thĆ° nhân dân của bạn</label> <input type="text" id="input" name="content[]" class="addtodo1"> </div> <div id="change-color2"> <label><span class=&

spreadsheet - google sheets - send email notification based on time of day -

in google sheets, there way send email notification when cell not filled time of day? if cell a1 isn't filled 5pm, send email user tell them fill cell. you'll need time driven trigger checks if cell(or range) blank , calls email function also @ answer, uses onedit()

antlr - "The following sets of rules are mutually left-recursive" -

i have tried write grammar recognize expressions like: (a + max(b) ) / ( c - average(a) ) if( > average(a), 0, 1 ) x / (max(x) unfortunately antlr3 fails these errors: error(210): following sets of rules mutually left-recursive [unaryexpression, additiveexpression, primaryexpression, formula, multiplicativeexpression] error(211): derivedkeywords.g:110:13: [fatal] rule booleanterm has non-ll(*) decision due recursive rule invocations reachable alts 1,2. resolve left-factoring or using syntactic predicates or using backtrack=true option. error(206): derivedkeywords.g:110:13: alternative 1: after matching input such decision cannot predict comes next due recursion overflow additiveexpression formula i have spent hours trying fix these, great if @ least me fix first problem. thanks code: grammar derivedkeywords; options { output=ast; //backtrack=true; } ws : ( ' ' | '\t' | '\n' | '\r' ) { skip(); }

Android test recording for third party app and webview support -

recently came across android test recording. - http://tools.android.com/tech-docs/test-recorder . looks interesting, tried play app. i have couple of questions. can record/generate code tests done on third party app? my testing app has webview inside. when tried interacting webview didn't generate code. espresso test recording support interaction webview? if yes, have enable auto-generate code interaction webview. any appreciated. pros of espresso test recorder - 1. allow create effective ui based test cases user interactions. 2.we can capture assertions , interactions without accessing app's structure directly increases execution speed , optimizes test case. 3.it saves lot of time search locators , writing test cases. 4. supports multiple assertions making more reliable test cases. cons of espresso test recorder - 1. not support recording of webviews interactions. (to write webview interactions click here ) 2. once complete recording once next time rec

javascript - How do export js2shapefile as zip file? -

i'm developing gis application. want export layer shape file in javascript using js2shapefile . js2shapefile uses filesaver.js exporting. filesaver exports 3 files ( .shp , .shx , .dbf ) separately. i'd exported files zipped in single file. how it? is adding library option you, think can use lib jszip zipping files. see details: https://stuk.github.io/jszip/

android - position of ViewPager item with Data Binding -

i have implemented viewpager use of android data binding, working perfect data , click events. i have created interface click event public interface itemclicklistener { public void onitemclick(); } here instantiateitem() of pageradapter @override public object instantiateitem(viewgroup container, final int position) { listitembinding binding = databindingutil.inflate(mlayoutinflater, r.layout.list_item, container, false); binding.sethandler(itemclicklistener); binding.getroot().settag(position); container.addview(binding.getroot()); return binding.getroot(); } i sending itemclicklistener in adapter constructor. public matchlistadapter(context context, itemclicklistener itemclicklistener) { mcontext = context; mlayoutinflater = (layoutinflater) mcontext.getsystemservice(context.layout_inflater_service); this.itemclicklistener= itemclicklistener; } here list_item.xml <layout xmlns:android="http://schemas.android.com/apk/

How to get client ID and secret key from paytm -

i trying wallet integration paytm. generate oauth token need supply client id send encrypting client secret key. struggling find out how or client id , secret key paytm. api doc @ paytm says oauth apis pre-requisites: client id : provided paytm authentication purposes client secret : provided paytm authentication purposes http://paywithpaytm.com/developer/paytm_api_doc?target=oauth-apis

spring boot - RabbitTemplate to connect to RabbitMQ : getting - NOT_FOUND - no queue -

i new spring , working on cloud based application , trying use rabbittemplate , rabbitmq. i able store data queue using. rabbittemplate.convertandsend(queue_name, msg); but when receiving data same queue using rabbittemplate.receiveandconvert(queue_name) i getting exception as: err caused by: java.io.ioexception 2016-09-13t11:15:21.38+0530 [app/0] err @ com.rabbitmq.client.impl.amqchannel.wrap(amqchannel.java:106) 2016-09-13t11:15:21.38+0530 [app/0] err @ com.rabbitmq.client.impl.amqchannel.wrap(amqchannel.java:102) 2016-09-13t11:15:21.38+0530 [app/0] err @ com.rabbitmq.client.impl.amqchannel.exnwrappingrpc(amqchannel.java:124) 2016-09-13t11:15:21.38+0530 [app/0] err @ com.rabbitmq.client.impl.channeln.basicget(channeln.java:985) 2016-09-13t11:15:21.38+0530 [app/0] err @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) 2016-09-13t11:15:21.38+0530 [app/0] err @ sun.reflect.nativemethodaccessorimpl.

arrays - Why is int a[0] allowed in c++? -

this question has answer here: what happens if define 0-size array in c/c++? 7 answers i find in declaration of array, cannot specify size of this int a[0]; i know, empty size array illegal in c++, in code, empty size array compiler allowed , give output. my code here : #include <iostream> using namespace std; int main() { int a[0]; a[0] = 10; a[1] = 20; cout<<a[0]<<endl; cout<<a[1]<<endl; return 0; } output: 10 20 online compiler link : http://code.geeksforgeeks.org/tteomo so, question is, why int a[0] allowed gcc compiler? it issues warning, example clang outputs: warning: 0 size arrays extension [-wzero-length-array] this undefined behaviour: a[0] = 10; a[1] = 20; zero length arrays extensions gcc, why - can read on here: https://gcc.gnu.or

r - Create data labels for frequency plot in ggplot2? -

Image
in this question, frequency figure can created using ggplot. example: f <- factor(sample(letters[1:5], 100, r=t)) h <- table(f) / length(f) dat <- data.frame(f = f) ggplot(dat, aes(x=f, y=..count.. / sum(..count..), fill=f)) + geom_bar() how obtain data labels each individual bar within figure? thank you. you can add geom_text() : library(ggplot2) ggplot(dat, aes(x=f, y=..count.. / sum(..count..), fill=f)) + geom_bar() + geom_text(stat = "count", aes(label=..count../100))

security - ASP.NET: First Chance to add something to HttpContext -

we using httpcontext.items save our own securitycontext. public static isecuritycontext current { { if (!(httpcontext.current.items["securitycontext"] isecuritycontext)) { httpcontext.current.items["securitycontext"] = new securitycontext(...); } return httpcontext.current.items["securitycontext"] isecuritycontext; } } now problem is, create securitycontext , add httpcontext. when looking @ mvc-lifecycle guess iauthenticationfilter first chance that. idea or there better "place" add securitycontext httpcontext? looks want sort of service locator . ioc might option used dependency inversion style of building controllers. in way don't have bother when httpcontext ready use. to answer question. in global.asax use application_prerequesthandlerexecute method instantiate , store service implementation. protected void application_beginrequest(object sender, eventar

recursion - How to print the recursive stack in Python -

how print or show recursive stack in python when i'm running recursive function? it's not clear want far question, can print stack of function callers in recursive manner following, using python inspect module . import inspect, sys max_recursion_depth = 10 def rec_func(recursion_index): if recursion_index == 0: return rec_func(recursion_index-1) current_frame = inspect.currentframe() calframe = inspect.getouterframes(current_frame, 2) frame_object = calframe[0][0] print("recursion-%d: %s" % (max_recursion_depth - recursion_index, frame_object.f_locals)) print("passed parameters: %s" % (sys._getframe(1).f_locals) ) rec_func(max_recursion_depth) you can use sys.get_frame() access current frame , using f_locals property, can access parameters passed current frame, in recursive manner, can observe parameter decreasing. mostly information want stack accessible frame objects can i've brought abo

android - How to call function in Activity from HomeScreen Widget -

what proper method of calling function in application's activity widget located on home screen? example, have background thread initialized in activity class, , able press widget home screen call specific functions start/stop thread without having enter application. below stripped , barebone version of activity working with: public class mainactivity extends appcompatactivity { private thread thread; private runnable runner; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); startthread(); } private void startthread() { //start/restart thread } public void stopthread() { //interupt thread } } below barebone code home screen widget: static void updateappwidget(context context, appwidgetmanager appwidgetmanager, int appwidgetid) { intent intent = new intent(context, mainactivity.class); intent

java - JSch ssh_rsa_verify: signature false on SSH_MSG_KEX_DH_GEX_REPLY -

i trying public/private key authorization, works on servers. the below code works when connecting local bitwise server, , when connecting local crushftp server, not work when connecting remote server version string "ssh-2.0-liquidsftp" same public key has been uploaded servers. jsch jsch = new jsch(); jsch.setlogger(new log4jlogger()); jsch.addidentity("privatekey.ppk", "mysecretpassphrase"); string host = "someserver.com"; string username = "myusername"; int port = 1100; session session = jsch.getsession(username, host, port); session.setconfig("stricthostkeychecking", "no"); session.setconfig("kex","diffie-hellman-group-exchange-sha1"); userinfo ui = new myuserinfo(); session.setuserinfo(ui); session.connect(); from key exchange init messages monitored wireshark, , logged in java, can see server support diffie-hellman-group-exchange-sha1 algorithm, fails when trying verify signatur

mysql - PHP Nested FOR Loops Troubleshooting -

i have database 10 columns in row, each set contain image name. himage1, himage2, himage3, etc... the user can delete of these images individually, , corresponding column value set 'na', signify there no image. but there 3 images, means 'himage4' onwards fields 'na', , user deletes 'himage1', row this: himage1 = 'na', himage2 = "...img2.jpg", himage3 = "...im3.jpg", himage4 = 'na', himage5 = 'na', etc... this creates problem, have column, 'hnumimage', controls how many images set displayed. but if 'hnumimage' 2, in example, there 2 images, loop use display images still try display 'himage1', though blank. for reason i'm trying create function detect if field 'na', , check if of following fields have valid image. if so, move image value forward. so in example above, should after function run: himage1 = "...img2.jpg", himage2 = "...im3.jpg&q