Posts

Showing posts from July, 2014

java - Why the getApplication() from Service Class on android can still return its sub class obj? -

as title, i've seen code below in custom service class of kiahapplication acquire app's application obj: ((kiahapplication)super.getapplication()).setservicerunning(true); but how android.app.service class's getapplication method know & return custom application obj? android.app.service should not part of custom application, and it's not recorded in application's manifest file should definition of app's members. thank helping! super.getapplication() call getapplication in super class, android.app.service ((kiahapplication)super.getapplication()) cast result of super.getapplication() kiahapplication , class kiahapplication extends application ((kiahapplication)super.getapplication()).setservicerunning(true); call setservicerunning(true); on kiahapplication class but how service class's getapplication method know & return custom application obj? because it's singleton. anywhere call getapplication() retu...

PESEL checksum validation(Javascript/HTML) -

im student studying home , im stuck on checksum problem. script supposed validate pesel(polish equivilant of social security number think), anyway checksum works follows pesel: 70051012347 pesel:7,0,0,5,1,0,1,2,3,4 (7) (multiply each pesel number corresponding check number) check:1,3,7,9,1,3,7,9,1,3 (sum each number) sum: + 7,0,0,45,1,0,7,18,3,12 =93 mod: 93 mod 10 = 3 10 - 3 = 7(last digit of pesel) where mod 10 doesn't equal 0, result of sum%10 subtracted 10 , matched final digit in original number, if match good, if not bad. need have or bad result. i'm pretty sure have of fine in code , there's simple solution cant see it. @ massively appreciated. <html> <head> <meta charset="utf-8"> <title>pesel checker</title> <script type="text/javascript"> function peselgood(y) { //sample pesel's //type 1 //70051012347 //02070803628 //07020803628 //type 2 //83102570819...

css - media-query specificity - why is the largest style used when using max-width media queries? -

i have following (simplified) example code: ( jsbin: http://jsbin.com/cisahilido/1/edit?html,css,output ) scss: .container { background: none; } @media screen , (max-width: 480px) { .container { background: red; } } @media screen , (max-width: 768px) { .container { background: white; } } @media screen , (max-width: 1024px) { .container { background: blue; } } markup: <!doctype html> <html> <head> <meta charset="utf-8"> <title>js bin</title> </head> <body> <div class="container"> hello! </div> </body> </html> now, when screen 480px or less, expect .container have red background. however, seems have blue background, until 1024px breakpoint, has no background. why max-width styles override smaller breakpoints bigger ones? because 480 less last max-width of 1024. css uses last valid value, need order max-width media queries larg...

windows - CreateRestrictedToken( ) from WinAPI -

my question winapi createrestrictedtoken( ) function. how can create token allows process initialize , start itself, restrict access all files on computer, except specified files? obviously should enable logon sid in token (to let process use window station). i'm bit confused sidstodisable , sidstorestrict function. usage not clear me. the plan start process logon sid enabled, , grant permission logon sid files. seems not work. i'm stuck, , need help.

javascript - How can call on_menu_about(); function of UserMenu.js in Odoo 9? -

i want create odoo backend theme, use icon about tab, means when click on icon popup generated. tried code don't work: .xml <xpath expr="//ul[@class='nav navbar-nav navbar-right oe_user_menu_placeholder']" position="inside"> <li><a href="#" onclick="web.usermenu.on_menu_about();" data-menu="about" title="about"><i class="fa fa-question-circle"></i></a></li> </xpath> but did not work. so follow code answer . .xml <xpath expr="//ul[@class='nav navbar-nav navbar-right oe_user_menu_placeholder']" position="inside"> <li><a href="#" class="about" title="about"><i class="fa fa-question-circle"></i></a></li> </xpath> then in .js file include this var usermenu = require('web.usermenu'); var self=this; var u...

java - Send logs from a REST service to an HTML page -

i have rest service on server a. service doing stuff , logging messages log4j. aside, have web page on server b calling service ajax , getting response. apart receiving response (which works fine me), print on page log messages server side. in other words, every time there new log message on server side, view display it. any ideas achieve ? edit: how use websocket retrieve logs log4j socket appender? you create rest endpoint retrieve raw log data text/plain . following: get /logs http/1.1 accept: text/plain you provide query string parameters filter logs date , time, following: get /logs?from=2016-07-03t10:00:00z&to=2016-07-04t10:00:00z http/1.1 accept: text/plain then client can request such endpoint, retrieve data want , display logs in html page. if prefer rendering html page on server side, instead of accepting text/plain , accept text/html . for real time logging, consider websockets .

javascript - onDrag event raised with incoherent values when mouse released -

i far being html/javascript expert , going crazy around problem. did not find on net regarding this, tried multiple things without success. basically using drag functionality achieve something. don't need drag/drop, interested in drag. here very simple sample illustrating issue : https://jsfiddle.net/fhdolz70/2/ the div can dragged around , logging event.clientx value. values correct during drag, when release mouse, ondrag event raised once more incoherent clientx value (completely out of bounds, negative value). same happens clienty , other values associated event (not interested in other values clientx , clienty haven't checked). why ondrag raised when mouse released ? drag on ... , why hold such weird values ? how can avoid receive last event on mouse release ? thanks lot. what you're seeing oddity jsfiddle. ondrag event fired on release, typically return zero. if took same code , placed in standalone file this: <!doctype html> ...

