w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Check whether directory exists "rel1.5" exists in Repository https://xx/svn/MobileApp/Tags if exists do some action else the other
<project name="demo" default="build"> <property name="tag" value="rel1.5"/> <condition property="url.exists"> <http url=" https://www.exampledomain.com/svn/MobileApp/Tags/${tag}" errorsBeginAt="401"/> </condition> <target name="check1" if="url.exists"> <echo message="URL exists"/> </target> <target name="check2" unless="url.exists"> <echo message="URL does not exist"/> </target> <target name="build" depends="check1,check2"> </target> </project>

Categories : Svn

Resolved: How to check multiple email addresses in dynamic fields to check if user already exists or not
I dont think your IF-Statement in your PHP-Code is executed. You're checking for an email-parameter, but your ajax-data looks like data: "name="+ name Try to change it to data: { email: name },

Categories : Javascript

Find out whether a whole folder structure exists (CMD Batch)
Wouldn't for /L %%a in (1,1,6) do md Folder%%a be easier, and create the directories whether or not they already exist? for /L %%a in (1,1,6) do md Folder%%a 2>nul should suppress messages for already-existing directories.

Categories : Windows

Ruby 1.9.3 and 2.0.0 way to call method if exists regardless of accessibility
respond_to? accepts a second parameter, which if set, will ignore visibility flags on a method. foo.send(:method) if foo.respond_to?(:method, true) class Foo def pub "public" end private def priv "private" end end > f = Foo.new > f.send(:pub) if f.respond_to?(:pub, true) => "public" > f.send(:priv) if f.respond_to?(:priv) => nil # No second param to #respond_to? makes 2.0.0 fail the respond_to? check > f.send(:priv) if f.respond_to?(:priv, true) => "private" > f.send(:nonexist) if f.respond_to?(:nonexist, true) => nil

Categories : Ruby

