Posts

Showing posts from January, 2013

node.js - MapReduce in keystone- giving error -

this mapreduce code nodejs works fine & perfect var server = new server('localhost', 27017, {auto_reconnect: true}); db = new db('test1', server); db.open(function(err, db) { if(err) console.log("connected 'driverb' database"); db.collection('users', function(err, collection) { var map = function() { emit(this.username.substr(this.username.indexof('@') + 1),1); }; var reduce = function(host, count) { return array.sum(count) ; }; collection.mapreduce(map, reduce, { out: "domain" }; } ); }); now wrote similar kind of code keystone throwing me error in next block. writing code part of upgrade migration script. var keystone = require('keystone'); var user = keystone.list('user'); exports = module.exports = func

The more numbers of columns in Dataframe Spark, the transformation on DataFrame is slower, Why -

i want build 1 dataframe have around 500 columns. when numbers of columns 100, operation on dateframe slow, such select, join, kind of transformation, not action. solution separate dataframe several dataframes. but, felt solution not totally resolve problem. hope run transformation on 1 whole dateframe.

abstract syntax tree - How to store AST Children information(python) -

i relatively new python , pycparser. have parsed c file ast using c-to-c.py file https://github.com/eliben/pycparser . trying make cfg using ast unable store information in .show() string. how go storing .show() information, have tried use test=ast.children()[0][1].show() when try print test out states "none". there way of storing it? or there method can use read through .show() information. thank you. def show(self, buf=sys.stdout, offset=0, attrnames=false, nodenames=false, showcoord=false, _my_node_name=none): """ pretty print node , attributes , children (recursively) buffer. buf: open io buffer node printed. offset: initial offset (amount of leading spaces) attrnames: true if want see attribute names in name=value pairs. false see values. nodenames: true if want see actual node names

python - Having issues resolving a SNIMissingWarning warning -

so i'm working vagrant vm , running snimissingwarning error when run script. after doing research, found following command should used counter this: sudo apt-get install pyopenssl ndg-httpsclient pyasn1 but when run that, following error: vagrant@precise64:/vagrant/rayhudsonbot$ sudo apt-get install pyopenssl ndg-httpsclient pyasn1 reading package lists... done building dependency tree reading state information... done e: unable locate package pyopenssl e: unable locate package ndg-httpsclient e: unable locate package pyasn1 i'm not sure cause , i'm quite new vms i'm bit stuck. appreciated.

python 3.x - Collate a list of tuples into a dictionary of tuples of lists, where the length of the tuples is unknown? -

[('a',), ('b',), ('a',)] produces {'a': (), 'b': ()}) [('a', 1.0), ('b', 2.0), ('a', 3.0)] produces {'a': ([1.0, 3.0],), 'b': ([2.0],)} [('a', 1.0, 0.1), ('b', 2.0, 0.2), ('a', 1.0, 0.3)] produces {'a': ([1.0, 1.0], [0.1, 0.3]), 'b': ([2.0], [0.2])} [('a', 1.0, 0.1, 7), ('b', 2.0, 0.2, 8), ('a', 1.0, 0.3, 9)] produces {'a': ([1.0, 1.0], [0.1, 0.3], [7, 9]), 'b': ([2.0], [0.2], [8])} i new python - came with. def collate(list_of_tuples): if len(list_of_tuples)==0 or len(list_of_tuples[0])==0: return defaultdict(tuple) d = defaultdict(lambda: tuple([] in range(len(list_of_tuples[0])-1))) t in list_of_tuples: d[t[0]] i,v in enumerate(t): if i>0: d[t[0]][i-1].append(v) return d in case want know context, list of t

.net - What is the IObservable.Subscribe(IObserver<T> observer) overload for? -

when writing .subscribe expressions find resharper has chosen following overload me, located in mscorlib, version=4.0.0.0: namespace system { public interface iobservable<out t> { idisposable subscribe(iobserver<t> observer); } } this seems different overloads take action , it's coming mscorlib , not system.reactive.* expect of reactive stuff be. what overload do? how should used? how iobserver<t> relate action ? , why single overload in mscorlib? to clear, isn't overload, that's core of rx really. other subscribe methods, , other operators matter, you're used extension methods call that. if @ documentation or rx, you'll see creators viewed push-based side of linq. lot of things mirror image of see in linq. iobservable mirror of ienumerable , , iobserver mirror of ienumerator . however, because push opposite of pull, rx versions opposite of pull-based counterpart: ienumerable defines 1 method produces ien

