Posts

merge two files based on one column Awk -

i trying merge 2 tab delimited files files - of unequal lengths. need merge files based on column number 1 , values 3rd column of each file new file. if of files missing id ( uncommon value) should blank value in new file - file1: id1 2199 082 id2 0909 20909 id3 8002 8030 id4 28080 80828 file2: id1 988 00808 id2 808 80808 id4 8080 2525 id6 838 3800 merged file : id1 082 00808 id2 20909 80808 id3 8030 id4 80828 2525 id6 3800 i went through many forums , posts , far have this awk -f\t 'nr==fnr{a[$1]=$1; b[$1]=$1; next} {$2=a[$1]; $3=b[$1]}1' but not yield right result, can please suggest. lot! $ awk -f'\t' 'nr==fnr{a[$1]=$3; next} {a[$1]; b[$1]=$3} end{for (id in a) print id,a[id],b[id]}' ofs='\t' file1 file2 | sort id1 082 00808 id2 20909 80808 id3 8030 id4 80828 2525 id6 3800 how works this script uses 2 variables. every line in file1, associative array a has key corresponding id , ...

apache spark - SparkR installation error wget: unrecognized option '--progress-bar' -

i trying install sparkr in docker container debian os. commands input r console is: >library(devtools) >install_github("amplab-extras/sparkr-pkg", ref="master", subdir="pkg") then error message follows: downloading github repo amplab-extras/sparkr-pkg@master url https://api.github.com/repos/amplab-extras/sparkr-pkg/zipball/master installing sparkr '/usr/lib/r/bin/r' --no-site-file --no-environ --no-save --no-restore --quiet \ cmd install \ '/tmp/rtmpvjw078/devtools12119aab1c/amplab-extras-sparkr-pkg-385fbe5/pkg' \ --library='/usr/local/lib/r/site-library' --install-tests installing *source* package ‘sparkr’ ... ** libs ** arch - ./sbt/sbt assembly attempting fetch sbt wget: unrecognized option '--progress-bar' usage: wget [option]... [url]... try `wget --help' more options. wget: unrecognized option '--progress-bar' usage: wget [option]... [url]... try `wget --help' more option...

c++ - Load JVM in a DLL -

i loading jvm in dll fails (indicated in code fails.). tried same code in exe , works fine. javavminitargs vm_args; /* jdk 1.1 vm initialization arguments */ jnienv *env; javavmoption options; options.optionstring = "-djava.class.path=c:\\core\\bin\\otk-1.4.1-with-dependencies.jar"; vm_args.version = jni_version_1_6; vm_args.noptions = 1; vm_args.options = &options; vm_args.ignoreunrecognized = 0; jvm_dll = loadlibrary("c:\\program files\\java\\jdk1.6.0_23\\jre\\bin\\server\\jvm.dll"); if(jvm_dll == null) { getmanager()->log( "initialisejava::can't load jvm dll.", high_importance ); return false; } jni_createjavavm_ptr = (jni_createjavavm_func)getprocaddress(jvm_dll, "jni_createjavavm"); if(jni_createjavavm_ptr == null) { getmanager()->log( "initialisejava::can't create jvm.", high_importance ); return false; } int ret = jni_createjavavm_ptr(jvm, (void**)&env, &vm_arg...

Why is my Android navigation drawer opening too wide? -

Image
i had rather basic navigation drawer working pretty -- simple listview. need title above selectable items, (see below) modified xml drawer relativelayout containing textview title , listview items. what resulted quite strange. though have specified width 3 (relativelayout, textview , listview) 240dp, width of listview when represented entire drawer's xml, looks (ignore volume control - didn't see pop up). notice listview 240 dp wide, red background i've assigned going way right. here's xml first screen. relevant drawer xml @ bottom. <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- main content view --> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools...

javascript - ng repeat list dropdown to filter another list dropdown -

i have 2 drop down lists following: html <div class="col-md-3"> <select class="form-control" ng-model="select1"> <option value="" selected disabled>select first</option> <option ng-repeat="item in items" value="{{item.name}}">{{item.name}}</option> </select> </div> <div class="col-md-2"> <select class="form-control" ng-model="select2"> <option value="" selected disabled>select second</option> <option ng-repeat="item in items|filter:itemfilter" value="{{item.stuff}}">{{item.stuff}}</option> </select> </div> my list of items looks like: [ {name:"foo1", stuff:["bar1","bar2","bar3"]}, {name:"foo2", stuff:["bar4","bar5","bar6"]}, {...

php - Connect to remote mssql with public ip -

i cannot connect remote mssql using mssql_connect(xx.xx.xx.xx\instancename, $user, $password); i tried: - xx.xx.xx.xx\instancename,1433 - xx.xx.xx.xx\instancename,1434 - xx.xx.xx.xx\instancename - xx.xx.xx.xx:1434 - xx.xx.xx.xx:1433 - xx.xx.xx.xx none of them work. however, when tried connect database sql management studio public ip, works( xx.xx.xx.xx or xx.xx.xx.xx\instancename, 1433 ) don't think there problems ports. works when created local mssql database , connect php using local ip , doesn't work when tried connect remote mssql(different network) using wan ip . know cause or how connect remote mssql php? thank you i fixed problem using sqlsrv driver microsoft $dbh = new pdo ("sqlsrv:server=xx.xx.xx.xx,1433;database=xxxx",'user','password'); :)

TCL RegExp IP exceptions -

i have following tcl regexp extract exact ip line: set ip [regexp -all -inline {((([2][5][0-5]|([2][0-4]|[1][0-9]|[0-9])?[0-9])\.){3})([2][5][0-5]|([2][0-4]|[1][0-9]|[0-9])?[0-9])} $ip_text] i'm using analyze log file, , works fine, except it's extracting domain name ip portion when domain name contains ip format (but in reverse), don't wan't eg when ip_text = log file 61.140.142.192 - 2012-06-16, 192.142.140.61.broad.gz.gd.dynamic.163data.com.cn, chn, 1 i 61.140.142.192 & 192.142.140.61 61.140.142.192 legit. and when ip_text = entry "61.140.170.118" resolved 118.170.140.61.broad.gz.gd.dynamic.163data.com.cn, , 61.140.185.45 verified. i 61.140.170.118, 118.170.140.61 & 164.111.111.34 61.140.170.118 & 61.140.185.45 legit. is there way make regexpr exclude ip's have domain name character after it? ie exclude <ip><dot> or <ip><dash> or <ip><any alpha/numeric character> you can use...