Posts

Showing posts from July, 2015

python - Why do these two arrays have the same shape? -

so trying create array , access columns name. came this: import numpy np data = np.ndarray(shape=(3,1000), dtype=[('x',np.float64), ('y',np.float64), ('z',np.float64)]) i confused why data.shape and data['x'].shape both come (3,1000), causing me issues when i'm trying populate data fields data['x'] = xvalues where xvalues has shape of (1000,). there better way this? the reason why comes out same because 'data' has bit more structure 1 revealed shape. example: data[0][0] returns : (6.9182540632428e-310, 6.9182540633353e-310, 6.9182540633851e-310) while data['x'][0][0]: returns 6.9182540632427993e-310 so data contains 3 rows , 1000 columns, , element of 3-tuple. data['x'] first element of tuple of combinations of 3 rows , 1000 columns, shape (3,1000) well.

Why can't I use an OR operator in a switch case for strings in C#? -

it says cannot use or on 2 strings in switch case (dental || vision). placing each option in own separate case work or messing syntax? thanks switch (gr.plantypefocus){ case "medical": createplanformedical(); break; case "dental" || "vision": //createplanfordental_vision break; case "ltd" || "life": //createplanforltd_life break; } } technically achieve 'or' using fall through switch (gr.plantypefocus){ case "medical": createplanformedical(); break; case "dental": case "vision": //createplanfordental_vision break; case "ltd": case "life": //createplanforltd_life break; }

jpa - Can Web sphere Liberty manage multiple JTA sources? -

when add more 1 jta-data-source in persistence.xml run runtime exception [error ] cwwjp0012e: persistence unit name not specified , unique persistence unit not found in coplinkrestservice application , coplinkrestservice.war module. [error ] cwwjp0029e: server cannot find persistence unit in coplinkrestservice.war module , coplinkrestservice application. [error ] cwnen0035e: java:comp/env/cldb reference of type javax.persistence.entitymanager null component in coplinkrestservice.war module of coplinkrestservice application cannot resolved. [error ] cntr0019e: ejb threw unexpected (non-declared) exception during invocation of method "getpersondetails". exception data: javax.ejb.ejbexception: java:comp/env/cldb reference of type javax.persistence.entitymanager null component in coplinkrestservice.war module of coplinkrestservice application cannot resolved. @ com.ibm.wsspi.injectionengine.injectionbinding.getinjectionobject(injectionbinding.java:1494) @ [...

cassandra - Cassandre did not delete old sstables created by full compact -

i have cf , set ttl 10 days. have cron job runs every 2 days. can see merged sstable after compaction. however,sometime, can still see sstables created/updated full compaction more 10 days ago in disk. restarting not force cassandra delete old files. anyway rid of them.

ssis - Cannot see Integration Services Catalogs node in SQL Server Management Studio (SSMS) -

Image
i wanted create ssis catalog , way create catalog right click on "integration services catalogs" node , select "create catalog" option. however, not able see "integration services catalogs" node in sql server management studio (ssms) shown in following image. what missing can see node in ssms? please help. fyi, have sql server 2014 (developer edition) , integration services 12.0 installed on machine. got resolved me! fyi, had launch sql server setup again , install named instance (\) of sql server. so, when connect named instance of sql server able see "integration services catalogs" node on object explorer (see below). however, although resolved me , able move forward now, not sure why not able show me node when connect sql server default instance. ms technet reference

Cordova multiple Html files -

in cordova app index.html redirects main.html when ondeviceready event. can't use plug-ins in main.html . need enable in cordova main.html work? avoid using multiple html files, keep cordova application "on same page" having other content in other html files or template fragment files, , loading these in via ajax / javascript div in index.html "cur. might want consider templating engine such handlebars , depending on javascript framework(s) using build app other options may more attractive. example project on github have uses approach can found here .

What will go in the field 'Deauthorize Callback URL' and 'Valid OAuth redirect URIs' to enable facebook login on ezpublish? -

i using ezpublish version 4.3 , trying integrate facebook login users in system. followed instructions @ facebook login ezpublish however, requires me configure 2 values in facebook app of mine i.e. deauthorize callback url , valid oauth redirect uris . not sure oauth uri format used in ezpublish login/ failed login. please suggest solution.

c# - Open Modal when access is incorrect - Asp.net -

how can open bootstrap modal when usuárou or password incorrect ? use following code if(login.logarusuario(txtuser.text, txtsenha.text)) { //cria um cookie lado servidor httpcookie cookie = new httpcookie("estado", "conectado"); //define validade cookie (10 dias partir de hoje) cookie.expires = datetime.now.addmonths(12); //envia o cookie para o cliente response.cookies.set(cookie); //redireciona para pagina inicial response.redirect("admin.aspx"); } else { //modal open here }

ruby on rails - Heroku pg:push Can't get Database URL working -

i'm trying use heroku pg:push send data local machine production instance on heroku. i've looked @ several posts , i've tried: on this page i've tried: heroku pg:push mylocaldb heroku_postgresql_magenta --app [app name] but db url isn't aliased heroku_postgresql_magenta. i've tried putting in full database url see when run heroku config --app [app name] but, error needs url. so did more digging on this page . i tried running heroku pg:wait and heroku config -s | grep heroku_postgresql in attempt "color url" nothing gets returned when run command. any ideas? thanks yes substituting actual variables local database , app name. using database_url database url worked. thanks!

Active Directory 3rd party authentication in .net -

i have scenario user's of windows .net client app want use active directory based sso against cloud service .net client calls. .net client should use local user's credentials without requiring sign-in form. cloud service not in trusted domain. can achieved? there method use oauth2 or openid connect user's ad? this can implemented through wso2 relying party in adfs. when implement setup outcome/income claims main source user profile load wso2is authentication , pass saml response sp(end url of application). refer below links configure wso2 relying party adfs , wso2 configuration too. https://omindu.wordpress.com/2015/06/19/setting-ad-fs-3-0-as-federated-authenticator-in-wso2-identity-server/

Rails 4: sort by association attribute -

person has_many :dogs dog belongs_to :person dog has_many :bones bone belongs_to :dog i want find bone associated each dog given person owns , sort results bone_buried_date something like... bones = [] some_person.dogs.each |dog| bones << dog.bones.first end bones.sort_by{ |e| e[:bone_buried_date] } seems clumsy. wondering if there better way. try one bone.where(dog: dog.where(person: some_person)).order(:bone_buried_date)

how to set up the AVD for android studio -

i trying run app on simulator on android studio. new android btw. message got "emulator: error: x86 emulation requires hardware acceleration! please ensure intel haxm installed , usable. cpu acceleration status: hax kernel module not installed! " remembered did install simulator on sdk manager. ideas? please advise. in android sdk manager, scroll down "extras" section , install intel x86 emulator accelerator (haxm installer) package.

Count the occurrence of a specific character in a string by using substring in Scala -

i new programming. , i'm being asked count occurrence of specific character in string using substring , recursion in scala. totally lost , don't know how check equality of second character in string. not supposed use tailrecursion , map. many thanks! my code far looks this: def countchars(str:string, chr:char):int = { if (str.length == 0) 0 else { if (chr == str.substring(0,1)) 1 else 0} + countchars() } println(countchars()) first of all, working version (haven't used shortest version make easier read): def countchars(str: string, chr: char): int = { if (str.length == 0) { 0 } else { (if (chr.tostring() == str.substring(0, 1)) { 1 } else { 0 }) + countchars(str.substring(1), chr) } } println(countchars("hello world", 'l')) //> 3 you had 2 problems. first didn't call countchars right parameters. , more important , maybe not obvious: compared char string. n...

javascript - Disable same origin policy in Chrome -

is there way disable same origin policy on google's chrome browser? this strictly development, not production, use. close chrome (or chromium) , restart --disable-web-security argument. tested , verified can access contents of iframe src="http://google.com" embedded in page served "localhost" (tested under chromium 5 / ubuntu). me exact command was: note : kill chrome instances before running command chromium-browser --disable-web-security --user-data-dir the browser warn "you using unsupported command line" when first opens, can ignore. from chromium source: // don't enforce same-origin policy. (used people testing sites.) const wchar_t kdisablewebsecurity[] = l"disable-web-security"; before chrome 48, use: chromium-browser --disable-web-security

JavaScript: for loop append element in several places -

i have loop needs append list item 2 menus sharing same class name. problem append 1 or other if reference index of or if use index of append last item. html <ul class="menu"> <li>list one</li> </ul> <ul class="menu"> <li>list two</li> </ul> js var menu = document.queryselectorall('.menu'); var listitem = document.createelement('li'); for(i=0; < menu.length; ++i){ menu[i].appendchild(listitem); } is weird quirk of js or missing something? should be... var menu = document.queryselectorall('.menu'); var listitem = document.createelement('li'); (var i=0; < menu.length; ++i) { menu[i].appendchild(listitem.clonenode()); // or menu[i].appendchild(document.createelement('li')); // point is, you'll have create new element , append } as stands, move same element 1 parent .menu item another. quoting the docs : if given ch...

linux - Get the nth column out of a text document (Python 3) -

i'm trying write code allow linux mint users install recommended packages software installed on machine. list of packages installed, run following in bash: grep 'install' /var/log/dpkg.log this returns this: 2015-09-24 19:39:01 install libportsmf0:amd64 <none> 0.1~svn20101010-4 2015-09-24 19:39:02 install libsbsms10:amd64 <none> 2.0.2-1 2015-09-24 19:39:03 install libsoxr0:amd64 <none> 0.1.1-1 2015-09-24 19:39:04 install libwxbase3.0-0:amd64 <none> 3.0.2-1+b1 2015-09-24 19:39:05 install libwxgtk3.0-0:amd64 <none> 3.0.2-1+b1 2015-09-24 19:39:07 install libvamp-hostsdk3:amd64 <none> 1:2.5-dmo6 2015-09-24 19:39:08 install audacity-data:all <none> 2.0.6-2 2015-09-24 19:39:10 install audacity:amd64 <none> 2.0.6-2 2015-09-25 11:47:36 install hardinfo:amd64 <none> 0.5.1-1.4 2015-09-25 12:14:35 install libstdc++6:i386 <none> 4.9.2-10 2015-09-25 12:14:36 install libudev1:i386 <none> 215+12+betsy 2015-09-25 1...

R date m/d/y to yyyy-mm-dd -

i trying change date within dataframe correct format within r. (m/d/y correct yyyy-mm-dd). i have data looks this date time ph 1 1/4/1981 9:00 3.9 2 1/8/1981 8:30 3.9 etc the name of data frame working in data.cat.ac i tried data.cat.ac[,1]$date <- as.date(data.cat.ac[,1]$date, "%y/%m/%d") ...but did not work. i getting error, $ operator invalid atomic vectors any tips or pointers on doing wrong? when use as.date, should not enter format want output. instead enter format in data. as.date("1/4/1981", format="%m/%d/%y") [1] "1981-01-04" we got lucky in case in desired output happens default output. learning purposes, let's wanted format "dd:mm:yyyy". after converting date format did above, use: format(x2, "%m:%d:%y") [1] "01:04:1981"

sql server - Columns node disappeared in SSMS -

Image
i'm using ssms (from sql server 2014 developer edition) work sql azure. it's running on windows 10. have number of databases set on azure, , have used ssms work them. have installed devart's dbforge studio sql , use time time. i've hit weird problem. create view, , clicked + next table expand nodes below. clicked + next columns , got strange error follows: title: microsoft sql server management studio failed retrieve data request. (microsoft.sqlserver.management.sdk.sfc) help, click: http://go.microsoft.com/fwlink?prodname=microsoft%20sql%20server&linkid=20476 additional information: unknown property ismemoryoptimized (microsoft.sqlserver.management.sdk.sfc) having dismissed error, seemed fine, however, until noticed no longer have columns node under table. or indeed table (see screenshot). i tried following trouble-shooting steps: restart ssms. no change restart pc. no change use "repair" option in sql server insta...

ruby - How to get value displayed in image created by Base64-encoded string? -

i have base64-encoded string used source of image element on website , need derive value said string. there tool allows information extracted image based on bits returned decoding base64 string? example here: <img src="data:image/png;base64,ivborw0kggoaaaansuheugaaalqaaaarcayaaadr/akkaaabueleqvr42u3cw27eibafufa/abkcirj7+kfzrsqnflykgy3wwiiiiiiiiiiiiiiiiiiin7l/ukr7vnhdc/cm7n5rqgzw9gcoyomgcpexyi03uep6czof3ofd4fu4iheduf+phhhrhz8ykusf3gbudcefthw5hn7s7jf6gpvdlx1l/a1o9vsn7vl1w3+bybq6uj5udvcqou3fs7mejhahjwod3q5udvcqox0cm81tlzohcqlnaek3htwexo12lfvnk9c4jvtmf6gjdzlqe/zde4vqptitgjd18/8inlfoerrdwujc44zs+q86geto3fdtdtvlbs8h7hizm4w2620gt+uyg9c4r9vokhpurohkypatk5vqzudnqdtz5sj+mb6hcndq6s60t2bdur2erut7g9ew7u1cr8jzcdfhn2a3cr1wzyuvbsfumexo6pdk3ifch7omzxgkifxpaaaaaelftksuqmcc"> this returns image containing value 210000, need way, if possible return actual value. if answer sort of ocr technology, advice on start, related embedding in ruby script, appreciated. thanks in advanc...

SQL Distinct Pair Groupings -

i interested in manipulating data so: my source data: from | | rate ---------------- eur | aud | 1.5895 eur | bgn | 1.9558 eur | gbp | 0.7347 eur | usd | 1.1151 gbp | aud | 2.1633 gbp | bgn | 2.6618 gbp | eur | 1.3610 gbp | usd | 1.5176 usd | aud | 1.4254 usd | bgn | 1.7539 usd | eur | 0.8967 usd | gbp | 0.6589 in regards "distinct pairs", consider following "duplicates". eur | usd matches usd | eur eur | gbp matches gbp | eur gbp | usd matches usd | gbp i want source data filtered such removes 1 of above "duplicates", such final table 3 records less original. not care record "duplicates" kept or removed, long 1 selected. i have tried many variations of joins, exists, except, distinct, group by, logical comparisons (< >) , feel close given approach... not seem click. my favorite effort has involved inner joining on except: select a.[from], a.[to], a.[rate] table inner join ( select distinct [from], [to] t...

javascript - Which drag and drop to use? jQuery draggable droppable or HTML5 native drag-and-drop? or maybe other? -

we developing drag , drop cms called ucraft.me. based on laravel + emberjs + jquery + greensock(gsap). imagine works following way: there blank page left panel, have different modules craft pages. ex., title, button, image, slider, video, etc... the white page based on grid there can max 4 modules. now imagine have module - button, in centre of full width row(span12) , decided drop module, title, split current row span6 - span6. using jquery draggable droppable, calculate droppable areas , let user drop elements. can recommend better drag , drop library implement this, there similar experience? think jquery draggable-droppable choice implement drag , drop feature in site builder? have performance? or should use html5 native drag-and-drop library? thanks!! this article may of use: https://medium.com/delightful-ui-for-ember-apps/ember-js-and-html5-drag-and-drop-fa5dfe478a9a - leverage ember drag , drop events provides.

amazon web services - How to launch ECS cluster in default VPC? -

is possible? use elasticache, seems allowed created in default vpc (alternative question is: how can launch elasticache in custom vpc), can't connect in separate vpc. don't know how configure clusters (or launch them outside of "getting started")so can launch them in existing vpc can set. you create elasticache instance in vpc created ecs cluster. though, you'll need create cache subnet group first. see: elasticache (redis) non default vpc

php - checkout page field rename in woocommerce -

i trying rename field text on checkout page woocommerce code using. add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); function custom_override_checkout_fields( $fields ) { $fields['billing']['billing_address_1']['label'] = 'address (no po boxes)'; return $fields; } now issue while uploading page address (no po boxes) showing page load start shows address again confused why showing that i got answer update label in woocommerce/includes/class-ec-countries.php . there can see code on line no.509 code in array 'address_1' => array( 'label' => __( 'address', 'woocommerce' ), 'placeholder' => _x( 'street address', 'placeholder', 'woocommerce' ), 'required' => true, 'class' => array( 'form-row-wide', 'address-fiel...

model view controller - How to query configurations from database in a custom MVC? -

i'm working on multi-language website owner requires configurations/options - must set first - stored in database, e.g.: default language default action default theme etc... i'm confused query config (as i'm still in logic behind mvc approach). query setting directly config file? (is ok query database non-model file/class?) create class file related every set of configurations in /core directory e.g.: language.php, theme.php , query database in these files? use only models query these configurations? if using models, should access them directly config file or should use controller access them? (if understand correctly, controller medium between views , models?). other suggestions ...? the app root contains following: backend core lib models config views controllers helpers handlers frontend img css js i ended doing through model , controller, little bit tricky though. once done, owner pleased more convenient him toggl...

osx - How can I open a Mac application like iTunes and read data from from it using Python? -

this question has answer here: how communicate between python , mac application? 5 answers pass , receive values between python script , applescript 2 answers i saw few ways open application using python none of them allow me read data inside application. possible? windows: you can interact programs pywin32 . also, check out: interact other programs using python you can interact programs in python using com automation. mac: how can interact application on mac through python subprocess? how communicate between python , mac application?

android - How to navigate to Activity from Sliding panel when the back button is pressed -

i have fragment activity sliding panel in it. implemented following exit app when user presses button. @override public void onbackpressed() { //this close , exit app intent intent = new intent(intent.action_main); intent.addcategory(intent.category_home); intent.setflags(intent.flag_activity_clear_top);//***change here*** startactivity(intent); finish(); system.exit(0); } however, stay in same activity if the user on sliding panel , wants navigate activity. right if user presses button when sliding panel displayed, closes app. how accomplish that? hope using slidingpanellayout mslidingpanellayout = (slidingpanelayout) findviewbyid(r.id.label); then public void onbackpressed() { if(mslidingpanellayout.isopen()) { mslidingpanellayout.closepane(); } else { //closeactivity(); } } you can use panelslidelistener mslidingpanellayout.setpanelslidelistener(new...

excel - Sum + Countifs formula not working -

i'm using google sheets , trying formula work give me following count: count when column t = kenneth , column u = ( pending or contacted ) , column w has date falls between dates shown in b14 , b15. this have far: =sum(countifs(users!$t:$t,"kenneth",users!$u:$u,{"pending","contacted"},users!$w:$w,">"&$b14,users!$w:$w,"<="&$b15)) this giving me correct count pending alone ignoring contacted rows somehow not recognizing or operator. countifs (and sumifs) not support array arguments conditions. need resort summation of countifs: =countifs(users!$t:$t,"kenneth",users!$u:$u,"pending",users!$w:$w,">"&$b14,users!$w:$w,"<="&$b15)+countifs(users!$t:$t,"kenneth",users!$u:$u,"contacted",users!$w:$w,">"&$b14,users!$w:$w,"<="&$b15) or different approach, eg: =countif(filter(users!$t:$t,(users!$u...

javascript - Retrieve data from device -

i'm using misfit beddit device. retrieve raw sleep data in .csv format analyse , plot using macros. the parameters needed skin_temperature, heart rate, gsr, toss_turns , sleep_type (for example, deep, rem , light). interval time ought 1 minute every row. have retrieved data in various ways using node.js, python, javascript etc. however, not helpful not in required format. here's example of data basis device: https://61bdfa02-a-62cb3a1a-s-sites.googlegroups.com/site/selasubjects/image/screenshot%202015-09-20%2014.18.18.png?attachauth=anoy7cqa8brd6y1ojo1gd1rvsjuxnxa3rqnp_4qdzy-yzlqy-vkqfya7q63cyla2vwrm9oeh5ijvwmxcnm2sn_1udxqfii7iw5-bnvneulyqzbtmsa8sba_ucau5hckrrldj4gxwpq8eulfqp_hjglrxqchnlnsfiwwmeirrfpceur63xfy4e8ug8sqwgraumvm3gs3lwmp_hob3ykhcz1agrb4n7e8qeuwdni9tgg8bkrzdqsz6orudcgl2xagebpk8r_ln7lky&attredirects=0 this how need retrieve data beddit sleep device. know how auto plot using macros. ideas on how retrieve data beddit device?

r - Read in only certain rows -

i have set of data below. has few rows of unwanted characters before numbers want read in, few unwanted rows after data. created substring serve first column, purely numerical. there data, when set read in, above , below these numericals converted na. there way, other skip , nrow, can remove na rows , read in rows numerical? x<-read.csv("..."), header=false, na.strings="y") y<-substr(x$v1,1,8) y<-as.numeric(y) x2<-cbind(y,x1) x2<-as.data.frame(x2) i have tried: if (x$y == is.numeric) { print(x) } else { print("")} but wrong errors. have been trying different combinations of above code, as: x3<-sapply(x$y,is.numeric) x[x3,] but nothing try working.. either off or missing something. update: able both methods answered below.. problem is, since rows above numeric rows contained characters, columns factors rather numeric. rather deleting rows, temporarily removing them. there way permanently remove them columns c...

javascript - How would I make load more button work in a case like this? -

i've tried using php , jquery try , establish way in make code work... envision whenever user clicks load more button go database , load in next ten data each time click until there no more data added in case message replaces input button saying "no more posts found". page not refresh instead stays in place load rest of data. header.php <?php include('connection.php'); ?> <?php session_start(); // checks if user logged in, if not redirect them if($_session['username'] == ""){ header('location: index.php'); } ?> <!doctype html> <html> <head> <meta charset="utf-8" /> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <title>men's volleyball</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="description" content="to give male volleyball player...

java - Exported Jar (Eclipse) Crashing on Startup -

i've made program eclipse. when launch from eclipse, works flawlessly, when export runnable jar , launch that, whitescreens. tried running through command prompt see if decent error message. turns out apparently had image loading, case of image title (still strange worked in eclipse not standalone). anyway, fixed issues, have similar 1 - still image loading if i'm correct. here's error output: http://pastebin.com/vpp0gwns can offer insight? let me know if need more info, appreciated. guys. edit: think it's worth mentioning while whitescreened, application still loops menu music until close it.

ios - React Native problems on Xcode 7 -

i install environment react-native , , try awesomeproject running. on terminal opens, syntaxerror: use of const in strict mode error pointing line: const babel = require('babel-core'); ^^^^^` 'nsinternalinconsistencyexception', reason: 'it looks implementationof dev has changed. update -[rctbatchedbridge loadsource:].'` is new version of xcode , build target being ios 9, problem? or else? you need upgrade node.js v4+

csv - ParseException Missing TABLE -

i created mytable table in mydb, , when show tables on db see mytable . however, when do: load data inpath '/my/hdfs/path/myfile.csv' overwrite mydb.mytable; i parseexception line 1:73 missing table @ 'mydb' near '<eof>' i can describe on table, , see headers. but how data myfile.csv hive table? in query table key missing.so,instead of load data inpath '/my/hdfs/path/myfile.csv' overwrite mydb.mytable; use this----> use mydb; load data inpath '/my/hdfs/path/myfile.csv' overwrite table mytable;

c# - checkListBox selectedindex and sql mapping -

i have combo box , checklistbox in windows form application. in combo box, mapped items sql table using query , displayed combo box select * job_table sql table job_detail -------------------- jobid | jobname ------------------- 1 | mcdonald 2 | buger king 3 | security officer 4 | manager 5 | teacher code: string query = "select jobid, jobname job_detail"; sqldataadapter da = new sqldataadapter(); myconn.open(); datatable dt = new datatable(); sqlcommand command = new sqlcommand(query, myconn); sqldatareader reader = command.executereader(); dt.load(reader); datarow dr; dr= dt.newrow(); dr.itemarray = new object[] { 0, "<----------select job -------> " }; dt.rows.insertat(dr, 0); ...

sql - Update birthdate incase the date is Hijri by the value of converting hijri birthdate to Gregorian -

table contains many records hijri date value , gregorian value in birthdate column, please how update birthdate value of converting hijri date gregorian tried script dosen't work - meant no changes - although (18422 row(s) affected) update member set birthdate = case when (substring(cast(birthdate nvarchar), 1, 2) ='14') or (substring(cast(birthdate nvarchar), 1, 2) ='13') (select convert(date, birthdate , 131) ) else birthdate end try below code convert birthdate column records hijri format: update member set birthdate = convert(varchar(100),birthdate,131) --- [hijri date gregorian date] update member set birthdate = convert(datetime, birthdate, 131) --- [ gregorian date hijri date] there several blogs this, likethis one: http://blogs.msdn.com/b/wael/archive/2007/04/29/sql-server-hijri-hijra-dates.aspx

How to make an icon URL based, Java -

i've made java app uses url based images instead of file based images. question is, there way url image icon image? frame.seticonimage(new imageicon("icon.png").getimage()); that's how icon image tried: frame.seticonimage(new imageicon("i.imgur.com/<whatever>").getimage()); and didn't seem work, there way to or there atleast way rid of icon altogether without using blank texture file? url url = new url("http://some url/mypic.jpg"); image image = imageio.read(url); f.seticonimage(new imageicon(image).getimage());

iphone - IOS: How to change the position of UITabbar to the top of view -

i using uitabbar in project want change position bottom top of view. code have put this. { [super viewdidload]; // additional setup after loading view. self.view.backgroundcolor = [uicolor whitecolor]; self.title = @"welcome"; _friendviewcontroller = [friendsviewcontroller new]; _homeviewcontroller = [homepageviewcontroller new]; _notifviewcontroller = [notificationviewcontroller new]; _messageviewcontroller = [messagesviewcontroller new]; self.tabbarcontroller = [[uitabbarcontroller alloc]init]; self.viewcontrollers = [nsarray arraywithobjects:_homeviewcontroller,_messageviewcontroller,_friendviewcontroller,_notifviewcontroller, nil]; //uitabbar *tabbar = self.tabbarcontroller.tabbar; uitabbaritem *item0 = [self.tabbar.items objectatindex:0]; uitabbaritem *item1 = [self.tabbar.items objectatindex:1]; uitabbaritem *item2 = [self.tabbar.items objectatindex:2]; uitabbaritem *item3 = [self.tabbar.items objec...

angularjs - kendo TreeList: sort columns based on parent element only? -

here example kendo treelist . how can sort data in treelist, depending on values based on parent element? in example, if sort data on column 'p names', child elements sorted. how can sort parent elements? thanks in advance. you need add custom comparer column. look in kendo docs in case this: $("#grid").kendogrid({ datasource: datasource, sortable: true, columns: [{ field: "item", sortable: { compare: function(a, b) { if(a.level>1){ var datarows = $scope.grid.items(); var arowindex = datarows.index(a); var browindex = datarows.index(b); return arowindex > browindex ; } else return a.item> b.item; } } }] });

c# - Binding RadGrid To DataTable ASP.NET -

Image
what trying before saving records database want show records in gridview when user fill text box , click on button record shown on gridview serial number 1 , 2 , 3 ... far have approach . first records added when adding second record datatable give null reference exception . right approach ? or there easy way . using telerik radgrid asp.net . public datatable dt; protected void page_load(object sender, eventargs e) { if (!ispostback) { dt = new datatable(); dt.columns.add("sn#"); dt.columns.add("type"); dt.columns.add("accounttitle"); dt.columns.add("description"); dt.columns.add("costcenter"); dt.columns.add("debit"); dt.columns.add("credit"); sno.text = "1"; } } protected void radgridview2_needdatasource(object sender, gridneeddatasourceeventargs e) {...

c# - customize query result -

Image
i have 3 tables tblindividual tblindividualspeciality tblspeciality one individual have multiple speciality, when write query many rows depends number of speciality individual. need record in single row , each speciality have single column. this table structure my query select firstname,lastname,specialtyname tblindividual ind,tblspecialty spec, tblindividualspecialty indspec ind.pkindividualid = indspec.fkindividualid , spec.specialtycode = indspec.specialtycode , pkindividualid = 355735; i received format result but need format result can 1 me please. using mysql database , development tool visual studio 2013. part of problem mysql not have equivalent of sql's pivot, , in overcoming doesn't have built-in concept of rownum. i created tables 2 separate individuals, 4 specialities of first individual had 3 , second had 2. combined these interim table (temporary table if prefer) using insert interimresults ( select @row_number:=...

java - Create multiple lists dynamically -

java version "1.7.0_45" i trying create mutliple lists contain same messages sent jid. for example offlinemessageheaderlist contain many messages different , same jid's. want group ones have same jids in there own lists. messagelist1 -> messages john messagelist2 -> messages peter etc. then @ end check ones empty , add them grouplist. however, solution not declare first , have more or less messages same jid. code snippet checking , adding list<list<messageheader>> grouplist = new arraylist<>(); list<messageheader> messagelist1 = new arraylist<>(); list<messageheader> messagelist2 = new arraylist<>(); list<messageheader> messagelist3 = new arraylist<>(); list<messageheader> messagelist4 = new arraylist<>(); if(offlinemessageheaderlist.size() > 0) { for(offlinemessageheader header : offlinemessageheaderlist) { log.log(level.info, "j...

ruby on rails - Prepard statement already exist issue - puma incorrect config -

i using rails 4 puma web server. using postgres on heroku i getting error saying prepared statement 'a3' exist this conf puma # ref https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server workers integer(env['web_concurrency'] || 2) threads_count = integer(env['max_threads'] || 5) threads threads_count, threads_count preload_app! rackup defaultrackup port env['port'] || 3000 environment env['rack_env'] || 'development' on_worker_boot # worker specific setup rails 4.1+ # see: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot activerecord::base.establish_connection end i think config activerecord connection causing problem this might don't know how puma postgres: prepared statement exists the rails issue linked question referred in question has suggestions. the popular seems removing rack-timeou...

Jenkins form validation with objects as parameters -

i'm building plugin jenkins , i'm trying validate form (connection test method). worked fine when @queryparameter strings. now i'm trying send form validation method object this: public formvalidation dotestconnection( @queryparameter("url") final string url, @queryparameter("timeout") final string timeout, @queryparameter("bypassproxy") final boolean bypassproxy, @queryparameter("deployercredentialsconfig") final credentialsconfig deployercredentialsconfig, @queryparameter("resolvercredentialsconfig") final credentialsconfig resolvercredentialsconfig ) throws servletexception { in global.jelly file have this: <f:validatebutton title="${%test connection}" progress="${%testing...}" method="testconnection" with="url,timeout,byp...

jquery - Order of function execution in javascript -

this question has answer here: how return value asynchronous callback function? [duplicate] 3 answers i making java script application having html canvas element. clicking on canvas triggers java script event. order of execution of function not expected $('#canvas1').on('click',function(e){ get_json_data(); //plot json data show_curve(); }); function get_json_data(){ $.getjson("program/heatmap_slices.json",function(data){ console.log("function1"); visibilty = data['photo'][1][1]; }); return ; } function show_curve(){ $("#canvas2").show(); console.log("function2"); var canvas2 = document.getelementbyid('canvas2'); var ctx2 = canvas2.getcontext("2d"); var mynewchart = new chart(ctx2); ...

java - executorService.scheduleAtFixedRate to run task forever -

i want task run forever after interval of 1 min. accomplish wrote task in public void poll() { scheduledexecutorservice executorservice= executors.newscheduledthreadpool(1); scheduledfuture files=executorservice.scheduleatfixedrate(new runnable() { @override public void run() { string path="/desktop/pnl/test"; list<string> filespaths= new arraylist<string>(); file folder= new file(path); file[] listoffiles= folder.listfiles(); (file file : listoffiles) { filespaths.add(file.getabsolutepath()); } if(!collectionutils.isempty(filespaths)){ try{ update(filespaths); } catch(exception e){ system.out.println(e.tostring()); } } } }, 0, 1, timeunit.minutes); files.cancel(false); //executorservice.shutdown(...

python - classification: PCA and logistic regression using sklearn -

step 0: problem description i have classification problem, ie want predict binary target based on collection of numerical features, using logistic regression, , after running principal components analysis (pca). i have 2 datasets: df_train , df_valid (training set , validation set respectively) pandas data frame, containing features , target. first step, have used get_dummies pandas function transform categorical variables boolean. example, have: n_train = 10 np.random.seed(0) df_train = pd.dataframe({"f1":np.random.random(n_train), \ "f2": np.random.random(n_train), \ "f3":np.random.randint(0,2,n_train).astype(bool),\ "target":np.random.randint(0,2,n_train).astype(bool)}) in [36]: df_train out[36]: f1 f2 f3 target 0 0.548814 0.791725 false false 1 0.715189 0.528895 true true 2 0.602763 0.568045 false true 3 0.544883 0.92...

How to access to the content of a html element using PHP? -

this question has answer here: how parse , process html/xml in php? 27 answers i know how access content of html element using php. explanation below: this html code: <div id="edittitle" title="editing title"> <b>1</b> </div> actually, want accessing content of <b> tag (which "1") using php , putting in php variable. there idea how that? thanks in advance. the following code should give idea how can use domdocument - xpath not required really: $strhtml=' <div id="edittitle" title="editing title"> <b>1</b> </div>'; libxml_use_internal_errors( true ); $dom=new domdocument('1.0','utf-8'); $dom->validateonparse=false; $dom->loadhtml( $strh...

java - EasyMock: call order on mocks created with @Mock -

is there way verify methods call order between mocks if created @mock annotation? as described in documentation can done mock control. easymockrule not expose control object. have looked @ easymocksupport implementation, have not found way force use 1 control injected mocks. :( public class test extends easymocksupport { @rule public easymockrule mocks = new easymockrule(this); @mock private someclass first; @mock private otherclass second; @testsubject private undertest subject = new undertest (); @test public void test() { expect(first.call()); expect(second.call()); .... //verify calls in order first.call(), second.call() } } you right, not possible. enhancement allow set control in @mock annotation. can please file issue ? in case, have create mocks manually using same imockscontrol explained in documentation.

batch file - Windows script doesn't work when user types in a whitespace -

i'm writing windows script in batch. have problem whitespaces in variables. when user types in space, script breaks. here's part of script: :package set /p packagename="set package name:" if [%packagename%] equ [] ( echo empty package name. goto package ) else ( set "packagename=%packagename: =%" echo %packagename% pause ) this schould work: @echo off setlocal enabledelayedexpansion :package set /p packagename="set package name:" if "%packagename%"=="" ( echo empty package name. goto package ) else ( set packagename=%packagename: =% echo !packagename! pause ) there 2 modifications script: [%packagename%] equ [] replaced "%packagename%"=="" i've added setlocal enabledelayedexpansion , changes echo %packagename% echo !packagename! the second point because changing value of variable inside if-construction. interpreter doesn't know new val...

php - How to use file_get_contents on loop? -

i'm trying use file_get_contents on loop, in order fetch json string url continuously (every second). , need store result javascript variable. here approach, didn't result this. page showed me nothing endless loading. <?php set_time_limit(0); while(true) { $jsoncontent=file_get_contents('http://megarkarsa.com/gpsjson.php'); echo $jsoncontent; sleep(10); } ?> and here javascript code. setinterval(function(){ var jsonupdpostdata = <?php echo $jsoncontent; ?>; }, 100); what should make work? suggestion appreciated. you can make work way: getcontent.php <?php echo file_get_contents('http://megarkarsa.com/gpsjson.php'); xxxx.js setinterval(function(){ var xmlhttp = new xmlhttprequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readystate == 4) { alert(xmlhttp.responsetext); // contains new file contents } } xmlhttp.open('get', 'getcontent....

javascript - one dropdown close on other dropdown opening bootstrap -

i have navigation menu structure goes as: 1)settings 1.1)settings1 1.2)settings2 2)home 2.1)home1 2.1.1) home1.1 2.2)home2 2.2.1)home1.2 step 1 - when open settings, dropdown appears showing 1.1settings1 , 1.2 settings2 step 2 - after if click on home, it's drop-down appears showing 2.1 , 2.2. step 3 - further when click home1, opens 2.1.1. step 4 - , if click home2,it opens 2.2.1 now concerns following: after click on home menu (1.2), if settings menu(1.1) open, should closed. if 2.1.1 open , click 2.2.1,then 2.1.1 should close. if home open , inside home home1 open home 1.1.1,and click settings, home should close entirely, ie. home 1.1 should closed , futher on. fiddle url: https://jsfiddle.net/hchawla13/4obzh90c/