Posts

Showing posts from April, 2010

openid - Options for performing load testing with identity tokens -

i have api expecting openid connect user tokens generated identityserver3 instance manage. need perform load testing on api, , not sure of best way go this. the non-protected parts of api easy test. however, several api methods require user authenticated bearer token. are there standard approaches load testing when using openid connect tokens, or identityserver3 in particular? given bearer token seems application uses oauth2 need load testing tool which: can send authorization http header containing token preferably have mechanism automatically or semi-automatically token check out example: soapui -> oauth2 authorization apache jmeter -> how run performance tests on oauth secured apps jmeter

java - how to map empty string with Map using jackson mapper -

my json string { "fieldinfo":{ "field1":{ "fieldname":"test1", "values":"" }, "field2":{ "fieldname":"test2", "values":{ "test":"5", "test1":"2" } } } } i facing problem while map values filed. in json string, values filed either empty string or map. mapping values field in below mentioned variable. @jsonproperty("values") private map<string, string> values; so problem mapping empty string map.it gives exception, com.fasterxml.jackson.databind.jsonmappingexception: can not instantiate value of type [map type; class java.util.linkedhashmap, [simple type, class java.lang.string] -> [simple type, class java.lang.string]] string value; no single-string constructor/factory method (through reference chain: com.

java - Repeat statement for infinite times using loop? -

i want print like: for(int i=0;i<should infinite;i++) { data loading. sleep(100); data loading.. sleep(100); data loading... sleep(100); } below code not working package com.queen.a01_simple_request; import android.os.bundle; import android.support.v7.app.appcompatactivity; import android.view.view; import android.widget.button; import android.widget.textview; public class mainactivity extends appcompatactivity { textview textview; button button; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); textview = (textview) findviewbyid(r.id.textview); button = (button) findviewbyid(r.id.button); button.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { (; ; ) { try { textview.settext("downloading file"); th

php - How to POST blob as a file using javascript? -

i have form, contents 2 inputs 1 hidden name="action" , second name="avatar" type="file". after user choose file in avatar input image converts blob. how can post blob loaded file , after submited? form: <form enctype="multipart/form-data" method="post" id="avatarform"> <input type="hidden" name="action" value="save" /> <input id="coolbutton" name="avatar" type="file" accept="image/*" class="form-control" placeholder=""> </form> i have try: var fd = new formdata(); fd.append('action', 'save'); fd.append('avatar', file.name); fd.append('data', blob); $.ajax({ type: 'post', url: '/', data: fd, processdata: false, contenttype: false }).done(function(data) { console.log(data); }); php controller: if ($_files['ava

php - Magento - eMail variables -

i want customize order confirmation , can see can use if statements in template , otherwise can customize sendneworderemail() function select 2 different templates based on information. however wondering because use extensions offer customer delivery date , timeslot. use placeholder {{layout handle="deliverydate_email_information" order=$order}} display delivery date. 1 looks in order confirmation: thursday, 28. july, 8pm - 10pm but want have these kind of information in 3 placeholders like: {deliverydate_weekday} {deliverydate_date} {deliverydate_time} does knows how can enhance magento system in way possible? assume can implementing own layout handle="deliverydate_email_information" how do this? thanks! for {deliverydate_weekday} {deliverydate_date} {deliverydate_time} you need define variables in sendneworderemail() shown below (define in custom module sending email or extend class. not edit code file): //get value of $weekday,

excel - VBA - Possibility of saying that SheetChange in specific Range is "something like True"? -

first, must admit newbie here , in vba too. thank forum! :) i have program reacts on sheetchange save data. however, if there formula added macro, doesn't cause sheetchange. copying , inserting values isn't possible - there 7k rows , program acts on every sheetchange (colors , other stuff) - time not bearable. is there possibility have enableevents = false (to turn of getting sheetchange), specify range of changed cells (always rather whole column - there 2 columns interest me) , let program save data. coloring of cells , on remain (this coloring , on has stay in program) is possible work? if could, how should tell macro specific range has sheetchange? apologies if question totally stupid. thank reading @ least. in sheet change event, specify should save when target within specified range. formulas, use calculate event , repeat same code. so, if want save when changed cell in first column , within row range (for example), add if target.column = 1 ,

python - In Scrapy, How to set time limit for each url? -

i trying crawl multiple websites using scrapy link extractor , follow true (recursive) .. looking solution set time limit crawl each url in start_urls list. thanks import scrapy class dmozitem(scrapy.item): title = scrapy.field() link = scrapy.field() desc = scrapy.field() class dmozspider(scrapy.spider): name = "dmoz" allowed_domains = ["dmoz.org"] start_urls = [ "http://www.dmoz.org/computers/programming/languages/python/books/", "http://www.dmoz.org/computers/programming/languages/python/resources/" ] def parse(self, response): sel in response.xpath('//ul/li'): item = dmozitem() item['title'] = sel.xpath('a/text()').extract() item['link'] = sel.xpath('a/@href').extract() item['desc'] = sel.xpath('text()').extract() yield item you need use download_timeout

javascript - AngularJS POST update to database in Rails -

i have app uses angularjs orders page, connects via json api sqlite3/ postrgres database in rails. can create , delete orders angular page, i'm having trouble updating column order shipped (a checkbox). when click on checkbox, js console indicates change of shipped value false true , returns error: post ... /orders/1.json 404(not found) . i think problem might code in rails orders_controller. here code. index.html.erb <input type="checkbox" value="order.shipped" ng-click="changeshipped(order)"> app.js // change shipped status via checkbox $scope.changeshipped = function(order) { order.shipped = !order.shipped; models.orders.save(order); // returns post... 404 (not found) console.log(order.shipped); // indicates true / false } orders_controller.rb class orderscontroller < applicationcontroller protect_from_forgery skip_before_action :verify_authenticity_token, if: :json_request? respond_to :json, :html load_a

How to grep file by another file's line using bash -

the file1 store sentence want grep,here 's content file1 .|||anymore . ,|||arguments ,|||atheists ,|||be ,|||because .|||because the problem it contain space in sentence , , target file2 contain space too, how can search file2 content know whether file2 has these sentence in file1 or not if found output grep result anther file(append) ,if no found output file keep it try this- while ifs= read -r i; #reading file line line , saving lines in $i. grep "$i" file2 >> output #grepping line in second file , outputting. done < file1 your question needs edited give more details though.

ios - XCUITest - UISlider shows up as "Other", unable to perform adjustToNormalizedSliderPosition -

i have tableview cell containing labels , uislider subclass. however, slider not recognized slider type, 'other'. inspecting view, accessibility prints: is accessibility element value 0% adjustable trait on elements <null> description ageslider hint <null> identifier <null> custom action <null> not focused any ideas how let xcuitest recognize slider as, know, slider? this tree printed xcode tableview cell: cell 0x7ff9c2bb95c0: traits: 8589934592, {{0.0, 203.1}, {375.0, 95.0}}, identifier: \'slidercell\' statictext 0x7ff9c2bb9d70: traits: 8589934656, {{19.0, 219.1}, {205.0, 18.0}}, label: \'select minimum age\' statictext 0x7ff9c2bba4c0: traits: 8589934656, {{210.0, 219.1}, {145.0, 18.0}}, label: \'any\' other 0x7ff9c2bbabf0: traits: 8589938688, {{33.0, 248.1}, {309.0, 34.0}}, identifier: \'ageslider\', value: 0%

c# - Finding instance of method -

this question utility script unity3d, problem in c#; i providing script string ( onclickcallbackpath ) looks " gameobjectname.componenttypename.callbackdelegatename ". finding gameobject , component not problem, take @ code: string[] ss = onclickcallbackpath.split ("." [0]); transform onclicktarget = tools.finddeepchild (transform.root, ss [0]); monobehaviour[] allcomponentsontarget = onclicktarget.getcomponents<monobehaviour> (); foreach (monobehaviour mb in allcomponentsontarget) { if (mb.gettype ().name == ss [1]) { methodinfo[] methods = mb.gettype ().getmethods (bindingflags.public); foreach (methodinfo mi in methods) { if (mi.name == ss [2]) { // , here how imagine work, , similar... // of course there no getinstance method in methodinfo action = (action) mi.getinstance(mb);

c# - how to get value of selected row in DropDown and Grid view -

i have 2 question... 1. have gridview bind data form database way datasource = company.getallcompany(); dgvcompanys.autogeneratecolumns = false; dgvcompanys.datasource = _datasource; dgvcolnameen.datapropertyname = "myenglishname"; dgvcoladdress.datapropertyname = "myaddress"; dgvcolcode.datapropertyname = "mycode"; dgvcolkeyid.datapropertyname = "mykeyid"; it's worked want keyid of selected row private void dgvcompanys_selectionchanged(object sender, eventargs e) { if (dgvcompanys.selectedrows.count > 0) { mtxtcode.text=dgvcompanys.selectedrows[0].cells[1].value.tostring(); } } this code have error object reference not set instance of object. have this? question 2.i have textboxdropdownlist(devcomponent) , sourced way: list<company> _datacompany; _datacompany = company.getallcompany(); cmbcompany.displaymember = "mye

osx - Flycheck package status obsolete -

Image
i trying integrate flycheck emacs. installed flycheck exec-path , js-standard through package manager. my .emacs file contains: (add-hook 'after-init-hook #'global-flycheck-mode) ;; https://github.com/purcell/exec-path-from-shell ;; need exec-path-from-shell on osx ;; sets path , other vars better (when (memq window-system '(mac ns)) (exec-path-from-shell-initialize)) i have .eslint file in same home location .emacs ( .bash_profile well) on unix osx yosemite. how can fix obsolete status , run flycheck. apologize in advance being new linting code, low level emacs user here. emacs marks packages “obsolete” if newer version of package loaded. emacs never loads obsolete versions, obsolete versions may safely removed. go package menu in m-x list-packages , type ~ (mark obsolete packages removal) , x (execute actions). alternatively type u , x conduct full upgrade of packages includes removal of obsolete packages. in case “obsolete” stat

javascript - Column and row highlighting not working with classes -

i have found table example after, doesn't conflict other tables on page need affect classes , not td , tr tags direct. is possible? if example have below should , jsfiddle doing after changing classes. example working: http://codepen.io/rglazebrook/pen/nazgy <script> $('td').hover(function() { $(this).parents('table').find('col:eq('+$(this).index()+')').toggleclass('hover' ); }); </script> <style type="text/css"> body { font: 16px/1.5 helvetica, arial, sans-serif; } table { width: 80%; margin: 20px auto; border-collapse: collapse; } table th { text-align: left; } table tr, table col { transition: .3s; } table tbody tr:hover { background-color: rgba(0, 140, 203, 0.2); } table col.hover { background-color: rgba(0, 140, 203, 0.2); } </style> <div style="width:700px;"> <table> <col /> <col /> <col /> <col /> <thead> <tr>

centos - Asterisk Does not work with PhpMyAdmin? -

good day.due requirement of voip calling on own server installed asterisknow freepbx.all gone until point unable install phpmyadmin.meanwhile during installation saw asterisk installed phpmyadmin link http://myipaddress/phpmyadmin redirect nowhere,saying file not found,meaning guess phpmyadmin wasn't installed @ all.anyway running server on centos , yum install phpmyadmin , seems run,but every time error finished dependency resolution error: package: phpmyadmin-4.0.10.16-1.el6.noarch (epel) requires: php-filter available: php-common-5.3.3-26.el6.x86_64 (base) php-filter available: php-common-5.3.3-27.el6_5.x86_64 (updates) php-filter installed: php-common-5.3.28-3.shmz65.4.125.x86_64 (@anaconda-pbx-201403180405.x86_64/6.5) not found available: php-common-5.3.28-3.shmz65.4.119.x86_64 (pbx) not found available: php-common-5.3.28-3.shmz65.4.120.x86

android - Genymotion increase internal storage space -

Image
i'm running out of internal storage space on genymotion emulator. strange thing when looking @ properties of emulator in virtual box see has 16gb external memory. how can increase storage size can install more apps without deleting existing ones.

authentication - NameNotFoundException in LDAP while used with Gerrit -

my intention install gerrit code review tool in remote server. had initialise gerrit site , launched web ui of gerrit in browser. key thing have used "ldap" auth type in gerrit config file. when tried sign in gerrit shows error "authentication unavailable @ time". , corresponding error log shows "namenotfoundexception". shown below gerrit configuration , error log messages. assume ldap server ip "xxx.xxx.xxx.xxx" , domain "abc-def.com" knows how fix issue ..?? **gerrit.config** [database] type = h2 database = /home/test/gerrit-testsite/db/reviewdb [index] type = lucene [auth] type = ldap [ldap] server = ldap://xxx.xxx.xxx.xxx username = nidheesh.kumar@abc-def.com password = ******* accountbase = cn=username,ou=users,ou=tvm,ou=india,dc=abc-def,dc=com referral = follow accountpattern = (samaccountname=${username}) grouppattern = (cn=${groupname}) accountfullname = cn accountmembe

html - navbar and footer when reduce window -

Image
i have problem when reduce window: this css nav bar , footer css nav{ width: 100%; max-width:100%; min-width:1000px; margin: 0 auto;} footer { position: relative; left: 0; bottom: 0; height: 100px; text-align:center; width:100%; max-width:100%; min-width:1000px; } add js.fiddle link see html coding

java - Hibernate 4 - Call stored procedure having IN as well as OUT parameters -

i researched how call stored procedure using hibernate 4 session object in & out params, no use. finally got clue related "sessionimpl". using object can connection object. using connection object can call preparecall() method, support in/out params of procedure. following sample snippet. map<string, string> returnmap = new hashmap<string, string>(); session session = sessionfactory.getcurrentsession(); connection connobj = ((sessionimpl)session).connection(); callablestatement connstmt = connobj.preparecall("{ call schema.pkg_name.sp_name(?,?,?) }"); connstmt.setlong(1, 123456); connstmt.registeroutparameter(2, java.sql.types.varchar); connstmt.registeroutparameter(3, java.sql.types.varchar); connstmt.execute(); if(connstmt != null && connstmt.getstring(2).equalsignorecase("y")) { returnmap.put("returnid", exceptionconstants

node.js - Create a zip file on S3 from files on S3 using Lambda Node -

i need create zip file consists of selection of files (videos , images) located in s3 bucket. the problem @ moment using code below hit memory limit on lambda. async.eachlimit(files, 10, function(file, next) { var params = { bucket: bucket, // bucket name key: file.key }; s3.getobject(params, function(err, data) { if (err) { console.log('file', file.key); console.log('get image files err',err, err.stack); // error occurred } else { console.log('file', file.key); zip.file(file.key, data.body); next(); } }); }, function(err) { if (err) { console.log('err', err); } else { console.log('zip', zip); content = zip.generatenodestream({ type: 'nodebuffer', streamfiles:true }); var params = { bucket: bucket, // name of dest bucket

regex - Java: which parser is best to match text according to parenthesis pairs? -

string example: "(this level 1. (this level 2. (this level 3.) level 2.) level 1.)" if not known in advance how many levels of parentheses there (i.e. there level 4, 5, 6 etc. within level 3), understanding is not possible regex match level 2 text in above example. so, example, not possible match following using regex: "(this level 2. (this level 3.) level 2.)" i have read using parser i'm not sure best. looking ease of use, speed, , compatibility java. on appreciated. i did myself last year. it easy, start searching last ( , store index. search first ) after index stored. need substring extract text between these 2 index , done :) for next level, use previous index find previous/next ( / ) , have easy parse ;) here sample of simple code print each level : public static void main(string... args) { string s = "(this level 1. (this level 2. (this level 3.) level 2.) level 1.)"; searchinto(s); } pub

php - I have comma seperated column and need to get most common values from them in mysql -

i have comma separated value in mysql table field , want common value amongst them. i.e. have table name a , in there 2 fields id , available_values . id available_values --- ----------------- 1 3,5,7,9 2 3,5 3 5,9 in above example there value 5 exist in rows need value(mean - 5), because available in every records. please find out solution. thanks in advance. best way include table 1 row per id , values. can use regexp achieve output : select * table_name available_values regexp concat('(^|,)(', replace(5,',','|'),')(,|$)')

c# - Errors in MVC application -

i'm new webdevelopment, , have made first mvc application. works , looks fine om development machine, when publish server errors in internet explorer. looks , works ok in other browsers, example google chrome. does have idea have done wrong know for? if need see code, please let me know parts don't know have done wrong. error messages //edit here references have in head tag in _layout.cshtml @styles.render("~/content/css") @styles.render("~/content/themes/base/css") @scripts.render("~/bundles/modernizr") @scripts.render("~/bundles/jquery") @scripts.render("~/bundles/jqueryui") @scripts.render("~/bundles/bootstrap") and bundleconfig.cs looks this public static void registerbundles(bundlecollection bundles) { bundles.add(new scriptbundle("~/bundles/jquery").include( "~/scripts/jquery-{version}.js")); bundles.add(new scriptbundle("~/bundles/

php - sql order and order_items tables but show shipping charge only once -

i have 2 tables orders , order_items orders table +----+-----------------------+ | id | total_shipping_charge | +----+-----------------------+ | 1 | 60 | | 2 | 60 | | 3 | 60 | | 4 | 60 | | 5 | 60 | | 6 | 0 | | 7 | 60 | | 8 | 0 | | 9 | 60 | | 10 | 60 | +----+-----------------------+ order_items table +----+--------------------------+-----+-------+- | id | order_id | p_name | qty | price | +----+----------+---------------+-----+-------+--------------------------------- | 1 | 1 | product 1 | 1 | 699 | | 2 | 2 | product 2 | 1 | 349 | | 3 | 3 | product 3 | 1 | 199 | | 4 | 4 | product x | 2 | 299 | | 5 | 4 | product y | 2 | 299 | | 6 | 4 | product z | 2 | 299 | | 7 | 5 |

python - Finding the optimal combination of algorithms in an sklearn machine learning toolchain -

Image
in sklearn possible create pipeline optimize complete tool chain of machine learning setup, shown in following sample: from sklearn.pipeline import pipeline sklearn.svm import svc sklearn.decomposition import pca estimators = [('reduce_dim', pca()), ('svm', svc())] clf = pipeline(estimators) now pipeline represents definition serial process. if want compare different algorithms on same level of pipeline? want try feature transformation algorithm additionally pca , machine learning algorithm such trees additionally svm, , best of 4 possible combinations? can represented kind of parallel pipe or there meta algorithm in sklearn? a pipeline sequential: data -> process input algorithm -> process input algorithm b -> ... something parallel, , think you're looking called "ensemble". example, in classification context can train several svms on different features: |-svm gets features x_1, ... x_n -> vote class 1 -| dat

sql - MySQL select by month returns NULL for all months -

using mysql 5.6 trying select total inspections each month in past 12 months output of 0 if there none. appear missing here output null . date_inspected field regular sql date from understood, structure should [conditional statement, output variable, default value] 0 gets ignored in favor of null. trying understand doing wrong here. table: column type null id int(11) no inspector_id int(11) yes company_id int(11) yes date_inspected date no start_time datetime no end_time datetime no query: select sum(if(month = 'jan', total, 0)) 'januari', sum(if(month = 'feb', total, 0)) 'februari', sum(if(month = 'mar', total, 0)) 'maart', sum(if(month = 'apr', total, 0)) 'april', sum(if(month = 'may', total, 0)) 'mei', sum(if(month = 'jun', total, 0))

jquery - CSRF token on ajax request -

i have registration form hidden token input. there username field & whenever user input data username field , sends ajax request server & checks if username exists. ajax request sent multiple times. i know how update token, my question there need update token simple request?is worth updating token every ajax request? thanks it depends on framework using. if framework expires token after time have update token. you can update token after time before gets expired. and if token not expired there no need update token.

How to manually commit offset in Spark Kafka direct streaming? -

i looked around hard didn't find satisfactory answer this. maybe i'm missing something. please help. we have spark streaming application consuming kafka topic, needs ensure end-to-end processing before advancing kafka offsets, e.g. updating database. building transaction support within streaming system, , guaranteeing each message processed (transformed) and, more importantly, output. i have read kafka directstreams. says robust failure-recovery in directstreaming mode, spark checkpointing should enabled, stores offsets along checkpoints . offset management done internally (setting kafka config params [ "auto.offset.reset", "auto.commit.enable", "auto.offset.interval.ms" ]). not speak of how (or if) can customize committing offsets (once we've loaded database, e.g.). in other words, can set "auto.commit.enable" false , manage offsets (not unlike db connection) ourselves? any guidance/help appreciated. the article b

javascript - file descriptor number increases when using websocket and nodejs -

i using websocket library ws npm @ 5001 , nodejs port 80 communication. my issue on period of time number of file descriptors increases results more ram consumption. below code. var sockets = []; //used publish url var app = https.createserver(options, function(req, response){ log.debug("connection:"+ req.url); var path = url.parse(req.url,true).pathname; log.debug('path:'+path); //response.writehead(200,{ 'content-type': 'text/html' }); switch(path){ case '/push': client.send(user_message); response.writehead(200,{ 'content-type': 'text/json' }); response.write(json.stringify({ 'userids': valid_users})); break; } // send html headers , message response.end(''); }); app.listen(config.websocket_port); var websocketserver = require('ws').server ,

encryption - Java Encrypt a file using aes256/ CBC/PKCS7Padding -

i'm trying encrypt file using aes256- cbc-pkcs7padding . i'm using bouncy castle library , exception java.lang.illegalargumentexception: invalid parameter passed aes init - org.bouncycastle.crypto.params.parameterswithiv @ org.bouncycastle.crypto.engines.aesengine.init(unknown source) @ org.bouncycastle.crypto.paddings.paddedbufferedblockcipher.init(unknown source) here source code : public class crypto { public static final int aes_key_size = 256; public static int blocksize = 16; private final blockcipher aescipher = new aesengine(); private paddedbufferedblockcipher cipher = new paddedbufferedblockcipher(aescipher, new pkcs7padding()); private byte[] iv; private keyparameter key; public crypto() throws nosuchalgorithmexception { keygenerator kg = keygenerator.getinstance("aes"); kg.init(aes_key_size); secretkey sk = kg.generatekey(); key = new keyparameter(sk.getencoded()); } public v

c# - how to bind multiple Node in RadTreeView -

question: how bind multiple nodes in radtreeview this code: if (lblcategory != null && lblcategory.text != string.empty && rtcategory != null) { string[] tree = lblcategory.text.split(','); (int = 0; < tree.length; i++) { foreach (radtreenode t in rtcategory.nodes) { if (t.value == tree[i]) { t.selected = true; } } } rtcategory.expandallnodes(); } if (lblcategory != null && lblcategory.text != string.empty && rtcategory != null) { string[] tree = lblcategory.text.split(','); (int = 0; < tree.length; i++) { foreach (radtreenode t in rtcategory.getallnodes()) { if (t.value == tree[i])

sql server 2008 - SSIS Unpivot including column names -

Image
(bids on sql server 2008) i have flat file (pipe-delimited) have parsed following format: accountid freetext1 freetext2 freetext3 freetext4 1 text more text other text different text 2 text more text other text different text 3 text more text other text different text i need end result this: accountid title thedata 1 freetext1 text 1 freetext2 more text 1 freetext3 other text 1 freetext4 different text 2 freetext1 text 2 freetext2 more text 2 freetext3 other text 2 freetext4 different text 3 freetext1 text 3 freetext2 more text 3 freetext3 other text 3 freetext4 different text i still rather new ssis learning go. found on unpivot transformation seems need, haven't been able figure out how unpivot based on name of column ("freetext1", etc),

angular - Angular2/Ionic2 + ng2-dragula Did anyone get it to work? -

im trying add drag , drop ionic 2 app. can't work. this have done far: npm install ng2-dragula dragula --save then in page: @component({ templateurl: 'build/pages/dragtest/dragtest.html', directives: [dragula], viewproviders: [dragulaservice], }) export class dragtestpage { constructor(private nav: navcontroller) { } } but when add [dragula] tags, error: can't bind 'dragula' since isn't know native property. did 1 work ionic 2, there examples? i think miss import statement: import {dragulaservice, dragula} 'ng2-dragula/ng2-dragula'; i tried seems ide can't find directory 'ng2-dragula' (red text in php storm)

node.js - Using JWT tokens. Is there a better approach? -

i'm using jwt tokens via njwt package authenticate users socket.io using socket.io-jwt package. more or less, code looks this. user sends post reques play/login via html form generate jwt token. then, socket.io client initializes using token. /** * create express server. */ const app = express(); const http = require('http').server(app); const io = require('socket.io')(http); const socketiojwt = require('socketio-jwt'); app.set('jwt.secret', securerandom(256, { type: 'buffer' })); app.post('/play/login', (req, res) => { // validate user's req.body.email , req.body.password const claims = { iss: "http://app.dev", // url of service sub: "user-1", // uid of user in system scope: "game" }; const jwt = njwt.create(claims, app.get("jwt.secret")); const token = jwt.compact(); new cookies(req,res).set('access_token', token, {

how to achieve the following task using sql server management studio -

i have 2 datasets. dataset1 have 2 variable name , date . dataset1 have name , date2 , price . dataset1 looks following name date x1 2013-04-12 x1 2013-05-12 x1 2014-04-12 x2 2012-06-11 x2 2014-04-12 x2 2015-05-01 x3 2005-02-01 dataset2 looks following name date1 price x1 2013-04-11 1.1 x1 2013-05-12 2 x1 2014-04-13 3 x2 2012-06-13 2.2 x2 2014-04-12 0.6 x2 2016-05-01 0.5 for each name , date in dataset1 , want find price of same name recent (latest) date1 equal or earlier date dataset1.name = dataset2.name , max(date1 |date1<= date) . result should looks like: name date date1 price x1 2013-04-12 2013-04-11 1.1 x1 2013-05-12 2013-05-12 2 x1 2014-04-12 2013-05-12 2 x2 2012-06-11 null null x2 2014-04-12 2014-04-12 0.6 x2 2015-05-01 2014-04-12 0.6 x3 2005-02-01 null null can teach me

Create a Timer and display Error Message once when time's out in C# -

i want create timer of 20 seconds. when reaches 20 second, pop out error message ok button. after user click ok, close whole application , exit completely. my code follows. however, error message pop out continuously 5 times within 5 seconds. how make error message displayed once instead of 5 times? private void settimerusbport() { // create timer 20 second interval. atimer = new system.timers.timer(20000); //timer in ms atimer.interval = 20000; // hook elapsed event timer. atimer.elapsed += ontimedevent; atimer.enabled = true; } private void ontimedevent(object source, elapsedeventargs e) { dialogresult result; bool display; display = true; // check if usb port driver found, progress bar reached max if (detectcommport.isusbportpresent == true) { buttonautodetectingnext.enabled = true; atimer.stop(); atimer.enabled = false; } //if usb port driver not setup , reach 3 minutes: else { atimer.stop(); atime

sql server - Skipping duplicated rolled up rows where data is NULL -

i create report organization hierarchy positions. hierarchy has 4 levels, position last leaf, path not 4 levels deep. for example: company > position company > section > department > position i want number of personnel. declare @hierarchy table ( company nvarchar(50), section nvarchar(50), department nvarchar(50), unit nvarchar(50), position nvarchar(50), person nvarchar(50) ) insert @hierarchy values ('wd', 'weapons', 'it', 'officer', null, 'wile e.'), ('acme', 'weapons', 'it', 'network', 'engineer', 'brain'), ('acme', 'weapons', 'it', 'network', 'support', 'pinky'), ('acme', 'weapons', 'it', 'officer', null, 'bugs'), ('acme', 'weapons', 'it', 'officer', null, 'elmer'), ('acme', 'weapons', 'it', 

asp.net mvc 4 - IdentityServer3 with ServiceStack and MVC Client -

i'm new identityserver3 , starting set up. seems going quite , i've been working on hybrid flow mvc app similar shown in kevin dockx's pluralsight course ( http://www.pluralsight.com/courses/building-securing-restful-api-aspdotnet ) when tried configure identityserver mvc error pops up- microsoft.identitymodel.protocols.openidconnectprotocolexception: invalid_request id server: new client { enabled = true, clientname = "mvc client (hybrid flow)", clientid = "mvc", flow = flows.hybrid, requireconsent = true, redirecturis = new list<string> {"https://localhost:44358/"}, } var scopes = new list<scope>{ standardscopes.openid, standardscopes.profile }; and following code mvc client app public void configuration(iappbuilder app) { app.usecookieauthentication(new cookieauthenticationoptions { authenticationtype =

sql - MySql - Sequalize - Cannot add foreign key constraint -

i trying using nodejs sequelize create database. commands being invoked are create table if not exists `wheel` (`id` integer not null auto_increment , `createdat` datetime not null, `updatedat` datetime not null, `shopid` varchar(255), primary key (`id`), foreign key (`shopid`) references `shop` (`id`) on delete set null on update cascade) engine=innodb; create table if not exists `segments` (`segmentid` varchar(255) not null , `heading` varchar(255) not null, `subheading` varchar(255) not null, `createdat` datetime not null, `updatedat` datetime not null, `wheelid` integer, primary key (`segmentid`), foreign key (`wheelid`) references `wheel` (`id`) on delete set null on update cascade) engine=innodb; create table if not exists `shop` (`id` varchar(255) not null , `accesstoken` varchar(255) not null, `createdat` datetime not null, `updatedat` datetime not null, primary key (`id`)) engine=innodb; but error unhandled rejection sequelizedatabaseerror: er_cannot_add_forei

.net - How can I pass an array parameter using Neo4j.Driver? -

let's have following query executed on neo4j 3.0: let cmd = """ match (u:user {userid: {userid} }) , (p:permission {permissionid: {permissionid} }) merge (u)-[r:can{ datecreated: {datecreated}, datechanged: {datemodified}, allowed: [{allowed}], denied: [{denied}], createdby: {createdby}, changedby: {modifiedby} }]->(p) return r """ the relationship can have array property called allowed . with code above tried pass "item1,item2" created single item in array. how can pass items correctly can have multiple items inside array? the allowed , denied values should arrays, , cypher code should changed use values as-is (instead of i

operating system - Shortest job first job with preemption allowed Anamoly -

Image
consider following scenario, , take preemptive shortest first job executing algorithm. [1] the problem here @ timeline (3), p2 has 1 burst time available, p4 available has 2 burst time, question why p2 not continuing execution, , why p4 starting?, diagram wrong or have misunderstood in way. gantt chart has like: average waiting time should [(0+11) + 0 + 4 + 9] /4 =6.

Python : IndexError: list index out of range -

i'm relatively new python. getting error when tried implementing following code. don't understand error. def coinchange(s,m,n): dp = [[0 x in range(m)] x in range(n+1)] in range(m): dp[0][i] = 1 in range(1,n+1): j in range(m): if >= s[j]: dp[i][j] = dp[i-1][j] + dp[i][i-s[j]] else: dp[i][j] = dp[i-1][j] return dp[i][j] s = [1,3,5] m = len(s) n = 11 print(coinchange(s,m,n)) error i'm getting: traceback (most recent call last): file "c:\users\saiv\coinchange.py", line 24, in <module> print(coinchange(s,m,n)) file "c:\users\saiv\coinchange.py", line 13, in coinchange dp[i][j] = dp[i-1][j] + dp[i][i-s[j]] indexerror: list index out of range the error means have tried retrieve value of index in list (as in my_list[index] ) does not exist. assumed fatal error sensible languages, , such program terminates immedia

catch specific HTTP error in python -

i want catch specific http error , not 1 of entire family.. trying -- import urllib2 try: urllib2.urlopen("some url") except urllib2.httperror: <whatever> but end catching kind of http error, want catch if specified webpage doesn't exist!! that's http error 404..but don't know how specify catch error 404 , let system run default handler other events..ny suggestions?? just catch urllib2.httperror , handle it, , if it's not error 404, use raise re-raise exception. see python tutorial . so do: import urllib2 try: urllib2.urlopen("some url") except urllib2.httperror err: if err.code == 404: <whatever> else: raise

c# - Flexible use of IDictionary (with interfaces) -

i'm trying flexibly use idictionary interface in 1 of methods because of limitations regarding conversion (see c# type conversion: explicit cast exists throws conversion error? ), use limited me. i'd know if there workaround. this concrete problem: have method takes mapping maps every key ienumerable of other keys. takes 1 key input. find closure set/hull of given key regarding mapping: public static iset<t> getclosureset(t element, idictionary<t, ienumerable<t>> elementtocollectionmap) { iset<t> closure = new hashset<t>(); closure.add(element); closure.unionwith(elementtocollectionmap[element]); int count = 0; while (count != closure.count) { count = closure.count; foreach (t elem in new hashset<t>(closure)) closure.unionwith(elementtocollectionmap[elem]); } return closure; } example of such mapping of type idictionary<double, ienumerable<double>> : 1 -&g