Posts

Showing posts from September, 2012

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&qu

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

scala - Why so many tasks in my spark job? -

Image
i have spark job takes file 8 records hdfs, simple aggregation , saves hadoop. notice there hundreds of tasks when this. i not sure why there multiple jobs this? thought job more when action happened. can speculate why - understanding inside of code should 1 job , should broken down stages, not multiple jobs. why doesn't break down stages, how come breaks jobs? as far 200 plus tasks, since amount of data , amount of nodes miniscule, doesn't make sense there 25 tasks each row of data when there 1 aggregations , couple of filters. why wouldn't have 1 task per partition per atomic operation? here relevant scala code - import org.apache.spark.sql._ import org.apache.spark.sql.types._ import org.apache.spark.sparkcontext._ import org.apache.spark.sparkconf object testproj {object testproj { def main(args: array[string]) { /* set application name in sparkconf object */ val appconf = new sparkconf().setappname("test proj") /* env settings

How do I backspace 4 spaces at once in Netbeans? -

i know can use shift + tab , isn't there more convenient way of changing backspace ? if you're @ beginning of line , shift + tab , don't go previous line. go tools->options->editor->formatting remove check sign "use languages settings" , remove check sign "expand tabs spaces".

python 2.7 - Explain this bit of code to a beginner -

this question has answer here: how % work in python? 17 answers for x in xrange(12): if x % 2 == 1: continue print x i know does, language doesn't make sense me. in particular second line lost. if x % 2 == 1 means "if x modulo 2 equals 1". modulo (or mod) remainder after division. so, example: 3 mod 2 = 1 12 mod 5 = 2 15 mod 6 = 3 for x mod 2, you're there's remainder if , iff x odd. (because numbers divisible 2 0 remainder.) likewise, odd numbers have remainder of 1. so x % 2 == 1 returns true if x odd.

join - Relationships in has many laravel -

i have 3 tables units , renters , renter_units . fields of render_units table id , unit_id , renter_id . my render model is public function renter_unit() { return $this->hasmany('app\renterunit'); } and in renterscontroller $renters = renter::with('renter_unit')->get(); so $renders array shows collection {#212 ▼ #items: array:1 [▼ 0 => renter {#206 ▼ #fillable: array:3 [▶] #table: "renters" #guarded: array:1 [▶] #connection: null #primarykey: "id" #perpage: 15 +incrementing: true +timestamps: true #attributes: array:7 [▶] #original: array:7 [▶] #relations: array:1 [▼ "renter_unit" => collection {#210 ▼ #items: array:2 [▼ 0 => renterunit {#213 ▼ #fillable: array:2 [▶] #table: "renter_units" #guarded: array:1 [▶] #connection:

PHP MySQLI not inserting variable -

i trying create database user input,the problem while query believe correct doesnt create new database if try without using variable puting database name myself works variable doesnt. <?php $con = mysqli_connect("localhost","root",""); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } else{ echo "connected successfuly"; } $postresult = $_post[dbname]; echo $postresult; $runsql = $con->query("create database".$postresult.""); ?> the solution below fixed issue. <?php $con = mysqli_connect("localhost","root",""); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } else{ echo "connected successfuly"; } $postresult = $_post['dbname']; echo $postresult; $safestring = $con->real_escape_string($postresult); $runsql = $con->q

java - How can I access Dropwizard Resource directly, and not via REST -

i've create dropwizard resource , mapped rest api. want reuse resource api other points in code java api. how can it? this resource class: @path("/providers_new") public class providerresource { private providerdao dao; public providerresource(providerdao dao) { this.dao = dao; } @get @path("/get") @produces("application/json") public list<provider> getall() { return dao.getallproviders(); } } please note providerresource initialized dao: public class entitiesservice extends service<entitiesserviceconfiguration> { public static void main(string[] args) throws exception { new entitiesservice().run(args); } @override public void initialize(bootstrap<entitiesserviceconfiguration> bootstrap) { bootstrap.setname("entities"); ... } @override public void run(entitiesserviceconfiguration configuration,

