Is there an "exists" function for jQuery
So I know that you can do: if ($(selector).length>0) { // Do something } But is there a more elegant method? ...
So I know that you can do: if ($(selector).length>0) { // Do something } But is there a more elegant method? ...
Here is the updated question: the current query is doing something like: $sql1 = "TRUNCATE TABLE fubar"; $sql2 = "CREATE TEMPORARY TABLE IF NOT EXISTS fubar SELECT id, name FROM barfu"; The first time the method containing this is run, it generates an error message on the truncate since the table doesn't exist yet. Is my only optio...
I need to generate a directory in my makefile and I would like to not get the "directory already exists error" over and over even though I can easily ignore it. I mainly use mingw/msys but would like something that works across other shells/systems too. I tried this but it didn't work, any ideas? ifeq (,$(findstring $(OBJDIR),$(wildc...
I'm using the jquery library to load the content of an html file. Something like this: $("#Main").load("login.html") If the file (in this case 'login.html') does not exist, I would like to detect it so that I can redirect the user to an error page for example. Any ideas how I can detect if the file to load exists or not? ...
I'd like to drop a user in a SQL Server script but I'll need to test for existence first or I'll get script errors. When dropping tables or stored procs, I check the sysobjects table like so: IF EXISTS (SELECT * FROM sysobjects WHERE id = object_id(N'[dbo].[up_SetMedOptions]') AND OBJECTPROPER...
Here is the single line from one of my functions to test if any objects in my array have a given property with a matching value Return ((From tag In DataCache.Tags Where (tag.FldTag = strtagname) Select tag).Count = 1) WHERE.... DataCache.Tags is an array of custom objects strtagname = "brazil" and brazil is definately a tag name s...
I have analyzed a hibernate generated oracle database and discovered that a delete of a row from a single table will spawn the firing of 1200+ triggers in order to delete the related rows in child tables. The triggers are all auto-generated the same - an automatic delete of a child row without checking for existence first. As it is impos...
Hi, I am working on an application. That application should get the resume from the users, so that I need a code to verify whether a file exists or not. I'm using ASP.NET / C#. Thanks, Suresh Kumar ...
If I have a list of items, say apples pairs pomegranites and I want to identify any that don't exist in the 'fruit' column in an SQL DB table. Fast performance is the main concern. Needs to be portable over different SQL implementations. The input list could contain an arbitrary number of entries. I can think of a few ways to do i...
Let's say I have a mapped User object with a user_id as a primary key, and a mail column with a unique constraint. I want my program to save a User object to the users table only if it doesn't exist. I can do the following thing in my insert function: begin transaction query for a user with the given mail if it doesn't exist, create a...
Is there a way to get functionality similar to mkdir -p on the shell... from within python. I am looking for a solution other than a system call. I am sure the code is less than 20 lines... really I am wondering if someone has already written it? ...
I'd like to perform a quick check whether or not a file can be opened. It should be written in portable C, or at least to work on Win32 and POSIX systems. #ifdefs are acceptable. I'm trying to avoid this: int openable(const char*filename) { FILE *f = fopen(filename,"r"); if (!f) return 0; /* openable */ fclose(f); ...
(sorry, not exactly a coding question) Say I want to install something to the directory C:\pony but the folder 'pony' does not exist, how can I get InstallShield to inform the user that the folder 'pony' does not exist and ask the user if he or she wants to create the directory. What happens now is the directory is automatically create...
We have a process that runs prior to our nightly builds. If the process fails it generates a text file. All I need to do is check to see if the file exists, and if it does, cause a failing MSBuild. I currently have tried the following: <CreateProperty Condition="Exists('C:\Process\Fail.txt')" Value="false"> <Output TaskParame...
I get an error when I do the following: if(Session["value"] != null) { // code } The error i get is this: Object reference not set to an instance of an object. Why is this? I always check my session this way? I am using the MVC Framework, does this has something to do with it? EDIT: The code is in the constructor of a Controlle...
Hi there, I need to check if a file is on HDD at a specified location ($path.$file_name). Which is the difference between is_file() and file_exists() functions and which is better/faster to use in PHP? ...
Dear All I have a MySQL db and inside it a table called ProductMaster with 6 fields "Product_Id,Product_Name,Model,Opening_date,Closing_Date,Status". Opening_Date and Closing Date Can accept null values.So some records has values for this field I have the below query to display records from this table. "select Product_Id,Product_Name,...
In my application I use the WebClient class to download files from a Webserver by simply calling the DownloadFile method. Now I need to check whether a certain file exists prior to downloading it (or in case I just want to make sure that it exists). I've got two questions with that: What is the best way to check whether a file exists o...
Is it possible to check if a (MySQL) database exists after having made a connection. I know how to check if a table exists in a DB, but I need to check if the DB exists. If not I have to call another piece of code to create it and populate it. I know this all sounds somewhat inelegant - this is a quick and dirty app. ...
What is the equivalent of following statement in LINQ: Select t1.appname, t1.julianDte, t1.cat From table1 t1 Where NOT EXISTS ( Select * from table t2 where t1.cat = t2.cat AND t2.julianDte < t1.julianDte ) ...