Posts

Showing posts from September, 2014

c# - Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index -

i beginner selenium c# .. when trying below code , throwing exception: index out of range. must non-negative , less size of collection. parameter name: index please me on this class program { static void main(string[] args) { iwebdriver driver = new chromedriver(); driver.url = @"file:///c:/users/user/documents/visual%20studio%202012/projects/learnselenium_xpath/learnselenium_xpath/testpage.html"; var radiobutton = driver.findelements(by.name("color"))[0]; -->exception radiobutton.click(); } the .findelements not seem find element, causing [0] fail. you should check result of driver.findelements(by.name("color")) before accessing it.

regex - Python Regular Express Lookahead multiple conditions -

my string looks this: string = "*[eq](@[type],'a,b,c',@[type],*[eq](@[type],d,e,f))" the ideal output list is: ['@[type]', 'a,b,c', '@[type]', '*[eq](@[type],d,e,f)'] so can parse string as: if @[type] in ('a,b,c') @[type] else *[eq](@[type],d,e,f) the challenge find commas followed @, ' or *. i've tried following code doesn't work: interm = re.search(r"\*\[eq\]\((.+)(?=,@|,\*|,\')+,(.+)\)", string) print(interm.groups()) edit: the ultimate goal parse out 4 components of input string: *[eq](value, target, iftrue, iffalse) >>> import re >>> string = "*[eq](@[type],'a,b,c',@[type],*[eq](@[type],d,e,f))" >>> re.split(r"^\*\[eq\]\(|\)$|,(?=[@'*])", string)[1:-1] ['@[type]', "'a,b,c'", '@[type]', '*[eq](@[type],d,e,f)'] although, if looking more robust solution i'd highl

SecretKey destroy in JAVA (android) -

hi have secretkey use encrypting data in sqlite db. best practise secretkey : keep key on memory destroy key after usage , request secretkey every time storage when required.

rgb - Java BufferedImage -

i have stored rgb image in bufferedimage, want take each color (eg. red) , store in new bufferedimage. @ end, have 4 bufferedimage, original 1 , 1 each color. each bufferedimage each color should 8 bits per pixel , 8 bits contain color value. this did. string filename = "test.jpg"; file infile = new file(filename); bufferedimage refimg = imageio.read(infile); bufferedimage redimage = new bufferedimage(refimg.getwidth(), refimg.getheight(), bufferedimage.type_byte_gray); // line 4 bufferedimage greenimage = new bufferedimage(refimg.getwidth(), refimg.getheight(), refimg.gettype()); bufferedimage blueimage = new bufferedimage(refimg.getwidth(), refimg.getheight(), refimg.gettype()); (int = 0; < refimg.getwidth(); i++) (int j = 0; j < refimg.getheight(); j++) { int rgb = refimg.getrgb(i, j); int red = (rgb >> 16) & 0xff; int green = (rgb >> 8) & 0xff; int blue = rgb & 0xff; int ronly = (red << 1

Does Oracle ADF Mobile/MAF provide any free trial version? -

i new adf mobile framework, knew not free, want have try whether apply requirement. does provide free trial version? if license needed, can see quotation? can buy adf mobile(amx component) extension license , apply adf essential? maf - of oracle products - license free development purposes. need licence once go production.

android - what is wrong with this layout, double clicks -

Image
i trying similar app list but hard me, can't understand layout system, ended doing in recyclerview rectangular , imagebuttons in left , 2 on right. buttons have functions. if click star add/remove favorites, download button download it, , right buttons delete , update. i added function clicklistener using code google public class recycleritemclicklistener implements recyclerview.onitemtouchlistener { private onitemclicklistener mlistener; public interface onitemclicklistener { public void onitemclick(view view, int position); } gesturedetector mgesturedetector; public recycleritemclicklistener(context context, onitemclicklistener listener) { mlistener = listener; mgesturedetector = new gesturedetector(context, new gesturedetector.simpleongesturelistener() { @override public boolean onsingletapup(motionevent e) { return true; } }); } @override public

linux - I can't get my bash script to run -

this script used not run, hoping can me figure out issue is. new unix #!/bin/bash # cat copyit # copies files numofargs=$# listoffiles= listofcopy= # capture of arguments passed command, store of arguments, except # last (the destination) while [ "$#" -gt 1 ] listoffiles="$listoffiles $1" shift done destination="$1" # if there less 2 arguments entered, or if there more 2 # arguments, , last argument not valid directory, display # error message if [ "$numofargs" -lt 2 -o "$numofargs" -gt 2 -a ! -d "$destination" ] echo "usage: copyit sourcefile destinationfile" echo" copyit sourcefile(s) directory" exit 1 fi # @ each sourcefile fromfile in $listoffiles # see if destination file directory if [ -d "$destination" ] destfile="$destination/`basename $fromfile`" else destfile="$destination" fi # add file copy list if file not

