Posts

Showing posts from March, 2010

android - How to make a script run automatically whenever i boot up the kernel -

i want create , run shell script each time boot kernel along android on mobile a script can't run when boot kernel because interpreter (your shell) isn't ready @ point. @ best can run script when kernel done loading, , quite hackey within kernel. best use init.rc purpose, designed for

sql server - Restrict Full access to certain User of Database - Database Administrators Stack Exchange

the scenario following: given sql server instance created , handled not me creation of database , user on given instance me question: to limited understanding, sa login have full access database. there way can create user user/login have full access database, despite fact don't own instance? if trying prevent owner of instance or windows or sql server administrators being able access database, the answer no . essentially should assume administrator on box owns , can gain access on box, including database. you may able protect actual data in cases (check out always encrypted in sql server 2016 , example), that's it. administrator can access don't encrypt (and of stuff in current versions), drop database, lock out, etc. if don't trust service provider that's hosting database, should host elsewhere. after all, host worth salt should have agreements in place legally protect you, though not physically, internal data breach.

python - Why is a tuple of tuples of length 1 not actually a tuple unless I add a comma? -

given tuple of tuples t : (('a', 'b')) and individual tuple t1 : ('a','b') why does: t1 in t return false? update: ipython: in [22]: t = (('a','b')) in [23]: t1 = ('a','b') in [24]: t1 in t out[24]: false and how check tuple in tuple? the problem because t not tuple of tuples, tuple. comma makes tuple, not parentheses. should be: >>> t = (('a','b'),) >>> t1 = ('a', 'b') >>> t1 in t true in fact, can loose outer parentheses: >>> t = ('a','b'), >>> t1 = 'a','b' >>> type(t) <type 'tuple'> >>> type(t[0]) <type 'tuple'> >>> type(t1) <type 'tuple'> >>> t1 in t true although needed precedence, if in doubt put them in. remember, comma makes tuple.

How to split a string in java by using following String? -

this question has answer here: how split string in java 29 answers how split following string how split following string "llslotbook17-07-2015@friday@1@10.00am-12.00pm@10@lmv,mcwg" ',' , '@' you can use string.split(regexp) function : string[] array = "llslotbook17-07-2015@friday@1@10.00am-12.00pm@10@lmv,mcwg".split(",|@");

java - How to define Kmeans cluster of the new data -

im trying cluster data , wanna learn accurancy of on weka.i mean lets say, cluster our training data n groups have new test data learn clusters. how can it? checked samples of them test in training data. use filteredclusterer , , choose kmeans in configuration dialog of filteredclusterer. here text "more" button shows documentation clusterer: name weka.clusterers.filteredclusterer synopsis class running arbitrary clusterer on data has been passed through arbitrary filter. like clusterer, structure of filter based exclusively on training data , test instances processed filter without changing structure.

fiware - Error at defining a specific field in a Hive Query -

i have orion context broker connected cosmos cygnus. it works ok, mean send new elements context broker , cygnus send them cosmos , save them in files. the problem have when try searchs. i start hive, , see there tables created related files cosmos have created, launch querys. the simple 1 works fine: select * table_name; hive doesn't launch mapreduce jobs. but when want filter, join, count, or fields. happens: total mapreduce jobs = 1 launching job 1 out of 1 number of reduce tasks determined @ compile time: 1 in order change average load reducer (in bytes): set hive.exec.reducers.bytes.per.reducer=<number> in order limit maximum number of reducers: set hive.exec.reducers.max=<number> in order set constant number of reducers: set mapred.reduce.tasks=<number> starting job = job_name, tracking url = job_details_url kill command = /usr/lib/hadoop-0.20/bin/hadoop job -kill job_name hadoop job information stage-1: number of mappers: 1; numbe...

ruby - Is overriding a module's method a good convention? -

i've got kind of template patterned module few method defined (default behaviour) , method below: def tax 1.2 end def do_something! raise "please implement in class" end i've read in cases should use modules on inheritance because of inheritance capabilities (single inheritance) , when don't need super() @ all. but feel bit guilty override raise "..." methods , default (like tax method), because module. what think? when need override methods should rather use inheritance or including modules? the rule follow is: when method has defined in class including module (e.g. module acts interface) do: def method_that_needs_to_be_defined raise nomethoderror end it's practice, prevents unexpected calls yet undefined method. example: module speaker def speak raise nomethoderror end end class bird < animal include speaker def speak 'chirp' end end

angularjs - Can not get selected value of dropdown in UI tree in angular -

