Posts

Showing posts from April, 2013

php - Installing Drupal - missing extension 'gd' -

i'm attempting install drupal on windows / apache / php box. when running install script 'install.php' i'm told extension gd not installed. my php ini file has enabled: ... ;extension=php_curl.dll ;extension=php_fileinfo.dll extension=php_gd2.dll ;extension=php_gettext.dll ;extension=php_gmp.dll ... i have restarted server. looking inside install script can see using if(extension_loaded ('gd')) discover extension, returns false . phpinfo(); mentions within 'php credits' section @ bottom. i've followed instructions can find, of boil down uncommenting in php.ini file. could point me in right direction? turned out 'read manual' moment. i hadn't set default extension directory via: extension_dir = c:\php\ext as assumed relative within downloaded installation. discovered reading apache logs.

jsf - Load images from outside of webapps / webcontext / deploy folder using <h:graphicImage> or <img> tag -

i need display images reside outside of deploy folder in web application using jsf <h:graphicimage> tag or html <img> tag. how can achieve that? to point, has accessible public url. thus, <img src> must refer http:// uri, not file:// uri or so. ultimately, html source executed @ enduser's machine , images downloaded individually webbrowser during parsing html source. when webbrowser encounters file:// uri such c:\path\to\image.png , in enduser's own local disk file system image instead of webserver's one. not going work if webbrowser runs @ physically different machine webserver. there several ways achieve this: if have full control on images folder, drop folder images, e.g. /images directly in servletcontainer's deploy folder, such /webapps folder in case of tomcat , /domains/domain1/applications folder in case of glassfish. no further configuration necessary. or, add new webapp context server points absolute disk file sy

java - complexity of simple algorithm -

i have following algorithm dont know its' complexity. me? input size n. int x = n; while (x > 0) { system.out.println("value is" + x); x = x/5; } thanks lot! in each iteration x divided 5. how many iterations take x become lower 1 (and therefore 0)? the answer log5(n) (logarithm base 5 of n), o(log(n)) .

javascript - Why is BST (British Summer Time/Daylight Savings Time) being added to my datetime in node? -

i'm logging out following.... dbresponsestub.starttime = new date(2014,6,13); console.log(dbresponse[0].starttime); console.log(new moment(dbresponse[0].starttime).utc().format()); but getting... fri jun 13 2014 00:00:00 gmt+0100 (bst) 2014-06-12t23:00:00+00:00 i'm confused because second 1 hour behind should be. bst thing happens in first 1 causing problem. know how turn off in node time be? dates given in local time. the first 1 has bst in because showing time zone, , time zone computer configured use. british summer time hour ahead of coordinated universal time. if want stay in bst remove .utc() don't convert it.

java - Error inheriting a module in a mavenized GWT project -

