Posts

Showing posts from March, 2012

excel - Fill in Dates by week? -

is there way fill column week week including weekends? example: a2 = 12/04/2015 a3 = 19/04/2015 a4 = 26/04/2015.... my current code follows: sub filldates() sheet1.range("a2") .value = dateserial(2015, 4, 12) .autofill .resize(1102, 1), xlfilldays end end sub i have tried code weekdays, months , individual days doesn't satisfy want, there way fill each corresponding cell in column weekly dates? if put sunday's date in a2 , next sunday's date in a3 select a2:a3 , fill down, there sunday's dates filled because there ever 7 days difference between sundays , default fill behavior fill series difference of selected cells. sub filldates() sheet1.range("a2") .value = dateserial(2015, 4, 12) .offset(1, 0).value = .value + 7 .resize(2, 1).autofill destination:=.resize(1102, 1) end end sub

css - Pure JavaScript - how to add class to a class? Or change style in class -

i have several classes named .tag on click/mousedown action want either change clear:both clear:none on .tag items. or add class .clearnone { clear:none; } tags. what i've tried far without luck: function mousedown(e) { window.addeventlistener('mousemove', sizepanel, true); // using id works var tagscol = document.getelementbyid("tags-col"); tagscol.classlist.add("width100"); // using class not var tag = document.getelementsbyclassname("tag"); tag.classlist.add("clearnone"); }; css .tag { overflow: hidden; float: left; position: relative; margin: 0 10px 10px 0; padding: 5px 10px; width: auto; cursor: pointer; clear: both; @include rounded(4px); } .clearnone { clear: none; } how accomplish this? note there hundreds of .tag 's don't that. instead, add marker classname common ancestor element, use css rule: .someclassname .tag { ...

debugging - How to set a breakpoint on inline JavaScript in Chrome Dev Tools? -

here example code: <a href="javascript:void('add media')" onclick="ckeditor.tools.callfunction(19,this);return false;"> is there way set breakpoint when click fire off callfunction debugger kicks in? tried editing inline function , prepend debugger; debugger behaves weirdly , doesn't step thought would. you can put debugger inline: <a href="javascript:void('add media')" onclick="ckeditor.tools.callfunction(19,this); debugger; return false;">

Why do 3 and x (which was assigned 3) have different inferred types in Haskell? -

this question has answer here: what monomorphism restriction? 1 answer type inference in haskell has bit of learning curve (to least!). way start learning simple examples. so, following bit of "hello world" type inference. consider following example: prelude> :t 3 3 :: (num t) => t prelude> let x = 3 prelude> :t x x :: integer the question thus: why 3 , x have different types? link summary: read answers below full story; here's link summary: ghc type defaulting: haskell report section 4.3.4 ghci's extended type defaulting: using ghci section 2.4.5 monomorphic restriction: haskell wiki there's factor here, mentioned in of links acfoltzer includes, might worth making explicit here. you're encountering effect of monomorphism restriction . when say let x = 5 you make top-level definition of variable . mr...

android - Set borders for an expanded group item using ExpandableListView -

Image
i'm trying find way of creating material-styled expandablelistview , , i'm using example located @ material design website . example i'm following is: i'm trying replicate borders appear @ top , bottom of group when group expanded, don't know start. can help?

tsql - MERGE vs DROP Table and Rebuild Indexes in SQL Server -

