w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Check ISO is valid or not
To quote the wiki gods: There is no standard definition for ISO image files. ISO disc images are uncompressed and do not use a particular container format; they are a sector-by-sector copy of the data on an optical disc, stored inside a binary file. ISO images are expected to contain the binary image of an optical media file system (usually ISO 9660 and its extensions or UDF), including the data in its files in binary format, copied exactly as they were stored on the disc. The data inside the ISO image will be structured according to the file system that was used on the optical disc from which it was created. reference

Categories : Misc

Check if UTF-8 string is valid in Qt
Try with QTextCodec::toUnicode and passing a ConverterState instance. ConverterState has members like invalidChars. They are not documented via doxygen though, but I assume them to be public API, as they are mentioned in the QTextCodec documentation. Sample code: QTextCodec::ConverterState state; QTextCodec *codec = QTextCodec::codecForName("UTF-8"); const QString text = codec->toUnicode(byteArray.constData(), byteArray.size(), &state); if (state.invalidChars > 0) { qDebug() << "Not a valid UTF-8 sequence."; }

Categories : C++

Check If access_token is valid
You can create request to the following Open Graph URL, basically you need to provide your APPID and access_token. https://graph.facebook.com/oauth/access_token_info?client_id=APPID&access_token=xxxxxxxxx The response will contain expiry time of specified token.

Categories : Facebook

How to check, the webpage is valid?
The reason is not because you are setting the variable to abc, it is because the URL doesn't exist. I am assuming that is what you mean when you ask to check if a webpage is valid. You could try getting the headers for the page and if they return a 404 then you can throw an error: include 'simple_html_dom.php'; $value1 = "http://isitraining.in/$message"; $file_headers = @get_headers($value1); if($file_headers[0] == 'HTTP/1.1 404 Not Found') { echo "File was not found!"; } else { $html = file_get_html($value1); $rain = $html->find('h1'); $weather = $html->find('h2'); $rains = strip_tags($rain[0]); weathers = strip_tags($weather[0]); // Rest of your code goes here }

Categories : PHP

How to check if a value is valid when set property
Use getters and setters: this.getValue = function(){ return value; }; this.setValue = function(val){ value = val; }; Add your checking logic to the setter.

Categories : Javascript

How to check if php session is valid?
So, because I'm receiving the html of the logging page in the json response when the session expired, what I’ve done it's to parse this string and when it's the logging page I’ve an alert to the user like this: /*....*/ switch(data.status){ case 200: var loginPageTest =/<!--loggin page-->/; if(loginPageTest.test(data.responseText)){ alert("A sua sessão expirou. É necessário fazer logging"); return; }else{ /*...*/ } break; }

Categories : PHP

How to check if a char is valid in C++
Your best bet according to me is parallilize. If you can parallelize the cleaning and clean many contents simoultaneously then the process will be more efficient. I'd look into a framework for parallelization e.g. mapreduce where you can multithread the task.

Categories : C++

How to check if input is valid or not?
In this case there's not really much you can do. If you try to read a floating-point number into an integer variable, that will not give any error since the stream (with the number in your example) reads the 1 as an integer, which it of course is. What you could do is to peek at the next character to see if it is something you expect or not.

Categories : C++

Check if a timezone is valid in R
You could use a timezone library which has knowledge of time zones. This is from the SVN version of RcppBDT: R> tz <- new(bdtTz, "America/Chicago") R> cat("tz object initialized as: ", format(tz), " ") tz object initialized as: America/Chicago R> tzBAD <- new(bdtTz, "blah") Error in new_CppObject_xp(fields$.module, fields$.pointer, ...) : Unknown region supplied, no tz object created R> In general, time zone support is dependent on the operating system. So for a portable solution you need to supply a list of valid time zones from somewhere... And for what it is worth, I am using the csv file from the Boost sources. A copy of that time zones file is eg here at github.

Categories : R