path - how to resolve a fakepath with google chrome using angular2 -

i need path application angular2 typescript path (c:\fakepath\img.png ) ask if there solution thanks below example: ts file upload(file) { console.log('file'+':'+file.value) const inputnode = file.value.replace("c:\\fakepath\\", ""); console.log(inputnode); } in above function, passed file value parameter , used javascript replace function replace "c:\fakepath\" blank space. html file <input class="file" (click)="file.click()" type="file" accept="image/*" #file > <button mat-raised-button (click)="upload(file)">upload</button>

python - Boolean function to check if a list of ints is in increasing order- Must use a while loop -

how approach this? i've tried different ways , i've far . ex: [1, 2, 5, 7] returns true , [1, 1, 6, 9] returns false . second example doesn't work. returns true though first 2 elements equal. doing wrong? def increasing(l): n = len(l) = 0 while <= n-1: if l[i] > l[i+1]: return false else: i+=1 return true problem lies here while <= n: if l[i] > l[i+1]: in example, n=4. since array index starts @ 0, list index 0 1 2 3 . checking till n=4 incorrect. then, doing [i+1] checks 5th element. replace these lines while < n-1: if l[i] > l[i+1]: this take care of index out of range error do have use loop here? no. check python - how check list monotonicity

angularjs - ng-map: How can I get the Marker object when I click it? -

i using pretty cool ng-map library angular, , want know how access underlying marker object referenced ng-map marker directive so, have markup: <div id="map-search" data-tap-disabled="true"> <map zoom="15" disable-default-u-i="true"> <marker ng-repeat=" pos in positions" position="{{pos.latitude}}, {{pos.longitude}}" id="{{pos.index}}" on-click="pinclicked()"> </marker> </map> </div> i haven't found straight-forward way of accessing google maps marker object during on-click event in case; controller: app.controller('mapsearchcontroller', function($scope) { $scope.$on('mapinitialized', function(event, map) { $scope.map = map; //assume existence of array of markers $scope.positions = generatepinpositionsarray(); }); $scope.pinclicked = function(event, marker) { console.log(...

Append element to json dict (geojson) using Python -

i add style geojson through python. current features not have style elements. want append style , fill. however, when do, nothing added file. same before import json open('test.json') f: data = json.load(f) feature in data['features']: feature.append("style") feature["style"].append({"fill":color}) sample geojson { "type": "featurecollection", "crs": { "type": "name", "properties": { "name": "urn:ogc:def:crs:ogc:1.3:crs84" } }, "features": [ { "type": "feature", "properties": { "statefp": "17", "countyfp": "019", "tractce": "005401", "blkgrpce": "2", "geoid": "170190054012", "namelsad": "block group 2", "mtfcc": "g5030", "funcstat": "s", ...

node.js - nodejs socket.io doing nothing but connections 100% cpu -

i'm new nodejs , socket.io, when run it reaches cpu 100% (the cpu jumping between 14-103%..) when have 800 users in site. @ first problem saw every few minutes of users disconnected , reconnect after few seconds, commented out of code ended on connect , on disconnect.. still after 5 minutes cpu reaches jumping cpu 14-100%.. don't know check since there's laterally nothing basic stuff.. node version - 0.10.25 socket.io version - 1.0 code snippet - var redis = require('redis').createclient(), server = require('http').createserver(), request = require('request'), io = require('socket.io').listen(server), sockets = {}; // , memcache = require('memcache') // , cookie = require('cookie') // run http server on port server.listen(3000); console.log('started node sockets.'); // allow authenticated connections - todo: check if doing anything.. :x io.set('authorization', function(handshake, cal...

C++ Error: expected primary-expression before 'double' -

i need write class program calculates distance between 2 points - point.cpp, , class program calls point.cpp program calculate length(basically distance point.cpp) , slope between 2 points - linesegment.cpp. tested point.cpp separately , runs fine. when run (in conjunction linesegment.cpp), following error message: linesegment.cpp: in member function ‘void linesegment::setend1(point)’: linesegment.cpp:31: error: expected primary-expression before ‘double’ linesegment.cpp:32: error: expected primary-expression before ‘double’ linesegment.cpp: in member function ‘void linesegment::setend2(point)’: linesegment.cpp:37: error: expected primary-expression before ‘double’ linesegment.cpp:38: error: expected primary-expression before ‘double’ my codes below. have marked 4 lines error message refers comment (everytime posted code line numbers received suggested edit take line numbers out, did not include line numbers time). my guess calling functions point.cpp incorrectly, textbook n...

Equivalence in iOS to Javascript interface in Android? -

i developing ios equivalent of running android app. both apps browser receiving data server. includes javascript thar checks server changes , issues local notifications when needed. in android done using interfaces. nevertheless, cannot find equivalent , straightforward solution ios (currently using swift). have got proposals on regard? (methods or workarounds this). thanks in advance, jose have looked webkit? wkwebview , wkscriptmessage , apis may you're looking for.

c++ - How to exclude namespace from gprof? -

i using gprof profile application. use gprof2dot produce graphs, graphs tend large because there plenty of "chain" calls of boost:: functions. there way remove not necessary boost:: functions gprof output? i can use --no-time=symspec option, allows exclude 1 function, not whole namespace.

ruby on rails - How would I make a link that takes you to a random article on the site? -

it wikipedia's "random article" button. takes random webpage on site. <%= button_to "random article", article_path(random_article) %> #app/helpers/application_helper.rb class applicationhelper def random_article article.order("rand()").first.pluck(:id) end end with article: random record in activerecord

c# 4.0 - Seeding data will not work when schema changes with Code First when using migrations -

okay using entity framework 6.1 , attempting code first seeding. have drop intializer works. want use database migration have set , works. until normalize out table , try seed primary key error. basically in context when uncomment out changes in 'todo' section , schema changes primary key violation when attempting population of newly normalized out table. work initializer drop always, want migration data table , not drop database everytime make changes in case want rollback ever. have tried changing attribute of 'personid' identity , none , identity. caveat if set 'identity' work values keep incrementing higher values each time 1,2,3,4 5,6,7,8;etc. if set none works first time , when split in mapping , normalized blows up. have tried custom dbcc commands , not either, setting dbcc reseed 2 new tables not it. if has no idea seeding new table when being done explicitly. does know how seeding process model can handle if normalize out mapping of obj...

python - How do I get the largest 2d slice of a numpy array? -

i have 3d numpy array dimensions different. plot slice parallel largest 2 dimensions , midway through smallest. how slice? e.g. if original data np.ones(3*4*5).reshape(3,4,5) i dataset np.ones(3*4*5).reshape(3,4,5)[1,:,:] that halfway though first dimension smallest , of other 2 dimensions because larger. you use np.rollaxis such task , work multi-dimensional ndarray, - def ndim_largest_slice(arr): shp = arr.shape return np.rollaxis(arr, np.argmin(shp), 0)[shp[np.argmin(shp)]/2] sample runs - in [511]: arr = np.random.rand(6,7,6,3,4,5) in [512]: np.allclose(ndim_largest_slice(arr),arr[:,:,:,1,:,:]) out[512]: true in [513]: arr = np.random.rand(6,7,6,4,5,5) in [514]: np.allclose(ndim_largest_slice(arr),arr[:,:,:,2,:,:]) out[514]: true in [515]: arr = np.random.rand(3,4,5) in [516]: np.allclose(ndim_largest_slice(arr),arr[1,:,:]) out[516]: true

matlab - How can using the existing fields, the value of another field achieved? -

i have table follows: cl c2 c3 ..... r1 x 4 r2 y b 5 r3 z c 2 . . . r(1,2,3) label of rows , c(1,2,3) label of columns. have field of c1,c2 , want c3. example have y , b, want achieve '5'; read 'find , sub2ind' functions not know how can use them case. you can use simple logical indexing accomplish this. want third column when value of first column 'y' , value of second column 'b' t = table({'x'; 'y'; 'z'}, {'a'; 'b'; 'c'}, [4; 5; 2], 'variablenames', {'c1', 'c2', 'c3'}); value = t.c3(ismember(t.c1, 'y') & ismember(t.c2, 'b')) % 5

android 5.1 - onActivityResult returning nullpointerexception by taking photo from camera -

i error when take image using camera : java.lang.runtimeexception: failure delivering result resultinfo{who=null, request=1, result=-1, data=intent { act=inline-data (has extras) }} activity {ir.aflak.niaz/ir.aflak.niaz.newadd2}: java.lang.nullpointerexception: attempt invoke virtual method 'int android.graphics.bitmap.getwidth()' on null object reference @ android.app.activitythread.deliverresults(activitythread.java:3539) @ android.app.activitythread.handlesendresult(activitythread.java:3582) @ android.app.activitythread.access$1300(activitythread.java:144) @ android.app.activitythread$h.handlemessage(activitythread.java:1327) @ android.os.handler.dispatchmessage(handler...

c# - Automapper Nuget Package failed -

i tried install http://automapper.org/ resulted in error. install-package : 'automapper' has dependency defined 'microsoft.csharp'. @ line:1 char:1 + install-package automapper + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + categoryinfo : notspecified: (:) [install-package], invalidoperationexception + fullyqualifiederrorid : nugetcmdletunhandledexception,nuget.powershell.commands.installpackagecommand any ideas? check version of nuget package manager current , if version of .net framework using supported nuget package trying install

java - cursor won't change in edittext -

so have edittext, (two actually, both have same problem,) , added ontouchlistener. need know edittext i'm working method. problem is, before adding listener, if clicked somewhere in edittext, cursor update. cursor won't update @ all. edittext.setontouchlistener(new view.ontouchlistener() { @suppresswarnings("unusedassignment") @override public boolean ontouch(view v, motionevent event) { edittext et = (edittext) v; et.requestfocus(); return true; } }); in case, best return false in ontouch . because return value specifies whether or not listener consumes event. returning false should therefore allow widget respond touch event normal behaviour, in addition whatever else have specified.

html - Width of text box jQuery mobile -

Image
i have label , text box in jquery mobile , trying change width of text box. for reason after changing width, lets 60% still seeing rest of 40% transparent. i adding photo of in order more clear. this code: html: <div role="main" class="ui-content"> <form> <div class="ui-field-contain"> <label for="sales1">sales:</label> <input type="text" id="sales" value=""> </div> </form> </div> css: #sales { width: 60%; } how change width without seeing 40% of text box? when using jquery mobile forms, inputs enclosed onto div holds width 100%. change width of text field, rather need change value of parent, not input itself. can achieve jquery: $('#sales').parent().width($('#sales').parent().width() * .4); the above code setting width of parent div 40% ...

Rails - How to send parameters from form to def create in controller -

i have create function def create @project = current_user.projects.where(id: params[:id]).first_or_create(project_params) if @project.save flash[:success] = "project created!" redirect_to root_url else flash[:success] = "project not created!" redirect_to root_url end end what im trying data params:id can check if object exists. heres relevant form <%= bootstrap_form_for(@project) |f| %> <%= render 'shared/error_messages', object: f.object %> <div class="col-md-4"> <div class="field"> <%= f.text_field :project_title, :value=>params[:project_title] , label: "title"%> </div> <div class="col-md-4"> <div class="field project-save-button"> <%= f.submit "save entry", class: "btn-sm btn-danger" %> </div> <% end %> when hit submit button...

Android: How to write to the Android/data/app.path/files directory -

so want write data file in location users can access manually. goal provide easy-to-access crash log can sent, without folks having full logcat. the 1 location on internal storage filesystem i'm aware of can written app /storage/emulated/0/android/data/my.app.package/files . goal, however, have path platform-independent possible. i can /storage/emulated/0 part using environment.getexternalstoragedirectory() . it's android/data/my.app.package/files part i'm concerned about. want avoid hardcoded paths avoid differences between devices. so there utility method out there can me? i've tried context.getfilesdir() , gives me /data/user/0/my.app.package , isn't accessible user without root. getexternalfilesdir want use https://developer.android.com/reference/android/content/context.html#getexternalfilesdir(java.lang.string)

java - How to access a instanciated class from another function? -

i don't know how possibly call this. lets i'm trying call instantiated class method other 1 instantiated class. (might hard understand) in java this: public class myclass { exampleclass classiwanttoaccess; // line here important part. public myclass() { classiwanttoaccess = new exampleclass(); } public exampleclass getwanted() { return classiwanttoaccess; } } so tried in c++, doesn't work expected... #include "test.h" test test; void gen() { test = test::test("hello"); } int main() { // how can access class here? return 0; } i'm not sure you're trying achieve, if want separate declaration of class it's initialization can use pointers. because have that: test test; - invoke constructor of class test . avoid can use pointers , write that: test *test; - test pointer object. then can create (allocate) object in function. whole code that: #include "t...

Windows 10 IoT Cordova app -

i trying build , deploy cordova app on raspberry pi 2 running windows 10 iot core. visual studio set run on remote machine (it automatically located device, authenticated , everything). build seems , there isnt errors ( http://prntscr.com/8x9zl8 ). raspberry pi 2 shows splashscreen second , this: http://prnt.sc/8x9z0m . checked developer licence says activated. tried building windows-anycpu instead of windows-arm, still no luck. first time adding files, changing files http://prntscr.com/8x9zh7 (i guess okay) not able run it. when try add .appxrecipe manually raspberry via web interface shows following error ( http://prntscr.com/8xa08k ). cordova builds appxmanifest.xml, resources.pri file , .appxrecipe , since able select 1 file in web interface added appxrecipe. any appreciated since dont see many questions creating windows app iot core using cordova. edit: tried "cordova remove platform windows" , readding again doesnt work. project works on physcial android devi...

TensorFlow Android demo: unable to build with Bazel, could not read RELEASE.TXT -

recently i've been learning how use tensorflow, , wanted set android demos on computer see how worked. followed instructions provided here , differences being installed android sdk through android studio, , installed android ndk through sdk manager. until $ bazel build //tensorflow/examples/android:tensorflow_demo , worked fine, after that, got error terminal: error: no such package '@androidndk//': not read release.txt in android ndk: /home/me/.cache/bazel/_bazel_me/f3471be34d1e62bf21975aa777cedaa3/external/androidndk/ndk/release.txt (no such file or directory). error: no such package '@androidndk//': not read release.txt in android ndk: /home/me/.cache/bazel/_bazel_me/f3471be34d1e62bf21975aa777cedaa3/external/androidndk/ndk/release.txt (no such file or directory). from looking around @ similar issues, understanding error because release.txt file isn't included in recent version of android ndk. this issue suggested downgrading previous version of ndk c...

javascript - Aurelia's Component Not Being Replace By Its Template -

why dont aurelia's custom elements replace template, instead of being put inside it? example: i want this <sidebar-item label="dashboard" href="#" icon="icon-home4"></sidebar-item> to replaced this <li class="active"> <a href="index.html"> <i class="icon-home4"></i> <span>dashboard</span> </a> </li> but instead, result this: <sidebar-item label="dashboard" href="#" icon="icon-home4"> <li class="active"> <a href="index.html"><i class="icon-home4"></i> <span>dashboard</span></a> </li> </sidebar-item> is there way replace custom tag template? basically add @containerless view-model of sidebaritem . import {containerless} 'aurelia-framework'; @containerles...

android - PopupWindow Enter Exit Animation not working on Marshmallow (23) -

i have set enter/exit animation style popupwindow mpopupwindow.setanimationstyle(r.style.popupanimation); and style as <style name="popupanimation" parent="widget.appcompat.popupwindow"> <item name="android:windowenteranimation">@anim/popup_show</item> <item name="android:windowexitanimation">@anim/popup_hide</item> </style> so , when popupwindow show/hide has animations works fine lollipop , previous android versions. marshmallow popup shows after animation time interval , no animation effects. popup-show.xml <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:fromalpha="0.0" android:toalpha="1.0" android:interpolator="@android:anim/accelerate_interpolator" android:duration="1000"/> popup-hide.xml <set xmlns:android="http://schemas.android.com/apk/res/android"...

javascript - how to synchronize two div on scroll of first div horizontal? -

i have 2 divs, 1 header other body. width of both div different. want synchronize header on scroll of body horizontal. using script: <div class="table-header " > <div class="dep">dep #</div> <div class="_lname">last name</div> <div class="_fname">first name</div> </div> <div class="table-body"> <div class="dep">dep #</div> <div class="_lname">last name</div> <div class="_fname">first name</div> </div> $(".table-body", that.target).on("scroll", function(event){ settimeout(function(){ $("#headerdiv").scrollleft( $(".table-body").scrollleft()*1.27); },500); }); and css is .table-header { width: 798px !important; overflow : hidden; } .table-body { overflow-y: scroll; width: 632px !important; ...

winforms - Setting a Panel's background color from a class, Windows Forms - C# -

i have relating setting panels background color class. the class not within form of panel, side class. the panel on main form called pnlcanvas. i don't know missing. if have values or methods in main form, can access values class. but, panel seems acts different. public form1() { initializecomponent(); changecolor changecolor = new changecolor(this); changecolor.redpanel(); } class changecolor { public form1 form1 { get; set; } public changecolor(form1 form1) { this.form1 = form1; } public void redpanel() { form1.pnlcanvas.backcolor = color.red; } } try this: make member of form1 public void redpanel() { this.pnlcanvas.backcolor = color.red; }

shell - Variable assignment in Unix -

this question has answer here: command not found error in bash variable assignment 4 answers when try following statements, doesn't assign values variables , loop goes infinite- while ( [ $nos -ne 0 ] ) rem = `expr $nos % 10` sum = `expr $sum + $rem` nos = `expr $nos / 10` done but when remove spaces left , right side of assignment operator, works fine. - while ( [ $nos -ne 0 ] ) rem=`expr $nos % 10` sum=`expr $sum + $rem` nos=`expr $nos / 10` done why shell behaviour that? rem = `expr $nos % 10` runs command rem first argument = . if weren't posix sh standard requiring assignments parse single word (which does), 1 couldn't pass = first argument command or function; hence, standard being written is. there's further expressive power based on whitespace in assignments well. instance: rem= foo ...run...

javascript - How can I use a different color to fill the left side of the input[type="range"] in chrome using CSS? -

as can see below in ie slider working, can't find "ms-fill-lower" pseudo-code in chrome/firefox. haven't figured out how can print out number continously above thumb (i thinking creating new childnode in js , using position of slider + current value of thumb , info create new position brand new childnode. there easier way maybe?) <!doctype:html> <html> <head> <style> input { position: fixed; top: 40; right: 40; } input[type=range] { -webkit-appearance: none; margin: 30px 0px; width: 80%; } input[type=range]:focus { outline: none; } input[type=range]::-ms-thumb { box-shadow: 0px 0px 0px #ffccff, 0px 0px 0px #ffccff; height: 30px; width: 48px; background-image: url('https://scontent-vie1-1.xx.fbcdn.net/hphotos-xpa1/v/t34.0-12/12204684_1096899726988871_1886399559_n.jpg?oh=b8481694391b1a5ebe58...

ldap - ldapmodify raises attributetypes: value #0 invalid per syntax error -

i'm implementing pwdcheckmodule library openldap version 2.4.14 (version cannot changed). during i'd read attributes ldap database. 1 of these attributes called pcpminnumberlowerupper , holds minimum number of lower and/or upper characters. attribute should part of existing objectclass called pwdpolicy located under cn:schema has other attributes pwdmaxage etc. i'd use ldapmodify terminal command in order add attribute existing ldap database. command i'v used looks following: ldapmodify -h localhost -p 389 -d "cn=administrator,dc=<mydc>,dc=<mydc>..." -w "<mysecret>" -x -f pcp_attribute_upgrade.ldif the corresponding ldif-file has following content: dn: cn=schema changetype: modify add: attributetypes attributetypes: ( 1.3.6.1.4.1.42.2.27.8.1.18 name 'pcpminnumberlowerupper' desc 'minimum of upper or lower characters' syntax 1.3.6.1.4.1.1466.115.121.1.27 single-valued usage userapplications ) now, if ex...

python - Scala Import Function in Scope Multiple Times -

i learning scala , run problem using scala repl. playing immutable.map , mutable.map , welcome scala version 2.11.6 (java hotspot(tm) 64-bit server vm, java 1.8.0_60). scala> map res0: scala.collection.immutable.map.type = scala.collection.immutable.map$@2e32ccc5 scala> var mymap = map[int, string](1->"one", 2->"two", 3->"three") mymap: scala.collection.immutable.map[int,string] = map(1 -> one, 2 -> two, 3 -> three) scala> import scala.collection.mutable.map import scala.collection.mutable.map scala> var mymap1 = map[int, string](1->"one", 2->"two", 3->"three") mymap1: scala.collection.mutable.map[int,string] = map(2 -> two, 1 -> one, 3 -> three) scala> import scala.collection.immutable.map import scala.collection.immutable.map scala> var mymap2 = map[int, string](1->"one", 2->"two", 3->"three") ...

By using Android Sqlite Database (or a local database ) ,will other people be able to use my app on Google store? -

i working on notepad app. wondering if other people able use app on google store, if use sq lite database? assuming use official approach (using internal database tools of android), should work everyone, since database created on each device. if, however, working seperate database file, not contained within application source, couldn't access it, since wouldn't have copy of it.

C# use one textBox for multiple items -

i making huge save editor game. have listbox loads names of weapons have in game. whenever click on 1 of weapons in listbox, textbox shows how ammo/quantity there current item. example: listbox1 selectedindex 0 shows ak47 , selectedindex 1 shows cbw. when select weapon ammo value goes textbox1. if click on ak47 , change ammo, move onto cbw , ak47, ammo resets was. what cant seem figure out how commit changes in process being edited until ready final save sounds missing commit / save section of editor? first of all, suggest create copy of file edit) , open readable in editor. - after maintaining first change, write text original file (open file writeable!), recretae copy of file , re-read again (readable) , on , on. on safe side can create 2 copies. idea behind have 1 instance of file readable , able dave changes writable second instance. afterwards readable instance has reread. might bit confusing, afterall not more confusing question. ;-)

java - Get the child id when persisting an entity with cascade -

i'm using hibernate entity manager (4.2.16). i'm having trouble when merging existing entity, after adding new child it. id of newly created child, id not set. here model: @entity @table(name = "parent") @genericgenerator(name = "gen_identifier", strategy = "sequence", parameters = { @parameter(name = "sequence", value = "sq_parent") }) public class parent { @id @generatedvalue(strategy = generationtype.sequence, generator = "gen_identifier") private long id; @onetomany(cascade = cascadetype.all, orphanremoval = true, mappedby = "parent") private set<child> children; } @entity @table(name = "child") @genericgenerator(name = "gen_identifier", strategy = "sequence", parameters = { @parameter(name = "sequence", value = "sq_child") }) public class child { @id @generatedvalue(strategy = generationtype.sequence, ge...

python - Splitting Dataframe based on corresponding numpy array values -

i have pandas dataframe looks : 2007-12-31 50230.62 2008-01-02 48646.84 2008-01-03 48748.04 2008-01-04 46992.22 2008-01-07 46491.28 2008-01-08 45347.72 2008-01-09 45681.68 2008-01-10 46430.5 where date column index. have numpy array b of same length has element -1, 0 , 1. cleanest way split dataframe 3 dataframes such rows equal corresponding b elements grouped together. eg. if b = numpy.array([0, 0, 0, 1, 1, -1, -1, 0]) dataframe should split : x 2007-12-31 50230.62 2008-01-02 48646.84 2008-01-03 48748.04 2008-01-10 46430.5 y 2008-01-04 46992.22 2008-01-07 46491.28 z 2008-01-08 45347.72 2008-01-09 45681.68 it's easy utilize groupby pandas, have option keep them grouped you're not doubling data. can assign then import numpy np import pandas pd import io data = """ 2007-12-31 50230.62 2008-01-02 48646.84 ...

java - Drools not matching nested object obtained from deserialization -

i'm trying create rule in drools trigger based on hypothetical student getting straight as. import student import semester import java.util.* dialect "mvel" rule "straight as1" when $s : student( grades != null, $g : grades ) forall( semester(reading == "a", writing == "a", math == "a") $g ) system.out.println($s.getid() + ": s as1: " + $s); system.out.println($s.getid() + ": g as1: " + $g); end rule "straight as2" when $s : student( grades != null, $g : grades ) $a : list(size() == $g.size) collect (semester(reading == "a", writing == "a", math == "a") $g) system.out.println($s.getid() + ": s as2: " + $s); system.out.println($s.getid() + ": g as2: " + $g); end the outpu...

visual studio - What is the opposite to this encryption+compression code in C#? -

i have written code encrypts , compresses data, have hard time writing code in reverse. i various errors no matter how assemble code. my question basic: in order should different bits of code used? here sample code encrypting , compressing: memorystream ms = new memorystream(); cryptostream crypts = new cryptostream(ms, des.createencryptor(), cryptostreammode.write)); deflatestream defs = new deflatestream(crypts, compressionmode.compress) binarywriter bw = new binarywriter(defs)) //bw.write("write string example"); bw.close(); now, in decryption routine, should cryptostream used after deflatestream trace encryption routine backwards? or should deflatestream used after cryptostream ? like following example: memorystream ms = new memorystream(); deflatestream defs = new deflatestream(ms, compressionmode.compress) cryptostream crypts = new cryptostream(defs, des.createencryptor(), cryptostreammode.write)); binarywriter bw = new binarywriter(crypts)) //...

ionic framework - npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 -

$ npm update minimatch@3.0.2 $ npm update -d npm info worked if ends ok npm info using npm@2.11.3 npm info using node@v0.12.7 npm info attempt registry request try #1 @ 5:33:55 pm npm http request https://registry.npmjs.org/jshint npm http 200 https://registry.npmjs.org/jshint npm info ok $ npm install jshint npm warn deprecated minimatch@2.0.10: please update minimatch 3.0.2 or higher avoid regexp dos issue npm warn deprecated minimatch@0.3.0: please update minimatch 3.0.2 or higher avoid regexp dos issue jshint@2.9.2 node_modules\jshint ├── strip-json-comments@1.0.4 ├── exit@0.1.2 ├── shelljs@0.3.0 ├── console-browserify@1.1.0 (date-now@0.1.4) ├── lodash@3.7.0 ├── minimatch@2.0.10 (brace-expansion@1.1.5) ├── htmlparser2@3.8.3 (domelementtype@1.3.0, entities...

javascript - Viewing deeper properties from JSON -

ok have code verify people born between 1900 , 1925. great, when console.log it, returns 3 objects properties , prototype. there way can console 1 specific property? example dont want display 3 objects want show name of people born between 1900-1925. thanks! var ancestry_file = "[\n " + [ '{"name": "carolus haverbeke", "sex": "m", "born": 1832, "died": 1905, "father": "carel haverbeke", "mother": "maria van brussel"}', '{"name": "emma de milliano", "sex": "f", "born": 1876, "died": 1956, "father": "petrus de milliano", "mother": "sophia van damme"}', '{"name": "maria de rycke", "sex": "f", "born": 1683, "died": 1724, "father": "frederik de rycke", "mother": ...

html - Value of list populated with javascript -

how populate select list values got javascript? i sending request .php site gives me respond in json format. want put lines got select list. <select id = "list" name=log size=50 style=width:1028px> <script type="text/javascript"> window.onload = function () { var bytes=0; var url = "/test/log.php?q='0'"; function httpget(url) { var xhttp = new xmlhttprequest(); var realurl = url + bytes; xhttp.open("get", url, true); xhttp.onload = function (e) { if (xhttp.readystate === 4) { if (xhttp.status === 200) { console.log(xhttp.responsetext); var response=json.parse(xhttp.responsetext); var log = response.key; bytes = log.length; } }; xhttp.onerror = function (e) { console.error(xhttp.statustext); } }; xhttp.send(); } var updateinterval = 2000; function update() ...

android - Appcompat 23.2.1 drawer layout with navigation view covered by status bar -

Image
i switched normal light dark appcompat themes daynight , status bar color being drawn on window. changed break configuration? styles.xml <style name="appthemedaynight" parent="theme.appcompat.daynight.noactionbar"> <!-- customize theme here. --> <item name="colorprimary">@color/primary</item> <item name="colorprimarydark">@color/primary_dark</item> <item name="coloraccent">@color/accent</item> <item name="preferencetheme">@style/preferencethemeoverlay</item> <item name="statusviewstyle">@style/statusviewstyle</item> </style> <style name="appthemedaynight.noactionbar"> <item name="windowactionbar">false</item> <item name="windownotitle">true</item> </style> <style name="apptheme.appbaroverlay" parent="themeoverlay.app...