i have "log shipped" copy of database lives @ third party. log shipping runs every 15 minutes @ time connections database dropped. database used reporting purposes. i have decided pull of data log shipped (read only) database new database refreshed nightly. allow users connect new database without risk of loosing connectivity due log shipping. (it allows more granular security permissions used, since read-only copy can't edited) i can think of 2 patterns accomplish this. drop table, create table, create indexes use merge statement insert/update/delete records i have implemented solution using method 1 above, , works fine. it feels bit heavy me drop of data every day. there side effects method 1 above should push me on using method 2? to provide sense of scale, syncing 3 tables, table 1 - 38 columns - 13,110 rows table 2 - 82 columns - 17,421 rows table 3 - 22 columns - 249 rows the resulting database ~1.3 gb. (there other tables in there well)...

ios - CloudKit - Storing multiple CKReferences in a CKRecord -

in app, have record type (useractivity) stores images user wants save profile. record type contains single attribute - ckreference record type (recordtypea example). works perfectly...i'm able store , retrieve data via references construct images , display appropriately on screen. however, realized need add second attribute useractivity record type, ckreference different record type (call recordtypeb). record type b second kind of image needs separately identified. each row in useractivity have 1 of 2 possible ckreferences, not both. i can save new recordtypeb reference no problem, have couple of issues result. first, when save it, whether through code or ckdashboard, record shows title "no name" because there nothing attribute recordtypea. originally, record names ref:followed-by-recordid. works did if ua record has reference recordtypea. there way make create record name recordtypeb reference only? possible should change ckreference list have 2nd attribute? second...

scala - Using SprayJson when json fields are optional -

i writing scala restful api , using sprayjson parse json being passed in during post call. example, have json structure looks this: {"a", "b", "c", "d", "e", "f", "g", "h"} fields a, b, c , h required others not. have custom json formatter case class. various reasons, way need structure case class requires me custom json formatter. here code snippet of read function in formatter: def read(value: jsvalue) = { value.asjsobject.getfields("a", "b", "c", "d", "e", "f", "g", "h") case seq(jsstring(a),jsstring(b),jsstring(c),jsstring(d),jsstring(e),jsstring(f),jsstring(g),jsstring(h)) new object(a,b,c,d,e,f,g,h) case _ => throw new deserializationexception("object expected") } how can implement above without having numerous case strings matching every possible permutation of fields may come...

regex - Python get the smallest words between two characters -

how find smallest string between 2 characters in python. tried extract words between [[ , ]] , put them list: clause_text ="bien_id [[bien_id.name]] dossier [[dossier_id.name]] " list_variables = re.findall(re.escape("[[")+"(.*)"+re.escape("]]"),clause_text) print list_variables in case need 2 variables on list bien_id.name , dossier_id.name but result 1 variable: [u'bien_id.name]] dfdfdf [[dossier_id.name'] it means takes biggest word between brackets.can me please solve problem? you looking non-greedy regex. use (.*?) instead of (.*)

angularjs - Angular optional params cause "%3F" to be added to url if there is a trailing "/" -

i running weird error angular router. of routes have optional parameter , when user adds trailing / url "%3f"(asci code ?) added url @ end of optional parameter. 1 of routes behaves way written as: when('/:classification?/package/compare', { name: 'public-package-compare', templateurl: '/pages/marketing/packages/compare', controller: 'packagecomparecontroller' }) when visit "/us/package/compare" or "/package/compare" brought correct url if visit "/us/package/compare/" brought "/us%3f/package/compare" not valid route(this breaks app). i know few ways hack work wondering if there established angular way deal this. know can double routes , add ones / on end or add routeinterceptor wondering best way solve issue is. using angular version v1.3.0-rc.2 , using standard router. in advance time. this angular issue , this pull request seemed have fixed issue. unfortunately f...

Mac OSX objective-c NSString memory leaking with ARC -

Image
today i've tested around nsstrings . sadly have serious memory leak when run code (xcode instruments showing me that): - (ibaction)start:(id)sender { while (true) // yes know infinity loop { nsstring *test = [[nsstring alloc] init]; test = [nsstring stringwithformat:@"llalalallalalallalalalalallalalllallalalallalal"]; test = nil; // why leak memory ? think arc releasing automatically ? } } here's screenshot of instruments: could me please me understand why code leaking (arc on)? the memory in autorelease pool, memory reclaimed when pool drained. when run loop cycles in tight loop run loop never chance pool needs explicitly drained. in situation inside toe loop add autorelease pool: @autoreleasepool { code } in case: while (true) // yes know infinity loop { @autoreleasepool { nsstring *test = [[nsstring alloc]init]; test = [nsstring stringwithformat:@"llalalallalal...

google chrome - Iphone iOS 6 Image corruption in skysphere -

Image
using code from https://vr.chromeexperiments.com/ any ideas why i'm getting strange scanline effect iphone 6 chrome/safari? any size jpg or png, doesn't matter. tried setting minfilter , magfilters nearest. it's fine on android , pc (all browsers) code: var light = new three.ambientlight(0xffffff); light.position.set(0,0,0); scene.add(light); skysphere = new three.mesh( new three.spheregeometry(160, 100, 100), new three.meshbasicmaterial({ color:0xffffff }) ); scene.add(skysphere); var texture = three.imageutils.loadtexture( "an_image.jpg" ); \\same problem or without setting filters texture.magfilter = three.linearfilter; texture.minfilter = three.nearestmipmaplinearfilter; skysphere.material.map = texture; \\i've tried , setting scale x -1 skysphere.material.side = three.backside; skysphere.mate...

java - Local JMX invokation fails with ClassCastException -

i'm trying invoke jmx service locally using following simple code below. works fine jconsole, under command line throws exception on last line of pasted code. string serviceurl = "service:jmx:rmi:///jndi/rmi://localhost:" + configuration.getjmxport(); string[] credentials = new string[]{configuration.getusername(), configuration.getpassword()}; map<string, string[]> attributes = new hashmap<string, string[]>(); attributes.put("jmx.remote.credentials", credentials); jmxserviceurl jmxurl = new jmxserviceurl(serviceurl); jmxcon = jmxconnectorfactory.connect(jmxurl, attributes); the stack trace looks this: java.lang.classcastexception: com.sun.jndi.rmi.registry.registrycontext cannot cast javax.management.remote.rmi.rmiserver @ javax.management.remote.rmi.rmiconnector.narrowjrmpserver(rmiconnector.java:1897) @ javax.management.remote.rmi.rmiconnector.findrmiserverjndi(rmiconnector.java:1892) @ javax.manageme...

What is the wrong with my c# code -

error server error in '/kibritak3' application. invalid column name 'name'. invalid column name 'phone'. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.data.sqlclient.sqlexception: invalid column name 'name'. invalid column name 'phone'. source error: an unhandled exception generated during execution of current web request. information regarding origin , location of exception can identified using exception stack trace below. stack trace: its come if write code ** if (literal1.text == "data inserted successfully") { response.redirect("http://localhost:1038/kibritak3/companyhomepage.aspx"); } else { txtname.text = ""; txtemail.text = ""; txtphone.text = ""; } ** ,...

java - doEval() With Multiline String Argument -

using groovy 2.3.6, gmongo 1.2, java 1.8, mongodb 3.0.0... i'm trying use doeval() count of documents in collection. (for various reasons want use doeval() rather count() ). invoking doeval() single line string argument returns retval double value of 1.0 , ok double value of 1.0 expect: def str = "db.configurations.count({name: 'mike'})" database.doeval(str) if argument on multiple lines retval returned null (ok 1.0). def str = "db.configurations.count({\nname: 'mike'\n})" database.doeval(str) i expect doeval return retval of 1.0 not null, in first example. bug or expectation incorrect? should doeval() support multiline string argument? from doeval() javadoc: evaluates javascript functions on database server. useful if need touch lot of data lightly, in case network transfer bottleneck. parameters : code - string representation of javascript function args - arguments pass javascript functio...

python count number of unique elements in csv column -

i'm trying counts of unique items in csv column using python. sample csv file (has no header): ab,asd ab,poi ab,asd bg,put bg,asd i've tried far. import csv collections import defaultdict, counter input_file = open('results/1_sample.csv') csv_reader = csv.reader(input_file, delimiter=',') data = defaultdict(list) row in csv_reader: data[row[0]].append(row[1]) k, v in data.items(): print k print counter(v) this gives output in format: ab counter({'asd': 2, 'poi': 1}) bg counter({'asd': 1, 'put': 1}) but want output like: ab:2 bg:2 total_unique_count:3 #unique count of column[1], irrespective of data in column[0] you're looking seriesgroupby method nunique : in [11]: df out[11]: 0 1 0 ab asd 1 ab poi 2 ab asd 3 bg put 4 bg asd in [12]: g = df.groupby(0) in [13]: g[1].nunique() out[13]: 0 ab 2 bg 2 name: 1, dtype: int64

ios - Draw UIBezierPaths in UIView without subclassing? -

i'm brand new using uibezierpaths draw shapes. of examples have found far involve first subclassing view, overriding drawrect: method , doing drawing within there, haven't been able find says absolute certainty whether way draw uibezierpaths within uiview, or if pragmatic way. is there other way (besides swizzling) draw uibezierpath in uiview without subclassing it? another way draw bezier paths without using drawrect use cashapelayers. set path property of shape layer cgpath created bezier path. add shape layer sublayer view's layer. uibezierpath *shape = [uibezierpath bezierpathwithovalinrect:self.view.bounds]; cashapelayer *shapelayer = [cashapelayer layer]; shapelayer.path = shape.cgpath; shapelayer.fillcolor = [uicolor colorwithred:.5 green:1 blue:.5 alpha:1].cgcolor; shapelayer.strokecolor = [uicolor blackcolor].cgcolor; shapelayer.linewidth = 2; [self.view.layer addsublayer:shapelayer];

How to add an incremental count (version) to a string (file) in Excel/VBA? -

i have tried lot of different things, , seems cannot work. basically, small piece of complete code. using microsoft scripting runtime save file, using fileexists() check if file exist before saving. working fine if remove if-statement/loop. however, feels fileexists won´t find string, myfilepath , when run if/loop. (getdirsubparentpath function) dim week, username string dim myfile, myfilepath string dim version integer ' current week, xx week = format(date, "ww") ' username, e.g. niclas.madsen username = environ$("username") ' initials, first letter of last , surname caps ' e.g. niclas.madsen nm username = ucase(left(username, 1) & mid(username, instr(username, ".") + 1, 1)) ' fix filename saving purpose myfile = replace(replace("supplierorganization_w", "", ""), ".", "_") _ & "" _ & week _ & " " _ & u...

html - how do I get a table width to stay with in its container? -

how table width stay within container? .outersection:nth-child(4) .innersection:nth-child(1) .sectiondata:nth-child(1) table{ margin:15px 15px 20px 15px; width:100%; max-width:100%; } the table not overflow container unless: 1. table has position:absolute; 2. table has width greater 100% 3. table has greater pixel width container 4. table uses margin-left or margin-right 5. table has padding, width: auto those simple ways table overflow table. if overflowing anyhow, , 1 of above 3 conditions not met, please post container , table css. a possible solution fix yous setting width auto, or setting width 100% , making 0px margin.

How to add new key/value pair to existing JSON object in Ruby -

how append new key/value pair existing json object in ruby? my output is { "2d967df3-ee07-4e40-8f65-7bbff59bbb7e": { "name": "book1", "author": "author1" } } i want achieve when add new key/value pair { "2d967df3-ee07-4e40-8f65-7bbff59bbb7e": { "name": "book1", "author": "author1" }, "c55a3632-9bed-4a41-ae40-c1abfe0f332a": { "name": "book2", "author": "author2" } } method write json file def create_book(name, author) temphash = { securerandom.uuid => { "name" => name, "author" => author } } file.open("./books/book.json","w") |f| f.write(json.pretty_generate(temphash)) end end how append new key/value pair existing json object ...

attributes - How to identify a section in an Evernote's note to update it later -

i making app automatically creates notes evernote based on government api , need update these notes if government api change something. but thing is, evernote uses superset of xhtml called enml , doesn't allows me use "id" or "data" attributes in tag. my question how can identify 1 tag or section in note i've created change/update later. we had same issue, wrapped inner html traceable span this: <span style="x-your-business-name:section;">here put inner html content</span> at point it's xhtml traversing , updating. span doesn't influence in way display of evernote note.

sql - Insert into master table through integrity constraint exception handling -

db: oracle 11gr2 os: windows 7 client hello, have master table , detail table following: create table country (id number not null, code varchar2(2) not null, creation_date date, constraint pk_country_id primary key (code)); create table country_detail (code varchar2(2), description varchar2(100), creation_date date, modify_date date, constraint fk_country_id foreign key (code) references country(code)); insert country values(1, 'us', sysdate); insert country values(2, 'ca', sysdate); -- missing on db1 insert country values(3, 'mx', sysdate); insert country values(4, 'ch', sysdate); insert country values(5, 'in', sysdate); -- missing on db2 insert country values(6, 'jp', sysdate); insert country_detail values('us', 'united states of ameica', sysdate, sysdate); insert country_detail values('ca', 'canada', sysdate, sysdate); -- missing on db1 insert country_detail values(...

c# - Do I need to create a new instance from EntityFramework ObjectContext anytime that I want call query? -

in c# entityframework creating new instance of context this: using(var context=new dataaccess.myobjectcontext()){ .... } where myobjectcontext this: public partial class globalcontext : objectcontext { public globalcontext() : base("name=mydbcontext") //: base(connectionstring) { commandtimeout = 2000; _assetcategory = createobjectset<assetcategory>(); _assetitem = createobjectset<assetitem>(); _assetitemtype = createobjectset<assetitemtype>(); _assetitemmunit = createobjectset<assetitemmunit>(); _filedb_asset = createobjectset<filedb_asset>(); } private objectset<assetcategory> _assetcategory; public objectset<assetcategory> assetcategory { { return _assetcategory; } } private objectset<assetitem> _assetitem; public objectset<assetitem> assetitem { { return _assetitem; } } } } true create new ...

php - Graph API Get all photos -

i have website people can upload pictures rated/liked etc. developing function if don't want upload pictures can import them there facebook account. i can login/logout user facebook using php graph api not sure on request need logged in persons photos. have setup login url user_photos permissions. i had feature few years ago use fql query images using new facebook v4 graph api. any appreciated. facebooksession::setdefaultapplication( 'id', 'secret' ); $helper = new facebookredirectloginhelper('url'); $permissions = array( 'user_photos' ); try { if ( isset( $_session['access_token'] ) ) { // check if access token has been set. $session = new facebooksession( $_session['access_token'] ); } else { // access token code parameter in url. $session = $helper->getsessionfromredirect(); } } catch( facebookrequestexception $ex ) { // when facebook returns error. print_r( $ex ); } catch( \exception $ex ) { /...

list - Extract metadata from custom file format and use in file manager -

i have been looking tool allows me scan files metadata (i have extensive directory full of test logs own file format. metadata "fail/pass" etc.). want have local or web-based file manager can add custom columns , manage files based on extracted metadata. know project/tool me build on/start with? hope not vague, lot! it better if you'd update question instead. look, when posting, you'd want share problem, not bugs you. like, how did store. possible sort based on test files on log files if theres constant format pattern. in .log files hope "a.jpg : pass ; pass ; fail" (can't sure though) so, write program finds have passed , have failed. in different folder, create file file name. copy source destination in order. update timestamps , when you'll sort date/time in file manager in folder, you'll see sorted results. advise write specifications of log file , work. easy enough unless not using delimiters.

ios - Universal ipa install never ends -

i have device(ipad) registered in devices developer center. until have use iphone project in deployment info, i'm working on ipad version using sufix ~ipad , ~iphone on xib files. then change iphone project universal project. works fine in xcode when generate .ipa file , try install via itunes install process never ends. the weird thing if iphone project ipa installed without issues. i'm using last version of xcode 6.3. i found wrong configuration. had try generate , ipa file ipad project. error comes out. i need add launch images ipad sizes. retina size 1536x2048 retina size 768x1028 now can generate , ipa file universal project.

java - Sending Location with SMS Message Issue? -

quick question, i've got class setup , sms messages send , i've got no errors.i trying send location part of sms message google maps link. issue messages sending location link not going through? file has no errors , messaging works. any ideas? i've included "access fine location" in manifest file. class: button btnsendsms; edittext txtphoneno; edittext txtmessage; string message; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_send_sms); btnsendsms = (button) findviewbyid(r.id.btnsendsms); txtphoneno = (edittext) findviewbyid(r.id.txtphoneno); txtmessage = (edittext) findviewbyid(r.id.txtmessage); btnsendsms.setonclicklistener(new view.onclicklistener() { public void onclick(view v) { string phoneno = txtphoneno.gettext().tostring(); string message = txtmessage.g...

angularjs - Angular JS: How to use icons in the ng-grid grouping columns? -

is there way display icons instead of text in ng-grid grouping columns? update 04-14-2015 i did it! making example in plunker, wanted. thank all. $scope.gridoptions = { ... aggregatetemplate: aggregaterowtemplate() }; function aggregaterowtemplate() { var result = "<div ng-click=\"row.toggleexpand()\" ng-style=\"rowstyle(row)\" class=\"ngaggregate\">" + " <img ng-src='{{row.label}}' lazy-src >" + " <div class=\"{{row.aggclass()}}\"></div>" + "</div>" return result; } plunker: http://plnkr.co/edit/oxvcvgmjgzgsnl1eov1d?p=preview use columndefs, stated in docs , celltemplate allows give html string display within column cells. an example using bootstrap glyphicons : $scope.gridoptions = { data: [{name: "line 1", icon: "plus"}, {name: "line 2", ic...

php - Symfony2, Doctrine: Configuring repositories for multiple databases -

let's have lot (50+) of repository configurations begin this // in src/foo/barbundle/resources/config/doctrine/baz.orm.yml foo\barbundle\entity\baz: type: entity repositoryclass: foo\barbundle\entity\bazrepository table: foo.bar.baz i working more 1 database, clones of each other // in app/config/config.yml doctrine: dbal: default_connection: default connections: default: dbname: foo alpha: dbname: alpha bravo: dbname: bravo charlie: dbname: charlie is there way me change way repository configuration handles table name dinamically ? tried inject app parameters in them, didn't quite worked. // in app/config/parameters.yml parameters: database_active: charlie // in src/foo/barbundle/resources/config/doctrine/baz.orm.yml foo\barbundle\entity\baz: table: %database_active%.bar.baz [note] working ms sql server, think same problem applied postgresql databases

rss - Rendering mRSS feed in Chrome using jsapi -

using google feed api parse , render mrss feed. having issue in chrome doesn't show content... jsfiddle any idea why that?... function initialize() { var feed = new google.feeds.feed("http://www.wdcdn.net/rss/presentation/library/client/robotrepair/id/a51a000c78e6997a1b7d422247cad813"); feed.setnumentries(99); feed.load(function(result) { if (!result.error) { var container = document.getelementbyid("feed"); (var = 0; < result.feed.entries.length; i++) { var entry = result.feed.entries[i]; var img = document.createelement("img"); if (entry.mediagroups) { var imgsrc = entry.mediagroups[0].contents[0].thumbnails[0].url; img.setattribute("src", imgsrc); container.appendchild(img); } } } }); }

node.js - Karma Test Runner RequireJS 404 error, not serving up content -

Image
getting 404 error app.js file though exists @ url says doesn't (served karma). idea , how solve? >.> going insane. debug [web-server]: serving: /users/tina/sites/node_require/client/src/app.js debug [web-server]: serving: /users/tina/sites/node_require/client/src/views/add.js warn [web-server]: 404: /base/client/src/app my directory structure: karma.conf.js bower_components/ client/ src/ -app.js -main.js spec/ -app.test.js -test.main.js views/ -add.test.js my karma.conf.js: // karma configuration // generated on mon apr 13 2015 19:36:01 gmt-0400 (edt) module.exports = function(config) { config.set({ // base path, used resolve files , exclude basepath:'', // frameworks use frameworks: ['jasmine', 'requirejs'], // list of files / patterns load in browser files: [ //'build/tests.js', //{pattern: 'buil...

nginx as a reverse proxy -

i'm trying use nginx reverse proxy couple of web applications deployed within docker containers. can expose port 80 docker server, , want allow access shipyard , rabbitmq management web app. ideally, users access services via: http[:]//10.10.10.1/shipyard/ http[:]//10.10.10.1/rabbitmq/ after quite bit of research, trial , error nginx config: upstream rabbitmq { server 127.0.0.1:8888; } upstream shipyard { server 127.0.0.1:8080; } server { listen 80; server_name 10.10.10.1; location /rabbitmq/ { proxy_http_version 1.1; proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header upgrade $http_upgrade; proxy_set_header connection 'upgrade'; proxy_set_header host $host; ...

android - View hidden on start is not displayed again after showing view, then configuration change -

is correct? in layout have checkbox marked invisible or gone. after creation, mark checkbox visible (i.e. after selecting button). perform configuration change (rotate device example). checkbox marked visible not showing. however, checked state of checkbox maintained, confusing me, information saved, not? what's best way ensure view stays visible after configuration change? thanks, zach unless specify otherwise, configuration change cause current activity destroyed. try check visibilty of checkbox visiable or not. in case, rotate device cause layout change, check layout file both landscape , portrait, check if can see checkbox placed properly.

rest - Cannot add second AngularJS Service Factory -

i try add 2 services angularjs module. 1 should access employees , 1 products, unknown provider: employeeserviceprovider <- employeeservice <- bookingcontroller . all javascript-files added html. app/module var coffeewatchapp = angular.module('coffeewatchapp', [ 'ngroute', 'coffeewatchcontrollers', 'coffeewatchservices' ]); //routing var coffeewatchcontrollers = angular.module('coffeewatchcontrollers', []); var coffeewatchservices = angular.module('coffeewatchservices', []); employeeservice.js var coffeewatchservices = angular.module('coffeewatchservices', ['ngresource']); var employeeserviceurlpart = "employeeservice/"; coffeewatchservices.factory('employeeservice', ['$resource', function($resource){ return $resource('all/', {}, { all: {method:'get',url:rest_baseurl+employeeserviceurlpart+"all", params:{}, is...

email - Send PDF as attachment via JavaScript -

i have pdf in acrobat following javascript in button's mouse down method. code prompts mail client (in case, outlook or webmail). when select outlook, new outlook message formed appropriate to:, subject:, , body: areas file button resides not attached. documentation https://acrobatusers.com/tutorials/dynamically-setting-submit-e-mail-address seems indicate file attached automatically. i'd code pdf attached. e message not return text. try { var mydoc = event.target; var ctoaddr = "rrose@bi.com"; var csubline = "test email"; var cbody = "email body text"; this.maildoc({bui:false, cto:ctoaddr, ccc:"", csubject:csubline, cmsg:cbody}); } catch(e){app.alert(e)} a few comments: 1) when want when user clicks button, use mouseup event (and not mousedown); clicking releasing mouse, not pressing it. 2) event.target button field, , not document. document this . 3) highly recommend download acrobat sdk a...

