Posts

javascript - jQuery method that disallows input of certain chars -

i'm trying make jquery method delete wanted chars selected elements. for example: $("input").disallowchars(/\d/g);// should disallow input of non-digit elements in input elements this how thought it, doesn't seem work: $.fn.disallowchars = function(regexp){ this.keyup(function(){ var value = $(this).val(); value.replace(regexp, ""); $(this).val(value); }); return this; }; $("input").disallowchars(/\d/g); i'm total newbie @ this, how can make work. thanks you use string.fromcharcode() , keypress event instead: $.fn.disallowchars = function(regexp){ return this.keypress(function(e){ if(string.fromcharcode(e.which).match(regexp)) return false; }); }; demo but doesn't disable characters paste in input using mouse or paste keyboard shortcut. on modern browsers, use input event, or change keyup paste mouseup (ya mouseup, handle dropped text too): $.fn.disallowchars = function(...

php - MySQL: on resetting an auto_increment option -

this question has answer here: how reset auto_increment in mysql? 18 answers when creating mysql database, how can modify auto_increment option number can start last one? for example, have table created query. create table tablename (uid int(11) primary key auto_increment, ... ); if add data table consecutively, each data have own uid starting 1. if delete last data uid value of 3 , add new data, new 1 have uid value of 4, not 3. i want know how make new data have 3 uid. after deleting record have fire following query on database alter table tablename auto_increment = value; where value 'id' of deleted row. when next time add record take deleted rows id primary key

java - Unable to run JUnit test in IntelliJ -

i wanted start project using tdd. created test directory , later changed package integrated src direcotry. in both cases same error: class not found: "tests.objectstest" i tried different techniques of importing junit jar , none solved problem. tried rename test class gives no solutons whatsoever. it seems intellij or junit changes name of test class. shouldn't "objectstest.tests"? i using junit version 4.12 , latest intellij eap. edit project structure: project: -.idea -src -logic -objects -tests -test -test.java src , tests directories marked source , test. every package except test empty. on other pc intellij community edition works fine on eap there bug. unfortunatelly have use eap. test.java code: package test; import org.junit.test; public class test { @test public void cancreateinhabitant(){ } } check root directory of classes. must marked source (for java classes) or test (for java test classe...

hadoop - HDP on Windows Server 2012 R2 Single Node Installation Error -

i trying install hortonworks data platform (hdp) 2.2.6.0 hadoop on windows server 2012 r2, following quick start single node , failing. settings using virtual box windows server 2012 r2. java, python, etc. set. running administrator account. have run installer using cmd.exe admin. i un-checked "install ranger" installer. ignored part of installation (by un-checking lzo codec in installer): when deploying hdp lzo compression enabled, add following 3 files (in hdp windows installation zip) directory contains hdp windows installer , cluster properties file: - hadoop-lzo-0.4.19.2.2.6.0-2060 - gplcompression.dll - lzo2.dll the cluster proprieties txt can found here: https://pastebin.mozilla.org/8838912 . error install log, see error: create-user: creating user hadoop create-user: setting password hadoop hdp-ps failure: write-log : create-user failure: exception calling "setinfo" "0" hdp-ps failure: argument(s): "the password n...

c# - Marshal.StructureToPtr <-> PtrToStructure rounds DateTime field -

the structure public struct tick : iequatable<tick> { public datetime date; public decimal price; public int volume; public tick(datetime date, decimal price, int volume) { this.date = date; this.price = price; this.volume = volume; } public override bool equals(object obj) { var other = (tick)obj; return this.date == other.date && this.price == other.price && this.volume == other.volume; } public bool equals(tick other) { return this.date == other.date && this.price == other.price && this.volume == other.volume; } } is changed in test: [test] public void marshaldoesntroundsdatetime() { (int = 0; < 1000; i++) { var = new tick(datetime.now.addseconds(i), i, i); var now2 = now; var ticks = new tick[1]; unsafe { fixed (tick* ptr = &ticks[0...

excel - Hiding columns based upon cell value -

i not sure why code not working. intended recognise when press button (saying "hide1") , search through each column, row row, looking cells have value 1 once this, should change button "show 1". however, when run it, nothing happens. here macro excel: sub hide_columns() dim integer dim j integer = 3 j = 4 until = 26 until j = 54 activesheet.cells(i, j) if .value = 1 activesheet.columns(i).entirecolumn.hidden = true activesheet.shapes(application.caller).textframe.characters if .text = "show 1" .text = "hide 1" elseif .text = "hide 1" .text = "show 1" else msgbox ("vba has gone wrong.") exit sub end if end end if end j = j + 1 loop...

java - Using extended properties on Events in Office 365 REST API -

we in process of migrating application uses ews api newer office 365 rest api , because provides more flexible authorization options. current application uses extended properties store information (identifiers internal our applications) on event objects. the office 365 message api resource seems implement extended properties using singlevalueextendedproperties , multivalueextendedproperties fields. similar option available event resources ? extended properties in preview right now, , they're not implemented on events. working on that, stay tuned. since in preview, bear in mind things change. extended properties available on events .