Ben’s Digital

Icon

Runner Never Stop

SSMS Connection to SQL Azure

Please be aware that SSMS is not supported with SQL Azure yet. However, you can use the following workaround for the time being:

1. Click Cancel in Connect to Server Dialog
2. Click New Query which will bring up the new connection dialog.
3. Enter your credentials. By default, you will connect to Master database. If you want to connect to specific database, click options and enter the database name. Please be aware that USE is not supported.
4. Now click Connect and you will get an error “Unable to apply connection settings. The detailed error message is: ‘ANSI_NULLS’ is not a recognized SET option. “
5. Click Ok.

Filed under: AZure, Database, SQL

Turn on Virtual Machine on Virtual Server Automatically

To autostart Virtual Machine, open Virtual Server web administration. With the VM off, edit the configuration for the VM you want to Autostart. Under the General Properties, you’ll see options to automatically turn on the virtual machine. You need to check Run virtual machine under the following user account, and type username and password. Click OK to save the settings.

Filed under: Virtual PC

SQL convert string ‘mmddyy’ to date time format

1) T-SQL scalar function
CREATE FUNCTION DBO.[format_mmddyy_date] (@mmddyy_value varchar(6)) returns smalldatetime
as
begin
 declare @return_value smalldatetime
 set @return_value =(select CAST(
   substring(Right(‘000000′ + convert(varchar(6),@mmddyy_value),6),1,2)
 +’/'+substring(Right(‘000000′ + convert(varchar(6),@mmddyy_value),6),3,2)
 +’/'+substring(Right(‘000000′ + convert(varchar(6),@mmddyy_value),6),5,2)
 as smalldatetime))
 return @return_value
end

2) SQL Select statement
select CAST(
 substring(Right(‘000000′ + convert(varchar(6),@mmddyy_value),6),1,2)
 +’/'+substring(Right(‘000000′ + convert(varchar(6),@mmddyy_value),6),3,2)
 +’/'+substring(Right(‘000000′ + convert(varchar(6),@mmddyy_value),6),5,2)
 as smalldatetime)

*replace the @mmddyy_value w/ your variable, column or string (e.g ‘071509′)

Filed under: Database, SQL

Could not load type ‘_Default’.

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type ‘_Default’.

you have to make sure that you build the application after moving it to the new server. (In Visual Studio, right click > build web site) and copy the bin folder w/ the .dll 

 

Filed under: ASP.NET

The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

The current identity (NT AUTHORITY\NETWORK SERVICE) does not have write access to ‘C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files’.

In a cmd box, type:

c:\Windows\Microsoft.net\framework\v2.0.50727\aspnet_regiis –i

Filed under: ASP.NET

Change the Color of row in DataGrid C# asp.net

1) add the Item Data Bound to event handler

OnItemDataBound=”ItemDataBoundEventHandler” 

2) add the following function to code behind

void ItemDataBoundEventHandler(object sender, DataGridItemEventArgs e)
{  
      string qa_id =Convert.ToString(DataBinder.Eval(e.Item.DataItem, “QA_ID”)); //QA_ID is the column name
      string eod_id = Convert.ToString(DataBinder.Eval(e.Item.DataItem, “EOD_ID”)); //EOD_ID is another one

  if ((qa_id.Trim() == “” || qa_id.Trim() == null) &&
          eod_id !=”"
          && eod_id !=null) //check  for condition for the row that need to have the color changed
      {
          e.Item.BackColor = System.Drawing.Color.AliceBlue;
          e.Item.ForeColor = Color.Red;
                  
      }
}

Filed under: ASP.NET, C#

SQL Update Value of column/row from another row

If you have one table and you want to update the value of the current row with the values from another row(NOT the column of the current row)

