Posts

Showing posts from September, 2015

c# - WebCamTexture not working on windows phone 10 -

i try open webcam of phone unity3d. mywebcameratexture = new webcamtexture(); mycameratexture.getcomponent<renderer>().material.maintexture =mywebcameratexture; mywebcameratexture.play(); when publish application on phone, camera not start. why? solution? try put plane, have render material still not working.

java - Regex doesn't work in String.matches() -

i have small piece of code string[] words = {"{apf","hum_","dkoe","12f"}; for(string s:words) { if(s.matches("[a-z]")) { system.out.println(s); } } supposed print dkoe but prints nothing!! welcome java's misnamed .matches() method... tries , matches input. unfortunately, other languages have followed suit :( if want see if regex matches input text, use pattern , matcher , .find() method of matcher: pattern p = pattern.compile("[a-z]"); matcher m = p.matcher(inputstring); if (m.find()) // match if want indeed see if input has lowercase letters, can use .matches() , need match 1 or more characters: append + character class, in [a-z]+ . or use ^[a-z]+$ , .find() .

itext - Showing an error while using XMLWorkerHelper -

i trying convert html data pdf. have used xmlworker-5.5.6.jar. while executing code showing error of missing resources. can please help. in advance. here code document document = new document(pagesize.letter); pdfwriter pdfwriter = pdfwriter.getinstance(document, new fileoutputstream(new file(filepathpdf))); document.open(); document.addauthor("me"); document.addcreator("me"); document.addsubject("thanks support"); document.addcreationdate(); document.addtitle("please read this"); xmlworkerhelper worker = xmlworkerhelper.getinstance(); string str = sb.tostring().substring(sb.indexof("<html"),sb.length()); system.out.println(str); worker.parsexhtml(pdfwriter, document, new stringreader(str)); document.close(); system.out.println("done."); and here error : 08-24 12:28:42.079 14077-15044/com.abc.abc e/androidruntime: fatal exception: asynctask #5 ...

javascript - How to ignore case (upper/lower) while triggering change for select in jquery? -

please see code below: <html> <head> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> </head> <body> <select> <option>one</option> <option>two</option> <option>three</option> <option>four</option> <option>five</option> </select> <script> $("select").val("two").trigger("change"); </script> </body> </html> in case option not set value "two" . if change : $("select").val("two").trigger("change"); then works. how can ignore case while triggering change select? $("select").val("two".tolowercase()).trigger("change"); make value in lowercase , able check not matter upper or lower case in string

android - App Crashes. Error Inflating XML. Cant find image because xxxhdpi folder is not there -

switched eclipse project android studio. maintaining resources under drawable-mdpi folder only. in studio preview of xml loads images correctly. when run app in device resolution higher mdpi app crashes, shows error inflating binary xml. after long analysis found issue device trying load images corresponding density folder not available. created folder drawable-xhdpi , put images in folder. app works fine. why android studio can't pick image other density drawable folder , resize possible eclipse. can't maintain 5 different drawable folders because there lots of images. you have add "drawable-hdpi" resource directory , paste hdpi resources there because 70% android devices supports hdpi resolution images. if maintain hdpi, ok. android manages remaining resouces hdpi resouce directory.

excel - How to open file using Open File Dialog -

i've been searching on web solution on how open file using open file dialog in vbscript. can point me on right track? my code below opens excel file wanted more dynamic in terms input file name can change , not hard coded. set objexcel = createobject("excel.application") objexcel.displayalerts = 0 set objshell = wscript.createobject("wscript.shell") path = objshell.currentdirectory infilename = "inputfile.xlsx" infilepath = path + "\" + infilename 'open target workbook set objworkbook1 = objexcel.workbooks.open(infilepath, false, true) msgbox "reading data " & infilename & vbnewline, vbokonly + vbinformation, _ "reading data" when in doubt, read documentation . set dialog = objexcel.filedialog(3) dialog.allowmultiselect = true dialog.show each f in dialog.selecteditems set objworkbook = objexcel.workbooks.open(f) '... stuff ... objworkbook.close next

git - Use merge operation in gradle (using grgit) -

