Posts

Showing posts from March, 2014

wordpress - Pages categorized by post -

i got 4 categories in wordpress, let categories c1, c2, c3, c4. make posts , assign either 1 of categories these posts. made categories menu in primary menu, purpose of when user click c1 posts under category shown, same goes rest of menu items. how make in wordpress? you can make template display posts according category , use template pages display posts , use pages menu.

windows - SSH connection could not be established rhc server -

Image
i error while try run command rhc server . ssh connection not established . .ssh folder has both private , public keys. how fix this? i did run chmod command . executed no errors , no output on console. , yet same error nexttime when run rhc setup.

ios - Error library libUartLib.a (print Bluetooth) -

has developed libuartlib.a library? because have following error: -[cbcentralmanager retrieveconnectedperipherals]: unrecognized selector sent instance 0x15e868d0 2015-10-02 17:13:29.265 dapper[2639:1705276] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '-[cbcentralmanager retrieveconnectedperipherals]: unrecognized selector sent instance 0x15e868d0' *** first throw call stack: (0x27a5186b 0x394bedff 0x27a57035 0x27a54c8f 0x279842b8 0x1018a3 0x27714a55 0x22cdbf 0x22cdab 0x231829 0x27a14595 0x27a12a8f 0x279651e9 0x27964fdd 0x30bc9af9 0x2bbca18d 0x1002b9 0x39be9873) libc++abi.dylib: terminating uncaught exception of type nsexception if refer documentation that method deprecated in ios 7 , has been removed in ios 9. replacement retrieveconnectedperipheralssithservices either need updated version of library or update if author hasn't done or identify alternative.

java - first Hibernate test gives error [EDITED] -

i'm hibernate beginner user, created simple application test ! error in console : initial sessionfactory creation failed.org.hibernate.hibernateexception: dialect class not found: org.openmeetings.app.hibernate.utils.mysql5myisamdialect exception in thread "main" java.lang.exceptionininitializererror @ util.hibernateutil.buildsessionfactory(hibernateutil.java:20) @ util.hibernateutil.<clinit>(hibernateutil.java:10) @ dao.services.addproduit(services.java:9) @ test.main(test.java:11) caused by: org.hibernate.hibernateexception: dialect class not found: org.openmeetings.app.hibernate.utils.mysql5myisamdialect @ org.hibernate.dialect.dialectfactory.builddialect(dialectfactory.java:81) @ org.hibernate.dialect.dialectfactory.builddialect(dialectfactory.java:42) @ org.hibernate.cfg.settingsfactory.determinedialect(settingsfactory.java:422) @ org.hibernate.cfg.settingsfactory.buildsettings(settingsfactory.java:128) @ org.hibernate.cfg.c

c++ - Can I make google test return 0 even when tests fail? -

i calling googletest in post-build step of c++ project in vs 2012. naturally, when of tests fail, googletest command returns failure (-1), , entire project marked failure visual studio. i not want that. want googletest run, , want see results in output, not want fail project if not tests pass. is there flag can pass googletest returns success (zero)? yes, can make test return 0 if write own main function. i imagine you're linking test executable special gtest_main library basic helper allow avoid having write own main function. it's pretty doing: int main(int argc, char **argv) { printf("running main() gtest_main.cc\n"); testing::initgoogletest(&argc, argv); return run_all_tests(); } the run_all_tests macro culprit returning -1 , need stop linking gtest_main , write own main more like: int main(int argc, char **argv) { testing::initgoogletest(&argc, argv); run_all_tests(); return 0; } for more info on topic,

c++ - Cannot explain ambiguous template specializations -

given template <typename...> struct pack; using t1 = std::tuple<int, char, double>; using t2 = std::tuple<bool, double, int, char>; tupletree<pack, t1, t2> shall be pack< pack<int, bool>, pack<int, double>, pack<int, int>, pack<int, char>, pack<char, bool>, pack<char, double>, pack<char, int>, pack<char, char>, pack<double, bool>, pack<double, double>, pack<double, int>, pack<double, char> > and extends number of tuples. easy enough understand definition? ok, have program working correctly: http://ideone.com/oumezk but want extend definition to `tupletreewithrepeats<p, std::index_sequence<is...>, tuples...>` where is... indicate number of times each tuple being used repeatedly until moving on next tuple. note <is...> = <1,1,...,1> reduce same tupletree<p, tuples...> . ambiguity i'm stuck these 2 specializations:

