Posts

Showing posts from March, 2011

java - How to return mysql function select count -

i tring count value of sql select using mysql function. functions executes without errors when try value using java following error appeared. 25-may-2016 05:14:02.180 severe [http-nio-8084-exec-109] core.applicationmgt.get_new_application_count null com.mysql.jdbc.exceptions.jdbc4.mysqlsyntaxerrorexception: unknown column 'temp' in 'field list' here mysql funtion delimiter // create function application_api_get_new_application_count() returns integer begin if((select count(*) temp application_view status = 'new')>0) return temp; end if; return 0; end// this function call point public int get_new_application_count() { callablestatement stmt; int temp_ = 0; try { stmt = mysqlmanager.getdbconnection().preparecall("{ ? = call application_api_get_new_application_count()}"); stmt.registeroutparameter(1, java.sql.types.integer); stmt.execute(); temp_ = s

pandas - Rolling average pairwise correlation in Python -

i have daily returns 3 markets (gld, spy, , uso). goal calculate the average pairwise correlation correlation matrix on rolling basis of 130 days. my starting point was: import numpy np import pandas pd import os os import pandas.io.data web import datetime datetime pandas.io.data import datareader stocks = ['spy', 'gld', 'uso'] start = datetime.datetime(2010,1,1) end = datetime.datetime(2016,1,1) df = web.datareader(stocks, 'yahoo', start, end) adj_close_df = df['adj close'] returns = adj_close_df.pct_change(1).dropna() returns = returns.dropna() rollingcor = returns.rolling(130).corr() this creates panel of correlation matrices. however, extracting lower(or upper) triangles, removing diagonals , calculating average each observation i've drawn blank. ideally output each date in series can index dates. maybe i've started wrong place appreciated. to average pairwise correlation, can find sum of correlation matrix,

list - Writing a ListIterator that mirrors Java's built in Iterator -

so i'm attempting mirror functionality of java's listiterator . thing i'm having trouble wrapping head around getting previous() method working correctly. here's have. public listiterator300<item> listiterator() { return new listiterator300<item>() { private node<item> n = first; public boolean hasnext() { return n.next != last; } public item next() { n = n.next; return n.data; } public void remove() { } public boolean hasprevious() { return n.previous != first; } public item previous() { n = n.previous; return n.data; } }; } so, issue i'm running having previous() , next() methods, when called subsequently, return same number. i've read built in listiterator uses cursor. there general ti

css - HTML Navigation Bar, fixed at the top of webpage, horizontal boxes(buttons) -

i trying navbar show @ top of webpage, have horizontal buttons inside of clean box. similar navbar found @ http://www.apple.com/ . feel if should know how this, apparently not. appreciated, or points , tips. thank , below code have far. css shown first, , html. body{ border: solid; background-color: white; color: black; text-align: center; } table.slideshow{ } th.slideshowtitle{ text-align: center; } footer{ border-top: solid 10px; } /*nav bar*/ .navbar-inverse { background-color:black; } <!doctype html> <html> <head> <link href="c:\users\chester szydlowski\desktop\hof\stylesheet.css" type="text/css" rel= "stylesheet" /> <title> hall of framers </title> </head> <body> <nav class ="navbar navbar-inverse navbar-fixed-top"> <div class="container"> <div class="navbar-header&q

c++ - Access violation writing location on creation of new array -

i working on homework assignment , instructor class not allow ask questions. demands try figure out on our own have been trying work past week , throwing same error , have no clue why. have done google searches , browsed has similar error , couldn't find solution. it works fine until after creates new array , user input entered start filling new array, throws : first-chance exception @ 0x000b517b in 6b.exe: 0xc0000005: access violation writing location 0x00008147. program '[4112] 6b.exe' has exited code 0 (0x0). #include "stdafx.h" #include <iostream> using namespace std; int* read_data(int& size){ size++; return &size; } void main(){ int size = 0; // size 0 start int max = 10; // set max 10 start float user; //user imputed float number cout << "start entering numbers.\n sure hit return between each one.\nwhen finished, hit 'q'\n"; float *a = new float [max]; //set first arr

Git: List the branches for merge in progress -

my team programs in labview, stores of it's source code in binary files. means when "merging" 99% of time you're selection file merge base, or branch. i'd make visual tool (source tree little pokey in situation). ui run bunch of following commands: git checkout --ours ... git checkout --theirs .... my question: there way nice user friendly branch name corresponds "ours" , "theirs"? the ours branch branch on when started merge, say, whatever head names. (this assumes head names branch, i.e., not on special anonymous "detached head" branch when start merge.) to symbolic name of current branch: git symbolic-ref head this prints full name ( refs/heads/master ) standard output , exits success (zero) status, or prints fatal: ... message stderr , exits failure (nonzero) status. add -q suppress failure messages; add --short suppress refs/heads/ part output on success. the name(s), if any, of other branch(e

