Posts

Showing posts from July, 2015

wordpress - comment_author also returns the ip -

i have plugin, gets comment authors name "$comment->comment_author", apparently gives authors ip , gateway, etc. is normal behaviour or there way stop this? this how email looks: autor: carlotta (ip: xxx.xxx.xxx , xxxx.adsl.highway.telekom.at) e-mail : xxx@student.tugraz.at url: whois: http://whois.arin.net/rest/ip/xx.114.244.129 thanks in advance if site administrator wordpress send information default, site admin sees it, , not average user.

c# - Use separate file to extend documentation -

i using doxygen document huge projects written in c#. existing documentation in these projects should not changed. is there way extend existing documentation , provide doxygen commands classes or methods in separate file? for example, lets there class viewmodel.cs, documented this: /// <summary> /// defines viewmodel can bound treelist control. /// </summary> public abstract class viewmodel : iviewmodel { /// <summary> /// gets root elements displayed in treelist. /// </summary> public observablecollection<itreenode> elements { get; protected set; } } is there way create separate file (.dox) linked class , extends existing documentation? e.g. group class specific module \ingroup command. to knowledge, no such tool exists. c# uses assemblies , namespaces conceptual grouping of apis. defining manual grouping separately serve confuse users familiar language. for best results, should use c# documentation comments along la

android - Error inflating class set in xml -

i'm trying create textview slides screen , creates error, don't know why. xml: <set xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:fillafter="true"> <scale android:duration="500" android:fromxscale="1.0" android:fromyscale="1.0" android:interpolator="@android:anim/linear_interpolator" android:toxscale="1.0" android:toyscale="0.0" /> <textview android:id="@+id/scroll_message" android:text="@string/scroll_text" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_gravity="center" android:minlines="1"

ruby on rails - Search by empty list for many-to-many relation using ransack -

i searched how pass empty array ransack, example: @search = promotionsretailer.search(retailer_id_in: []) this sql statement: "select `promotions_retailers`.* `promotions_retailers` " i found link , add -1 empty array, used search(retailer_id_in: ([] + [-1])) . any solution better solution? how search using retailer_id in promotion table, if have many-to-many relation between promotions/retailers without using breaking table promotionsretailer ransack gem ? first part of question vital. should separate question. unfortunately, there in no more elegant way cope it, than: search(retailer_id_in: ([] + [-1])) the problem lays somewhere in gem. , if pass empty array, or array filled nil values parameter, there join in sql, conditions ignored, e.g.: ruby: article.ransack({authors_id_in: [nil, nil, nil]}).result sql: select "articles".* "articles" left outer join "articles_authors" on "articles_authors&quo

c++ - Reading depth buffer in Android native code, using OpenGL ES 3.0 -

i'm creating application render image offscreen , need read depth buffer. pc version of application easy, since can use glgetteximage or glreadpixels (using gl_depth_component). need port application android, have issues, since gl es not support glgetteximage @ all, , glreadpixel can used read color buffer (as understood). many people suggest render depth buffer color buffer (or render depth value color buffer), understand, glreadpixel can read 8 bit per channel values, , need @ least 16 bit per depth values. my target android device supporting opengl es, reading pixel buffer object, seams pbos faster method of transferring data gpu, read depth map still need use glreadpixels transfer depth map pbo (which not possible). i thinking maybe creating eglimage (wrappening own buffer) , use depth texture in fbo might solution, don't have experience eglimages, i'm not sure if possible or not (and work on android, need have different implementations pc , android). so, be

sql server - SQL Select Top and Random Fill -

i select , insert top 4650 fields table column g table b column e. how can randomly fill column data table column g? how replace data exist in column e? easier in multiple parts? if single column should work you. insert tableb (columne) select top(4650) columng tablea if there relationship between tables this update x set columne = y.columng tableb x inner join (select top(4650) id tablea) y on x.id = y.id you utilize cte ;with ( select top (4650) id,columng tablea ) y update x set columne = y.columng tableb x inner join y on x.id = y.id we need structure of tables answer question

rails jquery.turbolinks javascript not firing after page change -