PHP Modify an Array within an Array -

i created array , put array inside array. modify array, code never modify it. here create part: $arr_row_name = array(); for($nrow=0;$nrow < $numrows;$nrow++) { $arr_slot_name = array(); for($nsp=0;$nsp < $numservprovider + 1;$nsp++) { $arr_slot_name[] = "closed"; } //add slot row....... $arr_row_name[] = $arr_slot_name; } here part try access array , modify it. $arr_row_length = count($arr_row_name); for($x=0;$x<$arr_row_length;$x++) { $arr_slot_name = $arr_row_name[$x]; $arr_slot_length = count($arr_slot_name); for($slot=0;$slot<$arr_slot_length;$slot++) { $arr_slot_name[$slot] = "open"; } } in second bit of code, change: $arr_slot_name = $arr_row_name[$x]; to: $arr_slot_name = &$arr_row_name[$x]; the way have it, making copy of $arr_row_name[$x] $arr_slot_name ... in second option, assigning reference , able change original ...

ruby on rails - moving rails2 to 4 and getting error - undefined method `with_scope' -

how replace query in rails4.1.9 auditarea.send(query_options[:include_retired] ? :with_exclusive_scope : :with_scope) { # stuff } getting error undefined method `with_scope' . the with_scope called scoping in newer rails versions. with_exclusive_scope should unscoped . both methods accept block code should work ok them. see docs scoping , unscoped more info. update: scoping method not work if called on class itself. has called on scope (as opposed unscoped works on bare model class). first add "harmless" scope all (which selects records , behaves same way bare model class auditarea ) select both variants of send work: auditarea.all.send(query_options[:include_retired] ? :unscoped : :scoping) { # ... }

reactjs - Why does react redux does not re render view for object states changes? -

new redux , react , not sure why views not updated when objects in state updated. see jsbin: https://jsbin.com/wucutuhovu/1/edit?js,output however works numbers: https://jsbin.com/kaloqanise/1/edit?js,output redux doing shallow comparison state. when change state.value , state still points same object. try changing state.value += 1 to: return object.assign({}, state, { value: state.value + 1 }); check out jsbin: https://jsbin.com/cikinocudo/1/edit?js,output

javascript - (userscript/tampermonkey) not allowing website to detect my mouse movment/clicks -

senario = there website , put mouse inside website shows online. what want = want bypass want able put mouse in website , copy , paste text while still seen offline. what did = using tampermonkey chrome userscript: document.addeventlistener("mousemove", function(e){ e.stopimmediatepropagation(); }, true); the problem = works can put mouse inside website without showing online. click copy text reveal self online. is there way can modify userscript can copy , paste text without website knowing online!? solution helpful! you try disabling javascript while doing this, should prevent , scripts ratting out. https://productforums.google.com/forum/#!topic/chrome/byoqskiugu0 alternately, try opening developer tools page, find offending script , remove it. should last until page reloads. alternately alternately, try viewing source on page. if you're familiar html should able find text in there , copy , paste needed.

android - How to create a button of any form programmatically? -

i want create button properties. it can have form, color , placement. these parameters can changed in application the button can change colour on touch i try use canvas , draw , ontouchevent . there exists more simple , fast aproach? help. thank you! you use xml file 1 below, create states button. you copy xml file drawables folder in project, name example custom_button.xml. <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android"> <item android:state_pressed="true" > <shape android:shape="rectangle"> <solid android:color="#00ff00" /> <stroke android:width="5dp" android:color="#ff0000" android:dashwidth="3dp" android:dashgap="2dp" /> </shape> </item> <item android:state_focuse

asp.net - SignalR User NullReferenceException -

i've got code using microsoft.aspnet.signalr; namespace chat22 { public class chathub : hub { public void send(string message) { string name = context.user.identity.name; // call broadcastmessage method update clients. clients.all.broadcastmessage(name, message); } } } but when try send message, nullreferenceexception context.user.identity.name but works fine when set username in js code, , add name parameter in function, getting context name doesn't work. i tried on both local , published on web how can names? thanks answer add authorization http://www.asp.net/signalr/overview/security/hub-authorization#requireauth

android - ScrollView in RelativeLayout: bottom layout is blocking EditText in ScrollView -

this xml code: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:fitssystemwindows="true" android:layout_height="match_parent"> <scrollview android:layout_width="match_parent" android:isscrollcontainer="false" android:layout_height="match_parent" android:layout_alignparentbottom="true"> <relativelayout android:layout_width="match_parent" android:layout_height="wrap_content" android:padding="16dp" android:background="#fff" android:elevation="2dp" android:paddingbottom="32dp"> <view android:id="@+id/view7" an

html - laravel error when import css/js file -

currently, used laravel , bootstrap template on web page. when want import css php file, i've error here import code : <link href="{{ url::asset('css/bootstrap.css') }}" rel="stylesheet" /> but, got error the requested resource /%7b%7b%20url::asset('css/bootstrap.css')%20%7d%7d not found on server. previously, same way import css, , works.

bash - list files in a directory based on timestamp -

in bash, there command line list files in directory based on timestamp. e.g., \ls -ltr dir/file* -rw-r--r-- 1 anon root 338 aug 28 12:30 g1.log -rw-r--r-- 1 anon root 2.9k aug 28 12:32 g2.log -rw-r--r-- 1 anon root 2.9k aug 28 12:41 g3.log -rw-r--r-- 1 anon root 2.9k aug 28 13:03 g4.log -rw-r--r-- 1 anon root 2.9k aug 28 13:05 g5.log i want list files have timestamp before aug 28 13:00 . update : ]$ find -version gnu find version 4.2.27 features enabled: d_type o_nofollow(enabled) leaf_optimisation selinux you can use find command if know number of days find ./ -mtime -60 +60 means looking file modified 60 days ago. 60 means less 60 days. 60 if skip + or - means 60 days.

