Posts

Showing posts from January, 2014

cordova plugins - On/Off NFC system setting through Phonegap -

i using chariotsolution's nfc plugin phonegap ( https://github.com/chariotsolutions/phonegap-nfc ) , it's working perfect reading nfc tag. in application there toggle button want on/off nfc system setting through programmatically in phonegap. possible app? there method, show setting not on/off. nfc.showsettings(); you can't programmatically turn nfc on , off. nfc.showsettings function starts intent opens nfc settings user can enable (or disable) nfc. https://github.com/chariotsolutions/phonegap-nfc#nfcshowsettings use nfc.enabled check if nfc enabled. https://github.com/chariotsolutions/phonegap-nfc#nfcenabled both of these functions wrap android nfc apis https://developer.android.com/reference/android/nfc/nfcadapter.html#isenabled()

string - Perl: Print on the "display" and also into a file -

is there way print both onto "display" , file @ same time without repeating print "string" code? what want do: if ($ofile) { open (file, '>>', "file"); print "hello" #some code#; #prints on display , file } instead of: if ($ofile) { open (file, '>>', "file"); } print "hello"; if ($ofile) { print file "hello"; } tried googling found either or, not both features together. edit add questions: then use io::tee create new tee'd handle, , select $tee print uses default. – eric strom @ericstrom mean create new tee'd handle? mean local::teeoutput ? search.cpan.org/~mschilli/log-log4perl-1.34/lib/log/log4perl.pm @ericstrom have example? @ericstrom local::teeoutput not available in default library strawberry perl. there alternative that's inside default library? sure, io::tee on cpan. my $tee = io::tee->new( \*stdout, \*stderr, $john, $tan );

html - Parent div copy dimensions of child image -

Image
i need set parent div in way, it's child image inside of it, since parent div has visible border, have wrap around image , text. thank tips :) html: .about-us { border: 1.5px solid $grey; width: 100%; height: 275px; //i need rid of it's fixed .us-image { float: left; width: 30%; img { width: 100%; height: auto; padding: .7%; } } .about-us-text { float: left; width: 64%; margin: 0 3%; h3 { margin-top: 5%!important; text-transform: uppercase; font-size: 130%; font-weight: 500; } } } <section class="about-us"> <div class="us-image"> <img src="img/about-us.png" alt="about-us"> </div> <div class="about-us-text"> <h3>abc</h3> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. donec pharetra mauris ornare ultricies malesuada.

javascript - How can I use parameter I get through riot.route()? -