realise issue (or flavours of it) documented despite investigation , reading still can't resolve issue, being... rails 4 application following gems installed: using rake 10.3.2 using i18n 0.6.11 using json 1.8.1 using minitest 5.4.1 using thread_safe 0.3.4 using tzinfo 1.2.2 using activesupport 4.1.4 using builder 3.2.2 using erubis 2.7.0 using actionview 4.1.4 using rack 1.5.2 using rack-test 0.6.2 using actionpack 4.1.4 using mime-types 1.25.1 using polyglot 0.3.5 using treetop 1.4.15 using mail 2.5.4 using actionmailer 4.1.4 using activemodel 4.1.4 using arel 5.0.1.20140414130214 using activerecord 4.1.4 using execjs 2.2.1 using autoprefixer-rails 3.0.1.20140826 using bcrypt 3.1.7 using sass 3.2.19 using bootstrap-sass 3.2.0.2 using bootstrap-select-rails 1.6.2 using thor 0.19.1 using railties 4.1.4 using bootswatch-rails 3.2.4 using breadcrumbs_on_rails 2.3.0 using cancan 1.6.10 using coffee-script-source 1.8.0 using coffee-script 2.3.0 using coffee-rails 4.0.1 using da

When to use aliases and when to use :refer in Clojure/ClojureScript :require? -

when using :require in clojure or clojurescript, when should use aliases , when should cherry-pick functions use? examples: using alias (:require [some-package.sub some]) (some/do-stuff "xyz") using :refer (:require [some-package.sub :refer [do-stuff]]) (do-stuff "xyz") using alias seems more handy if dependency has plenty of functions want use or use of functions (however many there are), since clojurescript (intentionally) doesn't support :refer :all . on other hand, using :refer seems more "clean" approach, when using specific functions dependency. are there other things 1 should consider when choosing between 2 (and valid reason in first place)? another thing think of if have lots of dependencies and/or loads of own functions defined in file, might beneficial have alias prefixes in function calls make clearer functions located, if use small subset of functions offered dependency. how should choose 1 use? or should decide

sql - substring varchar get first globalid -

i have varchar string , need return first globalid value - 8679926300927194610 string: declare @erservice varchar(max) = 'globalid=8679926300927194610,ou=services,globalid=00000000000000000000' you can following. assuming string starts globalid=, , there comma after number. select substring(@erservice,10,charindex(',',@erservice)-10)

web services - How to receive Content-Type multipart/related response using java? -

i using saaj soap connection call third party web service.it seems web service have been created using wcf or c# .when invoking url using soap ui tool working fine , receiving response successfully. when tried access through below java code receiving error. code : public class soapclientsaajnew { public static void main(string args[]) throws exception { // create soap connection soapconnectionfactory soapconnectionfactory = soapconnectionfactory.newinstance(); soapconnection soapconnection = soapconnectionfactory.createconnection(); // send soap message soap server string url = "xxx"; soapmessage soapresponse = soapconnection.call(createsoaprequest(), url); // print soap response system.out.print("response soap message:"); soapresponse.writeto(system.out); soapconnection.close(); } } error: severe: saaj0008: bad response; cannot process message because

php - Symfony2: Same route path for 2 actions -

is possible have same route path 2 different actions. want use action when user logged in , when user isn't logged in. /** * @route("/", name="bundle_index") * @template("namebundle:default:index.html.twig") */ /** * @route("/", name="bundle_index_auth") * @security("has_role('role_user')") * @template("namebundle:default:auth.html.twig") */ use same path different names think not, , can't imagine in cases useful if can (maybe if explain better want achieve), looking example can checks need inside same action... checking if role_user granted user (otherwise redirect user or throw access exception whit same behavior of example) , rendering template consequently (obviously other manipulation needed).

hadoop - Loading datetime field doesn't work in pig latin 0.12 -