validation - HTML Tag not allow in textbox -

in website contact form. have received email. there html tags included in email. can please provide solution validation (special symbol not allowed) etc.... check if suits needs. you need add required pattern = "[a-za-z0-9 ]+" attribute input-textbox. allow upper-case/lower-case text, numbers , spaces only. <!doctype html> <html> <form> <label>name*</label> <input type="text" name="name" class="field" required pattern="[a-za-z0-9 ]+" /> <input type="submit"/> </form> </html>

twitter bootstrap 3 - Show image on top of the background color in CSS -

Image
i using bootstrap , have layout similar this: <div class="container stamp"> <div class="row"> header text </div> <div class="row" style="background-color:black"> more header text here </div> <div class="row"> more text </div> </div> i've set background image overlaps 3 rows .stamp { background-image: url('img/hugestamp.gif'); background-repeat: no-repeat; background-position: left top; } the hugestamp.gif spans across 3 rows second row has background color of black, part of image cut off. how make image show on top of background color (maybe z-index ?) on 2nd row? edit: cannot make colored row transparent. trying achieve styling here: in image, can see 3 rows , how image shown on top of colored row try code image on colored row .stamp { background-image: url('http://imgh.us/

R programming and sum up columns with different date column -

actually, wanted sum column send_invites , member_received_invites id , here created doi_date adding 30 days month1 month1 adding 30 days , getting month2 etc upto 12 months now, need sum above using date_created column range of date doi_date month1 date sum month 1 value next date range month1 date month2 date in date_created column sum month2 etc, need sequence of id's can please me rcode thank you id country_code send_invites member_received_invites doi_date1 date_created1 month1 month2 month3 1170309479 1 1 12/22/2016 1/14/2017 1/21/2017 2/20/2017 3/22/2017 1167268031 1 1 12/4/2016 1/6/2017 1/3/2017 2/2/2017 3/4/2017 1168417033 1 1 12/11/2016 1/6/2017 1/10/2017 2/9/2017 3/11/2017 1133456595 ca 1 1 10/31/2016 12/13/2016 11/30/2016 12/30/2016 1/29/2017 1026176359 ca 1 1 7/8/2016 9/20/2016 8/7/2016 9/6/2016 10/6/2016 1170285089 gb 1 1 12/23/2016 12/23/2016 1/22/2017

sql - MemSQL - How to cast integer/decimal values to Float in MemSQL? -

i tried convert integer/decimal values float returns syntax error.i used following sample query. select cast(order_quantity float) t demo limit 10 it returned following error. error code: 1064. have error in sql syntax; check manual corresponds mysql server version right syntax use near 'float) demo limit 10' @ line 1 so there way cast float in memsql? thank in advance. casts float not supported memsql. supported casts listed here: cast (input {binary | char | date | datetime[(prec)] | decimal[(prec [, scale])] | time[(prec)] | signed [integer] | unsigned [integer]}) http://docs.memsql.com/v5.7/docs/convert will decimal cast work?

ios - What kinds of errors does a func throw out in Swift? -