How to check if a range specified by iterators is valid?
how can we check if a range is valid? You can't. Your function cannot guarantee that the range is valid, only that the last is reachable from the first. These are two different things (for a simple example, consider an iterator into a vector which was subsequently reallocated). There is no mechanism by Standard that permits you to check if a range is valid. Much like you cannot know that a pointer is valid before you de-reference it. Just to note, Microsoft provided a function to check if a pointer was valid and it utterly screwed everyone who used it. Raymond Chen said that it should have been named CorruptMemoryIfPossible.

Categories : C++

Android check is valid UUID
I would use a regexp: [a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12} Something like: if(!Pattern.matches("[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}", filename)) { /* this is not a valid uuid */ }

Categories : Android

How to check whether a memory allocation is still valid?
I guess that when you say "shared pointer" you are not referring to an actual smart pointer class like std::shared_ptr or boost:shared_ptr, but simply a raw pointer which is passed from function to function. There is no reliable, safe, and cross-platform way to determine the validity of a raw pointer. However, using smart pointer classes will relieve much of the burden of managing dynamic memory. Instead of passing around raw pointers, you pass around smart pointers. These smart pointers (at least the shared_ variety) are reference-counted. As long as at least one reference to the pointer still exists, the object being pointed to will not be deleted. Once the last reference is removed, the object is automatically deleted. The smart_ptr I reference above has a so-called "strong refer

Categories : C++

Check if the facebook session is valid
When you open a session from cached information (normally done automatically for you), there's no server requests made to Facebook, which is why the Session object itself has no idea whether it's still valid or not. The only way to know that an access token has been invalidated (for any reason) is to make a graph request. You can either make a graph request every time you open a new session (to /me or even /me/permissions), or you can have your app proceed as normal, and perform the error handling steps outlined here when an error occurs (note that a session/access token can become invalid at any time - even in the middle of running your app - so you should have proper error handling regardless).

Categories : Android