javascript - Using function of an already loaded script -

in html-page i'm loading js-file (main.js) functions. html: <head> <script src="main.js"></script> </head> <body> <header>navigation</header> <main> <div id="click_me"> </div> </main> </body> main.js: $( document ).ready(function() { start() }); function start() { $.getscript( 'first.js' ).done(function () { console.log("loaded"); }); } function anything() { console.log("done"); } now i'm using $.getscript load js-file (first.js). file need use functions of first one. first.js: $('#click_me').on('click', function() { anything(); }); in example clicking on #click_me should result in printing "done" in console. your code looks correct. add .fail() statement account errors stated jquery $.getscript official docs: https://api.jquery.com/jquery....

security - Simple Qlik Sense Section Access -

i attempting use section access qlik sense. testing against "admin1", rootadmin in qlik sense , admin in windows server. tried following script in data load editor, hit load data, quit re-enter. qlik says: "access denied". section access; load * inline [ access, userid admin, admin1 ]; section application; load * inline[ customer, age 1,1]; i replaced admin, admin1 admin, domain1\admin1 still "access denied". same when try admin, * or admin, '*' . how can make simple test work? thanks, amir. just noticed in sense documentation, regarding section access, there no "admin" value in "access" column. when i've changed "admin" "user" worked. section access; load * inline [ access, userid user, mydomain\admin1 ]; section application; load * inline[ customer, age 1,1]; also make sure username used domain prefix , domain added "user directory connector" in...