c++ - Writing Recursive code iteratively -

i have following recursive code want change iterative code. unsure of begin function complex recursive calls @ 2 locations. possible iterative implementations below function ? int ncip(int dim, double r){ int n, r = (int)floor(r); if (dim == 1) return 1 + 2*r; n = ncip(dim-1, r); // last coord 0 (int i=1; i<=r; ++i){ n += 2*ncip(dim-1, sqrt(r*r - i*i) ); // last coord +- } return n; } one common approach use stack function calls. simple implementation follows , can optimization on it int ncip(int dim, double r){ typedef pair<int, double> data; // ties parameters 1 unit stack<data> s; s.push(make_pair(dim,r)); // push first set of parameters int n = 0; while(false == s.empty()) { // loop until stack depleted auto item = s.top(); // top item , pop after s.pop(); int r = static_cast<int>(floor(item.second)); if (item.first == 1) { n += 1 + 2*

docker - Possibility of using gluster volume in k8s if glusterfs client package on container -

kubernetes supports several types of volumes including glusterfs. glusterfs can persistent volumes in k8s. https://github.com/kubernetes/kubernetes/tree/release-1.2/examples/glusterfs/ for using glusterfs volumes in k8s, 1 of prerequisites "install glusterfs client package on kubernetes nodes". if expect shall in containers. possible put gluster client in container (e.g. daemonset deploy gluster client on k8s node first), while k8s still can suing glusterfs above example? will k8s support such using scenarios? nothing officially supported via way described @ moment, take @ blog post, outlines describe: https://huaminchen.wordpress.com/2016/03/22/yet-another-containerized-mounter-for-kubernetes/

wordpress - Want to show first 100 characters of recent posts in sidebar then "Read More" -

i'm creating first custom theme on wordpress , trying familiar codex. have "news" section on bottom right of sidebar. want show previews of last 2 posts or so. want show title, date, , first 100 characters or of recent post followed "read more" anchor. idea function can use? here's 1 way of doing it: <h2>recent posts</h2> <ul> <?php $args = array( 'numberposts' => '2' ); $recent_posts = wp_get_recent_posts( $args ); foreach( $recent_posts $recent ){ echo '<li>'.$recent["post_title"].' - '.$recent["post_excerpt"].'<a href="'.get_permalink($recent["id"]).'">read more</a></li>'; } ?> </ul> more info here: http://codex.wordpress.org/function_reference/wp_get_recent_posts

google app engine - How to solving ImportError: No module named scraping -

this rj. have question google web engine python. when deploy scraping source code, following error occurred. please me solve problem. error code follows, error 2016-05-25 01:13:25,282 wsgi.py:263] traceback (most recent call last): file "c:\program files (x86)\google\google_appengine\google\appengine\runtime\wsgi.py", line 240, in handle handler = _config_handle.add_wsgi_middleware(self._loadhandler()) file "c:\program files (x86)\google\google_appengine\google\appengine\runtime\wsgi.py", line 299, in _loadhandler handler, path, err = loadobject(self._handler) file "c:\program files (x86)\google\google_appengine\google\appengine\runtime\wsgi.py", line 85, in loadobject obj = __import__(path[0]) importerror: no module named scraping_ert_v1 info 2016-05-25 10:13:25,289 module.py:788] default: "get / http/1.1" 500 -

r - Determine the number of datapoints that meet a criteria -

how can find out number of datapoints have in data frame, meet specific criteria? group<-c("group 1","group 1","group 1","group 2","group 2") factor<-c("factor 1", "factor 1", "factor 2", "factor 1", "factor 2") data<-data.frame(cbind(group,factor)) data for instance, know how many data points in group 1, factor 2. think should able use summary function, can't figure out how specify want combinations of factor levels. instance: summary(data) #verifies group 1 appears 3 times, , factor 2 appears twice, no information on how many times group 1 , factor 2 appear in same row so, how summary table of combinations of different factor levels? use logical test , sum specific combination: sum(with(data,group=="group 1" & factor=="factor 2")) [1] 1 to extend this, use table : with(data,table(group,factor)) factor group

loops - Change Calculation Program in C -