sql server - How to run a SQL batch within an Azure runbook? -

i need execute batch perform maintenance tasks in database examples on azure automation see dealing a single sql command . how do if creating sp not option? think need either somehow embed script.sql file runbook script or reference (like here , example)? you store .sql file in azure blob storage, , within runbook download .sql file, read contents, , pass sqlcommand object. something like: try { # connect azure using service principal auth $serviceprincipalconnection = get-automationconnection -name $azureconnectionassetname write-output "logging in azure..." $null = add-azurermaccount ` -serviceprincipal ` -tenantid $serviceprincipalconnection.tenantid ` -applicationid $serviceprincipalconnection.applicationid ` -certificatethumbprint $serviceprincipalconnection.certificatethumbprint } catch { if(!$serviceprincipalconnection) { throw "connection $azureconnectionassetname not foun

Call soap wsdl web service android -

i'm using java create web service, have link http://localhost:8181/netbeansprojects/wstlu30lichphongvan?wsdl on android studio use easywsdl generator plugin call ws link , generate hfiwsdangnhapportbinding.java, have code : public string testlogin(string username, string pass) { string result = ""; try { result = wsdangnhapportbinding.testlogin(username, pass); } catch (exception e) { result = "catch"; e.getstacktrace(); } return result; } when call testlogin catch ? use below code call soap web service android app. need ksoap library download , add ksoap library android project public class webservices { private static string serviceresponse; final static string namespace = "http://tempuri.org/"; final static string url = "http://" + appconstants.ip + "/mobileservice.asmx "; public static string dynamicwebcall(string methodname,hashmap<

javascript - Assignment associativity -

this question has answer here: javascript code trick :what's value of foo.x 4 answers the assignment operator has right-to-left associativity. var x,y; x=y=1; works expected , x equals 1. consider code: var foo={}; foo.x = foo = {n: 2}; i expect above work following: var foo = {n: 2}; foo.x=foo; however, in first case foo.x undefined while in second case foo.x points foo (circular reference). explanation? javascript evaluates expressions left right. can show what's going on using additional variable: var foo = {}; var bar = foo; // keep reference object stored in foo foo.x = foo = {n: 2}; because of associativity, last statement parsed as: foo.x = (foo = {n: 2}); but because of evaluation order, foo.x runs first (determining store value), foo , {n: 2} . store {n: 2} in variable foo , assign same value property x of old con

wix - Why the INSTALLFOLDER property was not changed through the RadioButtonGroup? -

Image
wix. write plugin must installed 1 of 3 directories only. therefore create custom dialog , insert chain: this code of dialog: <?xml version='1.0' encoding='windows-1252'?> <!-- selectinstalldirectory.wxs © andrey bushman, 2016 dialog window install directory selection of autocad extension. --> <wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <fragment> <ui> <!--<property id="defaultuifont">dlgfont10</property>--> <textstyle id="dlgfont10" facename="tahoma" size="10" /> <textstyle id="dlgfont20" facename="tahoma" size="20" /> <textstyle id="dlgfont10_important" facename="tahoma" size="10" red="255" green="0" blue="0"/> <textstyle id="dlgtitlefont" facename="tahoma" size="10&q

hex - Java - what does 0xXXXc means? -

i came acrros line: int b = (0x001c >> 1) and don't know little c next 0x001 means. know 0x hex i've never seen c before.. thanks the c hexadecimal c 12(in decimal). in case, 0x001c shifted right 1 . in other words 28 (in decimal), shifted 1 place right 14 (in decimal). in binary, 0...00 00011100 >> 00000001 gives.. 0...00 00001110(in binary) which is: 14 (in decimal) or e (in hex)

Set Image.Source to file in external storage in Xamarin.Forms -

i have picture of item in external storage (that saved intent in app). want display picture in image view in shared project. image.source takes object of imagesource type. tried imagesource.fromfile , imagesource.fromstream , imagesource.fromuri . result image not displayed (no error or exception). validated path file correct first opening file.open 1 line above. what correct way of displaying pictures normal storage, not assets/resources/etc? this code does not work : var path = "/storage/emulated/0/pictures/6afbd8c6-bb1e-49d3-838c-0fa809e97cf1.jpg" //in real app path taken db var image = new image() {aspect = aspect.aspectfit, widthrequest = 200, heightrequest = 200}; image.source = imagesource.fromfile(path); your xamarin forms pcl don't know uri android beacuse platform specific, so: imagesource.fromfile(path); won't work. in case handling platform specific features, loading image android. suggest approach: create interface on xam

Bringing in a function from javascript into html -

new web programming need make web app existing c++ code. have gotten existing c++ code compile in javascript. can output values in js file function called sample(), cannot figure out how bring function html front end have can use these generated values. thanks can give. place code inside script tag: <script> var func = function() { // ... } </script> to show inside html element: <div id="my-element"></div> <script> var func = function() { return 'result'; } window.onload = function() { document.getelementbyid("my-element").innerhtml = func(); } </script>

ios - How can I get the frame of a table view cell in the coordinate space of the table view? -

Image
i have table view bunch of cells in it. want frame of cell, not in superview's coordinate space, in table view's coordinate space. a picture explain better see red rectangle? frame of table cell. , blue rectangle frame of table view. want red rectangle relative blue rectangle. i tried use frame property of uitableviewcell . doesn't work because returns (0, 0, 320, 44). y value shouldn't 0 because cell not @ top of screen. according view hierarchy, intended behaviour, because superview of table cell apparently uitableviewwrapperview , not table view: while table view this: so there method/property can me cgrect represents frame of table view cell in coordinate space of table view? i think there function can convert cgrect in coordinate space another. forgot name , how use it. don't know whether helpful in situation. please use below code let rectofcell= tableview.rectforrowatindexpath(indexpath) let rectofcellinsuperview = tablev

html - java getParametr() returns wrang value of russian char -

i,ve got problem returning "letter" (russian chars) value. the request string is: http://localhost:8080/library_1/pages/books.jsp?letter=Г // books.jsp <%@page contenttype="text/html" pageencoding="utf-8"%> <!doctype html> <%@include file="../web-inf/jspf/left_menu.jspf" %> <jsp:usebean id="booklist" class="beans.booklist" scope="page"/> <%@include file="../web-inf/jspf/letters.jspf" %> <div class="book_list"> <% list<book> list = null; if (request.getparameter("genre_id") != null) { long genreid = long.valueof(request.getparameter("genre_id")); system.out.println(genreid); // string checking value of returning parameter list = booklist.getbooksbygenre(genreid); } else if (request.getparameter("letter") != null) { string letter = re

c# - selenium doesn't enter the site -

i created console application (with target: .net framework 4 ) , added next references: selenium.webdriverbackedselenium.dll thoughtworks.selenium.core.dll webdriver.dll webdriver.support.dll static iwebdriver driver = null; if (driver == null) { chromeoptions options = new chromeoptions(); options.addarguments("--start-maximized"); driver = new chromedriver(@"c:\selenium\net40", options); // opened new window (about:blank) } driver.navigate().gotourl("http://www.facebook.com"); but nothing happen. i use: chromedriver 26.0.1383.0 and chrome browser version is: 29.0.1547.62 m this command line: started chromedriver port=1866 version=26.0.1383.0 log=c:\users\salon\desktop\application alon\consoleapplication1\consoleapplicati on1\bin\debug\chromedriver.log [156:4144:0828/233852:error:platform_thread_win.cc(127)] not implemented [5804:5712:0828/233856:error:textfield.h(173)] not implemented i have windows 7 if it

c# - Trying to use touch id -

i trying use touch id sample on 1 of xarmians blogs given me error. not no if cause using simulators registered test touch passed. failing , probelm have using story boards question how push view controller succsess , find out why touch id faling. partial void touchid(uibutton sender) { //lets double check device supports touch id if (context.canevaluatepolicy(lapolicy.deviceownerauthenticationwithbiometrics, out error)) { var replyhandler = new lacontextreplyhandler((success, error) => { invokeonmainthread(() => { if (success) { var newvc = new uiviewcontroller(); presentviewcontroller(newvc, true, null); } else { var alert = new uialertview("

oauth - clientId is null while using swagger (both Swashbuckle & Swashbuckle.Core versions are 5.3.2) with Web Api (v5.2.3) -

i trying setup swagger documentation web api uses oauth (using owin middleware 'useoauthauthorizationserver') running issues. i have done oauth swagger configuration below: general oauth configuration scopes: c.oauth2("oauth2") .description("oauth2 implicit grant") .flow("implicit") .authorizationurl(configurationmanager.appsettings[constants.authorizationhosturl]) .tokenurl(configurationmanager.appsettings[constants.tokenurl]) .scopes(scopes => { scopes.add("admin", "admin permission required"); }); enabling oauth selected apis: c.operationfilter<assignoauth2securityrequirements>(); swagger ui configuration: c.enableoauth2support("myportal", "test-realm", "swagger ui"); wi

vb.net - the point disappear in excel -

i using code save dgv excel file: if ((datagridview1.columns.count = 0) or (datagridview1.rows.count = 0)) exit sub end if 'creating dataset export dim dset new dataset 'add table dataset dset.tables.add() 'add column table integer = 0 datagridview1.columncount - 1 dset.tables(0).columns.add(datagridview1.columns(i).headertext) next 'add rows table dim dr1 datarow integer = 0 datagridview1.rowcount - 1 dr1 = dset.tables(0).newrow j integer = 0 datagridview1.columns.count - 1 dr1(j) = datagridview1.rows(i).cells(j).value next dset.tables(0).rows.add(dr1) next dim excel microsoft.office.interop.excel.application dim wbook microsoft.office.interop.excel.workbook dim wsheet microsoft.office.interop.excel.worksheet excel = new microsoft.office.interop.excel.application wbook = excel.workbooks.add() wsheet = wbook.activesheet() dim

java - What is a NullPointerException, and how do I fix it? -

what null pointer exceptions ( java.lang.nullpointerexception ) , causes them? what methods/tools can used determine cause stop exception causing program terminate prematurely? when declare reference variable (i.e. object) creating pointer object. consider following code declare variable of primitive type int : int x; x = 10; in example variable x int , java initialize 0 you. when assign 10 in second line value 10 written memory location pointed x. but, when try declare reference type different happens. take following code: integer num; num = new integer(10); the first line declares variable named num , but, not contain primitive value. instead contains pointer (because type integer reference type). since did not yet point java sets null, meaning "i pointing @ nothing". in second line, new keyword used instantiate (or create) object of type integer , pointer variable num assigned object. can reference object using dereferencing operator . (a dot

ios - Core Data NSPredicate not working -

Image
this question has answer here: swift nspredicate throwing exc_bad_access(code=1, address=0x1) when compounding statements 2 answers please me there no specific error, run time stop func fachdatabyid(entityname: string, colummname: string, value: int) -> bool { let appdeleget = uiapplication.sharedapplication().delegate as! appdelegate let manegecontext = appdeleget.managedobjectcontext let fetchrequist = nsfetchrequest(entityname: entityname) print("ok fetchrequist") fetchrequist.predicate = nspredicate(format: "%k == %@", colummname, value) do{ let results = try manegecontext.executefetchrequest(fetchrequist) print(results) return true } catch{ print("error") return false } } the problem %@ format value:int , cast value nsobject or anyobject fo

php - How to print an entire array when third dimension is constant -

how print entire array when 1 index constant. for understanding purposes have made array $actionf = array( "enemyhlth" => array(array()), "enemyblts" => array(array()) ); with input 3 2 1 1 2 3 3 2 1 1 2 3 3 2 1 1 2 3 the array structure supposed store top 3 rows under 3d array 3rd dimension constant "enemy health" while bottom 3 in 3d array same 3rd dimension "enemy bullets". , both these 2 3d arrays stored in single array called actionf now when try print it for($level=0;$level<$n;$level++){ $actionf["enemyhlth"] = array ( $level => fscanf($_fp,"%d\t%d\t%d\n") ); } for($bullets = 0;$bullets<$m; $bullets++){ $actionf["enemyblts"] = array ( $bullets => fscanf($_fp,"%d\t%d\t%d\n") ); } print_r($actionf); output 3 2 1 i think printing last index of ab

android - Cordova app closes unexpectedly -

i developed hybrid app using cordova. uploaded google play , app store. users reported getting message "unfortunately, xxx has closed" (xxx represents app name). while testing not able reproduce issue. strange part users message when not using app. had following plugins installed in app cordova-plugin-camera 2.2.1-dev "camera" cordova-plugin-compat 1.0.0 "compat" cordova-plugin-device 1.1.1 "device" cordova-plugin-file 4.1.0 "file" cordova-plugin-file-transfer 1.5.0 "file transfer" cordova-plugin-geolocation 2.1.0 "geolocation" cordova-plugin-inappbrowser 1.4.0 "inappbrowser" cordova-plugin-network-information 1.2.0 "network information" cordova-plugin-splashscreen 3.2.2 "splashscreen" cordova-plugin-statusbar 2.1.4-dev "statusbar" cordova-plugin-whitelist 1.2.2 "whitelist" cordova-plugin-x-toast 2.3.2 "toast" cordova-sqlite-storage 0.7.14 "cordov