html: <select data-ng-model="completionpercentage" class="pull-right" style="margin-right:20px" data-ng-options="c.percentage c in taskcompletionpercentage" ng-change="percentagecompleted()"> <option value="">0%</option> </select>` javascrpt: $scope.percentagecompleted = function () { alert($scope.completionpercentage); }

How can I remove default headers that curl sends -

curl default adds headers such content-type , user-agent. thing i'm trying test our server when headers missing. problem content-type header. if missing, server correctly assumes user sent json. however, curl adds missing header , incorrectly assumes content posting application/x-www-form-urlencoded. sends accept header of / . suppose nice default behavior not send headers did not specify. there option that? curl -v -x post 'https://domain.com' -d '{...}' > user-agent: curl/7.37.1 > host: domain.com > accept: */* > content-length: 299 > content-type: application/x-www-form-urlencoded use -h flag header want remove , no content after : -h, --header line custom header pass server (h) sample -h 'user-agent:' this make request without user-agent header (instead of sending empty value)

create exe with admin rights with InstallShield in Visual Studio 2012 -

i create setup install application developed in vs 2012. application needs installed in program files folder, needs run administrator rights. have created new installshield project inside solution, don't know if possible set settings allow exe runs administrator. i'm using installshield 2013 limited edition you can manifest exe indicate windows exe requires administrative privs. can't bypass windows security.

regex - strsplit by parentheses -

this question has answer here: regular expression string between parentheses in javascript 5 answers suppose have string "a b c (123-456-789)", i'm wondering what's best way retrieve "123-456-789" it. strsplit("a b c (123-456-789)", "\\(") [[1]] [1] "a b c" "123-456-789)" if want extract digits - between braces, 1 option str_extract . if there multiple patterns within string, use str_extract_all library(stringr) str_extract(str1, '(?<=\\()[0-9-]+(?=\\))') #[1] "123-456-789" str_extract_all(str2, '(?<=\\()[0-9-]+(?=\\))') in above codes, using regex lookarounds extract numbers , - . positive lookbehind (?<=\\()[0-9-]+ matches numbers along - ( [0-9-]+ ) in (123-456-789 , not in 123-456-789 . lookahead ('[0-9-]+(?=\)') matches numbers...

php - ftp_ssl_connect not taking User and pass -

i have function talks ftp server apache webserver. $conn_id = ftp_ssl_connect($ftp_server) or die("could not connect $ftp_server"); // login username , password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); getting warning while compiling below. php warning: ftp_login(): please login user , pass. the same function running if change function call ftp_ssl_connect ftp_connect i have openssl enabled.

CSS makes div unequal in firefox and chrome -

i've made 2 divs navigation given css: first button: .optionsbutton .dropdownbuttonoverlay { margin: 0px -95px 0px 0px; width: 92px; height: 38.5px; float: right; z-index: 2; } .tenpxleft { margin-left: 10px; } .floatright { float: right; } .regularbutton { background-color: #008be1; border: none; } .optionsbutton { border-radius: 3px; -webkit-appearance: none; } and second button this: .defaultbutton { font-family: 'open sans', segoe ui, verdana, helvetica, sans-serif; border-radius: 3px; font-size: 14px; color: #ffffff; padding: 10px 15px; -webkit-appearance: none; margin: 0; /* fixes chrome bug */ } .tenpxleft { margin-left: 10px; } .floatright { float: right; } .regularbutton { background-color: #008be1; border: none; } the problem dealing fine on chrome , ie (alligned nicely). when go firefox don't alligned intended (i putting them in div top men...

eclipse - Raspberry PI 2 - How to get file-access for c-program to write on disc -

i using raspbian on rpi2 , tried create/change sqlite database c-program. here little bit code: static sqlite3 *db; static char *zerrmsg = 0; //.... sqlite3_open(path_database, &db); char *sql_statement = "create table if not exists mytable (datetime bigint, myval bigint)"; sqlite3_exec(db,sql_statement, null, null, &zerrmsg); sqlite3_close(db); as ide use eclipse cdt. in eclipse debug-mode , executing program double click (in "sudo startx" mode), raspbian creates me database file. if start program via terminal (sudo /home/pi/test/myprogram) no database-file created. folder "test" , executable "myprogram" have both chmod 755 access. searched lot, found nothing helps me. each 1 of sqlite3 functions returns error code. after every call, check error code sqlite_ok . if isn't, function failed, , need handle error. you can call sqlite3_errstr convert error code string. for more information error handling...

owasp - ESAPI Doc and tutorial -

i'm interested in esapi use in production environment. there official, unofficial documentation on how setup web application ? esapi has intentions, referenced de facto in owasp top 10 issues. however main development not active. library provided as is . there 2 java libraries depending on versions: owasp enterprise security api java : version >= 3.x maintained 1 contributor (chris schmidt), last code commit (as of today) on nov 20, 2013. enterprise security api java (legacy) : version <= 2.x maintained @ least 3 contributors, last code commit (as of today) on may 30, 2015. there wish have documentation ( https://www.owasp.org/index.php/esapi_documentation ), especially: how use esapi in new application . but currently, light... as of march 2014 project downgraded away flagship status ( http://off-the-wall-security.blogspot.fr/2014/03/esapi-no-longer-owasp-flagship-project.html ). (credits avgvstvs) if still want learn esapi, best can hav...

ruby on rails - Add extra result to Association Collection Proxy result -

i have 2 models, class user < activerecord::base has_many :posts end class post < activerecord::base belongs_to: user end i'm using formtastic gem , consider in edit action of users_controller . required user , associated posts attributes of form prefilled formtastic form code: <%= semantic_form_for @user |f| %> <%= f.input :name %> <%= f.inputs :posts |p| %> <%= p.input :title %> <%= p.input :comment %> <% end %> <% end %> for instance i'm having @user , 2 posts associated. while doing @user.posts , result like. [ [0] #<post:0x0000000aa53a20> { :id => 3, :title => 'hello world', :comment => 'long text comes here' }, [1] #<post:0x0000000aa53a41> { :id => 5, :title => 'hello world 2', :comment => 'l...

matrix - R Function %*% Explanation -

i have small data frame looks below - name,standrewslodge,loyalnine,northcaucus,longroomclub,teaparty,bostoncommittee,londonenemies adams.john,0,0,1,1,0,0,0 adams.samuel,0,0,1,1,0,1,1 allen.dr,0,0,1,0,0,0,0 appleton.nathaniel,0,0,1,0,0,1,0 data <- as.matrix(read.csv("data.csv",row.names=1)) data.t = t(data) once imported r data set, can transpose using t() function. post create new data set using data.ts = data %*% t(data) i trying understand %*% function does. numbers come out make no sense. if has used can pls explain. thanks, it's matrix multiplication, see help("%*%") . multiplies 2 matrices, if conformable. if 1 argument vector, promoted either row or column matrix make 2 arguments conformable. if both vectors of same length, return inner product (as matrix).

angularjs - Sending data from form to POST request in Angular -

i want make post request using angular. using ng-submit submit form controller access factory make request using: $http.post('/droplets', data) i need data form fields put in "data" variable above send api can't work out how when more 1 field. how done? try this... $http({ url: '/droplets', method: "post", data: json.stringify({application:app, from:data1, to:data2}), headers: {'content-type': 'application/json'} }).success(function (data, status, headers, config) { // callback called asynchronously // when response available }).error(function (data, status, headers, config) { // called asynchronously if error occurs // or server returns response error status. }); }; ref: https://docs.angularjs.org/api/ng/service/ $http

MDX calculated member total -

i'm using calculated member "previous period" as: case // test current coordinate being on (all) member. when [<<target dimension>>].[<<target hierarchy>>].currentmember.level [<<target dimension>>].[<<target hierarchy>>].[(all)] "na" else ( parallelperiod ( [<<target dimension>>].[<<target hierarchy>>].[<<target level>>], <<number of periods>>, [<<target dimension>>].[<<target hierarchy>>].currentmember ), [measures].[<<target measure>>] ) end // expression evaluates difference between value of numeric // expression in previous period , of current period. (snippet code taken directly microsoft suggestion) it works expected when presenting totals whole year total, if months selected on rows. so, if select year 2015, months jan jun, 6 correct values ...

how to add another table in existing realm android -

i have database few tables. need add table existing database, don't find ways in migration class. table persontable = realm.gettable(person.class); table pettable = realm.gettable(pet.class); pettable.addcolumn(columntype.string, "name"); pettable.addcolumn(columntype.string, "type"); long petsindex = persontable.addcolumnlink(columntype.link_list, "pets", pettable); long fullnameindex = getindexforproperty(persontable, "fullname"); (int = 0; < persontable.size(); i++) { if (persontable.getstring(fullnameindex, i).equals("jp mcdonald")) { persontable.getuncheckedrow(i).getlinklist(petsindex).add(pettable.add("jimbo", "dog")); } } version++; } the example gave above has that table pettable = realm.gettable(pet.class); pettable.addcolumn(columntype.string, "name"); pettabl...

java - write one's own little ftp server -

i'd code ftp server in java, practice. need have client send ftp commands , "parse" commands on server , translate them file system access, right? don't want fancy, implement basic commands. so when client sends "cd directoryname" check substrings before , after space , list of files specified directory. along lines, right? i looked bit @ source code here: http://svn.apache.org/viewvc/mina/asyncweb/trunk/server/src/main/java/org/apache/asyncweb/server/ couldn’t find any< code reads in ftp commands... am going in right direction or off?

java - Hive GenericUDF return array<String> Error -

im new genericudf. i'm try generate function create telephone numbers use of array<strings> . but have error: caused by: java.lang.classcastexception: org.apache.hadoop.hive.serde2.lazy.lazystring cannot cast java.lang.string in line: string inumber = (string) listoi.getlistelement(args[1].get(), i); could me, please? thanks. this code: @description(name = "create_numbers", value = "_funct_(prefix, array(number1, number2, ...)); first argument prefix(string) , second argument array of strings." + "return list of phone numbers. " + "example: prefix = +49 , arraynumbers = array[1234, 2346, 1356] - result: array[+491234, +492346, +491356].") public class udfgenericlistnumbers extends genericudf { listobjectinspector listoi; stringobjectinspector elemoi; public object evaluate(deferredobject[] args) throws hiveexception { // must have 2 arguments if(args==null || args.length...

javascript - No connecting lines are getting displayed -

Image
i using connector framework called js-graph-it connect elements on web page. when running html file demonstration of working of project works fine when including project, connecting lines missing. here code <!doctype html> <html> <head> <script type="text/javascript" src="js-graph-it.js"></script> <link rel="stylesheet" type="text/css" href="js-graph-it.css"> <style> .canvas { font-family: tahoma; } .block { position: absolute; border: 1px solid #7dab76; background-color: #baffb0; padding: 3px; } /*.connector { background-color: #ff9900; }*/ .source-label, .middle-label, .destination-label { padding: 5px; } </style> </head> <body onload="initpageobjects();"> <div class="canvas" style="width: 1350px...

netweaver - Map complex data access business logic with oData -

i have table in db , want show/edit data odata. don't want expose rows entityset because business logic add information each field of each row: example. have in db table 3 rows: k c1 c2 c3 c4 ---------------------- 01 b d e 02 f g h 03 l m n o 04 p q r s usera can: full control(create-read-update-delete) on each field (not modify-edit key can delete rows) userb can: edit 2nd row userc can: edit m, n , r how can send complexity using odata? how can recognize user logged ? (a sessionid string in header of http odata entityset?) in metadata can expose different type of interaction data? if want specify precise crud information (userb) how can pass informaions? (using complex type?) these questions. odata, particularly full-descriptive concept of metadata, seems not marry complexity of data access.

php - cant acess video adzone (revive adserver) -

i want show video on jw player using revive adserver, when click video zone shows me 404 error, im sure folder , files exists , has right path, can me? searched , tried 5 hours, asked on revive adserver's forum nobody answered too. the error happened due file permissions not correct. actually revive adserver not generate video invocation tag, have generate own. in jw player site provided document how generate tag that.

python - How to automatically close connection serverside after a certain time in Tornado Websocket -

i have tornado websocket server has dictionary of open connections: class websockethandler(tornado.websocket.websockethandler): def open(self, *args): self.id = self.generate_id() self.stream.set_nodelay(true) # ... stuff ... clients[self.id] = {"id": self.id, "time":datetime.now(), "object": self} self.write_message("connection successful! connecting! connection id is: %d :)" % self.id) print datetime.now() print "new connection. id: %d" % self.id print "total number of open connections: %d" % len(clients) def on_close(self): print datetime.now() print "closing connection %d." % self.id if self.id in clients: del clients[self.id] print "number of open connections: %d" % len(clients) i automatically close connections more 1 hour old. this: for client in clients.values(): if (...

javascript - .attr 'alt' displaying only the first word -

i stuck on small issue, i'm trying print image titles getting them alt tag. not working because showing first word alt. $("#gallerythumbs .imagethumb").click(function () { if ($(this).hasclass('active')) { //do nothing } else { var newimage = $(this).attr('picurl'); $('#galleryimagelarge').attr('src', newimage); $("#gallerythumbs .imagethumb").removeclass('active'); $(this).addclass('active'); var newtitle = $(this).attr('alt'); $('#gallerytitle').text(newtitle); } }); the html code: <div class="col-md-6 verticalcenter work" id="largegalleryimage"> <img src="<?php echo $galleryimages[0]['sizes']['large']; ?>" alt="<?php echo $galleryimages[0]['title']; ?>" class="img-responsive" id="galleryimagelarge...

python - Unpredictable poisson noise -

Image
i'm in process of comparing 2 sets of values apply poisson noise. below code , corresponding result: import numpy np import pylab size = 14000 # 1) creating first array np.random.seed(1) sample = np.zeros((size),dtype="int")+1000 # applying poisson noise random_sample1 = np.random.poisson(sample) # 2) creating second array (with changed values) # update of value 2000... x in range(size): if not(x%220): sample[x]=2000 # reset seed same first array # poisson shall rely on same random. np.random.seed(1) # applying poisson noise random_sample2 = np.random.poisson(sample) # display diff result pylab.plot(random_sample2-random_sample1) pylab.show() my question is: why have strange values around [10335-12542] expect perfect zero? i search info in poisson() documentation without success. i (only) test , reproduce problem in python version 1.7.6 , 1.7.9 (it may appear on others). numpy version tested: 1.6.2 , 1.9.2 more details if print related values: ...

vb.net - .NET 2012 Connect to Firebird Database -

i having trouble connecting firebird database using vb.net 2012. downloaded firebird entity framework provider through nuget package manager. i checked , following references have been added project: entityframework, entityframework.firebird, entityframework.sqlserver , firebirdsql.data.firebirdclient. when run program, output windows displays following: a first chance exception of type 'system.net.sockets.socketexception' occurred in system.dll first chance exception of type 'firebirdsql.data.common.iscexception' occurred in firebirdsql.data.firebirdclient.dll first chance exception of type 'firebirdsql.data.firebirdclient.fbexception' occurred in firebirdsql.data.firebirdclient.dll first chance exception of type 'firebirdsql.data.firebirdclient.fbexception' occurred in firebirdsql.data.firebirdclient.dll i don't errors displayed in application, nothing happens here code: imports firebirdsql.data.firebirdclient imports system.text...

ASP.NET MVC cookie duplicate -

when add cookie in response, request getting 2 duplicate cookies. here code: httpcookie cookie = request.cookies[constants.cart_cookie_key]; // 1 "cart" coookie received client browser. if (cookie != null) { request.cookies.remove(constants.cart_cookie_key); //remove it. there no cookie in request cookie.expires = datetime.now.addyears(2); cookie.value = "test"; //response empty until response.cookies.set(cookie); // add response, there 2 "cart" cookies in request. wtf? } it's important me have harmonized values, because still have use value request in remaining process. when add modified value response, request getting horrible mess. you removing cookie request , adding new 1 response knows in state of request... may suggest use owinmiddleware modifying response cookies since you're using compatible stack anyway? it's pretty easy plug correct phase of request. publi...

magento - Me2pro synchronisation -

i have started using me2pro synchronise amazon orders magento. oreders arrive ok in magento. have marked shipped , still showing on amazon unshipped. how long should wait synchronise tell amazon has been shipped? for synchronization, cron must run extension. so please whether check working or not. when cron runs, automatically update in amazon

php - Json_decode throws a null array when string contain "&" sign -

i have problem json_decode() when passed string contain "&". when mobile app send request post containing type of utf encoded string: [ { "mobile": [ "123456" ], "full_name": [ "bride&groom" ] } json_decode() null array. happens when send request through mobile end. specific scenario? using laravel 5. request taken $frienddetails = $request->friend pass variable through json_decode $decodedfriend = json_decode($frienddetails ,true); as headers using oauth , header values this. authorization bearer <token> content type application form data thanks in advance i tried json_decode function , string gave example decoded to: object(stdclass)#1 (2) { ["mobile"]=> array(1) { [0]=> string(6) "123456" } ["full_name"]=> array(1) { [0]=> string(11) "bride&groom" } } consider adding...

reporting services - Attempted to divide by zero in SSRS Chart -

this pie chart report. have searched still cannot resolve issue message: warning 1 [rsruntimeerrorinexpression] visible expression chart contains error: attempted divide 0 the single field summation in pie chart checked against 0 (isnull(val,0)) in sql , therefore referenced in "value field" of pie chart "sum(val)" . (isnull(val,0)) set null value 0. haven't seen expression that's causing error, if you're using value divisor, may causing error. again, don't know expression is, might able avoid error (if divisor 0, won't try dividing it): iif(divisor > 0, dividend / divisor, 0)

php - Execute multiple queries from file fast -

this question has answer here: running mysql *.sql files in php 10 answers i have file queries. that: drop table if exists #__assets; create table if not exists `#__assets` ( `id` int(10) unsigned not null auto_increment comment 'primary key', `parent_id` int(11) not null default '0' comment 'nested set parent.', `lft` int(11) not null default '0' comment 'nested set lft.', `rgt` int(11) not null default '0' comment 'nested set rgt.', `level` int(10) unsigned not null comment 'the cached level in nested tree.', `name` varchar(50) not null comment 'the unique name asset.\n', `title` varchar(100) not null comment 'the descriptive title asset.', `rules` varchar(5120) not null comment 'json encoded access control.', primary key (`id`), unique key `idx_asset_name` (`name`), key `id...

