Posts

Showing posts from April, 2014

java - How to receive base64 conversion [audio file] through TCP/IP with less seconds? -

case: 2 different linux machine. client machine running on 'c'programming , sever receiving machine running on java. my code: appendedlen = "2687868"; int lengthtocheck= infromclient.read(ch, 0, ch.length); while (appendedlen >= lengthtocheck) { request = request + string.valueof(ch).trim(); if ((appendedlen - lengthtocheck) != 0) { ch = new char[appendedlen - actuallen]; actuallen = infromclient.read(ch, 0, ch.length); lengthtocheck = lengthtocheck + actuallen; } else { (" received entire response"); break; } } for receiving, take 6-7 mins. get inputstream socket , use apache commons read byte[] follows ioutils.tobytearray(inputstream)

mapreduce - Map-Reduce Logs on Hive-Tez -

i want interpretation of map-reduce logs after running query on hive-tez ? lines after info: conveys ? here have attached sample info : session open info : dag name: select a.model...) info : tez session closed. reopening... info : session re-established. info : info : status: running (executing on yarn cluster app id application_14708112341234_1234) info : map 1: -/- map 3: -/- map 4: -/- map 7: -/- reducer 2: 0/15 reducer 5: 0/26 reducer 6: 0/13 info : map 1: -/- map 3: 0/118 map 4: 0/118 map 7: 0/1 reducer 2: 0/15 reducer 5: 0/26 reducer 6: 0/13 info : map 1: 0/118 map 3: 0/118 map 4: 0/118 map 7: 0/1 reducer 2: 0/15 reducer 5: 0/26 reducer 6: 0/13 info : map 1: 0/118 map 3: 0/118 map 4: 0(+5)/118 map 7: 0/1 reducer 2: 0/15 reducer 5: 0/26 reducer 6: 0/13 info : map 1: 0/118 map 3: 0(+5)/118 map 4: 0(+7)/118 map 7: 0(+1)/1 reducer 2: 0/15 reducer 5: 0/26 reducer 6: 0/13 info : map 1: 0/118 map 3: 0(+15)/118 ...

excel - Copy cell values to different Workbook -

firstly, let me apologise if question has been answered somewhere else. had couldn't find me. secondly, i'm sure there far more simple way i'm new vba , i'm trying teach myself go along. ok, have sheet @ end of workbook compiles information previous sheet , want copy values in row 2 workbook have network drive. i've managed work on same sheet not workbook (without using userform). it comes error 'invalid qualifier' line cells(emptyrow, 1.value - dateraised.value here code below, sub commandbutton1_click() dim emptyrow long dim dateraised long dim customername string dim siteaddress string dim callreason string dim customerorderno long dim invoiceno long dim covernoteno long dim findings string dim producttype string dim supplier string dim attempts long dim condition string dim dateclosed long dim creditgiven string dim creditvalue long dim issuedays long dim comments string dateraised = cells(2, "a").value customername = cells(2,...

which is lightest linux distro to install utility softwares in vm environment? -

my application running on ubuntu 14.04 vms. , decided install utility software security gateway , imq on individual vms. i think overkill run security gateway on full fledged os. there better way, wherein can use os lightest memory, filesystem , cpu footprint ? just applications can work done using lighttpd in-place of complete webserver. i need of lightweight server image, easier store . lubuntu takes 800+ mb. think https://help.ubuntu.com/community/installation/minimalcd do. let me try , post results.

node.js - Having trouble with Mongod testing a route -

i've been following online tutorial @ thinkster "building first mean stack app" @ https://thinkster.io/mean-stack-tutorial#beginning-node im trying test route see if correct using curl -x put http://localhost:8080/posts/<post id>/upvote and mongod throws 505 error saying <h1>cast objectid failed value &#34;57bcdb57bcdb255600e6d114e7afb9&#34; @ path &#34;_id&#34;</h1> casterror: cast objectid failed value "57bcdb57bcdb255600e6d114e7afb9" @ path "_id" @ mongooseerror.casterror (/home/ubuntu/workspace/flapper-news/node_modules/mongoose/lib/error/cast.js:19:11) @ objectid.cast (/home/ubuntu/workspace/flapper-news/node_modules/mongoose/lib/schema/objectid.js:147:13) @ objectid.castforquery (/home/ubuntu/workspace/flapper-news/node_modules/mongoose/lib/schema/objectid.js:187:15) @ cast (/home/ubuntu/workspace/flapper-news/node_modules/mongoose/lib/cast.js:208:32) @ query.cast (/...

github - What is this git command saying? -

what git command saying? it-staging:master? master part throwing me off. how can branch it-staging have master under/in it? git push my-staging it-staging:master if run git push --help , find example following git push origin head:master push current branch remote ref matching master in origin repository. form convenient push current branch without thinking local name. for question, it-staging:master means push local branch it-staging remote branch master .

javascript - How to disable 'withCredentials' in api call using node.js only (https package) -