e.g. column LN, FN, MI of the current rows that you want to update from another rows in the table (replace the tableName of your table, keyColumn of the key that you want to match and t1 and t2 conditions

--UPDATE VALUE FROM ONE ROW TO ANOTHER ROW
UPDATE t1
SET
SUB_LN = t2.SUB_LN
,SUB_FN = t2.SUB_FN
,SUB_MI = t2.SUB_MI
FROM tableName AS t1
INNER JOIN
tableName AS t2
ON t1.keyColumn = t2.keyColumn
WHERE t1.updateCondintion = 'U'
AND t2.valueCondition ='V'

Filed under: Database, SQL

System.Configuration.ConfigurationSettings.AppSettings’ is obsolete

Using the System.Configuration.ConfigurationSettings.AppSettings["whatever"] and getting the obsolete error message?

While  the definition of “obsolete” might be arguable, it still works - but of course you should fix it. Change to

System.Configuration.ConfigurationManager. AppSettings["whatever"]

If you are getting an error on that one – add a reference to System.Configuration.dll, cause appearantly Microsoft have moved the AppSettings class out of the System dll.

Filed under: C#

Net use command

Net use command

http://www.cezeo.com/tips-and-tricks/net-use-command/

connects / disconnects the computer from a shared resource, or allow to view the information about current computer connections. This command also can controls persistent network connections. If you will use net use command without any parameters, you will retrieves a list of network current connections.

 
Net use command syntax:
net use [{DEVICE | *}] [\\COMPUTER\SHARE[\VOL]] [{PASSWORD | *}]] [/USER:[DOMAIN\]USER] [/USER:[DOTTEDDOMAIN\]USER] [/USER: [USER@DOTTEDDOMAIN] [/SAVECRED] [/SMARTCARD] [{/DELETE | /PERSISTENT:{yes | no}}]

net use [DEVICE [/HOME[{PASSWORD | *}] [/DELETE:{yes | no}]]

net use [/PERSISTENT:{yes | no}]

Net use command parameters:
DEVICE : Assigns a name to connect to the resource or specifies the device to be disconnected. There are two kinds of device names: disk drives (that is, D: through Z:) and printers (that is, LPT1: through LPT3:). Type an asterisk (*) instead of a specific device name to assign the next available device name.

\\COMPUTER\SHARE : Specifies the name of the server and the shared resource. If COMPUTER contains spaces, use quotation marks around the entire computer name from the double backslash (\\) to the end of the computer name (for example, “\\Computer Name\Share Name”). The computer name can be from 1 to 15 characters long.

\VOL : Specifies a NetWare volume on the server. You must have Client Service for NetWare installed and running to connect to NetWare servers.

PASSWORD : Specifies the password needed to access the shared resource. Type an asterisk (*) to produce a prompt for the password. The password is not displayed when you type it at the password prompt.

/USER : Specifies a different user name with which the connection is made.

DOMAIN : Specifies another domain. If you omit DOMAIN, net use uses the current logged on domain.

USER : Specifies the user name with which to log on.

DOTTEDDOMAIN : Specifies the fully-qualified domain name for the domain where the user account exists.

/SAVECRED : Stores the provided credentials for reuse.

/SMARTCARD : Specifies the network connection is to use the credentials on a smart card. If multiple smart cards are available, you are asked to specify the credential.

/DELETE : Cancels the specified network connection. If you specify the connection with an asterisk (*), all network connections are canceled.

/PERSISTENT:{yes | no} : Controls the use of persistent network connections. The default is the setting used last. Deviceless connections are not persistent. Yes saves all connections as they are made, and restores them at next logon. No does not save the connection being made or subsequent connections. Existing connections are restored at the next logon. Use /DELETE to remove persistent connections.

/HOME : Connects a user to the home directory.

net help command : Displays help for the specified net command.
Net Use Command

Net use command Remarks:
Connecting and disconnecting from a network resource

Use net use to connect to and disconnect from a network resource, and to view your current connections to network resources. You cannot disconnect from a shared directory if you use it as your current drive or an active process is using it.

=> Viewing connection information

To view information about a connection, you can do either of the following:

=> Type net use DEVICE to get information about a specific connection.

=> Type net use to get a list of all the computer’s connections.

=> Using deviceless connections

Deviceless connections are not persistent.

=> Connecting to NetWare servers

After you install and run Client Service for NetWare, you can connect to a NetWare server on a Novell network. Use the same syntax that you use to connect to a Windows Networking server, except you must include the volume you to which you want to connect.

=> Using quotation marks

If the ServerName that you supply contains spaces, use quotation marks around the text (that is, “SERVER”). If you omit quotation marks, an error message appears.

How Authentication Works for Net Use Command
When you use the NET USE command to connect to a share on a server in a domain, the following authentication process verifications take place:
=> If the client’s user name is in the domain’s UAS account database, the passwords are compared. If the passwords match, access is allowed to the share. If the passwords do not match, an access denied message is returned.

The behavior allows for backward compatibility with Windows for Workgroups and other clients. These clients do not pass the domain name to the Server.
=> If the client’s user name does not match a user name in the domain’s UAS, the domain controller checks to see if the client’s domain is listed in its trust list. If the client’s domain name is on the target domain’s trust list, the domain controller communicates with the other domain to see if the client’s user account and password are valid. If so, access is allowed to the share. If not, an access denied message is returned.
Net Use Command examples
To assign the disk-drive device name E: to the Letters shared directory on the \\Fin server, type:

net use e: \\fin\letters

To assign (map) the disk-drive device name M: to the directory Mike within the Letters volume on the \\Fin NetWare server, type:

net use m: \\fin\letters\mike

To connect the user identifier Dan as if the connection were made from the Accounts domain, type:

net use d:\\server\share /USER:Accounts\Dan

To disconnect from the \\Fin\Public directory, type:

net use f: \\fin\public /DELETE

To connect to the resource memos shared on the \\Fin 3 server, type:

net use k: “\\fin 3″ \memos

To restore the current connections at each logon, regardless of future changes, type:

net use /PERSISTENT:yes

Filed under: Windows

Emacs Command Summary

C-SP     set-mark-command C-q      quoted-insert
C-a      beginning-of-line C-r      isearch-backward
C-b      backward-char C-s      isearch-forward
C-c      exit-recursive-edit C-t      transpose-chars
C-d      delete-char C-u      universal-argument
C-e      end-of-line C-v      scroll-up
C-f      forward-char C-w      kill-region
C-h      help-command C-x      Control-X-prefix
TAB      indent-for-tab-command C-y      yank
LFD      newline-and-indent C-z      suspend-emacs
C-k      kill-line ESC      ESC-prefix
C-l      recenter C-]      abort-recursive-edit
RET      newline C-_      undo
C-n      next-line SPC .. ~        self-insert-command
C-o      open-line DEL      delete-backward-char
C-p      previous-line

C-h v    describe-variable C-h d    describe-function
C-h w    where-is C-h k    describe-key
C-h t    help-with-tutorial C-h c    describe-key-briefly
C-h s    describe-syntax C-h b    describe-bindings
C-h n    view-emacs-news C-h a    command-apropos
C-h C-n  view-emacs-news C-h C-d  describe-distribution
C-h m    describe-mode C-h C-c  describe-copying
C-h l    view-lossage C-h ?    help-for-help
C-h i    info C-h C-h  help-for-help
C-h f    describe-function

C-x C-a  add-mode-abbrev C-x 5    split-window-horizontally
C-x C-b  list-buffers C-x ;    set-comment-column
C-x C-c  save-buffers-kill-emacs C-x <    scroll-left
C-x C-d  list-directory C-x =    what-cursor-position
C-x C-e  eval-last-sexp C-x >    scroll-right
C-x C-f  find-file C-x [    backward-page
C-x C-h  inverse-add-mode-abbrev C-x ]    forward-page
C-x TAB  indent-rigidly C-x ^    enlarge-window
C-x C-l  downcase-region C-x `    next-error
C-x C-n  set-goal-column C-x a    append-to-buffer
C-x C-o  delete-blank-lines C-x b    switch-to-buffer
C-x C-p  mark-page C-x d    dired
C-x C-q  toggle-read-only C-x e    call-last-kbd-macro
C-x C-r  find-file-read-only C-x f    set-fill-column
C-x C-s  save-buffer C-x g    insert-register
C-x C-t  transpose-lines C-x h    mark-whole-buffer
C-x C-u  upcase-region C-x i    insert-file
C-x C-v  find-alternate-file C-x j    register-to-dot
C-x C-w  write-file C-x k    kill-buffer
C-x C-x  exchange-dot-and-mark C-x l    count-lines-page
C-x C-z  suspend-emacs C-x m    mail
C-x ESC  repeat-complex-command C-x n    narrow-to-region
C-x $    set-selective-display C-x o    other-window
C-x (    start-kbd-macro C-x p    narrow-to-page
C-x )    end-kbd-macro C-x q    kbd-macro-query
C-x +    add-global-abbrev C-x r    copy-rectangle-to-register
C-x -    inverse-add-global-abbrev C-x s    save-some-buffers
C-x .    set-fill-prefix C-x u    advertised-undo
C-x /    dot-to-register C-x w    widen
C-x 0    delete-window C-x x    copy-to-register
C-x 1    delete-other-windows C-x {    shrink-window-horizontally
C-x 2    split-window-vertically C-x }    enlarge-window-horizontally
C-x 4    ctl-x-4-prefix C-x DEL  backward-kill-sentence

ESC C-SP mark-sexp ESC =    count-lines-region
ESC C-a  beginning-of-defun ESC >    end-of-buffer
ESC C-b  backward-sexp ESC @    mark-word
ESC C-c  exit-recursive-edit ESC O    ??
ESC C-d  down-list ESC [    backward-paragraph
ESC C-e  end-of-defun ESC \    delete-horizontal-space
ESC C-f  forward-sexp ESC ]    forward-paragraph
ESC C-h  mark-defun ESC ^    delete-indentation
ESC LFD  indent-new-comment-line ESC a    backward-sentence
ESC C-k  kill-sexp ESC b    backward-word
ESC C-n  forward-list ESC c    capitalize-word
ESC C-o  split-line ESC d    kill-word
ESC C-p  backward-list ESC e    forward-sentence
ESC C-s  isearch-forward-regexp ESC f    forward-word
ESC C-t  transpose-sexps ESC g    fill-region
ESC C-u  backward-up-list ESC h    mark-paragraph
ESC C-v  scroll-other-window ESC i    tab-to-tab-stop
ESC C-w  append-next-kill ESC j    indent-new-comment-line
ESC ESC  ?? ESC k    kill-sentence
ESC C-\  indent-region ESC l    downcase-word
ESC SPC  just-one-space ESC m    back-to-indentation
ESC !    shell-command ESC q    fill-paragraph
ESC $    spell-word ESC r    move-to-window-line
ESC %    query-replace ESC t    transpose-words
ESC ‘    abbrev-prefix-mark ESC u    upcase-word
ESC (    insert-parentheses ESC v    scroll-down
ESC )    move-past-close-and-reindent ESC w    copy-region-as-kill
ESC ,    tags-loop-continue ESC x    execute-extended-command
ESC -    negative-argument ESC y    yank-pop
ESC .    find-tag ESC z    zap-to-char
ESC 0 .. ESC 9  digit-argument ESC |    shell-command-on-region
ESC ;    indent-for-comment ESC ~    not-modified
ESC <    beginning-of-buffer ESC DEL  backward-kill-word

C-x 4 C-f       find-file-other-window C-x 4 d  dired-other-window
C-x 4 .  find-tag-other-window C-x 4 f  find-file-other-window
C-x 4 b  pop-to-buffer C-x 4 m  mail-other-window

Filed under: Emacs

Flickr

  • Bensdigital Flickr

Twitter

  • Bensdigital Twitter