Feeds:
Posts
Comments

Archive for the ‘Uncategorized’ Category

function isUrl(s) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/
return regexp.test(s);
}

Read Full Post »

DECLARE @SearchStr varchar(50)
SET @SearchStr = ‘Whatever’
SET NOCOUNT ON
DECLARE @Results TABLE ([Table] nvarchar(370), [Column] nvarchar(370), [Value] nvarchar(3630))
DECLARE @TableName nvarchar(256), @ColumnName nvarchar(128), @SearchStr2 nvarchar(110)
SET @TableName = ”
SET @SearchStr2 = QUOTENAME(‘%’ + @SearchStr + ‘%’,””)
WHILE @TableName IS NOT NULL
BEGIN
SET @ColumnName = ”
SET @TableName =
(
SELECT MIN(QUOTENAME(TABLE_SCHEMA) + ‘.’ + QUOTENAME(TABLE_NAME))
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE = ‘BASE TABLE’
AND QUOTENAME(TABLE_SCHEMA) + ‘.’ + [...]

Read Full Post »

taskkill /F /IM WebDev.WebServer.exe
START /D “C:\Program Files\Common Files\microsoft shared\DevServer\9.0\” /B WebDev.WebServer.EXE /port:5002 /path:”$PROJECT PATH” /vpath:”/PROJECT”
Example:
taskkill /F /IM WebDev.WebServer.exe
START /D “C:\Program Files\Common Files\microsoft shared\DevServer\9.0\” /B WebDev.WebServer.EXE /port:5002 /path:”d:\Projects\myproject\project.service” /vpath:”/Project.Service”

Read Full Post »

By default, the maximum file size to upload is 4MB. To increase it, simply add this section in web.config:
This will dictate the maximum size to be 5MB.

Read Full Post »

File MIME Type Using C#

string fileName = “C:\\somefile.vsd”;
string mimeType = “application/unknown”;
string ext = System.IO.Path.GetExtension(fileName).ToLower();
Microsoft.Win32.RegistryKey regKey = Microsoft.Win32.Registry.ClassesRoot.OpenSubKey(ext);
if (regKey != null && regKey.GetValue(“Content Type”) != null)
{
mimeType = regKey.GetValue(“Content Type”).ToString();
}

Read Full Post »

This is a great article from CodeProject: http://www.codeproject.com/KB/WCF/WCFMultipleHosting.aspx

Read Full Post »

Things to do to setup a the right conection string in production:

The connection string shouldn’t have user in it, but the following: “Data Source=SERVER_NAME;Initial Catalog=DATABASE_NAME;Integrated Security=true;”
Create a user, say: User1 under “Local Users and Groups”. Set the password.
Change the application pool’s “Identity” to the user User1 just created.
Add in SQL Server the user using “Windows [...]

Read Full Post »

As the window is closing, windows fire an event before onunload that the user can capture to do “something” before the window closes. Or, just prevent it from closing.
The code:
 window.onbeforeunload = function()
{
    return ‘Prompt message…’;
}

Read Full Post »

Interaction with a Web application can be initiated via a synchronous page postback or an out-of-band postback, known as a client callback, from the client to the server.  The default ASP.NET Web page model uses synchronous page postbacks, which are usually triggered on the client by submitting an html form.  During a page postback, the Web page and controls [...]

Read Full Post »

<html>
<head>
<script type=”text/javascript”>
var shiftOn = false;
var ctrlOn = false;
var altOn = false;
var focusedValue = “0″;
function validateNumeric(obj)
{
if (obj.value.length == 0)
{
obj.value = focusedValue;
return false;
}
[...]

Read Full Post »

Older Posts »