I'm using a Odbc connection to a mysql server, and was wondering how I would go about checking if a table exists within my database, and if not, create it.
I am trying to check if md5sum or digest exists on solaris and script is used on different machines.
Here is the function in sh script which is called from a ksh script
getMD5cmd ()
{
PATH="${PATH}:/bin:/usr/bin:/usr/sfw/bin:/usr/local/bin:/usr/sbin/bin"
if type -p md5sum;then
MD5CMD=`type -p md5sum`
elif type -p digest;then
MD5CMD="`type -p digest` -a md5"
fi
echo "HERE ${MD5CMD}"
}
When I run scripts I get
-p not found
md5sum not found
-p not found
digest is /bin/digest
HERE
However, when I type it in a terminal, works as exptected
Any Ideas?
Thanks
When I create a thread I save it handle in a list.
After a time I want to check which of them still exists.
I'm not looking for other kind of implementation, I want to know if is there some how to get a thread by it handle ?
I have a desktop application with a database embedded in it. When I execute my program I need to check that specific table exists, or create it if not.
Given a Connection object named conn for my database, how could I check this?
I need to add a row to a MySQL database table but only if the row doesn't already exist. My database server just went down so I can't test this, but will this work as expected?
INSERT INTO `blocks` (`block_file`,`settings_group`)
VALUES ('announcements','announcement_settings')
WHERE NOTEXISTS (SELECT `block_file`,`settings_group`
FROM `blocks`
WHERE `block_file`='announcements' AND `settings_group`='announcement_settings')
It seems like sound logic. Is this a valid query or is there a better way of doing this?
I was wondering if there is a nice IF NOTEXISTS for checking columns and indexes in SQLite, or do I need to bring back the entire database schema and validate against that?
Hi Friends,
I am a beginner coder, i am building a project using C# Asp.Net in which i am registering users with a user id, now my question is that how to check that the user id is already exists in the user table or not when user trying to register, i am using sql server 2000?
I would like to use Linq instead of below function :
Friend Function IsCollectionInTable2(ByVal apps As DataTable, ByVal collectionId As String) As Boolean
For Each row As DataRow In apps.Rows
If row("CollectionId").ToString = collectionId Then Return True
Next
Return False
End Function
The best I can do is below:
Friend Function IsCollectionInTable(ByVal apps As DataTable, ByVal collectionId As String) As Boolean
Return (From row In apps.AsEnumerable()
Where (row.Field(Of String)("CollectionId") = collectionId)
Select row.Field(Of String)("CollectionId")).Count > 0
End Function
I would like to use Exists or Any in above function. Performance could be an issue,
Hello, i want to check if an e-mail address is valid and exist.
I mean not using regex. I need a valitadion by using mx.
for example how to check blablabla[at]gmail.com exists on gmail.com
it would be better using CMD (win)
Hi All,
In a bash script i want to do the following (in pseudo-code):
if [ a process exists with $PID ]; then
kill $PID
fi
What's the appropriate bash for the conditional statement?
Thanks
I'm using LINQ2SQL and I want to compare two tables and select all rows that are missing from one tables (based upon one of the column values).
In standard SQL I would write this as:
SELECT
FirstName,
LastName,
RefId,
Email
FROM
Users_ActiveDirectory AS ADU
WHERE
NOTEXISTS
(
SELECT
U.RefId
FROM
Users AS U
WHERE
U.RefID = ADU.RefId
)
However I'm not sure how to achieve the same result using LINQ2SQL?
I spent some time trying to figure out why this query isn't pulling the results i expected:
SELECT * FROM NGS WHERE ESPSSN NOT IN (SELECT SSN FROM CENSUS)
finally i tried writing the query another way and this ended up getting the expected results:
SELECT * FROM NGS n WHERE NOTEXISTS (SELECT * FROM CENSUS WHERE SSN = n.ESPSSN)
The first query seems more appropriate and "correct". I use "in" and "not in" all the time for similar selects and have never had a problem that i know of.
A bit of a basic question but how may I check if a anchor is in the url when I load the page?
For example www.mysite.com/mypage#show
And then in the JavaScript I can go if #show exists do this
Thanks.
Hello,
I want to check if an URL exists using PHP. for eg. If someone enters www.adflkjweoifj123912873.com, I want to check if this domain has a website, or its live on the web.
Thanks
Jean
I have a method as an NSString *. If it exists, I want to call it, and if not, do nothing.
SEL eventSelector = NSSelectorFromString(eventSelectorStr);
if ([delegate respondsToSelector:eventSelector]) {
[delegate performSelector:eventSelector];
[delegate adapterDidFinishAdRequest:self];
}
else {
// Does not implement selector
}
This code does not work, since NSSelectorFromString will register the string as a selector, so respondsToSelector:eventSelector will cause a crash because the selector is actually invalid.
I get a file path to a user file and I want to make sure that this path is to a valid existing user file and not to something bogus or a system file or something like that.
I know I can use file_exists to check that it exists, but I'm not sure how I should make sure that the file is in a certain sub-directory...
This is strange. I just did a deploy to a cluster server, and since then, pictures have not been processing. Reading the logs, I usually do not get an error at all, but they never finish. However, on one particular image, I found this little bit at least, but this might not explain everything.. Any ideas?
Processing PhotosController#edit (for 69.248.152.173 at 2010-05-27 04:25:12) [GET]
Parameters: {"gallery_id"="2102", "action"="edit", "type"="photo", "id"="15453", "crop"="true", "controller"="photos", "organization_id"="470", "_"="1274959512393"}
Rendering media/crop_photo
ActionView::TemplateError (/data/HQ_Channel/releases/20100524111501/public/system/photos/15453/original/DSC05193.JPG is not recognized by the 'identify' command.) on line #4 of app/views/media/crop_photo.js.haml:
1: == $("#media_header").html('#{ escape_javascript(render :partial = 'media/crop_photo') }').slideDown("slow");
2:
3: :plain
4: function updateForm(coords)
5: {
6: var rx = #{PHOTO_IMAGE_WIDTH} / coords.w;
7: var ry = #{PHOTO_IMAGE_HEIGHT} / coords.h;
vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/geometry.rb:24:in `from_file'
app/models/photo.rb:68:in `photo_geometry'
app/views/media/crop_photo.js.haml:4:in `_run_haml_app47views47media47crop_photo46js46haml'
haml (2.2.2) [v] lib/haml/helpers/action_view_mods.rb:13:in `render'
app/controllers/photos_controller.rb:81:in `crop'
app/controllers/photos_controller.rb:24:in `edit'
haml (2.2.2) [v] rails/./lib/sass/plugin/rails.rb:19:in `process'
lib/flash_session_cookie_middleware.rb:14:in `call'
vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in `call'
** [Hoptoad] Failure: Net::HTTPClientError
** [Hoptoad] Environment Info: [Ruby: 1.8.6] [Rails: 2.3.3] [Env: production]
** [Hoptoad] Response from Hoptoad:
No project exists with the given API key.
Rendering /data/HQ_Channel/releases/20100524111501/public/500.html (500 Internal Server Error)
And then a little later, I got this :
ActionView::TemplateError (/data/HQ_Channel/releases/20100524111501/public/system/photos/15453/original/DSC05193.JPG is not recognized by the 'identify' command.) on line #4 of app/views/media/crop_photo.js.haml:
1: == $("#media_header").html('#{ escape_javascript(render :partial = 'media/crop_photo') }').slideDown("slow");
2:
3: :plain
4: function updateForm(coords)
5: {
6: var rx = #{PHOTO_IMAGE_WIDTH} / coords.w;
7: var ry = #{PHOTO_IMAGE_HEIGHT} / coords.h;
vendor/gems/thoughtbot-paperclip-2.3.1/lib/paperclip/geometry.rb:24:in `from_file'
app/models/photo.rb:68:in `photo_geometry'
app/views/media/crop_photo.js.haml:4:in `_run_haml_app47views47media47crop_photo46js46haml'
haml (2.2.2) [v] lib/haml/helpers/action_view_mods.rb:13:in `render'
app/controllers/photos_controller.rb:81:in `crop'
app/controllers/photos_controller.rb:24:in `edit'
haml (2.2.2) [v] rails/./lib/sass/plugin/rails.rb:19:in `process'
lib/flash_session_cookie_middleware.rb:14:in `call'
vendor/gems/hoptoad_notifier-2.2.2/lib/hoptoad_notifier/rack.rb:27:in `call'
** [Hoptoad] Failure: Net::HTTPClientError
** [Hoptoad] Environment Info: [Ruby: 1.8.6] [Rails: 2.3.3] [Env: production]
** [Hoptoad] Response from Hoptoad:
No project exists with the given API key.
Rendering /data/HQ_Channel/releases/20100524111501/public/500.html (500 Internal Server Error)
Does anyone check the domain of an email address as part of their verification steps? eg. Confirm that gmail.com exists if the user specified [email protected] as their address.
How would I go about ensuring that the overridden parent method exists before I call it?
I've tried this:
public function func() {
if (function_exists('parent::func')) {
return parent::func();
}
}
However the function_exists never evaluates to true.
Hello,
How can I call Synchronize method on an agent but only when connection to remote db
exists?
I'm very new to sync framework so forgive me my ignorance.
Thanks in advance :)
How can I check if a user exists?
Im doing an installer for a mysql database, and I need to check if a user exits, if not create user, if yes delete user and create it again.
this so i can execute the script without worries.
thanks.
Using Delphi 2009 + Firebird 2.1.3.
Database is ODS 11.1, default char set is UTF8.
My prepared query is as follows:
SELECT
a.po_id, a.po_no
FROM
purchase_order a
WHERE EXISTS
(SELECT 1
FROM
sales_order_item z1
JOIN
purchase_order_item z2
ON
z2.so_item_id = z1.so_item_id
AND
z2.po_id = a.po_id
WHERE z1.so_id = :soid)
ORDER BY a.po_no
Now when I loop this say 1000 times because I have 1000 x so_id, the CPU usage get at 100% for FBSERVER.EXE
Anyone encountered this problem?
Is there a standard way to check if a view layout exists from within a Controller in Rails? I'm trying to allow the user to determine the layout, but it needs to exist first.
How do I check if a URI exists with PHP?
I guess it will return an error code and I can check it before I use file_get_contents, because if I use file_get_contents on a link that doesn't exist, it gives me an error.