[Solved] create two thumbnails instead of one based on code

[ad_1] Can you just call the function twice like in this example below? if (!empty($_FILES)) { $tempFile = $_FILES[‘Filedata’][‘tmp_name’]; $targetPath = $_SERVER[‘DOCUMENT_ROOT’] . $_REQUEST[‘folder’] . “https://stackoverflow.com/”; $targetPath = str_replace(‘//’, “https://stackoverflow.com/”, $targetPath); $targetFile = $targetPath . basename($_FILES[‘Filedata’][‘name’], ‘.’ . $ext) . ‘_s.’; $newTargetFile = // define whatever you want to call your second copy of thumbnail … Read more

[Solved] Handler as a method parameter

[ad_1] From dispatchGesture doc, callback AccessibilityService.GestureResultCallback: The object to call back when the status of the gesture is known. If null, no status is reported. handler Handler: The handler on which to call back the callback object. If null, the object is called back on the service’s main thread. That basically means, if you don’t … Read more

[Solved] Delete/unset an array element matching a key/value of another array element [PHP]

[ad_1] Try this: <?php $messages = array( ‘message1’=>array( ‘type’=>’voice’, ‘call-id’=>’11’, ‘id’=>’message1’ ), ‘message2’=>array( ‘type’=>’voice’, ‘call-id’=>’44’, ‘id’=>’message2’ ), ‘message3’=>array( ‘type’=>’text’, ‘call-id’=>’44’, ‘id’=>’message3’ ), ‘message4’=>array( ‘type’=>’text’, ‘call-id’=>’55’, ‘id’=>’message4’ ), ‘message5’=>array( ‘type’=>’voice’, ‘call-id’=>’55’, ‘id’=>’message5’ ), ); $unique = []; foreach ($messages as $value) { if ($value[‘type’] == ‘text’) { $unique[$value[‘call-id’]] = $value; // so text comes first and … Read more

[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