i'm using pig 0.12, , document here says supports datetime datatype http://pig.apache.org/docs/r0.12.0/basic.html#data-types but following load statement gives me unsupportedoperationexception on first field. hdfs location contains tab separated files first field in format yyyy-mm-dd. rsa = load '/mypath/*' using pigstorage() ( hit_date:datetime, agency_id:long, agency_name:chararray, .... ); error 2999: unexpected internal error. null java.lang.unsupportedoperationexception @ parquet.pig.pigschemaconverter.convertwithname(pigschemaconverter.java:273) @ parquet.pig.pigschemaconverter.convert(pigschemaconverter.java:248) @ parquet.pig.pigschemaconverter.convert(pigschemaconverter.java:285) @ parquet.pig.pigschemaconverter.converttypes(pigschemaconverter.java:241) @ parquet.pig.pigschemaconverter.convert(pigschemaconverter.java:234) @ parquet.pig.tuplewritesupport.(tuplewritesupport.java:63) @ parquet.pig.

html - javascript - How to get a specific form from a forms array without knowing the number of forms in the page -

i have html page multiple forms: forms1 forms2 forms3 forms4 . . . formsn in javascript know can deal specific form forms array: document.forms[2] but how can n form without knowing number of forms? something that: n = numbnerofforms document.forms[n] document.forms[n-1] i think document.form.length want. returns length of array; in case form array. note: if , array is: a ['q','w','e','r','t','y'] array.lenght return 6, useful when nedd cicle via array for (var = 0; < array.length; i++) { // ... }

Ruby Divide Always Returning Zero in Rails Axlsx Export -

i cannot life of me figure out why dividing isn't working in aslsx export. can add, subtract, multiple , modulus division fine, when try answer_number / question_number coming out 0. ideas i'm doing wrong? works spitting out answer_number times question_number : @survey.questions.each |question| question_number = choice.where(question_id: question.id).length question.answers.each |answer| answer_number = choice.where(answer_id: answer.id).length sheet.add_row [answer_number, question_number, answer_number * question_number] end end doesn't work - spits out 0: @survey.questions.each |question| question_number = choice.where(question_id: question.id).length question.answers.each |answer| answer_number = choice.where(answer_id: answer.id).length sheet.add_row [answer_number, question_number, answer_number / question_number] end end i thought maybe doing sort

garbage collection - Ruby GC::Profiler no output -

i'm running ruby script , trying see gc stats on it, output empty string. here contents of script: class numberpool ... attr_accessor :sets def initialize @sets = [] end def allocate allocated_number = random.rand(min_bound..max_bound) sets.each |set| next unless set.range.include?(allocated_number) return set.range.delete(allocated_number) end factor = allocated_number / batch_size min = factor * batch_size max = min + batch_size sub = subpool.new(min, max) sub.range.delete(allocated_number) sets.push(sub) allocated_number end ... def run_test gc::profiler.enable = numberpool.new p a.allocate gc::profiler.report end puts run_test when run this, output is: $ ruby number_pool.rb 1855532 i expected see gc report in standard out. this guess, maybe gc hasn't triggered (no need collect garbage yet because plenty of free memory). see happens if force gc adding gc.start (modif

download - Python urllib urllib2 keeping sessions -

iam trying find way how keep cookie sessions while performing urllib command download files. here have far. session.get(url, data=login_data, verify=false) f = urllib2.urlopen(url) data = f.read() open('c:/files/filename.docx', "wb") code: code.write(data) url url data login details username , password so when run this, no success. does have experience that?

c# - Calling SignedCMS.Decode takes too long -

is there reason calling signedcms.decode take 15 seconds or more? have following code: signedcms signedcms = new signedcms(); signedcms.decode(posteddata); where posteddata byte array of signed cms message. function call returns instantly, of time, takes 10-15 seconds return causing message sender timeout. this seems happen whether or not debugger attached process. so narrowed down instantiation of oid in 1 of functions decode function calls. source available @ reference source .net framework 4.5.1 . i tested using: system.security.cryptography.oid oid = new system.security.cryptography.oid("1.2.840.113549.1.7.1"); i found this link similar problem. interestingly, disconnecting wireless adapter, oid instantiation occurs immediately, leads me believe may network/dns related (i have not idea oid instantiation doing). after reconnecting adapter signedcms.decode working normal. option read remove computer domain , rejoin. haven't tried yet.

node.js - Getting assemble-middleware-permalinks working -

i trying assemble-middleware-permalinks working on build, doesn't appear work way want to. i have following in gruntfile.coffee : assemble: options: layout: 'default.hbs' layoutdir: '<%= config.app %>/_layouts' partials: '<%= config.app %>/_partials/*.hbs' plugins: ['assemble-middleware-permalinks'] permalinks: preset: 'pretty' pages: files: '.tmp/': ['<%= config.app %>/pages/{,*/}*.hbs'] however when running grunt assemble task, still shows generating following: running "assemble:pages" (assemble) task writing .tmp/about.html writing .tmp/index.html assembled 2 files ok i have grunt-assemble package installed uses 0.5.0 branch of assemble. i have tried manually putting in structure instead of using preset: permalinks: structure: ':basename/index.html' can tell me i'm doing wrong?

gmail - Display google groups mails into wordpress -