Android ( Java ): Enable GPS or WiFi with Intent -

i´ve small question. possible enable gps intent? tried intent intent=new intent(settings.action_location_source_settings); opens gps settings, want change (enable/disable) gps settings. (sorry bad english) is possible enable gps intent? no, privacy reasons. apps cannot enable gps, outside of unusual scenarios (e.g., rooted devices). i tried intent intent=new intent(settings.action_location_source_settings); opens gps settings correct. user can choose whether or not enable or disable of location providers on screen. if willing dependent upon play services, added settingsapi in 7.0.0 release allows pop simpler dialog user elect whether or not enable locations, though effect largely same action_location_source_settings .

javascript - JSON.stringify turned the value array into a string -

i have js object { astring:[anumber, aurl] } json.stringify() returns { "astring":"[number, \"aurl\"]" } i thought valid json can have arrays values. can have stringify return json string without converting array string? need turn whole js object straight string, without modification. is there better way this? i've been looking around suggests using json.stringify if want object string, , no 1 has raised problem. edit: quick responses. here how created js object, please let me know if messed , how! cookie = {}; // producturl string, timer number, imagesrc url string cookie[producturl] = [timer, imagesrc]; // then, stringified cookie newcookie = json.stringify(cookie); if relevant, setting actual cookie's value resulting json string, in order access in set of functions. setting cookie's value uri encoding of own, i've been grabbing value of newcookie in chrome console , returns array string. if object you...

