Posts

Showing posts from February, 2012

java : Advantages of anonymous object -

i have 1 class named sample used in code. class sample{ . . object somemethod(){ return someobject; } . . } i call : object ob = new sample().somemethod(); i want know there advantage if create anonymous object of class( new sample() ) , call require method if don't have further use of object. benefits? i assume asking code posted contrasted following: sample s = new sample(); s.somemethod(); (where explicitly assign new sample() local variable). there's no significant performance or memory benefit 1 way or another. if store reference in local variable , invoke method, suppose there may (extremely) small performance penalty storing reference. however, suspect many compilers notice variable dead once method called , optimize away assignment. jit compiler might finish job. we're talking few cpu cycles @ most.

vba - How to transfer highlighted cells in Excel 2007 from one table to another in the same sheet? -

Image
i create code transfer content of highlighted cells 1 table in same sheet content, use button copy content, create macro transfer content dynamically clicking on button, when user change content of highlighted cells of first table content changes automatically in second table or clicking on button again. i use code highlight cells ' set of highlighted cells indexed row number dim highlightedcells new collection ' scan existing sheet cells coloured 'red' , initialise ' run-time collection of 'highlighted' cells. private sub worksheet_activate() activesheet.unprotect password:="p@ssw0rd" dim existinghighlights range ' reset collection of highlighted cells ready rebuild set highlightedcells = new collection ' find first cell has background coloured red application.findformat.interior.colorindex = 3 set existinghighlights = activesheet.cells.find("", _ ...

How to implement Hamburger Icon in Xamarin.Forms MasterDetailPage? -

how implement hamburger icon in xamarin.forms masterdetailpage? there arrow icon. need use masterdetailpage detailpage navigationpage: var masterdetailpage = new masterdetailpage { master = new menupage(), detail = new navigationpage(new yourhomepage()), };

How to read and output Hindi in R console? -

