Posts

Showing posts from January, 2010

SQL Server: Where & Like Statements -

i'm rusty sql game. have code (see below) checks on database instance (instance001, instance002, etc), looks when last_read , last_write fields null, along when last reset. nothing on top. the issue i'm having how execute across multiple instances. you'll see commented out section. if add in appropriate or statement ( or inst_name 'instance002' ), isn't getting results seeking. example: instance001 yields 1 records. instance002 yields 60. if use where inst_name 'instance001' or inst_name 'instance002' 210 records. how manipulate sql provide 61? declare @timestring nvarchar(50) = convert(varchar(24), getdate(), 120) select db_name, inst_name, min([last_srvr_rst]) min_srvr_rst, last_read, last_write, log_date=@timestring cms_db_last_read_write -- targeted db data. inst_name -- targeted instance(s) 'instance001' /* 'instance002' 'instance003' 'instance004' */

c# - How to Reset USB Port Programatically -

we have systems connect through devices connected pcs through usb. in cases there adapter in between rs-232 usb conversion. possible tell device manager remove port , add in? drivers various devices (which in cases more 1 such device through usb serial adapter) reset. seems removing port , adding in ensure drivers reconnect. important third party drivers can "stuck" , due threading not possible use anymore. means require physical removal of connection, or full system reset. so hoping knows if there simple way connect device manager find ports remove them , reconnect them. this: public class devicemanagerwrapper { public void resetallports() { using(var devicemanager = new system....devicemanager() { foreach(var port in devicemanager.getports()) { port.disconnect(); port.reconnect(); } } } } obviously doesn't work. hoping point me in right direction.

javascript - ng-repeat through object with value as an array angular -

i have object key value pairs looks this. see key has array value. $scope.testobj = { "london":[ {"id":1,"city":"london","country":"gb","name":"test1"}, {"id":4,"city":"london","country":"gb","name":"test2"} ], "los angeles":[ {"id":8,"city":"la","country":"us","name":"test3"} ] } i want display name next city in front end using angular. have tried many approaches, , used track $index, cannot figure out how working. <div ng-repeat="(key, val) in jobsbycity track $index"> {{key}}:{{val[$index].name}} </div> i have looked @ approach too, nesting ng-repeat <div ng-repeat="(key, val) in testcity"> {{key}} <div ng-repeat="test in val[$index].name"&g

sql - Single-row subquery returns more than one row - Real solution -

i'll fast. problem: subquery returning more 1 row (and ok, because should returns more one, or one), , trigger ora error 1427, closing query results. question: how can show registers of subquery? notes all searches on internet says can limit 1, not want. d table matrix, give field4 specific value, returns field me. , in same query, have value field4, , returns type , business result on field. select (select b.value table_b b b.field1 = a.field1 , b.fiel2 = a.field2 , b.field3 = a.field3 , b.category= 'adress') result_field, (select b.value table_b b b.field1 = a.field1 , b.fiel2 = a.field2 , b.field3 = a.field3 , b.category= 'gender') result_field2 table_a a; tables example: table id name age 1 lapras 6 2 lincon 45 table b id a_id

excel - Keep leading zeros in specific column when running batch file that splits csv files into multiple files -

i have csv file on number of rows allowed in excel. i'm running batch file (listed) below split multiple csv files. code works , splits multiple files. however, there 2 fields (2 , 3rd) in file have leading zeros keep. is there way can set 2 specific fields imported text keep leading zeros? @echo off setlocal enabledelayedexpansion set bfn=test.csv set lpf=1048576 set sfn=test_split rem not change beyond line. set sfx=%bfn:~-3% set /a linenum=0 set /a filenum=1 /f "delims=" %%l in (%bfn%) ( set /a linenum+=1 echo %%l >> %sfn%!filenum!.%sfx% if !linenum! equ !lpf! ( set /a linenum=0 set /a filenum+=1 ) ) endlocal pause

javascript - Converting multiple configuration routes in react-router's plain objects -

i'm trying achieve following router structure in plain route objects. const demo = () => ( <router history={hashhistory}> <route path="/" component={app}> <route path="fade" component={fadedemo}> <indexroute component={lorem} /> <route path="demo-1" component={lorem} /> <route path="demo-2" component={lorem} /> <route path="demo-3" component={lorem} /> </route> my app router looks this: export const createroutes = (store) => ({ path: '/', component: corelayout, indexroute: home, childroutes: [ counterroute(store) ] }) so want add fadedemo transition container former jsx route without path on latter example. possible? edit: that's updated route index file, can't match '/counter' location: import corelayout '../layouts/corelayout/corelayout' import home './home'

c - 'GtkToggleButton {aka struct _GtkTogglebutton}' has no member 'active' -

i trying compile , run example of gtk+3 , unfortunately, example gtk+2 manual, can't find useful on gtk+3 , can't download gtk+2 . on example there couple of function this: void entry_toggle_editable( gtkwidget *checkbutton, gtkwidget *entry ) { gtk_editable_set_editable(gtk_editable(entry),gtk_toggle_button(checkbutton)->active); } when compiling got error: 'gtktogglebutton {aka struct _gtktogglebutton}' has no member named 'active' i looked in manuals. able find in order around problem, understand release compatibility problem, gtk+3 manuals useless approaching first time gtk. one of biggest changes between gtk+ 2 , gtk+ 3 gtk+ 3 gets rid of public structure fields, replacing them gobject properties. instead of saying gtk_toggle_button(checkbutton)->active you say gboolean active; g_object_get(checkbutton, "active", &active, null); (the null because g_object_get() can multiple properties same object @ sa

Highlighting VBA code in R markdown -

is there way highlight vba code in r markdown code chunk e.g. {r, engine="vbnet", eval = false} sub myfirstsub() msgbox "hello world!" end sub will not give desired result (since vbnet unknown language engine). {r, eval = false} sub myfirstsub() msgbox "hello world!" end sub partly work e.g. keyword sub highlighted also.

how to get ip from domain in php? -

Image
( i exexute code in dos ) code: <?php $handle = fopen("domann.txt", "r"); if ($handle) { while (($line = fgets($handle)) !== false) { $ip = gethostbyname($line); echo "reading: ".$line. " ip: ".$ip ; } fclose($handle); } else { // error opening file. } ?> i'd have this: reading: www.abc.it ip: 211.195.239.122 the problem not in gethostbyname() function!! must in fgets($handle) return \n each line read here solution: $handle = fopen("file.txt", "r"); if ($handle) { while (($line = fgets($handle)) !== false) { $line=str_replace("\r\n","",$line); $ip = gethostbyname($line); echo "reading: ".$line." ip: ".$ip; echo "\n"; } fclose($handle); } else { echo "connection error"; } hey there @luca i've found out why code i'snt working, because in domann.

Ruby on Rails: Why doesn't my formatting work when downloading XLS? -

following railscast http://railscasts.com/episodes/362-exporting-csv-and-excel?autoplay=true trying format xls download, below code doesn't format xls file opens excel (with no data , no file opened). mime_types.rb : mime::type.register "application/xls", :xls contacts_controller : def index @contacts = contact.where(user_id: session[:user_id]) respond_to |format| format.html format.csv { send_data @contacts.to_csv } format.xls end end contact model: def self.to_csv(options = {}) csv.generate(options) |csv| csv << column_names all.each |contact| csv << contact.attributes.values_at(*column_names) end end end index.xls.erb : <table border="1"> <tr> <th>firstname</th> <th>surname</th> <th>email</th> </tr> <% @contacts.each |contact| %> <tr> <td><%= contact.firstname %></td> <td

java - Android Studio error - Inconvertible types, Cannot cast Fragment -

enter image description here trying make simple program using fragments. exact error : "inconvertible types, cannot cast android.app.fragment com.example.something.something.workoutdetailfragment" code: public class mainactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); workoutdetailfragment frag = (workoutdetailfragment) getfragmentmanager().findfragmentbyid(r.id.detail_frag); //error! frag.setworkoutid(1); } } (my activity_main_xml code) your workoutdetailfragment should extends android.app.fragment, not android.support.v4.app.fragment. try out~

superclass - Why is super.super.method(); not allowed in Java? -

i read this question , thought solved (not isn't solvable without) if 1 write: @override public string tostring() { return super.super.tostring(); } i'm not sure if useful in many cases, wonder why isn't , if exists in other languages. what guys think? edit: clarify: yes know, that's impossible in java , don't miss it. nothing expected work , surprised getting compiler error. had idea , discuss it. it violates encapsulation. shouldn't able bypass parent class's behaviour. makes sense able bypass own class's behaviour (particularly within same method) not parent's. example, suppose have base "collection of items", subclass representing "a collection of red items" , subclass of representing "a collection of big red items". makes sense have: public class items { public void add(item item) { ... } } public class reditems extends items { @override public void add(item item) {

office365 - Unable to Update DateTime value for Start and End of IEvent Office 365 -

i using office 365 v2 dll , tryign update datetime value start , end properties of ievent fails update event without error. my code :- try { var taskupdatemeeting = task<bool>.run(async () => { bool updatestatus = false; ievent meetingtoupdate = await service.me.events.getbyid(meetingeventid).executeasync(); if (meetingtoupdate != null) { meetingtoupdate = getupdatedevent(meetingtoupdate, meeting, location, phone); // function update ievent obj values needed update meetingtoupdate.start.datetime = "2016-08-06t19:00:00.0000000"; // sample value datetime property meetingtoupdate.end.datetime = "2016-08-06t19:30:00.0000000"; meetingtoupdate.start.timezone = "asia/kolkata"; // sample value timezone property meetingtoupdate

kubernetes - Bootstrapping docker deamon -

in official kubernetes multinode docker guide , mentioned need docker instance: a bootstrap docker instance used start etcd , flanneld, on kubernetes components depend so bootstrap instance , how make sure keeps running on restarts ? the documentation gives detailed explanation purpose of bootstrap instance of docker: this guide uses pattern of running 2 instances of docker daemon: 1) bootstrap docker instance used start etcd , flanneld, on kubernetes components depend 2) main docker instance used kubernetes infrastructure , user’s scheduled containers this pattern necessary because flannel daemon responsible setting , managing network interconnects of docker containers created kubernetes. achieve this, must run outside of main docker daemon. however, still useful use containers deployment , management, create simpler bootstrap daemon achieve this. in summary special bootstrap docker daemon runs bits kubernetes depends on, freeing the

python - Finding the brightest spot in an image -

so trying find brightest spot in image , coordinates. found prewritten code doesn't work propoerly, wondering if can give me solution (i not advanced in programming) . using video of tracked object not photo. this code trying use: # import necessary packages import simplecv import numpy np import argparse import cv2 display = simplecv.display() cam = simplecv.camera() img = cv2.imread(args["image"]).fliphorizontal().togray() # construct argument parse , parse arguments ap = argparse.argumentparser() ap.add_argument("-i", "--image", = "path image file") ap.add_argument("-r", "--radius", type = int, = "radius of gaussian blur; must odd") args = vars(ap.parse_args()) # perform naive attempt find (x, y) coordinates of # area of image largest intensity value (minval, maxval, minloc, maxloc) = cv2.minmaxloc(gray) cv2.circle(image, maxloc, 5, (255, 0, 0), 2) # display results of naive attempt cv2.ims

php - Sabre XML Writer - Group repeating Elements -

i have little question sabre xml. i prefer not develop custom writers hardcoded every php class want serialize, use mapvalueobject tell sabrexml do. unfortunatelly repeating elements not grouped. i have php model (simplified): class productitem contains object of class "product" , array, containing multiple productsdescriptions multilanguage. class productitem extends model { /** * @var product */ var $product; /** * @var productsdescription[] */ var $descriptions; } class model contains information how serialize extending classes. abstract model { public function serialize() { $service = new \sabre\xml\service(); $service->mapvalueobject('{}productitem', productitem::class); $service->mapvalueobject('{}product', product::class); $service->mapvalueobject('{}productsdescription', productsdescription::class); $xml = $service->writevalueobject($this); return $xml; } } the xml re

How smart is git in rebasing in python? -

i'm experimenting git , encountered following problem. created python file 1 function called f1 , saved under main.py , committed master branch. created branch called b1 of that, went master , changed name of function f2 (no other changes). in branch b1 added second function called new_function. after tried rebase b1 onto master. i surprised see there conflict. why isn't git seeing changed name of f1 f2 in master? am doing wrong? suggestions appreciated. you not doing wrong. git preventing potential loss of work. @ point, since function f1 has been changed f2 in master branch - branch b2 still refers f1 . so, when git rebase , git ask "so name want f1 , f2 or else.

Using condition to select the sorting property in Kotlin -

i using sortedby() perform sorting on collection of objects. since order may change depending on user choice, i've ended following code val sortedlist = if (sortingorder == wordsortingorder.by_alpha) { list.sortedby { it.word.value } } else { list.sortedby { it.createdat } } then perform further actions on sorted collection. realize sortedby() method expects property returned. wonder if there way embed sorting condition in 1 chain of collection methods. if properties of different types won't able select 1 of them based on condition result sortedby , common supertype inferred any , not subtype of comparable<r> sortedby expects. instead can utilize sortedwith method, takes comparator , , provide comparator depending on condition: list.sortedwith( if (sortingorder == wordsortingorder.by_alpha) compareby { it.word.value } else compareby { it.createdat }

PHP mysql query loop to get lowest value -

i need create loop, lowest id value mysql. so tried script: <?php include "configuration.php"; // mysql konfiguration $jungiam = mysql_connect("$db_host", "$db_user", "$db_pass"); mysql_select_db($db_name, $jungiam); $darom = mysql_query("select * task id = ( select min(id) task)"); $rez = mysql_num_rows($darom); while ($rez > 1) { $row = mysql_fetch_array($darom); echo $komanda = $row['komanda']; mysql_query('delete * task komanda = ' .$row['komanda'].''); } return true; ?> i need lowest id , print page $row['komanda'] , after printing delete table komanda = $row['komanda'] (printed text). after deleting record, need script start, print text lowest id mysql , after text deleted , proccess start start , repeating until records in table 'task' deleted. "select * task order id asc limit 1;" this ret

sql server - ERR: install_driver(ODBC) failed: Can't locate DBD/ODBC.pm in @INC -

i trying connect mssql database using perl script. my code looks follows: #!/home/fds/freeware/perl/bin/perl use dbi; $user = "username"; $pass = "password"; $server = "server_name"; $database_name = "db"; $dsn = "driver={sql server};server=$server;database=$database_name;uid=$user;pwd=$pass"; $dbh = dbi->connect("dbi:odbc:$dsn") or die "couldn't open database: $dbi::errstr\n"; when run script, getting following error: install_driver(odbc) failed: can't locate dbd/odbc.pm in @inc (@inc contains: /export/fds/linux_rhel6_x86_64/lang/perl/fdsperl5.12-cpanmodules-5.12-20160408/lib/perl5/x86_64-linux-thread-multi /export/fds/linux_rhel6_x86_64/lang/perl/fdsperl5.12-cpanmodules-5.12-20160408/lib/perl5 /export/fds/linux_rhel6_x86_64/lang/perl/5.12/lib/site_perl/5.12.5/x86_64-linux-thread-multi /export/fds/linux_rhel6_x86_64/lang/perl/5.12/lib/site_perl/5.12.5 /export/fds/linux_rhel6

GlusterFS noatime alternative -

it seems noatime has been disabled glusterfs on version i'm using. installing direct via apt-get, i'm on v3.4.2. i've tried manually switching on 3.7 , 3.8 via ppas, did work fine, noatime flag still isn't accepted when mounting. i'm running glusterfs across several php servers. vast majority of load comes glusterfs. i'm writing files, i'm assuming load coming gluster syncing access times across servers. php mode, caching, etc. aside, can reduce insane load caused gluster? running gluster volume top www_storage open shows massive open counts config.ini files. highest value in read quarter of highest opens, , writes tiny.

unity3d - Mesh Collider that detects transparency -

i have lots of meshes 2d project place on quads (as material quads). they're "maps"; filled inside have transparent edges. i make polygon collider each map , place on top of can use physics2d.raycast() detect whether user has placed object on map or off map. they're shapes (polygons). the process of making polygon collider time-consuming , quality isn't good. there mesh collider detects transparency , therefore shapes shape of map? or there way make script shapes collider shape of map? turns out polygon collider 2d has feature generate polygon such transparent mesh. drag , drop sprite on polygon collider component.

caffe - Image as a label for pixel wise classification using lmdb -

i having problem configuring caffe pixel wise segmentation. however, after research, found can create imdb database labels. have done that, don't know how link data , label databases in training prototxt file. example appreciated. since aiming pixel-wise segmentation i'm gonna call call labels ground truths. the simple solution - use 2 input layers. use 1 input layer read image , fake labels. use input layer read ground truth , fake labels. use image , ground truth blobs wherever appropriate in network.

python - succeed in script but fail in rc.local -

i write mail.py(use webpy) send me ip address of each machine. #!/usr/bin/env python #coding=utf-8 import web def send_mail(send_to, subject, body, cc=none, bcc=none): try: web.config.smtp_server = 'xxxxx' web.config.smtp_port = 25 web.config.smtp_username = 'xxx' web.config.smtp_password = 'xxx' web.config.smtp_starttls = true send_from = 'xxx' web.sendmail(send_from, send_to, subject, body, cc=cc, bcc=bcc) return 1 #pass except exception, e: print e return -1 #fail if __name__=='__main__': print "in mail.py" f=file('/home/spark/desktop/ip.log') f1=f.read() f.close() send_to = ['xxxx'] subject = 'xxxx' body = 'ip:',f1 send_mail(send_to, subject, body) rc.local bash deploy.sh & exit 0 deploy.sh #!/usr/bin/env cd /h

Node.js Parallel calls to same child rest service and aggregating response -

i want call parent rest service child rest service. number of times child service called depends on parameters parent rest services. once call child service instance concurrently different parameters. want combine responses instances of child service. using below snippet. don't want use timeout. should either timeout or when calls of child service on ever lesser. for( i=0; i<length; i++) { url=accountid[i] +'+'+sortcode[i] +'+' +accountholdername[i]; micro(url ,filter[i],function(resp) { this.resutlobject[count]=resp; console.log("count"+count); count=count+1; }.bind( {resutlobject: resutlobject} )); }//end of settimeout(function () { console.log("in time out"); res.end(json.stringify(resutlobject || {}, null, 2)); },500); you can use async module async . provides parallel foreach loop. var obj = {dev: "/dev.json&quo

c# - Selenium.DriverServiceNotFoundException Error when running remote driver -

i have automation project run local , on remote until download chrome driver version , install manually our remote machines. want start use driver nugget , download nugget , instar project , in local runs fine , after check in chenges , trying run on our remote machine error (im using mstest): initialization method automationtests.boltaplconsumer.ini threw exception. openqa.selenium.driverservicenotfoundexception: openqa.selenium.driverservicenotfoundexception: chromedriver.exe file not exist in current directory or in directory on path environment variable. driver can downloaded @ http://chromedriver.storage.googleapis.com/index.html .. it looks files not exist reason on machine , why can ? this driver set cod : chromeoptions options = new chromeoptions(); options.addarguments("test-type"); options.addargument("--disable-popup-blocking"); options.addargument("--ignore-certificate-errors"); driver = new chromedriver(options);

html - Problems on my Media-Queries Positioning for Hover Buttons -

i finished coding smartphone devices , started on tablets on mission have problem because im not sure how fix this. this how "section skills" looks mobile: my section on mobile on tablet want 3 in each row , not 2 im not able make , dont know why. .skills{ background-color:#262626; padding-bottom: 40px; } .skills p:nth-child(1){ padding-top: 54px; padding-left: 50px; font-size:30px; font-weight:900; letter-spacing: 15px; color:#fff; } .skills p:nth-child(2){ padding-top: 4px; padding-left: 50px; font-size:30px; font-weight:900; letter-spacing: 15px; color:#fff; } .skills p:nth-child(3){ padding-top: 7px; padding-left: 50px; font-size:15px; font-weight:400; color:#fff; } .skills img:nth-child(4){ padding-top: 7px; padding-left: 51px; } section { display:flex; flex-wrap: wrap; flex-direction:row; justify-content: space-between; } .programme { text-align:center; color:#ffffff; pa

c# - How to workaround 0x01 invalid character exception. Using Xdocument -

im trying parse folder bunch of xml files. xml files contains information vehicles. xml files autogenerated , of them has invalid characters. thing that, there many files me correct them manually. wonder how can bypass invalid character exception? invalid line in of xml files: <ecu ecuname="abs" ecufamily="bss" cplno="&#01;" address="0x0b" configchecksum="0x00000000" updated="false"> i have tried use streamreader without success. code: xdocument docs = xdocument.load(new system.io.streamreader((path), encoding.getencoding("utf-8"))); var namevalues = fpc in docs.descendants("fpc") select new { name = (string)fpc.attribute("name"), value = (string)fpc.attribute("value") }; if need can load file e.g. xdocument doc; using (xmlre

PHP Contact Form to Mail not working -

good day everyone, first time post here pls bear me. need guys, i'm artist knows basic html5/css that's why i'm not in php. anyway have project has contact form, realized yahoo mail not working when fill form online, gmail's good. below php code. i've been following php mail() contact-us form works fine if entering gmail sending address, not yahoo can't on own! brother needs help. thank you. <?php $field_name = $_post['cf_name']; $field_brand = $_post['cf_brand']; $field_category = $_post['cf_category']; $field_email = $_post['cf_email']; $field_facebook = $_post['cf_facebook']; $field_instagram = $_post['cf_instagram']; $field_number = $_post['cf_number']; $field_message = $_post['cf_message']; $mail_to = 'dulcetlifestylehub@gmail.com'; $subject = 'dulcet lifestyle - become family: '.$field_name; $body_message = 'from owner: '.$field_name."\n"; $body_

gradle - Serenity BDD ConfigurationException after updating IntelliJ -

i try run bdd scripts via gradle getting following error message after updating intellij 2016.2 no implementation net.thucydides.core.webdriver.webdrivermanager bound. while locating net.thucydides.core.webdriver.webdrivermanager the code raising error this: @before public void jeffcanbrowsetheweb() { giventhat(jeff).can(browsetheweb.with(thebrowser)); } the binaries browser linked this: test { system.setproperty("webdriver.chrome.driver","d:\\lib\\chromedriver.exe") /* pass system properties: */ systemproperties system.getproperties()} the compile dependencies selenium-java pointing version '2.53.1' the gradle command: clean test aggregate i cannot figure out wrong since did nothing else updating ide. maybe has hint? thanks in advance, martin i ran same problem when following example in article mentioned in comment. in case (without using ide) seemed out-of-date dependency (which renamed). try changing dependency

css3 - CSS cogged right border -

having situation described in image , need find solution such border using css-only, if possible. height not fixed, can variable. , border should start , end shown. , there border wavy line. red color on screen show how works. i need work on ie9+. ie 9+ difficult, since border-image property won't work here... if can withour proper endings, can use border-color in combination background image, y-repeated , right aligned.

javascript - Drag-and-drop from div with scrollbars - overflow-y scroll VS overflow-x visible -

i've set jquery drag-and-drop div div , works fine. however, source div exceeds screen's height needed add vertical scrollbar it. here's run trouble infamous overflow-y issue. the div needs have overflow-x: visible in order dragged elements visible moved target div. but, when add overflow-y: scroll or overflow-y: auto source div, overflow-x doesn't work anymore. i have been w3 , few stackoverflow questions, , realise not bug intended behavior (although why intended beyond me). however, haven't found solution works me. i've tried adding wrapper div source div answers suggested, , doing following: .wrapper { width: 100px; position: absolute; top: 4vw; left: 0; bottom: 4vw; overflow-y: auto; } .source { position: relative; overflow: visible; z-index: 2; } <div class="wrapper"> <div class="source"> <!-- draggable elements go here --> </div> </div> &

mysql - Getting all table names which contains a specific keyword inside itself -

i'm facing small problem, have database has 180 tables in it. going through of them 1 one wasting time. hence, thought i'll turn here help. the problem facing, want search specific keyword tables , columns. lets got database d tables t1, t2 , on, tables have different column names , string want see must like '%connect%' . --edit: clarify, %connect% must inside table contents (i.e. inside row of table). if not possible single query, maybe can point me right direction how programmatically. many , best regards, janno table's names: select t.table_name information_schema.tables t t.table_name '%connect%'; column's names: select column_name information_schema.columns table_schema = 'my_database' , table_name = 'my_table';

softlayer - SoftLayer_Hardware_Server : Error Creating hardDrives larger than 500 GB -

i need create hardware server 1 tb of harddisk, when call code: $client = \softlayer\soapclient::getclient('softlayer_hardware_server', null, $apiusername, $apikey); $call = $client->getcreateobjectoptions(); i see 1 option 500 gb capacity under: harddrives. ( [itemprice] => stdclass object ( [hourlyrecurringfee] => 0 [recurringfee] => 0 [item] => stdclass object ( [description] => 500 gb sata ) ) [template] => stdclass object ( [harddrives] => array ( [0] => stdclass object ( [hardwarecomponentmodelid] => [hardwareid] => [id] => [modifydate] => [serviceproviderid] => [capacity] => 500 ) ) ) ) how can create hard disk 1 tb ? using softlayer_hardware_server::createobject method can not it, can use configuration displayed softlayer_hardware_server::getcreateobjectoptions method. the way use softlayer_product_order::placeorder method method control portal uses order, drawback is not easy c

css - Formatting and load times -

i have been reading bit on compressed , uncompressed css files, haven't seen talk specific formatting in css file. should group things this: .class1, .class2, .class3, .... { color: [color]; background: [image/color]; .... } or better keep them seperated, this: .class1 { color: [same color]; .... } .class2 { color: [same color]; .... } does affect load time in way? personal preference?

android - number of active threads keeps increasing -

i using executorservice excecute 1 task @ time using code ` executorservice=executors.newsinglethreadexecutor(); and using thread.activecount() number of active threads whenever submit runnable task executorservice number of active threads incremented 1 ,how possible ? thought newsinglethreadexecutor() allows executing 1 task @ time , why number of threads keeps increasing? ,i mean shouldn't number of threads increases 1 , not more? note using future cancel execution of runnable before submitting new task , works fine ,all runnables interrupted number of active threads keeps increasing. edit: code call whenever press on button (worker class implements runnable) private void handle() { executorservice=executors.newsinglethreadexecutor(); worker worker=new worker(); future=executorservice.submit(new worker()); } each time call it cretes new executor. each single threaded executor has own thread. if want multiple jobs on executor call newsingl

C# picturebox brings up Red X -

i trying zoom image. here code. @ times red x box comes up. unable resolve this. great if me this. private void radbtnzoomin_click(object sender, eventargs e) { try { m_presentangle = 0; gc.collect(); image originalimg = system.drawing.image.fromfile(m_filepath); originalimg.selectactiveframe(system.drawing.imaging.framedimension.page, m_intcurrpage); if (originalimg != null && m_zoominpresentpercent < 500) { int zoompercentrequired = 0; if(m_zoominpresentpercent >=100) { zoompercentrequired = m_zoominpresentpercent + 100; } else { zoompercentrequired = m_zoominpresentpercent + 20; } cbzoompercentage.text = zoomper

xamarin.android - Xamarin replace image imageview resource in listview -

i'm beginner in xamarin. have listview, there 1 textview , 1 imageview in each row. wrote adatpter it, activity, everything. goal is, when click item in listview, image changes other one. data class: class otherlabellistdata { private string otherlabel; private int image; public otherlabellistdata(string otherlabel, int image) { this.otherlabel = otherlabel; this.image = image; } public string otherlabel { { return otherlabel; } } public int image { { return image; } } } here holder class: class otherholder { public textview labeltxt; public imageview iconimg; public otherholder(view itemview) { labeltxt = itemview.findviewbyid<textview>(resource.id.othermessagelabel); iconimg = itemview.findviewbyid<imageview>(resource.id.otherlabelicon); } } adapter: class otherlabellistadapter : baseadapter<otherlabellistdata> { private javalis

javascript - getting the size of a content box with javascriptHey -

this question has answer here: why jquery or dom method such getelementbyid not find element? 6 answers i trying width of content box following comand: var box = document.getelementbyid('player'); var boxsize = box.clientwidth; it seems return something. when alert it gives out number. still throws error: uncaught typeerror: cannot read property 'clientwidth' of null what happening here? var box = document.getelementbyid('player'); if(box){ var boxsize = box.offsetwidth; }

Java split and replace -

i have following string string path = "(tags:homepage).(tags:project mindshare).(tags:5.5.x).(tags:project 5.x)"; i used following code, string delims = "\\."; string[] tokens = path.split(delims); int tokencount = tokens.length; (int j = 0; j < tokencount; j++) { system.out.println("split output: "+ tokens[j]); } current output split output: (tags:homepage) split output: (tags:project mindshare) split output: (tags:5 split output: 5 split output: x) split output: (tags:project 5 split output: x) end goal convert string string newpath = "(tags:homepage)(tags:project mindshare)(tags:5.5.x)(tags:project 5.x)"; you can use positive lookbehind achieve : string path = "(tags:homepage).(tags:project mindshare).(tags:5.5.x).(tags:project 5.x)"; string newpath = path.replaceall("(?<=\\))\\.", ""); // periods preceeded `)` system.out.println(newpath); o/p : (tags:homepage)(tags:pro

Unable to detect duplicate using mysql and rename the string -

i have schema account follows : accountid | filename if filename repeats want store as: filename.txt filename1.txt filename2.txt filename3.txt i doing checking number of duplicates running query check number of duplicates , renaming filename in backed , running insert query. can whole procedure can done in 1 query ? you can in single query: select t.id, t.account, z.dupcount filename join (select account, count (*) dupcount filename group account having count(*) > 1) z on z.account = t.account order dupcount desc

jquery - Drag and Drop photo preview is not worikng -

Image
photo preview not working ,please me //single photo upload box click //keyvalpimage stores box image in array $(".dzq-img-box ") .on( 'click', this, function() { $('<input type="file" name="files[]" />') .click() .on( "change", function(event) { event .stopimmediatepropagation(); var files = !!this.files ? this.files : []; if (!files.length || !window.filereader) { return false; // no file selected, or no filereader support } if (/^image/ .test(files[0].type)) { // image file var reader = new filereader(); // instance of filereader reader .readasdataurl(files[0]); // read local file reader.onloadend = function() { // set image data background of div $('.dzq-img-box') .each( function(

javascript - Get the index of div that has not a common class Jquery -

hello wanted index of div doesn't have class "already" code. $('#slotmachine #slotmachine2 div.combi:not(.already):first').index(); this html code. <li id="slotmachine2"> <div class="combi already" data-id="17">john4654</div> <div class="combi already" data-id="18">john4015</div> <div class="combi" data-id="19">john1235</div> <div class="combi already" data-id="20">john0454</div> <div class="combi already" data-id="21">john1254</div> <div class="combi already" data-id="22">john0014</div> <div class="combi already" data-id="23">john1387</div> <div class="combi already" data-id="24">john2478</div> <div class="combi" data-id="25">john8475</div> <div class