Posts

Showing posts from April, 2011

php - HttpURLConnection check whether JSON string has been inserted in mysql successfully -

i implemented android code send json string server. getting json string '{"mac": "23:a5:j0:06:c6:e9", "latitude":84.16898451,"longitude":3.16561387,"route": 1}' output in doinbackground method , getting output output of getresponsecode: the output of getresponsecode: 200 in client side. i checked php file in localhost , when fresh index.php homepage, bus table being created , data updated if change values in json string. not connect s4 device localhost directly check since using public hotspot. i have uploaded index.php file online file manager in htdocs directory on byethost.com server, table bus being created no record being inserted , updated. is possible httpurlconnection check whether data has been inserted/updated in bus table? should add path first parameter of file_get_contents method else php://input ? doinbackground method: protected void doinbackground(string... params) { // todo auto-ge

c - include errno if not accessed directly -

do need include errno.h if don't access errno directly? eg. void *mem = malloc(16384); if (mem == null) { perror("malloc"); exit(exit_failure); } i tried simple piece of code without including errno.h , worked, i'm not sure if it's ok this. maybe errho.h included in other libraries stdlib.h , don't need explicitly include myself? you don't need <errno.h> if use perror() . from linux programmer's manual : name perror - print system error message synopsis #include <stdio.h> void perror(const char *s); #include <errno.h> const char *sys_errlist[]; int sys_nerr; int errno; this means need <errno.h> if use sys_errlist , sys_nerr or errno . note sys_errlist , sys_nerr bsd extensions. similar entries can found on c99 standard. 7.19.10.4 perror function synopsis #include <stdio.h> void perror(const char *s); and need <

python - Get last element of type string in a list -

suppose have list of different types: i.e. [7, 'string 1', 'string 2', [a, b c], 'string 3', 0, (1, 2, 3)] is there pythonic way return 'string 3' ? if have given type, can use several kinds of comprehensions need. [el el in lst if isinstance(el, given_type)][-1] # gives last element if there one, else indexerror or next((el el in reversed(lst) if isinstance(el, given_type)), none) # gives last element if there one, else none if you're doing enough, can factor function: def get_last_of_type(type_, iterable): el in reversed(iterable): if isinstance(el, type_): return el return none

How to call/use data returned by python function in javascript? -

i've defined function in views.py this def ma_fonction_bokeh(request, numero = none): cdr_common = settings.dbcon[settings.mongo_cdrstats['cdr_common']] acc = cdr_common.find() donnees = [] # on initialise une liste in acc: if i['accountcode'] == numero: donnees.append([calendar.timegm(i["start_uepoch"].timetuple()), i["duration"]]) data = simplejson.dumps(donnees) return render(request,"frontend/mongraphe.html", {"name": numero, "data": data}) then in mongraphe.html file i've created javascript code plot got http://www.highcharts.com/stock/demo/dynamic-update want customize plot own data returned function defined @ first... how can that? i've tried ajax function without result you can transfer data python code javascript in several ways. the "proper" way create endpoint returns json data , use ajax request (for example, jquery.getjs

Import data from text file to mysql in php -

i want import data txt file mysql in php my txt file as: id name rollno grno inoutdatetime 1 test 1 1 10/4/2015 05:20:00 2 test2 2 2 11/4/2015 08:20:00 and not have insert duplication of date data row create database table columns according needs. create table yourtablename ( id int, name varchar(100), rollno int, grno int, inoutdatetime varchar(100) ) engine=innodb; if txt file follows same format example. $fhandle=fopen("textfile.txt", "r"); fgets($fhandle); //first fgets read on header line. while($line=fgets($fhandle)){ //explode line space delimeter $words=explode(" ",$line); /* additional checks , data sanitizing here. */ //if every line follows format in example, , not empty, insert table here $sql="inser yourtablename values ($words[0], $words[1], $words[2], $words[3], $words[4])";

android - Update ListView everytime the Data changes -