In C check to see if an int exists?
The array elements may not be initialized with zero always. The first thing you need to do is initialize it with a default value. say 0 or -1 or whatever. Then you can modify your code as follows: int *spaceCheck; int i, Value; for(i=0;i<169;i++){ spaceCheck = &Array[i]; if(*spaceCheck!=default_value){ continue; else //do this job } Note that you were also storing the reference of the array element. If you want to check its data you need to use the dereferencing operator *. Hope that this is what you want. Simpler way to write the above code is to not use pointers at all. It is as follows: int i, Value; for(i=0;i<169;i++){ if(Array[i]!=default_value){ continue; else //do this job }

Categories : C

check if the value already exists in vector
Using find_if and lambda filter: auto match = std::find_if(CollectionOfYears.begin(), CollectionOfYears.end(), [&year](v){ return year == v.last(); }) if (match == CollectionOfYears.end()){ //no value previously } This still iterates the whole array. If you need more efficient search you should keep the array sorted and use binary search or std::set. Note that vector::end() returns iterator to the element after the last element. This is why std::find ignores the last value (because it is already out of bounds!).

Categories : C++

How to check if a key exists in a MemoryCache
Use bool Contains(string key, string regionName) method. MSDN: Determines whether a cache entry exists in the cache. Return Value Type: System.Boolean true if the cache contains a cache entry whose key matches key; otherwise, false. (http://msdn.microsoft.com/en-us/library/system.runtime.caching.memorycache.contains.aspx)

Categories : C#

Check Key Exists in Array
How about instead of pushing the results to an array you push them to an object like so: var officeLines = [{"Office":"abc", "Name":"ABC", "Total":0}, {"Office":"def", "Name":"DEF", "Total":11}, {"Office":"def", "Name":"DEF", "Total":1}, {"Office":"ghi", "Name":"GHI", "Total":1111}]; var offices = {}; ko.utils.arrayForEach(officeLines, function (item, indx) { var office = item.Office; if (!offices[office]) { offices[office] = 1; } else { offices[office]++; } }); document.write(JSON.stringify(offices)); // -> {"abc":1,"def":2,"ghi":1} http://jsfiddle.net/zd5Db/

Categories : Javascript

How to check url exists or not on wp7 apps?
You use something like this. bool result = false; using (WebClient client = new WebClient()) { try { Stream stream = client.OpenRead(url); if (stream != null) { result = true; } else { result = false; } } catch { //Any exception will returns false. result = false; } } return result; As you are using WP7, you may need to look the async versions. Source : http://www.dotnetthoughts.net/how-to-check-remote-file-exists-using-c/

Categories : C#

How to check if a json key exists?
use optString instead of getString: Returns the value mapped by name if it exists, coercing it if necessary. Returns the empty string if no such mapping exists

Categories : Java

Check if a database exists
You shouldn't have to catch the exception, the return type returns an JET_ERR type that will let you know if there is a problem, if you are looking for a simple bool check, I believe you may be out of luck, or have to write your own. Source : http://msdn.microsoft.com/en-us/library/gg294074.aspx http://msdn.microsoft.com/en-us/library/gg294092.aspx const JET_errSuccess = 0; result = JetCreateDatabase(...); if(result != JET_errSuccess) { //throw error }

Categories : C#

How do I check database for a value that already exists?
See mysql_num_rows. You should also look into using PDO or MySQLi http://php.net/manual/en/function.mysql-num-rows.php if (mysql_num_rows($query) > 0) { echo "user already exists"; }

Categories : PHP

Check whether value exists in SQL table
There's a lot of unclear things in the question, but I suspect the biggest question here is whether TagID is a numeric type vs a string type. But there's also the big question of why it is going into a data-set. But; getting back to the actual question - checking if a value exists; I would do something like (using dapper to make correct parameterization simple): // where tagNo is a local variable... int? id = connection.Query<int?>( "select Id from Student where TagID=@tagNo", new { tagNo } ).FirstOrDefault(); if(id == null) { // doesn't exist } else { // exists, plus you now know the id - it is: id.Value } But ultimately, if your original code worked in a DataSet, it should continue working - if it isn't, I suspect you have simply messed up the schema (maybe a column

Categories : C#

Call to DB to check if a value exists
Here, code is not an integer value. Hence, enclose it by single quotes. You should also include the $conn (connection variable) while using mysqli_query() statement - mysqli_query() $codeCheck = mysqli_query($conn, "SELECT code FROM discount WHERE code = '$discountCode'"); [EDIT] If you are including the connection page inside this page, try doing these: connect.php function connect(){ $conn = mysqli_connect($host, $un, $pw, $db); return $conn; } Now, call this function from the current page and get the connection variable: $conn = connect(); Now, use $conn for the mysqli_query() function. Change the if condition as follows: if(isset($_POST['discount']))

Categories : PHP

Recurring job to check if url exists
Writing and running a simple link checker is easy. Doing that for 1000s of links quickly, without redundancy, and handling dead and slow-responding links without bogging down your entire system gets harder. I'd use three threads, plus two queues: A dispatcher thread that only reads from the database. It is responsible for finding and queuing URLs to be checked in to a "to be checked" queue. A worker thread that consumes from the first queue and pushes results into the "updated URL results" queue. An updater/consumer thread that takes the result of a thread in #2 and updates the database. Ruby has some built-in classes to help: Thread Queue I'd highly recommend Typhoeus and Hydra for use in the middle thread. The documentation for these two classes cover a lot of what you need t

Categories : Ruby On Rails

Check in database if it exists or not
You need to pass listOfFiles in public void execute() method like: public void execute(File[] listOfFiles){ } That is why you are getting compilation error as listOfFiles can not be resolved to variable. Or you need to declare the variable listOfFiles into the class level. Edit: (Not able to understand from where you are calling execute) int i = 0;//Declare i to class level. public void execute(File[] listOfFiles) { if (listOfFiles[i].isFile()) { String fileName = listOfFiles[i].getName(); System.out.println(fileName); doesFileExistInDb(fileName); i++; } }

Categories : Java

How to check if a subdomain exists
DownloadStringAsync is exactly that – asynchronous. It only finishes some time after your code finishes running. To see the result or error, handle the DownloadStringCompleted event.

Categories : Vb.Net

Check to see if row exists before adding it?
You need to select only one record : IPACS_Certification doesExist = db.IPACS_Certification.Where(m => m.adUserName == item && m.procedureID == procedureID).Select(m => m).FirstOrDefault();

Categories : C#

C++ Check if file exists
So, assuming it's OK to simply check that the file with the right name EXISTS in the same directory: #include <fstream> ... void check_if_dll_exists() { std::ifstream dllfile(".\myname.dll", std::ios::binary); if (!dllfile) { ... DLL doesn't exist... } } If you want to know that it's ACTUALLY a real DLL (rather than someone opening a command prompt and doing type NUL: > myname.dll to create an empty file), you can use: HMODULE dll = LoadLibrary(".\myname.dll"); if (!dll) { ... dll doesn't exist or isn't a real dll.... } else { FreeLibrary(dll); }

Categories : C++

How to check if a registry key exists
You need to call ValueExists rather than KeyExists. A key is what appears as a folder in Regedit but you are looking for a value named nginx.exe in the key HKCUSoftware...Run. Some other comments: Since you are only reading from the registry, use OpenKeyReadOnly rather than OpenKey. Check the return value of OpenKeyReadOnly in case the key cannot be opened. If you actually need to do this with HKLM (as you state in a comment), watch out for registry redirection confusion when running 32 bit process on 64 bit system.

Categories : Delphi

Check if file name exists
You can specify a search filter in the call to Directory.GetFiles(): Directory.GetFiles(@"c:myFolder", "abc_*.*"); This will return only files that start with abc_.

Categories : C#

Check if a row with given values exists
You could select the count to see if a record exists already SELECT count(*) FROM following WHERE idUser = <id> AND followingID = <followingId> If the count is greater than zero, then a relationship exists.

Categories : PHP

How can I check if stdin exists in PHP ( php-cgi )?
The problem is that you create a endless loop with the while($line = fgets($fh)) part in your code. $stdin = ''; $fh = fopen('php://stdin','r'); if($fh) { // read *one* line from stdin upto " " $stdin = fgets($fh); fclose($fh); } echo $stdin; The above would work if you're passing arguments like echo foo=bar | ./myscript.php and will read a single line when you call it like ./myscript.php If you like to read more lines and keep your original code you can send a quit signal CTRL + D To get parameters passed like ./myscript.php foo=bar you could check the contents of the $argv variable, in which the first argument always is the name of the executing script: ./myscript.php foo=bar // File: myscript.php $stdin = ''; for($i = 1; $i < count($argv); i++) { $stdin .= $argv[

Categories : Shell

How to check if file name already exists?
The File class provides the exists() method, which returns true if the file exists. File f = new File(newFileName); if(f.exists()) { /* show alert */ }

Categories : Java

How do i check if a "Thread" is already exists?
You can use a pattern like this to ensure that if this particular method is started in a new thread pool thread it will do nothing if a previous instance is already running. class Foo { //make static if this is called from different instances and should still //be synchronized private int isRunning = 0; public void DoStuff() { if (Interlocked.Exchange(ref isRunning, 1) == 0) { try { DoRealStuff(); } finally { Interlocked.Exchange(ref isRunning, 0); } } } }

Categories : C#

Check if an M2M relationship exists
I'm not 100% sure on this, but I think you can do something like... if profiles=Profile.objects.filter(ownedEvent=YOUREVENT): #What you want if it is owned else: #What you want if it isn't owned

Categories : Django

PHP check if url parameter exists
Use isset() if(isset($_GET["id"]) && trim($_GET["id"]) == 'link1'){ $slide = trim($_GET["id"]); } else{ $slide = ''; }

Categories : PHP

How do I check if the value already exists in the database?
I need to insert certain data into my database through the form. But before that, it needs to be checked whether the value that's been typed in the txtField already exists in the database. No. You need to insert it into the database if it isn't already there. The correct way to do that is to try the insert and catch the failure. Otherwise you are creating a timing-window problem between your check and your insert, during which another client could do the insert.

Categories : Java

Check if json array exists c#
Your missing the double "==" to check for comparison, "=" is an assignment operation. if(jsonObject.Address == null) { return "null array"; } Your JSON should look like this. Otherwise your not checking for a null array but instead an array with a null value for the first element of the array. { "Name": "Mike", "Personaldetails": [ { "Age": 25, "Surname": "Barnes" } ], "Address": null } Then the code would be the following: if(jsonObject.Address == null) { return "null array"; } If you need to keep the original JSON you can always do a check like so: if(jsonObject.Address.Length > 0 && jsonObject.Address[0] == null) { return "null array"; }

Categories : C#

Check if file exists from string
String has no method named exists() (and even if it did it would not do what you require), which will be the cause of the errors reported by the IDE. Create an instance of File and invoke exists() on the File instance: if (new File("C:/data/datafile.txt").exists()) { }

Categories : Java

How to check if an element with id exists or not in jQuery?
How you inserting your dynamic generated div? It works if you do it in following way: var div = document.createElement('div'); div.id = 'liveGraph_id'; div.innerHTML = "i'm dynamic"; document.getElementsByTagName('body')[0].appendChild(div); if ($(div).length > 0) { alert('exists'); //will give alert } if ($('#liveGraph_id').length > 0) { alert('exists'); //will give alert } if ($('#liveGraph_id_extra').length > 0) { alert('exists'); //wont give alert because it doesn't exist. } jsfiddle.

Categories : Javascript

php check if a username exists in a database
you have error here if(isset($_POST))['username'])){ it should be if(isset($_POST['username'])){ $_POST['username'] should be enclosed inside isset function

Categories : PHP

How can I check whether a function exists in sqlite?
I don't know if sqlite supports information_schema, but in systems that do (such as postgres) you can query for whether a particular function exists like this: select routine_name from information_schema.routines where routine_name = 'sha1';

Categories : C

Express, check if a template exists
You could use this: res.render('specific_page', function(err, html) { if (err) { if (err.message.indexOf('Failed to lookup view') !== -1) { return res.render('generic_page'); } throw err; } res.send(html); }); This will distinguish between an error thrown because the template couldn't be found (in which case it will render generic_page instead), and any other errors that might occur (which are re-thrown). It's not entirely stable because it relies on the error message that's being thrown, but I don't think there's any other way of determining the type of error.

Categories : Node Js

Yii check if db column exists before creating it
You will want to use $model->hasAttribute(): if( $model->hasAttribute('VARNAME') ) e.g.: if( $model->hasAttribute('title') ) if( $model->hasAttribute($varname) )

Categories : PHP

Check to see if a variable exists in an array
A solution is to use the in_array() function: http://php.net/manual/en/function.in-array.php if(in_array($_SESSION['id'], $likes_row)) { //Array contains the value }

Categories : PHP

PHP Glob check if a file exists
glob gets all filenames that match your pattern and it returns an array containing these names. So instead of using file_exists (which expects a file path string and not an array), you can simply use something like: $files = glob(...); if (count($files) > 0) to see if any files were found. If you are sure your pattern will return only one file-name or less, you can use $files[0] or reset($files) to get the first element (if the condition is met...).

Categories : PHP

How to check if Image exists on server using URL
Issue is that the image may not exist or you don't have a direct permission for accessing the image, else you must be pointing an invalid location to the image.

Categories : PHP

check if value exists in json array
The elements of the array are objects, not strings. The values you want to check are the pathway_action_fk properties of those objects. So you have to drill down before checking. if ($.inArray('1', returnedData.map(function(x) { return x.pathway_action_fk; })) != -1); Also, you need to compare the result of $.inArray with -1 -- it returns the found element's index, which can be 0, not a boolean.

Categories : Json

How to check if a namespaced function exists?
Assuming callback is your successCallback object doing window[callback] === 'function' will only check that there is an object called '$.Namespace.SomeFunction' at the root of the window object. But what you want to achieve is to check if there is an object called SomeFunction in the object Namespace itself contained within the $ object. To do so you can either use what @rps wrote aka typeof typeof myNamespace.myFunc if you already know the namespace and the function or use the below function that will traverse an object and look for a given path, in your case $.Namespace.SomeFunction : var get = function (model, path, def) { path = path || ''; model = model || {}; def = typeof def === 'undefined' ? '' : def; var parts = path.split('.'); if (parts.length > 1 &

Categories : Javascript



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