How to get a group type using Google Apps APIs? -

i'm developing google apps script modifies settings of groups of domain, settings applied depend on group type (i.e. email list or collaborative inbox, mostly). however, i've not found way determine group type using google apis (i'm using "groups settings api" , "directory api: groups" ). does know how group type using google apis, or other programmatic way ? these group 'types' aren't types - because of this, there's nothing in groups settings api set or type. essentially, when change between them, google groups changing bunch of presets. way tell difference create different test groups each 'type', settings each groups settings api , use difference in settings between them how determine 'type' of group. hope helps!

Emacs cursor jumps before period on Proof General -

i encounter problem when running proof general. i'm assuming random minor mode started proof general, can't figure out one! include list of minor modes bellow, in case can recognise name. if place period in emacs, cursor jump before it, so: writing something| writing something.| writing something|. where | represents cursor , last 2 lined happen 1 after other. the same happens if click @ end of line period. cursor appear after period , jump before period. some sentence. (click here) some sentence. | some sentence|. where last 2 lined happen 1 after other. here list of minor modes, in case can spot name: aquamacs-autoface auto-composition auto-compression auto-encryption blink-cursor column-number cua delete-selection electric-indent file-name-shadow font-lock global-font-lock holes line-number menu-bar mouse-wheel osx-key recentf savehist show-paren smart-frame-positioning tabbar tabbar-mwheel tool-bar tooltip transient-mark ...

javascript - Moving items around in a queue - Code Review Stack Exchange

what i'm trying achieve here sort queue of .item-dragable between different lists. users can click on right , left arrows , items move in queue respectively, previous or next item gets placed in place of item moved. there placeholder element should not counted valid sortable, there checks ignore it. if item in last list , moved right, moves first list. if in first list , gets moved left moves last list (last item in last list, first item in first list). the first thing came mind switch statements, can't figure out way implement them in case, each check unique. please provide alternative or let me know if there other better way using many if / else statements in case? there more bits code find correct adjacent lists, re initiate stuff etc., adding these in make question lengthy. if ( (item.is(':last-child') || item.next().hasclass('item-dragable-placeholder') ) && direction == "right") { var itemlistadjtmp = itemlistadj.find...

android - WifiManager.is5GHzBandSupported() lying? -

i using new method is5ghzbandsupported() available in wifimanager since api level 21. http://developer.android.com/reference/android/net/wifi/wifimanager.html#is5ghzbandsupported%28%29 on nexus 5 working fine (returning yes expected), on samsung galaxy s4 advance (gt-i9506) running official android rom in version 5.0.1, returning false, apparently incorrect, since device support 5ghz... same thing nexus 7 2013, returning no, false has seen behaviour on other models, rom issue specific these model, or misunderstanding of behaviour of method? use below code snip detect whether device support 5ghz band or not. wifimanager wifimanager= (wifimanager)mcontext.getapplicationcontext().getsystemservice(wifi_service); class cls = class.forname("android.net.wifi.wifimanager"); method method = cls.getmethod("isdualbandsupported"); object invoke = method.invoke(wifimanager); boolean is5ghzsupported=(boolean)invoke;

c# - WPF HandleListBoxClickEvent works only on the empty space of the list -

why handlelistboxclickevent works on empty space of list? problem when want refresh list. while clicking on item - nothing updating. clicking on empty space of list (when item selected) - selected item updating. i think, problem should in xaml, because following ready (working) example c# code. resources: <usercontrol.resources> <style x:key="redglowitemcontainer" targettype="{x:type listboxitem}"> <setter property="control.template"> <setter.value> <controltemplate targettype="{x:type listboxitem}"> <border name="iconborder" background="#00ffffff"> <contentpresenter /> </border> <controltemplate.triggers> <trigger property="listboxitem.isselected" value="true"> ...

xslt - Can you add a DTD schema to an biztalk created XML if you don't have the DTD? -

Image
we need create xml shipping software company deal with. basically, output xml needs contain below doctype <!doctype interface_create_shipment system "interface_create_shipment.dtd"> but don't have file, adding mappings doctype system causes error don't know if work. possible let biztalk add doctype without dtd being avaible on side? or make new dtd same name able create file? you have set own custom xml declaration @ design time in pipeline component in "add processing instructions text" field should put <?xml version="1.0" standalone="no" ?><!doctype interface_create_shipment system "interface_create_shipment.dtd"> don't forget set add xml declaration false more details available here http://cherifmahieddine.com/2013/09/23/custom-biztalk-xml-declaration/

c# - Copy Dictionary<String, String> to clipboard for Excel -

i trying write tool compare 2 string tables , find values in 1 not other. have got app getting these values correctly , store them in dictionary<string, string> , use display on gridview in xaml. i found out have manually add copy code gridview thought have button copy entire contents of dictionary, having problem when try copy excel produces 1 column of values , need key 1 column , value another. here copy code far: if (totranslate.count != 0) { var sb = new stringbuilder(); foreach (var item in totranslate) { sb.append(item.key + ", "); sb.appendline(item.value); } system.windows.clipboard.setdata(dataformats.text, sb.tostring()); } i have tried lots of other things such item.string puts them in square brackets , still doesn't work. have tried trimming square brackets still doesn't work. i have thought have picked comma seperator ...

dynamic programming - Can 01Knapsack algorithm with solution printed using O(n) space? -

with dynamic programming, 01 knapsack can solved using formula: f(v) = max(f(v), f(v-cost(i)+w(i)) v reverse enumeration. but if want record item put knapsack, need 2 dimensional array record item index. i'm not sure can 01knapsack use o(n) space solution of items put in knapsack? it true solution dp n states can reconstructed @ o(n) additional memory. way create additional array of same size states array , store move did each states. in case of particular problem, have record if f(v) or f(v-cost(i)+w(i)) optimal.

operating system - spin until lock is acquired -

this question has answer here: why spinlocks don't work in uniprocessor (unicore) systems? 5 answers i reading material on test , set instructions wiki( https://en.wikipedia.org/wiki/test-and-set ) what understand cpus support special instruction "test , set" achieve mutual exclusion. not understand talks cpu spinning acquire lock. can implemented on single core systems. if yes spinning acquire lock not make sense me. or may missing point test ans set instruction possible on multiple core systems? boolean lock = false function critical(){ while testandset(lock) skip // **spin until lock acquired** critical section // 1 process can in section @ time lock = false // release lock when finished critical section } thanks in advance feedback. on preemptive multithreading systems, other processes allowed run between testand...

c# - How can I get all the object identifiers from Spring context? -

in project using spring.net , have unit test want spring context identifiers of objects. how can such thing? at moment have private array of string identifiers. what want build array dynamically , not maintaining whenever change in spring configuration. i know there following method: applicationcontext.getobject(id); which gets object context id. how can take ids of context in order build array dynamically? thank you. people have found answer. there getobjectdefinitionnames method returns object names. thank you.

c# - FileMaker - How to query multiple database files via ODBC -

when use odbc query filemaker 11 server, looks query restricted retrieve data 1 database @ time. i want query data in 1 database, return records have related data in database (on same filemaker server). know how write normal joins, don't know how across multiple databases . is possible? if so, can please provide small sql query example or code snippet (preferably in c#)? filemaker odbc queries, same executesql (fql) statements based on table occurrence placed in relationships graph of "manage database". to use table filemaker file (database, dsn) in query, add file "external data sources" of target file , place table occurrence of table need query "manage database" of target file. this guess initially, kindly confirmed @maarten docter.

c# - Get AudioSource from other Gameobject -

how can use audiosource component of gameobject gameobject?. gameobject1.audiosource in gameobject2 use gameobject1.audiosource.. i'm using unity3d , c# lang. please help.. perhaps looking this: audiosource source1 = gameobject.findgameobjectwithtag("gameobject1").getcomponent<audiosource>(); getcomponent<audiosource>().clip = source1.clip; this finds gameobject tag (this step optional if have gameobject1) , gets clip audiosource component , copy gameobject2's audiosource. in same way can read other properties audio source1.

PHP - function not returning value inside isset -

i have function call find_student_by_id() 1 arg complete code below. function find_student_by_id($student_number){ global $con; $safe_student_number = prep($student_number); $sql = "select * "; $sql .= "from studeprofile "; $sql .= "where studentnumber = '{$safe_student_number}'"; $sql .= "limit 1"; $student_set = mysqli_query($con, $sql); confirm_query($student_set); if($student = mysqli_fetch_assoc($student_set)){ return $student; } else { return null; } } this function work fine if call anywhere in page, if use inside isset function not returning value . $student = find_student_by_id('id-201'); if use outside isset give me value echo $student['student_number']; but if used inside isset no value return. if(isset($_post['submit'])){ $student_number = $student['student_number']; } complete code inside cor.php <?php $student = find_student_by...

gwt - How to Update Cell Table Footer Dynamically -

i trying add footer celltable , finding hard time change celltable footer dynamically able add while creating columns below celltable.addcolumn(qty, "qty",integer.tostring(totalqty)); this not looking for,is there way set footer cell table dynamically.any help? you need implement custom header , add column should contain footer. example: public class quantityfooter extends header<number> { private final number totalqty; public quantityfooter(number totalqty) { super(new numbercell()); this.totalqty = totalqty; } public void setquantity(number totalqty) { this.totalqty = totalqty; } @override public number getvalue() { return totalqty; } } then add column: quantityfooter quantityfooter = new quantityfooter(0); celltable.addcolumn(qty, new textheader("qty"),quantityfooter ); when need update footer call quantityfooter.setquantity(10) , need redraw headers/footers re...

c# - Azure Cost Calculator -

i have existing website , have been asked calculate how cost move site azure. we know azure right platform because need solution can scale , shrink according demand whilst maintaining high availability. the site asp.net mvc running across 3 server environment (iis7) - , sql server. are there tools available run alongside website tell me how site cost on azure? if not, statistics need able calculate this? any appreciated. you can download azure cost estimator tool , can use azure app service migration assistant assessment , migration of web app

java 8 certandkeygen exception during runtime -

i have third party java package compiled using java 6 version , package deployed in java 8 environment. seeing follow exception during runtime. exception in thread "awt-eventqueue-2" java.lang.noclassdeffounderror: sun/security/x509/certandkeygen @ com.xxx.ws.security.impl.defaultsecuritystore.generateselfsignedentry(unknown source) @ com.xxx.ws.security.impl.securitypluginutil.sign(unknown source) @ com.xxx.ws.security.impl.processingcontext.processoutbound(unknown source) @ com.xxx.ws.security.impl.basesecurityenvironment.secureoutboundmessage(unknown source) @ com.xxx.em.launch.message.launchrequestmessage.sendto(unknown source) i did research exception , discovered java 8 moved certandkeygen class sun.security.tools.keytool package. in case, package compiled using java 6 , referring sun.security.x509.certandkeygen package. alternative approach mitigate issue. . time.

tomcat - How to decode javascript file using perl script? -

i obfuscated javascript files using stunnix tool through buildscript perl script.how decode obfuscated file using perl?? in general, can't. you parse javascript ast , pretty-print it, go long way towards improving readability, cannot, example, recover original variable names or function names.

jdbc - Hadoop Sqoop export to Teradata Error -

i'm trying export data teradata using sqoop. entire mapreduce.job gets completed data not loaded , shows following. 15/07/08 01:27:36 info processor.teradataoutputprocessor: input postprocessor com.teradata.connector.teradata.processor.teradatabatchinsertprocessor starts at: 1436333256770 15/07/08 01:27:36 info processor.teradatabatchinsertprocessor: insert staget table target table 15/07/08 01:27:36 info processor.teradatabatchinsertprocessor: insert select sql starts at: 1436333256969 what's wrong? i used following script load sqoop export --connect jdbc:teradata://172.xx.xx.xx/database=prd_xxx_xxx \ --connection-manager org.apache.sqoop.teradata.teradataconnmanager \ --username gdw_xyv \ --password 123 \ --export-dir /user/xxxx/xxx_xxx/2001/ \ --table prd_xxx_xxx.table_t_hd \ --input-fields-terminated-by '|' \ --input-escaped-by '\\' \ --input-enclosed-by '\"' \ --input-optionally-enclosed-by '\"' \ --mapreduce-job-name...

javascript - Regular expression to match text that "doesn't" contain a word? -

i exclude words using regular expression. input text: aaa1234 cc bbb1234 c1234 cc dd aacc cccc ccadf cc output text: aaa1234 bbb1234 c1234 dd aacc cccc ccadf exclude word: cc i used (^|\s)[^(cc)]+(\s|$) how make regular expression work? \s+\bcc\b|\bcc\b\s+ try this.replace empty string .see demo. https://regex101.com/r/ck4iv0/25

Access 2007 Query to return latest date note from subquery -

i have 2 tables joined projectid in access 2007. table structure of primary table (a) projectid | custid 1 | 5 2 | 8 i have secondary table (b) of notes on projectid, structured projectnotesid | projectid | note | createdate --------------------------------------------------- 1 | 1 | note11 | 1/2/2015 2 | 1 | note12 | 2/2/2015 3 | 2 | note21 | 4/8/2015 4 | 2 | note22 | 3/5/2015 i want return of, or part of, table a, latest note of table b, projectid | custid | note | createdate ------------------------------------------ 1 | 5 | note12 | 2/2/2015 2 | 8 | note21 | 4/8/2015 i can (and have done) php & mysql, can't work in access 2007. can return projectid , latest note date following query in access 2007 select projectid, max(createdate) maxofcreatedate table b group projectid; i have tried unique values, etc.,...

timer - Javascript setTimeout unexpected output -

i've been working scripts making use of setinterval(fn,delay) function in application , after reading how settimeout , js work encounter weird results made test: here jsfiddle https://jsfiddle.net/jyq46uu1/2/ and code suggested: var limit = 1000000000; var intervals = 0; var totaltime = new date(); var starttime = new date(); var uid = setinterval( function () { // final lap? if (intervals == 9) clearinterval(uid); (i = 0; < limit; += 1) { // working cpu } // reduce iterations limit = limit / 10; intervals += 1; console.log('interval ' + intervals +' time elapsed : ' + (new date() - starttime)); // reset time starttime = new date(); }, 250, 9); ok, i've red http://ejohn.org/blog/how-javascript-timers-work/ javascript make timer calls function in setinterval if "thread blocked", if function still executing ca...