i'm building chat using php , java, i'm getting data chat using json file, , inserting data calling php file inserts new message database. i'm listing messages in listview , , trying update listview everytime new message sent, code working, automatically update listview when send new message. i have click @ chat room again see listview updated. update listview both users, receiver , sender. i tried update adapter using: notifydatasetchanged(); didn't work. how can that? code: my adapter: @override protected void onpostexecute(void result) { super.onpostexecute(result); // dismiss progress dialog if (pdialog.isshowing()) pdialog.dismiss(); /** * updating parsed json data listview * */ adapter = new costumeadapter( chatroomactivity.this, contactlist, r.layout.chat_row, new string[]{ tag_message, tag_conversation },

Filtering out correlation values in seaborn corrplot -

Image
i'm using corrplot function in seaborn , works flawlessly. however, want little filtering on data. there way hide correlations below or above value? have large data frame , want see correlations greater arbitrary number, .4. i'd 'squares' in image not greater .4 set white, grey or other color. i'm not sure how because corrplot takes full data frame , calculates correlations internally. don't want filter on data frame values, resulting correlation values. maybe there's way resulting image underlying matshow call own code , replot filtering image itself?

json - Timeout expired VB WebService Method Error -

i'm using method shows database content json arrays. times works it's giving me error lot of times: timeout expired. timeout period elapsed prior obtaining connection pool. may have occurred because pooled connections in use , max pool size reached by way other methods works 1 doing this this webmethod code: <webmethod> public sub afterordersinsert(jsonstring [string]) try dim context httpcontext = me.context dim strjson string = "" dim orderitems jarray = jarray.parse(jsonstring) 'dim incrementalconnection new sqlconnection() dim conn new sqlconnection(configurationmanager.connectionstrings("mycstring").connectionstring) each orderitem jobject in orderitems conn.open() dim selectquery string = "select * orders orderid = @a , name = @b" dim selectcommand new sqlcommand(selectquery, conn) selectcommand.parameters.addwit

google maps - How to solve 2 libraries with same package name in my dependencies in Android Studio? -

Image
i have below dependencies in project: compile filetree(dir: 'libs', include: ['*.jar']) compile 'com.android.support:appcompat-v7:21.0.2' compile 'com.google.android.gms:play-services:6.5.87' compile project(path: ':backend', configuration: 'android-endpoints') compile project(':library') compile files('libs/volley.jar') compile('com.google.maps.android:android-maps-utils:0.3+') now while syncing got below error: error:execution failed task ':app:processdebugresources'. error: more 1 library package name 'com.google.maps.android' can temporarily disable error android.enforceuniquepackagename=false however, temporary , enforced in 1.0 i have tried below same error got: compile('com.google.maps.android:android-maps-utils:0.3') { exclude group: 'com.google.android.gms' } i have tried below error remains: compile('

java - What methods are there to programmatically detect vulnerabilities within an Android O.S? -

what methods there programmatically detect vulnerabilities within android o.s? lead dos, code execution, overflow, memory corruption attacks etc. i'm not wanting know how perform above attacks, instead i'd know how can verify programatically whether flaws required perform attacks above exist within user's o.s do know method in, can write piece of code within android, scan through user's o.s flaws can lead toward dos attack etc.? assuming want code detects these vulnerabilities, wouldn't make sense because why wouldn't google's world class engineers run code detect these vulnerabilities themselves? i think best way approach problem map known vulnerabilities ( perhaps may help ) versions of android prior patch. therefore code detects user's android version, , lists discovered vulnerabilities. this isn't silver bullet solution because because security vulnerability fixed in 4.1, doesn't mean existed in previous version of

android - Cordova build error, exit code 65 - Eddy Verbruggen Calendar Plugin -

i trying use eddy verbruggen calendar plugin i created new starter app (myapp), , ran following instructions documentation: $ cordova plugin add https://github.com/eddyverbruggen/calendar-phonegap-plugin.git and run command afterwards: $ cordova build from there following failure: ** build failed ** following build commands failed: compilec build/myapp.build/debug-iphonesimulator/myapp.build/object-normal/i386/calendar.o myapp/plugins/nl.x-services.plugins.calendar/calendar.m normal i386 objective-c com.apple.compilers.llvm.clang.1_0.compiler (1 failure) error: /users/stellar/desktop/myapp/platforms/ios/cordova/build: command failed exit code 65 @ childprocess.whendone (/usr/local/lib/node_modules/cordova/node_modules/cordova- lib/src/cordova/superspawn.js:135:23) @ childprocess.emit (events.js:98:17) @ maybeclose (child_process.js:756:16) @ process.childprocess._handle.onexit (child_process.js:823:5) any guidance on how proceed? best regards, troy

javascript - Why does script file that's loaded before jQuery still work? -

Image
i planning load jquery on cdn rails app. unfortunately unable show code, i'll try explain. code set follows: in layout, before closing body tag: = javascript_include_tag "main_web" main_web.js: //= require jquery //= require page_script now want do, in layout = javascript_include_tag "https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js" = javascript_include_tag "main_web" and in main_web.js remove jquery dependency //=require page_script i did , have waterfall looks this: i want sure when implement change, none of visitors' browsers try execute main_script before jquery loaded. not 100% sure of scripts or how rendered on page javascript files loaded markup executed sequentially. therefore if have 2 script files in page: <script src="filea.js"></script> <script src="fileb.js"></script> filea.js execute before fileb.js this situation occurring in exam

java - How to move log4j.properties outside jar file? -

i build jar file gradle, app uses log4j . log4j.properties embedded in jar file. moved outside able modify in production. updated meta-inf/manifest.mf file embedded in jar file reflect this: class-path: lib/log4j-1.2.1 lib/slf4j-api-1.4.2.jar lib/slf4j-api-1.5.6.jar lib/slf4j-log4j12-1.5.6.jar lib/log4j-1.2.14.jar ... lib/log4j.properties my filetree follows on windows7 32bit machine: root/myapp.jar root/lib/log4j.properties i start app command: java -dlog4j.configuration='lib\log4j.properties' -dlog4j.debug=true -jar myapp.jar > logs/output.log my logs/output.log says log4j not find property file: log4j: trying find ['lib\log4j.properties'] using context classloader sun.misc.launcher$appclassloader@17fa65e. log4j: trying find ['lib\log4j.properties'] using sun.misc.launcher$appclassloader@17fa65e class loader. log4j: trying find ['lib\log4j.properties'] using classloader.getsystemr

windows 7 - Use PowerShell to add and remove shortcuts from Explorer's favorite bar -

Image
is there way use powershell manage explorer's shortcut? for example, remove 7346 add link ~/projects/9999 ? favourites in explorer shortcuts in \links folder in profile. if want remove 7346 : rm $home\links\7346.lnk creating 1 rather cumbersome in ps: $wshshell = new-object -comobject wscript.shell $shortcut = $wshshell.createshortcut("$home\links\9999.lnk") $shortcut.targetpath = "$home\9999" $shortcut.save() adjust target path if 9999 doesn't sit in root of user profile.

sql server - Select all Item From Table Where Order has any Items between dates -

i have orders table , orderitem table. select orderitems have been shipped between 2 dates, , select additional orderitem of type shipped outside of 2 dates if it's part of order has orderitems shipped between 2 dates. this seemed easy when first thought of it, i'm having hard time putting sql statement. i'm using sql server . edit: yes, familiar between keyword. have order , order #10001 . has 2 items, product shipped on 01/20/2015 , warranty marked shipped on 02/04/2015 . when run query: select * orderitems shipdate between '01/01/2015' , '01/31/2015' i 1 product, want warranty on order well. hope clarifies question. are familiar between keyword? select ... col between , if add more information, such sample data question, can elaborate on answer.

ado.net - Double value changed after transmitting it via .NET remoting -

i have application uses ado.net datasets , data adapters in combination remoting (client/server architecture, transmitting datasets via remoting). i face following issue: tl;dr: double value 44.850000925362000 turns 44.850000925362004 after sending dataset via remoting server. i create new row in database saving dataset, contains float column (mapped double in dataset). double value saved 44.850000925362 i read row database ( dataadapter.fill ) , same value (checked bitconverter.doubletoint64 ). dataset passes via remoting client , merged usecase dataset on client. still retaining same value. this dataset merged usecase-dataset, row imported different table (because read view, saved table) , value changed before transmitting usecase-dataset (now containing row in other table). on client-side value still same - dataset reaches server, value in question different (although no changes made specific column - still unchanged , original value different). example: save 44

bash - Sourcing .bashrc from .profile not working -

i have many environment variables set 'export' in ~/.bashrc. .profile sources .bashrc with source /home/doriad/.bashrc however, qtcreator doesn't seem know these environment variables. if, instead, put exports directly in .profile, qtcreator has them correctly. suggestions on i'm doing wrong here? thanks providing .profile , .bashrc. cause found in .bashrc : # if not running interactively, don't case $- in *i*) ;; *) return;; esac in non-interactive mode, .bashrc return, skipping export below that.

javascript - Call more than one callback on angular directive $destroy -

let's have directive uses external controller called mycontroller (function() { 'use strict'; angular .module('app') .controller('mycontroller', mycontroller); mycontroller.$inject = ['$rootscope']; function mycontroller($rootscope) { //my app code... var clearroot1 = $rootscope.$on('event1', dosomething); var clearroot2 = $rootscope.$on('event2', dosomethingelse); var clearwatcher = $scope.$watch('model', updatesomething); $scope.$on('$destroy', clearwatcher); $scope.$on('$destroy', clearroot1); $scope.$on('$destroy', clearroot2); } })(); as see i'm creating multiple listeners , have listen $destroy event clear each 1 of listeners. so have 2 questions 1 practical , 1 aesthetical. practical question need call clearwatcher being watcher bound $scope of directive destroyed when directive eleme

user interface - how can I make a desktop gui app that behaves like a window manager for any other apps? -

i want build general purpose application used ide anything. for example, user needs text editor , 2 separate terminals specific work. open app, split main window 3 parts, run favourite text editor in 1 of them , favourite terminals in other two. how can make that? update: something one: https://vimeo.com/6661713 think don't use system-wide, click icon, window opens , done in video. there many ways accomplish want. in comments, said target platform linux. using xembed ( wikipedia link ) lets embed x applications inside application. have never used cannot comment on how easy use or stable solution problem. at level, implement seeking extension window manager. xmonad comes mind extensible window manager: add hook tells xmonad how handle windows. requires knowledge of xmonad , haskell, though.

java - JavaFX After Splash Screen Button onClick error -

Image
i'm making desktop application javafx , made splash screen appears 5 seconds , after 5 seconds shows new stage button, , when click button sends error: exception in thread "javafx application thread" java.lang.illegalargumentexception: argument type mismatch @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ sun.reflect.misc.trampoline.invoke(methodutil.java:71) @ sun.reflect.generatedmethodaccessor1.invoke(unknown source) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:497) @ sun.reflect.misc.methodutil.invoke(methodutil.java:275) @ javafx.fxml.fxmlloader$methodhandler.invoke(fxmlloader.java:1765) @ javafx.fxml.fxmlloader$controllermethodeventhandle

javascript - JS Combine array values into one single value -

i have object a = {key:'animals', options: ['dog','cat','penguin']} how can simplify this: b = ['animals','dogcatpenguin'] like var = { key: 'animals', options: ['dog','cat','penguin'] }; var key, b = []; (key in a) { b.push(array.isarray(a[key]) ? a[key].join('') : a[key]); } console.log(b); or can use object.keys .map var = { key: 'animals', options: ['dog','cat','penguin'] }; var b = object.keys(a).map(function (key) { return array.isarray(a[key]) ? a[key].join('') : a[key]; }); console.log(b);

javascript - Bluebird nested promises with each/spread -

i'm facing issue while using bluebird promises. i'm using coffeescript javascript answers welcome :) here i'm trying : code example promise = require 'bluebird' model = promise.promisifyall(require '[...]') # mongoose model promisified getopts = () -> [...] # whatever promise.each [1..3], (number) -> opts = getopts(number) return model.count(opts).exec (err, count) -> return "the count #{count}" .spread () -> console.log json.stringify arguments result = arguments.join(',') [...] explanations i want run same function 1 , 2 , 3 (sequentially), use bluebird's .each function. in function, need count database. i'm using mongoose bluebird's promisifyall function return promise , make sure .each waits until each query done go next. then, gather result of each query. i'm using bluebird's spread gather return values of .each . however, doesn't contain return value of nested p

Magento 1.9.1 PayPal Express review page is empty -

i using magento version 1.9.1.0 , module firegento_magesetup version 2.2.2. furthermore using custom theme. if customer pay paypal shop redirects him after shipping information step in onepage checkout paypal. after logging in in paypal customer redirect review page of shop. page has not content, customer can not place order. can me please?? if enable errors see there fatal error: call member function setfieldnameprefix() on non-object on paypal/express/review.phtml on line 28 of custom template. quick solution is, delete review.phtml theme file , read base directory may disturb design of order review page. proper solution is, copy review.phtml base , fix design according theme.

Merging git branch A into branch B once again after the first merge has been reverted -

my situation presented below. o---o---o issue-2 / \ o---o---o---o---m---r---o develop \ / o---o---f issue-1 there work on issue-1. after review, merged develop (commit m). unfortunately, discovered there serious errors present. sake of other issues merge commit reverted (commit r). later, other issues (like issue-2) merged develop. code on original branch fixed (commit f). the problem - how merge issue-1 develop now? simple merge keep effect of revert commit r , apply changes not in develop branch (commit f), not of them. there few options: revert revert pros: approach recommended git documentation , , it's easy do cons: uglies history, makes little more difficult people understand how code evolved on time (e.g., git blame show revert of revert instead of individual commits on issue-1 branch) rebase reverted branch , merge pros: git blame , other history digging tools make easier understand c

csv - How can I use powershell to retrieve AD distinguishedName from the employeeID only? -

what i'm trying run script compares employee ids csv file ad, , if they're not in csv in ad should: - disabled - have termination date comment added description - move different ou the script i'm using below disables account , adds comment, error when tries move different ou. error is: move-adobject : cannot find object identity: 'name1test' ... i've tried lot of things adjust script samaccountname or distinguishedname using employeeid, i've had no luck. ideas? import-module activedirectory $targetou = "ou=term,ou=logins,dc=domain,dc=com" $date = get-date -format mm-dd-yyyy $users = import-csv c:\adterm.csv | select-object -expandproperty employeeid $terms = get-aduser -filter * -searchbase "ou=test,ou=logins,dc=domain,dc=com" -properties employeeid | where-object{$_.employeeid -and ($users -notcontains $_.employeeid)} foreach ($term in $terms) { # retrieve user samaccountname. $name = $term.samaccountname # di

java - JPA Criteria Query, how to join entities - Hibernate- -

i have made jpa project (using hibernate). it's bit more complex this, here 2 classes: @entity @table(name= "persons") public class person { @id @column(nullable= false) @generatedvalue(strategy = generationtype.auto) protected integer persid; @column(nullable= false, length = 50) private string firstname; @column(nullable= false, length = 50) private string surname; @column(nullable= true, length = 50) private string emailaddress; @onetomany(orphanremoval = true, cascade = {cascadetype.remove, cascadetype.merge}) private list<phonenumber> phonenumbers; @onetoone(mappedby="person", orphanremoval = true, cascade = {cascadetype.remove, cascadetype.merge}) private account account; //private account account; public person() { // empty } public person(string firstname, string surname, string emailaddress) { this.firstname = firstname; this.surname = surnam

How to get the names of all nodes and attributes of an xml in php? -

i'm using following code xml object of file: $xml = simplexml_load_file($tmp_dir); and after long research found how values of nodes using foreach loop, there way names? need can parse xml magicparse ( http://www.magicparser.com/ ) example input: <?xml version="1.0"?> <root attribute="example_attribute"> <node 1> <nested node> <nested node> </node 1> <node 2> </node 2> </root> desire output: root -@attribute -node 1 -node 1/nested node -node 2 this node , attribute names <?php $xf = file_get_contents($xmlfilename); $xml = simplexml_load_string($xf); displaynode($xml, 0); function displaynode($node, $offset) { if (is_object($node)) { $node = get_object_vars($node); foreach ($node $key => $value) { echo str_repeat(" ", $offset) . "-" . $key . "\n"; displaynode($value, $offset + 1);

Python cannot find file to send as email attachment -

i using python3 , mime.multipart send attachment. able send attachment successfully. today, error saying file not exist, when can see in winscp does. permissions issue? when list contents of directory, file not show up. going on? i wasn't closing stream after writing file. code couldn't find file. when script finished, stream closed force , see file in folder.

Call to a member function query() on string OOP PHP -

i'm new oop php im trying learn doing few basic things, error im getting in title query keeps returning error. <?php //connection starts here class connection{ private $host = 'localhost'; private $username = 'root'; private $password = ''; private $database = 'test'; public $conn; public function __construct(){ return $this->conn = mysqli_connect($this->host, $this->username, $this->password, $this->database) or die("mysql error"); } } //users starts here class users{ public $db; public function __construct($db){ $this->db = $db; } public function getallusernames($db){ $query = "select * users"; //error on line $all_users = $this->db->query("$query"); while ($row = $all_users->fetch_assoc()) { return $row['username']; } } } i have no idea im going wrong can me better under

mysql - How to parse CSV files in PHP -

i want stock fields in mysql coming excel i'm not arrived cut lines excel in php example: 123,15,0,01/01/2000,456462abcd,,, any please ? just use function parsing csv file http://php.net/manual/en/function.fgetcsv.php $row = 1; if (($handle = fopen("test.csv", "r")) !== false) { while (($data = fgetcsv($handle, 1000, ",")) !== false) { $num = count($data); echo "<p> $num fields in line $row: <br /></p>\n"; $row++; ($c=0; $c < $num; $c++) { echo $data[$c] . "<br />\n"; } } fclose($handle); }

Can Tableau connect to arbitrary REST APIs as data sources? -

i use rest api data source tableau. possible in way? api service returns standard json, , think ideal scenario tableau. rather connecting backend database behind api. thanks the web data connector and in beta right now noted inox. see: https://www.tableau.com/web-data-connector "the web data connector allow create connection data accessible on http. can include internal web services, json data, rest apis, , many other sources. not supported in initial launch of tableau 9.0. beta participants able use dedicated product key continue building , testing connectors until web data connector officially launches." also, can use extract api create tableau extracts api: https://www.tableau.com/learn/tutorials/on-demand/extract-api-introduction

How to aggregate data from two different sources in Mule ESB -

i trying aggregate data 2 tables in mule. using scatter-gather flow control achieve this. able see data in debugger not sure how can combine single format payload[0]= [[{"gender":"m","dob":"1974-11-23", "last_name":"harding","first_name":"ezekiel"}], payload[1]= [{"role":"sr. developer"}]] what want create is payload = [[{"gender":"m","dob":"1974-11-23", "last_name":"harding","first_name":"ezekiel", "role":"sr. developer}] if understood correctly, there 1 transformer need. the: <combine-collections-transformer />

c# - Linq aggregate with strings only returns one item instead of two -

although have 2 items in w.refrigeratordetails collection, aggregated string shows data second item, not first. why that? refrigeratordetails = w.refrigeratordetails .select((value, index) => new { value = value, index = index + 1 }) .aggregate(string.empty, (current, item) => "test1" + item.index + ": " + item.value.serialnumber + environment.newline + "test2" + item.index + ": " + item.value.articlenumber + environment.newline + "test3" + item.index + ": " + (item.value.dateofpurchase.hasvalue ? item.value.dateofpurchase.value.toshortdatestring() : "")

ios - Best way to handle a JSON call and use it's information in all views -

i have api serving json information needed put app, , serve texts , news needed views in app. this information , json never big enough need make multiple calls or paginate, information might changed in future since it's app event, , minimum stuff added information like, sponsors logo, , stuff that. i wondering, best way handle this? make api call on appdelegate or something, save local , make 1 api call per day "update" local file? also, technically speaking, how handle information views? keep reading local file everytime view loaded? implement singleton class holds data inside proper data structure(s). need download json in root view controller , display activity indicator user. in every view controller can access singleton class object asking data relative controller.

java - string builder and string output -

although have converted output string , output on console "solution@3343c8b3". thanks. public class solution { public string converttotitle(int n) { if (n < 1) throw new illegalargumentexception("input wrong number"); stringbuilder sb = new stringbuilder(); while (n > 0) { n--; char ch = (char) (n % 26 + 'a'); n = n / 26; sb.append(ch); } sb.reverse(); return sb.tostring(); } } the test class: public class test { public static void main(string[] args) { int f = 2; solution f1 = new solution(); f1.converttotitle(f); system.out.println(f1); } } you should print value returned method : converttotitle : string title = f1.converttotitle(f); system.out.println(title); also, this might not concern @ time , system.out.println(f1); printing string provided default implement

ios - Extending Array to append SKTextures -

this question has answer here: is possible make array extension in swift restricted 1 class? 4 answers being new swift decided @ extending array (or more [sktexture] arrays of sktexture) function add specified number of frames application bundle. // frames fuzzyrabbit_0001@2x.png fuzzyrabbit_0002@2x.png fuzzyrabbit_0003@2x.png fuzzyrabbit_0004@2x.png // call var rabbittextures = [sktexture]() self.rabbittextures.texturefromframes("fuzzyrabbit", count: 4) my first attempt listed below, getting error cannot invoke 'append' argument list of type '(sktexture!)' looking @ function fuzzypush because trying append sktexture rather generic t . is possible, or limited fact don't want function generic rather specific arrays of sktexture . extension array { // sktexture mutating func texturefromframes(imagename: string, count

How does Groovy select method when a user-defined method conflicts with a GDK method -

i wrote following java classes: package com.example; class myset extends java.util.abstractset { @override public java.util.iterator iterator() { return null; } @override public int size() { return 0; } } interface toset { myset toset(); } public class mylist extends java.util.abstractlist implements toset { @override public object get(int index) { return null; } @override public int size() { return 0; } public myset toset() { return new myset(); } } and test in groovy: package com.example class mytest { @org.junit.test public void test() { myset set = new mylist().toset(); println(set.class); println(new mylist().toset().class); def set2 = new mylist().toset(); println(set2.class); } } the test run results in: class com.example.myset class java.util.hashset class java.util.hashset my guess in latter 2 cases expression toset() invokes gdk's toset method instead of mylist#tose

ajax - Architecture of API Key Implementation -

i might me wrong, new api key fundamentals. please correct me if wrong. i have javascript front-end, , backend application in php (can technology). want expose api backend application ajax. third party developer use api application without worrying actual implementation on backend. i expose api key developer, whatever request makes application, uses api key , can keep record of api key accessing application. as ajax call server, has api key stored in js file i'll give. the question is: if use seek js file has, 1 api key designed other application. how should implement in secured manner. can help.? plain javascript not possible hide end-user since end-user 1 executing code. you can use obfuscated javascript again there possibility of reverse-engineering.

python - ImportError when using rpy2 with numpy.testing -

i've run rather strange error when doing unit testing numpy.testing module. i'm running ipython notebook in vm. in code, have 1 test compare output in r. requires me load rpy2 modules so: import rpy2.robjects robjects rpy2.robjects.packages import importr fastclime = importr('fastclime') grdevices = importr('grdevices') however when run ! py.test , following error: ==================================== errors ==================================== _____________________ error collecting test_fastclime_r.py _____________________ test_fastclime_r.py:6: in <module> import rpy2.robjects robjects ../../anaconda/lib/python2.7/site-packages/rpy2/robjects/__init__.py:15: in <module> import rpy2.rinterface rinterface ../../anaconda/lib/python2.7/site-packages/rpy2/rinterface/__init__.py:101: in <module> rpy2.rinterface._rinterface import * e importerror: /home/bitnami/anaconda/bin/../lib/libreadline.so.6: undefined symbol: pc =====

c++ - How to call function inside injected dll -

i'm trying keyboard messages process using injected dll,but don't know have call function in own program. here injected dll functions : //this dll main function bool apientry dllmain(handle hmodule,dword ul_reason_for_call,lpvoid lpreserved) { /* open file */ file *file; fopen_s(&file, "d:\\dll\\temp.txt", "a+"); switch (ul_reason_for_call) { case dll_process_attach: hinst = (hinstance)hmodule; // should function calling here???? installhook(); break; case dll_process_detach: fprintf(file, "dll detach function called.\n"); break; case dll_thread_attach: fprintf(file, "dll thread attach function called.\n"); break; case dll_thread_detach: fprintf(file, "dll thread detach function called.\n"); break; } hinst = (hinstance)hm

php - Why the logic for array conversion and HTML parsing is not working in following scenario? -

i've associative array titled $allfeeds (after executing print_r($allfeeds); ) follows : note : actual associative array $allfeeds large. understanding purpose i've put 1 element large array. array ( [0] => array ( [feed_image] => array ( [0] => <a href="http://52.1.47.143/photo/928/2_onclick_ok/userid_244/" class=" js_photo_item_928 photo_holder_image" rel="928" ><img src="http://52.1.47.143/file/pic/photo/2015/04/9bd387c6442135834298d6a17b3f9555_240.jpg" alt="" width="180" height="160" class="photo_holder" /></a><br /> [1] => <a href="http://52.1.47.143/photo/927/8/userid_244/" class=" js_photo_item_928 photo_holder_image" rel="927"><img src="http://52.1.47.143/file/pic/photo/2015/04/6eb60ee0e258223ef72a9a632d0ce429_240.png" alt="&qu

javascript - Showing Popover in a Table element using Codeigniter -

can explain how use popover on table element using codeigniter? <td> <span id="popover" data-toggle="popover" data-content="<?php echo $userdata[$i]->name; ?>"></span><?php echo custom_echo($userdata[$i]->name,15); ?></td> and javascript code is <script> $(document).ready(function() { $("#popover").popover({ html: true, animation: false, placement: "bottom" }); }); </script> what not working? using code, have guessed how output html like: <table> <tr> <td><span id="popover" data-toggle="popover" data-content="user name in popover">user name in span</span></td> </tr> </table> i have added script in onload event: $("#popover").popover({ html: true, animation: false, placement: "bo

Send message to specific number whatsapp android? -

how can send message specific number in whatsapp. i searched , found code uri uri = uri.parse("smsto:" + number); intent = new intent(intent.action_sendto, uri); i.putextra("sms_body", "as sdj ajs"); i.setpackage("com.whatsapp"); startactivity(i); it opens number's chat window no message displayed in edit text. also tried cursor c = getcontentresolver().query(contactscontract.data.content_uri, new string[] { contactscontract.contacts.data._id }, contactscontract.data.data1 + "=?", new string[] { "number@s.whatsapp.net" }, null); c.movetofirst(); intent = new intent(intent.action_view, uri.parse("content://com.android.contacts/data/" + c.getstring(0))); startactivity(i); c.close(); but force closes app android.database.cursorindexoutofboundsexception: index 0 requested, size of 0 @ android.database.abstractcursor.checkposition(abs