exception handling - Java try block code does not execute -

i not understand why code in try block not execute. compilation error says when use these variables after try block, may not initialized. double star, planet, poslife, actlife, intellife, comm, length; try{ star = double.parsedouble(factor.elementat(0).gettext()); planet = double.parsedouble(factor.elementat(1).gettext()); poslife = double.parsedouble(factor.elementat(2).gettext()); actlife = double.parsedouble(factor.elementat(3).gettext()); intellife = double.parsedouble(factor.elementat(4).gettext()); comm = double.parsedouble(factor.elementat(5).gettext()); length = double.parsedouble(factor.elementat(6).gettext()); } catch(numberformatexception e){ system.err.println("numberformatexception"); } first, variables define in try block should not visible outside try block ; believe must have double star; etc. before try. now, i'll assume code more following, because error spoke of not occur code gave us: double ...

r - Creating a matrix of OLS results -

i have data set of excess returns 576 years 25 asset portfolios(it goes on till 201012 , er25) date er1 er2 er3 er4 er5 market-rf 196301 12.77 11.19 9.15 10.71 10.87 4.93 196302 -3.48 -3.72 -0.94 -1.06 2.51 -2.42 196303 4.75 -1.7 -0.34 0.99 2.36 3.06 196304 4.55 1.25 1.8 3.29 2.52 4.49 196305 3.15 1.44 2.51 3.89 7.63 1.77 i need run 25 regressions capm model , need arrange alphas(intercepts), betas(the co-efficient) , t-statistic of intercept in 25x3 matrix form. here regressions. capm1 <- lm(er1~market.rf, data=ff25) capm2 <- lm(er2~market.rf, data=ff25) capm3 <- lm(er3~market.rf, data=ff25) etc until capm25. i can results of coeftest this. coeftest(capm1) t test of coefficients: # estimate std. error t value pr(>|t|) #(intercept) -0.395188 0.204474 -1.9327 0.05376 . #market.rf 1.434851 0.045032 31.8629 < 2e-16 *** #--- #signif. ...

