Posts

Showing posts from January, 2012

Add new column if range of columns contains string in R -

i have dataframe below. add 2 columns: containsanz: indicates if of columns f0 f3 contain 'australia' or 'new zealand' ignoring na values allanz: indicates if non na columns contain 'australia' or 'new zealand' starting dataframe be: dfcontainsanz col.a col.b col.c f0 f1 f2 f3 1 data 0 xxx australia singapore <na> <na> 2 data 1 yyy united states united states united states <na> 3 data 0 zzz australia australia australia australia 4 data 0 ooo hong kong london australia <na> 5 data 1 xxx new zealand <na> <na> <na> the end result should this: df col.a col.b col.c f0 f1 f2 f3 containsanz allanz 1 data 0 xxx australia singapore <na> <na> australia unde

java - What is the right way to make Spring boot authentication for mobile clients? -

Image
i need make simple crud application user registration , authentication using spring boot, have trouble figuring out how right. have created user table @ rdms , set redis storing user sessions explained here . at spring boot docs it's said if spring security on classpath web applications secure default ‘basic’ authentication on http endpoints. but defined several crudrepository intefaces , after starting application can get it's data using browser without authentication. thought should work out of box without additional tuning , therefore checked if spring security on classpath gradlew dependencies command , appears there: also default user password should displayed during application start not show up. maybe missing here? also not sure if best option mobile app because possibly uses short-living tokens. there several other options, among using webview , cookies (as recommended google long ago), creating custom authentication entry point , using appro

java - Why can't I inject a WebServiceContext into a Jax-WS logical Handler -

i have logical handler web service need access servlet's context (via web service context, thinking). package test; public class newlogicalhandler implements logicalhandler<logicalmessagecontext> { @resource private webservicecontext context; error when deploy: <servlet: "test.ws1" failed preload on startup in web application: "web". java.lang.classnotfoundexception: test.newlogicalhandler @ java.net.urlclassloader.findclass(urlclassloader.java:381) @ java.lang.classloader.loadclass(classloader.java:424) @ sun.misc.launcher$appclassloader.loadclass(launcher.java:331) @ java.lang.classloader.loadclass(classloader.java:357) if inject web service proper: @webservice(..stuff...) @handlerchain(file = "handler.xml") public class ws1 { @resource private webservicecontext context; that works fine. never mind. can servlet context logicalmessagecontext.get(messagecontext.servlet_context);

node.js - how to run 3 function sequentially? -

i have 3 function: function createdir(){ fs.mkdirs('./quickstart',function(){ console.log("thao thanh cong"); }); } function unzip(){ fs.createreadstream('./prestashop_cache/' + quickstart).pipe(unzip.extract({path:'./quickstart'})); console.log("giai nen xong"); } function copydata(){ if (path.extname(folder + '/samples' + version + '/data') != '.ds_store' && path.extname(folder + '/samples' + version + '/data') != '.svn' && path.extname(folder + '/samples' + version + '/data') != '__macosx') { fs.copy(folder + '/samples' + version + '/data','./quickstart/prestashop/install/data/', function () { console.log("coppy thanh cong toi thu muc data"); }); } } i want execute 3 function above : createdir() finished -> unzip(); finished -> copydata();

ios - How to use checkmark for UITableView -