c++ - Using meta programming to select member variables -

i trying create game save system using boost serialization, , want create easy way clients select member variables serialization. basically want user input this: class apple : public actor { public: int a; bool istasty; float unimportantdata; set_saved_members(a, istasty); }; and expanded like class apple : public actor { public: // ... template<typename archive> void serialize(archive& arch, const unsigned int version) { arch & boost_serialization_nvp(a); arch & boost_serialization_nvp(istasty); } of course, fine if requires few more macros this. i'm fine template meta programming (preferably) or preprocessor meta programming. c++11 fine, too. thanks help! previously had boost-focused answer wasn't able test. here's more comprehensible using combination of template meta-programming , macros: #include <iostream> // build base template save implementation template <

talend - Put File Mask on tFileList Component dynamically -

i wondering if let me know how can set file mask tfilelist component in talend recognize date automatically , download data desired date? have tried approach , faced errors "the method add (string) in type list <string> not applicable arguments (date)" there 2 ways of doing it. create context variable , use variable in file mask. directly use talenddate.getdate() or other date function in file mask. see both of them in component 1st approach, create context variable named datefilter string type. assign value context.datefilter=talenddate.getdate("yyyy-mm-dd"); suppose have file name "abc_2015-06-19.txt" then in tfilelist file mask use variable follows. "abc_"+context.datefilter+".*" 2nd approach in tfilelist file mask use date function follows. "abc_"+talenddate.getdate("yyyy-mm-dd")+".*" these 2 best way, can make changes in file mask per file names.

C# Detect detect key down after button click -

i perform action after particular key pressed after button click. sth this: click button press end key , action performed. i tried simple code doesn't work. private void buttonstart_click(object sender, eventargs e) { keydown += onkeydown; } private void onkeydown(object sender, keyeventargs keyeventargs) { if (keyeventargs.keycode == keys.return) label2.text = "siala"; } } you did not specify whether using winforms or wpf, following example wpf should similar winforms well: bool canclick = true; public mainwindow() { initializecomponent(); thebox.previewmousedown += thegrid_previewmousedown; } async void thegrid_previewmousedown(object sender, mousebuttoneventargs e) { if (canclick) { canclick = false; thebox.previewkeydown += thegrid_previewkeydown; await task.delay(5000); thebox.previewkeydown -= thegrid_p

ios - Fit entire Google Map in zoom level in Swift project -

Image
i have google map bunch of coordinates path.addcoordinate(cllocationcoordinate2dmake(-37.813047, 144.959911)) path.addcoordinate(cllocationcoordinate2dmake(-37.814895, 144.960759)) path.addcoordinate(cllocationcoordinate2dmake(-37.814361, 144.963140)) path.addcoordinate(cllocationcoordinate2dmake(-37.812386, 144.962239)) i map automatically zoomed best level based on points can't find relating this. i have working: var vancouver = cllocationcoordinate2dmake(-37.813047, 144.959911) var calgary = cllocationcoordinate2dmake(-37.814361, 144.963140) var bounds = gmscoordinatebounds(coordinate: vancouver, coordinate: calgary) var camera = viewmap.cameraforbounds(bounds, insets:uiedgeinsetszero) viewmap.camera = camera however accepts 2 coordinates may have 100 thanks you can use gmscoordinatebounds(path:) fit coordinates. display world size scale if update camera right after update. can use dispatch_after solve problem. override func viewdidload() {

dynamic - How can I set a Button's type to "Button" (as opposed to the default "Submit") in C#? -

according answer here , can prevent button submitting form setting type value "button", in html: <button type="button">cancel changes</button> ...but how can in c#? creating controls dynamically, (pseudocode, i'm away ide): button btn = new button { css = "bla" } btn.type = "button"; // <- this? use htmlbutton instead of button if want "html button tag" var btn = new htmlbutton(); btn.attributes["class"] = "bla"; btn.attributes["type"] = "button"; button renders <input type="submit" /> , button.usesubmitbehavior renders <input type="button" /> . htmlbutton render <button type="your_definition"></button> .

Access GPS on Android from C++ -

i have android app serves gui little daemon (written in c++) needs run on variety of mobile/embedded linux devices. daemon needs collect gps data , pass several clients (android phones, each gui). daemon needs capable of running on 1 of same android devices being used gui, i'm having lot of trouble accessing gps data c++ daemon. i've looked 2 options far: 1) the "stay native" method : i've heard gpsd exists android (such here http://esr.ibiblio.org/?p=4886 ), seems elusive and/or not existent on samsung galaxy sii, running cyanogenmod 10.1.3-i9100 (android 4.2.2). standalone toolchain built ndk doesn't seem have gps-related @ all, though sites 1 ( http://www.jayway.com/2010/01/25/boosting-android-performance-using-jni/ ) indicate java uses jni wrappers use c code talk gps anyway. 2) the jni method : gps seems easy in android java applications, started looking jni (i'm pretty new android , java, way). supposed proved way c code , java code int

c# - How to use the parenthesis in the expression tree -

[question] tell me how create appropriate expression tree? [detail] created following query statically, , result expected. // datasource string[] datasource = { "john", "ken", "mark", "mary", "tom" }; // keyword search string[] keywords = { "o", "mark", "tom" }; //linq query (static) var query = datasource.asqueryable(). where(item => (item.tolower().contains(keywords[0].tolower()) || item.tolower().contains(keywords[1].tolower())) && item.tolower().contains(keywords[2].tolower())). orderbydescending(item => item); //result // "tom" condition || condition b && condition c but not know how code following condition expression tree (condition || condition b) && condition c does tell me how use parethesis in expression tree? far created body lambda expression follows not work well. public static expression getcontain

c++ - QODBCResult::exec: Unable to execute statement: "[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error -

i error when try call stored procedure in qt using qodbc: qodbcresult::exec: unable execute statement: "[microsoft][odbc sql server driver]count field incorrect or syntax error amount of parameters correct, syntax looks alright me. procedure executes fine in management studio. might problem? qsqlquery query(db1); query.exec("select * teachers"); //test query tablewidget *table = ui->tablewidget; (int = 0; < table->rowcount(); i++) { qcombobox *combo = static_cast<qcombobox*>(table->cellwidget(i,0)); qdebug() << query.prepare("{call add_syllabus_line (?,?,?,?,?,?,?,?,?)}"); query.bindvalue("teacher_name", teachername); query.bindvalue("subject_name", "????"); query.bindvalue("temporary_name", ratingname); query.bindvalue("type_name", combo->currenttext()); query.bindvalue("activity_name", table->item(i, 1)->text()); que

python - Number format with commas and one decimal -

this question has answer here: how print number commas thousands separators? 23 answers i have number 1 decimal point such 123456.1 format 123,456.1 tried use locale format number unable work instead used following: def format(n): r = [] i, c in enumerate(reversed(str(n))): if , (not (i % 3)): r.insert(0, ',') r.insert(0, c) return ''.join(r) which results in 1,234,56.1 use string formatting . >>> '{:,}'.format(123456.1) '123,456.1'

Spark-Cassandra Connector : Failed to open native connection to Cassandra -

i new spark , cassandra. on trying submit spark job, getting error while connecting cassandra. details: versions: spark : 1.3.1 (build hadoop 2.6 or later : spark-1.3.1-bin-hadoop2.6) cassandra : 2.0 spark-cassandra-connector: 1.3.0-m1 scala : 2.10.5 spark , cassandra on virtual cluster cluster details: spark master : 192.168.101.13 spark slaves : 192.168.101.11 , 192.168.101.12 cassandra nodes: 192.168.101.11 (seed node) , 192.168.101.12 i trying submit job through client machine (laptop) - 172.16.0.6. after googling error, have made sure can ping machines on cluster client machine : spark master/slaves , cassandra nodes , disabled firewall on machines. still struggling error. cassandra.yaml listen_address: 192.168.101.11 (192.168.101.12 on other cassandra node) start_native_transport: true native_transport_port: 9042 start_rpc: true rpc_address: 192.168.101.11 (192.168.101.12 on other cassandra node) rpc_port: 9160 i trying run minimal sample job import org.a

Downloading a section of an Image from a website in python? -

i able download entire image url using from pil import image, imagetk import cstringio import urllib url = http://prestigemgmt.us/wp-content/uploads/2013/03/dog.jpg self.image = image.open(cstringio.stringio(urllib.urlopen(url).read())) it works fine , gets whole image website. question there way get, lets right half of image. i understand edit image after downloaded, speed important aspect, ideally download need. it not possible this. the common image file formats png , jpeg encoded in manner cannot download arbitrary part of picture without downloading full picture. you need download whole picture, decode , edit after download. for advanced knowledge can study png , jpeg file formats. if in control of server providing images can write server-side script edits image on server , sends edit on wire.

Do outbound properties get deleted when passing through a scatter-gather flow control in Mule? -

i attempting set outbound property prior using scatter-gather, subsequently sends copy of each message loop breaks collection , sends objects on vm queue. want use outbound property in subsequent flow, inound property, of course, properties don't make past scatter-gather. here's flows like: <flow name="processpage"> <vm:inbound-endpoint path="processpage" exchange-pattern="one-way" doc:name="processpage" /> <message-properties-transformer doc:name="set parentid (e.g. facebook page or group id)"> <add-message-property key="parentid" value="#[payload.get('fbaggregatorsource').get('id')]"/> </message-properties-transformer> <component doc:name="getpagepostsandevents"> <spring-object bean="pageservice"/> </component> <scatter-gather doc:name="scatter-gather"> &l

Rabbitmq: set per-message TTL during basicNack()? -

https://www.rabbitmq.com/ttl.html says can set per-message ttl when publish message. in use cases, when consumer receive message rabbitmq, reason cannot distribute message. consumer basicnack message setting re-enqueue = true. problem is, may introduce broadcast storm. wondering, can set ttl message during basicnack()? no. basicnack api doesn't allow that. more info here: https://www.rabbitmq.com/nack.html

c# - Progress Bar in WPF - stuck in 50% -

so have class backgroundworker , progressbar on gui this public class mcrypt { public byte[] datablock; public byte[] ivblock; public static bitmap fingerprintimg; public byte[] tempx; public byte[] tempangles; public byte[] tempy; public byte[] tempkey; public byte[] x; public byte[] y; public byte[] angles; public byte[] key; public int nom; public mcrypt(backgroundworker bw, string imgloc, string fileloc, byte[] ivblock) { if (!bw.cancellationpending) { bw.reportprogress(0); loadimg(imgloc); bw.reportprogress(7); detectminutiae(fingerprintimg); bw.reportprogress(25); convertvalues(); bw.reportprogress(30); loadfile(fileloc); // loadfile method contains datablock = file.readallbytes(fileloc); bw.reportprogress(35); handlelength(ivblock); bw.reportprogress(40); manageinitkey(); bw.reportprogress(45);

Gammu - Can receive SMS but can't dialvoice -

with gammu configuration, on huawei e220 modem, can receive sms, cant dialvoice. here gammu config file (used both gammu-smsd , gammu) : # configuration file gammu sms daemon # gammu library configuration, see gammurc(5) [gammu] port = /dev/ttyusb0 model = connection = at19200 synchronizetime = yes logfile = /var/log/gammulog logformat = textall use_locking = gammuloc = # smsd configuration, see gammu-smsdrc(5) [smsd] service = files pin = 0000 logfile = /tmp/smsd.log # increase debugging information debuglevel = 0 runonreceive = /opt/sms/onreceive.sh # paths messages stored inboxpath = /var/spool/gammu/inbox/ outboxpath = /var/spool/gammu/outbox/ sentsmspath = /var/spool/gammu/sent/ errorsmspath = /var/spool/gammu/error/ the command dialvoice : gammu -c /etc/gammu-smsdrc dialvoice xxxxxxxx and here log : [gammu - 1.31.90 built 08:54:06 may 23 2012 using gcc 4.6] [connection - "at19200"] [connection index - 0] [model type - "&quo

javascript - Ionic list + firebase binding not working -

i building app ionic , firebase. have firebasearray contains events date on server side. i able sort these events on client side date. the goal populate ion-list these events , sort them date (today, week, later). the problem after retrieving events, sort them in local $scope.arrays date populate ion-list. since not firebasearrays anymore, there no binding between data , lists. (work after retrieving events if add event firebasearray, won't show in ion-list). does can me how deal it? don't need actual code more way of thinking , maybe angularfire methods unaware. here service using: angular.module('starter.services', ['firebase']) .factory('soirees', function($firebase, $firebasearray) { var soireesref = new firebase('https://partey.firebaseio.com/soirees'); var soirees = $firebasearray(soireesref); return { all: function() { return soirees; }, add: function(soiree) { soirees.$add(soiree); }, remove

Excel Formula - Rank -

Image
i trying figure out how rank values based on percentages. ever cell has highest percentage, should ranked 1st. ever has 2nd highest percentage, should ranked 2nd. same thing 3rd value. however, comparing 12 different values (using cells a1 a12). how rank each value show first 3 highest percentages? have been using rank value, however, don't want 12 values shown..so values 4-12 should not display or should hidden. also, need accurate within 0.1. example, if 1 value 18.5% , 18.7%, need 18.7% ranked higher, , not equal (which happens rank formula). any idea how this? thanks, with data in a1 through a12 , in c1 enter: =large($a$1:$a$12,row()) and copy down through c4 to show fewer items, copy through c3 , etc. edit#1: leave formulas in column c . in column d enter 1, 2, 3. then in b1 enter: =iferror(vlookup(a1,$c$1:$d$3,2,false),"") and copy down. here example: edit#2: in b2 enter: =if(rank(a1,$a$1:$a$12,0)<4,rank(a1,$

winforms - Shortcut in Visual Studio - Windows Form Application while other Window is active -

i want use shortcut in windows form app , found following code . protected override bool processcmdkey(ref message msg, keys keydata) { if (keydata == (keys.enter)) { messagebox.show("hello world!"); return true; } return base.processcmdkey(ref msg, keydata); } but works, if window active. how can use shortcut if different window active? you use single entry point message catching , dispatching in base form. base form public class baseform : form { public void mymessage(hwnd:hwnd) { ... case msg_specific_action_1 : handled=this.doonspecificaction1(); ... } protected bool doonspecificaction1(){ return=false;} } base form descendant public class mycustomform : baseform { protected override bool doonspecificaction1() { messagebox.show("hello"); return true; } } edit - global keyboardhook if looking trap key events in other applications nee

How to clear a "stuck" job in Collabnet Edge -

i'm having problem job in collabnet edge. created blank repository, did load dump file. there issue during load (finally figured out had run out of disk space) , due this, job got stuck. so, here's what's happening: the load appeared finish, job isn't shown on list. the data not loaded correctly (no space...but took while figure out) so deleted repository, added disk space , tried reload, message saying can't because there job running. a dump file set loaded. 1 load may scheduled @ time; progress can monitored on jobs screen. as mentioned, there no job listed being in progress. repo loading has been deleted. how clear out stuck job? check if there job progress repository logged under csvn/data/logs/temp if present remove , re-schedule

c# - Load data by type using Entity Framework -

i want do list<isomeinterface> result = new list<isomeinterface>(); foreach(type type in someassem.gettypes.isassignablefrom(isomeinterface)) result.addrange(loadtype(type)); is possible load entities type? need load them, no more operation needed. prefer using code first , tpt or tpc hierarchy solution. i have seen generic repositories patterns, of them need pass class. using entity framework 6 , .net 4.5. you can use dbset.set() method accepting type argument: public ienumerable<t> loadtype<t>(type type) { return context.set(type).cast<t>(); } then: result.addrange(loadtype<isomeinterface>(type)); see msdn

apache - Hadoop filesystem copy - namenode vs datanode -

i need copy file filesystem hdfs, , below configuration in hdfs-site.xml. how should use "hadooop fs" command copy file @ /home/text.txt hdfs? should copy namenode or datanode? <configuration> <property> <name>dfs.replication</name> <value>1</value> </property> <property> <name>dfs.namenode.name.dir</name> <value>file:/usr/local/hadoop_store/hdfs/namenode</value> </property> <property> <name>dfs.datanode.data.dir</name> <value>file:/usr/local/hadoop_store/hdfs/datanode</value> </property> </configuration> what hadoop version use? directory dfs.namenode.name.dir used storage meta data, , directory dfs.datanode.data.dir used storage real data(e.g. user data). if want upload file hdfs, need not care copy namenode or datanode. because hdfs it. , data storage on datanode. you can use commond bin/hadoop fs -mkdir /input

java - Sending text file to client through Spring MVC web application -

after doing research online on subject managed things working code: @requestmapping(value = "/report040generated", method = requestmethod.get) public string index(model model, httpservletresponse response, httpservletrequest request) throws ioexception { string mystring = "hello"; response.setcontenttype("text/plain"); response.setheader("content-disposition","attachment;filename=myfile.txt"); servletoutputstream out = response.getoutputstream(); out.println(mystring); out.flush(); out.close(); return "index"; } my proble when click on jsp button, files gets downloaded method doesn't redirect "index" .jsp view , gives me illegalstateexcepton: severe: servlet.service() servlet jsp threw exception java.lang.illegalstateexception: getoutputstream() has been called response any suggestions might causing issue ? it not possi

java - Creating pdf files with iText and utf8 symbols -

i’m testing creation of pdf files itext library. i’ve tried tutorial: http://www.vogella.com/tutorials/javapdf/article.html works fine, when add non latinic symbols (such ā, ē, š), empty places instead of symbols. how can resolve problem? thanks!

Inheritance of class in Python? -

suppose have parent class a , daughter class b . a has 10 methods in , b requires 3 of methods. how can done? there nothing special do. just inherit class a : class b(a): super(b, self).__init__(): use/override methods need , ignore rest.

javascript - PHP variable stores different values? -

i clueless problem. have variable called $opts . use fill select results database query (mysql). <select id="user" name="user" > <?php $cons=array(); $opts=getoptions("user",$cons,0); logge(date("y-m-d h:i:s")." - ".$tag." - ".$fn." - opts are=".$opts); echo $opts;?> </select> this working , select filled usernames: <option value="1">admin</option> <option value="2">test</option> i have select-multiples filled depending on username selected. here javascript in document ready function: $(document).ready( function () { // rootloc returns root url var $_get = {}, args = location.href.substr(0).split("/"); var rootloc="http://"+args[2]+"/"+args[3]+"/"; $("select").change(function() { console.log("select on change called."); var elem=this.id; /

results changing between loop, manual entry in R -

i'm running weird issue of looped results being different manually entered ones. need count number of levels in set of variables in data-set. wrote little code turns variable factor, counts number of levels , sets numeric. works fine. when loop across variables, says each variable has 1 level. happened on dataset i'm using , sample data created below. happened when wrote function , used in apply instead of loop. must wrong loop, i'm stuck. thoughts? here sample data, dataframe 3 variables (x,y,z), 18 observations. x <- rep(c(1,2,3), 6) y <- rep(c(1,2), 9) z <- rep(c(1,2,3,4,5,6), 3) xyz_df <- as.data.frame(cbind(x,y,z)) so count number of levels each variable- levelsx <- as.numeric(nlevels(as.factor(xyz_df$x))) levelsy <- as.numeric(nlevels(as.factor(xyz_df$y))) levelsz <- as.numeric(nlevels(as.factor(xyz_df$z))) the result right- levelsx 3, levelsy 2 , levelsz 6. but when loop it, changes. created vector values of variabl

excel - Find a Value and insert a row in VBA -

sub o() dim x integer dim y integer y = 2 2 x = 1 600 if cells(x, y).value = "cd sector average" cells(x, y).entirerow.select selection.insert shift:=xldown cells(x + 2, y).select end if next x next y y = 2 2 x = 1 600 next x if cells(x, y).value = "cs sector average" cells(x, y).entirerow.select selection.insert shift:=xldown cells(x + 2, y).select end if next x next y y = 2 2 x = 1 600 next x if cells(x, y).value = "e sector average" cells(x, y).entirerow.select selection.insert shift:=xldown cells(x + 2, y).select end if next x next y end sub so looking find first value , add row above , continue searching next value , add row. what inserts rows before first value until hits 600 range macro ends. how can altered run find , insert 1 time , move next value find? the problem you're working in wrong direction. loop, if finds

r - function to get the power of a number -

looking way floating point number power of 10 noted 6.45e-8 - 8 3.21e-4 4 0.013 2 or minus in is ther e function following instead of multiplying 6.45e_8 @ first dividing 1e-8 , multiply (6.45e-8/1e8=...). how floor(log10(x)) ? log10 computes log base 10, floor finds next smaller integer.

ios - Making UIContainerView as wide as device screen -

i can't seem correctly reason problem hoping give me tips guide me along. so have 4 uicontainerview's within uiscrollview. user swipes, containers display 4 individual uiviewcontrollers. what want is, through autolayout, specify each uicontainerview must take device screen's width. user scrolls, 1 uiviewcontroller shown @ time on entire screen the problems running into: 1. can't make iboutlet uicontainerview .. not sure why 2. no way in autolayout specify "device screen width" within uiscrollview any appreciated! your uiscrollview must contained inside uiviewcontroller nib. make constraints container view equal widths view controller's view in interface builder, , place container views next each other using al.

It's not possible to edit a SonarQube rule because it's not displayed -

we updated sonarqube 4.2 4.5.4 have problem following java rule: key : squid:methodcyclomaticcomplexity name: methods should not complex the rule used in analysis , several complexity issues correctly found, it's not possible edit rule (to change threshold value, example) because rule not displayed in web interface: steps reproduce issue: log in sonarqube click on rules search "methodcyclomaticcomplexity" click on methodcyclomaticcomplexity rule found @ left side of window result: nothing appears @ right side of window!!! please, resolve this? the "data/es" folder should not copied when doing sonarqube upgrade (see "upgrading" guide ). so solve issue: stop sq drop "data/es" folder restart sq, et voilà!

c++ - How to use namespace System; in MFC application with VC++ -

help me,am new, want use features(i don't know specific word use) present in system namespace, when try add project "using namespace system",i want use sqlclient ,i saw below link giving answer dont have clue talking about https://social.msdn.microsoft.com/forums/vstudio/en-us/5429ca08-4e18-471e-a679-859094e9aa18/i-work-with-vc-2005-mfc-i-cant-use-namespace-system?forum=vclanguage thanks in advance namespace system part of .net library, requires use c++/cli or c# language. mfc c++ library, programmed c++. if new not recommend attempt program in 2 languages. can find other way use sql in mfc application. (try looking cdatabase , crecordset).

powershell - Getting installed programs and filtering them by publisher -

ok, can list of installed programs via get-wmiobject win32_product | select name i'd list of select publishers "microsoft" , "google". so programs installed: adobe reader - adobe itunes - apple chrome - google visual studio- microsoft run program output: chrome visual studio thank help. when in doubt, read documentation . publisher name stored in vendor property, can filter results this: $vendors = 'microsoft corporation', 'google' $names = get-wmiobject win32_product | ? { $vendors -contains $_.vendor } | select -expand name fuzzy matches on list of vendors little more complicated. should work, though: $vendors = 'microsoft', 'google' $names = get-wmiobject win32_product | ? { $vendors | ? { $_.vendor -like "*$_*" } } | select -expand name

javascript - How do I tell Selenium that an Angular controller has "loaded" -

i've got ui tests attempting test click on element makes else appear. there's existing check tests looks see if dom ready, there's small amount of time between firing , app.controller() calls completing test jump in , wrongly determine click handler has not been added. i can use angular.element('[ng-controller=mycontroller]').scope() determine if scope defined, there still small window test run before click handler bound (a very, small window). <div ng-controller="mycontroller"> <div ng-click="dowork()"></div> </div> can see way tell click handler has been added? ps: there's event fires within controller when controller has loaded: $scope.$on('$viewcontentloaded', function(){ }); doesn't me unless subscribe in controller , flag variable somewhere can check via selenium. pps: lot of these have classes change when scope changes , can used trigger test, many not. there specialized

Trying to get the average number of a value by day in SQL -

i trying average number of posted jobs day , cannot figure out of similar prior questions asked on site. seems pretty basic reason isn't working. can please help? thank you! select avg(count(*) select (count(*), to_char(thedate, 'mm/dd/yyyy') date jobs companyid = 1) try this: select avg(jobnumber), date select (count(*) jobnumber, to_char(thedate, 'mm/dd/yyyy') date jobs companyid = 1 group to_char(thedate, 'mm/dd/yyyy') ) innerselect group date

Passing a variable back and forth vs. using a python constant -

i have python module few functions. @ moment, these functions called main(), expect import module other files in future. i have counter variable used , modified of these functions. @ moment passing around parameter, , returning every function call. this works seems silly. considered including constant variable counter used directly functions. however, assume constants not supposed modified. is there cleaner approach passing counter variable , forth? creating class counter 1 of attribute solution. since current functions explicitly called in future, making counter attribute save callee of variable passing , of additional error checking. also counter variable can abstracted callee function reducing errors. point depends on implementation though.

javascript - Count times a value is repeated in data fetched using REST call -

Image
i'm fetching data sharepoint using rest, , works fine, except count times same item appears. this jquery: var url = "https:xxxxxxxx/_vti_bin/listdata.svc/rmsd_tasks?$orderby=typeofissuevalue asc,statusvalue desc&$filter=statusvalue ne 'completed'&groupby=typeofissuevalue/statusvalue"; var lastissue = ''; $.getjson(url, function (data) { $('#totalcounter').text(data.d.results.length); (var = 0; < data.d.results.length; i++) { var datereceived = data.d.results[i].datereceived; datereceived = new date(parseint(datereceived.replace("/date(", "").replace(")/", ""), 10)).tolocalestring('en-us', { year: 'numeric', month: 'numeric', day: '2-digit' }); var issue = data.d.results[i].typeofissuevalue; console.log(data.d.results[i].typeofissuevalue); if (issue != lastissue) { lastissue = issue;

r - multiplication of very large with small values -

as result of large binomial coefficient summed sorry stored number big integer (from gmp) package big integer ('bigz') : [1] > choosez(1599,999) big integer ('bigz') : [1] 64702725976477841685087011694882593433664461459998756503370133423490886710992479387020713114439119078572270410565905096678530812549132718109065352925330156276352159906752920126061592461003982967533637590930195693832792290806000097619179060714793020167850667221328682056807933391950779186595385360309444776548462757363488307499961774581415255778468273486215727708155489945082243963752226921889401251140938597561863975549109487674702867681182063412410767713200 now need multiply [1] 1.884357e-08 if convert big integer number 1.88 e-8 rounded 0 means multiplication 0. how can multiply both numbers in r can't divide big number 1x10^8 (as integer) , multiply 18884357?

r - Issue with subsetting data; not picking up observations for one category -

i'm attempting subset data in r 1 column of spreadsheet 3 different categories: cod, haddock , whiting. reason however, haddock not working , saying there no observations subset, when in fact there should 51 - other 2 categories subsetting fine observations accounted for. can reasons this? spreadsheet appears ok, , doesn't seem contain obvious problems, there overlooking? thanks edit: ok, here's part of data set here... opcode species distancefromcoast sa_f1_280714_c4_1 atlantic cod 583.69 sa_f1_280714_c4_1 haddock 583.69 sa_f1_280714_c4_1 whiting 583.69 sa_f1_290714_c2_10 atlantic cod 892.51 sa_f1_290714_c2_10 haddock 892.51 sa_f1_290714_c2_10 whiting 892.51 sa_f1_280714_c4_6 haddock 1080.5 sa_f1_280714_c4_6 whiting 1080.5 sa_f1_280714_c4_6 atlantic cod 1080.5 sa_f1_280714_c4_7 whiting 1030.59 sa_f1_280714_c4_7 haddock 1030.59 sa_f1_280714_c4_7 atl

c# - How to assign list to generic list -

how can assign return result table generic list this wcf service method. public list<t> getapprovedstatelist(datetime effectivedate) { list<t> statelist = null; using ( var db = new context()) { statelist = (from in db.stateproductlist join b in db.states on a.stateid equals b.stateid a.effectivedate <= effectivedate select b).tolist(); } return statelist; } here entity class public class entities { public class state { public int stateid { get; set; } public string statecode { get; set; } public string statedescription { get; set; } } here context public class context : dbcontext, idisposable { public context() : base("ecommconnectionstring") { } public list<entities.state> states { get; set; } public list<entities.product> products { get; s

c# - How do I change the value of a query string parameter? -

i have string representation of url this: http://www.goodstuff.xxx/services/stu/query?where=1%3d1&text=&objectids=231699%2c232002%2c231700%2c100646&time= it's url string object in code. how change value of objectids ? need find string, objectids , locate & before , after, , replace contents desired value? or there better way? this .net 4.5 fw console app... if rest of url fixed, locate id manually, , use string.format , string.join insert ids it: var urlstring = string.format( "http://www.goodstuff.xxx/services/stu/query?where=1%3d1&text=&objectids={0}&time=" , string.join("%", ids) ); this insert % -separated list of ids code url template.

python - Convert numpy matrix to R matrix and keep it that way -

i'd convert numpy matrix r matrix. i'm aware this: from rpy2 import robjects ro ro.conversion.py2ri = ro.numpy2ri ro.numpy2ri.activate() and build r matrix: mat_r = ro.r.matrix(mat_py) but problem is, whenever refer new matrix in python gets converted numpy matrix. instance, need set row , column names, doing results in this: mat_r.rownames = numpy.array([1,2,3]) attributeerror: 'numpy.ndarray' object has no attribute 'rownames' anyone know how can keep shiny new r matrix r matrix, , stop becoming ndarray again? one way might be ro.numpy2ri.deactivate() the conversion can called explicitly (the conversion generics in module, here numpy2ri ).

javascript - Is there a way to create tables like nested lists? (image for reference) -

Image
in app, user can select of followers see of followers. i want result of function appear image: (please don't mind wrong spacing) but haven't been able nest tables or shift table rows left or right. here's code have used generate image: table { position: relative; left: 126px; margin-left: 16px; margin-top: 16px; border-collapse: collapse; } .avatar { width: 52px; height: 52px; border-radius: 50%; background-color: #abc; float: left; margin-right: 20px; } tr { height: 70px; width: 732px; } td { height: 70px; margin: 0px; } p { margin-right: 16px; line-height: 70px; } .flldfll { margin-top: 0px; margin-left: 91px; } <div id="complist"> <table class="fll"> <tr> <td> <div class="avatar"></div> </td> <td> <p>nome cognome</p> </td> <

php - If !empty statement not working / event manager plugin -

this event manager on wordpress. the following echos " website: " if field empty. <?php if ( !empty( $em_event->event_contact['url'] ) ) { echo $em_event->output(' '); } else { echo $em_event->output('<strong>website:</strong> #_contacturl{url} ') ; } ?> </p> how can echo " website: " if there www.website.com entered not echo " website: " if there no www.website.com entered? you printing echo $em_event->output('<strong>website:</strong> #_contacturl{url} ') ; when $em_event->event_contact['url'] is empty. run var_dump($em_event->event_contact['url']) right before if, show prints.

java - Submitting a Form with Angular JS and Spring MVC -

i noob angular js , having difficulties submit simple form using angular js , spring mvc. getting error: the requested resource not available mock.jsp <%@taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%> <%@taglib prefix="spring" uri="http://www.springframework.org/tags"%> <%@taglib prefix="form" uri="http://www.springframework.org/tags/form"%> <%@taglib prefix="security"uri="http://www.springframework.org/security/tags" %> <!doctype html> <html> <head> <title>settings</title> <link rel="stylesheet" href="css/main.css"> <link rel="stylesheet" href="css/workflow.css"> <link rel="stylesheet" href="css/upload.css"> <link rel="stylesheet" href="css/jquery.qtip.min.css"> <link rel="stylesheet" href="http://netdna.bo