i see methods throw out errors in apple's documentation. can't find information throws. like methods below. it's in filemanager class. func moveitem(at srcurl: url, dsturl: url) throws i want know kinds of errors throws. can related information? unlike java, throws declaration requires type, in swift not know, type of error thrown. thing know object conforms error -protocol. if know function throws certein error (because it's documented), need cast caught object properly. example: do { try moveitem(from: someurl, to: otherurl) } catch { //there automatically local variable called "error" in block // let's assume, function throws moveitemerror (such information should in documentation) if error moveitemerror { let moveerror = error as! moveitemerror //since you've checked error moveitemerror, can force-cast } else { //some other error. without casting it, can use properties , functions decl

elasticsearch - elastic search - easy way to create hourly aggregated index from another index -

i dumping raw data timestamps elastic search. querying last few hours of data , size of index bigger because raw index. create index contains hourly aggregated data can route hourly queries index. in other words , first index , retrieve aggregated data possible combinations each hour , store index. is there way in es retrieve aggregated data combinations ? if not , easy way ? want eliminate heavy wrapper code retrieve, aggregate , put back. i see many applications supporting month on month , hour on hour queries , wondering if missing something

html - Font size - percentage mess - and workarounds -

i figured out span not inherit div 's font-size , consider on 50% 100%. so, following example won't same 100% span , because 100% is: 16 (100%) -8 (50%) +4 (50% of 50%) = 12px (150% <span>) . needed 200% same. my question is: can done that, if want use % . there workarounds(something css reset - it's different, know)? if not, best alternative making more simple development, yet effective responsiveness styling? css: body { font-size: 16px; } div { font-size: 50%; } div > p > span { font-size: 150%; } html: <div> p p p <p> <span> span </span> </p> </div>

wordpress - WP_Query for product search behaves strangely - not fetching products with search query parameter added -

first of all, apology if not right place put question. searched lot did not find suitable answer anywhere. i having strange problem woocommerce product search. in store have following 2 products: syska x110 – 11000 mah power bank htc mobile phone when use following wp_query $args = array( 'post_type' => array('product') ); $q = new wp_query($args); if($q->have_posts()) { while($q->have_posts()) : the_post(); echo the_title() . '<br />'; endwhile; } i above 2 results fine. if add search parameter, i.e. $args = array( 'post_type' => array('product'), 's' => 'htc' ); there no result when expect htc mobile phone come up. there problem well. if change $args array this: $args = array( 'post_type' => array('product'), 's' => 'h' ); it brings records other post types have , omitting products. have 3 different custom post_ty

php - How to return multiple views in one function in laravel for same route -

it quite difficult explain question. hope able understand it. for project have master layout contains header , yield of content. master.blade.php @include('partials.header') <div class="container-fluid main-con"> @yield('content') @include('partials.footer') </div> now on main public route raturning method. web.php route::get('/', [ 'uses' => 'productcontoller@getindex', 'as' => 'product.maincats' ]); productcontoller.php class productcontoller extends controller { public function getindex(){ $ad_cats = mainaddtype::orderby('title')->get(); return view( 'shop.main-categories-page', ['mediacats' => $ad_cats]); } } now query is, 'main-categories-page' yielding in content section of master. want same data of mainadtype in header also. want return view of header on same function.

Javascript add array elements -

first of new java script. i insert variables type ofarray dynamically containing latitude , longitude. hoping helps... var locations = [ [ test, test1], [ -33.923036, 151.259052], [ -34.028249, 151.157507], [ -33.80010128657071, 151.28747820854187], [-33.950198, 151.259302 ] ]; var test = -33.923036; var test1 = 151.259052; thanks in advance. try - you have use push method insert object array. var test = -33.923036; var test1 = 151.259052; var locations = [ [ -33.923036, 151.259052], [ -34.028249, 151.157507], [ -33.80010128657071, 151.28747820854187], [-33.950198, 151.259302 ] ]; locations.push([test, test1]) console.log(locations)

amazon web services - Cannot drop aws athena table across database -

i had created test database, named: test , there table named: test_table i executed command default database: drop table if exists test.test_table , got error message: failed: execution error, return code 1 org.apache.hadoop.hive.ql.exec.ddltask. nosuchobjectexception(message:table test_table not found. (service: amazondatacatalog; status code: 400; error code: entitynotfoundexception; request id: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)) any suggestion? just follow below steps , see whether can delete console: from amazon athena console, select catalog manager top bar select test database databases listed on left hand side. select test_table listed in tables section click on drop option shown above tables section

Converting between C# List and F# List -

remark: self-documentation, if have other suggestions, or if made mistakes/miss out obvious, appreciate help. sources: convert .net generic list f# list what can pass list c# f#? https://msdn.microsoft.com/en-us/library/4kf43ys3(v=vs.110).aspx?cs-save-lang=1&cs-lang=fsharp#code-snippet-1 i beginner in f# , c#, , want convert c# list f# list, , vice versa. code/commands doing changes depending on code (in c# or f#). please see answer below. if have other suggestions, please let me know. thank you. inside c# document, can use listmodule.ofseq , .tolist() , this: // inside c# document var cs_list = new list<int> {1,2,3}; var fs_list = listmodule.ofseq(cs_list); // microsoft.fsharp.collections.listmodule var cs_converted_back = fs_list.tolist(); inside f# document, can use seq.tolist , resizearray<_> , this: // inside f# document let fs_list = [1;2;3] let cs_list = resizearray<int> fs_list // system.collections.generic.list let fs_

php - Retrive Image URL of Custom Fields in Theme -

i have created custom fields custom post type. when retrieve values in theme template image value returning 22. how can image url.? <?php $args = array( 'posts_per_page' => -1, 'post_type' => 'projects', 'post_status' => 'publish', ); $projects = get_posts( $args ); foreach ($projects $project) { echo $project->project_title; // title text echo $project->project_description; // description content echo $project->project_image; // 22 } ?> when print $project wp_post object ( [id] => 35 [post_author] => 1 [post_date] => 2017-04-07 05:50:29 [post_date_gmt] => 2017-04-07 05:50:29 [post_content] => tekzenit [post_title] => tekzenit [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => t

javascript - Knockout pushing observable and computed data to an observable array -

i trying push multiple data (firstname , lastname), along when compute firstname , lastname , try push data in same array thrown error. below code. viewmodel: var viewmodel = function () { var self = this; self.gameofthrones = ko.observablearray ([ {firstname: 'jon', lastname: 'snow'}, {firstname: 'robb', lastname: 'stark'} ]); self.firstname = ko.observable(''); self.lastname = ko.observable(''); (var i=0; i<self.gameofthrones().length; i++) { self.gameofthrones()[i].fullname = ko.computed (function () { return self.gameofthrones()[i].firstname+" "+self.gameofthrones()[i].lastname; }) }; $('#classic').click( function() { self.gameofthrones.push( {firstname: $('#fn').val(), lastname: $('#pr').val()} ); }); } ko.applybindings(new viewmodel()); html view: <form class="" action="index.html" method="post"

html - Unable to extract all spans with matching class or id -

this stupid. trying write simple scraper grab listing website: https://online.ncat.nsw.gov.au/hearing/hearinglist.aspx?locationcode=2000 well, run each locationcode example page. i want extract both <span> headings , table data each date. the general form of data is: <span id="lblsubheader1242017" class="clsgriditem">1:15 pm wednesday, 12 apr 2017 @ room 15.6 level 15, 66 goulburn st </span> <hr /> <table id="dg1242017"> <tr class="clsgriditem"> <td width="15%">rt 17/11111</td> <td width="30%">name of party</td> <td width="55%">name of party</td> </tr> ... </table> it's rough can grab table data pretty code of form: page = requests.get('https://online.ncat.nsw.gov.au/hearing/hearinglist.aspx?locationcode=2000') tree = html.fromstring(page.content) events = tree.xpath(&

javascript - How to apply these few css settings with jquery? -

i working on navigation bar. when scroll down, want become thinner. have code working can't styles apply.. dev tools being applied not. jquery or vanilla js, how can apply these settings @ once. here screen shot of how "should" work: before scrolling after scrolling for reason can't post css here, here is link codepen . $(document).ready(function() { // custom jquery go here var nav = $(".main-nav"); $(window).scroll(function(){ if( $(this).scrolltop() > 5 ){ nav.addclass("main-nav-scrolled"); }else{ nav.removeclass("main-nav-scrolled"); } }); }); .fixed-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 9999; width: 100%; height: 110px; background-color: #fff; border-bottom: solid 1px #f2f2f2; } .fixed-nav li, .fixed-nav { height: 110px; line-height: 110px; } .fixed-nav { height: 50px;

c# - RestSharp - array as querystring parameter -

i can't pass array (an int array) query string parameter restsharp client var client = new restclient(baseurl); client.authenticator = new httpbasicauthenticator(username, password); var request = new restrequest(_endpoint, method.get); request.addheader("cache-control", "no-cache"); request.addheader("contenttype", "application/json; charset=utf-8"); request.addheader("accept", "text/html, application/xhtml+xml, image/jxr, */*"); //i tried request.addparameter("messageids", "[1,2,3]"); or request.addparameter("messageids", new int[] {1,2,3} ); or request.addqueryparameter("messageids", "[1,2,3]"); or request.addqueryparameter("messageids", new int[] {1,2,3} ); i suppose problem related urlencoding of parameters in case pass values "new int[] {1,2,3}" (both addparameter , addqueryparameter) url built in w

android - how to create jsonObject for bellow Structure in java -

{ "datatable": [ { "entityid": "2", "userid": "5897", "orgid": "p01", "compid": "a0002", "ip": "0", "indent_no": "0", "serial": "1", "doc_dt": "06/04/2017", "itm_cd": "100000397", "qty": "6", "rate": "9", "from_loc": "0", "remark": "re", "req_dt": "06/04/2017", "add_spec": "ass", "project": "0", "ind_type": "r", "ind_cat": "rev", "purpose": "p" } ], "mode": "i" } how create json object in java using above code please giv

r - Aggregating a data.frame with NAs using data.table -

i have large data.frame character column , several numeric columns contain na 's. here few example rows: df <- data.frame(id=rep("a",3),v1=c(na,1,na),v2=c(2,5,2),v3=c(na,na,na),v4=c(0,0,0),stringsasfactors=f) since df$id repeats want aggregate df df$id , , apply sum other columns. i did this: require(data.table) setdt(df)[,lapply(.sd, function(x) sum(x,na.rm=t)),by=.(id)] and getting this: id v1 v2 v3 v4 1: 1 9 0 0 so column v3 na 's in df , hence gets value of 0 , poses problem me since in such case i'd keep na value in other cases (where aggregation on mix of numerics , na 's, i'd remove na 's otherwise sum na ). example shows ( df$v4 ) have columns 0 , therefore can't replace 0 's na 's aggregated data.frame . in other words desired outcome: id v1 v2 v3 v4 1: 1 9 na 0 any idea how data.table 's .sd aggregation achieve this? df[,lapply(.sd, function(x) ifelse(all(is.na(x))

arrays - PHP: "Notice: Undefined variable", "Notice: Undefined index", and "Notice: Undefined offset" -

i running php script, , keep getting errors like: notice: undefined variable: my_variable_name in c:\wamp\www\mypath\index.php on line 10 notice: undefined index: my_index c:\wamp\www\mypath\index.php on line 11 line 10 , 11 looks this: echo "my variable value is: " . $my_variable_name; echo "my index value is: " . $my_array["my_index"]; what these errors mean? why appear of sudden? used use script years , i've never had problem. what need fix them? this general reference question people link duplicate, instead of having explain issue on , on again. feel necessary because real-world answers on issue specific. related meta discussion: what can done repetitive questions? do “reference questions” make sense? notice: undefined variable from vast wisdom of php manual : relying on default value of uninitialized variable problematic in case of including 1 file uses same variable name. majo

c# - Generate Dynamic Linq query using outerIt -

i using microsoft's dynamic linq (system.linq.dynamic) library generate queries @ run time. has worked great me, 1 specific scenario. simplified scenario - trying query claims have specific tags user has selected , balance greater number. static void main(string[] args) { var claims = new list<claim>(); claims.add(new claim { balance = 100, tags = new list<string> { "blah", "blah blah" } }); claims.add(new claim { balance = 500, tags = new list<string> { "dummy tag", "dummy tag 1" } }); // tags searched var tags = new list<string> { "new", "blah" }; var parameters = new list<object>(); parameters.add(tags); var query = claims.asqueryable().where("tags.any(@0.contains(outerit)) , balance > 100", parameters.toarray()); } public class claim { public decimal? balance { get; set; } public list&l

error while decoding html and farsi from hex encoding in python -

i have string in hex enocoding this: data = \xd8\xa7\xdb\x8c \xd9\x84\xda\x86\xdb\x8c<br/> \xd8\xa7\xda\xaf\xd8\xb1\xda\x86\xd9\x87 \xd8\xa7\xd9\x82\xd8\xaf\xd8\xa7\xd9\x85\xd8\xa7\xd8\xaa it contains persian string , html elements. using ddcode.com convert them , meaningful results(i'm not sure string in hex!), when want decode strings python errors. using codec: codecs.decode(data,'hex',errors='ignore') i assertionerror traceback (most recent call last) <ipython-input-124-5246163fba41> in <module>() ----> 1 codecs.decode(data,'hex',errors='ignore') assertionerror: decoding 'hex' codec failed (assertionerror: ) using binascii : binascii.unhexlify(data) i get: --------------------------------------------------------------------------- valueerror traceback (most recent call last) <ipython-input-126-fbe8c6445b8a> in <module>()

javascript - When i click edit in html table how to send those details same page text boxes to update in jsp -

i have jsp page in did insert , displaying records in html table in 1 page in when click edit redirect update.jsp page need same page without taking update.jsp page is possible insert,update,delete in single page? yes possible edit in same page. you can use ajax it. form of project insert in jsp using jstl <%@ page import="java.io.*,java.util.*,java.sql.*"%> <%@ page import="javax.servlet.http.*,javax.servlet.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <c:if test="${empty sessionscope['loginuser']}"> <c:redirect url="login.jsp" /> </c:if> <jsp:include page="header.jsp" /> <!-- content --> <!-- basic inputs --> <!-- basic inputs --> <script src="http://code.j

python - KIVY: AsyncImage widget resizing issue within a RecycleView -

Image
i'll start little contextualization before explaining issues. i implemented recycleview widget contains recycleboxlayout default_size dynamic (based on parent's size). believe needed (i'm wrong) because app used on wide variety of devices , i'd rv contains average of 4 playlistitem. here code inside .kv file: recycleview: id: rv scroll_type: ['bars', 'content'] scroll_wheel_distance: dp(114) viewclass: 'playlistitem' recycleboxlayout: default_size: none, (self.parent.height / 4 - dp(80)) if self.parent.height / 4 > dp(60) else dp(60) default_size_hint: 1, none size_hint_y: none height: self.minimum_height orientation: 'vertical' spacing: dp(20) padding: dp(20) now let's take @ code playlistitem viewclass: <playlistitem@boxlayout>: created_time: '' description: '' id: '' image_url: '' name

javascript - addEventListener() click incorrectly executing -

i'm new javascript, , made small game using prompts. in process of building ui , phasing out prompts. @ moment have main menu, , fight menu. pressing fight takes fight menu list of moves. after pressing "ora" in fight menu supposed bring prompt stating attack , bringing main menu. while happen, when brought main menu acts if still in attack menu. document.getelementbyid("fight") var fightmenu = fight.addeventlistener("click", fightmenufunction) function fightmenufunction() { document.getelementbyid("fight").id = "ora"; document.getelementbyid("ora").innerhtml = "<p class='textstuff'>ora</p>"; document.getelementbyid("status").id = "get_angry"; document.getelementbyid("get_angry").innerhtml = "<p class='textstuff'>get angry</p>"; document.getelementbyid("blank1").id = "yell_dio"; document.getele

.net - How to Deploy Node.js app in Ubuntu/Linux? -

how deploy node.js app in ubuntu/linux? developed in .net framework without use of docker? thank giving great time. a useful tool assist in deploying .net framed node.js application is: http://tjanczuk.github.io/edge/#/ run node.js , .net in-process the real question why want destroy portability of node.js introducing .net.

php - WP custom post type cant already add to cart in woocommerce 3.0 above -

Image
i can still add custom post type cart in woocommerce 2.6 adding filter 'woocommerce_product_class' function wc_product_class( $class, $product_type, $post_type ) { if( 'my_custom_post_type_slug' == $post_type ) $class = 'wc_product_simple'; return $class; } add_filter( 'woocommerce_product_class', 'wc_product_class', 10, 3); //this echo carti item id echo wc()->cart->add_to_cart($custom_post_type_id, $quantity, null, null, array()); unfortunately doesn't work on latest version of woocommerce. please me solution issue? suggestions, comments, solutions appreciated. i'm selling plugin enable use custom post type "product" of woocommerce . did lot of work on that. but important part. have create own data store, this: first create class extends wc_product_data_store_cpt . idea overwrite existing function of class check post type. found read , get_product_type checking. class wccpt_product_

multithreading - How to measure resources are consumptioned by thread in Java -

i need track running thread execution measure it's performance memory usage , cpu usage , global cache misses etc... have able measured cup usage consumed running thread using java.lang.management.threadmxbean get cpu time thread threadmxbean tmxb = managementfactory.getthreadmxbean(); long cputime = tmxb.getthreadcputime(athreadid); but couldn't other values.so question that,is there api available measure thread performance or how using native way. there's jconsole executable in bin folder of jdk. execute it, connect process , list managed beans. the java.lang folder 1 you're looking for.

php - Json array encode and decode the same -

i encode array json format using code below : $arrayname[] = array('user_role_id' => 1, 'user_id' => 1); $arrayname[] = array('user_role_id' => 2, 'user_id' => 2); $jos = json_encode(array_values($arrayname)); the output is [{"user_role_id":1,"user_id":1},{"user_role_id":2,"user_id":2}] and sent browser. then after steps browser returns same array. but when try decode $return = json_decode($jos,true); i receive error : array string conversion. browser didnt array. returns supply. code flow : <?php if(isset($_get['array'])) { $arrayname[] = array('user_role_id' => 1, 'user_id' => 1); $arrayname[] = array('user_role_id' => 2, 'user_id' => 2); header('content-type: application/json'); echo $jos = json_encode($arrayname); } else { if(isset($_post['jos'])) { $jos = $_post['jo

javascript - CKEDITOR is not working with promise call back -

employer_data = functiontogetemployer(); $.when(filldata()).then( function(status){ console.log("reaching here"); if(employer_data.detailsmessage !== null){ console.log("reaching here too"); ckeditor.instances.employer_detail_message.setdata(employer_data.detailsmessage); } } ) filldata: function(){ var dfd = jquery.deferred(); $.ajax({ // ajax call data. success: function(){ // dfd.resolve("resolved"); }, error: function(){ dfd.reject("rejected"); } }) return dfd.promise(); } in above ckeditor setdata method not working. if keep setdata method above promise setup works expected.

azure - How is accomplished password match between AD FS and StoreDB? -

just trying head around password synchronisation. in windows azure active directory store db password matched ad fs method? getting lot of reading tokens , protocols, there else have aware of? it's general before can dive deeper in synchronisation. thank you it's done via aad connect. if tick "password sync.", password in ad (which hashed) hashed again , propagated aad. note aad doesn't use "traditional db". uses graph structure.

javascript - how to Merge the .html file into one Master file with all scope values from releated html files in Angularjs -

hi using angular js have 3 html file like.header,menu , footer.html combined , show ecah html file in each div through id 3 html file 1 html file name called master.html code used link html <script> $(function () { $("#navbar-container").load("header.html"); $("#sidebar").load("slidebar.html" ); $("#footer").load("footer.html"); }); </script> header.html i have 1 scope variable in header page , it's shows correctly scope variable hello world.but when combined means merge master page it's not working scope values not fetched don't why solve problem please show how did initialize "scope variable" in header? think want use here nginclude directive includes additional html code current template. so you'r example might like: <div ng-include="header.html"></div>; ....

jquery - ios hover works with ontouchstart but keeps activated when scrolling -

when use ontouchstart="" activates hover but, activates when scrolling along page want active when clicked. or links simulair questions welcome. this div hover <div class="featured-image" > <?php if ($post->getlistthumbnailsrc()): ?> <img class="thumbnail" src="<?php echo $post->getlistthumbnailsrc(); ?>" alt="<?php echo $this->escapehtml($post->gettitle()); ?>"/> <img class="gradient" src="http://www.bijsmaak.com/development/skin/frontend/default/bsmk_mobile/images/gradient-blog.png" /> <?php endif; ?> </div> css .blog_roll .post-list .entry .featured-image img.thumbnail { width: 100%; position:absolute; display: inline-block; -webkit-transform: opacity 0.3s ease-in-out; transform: opacity 0.3s ease-in-out; } .blog_roll .post-list .entry .f

struct - Select where type command for Matlab structure -

i have 2x3 matlab structure containing following fields: projectname , projectcategory , projectcost . here loop goes through contents of structure: >> i=1:3 projectstructure(i).projectname projectstructure(i).projectcategory projectstructure(i).projectcost end ans = project1 ans = category1 ans = 50000 ans = project2 ans = category2 ans = 25000 ans = project3 ans = category1 ans = 65000 >> i see if, in matlab, there efficient way "query" structure based on projectname field. i.e. whether there programmatic way extract projectcategory field value for, say, projectname3 . this similar excel vlookup function or mysql select where type thing. see if matlab can without having resort large (and costly) database extensions database toolbox. projectstructure(strcmp({projectstructure.projectname}, 'project3')).projectcategory explanation {projectstructure.projectnam

Hide particular day from google calendar in Android -

how can make particular day deselected in google calendar.on click of button open date picker dialog select date.here need, user can able select sunday. remaining days should unselectable transparent color. how can this. code tried: { calendar c = calendar.getinstance(); int day = c.get(calendar.day_of_week); if (day !=calendar.sunday) { c.add(calendar.day_of_week,day); } dialog = new datepickerdialog(this, datepickerlistener, year, month, day); dialog.getdatepicker().setmindate(system.currenttimemillis() + (1000 * 60 * 60 * 24)); dialog.show(); } public datepickerdialog.ondatesetlistener datepickerlistener = new datepickerdialog.ondatesetlistener() { public void ondateset(datepicker view, int selectedyear, int selectedmonth, int selectedday) { year = selectedyear; month = selectedmonth; day = selecte

mysql - Want to add multiple variables to myql AND function -

Image
a screenshot: hi want add number functie.code = results of people functie.code = 3 4 , 5. but how should this? select distinct voornaam,achternaam,provincie,functie.naam,max(provincie) medewerker,functie,persoon,adres medewerker.functie_code = functie.code , medewerker.persoon_idpersoon = persoon.idpersoon , persoon.adres_idadres = adres.idadres , functie.code in ( 3, 4, 5) thanks in advance you have max() in select . turns query aggregation query without group by -- returns 1 row. in addition, using archaic join syntax. simple rule: don't use commas in from clause. a query presumably want: select voornaam, achternaam, provincie, f.naam, provincie medewerker m join functie f on m.functie_code = f.code join persoon p on m.persoon_idpersoon = p.idpersoon join adres on p.adres_idadres = a.idadres f.code in ( 3, 4, 5); it unclear whether or not need select distinct . if don't, don't use unnecessarily in query.

javascript - drupal error Cannot read property 'parentNode' of undefined -

console=> error: vm31166:1 uncaught typeerror: cannot read property 'parentnode' of undefined @ :1:22622 @ (:1:22652) @ :1:22745 enter image description here can't find error code,。。。find in path / content anywhere. don't know how appeared.ask help,online.

ios - How to delete cookies in Nativescript -

i developing ios app using nativescript using angular. have webview in it. want delete cookies on click of button. how it? for ios can user following code delete each cookies inside ios webview. const cookies: = nshttpcookiestorage.sharedhttpcookiestorage.cookies; if (typeof cookies !== 'undefined') { (let = 0; < cookies.count; i++) { const cookie: nshttpcookie = <nshttpcookie>cookies.objectatindex(i); // let cookie: = cookies[i]; console.log(cookie); nshttpcookiestorage.sharedhttpcookiestorage.deletecookie(cookie); } } console.log(nshttpcookiestorage.sharedhttpcookiestorage.cookies); after last console.log there shouldn't cookies. kind regards

Copy data from one table to other in Cassandra using Java -

i trying move data 1 column-family (table) other. since both tables have different descriptions, have pull data table-1 , create new object table-2 , bulk aync insert. table-1 has millions of records cannot data directly in data structure , work out. looking out solutions using spring data cassandra java. i planned moving data temp table first followed creating composite key relations , querying master table. however, doesn't seems favorable me. can suggest strategy this? leads appreciated. thanks! my table-1 has millions of records cannot data directly in data structure , work out. with datastax java driver can data token ranges , work out data each token range. example: set<tokenrange> tokenranges = cassandrasession.getcluster().getmetadata().gettokenranges(); for(tokenrange tr: tokenranges) { list<row> rows = new arraylist<>(); for(tokenrange sub: tr.unwrap()){ string query = "select * keyspace.table token(pk) >

c - How to make signed 64 bit integer using one signed integer and one unsigned integer on 32 bit processor -

on 32 bit processor 32 bit compiler want make 64 bit signed integer using 1 of each signed , unsigned integer. without using predefined macro or types. 32-bit compilers handle 64-bit numbers you. unlikely need this. i'll bite. on surface pretty simple problem. #include <stdint.h> static inline int64_t make_int64(uint32_t low, int32_t high) { return (int64_t)((uint64_t)high << 32) | low; } static inline void split_int64(int64_t value, uint32_t *low, int32_t *high) { *low = value & 0xffffffff; *high = (int32_t)((uint32_t)(value >> 32)); } but tricky/dangerous mixing signed , unsigned integers. manually constructing int requires know how processor formats them. we'll assume 2s compliment little endian. it helpful if gave full description of requirements. example above example make_int64(0, -1) = -4294967296 make_int64(1, -1) = -4294967295.

c# - Paypal IPN sample code has no ActionResult. How am i meant to give a url if there is no view? -

this paypals sample code ipn. have been on few days , getting no where. not sure meant call. in previous question asked said dont call receive method. lead me on think how paypal know go. (i.e method use.) public class ipncontroller : controller { [httppost] public httpstatuscoderesult receive() { //store ipn received paypal logrequest(request); //fire , forget verification task task.run(() => verifytask(request)); //reply 200 code return new httpstatuscoderesult(httpstatuscode.ok); } private void verifytask(httprequestbase ipnrequest) { var verificationresponse = string.empty; try { var verificationrequest = (httpwebrequest)webrequest.create("https://www.sandbox.paypal.com/cgi-bin/webscr"); //set values verification request verificationrequest.method = "post"; verificationrequest.contenttype = "applicati