[Solved] jQuery Custom validation

[ad_1] From the plugin docs, it appears all you need is a required dependency callback $(selector).validate({ rules:{ Name:{ required: function(element){ return $(“#ID”).val() == 1 && $(“#IDName”).val() == 0; } }, messages:{ Name:{ required: ‘Enter an individual.’} } }) 3 [ad_2] solved jQuery Custom validation

[Solved] How do i condense this jQuery down so it’s more efficient?

[ad_1] The big thing you can do is avoid running the same query twice, if you know the results haven’t changed. Chain or cache the results of your jQuery calls! Instead of: $(‘#button-active’).hide(); $(‘#button-active’).delay(30).fadeIn(1000); you can use the chainability of jQuery objects. In fact, you’re already doing it in the second line–why not take the … Read more

[Solved] Post data & show source code

[ad_1] You can use 3rd parameter of this function: context $postdata = http_build_query( array( ‘var1’ => ‘some content’, ‘var2’ => ‘doh’ ) ); $opts = array( ‘http’ => array( ‘method’ => “POST”, ‘header’ => “Connection: close\r\n”. “Content-Length: “.strlen($postdata).”\r\n”, ‘content’ => $postdata ) ); $context = stream_context_create($opts); $result = file_get_contents(‘http://example.com/submit.php’, false, $context); // edit -little bug … Read more

[Solved] create a wizard [closed]

[ad_1] It looks as if you will need to create a UserControl (right-click your project, New… User Control) for each page of the Wizard, and you will need to implement IWizardPage on your UserControl. Than you have your WizardHost which is a single Form. So to answer your question you will have one Form and … Read more

[Solved] Regex to match given string filenames in a string

[ad_1] This one should work exactly for first two files, but won’t work if there any additional special characters in file names: using System; using System.Collections.Generic; using System.Text.RegularExpressions; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { const string example = “PrintFileURL(\”13572_IndividualInformationReportDelta_2012-06-29_033352.zip\”,\”13572_IndividualInformationReportDelta_2012-06-29_033352.zip\”,0,\”53147\”,\”Jun 29 3:33\”,\”/icons/default.gif\”)”; Console.WriteLine(example); const string pattern = “\\\”([a-zA-Z0-9\\-_]*?\\..*?)\\\””; var regex = … Read more

[Solved] Find x number of array elements closest to target [closed]

[ad_1] Let’s define some testing data. Let’s have a function: func getClosest(count: Int, from values: [Int], to targetNumber: Int) -> [Int] and we will test with the following: let array = [1000, 2000, 3000, 4000, 5000, 6000, 7000, 8000, 9000, 10000, 11000, 12000, 13000, 14000, 15000, 16000, 17000] print(getClosest(count: 5, from: array, to: 1000)) print(getClosest(count: … Read more

[Solved] How to convert an array of numeric values as strings to an array of bytes?

[ad_1] Do use Byte.parseByte(String) to do this: public static byte[] toByteArray(String[] arr) { byte[] res = new byte[arr.length]; for (int i = 0; i < arr.length; i++) res[i] = Byte.parseByte(arr[i]); return res; } P.S. In Java byte values are [-128; 128). Therefore “128” will throw java.lang.NumberFormatException: Value out of range. Value:”128″ Radix:10. The you have … Read more

[Solved] pd.DataFrame(np.random.randn(8, 4), index=dates, columns=[‘A’, ‘B’, ‘C’, ‘D’])

[ad_1] Basically np.random.randn returns random float values of normal distributions with mean = 0 and variance = 1. Now np.random.randn takes shape you would like to return of those distributions. For example: np.random.randn(1,2) returns an array of one row and two columns. Similarly, you can give np.random.randn(1,.,.,.,9) which gives you out a complicated array. Since … Read more