riot.route('/*', function(category) { riot.mount('#main', 'category-page', category) }) when url change, want parameter "category" , use in <category-page> . tried console.log(this.opts.category) in <category-page> , got undefined. riot.route('/*', function(category) { riot.mount('#main', 'category-page', category) console.log(category) }) when code above, console.log(category) works well. think wrong passing or getting parameter. tried many case couldn't resolve it. please me problem. according riot.js router api documentation when calling riot.mount(selector, tagname, [opts]) should pass object set this.opts in tag. so router code should this: riot.route('/*', function(category) { riot.mount('#main', 'category-page', {category: category}) });

servletcontextlistener - How to create servlet-context.xml & servlet-context-dispatcher.xml files for spring -

in spring spring controller have written @postconstruct configured function, problem is involked 2 times when run project.below web.xml , servlet-context.xml files. web.xml : <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="webapp_id" version="3.1"> <display-name>savemoneyoauth</display-name> <servlet> <servlet-name>myproject</servlet-name> <servlet-class>org.springframework.web.servlet.dispatcherservlet</servlet-class> <init-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/servlet-context.xml</param-value> &l

excel - Convert date format (only year) -

i have range of dates in format dd/mm/yyyy recognised date excel. of dates not identified in excel in dd/mm/yy. for example 23/03/2015 -> recognised date 23/03/15 -> recognised text format when use filter in date column, dates dd/mm/yyyy recognised date under yyyy. dates dd/mm/yy recognised differently. i need formula convert dd/mm/yy dates format dd/mm/yyyy. fyi dates in 2015 , 2016 years not elegant solution should job done: =iferror(date(right(g3,len(g3)-5),mid(g3,3,2),left(g3,2)),g3) assumes have leading zeros single digit daya i.e. 02/03/15 rather 2/03/15

Solr Indexing & Searching -

could suggest me best way of using solr regular search products , should support synonyms & fuzzy search ? suppose if search word cro, need products starting cro, cro occurrences anywhere in field, synonyms & fuzzy on in respective boosting i have scenario project. i using fuzzylookupfactory (with multiple suggester) , analyzinginfixlookupfactory . using solrj (java api) request query. first search word analyzinginfixlookupfactory find word anywhere in field have input correctly. example product name " toshiba " if search " tosh " find " toshiba " correctly if search " toshba " not find product. this time using fuzzylookupfactory suggester split words(for example have "toshiba laptop" word1=toshiba word2 = laptop etc.) , search 1 one , fuzzy find toshba -> toshiba , after find toshiba again use analyzinginfixlookupfactory find complete product field. for example want find " toshiba laptop "

Repair json file without quotes using sed -

how repair json file without quotes using sed or perl or whatever shell script tool? add double quotes (e.g. "glossary"). below sample json. lot! { glossary: { title: "example glossary", glossdiv: { title: "s", glosslist: { glossentry: { id: "sgml", sortas: "sgml", glossterm: "standard generalized markup language", acronym: "sgml", abbrev: "iso 8879:1986", glossdef: { para: "a meta-markup language, used create markup languages such docbook.", glossseealso: ["gml", "xml"] }, glosssee: "markup" } } } } }

bitwise operators - Java - Setting a distinct bit of an integer to zero -

here description: in order stop mad coder evil genius need decipher encrypted message sent minions. message contains several numbers that, when typed supercomputer, launch missile sky blocking out sun, , making people on earth grumpy , sad. you figured out numbers have modified single digit in binary representation. more specifically, in given number n kth bit right set 0, current value might different. it's write function change kth bit of n 0. example for n = 37 , k = 3, output should killkthbit(n, k) = 33. 3710 = 1001012 ~> 1000012 = 3310. for n = 37 , k = 4, output should be killkthbit(n, k) = 37. the 4th bit 0 (looks mad coder forgot encrypt number), answer still 37." here solution found , cannot understand it: int killkthbit(int n, int k) { return n & ~(1 << (k - 1)) ; } can explain solution , syntax? detailed explanation of function the expression 1 << (k - 1) shifts number 1 k

jquery - PHP long polling make my server hang -

i trying make facebook webpage messenger app , use ajax in client side , php on server side. my ajax code: function longpoll(timestamp) { var querystring = {'timestamp' : timestamp}; var shoulddelay = false; $.ajax( { type: 'get', async: true, url: 'pollmsg.php', data: querystring, timeout: 5000, cache: false } ).done(function(data){ var array = jquery.parsejson(data); (var = 0; < array.length; i++) { $('#msgtable > tbody:last-child').append('<tr><td><b>' + array[i].sender + '</b><br/>' + array[i].timestamp + '</td><td><b>' + array[i].title + '</b><br/>' + array[i].content + '</td></tr>'); } longpoll(obj.timestamp); }).fail(function(jqxhr, textstatus, errorthrown) { //sh

Wit.ai not parsing data for pence -

wit trained extract wit/number , wit/amountofmoney correctly interprets following sentences 3.03 pounds: 1)spent 3 pound , 3 pence 2) spent 3 cent 3) spent £3: but fails : 1) spent 3 pence 2) spent 3p questions: 1) bug/ new feature ? 2) there workaround ? reference : https://en.wikipedia.org/wiki/pound_sterling wit.ai api response spent 3 pounds , 3 cent { "msg_id": "xxxxxxxxxxxxxxxxxxx", "_text": "spent 3 pounds , 3 cent", "entities": { "amount_of_money": [ { "_body": "3 pounds , 3 cent", "confidence": 1, "_start": 6, "_end": 25, "_entity": "amount_of_money", "type": "value", "value": 3.03, "unit": "£" } ], "intent": [

sql - Detect duplicate string or word in a row -

i want know how detect duplicate word in row. ensure have clean data in our database. for example see below name count james james mccarthy 1 donald hughes hughes 1 i want result like name count james mccarthy 1 donald hughes 1 is there solution using oracle sql? for adjacent words select 1 dual regexp_like ('john john doe','(^|\s)(\s+)\s+\2(\s|$)') ; or select case when regexp_like ('john john doe','(^|\s)(\s+)\s+\2(\s|$)') 'y' end adj_duplicate dual ;

github - Git Squash all commits in origin/master into single commit within origin/master -

i playing around git repository , made quite number of commits earlier on master branch. realised bit noisy, , merge of single commit. 102381 commit z .... 176232 commit 891273 initial commit to simply 198273 initial commit (after rebase) 891273 initial commit i have looked around , many of solutions seems around squashing. unfortunately might possible given on master branch already. one of initial thoughts create new branch commit #891273 squash master new branch delete old master, , replace new branch i not sure if might way it; thought wiser ideas, guidance , discussions it. find easy way achieve requirement: git checkout –b branch1 . create new branch commit #891273, git rebase –i master waiting editor input (type i start input): pick 176232 commit a squash ****** commit b ...... squash 102381 commit z note: type ‘esc’ button stop input input :wq exit editor, find want note: when squashing commit z, may have conflict. need fi

ios - Switch case in swift -

these uibuttons @iboutlet weak var btnprogressdate: uibutton! @iboutlet weak var btncloseddate: uibutton! i have dragged these 2 buttons action as: @ibaction func btnclicked(sender: uibutton) { let tag = sender.tag self.clearpopups() switch (tag) { case 1: self.datepicker.hidden = false self.datepicker.datepicker.maximumdate = nil self.datepicker.datepicker.minimumdate = nil if(self.healthactionplancondition.dateclosed != nil) { self.datepicker.datepicker.maximumdate = self.healthactionplancondition.dateclosed } if(self.healthactionplancondition.nextprogressreviewdate != nil) { self.datepicker.datepicker.setdate(self.healthactionplancondition.nextprogressreviewdate, animated: true) } self.selectedbtn = self.btnprogressdate case 2: self.datepicker.hidden = false if(self.healthactionplancondition.nextprogressreviewdate != nil)

node.js - NodeJS + Wordpress on Apache -

i have instance on google cloud , want migrate apps it. using apache host wordpress page @ path: my_ip/wordpressapp. now want host nodejs app in apache too. configured proxy in /etc/apache2/sites-available/000-default.conf <virtualhost *:80> # allow .htaccess <directory /var/www/html/> options indexes followsymlinks multiviews allowoverride order allow,deny allow </directory> #setup proxy nodejs app proxyrequests off proxypreservehost on proxyvia full <proxy *> require granted </proxy> <location /nodeapp> proxypass http://0.0.0.0:8080 proxypassreverse http://0.0.0.0:8080 </location> loglevel warn serveradmin webmaster@localhost documentroot /var/www/html errorlog ${apache_log_dir}/error.log customlog ${apache_log_dir}/access.log combined </virtualhost> when run nodejs app, if go addr

Node.js app on Heroku. Getting started -

starting documentation: getting started on heroku node.js( https://devcenter.heroku.com/articles/getting-started-with-nodejs ). trying put own thing together. inside db.ejs 1 can read code: <ul> <% results.foreach(function(r) { %> <li><%= r.id %> - <%= r.name %></li> <% }); %> </ul> and here "results" array coming query (inside index.js) client.query('select * test_table', function(err, result) {.... now here comes question: how "result" inside db.ejs? (what right syntax?), when inside index.js, use query returning value instead of array. for example: client.query('select max(id) test_table', function(err, result) {.... i tried code unchanged in db.ejs, not result.

spring boot - org.apache.http.client.HttpResponseException: No authentication header supplied -

i configuring neo4j database spring boot. able setup spring boot , working fine. when configure neo4j throwing exception org.apache.http.client.httpresponseexception: no authentication header supplied . log stash below: 2016-11-08 15:20:54.962 info 4932 --- [nio-8080-exec-1] o.s.web.servlet.dispatcherservlet : frameworkservlet 'dispatcherservlet': initialization completed in 23 ms 2016-11-08 15:24:29.062 info 4932 --- [nio-8080-exec-2] o.n.o.drivers.http.request.httprequest : thread: 27, url: http://localhost:7474/db/data/transaction/commit, request: {"statements":[{"statement":"match (user:user) user.id = {id} return user","parameters":{"id":"10"},"resultdatacontents":["graph"],"includestats":false}]} 2016-11-08 15:24:29.285 warn 4932 --- [nio-8080-exec-2] o.n.o.drivers.http.request.httprequest : thread: 27, response: no authentication header supplied. 2016-11-08 15:

javascript - How to remove and add js file completely dynamicaly after page load by jquery? -

in project ,i have load js , css file dynamically after page load. using below code able add , remove js file after adding new file removing previous one,then previous file not shown in header when run code both js file code executed.i don't known how remove file ,can body me. code is. in the view page header:- <link rel="stylesheet" id="videocss" /> <script id="videojs"></script> jquery dynamically load js , css file:- function addremovejscssfile(filename, filetype) { var fileref=''; if (filetype == "js") { //if filename external javascript file document.getelementbyid("videojs").remove(); fileref=document.createelement('script'); fileref.setattribute("type", "text/javascript"); fileref.setattribute("src", filename); fileref.setattribute("id", "videojs");

c++ - Armadillo linking error only if I use it in my own library -

i'm having troubles armadillo when use within own library. installed armadillo, , created own library, calls svd_econ method. cmakelist.txt file: cmake_minimum_required (version 2.8.9) set(projectname training_library) project(${projectname}) if (not defined env{eigen_root}) message(fatal_error "could not find eigen_root environment variable") endif() find_package(armadillo required) include_directories("$env{eigen_root}") add_definitions(-g) add_definitions(-o3) add_definitions(-dndebug) include_directories(${armadillo_include_dirs}) include_directories(${project_source_dir}/include) file(glob header include/*.h) file(glob source src/*.cpp) source_group("source files" files ${source}) source_group("header files" files ${header}) add_library(${projectname} ${source} ${header}) target_link_libraries(${projectname} ${armadillo_libraries}) this header file: #include <algorithm> #include <string> #include <stdio.h

ios - Custom Tab Bar with details view -

Image
i'm creating custom tab bar based on tutorial: https://github.com/codepath/ios_guides/wiki/creating-a-custom-tab-bar everything fine when want segue view controller "details view", details view covers bottom bar menu. behaviour logical i'm pushing new view controller how have in order keep bottom bar visible , functional? i'm using segue because need pass data. need custom bar because functionality , difficult implement using apple's one. any tips or suggestions? thanks edit: here "tab" working when tap on row navigate "details" view in details view, bottom bar not visible. have tried setting hidesbottombarwhenpushed = false details view?

c# - How to get namespace from datacontract type and type from namespace? -

i want support own metadata queries in wcf service , need exchange data contract type information clients. for example, service contract allows client select data contract usedatacontract operation based on getmostuseddatacontracttype result: [servicecontract] [serviceknowntype("getknowntypes", typeof(knowntypesprovider))] public interface imetadataservice { [operationcontract] string getmostuseddatacontracttype(); [operationcontract] void usedatacontract(object arg); } i understand clr type information not since clients has own assemblies , runtimes. wsdl namespaces way go. , there 2 problems solve: how namespace exposed in wsdl datacontract's type, considering wcf data annotations , conventions (for example, don't use attributes , have tempuri everywhere)? how namespaces can transformed types on client side? since wcf work internally beleive there's easy solution avaible, can't find it.

codeigniter - php excel reader date format getting 1970-01-30 for any input date given in excel sheet -

Image
i'am getting date format 1970-01-30 input date given date in excel there 2 fields having date format cells date given in excel showing 1970-01-30 output in echo please can 1 me this code public function clientfileupload($list_id){ $clientarr = array('client_name','client_nick_name', 'client_email','client_phone','client_address','client_location','contract_name','contract_description','contract_value','renewal_date','expiry_date','payment_mode'); $this->load->library('phpexcel'); $name = $_files["images"]["name"]; $filetype = explode(".",$name); $name = str_replace(' ', '',$name. "_" . time()); $abs = getcwd(); $path = $abs . "/upload/excelfiles/"; $pathfile = $path . $name; if (move_uploaded_file($_files["images"]["tmp_name"], $path . $nam

java - Access denied exception when trying to create PubSub instance -

i trying publish data on pubsub. so, need run below code pubsub pubsub = pubsuboptions.defaultinstance().service(); string topicname = "mytopic"; topic topic = pubsub.create(topicinfo.of(topicname)); this exception getting nested in java.lang.exceptionininitializererror: java.security.accesscontrolexception: access denied ("java.lang.runtimepermission" "modifythreadgroup") @ java.security.accesscontrolcontext.checkpermission(accesscontrolcontext.java:484) @ java.security.accesscontroller.checkpermission(accesscontroller.java:698) @ java.lang.securitymanager.checkpermission(securitymanager.java:549) @ java.lang.threadgroup.checkaccess(threadgroup.java:315) @ java.lang.thread.init(thread.java:391) @ java.lang.thread.init(thread.java:349) @ java.lang.thread.<init>(thread.java:508) @ io.netty.util.internal.threadlocalrandom$1.<init>(threadlocalrandom.java:79) @ io.netty.util.internal.threadlocalrandom.&

osx - Trigger notification from Terminal process output -

how can trigger notification whenever process running within terminal prints screen? i.e. i'm using https://github.com/shopify/shopify_theme watch & upload file changes. i'd recieve notification whenever file done uploading don't have manually check terminal every time save file. idealy trigger system notification.

Find element '0' in each rwo of CSV file in Python -

Image
what i'm trying should simple,to write program reads csv or txt file line line , finds rows have more 1 element equal 0 highlighting these lines , saving new version of highlighted csv file. have csv file this: i have no idea how find elements = 0 in each row of csv file , how change color of row. don know if there way save copy of changed csv file. if self.enablecalibration.ischecked(): try: importedfile = open('some.csv', 'rb') csvreading= importedfile.read(_max_lunghezza_file) lenght_csvreading = len(csvreading) csvfilearray = [] row in csv.reader(importedfile, delimiter=' '): csvfilearray.append(row) if two_elements == 0: ? highlight_row? # not string or python command csvfilearray.next() # go next row if csvreading.split(-1): # end of csv file csvsave= csv.writer(csvreading) #to save import

sdn - Matching TCP flows based on tcp ports Ryu Controller -

i'm trying redirect tcp flows specific servers using tcp source port ryu sdn controller. topology (simple first step): host -- ovs1 -- ovs2 -- server match rule ovs1: match = parse.ofpmatch(in_port=port,eth_type=0x0800, ipv4_dst=server_ip, tcp_src=tcp_pkt.src_port) but following error : eventofperrormsg received. version=0x4, msg_type=0x1, msg_len=0x4c, xid=0x370bf1bf `-- msg_type: ofpt_error(1) ofperrormsg(type=0x4, code=0x9, data=b'\x04\x0e\x00\x70\x37\x0b\xf1\xbf\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\xff\xff\xff\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x28\x80\x00\x00\x04\x00\x00\x00\x01\x80\x00\x0a\x02') |-- type: ofpet_bad_match(4) |-- code: ofpbmc_bad_prereq(9) `-- data: version=0x4, msg_type=0xe, msg_len=0x70, xid=0x370bf1bf `-- msg_type: ofpt_flow_mod(14) the point is, if remove tcp_src option, works fine, that's why think problem related how i'm passing

postgis - Selecting a cluster in Postgresql -

i have upgraded psql server 9.5 major version in order work last version of postgis . this, have set $pgcluster 9.5/main after upgrade, problem appears when try sudo -su postgres psql , in returns me no existing local cluster suitable default target. please see man pg_wrapper(1) how specify one. and due tho fact have use sudo -u postgres psql --cluster 9.5/main . the cluster list is: ubuntu@inn0095_vm2:~/desktop$ pg_lsclusters ver cluster port status owner data directory log file 9.5 main 5433 online postgres /var/lib/postgresql/9.5/main /var/log/postgresql/postgresql-9.5-main.log 9.6 main 5434 online postgres /var/lib/postgresql/9.6/main /var/log/postgresql/postgresql-9.6-main.log

string - Removing duplicate extension files on Java -

having folder following files myoutput.pdf hello.pdf.pdf byebye.txt hey.txt.txt how can remove extension of files duplicated extension? in example there pdf , txt, in real example can type of extension. i got far: string dir = "c:/users/test"; file[] files = new file(dir).listfiles(); (file file : files) { if (file.isfile()) { system.out.println(file.getname()); } } but don't know how can detected ones "duplicated extension" , rename "single extension" my desired output be: myoutput.pdf hello.pdf byebye.txt hey.txt thanks in advance. you may use file.getname().replaceall("(\\.\\w+)\\1+$", "$1") see regex demo pattern details : (\\.\\w+) - group 1 capturing dot , 1 or more word chars ( \\w+ might replaced [^.]+ match 1 or more chars other dot) \\1+ - 1 or more occurrences of same value captured in group 1 $ - end of string. the replacement pattern backreference group 1

bash - Copy File ignoring Column(s) -

i have .txt this: dummy1, dummy2, dummy3, dummy4, dummy1, dummy2, dummy3, dummy4, dummy1, dummy2, dummy3, dummy4, dummy1, dummy2, dummy3, dummy4, dummy1, dummy2, dummy3, dummy4, i want save information in file, ignoring (for example) column 2 and/or 4. how can it? if have access awk command then: awk '{ $2=""; $4=""; print}' test.txt > new.txt where $2 second column , $4 fourth. contents of new.txt file be: dummy1, dummy3, dummy1, dummy3, dummy1, dummy3, dummy1, dummy3, dummy1, dummy3, just change columns in print different configurations. i.e. awk '{ $2=""; print}' test.txt > new.txt the contents of new.txt file be: dummy1, dummy3, dummy4, dummy1, dummy3, dummy4, dummy1, dummy3, dummy4, dummy1, dummy3, dummy4, dummy1, dummy3, dummy4,

android - Transparent gradient issue -

Image
i have layout google map fragment in framelayout. also, placed new view on map gradient background. layout: <framelayout android:layout_width="match_parent" android:layout_height="0dp" android:layout_weight="1" > <com.google.android.gms.maps.mapview android:id="@+id/mapview" android:layout_width="match_parent" android:layout_height="match_parent"/> <view android:id="@+id/fadetop" android:layout_width="match_parent" android:layout_height="@dimen/fade_height" android:layout_gravity="top" android:background="@drawable/list_fade_top"/> <include layout="@layout/top_line_mid_gray"/> </framelayout> list_fade_top: <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <grad

How to invoke ondragstart and drop event manually javascript -

i have used html ondragstart , ondrop events. <div class="row height_380_div" id="target_div_id" ondragover="drag_over(event)" ondrop="drop(event)"> <div ondragstart="dragstart(event)" class="alert alert-warning col-lg-12 height_30_div node" draggable="true" id="call" name="call" > <button class="close top_min_10 hidden call_btn" data-dismiss="alert" onclick="remove_btn(this)"> &times;</button><p class="top_min_10">call</p> </div> </div> i want drag , drop dynamically on page load. means example, div should dragged 100 px left , dropped there, should called dynamically when page loads , should run on own. how that?

php - Getting data from multiple tables in sql -

table 1: invoices (inv_id, inv_value, cust_id) table 2: customers (cust_id, sales_rep) table 3: members (member_id, member_cateogry, member_type, cust_id) note 1: each customer pays multiple invoices. (one-to-many relationship). note 2: each customer pays one-or-more members (so more 1 member related 1 customer). note 3: each member has category 1 "represents individual" or 2 "represents group". note 4: each member has type 1 "represents new" or 2 "represents renew". i want total of invoice_value field customers who's sales_rep = 1 , member_category = 10 , members_type = 123 ex: total amount of invoices customers paid if sales_rep these customers 1 , members paid new , individual members. i tried: select sum(invoices.inv_value) total invoices, customers, members invoices.cust_id = customers.cust_id , members.custid = customers.cust_id , members.category = {$category} , members_type = {$type} ,

vb.net - PHP decryption of VB data -

i taking on task wrote library years ago. library vb , asp. i'm working in php need decrypt load of strings have been stored in database after being encrypted in vb: public function encrypt(byval mystring object) string if isdbnull(mystring) or isnothing(mystring) return string.empty else if mystring.length = 0 return "" else cryptdes3.key = cryptmd5hash.computehash(asciiencoding.ascii.getbytes(mykey)) cryptdes3.mode = ciphermode.ecb dim desdencrypt icryptotransform = cryptdes3.createencryptor() dim myasciiencoding asciiencoding = new asciiencoding() dim buff() byte = asciiencoding.ascii.getbytes(mystring) return convert.tobase64string(desdencrypt.transformfinalblock(buff, 0, buff.length)) end if end if end function the appropriate decryption function in vb like: public function decrypt(byval mystring object) string try

java - Spring boot mvc multimodule on Whitelabel Error Page -

i know question has been asked multiple times , couldn't find answer fits. here have created maven multi-module project in spring boot included , not sure have gone wrong. someone please me through,its been 2 days , cant find answer. below error getting. whitelabel error page application has no explicit mapping /error, seeing fallback. tue nov 08 17:22:26 ist 2016 there unexpected error (type=not found, status=404). no message available parent pom. <project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>com.sonic</groupid> <artifactid>sonicboot</artifactid> <version>0.0.1-snapshot</version> <packaging>pom</packaging> <modules> <module>sonicweb</module

android - How to get the checked state of Switch from menu items -

i have added switch in menu items , trying access checked state.but not able access checked state.can 1 me out. this menu_crime.xml <?xml version="1.0" encoding="utf-8"?> <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/crime_toggle" android:title="crime" android:enabled="true" app:showasaction="always" app:actionlayout="@layout/toolbar_crime_toggle" /> </menu> this toolbar_crime_toggle.xml <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content"> <android.support.v7.widget.switchcompat android:id="@+id/crime_switch" android:layout_width="wrap_content" android:layout_height="wrap_content

python - Is it at all possible to create indirectly recursive ctypes.Structure types? -

this not same #1228158 or #28879604 . it's similar, twist. it's trivial create recursive type referring own type: a = type('a', (ctypes.structure,), {}) a._fields_ = [('another_a', ctypes.pointer(a))] or, if prefer: class a(ctypes.structure): pass a._fields_ = [('another_a', ctypes.pointer(a))] same thing. if they're not same thing, educate me! but i'm trying machine-translate c struct s , typedef s ctypes.structure s. want names , relations on python side reflect on c side. if function returning uint32 typedef ed consumer_id , want object on python side have more descriptive name. now, here's type of thing occurs quite often: typedef dummy_type official_type; typedef struct dummy_struct { official_type *another_struct; } dummy_type; no matter how twist , turn this, can't realize relation in python. intermediate names probably not used anywhere, @ moment we're going idea of detecting situation , making o

java - Generic list conversion to an array -

Image
assuming have following class public class <t>{ private t [] datas; // more code here ... } and desire take advantage of constructor initialize array. suppose have following constructor public a(t element){....} java not allow me use like datas = new t[10] and complain cannot create generic array of t can still use work around like: @suppresswarnings("unchecked") public a(t element){ list<t> dataslist = new arraylist<t>(); dataslist.add(element); datas =(t[]) dataslist.toarray(); } i have warning compiler that's why had add @suppresswarnings, point related following comment toarray method documentation (please take @ picture) it talks returned array being safe . so means safe use method ? if not why? , better way such initialisation in constructor? consider case of variable list of t elements in overloaded constructor public a(t... elements){....}. you can create instance of g

iOS, bluetooth scanner blocks wifi -

Image
i have strange problem app. on iphone 7 ios 10.1 or 10.2(beta) seems bluetooth scanner seems block internet connection through wifi. meaning when i'm in airplane mode , have bluetooth activated, app has no internet access. when turn bluetooth off, internet through wifi works fine. other apps (also using bluetooth) not experience issue. no stranger. other phones using ios 9 or 10 not have issue app. tried restarting phone, resetting network settings. reinstalling app. nothing helped. anybody experiencing similar issues? i have met similar situation while tested app using bluetooth connection on dec 19 in 2016. device:iphone 6/a1586/hong kong os:ios 10.2 the app using bluetooth a2dp , ble connection.when update iphone 6 ios 10.2. 1.we found can not bluetooth scanning list in bluetooth settings. note:we have wi-fi , 4g (china mobile) connection. 2.when turn off wi-fi connection,we still can not bluetooth scanning list in bluetooth settings. 3.wh