i'm using node.js script load in-built https package. when using error: xmlhttprequest cannot load [constructed-api-url]. wildcard '*' cannot used in 'access-control-allow-origin' header when credentials flag true. origin 'http://localhost:3000' therefore not allowed access. credentials mode of xmlhttprequest controlled withcredentials attribute. i'm using node.js 4.4.3, , https api docs not mention withcredentials. the script being used this one . is there anyway set xhr call's withcredentials false using node.js https? i looking analogous jquery ajax call (just focusing on xhr field): $.ajax({ type: 'post', async:true, url: 'https://someapp.constructed.url/token', datatype: "json", contenttype: 'application/x-www-form-urlencoded; charset=utf-8', xhrfields: { withcredentials: true }, headers: { ...

java - How to add admob banner in a fragment view? -

Image
i new android development , confused how add admob banner fragment activity(i think calling fragment). modifying source code. i have layout file called fragment_ftp.xml , below <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:ads="http://schemas.android.com/apk/res-auto"> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:textappearance="?android:attr/textappearancemedium" android:text="" android:id="@+id/statustext" android:layout_above="@+id/startstopbutton" android:layout_centerhorizontal="true" android:layout_marginbottom="99dp" /> <textview a...

markdown - Color print R mark down html -

Image
i wonder there way force web browser print r mark down html in colors. can achieved editing bootstrap file wonder if done within markdown file. reproducible example: test.rmd --- title: "habits" output: html_document --- ```{r, echo = false} df <- data.frame( id = 1:10, name = c("bob", "ashley", "james", "david", "jenny", "hans", "leo", "john", "emily", "lee"), age = c(28, 27, 30, 28, 29, 29, 27, 27, 31, 30), grade = c("c", "a", "a", "c", "b", "b", "b", "a", "c", "c"), test1_score = c(8.9, 9.5, 9.6, 8.9, 9.1, 9.3, 9.3, 9.9, 8.5, 8.6), test2_score = c(9.1, 9.1, 9.2, 9.1, 8.9, 8.5, 9.2, 9.3, 9.1, 8.8), final_score = c(9, 9.3, 9.4, 9, 9, 8.9, 9.25, 9.6, 8.8, 8.7), registered = c(true, false, true, false, true, true, true, false, false, false), ...

python - Does pandas reindex `method` kwag not work with columns? -

i trying simple operation: df = pd.dataframe(np.random.rand(5,3)) df.columns = df.columns * 3 print(df.reindex(columns=np.arange(9), method='ffill').head()) and this: 0 1 2 3 4 5 6 7 8 0 0.593936 nan nan 0.805081 nan nan 0.930780 nan nan 1 0.019330 nan nan 0.095645 nan nan 0.667744 nan nan 2 0.826164 nan nan 0.295915 nan nan 0.259967 nan nan 3 0.495695 nan nan 0.403194 nan nan 0.122684 nan nan 4 0.365294 nan nan 0.648194 nan nan 0.621820 nan nan but, of course, expect see this: 0 1 2 3 4 5 6 7 8 0 0.593936 0.593936 0.593936 0.805081 0.805081 0.805081 0.930780 0.930780 0.930780 1 0.019330 0.019330 0.019330 0.095645 0.095645 0.095645 0.667744 0.667744 0.667744 2 0.826164 0.826164 0.826164 0.295915 0.295915 0.295915 0.259967 0.259967 0.259967 3 0....

node.js - Show all sections for node util.debuglog -

is there way show sections of node.js built-in uitl.debuglog ? let's want debuglog between multiple files covering different aspects. example, such controllers , services , more. set each's debuglog section respectively. node_debug can grossly long , if add new section, have restart nodemon. i thought node_debug=* node app.js work doesnt. never mind, i'm using debug now. allows debug=*

sql server - How to query and display data as a matrix? -

my query : select * (select t.description, isnull(count(e.employeecode), 0) employee e inner join department d on e.departmentcode = d.departmentcode inner join termreason t on e.termreasoncode = t.termreasoncode e.terminationdate not null , e.terminationdate between @periodstartdate , @periodenddate) s pivot (count(employeecode) description in ([finance], [human resources], [nursing])) pvt my expected results are: termination reason department1 department2 department3 etc etc --------------------------------------------------------------------- aaa value1 value2 value 3 value4 bbb value1 value2 value 3 value4 ccc value1 value2 value 3 value4 ddd value1 value2 value 3 value4 dynamic pivot declare @dynamicpivotqu...

windows 7 - Intuitive file sorting in batch scripts? -

Image
so in windows explorer, have these files sorted this: i have script remove brackets , 1 zero, , in case trailing number greater or equal 10, remove 2 zeroes: cd c:\folder setlocal enabledelayedexpansion set /a count=0 %%a in (*.jpg) ( set /a count+=1 echo !count! set f=%%a if !count! gtr 9 ( set f=!f:^00 (=! ) else ( set f=!f:^0 (=! ) set f=!f:^)=! ren "%%a" "!f!" ) pause however, once run code, result: so batch file isn't going through files "intuitively" windows explorer shows them. there way change this? or there better way rename these files altogether? this uses different approach: @echo off cd c:\folder setlocal enabledelayedexpansion set /a count=0, remove=2 /f "delims=(" %%a in ('dir /b *.jpg') ( set /a count+=1 echo !count! set "f=%%a" if !count! equ 10 set "remove=3" /f %%r in ("!remove!") set ...

imacro loop from csv -

i trying run macro log account , make changes , log account number , same changes. so far able log account , make change not able have macro pull next account id csv , continue on. think can done loop how im not certain. i can't post exact info 2 reasons. 1. company internal , 2. block access forums @ work. i'm going write similar im needing log account, , log account , same thing. lets example wanted log lowes account , make payment log out , make payment on other lowes account. 'version build=8970419 recorder=fx tab t=1 set !datasource datasource.csv set !var1{{!col1}} set !var2{{!col2}} url goto=url here tag pos=1 type=input:text form=name:consumerloginform attr=name:userid content={{!var1}} tag pos=1 type=img attr=src:url here set !encryption no tag pos=1 type=input:password form=name:consumerloginform attr=name:password content={{!var2}} tag pos=1 type=img attr=src:url here tag pos=3 type=a attr=txt:makeapayment i know can use {{!col1}} call first col...

amazon web services - How do I restrict a user to update and for anyone to search? -

i lock down aws elasticsearch instance users specify allowed "update" index (usually /_bulk request deleting , creating indexes) , can "search" index (with /_search request). this thought work: { "version": "2012-10-17", "statement": [ { "sid": "", "effect": "allow", "principal": { "aws": "arn:aws:iam::$myrootid:user/$myusername" }, "action": "es:eshttppost", "resource": "arn:aws:es:us-west-2:$myrootid:domain/mydomainname/*" }, { "sid": "allowanonymoushttpget", "effect": "allow", "principal": { "aws": "*" }, "action": "es:eshttppost", "resource": "arn:aws:es:us-west-2:$myrootid:domain/$mydomainname/_search" ...

Solr sort search using AND operator first and then results from OR operator -

let's have phrase like: cyclone winston fiji relief appeal and first want display words in results, , search, , after display results have @ least 1 word in it, or search. is possible, , how should done? so first i'll see results like: cyclone winston fiji relief appeal appeal cyclone winston fiji relief appeal fiji relief cyclone winston ... and results like: cyclon widston appeal fiji ... solr (lucene actually) not have , and or commands - in-reality must, should, , not each term. , said should match standard should use case, happens when don't special. terms match, more relevant is. so, if not getting that, else problem. can enable debugging see happens (though takes time understand output). 1 scenario using edismax , searching across multiple fields matches coming different sources. best field match used , other matches shadowed. using tie parameter can that.

php - How do you put 3 arrays in memory and then reference them to avoid hitting API calls more then 3 times -

in code have 3 functions nested. 1 calls 1 calls another. code execution slow. led believe because these api calls can contain lot of data , getting ran more once having impact on performance. code sample follows: $data['object'] = 'domain'; $data['action'] = 'read'; $data['format'] = 'json'; if($response = $this->request($data)){ $obj = json_decode($response,true); ....... } }else{ return $response; } so basically, obj gets data. can create private array in form , write results , run statements against instead of calling api several times? i led believe because these api calls can contain lot of data , getting ran more once having impact on performance. the golden rule of optimization do not optimize without measuring first . use profiler run code , tell code getting executed , taking longest time. if don't measure, speedi...

python 3.x - Django with Pycharm - PermissionError at /home/ -

i set first django project in pycharm morning seem receiving following error whenever intend navigate /home/ view. view can reached via basic home ur when 'runserver' , navigate url receive following error: permissionerror @ /home/ [errno 13] permission denied: 'c:\\users\\admin\\pycharmprojects \\shadowrun\\shadowruntetramode\\templates\\shadowruntetramode' request method: request url: http://127.0.0.1:8000/home/ django version: 1.9.4 exception type: permissionerror exception value: [errno 13] permission denied: 'c:\\users\\admin\\pycharmprojects\\shadowrun\\shadowruntetramode\\templates\\shadowruntetramode' exception location: c:\users\admin\appdata\local\programs\python\python35-32\lib\site-packages\django\template\loaders\filesystem.py in get_contents, line 24 python executable: c:\users\admin\appdata\local\programs\python\python35-32\python.exe python version: 3.5.1 python path: ['c:\\users\\admin\\pycharmpr...

algorithm - Java Mergesort Implementation having a stackoverflow error -

i'm not quite sure why merge sort implementation getting stackoverflow error. i've reviewed code multiple times i'm not getting why happening. tried debugging have had trouble understanding why values 0 , 4 (the first , last index of array) never change when walk through code. , throws stack overflow error. the first recursive call mergesort (line 17?) should use "start, mid", not "start, end". puts in endless loop, run out of stack. trust debugger.

wordpress - IIS unwanted redirect to port 8080 -

i have own webserver on virtual machine in internet. server worked far. today tried deploy new wordpress website. in order keep old website running , deploy new, set bindings of new website port 8080 instead of 80. when finished deployment, stopped old site , set bindings of new site 80 , started new site on myserver. since this, can't connect website froum outside or when browsing within iis anymore. browser appends 8080 @ end of address. i restarted site, server, checked bindings 10 times, no change. it iis 8.5 running on win 2012 r2 standard. the error message in browser is: firefox cannot establish connection www.mysite.com:8080 i not clear appending 8080. related dns somehow ? or local config file. made search , found no entries 8080. additional information: 1. have ssl cert installed , linked page 2. have redirect rule defined http->https 3. worked before switching new website 4. when blank wordpress installation, can reach site via https not http -...

Close specific notification android -

i need close specific notification click buttom it. problem how know notification_id know close. code: intent.setaction("eliminar"); bundle = new bundle(); bundle.putint("respuesta", 1); intent.putextras(bundle); pintent = pendingintent.getbroadcast(getapplicationcontext(), (int) system.currenttimemillis(), intent, pendingintent.flag_update_current); n = new notification.builder(getapplicationcontext()) .setcontenttitle("recordar") .setstyle(new notification.bigtextstyle().bigtext(nota.gettext())) .setsmallicon(r.drawable.ic_icono) .setcontentintent(pintent) .setcolor(color.parsecolor("#4caf50")) .setongoing(true) //notificacion persistente .addaction(r.drawable.ic_borrar, "quitar nota", pintent).build(); n...

c++ - bitwise right-shift of negative numbers -

this question has answer here: right shifting negative numbers in c 6 answers arithmetic bit-shift on signed integer 4 answers i looked @ binary representations of negative integers under influence of bit-shift , noticed bitshifting behaves differently these positive ones. int imax = std::numeric_limits<int>::max(); std::bitset<32> bs0(imax+1); std::cout << bs0 << "\n"; std::bitset<32> bs1((imax+1) >> 1); std::cout << bs1 << "\n"; std::bitset<32> bs2((imax+1) >> 2); std::cout << bs2 << "\n"; output: 10000000000000000000000000000000 11000000000000000000000000000000 11100000000000000000000000000000 what had expected was: 10000000000000000000000000000000 0100000000...

r - Applying a function to elements of each row and then summarising -

i have question on manipulating data in data.frame. essentially have large data set - abbreviated version below: structure(list(nm_mean = c(194213914.326, 194213914.326, 194213914.326, 194213914.326, 194213914.326, 217947112.739), nm_se = c(9984735.05918367, 9984735.05918367, 9984735.05918367, 9984735.05918367, 9984735.05918367, 11010386.0760204), alpha = c(193.197697846336, 214.592588477741, 240.246557258741, 258.116959355425, 282.560024775668, 306.610038660465 ), beta = c(61526.2664158025, 57950.9563448233, 56085.1512614369, 52919.4794239927, 51483.4591654126, 50405.8186695088)), .names = c("nm_mean", "nm_se", "alpha", "beta"), row.names = c(na, 6l), class = "data.frame") i want use rbeta generate probabilities using beta distribution , alpha , beta parameters similarly want use rnorm generate random numbers using normal distribution nm_mean , nm_se mean , sd. i want multiply rbeta values generated rnorm values , ...

python - ModelForm to edit a model and its OneToOne-related model -

say have user model , account model. the account related user onetoone relationship. i have modelform user model, , i'm looking third-party plugin / patch / snippet allow declaration: class usereditform(modelform): class meta: model = user fields = ['first_name', 'last_name', 'email', 'account__phone'] note account__phone part. thanks!

c# - How to map binary(16) to Guid using NPOCO? -

Image
i have table in mysql database below structure how map primary key affiliatesiteid binary(16) guid using npoco in c# net core? i guess can create guid using affiliatesiteid. ex. if affiliatesiteid string can create guid follows have no idea npoco. var siteid = new guid(affiliatesiteid);

excel vba - Calling an ActiveX control Button from a macro -

Image
i have written vba-excel code excecuted press of activex control button placed on worksheet. i don't want press run , want control invocation based on 1 more macro (separate). is possible , if yes, share insights regarding it. this how worksheet looks , want invoke button separate macro: in order run macro attached activex control can directly call sub following command: callbyname worksheets("sheet1"), "commandbutton21_click", vbmethod note, (by default) excel create private sub on worksheet button. if wish call these subs module have remove private up-front. note, sub's name must nameofthebutton_click . so, if above code resides in sub in module , want make work the code on sheet (for example): sub commandbutton21_click() msgbox "gotcha" end sub if wish invoke macros buttons on sheet1 following code do: option explicit public sub tmpso() dim obj oleobject each obj in worksheets("sheet1").oleobje...

jQuery get data-parent value -

i have checkboxes when 1 of them checked returns value stored in data-parent the html: <input type="checkbox" name="" data-parent="some-parent"> the jquery: $(document).on('change', '.checkbox', function(event) { alert($(this).data(parent)); }); here returns [object object] you need quote parent : $(document).on('change', '.checkbox', function(event) { alert($(this).data("parent")); }); single quotes fine.

Python another option to tkinter label counter -

i have program i'm using tkinter pop window , use root.title of window counter. call program through subprocess mutliple times, aka multiple windows pop , display have @ counter see how long before each of programs finished running. i want know how long before each , every process finished. doing bit of testing don't believe using subprocess report idle , show counter using print(). @ least doesn't appear doing right me. is there way of accomplishing same task without using tkinter? below link other open question right i'm using open tkinter window closes on me unexpectedly. i'm not sure when windows closes if whole program stops running or if windows closes. hence why want counter...hence why have been using tkinter window don't know of other way of doing serves same purpose. i want counter can tell program finished if internet connection gets dropped. don't have internet access @ home i'm using free-wifi quite has timeouts on it. want...

angular - Webpack, Typescript and Angular2 with Ahead Of Time (AOT) compilation? -

the latest release of angular2 allows ahead of time (aot) compilation, using code in app.bootstrap.ts file: // browser platform without compiler import { platformbrowser } '@angular/platform-browser'; // app module factory produced static offline compiler import { appmodulengfactory } './app.module.ngfactory'; // launch app module factory. platformbrowser().bootstrapmodulefactory(appmodulengfactory); angular2 official documentation how can integrate webpack , typescript loaders angular2's aot compiler? it seems there might not option yet, i'm asking question on stack overflow when available, answer can found. update 10/12/16 - got working, see answer below. i got working finally, see repo angular2 webpack2 dotnet starter there several tricks necessary. note aot compilation not support require() statements in angular 2 components. need converted import statements. first, need have second tsconfig.json file, special options aot com...

localization - Add localized language app descriptions on app store -

Image
i have app, written in javascript , built objective c http://cocoon.io in other words, can not edit c files of build. now, want simplest thing on world - add translated app description in multiple languages. on play store need select , add new language drop down menu , add corresponding description. on apple, however, read, need set list of languages available in drop down build. can't express enough how silly this!!! in itunes store on "localizable information" language drop down have , english. any workaround this? thanks! as far understand question, want add localised app store descriptions app. works similar in itunes connect google play console. (it's different if want localise app itself. more info check official guide .) 1) log itunes connect , choose app 2) click on languages dropdown on right - default shows primary language - , click on little blue "+" add languages . 3) can add specific/translated metadata new lan...

ATOMS Arduino for scilab -

i trying install arduino toolbox on windows 64. use scilab 5.5.2. install select "box" atoms in scilab box not show arduino toolbox in list of toolboxes. i downloaded file "arduino_1.1-1.bin.x64.windows.zip" , unzipped after not know install tool box , follow examples. i need use scicos monitor sensors through arduino installation of toolbox mandatory. install scilab 5.4.1. contains arduino tool box. the same thing happens me scilab 5.5.2 happens computers. reason unclear me, time being, uninstall 5.5.2 , use scilab 5.4.1.

Check for "handshake" in MPI? -

is there way check whether non-blocking receive posted (for given source , tag), before initiating mpi_send ? i've got situation senders , receivers both don't know send / receive from. idea first post open irecv on chosen receivers. senders check whether rank has posted receive, , send if true (continue otherwise). after sends successful, receivers cancel outstanding irecv s. this works collective (on mpi_comm_world ) array broadcast; i'm wondering if there different way i imagine in reverse, mpi_isend , mpi_probe . in case though i'm worried happens unreceived send buffers (and have heard mpi_cancel bad news sends) thanks suggestions. you can perform mpi_irecv different tag of data transfer, using source mpi_any . using blocking mpi_recv trick. once message ( mpi_test 's flag==1), can check actual source reading mpi_status.mpi_source (not available if status parameter mpi_status_ignore ). if don't explicitly require transfer must sy...

scala - Slick 2.1.x Invalid query because of ` -