i trying create simple todo list app learning purposes i. want able click on row , add check mark , when clicked again want go away. have looked @ several other examples nothing working. how can achieve this? class firstviewcontroller: uiviewcontroller, uitableviewdelegate, uitableviewdatasource { @iboutlet weak var tbview: uitableview! override func viewdidload() { super.viewdidload() tbview.reloaddata() } override func viewwillappear(animated: bool) { self.tbview.reloaddata() } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int{ return tasks.manager.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell: uitableviewcell = uitableviewcell(style: uitableviewcellstyle.subtitle, reuseidentifier: "default tasks")

ios - how to handle the below data -

the problwm iam facing ..when ever iam passing values array inside dictionyy..it showing me error -1005 connection lost..and when ever dont pass values response getting created inthe server side database ofiice price details , office contact information , office document not saving ..can 1 me how handle in advance [ { "officeprice": [ { "office": 1, "making_charge": 1, "wastage": 1, "weight_by": 1, "credit_period": 1, "cartage_price_type": null, "cartage_price": null, "diamond_price": 1, "amethyst_price": 1, "amber_price": 1, "sapphire_price": 1, "emerald_price": null, "ruby_price": null, "id": 1, "createdat": "2016-04-15t08:41:08.000z", "updatedat": "2016-04-16t14:18:39.000z" } ], "officecontactperson": [ {

php - Inserting MySQL data as an image path -

when try simple code works fine: <?php require 'connect.php'; if($result = $con->query("select * table")) { if($row = $result->fetch_object()) { echo $row->imgname, ' ',$row->divid, '<br>'; } } ?> but inserting image not working reason: <?php require 'connect.php'; if($result = $con->query("select * table")) { if($row = $result->fetch_object()) { echo "<img src='img/".$row['imgname']."' />"; } } ?> can me out, please! change $row['imgname'] $row->imgname

javascript - Events in Android OS/iOS /debian linux (on click of Enter key) -

how can detect enter key press event using javascript? want restrict enter key press event on text box in various platforms such android os, ios, debian linux. the enter key 13. if have event listener can listen when key pressed so: document.body.addeventlistener("keydown", function(event) { if(event.keycode == 13) alert("you hit enter key"); })

runtime.exec - how to open a file using exec method in java? -

c:\users\admin\downloads\vid_20160226_203631957.mp4 when execute above line in command prompt corresponding video gets played default media player. but when try same using java runtime class doesnt work. using following method. runtime r= runtime.getruntime(); r.exec("c:\users\admin\downloads\vid_20160226_203631957.mp4") try this. runtime r= runtime.getruntime(); r.exec("cmd /c c:\\users\\admin\\downloads\\vid_20160226_203631957.mp4");

microcontroller - Books for programming processors/microcontollers using DMA, interrupts -

i'm looking book processors programming using dma, interrupts. may beginner, full guide using processor's peripherial examples. i have use processor core cortex-m0, books may cortex-m3 , other cores, , not difficult read. thanks! the best books dma , innnterrupts datasheet , user guide processor , pripherial modules. each processor have unique set of features , processor documentation can image combinations of using peripherials.

c# - How to add a UI element above Map Icon to show address in Windows 10? -

Image
i working on mapcontrol in windows 10 , want display location address above map icon. know how add map icon not aware of adding ui element above it. added map icon using following code mapcontrol map = frameworkelement mapcontrol; map.mapservicetoken= "my service token"; basicgeoposition councilposition = new basicgeoposition() { latitude = convert.todouble(info.gettype().getruntimeproperty("latitude").getvalue(info, null)), longitude = convert.todouble(info.gettype().getruntimeproperty("longitude").getvalue(info, null)) }; geopoint pinpoint = new geopoint(councilposition); mapicon locationpin = new mapicon(); locationpin.image= randomaccessstreamreference.createfromuri(new uri("ms-appx:///images/pushpin.png")); locationpin.title = councilinfo.council_name; locationpin.collisionbehaviordesired = mapelementcollisionbehavior.remainvisible; locationpin.location = councilpoint; locationpin.normalizedanchorpoint = new point(0.5, 1.0)

node.js - Write After end error when post request happen -

'use strict'; var express = require('express'); var app = express(); var stomp = require('stomp-client'); var cors = require('cors'); var destination = '/topic/chat.'; var client = new stomp('127.0.0.1', 61613, 'admin', 'password'); var bodyparser = require('body-parser'); app.use(bodyparser.json()); app.use(bodyparser.urlencoded({ extended: true })); app.use(cors()); app.post('/activemq', function(req, res) { var message = req.body.message; var con_id = req.body.conid; var send_destination = destination + "" + con_id var obj = new object(); obj.text = message; obj['corre-id'] = ""; var jsonstring = json.stringify(obj); client.connect(function(sessionid) { client.subscribe(send_destination, function(body, headers) { console.log(body); }); client.publish(send_destination, jsonstring); }); cli

SoapUI on windows 10 - high DPI/4K scaling issue -

Image
soapui doesn't seem dpi-aware , displays small on high dpi screen (tiny text , buttons). other applications running fine (screen resolution 3840 x 2160). version : soapui 5.1.2 os : windows 10 i have tried: configure soapui run "disable display scaling on high dpi settings" - parts of soapui looking bigger , don't display (image) changing resolution changing font size (preferences > editor settings > select font...) therefore assume, soapui pretends dpi-aware, not scale itself. have same issue? this workaround until developers round making version dpi-aware. step 1: add registry key hkey_local_machine\software\microsoft\windows\currentversion\sidebyside\preferexternalmanifest (dword) 1 step 2: add manifest file 'soapui-5.2.1.exe.manifest' in same directory 'soapui-5.2.1.exe' content of manifest file: <?xml version="1.0" encoding="utf-8" standalone="yes"?> <assembly xml

module - Loading Rubywork Facets unto a Rails Application -

i want use particular rubyworks facets unto helper: require 'core/facets/string/snakecase' module generictablehelper def generic_table_theadlink(head_title, order_parameter = head_title.snake_case ) render(:partial => 'common_partials/generic_table/theadlink', :locals => {:head_title => head_title, :order_parameter => order_parameter}) end end i error: no such file load -- core/facets/string/snakecase checked gemfile: gem 'facets' how load rubyworks facets unto helper? , other model/view/controller i think core leading astray. require 'facets/string/snakecase`

fswatch - Stop watching a folder for changes if a file exists (bash) -

i'm using fswatch keep track of changes directory, process stop if file exists (with wildcard). file created in alternative directory (not in tracked directory) process (which generating changes need tracked). here's tried do: while [[ $(shopt -s nullglob; set -- "${file_to_check}"; echo $#) -eq 1 ]]; fswatch "${path_to_the_tracked_directory}" done && echo "done" however, script not terminate after ${file_to_check} appears. the complex bit in condition take care of wildcards per: bash check if file exists double bracket test , wildcards edit: the complex bit can simplified to: while [ $(set -- "${path_to_the_file_to_check}"${file_to_check_with_wildcards}; echo $#) -eq 0 ]; fswatch "${path_to_the_tracked_directory}" done && echo "done" one solution use -1/--one-event option ( https://github.com/emcrisostomo/fswatch/wiki/how-to-use-fswatch ). the code looks as: whil

jquery - Find input whose name attribute value has [somedigit] in it -

i've got several divs inside inputs this: <div class="executor"> <input type="hidden" name="task.executors[0].id"/> <input type="hidden" name="task.executors[0].name"/> <input type="hidden" name="task.executors[0].jobtitle"/> </div> <div class="executor"> <input type="hidden" name="task.executors[1].id"/> <input type="hidden" name="task.executors[2].name"/> <input type="hidden" name="task.executors[3].jobtitle"/> </div> i need selector this: find inputs name contains executors[somedigit] . somedigit part makes hard me. need regex this? edit: seem have missed important part. need change executors[somedigit] executors[2] . need me replace somedigit one. edit2: why need this. suppose there 100 of such divs. last div going contain hidden inputs name contain

php - How to Prepare a Prepared Statement With Lots of If Statements? -

i have 25 optional field sql query. doing is, posting data using ajax (for pagination) php file prepare , execute query. sample (index.php) // optional value if (isset($_post['il']) && !empty($_post['il'])) $il = $_post['il']; // js change_page('0'); }); function change_page(page_id) { var datastring = page_id; // define optional value <?php if (isset($_post['il'])&& !empty($_post['il'])):?> var il = '<?php echo $il;?>'; <?php endif; ?> // send optional value $.ajax({ type: "post", url: "includes/post.php", data: { <?php if (isset($_post['il'])&& !empty($_post['il'])):?>'il': il,<?php endif; ?> }, ... post.php (where operations handled) ... // main query (default) $bas_query = "select id, a, b, c, d, e test.db a=$1 , b=$2"; // if user has input 'il', add query. if (isset($_po

ruby on rails 4 - Rubymine RSpec kind of error after successful test -

Image
i newbie learnt how use rspec. rspec works fine in windows terminal. however, in rubymine build-in rspec. errors after giving success message. annoying. git: https://github.com/ivawzh/sample_app please help. thanks , best regards. rspec works fine in native cmd not sure if matters, spork drb server rubymine build-in rspec, says tests passed. errors come after success message. error messages: running specs... command line: ["c:\\ruby200\\bin\\ruby.exe", "-e", "$stdout.sync=true;$stderr.sync=true;load($0=argv.shift)", "c:\\ruby200\\bin/rspec", "--require", "teamcity/spec/runner/formatter/teamcity/formatter", "--format", "spec::runner::formatter::teamcityformatter", "e:/ror docs/sample_app/spec/controllers/pages_controller_spec.rb", "--drb", "--backtrace"] 2 examples, 0 failures, 2 passed finished in 0.17701 seconds <-- slave(1) run done! c:/ruby200/

css - Is there an easy way to get started with basscss? -

i trying out different basscss examples. there selectors not present in css files have - installing more, time consuming, , becoming confusing. there example html file somewhere contains them all? here getting started guide , isn't helpful in respect. i started off css/basscss.css , found out needed css/colors.css , , on. kept going started suspect there overlaps. haven't found file (even min one) has in it. i wouldn't mind installing them separately if there kind of guide - index.html css links make examples work straight away great. i tried installing basscss through bower package seems broken. , went on documentation , source code. referenced cdn steveax suggested , that's start. if wanted use ui elements (buttons, navbars, etc.) of basscss there's note states "note: guide makes use of optional ui utility groups module not included in default basscss package." here's link utility group: https://www.npmjs.com/package/basscss-ui

How to set selected values using sfWidgetFormSelectMany in Symfony1? -

i want use sfwidgetformselectmany inside sfform. have no problems setting choices select, how set selected values when loading form? this code sfwidgetformselectmany far: $choices = $this->getscopes(); $this->widgetschema['application_scopes'] = new sfwidgetformselectmany(array( 'choices' => $choices )); $this->validatorschema['application_scopes'] = new sfvalidatorchoicemany(array( 'choices' => array_keys($choices) )); so, have answer question myself. best way ask question find answer ;-) as inside form class, can set values this: $this->setdefault('application_scopes', array('this','that'));

python 2.7 - Pip won't install anything -

i upgraded windows machine new macbook pro. currently, trying used new development environment. problem whenever try pip install prompted following error: exception: traceback (most recent call last): file "/library/python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/basecommand.py", line 209, in main status = self.run(options, args) file "/library/python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/commands/install.py", line 317, in run prefix=options.prefix_path, file "/library/python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_set.py", line 732, in install **kwargs file "/library/python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 835, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) file "/library/python/2.7/site-packages/pip-8.1.1-py2.7.egg/pip/req/req_install.py", line 1030, in move_wheel_files isolated=self.isolated, file "/library/pytho

How to monitor windows services using c# -

how can monitor windows services using c# , have save services name, started time , services end time using in csv file. if new services started should automatically write services name, started time , services end time using in existing csv file. you can list running services using servicecontroller or managementobjectsearcher . here sample using managementobjectsearcher : using system.management; ... stringbuilder sb = new stringbuilder(); string format = "{0},{1},{2},{3},{4}"; // header line sb.appendformat(format, "displayname", "servicename", "status", "processid", "pathname"); sb.appendline(); managementobjectsearcher searcher = new managementobjectsearcher("select * win32_service"); foreach( managementobject result in searcher.get() ) { sb.appendformat(format, result["

c# - Async await button click always running synchronously -

i learning async await , implementing in old asp.net. using c# 4.6. now page running synchronously after adding async-await. it's waiting api send result , shows message on screen. what looking page kicks off thread , responsive(i can other bits on it). when it's completed, shows result. below button click, http call (which initiate async req) , api method . i have followed examples https://msdn.microsoft.com/en-us/library/hh191443.aspx looked solution on stackoverflow , other forums. believe doing same way (which of course not :( ). added async="true" on aspx page. button click protected async void btncopy_click(object sender, eventargs e) { await runasync(guid.parse(sourcebusinessid), guid.parse(destinationbusinessid), false); if (lblerror.text == "") { lblerror.text = "copy completed!"; } } public async task runasync( guid sourcebusinessid, guid destinati

errorlevel - How to run bcp commands one by one -

i want execute 15 "bcp commands" 1 one in 1 single batch file/script.. every command should process or execute after previous command executed.. if in case command fails execute..the script should stop execution... i tried this..but didn't sufficient output need.. bcp.exe "select * orderxpress.dbo.customers custid < 1000" queryout "d:\customer.dat" -s localhost -u sa -p sa12345 -e -n if %errorlevel% > 0 ( pause ) bcp.exe orderxpress.dbo.customers out "d:\customer2.dat" -s localhost -u sa -p sa12345 -e -n if %errorlevel% > 0 ( pause ) bcp.exe orderxpress.dbo.orders out "d:\orders.dat" -s localhost -u sa -p sa12345 -e -n if %errorlevel% > 0 ( pause ) please try this... begin try bcp.exe "select * orderxpress.dbo.customers custid < 1000" queryout "d:\customer.dat" -s localhost -u sa -p sa12345 -e -n end try begin catch declare @msg varchar(1000) set @msg = error

regex - filter dates from dataframe -

i need remove kinds of dates ( mm-dd-yy , mm/dd/yyyy , dd.mm.yy , dd-mon-yyyy etc) .csv file using pandas dataframe. can filter method of use? for col in df.columns.values: pd.filter(regex = '(([1-9]|1[012])[-/.]([1-9]|[12][0-9]|3[01])[-/.](19|20)\d\d)|((1[012]|0[1-9])(3‌​[01]|2\d|1\d|0[1-9])(19|20)\d\d)|((1[012]|0[1-9])[-/.](3[01]|2\d|1\d|0[1-9])[-/.]‌​(19|20)\d\d)') e.g: if have .csv file various columns data , dates 10/12/2015 , 12/01/1995 , 2016-19-04 , 19th april,2016 , etc., output file must contain no dates. data sample column1 column2 column3 data 4th april,2016 data 4/20/2016 20-04-16 20.04.2016 data data 20-04-2016 4-apr-16 data 20/04/2016 as can see have various formats dates here. need remove them all. of course can use regex filter out dates, find way: pick first row of dataframe (assuming there no nan in df), initialize pandas.timestamp object each value of row. if success, corresponding column co

Is it possible to let android studio read resources in external folder with sourceSets? -

here sample of sourcesets code block in build.gradle sourcesets { main { manifest.srcfile 'androidmanifest.xml' java.srcdirs = ['src'] resources.srcdirs = ['src'] aidl.srcdirs = ['src'] renderscript.srcdirs = ['src'] res.srcdirs = ['res'] assets.srcdirs = ['assets'] } } what wanted achieve that. want read resources external folder. example in data/data/com.myapp/res . im not gradle api, can guide me of how it? the reason want because. client want update string translation dynamically. without need re-compile , re-download app. know not standard way of using multilanguage. don't want turn requirement down without effort , strong evidence. you misunderstanding purpose of sourcesets . source set used map source folders in project. not means point directories in installed app. update after reading reason: since want deal strings, easiest way

html - @media queries before or after class? -

i wanted know best practice media queries. if target screen size like: section#about { background-color: yellow; color: black; padding: 5px 20px; @media (max-width: 600px) { padding: 0; } } .button-small { margin-bottom: 12px; @media (max-width: 600px) { margin-bottom: 6px; } } would following better: section#about { background-color: yellow; color: black; padding: 5px 20px; } @media (max-width: 600px) { section#about { padding: 0; } } .button-small { margin-bottom: 12px; } @media (max-width: 600px) { .button-small { margin-bottom: 6px; } } instead of nesting @media queries inside classes, create standalone @media query , add class need changed? nb: sorry all, i'm using preprocessor (sass). i'm thinking of ways organize code legibility. media queries can't nested in pure css. css preprocessors (like less , stylus) allow that. css preprocessor take code you've given in example 1 (which invalid

aws cli - Finding the services running on multiple aws ec2 instances -

is there command in aws cli list of services running on ec2 instances? normally log each ec2 instance individually, , check using linux commands such "netstat" or "ps -eaf". there around 400 instances, if manually takes quite lot of time. if aws commands there find services running without logging instance, great. thanks in advance. you might have luck ec2 run command . docs: run command provides simple way of automating common administrative tasks executing shell scripts , commands on linux [...] run command allows execute these commands across multiple instances , provides visibility results

javascript - Make the full width of input field inside an xeditable using angularJS -

Image
how enable 100% width of each cell when in edit status xeditable plugin? i tried put these style <style> div[ng-controller] { margin: 10px; } .table {width: 100% } form[editable-form] > div {margin: 10px 0;} .editable-wrap { width: 100%; } </style> and option in angular app, couldn't work well. app.run(function(editableoptions) { editableoptions.theme = 'bs3'; }); here's demo page http://106.185.55.97:3001/ngadmin/admin.html#/admin/banks/index you can use simple css apply 100% width input .editable-controls input { width: 100% }

multithreading - Reading from a very large table using multiple threads (Java ) and writing them to a single file -

i facing situation have table 80 millions data , have take dump of table , store csv file. using not professional approach( perl script+dbi interface , printing values stdout , redirecting csv file). planning use java threading approach. can suggest way forward. in advance

Is there any way to understand if the card(emv or magnetic) is used first time at ATM or POS? For EMV card ATC is reliable? -

is there way understand if card(emv or magnetic) used first time @ atm or pos? emv card atc reliable? the "first time" different. you can ask atc after selection ( command 80ca9f5200 ) , if equals 0000 , processing options wasn't performed, means there wasn't transaction. bit if if > 0000, not mean "full" transaction on card. atc shows number of launch command processing options. for visa card can find specific bit in cvr ( cvr3, bit5 ) "new card". shows if successful online transaction performed card.

playframework - pac4j.core classes unresolved in intellij -

Image
i have cloned demo project pac4j play @ here . runs , display web interface @ port 9000 classes org.pac4j.core unresolved in intellij ide how import statements shown below build.sbt file name := "play-pac4j-java-demo" version := "2.2.0-snapshot" lazy val root = (project in file(".")).enableplugins(playjava) scalaversion := "2.11.6" librarydependencies ++= seq( "org.pac4j" % "play-pac4j" % "2.2.0-snapshot", "org.pac4j" % "pac4j-http" % "1.9.0-snapshot", "org.pac4j" % "pac4j-cas" % "1.9.0-snapshot", "org.pac4j" % "pac4j-openid" % "1.9.0-snapshot" exclude("xml-apis" , "xml- apis"), "org.pac4j" % "pac4j-oauth" % "1.9.0-snapshot", "org.pac4j" % "pac4j-saml" % "1.9.0-snapshot", "org.pac4j" % "pac4j-oidc" % "1.9.

css - Force group of thumbnails within div to break lines -

simply put have page: http://www.constantinos.org/portraits/ each set of thumbnails nextgen gallery , want make galleries break lines if needed not forced appear blocks in 1 line , galleries next each other instead of 1 per line. an image worth thousand words photoshopped example of i'd do: http://constantinos.org/example/screenshot%20from%202013-06-29%2018:01:23.png this css sets of thumbnails: #ngg-gallerysinglegallery { float:left; display: inline !important; clear: none; width: auto; } .ngg-gallery-thumbnail img { background-color: #ffffff; border: 0; display: block; margin: 4px 0px 4px 5px; padding: 4px; position: relative; } pfff. doing headings.. has suggestions? ok. problem have images grouped threes in ngg-galleryoverview divs. so, though floated, (both images , ngg-galleryoverview divs), images grouped in threes (you may need review box model bit). i don't know how galleries function—and may required markup them work properly—but that

vb.net - How to encrypt and decrypt string to base64? -

good day all, new vb.net programming. wanted encrypt , decrypt user passwords, came code below. imports system.security.cryptography imports system.text public class updatepass dim des new tripledescryptoserviceprovider dim md5 new md5cryptoserviceprovider function encrypt(stringinput string, key string) string des.key = md5hash(key) des.mode = ciphermode.ecb dim buffer byte() = asciiencoding.ascii.getbytes(stringinput) return convert.tobase64string(des.createencryptor().transformfinalblock(buffer, 0, buffer.length)) end function function decrypt(encryptedstring string, key string) string des.key = md5hash(key) des.mode = ciphermode.ecb dim buffer byte() = convert.frombase64string(encryptedstring) return asciiencoding.ascii.getstring(des.createdecryptor().transformfinalblock(buffer, 0, buffer.length)) end function function md5hash(value string) byte() return md5.computehash(asciiencoding.ascii.getbytes(value)) end function end

angularjs - Validating checkboxes angular -

how validate checkboxes, @ least 1 must checked, if not, there has message or alert <div class="form-group" ng-class="{ 'has-error' : actionsaddform.active.$invalid && !actionsaddform.active.$pristine }"> <label class="control-label col-sm-2">days*</label> <div class="col-sm-10"> <label>monday <input type="checkbox" ng-model="actions.value1"> </label> <label>tuesday <input type="checkbox" ng-model="actions.value2"> </label> <label>wednesday <input type="checkbox" ng-model="actions.value3"> </label> <label>thursday <input type="checkbox" ng-model="actions.value4"> </label> <label>friday <input type="checkbox&quo

android - Locating style animation for ImageView -

Image
i'm trying create animation imageview shows picture below (collected on stackoverflow). want because want shows when location locating. i've tried find keywords couldn't found anything. thanks. you can use wavedrawable library. available in github sample projects. https://github.com/alexrs95/wavedrawable compile 'me.alexrs:wave-drawable:1.0.0' import android.app.activity; import android.graphics.color; import android.os.bundle; import android.view.menu; import android.view.menuitem; import android.view.view; import android.view.animation.interpolator; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.imageview; import android.widget.spinner; import me.alexrs.wavedrawable.wavedrawable; public class mainactivity extends activity { private wavedrawable wavedrawable; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontent

java - Fetch Google+ emails from Google People API -

i'm doing this. listconnectionsresponse r = peopleservice.people().connections() .list("people/me") .setpagesize(500) // specify fields returned .setrequestmaskincludefield("person.names,person.emailaddresses") .execute(); it returns list of connections emails have added myself. not information gathered google+ profiles. possible fetch also? tried fetching individual resourcename, no email there. person p = peopleservice.people().get("people/xxxxx").execute(); the google people api fetch emails google+ profiles, public e-mails. if e-mail shows when view profile when not signed in, should show in response. however, e-mails not public shared account (e-mails can see if signed in) not visible through google people api privacy reasons.

reactjs - How to make page slide(change) with react-router -

i'v tried use react-router , reacttransitiongroup make navigation effect(page slide whereas route changes). however, it's error-prone , ugly.(made logic define direction slide , remove/add classes make transition work). i doubt there nice plugin use. here's piece of code, inspired hardware-accelerated page transitions mobile web apps / phonegap apps . const keyhistory = []; let dir = 0; const pagemixin = { componentwillappear(cb) { keyhistory.push(this.props.location.key); let $el = $(reactdom.finddomnode(this)); $el.addclass(pagestyles.right); $el.one('transitionend', () => { $el.removeclass(`${pagestyles.right} ${pagestyles.active}`); cb(); }); requestanimationframe(() => { $el.addclass(`${pagestyles.active} ${pagestyles.center}`); }); }, componentwillenter(cb) { let key = this.props.location.key, len = keyhistory.len

java - How to get path of windows system folders? -

Image
i have problem getting path system folders "my computer" , "library" , "home group" etc java. the problem path these files ::{xxxx-xxxxxx-xxxxxx} instead of simple path c://users ... path use filename.getpath() . how can normal path these files can work them other files? i recommend add folder class path. can add files ,images etc.

c# - Why upload to azure blob so slow? -

i have custom stream used perform write operations directly page cloud blob. public sealed class windowsazurecloudpageblobstream : stream { // 4 mb top limit page blob write operations public const int maxpagewritecapacity = 4 * 1024 * 1024; // every operation on page blob has manipulate value rounded 512 bytes private const int pageblobpageadjustmentsize = 512; private cloudpageblob _pageblob; public override void write(byte[] buffer, int offset, int count) { var additionaloffset = 0; var bytestowritetotal = count; list<task> list = new list<task>(); while (bytestowritetotal > 0) { var bytestowritetotaladjusted = rounduptopageblobsize(bytestowritetotal); // azure not allow write many bytes want // max allowed size per write 4mb var bytestowritenow = math.min((int)bytestowritetotaladjusted, maxpagewritecapacity); var adjustmentbuffer

if statement - R: Automated ifelse calculation in matrix for every row -

for large matrix [n,1], want find out every row, if value smaller 0.1 , if following value (in following row) bigger 0.1. ifelse(matrix[1,1]<0.1 & matrix[2,1]>0.1, "1", "0") ifelse(matrix[2,1]<0.1 & matrix[3,1]>0.1, "1", "0") ifelse(matrix[3,1]<0.1 & matrix[4,1]>0.1, "1", "0")` how can automate calculation every row? this vectorized: set.seed(6l); n <- 10l; m <- matrix(rnorm(n,0.1,0.01),ncol=1l); m; ## [,1] ## [1,] 0.10269606 ## [2,] 0.09370015 ## [3,] 0.10868660 ## [4,] 0.11727196 ## [5,] 0.10024188 ## [6,] 0.10368025 ## [7,] 0.08690796 ## [8,] 0.10738622 ## [9,] 0.10044873 ## [10,] 0.08951603 m[-length(m)]<0.1 & m[-1l]>0.1; ## [1] false true false false false false true false false if want actual row indexes: which(m[-length(m)]<0.1 & m[-1l]>0.1); ## [1] 2 7

ios - SpriteKit fps drops at first animation call -

i have function moves object , runs animation on move: func animatemove(move: moveto, completion: () -> ()) { let object = move.object let spritename = "\(object.spritename)\(move.direction.name)" let textures = texturecache.loadtextures(spritename) let animate = skaction.animatewithtextures(textures, timeperframe: moveduration/nstimeinterval(textures.count)) let point = pointforcolumn(move.column, row: move.row) let move = skaction.moveto(point, duration: moveduration) move.timingmode = .linear let group = skaction.group([move, animate]) object.sprite!.removeallactions() object.sprite!.runaction(group, completion: completion) } also have cacher: class texturecache { ... static func loadtextures(name: string) -> [sktexture] { let atlas = "\(name).atlas" return texturecache.sharedinstance.loadtexturesfromatlas(atlas, name: name) } private func loadtexturesfromatlas(atlas: string, name: string) ->

unit testing - How can I integrate my Maven Java application with SONARQube 5.4? -

already installed sonarqube successfully. running now. i'm following url click not working expected. i want integrate maven java appliacation sonarqube5.4 , mysql5.7.12. also need execute javascript unit testing using jasmine sonarqube exists in same application. please tell me steps follow.

php - PIVOT Table making columns dynamic -

Image
i know kind of question might have been asked before. but self not sure if doing right way have ask. i want below table in output empid name desig year q1 q2 q3 annual --------------------------------------------------------------------------------- 1 haider 0 2016 setup setup setup anotherstring 2 arif 1 2016 setup setup setup anotherstring but tables have in db are. employee table: empid name desig ------------------------------- 1 haider 0 2 arif 1 appraisal table id title ----------------- 1 q1 2 q2 3 q3 4 annual the values in appraisal table columns in output table(first table). i don't understand how can pivot. have seen examples not sure how have table setup this. plus there no year information in table. year displayed current year against every emp

ThingWorx: Join table in mashup grid -

Image
i have data model car has sensors . sensor thing alias object properties , cannot represented single column, want sensor represented name property of sensor object. how it? why don't build service returns infotable need, see that's infotable, inside infotable, make difficult manage through mashups. best regards, carles.

php - Symfony3 - FOSUserBundle - Roles attribution -

first of all, i'm french beg pardon poor english. i come cause here am, i'm starting first symfony3 project ! , got first problem: want use fosuserbundle manage users, dont want visitor able register. want administrator create users (i think can it), need in user creation form, administrator can assign role user. (just 1 role) here's problem: symfony3 changed lot in point, , solutions found dont match anymore. infact, add field collectiontype in /registration of fosuserbundle , put registration page under /admin/registration making administrators able create new users. change registration redirection make website dont think administrator visitor using form. idea? well, need give me code of "->add('role')" .. please :d. cause it's different used in symfony2. so, want like: // \fos\userbundle\form\type\registrationformtype.php $builder ->add('roles', collectiontype::class, array( 'entry_type' =>

javascript - "onrendered" in html2canvas not being called -

i using jspdf generate pdf html div. from_html not working using html2canvas function create pdf convert html base64 image , added canvas. don't see error in console, code in onrendered event not being executed. means onrendered not being called. not find wrong. searched lot no beneficial results. now have added 1 option html2canvas function "logging" : "true", see there log "95534ms html2canvas: document cloned" , after have 404 (invalid sid) post error. below code snippet : var doc = new jspdf('p','pt','letter'); widget.log('doc : '+doc+' jspdf : '+ new jspdf()); html2canvas( [divdocedit], { 'logging' : 'true', onrendered: function( canvas ) { alert("in onrendered"); console.log("canvas : "+canvas+" divdocedit : "+divdocedit); var imgdata = canvas.todataurl(); //var doc

check for and close firefox popup with batch file? -

Image
i have simple batch script opens firefox profile @echo off start firefox.exe -p default -no-remote sometimes profile opened , popup. is there anyway check if popup appeared , click close firefox button? or maybe theres piece of code can close firefox profile , play in begining of batch file know sure closed , dont popup. help. try sendkeys.bat : call sendkeys.bat "close firefox" "{left}{enter}"

javascript - phone number validation with only one "+" character in first place -

i want check following number in regex expressions, +78645435748675 87978976435 not valid below +944+4814674 464641+ 4+167464165 this work ^\+?\d+$ var regex = /^\+?\d+$/; var phonenumbers = ['+78645435748675', '87978976435', '+944+4814674', '464641+', '4+167464165']; phonenumbers.foreach(function(number) { document.writeln(number.match(regex) + '<br>'); });

javascript - How can I display (onload) an on/off button in html depending on a value in a mysql database? -

i want display onload (sort-of) toggle button depending on value inside table in mysql database (the table has 1 row) , when click it,i want change value in same table 0 1 or opposite. i've seen lot of answers on related questions non of them seem working me. needed. lot! here php code: <?php include 'db_ecoheating.php'; mysql_connect($dbhost,$dbuser,$dbpass) or die ("unable connect database"); mysql_select_db($dbname) or die ("unable select database"); $sql = "select coil1 coils "; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ $coil1 = $row['coil1']; } $arr = array( 'value1'=> $coil1, ); echo json_encode($arr); ?> also function in js (inlcuding jquery): function buttonfunctions(){ var x1=document.getelementbyid("coil1"); var value = $.ajax({ type: "get", url: "coils.php", data: query, dataty

javascript - Assembling the typescript with gulp-webpack -

Image
there test-project, structure: it files * .ts: ////// greeter.ts import {actionscollection} "./actionscollection"; class greeter extends actionscollection{ } var greeter = new greeter(); alert(greeter.greet("hello, world!")); ////// actionscollection.ts export class actionscollection{ public (){ } public greet(greeting :string) { return "<h1>"+greeting+"</h1>"; } } ///// newts.ts export class newts{ public foo (){ return "<h1>foo</h1>"; } } it gulpfile: var gulp = require('gulp'); var debug = require('gulp-debug'); var webpack = require('gulp-webpack'); gulp.task('default', function() { return gulp.src('ts/greeter.ts') .pipe(webpack({ output: { filename: 'main.js' }, resolve: { extensions: ['', '.webpack.js',

windows - External monitor stopped working -

my external monitor stopped working today after restart. found computer on during night. running win 10 64b on lenovo u430p. the monitor worked fine whole time. can see windows logo while booting, says no signal. when uninstalled video driver worked (login screen, desktop, res 800*600), until windows installed driver on it. tried getting newest driver both lenovo , intel, no results. did experience issue well? read people having new computer not happen blue , ususally @ least disabling video adapter helped. thanks! haven't found real solution , seems problem of intel graphic cards. however reverting basic driver windows can offer did trick uninstall driver rollback driver using wushowhide.diagcab utility ( https://support.microsoft.com/en-us/kb/3073930 ) disable updates video card drivers

django nginx gunicorn,, start: Job failed to start -

Image
every 1 trying deploying django project using nginx gunicorn,,but when run sudo service gunicorn start, said, start: job failed start, here working path,, the gunicorn.conf file /etc/init/gunicorn.conf description "gunicorn application server handling myproject" start on runlevel [2345] stop on runlevel [!2345] respawn setuid user setgid www-data chdir /home/parallels/books/mysite exec myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/parallels/books/mysite/mysite.sock mysite.wsgi:application when run gunicorn --bind 0.0.0.0:8000 mysite.wsgi:application i can see mysite running but when try sudo service gunicorn start fail,,, following instruction here any 1 can reply thank much i know late, in case: in gunicorn.conf see setuid user there user parallels in prompt (it depends of bash settings, name of curent user). there chdir /home/parallels/books/mysite , exec myprojectenv/bin/gunicorn , guess gunicorn

javascript - Multiple classes in one jquery initialization -

i'm using plugin http://www.jqueryscript.net/layout/responsive-equal-height-plugin-with-jquery-responsibleheight.html but don't know how make "child" multiple classes. here's code initialize plugin. here used plugin? copy , paste code , put different class under "child" bit redundant. there way can lessen code without using same code on , on again? thanks! //initialise plugin $('.item-container div').responsibleheight({ delay: 0, child: '.filter', widths: [ [1300, 10], [1000, 8], [700, 4], [40, 2], [0, 1] ] }); //destroy plugin, remove heights , stop working on resize $('.destroy').click(function(){ $('.item-container div').responsibleheight('destroy') }); //reinitialise plugin $('.reinit').click(function(){ $('.item-container div').responsibleheight('reinit')

android - Get Google Maps Navigation Instructions -

i'm looking way instructions maps navigation. think possible way read notification data placed @ top maps navigation. reason beleving way comes post . tried getting data onnotificationposted method, cant find directions data in statusbarnotification object... does have solution or better idea on how achieve this you can implement notificationlistenerservice in order retrieve content of google maps route direction. unfortunately maps not using common attributes within statusbarnotification. maps uses remoteviews display content. can send data via broadcast activity , add content existing view: remoteviews remoteview = intent.getparcelableextra(id); if (remoteview != null) { viewgroup frame = (viewgroup) findviewbyid(r.id.layout_navi); frame.removeallviews(); view newview = remoteview.apply(getapplicationcontext(), frame); newview.setbackgroundcolor(color.transparent); frame.addview(newview); }