i want merge branch branch in git using gradle git (grgit) plugin. branch merged first branch , branch first branch merged second branch. so, merge operation this: def grgit = org.ajoberstar.grgit.grgit.open(dir: project.parent.projectdir) grgit.checkout(branch: 'origin/first') grgit.merge(head:'origin/second',mode: org.ajoberstar.grgit.operation.mergeop.mode.only_ff) it builds fine doesnot merge operation. idea?

mysql - How to get json array and insert in the database. php -

i have table on invitation. passing data in json format postman. i want send many invitations @ time. want insert multiple invitations. how can this? i have created single invitation. invitaion : class invitation { private $sender_id,$date,$invitee_no,$status; function invitation($sender_id,$date,$invitee_no,$status) { $this->sender_id = $sender_id; $this->date= $date; $this->invitee_no = $invitee_no; $this->status = $status; } function sendinvite() { $database = new database(contactsconstants::dbhost,contactsconstants::dbuser,contactsconstants::dbpass,contactsconstants::dbname); $dbconnection = $database->getdb(); $stmt = $dbconnection->prepare("select * invitation invitee_no =?"); $stmt->execute(array($this->invitee_no)); $rows = $stmt->rowcount(); if($rows > 0) { $response = array("status...

osx - I install gcc5.3.0 on my mac, and I broke it. What should I do to reuse apple-gcc42? -

i used rm -rf delete gcc5.3.0, mac continues use gcc5.3.0. wrong message: g++: error trying exec 'cc1plus': execvp: no such file or directory what should reuse apple-gcc42? editing comments , responses answer. where gcc 5.3.0 installed? did come from? did create or apple, or 1 of auxilliary packagers? did recursive remove remove anything? running xcode-select help? (use man xcode-select see does; maybe xcode-select --install useful, i'm not sure since i've never destroyed compilation system that.) version of xcode have installed? version of mac os x running? gcc5.3.0 installed @ /usr/local/libexec/gcc/x86_64-apple-darwin15.0.0/5.3.0 . removed folder gcc . mac os x 10.11.6 , xcode 7.3.1. removing /usr/local/lib/libexec/gcc didn't remove executables /usr/local/bin , when run g++ , shell still finding executable /usr/local/bin/g++ , not finding auxilliary programs because did manage remove them. haven't cleaned headers installed und...

ruby - Retrieving only the sixth and seventh matching results in a Rails table -

i working on rails app, , hitting roadblock: need return several items in table are, say, 6th-8th matching items. ironically, rails has helper method shown here .first through .fifth. my question is: how can find these results when n searching 6,7,8 , on without calling of 1st through 8th items? here's why doing this. making home page blog. @ top, want show 5 recent posts (which shown image). underneath them, want show additional 3 links posts text. currently, doing first part fine. in blog.controller.rb : @posts = post.order('created_at desc').first(5) i iterate through posts in view, , shows first 5 recent results. want show 6th-8th, , try , store them in new method. change controller to: @posts = post.order('created_at desc').first(5) @texts = post.order('created_at desc').limit(8) this returns 8 recent posts instead of, say, 8th. is possible me limit @texts show matching 6th, 7th, , 8th results? yes. you'...

java - Jenkins: JDK configuration -

i have both java 1.7 , 1.8 installed in virtual cent os. installed jenkins , running fine dont know version of java using. how can detect that? what configuration file of jenkins setup jdk version manually? edit: ** dont want configure jdk global tool configuration of manage jenkins first, determine process id of jenkins (e.g., ps aux | grep jenkins ) then check corresponding exe entry in /proc file system : $ ls -l /proc/2884/exe lrwxrwxrwx 1 user users 0 aug 24 08:08 /proc/2884/exe -> /usr/lib/jvm/java-8-jdk/jre/bin/java for selecting java version, depends on how start jenkins. if start command line, proper setting of path , java_home sufficient. if use service file ( /etc/init.d/jenkins , or systemd approach), depends on implementation of service.

javascript - How to upload more than 2 files by Dropzone.js with button -

i make simple form uploading files. form can add multiple files queue. special button can remove file queue. reason doesn't work in way want. clicking "unload files" 2 files uploading server. if click second time second 2 files uploading. code below. how upload files click button ones? in advance. html: <div class="panel panel-default"> <div class="panel-heading"> <strong>Прикрепить файлы</strong> </div> <div class="panel-body"> <button type="button" class="btn btn-primary" id="add-file"> <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></span> Обзор... </button> <button type="button" class="btn btn-primary" id="upload-file"> <span class="glyphicon glyphicon-folder-close" aria-hidden="true"></spa...

html - Load different background image without loading default -

my rails project has default pattern background pages. i'm trying set root page whole-screen background image. upon loading, works expected. however, when opening page 1 can see two-step delay page first opens default colorful background, , lays image on page. there way can not load default background on 1 view in order avoid two-step view during loading? i have given root view (static_pages#index) #landing-page id. css: #landing-page { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: url(ripples.jpeg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } body { background: url('congruent_pentagon.png'); } if first background comes body, solution add different classes main , other pages body in layout <body class="<%= current_page?('/') ? 'main-page' : 'page' %>"> and in c...

objective c - Calling/Executing applescript commands from a ios xcode project -

so in ios xcode project, trying call applescript code xcode. know possible os x possible ios? instance in os x can execute applescript code using nsapplescript . there equivalent function in ios project? i appreciate can get. thanks. applescript not supported in ios. if want open application app can consider using url scheme of app (if registers one). more info can found @ : https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/inter-appcommunication/inter-appcommunication.html#//apple_ref/doc/uid/tp40007072-ch6-sw2

angular - How to use PayPal SDK Cordova Plugin in ionic2 -

can 1 tell how import , implement paypal cordova plugin in ionic2. i had install plugin using cordova plugin add com.paypal.cordova.mobilesdk paypal cordova plugin on github paypal official developer cordova plugin

javascript - force form submit button click with jquery -

trying trigger submit functionality jquery. doing wrong? in theory, should work. i've tried 4 different ways though. i have tried $('input#submit').trigger("click"); $( form:first ).submit(); $( form:first ).trigger("submit"); $('form#databaseactionform').submit(); nothng has worked (yet)?! code: <html lang="en"> <head> <title>database management</title> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <script src="http://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-ccuebr6csya4/9szppfrx3s49m9vuu5bgtijj06wt/s=" crossorigin="anonymous"></script> <style> table td { border: 1px solid black; } table td:first-child { text-align: left; } </style> <script> <!-- $(document).ready(function() { $('#...

reporting services - How to make report on 2016 SSRS Report Server and upload it to 2014 SSRS Report Server? -

Image
it seems there not backward compatibility option upload new version report older version server. this 2 step process. on project properties page, set targetserverversion sqlserver 2008 r2, 2012 or 2014 deploy bin folder of project. (if manually deploying/uploading). when building report, vs2015 create rdl file in \bin directory targets correct version of ssrs you can right click | deploy project if settings above have relevant values

active directory - Using group policy migration table does not catch all occurrences -

Image
i'm trying use group policy migration table editor make conversion table import job... and can see below, results positive can't seem account occurrences in policy. what doing wrong?

c# - Project a Query onto an anonymous Dictionary<string,int> -

i trying check if entity in database has foreign key relations, can inform user entity can or cannot deleted. i understand can done in rolled transaction, inform user how many references , assist in decision delete entity. i trying avoid loading entire navigation collection memory data may large. so, in light of this, can formulate simple query firstly determine if there references: private bool candeletecomponent(int compid) { var query = _context.components.where(c => c.componentid == compid) .select(comp => new { references = comp.incidents.any() && comp.drawings.any() && comp.documents.any() && comp.tasks.any() && comp.images.any() && comp.instructions.any() }); var result = query.firstordefault(); if (result != null) { return !result.references; } return true; } this performs series of select count...

node.js - Using named streams with clis without support for stdin -

i'm using following code read pdf web , pass pdftotext without saving in local file system: const source = 'http://static.googleusercontent.com/media/research.google.com/en//archive/gfs-sosp2003.pdf' const http = require('http') const spawn = require('child_process').spawn download(source).then(pdftotext) .then(result => console.log(result.slice(0, 77))) function download(url) { return new promise(resolve => http.get(url, resolve)) } function pdftotext(binarystream) { //read input stdin , write stdout const command = spawn('pdftotext', ['-', '-']) binarystream.pipe(command.stdin) return new promise(resolve => { const result = [] command.stdout.on('data', chunk => result.push(chunk.tostring())) command.stdout.on('end', () => resolve(result.join(''))) }) } in example, work because pdftotext supports stdin, if wasn't case, do? write named streams, didn't f...

reactjs - Rendering Firebase Data in React -

i'm looking render firebase data homefeed component. update state in componentdidmount method. can see looks below. it's array. should map on using map function? how access specific info "title", "link", "type", etc. able render it? thanks lot! var react = require('react'); var rebase = require('re-base'); var base = rebase.createclass("https://nimbus-8ea70.firebaseio.com/"); // todo: render firebase data screen. // home // <home /> var homecontainer = react.createclass({ render : function() { return ( <div classname="homecontainer"> <homefeed /> </div> ); } }); // home feed // <homefeed /> var homefeed = react.createclass({ componentdidmount: function() { base.fetch('article', { context: this, asarray: true, then(data){ console.log(data);...

What is this weird dynamic method dispatch behavior inside a static method in Java -

this question has answer here: what difference between method overloading , overriding? [duplicate] 2 answers how covariant parameter types work in java 1 answer the utility method in below example illustration purposes only. in example below, instance method invocation dispatched reference type not run-time object. import java.sql.timestamp; import java.util.date; public class dynamicmethoddispatchex { public static void main(string[] args) { timestamp = new timestamp(system.currenttimemillis()); timestamp beforenow = new timestamp(now.gettime() - 1); system.out.println("finding newest in " + + " , " + beforenow); system.out.println("attempt 1: " + staticfindnewer(beforenow, now)); system.out.prin...

javascript - Google Maps API multiple times on this page - Modal Bootstrap Return Json Success -

Image
the problem when open modal bootstrap carries google maps. modal bootstrap - _edit.cshtml <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">editar</h4> </div> @using (ajax.beginform("edit", "account", new ajaxoptions { httpmethod = "post", onsuccess = "onmodalsuccess" }, new { @id = "modalformid", @class = "form-horizontal", role = "form" })) { @html.antiforgerytoken() <div class="modal-body"> <div class="form-horizontal"> @html.validationsummary(true, "", new { @class = "text-danger" }) <div class="form-group"> <div class="col-xs-6"> ...

vb.net - Universal Windows Reference is pointing to wrong file -

i have windows universal app in process being made in visual studio 2015 express windows 10 on windows 10 machine. program written entirely in vb.net , xaml forms. yesterday, out of blue, whole bunch of errors came referring x:name's in .vb files using xaml objects names in vb file various things. traced problem universal windows reference pointing different file should. pointing sort of voip calling reference, besides point. i tried add reference path project using correct folder did not work. tried delete reference program not allow me because says reference put in editor , can not removed. have confirmed have correct files on computer , other projects reference's work. did repair on visual studio hoping solve problem, did not. i thinking problem particular project , @ point forced make new project , import various files , sort of start on fresh project solution. i'm seeing if there better way fix situation. all comments , appreciated. edit : adding sc...

music - Chords in MIDI? -

i'm looking way represent chords in midi file. note i'm not looking represent chord voicings. can trivially done multiple note-on messages. if that, have sort of note-on chord analysis every time read midi file in, , that's major nuisance since know chord structures when write file. rather, i'm looking more akin guitar tablature or fake books. is, want record "c" or "cm" or "i" or "i" or “iii7" @ particular point in time. so questions... is there standard way this? (i'm not finding one, don't know current spec thoroughly.) is there non-standard way of doing this? i'm considering using "tag" facility of lyric/display meta event. appears though can invent {@chord=cm} , should transparent reader, past, present, or future, doesn't understand usage. reading standard right? reasonable, private, non-standard extension? the midi specification provides values such "note on...

php - Phalcon is not recognised as an internal command -

Image
i'm trying install phalcon first time on windows 8.1. made right config , saw phalcon ext in phpinfo() . want install tools of phalcon. i installed them in documentation page: https://docs.phalconphp.com/en/latest/reference/wintools.html , wrong. should output: and output: is wrong output? have change something? can't find folder created phalcon models, controllers , views on pc. phalcon create folder or have create 1 myself? in first tutorial says create files inside controller or model or view folder, these folders located?

sql server - SSRS - "Content" field doesn't update for data source when connection string is updated? -

i'm building ssrs audit checks "content" field in reporting database's catalog table. i've noticed when data source's connection string updated different server or db after being deployed, content field in database continue showing old connection string - however, other fields such name or path update immediately. haven't been able find online - has experienced similar? my environment ssrs 2012 & sql server 2012. the query i'm using read content is: select convert(varchar(max), convert(varbinary(max), substring(convert(varbinary(max), content), 4, len(convert(varbinary(max), content))))) content catalog type = 5

java - How is the DTO objects transferred from client to server in spring-struts web application without implementing serializable -

i have web application developed using spring - struts framework deployed in tomcat 8 server. application hosted in 1 server. the application code layered action | bpo | dao | dto | entityobject only few dto classes implements serializable interface dto objects being written file using ehcache caching state. do need implement serializable interface dto classes? with reference below link says not necessary implement serializable dto classes. dto implementation of serializable interface if how dto object gets transferred client side server side without serialization? the serializable used java.io , it's needed if want keep objects in session. other frameworks using serializable behind scene perform serialization. if don't know object serialized using java.io.serializable better add interface dtos. the client-side might use other serialization json, xml, etc., doesn't affect processes running serialization on server-side , should handl...

php - htaccess: friendly url - trailing slash and "fake subdirectories" -

i want make fake-subdirectories htaccess ( fakefolder/forget-password rewrite mod), doesn't working me... i have url: parent-directory/index.php?version=1&do=forget-password&email=example@domain.com&token=85085ab92fcfd5dada280c73f7f494ec * note: 'email' variable being verified mysql, , use filter_var in case value email can username instead ( email=username ). parent-directory real directory. version dynamic, , can 2 or 3 or string, , show different result, in case version=1 fakefolder . version=2 , other value can else ( fakefolder2 ) and htaccess code: options +followsymlinks -multiviews rewriteengine on # set configuration file php_value auto_prepend_file configuration.inc.php # start rewriting rewritebase /parent-directory/ rewritecond %{script_filename} !-d rewritecond %{script_filename} !-f rewriterule ^fakefolder$ index.php?version=1 [qsa,l] if try make this: rewriterule ^([a-z])$/forget-password$ index.php?version=$1&do=fo...

Google Plus PHP Login -

i trying make google+ login php, working there piece of code: if(isset($_get['code'])) { $client->authenticate($_get['code']); $_session['access_token'] = $client->getaccesstoken(); $redirect = 'http://'.$_server['http_host'].$_server['php_self']; header('location:'.filter_var($redirect, filter_sanitize_url)); } and when put localhost/?code in url gives me error : fatal error: uncaught exception 'invalidargumentexception' message 'invalid code' is there way handle ?

Append to an existing array of JSON objects on file using rapidjson -

i have array of json objects similar below: [ {"hello": "rapidjson", "t": true, "f": false, "n": null, "i": 2, "pi": 3.1416}, {"hello": "rapidjson", "t": true, "f": false, "n": null, "i": 12, "pi": 3.88}, {"hello": "rapidjson", "t": true, "f": false, "n": null, "i": 14, "pi": 3.99} ] my application spits out bunch of json objects need add json file every 30 seconds lets say. each round need append same file , add new json objects array of json objects have. first entry of each json file json schema. the problem facing not know how each time read previous file , add new objects array of existing objects in file , write updated file. could please provide me guidance needs done? or point me couple o...

java - How to load LinkedHashMap Values into Hashtable -

i have following code: clienttablelist = new object[dbqueries.getallclients().size()][3]; [i want load 3 records now] linkedhashmap<string, linkedhashmap<string, string>> clienthashmap = dbqueries.getallclients(); system.out.println(clienthashmap.keyset()); //printing values system.out.println(clienthashmap.values()); results: [bob hope, elena hairr, blossom kraatz, loreen griepentrog] [{userid=2345, givenname=bob, familyname=hope, dateofbirth=august 30, 1963, namesuffix=sr, nameprefix=, email=francoise.rautenstrauch@rautenstrauch.com, phone=519- ... i need load jtable , next code is: for (int = 0; < clienthashmap.size(); i++) { clienttablelist[i] = new object[] { clienthashmap.get("givenname") + " " + clienthashmap.get("familyname"), clienthashmap.get("loginemail") + " ", clienthashmap.get("phone") + " " }; but i'm getting null clienttablelist ...

javascript - What's wrong with this DIV background image assignment? -

var bgimages ='myimage.png' var pathtoimg=new array(), i=0 pathtoimg[0]=new image() pathtoimg[0].src=bgimages document.body.background=pathtoimg[i].src // above works however, when attempted change "body" element "div" id of "slide" fails, fyi, div exists document.getelementbyid('slide').style.background-image = pathtoimg[i].src or what's correct syntax setting div background imagine dynamically? thanks. addition, full code // image slideshow script 2 var bgimages=new array() bgimages[0]="paper-n.jpg" bgimages[1]="kn-n.png" // bgimages[2]="img3.jpg" //preload images var pathtoimg=new array() (i=0;i<bgimages.length;i++){ pathtoimg[i]=new image() pathtoimg[i].src=bgimages[i] } var inc=-1 function bgslide(){ if (inc < bgimages.length-1) inc++ else inc=0 // document.body.background=pathtoimg[inc].src document.getelementbyid('slide...

apache - nginx rewrite wildcard subdomain to base php file -

i trying create sub domain each user.so pointed wildcard subdomain server.my server running nginx , php-fpm.all subdomains username.site.com/page should rewrite to /index.php?user=username&page=page i new nginx please me.i found out , how apache in link how let php create subdomain automatically each user? , please explain can modify needs.i tried apache nginx rewriter , doesn't works.

linux - Get IP Address for a specific network interface on Ruby -

i need ip address each of network interfaces. issue standard ruby method socket.ip_address_list returns me adress list, no information interface corresponds ip address. #<addrinfo: 127.0.0.1> #<addrinfo: 192.168.13.175> #<addrinfo: 172.17.0.1> #<addrinfo: ::1> #<addrinfo: fe80::4685:ff:fe0d:c406%wlan0> i looking equivalent of nodejs os.networkinterfaces()[interfacename] . how can know ip address specific network interface? please let me know if there's way information using ruby 1.9.x i updated ruby 2.3 version , used socket.getifaddrs (available since ruby 2.1). require 'socket' addr_infos = socket.getifaddrs addr_infos.each |addr_info| if addr_info.addr puts "#{addr_info.name} has address #{addr_info.addr.ip_address}" if addr_info.addr.ipv4? end end output: $ ruby2.3 getinterfaces.rb lo has address 127.0.0.1 wlan0 has address 192.168.13.175 docker0 has address 172.17.0.1

asp.net mvc - Pass server data into root App class of Aurelia app -

when using aurelia, best way dynamic server data root view model class without having make second trip server? below super simple example: body of root view <body aurelia-app> <script src="/path/to/system.js"></script> <script src="/path/to/config.js"></script> <script> system.import('aurelia-bootstrapper'); </script> </body> app.js export class app { name; constructor() { } } app.html <template> ${name} </template> if name value coming server, how can value root app class without having make second trip server? there syntax/capability in aurelia allows pass dynamic data constructor of root class via html attributes? maybe (asp.net mvc syntax used below)? <body aurelia-app params="name: '@model.name'"> and can received via constructor this: export class app { name; constructor(name) { this.name = name; } } i've see...

javascript - React-router: Refreshing the child page contents with hashHistory.push -

i'm working on spa uses react router so: <router> <route path="/" component={base}> <indexroute component={home}/> <route path="features/:id" component={single} /> </route> </router> i have component attached base supposed update contents of single via: hashhistory.push(`features/${val.value}`); the page url updates once in child route, change hashhistory doesn't cause child state update. ideas how can reload content here? you need add componentwillreceiveprops lifecycle method . respond prop changes render s except initial one. recall coming router prop. // example: feature id changed in url componentwillreceiveprops(nextprops) { if (this.props.params.id !== nextprops.params.id) { this.setstate(...); } }

javascript - How to validate the summation of textboxes values in the client side -

if have group of textboxes group 1 , , group of textboxes group 2 .both of them in edit template of grid view want validate the summation of first group equal summation of second group in client side allow save or add . ex: txt1 txt2 txt3 txt4 i want validate : decimal.parse(txt1.text)+ decimal.parse(txt2.text) = decimal.parse(txt3.text )+ decimal.parse(txt4.text) note: one or more of these text boxes may empty , in case consider value 0 how thing using asp.net validators . you can use customvalidators. https://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.customvalidator.aspx below little example started. can expand mycustomvalidation include checking non-integer values, min-max ranges etc. <asp:textbox id="textbox1" runat="server" validationgroup="mygroup"></asp:textbox> <br /> <asp:textbox id="textbox2" runat="server" validationgroup="my...

Spark flatMapToPair vs [filter + mapToPair] -

what performance difference between blocks of code below? 1.flatmaptopair: code block uses single transformation, having filter condition inside of returns empty list, technically not allowing element in rdd progress along rdd.flatmaptopair( if ( <condition> ) return lists.newarraylist(); return lists.newarraylist(new tuple2<>(key, element)); ) 2.[filter + maptopair] code block has 2 transformations first transformation filters using same condition above block of code transformation maptopair after filter. rdd.filter( (element) -> <condition> ).maptopair( (element) -> new tuple2<>(key, element) ) is spark intelligent enough perform same both these blocks of code regardless of number of transformation or perform worse in code block 2 these 2 transformations? thanks actually spark perform worse in first case because has initialize , garbage collect new arraylist each record. on large number of records can ad...

javascript - Encrypt only json key value and get response of whole json object with keyvalue encrypted -

iam trying encrypt key value of json object using nodejs app.iam using crypto node module.i pass json object(it can basic or complexi.e.,inside value can again have key value pair) response should same json in same format give initially,but key value should enctyped. in code have encrypt function encrypt data.here should pass keyvalue function,which iam able , encrypted data.iam using each i.e for(var exkey in jsondata) , passing each key value function.and again framing in json format using code. var jsondata=json.parse(req.headers.jsondata); var enc=null; for(var exkey in jsondata) { var encryptdata=encrypt(jsondata[exkey]); if(enc!= null) enc= enc+","+ '"'+ exkey+'"'+":"+encryptdata; else enc="{"+'"'+exkey+'"' +":"+encryptdata; } enc=enc+"}"; this fine if using basic json.but if using complex(eg.,inside keyvalue other key value pair) not work since need see whether having...

How to grant disabled permissions on a user in mysql -

Image
for testing, had unchecked insert, update , delete permissions on data in phpmyadmin. now when tried enable permissions again, getting follow error: can please guide me how enable privileges again? i facing problem in xampp on mac. there many solutions provided in various posts, no 1 fixing problem. updating answer, may else fix problem. steps followed are: stop mysql server in xampp sudo /applications/xampp/xamppfiles/bin/mysql.server stop edit my.cnf skip grant privileges user sudo vi /applications/xampp/xamppfiles/etc/my.cnf add skip-grant-tables @ end of [mysqld] section restart mysql server sudo /applications/xampp/xamppfiles/bin/mysql.server restart connect mysql server (username , password not required) mysql type following commands respectively: update mysql.user set grant_priv='y', super_priv='y' user='root'; flush privileges; grant on *.* 'root'@'localhost'; now go :)

regex - How do I make vim substitute repeat until there are no more matches? -

i have file text looks {\o h}{\o e}{\o l}{\o l}{\o o} {\o w}{\o o}{\o r}{\o l}{\o d} i want make text this {\o hello} {\o world} there multiple tools can use solve problem, trying use vim substitutions. far, have :%s/{\\o \(.\{-}\)}{\\o \(.\{-}\)}/{\\o \1\2}/g the patterns here are .\{-} match characters, non-greedy {\\o .\{-}} match regex string {\o .*} being non-greedy .* and \( ... \) creates capture groups backreferencing. when run substitution once, {\o he}{\o ll}{\o o} {\o wo}{\o rl}{\o d} i could run command 2 more times get {\o hell}{\o o} {\o worl}{\o d} and then {\o hello} {\o world} but love if there way 1 command, i.e., tell vim substitution keep passing on file until there no more matches. seems me ought possible. does know magic need add achieve this? doesn't there's flag achieves this. maybe trick don't know labels? sub-replace expression method you can use sub-replace-expression, \= , execute second subst...

C++ string literal type and declaration -

two types of declaration: char* str1 = "string 1"; and char str2[] = "string 2"; my compiler doesn't allow me use first declaration error incorrect conversion const char[8] char*. looks okay, version this: const char* str1 = "string 1"; passed compiler. please clarify understanding. believed if declare both versions e.g. in main(), first 1 (const char*) - pointer allocated on stack , initialized address in data segment. second version (char[]) - whole array of symbols placed on stack as far see string literal have const char[] type. using of const char* depricated? c compatibility only? where each version store string ? char str2[] = "string 2"; "string 2" string literal const char[9] stored in read-only memory. char str2[] allocate char array (of size deducted initializer size) in read-write memory. = use string literal initialize char array (doing memcpy of "string 2" content)....

java - Are ehcache putAll Operations Thread Safe and Atomic? -

the documentation says ehcache thread safe. far understand if thread a updates cache updates visible other threads. but wonder if putall operation thread safe , atomic? say, want update cache invoking putall , passing map actual values. say, want value cache while being updated. receive old value or wait till cache updated , receive new value? an operation atomic when operation can performed entirely or not performed @ all. according interface ehcache putall operation not atomic. this method throw nullpointerexception if null element or null key encountered in collection, , partial completion may result (as of elements may have been put). regarding if ehcache threadsafe or not. ehcache designed threadsafe. take example cache implementation. cache threadsafe. but beware threadsafe not mean synchronized. what's difference? threadsafe means class can used multiple threads without errors or problems. synchronized means 1 or more methods can use...

Creating pop-up terminal for bash script in python -

so following bit of novice code serves purpose problem being bash script runs within terminal i'm using run rest of python script, if can find way have script run in new terminal without closing when done, appreciate it. thanks. elif request.lower() == "request arpscan": print("would run ""arpscan""?") arpscananswer = input('>>') if arpscananswer.lower() == "yes": subprocess.popen("/badmuffin/scripts/arpscanall") print("success, moving hub")

atg dynamo - Atg dyn exception -

i face below error while trying run http://localhost:7103/dyn/admin/ atg 10.1.2 on windows 7 dyn/admin the detailed exception is: java.io.ioexception: cannot run program "javac": createprocess error=87, parameter incorrect this appear because windows has limitation on command parameter lenght please advice how solve issue. according atg support site: oracle commerce atg convert jhtml pages java servlets , compile them class files using javac java compiler. default, javac executable invoked perform page compilation. these errors point low level problem invoking javac compiler. error=87 problem on weblogic 12 has many different libraries in nested directories. the solution (which works me on atg11.1 , weblogic 12.1.3) is edit or create files <atg_home>/localconfig/atg/dynamo/servlet/pagecompile/pageprocessor.properties <atg_home>/localconfig/atg/dynamo/servlet/pagecompile/extendedjhtmlpageprocessor.properties (i prefer crea...

javascript - How to run a script once error handlers for all script tags have finished? -

i have few resources load defer cdn, so: <script src="js/sri-fallback.js"></script> <script defer src="https://code.jquery.com/jquery-3.1.0.min.js" integrity="sha256-ccuebr6csya4/9szppfrx3s49m9vuu5bgtijj06wt/s=" data-fallback="js/jquery.min.js" crossorigin="anonymous" onerror="resource_error(this)"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" defer data-fallback="js/bootstrap.min.js" integrity="sha384-tc5iqib027qvyjsmfhjomalkfuwvxzxupncja7l2mcwnipg9mgcd8wgnicpd7txa" crossorigin="anonymous" onerror="resource_error(this)"></script> <script src="js/do_jquery_stuff.js" defer></script> sri-fallback.js script trying use automatically handle failure when loading cdn (such incorrect hash or cdn being down). looks this...