i working on legacy code written in slick 2.1 (can't upgrade right now). val query = foo.filter(x => x.d >= input._1).filter(x => x.d < input._2) println(query.selectstatement) query.list i can see generate query select x2.`a`, x2.`b`, x2.`c`, x2.`d` `foo` x2 (x2.`d` >= {ts '2016-07-30 00:00:00.0'}) , (x2.`d` < {ts '2016-07-30 23:23:59.0'}) when executes, gives error java.sql.sqlsyntaxerrorexception: ora-00911: invalid character when copy paste printed query oracle query editor gives same error there. if remove ```s works. why slick 2.1.x generate bad query? there anyway tell stop generating "`"s i found answer. had imported wrong driver. had imported mysqldriver , trying execute code against oracle. importing right oracledriver (via slick-extensions) generated right query.

themes - Custom gtkrc for a specific application in Ubuntu Gnome 16.04 -

i use ubuntu gnome 16.04 lts. installed arc-darker theme repository given in github page. installed gvim ubuntu software center. use solarized dark theme in gvim there thin horizontal white line @ bottom. gvim window white line @ bottom. i don't want line in white (in red reactangle). want line dark, background of solarized theme. i changed background color in /usr/share/themes/arc-darker/gtk-2.0/gtkrc background color of solarized theme : gtk-color-scheme = "bg_color: #002b36" it solves problem can see here : gvim without white line @ bottom. the problem other gtk2 application use background now. so, part of these applications dark. don't want this. want other application keep original theme color. question : is possible add option somewhere in gtkrc file or other file in theme folder permanently change "gtk-color-scheme" property of gvim only , only theme ? ps : sorry, not allowed put pictures directly here, , can't put more 2 l...

python - Finding random pairs in a large directory -

i have ~5m csv files stored in ~100.000 folders. each folder contains same number of files , there's number of files in folder. need find paths these files , load them list in strange order statistical modeling project. in particular, need following upheld: uniqueness: each file must in list once pairs: each file must next file same folder (it can next 2 if due randomness) randomness: probability of 2 files not "paired" being next each other should same (i.e. wouldn't work iterative on files) i've created example below. files folder_1 - file_a - file_b - file_c - file_d folder_2 - file_e - file_f - file_g - file_h good result (randomized, upholds rule of pairs) paths = ['folder_1/file_a', 'folder_1/file_d', 'folder_2/file_g', 'folder_2/file_f', 'folder_2/file_e', 'folder_2/file_h', 'folder_1/file_c', 'folder_1/file_b'] a simple approach might "pick random folder, pick ra...