i'm beginning studying programming , trying write program display how many of each denomination of currency required given amount of change. i'm studying in japan, currency yen, think basic code universal. i've seen other similar programs online, mine has few features may cause of problem, i'm not sure. first user inputs whether or not there two-thousand yen bills in register or not. (as these bills not common). enter total amount due. enter how paid. calculates change , how of each denomination , displays it. however, after enter amount paid, cursor goes next line , sits there indefinitely. don't know what's causing this. guess it's getting stuck in loop somewhere. does see problem? (*i switched text printed english) #define _crt_secure_no_warnings #include <stdio.h> int main(void) { //入力 int aru; printf("are there 2-thousand yen bills in register?\n 1.) yes\n 2.) no\n "); //レジに2千円札が入ってますか?\n 1.) 入ってます\n 2.)入ってません

python - How to "patch" _response.py in Mechanize -

i had issue ntlm authentication , mechanize. after going through below post understood need modify _response.py file of mechanize. use python mechanize log pages ntlm authentication but not sure file location is. find .egg file mechanize present @ location: c:\python27\lib\site-packages can please explain me how patching done. supposed edit file inside egg file? i figured out. i removed .egg file present in location c:\python27\lib\site-packages. then edited _response.py present inside zip downloaded install mechanize. then installed mechanize again. to verify opened .egg file , checked _reponse.py file.

java - Jersey 415 Unsupported Media Type -

