Posts

Showing posts from September, 2011

I want to show data from mysql database on browser using dart -

i'm working on school project, requires show simple data mysql database in browser. i've read, sqljocky doesn't work in browser decided make server-client app , run db on server side (got inspiration here: https://dart-lang.github.io/server/codelab/ ). didn't work, failed in creating client api message: *in shutdownisolate: unhandled exception: isolatespawnexception: unable spawn isolate: unhandled exception: load error "package:sqljocky/sqljocky.dart": no mapping 'sqljocky' package when resolving 'package:sqljocky/sqljocky.dart'. #0 _asyncloaderrorcallback (dart:_builtin:155) #1 _asyncloaderror (dart:_builtin:566) #2 _loadpackage (dart:_builtin:605) #3 _loaddata (dart:_builtin:637) #4 _loaddataasync (dart:_builtin:657) #5 _loadscriptcallback (dart:_builtin:153) #6 _handleloaderreply (dart:_builtin:370) #7 _rawreceiveportimpl._handlemessage (dart:isolate-patch/isolate_patch.dart:148) 'file:///ho...

Spring JMS with Spring boot , Conflicting beans -

i creating spring jms listener spring boot, keep getting error:- org.springframework.beans.factory.nouniquebeandefinitionexception: no qualifying bean of type [javax.jms.connectionfactory] defined: expected single matching bean found 3: queueconnectionfactory,queueconnectionfactoryextra,targetconnectionfactory @ org.springframework.beans.factory.support.defaultlistablebeanfactory.doresolvedependency(defaultlistablebeanfactory.java:1126) @ org.springframework.beans.factory.support.defaultlistablebeanfactory.resolvedependency(defaultlistablebeanfactory.java:1014) @ org.springframework.beans.factory.annotation.autowiredannotationbeanpostprocessor$autowiredfieldelement.inject(autowiredannotationbeanpostprocessor.java:545) whereever read resolved using @qualifier annotation doesn't seem work me, please help. below class:- @configuration public class listenercontainer{ @suppresswarnings("rawtypes") @qualifier("queueconnectionfactory") @bean(n...

c# - Pattern matching in byte arrays -

