check

Wildcard character in CHECK in Create table taken as string

I created an info table that stores employee record, the SQL query for it as follows... CREATE TABLE info1 (empid VARCcHAR(8) PRIMARY KEY CONSTRAINT empchk CHECK (empid IN ('kh\%' ESCAPE '\''), initials CHAR(6), fname CHAR(25) NOT NULL, lname CHAR(25), userstatus INTEGER NOT NULL, designation CHAR(10) NOT NULL); Now, as...

Check if a server is available

Hi, I'm looking for a way to check if a server is still available. We have a offline application that saves data on the server, but if the serverconnection drops (it happens occasionally), we have to save the data to a local database instead of the online database. So we need a continues check to see if the server is still available. W...

nullable types: best way to check for null or zero in c#

i'm working on a project where i find i'm checking for the following in many, many places: if(item.Rate == 0 || item.Rate == null) { } more as a curiousity than anything, what's the best way to check for both cases? I've added a helper method which is: public static bool nz(object obj) { var parsedInt = 0; var parsed = int.Try...

Checking whether the file can be opened in portable C

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); ...

File Path check

Hi I wanted to chek file existance with UNC path. But i thought UNC will slow for cheking of file.exist method. so i want to map that UNC path and then check for the File Existance case.. how can i map drive using C# code.. and any one have exact idea about timing to check File Existance with UNC path & Map drive path.. as in my t...

determine if another application is busy

How do I check if another application is busy? I have a program that sends text to a console. The text that I will send contains #13 char (i.e. ls#13cd documents#13dir). In other words I want to send many commands at one time and the console will process it one by one. I am sending it character by character. But sometimes it only execut...

How to quickly check if folder is empty (.NET)?

Hello. I have to check, if directory on disk is empty. It means, that it does not contain any folders/files. I know, that there is a simple method. We get array of FileSystemInfo's and check if count of elements equals to zero. Something like that: public static bool CheckFolderEmpty(string path) { if (string.IsNullOrEmpty(path))...

Need user to input string /check string length (C++)

I'll need to accept a string of 5 numbers from the user (only 5). Should I use istringstream for the same ? Can't I get away with something like this ? int main() { char *InputMain; InputMain=(char *)malloc(5+1); cout << "Enter the number : " <<endl; cin.getline ( InputMain, 5, '\n' ); // Input goes int...

Cakephp - checkPasswords is always false

Hello :) I'm working on the signup process and want to check if the two passwords (password + re-entered password) are equal. These are my validation rules in the User Model: var $validate = array( 'username' => array( 'notEmpty' => array( 'rule' => array('minLength', 5), 'required' => true, ...

Can I remove the "not for replication" option from an existing check constraint in T-SQL?

Suppose a check constraint (involving multiple columns) with the "not for replication" option was added to a database table (e.g. "alter table table_name add constraint constraint_name check not for replication (constraint_expression)") I found syntax for dropping "not for replication" from a column, but not for an existing check constr...

validation on email / postcode fields in sql/oracle

Hi, Would be gratefull for some advice on the following - Is it possible to validate email and postcode fields through some kind of check constraint in the sql in oracle ? or this kind of thing as i suspect pl/sql with regular expressions ? Thanks ...

How to check whether STL iterator points at anything?

I want to do something like this: std::vector<int>::iterator it; // /cut/ search for something in vector and point iterator at it. if(!it) //check whether found do_something(); But there is no operator! for iterators. How can I check whether iterator points at anything? ...

How to get SQL Server to ignore checks?

I have a SQL script that populates a temp column and then drops the column at the end of the script. The first time it runs, it works fine because the column exists, then it gets dropped. The script breaks the 2nd time because the column no longer exists, even though the IF statement ensures that it won't run again. How do I get around S...

How I can check for a valid date format in Perl?

Hi, I am getting a date field from the database in one of my variables, at the moment I am using the following code to check if the date is in "yyyy-mm-dd" format if ( $dat =~ /\d{3,}-\d\d-\d\d/ ) My question, is there a better way to accomplish this. Many Thanks ...

Can you replace or update an SQL constraint?

I have written the following constraint for a column I've called 'grade': CONSTRAINT gradeRule CHECK grade IN (‘easy’, ‘moderate’, ‘difficult’), Is it possible to later update the gradeRule to have different values? For example, 'moderate' and 'difficult' could be changed to 'medium' and 'hard'. Thanks ...

C#: Is there a way to check if a file is in use?

I'm writihg a program in C# that needs to repeatedly access 1 image file. Most of the time it works, but if my computer's running fast, it will try to access the file before it's been saved back to the filesystem and throw an error "File in use by another process". I would like to find a way around this, but all my Googling has only yie...

C# How can I check if a URL exists/is valid?

I am making a simple program in visual c# 2005 that looks up a stock symbol on Yahoo! Finance, downloads the historical data, and then plots the price history for the specified ticker symbol. I know the exact URL that I need to acquire the data, and if the user inputs an existing ticker symbol (or at least one with data on Yahoo! Financ...

Dynamic info screen

I am trying to find a way to make the info screen on my app download from the web IF an internetconnection is available (so i can update it regularly). If internet is not available, it should use the default or the last downloaded one. Is this possible? ...

Check to see if excel file is available before opening or starting it

Ok so here's the problem, i use a connection with using(connection.... blah blah) and then after my using block is over I want to start the excel aplication like this: System.Diagnostics.Process.Start(excelFile); This works... sometimes, other times my computer runs too quick and before the file is fully close, or the connection is full...

OCL Syntax Checker

Hello, I have been looking for an existing open-source syntax-checker for the Object Constraint Language (OCL). I intend to extend the syntax-checker with additional functionality not present in the OCL standard to be more applicable to my usage with entity-relationship diagrams. However, most of the projects I have found are based on t...