i have been trying since hours correct http error 415 unsupported media type still showing media unsupported page. adding headers application/json in postman. here java code package lostlove; import javax.ws.rs.consumes; import javax.ws.rs.get; import javax.ws.rs.post; import javax.ws.rs.path; import javax.ws.rs.pathparam; import javax.ws.rs.produces; import javax.ws.rs.core.mediatype; import javax.ws.rs.core.response; import org.json.jsonobject; @path("/story") public class story { @post @consumes({"application/json"}) @produces(mediatype.application_json) // @consumes(mediatype.application_json) // @path("/story") public jsonobject sayjsontexthello(jsonobject inputjsonobj) throws exception { string input = (string) inputjsonobj.get("input"); string output = "the input sent :" + input; jsonobject outputjsonobj = new jsonobject(); outputjsonobj.p

Pulling information from a previous webpage error (Angular2, Typescript, javascript, html) -

i'm making ebay clone website makes auction/bidding system wikipedia search results. screenshot of search results: first screenshot screenshot of different webpage (the "apple" in screenshot should instead "a"): second screenshot i'm trying make variable consistent: item.name screenshot of error when trying {{item.name}} consistent: dropbox.com/s/wlcovvt8x5v7cne/screenthis.png?dl=0 code of biddingpage.component.html causes error: <label for="name">name of item: {{item.name}} </label> <p> </p> link full project: dropbox.com/s/84svnggv8xeub5m/fullprojectebayclone.zip?dl=0 name of code files changing: wiki.component.ts biddingpage.component.html biddingpage.component.ts link plunker of full project (currently not working): plnkr.co/edit/1lci4durhwa8d9iqtqsf?p=info code of wiki.component.ts: import { component } 'angular2/core'; import { jsonp_providers } &#

How to require keyword arguments in Common Lisp? -

given (defun show-arg (a) (format t "a ~a~%" a)) (defun show-key (&key a) (format t "a ~a~%" a)) evaluating (show-arg) will lead error saying "invalid number of arguments: 0", where (show-key) will display a nil how can show-key signal error show-arg does? there way other using (unless (error "a required")) in function body? fond of keyword arguments , use them constantly, , want them required. keyword arguments optional, need manually check if they're given , signal error if needed. better not require keyword arguments though. compiler won't recognize them required , won't given error message missing arguments @ compile time. if want require them, can specify arguments 3 element list; first element being argument, second default value , third variable true if argument given. checking third element better checking keyword itself, because can tell difference between nil default, , nil user

database - Finding Lowest Start DateTime and Highest End DateTime in each group by only EntryDate and Emp_id in MS SQL Server -

Image
i want find lowest "startdatetime" highest "enddatetime" when i'm grouping data the date portion of "entrydate"( ignoring time portion ) "empl_id" in ms sql server my data looks this what results should like this ? select emp_id, min (startdatetime), max (enddatetime) yourtable group emp_id, convert(date, entrydate)

shiny - Where can I deploy R script and schedule to run it in a timely manner? -

i have small r script. typically, 15-20 lines of code. script replies random people on twitter. working fine when run code. now, want auto run after fixed intervals of time. so, made .bat file of r script , scheduled task in windows scheduler run after every 15 mins. works fine , way expect work. now, problem scheduler works when system working. once shut down system, scheduler stops working , script not execute. i want server (not sure if right word), can host r file or bat file , can schedule script execute after every x mins. need server (??) because want active 24 x 7. i have tried deploying on shinyapps.io somehow doesn't work. have gone through this well, no help. appreciated. thanks!

PHP Laravel : How to logout from other device with same userId forcefully -

i'm building laravel application user logged in other device , while logged out want force him logged out other device also. how implement in laravel. personally have used redis server that.but don't know why it's not working. while running program have run redis-server.exe also.and i'm in windows. , here controller have written login forcing user logged out other device. if find solution please me find out.thanks in advance. controller: public function postsignin(request $request) { if (auth::attempt(['email' => $request['email'], 'password' =>$request['password'] ]) ) { $redis = \redis::connection(); $userid = auth::user()->id; $redis->sadd('users:sessions:' . $userid,session::getid()); return redirect()->route('main'); } return redirect()->back(); } public function getlogout() { $redis = redis::connection(); $userid =aut

How to calculate width, height and position of bezier curve -

i have bezier curve defined start point, end point , 2 control points (parameters of this: http://www.w3schools.com/tags/canvas_beziercurveto.asp ). first, need calculate width , height of curve. if make rectangle around curve, width , height need. need start point (x,y of left top corner) of rectangle. how can calculate ? thanks. i found approximate solution in other topic (i don't remember one) here simple js function calculate it: function getcurveboundary(ax, ay, bx, by, cx, cy, dx, dy) { var tobx = bx - ax; var toby = - ay; var tocx = cx - bx; var tocy = cy - by; var todx = dx - cx; var tody = dy - cy; var step = 1 / 40; // precission var d, px, py, qx, qy, rx, ry, tx, ty, sx, sy, x, y, i, minx, miny, maxx, maxy; function min(num1, num2) { if (num1 > num2) return num2; if (num1 < num2) return num1; return num1;

java - Hibernate generating a query from Named Query that joins on the wrong column? -

i using named query (hibernate 4).entity defined below. @entity @namedquery( name = "findallproduct", query = "select pc.pincode,po.description" +" product_vendor_payment_option_location pvpol" +" inner join pvpol.paymentid pid" +" inner join pvpol.pincode pc" +" inner join pvpol.paymentoptions po" +" pvpol.id = :id" ) public class product_vendor_payment_option_location extends baseentity.entity { @id @generatedvalue(strategy=generationtype.auto) private int id; @column(name="payment_id") @onetomany(cascade=cascadetype.all,fetch=fetchtype.eager,mappedby="id") private set<product_catalog_vendor> paymentid; @column(name="pincode_id") @onetomany(cascade=cascadetype.all,fetch=fetchtype.eager,mappedby="pincode_id")

android - How can I check permission under API level 23? -

this question has answer here: is available set checkselfpermission on minimum sdk < 23? 5 answers one of app has permission record_audio , app's targetsdkversion 22. cannot check permission @ runtime. notice if install app in android 6.0 , above. users can manually deny permission in system app permissions settings. question how can check whether app grand audio permission under api level 23? i have searched quite long time find document how check permission in android m. i have noticed context has function checkcallingorselfpermission , it's behavior strange under android 6.0. using solution here . after manually close app permission in system app settings. result not expect. string permission = "android.permission.record_audio"; int ret = context.checkcallingpermission(permission); forget mention: minsdkversion 9 targetsdkversion

verilog code to find a single max value for an input that has 1000 samples values -

i want find single max value input signal has 1000 decimal values read memory once every positive clk edge.i did following rough code finding max value didn't give me correct max value/number please me can find single max value in these 1000 values of input signal..`thanks in advance module(input clk, input [15:0]din, output [15:0]dout); reg [15:0] max=0; @ (posedge clk) if(din>max) max<=din; else max<=0; assign dout=max; endmodule assumption 1: if memory read operation of 1000 valuation out of finding max value module no need track how many values read. module find_max (input clk, input [15:0] din, output [15:0] dout ); reg [15:0] max=0; @ (posedge clk) begin if(din > max) max <= din; else max <= max; end assign dout = max; endmodule your max value reflected in output after next cycle of being fed find_max module. assumption 2: if outof find_max module not ta

javascript - Browsers back button click with confirm box -

need create javascript confirm pop on click of browsers button. if click on button pop come , "you want go ahead ?" if click on yes have redirected previous page. i have following code not working per requirement. if(window.history && history.pushstate){ // check history api support window.addeventlistener('load', function(){ // create history states history.pushstate(-1, null); // state history.pushstate(0, null); // main state history.pushstate(1, null); // forward state history.go(-1); // start in main state this.addeventlistener('popstate', function(event, state){ // check history state , fire custom events if(state = event.state){ event = document.createevent('event'); event.initevent(state > 0 ? 'next' : 'previous', true, true); this.dispat

Is it possible to deep link for the android fragment -

how apply deep linking of fragment page while app invitation. easy handle deep linking activity class, how can manage android fragment deep linking ? it impossible put deep link fragment but, can sent deep link main activity then, can filter string deep link belongs fragment , can trigger fragment string.

html - how to apply print stylesheets in email templates as the <style> tag gets discarded by the email clients? -

i developing html email templates, page supports print feature. style of html document should differ, when 1 prints same. so, have added internal stylesheet print (only) , rest of styling being leveraged inline styles, using below: <style type="text/css"> @media print { /* print related styles */ } </style> i know @media print {..} , media="print" isn't supported email clients , have no issue them, issue -: the styles have added print, being removed entirely clients . unable target dom providing different styles print. this done many emails google , others, remove style / script , other stuff... you need figure away use inline styling instead

How Can I pass a javascript variable value to MVC controller? -

just example: in javascript, have 2 variable values: movie id: 2 rating value: 3 i need pass values mvc controller. for start, easiest way use ajax call jquery. here example: first create action this. using index starting action should create view, , view passing data movies action public actionresult index() { return view(); } public actionresult movies(int movieid, int ratingvalue) { string s = movieid + " - " + ratingvalue; return json(s, jsonrequestbehavior.allowget); } **now creating view index sending data on button click. , import jquery file , use in tag can see below ** <html> <head> <meta name="viewport" content="width=device-width" /> <title>index</title> <script src="~/scripts/jquery-2.2.3.min.js"></script> <script type="text/javascript"> $(function () { $('#senddata').click(f

tabstop - How to set tab indentation in Google Code? -

Image
i use visual studio development environment, , tab indentation 4, after commit google code, indentation 8 in browser, makes code ugly. does know how reset tab indentation 4 when looking @ in web browser? apparently not supported. this enhancement request filed 5 years ago, , still marked "won't fix": if rely on tabs width other 8 spaces code formatted correctly, other contributors have trouble reading code. if prefer hard tabs, it's practice use spaces (not tabs) formatting/alignment other plain indentation: way, code right no matter tab width. i don't see taking action on in foreseeable future: adding complexity project administration enable isn't such great idea anyway. – artdent so looks out of luck. guess that's using tabs instead of spaces. tabs require far support editor, , high quality editors sadly still not ubiquitous. it trivial configure visual studio use spaces everywhere instead of tabs, includ

php - How to show two different categories in wordpress? -

actually i've static website , i'm trying convert wordpress, i'm new wordpress. have created following page. header.php footer.php sidebar.php functions.php index.php then have created main-template.php page other pages about, contact, gallery, etc, using same template. website completed 2 pages left. 1. jobs 2. news & events so in these pages, there new jobs coming, , same news & events. think these 2 pages blog post. jobs page display jobs title , 100 words description , read more button, open in new page particular job. i have different job categories electrician , plumber , mason , english language , call center etc i want show categories jobs on jobs page. so have created page in wp-admin>pages>add new called jobs , newsevents , selected template main-template have used pages. page blog type show jobs. as know having 2 blog type pages 1 jobs , 1 news events have created 2 categories jobs & newsevents now if add new

angular - How to read Angular2 json map object in angular2 -

i trying fetch json object in angular 2 has key value pair. your question not clear. demonstrate things understood question. here's sample code (assuming value pair username & password ) let params:urlsearchparams = new urlsearchparams(); params.set('username', username); params.set("password", password); return this.http.post(this.baseurl + '/auth/credential', '', {search: params}).map((res:response) => res.json()); i defined above method getuserdetails() global service , import dataservice particular component mentioned below,assuming server send reply inside array called results (cant out looking @ back-end implementation of project) this.dataservice.getuserdetails().subscribe( (data) => { console.log('fetched userdata edit', data.results) this.modify_users = data.results; console.log(data.results); console.lo

python - Dividing a series containing datetime by a series containing an integer in Pandas -

i have series s1 of type datetime , has time represents range between start time , end time - typical values 7 days, 4 hours 5 mins etc. have series s2 contains integers number of events happened in time range. i want calculate event frequency by: event_freq = s1 / s2 i error: cannot operate on series out rhs of series/ndarray of type datetime64[ns] or timedelta whats best way fix this? thanks in advance! example of s1 is: some_id 1 2012-09-02 09:18:40 3 2012-04-02 09:36:39 4 2012-02-02 09:58:02 5 2013-02-09 14:31:52 6 2012-01-09 12:59:20 example of s2 is: some_id 1 3 3 1 4 1 5 2 6 1 8 1 10 3 12 2 this might possibly bug works operate on underlying numpy array so: import pandas pd pandas import series startdate = series(pd.date_range('2013-01-01', '2013-01-03')) enddate = series(pd.date_range('2013-03

database - Does com.android.providers.calendar remove deleted events or just flag them as deleted? -

in android kitkat, com.android.providers.calendar remove deleted calendar events calendar storage databases, or flag them deleted? if flag them in database, write database reflect deletion? i interested in how pertains local (non-synced) calendars, technical responses regarding both local , synced calendars welcome. if question belongs on android se instead of here, please migrate it. decided post here because (1) more technical audience here might able answer question, , (2) android se recognize programming-related question , migrate stackoverflow. event has deleted column , dirty column. as experienced, calendarprovider doesn't special thing these columns , work you. if delete event delete query removed database. calendar apps such google calendar work in way: if kind of update or delete has occurred on event, dirty column set true. if event deleted user, deleted column set true. so when syncadapter starts syncing, finds non-synced events whit

javascript - How to add an element to another one(instead of using selector) -

i found in document can create element , add 1 like: var sel = document.createelement("select"); var opt1 = document.createelement("option"); var opt2 = document.createelement("option"); opt1.value = "1"; opt1.text = "option: value 1"; opt2.value = "2"; opt2.text = "option: value 2"; sel.add(opt1, null); sel.add(opt2, null); but when tried apply practice, method doesn't work, newuser not added newdiv successfully: function createonele(imgsrc, user, extract) { var newdiv = document.createelement("div"); var newuser = document.createelement("span"); newuser.textcontent = user; newdiv.add(newuser); } it seems add method doesn't work div , span , if true, how achieve it? otherwise, did wrong? .add method of select-element used add option-element it. refer htmlselectelement.add() use .appendchild() the node.appendchild() method adds node

solr - In Retrieve and rank how to tell service that the words are of same context -

for example want query "tell me fever symptoms" breaks "fever" , "symptoms" gives wrong results. in apache solr can query double quotes in rnr not make difference. also ground truth queries returned wrong result. suppose "what symptoms of fever" query solr indexes "what", "are", "the", "symptoms", "of", "fever". practice add what,why,how etc stopwords because doing change meaning of query. please me on this.

asp.net mvc - EF 6, Code First Database table not create -

i have group user class: [table("tblgroupuser")] public class usergroup : mytemplate { public usergroup() { users = new list<user>(); } [key] [displayname("group code"), column("groupcode", typename = "varchar")] [maxlength(20, errormessage = "group code maximum length {0}")] [required(allowemptystrings = false, errormessage = "{0} required")] public string groupcode { get; set; } [displayname("group name")] [maxlength(20, errormessage = "group code maximum length {0}")] [required(allowemptystrings = false, errormessage = "{0} required")] public string groupname { get; set; } public virtual list<user> users { get; set; } } user class : [table("tbluser")] public class user : mytemplate { public user() { usergroup = new

Sending data from backend to Ember.JS -

anybody knows possible (and how achieve that) send data backend ember.js, communication should initialized backend? you can use sockets send data backend ember application. https://github.com/wildhoney/embersockets pretty ember addon connect backend through sockets.

c# - The given key was not present in the dictionary Microsoft CRM Plugin -

another microsoft crm plugin related question. plugin firing when invoice record updated. want copy contents of of invoice fields corresponding fields on commission record. if contains due date seems work ok if containing invoiceamount gives key not present error. have checked field names correct , exist in correct entities. any ideas what's happening? need use images , if so, me code, please? thanks // <copyright file="preinvoiceupdate.cs" company=""> // copyright (c) 2013 rights reserved // </copyright> // <author></author> // <date>8/8/2013 10:40:22 am</date> // <summary>implements preinvoiceupdate plugin.</summary> // <auto-generated> // code generated tool. // runtime version:4.0.30319.1 // </auto-generated> namespace updatecommission { using system; using system.servicemodel; using microsoft.xrm.sdk; using microsoft.xrm.sdk.query; /// <summary> ///

java - Input Validation on Parsed Code -

in below code user prompted enter numerical grade or hit "s" || "s" skip requirement. input in form of string. in case input not "s"||"s", input parsed double. code works perfectly. now, want input data validation , restrict input either "s" or "s" or number 0-100. there way without creating each term in form of string? e.g. ( line == "0" || line == "1" etc... till 100 // prompting user score (numerical grade) system.out.println("kindly input numerical score: (enter s skip)"); // reading input line variable of string datatype string line = input.nextline(); // checking if line =="s" or =="s" skip, otherwise // value parsed double if("s".equals(line) || "s".equals(line)) { }else try { score = double.parsedouble(line); system.out.println(score); } catch( numberformatexception nfe) { } you parsing value double . check val

docker - Should Swarm Master Join As Node in a Single Node Cluster? -

we building small cluster, , (strange) requirement setup in 1 machine, other machines can join in future. i set consul with: docker run -d -p 8500:8500 --name=consul progrium/consul -server -bootstrap and master with: docker run -d -p 4000:4000 swarm manage -h :4000 --advertise <ip_here>:4000 consul://<ip_here>:8500 where docker run with: sudo docker daemon -h tcp://0.0.0.0:2375 -h unix:///var/run/docker.sock and docker -h :4000 info lists nodes 0 @ stage, cannot run images docker -h :4000 run <image> because no healthy node available in cluster. when join master node cluster with: docker run -d swarm join --advertise=<ip_here>:2375 consul://<ip_here>:8500 then docker -h :4000 info lists nodes 1, , can run containers. please note <ip_here> refers same ip of machine. is intended behaviour? if not, doing wrong? after seeing docker machine's way of creating swarm cluster, using swarm integrated docker v1.12.0

javascript - How does setTimeout(console.log.bind(console, "something")) work? -

Image
after reading how hide source of log messages in console? , i'm confused how command works. i try not use settimeout wrap it, console log show source of log messages. try see stack trace, shows nothing second line: what settimeout(console.log.bind(console, "something")) do? , seems cannnot remove settimeout? is there other way same thing? let's take piece-by-piece: what console.log.bind(console, "something") ? the function#bind function creates new function that, when called, call original function using first argument this call , passing along further arguments. console.log.bind(console, "something") creates (but doesn't call) function that, when is called, call console.log this set console , passing along "something" first argument. what settimeout(x, y) ? it schedules function x called after y milliseconds browser; if don't supply y , defaults 0 (call immediately, current code completes).

terraform - Error "softlayer_virtual_guest.my_server_1: Error creating virtual guest: softlayer-go: could not SoftLayer_Virtual_Guest#createObject -

i testing terraform on softlayer on applying below error on applying ssh key gets added softlayer whereas environment isn't created following error softlayer_virtual_guest.my_server_1: error creating virtual guest: softlayer-go: not softlayer_virtual_guest#createobject, http error code: '500' need please i able create server, code used was: provider "softlayer" { username = "set me" api_key = "set me" } # virtual server created existing ssh key in softlayer \ # inventory , not created using terraform template. resource "softlayer_virtual_guest" "my_server_1" { name = "rcvtest-11" domain = "softlayer.com" ssh_keys = ["269479"] image = "debian_7_64" region = "ams01" public_network_speed = 10 cpu = 1 ram = 1024 local_disk = true hourly_billing = true } however, if continue getting issue, can report in: https://gi

Remove multiple selection from asp.net core application -

i have list<selectlistitem> variable 2 values. want represent dropdown box in html i'm doing this. <div class="form-group row"> <label asp-for="roles" class="col-sm-2 col-sm-offset-2 form-control-label"></label> <div class="col-md-6"> <select asp-for="roles" asp-items="@model.roles" class="form-control selectpicker bs-select-hidden"></select> </div> </div> and code shows me list 2 items, generates multiple="multiple" attribute select tag. how can make not generate multiple attribute? set multiple=false in select

how to get the maximum value from a specific portion of a array in python -

i have specific scenario need scan specific portion of array maximum value of portion , return position of value regards entire array. example searcharray = [10,20,30,40,50,60,100,80,90,110] i want scan max value in portion 3 8, (40,50,60,100,80,90) and return location of value. so in case max value 100 , location 6 is there way using python alone or oy numpy first slice list , use index on max function: searcharray = [10,20,30,40,50,60,100,80,90,110] slicedarray = searcharray[3:9] print slicedarray.index(max(slicedarray))+3 this returns index of sliced array, plus added beginslice

html - Convert div to table; extract div or table -

i parsed website containing main content in table using html::tableextract. works fine. website has main content in div tags stored. i to: convert div table using html::tableextract or parsing div tags html::tableextract the major goal not find/parse html file classes , tags, because website changing layout (html classes) in little ways every week, parsing would fail @ points. using html::tableextract , parse coords of table, more independency. does has idea?

y axis on d3.js Stacked Bar Chart -

Image
i display y axis on d3.js stacked bar chart. can display x axis can not display y one. here code y axis never displays. made mistake sure can not see where. var w = 600, h = 500 var dataset = [ {"month":"jan","purchased":6,"sold":3}, {"month":"fev","purchased":7,"sold":5}, {"month":"mars","purchased":4,"sold":3}, {"month":"avr","purchased":4,"sold":2}, {"month":"mai","purchased":8,"sold":1}, {"month":"juin","purchased":3,"sold":3}, {"month":"juil","purchased":3,"sold":4}, {"month":"aou","purchased":4,"sold":2}, {"month":"sept","purchased":6,"sold":3}, {"month":"oct","purchased":6,"sold&quo

c# - Can't immediately receive multiple notifications in Npgsql -

today wrote following code works postgresql c# library named npgsql: using system; using system.collections.generic; using system.linq; using system.text; using system.threading.tasks; using npgsql; namespace postgresqlnotificationstest { class program { static void main(string[] args) { using (var conn = new npgsqlconnection("server=127.0.0.1;port=5432;user id=postgres;password=my_password;database=helper_db.psql;syncnotification=true")) { conn.notification += onnotification; conn.open(); using (var command = new npgsqlcommand("listen notifytest;", conn)) { command.executenonquery(); } console.readline(); }; } private static void onnotification(object sender, npgsqlnotificationeventargs e) { console.writeline("event handled: " + e.addition

Android - wlan0 doesn't exist -

i'm using galaxy s2 (rom 4.1.2). turn off wifi using command : netcfg the above command lists available nic. doesn't have "wlan0" in it. use : ifconfig wlan0 it shows : error: siocgifflags (no such device) until turn wifi function on, wlan0 added. now i'm developing hotspot application need config options wlan0 interface. in galaxy s1 (rom 4.2.2). when wifi function turns off. still show wlan0 as: wlan0 down 0.0.0.0/0 0x00001002 00:26:37:63:d8:ab so question is: there anyway can add wlan0 when don't use wifi function? i know 1 year late still .... installed busybox , terminal app , checked available interfaces following command busybox ifconfig -a what got know wireless interface phone named "eth0" instead of "wlan0" hope helps .. better late never .

qtableview - create a table in Qt and fill it by the user -

i want create qt application containing table of 3 columns , n row, user choose number of row putting in edit button , table have 3 columns , number given user. fill element i have search lot found how fill able sql data, please having idea? here did far, have fixed number of rows , columns not want, besides, want use either qtablewidget or qtavleviewitem int n; n = ui->spinbox->value(); qstandarditemmodel *model = new qstandarditemmodel(n,3,this); //2 rows , 3 columns model->sethorizontalheaderitem(0, new qstandarditem(qstring("x"))); model->sethorizontalheaderitem(1, new qstandarditem(qstring("y"))); model->sethorizontalheaderitem(2, new qstandarditem(qstring("z"))); ui->tableview->setmodel(model); you can go through elements in qtableview , things them: for(int r=0; r<n_rows; r++) { for(int c=0; c<n_cols; c++) { qmodelindex index = ui->tableview->m

php - Retrieve rows which have comma separated values in corresponding column -

i have category list. , have posts have multiple category. such .. php category,, first post has php , javascript, wordpress category , second post has php , mysql category in 1 column. now when click on php category, time posts have php category retrieved. please idea how can retrieve posts based on 1 category if has multiple category in 1 column. what need find_in_set() mysql function. select * tablename find_in_set('php', category_column); find_in_set() returns position of php in category_column , used in where clause true except 0 , returned when substring not found. as disclaimer i'd mention, seems, have bad design of database. shouldn't put multiple values in 1 field. may in trouble developing further features in app later.

php - Login on webapp by token sent by e-mail -

i building webapp supposed hosted in company servers , used through intranet. requirements are: the user accesses webapp. the app requests e-mail address. an e-mail containing unique link (token) sent address. the user clicks on link log in without password. i developing webapp using symfony3 , thought of using friendsofsymfony user bundle. how can acheive that? fosuserbundle not mandatory. the login functionalities want achieve not diver e.g. resetting password email. except temporary token in use case used authenticate user instead of authenticating password reset. a simple explanation you should create entity stores authentication token, e.g. autologin has user , token , timestamp property. on submit of 'authentication form' new autologin record gets stored relationship towards user , user gets notified email. whenever user clicks link should have method validates timestamp timeframe , authenticate user user provider. examples symfony 2:

Upload image to Lambda using gateway API -

i'm trying let user upload pictures lambda function processing; using gateway api interface. i tried specify model post method, far keep getting error invalid model specified: validation result: warnings : [], errors : [invalid model schema specified] ... not helpful. i understand cannot directly send raw data lambda , must using kind of formatting in-between. what understood make gateway interface base64 encode data me. i tried using following model schema content type image/jpeg { "body" : $util.base64encode($input.body) } how send image ? there no native support in api gateway binary data have seen. working on don't have eta you. customers have had success base64 encoding data have in question, should in mapping template in integration request not method request. if set content type image/jpeg, encoding apply when content-type header on incoming request image/jpeg, make sure set that. you can reject incoming requests method