i want display our googlegroups mails website. created theme wordpress , want create widget , add functionality show mails it. have idea it? thanks you can try plugin (i've never used it): https://wordpress.org/plugins/odynogooglegroups/

excel - VBA error 'Cannot change part of a merged cell' -

having problem vba error "cannot change part of merged cell" here code. clears range on first sheet, hides raw samples sheet. loop clears ranges on unhidden sheets in workbook because formatted exact same. code works if go sheets , clear formatting merged cells. need code run on number of workbooks having time consuming or i'd have add code clear users formats before clearing ranges. sheets("raw samples").select range("a9:ab3000").select selection.clearcontents activewindow.selectedsheets.visible = false dim ws worksheet each ws in activeworkbook.worksheets ws.range("b3:g342").clearcontents next ws activeworkbook.sheets("raw samples").visible = true my questions are does next loop still check formatting on hidden sheet? is there way around having unformat sheet still clear specified ranges? q1. next loop still check formatting on hidden sheet? no doesn't q2. there way around having unformat s

emacs - AUCTeX: insert reference / citation without macro -

is there way add reference / citation format inserts reference / citation label directly buffer without enclosing macro? to clear: when hit c-c ) auctex prompts reference format, when hit return it'll insert ~\ref{label} buffer [after selecting appropriate reference in next buffer]. add reference format bound \?s (space) inserts label part. that say: hit c-c ) , <space> , select reference and... tadaa there's label in buffer. [edit:] have tried (eval-after-load "latex" '(progn (add-to-list 'reftex-ref-style-alist '("default" t (("" ?\s)))))) however encloses label in curly braces , prepends ~ if there's word before point. i have created solution adding around-advice reftex-reference , however, it's not pretty solution. i'll put answer i'm still hoping better solution. (eval-after-load "latex" '(prog

ios - Archive in xcode 6 is producing a pkg, not ipa -

recently updated xcode 6 , whenever archive project, .pkg instead of .ipa. i've set other target in project (cocoapods) skip install didn't trick. deployment target ios, not mac (it's iphone/ipad app archived .ipas fine). am missing new setting somewhere (i.e. default archive ios apps .ipa) or there gotcha ad hoc distribution on xcode 6 i'm not aware of? add lsrequiresiphoneos yes info.plist key can found application requires iphone environment

c# - Change the Foreground Color of List View Selected Item from Code Behind in WP -

Image
i trying change foreground color of list view code behind getting object reference not set instance of object exception . here code; var item = listviewtest.selecteditem; listviewitem listviewitem = this.listviewtest.containerfromitem(item) listviewitem; listviewitem.foreground = new solidcolorbrush(colors.greenyellow); //manually scrolling selected item listviewtest.scrollintoview(listviewtest.selecteditem); as can see code, want change foreground color e.g yellow , scroll particular listview item. scrolling works foreground color isn't working , getting exception. update here item template; <listview.itemtemplate> <datatemplate> <stackpanel margin="0,0,0,9.5"> <textblock fontfamily="times new roman" text="{binding id}" horizontalalignment="right"

c# - How to display complex data in MVP Passive View -

i've been looking in mvp pattern while, , managed create simple mvp-compliant applications. i trying apply pattern more complex application, , have doubts on best way of doing that. my application has single winform, 2 buttons loading 2 different kinds of data. view interface looks following: interface iview_mainform { // load input // event eventhandler<inputloadeventargs> loadinput_01; event eventhandler<inputloadeventargs> loadinput_02; bool input01_loaded { get; set; } bool input02_loaded { get; set; } } the iview referenced in presenter via constructor injection: public presenter_mainform(iview_mainform view) { this.view = view; this.view.loadinput_01 += new eventhandler<inputloadeventargs>(onloadinput_01); this.view.loadinput_02 += new eventhandler<inputloadeventargs>(onloadinput_02); } so far, good. when user clicks of 2 buttons loading data, loadinput_## event raised, presenter handling it, checks

html - Using regex in Vb.net to extract phone numbers -

i wrote code extract mobile numbers web link got 3 links in list box , getting source code using code below while i'm trying use regex extract phone number i'm getting same number again , again. full code wrote! , website i'm extracting link is http://bolee.com/nf/all-results dim doc new htmlagilitypack.htmldocument() private sub button1_click(sender object, e eventargs) handles button1.click if listbox1.items.count = 0 msgbox("please extract links first") else listbox1.selectedindex = 0 end if end sub private sub button2_click(sender object, e eventargs) handles button2.click scraplinks() end sub private function scraplinks() dim hw new htmlweb() try doc = hw.load(textbox1.text) doc.loadhtml(doc.documentnode.selectsinglenode("//*[@id='ad_list']").innerhtml()) each link htmlnode in doc.documentnode.selectnodes("//a[@href]") dim hrefvalue string =

directx - Depth textures clamped to 1.0? -

i'm doing exponential shadow maps instead of outputing depth, output exp(depth), this: float ps_main(float4 position : sv_position) : sv_depth { return exp(position.z / position.w); } using exp() turns entire depth texture white (1.0f). i thinking no depth gets written because depth texture cleared 1.0f, max, , exp() values equal or higher. how can around this? want write float value depth texture. the sv_depth range determined depth min/max in viewport, , has maximum range of 0.0 1.0 (it unorm surface interpretation). invocations depth values outside range or greater current value of depth buffer discarded. if want encode expression in code, can either calculate on load whenever end using it, or write separate render target (e.g. r32_float ) rather using depth buffer.

delphi - Convert From indy udp To Tcp -

i have been using indy udp , want move on indy tcp but dont know how convert code work in same way indy tcp my project work send stream chat room here udp code procedure tform1.recorderdata(sender: tobject; const buffer: pointer; buffersize: cardinal; var freeit: boolean); begin freeit :=true; if idudpclient.active idudpclient.sendbuffer(rawtobytes(buffer^, buffersize)) else stop.caption := 'error'; end; and server on read event procedure tform1.udpreceiverudpread(athread: tidudplistenerthread; const adata: tidbytes; abinding: tidsockethandle); var audiodatasize: integer; audiodata : pointer; begin try entercriticalsection(section); try audiodatasize := length(adata); if audiodatasize > 10 begin try if not player.active begin player.active := true; player.waitforstart; end; except end; if blockalign > 1 dec(audiodatasize, audiodatasize mod

C: Run machine code from memory -

i want execute code memory; longterm goal create self-decrypting app. understand matter started roots. created following code: #define unencrypted true #define sizeof_function(x) ( (unsigned long) (&(endof_##x)) - (unsigned long) (&x)) #define endof_function(x) void volatile endof_##x() {} #define declare_end_of_function(x) void endof_##x(); #include <unistd.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <errno.h> #include <string.h> #include <sys/mman.h> #include <sys/types.h> unsigned char *bin; #ifdef unencrypted void hexdump(char *description, unsigned char *todump, unsigned long length) { printf("hex-dump of \"%s\":\n", description); (int = 0; < length; i++) { printf("%02x", todump[i]); } printf("\n"); } void hello_world() { printf("hello world!\n"); } endof_function(hello_world); #endif int main (void) {

c# - Registering multiple objects with same interface in Autofac -

i'm calling below code in xyzmanager class's constructor , application working. var handlers = new itabletype[] { new abchandler(new logger(), new repository()), new otherhandler(new logger(), new repository()) /*etc...*/ }; xyzmanager , logger , repository registered in application using autofac. the problem have around 25 handlers when go live , way have more maintainable code... i hope have been able explain problem. edit: know how register handlers in autofac , changes need make above code.. i guess register every handler : builder.registertype<abchandler>().as<itabletype>() but how change xyzmanager class's constructor after register implementors of itabletype , can define constructor so... public xyzmanager(itabletype[] handlers, /* other params... */) { } and autofac give array 1 of each of registered itabletype objects.

elasticsearch - Spring Boot + Elastic Search -

i trying setup application spring boot , elastic search. application use spring data jpa repositories persist entities. problem have when try run application elasticsearch configuration enabled getting exception when repositories scanned. i getting following exception: caused by: java.lang.illegalargumentexception: unable obtain mapping metadata int! my repository defined in following way: @repository public interface adminuserrepository extends pagingandsortingrepository<adminuser, long> { /** * returns adminuser match email specified parameter. * @param email adminuser email. * @return adminuser instance. */ adminuser findbyemail(final string email); /** * returns adminuser match email , business name specified parameter. * @param email adminuser email. * @param businessname business name. * @return number of matching instances. */ int countbyemailandbusinessname(final string email, final string business

javascript - Angular $http.jsonp or get returning 404 on a mobile -

i pulling in json file storing locally. when view in browser works, when view in ionic packaged app returns 404 i using following code: .factory('cardfactory', function ($q, $http, $rootscope) { return { getcards: function () { var deferred = $q.defer(), httppromise = $http.jsonp('/static/cards.json'); httppromise.then(function (response) { deferred.resolve(response); }, function (error) { console.error(error); }); return deferred.promise; } }; }); and calling so: cardfactory.getcards() .then(cardsuccess, carderror); i have tried instead of jsonp, both return 404 response. i aware of access-control-allow-origin issue, surely jsonp should solve that? @ same level (hierarchically) images, served fine. any ideas what's going on? the solution change request simple get, , lose first slash so: var httppromise = $http.get('static/cards.json');

Create a concatenated, comma separated list from XML nodes at different levels in the XML tree using XPath/XSLT -

i asked generate comma separated list generated xml document. when discounts consisted of nodes grouped under vehicle node worked ok (i have limited understanding of xpath). asked add 1 more discount located in different section of xml. using approach can't seem value of node need. clarification, don't create xml file, generated vendor system , 5k lines long. used post basis creating list. desired output (if node in loop != '0' or paymentplancd != 'paidinfull' add list - psuedo-code) multi-car, homeowner, affinity, in-agency transfer, advanced purchase, incident free, annual mileage, paid in full discount i getting comma @ end changed whitespace based approach seemed work (method 2). rather have comma based approach (method 1) though. below sample of xml document , code i'm trying make work. if there easier or more eloquent solution, i'm ears. sample xml (@pval stands "proposal value") <datastore> <session>

php - Prepared Statements and updating multiple rows -

i new prepared statements , in process of transitioning project... the last piece have transition piece have update multiple rows/records. this seems work me... however, curious , wondering technique , sending sort of response (boolean or other) success or failure. thoughts? comments? suggestions? function timeupdate($uid, $galarr, $timestamp) { global $mysqli; //my connection set elsewhere (bad/good?) $q = "update sometable set timestamp = ? galleryid = ? , uniid = ?"; $stmt = $mysqli->prepare($q); $stmt->bind_param("iii", $timestamp, $gid, $uid); foreach($galarr $value) { $gid = $value[0]; if(!$stmt->execute()) { throw new exception($stmt->error, $stmt->errno); } } $stmt->close(); } thanks in advance. links, suggestions appreciate.

calculating means from csv with python's numpy -

i have 10gb (can't fit in ram) file of format: col1,col2,col3,col4 1,2,3,4 34,256,348, 12,,3,4 so have columns , missing values , want calculate means of columns 2 , 3. plain python like: def means(rng): s, e = rng open("data.csv") fd: title = next(fd) titles = title.split(',') print "means for", ",".join(titles[s:e]) ret = [0] * (e-s) c, l in enumerate(fd): vals = l.split(",")[s:e] i, v in enumerate(vals): try: ret[i] += int(v) except valueerror: pass return map(lambda s: float(s) / (c + 1), ret) but suspect there faster way thins numpy (i still novice @ it). pandas best friend: from pandas.io.parsers import read_csv numpy import sum # load 10000 elements @ time, can play number better # performance on machine my_data = read_csv("data.csv", chunks

java - Closing connection in BoneCP -

we have bonecp library managing our connection pools. i'd know if following statement return connection pool. statement = conn.createstatement(); .... lots of code. .... connection conn = statement.getconnection(); statement.close(); conn.close(); will above code close connection , put connection pool? update: i'm asking question because when run statistics on connectionpool, still see conpool.gettotalleased() showing 2 connections being used. but, i've closed connections using above mechanism. the whole sense of pool hold established connections database. when retrieve connection pool save time connect database. what seeing pool holding connections fine. when close connection, returned pool , marked available next retrieval.

java - Hexadecimal representation taking more space than it should -

i have strings, hexadecimal, "ff", "bb", "aa" etc. did small experiment encoding stuff, , looks hexadecimal taking double number of bytes these things in string representation. my code's this: string hex ="ff"; byte[] b = hex.getbytes(); string enc = base16().encode(hex.getbytes()); byte[] c = enc.getbytes(); i'm using guava utils encoding stuff. it appears hex taking 2 bytes, b of length 2. encode hexadecimal. "ff" 255 in decimal, needs take 1 byte . enc 4 bytes , equal "4646" . next, c 4 bytes. i don't understand point enc getting generated. want c take 1 byte. can throw light? thank you! the getbytes() method doesn't think does. doesn't parse hexadecimal number; gives character encodings. character f number 70 , hex.getbytes() gets two-byte array of 'f', 'f' , or 70, 70 . encodes string sequence of bytes using p

python - Diameter computation in igraph -

i'm new python , igraph , wish simulate targeted attack network. specifically, given directed graph g, want progressively delete vertices g according in-degree. function takes input list (vertices_to_delete) of vertices delete g plus graph g. creates copy of g, deletes g vertices in vertices_to_delete , computes, on new instance of g, size of wcc , diameter of new graph. such process repeated different instances of vertices_to_delete (thus @ each iteration re-compute size of wcc , diameter). i report code below. results wcc in line expectations while values of d quite weird (i expect d increases no clear pattern emerges). i've tried code on dataset extracted wikipedia (wiki-vote - https://snap.stanford.edu/data/wiki-vote.html ). think i'm not using correct function computing diameter , depend on fact g directed. thanks lot kind , developers/contributors of igraph wonderful package! def attack(graph, vertices_to_delete): gc = graph.copy() gc.delete_vertic

android - Implement options menu in Fragment Activity -

i have 2 fragment activities , 1 fragment. here's how app logic looks like: fragmentactivity ==> fragment b ==> fragmentactivity c. fragmentactivity parent activity of fragment b , has options menu shows correctly.fragment b contains listview. when list item clicked on fragment b,its details displayed in fragmentactivity c.now want display options menu inside c in actionbar.however, menu displayed after menu button clicked.i want actionbar action. here code activity c: public class latestdetailsfragment extends fragmentactivity implements onitemclicklistener { public latestdetailsfragment() { photoimages = new imageitem(); } @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.fragment_latestdetails); gallery.setonitemclicklistener(this); // sethasoptionsmenu(true); } @override public boolean oncreateoptionsmenu(menu menu) { getmenuinflater().inflate(r.menu.d

javascript - Best way to create a color picker gui in extendscript? -

i started out scripting in javascript , knowledge minimal. i have few lines of code in create solid want gui color picker prompt user can choose color. here example below: var mycomp = app.project.item(1); //points comp var mysolid = mycomp.layers.addsolid([10,10,10],"shape", 10, 10, 1.0); // creates 10 pixel shape one of first parameters addsolid color enter array value identified in rgb values. wondering if can on ride value variable attached color picker gui? there objects or methods inside extendscript utility can create color picker? wondering. i hope question clear. thank you check out http://yearbookmachine.github.io/esdocs/#/javascript/$/colorpicker colorpicker(number color) invokes platform-specific color selection dialog, , returns selected color. parameters number color color preselected in dialog, 0xrrggbb, or -1 platform default. var color = $.colorpicker(); alert(color); edit1: ae uses colors in 4 value array values 0 1 [r, g,

linux - error while installing ceph in cluster node -

i'm getting below error while installing ceph on node using ceph-deploy $ceph-deploy install ceph-mds [ceph-mds][debug ] loaded plugins: fastestmirror, security [ceph-mds][warnin] need root perform command. [ceph-mds][error ] runtimeerror: command returned non-zero exit status: 1 [ceph_deploy][error ] runtimeerror: failed execute command: yum -y install wget i have changed defaults requiretty setting defaults:ceph !requiretty in /etc/sudoers file , put ceph sudo user same root in node ceph-mds. please let me know can issue here? thanks, subhadip

How to transfer C++ std::vector to openCL kernels? -

i have implement matrix class using 2 dimensional vectors in c++ ( vector<vector<float>>() ). want optimize code using gpgpu using opencl. runing in problems every miniute. please me , give me tips this. my requirements follows since want use matrix library implement machine learning algo there may huge matrix, 1000*400. can use 2 dimensional vectors , transfer them opencl kernels (because if can use vectors implement class more easy implementing these scratch using array). one of code segments follows, here in kernal try add 10 every element. but output shows change values in frist vector[0][n] elemets. this segment in host program.... int in_vec_size = 100; int out_vec_size = 100; vector<vector<float>> in_vec(10,vector<float>(10)); vector<vector<float>> out_vec(10, vector<float>(10)); int k = 0; //initialize input vec (int i=0; < 10;i++) { (int j = 0; j < 10;j++) { in_vec[i][j] = k++;

Understanding the Event-Loop in node.js -

i've been reading lot event loop, , understand abstraction provided whereby can make i/o request (lets use fs.readfile(foo.txt)) , pass in callback executed once particular event indicating completion of file reading fired. however, not understand function doing work of reading file being executed. javascript single-threaded, there 2 things happening @ once: execution of node.js file , of program/function reading data harddrive. second function take place in relation node? "of course, on backend, there threads , processes db access , process execution. however, these not explicitly exposed code, can’t worry them other knowing i/o interactions e.g. database, or other processes asynchronous perspective of each request since results threads returned via event loop code. compared apache model, there lot less threads , thread overhead, since threads aren’t needed each connection; when absolutely positively must have else running in parallel , management handled node.j

javascript - Get TH of a TD in Datatables -

how can th of td in datatables? right have code can use add attribute td's on datatable: "fnrowcallback": function( nrow, adata, idisplayindex, idisplayindexfull) { $('td', nrow).attr("title","pummm"); //takes tds row , assigned title attribute } what want put different attribute depending on header particular td have. do mean this? sorry, dont know plugin... var columnumber = 0; "fnrowcallback": function( nrow, adata, idisplayindex, idisplayindexfull) { $('td, th', nrow).each(function(){ var $this = $(this); if($this[0].tagname == "td"){ switch(columnnumber) { case 0: $this.attr("title","column 0"); break; case 1: $this.attr("title","column 1"); break;

php - How do I access values in a multidimensional array dynamically with a variable number of indices? -

essentially, have multidimensional array (it's more extensive bare skeleton need access): $arr = [ 1 => [ 'val1' => 'foo', 'val2' => 'bar', ], 2 => [ 'type1' => [ 'val3' => 'baz', 'val4' => 'fuz', ], ], ] i accessing array dynamically , won't know whether i'll accessing $arr[1] or $arr[2] until try so. therefore, don't know how many levels deep need go until time comes. looking function accesses varying number of levels deep of multidimensional array can't find that. know can if or switch statement i'm trying simplify like: if ( isset( $arr[$var]...... ) ) { return $arr[$var]......; } my problem can't figure out how build string replace "......" proper number of indices. tried making string using loop: function getaccessstring( array $arrofindices ) { $str = &

matplotlib - How to plot two sets of data in python -

Image
there 2 sets of data in 2 lists. lists x=[1,2,3,...,1000] , y=[0.12,0.59,-0.89,...,0.45] . i want plot them in xy coordinate. searched on net , figured out should download matplotlib , anaconda did. due fact new python user, not figure out how plot it. here's simple example: import matplotlib.pyplot plt x =[1,2,3,10] y =[0.12,0.59,-0.89,0.45] plt.plot(x, y, 'o-') plt.show()

javascript - How to check if svg <g> element supports css transform -

chrome, firefox , safari supports tranformation of svg <g> element css style without prefixes, while internet explorer , android 4.2.0 browser not support it. i want check if browser supports feature or not javascript, example this: if ( svg_css_transform_supported() ){ //do something; }else{ //do nothing; } this jsfiddle tutorial running on supported browsers: http://jsfiddle.net/samehobada/w95298kf/ function svg_css_transform_supported() { var svg = document.createelementns("http://www.w3.org/2000/svg", "svg"); return 'transform' in svg; }

javascript - Any way to disable scroll functionality of fullpage.js temporarily? -

i'm building out site using fullpage.js, has overlay pops , covers entire page. inside overlay, div setup overflow: scroll, can see of content. problem lies in when scroll thru content of overlay, scrolling of fullpage.js still going on background slides, causing end on random slide when close overlay. is there way disable scroll functionality slides, without effecting scrolling of div set overflow:scroll? using option normalscrollelements fullpage.js plugin provides: from the documentation : normalscrollelements: (default null) if want avoid auto scroll when scrolling on elements, option need use. (useful maps, scrolling divs etc.) requires string jquery selectors elements. (for example: normalscrollelements: '#element1, .element2')

How to configure Spring Data REST to return the representation of the resource created for a POST request? -

i following spring-data-rest guide accessing jpa data rest . when http post new record inserted (and response 201). great, there way configure rest mvc code return newly created object? i'd rather not have send search request find new instance. you don't have search created entity. http spec suggests, post requests returning status code of 201 created supposed contain location header contains uri of resource created. thus need issuing get request particular uri. spring data rest has 2 methods on repositoryrestconfiguration.setreturnbodyoncreate(…) , ….setreturnbodyonupdate(…) can use configure framework return representation of resource created.

python - Strange assignment in numpy arrays -

i have numpy array n rows of size 3. each row composed 3 integers, each 1 integer refers position inside numpy array. example if want rows refered n[4] , use n[n[4]] . visually: n = np.array([[2, 3, 6], [12, 6, 9], [3, 10, 7], [8, 5, 6], [3, 1, 0] ... ]) n[4] = [3, 1 ,0] n[n[4]] = [[8, 5, 6] [12, 6, 9] [2, 3, 6]] i building function modifies n, , need modify n[n[x]] specified x parameter (4 in example). want change 6 in subarray number (let's 0), use numpy.where find indexes, are where_is_6 = np.where(n[n[4]] == 6) now, if replace directly n[n[4]][where_is_6] = 0 there no change. if make previous reference var = n[n[4]] , var[where_is_6] change done locally function , n not changed globally. can in case? or doing wrong? sounds need convert indices original n 's coordinates: row_idxs = n[4] r,c = np.where(n[row_idxs] == 6) n[row_idxs[r],c] = 0

Scala + EclipseLink: JPA annotations treated as abstract traits, cannot be instantiated -

i writing scala backend uses eclipselink data abstraction layer. i find having problems right out of box, although several tutorials have followed indicated no such thing. example, 1 of entities this: @mappedsuperclass abstract class entity { @id @generatedvalue(strategy = generationtype.auto) @expose @beanproperty protected var id: int = 0 } @entity class user extends entity { @expose @temporal(temporaltype.timestamp) @beanproperty var createdat: date @expose @temporal(temporaltype.timestamp) @beanproperty var updatedat: date @expose @temporal(temporaltype.timestamp) @beanproperty var dateofbirth: date @expose @beanproperty var twostepverificationcode: string @expose @beanproperty var firstname: string @expose @beanproperty var lastname: string @expose @beanproperty var email: string @expose @beanproperty var description: string @expose @beanproperty var password: string @expose @beanproperty