javascript - Splicing Array Based on For Loop Iteration -

i trying take array ('selectedworkshops'), , move objects in 'registeredworkshops'. then, want remove objects both 'selectedworkshops' , array called 'workshops'. see codepen here: http://codepen.io/truescript/pen/wbvqnn arrays: var workshops = [ { name: 'apples', workshopid: '19' }, { name: 'oranges', workshopid: '3b' }, { name: 'pears', workshopid: 'x6' }, { name: 'pineapples', workshopid: '55' }, { name: 'watermelons', workshopid: '8v' } ]; var selectedworkshops = [ { name: 'oranges', workshopid: '3b' }, { name: 'watermelons', workshopid: '8v' }, { name: 'pears', workshopid: 'x6' } ]; var registeredworkshops = []; function supposed move workshops 'registeredworkshops' , remove them 'selectedworkshops' ...

Android Emulator not launching in Windows7, Android Studio 1.1, API22 -

i have been able launch emulator in past. lately switched android studio 1.1 , emulator not launch @ all, either api21 or 22. in "run" window message "hax working , emulator runs in fast virt mode". beyond nothing appears on screen. on windows 7 , enterprise. please help... vikas you not first person haves problems android emulators. slow, not work in situations , have multiple other issues. alternative running android in virtual box instead of emulator. you're doing same thing (running android in non real device) faster , less risky have issues. give try: http://www.howtogeek.com/164570/how-to-install-android-in-virtualbox/ https://www.youtube.com/watch?v=o3ycsjjlxio and if use xamarin, can use xamarin player: https://xamarin.com/android-player