i have been trying read , output hindi .txt file r console gibberish. did far. hindi <- read.table('hindi_text.txt') hindi 1 कà¥à¤¯à¤¾ बोल रहे हो तà¥à¤® then typed this. still not work. > sys.setlocale(category="lc_all", locale="hindi") > [1] "lc_collate=hindi_india.1252;lc_ctype=hindi_india.1252;lc_monetary=hindi_india.1252;lc_numeric=c;lc_time=hindi_india.1252" > hindi > 1 कà¥à¤¯à¤¾ बोल रहे हो तà¥à¤® i tried reading chinese characters changing locale chinese , worked. > chinese <- read.table("chinese.txt") > sys.setlocale(category="lc_all", locale="chinese") > [1] "lc_collate=chinese (simplified)_china.936;lc_ctype=chinese (simplified)_china.936;lc_monetary=chinese (simplified)_china.936;lc_numeric=c;lc_time=chinese (simplified)_china.936" > chinese > 1 锘夸负浠€涔堣繖涓敞鎰忥紝杩欎釜宸ヤ綔 why work chinese , not hindi (and other...

powershell - Test-Connection Performance Better with HostName -

running test-connection ip address takes considerably longer running same command server's hostname. however; if add -quiet parameter performance same (ip fraction faster, may expect). using measure-command anomaly not show up; presumably quirk of output not being displayed. the below code more accurately reflects anomaly seen: $begin=(get-date).ticks;test-connection '123.45.67.89'; $a=((get-date).ticks - $begin) $begin=(get-date).ticks;test-connection 'myhostname'; $b=((get-date).ticks - $begin) $a-$b colleagues have reproduced same issue on machines. question: aware of may cause this? i.e. suspect it's bug (and have reported such), implies there's clever going on powershell may work differently depending on whether output displayed or not / causing quantum-like effect; it's not running commands given in order, doing (de)optimisation under covers. my environment os: ms windows 7 pro sp1 $psversioninfo : name ...

html - Locating tags via styles - using Python 2 and BeautifulSoup 4 -

i trying use beautifulsoup 4 extract text specific tags in html document. have html has bunch of div tags following: <div style="position:absolute; border: textbox 1px solid; writing-mode:lr-tb; left:42px; top:90px; width:195px; height:24px;"> <span style="font-family: fipxqm+arial-boldmt; font-size:12px"> futures daily market report financial gas <br/> 21-jul-2015 <br/> </span> </div> <div style="position:absolute; border: textbox 1px solid; writing-mode:lr-tb; left:54px; top:135px; width:46px; height:10px;"> <span style="font-family: fipxqm+arial-boldmt; font-size:10px"> commodity <br/> </span> </div> i trying text span tags in div tag has style of "left:54px". i can single div if use: soup = beautifulsoup(open(extracted_html_file)) print soup.find_all('div',attrs={"style":"posit...

Create Multi-Parameter Pipeable Function F# -

i want generalize standard deviation function allow calculations of multiples of deviations, still use in context of piping. appears setting function incorrectly. let variance (x:seq<float>) = let mean = x |> seq.average x |> seq.map(fun x -> (x - mean) ** 2.0) |> seq.average let stddeviation (deviations:float, x:seq<float>) = sqrt (x |> variance) * deviations example usage be let stester = seq{1.0 .. 20.0} let stddev = stester |> stddeviation 1.0 i keep getting error: expression expecting have type: seq -> a' here has type float help appreciated. thanks, ~david if change stddeviation takes 2 parameters, rather tuple works: let stddeviation (deviations:float) (x:seq<float>) = sqrt (x |> variance) * deviations let stddev = stester |> stddeviation 1.0 the idea when write let stddeviation (deviations, x:seq<float>) defining function takes single parameter tuple. the way |> operator ...

android - ImageView radius with background -

i have imageview has background. need set border-radius imageview . use below code in xml file , set android:src doesn't work when set background. <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="10dp"/> </shape> how can set background , radius @ same time ? you can set background border-radius xml. <shape xmlns:android="http://schemas.android.com/apk/res/android" > <corners android:radius="10dp"/> <!-- background --> <solid android:color="@android:color/white" /> </shape>

json - New thumbnail size url in WP returning "0" with Angular and WP-API -

i'm working on project using wp-api , angular. i added new custom image size functions.php my /wp-json/posts (the json output) shows url new image size , using url works. http://localhost/mysite/wp-content/uploads/2015/07/6823214-large-600x300.jpg but outputting url angular doesn't work (returns "0") {{house.featured_image.attachment_meta.sizes.blog-thumb.url}} however still works fine (the original sizes): {{house.featured_image.attachment_meta.sizes.medium.url}} {{house.featured_image.attachment_meta.sizes.thumbnail.url}} this might have "-" in name (blog-thumb). tried doing same again using new name (blogthumb) , worked fine! then make sure added new image size called "test-er" , had same issues first time around.

javascript - AngularJS : Factory $http assigning values returning null -

i trying assign variable $http.get() though conf var null despite request going through , returning json. app.factory('config', ['$http', function($http) { return { conf: null, init: function () { if (this.conf === null) { $http.get('/config') .success(function (data) { this.conf = data; }); } } } } ]); this inside success callback function different app.factory('config', ['$http', function($http) { return { conf: null, init: function () { var self = this; if (this.conf === null) { $http.get('/config') .success(function (data) { self.conf = data; }); } ...

c# - what exactly happens when ManualResetEvent.WaitOne is called? -

recently came across msdn link says manualreseteventslim class can used better performance when compared manualresetevent class. "in .net framework 4, can use system.threading.manualreseteventslim class better performance when wait times expected short". https://msdn.microsoft.com/en-us/library/5hbefs30%28v=vs.110%29.aspx please correct me if understanding wrong. when waitone(1000) called 1 sec the windows, apart blocking other threads executing, makes current thread sleep time , wakes when notified. here word blocking means thread sleeps time until notified? what sentence mean - "when wait times expected short"? can suggest websites understand internal process of waitone

c# - Insert using Scope Identity as Attribute -

when creating user , need give system role , wondering best way that. i have working solution, i'm unsure if it's best way. using (sqlconnection con = new sqlconnection(constring)) { con.open(); using (sqlcommand cmd = new sqlcommand(@"insert users (name, email, username, password, active) values (@name, @email, @username, @password, @active); select scope_identity();", con)) { try { cmd.parameters.addwithvalue("@name", user._name); cmd.parameters.addwithvalue("@email", user._email); cmd.parameters.addwithvalue("@username", user._email); cmd.parameters.addwithvalue("@password", user.password); cmd.parameters.addwithvalue("@active", 1); user_id = convert.toint32(cmd.executescalar()); //cmd.executenonquery(); } catch (sqlexception) { //handle exce...

Escaping shell command in git alias -

i have command deletes local branches not in repo anymore, i'm trying add in .gitconfig: git checkout master && git fetch -p && git branch -l | sed 's/* master//' > /tmp/gitlocal.txt && git branch -r | sed 's/origin\///' > /tmp/gitremote.txt && grep -fxv -f /tmp/gitremote.txt /tmp/gitlocal.txt | xargs git branch -d i'm trying put alias, i'm getting escaping problems cleanbranches = "!f() { git checkout master && git fetch -p && git branch -l | sed 's/* master//' > /tmp/gitlocal.txt && git branch -r | sed 's/origin\///' > /tmp/gitremote.txt && grep -fxv -f /tmp/gitremote.txt /tmp/gitlocal.txt | xargs git branch -d; }; f" after trial , error, i've concluded sed 's/origin\///' is making alias break. if remove part, commands executed (but it's deleting every branch, instead of keeping 1 still on repo), , have no errors any on ho...

regex - Text search elements in a big python list -

with list looks like: cell_lines = ["ln18_central_nervous_system","769p_kidney","786o_kidney"] with dabbling in regular expressions, can't figure out compelling way search individual strings in list besides looping through each element , performing search. how can retrieve indices containing "kidney" in efficient way (since have list of length thousands)? make list comprehension : [line line in cell_lines if "kidney" in line] this o(n) since check every item in list contain kidney . if need make similar queries often, should think reorganizing data , have dictionary grouped categories kidney : { "kidney": ["769p_kidney","786o_kidney"], "nervous_system": ["ln18_central_nervous_system"] } in case, every "by category" lookup take "constant" time.

javascript - Referencing a file (module) in Typescript using AMD -

i new typescript , module handling. in project coding in typescript developing browser library. therefore using amd . following tsconfig.json file. { "compileroptions": { "target": "es5", "outdir": "out", "module": "amd" }, "files": [ "src/main.ts", "src/communication.ts", ... ] } file communication.ts is: export module myproj.dataexchange { export interface communication { connect(uri: string): void; close(): void; status: int; } } referencing components other files i want use communication in main.ts : import communication = require('./communication'); export module myproj { export class communicator implements communication.myproj.dataexchange.communication { ... } } i avoid using whole signature communication.myproj.dataexchange.communication . tried like: import communication = require('...

ubuntu - Unknown filesystem type on /dev/mapper/docker-202 -

i attempting build docker image dockerfile. file runs this: from ubuntu:14.04 env debian_frontend noninteractive env home=/home/root env gopath=$home/go env path=$path:/usr/local/go/bin:$home/go/bin run mkdir -p $home run apt-get -y install wget run apt-get -y install git everything works, until installation of wget. appear finish then, straight after "running hooks in /etc/ca-certificates/update.d....done." docker throws following error: info[0032] unknown filesystem type on /dev/mapper/docker-202:1-145547-28276018... the build stops. attempted comment out wget installation, same thing happened upon git installation. commented out entire file, except wget line, worked, strangely enough. doesn't me much, because rest of file kind of important... tried see line problematic one, seems every single command executed before apt-get resulted in failure straight after apt-get. so moved apt-get top of file, , again, worked, next command ( env debian_frontend noni...

architecture - Talend - Get sync with a Zimbra service -

i have develop interface display, in real-time (max : 2min) how many email unread (on zimbra server). i must using talend information zimbra server api. i have looking solution , have found faye, subscribe modifications. problem : how stay sync zimbra in using talend ? can't check each minute, because 4000 users connected in same time , use interface. thanks lot help, ... , sorry english ! john,

ember.js - Get request params within Ember DS.RESTADAPTER -

i have controller looks this: export default ember.route.extend({ model: function(params) { console.log(params); return this.store.query('workspace', {user: ':uid'}); } }); i need rewrite query url in restadapter: export default ds.restadapter.extend({ namespace : 'api', urlforquery: function(query, modelname){ var url = ['api','users', query.user, modelname+'s']; delete query.user; var host = 'http://localhost:8080/'; var prefix = this.urlprefix(); url = url.join('/'); if (!host && url && url.charat(0) !== '/') { url = '/' + url; } return host+url; } }); the problem ember requires dashed params passed such here: {user: ':uid'} so when try access query.user => ':uid' instead of actual value. there way 'controller url params' within adapter parsing...

c++ - standard and efficient map between objects -

Image
i working on clustering problem have called distance matrix . distance matrix like: the number of nodes(g) n (dynamic) this matrix symmetric (dist[i,j]==dist[j,i]) g1,g2,.... object (they contain strings , integers , may more..) i want able reach value simple way dist[4][3] or more clear way dist(g1,g5) (here g1 , g5 may kind of pointer or reference) many std algorithm applied on distance matrix min, max, accumulate ..etc preferably not mandatory, not use boost or other 3rd party libraries what best standard way declare matrix. you can create 2 dimensional vector so std::vector<std::vector<float> > table(n, std::vector<float>(n)); don`t forget initialize this, reserves memory n members, not need reallocate members adding more. , not fragment memory. can access members so table[1][2] = 2.01; it not uses copy constructors time because vector index operator returns reference member; pretty efficient if n not need change.

xml parsing Python reads file incorrectly -

i trying parse xml file online , obtain data need file. code displayed below: import urllib2 xml.dom.minidom import parse import pandas pd import time page = urllib2.urlopen('http://www.wrh.noaa.gov/mesowest/getobextxml.php?sid=kbfi&num=360') page_content = page.read() open('kbfi.xml', 'w') fid: fid.write(page_content) data = [] xml = parse('kbfi.xml') percp = 0 station in xml.getelementsbytagname('station'): ob in xml.getelementsbytagname('ob'): # convert time sting time_struct ignoring last 4 chars ' pdt' ob_time = time.strptime(ob.getattribute('time')[:-4],'%d %b %i:%m %p') variable in xml.getelementsbytagname('variable'): if variable.getattribute('var') == 'pcp1h': percp = true # unindent if want variables if variable.getattribute('value') == 't': data.append([ob_time.tm_mday, ...

javascript - How do you "bypass" mouse up? -

i trying make when user clicks down, happens. in order, does something. (not being specific, isn't important part.) mouse triggered. using: angular, html, css. not using: jquery any suggestions? thanks! you attach 2 event listeners, 1 while user has mouse pressed down mousedown . once user lets go mouseup event triggered. mouse event listeners passed event object can use information event ie: mouse x, , y positions.one of methods available event.preventdefault() stop browser doing wants do. example: cmd/ctrl + s cause browser save html page. preventdefault stop this. document.addeventlistener('mousedown' function (event) { // }) document.addeventlistener('mouseup', function (event) { event.preventdefault() }) to address op comment: var nomouseup = true document.addeventlistener('mousedown', function () { if (nomouseup) { // nomouseup = false } }) document.addeventlistener('mouseup', fu...

ruby - Rails - Convert hours and minutes to seconds then assign value to key -

i combine both values :hours , :minutes , convert them to_i in seconds. next assign value (which should in seconds) :time_duration column in cars db before creates new service . :time_duration in hidden_field because there's no reason render data in view. views this _car_fields.html.erb nested partial inside view template called, _form.html.erb . _car_fields.html.erb <div class="nested-fields"> <div class="field"> <%= f.label :name %><br> <%= f.text_field :name %><br> <%= f.label :hours %> <%= f.select :hours, '0'..'8' %> <%= f.label :minutes %> <%= f.select :minutes, options_for_select( (0..45).step(15), selected: f.object.minutes )%><br> <%= f.label :price %><br> <%= f.text_field :price, :value => (number_with_precision(f.object.price, :precision => 2) || 0) %> <b...

java - How to build the EndPoint correctly using jax-ws? -

i using bootstrap method build endpoints dynamically making wsdl available locally. both http , https, pretty sure going somewhere wrong while building them https. map<string, object> context = ((bindingprovider)control).getrequestcontext(); url address = minstance.getconnectionendpoint(); if (address != null && settings.getsettings().isusinghttpconnection()) { context.put(bindingprovider.endpoint_address_property,address.tostring()); system.out.println(address); } else{ //for https httpsurlconnection.setdefaulthostnameverifier(new hostnameverifier() { public boolean verify(string hostname, sslsession session) { if (hostname.equals("myhostname")) return true; return false; } }); address = minstance.getsecureconnectionendpoint(); context.put(bindingprovider.endpoint_address_property,address.tostring())...

Appending new tag to the existing xml using java -

my source code needs append/add new tags between existing tags xml document have on hard-disk. confused kind of parser need use complete task. xml document have looks similar to: <school> <teacher> <name>xxxxx</name> <gender>xxxx</gender> </teacher> </school> need xml document be: <school> <teacher> <name>xxxxx</name> <gender>xxxx</gender> </teacher> <!--need append student tag--> <student> <name>xxxxxx</name> <gender>xxxxx</name> </student> </school> so, please me in choosing efficient xmlparser in achieving job.also, appreciate if can show me sample source code achieve task. thanks in advance.. if i'm understanding question correctly, i'm assuming you're trying take xml document contains teachers, , teachers, you'd add corresponding students. i'd suggest using dom parser (link @ bottom reference). i...

android - Bubbles like whatsapp, viber, facebook chat -

Image
i trying create chat bubble viber, whatsapp , facebook chat have. please @ screenshot: the last bubble not have arrow. wondering if bubbles 9-patch images or made programmatically. have googled while cannot find image, tho same in many apps (viber, whatsapp). my second question is, how create bottom line in bubbles shows if message has been delivered. imagebutton html.fromhtml() inside (a bottom line)? linearlayout 2 textviews? i searching these ✓✓. viber , whatsapp have same, not seem utf. image maybe? thx. i wondering if bubbles 9-patch images or made programmatically the bubble (with the arrow , without) nine-patches. my second question is, how create bottom line in bubbles shows if message has been delivered. the message status @ bottom of bubble imageview changes no ✓ image 1 ✓ , when message arrived receiver 2 ✓✓ image shown.

Print out Scala worksheet results in interactive mode in IntelliJ -

for reason, intermediate values aren't being printed out in repl console (right hand side of worksheet) for instance, have: object test { val obj = new myobject(1) obj.value } class myobject(x: int) { def value = x } in repl results, following: defined module test . . . defined class myobject however, don't of intermediate results, such when evaluate x.value i expect like: > myobject@14254345 > 1 after x.value any reason why isn't printing out? what ended working me in case (and might particular intellij 14, since i've seen working other way in eclipse) added class inside object block, this: object test { val obj = new myobject(1) obj.value class myobject(x: int) { def value = x } } this forced repl instance inside worksheet auto-evalute result , print them out on right hand side.

android - force left to right on TextView's declaration in the xml -

i have textview might contains both latin letters , rtl language letters. when showing both on same text, doesn't good. how can force textview ltr if have rtl letters ? in xml, , not in code behind. setting text : ((textview) findviewbyid(r.id.card_view_title_label_picker_empty_tv)).settext("גל friend"); here's layout : <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent"> <textview android:id="@+id/card_view_title_label_picker_empty_tv" android:layout_width="match_parent" android:layout_height="wrap_content" android:background="@drawable/label_picker_bg" android:paddingbottom="3dp" android:paddingleft="15dp" android:paddingright=...

excel - This command cannot be used on multiple sections when copying discontinuous range -

while columncount <= lastcolumn if not isempty(mailsheet.cells(2, columncount)) lastrow = mailsheet.cells(rows.count, columncount).end(xlup).row set rng1 = mailsheet.range(mailsheet.cells(1, columncount), mailsheet.cells(lastrow, columncount)) if rng nothing set rng = rng1 else set rng = union(rng, rng1) end if end if columncount = columncount + 1 loop rng.copy worksheets("sheet1").pastespecial xlpastevalues hello, have sheet 45 columns, of have headers. of these columns, ~5 have 2 or 3 values below headers. my code above creates discontinuous range (variable "rng"). want figure out way create "continuous range" i thought using pastespecial command work, seen in other stackoverflow questions (link: copying discontinuous range 1 sheet another ). however, in case, code not run beyond rng.copy line, , returns error: command cannot used on multiple sections u...

java - unit test Spring MissingServletRequestParameterException JSON response -

i have post method in spring boot rest controller follows @requestmapping(value="/post/action/bookmark", method=requestmethod.post) public @responsebody map<string, string> bookmarkpost( @requestparam(value="actiontype",required=true) string actiontype, @requestparam(value="postid",required=true) string postid, @currentuser user user) throws exception{ return service.bookmarkpost(postid, actiontype, user); } now if test missing parameter in postman 400 http response , json body: { "timestamp": "2015-07-20", "status": 400, "error": "bad request", "exception": "org.springframework.web.bind.missingservletrequestparameterexception", "message": "required string parameter 'actiontype' not present", "path": "/post/action/bookmark" } until it's ok, when try unit test don't json resp...

python - scipy.optimize for vector function -

i want minimize function has multiple inputs multible outputs. more specific, call excel calculation , want constrain particular inputs , outputs of function. far managed minimize scalar function meaning multible inputs 1 output. can please guide me if such problem can solved python/scipy? i´d choose x smpkt minimized , smaller particular value. for example code snippets: def f1(x,params): y=f(x) the function f(x) external excel sheet multiple inputs , outputs, output should y=[smpkt,a]. i´d minimize smpkt , keep a smaller constraint choosing x . so far managed minimize y=f(x) y=[smpkt] scalar following call: res = optimize.minimize(f1, x0, args=params, method='cobyla',options={'ftol': 0.1, 'maxiter': 5}) any idea? note: i'm not sure following want do. in particular, "i'd keep variable "a" smaller particular value.", not same "i want choose x a small possible.". it's worth, here...

c# - NHibernate. “Cannot simultaneously fetch multiple bags” with multiple Fetch -

first of should did not familiar nhibernate @ all, project work using orm instead of ef, don't know why. know bug can fixed splitting queries, not have idea how make using nhibernate. here query: query = query.where(c => c.trade.id == tradeid); query = query .fetch(lot => lot.items) .fetch(lot => lot.documents) .fetch(lot => lot.tradelotapplications) .fetchmany(lot => lot.customers) .thenfetch(cus => cus.customer); lots = query.tolist();

php - Facebook not returning User Data in some cases for OAuth 2.0 -

when requesting user data facebook using proper app id , app secret facebook api, in cases providing data required firstname, lastname, email , gender. but of websites no data returned facebook api creates error , customer not able login store through facebook. any ideas? this normal behaviour: data user can choose not divulge when authorises app on facebook. backend need handle cases correctly: choosing default data user or returning error , option try again (using auth_type re-request : https://developers.facebook.com/docs/facebook-login/login-flow-for-web/v2.2#re-asking-declined-permissions )

Java - rewrite a List<List<String>> -

Image
this question has answer here: javafx - move columns in tableview 1 answer i want rewrite list<list<string>> new values. im working tableview (javafx) , when reorder columns, datalist should updated/rewritten. this how table data looks (for example here want exchange first secound column): at example want 1. column has data of scond, , 2. column has data of first... i wrote code, doesnt work: private observablelist<list<string>> fnldata; . . tmplistdata = new linkedlist<list<string>>(); tmplistdata.addall(fnldata); int = 0; (list<string> ls : fnldata){ int j = 0; (string s : ls){ s = tmplistdata.get(i).get(colorder[j]); j++; } i++; } im getting error: when move first time column,nothing happens new column order number correct. second time reorder column, error appears , column ...

scala - How to calculate the mean of a dataframe column and find the top 10% -

i new scala , spark, , working on self-made exercises using baseball statistics. using case class create rdd , assign schema data, , turning dataframe can use sparksql select groups of players via stats meet criteria. once have subset of players interested in looking @ further, find mean of column; eg batting average or rbis. there break players percentile groups based on average performance compared players; top 10%, bottom 10%, 40-50% i've been able use dataframe.describe() function return summary of desired column (mean, stddev, count, min, , max) strings though. there better way mean , stddev doubles, , best way of breaking players groups of 10-percentiles? so far thoughts find values bookend percentile ranges , writing function groups players via comparators, feels bordering on reinventing wheel. i able percentiles using windows functions , apply ntile() , cumedist() on window. ntile() can create grouping based off of input number. if want things groupe...

html - Text Progress bar (Email) -

i developing template email , i'have developed : <table style="border:0;" cellpadding="0" cellspacing="0" width="250"> <tr> <td bgcolor="#f83f83" style="width:50%; background-color:#f83f83; float:left; height:15px;"></td> <td bgcolor="#cccccc" style="width:50%; background-color:#cccccc; float:left; height:15px;"></td> </tr> </table> but dynamic percentage indicated in center of progress bar. have solution make compatible email client quite capricious ? thanks it's tricky centre text on progress bar, because can't put on top of table - position:absolute; won't work on email clients. however, try like: <table style="border:0;" cellpadding="0" cellspacing="0" width="250"> <tr> <td bgcolor="#f83f83" style="width:50%; backgrou...

Can I have multiple local repository for maven? -

in maven settings, there entity refers local repository: <localrepository>~/.m2/repository</localrepository> when add one, this: <localrepository>~/another/place</localrepository> it raises duplicated tag error. can have multiple local repository or maybe add direcotry local repository? yes can have , can in pom.xml itself. below example. <project> ... <repositories> <repository> <id>firstrepo</id> <name>repo</name> <url>http://myrepo.my</url> </repository> <repository> <id>secondrepo</id> <name>repo2</name> <url>http://myrepo.yours</url> </repository> </repositories> ... </project> second method creating profile in settings.xml for multiple local repositories can have multiple settings.xml file. in command line specify alternate path using mvn -dmaven.rep...

ios - Facing issue in implementing horizontal and vertical scrollview using autolayout -

Image
i implementing horizontal , vertical scrollview in application. outer scrollview scrolling vertically , inner scrollview scrolling horizontally. i have set layout shown in below image. now set content size of outer scrollview follows self.outerscrollview.contentsize = cgsizemake(self.view.frame.size.width, self.outerscrollview.frame.size.height); i have set view's width 460 eventhough able scroll screen in iphone4s , iphone5 simulator. not scroll on both of these devices. if temporary remove inner view scrolling not happen. can me why facing problem?

javascript - IE11 issue : xhr.send() is throwing invalid parameter -

i using file api javascript upload files. the utility working fine in chrome , mozilla, in ie getting below exception: script87: parameter incorrect. please find code sample using below: var control = document.getelementbyid('rsfile'); var file= control.files[0]; request.open(method, url); request.send(file);

java - GAE Managed VM with automatic scaling and resources config fails with HttpError 409 -

i'm experiencing following error intermittently while deploying java application appengine using managed vms explicit resource configuration: deployment failed: https://www.googleapis.com/autoscaler/v1beta2/projects/managedvm409example/zones/us-central1-f/autoscalers?alt=json returned "autoscaler resource name exists in zone or there exists autoscaler controlling given target."> deployed version: 1.385892435190233331 here's configuration i'm using: <?xml version="1.0" encoding="utf-8"?> <appengine-web-app xmlns="http://appengine.google.com/ns/1.0"> <application>managedvm409example</application> <version>1</version> <threadsafe>true</threadsafe> <precompilation-enabled>false</precompilation-enabled> <vm>true</vm> <automatic-scaling> <min-num-instances>2</min-num-instances> <max-num-in...

vb.net - Show Combobox selected item in textbox -

public class form1 public selected integer private sub combobox1_selectedindexchanged(byval sender system.object, byval e system.eventargs) handles combobox1.selectedindexchanged select case combobox1.selecteditem case "philippines (php)" selected = 1.0 case "united states(usd)" selected = 45.2 case "japan(jpy)" selected = 0.36 case "canada(cad)" selected = 35.01 case "australia(aud)" selected = 33.34 end select end sub private sub textbox1_textchanged(byval sender system.object, byval e system.eventargs) handles textbox1.textchanged textbox1.text = combobox1.selecteditem end sub end class please dont laugh casually reading basic tutorial in vs2010.. problem here nothing selected item in combobox shows in textbox.. firstly, 'selected' variable wrong type. needs string or double type. string if it's...

powershell - Iterating through a variable line by line -

i have small script outputs text variable. need go through line 1 in order parse it. outputting variable text file , reading using get-content seems bit redundant. my script connects fortigate unit , runs query. it's response i'm looking parse. new-sshsession 10.0.0.138 -port 65432 -credential (get-credential) -acceptkey $command = 'config router policy show' $result = invoke-sshcommand -index 0 -command $command by description, variable string newlines. can turn array of single-line string calling this: $result = $result -split "`r`n"

Python code to ignore errors -

i have code stops running each time there error. there way add code script ignore errors , keep running script until completion? below code: import sys import tldextract def main(argv): in_file = argv[1] f = open(in_file,'r') urllist = f.readlines() f.close() destlist = [] in urllist: print str0 = ch in ['\n','\r']: if ch in str0: str0 = str0.replace(ch,'') str1 = str(tldextract.extract(str0)) str2 = i.replace('\n','') + str1.replace("extractresult",":")+'\n' destlist.append(str2) f = open('destfile.txt','w') in destlist: f.write(i) f.close() print "completed successfully:" if __name__== "__main__": main(sys.argv) many thanks you should...

projection wont work in mongodb c# driver -

i have class executes mongo queries works when send projection in query, projection won't work , mongo return hole document whats matter? query = new querydocument( bsonserializer.deserialize<bsondocument>(querystr)); querystr="{family:'james'},{}" => ok querystr="{},{family:0}" => not ok. return columns, don't want family column remember: want method. not methods. because want send query mongo. i've read mapped mongo objects orms. just want method. thanks did new c# 2.0 driver documentation ? looks projection part of options argument can give findasync private static void find(imongocollection<person> mongocollection) { var query = builders<person>.filter.eq(p => p.name, "bob"); var options = new findoptions<person>() { projection = builders<person>.projection .include(p => p.name) .exclude(p...

java - Two interface have same method name with different return type -

this question understanding interfaces in java. here simple example of implementing interfaces in java. interface parenta { void display(); } interface parentb { int display(); } class child implements parenta, parentb { @override public void display() { system.err.println("child parenta"); } //error : return type incompatible parentb.display() //so added method int return type @override public int display() { system.err.println("child parentb"); } } this case can happen in large java application 2 interface can have method same name. thought since return type different jvm know interface's method overriding. what best explanation this? situation make sense? thanks in advance because method same signature not allowed, confuses compiler detect exact override-equivalent method declared once. jls (§8.4.2) 2 methods or constructors, m , n, have same signature if have, ...

spring - Group toghether Node properties and return as a view in Cypher -

i working v2.2.3 of neo4j , spring neo4j data sdn 4 want return few properties of node using cypher query , map them attributes of pojo.my function in spring data repository looks @query( "match(n:serviceprovider{profilestatus:{pstatus},currentresidencestate:{location}}) return n.name,n.currentresidenceaddress ,n.employmentstatus," + "n.idprooftype,n.idproofnumber order n.registrationdate desc skip{skip} limit {limit}") list<adminsearchmapresult> getserviceproviderrecords( @param("pstatus")string pstatus, @param("location")string location, @param("skip") int skip,@param("limit")int limit); i error like scalar response queries must return 1 column. make sure cypher query returns 1 item. i think because of fact cant bundle returned attributes view can map pojo if return node , map pojo works kindly guide this can done using @queryresult annotate admins...

Change desktop background in C# -

i try change background using c#.example: [dllimport("user32.dll", charset = charset.auto)] private static extern int32 systemparametersinfo(uint32 uiaction, uint32 uiparam, string pvparam, uint32 fwinini); private static uint32 spi_setdeskwallpaper = 20; private static uint32 spif_updateinifile = 0x1; and then systemparametersinfo(spi_setdeskwallpaper, 1, @"c:\background.bmp", spif_updateinifile); } but doesn't work...help? pvparam should local file. not work urls... first download image, give local path systemparametersinfo method. var filename = "4.jpg"; new webclient().downloadfile("http://www.scottgames.com/4.jpg", filename); systemparametersinfo(spi_setdeskwallpaper, 1, filename, spif_updateinifile);

javascript - How to remove hidden element from the array using recursive method -

i using tree structure show types not hidden. deleting type hidden = true which working fine perfectly var filtertypes = function (types) { (var = 0, l = types.length; < l; i++) { var type = types[i]; if (type && !type.hidden) { if (type.text) { type.n = type.text type.id = type.id; } if (type.children) { filtertypes(type.children); } } else { types.splice(i, 1); filtertypes(types); } } return types; }; but not edit data (i.e. types), want create new array non-hidden values. want function provide types data , returns me types not hidden. note:- types structure follow 1 11 111 12 121 13 2 21 211 212 22 221 222 3 31 311 312 32 321 322 suppose 13, 121, 21, 31, 32 hidden should output follows [1,2,3] 1.children should should [11, 12] #as 13 hidden ...

css - Bootstrap navbar x-scroll -

Image
i trying change behaviour of bootstrap navbar inherit horizontal scroll instead of collapsing, works on mobile want same across devices... using sass: .navbar-nav { li { display: inline-block; // stops menu items stacking } } .scroll { white-space: nowrap; overflow-x: scroll; // scroll -webkit-overflow-scrolling: touch; } here image of in mobile view, works great: as increase size of view port , media queries kick in disabled horizontal scroll: and on desktop: html: <div class="navbar-header"> <a class="navbar-brand" href="#"><i class="fa fa-home"></i></a> </div> <ul class="nav navbar-nav scroll"> <li><a href="#">hyperlink</a></li> <li><a href="#">hyperlink</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="...