Get "jstat" Utility for IBM J9 (Java 1.6) -

i maintaining several linux systems (suse sles 11 sp3) running java 1.6 (ibm j9) , java application wish able monitor more closely. i'd able gather statistics on heap usage, "jstat" tool not seem supplied ibm in jdk (unless i'm confused, so, i'm starting familiarize self java). looks it's bundled oracle java jdk.. what i'm wondering if there way utility installed compatible java application running in ibm j9 vm, or pretty sol? , if it's not available, there way gather size of heap , how close application running out of memory? it sounds you're looking ibm health center: http://www.ibm.com/developerworks/java/jdk/tools/healthcenter/ health center quick deploy, small impact live monitoring tool running on either ibm java virtual machines or ibm sdk node.js. gathering information on wide range of areas such method profiling, garbage collection , memory usage, health center provides recommendations , analysis improve performance , e...

postgresql - POSTGRES COALESCE(NULLIF(c.name,''), 'unassigned') not working -

no version of character varying field return null if there isn't value... it's frustrating case when coalesce(nullif(e.name,''),'unassigned') null 'unassigned' else a.name end was final test , still returns null unless field has value it's character varying(255) coalesce(a.name,'unassigned') // won't work nullif(a.name,'') // won't work nullif(a.name,null) // won't work coalesce(nullif(a.name,''),'unassigned') // won't work however instant use 0 works.. what's that? it's character varying(255) field , set default null as matter of point build of table column is name varying character(255) default(null) so know it's entering null , i've done select * <tbl> name null; , of course, return null rows a.name... what's deal this? ok... deciding answer me with: coalesce(nullif(e.name,''),'unassigned') null... this method never...

