MayfieldGlobal

Everything from operating systems, programming to web development and more.

Jan
11

How do I change the name of an existing user account in Linux?

Posted under Linux, Shell
  1. From the desktop, press Alt+F2 to launch the Run Application window.
  2. Type:gnome-terminalthen press Enter. This will launch a user terminal (similar to Windows command prompt).
  3. At the terminal prompt, type:suthen press Enter. When prompted, type the root (administrator) password then press: Enter. You now have a root terminal session.
  4. At the root terminal, type:usermod -l new old where new is the new username and old is the old / existing username then press: Enter. The username is now changed.

Jan
10

How do I change the access permissions for a file or directory using chmod?

Posted under Linux, Shell

The chmod (change mode) command is used to set file and directory permissions in Linux operating systems. The most common use of chmod is to grant or revoke read (r), write (w) or execute (x) permissions for an owner / user (u), a user group (g) or other / anonymous (o) users. Below is a depiction of a typical permissions set for a file:

read permissions for owner / user (u)
|write permissions for owner / user (u)
||execution permissions for owner / user (u)
||| read permissions for other / anonymous (o)
||| |write permissions for other / anonymous (o)
||| ||execution permissions for other / anonymous (o)
||| |||
-rwxr-xr-x
| |||
| ||execute permissions for user group (g)
| |write permissions for user group (g)
| read permissions for user group (g)
file/directory ("-" for file "d" for directory)

Current permissions information may be obtained by using the terminal command:
Read the rest of this entry »

Jan
10

How do I clear (onclick) and restore (onblur) the default value for a text field?

Posted under ASP.NET, JavaScript

Below is one example of how to clear the default text of a text field. In this example, the default text is: “Search Keywords”. If the user types text into the field, their entry will remain, allowing them the opportunity to click your “Search” button (or do whatever else is planned). However, if the user simply clicks into the field then clicks elsewhere (onblur), the default text will be returned.

<asp:TextBox ID="TextBox1" runat="server" class="searchfield" Text="Search Keywords"
onfocus="if(this.value=='Search Keywords')(this.value='');" onblur="if(this.value=='')(this.value='Search Keywords');" />

Essentially, the JavaScript reads like this: When the onclick event occurs, if the text in the text box is equal to: “Search Keywords”, set the text in the text box to nothing. When the onblur event occurs, if the text in the text box is nothing, set it to: “Search Keywords”.
Read the rest of this entry »

Jan
09

How do I concatenate characters or strings using SQL?

Posted under SQL Server 2005, T-SQL

Concatenation (joining 2 or more characters or strings of the same data type) is accomplished using the “+” operator. For example, let’s say that I want to join the strings “Able” and “Baker”. To do so, I would simply write:

SELECT 'Windows' + 'Vista' AS OSName

Running this query would return:
Read the rest of this entry »

Jan
09

How do I select only the date from a datetime data type?

Posted under SQL Server 2005, T-SQL

Selecting only the date portion from a datetime data type could be accomplished in a number of ways. One of the most convenient methods is to simply use CONVERT and one of the many style values.

SELECT GETDATE() AS MyDate

returns the default format:
Read the rest of this entry »