Posts

Showing posts from March, 2010

angularjs - Angular - when calling a function from ng-show and passing a parameter into it - the parameter becomes undefined -

i having problem angular when call function ng-show hide/show element parameter pass undefined function. i don't know if it's because using php print html highly doubt it. there no other option me use it. what possible reason why undefined? <div ng-app="app"> <div ng-controller="myctrl"> ... <?php ... echo '<li ng-show="toggle(' .$type . ')"></li>' //$type not undefined ... ?> ... </div> </div> js: app.controller('myctrl', function($scope) { $scope.toggle = function(type){ console.log(type); //undefined ... } }); i can provide more info if needed. if goal pass literal string toggle function, forgot add quotes around $type: echo '<li ng-show="toggle(\'' .$type . '\')"></li>' so, if php variable $type has value 'hello', generated html code be <li

javascript - How to set a CSS property with a variable in JQuery? -

i need set css property of width same size browser's current width. this, did var setwidth = $(window).width() , don't know how apply current code, this: $(document).ready(function(){ $("#backgroundimg").css("width", ""); }); is there way this? i'm new jquery might amateur. try this $(document).ready(function() { var setwidth = $(window).width(); $("#backgroundimg").css("width", setwidth + 'px'); }); or can use $.width $(document).ready(function() { $('#backgroundimg').width( $(window).width() ) });

change language of alert box in javascript -

i have alert box displays message "prevent page creating additional dialogs" every time 2 or more alert boxes displaying. want change language german, how can this? <script> alert('all fields required!'); </script> you can't, browser feature. language depend of browser language of user.

Adding data points in a column by factors in R -

the data.frame my_data consists of 2 columns("pm2.5" & "years") & around 6400000 rows. data.frame has various data points pollutant levels of "pm2.5" years 1999, 2002, 2005 & 2008. have done data.drame: { my_data <- arrange(my_data,year) my_data$year <- as.factor(my_data$year) my_data$pm2.5 <- as.numeric(my_data$pm2.5) } i want find sum of pm2.5 levels (i.e sum of data points under pm2.5) according different year. how can it. ! the image shows first 20 rows of data.frame. since column "years" arranged, showing 1999 say data: library(plyr) # <- don't forget tell libraries using give easy sample set my_data <- data.frame(year=sample(c("1999","2002","2005","2008"), 10, replace=t), pm2.5 = rnorm(10,mean = 5)) my_data <- arrange(my_data,year) my_data$year <- as.factor(my_data$year) my_data$pm2.5 <- as.numeric(my_data$pm2.5) > my_data

linux - How to partition the graph with edge weights using METIS such that the edgecut is least? -

i have metis input file edge weights of graph. , want partition graph metis, such edgecut in metis summary report least possible metis. can rb, kway or other algorithms or options. so options work best? at moment, following options have worked best me. gpmetis -ptype=rb metis.input.file num.of.partitions using k-way partitioning (-ptype=kway) let's choose minimize edgecut (-objtype=cut) or minimize total communications volume (-objtype=vol). these 2 concepts similar (refer metis manual ). i found minimizing total communication volume worked better edgecut, because, when edges had weights, edgecut in metis defined sum of edge weights cut. minimizing "edgecut" turned out produce more border vertices. edgecut did perform lot better if edge weights (temporarily) set 1, it's simpler use other option. source: metis manual , personal experience.

regex - Splunk: how to extract fields using regular expressions? like rex in splunk search -

i want extract primary , standyby db names below string found in splunk search. jul 20 14:43:31 xxxxxxxx guptaa guptaa - primary database guptac - (*) physical standby database guptab - physical standby database. jul 20 14:43:31 xxxxxxxx kumara kumara - primary database kumarc - (*) physical standby database kumard - physical standby database - physical standby database kumare - physical standby database primary db : guptaa secondarydbs : guptac, guptab i want show table below details. primary db standybydb guptaa guptac, guptab kumara kumarc, kumard, kumare any suggestions using splunk search? thank you!

javascript - Use the page title as the screenshot file name in PhantomJS -

the following phantomjs code can used obtain page title <title> of web page var page = require('webpage').create(); page.open(url, function(status) { var title = page.evaluate(function() { return document.title; }); console.log('page title ' + title); phantom.exit(); }); the following phantomjs code renders multiple urls png files. // render multiple urls file var renderurlstofile, arrayofurls, system; system = require("system"); /* render given urls @param array of urls render @param callbackperurl function called after finishing each url, including last url @param callbackfinal function called after finishing */ renderurlstofile = function(urls, callbackperurl, callbackfinal) { var getfilename, next, page, retrieve, urlindex, webpage; urlindex = 0; webpage = require("webpage"); page = null; getfilename = function() { return "rendermu

mysql - Ajax and php to create table -