java - deleting the specific file in a directory and all sub directories -

this question has answer here: how compare strings in java? 23 answers am using code deleting specific file in directories , sub directorates in drive not working. please me in regard. if want delete specific file in drives how do. static string refile= "input.txt"; public static void deletemyfile(file directory) { if (directory.exists()) { file[] files = directory.listfiles(); if (null != files) { (int = 0; < files.length; i++) { system.out.println(files[i].getname()); if (files[i].isdirectory()) { deletemyfile(files[i]); } else { string temp ; temp = files[i].getname(); if (temp==re...

Find virtual host for VM running Windows Server 2012 Standard (not R2) -

i can find virtual host of windows servers (2003-2012 r2) using in command line: reg query "\\*machinename*\hklm\software\microsoft\virtual machine\guest\parameters" /v hostname however, have 1 server running 2012 standard , not have reg key. i verified server vm using: systeminfo | findstr /c:"model:" /c:"host name" /c:"os name" however, i'd know vm being hosted. i've investigated other methods of determining host, focus around reading reg key vm not have reason. is there way determine vm hosted without reg key? using hyper-v , have no reason suspect vm one-off snowflake. check “hklm\software\microsoft\virtual machine\auto” host details stored in key @ guest there class check this share vm , host details

c# - Environmental variables ignored for Layout in Area -

i have problem in asp.net core mvc application. can advise why tag helper environment (names) isn't working (administration) layout page when located inside area? when referencing scripts using below code, works when placed standard _layout.cshtml page not _layout.cshtml contained within area (used administration area). ideally trying modularise code areas - dashboard contains _layout.cshtml page administration area. i discovered css/js references being included (unminified , minified , cdn). put below code public layout , admin layout. <environment names="development"> development </environment> <environment names="staging,production"> staging production </environment> ~/views/shared/_layout.cshtml (public) "development" displayed (good) ~/areas/dashboard/views/shared/_layout.cshtml (administration) "development staging production" displayed (bad) my environmental variable is aspnetcore_e...

php - Accept-Language of CURLOPT_HTTPHEADER does not work -

Image
curl set language header i trying source code of facebook's homepage using curl, chinese due location of server host. reason, added accept-language of curlopt_httpheader change language english, failed. according answer quoted above, below php code of curl tried: <?php $url = "http://www.facebook.com/"; if(isset($_server['http_user_agent'])) $user_agent = $_server['http_user_agent']; else $user_agent = ""; $options = array( curlopt_returntransfer => true, // return web page curlopt_header => false, // don't return headers curlopt_followlocation => true, // follow redirects curlopt_httpheader => array("accept-language: en-us;q=0.6,en;q=0.4"), curlopt_useragent => $user_agent); $ch = curl_init($url); curl_setopt_array($ch, $options); $content = curl_exec($ch); $err = curl_errno($ch); $errmsg = curl_error($ch); $header = curl_getinfo(...

vectorization - Vectorize weighted sum matlab -

i trying vectorize weighted sum couldn't figure out how it. have created simple minimal working example below. guess solution involves either bsxfun or reshape , kronecker products still have not managed working. rng(1); n = 200; t1 = 5; t2 = 7; = rand(n,t1,t2); w1 = rand(t1,1); w2 = rand(t2,1); b = zeros(n,1); = 1:n j1=1:t1 j2=1:t2 b(i) = b(i) + w1(j1) * w2(j2) * a(i,j1,j2); end end end = b; you use combination of bsxfun , reshape , permute accomplish this. we first use permute move n dimension 3rd dimension of a . multiply w1 , transpose of w2 create grid of weights. can use bsxfun perform element-wise multiplication ( @times ) between grid , each "slice" of a . can reshape 3d result m x n , sum across first dimension. b = sum(reshape(bsxfun(@times, w1 * w2.', permute(a, [2 3 1])), [], n)).'; update there's simpler approach use matrix multiplication perform summation you. unfortunately has broken % create grid of weigh...

angularjs - Ng-Transclude not working for ng-include -

i have created ng-transclude sample not working when use ng-include inside directive template property.below code have tried angular.module("app",[]); angular.module("app").controller('appcontroller', function ($scope) { $scope.message="message controller"; }); angular.module("app").directive('myframe', function () { return { restrict: 'e', template : '<div ng-include=\"gettemplateurl()\"></div>', controller:function($scope){ $scope.hidden=false; $scope.close=function(){ $scope.hidden=true; } $scope.gettemplateurl=function(){ //dynamic url return "frame.html"; } $scope.message="message directive"; }, transclude:true, } }); angular.module("app").directive('mychildframe', function () { return...

c++ - Swapping elements in array recursively -

i've been trying swap elements store in array recursively. my array stores list of upper , lower case letter using rand() below. for (int = 0; < size; i++) { alphabets[i] = (rand() % 26 + 65 + rand() % 2 * 32); } the objective swap uppercase , lowercase elements , move lower case , uppercase left , right respectively thi function meant swaps element recursively until (i == j) condition met. void swapelementr(char alphabets[], int size) { int temp; int = 0; int j = size - 1; if(i == j) { return; } else { if (alphabets[i] >= 'a' && alphabets[i] <= 'z') { if (alphabets[j] >= 'a' && alphabets[j] <= 'z') { temp = alphabets[i]; alphabets[i] = alphabets[j]; alphabets[j] = temp; } else --j; ...

excel - Vlookup to match the SUBSET of a cell with contains -

Image
i vlookup,but match subset of cell. possible? for example, have value in sheet1 cell a2 alcatel 7705 sar-8 fan v1 , have value in sheet2 cell b2 7705 sar-8 fan v1 , want match , put value of sheet2 cell b2 in sheet1 , match 7705 sar-8 fan v1 . i trying use wildcard in vlookup =vlookup("*"& a2 &"*",'sheet2'!b:b,1,false) but not working. please help. this need , array formula using index/match: =index(sheet2!$b$2:$b$100,match(true,isnumber(search(sheet2!$b$2:$b$100,a2)),0)) being array formula 1 must confirm ctrl-shift-enter instead of enter when exiting edit mode. if done correctly excel put {} around formula.

c# - Unity: The type is not interceptable -

i'm trying resolve dependency on class called within class service. registration this private static iunitycontainer registerservices(this iunitycontainer container) { return container .registerwithpolicy<iservice, service>(new injectionproperty("unitycontainer", container)) .registerwithpolicy<icalled, called>() ; } i use reflection find right implementation of icalled (there more 1 implementation of it). var type = _typefinder.findmytype(myobject); var instance = (icalled)unitycontainer.resolve(type); but when execute code error exception is: argumentexception - type called not interceptable. parameter name: interceptedtype @ time of exception, container was: resolving namespace.called,(none) i tried using servicelocator , enterpiselibrary resolve type, same error. cannot use activator since called (and other implementations) have different interface dependencies. hint?

loops - Create archive for Custom Post Type : wordpress -

i have created archive.php custom post type. archive-custom_posttype.php within have placed standard loop. `<?php get_header(); if (have_posts()) : while (have_posts()) : the_post(); the_title(); the_excerpt(); endwhile; endif; get_sidebar(); get_footer(); ?>` great! works. where fall down when trying use current_post; , found_posts; they not giving me values when echo them loop. the actual archive page layout more complex , part of making work need current_post , found_post. any ideas appreciated! are echoing found_posts referencing global wp_query variable? if not, try: echo $wp_query->found_posts;

flexbox - React Native Grid of Buttons -

i'm new react-native, , i'm trying make grid of buttons can change number of buttons per row , overall number of buttons. making grid not problem changing number of items per row harder. give me advice on should use achieve goal? i'm using flex-box , listview right now. i don't recommend use listview, try create new component instead represent each row on grid , create componen represents each button on ro. can create many button want on each row , able modify styles. you can still use flexbox order elements @ center.

RSpec, Rack/Test, Sinatra message expectation always passes even though an error gets thrown -

testing whitelisting operation via given test: require 'spec_helper' describe '/orders' describe 'post /order' 'whitelists attributes' expect_any_instance_of(logger).to_not receive(:warn) order = { account: "1234", user: "zach", } post '/order', order.to_json, {'content-type' => 'application/json'} end end end jumping controller via pry shell prints error screen: rspec::mocks::mockexpectationerror: (#<logger:0x007f2c4e5c4fc8>).warn(#<logger:0x007f2c4e5c4fc8 @progname=nil, @level=0, @default_formatter=#<logger::formatter:0x007f2c4e5c4f50 @datetime_format=nil>, @formatter=nil, @logdev=#<logger::logdevice:0x007f2c4e5c4f00 @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<io:<stdout>>, @mutex=#<logger::logdevice::logdevicemutex:0x007f2c4e5c4ed8 @mon_owner=nil, @mon_count=0, @mon_mutex=#<mutex:0x007f2c4e5c4e6...

angularjs - Creating custom balloon text for category Axis in AmCharts -

i using amcharts in angularjs application , wanted know how create custom balloon text when hover on category axis labels. following code: var configchart = function () { employeechart = new amcharts.amserialchart(); employeechart.categoryfield = "empid"; var yaxis = new amcharts.valueaxis(); yaxis.position = "left"; employeechart.addvalueaxis(yaxis); mcfbargraph = new amcharts.amgraph(); mcfbargraph.valuefield = "employeerating"; mcfbargraph.type = "column"; mcfbargraph.fillalphas = 1; mcfbargraph.linecolor = "#f0ab00"; mcfbargraph.valueaxis = yaxis; employeechart.addgraph(empbargraph); employeechart.write('employee'); } in chart category field emp id , valuefield rating. data provider chart employees json data. there 1 more attribute in json location. w...

logging - Limiting Nlog internal log file size -

i've been tasked finding way manage internal log files nlog generating of our projects. files continuously being appended leading large files ~80 mb , up. after looking matter came across this issue on nlog's github specified layout variables aren't usable on nlog's internal log files. is there other possible method handle every growing internal log files built in nlog? edit: changing internallogfilelevel error warn reduced number of lines being written our internallogfiles. currently there no builtin file size limit. a work around disable writing internal log file , use internallogger.logwriter . another option disabled internallogger (set off ) , enable when there issues.

angularjs - Point [ui-router otherwise] to static page -

i have login.html different layout other sites i've put in app directory , not have state it. i'd redirect www.example/login.html if user 404. i tried configuring ui-router inside of 1 module: function routeconfig($urlrouterprovider, $windowprovider) { var $window = $windowprovider.$get(); $urlrouterprovider.otherwise(function($injector, $window){ $window.location.href = '/login.html'; }); } but unfortunatelly got error: $window.location undefined how can redirect 'static page'? your otherwise callback function of which, closure var $window = $windowprovider.$get() not same argument $window in callback function, , hence undefined. the correct code should be: function routeconfig($urlrouterprovider, $windowprovider) { $urlrouterprovider.otherwise(function($injector){ var $window = $windowprovider.$get(); // put line of code inside $window.location.href = '/login.html'; }); }...

javascript - How to copy the state of a manually (un)checked checkbox? -

in other words, without triggering javascript events change attributes of <input> , how preserve state of checkbox manually checked or unchecked , copied place? run snippet below , check or uncheck few of them , hit "copy": $('#cp').click(function(){ $('#copy').html($('#original').html()) $('#copy-clone').html($('#original').clone().html()) }) $('#hi').click(function(){ $('#original input:checked').parent().css('border','2px solid red') }) <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <form id="original"> <label><input type="checkbox" name="man">man</label> <label><input type="checkbox" name="woman">woman</label> <label><input type="checkbox" name="monkey">monkey</label> ...