python - Asking the user for input until they give a valid response -

i writing program must accept input user. #note: python 2.7 users should use `raw_input`, equivalent of 3.x's `input` age = int(input("please enter age: ")) if age >= 18: print("you able vote in united states!") else: print("you not able vote in united states.") this works expected if user enters sensible data. c:\python\projects> canyouvote.py please enter age: 23 able vote in united states! but if make mistake, crashes: c:\python\projects> canyouvote.py please enter age: dickety 6 traceback (most recent call last): file "canyouvote.py", line 1, in <module> age = int(input("please enter age: ")) valueerror: invalid literal int() base 10: 'dickety six' instead of crashing, try getting input again. this: c:\python\projects> canyouvote.py please enter age: dickety 6 sorry, didn't understand that. please enter age: 26 able vote in united states! how can accomplish this? i...

c# - Formatting with System.XML -

i redoing legacy vb.net app in mvc. part of app used msxml2 create xml document. having trouble 2 elements far. legacy code uses "right" ( right function in c#? ) , "format" ( equivalent of format of vb in c# ) commands. is there preferred method creating xml other using system.xml? objnode = objdoc.createnode("element", "payout", ""); objelement = objdoc.documentelement.appendchild(objnode); objelement.setattribute("companynumber", right(objrs.fields["operating_unit_code"].value, 3)); objelement.setattribute("employeenumber", objrs.fields["employee_code"].value); objelement.setattribute("earningscode", objrs.fields["incentive_type_code"].value); objelement.setattribute("chargetoproject", right(objrs.fields["operating_unit_code"].value, 3) & objrs.fields["organization_code"].value); objelement.setattribute("amount", format(obj...