i have following html code in 1 file: <html> <head> <script> function showuser(str) { if (str == "") { document.getelementbyid("txthint").innerhtml = ""; return; } else { if (window.xmlhttprequest) { // code ie7+, firefox, chrome, opera, safari xmlhttp = new xmlhttprequest(); } else { // code ie6, ie5 xmlhttp = new activexobject("microsoft.xmlhttp"); } xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4 && xmlhttp.status == 200) { document.getelementbyid("txthint").innerhtml = xmlhttp.responsetext; } } xmlhttp.open("get","createtable.php?q="+str,true); xmlhttp.send(); } } </script> </head> <body> <form> <select name="users" onchange="showuser(this.value)"> <option value="">select person:</option>

VBScript can create text file but can't delete file (permission denied)? -

i create .vbs file (that can: creat text file -> open notepad.exe -> delete file above) this: ' create new file dim objfs, objfile set objfs = createobject("scripting.filesystemobject") set objfile = objfs.createtextfile("d:\folder\textfile.txt") objfile.writeline ("sample text") ' run program , wait wscript.createobject("wscript.shell").run "notepad.exe", 1, true ' delete file objfs.deletefile("d:\folder\textfile.txt") but when run it, after close notepad window, show error message: line: 10 char: 1 error: permission denied code: 800a0046 source: microsoft vbscript runtime error i don't know why .vbs can't not delete text file? thank help! you have close file handle in script before trying delete it. ' create new file dim objfs, objfile set objfs = createobject("scripting.filesystemobject") set objfile = objfs.createtextfile("d:\folder\textfile.txt")

android - Shaky Camera Pan AndEngine -

i have been trying find best way move camera dragging background scene. have not found resource yet. pretty new android programming , using andengine. here code far public class mainactivity extends simplebasegameactivity{ private static final int camera_width = 800; private static final int camera_height = 480; private smoothcamera msmoothcamera; private bitmaptextureatlas mbitmaptextureatlas; private textureregion mfacetextureregion; private sprite face; private float lastxmove; private float lastymove; @override public engineoptions oncreateengineoptions() { msmoothcamera = new smoothcamera(0, 0, camera_width-200, camera_height-200, 400, 400, 2); msmoothcamera.setbounds(0f,0f,camera_width, camera_height); cameralastx = msmoothcamera.getcenterx(); cameralasty = msmoothcamera.getcentery(); return new engineoptions(true, screenorientation.landscape_fixed, new ratioresolutionpolicy(camera_width, camera_height), msmoothcamera); } @override public void on

caching - How do I prevent Compass from outputting .sass-cache folder using Grunt -

i have .sass-cache folder being auto generated. trying figure out how not let generate @ all. more clear, don't want .sass-cache folder. i've tried several approaches can't seem keep generating. here's couple approaches attempted: nocache: false or true config.rb file with: asset_cache_buster = :none config.rb file with: cache = false here watch doing: module.exports = function (grunt) { grunt.initconfig({ pkg: grunt.file.readjson('package.json'), watch: { scripts: { files: ['assets/js/*.js'], tasks: ['concat', 'uglify', 'copy', 'clean'], options: { spawn: false } }, scss: { files: ['assets/scss/*.scss'], tasks: ['compass', 'cssmin'], } }, then later on, here compass doing & snippet of tasks: compass: { development: { options: { config: './config.rb', sas

python - Appending bcolz columns with Blaze -

let's first construct ctable : import pandas pd import blaze bl df = pd.dataframe({'x': range(4), 'y': [2., 4., 2., 4.]}) bl.odo(df, 'test.bcolz') now suppose wanna add column called 'x_mod' table. tried test_table = bl.data('test.bcolz') def f(h): return h*3 test_table['x_mod'] = test_table['x'].apply(f, dshape='int64') #or, think equivalently: #test_table['x_mod'] = test_table['x']*3 but gives typeerror: 'interactivesymbol' object not support item assignment 1) how assign 'x_mod' column , save disk? i'm working large databases: calculating column in memory should fine, there's no way can load entire ctable in memory. 2) on related matter, apply doesn't work me either. doing wrong? #this doesn't work: bl.compute(test_table['x'].apply(f, dshape='int64')) #this think should equivalent, work: bl.compute(test_table['x']*3)

java - Creating a datasource from fetching the data source -

currently,i storing database details in property file , creating datasource using <bean id="datasource" class="org.apache.commons.dbcp.basicdatasource"> <property name="driverclassname"> <value>${driverclassname}</value> </property> <property name="url"> <value>${url}</value> </property> <property name="username"> <value>${username}</value> </property> <property name="password"> <value>${password}</value> </property> </bean> my client asked place config database , db store i18keys , main database values. so need create 1 2 datasources 1 configs , other main database. i can create config data sources using same. how can create second datasource database details stored in config database. can pointers helpful. you might take java-configu

zip - php ZipArchive - do I have this class if I have zip_open? -

simple question really, i'm not sure answer: if have zip_* functions ( http://php.net/manual/en/ref.zip.php ) available, mean have ziparchive class ( http://php.net/manual/en/class.ziparchive.php ) available? php 5.3+. first, requirements same. both use zlib if it's installed, not have requirement problem. both uses same installation page , need same configure options. if 1 works, other 1 work too. need make sure php compiled --enable-zip . you can check php -m | grep zlib command line. , phpinfo or php -i show zlib , zip version similar this: zip zip => enabled extension version => $id:abc21c7f1559e732dba6db94c69ecf638ae5fa3f $ zip version => 1.11.0 libzip version => 0.10.1 zlib zlib support => enabled stream wrapper => compress.zlib:// stream filter => zlib.inflate, zlib.deflate compiled version => 1.2.8 linked version => 1.2.8

angularjs - How to allow cross domain request -

i using $resource make http calls,my backend application deployed on different port. when trying fetch data server using request method(get),my browser automatically attaching request method(options). read nice articles browser behavior,but couldn't find issue. i allow access-control-allow-methods on server,but not working i don't have knowledge server requests,please tell me going wrong there,why ? my grunt configuration is 'use strict'; module.exports = function (grunt) { require('autostrip-json-comments'); var fs = require('fs'); // load grunt tasks automatically require('load-grunt-tasks')(grunt); var appsettings = require('./config/application.conf.json'); grunt.initconfig({ // set application settings settings: appsettings, connect: { options: { hostname: '<%= settings.dev.hostname %>', port: '<%= s

javascript - how to use q promise 2.X with requirejs on jsfiddle? -

this requirejs.config({ paths: { 'q' : '//cdnjs.cloudflare.com/ajax/libs/q.js/2.0.3/q.min' }}); require(['q'], function(q) { console.log("in loaded callback"); console.log("q: %o", q); return {}; }); fails with: module name "weak-map" has not been loaded yet context: _. use require([]) http://requirejs.org/docs/errors.html#notloaded file: require.min.js, line: 1, column: 1948 see jsfiddle however, works fine: requirejs.config({ paths: { 'q' : '//cdnjs.cloudflare.com/ajax/libs/q.js/1.4.1/q.min' }}); i checked , found out q v2 experimental now. in source code can see has dependency following library var weakmap = require("weak-map"); var iterate = require("pop-iterate"); var asap = require("asap"); and type of require/module import node/browserify. wont support require.js. per documentation:- this q version 2 , experimental @ time. if

SQL Server 2008, how to update a column with seeded random values? -

i've found lot of answers call rand being reseeded, means while different values created each row, operation cannot repeated same result. there way ensure each row gets new value still seeded initial call? the below attempts don't work: update #testtable set number = convert(int, floor(rand(checksum(newid())) * 1000)) every row has different value, every time run values given row changed. declare @randomseeder float; --seeds value, better way this. select @randomseeder = rand(5336); update #testtable set number = convert(int, floor(rand() * 1000)); it appears rand called once , value used in every row. to put guid column value should declare example: [number] uniqueidentifier constraint [df_email_emailid] default (newsequentialid()) not null you use value generate random number.

linux - Average of multiple files with unequal row sizes in Shell -

i have 15 datafiles unequal row sizes, number of columns in each file same. e.g. ifile1.dat ifile2.dat ifile3.dat , on ............ 0 0 0 0 1 6 1 2 5 3 2 7 2 5 6 10 4 6 5 2 8 9 5 9 10 2 10 3 8 2 in each file 1st column represents index number. compute average of these files each index number in column 1. i.e. ofile.txt 0 0 [this computed (0+0)/2] 1 4 [this computed (2+6)/2] 2 6 [this computed (5+7)/2] 3 [no value] 4 6 [this computed (6)/1] 5 4.66 [this computed (2+3+9)/3] 6 10 7 8 5.5 9 10 2.5 i can't think of simple method it. thinking of method, seems lengthy. taking average after converting files same row size, .e.g. ifile1.dat ifile2.dat ifile3.dat , on ............ 0 0 0 0 0 0 1 2 1 1 6 2 5 2 2 7 3 3

How to create bash script to do/undo setting locale with one alias? -

how create bash script (to make alias of it), doing this: if lang=en_us.utf-8 "unset lang" else "export lang=en_us.utf-8" adding en() { if [[ $lang == "en_us.utf-8" ]] unset lang else export lang=en_us.utf-8 fi } to ~/.bash_profile works!

algorithm - Client and server: data filtering and sorting synchronization. -

i have java client-server crud application. in client open person table , can set filter example city,age,sex. besides can add sorting rule, example sort name,and after age. these filtering , sorting rules sent server passed sql dao , used in sql code. server returns dto client according filtering , sorting rules. it's important - server implements these rules client passes these rules server. easy , clear. now create new person in client application. newly added person must visible in table of persons. , came across problem. how add person table according filtering , sorting rules. solution see make client refresh data server according same rules. obvious bad solution. i sure common problem crud application. possible solutions: patterns,algorithms,libs? name of problem (if exists) the broad category of problem layered architecture (an architectural pattern) , question deals run domain logic of system. on client-server systems decision needs made processing sho

android - How to make NavigationView header sticky -

is possible make header sticky in design support library navigationview? <android.support.design.widget.navigationview android:id="@+id/nav_drawer" android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_gravity="start" app:headerlayout="@layout/nav_header" app:menu="@menu/nav_drawer" style="@style/navigation_view_drawer" /> edit: my attempts far have led this overriding navigationview widget , adding new method: public class customnavigationview extends navigationview { public customnavigationview(context context) { super(context); } public customnavigationview(context context, attributeset attrs) { super(context, attrs); } public customnavigationview(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); } // inflates header child of navigationview, on top of normal menu public voi

java - Writing regex for string containing no only numbers -

i need write regex containing not digits [0-9] . how can without explicitly specifying possible charaters in group. possible through lookahead/lookbehind? examples: 034987694 - doesn't match 23984576s9879 - match rtfsdbhkjdfg - match =-0io[-09uhidkbf - match 9347659837564983467 - doesn't match ^(?!\\d+$).*$ this should you.see demo. https://regex101.com/r/fm9ly3/1 the negative lookahead check if string doesnt have integers start end.you need $ make sure check till end or else check @ start.

javascript - Scope is not being applied to the scope variables -

i have snippet of code in controller: $scope.$on('$ionicview.enter', function() { $scope.nodeid = $stateparams.studynoderef; studies.fetchcollection($scope.nodeid).then(function(data){ $scope.y = angular.fromjson(data.list); $scope.collections = angular.fromjson($scope.y[0].collections); console.log($scope.collections); }) }); the reason have $scope.$on because want nodeid update every time enter view can update collections. before had $scope.$on function , had study.fetchcollection function able iterate through collections in template this: <ion-list ng-controller="studyctrl"> <ion-item ng-repeat="collection in collections" nav-clear menu-close ng-click="go('app.studies')" class="item item-icon-left brand-base-text-color"> <i class="icon ion-ios-paper"></i> {{collection.name}} </ion-item> but displays nothing. if try displ

morelikethis - Combining two Solr MLT query -

just wondering if it's possible combine separate mlt queries (based on filtering condition) single one. i'm trying combine results of 2 query: http://localhost:8983/solr/collection1/mlt?q=title:"abc"&fq=source:("test1") http://localhost:8983/solr/collection1/mlt?q=title:"abc"&fq=source:("test2") the source field have different values 2 queries. combine results of 2 queries, possible in single query? any pointer appreciated.

openlayers 3 - How to update cluster source on wfs source -

i have wfs source , cluster source in vector layer. time time know changed in serverside wfs source, want update vector layer show new features. how can trigger update of wfs layer without interaction of user (especially change resolution)? clear() on cluster source or vector source or combination of did not help. changed() or map.render() did not work. trigger somehow loader-function of vector source. help! this related known issue: https://github.com/openlayers/ol3/pull/3917 i'd suggest using change pull request above in custom build, should enable reload layer (and cluster) calling clear on base source. alternatively, initialize new cluster source each time call clear on base source, , replace cluster source calling setsource on layer.

php - Populated options from database doesn't run script on change -

i load options select database (which loads options) , trying run script when selected option changes (which doesn't run) script below <script> $(function() { function subrace() { var race = $("#race").val(); console.log(race + "!"); } $("#race") .selectmenu() .selectmenu( { change: subrace() }) .selectmenu("menuwidget") .addclass("overflow"); }); </script> <select name="race" id="race"> <?php $dbhost = "localhost"; $dbuser = "dand_user"; $dbpass = "****************"; $dbname = "dand_user"; $mysqli = new mysqli($dbhost, $dbuser, $dbpass, $dbname); $query = "select * races order name asc"; $result = mysqli_query($mysqli, $query); $x = 0; while($row = $result->fetch_array(mysqli_both)) { echo" <option value=\"" . $row['

c# - Position Gtk# Dialog in the center of a Gtk window -

im trying position gtk# dialog in center of window,also make parent window non editable when dialog appears. tried setting parent property , of dialog , set it's position center on parent .(the parent windows position centered,the parent appers centered portion of below taskbar) what im doing wrong? update: i tried setting transcientfor property. mywin d = new mywin(); d.parent = this; d.windowposition = windowposition.centeronparent; d.transientfor = this; d.widthrequest = 360; d.heightrequest =260; d.resizable = false; d.show (); also error in application output when (myapp:5844): gtk-warning **: can't set parent on toplevel widget (myapp:5844): gdk-critical **: inner_clipboard_window_procedure: assertion 'success' failed update: calling dialog parent protected void onbutton7clicked (object sender, eventargs e) { var mydiag = new mydiag( ); if ( ( (gt

java - passing values from one jsf page to another through managed bean -

i need pass value(studentid) jsf view(list.xhtml) jsf page (editor.xhtml) via managed bean (bean.java). can values in bean page not access in editor . can please tell me went wrong ? hope hear suggestions list.xhtml <h:datatable value="#{student.createlist()}" var="student" styleclass="studenttable" columnclasses=",,,fixedwidth" border="1" cellspacing="2" cellpadding="2"> <h:column> <f:facet name="header">student id</f:facet> <h:outputtext value="#{student.studentid}"></h:outputtext> </h:column> <h:column> <f:facet name="header">name</f:facet> <h:outputtext value="#{student.fname}"></h:outputtext> </h:column> <h:column

Running sqoop using python subprocess can't recognize the arguments -

when run sqoop export terminal runs properly.but executing python scripts returns error: *error tool.basesqooptool: unrecognized argument: --connect error tool.basesqooptool: unrecognized argument: --table error tool.basesqooptool: unrecognized argument: --export_dir* following code snippet: call(["/usr/local/sqoop/bin/sqoop","export","--connect jdbc:mysql://localhost/temp","--table table1" ,"--export-dir /user/data/input" ,"--username root"]) assuming imported subprocess module the single arguments in argument list shouldn't contain whitespaces. line should this: call(["/usr/local/sqoop/bin/sqoop","export","--connect", "jdbc:mysql://localhost/temp","--table", "table1" ,"--export-dir", "/user/data/input" ,"--username", "root"])

Android animation jumps to end -

hi trying simple listview expand animation work. animation working jumps end resumes animation . gif of problem this code animation class: public class dropdownanimation extends animation { private int targetheight; private view view; private boolean down; public dropdownanimation(view view, int targetheight, boolean down) { this.view = view; this.targetheight = targetheight; this.down = down; } public dropdownanimation(view view, int targetheight) { this.view = view; this.targetheight = targetheight; this.setduration(350); if(view.getvisibility() == view.invisible) down = true; else down = false; } @override protected void applytransformation(float interpolatedtime, transformation t) { super.applytransformation(interpolatedtime,t); int newheight; if (down) { newheight = (int) (targetheight * interpolatedtime); view.setvisibility(view.visible); } else { newheight = (int) (targetheigh

webdriver - Check for email id in a text in java -

i using java write appium test script & want compare 2 emails, before comparison have fetch email id text splitting string. ex: have text in application "your account email associated pankaj@gmail.com" want split & capture email id text & compare other email id showing in text box. how can ?? doing this: webelement email_id= driver.findelement(by.xpath("//uiaapplication[1]/uiawindow[1]/uiatextfield[1]")); string edit_email=email_id.gettext(); system.out.println(edit_email); but getting full text.how can split it. you should try regular expression using java.util.regex.pattern , java.util.regex.matcher . have prepared snippet finds email ids given chunk of text. string text = "your account email associated pankaj@gmail.com , has emailed someone@gmail.com."; pattern pattern = pattern.compile("[\\w]+[\\d\\w]*(@)[\\w]+[\\w\\d]*(\\.)[\\w]+"); matcher matcher = pattern.matcher(text); while(matcher.fin

windows 7 - Android studio 1.2.2 Frequently restarted -

facing problem android studio 1.2.2 . it's getting restarted after opening existing project. there else faced type of problem before? i had started google map api project , after problem started. deleting project not solve . thanks in advance.

sockets - Real Time Tracking in Android App -

how app uber real time tracking of cabs? let me put across in detail:- cabs position server. server communicates positionto user app trying book cab. i have gone through many blogs, after think of solution below solve 2 issues: cabs communicate there lat/long server after time gap using http request. the user app establish socket server , change in server communicated user app through socket. is there better way it? please give insight issue. i think each cab fitted gps tracker(could mobile based app not sure) track , send real time data, once location data changes tcp connection established used communicate.

ODBC between SQL and R consistency of data -

i created odbc connection between sql server , r using rodbc package. then loaded data 1 table channel <- odbcconnect("ahmed") p <- sqlquery(channel, "select * table name") i got following problem. in 1 column in sql table have string "sziget festival" in r "sziget festival\r\n" , happens often. furthermore when create subset dataframe y<-p[p$brand=='sziget festival\r\n', ] which should include 4 rows 100 rows of nas , @ end of data.frame 4 rows. when checked on summary values of numeric data it's ok. so please help

SPARK SQL Equivalent of Qualify + Row_number statements -

does know best way apache spark sql achieve same results standard sql qualify() + rnk or row_number statements? for example: i have spark dataframe called statement_data 12 monthly records each 100 unique account_numbers, therefore 1200 records in total each monthly record has field called "statement_date" can used determining recent record i want final result new spark dataframe 3 recent records (as determined statement_date descending) each of 100 unique account_numbers, therefore 300 final records in total. in standard teradata sql, can following: select * statement_data qualify row_number () over(partition acct_id order statement_date desc) <= 3 apache spark sql not have standalone qualify function i'm aware of, maybe i'm screwing syntax or can't find documentation qualify exists. it fine if need in 2 steps long 2 steps are: a select query or alternative method assign rank/row numbering each account_number's records a select que

python - control a fermentor using pySerial -

i have fermentor (nbs bioflo 3000) connected pc (windows xp) via rs232 cable. have downloaded free software ( http://www.foxylogic.com ) monitor fermentor. it works, know fact, hardware, cable, etc, good. the free software not open source, , old. i'd use pyserial monitor fermentor. know port com1, 8 bit data, parity, baudrate=9600. paper saw ( http://dx.doi.org/10.1371/journal.pone.0092108 , supplement s1, page 2) says should using "afs communication protocol" , string requesting information looks like: (md#)ra(cr) (md#) number of reactor (0 in case) , (cr) carriage return. based on that, did, in ipython terminal: import serial ser = serial.serial(0) ser.parity = serial.parity_even ser.timeout = 1 print ser i get: serial<id=0x1976cb0, open=true>(port='com1', baudrate=9600, bytesize=8, parity='e', stopbits=1, timeout=1, xonxoff=false, rtscts=false, dsrdtr=false) ser.write('0ra\r') print ser.read(9999) ..., , nothing @ - empty

Android fragment :should back to fresh page -

i have 2 fragment , b. fragment : have 1 view, scroll view bottom. after move fragment b, touch @ fragment b move fragment a, want see view have scroll top(same refresh layout fragment a. when oncreate). my view : newheader, pulltoreveallistview, button search , framelayout parent use function inflate first fragment i.e call function in oncreateview of fragment a public view createpersistentview(layoutinflater inflater, viewgroup container, bundle savedinstancestate, int layout) { if (_rootview == null) { _rootview = inflater.inflate(layout, null); } else { ((viewgroup) _rootview.getparent()).removeview(_rootview); } return _rootview; }

switch and/or iff function in SSRS. How to use both or any for two given columns -

how use =switch & iif condition change color in ssrs if condition met. have 2 columns “scheduleddate” (which date/time), , activity(which text format). want change color of activity (which has output complete, current, overdue), if scheduleddate greater today’s date, want change overdue data in column activity red. should using switch or iif. how? can please give example? appreciate on one. thanks, niki in scenario, if need set red without setting multiple color fields, it's better use iif(). base on condition, try expression below: =iif(fields!scheduledate.value>now() , fields!activity.value="overdue",red,black)

java - CLOSE_WAIT and FIN_WAIT_2 when I try to create a SSL client socket -

the server port listening correctly before invoked line: sslsocket socket = (sslsocket) ssfactory.createsocket(ipaddress, port); then became this: tcp 0.0.0.0:23333 0.0.0.0:0 listening tcp 10.200.49.196:23333 10.200.49.196:50814 fin_wait_2 tcp 10.200.49.196:50814 10.200.49.196:23333 close_wait i never wanted close port. why did hang that? code worked fine before. i can not ask comment. :( did certificate change , ssl hand shake failed? may result in closed ssl connection. the netstat output shows: a running server socket a client server entry of closed connection and server client entry of closed connection is there exception thrown?

Google Analytics V3 - Authentication Java -

this code access google analytics api upload audiences. when tried execute getting "401 : login required".i have provided correct client id , client secret. there other object need populate in googlecredential ? missing ? public class testgoogleanalytics { private static final string application_name = "calling analytics"; private static final jsonfactory json_factory = gsonfactory.getdefaultinstance(); public static void main(string[] args) throws ioexception, generalsecurityexception{ try { file file = new file("/home/hariprasath/test.csv"); system.out.println(file.canwrite()); analytics analytics = createanalytics(); inputstreamcontent mediacontent = new inputstreamcontent("application/octet-stream", new fileinputstream(file)); mediacontent.setlength(file.length()); system.out.println("test" + file.length()); uploads uploads = analytics.management().uploads().list("accountid", "webpro

classification - R package "tree": what is the difference between minsize and mincut? -

the tree command constructing classification trees (using "tree" library) configured using tree.control . tree.control page explains minsize , mincut parameters follows: mincut minimum number of observations include in either child node. weighted quantity; observational weights used compute ‘number’. default 5. minsize smallest allowed node size: weighted quantity. default 10. to me, these 2 descriptions seem similar things. difference between mincut , minsize ? as understand it, classification, mincut determines minimum number of observations required each class minsize minimum number of observations required node. for example suppose have 14 observations in node , deciding whether split. if 11 in class , 4 in class b shouldn't split because don't have @ least 5 of each class. if had 10 in class , 5 in class b split.

python - How do I retrieve key from value in django choices field? -

the sample code below: refund_status = ( ('s', 'success'), ('f', 'fail') ) refund_status = models.charfield(max_length=3, choices=refund_status) i know in model can retrieve success method get_refund_status_display() method. however, if want reversely like: have 'success' want find abbreviated form 's'. how can in django or python? i write that: next(iter([x[0] x in refund_status if 'success' in x]), none)

Python filter() not working and returning TypeError? -

i have written prime generator program generates primes in range. code below: from math import sqrt primes = range(3, 31623, 2) in range(len(primes)): if primes[i] != none: if primes[i] >= sqrt(31622): break x in range(i+1, len(primes)): if primes[x] , not primes[x] % primes[i]: primes[x] = none primes = [x x in primes if x] def is_prime(x): #if x <= 31623 , x in primes: #return true if x % 10 == 5 or not x % 10 or not x % 2: return false else: in primes: if not x % or >= sqrt(x): return false return true l = [x x in range(999900001, 1000000000, 2) if is_prime(x)] #l = filter(is_prime(x), range(999900001, 1000000000, 2)) print l the problem in last couple lines. if use list comprehension, works fine. however, if try create list of primes using filter(), python returns error: traceback (most recent call last): file "primes.py&qu

java - Android : SMSManager - Attempt to get length of null array -

this question has answer here: what nullpointerexception, , how fix it? 12 answers i have bug smsmanager when try send message method sendtextmesasge . returns me java.lang.nullpointerexception: attempt length of null array . there code : // constructs message telephonymanager mtelephonymgr = (telephonymanager) getsystemservice(context.telephony_service); string myphonenumber = mtelephonymgr.getline1number(); string destnumber = taskmanager.gethelpcenternumber(); string message = getresources().getstring(r.string.call_me_message) + " " + myphonenumber+"."; // sends message smsmanager smsmanager = smsmanager.getdefault(); smsmanager.sendtextmessage(destnumber, null, message, null, null); the logcat receives message : 08-03 09:59:10.548: e/androidruntime(19825): fatal exce

unity3d - Unity and Photon Networking - Wait for other players -

i trying integrate multiplayer option unity game photon networking. however, have questions: created gui unity's new gui system. not using ongui @ all. trying let user create room. after he/she created room, user redirected in sort of "waiting room" in waits other players join. how done? tutorials cover how jump right game. want them inside "waiting room" , start game (by switching scene) once max players reached. i able create room in editor. made build can test out on laptop. tried show rooms inside update(). won't show rooms @ although i've created one. i think i'm missing out on something, tips? thanks! what prevents using photon lobby system? player created room sits in room , waits while other players in lobby choose room join.

MySQL AFTER UPDATE TRIGGER to increase count -

any ideas what's wrong query? searched around stackoverflow , seems using , works. mysql> create trigger upd_entry -> after update on entry each row -> begin -> update entry -> set count = count +1 -> id = new.id -> end; error 1064 (42000): have error in sql syntax; check manual corresponds mysql server version right syntax use near 'end' @ line 7 run first change delimiter delimiter // create trigger create trigger upd_entry after update on entry each row begin update entry set count = count +1 id = new.id; end// after change back delimiter ;

html - Placing an unknown width element on the right of a centered element without moving it -

i have text element centered text-align: center; , want place element (a small inline <span> ) right of without affecting position. neither of elements (and span ) have known size, can't use offsetting margin on left of text element. there way in pure css? obligatory code doesn't work: <div style="text-align: center;"> <h3 id="centered-text">my centered text</h3> <span class="to-the-right" style="background-color: blue;">badge</span> </div> how's this? #centered-text { display: inline-block; } #to-the-right { display: inline-block; position: absolute; margin-left: 4px; } <div style="text-align: center;"> <div id="centered-text">my centered text</div> <div id="to-the-right" style="background-color: blue;">badge</div> </div> i made h3 not h3 bec

How can I play birthday music using R? -

i play music using r. while r may not best tool purpose, tool familiar , nice demonstrate others flexibility on such joyous occasion. how accomplish this? if wanted this: library("audio") bday_file <- tempfile() download.file("http://www.happybirthdaymusic.info/01_happy_birthday_song.wav", bday_file, mode = "wb") bday <- load.wave(bday_file) play(bday) note you'll need install.packages("audio") first. if have specific file, you'll need convert wav format first. if wanted bit more programmery playing wav file, here's version generates tune series of sine waves: library("dplyr") library("audio") notes <- c(a = 0, b = 2, c = 3, d = 5, e = 7, f = 8, g = 10) pitch <- "d d e d g f# d d e d g d d d5 b g f# e c5 c5 b g g" duration <- c(rep(c(0.75, 0.25, 1, 1, 1, 2), 2), 0.75, 0.25, 1, 1, 1, 1, 1, 0.75, 0.25, 1, 1, 1, 2) bday <- data_frame(pitch = strsplit(p

jquery - JavaScript global variable in function and .hover -

i have code in javascript: status = document.getelementbyid('status2'); $('#slider > img').hover( function() { stoploop(); status.innerhtml = "paused"; }, function() { startslider(); status.innerhtml = "playing"; } ); where images in html have id slider , when hover on want add word (paused or playing) span tag has id status2. don't know why global variable not working, way make work putting local variable inside each funcion this: function() { stoploop(); var status = document.getelementbyid('status2'); status.innerhtml = "paused"; }, function() { startslider(); var status = document.getelementbyid('status2'); status.innerhtml = "playing"; } can me why? note: said before works local variables not setting global variable. because time run status = document.getelementbyid('status2'); dom not ready stat

floating point - Convert float 2-D array to integer 2-D array in Julia -

i know possible convert float64 int64 using convert function. unfortunately, doesn't work when applying convert 2-d array. julia> convert(int64, 2.0) 2 julia> = [1.0 2.0; 3.0 4.0] 2x2 array{float64,2}: 1.0 2.0 3.0 4.0 julia> convert(int64, a) error: `convert` has no method matching convert(::type{int64}, ::array{float64,2 }) in convert @ base.jl:13 how convert 2-d array of floats 2-d array of ints? what tried i using following code, little verbose works. hoping there easier way though. julia> = [1.0 2.0; 3.0 4.0] 2x2 array{float64,2}: 1.0 2.0 3.0 4.0 julia> b = array(int64, 2, 2) 2x2 array{int64,2}: 4596199964293150115 4592706631984861405 4604419156384151675 0 julia> = 1:2 j = 1:2 b[i,j] = convert(int64,a[i,j]) end end julia> b 2x2 array{int64,2}: 1 2 3 4 an answer doesn't work me _ _ _ _(_)_ | fresh approach technical compu

payment gateway - How can I verify sandbox merchant account in PayPal? -

Image
i integrating paypal payment gateway standard in website. have made setup configuration , transaction goes through well, problem can't verify email. 1) kindly suggest how can verify email in sandbox account. i have confirmed/verified email address prasadraja07-facilitator@aol.com in backend. in future, recommended create sandbox accounts developer.paypal.com created sandbox accounts would verified (if have checked bank verified account option yes) to confirm email, check developer.paypal.com dashboard , email notifications see email confirmation link.

multithreading - Upload a file in a separate thread in a java webapp -

i need make form users can upload big files (>200mo). wanted launch uploads in separate threads users can launch 3-4 uploads , else. problem generated .tmp file deleted when run secondary thread. use struts2. what struts2 gives me: private string uploadcontenttype; private string uploadfilename; private file upload; i transfer information thread using constructor mythread thread=new mythread (sourcename, uploadfilename, upload, user, database); thread.start(); in run() method: system.out.println("src file name: " + myfile); system.out.println("dst file name: " + myfilefilename); file destfile =new file(upload_directory, myfilefilename); fileutils.copyfile(myfile, destfile); and error: src filename: c:\***myeclipsepath***\upload_1949ed75_1002_4ccf_b198_ 25faff66563a_00000003.tmp dst file name: books.xml java.io.filenotfoundexception: c:\***myeclipsepath***\upload_1949ed75_1002_4ccf_b198_ 25faff66563a_00000003.tmp (le fichier spécifié es

jboss7.x - How to limit multipart file upload size at jboss level? -

my application running on jboss as7+resteasy, handling file size limit in api as @post @gzip @requestfilter @produces("application/json") @consumes("multipart/form-data") @path("/demo/test") public string uploadtest( @multipartform upfile uploadfilefile, ) { if (uploadfilefile.getfilesize() > 10*10*1024) { //error.. } } where filesize @formparm, works me. issue uploadtest() api gets called after file uploaded jboss container, , check file size takes unnecessarily server resources (say client uploads 1gb data data uploaded server) looking rejects files once exceed size of 10mb. adding web.xml can you. <multipart-config> <max-file-size>5120000</max-file-size> <max-request-size>5120000</max-request-size> </multipart-config>

Repeating jQuery condensed using a common id -

so, have following simple jquery common id="private_menu_" used. way condense repeating jquery? <a href="#private_menu_address" id="address">menu 1</a> <a href="#private_menu_name" id="name">menu 2</a> <a href="#private_menu_country" id="country">menu 3</a> <a href="#private_menu_email" id="email">menu 4</a> <div id="private_menu_address">address</div> <div id="private_menu_name"> name</div> <div id="private_menu_country">country</div> <div id="private_menu_email">email</div> <script> jquery("#address").click(function () { jquery('#private_menu_address').show(); jquery('#private_menu_name').hide(); jquery('#private_menu_country').hide(); jquery('#private_menu_email').hide();