after adding dependency in pom.xml : <dependency> <groupid>com.eaio.uuid</groupid> <artifactid>uuid</artifactid> <version>3.2</version> </dependency> i error jetty on module load event: no source code available com.eaio.uuid; did forget inherit module? unable find com.client.myproject..` what missing? if you're using of classes in artifact in gwt compiled code, source code needs available, either packaged in jar or source jar (remember that's dependency). you'll have .gwt.xml file in jar, name need inherit in own gwt descriptor, eg. if file called com/eaio/uuid.gwt.xml should ... <inherits name="com.eaio.uuid" /> ... if 1 isn't available, create own simple <source path="..." /> , stick in right package in own project (still provided source is available!) cheers,

javascript - Click handler inside another -

i have structure uses couple of list elements hold anchor tags. basically, have click handler on list element itself, , click handler on anchor tag within it. however, issue having when click on anchor tag, fires list element's click handler. $(".mystructure").on("click", ".mylis", dosomeaction); $(".mystructure").on("click", "#mylink2", dosomeaction2); <div class="mystructure"> <li class="mylis"> <a id="mylink">abc</a> </li> <li class="mylis"> <a id="mylink2">abc</a> </li> </div> can tell me can when click on anchor tag invokes method want to? can't seem find out can do. you can call event.stoppropagation() link event handler. event.stoppropagation() prevents event bubbling dom tree, preventing parent handlers being notified of event. functio

html - When trying to link an image in a figure, nothing happens? -

i have image inside figure link email, when add tag, nothing happens. how fix this? <figure> <a href="mailto:#"> <img src="images/slides/slide2.2.png" alt="class-header-3d" width="900" height="450" class="alignnone size-large wp-image-174" /> </a> <figcaption><strong>game submission open! click image direct link e-mail.</strong> </figcaption> </figure> .css-slideshow { position: relative; max-width: 900px; height: 450px; margin: 2em auto .5em auto; } .css-slideshow figure { margin: 0; max-width: 900px; height: 450px; background: #000; position: absolute; } .css-slideshow img { box-shadow: 0 0 2px #666; } .css-slideshow figcaption { position: absolute; top: 0; color: #fff; background: rgba(0, 0, 0, .3); font-size: 0.9em; padding: 8px 12px; opacity: 0; transition: opaci

html - PHP Mail Form - Checkbox Array -

so i've looked around @ several older questions here on stack overflow , none of them seem give me right output figured should ask own question. this basic answer, not versed in php. trying send array of checkboxes via e-mail no success far. below small sample have far in form: html <input type="checkbox" name="colorstones[white]" value="white" />white <input type="checkbox" name="colorstones[pink]" value="pink" />pink <input type="checkbox" name="colorstones[yellow]" value="yellow" />yellow <input type="checkbox" name="colorstones[light brown/cognac]" value="light brown/cognac" />light brown/cognac php $finish_colors = implode(', ', $_post['colorstones']); $body = $colorstones; $subject = 'scio test form submission'; $headers = 'from: example@example.com' . "\r\n" . 'reply-to: ex

java - git ignore doesn't ignore already submitted files? -

this .gitignore file: src/main/resources/* !src/main/resources/input in past submitted few files under resources folder. now see files still monitored git (as changed) if under src/main/resources/foo1 how come git ignore don't hide these files git status ? gitignore governs addition of new files, files tracked continue tracked. to remove them git keep them in filesystem, use --cached option of rm : git rm -r --cached src/main/resources

php - Generating Dynamic Navbar based on SQL results? -

hello superiors coders. im trying make shop section part of website includes sidebar navbar can clicked specify sections of product e.g. electrical or cctv. i've done allocating products category , generate navbar querying categories , looping through creating html bar displays categories example <div class="leftside" id="leftbar"> <nav class="menu-top"> <ul class="off-canvas-list" style="font-size: 25px;font-weight: bold"> <li style="padding-top: 2.7rem"></li> <?php foreach ($item_list $list) { echo "<li><a href='/welcome/shop_search/" . $list->type . "'>" . $list->type . "</a></li>"; } ?> </ul> </nav> the problem want able use sub categories have not got clue how sql data should set out how incorporate intelligence loop through add main categ

ios - Forced to use parameter names, but only some of them -

this question has answer here: function parameter names don't behave according documentation 2 answers i'm new swift , i've read swift function documentation , far understand function has built way: func funcname(param1:type, param2:type) -> return { //whatever istructions } and has called way: funcname(1, 2); very easy, , here original apple documentation: func halfopenrangelength(start: int, end: int) -> int { return end - start } println(halfopenrangelength(1, 10)) // prints "9" so in last example when calling halfopenrangelength function don't have specify name of parameters ( start , end ). so did function in xcode: func assegnarisposte(uno:string, due:string, tre:string, quattro:string){ button1.settitle(uno, forstate: uicontrolstate.normal) button2.settitle(due, forstate: uicontrolstate.normal

javascript - Kendo MVC Bar Charts / Column chart CategoryAxis Fit day -

Image
i'm facing problem while using kendo mvc bar charts / column chart. in categoryaxis, put date values. if choose ".baseunit(chartaxisbaseunit.days)" option in categoryaxis, date values of month including days there no value. is there way hide days there no value ? here have; <%= html.kendo().chart<dafydac.models.kpis.historyelecconsumpview>() .name("kilovat") .datasource(datasource => datasource .sort(sort => sort.add(model => model.hec_date).ascending()) ) .series(series => { series.column(model => model.hec_power).name("power (kva)"); series.column(model => model.hec_consumption).name("elec. consump. (kvh)"); }) .categoryaxis(axis => axis .date() .labels(l=>l.template("#= kendo.tostring(value, 'dd/mm/yyyy')#")) .title("month") .categories(model => model.hec_date) .color(&quo

html - Get First Vid From Youtube VB.NET -

im trying first youtube link youtube or google can't work. can please me out? dim m new regex( "<a href=""/watch?v=.*""" ) dim request2 system.net.httpwebrequest = system.net.httpwebrequest.create(" https://www.youtube.com/results?search_query= " + listbox1.selecteditem + " " + listbox2.selecteditem) dim responseyoutube system.net.httpwebresponse = request2.getresponse textbox2.text = (request2.address.tostring) dim sr system.io.streamreader = new system.io.streamreader(responseyoutube.getresponsestream()) dim rssourcecodey string = sr.readtoend dim matches matchcollection = m.matches(rssourcecodey) textbox1.text = rssourcecodey each itemcode2 match in matches youtube = itemcode2.value.split("=").getvalue(1) listbox2.items.add(youtube) ? special meta char in regex makes previous token optional 1 (not 1 after * or + ). need escape ? symbol in-order match

tags - Android: card emulation - read ndef message with PN532 nfc module -

i have lg d320n android phone, elechouse's pn532 nfc module , stollmann's nfcplayer can read nfc tags properly. i tested sample here: https://github.com/grundid/host-card-emulation-sample it works fine, when read 1 android device tag android device reader. can not read android device tag pn532 reader through nfcplayer. want reader read ndef message android device acting tag, nfcplayer doesn't recognise android device. think have write modifications on android side can't figure out do. think don't have enough knowlege how nfc communication , hce work, though read this: https://developer.android.com/guide/topics/connectivity/nfc/hce.html i appreciate guideline me understand missing here. the grundid example app should discovered nfcplayer "legacy tag" (tab "r/w: legacy") not implement ndef abstraction layer. on tab, can exchange pdus (apdus in case of hce) emulated smartcard. valid apdu example app be 00 a4 04 00 07 f00102030

internationalization - Multi language support using JavaScript -

i'm working on javascript based web app. want json based multiple language integration. 1 best library (without jquery) provide multi language support? actually working angularjs , angular-translate has covered needs on field. can translations js or json please. has problems scopes , cached translations solvable. have @ it: http://angular-translate.github.io/

Can you increase the spark shell output character limit -

when running code in spark shell, convenient have small outputs/a sample printed in shell directly rather putting output in file. by default, shell truncate such output after (fairly small) given number of characters. there way character limit can increased? i'm running spark 1.2 thanks reading what mean "output"? if want print n lines of rdd use take() : myrdd.take(n).foreach(println) according spark programming guide 1.2.0 , function "return array first n elements of dataset. note not executed in parallel. instead, driver program computes elements."

How to retrieve LDAP data in Grails? -

i trying use grails plugin 'directory services' access ldap data. unable configure in ggts. can me code or directions used in coding program ldap access in ggts. did check documentation http://lr.github.io/directory-service/guide/configuration.html see how configure plugin ? client , means have install / configure ldap server. have @ apache directory project https://directory.apache.org ldap client / server . afterwards can connect grails client ldap-server.

android - Model View Presenter - same view, different presenters -

i'm building 1 android app using mvp, , have 1 question pattern. say have 1 screen creating new person . screen show 1 edittext inserting name, surname, 1 imageview show picked photo picture, etc. lead 1 view interface, implemented fragment . cooperate 1 presenter interface, implemented class. fine. now have feature: screen editing existing person . happens, view feature identical 1 creating new person. however, presenter different. start loading existing person db pre-populate view current data, , action on database when clicking "save" update instead of insertion. so, think example of mvp where 1 view works different implementations of presenter achieve different use cases . do think correct assumption, or think different features should have different view , presenter interfaces? also, if you'd common view , different presenters , implementation of view common, or lead same interface implemented 2 classes? in practice, see 2 options. ha

javascript - Format point value in hightcharts -

i have graph 2 line series. points in each series percent them database in format : 0.24 24% , 0.02 2% ... there method multiply value 100 directly in graph options ? try use pointformat , pointformatter test isn't succesfull... my graph configuration : options.evolres.chart = { renderto: 'container_graph', backgroundcolor: '#f1f1f1', width: $('#container_graph:parent').width(), height: 700 }; options.evolres.title = { text: 'title', x: -20 }; options.evolres.yaxis = [ { title: { text: 'result' }, labels: { format: '{value}%' }, min: 0, max: 100, tickinterval: 10 } ]; options.evolres.xaxis = { categories: ['t1','t2','t3','t4','t5','t6'], labels: { rotation: -45, y: 20 } }; options.evolres.tooltip = { crosshairs: true,

How to fail promise in Scala -

in scala documentation, there example how pick future succeeds faster using promises. http://docs.scala-lang.org/overviews/core/futures.html#promises def first[t](f: future[t], g: future[t]): future[t] = { val p = promise[t] f onsuccess { case x => p.trysuccess(x) } g onsuccess { case x => p.trysuccess(x) } p.future } this function returns future succeeds first , if either 1 of them fails, never completes. is possible modify in way if other future fails, second returned if it's successful , if both of them successful, faster 1 picked code now. you can add this: f onfailure { case e => g onfailure { case _ => p.failure(e) } } when both futures failed, fail promise same exception f . can elaborate on create exception records 2 exceptions coming f , g if necessary.

internet explorer - Angularjs is not working on some old browser -

angularjs scripts not working on old browsers want redirect users use these old browsers. how can understand angular working or not in client browsers. since angular 1.3, support ie8 , below dropped angularjs 1.3 has dropped support ie8. read more on our blog. angularjs 1.2 continue support ie8, core team not plan spend time addressing issues specific ie8 or earlier. you can access user agent information so $window.navigator.useragent; check out question: how detect browser using angular?

java - Gurobi cannot set or print (manually) value of variables -

i'm writing program in java gurobi 6.0.2 , i've trouble management of variables, in particular can't set or print them. example: grbenv env = new grbenv(); grbmodel model = new grbmodel(env); grbvar x = model.addvar(0.0, grb.infinity, 0.0, grb.semiint, "x"); x.set(grb.doubleattr.x, 10.0); system.out.println(x.get(grb.doubleattr.x)); netbeans shows message: exception in thread "main" gurobi.grbexception: error @ grbvar.set @ gurobi.grbvar.set(grbvar.java:141) @ core.optimize.main(optimize.java:29) java result: 1 this problem happens when resolved relaxation model, can't retrive value of variables. if want set start values variables, cannot use x.set(grb.doubleattr.x, 10.0); but have write x.set(grb.doubleattr.start, 10.0); getting variable values makes sense after have solved model.

javascript - AngularJS css performance on table column background color -

i have table generate json data ng-repeat. when user click on link want highlight corresponding column in table background color. (when key.key === anchor.output in code) <table> <colgroup> <col ng-repeat="key in preview.data[0] track $index" ng-class="{ 'selected-class-name': key.key === anchor.output }"> </colgroup> <tr> <td id="anchoroutput_{{key.key}}" ng-repeat="key in preview.data[0] track $index"> {{ key.key }} </td> </tr> <tr ng-repeat="data in preview.data"> <td ng-repeat="key in data"> {{ key.value }} </td> </tr> </table> this code working have huge performance issues on big tables, ie ui profiler tells me there lot of calls removechild() , appendchild() ui profiler screenshot : http://imgur.com/f5wk02v questions : what can improve performance of css style update ? i tw

c++ - Replace GetInstanceOfClass1()->GetInstanceOfClass2() with extern? -

what happen if "shorten" call: getinstanceofclass1()->getinstanceofclass2(); (where instance of class2 member of class1) extern function declared in class1.cpp: extern void getinstanceofclass2() { getinstanceofclass1()->getinstanceofclass2(); } will compiler (clang) produce inefficient code? ugly, bad idea actually?

linux - Mysql: how to get the mysql status info just using one command -

i have installed mysql-server on ubuntu. if want know status of mysql, need type 'mysql -u root -p' in command line, , need type password enter mysql interaction mode, in interaction mode need type 'show status' , can see info. question is, there method doesn't need enter mysql interaction mode, type 1 command in command line , mysql status info? you can use: mysql -p'password' -e "show status" where -e flag is: -e, --execute=name execute command , quit. (disables --force , history file.) if don't want use password of mysql documentation can store password in option file (note change permissions respectively): store password in option file. example, on unix, can list password in [client] section of .my.cnf file in home directory: [client] password=your_pass so have run: mysql -e "show status"

c# - object does not belong to a list error when loading file using clientcontext -

i trying load file , properties in sharepoint microsoft.sharepoint.client.file newfile = null; newfile = clientcontext.web.getfilebyserverrelativeurl(relativeurl); listitem item = updatefile.listitemallfields; clientcontext.load(item, => i.fieldvaluesastext, i=> i.contenttype ); clientcontext.load(newfile , => i.checkouttype, => i.listitemallfields); clientcontext.executequery(); this throws "object not belong list" error when library name , content type name of file same works fine otherwise what causing issue?

java - Call more than post method in same resource in RestLet framework -

i want more 1 post method in same resource class of restlet framework shown below: public class myclass extends serverresource { private logger log = logger.getlogger(loginresource.class.getname()); @post public representation createuser(final representation representation) throws ioexception { .......................... ................................ } /** * class in creating person. * @return representation representation * @param representation representation * @throws ioexception ioexception */ @post public representation createalluser(final representation representation) throws ioexception { ............... ............................... return new jacksonrepresentation<>("success"); } } how can it? please provide solution according problem. please me. i don't know want do. isn't clear question way choose method use handle post reque

XQuery: Return how many times a search term was found in a XML document -

i have collection of 2 xml files (tagged according tei standard , containing lots of <entry> elements) in exist database. i'm looping through file flwor routine, looking search term user typed in form ( $searchterm ) , returning contents of elements. far good. add thing, don't know how that: i count how many <entry> had $searchterm in <form type="hyperlemma"> , print instead of xxx . if $searchterm equals "ангелъ", number "3". need print information before loop through collection, have no clue need do. could help? i'm still new xquery, code isn't pretty, hints me improve appreciated, too! my xquery: xquery version "3.0"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare option exist:serialize "method=xhtml media-type=text/html"; declare variable $searchphrase := request:get-parameter("searchphrase", ()); declare variable $collection_path := "/db/apps/

How can I Link Jira issues to an epic using java and REST -

i create jira issues through java , rest service following link . want link jira issues created epic in project. how can through java code. the jira rest api has defined here . from reading pastebin example call similar createissue except call jira rest api has defined above required fields.

java - eclipselink doesn't care about foreign key constraint, but the DBMS does -

i have issue jpa , relation manytomany. use inheritance strategy both sides of relation. jpa doesn't take account foreign key constraints, mysql when use workbensh delete characters bound movie example. i don't understand how jpa can pass through constraints. the first class hierarchy : @entity @discriminatorcolumn(name = "typeoeuvre",discriminatortype = discriminatortype.integer) @table(name="oeuvre") public abstract class etyoeuvre extends etyabstract implements itcompositeinfo,comparable<etyoeuvre> { @manytomany(cascade ={ cascadetype.persist},fetch = fetchtype.eager) @jointable(name="oeuvres_characters", joincolumns = @joincolumn(name="oeuvres_id"),inversejoincolumns = @joincolumn(name="characters_id")) @orderby("last_name,first_name asc") protected list<etycharacter> characters = new linkedlist<etycharacte

mysql - codeigniter left join without wrapping character -

i'm having trouble generating query in codeigniter. problem is $this->db->select('user.*') ->join('user_group', 'user.group_id between user_group.start_range , user_group.end_range', 'left'); this code generates following query: select `user`.* (`user`) left join `user_group` on `user`.`group_id` `between` user_group.start_range , user_group.end_range here, mysql can not recognize between inside quote character, how can generate query without wrapping quote character. please, give me suggestion. i'm using codeigniter 2.2.0 you need either override $_reserved_identifiers variable in ci_db_driver class following var $_reserved_identifiers = array('*', 'between'); // identifiers should not escaped (note im not sure if reduces security) https://github.com/bcit-ci/codeigniter/blob/2.2-stable/system/database/db_driver.php#l67 the other option replicate between operator using >= , <=

sharding - How to add additional primary shards to Elasticsearch cluster? -

i have cluster containing 7 nodes, i've noticed using 5 primary shards, meaning per index - utilizing 5 nodes out of 7. add 2 additional primary shards newly created indices. i've added following elasticsearch.yml , restarted cluster: index.number_of_shards: 7 index.number_of_replicas: 0 however, it's been few days , few new indices since - , still see sharding 5 pieces.. can explain why? missing additional configuration here? thanks! you have reindex affected index. imagine there 1 index in cluster. number of shards can not change automatically in existing index. this relative question might , this question if not want downtime, works aliases , 2 indexes- 1 before resharding , 1 afterwards , switch aliases point in wherever index want

html5 - Add html asynchronously -

i want add new html in page asynchronously like $.each(programlistall, function (j, inneritem) { programhtml = '<div class="row"><ul>'; $("#programlist").append(programhtml); }); it should show user html adding asynchronously. how can achieve this? you have little delay in adding items, code this: var $programhtml = $('<ul class="row"></ul>'); $('#programlist').append($programhtml); var delay = 1000; $.each(programlistall, function (j, inneritem) { $programhtml.delay(j * delay).append('<li'> + inneritem + '</li>'); });

ios - SceneKit crash in unknown (internal?) method -

i'm trying integrate third-party scenekit code app, , i'm experiencing mysterious crash. oddly, crash gives no error or log in xcode, , stack trace "uiapplicationmain". no helpful info there. the code works in third-party app got , i've copied wholesale, know must delegate call or framework haven't included, etc. first experience scenekit i'm having trouble closing in on be. the crash happens during event user taps on screen , new 3d object added scene. i've breakpointed associated methods, , crash seems happening in in-between time, presumably internal scenekit functionality, can't pinpoint it. my crashlytics report, though, did pick info, have included here: thread : crashed: com.apple.main-thread 0 libobjc.a.dylib 0x00981ea8 _objc_empty_cache 1 scenekit 0x015e0273 __28-[scnphysicsbody _setowner:]_block_invoke + 214 2 scenekit 0x016b05b5 c3dtransactionflush + 2014 3 co

ruby - How to convert PDF to Excel or CSV in Rails 4 -

Image
i have searched lot. have no choice unless asking here. guys know online convertor has api or gem/s can convert pdf excel or csv file? i not sure if here best place ask either. my application in rails 4.2. pdf file has contains header , big table 10 columns. more info: user upload pdf via form need grab pdf parse csv , read content. tried read content pdf reader gem result wasn't promising. i have used: freepdfconvert.com/pdf-excel unfortunately don't supply api. (i have contacted them) sample pdf this piece of code convert pdf text handy. gem: pdf-reader def self.parse reader = pdf::reader.new("pdf_uploaded_by_user.pdf") reader.pages.each |page| puts page.text end end now if check sample attached pdf see fields might empty means can't split text line space , put in array won't able map array correct fields. thank you. ok, after lots of research couldn't find api or proper software it. here how did i

SVN error when run by crontab -- SOLVED -

i wrote shell script run svn, following: #! /bin/sh cd /data/tmpsvn/ export lc_all=zh_cn.utf8 date "+getsvn - [%y-%m-%d %t]" >>svn.log 2>&1 /usr/local/bin/svn checkout http://ip >> svn.log 2>&1 then wrote crontab: */5 * * * * sh /data/htdocs/zlbz-test/tools/get_svn_all.sh 1>/dev/null 2>&1 some errors occur shown in log file: getsvn - [2015-05-12 14:40:01] /usr/local/bin/svn: error while loading shared libraries: libssl.so.1.0.0: cannot open shared object file: no such file or directory but when execute command in terminal, work well. can people explain has happened? thanks~ it's been solve according vadim landa's link in comment. added line in script: export ld_library_path=$ld_library_path:/usr/local/openssl/lib/ most probably, ld_library_path variable set in shell profile, not in crontab. check out thread: python cannot find shared library in cron

typo3 - Fluid image with extra data for cycle2 -

i'm using cycle2 image slider, adding title data needed in image url, want generate following url: <img src="foto.jpg" data-cycle-title="title" data-cycle-desc="subtitle" /> i tried following generates error? <f:image src="foto.jpg" data-cycle-title="title" data-cycle-desc="subtitle" /> since data-cycle-title , data-cicle-desc not registered arguments within imageviewhelper cant pass values directly. there additionalattributes argument rescue. can add many attributes have in image tag. additionalattributes expects array notation: <f:image ... additionalattributes="{data-cycle-title: 'title', data-cycle-desc: 'subtitle'}" ... />

javascript - Calling helper function in node.js within callback? -

i'm new programming node.js , not quite sure why getting error. function looks set correctly, , don't believe have asynchronous problems b/c should account self variable put in place (i think). did try w/o too, using simple var consoleprint(...) anyways, code below , error log below that. /* global __dirname */ var express = require('express'); var app = express(); var bodyparser = require('body-parser'); var self = this; //calling helper function here var server = app.listen(8000, self.consoleprint(server)); app.use(bodyparser.urlencoded({ extended: true })); app.use(bodyparser.json()); app.use('/public', express.static(__dirname + '/public')); app.get('/', function (req, res) { res.sendfile(__dirname + '/public/views/index.html'); }); //---------------helper function(s)-------------------// self.consoleprint = function(servervar){ var host = servervar.address().address; var port = servervar.address().port; c

objective c - Read data from geoJson file in ios -

i'm trying read data geojson file using code: nsstring *jsonpath = [[nsbundle mainbundle] pathforresource:@"roads_json" oftype:@"geojson"]; nsdictionary *json = [nsjsonserialization jsonobjectwithdata:[[nsdata alloc] initwithcontentsoffile:jsonpath] options:0 error:nil]; nslog(@"points:%@",json); and output: points:(null) any idea plz... it best pass nserror object when using nsjsonserialization . way can know wrong. nserror *error; nsdictionary *json = [nsjsonserialization jsonobjectwithdata:[[nsdata alloc] initwithcontentsoffile:jsonpath] options:0 error:&error]; if (error) { nslog(@

Plivo SDK call Recording -

i getting error dont understand cannot find helpfull informations about: no 'access-control-allow-origin' header present on requested resource. origin 'https:*******' therefore not allowed access. response had http status code 401. function recordthecall() { var key = '*******************'; $.get( "https://api.plivo.com/v1/account/"+key+"/call/?status=live", function( data ) { var calluuid = data.call_uuid }); $.ajax({ url: "https://api.plivo.com/v1/account/"+key+"/call/"+calluuid+"/record/", type: "post", data: { 'auth_id': auth_id, 'call_uuid': calluuid }, datatype: "json", success: function (res) { alert(res); }, error: function(err) {

javascript - Switching <div> content with fade in and fade out -

<div id="div1">lorem ipsum dolor sit.</div> <div id="div2" style="display:none;">sit dolor ipsum lorem.</div> i have html contains code above, , want add hyperlink change content of div1 div2 content. how solve this? algorithm: div1 fade out div1 content = div2 content div1 fade in i found code (failed) $(document).ready(function(){ $("button").click(function(){ $("#div1").fadeout(); $("#div1").html(document.getelementbyid("div2").innerhtml); $("#div1").fadein(); });}); *but prefer hyperlink rather button. using jquery, following should work: // when link clicked $("#load").click(function (event) { // prevent page refreshing event.preventdefault(); // fade out // , wait animation finish $("#div1").fadeout().promise() // once finished, execute following function .done(function () { // c

Jmeter thread groups -

i have entered 500 number of thread group , ramp time 120 seconds when report generated,the virtual users count 15 or in composite graph-active threads on time raised near 12. bit confuse active threads counts. because data(threads) or numbers filled in test plan before test different , after result different. scaled values in graph?and x10?something related threads? each jmeter thread representing virtual user after initialization starts executing samplers upside down (or according logic controllers ). if thread doesn't have more samplers execute , no more loops iterate it's being shut down. looks case. see max users lower expected article more detailed explanation , workaround. usually people set loop count "forever" , use runtime controller test finish in designed time. option using i.e. ultimate thread group available via jmeter plugins provides convenient way of defining load scenario.

Android image picker to pick image from specified folder path -

i'm saving images folder in sdcard, in android app, want create image picker opens specific folder , allow picking images. tried many solutions none worked me! any appreciated. in advance. no, not possible. if necessary, can implement own gallery, pick images from android.provider.mediastore.images.media.internal_content_uri and android.provider.mediastore.images.media.external_content_uri

android - How does putExtra() works? -

can tell me how putextra() works? how , stores data passed ? still confused how data inside works , how passed 1 activity other activity? how structure organised? or values stored on inside of intent class ? imagine there class a. has 1 static string example .i want fill string in next activity call activityforresult() now there class b.i filled textbox id text_entered . , put code intent text = new intent(); test.putextra(a.example, text_entered); now text saved, in example or in intent test? activity1.class intent intent = new intent(getapplicationcontext(), activity2.class); intent.putextra("extra_name", 4);//int intent.putextra("extra_name", "string_values");//string activity2.class string stringvalue = getintent().getstringextra("extra_name");//string int ivalue = getintent().getintextra("extra_name", 0);//defaultvalue = 0

mysql - Get latest rows from my sql database -

i have table there in rows there column called version. have 2 same entries 1 column abc(unique) in same rows. have 2 rows follows id|name|version|unique_id ------------------------- 1 |abc |1 | 23 2 |abc1|2 |23 3 |xyz |1 |21 4 |tre |1 |20 i want result as id|name|version|unique_id ------------------------- 2 |abc1|2 |23 3 |xyz |1 |21 4 |tre |1 |20 i have tried grouping unique_id, result follows id|name|version|unique_id ------------------------- 1 |abc |1 | 23 3 |xyz |1 |21 4 |tre |1 |20 following query using select * test group unique_id order version desc; i want latest(top order desc) of each each rows. please help. how can achieve that. how like insert tbllogs (logorigin, logaction, loguser, logdate, logoutcome) values (:origin, :action, :user, :dt, :outcome) use sub s

iphone - iOS Location Services Fail when testing in Xcode -

i trying use gpx file test location services on app while running app on ios simulator on mac. have added gpx file mac, , navigation icon in debug toolbar turns blue. however, when decide run app, icon on debug bar turns grey , app cannot find location. problem exists when use location (london, built in , not gpx file) also. any ideas on why occurring?

javascript - Angularjs having multiple views with same controller and only run the controller once? -

right have 2 separate views want able controll in 1 controller. however, @ moment, controller get's run twice. there anyway connect multiple views same controller have controller run once? i know have set factory share $scope data, goal not gather data twice. .state('cloud', { url: '/cloud', views: { 'main': { templateurl: 'main.html', controller: 'cloud' }, 'second': { templateurl: 'second.html', controller: 'cloud' } } }) the controller get's run twice because within "cloud" state defined 2 views , both views having same controller. so, when both views gets loaded controller called twice. but if want called controller once have defined separate controller both views.

sql - Why does my text value not appear in matlab gui? -

i've managed retrieve 5 string values database whereby results = 'something1' 'something2' 'something3' 'something4' 'something5'. want these values display in edit texts matlab gui. how do that? how pass values results = curs.data; 5 different set(handles.edit1,'string'); ? %assign data output variable results = curs.data; display(results); %diplay in edit texts matlab gui set(handles.edit1,'string'); set(handles.edit2,'string'); set(handles.edit3,'string'); set(handles.edit4,'string'); set(handles.edit5,'string'); if results cell array do: set(handles.edit1,'string',results{1}); and repeat each string. or, if wish, can use arrayfun : arrayfun(@(k) eval(['set(handles.edit' num2str(k) ',''string'',results{' num2str(k) '}); ']),1:5);

ios - How to exclude header from reloading when using reloadData in UICollectionView -

i have uicollectionview using csstickyheaderflowlayout mimic header behavior in uitableview . inside header there segmentedcontrol control data on uicollectionview . want reload data when tap segment (calling api) , perform reloaddata called - (uicollectionreusableview *)collectionview:(uicollectionview *)collectionview viewforsupplementaryelementofkind:(nsstring *)kind atindexpath:(nsindexpath *)indexpath so best approach reload data not header, because when reloaddata header reload too, , segment first state. here code viewforsupplementaryelementofkind - (uicollectionreusableview *)collectionview:(uicollectionview *)collectionview viewforsupplementaryelementofkind:(nsstring *)kind atindexpath:(nsindexpath *)indexpath { uicollectionreusableview *reusableview = nil; if (kind == uicollectionelementkindsectionheader) { segmentheaderview *collectionheader= [collectionview dequeuereusablesupplementaryviewofkind:kind withreuseidentifier:@"header" fo

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

ruby on rails - Excluding quotes in a split method Regex -

i'm having hard time understanding how use regexp in split method in ruby. i have string: "mark sally 'john smith' steve" and trying array: ["mark", "sally", "john smith", "steve"] instead of split ting string, consider matching or using parser this. s = "mark sally 'john smith' steve" p s.scan(/'([^']+)'|(\s+)/).flatten.compact #=> ["mark", "sally", "john smith", "steve"]

javascript - How do I return the response from an asynchronous call? -

i have function foo makes ajax request. how can return response foo ? i tried return value success callback assigning response local variable inside function , return one, none of ways return response. function foo() { var result; $.ajax({ url: '...', success: function(response) { result = response; // return response; // <- tried 1 } }); return result; } var result = foo(); // ends being `undefined`. -> more general explanation of async behavior different examples, please see why variable unaltered after modify inside of function? - asynchronous code reference -> if understand problem, skip possible solutions below. the problem the a in ajax stands asynchronous . means sending request (or rather receiving response) taken out of normal execution flow. in example, $.ajax returns , next statement, return result; , executed before function passed success callback ca