Posts

Showing posts from May, 2014

matrix - Camera PreviewView is streched in some android devices -

right im playing api2 camera of google , im having problems code. had 2 different camerasessions, 1 video , 1 images. more efficient change code use unique session , make app more efficient. after this, camera preview not working adequately. when im using 4:3 aspect ratio preview become streched @ height. in other way looks fine when im using 16:9 ratio. in both cases pictures looks fine, mean, preview doesnt work correctly pictures taked, have correct aspect ratio. i check different post same problem: camera preview stretched on few android devices camera display / preview in full screen not maintain aspect ratio - image skewed, stretched in order fit on screen but different answers didnt me. know problem inside onmeasure() , settransformmatrix() or onlayoutchangelistener() methods, dont know iḿ doing wrong. ignore code rotation, right dynamic. enter @ else condition. here code: private onlayoutchangelistener mlayoutlistener = new onlayoutchangelistener() { @ov...

javascript - How to setup simple static server where path '/' points to index.html within dirrectory? -

there might simple solution question, not able find answer online , due practice node can't figure out either. i'm trying set simple server.js file listens on port 80 , serves /dist/index.html file when users enter root address, example.com this project structure dist/ index.html bundle.js node-modules/ package.json server.js you can create static server express : server.js var express = require('express'); var app = express(); app.use(express.static(__dirname + '/dist')); app.listen(8080, function() { console.log('listening on port: ' + 80); }); you run node server.js static server. app can deployed.

Special characters in R plots -

i have code in use plot(1, 1, type="s", ylab="log â„“") that equivalent to plot(1, 1, type="s", ylab="log \u2113") produces nice slanted l representing likelihood in y-axis . why capital script version of l (\u2112) gives me box in place of l? i'm running r on mac.

dictionary - Building up a list of dictionaries from a few lists in Python -

i have few lists this: pargs = [args.pee, args.pem,...,args.pet] # 9 elements of boolean type indices = [(0,0),(0,1),...,(2,2)] # 9 possible combinations (i,j), = 0,1,2; j = 0,1,2 d = [{},{},...,{}] # 9 dictionaries, desired result the result want see should this: d = [{event:args.pee,i:0,j:0},{event:args.pem,i:0,j:1},...{event: args.pet,i:2,j:2}] the dictionaries must ordered shown above. i tried for d in d: in range(3): j in range(3): d['i'],d['j'] = i,j but not trick. i've tried numerous algorithms zip(),product(),dict(), no avail... with comprehension , ordereddict , demo: from collections import ordereddict pargs = ['arg1', 'arg2', 'arg3', 'arg4', 'arg5', 'arg6', 'arg7', 'arg8', 'arg9'] indices = ((x,y) x in range(3) y in range(3)) result = [ordereddict([('event',p), ('i',i), ('j',j)]) p,(i,j) in zip(pargs, indices...

python 3.x - Python3 split character list into words from a template -

i'm having problems after mixed language text segmentation, not sure how go doing this. "template": '新闻 wang arrange soon. 在电视' segmentation output: '新闻 w n g w l l r r n g e s o o n. 在 电视' the desired output is: 新闻 wang arrange soon. 在 电视

Rails 4 Inventory Application: database design and use of nested forms -

i built application , works nicely , quite simple: https://github.com/ornerymoose/devicecount . allows create new entry device specify count (ie, inventory amount) of device. now though works, i've been told needs on 'per location' basis. ie, create entry , have 10 textfields (if there indeed 10 devices. amount never change nor devices change) devices, , each device text field, enter count device. choose location dropdown menu. when entry created, have: -1 location -10 devices listed, own count. i'm struggling wrapping head around how design these models. should have entry , device model? separate count model? would nested form best approach here? any , input appreciated. sounds you'd best inventory join model (with has_many :through ): #app/models/inventory.rb class inventory < activerecord::base # id | device_id | location_id | qty | created_at | updated_at belongs_to :device belongs_to :location end #app/models/device....

python - String preprocessing -

i'm dealing list of strings may contain additional letters original spelling, example: words = ['whyyyyyy', 'heyyyy', 'alrighttttt', 'cool', 'mmmmonday'] i want pre-process these strings spelt correctly, retrieve new list: cleaned_words = ['why', 'hey', 'alright', 'cool', 'monday'] the length of sequence of duplicated letter can vary, however, cool should maintain spelling. i'm unaware of python libraries this, , i'd preferably try , avoid hard coding it. i've tried this: http://norvig.com/spell-correct.html more words put in text file, seems there's more chance of suggesting incorrect spelling, it's never getting right, without removed additional letters. example, eel becomes teel ... thanks in advance. if download text file of english words check against, way work. i've not tested idea. iterates through letters, , if current letter matches last...

powershell - cd ~ Throws error while PWD is in Regisrty -

cd ~ throwing below error . ps hklm:\> cd ~ cd : home location provider not set. set home location, call "(get-psprovider 'registry').home = 'path'". @ line:1 char:1 + cd ~ + ~~~~ + categoryinfo : invalidoperation: (:) [set-location], psinvalidoperationexception + fullyqualifiederrorid : invalidoperation,microsoft.powershell.commands.setlocationcommand why ? this error gets thrown because in registry , default doesn't have home directory. error message explicitly says in order set home directory (even though see no reason to) need call (get-psprovider 'registry').home = 'path'

asp.net mvc - Rendering a partialview from within a helperclass in Umbraco -

i have html used lot in site i'm building. created app_code\helpers.cshtml file , placed helperfunction in file. now, want render partial-view (a mvc view form). can't use @html.partial("myformpartial", new formmodel()) i can't find other ways of rendering partial view within helper class. got idea on how solve this? is seperate helpers.cshtml best way kind of repeating html-code? think gives me bit more freedom in parameters i'm providing, instead of macro's. sucks can't use @umbraco (without creating own helper) or @html :( just pass @html helper function if don't want create inside helper function. nevertheless, isn't better idea use child action , render part of code you'd been shared?

validation - Rails locking a 'completed' 'todo' -

i have todo model title:string, description:text , completed:boolean , 2 self references: children & parents joined todos_todos table (parent_id, child_id). i want prevent todo completed == true being edited unless user passes params[:completed] = false . want prevent children being added todo if it's completed. i know can in controller this: def update ... @todo.find(params[:id]) if params[:completed] == false if @todo.completed == true render :edit ... end ...but i'm not sure that's correct way this. feel should use validation in model this, except can't figure out way compare user's input existing data in model. just use authorization (preferably cancancan ): #gemfile gem "cancancan" #app/models/ability.rb class ability include cancan::ability def initialize(user) user ||= user.new # guest user (not logged in) cannot :manage, todo, completed: true end end #ap...

php - How to create Date format in Nusoap server side? -

i make simple web service using nusoap & php server. in server page want instanciate date object , return client. part of complextype (struct). read solutions soapval() function can not make work. how can return date? //complexlogintype $server->wsdl->addcomplextype('userinfo','complextype','struct','all','', array( 'id' => array('name' => 'id','type' => 'xsd:int'), 'lastname' => array('name' => 'lastname','type' => 'xsd:string'), 'firstname' => array('name' => 'firstname','type' => 'xsd:string'), 'address' => array('name' => 'address','type' => 'xsd:string'), 'position' => array('name' => 'position','type' => 'xsd:string'), 'manager' => array('na...

c# - How to make a GUID column in Orchard's migrations? -

i can make guid column through arcgis , can make uniqueidentifier column in sqlsqrver, orchard wants autogenerate table through migrations.cs . unfortunately, guid column make migration fail, no table created. tried decorate column in model [databasegenerated(databasegeneratedoption.computed)] , didn't help. using wrong? or need different? make several other tables, prefer avoid bigger changes outside guid column unless necessary. migrations.cs (important parts): public int create() { schemabuilder.createtable(typeof(foorecord).name, table => table .column<int>("id", column => column.primarykey().identity()) .column<guid>("guid", column => column.notnull().unique()) //other columns ); return 1; } model : public class foorecord { public virtual int id { get; set; } [databasegenerated(databasegeneratedoption.computed)] public virtual guid guid { get; set...

Using css only, how to select html elements inside a div/class but exclude some nested div/classes -

here simplified page struture, want select images inside "page"-div , enclosed elements, not in either "keepoffa" or "keepoffb". <!doctype html> <html lang="en"> <body> <div class="page"> <img/> <!-- ok --> <div class="keepoffa"> <img/> <!-- never take this--> </div> <div class="keepoffb"> <img/> <!-- never take this--> </div> <img/> <!-- ok --> <div class="subpage"> <img/> <!-- ok --> <ul> <li> <img/> <!-- ok --> </li> </ul> </div> <ul> <li> <img/> <!-- ok --> </li> </ul> <div> </body...

css - Change the div or the contents of the div? -

the page referring one: http://www.plummerwigger.albanystrategicmarketing.com/ i'm trying move "current clients” section @ bottom , right of div includes seal, paragraph , news (i.e.: current clients on right, else on left. currently, i’m using 60% on div holding text in left side. i’m guessing contents. i’ve been trying move "current clients" right of first column. i’ve fooled width, padding , margin, align, , quite few other elements. assistance appreciated. thanks. bam for class entry-content add following css: display: flex; this solves problem. for more detail check post: how place div side side more details flex here

cordova - How to create a Ionic 2 android application with the same angular 2 website ? -

hello have question ionic 2 , angular 2 can convert angular2 website ionic 2 android application same components , same interfaces , same code ? help please? actually, need cordova: https://www.npmjs.com/package/cordova create cordova app copy app code inside cordova.app/www directory build apk

opencv - How to crop away convexity defects? -

Image
i'm trying detect , fine-locate objects in images contours. contours include noise (maybe form background, don't know). objects should similar rectangles or squares like: i results shape matching ( cv::matchshapes ) detect contours objects in them, , without noise, have problems fine-location in case of noise. noise looks like: or example. my idea find convexity defects , if become strong, somehow crop away part leads concavity. detecting defects ok, typically 2 defects per "unwanted structure", i'm stuck on how decide , should remove points contours. here contours, masks (so can extract contours easily) , convex hull including thresholded convexity defects: could walk through contour , locally decide whether "left turn" performed contour (if walking clockwise) , if so, remove contour points until next left turn taken? maybe starting @ convexity defect? i'm looking algorithms or code, programming language shou...

php - Open SCORM popup in the other screen -

i have implemented scorm in 1 of applications , works perfectly. using 2 screens development purposes , want open scorm pop-up in other screen whereas application on screen one(from request open scorm made). is somehow possible deal it? chrome's had issue bit - popup open position in chrome . also how javascript open popup window on current monitor . you should able use screen left position though work out math. did window appear left of browser window. again, chrome may issue. leftposition = (window.screenleft != undefined ? window.screenleft : window.screenx) - width; topposition = 0; window.open(url, "title", "status=no,height=" + height + ",width=" + width + ",resizable=yes,left=" + leftposition + ",top=" + topposition + ",screenx=" + leftposition + ",screeny=" + topposition + ",toolbar=no,menubar=no,scrollbars=no,location=no,directories=no");

html - Bootstrap image not responsive -

i adding logo using bootstrap etc , background image. i'm not sure if doing right when resize window nav bar self getting smaller image in navbar not. know why? html: <div class="navbar navbar-default navbar-fixed-top" role="navigation"> <div class="container"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <div class="logo"> <img src="image/logo.png"/> </div> </div> <div class="navbar-collapse collapse"> <ul...

sql - Using a Case Statement in a Function -

i having issues piece of query writing- i'm creating indicator field want show '1' if couple of cases satisfied. field built using case statement inside max() function- need function because portion part of cte joined cte turning rows columns , used functions lateralize. max(case when pmod1_pgm in ('ir') , integer(pmod1_pct) <> 0 1 when pmod2_pgm in ('ir') , integer(pmod2_pct) <> 0 1 when pmod3_pgm in ('ir') , integer(pmod3_pct) <> 0 1 when pmod4_pgm in ('ir') , integer(pmod4_pct) <> 0 1 when pmod5_pgm in ('ir') , integer(pmod5_pct) <> 0 1 when pmod6_pgm in ('ir') , integer(pmod6_pct) <> 0 1 else 0 end) @irpm_ind, /*@irpm_pct*/ max(case when pmod1_pgm in ('ir') , pmod1_cd in ('c') pmod1_pct * - 1 when pmod1_pgm in ('ir') , pmod1_cd in ('d') pmod1_...

OneNote API intermittently returns HTTP 400 when querying O365 SharePoint SiteId -

my code calls onenote api resolve sharepoint online site url sitecollectionid , siteid. bearer token, set http auth header , issue request to: https://www.onenote.com/api/v1.0/myorganization/sitecollections/fromurl(url='https://mytenantxyz.sharepoint.com/sites/copynotesite') for approx week, has been returning expected response, similar to: { "@odata.context": "https://www.onenote.com:576/api/v1.0/$metadata#microsoft.onenote.api.sitemetadata", "sitecollectionid": "111e03ac-468c-4a28-9aab-543098ef49bb", "siteid": "555d72a0-f82f-4e4c-ae8a-17ef0ea04f32" } however, today has decided return following in approx 9 out of 10 requests: { error": { "code" : “20158”, "message": "unable sitemetadta url specified in request.", "@api.url": "http://aka.ms/onenote-errors#c20158" } } the microsoft docs ( link ) explain error 20158 as: ...

azure mobile services - What is a good way to insert an entity with dependencies using TableController? -

i struggling insert new entity references other existing entities using table controller in azure mobile services. this set up: entities: public class entityb : entitydata { public entitya parent { get; set; } //some data } public class entitya : entitydata { //some data } dtos: public class dtoentityb : entitydata { public dtoentitya parent { get; set; } //some data } public class dtoentitya : entitydata { //some data } controller: public class controller : tablecontroller<dtoentityb> { public virtual async task<dtoentityb> post(dtoentityb entity) { return await insertasync(entity); } } mapper: automapper.mapper.initialize(cfg => { // use other mapper cfg.createmap<dtoentityb, entityb>(); cfg.createmap<entityb, dtoentityb>(); cfg.createmap<dtoentitya, entitya>(); cfg.createmap<entitya, dtoentitya>(); } entitya exists already, make client call results in json sent post ...

java - How can I create a JUnit test to test CompareTo? -

in code have 2 static methods. 1 using compare contents of 2 arrays of int's, , 1 comparing contents of 2 arrays of strings (in same order). how can structure junit test 1 of these methods? i'm thinking use edit** created test works not accurate. //edited test, passes isn't correct. public class arraycomparertests { @test public void testintarray() { // arraycomparer arraycomparer = new arraycomparer(); int[] list1 = {2,2,3}; int[] list2 = {1}; assertequals(false, arraycomparer.compareintarrays(list1, list2)); } } public class arraycomparer { public static boolean compareintarrays(int[] list1, int[] list2) { // checks same array reference if (list1 == list2) { return true; } // checks null arrays if (list1 == null || list2 == null) { return false; } // arrays sho...

android - ionic/cordova error code 1, error building one of platforms -

Image
ok have installed: nodejs v 5.4.0 (latest) ant v 1.9.6 (latest) java v 1.8.0_71 (latest) git v 2.7.0 (latest) ionic v 1.7.14 (latest) corodva v 6.0.0 (latest) here env variable looks like: ant_home,java_home,android_home variable my path variable im running on windows 10 64bit, keep getting errors both ionic build , cordova build, here log of error (i same build error cordova ): ionic build running command: "c:\program files\nodejs\node.exe" c:\work\boaz\myapp\hooks\after_prepare\010_add_platform_class.js c:\work\boaz\myapp add body class: platform-android add body class: platform-ios android_home=c:\program files (x86)\android\android-sdk java_home=c:\program files\java\jdk1.8.0_65 unzipping c:\users\boaz\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiejfej094b\gradle-2.2.1-all.zip c:\users\boaz\.gradle\wrapper\dists\gradle-2.2.1-all\2m8005s69iu8v0oiejfej094bexception in thread "main" java.lang.runtimeexception: java.ut...

javascript - Interaction between flex and iframe -

i have flex application , there iframe(html code) inside flex app. how trigger event iframe , listen in flex app or call method in flex app js in iframe? need pass info parent flex application. you can use externalinterface ( http://help.adobe.com/en_us/flashplatform/reference/actionscript/3/flash/external/externalinterface.html ) it. for example, call method try: if (externalinterface.available) { externalinterface.call("mymethod", { id: 'somedataid' } ); }

office365 - Onedrive for Business API strategy confusion (Office 365, sharepoint, Skydrive Pro) -

i writing windows desktop software in c# can access microsoft onedrive business. software use access own onedrive business account. looking @ latest online documentation seems azure active directory needed access api have had success without using azure using method similar (although have issues): http://jomit.blogspot.co.uk/2013/03/authentication-and-authorization-with.html my question have use azure ad or above method still expected work? if have use azure needs azure account, me or each user use software? i have downloaded other third party software accesses onedrive business account , did not have azure. want software simple possible users connect onedrive business account. if hosted in sp, not need anything. if hosted externally such o365 apps, need register app in azure ad. applies office 365 apps or apps hosted somewhere. azure ad important authorize apps use office 365, office 365 apps can hosted anywhere.

Google Apps Script - Delay sending an email by 48 hours -

i need delay sending email by 48 hours. i've tried: var mail_date_plus_2 = new date(date.setdate(mail_date+2)) but error: "referenceerror: "date" not defined. (line 26, file "code"). here script: function sendemail() { var ss = spreadsheetapp.getactivespreadsheet(); var data_sheet = ss.getsheetbyname('sheet1'); var values = data_sheet.getrange(2, 1, data_sheet.getlastrow(), data_sheet.getlastcolumn()).getvalues(); var row = 2; var current_time= new date(); logger.log('current data , time '+current_time) for(var v in values) { var mail_note = data_sheet.getrange(row, 1).getnote(); if(mail_note=='') { var mail_date = values[v][5]; if(mail_date!='') { if(current_time>mail_date) { logger.log(v+'>>need send mail @ '+mail_date); var name = values[v][2]; var email = values[v][4]; var form = values[v]...

javascript - specify which button triggered a form submission into an ASP.NET app -

into asp.net mvc aplication, use form several submit buttons. can route them correct controller action way: @using (html.beginform("actionname", "controllername", formmethod.post)) ... <input type="submit" name="submit_button" value="action1" /> <input type="submit" name="submit_button" value="action2" /> then controller: public actionresult validate_form(..., string submit_button) { switch submit_button { ... } } this works perfectly. now d include js action before submitting form. change input submit input button , add onclick event way: <input type="button" name="submit_button" value="action1" class="col-md-2" onclick="jsaction()" /> js function: function jsaction(){ ...my stuff document.getelementbyid('formname').submit(); } and then, when controller validate_form method run, looses ...

text files - Delete lines from multiple textfiles in PowerShell -

i trying delete lines defined content multiple textfiles. it works in core, rewrite every file if no changes made, not cool if modifying 50 out of 3000 logonscripts. made if statement seems doesn't work. alright have: #here $varfind escaped potential regex triggers. $varfindescaped = [regex]::escape($varfind) #here deletion happens. foreach ($file in get-childitem $varpath*$varending) { $contentbefore = get-content $file $contentafter = get-content $file | where-object {$_ -notmatch $varfindescaped} if ($contentbefore -ne $contentafter) {set-content $file $contentafter} } what variables mean: $varpath path in logonscripts are. $varending file ending of files modify. $varfind string triggers deletion of line. any highly appreciated. greetings löwä cent you have read file regardless improvement on change condition help. #here deletion happens. foreach ($file in get-childitem $varpath*$varending) { $data = (get-content $file) if(...

IOCTL Linux device driver -

can explain me, what ioctl ? what used for? how can use it? why can't define new function same work ioctl ? an ioctl , means "input-output control" kind of device-specific system call. there few system calls in linux (300-400), not enough express unique functions devices may have. driver can define ioctl allows userspace application send orders. however, ioctls not flexible , tend bit cluttered (dozens of "magic numbers" work... or not), , can insecure, pass buffer kernel - bad handling can break things easily. an alternative sysfs interface, set file under /sys/ , read/write information , driver. example of how set up: static ssize_t mydrvr_version_show(struct device *dev, struct device_attribute *attr, char *buf) { return sprintf(buf, "%s\n", driver_release); } static device_attr(version, s_irugo, mydrvr_version_show, null); and during driver setup: device_create_file(dev, &dev_attr_version); you have ...

c# - Expression<Func<T1, T2, TResult>> and Sql IN -

i want use expression trees make filters entity framework. so types public class type1 { public string name { get; set; } } public class type2 { public ienumerable<string> names { get; set; } } and specification public expression<func<entities.type1, bool>> myexpression(type2 filter) { //something name in (name[0], name[1], ... name[n]) } i need transform in sql in. how can it, , what's best form? how can make entity framework understand arbitrary expression in way want? you can this: public expression<func<type1, bool>> myexpression(type2 filter) { return x => filter.names.contains(x.name); }

data binding - Setting focus to UI control in WPF MVVM Way on Validation.HasError -

problem: validation.haserror automatically highlights control has error via inotifydataerrorinfo implementation. my problem need set focus on specific control when has error. how do that? i have gone through several articles in stackoverflow , other sites , wish address problem. <style targettype="textbox" > <setter property="overridesdefaultstyle" value="false"/> <setter property="verticalalignment" value="center"/> <setter property="horizontalalignment" value="left"/> <setter property="margin" value="5,3" /> <style.triggers> <trigger property="validation.haserror" value="true"> <setter property="focusmanager.focusedelement...

javascript - Put a promise in a pending state -

i want defer execution of promise, until user input provided. i want post, wait until has happened, this: while (true) { promiseforuserinput = pending; strinput = rl.question("provide input"); //waits user input promiseforuserinput = resolved; var resultofuserschoice = promiseforuserinput.then(function(input) { return loadfromserver(input) }).then(function(serverresponse) { console.log(serverresponse) }); } is possible? need read on factory functions? that have work this: new promise(function (resolve) { document.getelementbyid('my-input').addeventlistener('keyup', function (e) { if (/* input value enough */) { resolve(e.currenttarget.value); } }); }) to input (i'm assuming browser context here), have bind event listener input element , read input element upon decided event. inside promise, , resolve promise you're happy input value. you can .then promise: thepromise.t...

android - How change Table Rows from another method -

i have table rows @ 1st method 2 textviews final tablelayout tl = (tablelayout) findviewbyid(r.id.mainlayout); final tablerow tr = new tablerow(this); tl.setstretchallcolumns(true); tl.setshrinkallcolumns(true); tr.setgravity(gravity.center); tr.setlayoutparams(new tablerow.layoutparams(tablerow.layoutparams.fill_parent,tablerow.layoutparams.wrap_content)); textview textview = new textview(this); textview.settext(nameone); textview.settextcolor(color.black); textview.settextsize(20); textview.setgravity(gravity.start); tr.addview(textview); textview textview2 = new textview(this); textview2.settext(nametwo); textview2.settextcolor(color.black); textview2.settextsize(20); textview2.setgravity(gravity.end); tr.addview(textview2); tl.addview(tr, new tablelayout.layoutparams( tablerow.layoutparams.fill_parent, tablerow.layoutparams.wrap_content)); then trying get/change second textview in row, doesnt w...

modelica - When .. elsewhen equations seems to be reversed in Wolfram Systemmodeler -

when try simple modelica code in wolfram systemmodeler: model bug integer y(start = 1); equation when time > 0.2 y = 5 "y = 2"; elsewhen time > 0.4 y = 4 "y = 3"; elsewhen time > 0.6 y = 3 "y = 4"; elsewhen time > 0.8 y = 2 "y = 5"; end when; end bug; the result 1, 2, 3, 4, 5, this: model bug simulatiom . when-equations seems activated in reverse order. on othe hand, changing "equation" "algorithm", , (of course) "=" ":=" code turns: model nobug integer y(start = 1); algorithm when time > 0.2 y := 5; elsewhen time > 0.4 y := 4; elsewhen time > 0.6 y := 3; elsewhen time > 0.8 y := 2; end when; end nobug; and result expected, 1, 5, 4, 3, 2, this: model nobug simulation is relatively basic problem in wolfram systemmodeler implementation, or there else cannot see?

javascript - Can the following code be shortened into a "ForLoop"? -

is possible shorten following code "for loop" or of sort? appreciated. $('#submit').click(function(){ var baronevalue = $('.barone-value').val(); var bartwovalue = $('.bartwo-value').val(); var barthreevalue = $('.barthree-value').val(); var barfourvalue = $('.barfour-value').val(); var barfivevalue = $('.barfive-value').val(); $('.barone').attr('percentvalue', baronevalue); $('.bartwo').attr('percentvalue', bartwovalue); $('.barthree').attr('percentvalue', barthreevalue); $('.barfour').attr('percentvalue', barfourvalue); $('.barfive').attr('percentvalue', barfivevalue); }); as mentioned in comments, can make function help: function int2word(i){ var map = ["zero", "one", "two", "three", "four", "five", "six", "seven...

actionscript 3 - as3 worker message issue -

i found example on as3 worker: http://esdot.ca/site/2012/intro-to-as3-workers-part-2-image-processing it works great on air 3.4 greater versions stops working, no error, or message. how fix this? and there other example on image prcessing working newer apis. regards there issue workersapi when ran on adl (android debug launcher) kindly check recent post as3 using workers

What DNS Name Label should I give my Azure Virtual Machine? -

Image
in ongoing effort wrap head around azure's new resource group model (see previous questions here , here ), trying create new virtual machine used web server. i have thee questions: question one: assuming want vm host website woodswild.com, dns name label should give vm? matter? know sure needs globally unique. need reflect domain want host (woodswild.com)? question two: do need set dns name @ all? question three: and, i've created it, can still change dns name label "none" something? , if so, how? there no requirement @ either have dns name, or have 1 setting up. have script use creates 1 guid! this follows usual process of assigning setting azure. get-something, assign variable. change property of variable, assigning other value. write change azure using set-something cmdlet. in case little complicated since ultimate structure want looks dnssettings : { "domainnamelabel": "mytestdnsname", ...

angularjs - what and how to do unit test for angular factories -

angular factory great!! while writing unit test, kind of confusing, should write unit test or not. i have following factory: (function(myapp) { myapp.factory('myfirstfactory', function(mysecondfactory){ function myfirstfactory(config){ this.value1 = 'value1'; setdefault(this); } myfirstfactory.dosomething = function(){ var config = { findwork: true; mywork: mysecondfactory.dowork() }; return new myfirstfactory(config); }; return myfirstfactory; }); })(angular.module('mymodule')); so above factory, need write unit test myfirstfacotry , dosomething function? if yes, how can achieve using jasmine , karma.. tried following: describe('myfirstfactory', function() { var mockmyfirstfactory; beforeeach(function(){ module('mymodule'); inject(function(myfirstfactory){ mockmyfirstfactory = myfirstfactory; }); }); it('myfirstfactory should defined', funct...

c++ - What does a pointer to a pointer mean? -

i have seen c++ programs pointer pointer variable i.e **i. mean , why used. cant use single pointer instead of that. difference between single pointer , pointer pointer. please explain each step. thank you. variables take space store. space taken memory. suppose stack (memory) starts @ 0x12 34 56 78 and have integer a value 4 : int = 4; your memory might like: 0x12 34 56 78: 0x00 00 00 04 (a) now suppose have pointer a : int = 4; int* p = &a; your memory like: 0x12 34 56 78: 0x00 00 00 04 (a) 0x12 34 56 7c: 0x12 34 56 78 (p) now suppose have pointer p : int = 4; int* p = &a; int** q = &p; your memory like: 0x12 34 56 78: 0x00 00 00 04 (a) 0x12 34 56 7c: 0x12 34 56 78 (p) 0x12 34 56 80: 0x12 34 56 7c (q) you can q p a following addresses. pointers layer of indirection: specify is, not is.

eclipse - Error while using Spring STS Starter Wizard -

Image
i create lot of spring boot apps , use spring sts starter wizard me going, of sudden today started seeing error window popup every time try open "spring starter wizard". sts version: 3.7.2 here error in popup window. here error see in logs. java.lang.error: java.io.filenotfoundexception: http://start.spring.io 12129 @ org.springframework.ide.eclipse.wizard.gettingstarted.boot.newspringbootwizard.init(newspringbootwizard.java:75) 12130 @ org.eclipse.ui.internal.actions.newwizardshortcutaction.run(newwizardshortcutaction.java:119) 12131 @ org.eclipse.jface.action.action.runwithevent(action.java:473) 12132 @ org.eclipse.jface.action.actioncontributionitem.handlewidgetselection(actioncontributionitem.java:595) 12133 @ org.eclipse.jface.action.actioncontributionitem.access$2(actioncontributionitem.java:511) 12134 @ org.eclipse.jface.action.actioncontributionitem$5.handleevent(actioncontributionitem.java:420) 12135 ...

ios - UIsearchController inside UIViewController using Auto Layout -

Image
has been successful implementing uiviewcontroller contais both uisearchcontroller searchbar , uitableview while laying out using auto layout? i'm trying achieve similar 1password on iphone: fixed searchbar on top of tableview (not part of tableheaderview ). when uisearchcontroller owns searchbar gets activated, searchbar animates show scope buttons , tableview moves down bit. i have got basics of layout working correctly class: // // viewcontroller.m // uisearchcontrollerissues // // created aloha silver on 05/02/16. // copyright © 2016 abc. rights reserved. // #import "viewcontroller.h" @interface viewcontroller () <uisearchresultsupdating, uitableviewdatasource, uitableviewdelegate> @property (nonatomic, strong) uisearchcontroller *searchcontroller; @property (nonatomic, strong) uitableview *tableview; @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; [self setuptableview]; [self setupsearch...

java - Print binary search tree using text -

i want print binary search tree in format: 4 / \ / \ 2 5 / \ / \ 1 3 4 6 i think have depth of tree and, then, each level, print number of spaces before , after each element. public void printtree(bstnode t, int depth) { (int = 1; <= depth; i++){ //then what? } i not know how proceed. the node class: public class bstnode { private int value; private bstnode left; private bstnode right; public bstnode(){ value = 0; left = null; right = null; } public bstnode(int x){ value = x; left = null; right = null; } void setvalue(int x){ value = x; } int getvalue(){ return value; } void setleft(bstnode l){ left = l; } bstnode getleft(){ return left; } void setright(bstnode r){ right = r; } bstnode getright(){ return right; } } one thing's sure: ...