how can i check if NSUrl is a valid image url?
you can check after getting NSData from NSURL . You can use GCD to download data here is an example i created which save your image in photo library. dispatch_async(dispatch_queue_create("com.getImage", NULL), ^(void) { NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRKII9COB-hvMef4Zvb9XYVbXKDFZHJAHwwzzGyMiy_b-q65GD43Chd37jH"]]; UIImage *image=[UIImage imageWithData:data]; if (image==nil) { //yourImageURL is not valid image=[UIImage imageNamed:@"placeholder.png"]; } else{ //yourImageURL is valid dispatch_async(dispatch_get_main_queue(), ^{ UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil); //s

Categories : Iphone

PHP WideImage check if valid image
The function LoadFromFile returns the image object and you can validate the variable $image is an instance of the WideImage_PaletteImage or WideImage_TrueColorImage class. If that's a valid instance, the uploaded file should be a valid image file. http://wideimage.sourceforge.net/wp-content/current/doc/WideImage/WideImage.html#methodloadFromFile

Categories : PHP

how to check if variable contains a valid ip address
Try this, hope it wi #! /bin/sh valid_ip() { # Check if IP format is num.num.num.num / num between 0..255 if [ "$(sipcalc $1 | grep ERR)" != "" ]; then echo "incorrect" return 1 fi echo "correct" return 0 }

Categories : Linux

How can I check that a HTML fragment is valid using Rspec?
Although I haven't used it, here's a gem that claims to do what you're looking for: https://github.com/ericbeland/html_validation

Categories : HTML

How can I efficiently check if a promotional code is valid?
Using a MySQL table for this purpose is absolutely the right thing to do. MySQL has no problem looking up an entry in a few milliseconds from a multi-million-row table if you index it correctly. In fact, a MySQL table index is pretty close to a pre-programmed trie structure, with all the hard work, concurrency, edge cases, and debugging done for you. If you build some other kind of lookup system, you'll have to sort out such things as persistence, maintenance of the data, and all.

Categories : PHP

how to check inserted regex pattern is valid or not
This could suit your needs: function isPatternValid(pattern) { try { "".match(new RegExp(pattern)); return true; } catch (err) { return false; } } Calling with: $('#input').blur(function() { alert(isPatternValid(this.value)); });

Categories : Javascript

Check if a string is a valid RegEx Pattern VB.NET
No, there is no other solution (you could of course reimplement the regex parser, but that would be an error-prone hell of work). I would prefer catching the specific ArgumentException that the Regex constructor throws if the regex is invalid other than just Exception.

Categories : Regex

Check if valid Xbox Live username?
I believe this API is the best to use for checking if the Gamertag is valid or not. Here is a valid Gamertag: https://xboxapi.com/profile/VNM+Jar that returns "Success":true Here is an invalid Gamertag: https://xboxapi.com/profile/196jjdfd74nu9za that returns "Success":false You could then do anything you wish with these values...

Categories : Api

Matlab Reversi 'valid move' check
In the second place where you assign variable selected (near the end of the function legalMove), you have out-of-board check in the wrong place. Here's a fixed version % ... % Number of enemy pieces you went over cnt = 0; selected = game_state(ti, tj); % Move while going over enemy pieces while selected == player_number * -1 ti = ti + d(1); tj = tj + d(2); % Check if out of the board if (ti > 8 || ti < 1) || (tj > 8 || tj < 1) break else end selected = game_state(ti, tj); % Count pieces you went over cnt = cnt + 1; end end % Check if you moved over enemy pieces & whether you landed on your piece if selected == player_number

Categories : Matlab

How can I check if a string is a valid file name for windows using R?
These characters aren't allowed: /:*?"<>|. So warn the user if it contains any of those. Some other names are also disallowed: COM, AUX, NUL, COM1 to COM9, LPT1 to LPT9. You probably want to check that the filename is valid using a regular expression. See this other answer for a Java example that should take minimal tweaking to work in R. http://stackoverflow.com/a/6804755/134830 You may also want to check the filename length (260 characters for maximum portability, though longer names are allowed on some systems). Finally, in R, if you try to create a file in a directory that doesn't exist, it will still fail, so you need to split the name up into the filename and directory name (using basename and dirname) and try to create the directory first, if necessary. That said, David

Categories : Windows

How to check whether a Birth Date entered is valid
mm is minutes. MM is months: SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd"); See the documentation for more details. You should set that to be strict (df.setLenient(false), and then you don't need to try to format the result again - just the parse exception should be enough. Personally I'd use Joda Time for any date/time work in Java though - it's a much nicer API. As for java.util.Date vs java.sql.Date - the code you've given us would entirely use java.util.Date. If you've already got an import for java.sql.Date which you want to preserve, you'd want something like: java.util.Date testDate = ...; Although as you don't need to reformat it, you may not even need a variable at all: SimpleDateFormat df = new SimpleDateFormat("yyyy/MM/dd"); df.setLenient(false); Date testDa

Categories : Java

How to check if a LatLng is valid in Google StreetView using JS and PHP
If you want to use JS to verify the lat and lng then you need to get the $_GET parameters into the JS. Something like: var LAT = '<?=isset($_GET['LAT']) ? $_GET['LAT'] : 91?>'; var LNG = '<?=isset($_GET['LNG']) ? $_GET['LNG'] : 181?>'; var latLng = new google.maps.LatLng(LAT, LNG); streetViewService.getPanoramaByLocation(latLng, STREETVIEW_MAX_DISTANCE, function (streetViewPanoramaData, status) { if (status === google.maps.StreetViewStatus.OK) { //ok } else { //no ok } }); I've used a simple ternary statement asking if the GET is available, if it is, then add it to the JS variable, if it's not add a value outside of the range of Lat and Lng. This will cause the Google Maps API to fail automatically.

Categories : PHP

How to check if position if valid in StreetView in Android
I google a lot for this question. Finally I got one useful link. See there is no direct way to use getPanoramaByLocation() javascript function in android api. But there is a work around to this. Here I'm providing url : http://maps.googleapis.com/maps/api/streetview?size=400x400&location=40.720032,-73.988354&fov=90&heading=235&pitch=10 See cases : When you hit this url by providing valid lat/lng. You will get streetview. So you can use that image size or contents for checking whether its a blank image or valid image. See this url : http://maps.googleapis.com/maps/api/streetview?size=400x400&location=73.67868,-73.988354&fov=90&heading=235&pitch=10 In above url I passed invalid lat/lng means this for this lat/lng there is no streetview so you can eit

Categories : Android

How to check if a type never be a valid generic argument?
Is the problem due to your customer potentially passing in types that don't have a valid public parameter-less constructor? If that is the case, you could restrict the input they are allowed to send you by adding a condition to your generic method: public class MyClass<T> where T : new() { } This code will only allow generic types T that have a public constructor with no parameters. You can find more info on the where clause here I don't know how you have your variadic type arguments implemented, but you could take in a params collection of type T with the above clause added, like so: public class MyClass<T> where T : new() { public void MyMethod(params T[] items) { //...Do stuff... } } That would let them pass in as many items as they wanted

Categories : C#

Cakephp check if smtp email is valid
Use the Exception handling. It will give you an appropriate message that what you are doing wrong: try { $email->from('abc@gmail.com'); $email->to($recipient); $email->subject($final_subject); $email->send() } catch(Exception $e) { pr($e);die; }

Categories : Validation

Check if string consists only of valid ISO 8859-1 characters
You could setup an array or list of valid characters and then iterate through your string to check if each of them exists in your list of valid characters. The list can be created by adding all valid latin-1 characters to it.

Categories : C#

Bash Script to Check if Given IP is Valid A Record for Host
Wouldn't this be enough? #!/bin/bash ipaddressused=$1 if grep -q -P "$ipaddressused" < <(dig +short sub.domain.com); then echo "found" exit 0 else echo "not found" exit 1 fi What was wrong with your script? The line ipaddresscurrent='dig +short sub.domain.com' assigns the string dig +short sub.domain.com to the variable ipaddresscurrent. You probably, instead, wanted to assign to the variable ipaddresscurrent the output of the command dig +short sub.domain.com. This is done either using the old and deprecated backticks: ipaddresscurrent=`dig +short sub.domain.com` (but please don't ever use backticks!) or the more modern, robust and nestable $(...) as: ipaddresscurrent=$(dig +short sub.domain.com) grep -Pzo doesn't really do what you're expecting. Ins

Categories : Regex

How show check mark icon when TextBox value is valid?
I think. This is not so simple with asp.net validation I would suggest, use jquery validation. there you will be able to show custom html on validate

Categories : Asp Net

HttpClient check valid image file async
Linq is (generally) lazy. This means that Linq statements only represent a query. Work happens when you enumerate the query (materialize). You never materialize your tasks query. To get it to actually run the code in your select statement, you need to materialize the query by causing it to be enumerated. One way would be to simply call tasks.ToList()

Categories : C#

Live form validation - How do I check if all the fields are valid?
You have your return true; before the switchButton(), so that function will never get called . . . but if it did, I think you'd be in major trouble, likely causing the browser to become unresponsive. You're switchButton function reads: function switchButton() { if (userError() && passError() && confirmError() && emailError()) { document.getElementById('submitbutton').style.display = 'inline'; document.getElementById('disabled').style.display = 'none'; } else { document.getElementById('submitbutton').style.display = 'none'; document.getElementById('disabled').style.display = 'inline'; } } As far as I can tell, call that function from within each of the four functions you have to check each field, but then in the if

Categories : Javascript

Symfony2 can check if a route is valid for the user who is currently logged in
It looks like (from the code) that you are using KnpMenuBundle. Which means, if it's the case, that you are in a service. Simply inject in your MenuBuilder service the security_context service, so you can check if your user can access to a link. #MenuBuilder.php if $securityContext->getToken()->getUser() && $securityContext->isGranted('ROLE_ADMIN') { $menu->addChild('Administration', array("route" => ......); } Yet, you need to secure the route in the controller using annotation : /** * Administration index page * * @Route("/administration/index", name="administration_index") * @Template * @Secure(roles="ROLE_ADMIN") * * @return array|Response */

Categories : PHP

WSO2 check if user is authenticated JSESSIONID, if session is still valid
If I understand correctly, you need to give access to the web service only for authenticated users. There are many ways to secure a web service. Since you are using AuthenticationAdmin to login, you can define your web service as an Admin Service. I guess you are trying code first approach for your web service. You can try extending your web service to org.wso2.carbon.core.AbstractAdmin. For example, we can see UserAdmin service in WSO2 Kernel. https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0/core/org.wso2.carbon.user.mgt/4.1.0/ UserAdmin service: https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.1.0/core/org.wso2.carbon.user.mgt/4.1.0/src/main/java/org/wso2/carbon/user/mgt/UserAdmin.java axis2 services.xml: https://svn.wso2.org/repos/wso2/carbon/kernel/branches/4.

Categories : Authentication

Valid date format check Oracle - weird behaviour
The FX format model modifier can be used to require exact matching between a character string and the format model: select TO_TIMESTAMP(P_EVENT_TIMESTAMP, 'FxYYYY-MM-DD HH24:MI:SS') into V_TIMESTAMP from DUAL; Moreover, you can prevent context switching by not querying DUAL table in order to convert character string to a timestamp data type: V_TIMESTAMP := TO_TIMESTAMP(P_EVENT_TIMESTAMP, 'FxYYYY-MM-DD HH24:MI:SS');

Categories : SQL

Starling AS3 mobile app check if user session is still valid every x seconds
Generally no. You should manually check if your session is "valid". You can start timer in your API class. Perhaps you have singleton class ServerAPI which has methods to communicate with your server, add timer to its constructor: package { import flash.events.EventDispatcher; import flash.events.TimerEvent; import flash.utils.Timer; public class ServerAPI extends EventDispatcher { final var sessionTimeout:int = 20 * 60 * 1000; final var sessionTimer:Timer; public function ServerAPI () { sessionTimer = new Timer(sessionTimeout) sessionTimer.addEventListener(TimerEvent.TIMER, onSessionCheck) sessionTimer.start() } private function onSessionCheck(e:TimerEvent):void { //executes every 20 minutes //checks session with URL

Categories : Actionscript

how to check in iphone app if url is valid then load in WebVIew else show alert
You can use this method: - (BOOL) validateUrl: (NSString *) url { NSString *theURL = @"(http|https)://((\w)*|([0-9]*)|([-|_])*)+([\.|/]((\w)*|([0-9]*)|([-|_])*))+"; NSPredicate *urlTest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", theURL]; return [urlTest evaluateWithObject:url]; } From Check URL validity . Hope this helps.

Categories : Iphone

How to check user entered phone number is valid or not in Objective c?
I think you want to check the number country wise. for this you have to use following demo https://github.com/rmaddy/RMPhoneFormat for UK RMPhoneFormat *fmt = [[RMPhoneFormat alloc] initWithDefaultCountry:@"uk"]; NSString *numberString = // the phone number to format NSString *formattedNumber = [fmt format:numberString]; for Australia RMPhoneFormat *fmt = [RMPhoneFormat instance]; NSString *callingCode = [fmt callingCodeForCountryCode:@"AU"]; // Australia - returns 61 NSString *defaultCallingCode = [fmt defaultCallingCode]; // based on current Region Format (locale) and so on...

Categories : Iphone

Check if input number is valid in Codeigniter Form Validation
Try the is_numeric() function in PHP: http://php.net/manual/en/function.is-numeric.php It'd return true if the number is an valid number, and return false if it isn't.

Categories : PHP



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.