let's have 2 byte array each contain series of values like: byte[] b = {50,60,70,80,90,10,20,1,2,3,4,5,50,2,3,1,2,3,4,5}; byte[] b2 = {1,2,3,4,5} i can compare these 2 arrays , equal values using linq methods. in way, if make comparison between these 2 arrays, result index of b array value in index of b2 array match. i've been trying find range b2 array recurring in b array. mean if (thelenghtofsearch==5) {now indexes of 2 regions must return } result ->(7, 11), (15, 19) if (thelenghtofsearch==2) {now indexes of around 9 regions 2 consecutive values in b2 recurred in b must returned} result ->(7, 8), (15, 16), (8, 9), (13, 14), (16, 17), (9, 10), (17, 18), (10, 11), (18, 19) i guess solution more mathematical. i decided use list, not array, because have more helpers kind of operations. understand depth = amount of items have equals in each array. 1 works, check out: class program { static void main(string[] args) { list<byte...

Screen Resolution in Adobe AIR -

how automatically set screen resolution phone in adobe air. , codes stands for? public static function screenresolutionx():number public static function screenresolutiony():number you cannot set screen resolution device -- it's read-only ( capabilities.screendpi ) capabilities.screenresolutionx , capabilities.screenresolutiony width , height, in pixels, of device, when air first runs.

ios - managed object value is randomly null (Sample project included) -

after saving data (10 records) entity, processing fetch request data again: //saving data - (void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname{ //save coredata song = [nsentitydescription insertnewobjectforentityforname:@"song" inmanagedobjectcontext:context]; [song setvalue:title forkey:@"title"]; [song setvalue:songlink forkey:@"songweblink"]; nslog(@"song link : %@",songlink);//never null [song setvalue:albumlink forkey:@"albumimagelink"]; nserror *error = nil; if (![context save:&error]) { nslog(@"whoops, couldn't save: %@", [error localizeddescription]); }else{ nslog(@"record saved correctly"); } } saving above working fine , debugged data before being sav...

c++ - add #define when a specific flag is used -

i want add #define foo code in header file autotools when used specific flag. the project have creates static library using header use inline functions example. if use -d option, used @ creation time i'll have add @ each compilation using library want avoid. how can perform this? i think best bet generate required header file pre-existing file. following shell command trick: (echo "#define foo" ; cat myheader_pregen.hpp) > myheader.hpp you can incorporate above script autotools this

What is the typescript syntax for combining ES6 generators with fat arrow syntax? -

i trying use es6 generators in combination fat arrow syntax. unable find example. class pingpong{ ping= *(val)=>{ yield "hello"+val; } } var a=new pingpong(); a.ping(0); i know need use '*' tsc not seem accept it.

html - Custom jquery combination with foundation -

i new foundation zurb 6. have written jquery own show , hide text. when add jquery html file won't work anymore (without foundation worked), created other file named custom.js code created in file: $(document).ready(function(){ $(".afspraak-rij").hide(); $(".offerte-rij").hide(); $(".afspraak").click(function(){ $(".afspraak-rij").show(); $(".offerte-rij").hide(); )}; $(".offerte").click(function(){ $(".afspraak-rij").hide(); $(".offerte-rij").show(); )}; )}; in html file have @ bottom: <script src="js/vendor/custom.js"></script> how can let litle code work? this part of code looks now: <!doctype html> <html class="no-js" lang="en" dir="ltr"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"...

Filling an array by 1~100 without loop in javascript -

i investigating question raised in interview. interviewer ask piece of code fill array 1~100 without traditional loop. of course, couldn't tell him need type 1~100 in code "[1,2,3,4...100]". i have thought several solutions, 1 of them successes. using mozilla firefox 46.0.1 & firebug. solution 1(failed) var filled = new array(100); filled.map(function(val, index){ return index+1; }); // array size 100 , filled undefined not int console.info(filled); solution 2(failed) var filled = new array(100); // seems can't go callback function filled.foreach(function(val, index){ val = index+1; }); // it's same solution 1 console.info(filled); solution 3(failed) var filled = []; // guess root cause array doesn't initialized. // if insert value index 99, previous 99 values automatically filled undefined. filled[99] = 100; filled.map(function(val, index){ // 100:99 can printed console.info(val + ...

c# - Pass a CSV as entry parameter in a REST API -

i have develop method in rest api called every hour. have methods internal objects , have not problem. new method entry parameter csv file. type have declare parameter? have tried types can't find type.. for example, have method this: [actionname("retrievebookinglist")] [httppost] public listrs retrievebookinglist(listrq rq) { return messageretrievebookinglist.execute(rq); } and can me how can send (header, raw data (file attached?)) via postman or via soap ui in rest project debug? many thanks.

c - How to check for a <CRLF> for my FTP server -

i have created little ftp server , have few commands available. here's how check input user see if matches 1 of commands in linked list: int check_cmd(char *buff, char *cmd) { int end; if (strstr(buff, cmd) != buff) return (-1); end = strlen(cmd); if (buff[end] != '\0' && buff[end] != ' ' && buff[end] != '\n') return (-1); return (0); } void read_command(t_client *client, t_cmd *lexer) { t_cmd *current; bzero(client->buff, max_read + 1); server_read(client); current = lexer; while (current != null) // go through linked list, checking if matches { if (check_cmd(client->buff, current->cmd) == 0) // matches command ! { current->ptr(client); // calls appropriate function return ; } current = current->next; } server_write(client, "invalid command.\n"); } but using -c option netcat send \r\n default @ every command, , yet, ...

Android, Super not called exception error -

i have 2 fragments, myfirst fragment , mysecond fragment. mysecond fragment extends myfirst fragment. classed this: public class myfirstfragment extends fragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { ... } @override public void onactivitycreated(bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); ... // check view , map, request recreate if each of them null if(myfirstfragment.this.getview() == null || googlemap == null) { toast.maketext(getactivity().getapplicationcontext(), r.string.my_message, toast.length_long).show(); return; } } } public class mysecondfragment extends myfirstfragment { @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { ...

java - How to draw asterisks (*) line on the screen? -

how can draw horizontal line using around 50 asterisks * , using loop? when tried this, result 50 asterisk listed vertically (instead of horizontally). public void drawastline() { (int = 0; < 3; i++) system.out.println("*"); } any suggestions? you need use system.out.print('*') instead of system.out.println('*') . system.out.println('*'); => system.out.print('*'); system.out.print('\n'); for case, output looks *\n*\n*\n*\n*\n , \n escape sequence inserts newline in text @ point. print('*') allows avoiding , output ***** .

php - How to get DATABASE_CONFIG value inside a plugin in cakephp? -

i want access database_config class values located @ app/config/database.php inside plugin app/plugin/myplugin/bootstrap.php class database_config { public $redis = array( 'datasource' => 'redis.redissource', 'host' => '127.0.0.1', 'port' => '6379', 'db' => '2' ); } i want access $redis host , port inside myplugin edit: cakephp version 2.1.2 get database details :- app::uses('connectionmanager', 'model'); $datasource = connectionmanager::getdatasource('redis'); $host = $datasource->config['host']; $port = $datasource->config['port'];

javascript - Angular JS - Show 1 div and hide all others -

i have requirement of toggling between div show/hide. achieve through following code <div class="fav-player" ng-repeat = "selectedplayer in selectedplayers"> <div class="player-head"> <div class="player-name" ng-click="showdetails = ! showdetails" id="name-{{selectedplayer.id}}">{{selectedplayer.firstname}})</div> </div> <div class="fav-player-score-detail" id="fav-{{selectedplayer.id}}" ng-show="showdetails"> hi, {{selectedplayer.firstname}} - shown </div> </div> clicking div: player-head shows fav-player-score-detail but, challenge hide other divs except 1 shown. should not see divs expanded @ once. 1 should expanded. pls help! demo here thanks in advance! save selected div on ng-click , update ng-show display if div selected one. upd: ...

ios - Skobbler background mode without SKTNavigationManager -

i'm developing ios app in swift language skobbler navigation sdk. try allow user use navigation while in background mode (iphone locked). i have question stated below : 1) possible without using sdktools , sktnavigationmanager ? use skmaps.frameworks functions. with configuration, can't use allowbackgroundnavigation property of sktnavigationconfiguration in demo. i set skpositionerservice.sharedinstance().worksinbackground = true and allowed "location update in backgroundmode" info.plist. unfortunately updatecurrentlocation doesn't triggered in background , navigation doesn't works neither. thank in advance :-) !! p.s. : succeeded run short code in background official library cclocationmanager. app seems correctly configured... the hotfix issue can downloaded here: objc: https://www.dropbox.com/s/ruk6at2fju0rdd7/skmaps_2_5_1.zip?dl=0 swift: https://www.dropbox.com/s/lgbdherhqzudy2a/skmapsswift_2_5_1.zip?dl=0