python - Regular Expression To Find C Style Comments -

i trying write regular expression find c style headers in java source files. @ present time experimenting python. here source code: import re text = """/* * copyright blah blah blha blah * blah blah blah blah * 2008 blah blah blah @ org */""" print print "i guess program printed correct thing." pattern = re.compile("^/.+/$") print "-----------" print pattern pos = 0 while true: match = pattern.search(text, pos) if not match: break s = match.start() e = match.end() print ' %2d : %2d = "%s"' % (s, e-1, text[s:e]) pos = e i trying write simple expression looks between forward slash , forward slash. can make regular expression more complicated later. does know going wrong? using forward slash dot meta-character, plus symbol 1 or more things, , dollar symbol end. i don't think should anchor (using '^' , '$&#

mysql - Like operator not working, using spring mvc and hibernate -

ok, i'm still of newbie java , hibernate , i'm trying search question/answer set in database, , can pull set fine if type in exact question, when use operator nothing works, , i'm not sure do. i'm searching question, , it's part of same object answer, pull answer well. here's code in questionanswerdao public questionanswerset getquestionanswersetbyquestion(string question) { session session = (session) em.getdelegate(); return (questionanswerset) session.createcriteria(questionanswerset.class).add(restrictions.eq("question", "%"+question+"%")).uniqueresult(); } also here's code in controller @requestmapping(value="search", method=requestmethod.get) public string searchget (modelmap model, httpservletrequest request) { searchform searchform = new searchform(); model.put("searchform", searchform); return "app/search"; } @requestmapping(value="search&q

javascript - Hartl 3rd ed section 8.2.3 dropdown not working -

when click on "account" link in navbar, dropdown menu not appear. happen # added end of url, users/1 becomes users/1#. a question dropdown not working has been asked here: ruby on rails chapter 8, 3rd edition. menu dropdown . have tried number of variations application.js file, show below, , far know, sessions_controller.rb , sessions_helper.rb match hartl has. i using windows , chrome. i have enabled "show user agent shadow dom" in dev console in chrome , see html dropdown menu. don't see error messages. i think there either controller error or bootstrap/sass/rails version incompatibility of kind. did dropdown work in hartl 2nd ed chapter 8, don't want roll gems far. my application.js: //= require jquery //= require jquery_ujs //= require bootstrap //= require turbolinks //= require_tree . i've tried //= require jquery //= require bootstrap //= require jquery_ujs //= require turbolinks //= require_tree . and i've tried subbing

multithreading - Java update GUI while MainThread.join()? -

