Posts

Showing posts from February, 2013

c# - Error while inserting duplicate records -

i have code commit public retornodto commit(efdbcontext _context) { string errovalidation = string.empty; try { _context.savechanges(); } catch (dbentityvalidationexception e) { foreach (var eve in e.entityvalidationerrors) { var erro = string.format("entity of type \"{0}\" in state \"{1}\" has following validation errors:", eve.entry.entity.gettype().name, eve.entry.state); logger.getinstance().erro(erro); foreach (var ve in eve.validationerrors) { errovalidation = string.format("- property: \"{0}\", error: \"{1}\"", ve.propertyname, ve.errormessage); logger.getinstance().erro(errovalidation); } } return new retornodto

Assigning content of a R dataFrame cell based on some conditions -

this question has answer here: calculating statistics on subsets of data [duplicate] 3 answers i have r dataframe df following content: serial n year current b 10 14 b 10 16 c 12 11 d 40 20 b 11 15 c 12 9 i add column compute average current if serial number , year same serial number , years. have this serial n year current average b 10 14 15 b 10 16 15 c 12 13 12 d 40 20 20 b 11 15 15 c 12 11 12 i wrote for (i in unique(df$serial_n)) { (j

android - React Native Release: Could not connect to development server -

i followed official guide create installable android application. however when installing apk ./gradlew installrelease app crashes react fragment loaded: runtimeexception: not connect development server. my fragment code looks this, integration android tutorial suggests. @override public view oncreateview(layoutinflater inflater, @nullable viewgroup container, bundle savedinstancestate) { mreactinstancemanager = reactinstancemanager.builder() .setapplication(getactivity().getapplication()) .setbundleassetname("index.android.bundle") .setjsmainmodulename("index.android") .addpackage(new mainreactpackage()) .setusedevelopersupport(false) // changes nothing .setinitiallifecyclestate(lifecyclestate.resumed) .build(); mreactrootview.startreactapplication(mreactinstancemanager, "helloworld", null); return mreactrootview; } do have ideas might wrong?

c# - How many applications should be defined in Azure B2C for a micro-service based infrastructure? -

in preview azure ad b2c can define applications. each application given name, client id, app key , few settings define whether include web app / web api , whether allow implicit flow. in 'old' world of azure ad had greater control interaction between applications such "this application can access graph api", or "this application can talk service" whereas in new world order doesn't appear possible (at least portal ui perspective). question is: given lack of apparent control in azure ad b2c infrastructure has growing number of microservices, make sense create 'application' per service in azure ad b2c (and indeed per environment)? or should whole system share same application (and therefore client id?). (i comment on current score not allow me that) what do: have client ids each web , api app (container micro services). when initializing authentication api apps put client ids allowed talk api in validaudiences : public static st

scala - PostgreSQL syntax error at or near "$1" -

sql"""copy updatetable $path credentials 'aws_access_key_id=<my_access_key_id>;aws_secret_access_key=<my_secret_access_key>' json '<path_to_s3_repository>' gzip;""".update().apply() above command gives org.postgresql.util.psqlexception: error: syntax error @ or near "$1" when run on spark streaming using scala. might issue? resultant query runs fine when run command line. you cannot use parameter copy . you have add literal value of $path statement string , execute that.

portaudio - Interpreting inputBuffer's Value in a Callback -

i basing code off of portaudio's paex_record_file.c example. 1 of parameters in callback inputbuffer, , wanted use data calculate other numbers double/float type. changed file .raw .txt, notepad still cannot read it, leading me believe data not encoded number. how data stored in inputbuffer , how can arithmetic (add, multiply, divide, etc)? this how initialized inputparameters: inputparameters.device = pa_getdefaultinputdevice(); /* default input device */ if (inputparameters.device == panodevice) { fprintf(stderr,"error: no default input device.\n"); goto error; } inputparameters.channelcount = 2; /* stereo input */ inputparameters.sampleformat = pafloat32; inputparameters.suggestedlatency = pa_getdeviceinfo( inputparameters.device )->defaultlowinputlatency; inputparameters.hostapispecificstreaminfo = null; this question related print floats audio input callback function (unanswered). the inputbuffer parameter callback

javascript - Angular2: replace component element entirely -

i looking around while , cannot seem find right answer... should trivial... , documented everywhere... seems cannot find it... so, have very, easy component/directive called navitem this how call it <ul> <nav-item route="/aboutus">about us</nav-item> <nav-item route="/contactus">contact us</nav-item> </ul> and inside (nav-item.html): <li><a [routerlink]="route"><ng-content></ng-content></a></li> so have this: import { component, input } '@angular/core'; import { router_directives } '@angular/router'; @component({ moduleid: module.id, selector: 'nav-item', template: require('./nav-item.html'), directives: [router_directives] }) export class navitem { @input() route = '/'; constructor(){} } what <ul> <nav-item _ngcontent-xng-6="" route="/aboutus" ng-reflect-ro

java - Gradle : How to call implicit task provided by application plugin from other task -

i need execute run task provide 'application' plugin after completion of 'copysrctotempdir' task. i tried 1)run.dependson copysrctotempdir -> buildfail 2)run.mustrunafter copysrctotempdir ->but won't execute run task. apply plugin:'application' repositories { flatdir { dirs 'lib' } } dependencies { compile name: 'zip4j_1.3.2' } mainclassname = "com.md.zippwd.zipwithpassword" task copysrctotempdir(type: copy){ "d:\\demoproject" "d:\\temp" } } // run.dependson copysrctotempdir // run.mustrunafter copysrctotempdir provided gradle command accordingly gradle copysrctotempdir gradle run please suggest me i'm not finding solution. run.dependson copysrctotempdir working me. using gradle 2.5. gradle task executing? run? try using: tasks.run

python - Use decorators to wrap all functions with "if func returned false, return false" -

i'm writing basic python script based on main function sequentially calls other functions. what wrap of functions called main like: result = func(*some_args): if (result != true): return result for example, code: def func1(arg1 , arg2): if (some_cond): return false #or err_val return true def func2(arg1): if (some_cond): return false return true def main(): func1(val1 , val2) func2(val3) return true if __name__ == "__main__": import sys result = main() if (result == err_val1): # something. maybe print. maybe call function. sys.exit(1) i want if 1 of functions fails main break , return error. can using decorators? this precisely exceptions built in python. # imports belong @ *top* of file import sys class somedescriptiveerror(exception): pass class someotherspecialerror(exception): pass def func1(arg1 , arg2): if (some_cond): raise so

python - Pandas: How to delete string with some value -

i have df subdomain search_engine search_term 0 vk.com none none 1 vk.com none none 2 facebook.com none none 3 vk.com none none 4 vk.com none vkontakte i need 4 vk.com none vkontakte i try df[~df.search_term.str == r"none"] but returns typeerror: bad operand type unary ~: 'stringmethods' i think should it: in[75]:df[df.search_term.str.strip()!='none'] out[75]: subdomain search_engine search_term 4 vk.com none vkontakte or work: df[~df.search_term.str.match('none')]

ios - GCM Push notification returns the error message "GCM registration is not ready with auth credentials...." -

i have implement gcm push notification in ios swift application. first, working on application , followed tips , instructions in google documentation : https://developers.google.com/cloud-messaging/ios/client . registration token generated after had complete application in computer re-generated certificates error "gcm registration not ready auth credentials" keeps showing, tried , removed certificates , follow instructions not solve issues. i tried generated ios provisioning profiles manually , tried using xcode did not solve issue. ios provisioning profiles any tips solve it.? in advance i able test yesterday in sandbox mode, configuration same. , (few hours ago) stopped working.(also noticed stackoverflow full of issue related questions within couple of hours) issues not related developer's configuration, think it's google backend/api related issues/changes. in mean time try other steps,if you've missed steps. follow issue( the operation coul

Analytics Core Reporting API. Rows in different segments have same values -

Image
i have misconception, need understanding wrong. at analytics.google.com have 2 segments differ event label both same event. in analytics interface difference between segments visible: when i'm trying same data tool query explorer results different: however, when i'm getting data reporting api v4, values same between segments. have tried api v3, resulted in similar outcomes. here code: googleapis.analyticsreporting('v4').reports.batchget({ 'headers': {'content-type': 'application/json'}, "auth": oauth2client, "resource":{ reportrequests:[ { "viewid": "ga:"+meteor.settings.admin.googleapi.viewid, "dateranges":[{ "startdate": '2016-07-01', "enddate": moment().format('yyyy-mm-dd'), }], "metrics": [{"expression":"ga:pageviews"},{"expression":"

c++ - Inspecting C Header Files Further -

i learning networking in c looking @ code of working packet sniffer within microsoft visual basic 2013 . below code creates pointer hostent structure , obtains localhost hostname , , loads hostent structure called local . struct hostent *local; gethostname(hostname, sizeof(hostname)) local = gethostbyname(hostname); the next part enables address printed in dotted decimal notation. for (i = 0; local->h_addr_list[i] != 0; ++i) { memcpy(&addr, local->h_addr_list[i], sizeof(struct in_addr)); printf(" interface number : %d address : %s\n",i,inet_ntoa(addr)); } now, want understand how works , more . . . say want understand inet_ntoa(), right-click , choose go definition or go declaration , sends me winsock2.h shows: inet_ntoa( __in struct in_addr in ); this appears show me parameter not workings of function or return value. means have refer msdn understand happening every time. my question is: code read happening don't have use

Where are ServiceStack security bulletins posted? -

we have developed pa-dss payment application makes use of servicestack , part of pa-dss requirements monitor security vulnerabilities / updates product vendors used. while see release notes, not see security specific entries, demis, guys publishing information? thanks

Compare first letter of strings in Matlab -

i see if letter inputted user matches of words in dictionary. could please me this? thank you! words = {'apple', 'banana', 'bee', 'salad', 'corn', 'elephant', 'pterodactyl'}; user_letter_input = input('please enter first letter of word: '); = words if (i starts user_letter_input) disp(['your new word is: ' i]); end end you can use: if(i{1}(1) == user_letter_input)

node.js - Some code only works while chrome debugger is active -

i'm working on react-native application , i'm trying format date using moment. dates "02-16-2016 09:04:23" function formattime(date){ var formatteddate = moment(date).format('mm:ss a'); return formatteddate; } works fine if chrome debugger active. if disable it, "invalid date" same thing decoding function i'm using var = this; messagesservice.getmessagebody(selectedmessage) .then(function(messagebody){ var decodeddata = window.atob(messagebody.messages); that.setstate({ messagebody: decodeddata }) }) .catch(function(err){ console.log(err); }) displaying decoded data with <text> body: {this.state.messagebody} </text> and displaying date with <view style = {[messagestyles.senderitem, messagestyles.date]}> <text> {this.formattime(message.createdatetime)} </text> </view> maybe bad way in react native? s

c++ - passing template args to std::thread -

im having little problem passing args std::thread calls template function. template <typename f, typename... a> void start(int interval, f func, a&&... args) { if (_running.load(std::memory_order_acquire)) { stop(); }; _running.store(true, std::memory_order_release); _thread = std::thread([this, interval, func, args]() { while (_running.load(std::memory_order_acquire)) { func(std::forward<a>(args)...); (int = 0; (i <= (interval / 200)) && _running.load(std::memory_order_acquire); i++) std::this_thread::sleep_for(std::chrono::milliseconds(200)); } }); } edit: added little more detail should able pass function "start" ammount or args void threadproc(hwnd hwnd) { beep(1000, 100); } start(2000, threadproc, hwnd); error: error c3520: 'args': parameter pack must expanded in context note: see reference function template instan

java - Move a Rectangle from point to point in a ramp with changing angle -

Image
so have program test possibility of object slide down in ramp given friction, object mass , ramp angle. need animate box if force positive. simple animation moving box point end of ramp. can't. please help private void drawtransform(graphics g, double modifier) { // redtowhite = new gradientpaint(0,0,color.red,100, 0,color.white); rectangle rect = new rectangle(130,350, 350, 15); rectangle box = new rectangle((int) (rect.getx()+300), 300, 50, 50); affinetransform @ = new affinetransform(); at.rotate(-math.toradians(modifier), rect.getx(), rect.gety() + rect.height); // transform shape , draw screen graphics2d g2d = (graphics2d) g; g2d.setcolor(color.dark_gray); // g2d.fillrect(0, 0, 350, 600); g2d.fill(at.createtransformedshape(rect)); g2d.draw(at.createtransformedshape(box)); } screenshot: if want move box, can done updating it's x position. should able manipulate rectangle's x position directly using "box

java - Spring 4: NullPointerException during instantiation of ClassPathXmlApplicationContext -

i developing standalone spring 4 application, uses javafx. however, when try create new classpathxmlapplicationcontext , autowired fields null, leading npes, though let spring instantiate classes. this main class: public class main extends application { public static void main(string[] args) { launch(); } public void start(stage stage) { configurableapplicationcontext context = new classpathxmlapplicationcontext("spring-config.xml"); gui gui = context.getbean(gui.class); stage.setscene(new scene(gui, 400, 400)); stage.show(); } } this spring-config.xml: <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd http://www.springframework.org/schema/contex

php - how to make "likes button"? -

what is, place button below user posting user can press. once pressed increment value in database table. problem have no idea how make base on query show posting. below table name , field have : user : id_user, username posting : id_post, id_user, content like : id_like, id_user, id_post and below query show posting : $query=$dbc->query("select user.username, posting.content posting inner join user on user.id_user = posting.id_user id_post='$_get[id]'"); $array= $query->fetch_array()

amazon web services - Elastic Beanstalk Multicontainer Docker environment: no entries in etc/hosts for lined containers -

i have environment few containers. of them linked. when run environment "docker-compose -d", creates entries in etc/hosts linked containers. when run "eb local run", no entries created. why that? my dockerrun.aws.json { "awsebdockerrunversion": 2, "containerdefinitions": [ { "name": "api", "image": "php7", "essential": true, "memory": 128, "portmappings": [ { "hostport": 8080, "containerport": 80 } ], "mountpoints": [ { "sourcevolume": "api", "containerpath": "/var/www/html/" } ] }, { "name": "nodeapi", "image": "nodejs",

Running python from Java using Process Builder -

for existing java code want extend, need run python code within java. using process builder this: processbuilder pb = new processbuilder("python", "/directorypath/mypython.py"); process p=pb.start(); bufferedreader stdinput = new bufferedreader(new inputstreamreader(p.getinputstream())); bufferedreader stderror = new bufferedreader(new inputstreamreader(p.geterrorstream())); // read output command system.out.println("here standard output of command:\n"); while ((s = stdinput.readline()) != null) { system.out.println(s); } // read errors attempted command system.out.println("here standard error of command (if any):\n"); while ((s = stderror.readline()) != null) { system.out.println(s); } system.exit(0); } while code runs fine command line, in ja

elasticsearch - Applying custom filters for aggregation in Elastic Search -

i have more 2 million documents has price , discount. have percentage of products 10%, 20%, 30%,......, 90%, 100% discount(discounts rounded off). not possible fetch data , aggregate on application layer @ take time. afraid create lag other users thread busy long time. is there way can create custom filters upon aggregation logic? it doesn't need custom filter here. functionality standard part of histogram aggregation . can take @ range aggregation in case need more flexible ranges. if need complete flexibility in how terms calculated can use script in terms aggregation return value want group records by. however, 2 million documents, might better pre-calculate discount during before indexing document, store value separate field , use histogram aggregation.

java - Export paginated table in html to PDF,CSV,XLS -

i trying export html table using js provided ngiriraj table export demo . table paginated bootstrap-table.js . when exporting data in format 1 table page getting exported. also, while exporting pdf, getting 4 columns in pdf. code attached below. jsp page: <div style="padding: 10px;"> <br> <table id="table" data-search="true" data-show-columns="true" data-pagination="true"> <thead> <tr> <c:foreach items="${keys}" var="keys"> <th data-field="${keys}" data-sortable="true">${keys}</th> </c:foreach> </tr> </thead> </table> <nav class="navbar navbar-default export"> <div class="container-fluid"> <div class="navbar-header">

c++ - WaitForSingleObject() not returning WAIT_ABANDONED -

i have mfc application. in initinstance() created named mutex , acquiring calling waitforsingleobject(). in exitinstance() mutex released. bool cmyapp::initinstance() { m_hmutex = createmutex( null, false, "myappmutex" ); dword dwres = waitforsingleobject( m_hmutex, infinite ); switch( dwres ) { case wait_abandoned: break; case wait_object_0: break; } } bool cmyapp::exitinstance() { ::releasemutex( m_hmutex ); ::closehandle( m_hmutex ); } what understand mutex documentation if process exits out releasing acquired mutex, when process tries acquire waitforxxxobject() return wait_abandoned. for testing ran application , killed using task manager releasemutex wont called. when ran application again waitforsingleobject() in initinstance() returns wait_object_0. expected behavior? from msdn page on createmutex : the system closes handle automatically when process terminates. mutex object destroyed when la

linux - how to execute ssh comand on .sh file? -

i trying create .sh file execute things "pwd" or "ls" command. problem when execute .sh file. seems not recognize tasks tried use echo example : echo 'lsapps' or echo "lsapps" prints name of task instead execute comand for example want execute .ssh file makes pwd var_1=pwd echo $var_1 but prints me pwd instead current path ... idea? echo used print on screen ( man page reference ). if echo 'isapps' take string , print it. if want execute command can doing isapps (acutes not quotes, acute below escape key). execute command , show output on screen. if want store output of command in variable, can <variable_name>=`isapps` this store output in variable. note there no space between variable name , command. also, not quotes instead acutes. print variable on screen can use echo doing echo $<variable_name> if don't want see output @ all. can do isapps > /dev/null this execute command not s

android - cannot change tabs in TabLayout -

i new android programming , trying change tab on touch of tab header text. here code activity_main <android.support.design.widget.appbarlayout> <android.support.design.widget.collapsingtoolbarlayout> <imageview android:id="@+id/image" android:layout_width="fill_parent" android:layout_height="match_parent" android:src="@drawable/test_image" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:scaletype="centercrop" /> <android.support.design.widget.tablayout android:id="@+id/tabs" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top" app:layout_behavior="@string/appbar_scrolling_view_behavior" android:background="@andr

ios - Re-Order UITableView Sections only -

i have been trying find way re-oder table sections drag , drop re-ordering table rows no success. can guide me go? need re order complete section not rows. simple way standard delegate methods implement tableview:moverowatindexpath:toindexpath: data represents data source array containing sections. func tableview(tableview: uitableview, moverowatindexpath sourceindexpath: nsindexpath, toindexpath destinationindexpath: nsindexpath) { let itemtomove = data[sourceindexpath.section] data.removeatindex(sourceindexpath.section) data.insert(itemtomove, atindex: destinationindexpath.section) tableview.reloaddata() } set editing of table view true . reorder symbol appears. drag row. code in method moverowatindexpath reorders entire section.

python - Pythonic way to create dictionary from bottom level of nested dictionary -

i have dictionary contains nested dictionaries, this: example_dict = { "test1": "string here", "test2": "another string", "test3": { "test4": 25, "test5": { "test7": "very nested." }, "test6": "yep, string" }, } assuming keys nested within unique, there pythonic way take dictionary , obtain 'bottom' level of keys , values? by mean going recursive dictionary , obtaining key:value pairs value isn't dictionary (but still capturing key:value pairs within fulfil critera)? above following returned: resulting_dict = { "test1": "string here", "test2": "another string", "test4"

Solr Config change not being picked up -

i'm trying remove unneeded scriptupdateprocessor sits in solr-home/configsets/myconfig/conf. have removed offending lines in processadd , saved it. restarted docker container solr lives. the problem seems still have reference file , fails add document because falls on due missing date scriptupdateprocess needs. how can force refresh of assumed restart enough! i've done find across entire server file of name , can find 1 don't think have edited wrong file or that! i have in addition server restart reloaded each core. still no joy. nb using solr 5 in cloud mode after wasted time.. hadn't considered fact running apache zookeeper. hence config loaded zookeeper , needed make changes there , reload each core.

Kendo UI ASP.net MVC - Why dropdownlist is getting empty data on select event? -

in asp.net mvc view i've kendo dropdownlist , grid. i'm after grid hidden default, based on selection of dropdownlist, grid should populate relevant data , displayed. however, select event dropdownlist not getting correct data. gets previous selection instead of current selection. code view is: @model myapplication.models.customermodel @{ viewbag.title = "customer information"; } <h2>customer information</h2> <div class="container"> <div class="row"> @(html.kendo().dropdownlist() .name("customerid") .optionlabel("select customer") .bindto((list<selectlistitem>)viewbag.customerlist) .datatextfield("text") .datavaluefield("value") .events(e => e.select("onselect"))

Adding a play again option to python game -

i'm working on making game programming class using python. don't know how give option player again when lose, or quit game. using python 2.7. code game: import pygame, sys, time, random pygame.locals import * # set pygame pygame.init() mainclock = pygame.time.clock() # set window windowwidth = 1000 windowheight = 500 windowsurface = pygame.display.set_mode((windowwidth, windowheight), 0, 32) pygame.display.set_caption('dankest memes') # set colors pink = (223, 61, 163) textcolor = (223, 61, 163) def waitforplayertopresskey(): while true: event in pygame.event.get(): if event.type == quit: terminate() if event.type == keydown: if event.key == k_escape: # pressing escape quits terminate() return def terminate(): while true: event in pygame.event.get(): if event.type == quit: terminate() if event.type == keydown: if event.key == k_esca

python - How does one store a Pandas DataFrame as an HDFS PyTables table (or CArray, EArray, etc.)? -

i have following pandas dataframe: import pandas pd df = pd.read_csv(filename.csv) now, can use hdfstore write df object file (like adding key-value pairs python dictionary): store = hdfstore('store.h5') store['df'] = df http://pandas.pydata.org/pandas-docs/stable/io.html when @ contents, object frame . store outputs <class 'pandas.io.pytables.hdfstore'> file path: store.h5 /df frame (shape->[552,23252]) however, in order use indexing, 1 should store table object. my approach try hdfstore.put() i.e. hdfstore.put(key="store.h", value=df, format=table) however, fails error: typeerror: put() missing 1 required positional argument: 'self' how 1 save pandas dataframes pytables tables? common part - create or open existing hdfstore file: store = pd.hdfstore('store.h5') try if want have indexed all columns: store.append('key_name', df, data_columns=true)

javascript - Variable Ionic not found -

i 'ionic not found' error when trying run cordova app ionic. 'ionic' present in module dependencies , think include right files in de index.html: lib/ionic/js/ionic.bundle.js lib/ngcordova/dist/ng-cordova.js cordova.js i've been searching hours , don't know possibly cause problem. knows matter? when inject ionic in controller's function, ionicprovider unknown error the app definition: angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives']) the controller: angular.module('app.controllers', ['ngcordova']) .controller('flightdocumentsctrl', function ($scope, $cordovafiletransfer, $timeout, $cordovainappbrowser) { ngcordova must placed in app module that: angular.module('app', ['ionic', 'app.controllers', 'app.routes', 'app.services', 'app.directives','ngcordova'

With Mosquitto broker, how to subscribe to a topic and get any message just once -

this newbie question i'm sure, using mosquitto how subscribe retained message , guarantee message once? have paho based java subscriber, , in testing notice is, if subscriber brought down, , restarted pulls of same messages received before came down. (normally stay forever, stuff happens.) , it's critical subscriber each message once. (for use case there 1 subscriber.) is there built mosquitto provides mechanism or have build data schema , retrieval process? i see there way of deleting message topic ( https://lists.launchpad.net/mosquitto-users/msg00067.html ) right topics pretty generic [company]/[mac address]/[topic x] , it's possible have 2 separate messages on queue same topic, , i'm assuming if send empty message given topic i'll end deleting messages of said topic. thanks in advance on this. set qos level 2. qos-level-2: exactly-once delivery. highest level incurs on head interms of control messages , need locally storing messages. exactl

javascript - alternate dates between 2 dates Jquery -

how find alternate days between 2 dates. here jquery code finds total number of hours between dates. var strt_date="2016-02-03"; var end_date = "2016-02-08"; strt_date = new date(strt_date); end_date = new date(end_date); var hours=math.abs(strt_date - end_date) / 36e5; console.log(hours); how find alternate dates between these 2 dates update:the output 2016-02-03 2016-02-05 2016-02-07 alternate dates between 2 dates starting selected date var start = new date("2016-02-03"); var end = new date("2016-02-08"); var between = []; var mil = 86400000 //24h var init = 0; (var i=start.gettime(); i<end.gettime();i=i+mil) { if(init%2==0) between.push(new date(i)); //if(init%2==0) between.push(inddate.getfullyear()+"-"+(inddate.getmonth()+1)+"-"+inddate.getdate()); //above condition returns dates in 'y

angularjs - facing issue while trying to add auth0 into angular web application -

(function() { angular .module('toolbar') .directive('toolbar',toolbar); function toolbar(){ return { templateurl: 'toolbar/toolbar.template.html', controller: toolbarcontroller, controlleras: 'toolbar' } } function toolbarcontroller(auth,$localstorage,$location) { var vm = this; vm.login = login; vm.logout = logout; vm.auth = auth; function login() { auth.signin({},function(profile,token){ $localstorage.profile = profile; $localstorage.id_token = token; $location.path('/companies'); }, function(err){ console.log(err); }) } function logout() { delete $localstorage.profile; delete $localstorage.id_token; auth.signout(); } } })(); i following auth0 video tutorials, d

ios - Monitoring iBeacon beacons in background -

i've been developing ios app , playing around apple's corelocation , ibeacon technology. far used 3 beacons different uuids. ok until decided add more beacons app. ran strange issue. it's been said, single app can monitor 20 beacon regions @ once, when in background - in particular case, number seems 3. tried different approaches, nothing worked. when shuffled beacons in array outcome expected - first 3 beacon regions triggered didenterregion , didexitregion events when app in background. didn't applied when in foreground. please consider this: i have array of custom beacon objects (consumed api) for each custom beacon object create instance of clbeaconregion so: let beaconregion = clbeaconregion(proximityuuid: nsuuid(uuidstring: region.uuid)!, identifier: region.uuid) beaconregion.notifyonentry = true beaconregion.notifyonexit = true beaconregion.notifyentrystateondisplay = true then pass instance cllocationmanager's startmonitoringforregion met

ruby on rails - Trouble installing therubyracer gem due to compiler issue on mac? -

i've been trying install gem, therubyracer on mac os x el capitan rails app, keep getting error associated -rdynamic flag, results in failure build native extensions. amory:coursequestionbank masonscott$ gem install therubyracer building native extensions. take while... error: error installing therubyracer: error: failed build gem native extension. /users/masonscott/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160301-14168-1g6b007.rb extconf.rb checking main() in -lpthread... yes checking main() in -lobjc... yes creating makefile make "destdir=" clean make "destdir=" compiling accessor.cc g++: error: unrecognized command line option '-rdynamic' make: *** [accessor.o] error 1 make failed, exit code 2 gem files remain installed in /users/masonscott/.rvm/gems/ruby-2.2.1/gems/therubyracer-0.12.2 inspection. results logged /users/masonscott/.rvm/gems/ruby-2.2.1/extensions/x86_64-darwin-14/2.2.0-static/therubyracer-0.12.2/gem_make.out i've

Cut - Paste an auto-detected range in Excel VBA -

i trying cut , paste chunks of cells, auto-detected line range, in defined position (specifically, right after last used cell in column or b). sub cut_range_to_clipboard() 'detecting number of used lines in chunck of code need cut dim lastrow long activesheet lastrow = .cells(.rows.count, "t").end(xlup).row msgbox lastrow end 'detecting number of used lines in column need paste code dim lastrow2 long activesheet lastrow2 = .cells(.rows.count, "b").end(xlup).row msgbox lastrow2 end 'cells(20, 3) = t3 range(cells(20, 3), cells(36, lastrow)).cut range(cells(2, lastrow2 + 1)).select activesheet.paste range("t1").cut range(cells(1, lastrow2 + 1)).select activesheet.paste columns("t:ak").entirecolumn.delete end sub when executing code, line range(cells(2, lastrow2 + 1)).select outputs error 1004, , cannot understand why. you need add address property of cells (neces

excel - VLOOKUP With Multiple Criteria? -

Image
i've been trying create vlookup return value based on if column's "submission" date falls in between date periods. aim provide view of projects have not submitted data in column (for week) in 1 document have archive of projects submissions, adding new line of values every time submits project (along time/date of submission). (macro copies across information , saves). i've assigned every day of year week number, , vlookup'd today() allow me pull off current weeks information. i'm trying return column hn if time has been submitted between date periods, pulling off newest submission week, project. each project has unique number assigned it. (there can multiple submissions in week, sumif wouldn't work - multiplying values amount of times project has been submitted.) if more information required, please let me know example of archive data: project obr last report submitted: costs 9977 29/01/2016 11:19 1

java - JavaFX : Supply arguments to Task -

i working on javafx project in making network calls task . unfortunately, have not been able find how can pass arguments it. have searched many links, none of them provides. 1 link java2s claims passing, code not reflect that. as can see code below, using for-loop , passing id parameter of restgroupaccount in url. time it's okay because anyways need of restcanvas. but interested in knowing how give parameters task code : private task<list<restcanvas>> fetchcanvases = new task<list<restcanvas>>() { @override protected list<restcanvas> call() throws exception { list<restcanvas> list = new arraylist<>(); try{ for(restgroupaccount groupaccount : groupaccounts) { resttemplate rest = staticresttemplate.getrest(); httpheaders requestheaders = new httpheaders(); requestheaders.add("cookie", "jsessionid=" + staticresttemplate.jsession

sql - convert into date -

i'm trying convert varchar date , style output in german fashion: update table set c1 = convert(date,convert(varchar,c2,104)) whereas c1 = varchar(15) , c2 = integer. thank in advance! the int needs become varchar , date , converted varchar : declare @c2 int = 20160719 select convert(varchar(10), cast(cast(@c2 varchar(8)) date), 104) -- 19.07.2016

c# - Convert ADODB::Recordset^ to _RecordsetPtr -

i'm using c# dll inside in c++/cli wrapper. dll returning adodb::recordset^ object, need wrapper return _recordsetptr object. how can convert between two? here's have far. problem i'm running in after last line of for-loop, function skips return statement , ends. doesn't continue looping, , doesn't hit "object^ rows = . . ." line. _recordsetptr traserinterface::getdistributorrecordset() { adodb::recordset^ recordset = traserwrapper::instance->traserinterface->distributorrecordset; adodb::fields^ fields = ((adodb::recordsetclass^)recordset)->default; hresult hr; _recordsetptr recordsetptr("adodb.recordset"); (int = 0; < fields->count; i++) { adodb::field^ field = fields[i]; string^ fieldname = field->name; _bstr_t bstrname = marshalstring(fieldname).c_str(); int type = (int)field->type; int definedsize = field->definedsize; int fieldattrib = fie

node.js - moment returns wrong value -

i'm parsing date using momentjs : var startdate = moment.utc('2016-02-20t07:00:00.000z') if i'm writing startdate.toisostring() console, this: 2016-02-19t21:00:00.000z the startdate object looks this: { [number: 1455915600000] _isamomentobject: true, _i: '2016-02-20t07:00:00.000z', _f: 'yyyy-mm-ddthh:mm:ss.ssssz', _tzm: -0, _isutc: true, _pf: { empty: false, unusedtokens: [], unusedinput: [], overflow: -1, charsleftover: 0, nullinput: false, invalidmonth: null, invalidformat: false, userinvalidated: false, iso: true }, _locale: locale { _ordinalparse: /\d{1,2}(th|st|nd|rd)/, ordinal: [function], _abbr: 'en', _ordinalparselenient: /\d{1,2}(th|st|nd|rd)|\d{1,2}/ }, _d: fri feb 19 2016 22:00:00 gmt+0100 (cet), _isvalid: true, _offset: 0 } where difference result from?

html - HTML5: Append spinnerInput value with percentage symbol -

Image
i need append percentage symbol spinnerinput, displayed below < input type="number" min="0" value="0" step="5" onkeydown="return false" > the value in textbox should 45% opposed 45 syntax: what best way implement (without using jquery)?

.net - Determine if GAC'ed & NGen'ed assemblies are being used -

how determine if native images being used without loader verifing signature of assembly @ runtime, or using gac'ed assembly? i have complex system we're experimenting ngen we're running exe folder dll's located due lot of late binding dependencies, looking @ process explorer, looks native images being used, how can sure i'm getting full benefit , eliminating loader verification step? cheers, graeme. update: i'm getting lots of sort of thing assembly binding log viewer: log: [level 1]start validating il dependency mycompany.entities, version=2.0.0.0, culture=neutral, publickeytoken=7cd8595f4671c5dd. log: dependency evaluation succeeded. and @ end log: validation of dependencies succeeded. log: start loading dependencies load context. log: loading of dependencies succeeded. log: bind native image succeeded. native image has correct version information. attempting use native image c:\windows\assembly\nativeimages_v2.0.50727_32\mycompany.mylibrary#\

Build number in each page of Inno setup -

Image
this question has answer here: inno setup - how can put version number on bottom left corner of welcome page 1 answer inno setup 5.5.7 changes default value of disablewelcomepage true match microsoft's desktop applications guidelines - in order reduce number of user's clicks. me, single important information on welcome page version , build number of product. indeed, example microsoft shows build number in bottom lower corner - left of "next" button. how can program this? you can use tnewstatictext achieve that. simple example: #define myappversion "6.3.129.200"; [code] procedure initializewizard; var statictext: tnewstatictext; begin statictext := tnewstatictext.create(wizardform); statictext.parent := wizardform; statictext.left := wizardform.outernotebook.width - (wizardform.cancelbutton.left + wizardform.c

Rails 4: Validate file, then import if conditions met -

i importing file using smartercsv , have 1 function validates aspects of file, , redirects you, displaying results. i display include button says "import", allows import same file long satisfied displayed. how can pass file second function after redirect without having select file again? # validate file , check display def check_file @success, @error = timecard.check_timecard(params[:file]) redirect_to timecards_path, notice: [@success, @error] end #import database if display satisfactory def bulk_upload x = timecard.import(params[:file]) redirect_to timecards_path, notice: "times imported successfully." end #view showing display <% if flash[:notice].is_a? string %> <%= flash[:notice] %> <% elsif flash[:notice].is_a? array %> <div class="container"> <div class="col-xs-10 col-xs-offset-1"> <table class="table table-hover table-striped table-bordered"

type conversion - c++ converting int to char + add leading zeros to char -

i got numbers 0 999. how can achieve following int = 123;//possible values 0-999 char i_char[3] = /*do conversion of int char , add 3 leading zeros*/ example(s): i_char shall "001" i=1 , "011" i=11 or "101" i=101 it appears looking sprintf, or perhaps printf. int = 123; char str[10]; sprintf(str, "%03d", i);