Automatically Mount Partitions on Ubuntu

Automatically Mount Partitions on Ubuntu

There are broadly two aproaches -

Per-user mounting (usually under /media)

Systemwide mounting (anywhere, often under /mnt)

Per-user mounting does not require root access, it's just automating the desktop interface. Systemwide mounts (/etc/fstab) can allow access from before login, and are therefore much more suitable for access through a network, or by system services.

Viewing the system's physical information

To read the layout of the physical disks in the system, the 'fdisk' command is used. Before panicking, realize that fdisk will be used with only non-destructive options; specifically, it will be used with 'l' (lower-case 'L', not '1'), which lists the partition table of the specified disk.
sudo fdisk -l
Disk /dev/sda: 500.1 GB, 500107862016 bytes
255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x1baf0215

  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     7813119     3905536   82  Linux swap / Solaris
/dev/sda2         7815166   976771071   484477953    5  Extended
Partition 2 does not start on physical sector boundary.
/dev/sda5         7815168    56641535    24413184   83  Linux
/dev/sda6        56643584   447266815   195311616   83  Linux
/dev/sda7       447268864   976771071   264751104   83  Linux

If the system has multiple hard disk drives, multiple lists will be displayed.

Per-User Mounts

You can do the same thing on the command line with the udisks tool easily.
/usr/bin/udisks --mount /dev/sdb1
The bit after --mount is the device name of the partition you want to mount. (/dev/something)

Finding the UUID of your partition

A device name like /dev/sdb1 is based on where your physical drive is plugged in and the order the drives were made available to the computer, so if your computer changes the same command could mount a different partition. It's possible for this to happen just from a software upgrade.

The solution is to use a UUID. A UUID is a globally unique name for the partition. A UUID will remain the same if you put an internal disk into an external USB caddy, or change the name of the partition.

 ls -al /dev/disk/by-uuid/ 
you will see an entry that matches the name :

total 0
drwxr-xr-x 2 root root 120 Apr 18 07:55 .
drwxr-xr-x 5 root root 100 Apr 18 07:55 ..
lrwxrwxrwx 1 root root  10 Apr 18 07:55 78a8d4f4-8739-407b-93fe-7fe23b560e74 -> ../../sda5
lrwxrwxrwx 1 root root  10 Apr 18 07:55 93b20629-db77-4a2f-998c-bc2df0227bbf -> ../../sda1
lrwxrwxrwx 1 root root  10 Apr 18 07:55 bb9a474e-a5a5-4b1c-9b98-e6becda49640 -> ../../sda6
lrwxrwxrwx 1 root root  10 Apr 18 07:55 f24b64fc-93df-4070-8181-4d3c1487763a -> ../../sda7


You can now determine the command you need for mounting the device by UUID. For our example it would be
/usr/bin/udisks --mount /dev/disk/by-uuid/78a8d4f4-8739-407b-93fe-7fe23b560e74 
Of course you need to replace 78a8d4f4-8739-407b-93fe-7fe23b560e74  with the UUID of the device you want to mount.

Editing Ubuntu's filesystem table
Sometimes we need to mount our disk automatically.It needs to edit Ubuntu's FS table and
It is possible to break Ubuntu if some of the earlier lines in the file opened during this step are modified, so be sure to read this section carefully.
Ubuntu's filesystem table is located at '/etc/fstab'. Open this file for editing by running the following command for Ubuntu.
gksu gedit /etc/fstab
The file opened contains lines of the form
<device> <location> <Linux type> <options> <dump> <pass>.
Every element in this line is separated by whitespace (spaces and tabs).

# /media/data1 was on /dev/sda6 during installation
UUID=bb9a474e-a5a5-4b1c-9b98-e6becda49640 /media/data1    ext4    defaults        0       2

Save file and exit then restart your computer. It ll mount your disk automatically when your computer start.




How to dress up your popular post widget in blog with CSS

How to dress up your popular post widget in blog with CSS

How to customize popular post on our blogger blog???
It looks not stylish so here we will see how to dress up this in simple steps.

This will change your fonts and colors and boarder also. And this will not effect on your page speed. Because we are using popular post given by the blogger itself. We are only styling our popular post widget using the cascaded style sheet.




 1.


Go to Dashboard >> Design - Edit HTML >> Expand Widget Template 

2.


Use (CTRL + F) to find this code:

]]></b:skin>

Now add below css code to above the code :

/*--- Careerandtricks.com Popular Posts --- */
.popular-posts ul{padding-left:0px;}
.popular-posts ul li {background: #FFF url(http://1.bp.blogspot.com/_7wsQzULWIwo/ SmodosCuJCI/AAAAAAAABh4/ZSXbVW9Qpa8/s400/261.gif) no-repeat scroll 5px 10px;
list-style-type: none;
margin:0 0 5px 0px;
padding:5px 5px 5px 20px !important;
border: 1px solid #dddddd;
border-radius:10px;
-moz-border-radius:10px;
-webkit-border-radius:10px;}.popular-posts ul li:hover {
border:1px solid #6BB5FF;
}.popular-posts ul li a:hover {
text-decoration:none;
}

Customization:

For the change of border color in static mode change #dddddd.
For the change of border color in mouse hover mode change #6BB5FF.

3.

When done, save your template and exit.



Oracle Function PLSQL: Conversion date to number (hour,min)

Oracle Function : Conversion date to number (hour,min)

Use this function to get conversion date variable to number(hour,min) :

The function would generate date variable, (date1-date2) becomes number (hour,min)

FUNCTION GET_DURATION(d1 number) RETURN VARCHAR2 IS
--# d1 = tanggal awal
--# d2 = tanggal akhir
tmpvar VARCHAR2(100);
durdays NUMBER(20, 10); -- days between two dates
durhrs BINARY_INTEGER; -- completed hours
durmin BINARY_INTEGER; -- completed minutes
dursec BINARY_INTEGER; -- completed second
durhari PLS_INTEGER;
jhrs number;
jmin number;
thrs number;
BEGIN
durdays := d1;

durhari := TRUNC(d1);

durhrs := MOD(TRUNC(24 * durdays), 24);
durmin := MOD(TRUNC(durdays * 1440), 60);
dursec := MOD(TRUNC(durdays * 86400), 60);

jhrs :=(to_number(durhari)*24)+to_number(durhrs||'.'||lpad(durmin,2,'0'));
thrs :=jhrs;
RETURN(thrs);
END get_duration;


How to use :

select GET_DURATION(date_variable) from dual;

example :
select GET_DURATION(date1-date2) from dual;
or
select GET_DURATION((date1-date2)-(date3-date4)) from dual; 

Oracle Designer 6i: How install SQLLDR on win xp


Oracle Designer 6i: How install SQLLDR on win xp

A few weeks ago, i was looking for some articles that discuss "How to install SQLLDR on windows xp?" but i did not get satisfactory results.

After studying some of the structures that exist within the application Designer 6i, I did a little improvisation.

Oracle Designer 6i: How install SQLLDR on win xp?


1.

Download SQLLDR package by this link below.
http://www.4shared.com/zip/YEkcRoB3/sqlldr.html?

2.

Exact the file and it contains 2 files "des_817" and "des_817.reg"

3.

Copy folder  des_817 onto "C:\des_817"

4.

Run des_817.reg

5.

Set up the network connection by "regedit"
HKEY_LOCAL_MACHINE >> SOFTWARE >> ORACLE >> HOME2


TNS_ADMIN = "your networking path"

mine
TNS_ADMIN = C:\orades\net80\admin

How to use :

1.

Open command prompt (Run >> cmd)

2.


Type this script :
C:\des_817\bin\sqlldr userid=usr/pass@sid control=ctlfile
:)

Oracle Form 6i: How to put database data into List Item(Combo Box)?

Oracle Form 6i: How to put database data into List Item(Combo Box)?

Last days around, i just tried to make some List Item(ComboBox) that filed from database selected. . .
It's pretty good and easy enough.

1.

Create Program Unit :


PROCEDURE CREATE_Filenames_RG  IS
-- Andrew Fraser v2.2 27th May 2010
-- Populate dynamic lookup

    it_id1   Item := Find_Item('block.my_list_item');

    group1_id    RecordGroup;

    GRP_status       NUMBER;

    V_Space varchar2(10) := ''''||'0'||'''';

BEGIN

  group1_id := Find_Group('FILENAMES_RG');

  IF NOT Id_Null(group1_id) THEN
   delete_group(group1_id);
  END IF;
  group1_id := Create_Group_From_Query('FILENAMES_RG',
        'SELECT field FROM table ORDER BY field') ;

    Grp_status := Populate_Group('FILENAMES_RG');
   IF Grp_status = 0 THEN
If Not Id_Null(it_id1) THEN
  If Get_Item_Property(it_id1,Item_Type) = 'LIST' Then
   Clear_List(it_id1);
   Populate_List(it_id1,'FILENAMES_RG');
    END IF;
END IF;
END IF;

End;


2.

Create/edit triggers to call this:

On form startup:
When-New-Form-Instance on the form as a whole:

CREATE_Filenames_RG;

3.


And/or on mouse click if you want the database table requeried every single time the user clicks on the dropdown:

When-Mouse-Click on the new item itself:

Clear_List('CAS_UPLOAD');
Clear_Item;
CREATE_Filenames_RG;

easy right??


How to set Oracle Database in Arcivelog Mode ::Oracle10g

How to set Oracle Database in Arcivelog Mode ::Oracle10g

Here;s  How to set Oracle Database in Arcivelog Mode ::Oracle10g :

1.

SHUTDOWN immediate;

2.

STARTUP mount;

3.

ALTER DATABASE FLASHBACK ON;

4.

ALTER DATABASE ARCHIVELOG;

5.

ALTER DATABASE OPEN;


The startup command will use a temporary file as pfile with the following init.ora parameters:

6.


ALTER SYSTEM SET log_archive_dest_10 = "LOCATION=/media/data2/oracle_kjks_backup/archivelogs
OPTIONAL REOPEN=300" SCOPE=SPFILE;
spfile='/media/data1/oracle/product/10.2.0/dboracle/dbs/spfileorcl.ora'