i try move jlabel position position b sequential in same x , y steps.. method works correctly, doesnt't update gui.. show code in following: when don't call . join() method, code works, don't wait execution on thread... need function don't call when runs.. can me? thread movethread = new thread( new runnable() { @override public void run() { (int = 0; i<const.steinverschiebenschritte; i++) { try { p_lbltomove.setlocation(p_lbltomove.getlocation().x + x_schritt, p_lbltomove.getlocation().y + y_schritt); system.out.println("setloc"); thread.sleep(10); } catch (interruptedexception ex) { statuslog("interruptedexception"); } } system.out.println("invokelater"); p_lblt

javascript - Angular JS and Symfony2 -

Image
i working on project using symfony2 , seeking advice on that. i thinking of hybrid application in two(2) different ways a) login page shall use traditional form crf token , let symfonty2 handle it. b) inner pages ( potentially modules ) want them non ajax, other activities inside shall behave single page. for example have employee module . when user clicks on entirely loaded server ( templates , forms etc ) each activity under employee module add/update delete/view etc shall loaded through ajax , response returned in json i.e angularjs. i thinking of using fosuserbundle return html on initial request , based on request type accept: application/json return json ( remember add/updat delete/view part? ). my question better idea use angular partials (html) files or symfony2 twig? or better use angular js, let partials rendered symfony2 twig? ( thinking of forms here, want validate both client , server side ) has 1 been through similar problem, if yes approach used develo

khan academy - How can I get all the exercises for a topic (e.g., math) and all its subtopics from the khanacademy api? -

khan academy's api explorer has exercises section mentions filtering tags, url math tag applied returns nothing. the generic exercise objects don't contain topic they're in. guess there's id join on somewhere in topictree/exercises json objects, don't know efficient way find it. here raw exercises json , raw topictree json (note, second 1 huge, , contains many topics other math). i don't think there nice way return exercises subtree of topictree (e.g. math). tags different concept, , there isn't tag common in math. best bet load full topictree exercises (and topics) , work there: http://www.khanacademy.org/api/v1/topictree?kind=exercise if need reference structure repeatedly, makes sense download , filter ahead of time, , maybe re-fetch time time account changes khan academy content. depends on exact use case. generally, content item can referenced content_id (sometimes called id ) or slug , unfortunately, naming , usage aren'

javascript - Node JS Require throw AssertionError: missing path -

i'm stuck on problem few hours, cannot find out. i've simple application write in node js: var mongo = require('./helpers/mongo_utils.js'); var express = require('express'); var user = require('./models/users.js'); mongo.connect(function (err) { if (err) throw err; console.log('connected'); var app = express(); app.listen(3000, function () { console.log('server set , start listening on port 3000'); }) }) all works except when require users.js file. if don't require have no problem, when got error: assert.js:89 throw new assert.assertionerror({ ^ assertionerror: missing path @ module.require (module.js:363:3) @ require (module.js:384:17) @ object.<anonymous> (/home/jimzer--jimzer/www/nodejsforum/models/users.js:1:79) @ module._compile (module.js:434:26) @ object.module._extensions..js (module.js:452:10) @ module.load (module.js:355:32) @ function.module._load (mo

python - Cannot index document in elasticsearch while performing string operation -

i have index documents in elasticsearch stored in file, , indexing documents while performing string operation on it. (i have partition line , use splits separately) rec = open(file) line in rec: val_1 = line.partition(' ')[0].strip() val_2 = line.partition(' ')[1].strip() #print str(val_1) + " " + str(val_2) es.index(index="test", doc_type="trial", id = val_1, body = val2) i can print line, cannot index reason. throws out following error. file "c:\python27\lib\site-packages\elasticsearch\client\utils.py", line 69, in >_wrapped return func(*args, params=params, **kwargs) file "c:\python27\lib\site-packages\elasticsearch\client__init__.py", line >261, in index _make_path(index, doc_type, id), params=params,body=body) file "c:\python27\lib\site-packages\elasticsearch\transport.py", line 307, in >perform_request status, headers, data = connection.perform_reques

use spmd in matlab (parallel) to apply a function to parts of vector -

i working in matlab parallel computing toolbox. task i have vector v. have 4 cores. want split vector on each core (so each core handles 1/4th of vector, assuming length(v) divisible 4) , apply function f() on each part. so core 1: f1 = f(v belongs part 1) and core 2: f2 = f(v belongs part 2) and on. then want gather results that, after have: f = "one vector containing elements of f1, , elements of f2, etc." on main core (root if wish, maybe matlab calls "client", not sure). attempt spmd v_dist = codistributed( v ); %split v onto cores lpv = getlocalpart( v_dist ); %this core's part ("my part") f1 = f( lpv ); %apply f part of v %i want piece outputs? f_tmp = codistributed( zeros(length(f1) * 4, 1) ); %get part of container want put output f_tmp_lp = getlocalpart( f_tmp ); %now put part of output here: f_tmp_lp = f1; %and piece part f_tmp = codistributed.buil

jquery - Anchor goes to whole width when centered -

Image
i've 1 paragraph , 1 button in container <div class="container"> <div class="row"> <p class="text-center text-muted">text</p> <a class="btn btn-danger center" href=""> download pdf </a > </div> </div> code center class .center{ display: block !important; margin-left: auto !important; margin-right: auto !important; } and how output looks while expecting in center small button should wide per value download pdf your style should like: .center { display: block !important; width: 250px; //change accordingly; margin-left: auto !important; margin-right: auto !important; } margin auto works fixed width container. or try: <div style='text-align:center'> <a class="btn btn-danger" href=""> download pdf </a &

Javascript: enumerate skews and rotations with multiple loop increments -

this question related another question think it's answer doesn't cover problem. have following: var props = ['skew','rotate'], axis = ['x','y','z']; (var p=0, a=0; p<2, a<3; p++, a++){ console.log(props[p]+axis[a]) } why logs undefinedx ? update: log should write rotatex rotatey rotatez skewx skewy skewz . you use inner , outer loop enumerate combinations var props = ['skew','rotate'] , axis = ['x','y','z'] , result = ''; for(prop = 0; prop < props.length; prop ++) { for(dir = 0; dir < axis.length; dir ++) { result += props[prop] + axis[dir] + '<br/>'; } } document.write(result); the problem using single loop 2 arrays of different sizes both variables incremented long code hasn't reached end of 1 array. now fixed checking in loop , capping index in array @ length - 1 of array. however,

vba - Add columns selectively in excel? -

Image
say have following data ......................judge 1 | judge 2 | judge 3 | total score contestant 1.......5.............3..............2 ....... contestant 2.......3.............3..............6........ and want design interface (i guess involve vba, unless can without?) can select judge's scores add up. so theoretically, there's checklist have [] judge 1 [] judge 2 [] judge 3 [] select or something, , if press select all, total score sum judge's scores. if unselect select , select judge 1 , 2, scores total accordingly. any suggestions? one way without vba: . make data validation rule first row: "list", source: "selected, not selected" total score formula: =sumif(b$2:d$2,"=selected",b5:d5) total score update every time select or deselect 1 of judges

ios - Multiple custom UITableView cells and sections -

Image
i'm trying create look: right have this: three prototype cells identifiers , custom cells respectively top bottom as id cellstyle cellstyle2 cellstyle3 with custom cell classes merely having capital c. this code far: what i'm trying change dequeue cell different custom cell classes able access properties , change labels , uiimageview. method not working cell.label.text not recognized. tried creating 3 different variables cell so. var cellstyle: cellstyle var cellstyle2: cellstyle2 var cellstyle3: cellstyle3 what return function then? questions: are either methods standard practice? if not, standard code accomplish i'm trying do? to cells top 3 buttons on prototype need inset? have in runtime layer.bordercolor layer.borderwidth layer.cornerradius layer.maskstobounds how configure numberofrowsinsection multiple sections? this update previous code based on comments. override func tableview(tableview: uitableview, cellforr

Rest DELETE verb with matlab's webread/webwrite -

is there way send put , delete requests webread() / webwrite() ? trying opt = weboptions('requestmethod','delete') gets me following error message: error using weboptions (line 223) expected requestmethod match 1 of these strings: 'auto', 'get', 'post' input, 'delete', did not match of valid strings. matlab doesn't have full rest capability easily. can expand using urlread2 http://www.mathworks.com/matlabcentral/fileexchange/35693-urlread2 or writing own java code.

c++ - Lambda function with no arguments as a default argument for std::function in template -

i'm banging head here, because below code worked hours, until started getting error out of blue. #include <iostream> #include <string> #include <functional> #include <algorithm> template<typename ret_t> ret_t get_num(const std::string &prompt = "", const std::string &error = "", const std::function<bool(ret_t)> &condition = [] { return true; }) //default value of &conditon lambda returns true { //....not complete function ret_t num = 0; std::cin >> num; if (condition(num)) return num; std::cerr << error; return get_num<ret_t>(prompt, error, condition); } int main() { //it works fine if supply third argument int number = get_num<int>("enter num: ", "bad input! ", [](int num) { return num > 0; }); //this gives me error, while should run //fine , condit

angularjs - Angular Digest cycle being ran but ng-bind value not updating -

i have parent view contains navbar, , inside of view have <div ui-view> element renders whatever child view i'm on. i want conditionally show/hide navbar within parent view, based on route of child view. right now, have this: <nav ng-show="!vm.hidenavbar"> the first time app loaded, vm.hidenavbar set true , works expected. after vm.hidenavbar changed false, bound value not updated. still true . every controller in app extends basecontroller : export class basecontroller { public hidenavbar: boolean; constructor(public $scope: ibasescope, private $state: ng.ui.istateservice) { if ($state.current.url === '/login') { this.hidenavbar = true; } else { this.hidenavbar = false; } $scope.vm = this; } } so, everytime new controller loaded, calls constructor basecontroller , conditionally sets $scope.vm.hidenavbar . if run $scope.$apply

c++ - Multiple pack expansions inside class with fixed number of template arguments -

is code well-formed? declaration of function template gives error in both clang , gcc though ts empty. // error: many template arguments class template 'pair' template<class i, class u, class... ts> void f(std::pair<i,u,ts...>); int main() { f(std::pair<int,int>()); } the function call gives error in gcc doesn't make sense. there no conversion int : note: cannot convert 'std::pair<int, int>()' (type 'std::pair<int, int>') type 'int' [temp.res]/8: if every valid specialization of variadic template requires empty template parameter pack, template ill-formed, no diagnostic required. every valid specialization of f require ts empty pack. therefore program ill-formed ndr. both compilers correct. as gcc's diagnostic, seems due habit of using int placeholder "something looks type doesn't make sense" error recovery purposes.

python - Can't connect to Google Cloud SQL from within App Engine using SSL (in Django) -

my app engine app doing well, want toggle "only allow secure connections" option in cloud sql configuration. when so, can still connect remotely , in local development. however, deployed app stops working 1045 error "access denied" i cannot figure out store/upload ssl certificates on deployed app or how call them settings.py can please help? here relevant section of settings.py (redacted) if os.getenv('server_software', '').startswith('google app engine'): # running on production app engine, use google cloud sql database. databases = { 'default': { 'engine': 'django.db.backends.mysql', 'host': '/cloudsql/<myappengineapp>:<mycloudsqlinstance>', 'name': 'test', 'user': 'root', 'password': '<mypassword>', 'options': <ssl goes in here?> } } else: # running i

How to flatten (compress) multi-dimensional array into one-dimensional array in PHP? -

i got array. want other 3 array come [0] => array. don't want unique value want merge array flat in [0] => array. array ( [0] => array ( [0] => array ( [campaign] => xxx [phone] => 111 [state] => cd ) ) [1] => array ( [0] => array ( [campaign] => zxxxzx [phone] => 111111 [state] => zxxx ) ) [2] => array ( [0] => array ( [campaign] => aaaa [phone] => 111 [state] => csd ) ) [3] => array ( [0] => array ( [campaign] => sasa [phone] => 111 [state] => asas ) ) ) this example of how important naming is. working basically: $re

java - LineIterator.hasNext() throws exception if last line of the file is not empty -

i have piece of code looks (in java) uses org.apache.commons.io.ioutils.lineiterator; lineiterator iterator = lineiterator(somefile, defaultcharset()); .... while(iterator.hasnext){ process(iterator); } private string process(lineiterator iterator, somecomplexclass someclass){ while(iterator.hasnext()){ //do using iterator.nextline() } } this works if input file has empty last row. input file: line1 line2 (nothing here. empty line) but if have input file without empty line, lineiterator.hasnext() throws exception saying "java.lang.illegalstateexception: stream closed" input file: line1 line2 //there no empty line after is known behaviour of lineiterator? please me try understand why happening this. update: don't see close() or lineiterator.closequietly(iterator) in code. can cause issue? open file reading in text editor can show line numbers notepad++ if last line empty.delete last line. blank space not mean there no line

css - How to replace taskbar stock icon browser with my own icon -

Image
i'm going create simple test of html files. want insert own icon @ taskbar windows. i has insert on event new tab code : <link rel="icon" href="favicon.ico"> can tell me what's code? i'll apreciated if can give example too.. thank's advance.. if understand question correctly... windows taskbar icons not same html icons displayed on browser tabs. if want assign specific icon file or filetype, need following. generate .ico file image used icon in windows. right-click on file, click properties . under shortcut tab, near bottom of window, you'll see button says change icon . click this. navigate .ico icon file , click open profit. if mean how can assign icon browser tab.... generate .ico file image used icon browser tab insert following code in <head> section of html: <link rel="icon" href="<relative filepath icon>"></link> save file, test, profit. it i

web services - Persisting data in an axis object -

forgive me if dumb question, unfortunately have assignment due! running apache axis under tomcat , need deploy simple web service class, see below. i installed counter file below "mycounter.jws" in /tomcat/webapps/axis/ folder. tomcat finds , makes corresponding mycounter.xml. use wsdl2java on xml file , client calls seem work, internal state not saved: every time call mycounter.call client side, return value 1. seems constructor called before method call. how can make mycounter integer persists across requests? public class mycounter { int mycounter; public mycounter() { mycounter = 0; } public int call() { mycounter++; return mycounter; } } i think persisting maybe wrong word, think mean java class not instantiated every time call service. see: https://axis.apache.org/axis/java/user-guide.html#scoped_services so need change service definition yo achieve this. i don't think jws files able conf

rails drop down search/filter with ransack -

i have column 3 set possibilities, (fruit, veg, meat). want filter rows drop down, shows rows fruits or veg etc. have been looking @ ransack gem examples make type text field. plan have several drop downs filter other columns. ransack best way this? <%= f.select :poollength_eq, options_for_poollength, {:include_blank => "select pool length"}, {:style => "width:175px", class: "form-control"} %> i defined options_for_poollength in application_helper.rb def options_for_poollength [['long course meters','lcm'], ['short course yards','scy'], ['short course meter','scm']] end

Trigger embedded Javascript from url (adwords landing page) -

i have javascript in header of site (opencart) scrolls page view 3 variants of product selected drop-down menu @ top of category pages. function getbatt() { var myselect = document.getelementbyid("batt"); var battery = myselect.options[myselect.selectedindex].value; document.getelementbyid(battery).scrollintoview(); } i want trigger script landing page url in adwords ad in order display 3 variants of product on category page, rather going directly product page, dislay 1 variant of product. should create better user experience. (eg ad product bl-4b, destination url xxx/nokia batteries. rather force user manually select product drop-down menu want pass parameter bl-4b (batt) function , trigger on page load.) is possible/advisable without opening can of worms regarding security? you create 1 url, url 1 parameter each product, each ad , parameter javascript , scroll product.

android - Binary file -NoClassDefFoundError: … R$styleable circlepageIndicator.java -

error in kitkat device not in greater version of android. after changing gradle file. library used circle pager indicator. https://github.com/jakewharton/viewpagerindicator dependencies { classpath 'com.android.tools.build:gradle:1.0.0'} to dependencies {classpath 'com.android.tools.build:gradle:1.3.0'} error is: binary xml file line #43: error inflating class com.viewpagerindicator.circlepageindicator caused by: java.lang.noclassdeffounderror: com.app.skedule.r$styleable 10-03 12:29:47.501 28314-28314/? e/androidruntime: @ com.viewpagerindicator.circlepageindicator.<init>(circlepageindicator.java:93) 10-03 12:29:47.501 28314-28314/? e/androidruntime: @ com.viewpagerindicator.circlepageindicator.<init>(circlepageindicator.java:74) circlepageindicator.java(inside project->java->viewpagerindicator package) package com.viewpagerindicator; public class circlepageindicator extends view implements pageindicator { private static

javascript - es6 modules to commonjs with typescript under node harmony flag -

i'm using typescript (1.6) node under --harmony flag, i'd transpile es6 module syntax commonjs. from can tell, can't typescript 1.6. if set target es6, , module commonjs, typescript error - cannot compile modules 'commonjs', 'amd', 'system' or 'umd' when targeting 'es6' or higher. why won't typescript compile commonjs es6 target? imagine lot people want since node doesn't support es6 modules yet. i'd thought new moduleresolution compiler option might solve issue, doesn't appear anything. currently, i'm having use babel transpile module syntax commonjs, i'd remove babel builds can take advantage of source maps. is there way can achieve this? note: not want transpile es5. want js running es6 under harmony flag. thanks! the typescript team add support looking in the next release . can wait few weeks/months. alternatively, can use polyfill es6 module loader: es6-module-loader sys

swift - UrbanAirship Cocoapods not working with use_frameworks -

so have bit of issue here. i'm using swiftyjson not appear work without use_frameworks option, , have need of urbanairship framework well. if disable use_frameworks, i'm able import airshipkit without incident in appdelegate. swiftyjson cacks , i'm not able use that. reverse true if enable it. has had luck or found solution how have both dynamic , static library cocoapods? what should bridging header urbanairship -- if i'm able use 1 use_frameworks enabled? thanks much! current podfile: platform :ios, '8.0' use_frameworks! target 'myproject' pod 'urbanairship-ios-sdk' pod 'swiftyjson', :git => 'https://github.com/swiftyjson/swiftyjson.git' end the documentation urbainairship-ios-sdk pod lacking. in fact doesn't make reference fact module name diverges official documentation (even though in official repo). you have import `urbanairship_ios_sdk' , should well.

java - JSONArray getValue -

i have teams.json file following content { "league": "champions league", "season": "2015/16", "start": "2015-11-01", "end": "2016-03-31", "teams": [ { "name": "spain" }, { "name": "germany"}, { "name": "italy" }, { "name": "brasil" }, { "name": "argentina" } ] } and have jsonarray works fine jsonobject jsonobject = (jsonobject) obj; jsonarray teamlist = (jsonarray) jsonobject.get("teams"); iterator<jsonarray> iterator = teamlist.iterator(); while (iterator.hasnext()) { system.out.println(iterator.next()); } output: {"name":"spain"} {"name":"germany"} {"name":"italy"} {"name":"brasil"} {"name":"argentina"} b

php - How to get mysqli error in different environments? -

in local/dev environment, mysqli query performing ok . however, when upload on webhost environment, got error; fatal error: call member function bind_param() on non-object in... here code: global $mysqli; $stmt = $mysqli->prepare("select id, description tbl_page_answer_category cur_own_id = ?"); $stmt->bind_param('i', $cur_id); $stmt->execute(); $stmt->bind_result($uid, $desc); to check query, tried execute query via control panel phpmyadmin , result ok . if there lacking information, please tell me can provide. first of all, have line before mysqli connect in all environments: mysqli_report(mysqli_report_error | mysqli_report_strict); after mysql errors transferred php exceptions. uncaught exception, in turn, makes php fatal error. thus, in case of mysql error, you'll conventional php error, instantly make aware of error cause. stack trace lead exact spot error occurred. note have able see php errors in general . ,

javascript - Having trouble using ReactCSSTransitionGroup -

i trying implement reactcsstransitiongroup , followed example on react website. using react 0.14-rc1 , reason reactcsstransitiongroup component not seem have affect. not getting errors on console. code: import react, { proptypes } 'react'; import reactdom 'react-dom'; import classnames 'classnames'; import dropzone 'react-dropzone'; import styles './addeventform.css'; import withstyles '../../../../../decorators/withstyles'; import link '../../../../../utils/link'; import dateselects '../dateselects'; import {startdateselect} '../dateselects'; import {enddateselect} '../dateselects'; import {eventtypeselect} '../dateselects'; import profilestore '../../../../../stores/profilestore'; import timelinestore '../../../../../stores/timelinestore'; import timelinedispatcher '../../../../../dispatchers/timelinedispatcher'; import timelineactions '../../../../../actions/time

linux - Script to perform remote login and execute another local script -

i have write script performs remote login , authentication , execute local script on remote. my original code this: #!/usr/bin/expect spawn ssh user@ip "bash -ls" < ./script.bash expect "password" send "abc123/r" interact which gives following on running ./my_script.sh spawn ssh user@ip "bash -ls" < ./script.bash user@ip's password: ./script.bash: no such file or directory however, if run script without argument i.e. just #!/usr/bin/expect spawn ssh user@ip expect "password" send "abc123/r" interact it gets login. also if run directly through terminal without script like ssh user@ip "bash -ls" < ./script.bash then local file getting executed @ remote server after taking password through prompt. hence can please suggest how make original code work successfully. that's because expect not understand shell's input redirection. try this: spawn sh -c {ssh user@ip &quo

Android: Not receiving the extra intent ID -

hi i'm trying send data textview activity in destination activity doesn't pick intent data id. clarify, in destination activity not recognize variable "username" . how fix this? mainactivity activity (sender) public final static string username = "com.example.eugen.test.mainactivity.etusername"; intent destination_intent = new intent(this, destination.class); destination_intent.putextra(username,etusername.gettext()); startactivity(destination_intent); destination activity string usernamereceived = null; usernamereceived = getintent().getstringextra(destination.username); just change destination.username mainactivity.username variable username declared static in mainactivity . , ivan v suggested, practice create constants file , declare static constants there, make things more cleaner.

node.js - Is it possible to check JavaScript files with node and get errors when a semicolon is missing? -

i use following command before sending js files server: node --check <filename>.js that way can sure there no gross errors before forwarding file server (i.e. missing ')' generates error). what noticed, though, node.js not give me error if not put semicolon @ end of line. happen, looking @ command line options, cannot see such feature. is there way node.js ? what noticed, though, node.js not give me error if not put semicolon @ end of line. that's because javascript has error-correction mechanism called automatic semicolon insertion (see this question's answers more asi), parser insert semicolons token stream if they're missing in many cases. node isn't going give information. i recommend using proper lint tool instead, such eslint , jshint , or of several others.

node.js - NPM Install is exctracting packages -

usually install files in folder seems it's extacting in node_modules ? did mess up? i looked on internet couldn't find anwser. that's how npm dependency resolution works since version 3, efficiency purposes. more information have @ docs. https://docs.npmjs.com/how-npm-works/npm3

ruby on rails - Joins not by related field -

i have 2 models: question (id,text,section,factor) answer (id,question_id,selected) question has_many :answers answer belongs_to :question my goal find factor of question text equal answer's selected field , search answers to show mean here sql gives expected result select questions.factor answers inner join questions on questions.text = answers.selected answers.id = 5 in rails try use joins answers.joins(:question).where('questions.section = 4').where ('answers.selected = questions.text') but results not exact, can see in console rails includes connection related field "questions"."id" = "answers"."question_id" select "answers".* "answers" inner join "questions" on "questions"."id" = "answers"."question_id" "answers"."participant_id" = $1 , (questions.section = 4) , (answers.selected = questions.text) well, be

c++ - Will QTimer timeout signal be sent after stop() is called? -

i working on qt 5.5 / 4.8 now. worry whether timeout() signal (occasionally)sent after timer explicitly stopped calling stop() on instance? i hope timeout() signal sent between start() , stop() , truth? my situation is: start() , stop() both called in main thread, , timeout() signal connect directly connection. (i know queued connection cannot guarantee above statement.) quick answer: no , won't called on of cases, there @ least 1 exception. a situation when may called if have used queued connections . here may associated slots called after you've stopped if, example, qtimer::timeout signal happens emitted before stopping timer. in case above slots queued (but not called), may happen call qtimer::stop before slots invoked. if use queued connections can check qtimer::isactive() @ beginning of slot (you'll need way access timer of course, maybe member of class).