how to use a numeric variable as character in plot_ly r graphs -

i quite new plotly basic question, have simple data frame : id = c("01","02","03","04","05") value = c(1:5) data=data.frame(id,value) when plot using plot_ly : require(plotly) plot_ly(data,x=id,y=value) plot_ly think id variable numeric variable, on x axis, graduation 1, 1.5, 2, 2.5 ... makes no sense. if want plot_ly understand variable character, have add non-numeric character : data$id = paste0("n",id) plot_ly(data,x=id,y=value) this code gives me want, whith disgracious "n" before id. any ideas ? useless have no problem using ggplot. based on github issue 1 needs explicitly specify axis type. hope helps. disregard misinformed comment earlier. library(plotly) df <- data.frame(x = c("a", "b", "c"), y = 1:3) # works fine plot_ly(df, x = x, y = y, mode = "markers") # treated numeric df <- data.frame(x = c("1...

javascript - How do I conditionally format Google visualization table cells using chart wrapper function? -

i new world of google visualization api , hoping can me conditionally format color of cells in google visualization table. have been able change number format different columns display, not having such luck color formatting. using arraytodatatable , chartwrapper functions display data have queried spreadsheet. is need change colorformat variable or chartwrapper function in not accepting formatting? thank in advance! function drawdashboard(response) { $('#main-heading').addclass("hidden"); if (response == null) { alert('error: invalid source data.') return; } else { // transmogrify spreadsheet contents (array) datatable object var responseobjects = json.parse(response); console.log(responseobjects); var testdata = []; (var = 1; < responseobjects.length; i++) { responseobjects[i][0] = new date(responseobjects[i][0]); } var data = google.visualization.arraytodatatable(responseobjects, f...

android - Smooch crashes when I press the button -

this error get: 05-09 11:55:10.559: e/androidruntime(15809): java.lang.nosuchfielderror: no static field smooch_inputtext of type in class lio/smooch/ui/r$id; or superclasses (declaration of 'io.smooch.ui.r$id' appears in /data/app/nl.hgrams.passenger-1/base.apk) 05-09 11:55:10.559: e/androidruntime(15809): @ io.smooch.ui.fragment.conversationfragment.oncreateview(unknown source) 05-09 11:55:10.559: e/androidruntime(15809): @ android.support.v4.app.fragment.performcreateview(fragment.java:1974) 05-09 11:55:10.559: e/androidruntime(15809): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1067) 05-09 11:55:10.559: e/androidruntime(15809): @ android.support.v4.app.fragmentmanagerimpl.movetostate(fragmentmanager.java:1252) 05-09 11:55:10.559: e/androidruntime(15809): @ android.support.v4.app.backstackrecord.run(backstackrecord.java:742) 05-09 11:55:10.559: e/androidruntime(15809): @ android.support.v4.app.fragmentmanagerimpl.exec...

javascript - Custom video-js width and height on Dynamically Loaded Content -

i'm dynamically loading video-js inside foundation reveal , , have trigger width , height each time loads. odd thing is, once i've loaded 1 video on page, won't change again no matter what, sticks 1 size. this code $(document).on('opened.fndtn', '[data-reveal]', function () { if($('.sd-video').length) { console.log('sd detected'); videojs($('.sd-video')[0], {"width": 640,"height": 480}, function() {}); } if($('.hd-video').length) { console.log('hd detected'); videojs($('.hd-video')[0], {"width": 1287,"height": 720}, function() {}); } }); $(document).on('closed.fndtn', '[data-reveal]', function () { $('#'+$(this).attr('id')).html(''); }); and no matter try, once it's loaded hd, sd not resize, , vice-versa. ideas? ...

How to change the color of XML elements in Visual Studio -

Image
i have imported theme, , have noticed color of value key in app.config has not been changed: is there way of editing this? you should change xmlattributevalue setting. tools->options->environment->fonts , colors -> (text editor set) xmlattributevalue

javascript - Laravel 5.2 ajax upload progress bar and TokenMismatchException in VerifyCsrfToken.php line 67 -

i'm trying integrate progress bar on image upload. code works fine when submit form php, when include javascript progress bar error "tokenmismatchexception in verifycsrftoken.php line 67". form: {!! form::open(array('files' => true, 'class' => 'form', 'route' => ['backend.posts.uploadimage', $post->id])) !!} <div class="form-group"> {!! form::file('image', ['id' => 'image']) !!} </div> <hr> <input type="button" value="upload image" class="btn btn-info btn-sm" onclick="uploadimage()"> {!! form::close() !!} this form generate hidden input field token: <input name="_token" type="hidden" value="jgqwc2gljisezrl8wvfmah490xhoh727345u6hzk"> my javascript code this: function uploadimage() { var file = document.getelementbyid("image").fi...

java - @RestController does not work, it still return me a jsp page -

Image
controller: @restcontroller public class commoditycontroller { @requestmapping("test.htm") public string test() { return "test"; } } spring version: <org.springframework.version>4.2.0.release</org.springframework.version> still not working: can use @restcontroller this?

I wanna get all multiple files in listview in c# like "ppt,docx,and txxt but i get only one at a time" -

it work not complete need. private void button2_click(object sender, eventargs e) { listview1.items.clear(); if (textbox1.text != "") { list<string> files = new list<string>(); files = directory.getfiles(textbox1.text, "*.txt,*.ppt").tolist(); progressbar1.maximum = files.count; progressbar1.value = 0; listviewitem it; foreach (var file in files) { = new listviewitem(file.tostring()); it.subitems.add(system.io.path.getfilename(file.tostring())); it.subitems.add(system.io.path.getextension(file.tostring())); listview1.items.add(it); progressbar1.increment(1); } } else messagebox.show("select directory first"); } getfiles doesnt take multiple extensions your : files = directory.getfiles(textbox1.text, "*.txt,*.ppt").tolist(); would come string[] extensions= new stri...

python - How to make a shape change color when I click on it in a Connect Four board? -

i'm writing connect 4 game in python using tkinter. i'm making board. want circles change color when click them. only last column of last row changed wherever click on board. how can make whenever click specific circle, circle changes color? from tkinter import * import random def conx_create_window(): mw = tk() mw.title("connect 4 game") mw.geometry("650x600") mw.configure(bg="#3c3c3c", padx=50, pady=50) return mw def main(): m_window = conx_create_window() return m_window m_window = main() mframe = frame(m_window, bg="#3c3c3c", padx=50, pady=150) mframe.pack() newframe = frame(m_window, bg="#3c3c3c", padx=50, pady=50) board = {} buttons = {} frames = {} gameboard = frame(m_window) #---------------------------------- def newgame_click(): print("new game") mframe.pack_forget() boardoption() def boardoption(): newframe.pack() def board7x6(): gameboard.pack()...

php - connecting to db2 through pdo_ibm module manually configured error SQL10007N -5005 -

i having difficulties connect remote db2 database using pdo_ibm, followed instructions on ibm configure pdo_ibm library , linux client since php not configured manually installed through apt-get not sure if current error might due missconfiguration or else. my stage is: linux debian wheezy ibm db2 client 10.5 php 5.4.45 pdo_ibm 1.4 when try connect db2 following code: <?php $usernamemaximo = '@user'; $passwordmaximo = '@password'; $connectionstringmaximo = 'ibm:driver={ibm db2 odbc driver};database=@databasename;hostname=@xx.xxx.xxx.xx;port=50002;protocol=tcpip;'; try { $connection = new pdo($connectionstringmaximo, $usernamemaximo, $passwordmaximo, array( pdo::attr_errmode => pdo::errmode_exception) ); echo "success"; } catch (exception $e) { var_dump($e); } i following error object(pdoexception)[2] protected 'message' => string 'sqlstate= , sqldriverconnect: -5005 [ibm][cli driv...

android - RecyclerView LinearLayout manager always returns -1 in landscape mode - findLastCompletelyVisibleItemPosition() -

i'm using findlastcompletelyvisibleitemposition() determine last visible item in recyclerview. here code snippet of how i'm setting layout: mrecyclerview.sethasfixedsize(true); linearlayoutmanager mlayoutmanager = new linearlayoutmanager(getcontext()); mrecyclerview.setlayoutmanager(mlayoutmanager); layout xml: <android.support.v4.widget.swiperefreshlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/swipe_container" android:layout_width="match_parent" android:layout_height="match_parent"> <framelayout android:layout_width="match_parent" android:layout_height="match_parent"> <android.support.v7.widget.recyclerview android:id="@+id/message_list" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/white...

scala - How can I use and return Source queue to caller without materializing it? -

i'm trying use new akka streams , wonder how can use , return source queue caller without materializing in code ? imagine have library makes number of async calls , returns results via source . function looks this def findarticlesbytitle(text: string): source[string, sourcequeue[string]] = { val source = source.queue[string](100, backpressure) source.mapmaterializedvalue { case queue => val url = s"http://.....&term=$text" httpclient.get(url).map(httpresponsetosprayjson[searchresponse]).map { v => v.idlist.foreach { id => queue.offer(id) } queue.complete() } } source } and caller might use this // there implicit actormaterializer somewhere val stream = plugin.findarticlesbytitle(title) val results = stream.runfold(list[string]())((result, article) => article :: result) when run code within mapmaterializedvalue never executed. i can't understand why don't have access instance of sou...

How to create MySQL function to create a new column of quarter by processing existing column of date? -

i have column date shown below: +-----------+ | date | +-----------+ | 20140611 | | 20150119 | | 20150922 | | 20160310 | +-----------+ it's string in yyyymmdd format. i want create new column named quarter shown below: +-----------+-------------+ | date | quarter | +-----------+-------------+ | 20140611 | q2-2014 | | 20150119 | q1-2015 | | 20150922 | q3-2015 | | 20160310 | q3-2016 | +-----------+-------------+ where quarter indicates quarter in corresponding date falls. this example purpose, want know how can write function can applied on single column of table create new column after pre-defined processing. use quarter function select `date`, quarter(`date`) quarter my_table ; otherwise if looking user defined function can use create function hello_world(my_text text) returns text language sql -- element optional , omitted begin return concat('hello ', my_text); end; $$ ...

Getting several lines from a table in SQL Server and list them -

Image
i have list vehicles likes this: let's display cars ecus tms1 , c200. how do that? i have inserted function: set ansi_nulls on go set quoted_identifier on go create function [dbo].[splitstring] (@pstring nvarchar(4000), @pdelimiter nchar(1)) returns table schemabinding return e1(n) ( select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 union select 1 ), --10e+1 or 10 rows e2(n) (select 1 e1 a, e1 b), --10e+2 or 100 rows e4(n) (select 1 e2 a, e2 b), --10e+4 or 10,000 rows max ctetally(n) (--==== provides "base" cte , limits number of rows right front -- both performance gain , prevention of accidental "overruns" select top (isnull(datalength(@pstring),0)) row_number() on (order (select null)) e4 ), ctestar...

Spark job on Mesos not working when submitting job via mesos dispatcher -

i have had spark running on standalone cluster manager, , decided try out mesos. when using client mode, works working perfectly. if want run in cluster mode, realized had start "mesos cluster dispatcher". tried starting regular script: ./start-mesos-dispatcher mesos://ip:5050 as using directions following link http://www.simosh.com/article/dbcjefbf-start-spark-via-mesos.html but cluster mode did not work in both cases. in both of them, saw in mesos ui driver submitted, after several seconds gets killed. after tried submit job mesos in client mode, using dispatcher again, , saw submitting process stucks in following step: i0509 11:09:44.550375 3339 sched.cpp:326] new master detected @ master@127.0.1.1:7078 i0509 11:09:44.555305 3339 sched.cpp:336] no credentials provided. attempting register without authentication in spark logs, saw dispatcher correctly started, , see framework registered in mesos ui. are there settings missing?

PHP Set image source for image tag -

i'm trying use php list of images in folder , display it. here current code: $images = glob($volumepath."*"); foreach($images $image) { $path = str_replace('c:\xampp\htdocs\\', '..', $image]); $path2 = str_replace(' ', '%20', $path); $file = "<img src=".$path2."/>"; echo $file; } right now, can retrieve array of images when try display it, shows generic placeholder image. how show image? tested giving file path , shows doesn't work php. try complete code: $images = glob($volumepath."*"); foreach($images $key => $image) { $path = str_replace('c:\xampp\htdocs\\', '../', $image); $path2 = str_replace(' ', '%20', $path); $file = "<img src='".$path2."'/>"; echo $file; } note single quotes in $file variable, modified foreach statement , single $image variable in $path

ios - Use NS[UI]ScrollView to manipulate projection -

i have simple metal setup draw image in middle of mtkview . wish add pinch zoom , other functionality have in scroll views, can zoom image , move around thresholds. i don't want implement myself since app live in both mac os , ios , twice more code support , write. is there way use default scroll view controlls manipulate projection? mean set scroll view somehow on top of view , data in delegate manner or whatever. any appreciated! you may want try metal2dscrollable sample code. idea that: place mtkview behind (not subview) uiscrollview, place dummy content view subview of uiscrollview make dummy content view target of zooming set uiscrollview such contentsize, contentinset etc. make both uiscrollview , dummy content view transparent calculate transform dummy content view's bounds -> mtkview's coordinate -> device coordinate apply transform when rendering metal so, mtkview not in uiscrollview, tricks fools user's eyes. https://g...

python - Pandas replace months names within dataframe values -

i have dataset months 'january', 'february' etc. example '23:12 25 april 2016' the goal transform '23:12 25 4 2016' using .replace() whole dataframe. any ideas? thanks. udp. forgot main problem: example has months in english, have them in other language need unicode replacement first to_datetime iiuc can use to_datetime reformating dates in column date : print df date 0 23:12 25 april 2016 df['date'] = pd.to_datetime(df['date']) print df date 0 2016-04-25 23:12:00 another solution add parameter format : df['date'] = pd.to_datetime(df['date'], format="%h:%m %d %b %y") print df date 0 2016-04-25 23:12:00 if names of months russian use replace : import pandas pd df = pd.dataframe({'date': [u'23:12 25 январь 2016']}) d = {u'январь':'january', u'февраль':'february', u'март':...

txt (from searchTwitter REST API) into JSON with R -

i've been using searchtwitter function twitter rest api retrieve amount of tweets , i've dumped txt file. structure of txt file is: "text" "favorited" "favoritecount" "replytosn" "created" "truncated" "replytosid" "id" "replytouid" "statussource" "screenname" "retweetcount" "isretweet" "retweeted" "longitude" "latitude" "1" "rt @kobebryant: last night final chapter incredible story. walk away @ peace knowing love game &amp; city will…" false 0 na 2016-04-14 23:59:59 false na "720763566027096066" na "<a href=\"http://twitter.com/download/iphone\" rel=\"nofollow\">twitter iphone</a>" "jtlongway" 204125 true false na na "2" "rt @kobebryant: last night final chapter incredible story. walk away @ peace knowing love game ...

java - Starting with Phantomjs driver -

can suggest me documentations or steps start or configure phantomjs driver in java can run test cases in remote server. i run selenium server in grid mode connect phantomjs after doesn't try reconnect if disconnects or isn't up ./phantomjs --webdriver=5558 --webdriver-selenium-grid-hub=http://localhost:4444 which have listen on port 5558 (for example) connect through selenium appears browser phantomjs on platform steps java -jar selenium-server-standalone-2.14.0.jar -role hub ./phantomjs --webdriver=5558 --webdriver-selenium-grid-hub=http://localhost:4444 you can run tests per selenium web site https://code.google.com/p/selenium/wiki/grid2 i use perl run tests http://metacpan.org/pod/selenium::remote::driver there many choices

php - Laravel 5: Passing additional parameters to Controller -

i using laravel 5 build website , have few pages, content written in blade (e.g. about, terms , conditions etc.) , others pulled database (general blog posts). i'd write single controller , run switch case show specific view. e.g. pagescontroller@showpage : public function showpage($page){ switch ($page) { case 'about': $view = 'frontend.about'; break; case 'terms': $view = 'frontend.terms'; break; ... default: $view = 'frontend.home' break; } return view($view); } but how can pass additional parameter in routes.php ? //route page route::get('/about',['as'=>'about','uses'=>'pagescontroller@showpage']); //route terms route::get('/terms',['as'=>'terms','uses'=>'pagescontroller@showpage']); something like: //route terms route::get('/terms',['as'=>...

javascript - Can I set a value to the golbal variable in $(document).ready(function(){}); and use the same variable outside? -

suppose, have 1 global variable 'x' , want set value '2' i.e. x=2 inside $(document).ready(function(){}) function. now want use variable 'x' having value '2' outside $(document).ready(function(){}) function. note usage of variable 'x' after $(document).ready(function(){}) should independent i.e. should not used inside function or callback function. is possible so? if yes how? if no why? please provide me detailed solution proper reasons this. thanks. note usage of variable 'x' after $(document).ready(function(){}) should independent i.e. should not used inside function or callback function. if isn't inside function, trying use immediately … before ready event fires … before value has been assigned variable. in short: no.

ios - Include CocoasMQTT library in swift framework project -

i pretty new swift , ios development. trying write framework using swift 2.0. need import cocoasmqtt library in framework. using cocoa pods approach , added use_frameworks! pod 'cocoamqtt' in pod file. after pod install. in pods directory can see debug.xconfig , release.xconfig files(in xcode directory view). think should have worked unable import library in swift classes says "no such module 'cocoamqtt'" when try import cocoamqtt in code. can explain if doing wrong. p.s., have included use_frameworks! , using ios version 9 development think don't have write objective c bridge header. i had same problem to. problem cause using cocoapods. think open .xcodeproj file xcode if install pods must open .xcworkspacefile. should raywenderlich's forum using cocoapods. https://www.raywenderlich.com/97014/use-cocoapods-with-swift

jquery - How to align an iframe horizontally (in the centre of the screen) with CSS? -

i'm embedding youtube video inside iframe , put inside div. problem i'm dealing right can horizontally align (in centre) text not iframe . this code used make this: html <div id="box-logo"> <img src="content/media/red_package.png" /> <span>quem somos?</span> <iframe src="https://www.youtube.com/embed/uz0d_oerfau?autoplay=1" frameborder="0" allowfullscreen></iframe> </div> css #box-logo { margin-top: 40px; text-align: center; } #box-logo img { background-color: red; border: 5px solid red; border-radius: 50%; width: 40px; height: 40px; } #box-logo span { color: red; font-family: calibri; font-size: 24px; } #box-logo iframe { display: block; width: 895px; height: 435px; } i've been searching multiple tips , could't find 1 solve problem. i'd gladly hear suggestions in order try th...

wpf - DevExpress and SimpleMvvmToolkit - Serialization error -

i have devexpress dxgrid bound observablecollection of viewmodels (based on simplemvvmtoolkit). viewmodel has 2 properties exposed (a string , boolean) , few other properties exposed base class (viewmodeldetailbase), 1 of them model behind viewmodel. everytime use grid modify contents of 1 of properties (e.g. boolean value), error saying "the type xxx cannot serialized.." (xxx type of model) followed suggestion use datacontractattribute circomvent issue. not sure how , solution. maybe should read on it, why serialization needed here?? anyway, hope can shed light on this. i'd appreciate pointers me looking in right direction. edit: since situation intricate post relevant code here, made sandbox project reproduces error. can find via this wetransfer link . best regards, ~rob thanks great of simple mvvm toolkit community found out solution simple. in simple mvvm toolkit, viewmodel needs serializable because gets cloned. roll-back data when action canc...

How to get an OffSet from a ByteBufferMessageSet returned by Simple Consumer of Kafka in Java? -

consider following code: public static long offset = 0l; fetchrequest req = new fetchrequest(kafkaproperties.topic, 0, offset,10485760); bytebuffermessageset messageset = simpleconsumer.fetch(req); the question how last offset , set variable offset read next batch of data kafka? update: when print data i.e.: for (messageandoffset messageandoffset : messageset) { system.out.println(messageandoffset); } the output follows: messageandoffset(message(magic = 1, attributes = 0, crc = 2000130375, payload = java.nio.heapbytebuffer[pos=0 lim=176 cap=176]),296215) messageandoffset(message(magic = 1, attributes = 0, crc = 956398356, payload = java.nio.heapbytebuffer[pos=0 lim=196 cap=196]),298144) .... .... messageandoffset(message(magic = 1, attributes = 0, crc = 396743887, payload = java.nio.heapbytebuffer[pos=0 lim=179 cap=179]),299136) the docs says last number offset messageandoffset(message: message, offset: long) that in above case, last offset read 2...

matlab - Performance of index creation -

Image
in trying choose indexing method recommend, tried measeure performance. however, measurements confused me lot. ran multiple times in different orders, measurements remain consistent. here how measured performance: for n = [10000 15000 100000 150000] x = round(rand(n,1)*5)-2; idx1 = x~=0; idx2 = abs(x)>0; tic t = 1:5000 idx1 = x~=0; end toc tic t = 1:5000 idx2 = abs(x)>0; end toc end and result: elapsed time 0.203504 seconds. elapsed time 0.230439 seconds. elapsed time 0.319840 seconds. elapsed time 0.352562 seconds. elapsed time 2.118108 seconds. % strange part elapsed time 0.434818 seconds. elapsed time 0.508882 seconds. elapsed time 0.550144 seconds. i checked , values around 100000 happens, @ 50000 strange measurements occur. so question is: else experience range, , causes this? (is bug?) this may due automatic optimization matlab uses basic linear algebra subroutine. just yours, configu...

asp.net mvc - Adding a specific error message to a view in mvc -

is possible add specific error message field in view? have validation on model check whether field empty (validationmessagefor<>) , using validation summary specific errors. i'm wondering whether specific error message created summary can replace validationmessagefor<>? model: [required] public string schoolcode { get; set; } view: @html.validationsummary("", new { @class = "text-danger" }) @html.editorfor(m => m.schoolcode, new { htmlattributes = new { @class = "form-control", @placeholder = "school code" } }) @html.validationmessagefor(model => model.schoolcode, "", new { @class = "text-danger" }) controller: var schoolexists = repositoryhelper.getschoolbycode(model.schoolcode); if (schoolexists == null) { modelstate.addmodelerror(string.empty, @"no school exists code"); return view(model); } if (modelstate.isvalid) { //do other stuff } so if model state isn...