linux tips

Download Linux tips

If you can't read please download the document

Upload: h-kheir

Post on 26-May-2015

550 views

Category:

Technology


3 download

DESCRIPTION

The following topics are covered: adding a new locale, adding a keyboard indicator, adding more languages to the keyboard indicator, Linux & Windows networking, showing hidden folders,sound level adjustments, building playlists, Setting up printers, starting database programs MySQL, Firebird, Postgres (psql), kexi, openoffice org base

TRANSCRIPT

  • 1. Linux operating system related tips1)Adding a new locale (eg. Arabic).2)Adding a keyboard indicator to the panel (or system tray).3)Adding more languages to the keyboard indicator to enable the keyboard to produce the alphabet ofother languages (eg. Arabic).4)Linux & Windows talking and understanding each other.5)Showing hidden folders (directories).6)Sound level adjustments .7)Building playlists in kmplayer.8)Setting up printers.9)Starting database programs: MySQL, Firebird & Postgres (psql).10)Building a playlist manually that later can be opened (loaded and played) by Totem, kmplayer orRealPlayer. Plus much moreAdding an new locale:1)Open the Synaptic Package Manager2)Click Settings in the main menu, then choose Repositories, then make only 1 repository active (eg.http://pclosusers.com/pclosfiles/) and click OK3)Click Reload, then Mark All Upgrades and finally Apply4)Click Addlocale and follow the prompts5)After this process is over, logout and login, the locale will change to the new one including user IDand password will be in the new language (eg. Arabic)Adding a keyboard indicator (even for 1 language):1)Click Configure Desktop icon2)Click Hardware, then Input Devices3)Click Keyboard, choose the Layout tab4)Mark (by clicking) the Show for single layout radio button, then click ApplyAdding more languages to the keyboard indicator:PCLOS1)Open Synaptic Package Manager, download and install the package pertinent to the language youwant to add, in our example here the Arabic language package will be downloaded and installed.Choose kde4-10n-ar package.2)Click Configure Desktop icon. Choose Common Appearance, then pick Locale, chooseCountry/Region & Language3)In the Locale tab, click Add Language, choose Arabic and click Apply4)Now, click Hardware, then Input Devices, followed by Keyboard, then choose the Layouts tab5)Click the configure Layouts radio button, the push button with the label Add Layout will becomeactive, click it and in the pop-up window, click the arrow in yhe layouts field and choose Arabic, thenclick OK and Apply6)From the Layout indicator on the panel you can choose between english and arabic language for thekeys (of the keyboard) to typeMEPIS1)Click System Settings icon2)Click Regional & Language

2. 3)Click Keyboard Layout, choose the layout you want (eg. Arabic) and then click the arrow to add tothe list of active layouts4)If you want to add lets say Arabic language to the Country/Region & Language, open SynapticPackage Manager, download and install the package pertinent to the language you want to add, in ourexample here the Arabic language package will be downloaded and installed (the kde4-10n-arpackage)5)Click System Settings icon, then click Regional & Language, click the push button with AddLanguage label and choose Artabic, then click Apply and you are done.Linux & Windows talking & understanding each other (on a LAN):Before getting 2 machines one having Linux OS and the other Windows on a LAN, lets first show howWindows XP and 7 can see each other using a crossover Ethernet cable.1)A unique workgroup name (we shall use WORKGROUP here) has to be set all machines on thenetwork (whether running Windows or Linux):1-1) Windows XP: Click Start, then right click My Computer, select Properties, change workgroupname. To WORKGROUP1-2) Windows 7: Click Start, then right click Computer select properties, change settings and assign theworkgroup name.2)In order to make the machines discoverable (seen by other machines on the network), the securitysettings have to be adjusted accordingly2-1) Windows 7: when you click Networks, a pop up frame will appear, when you click you will get adrop down menu, choose Turn on network discovery, then click Make Network Private.2-2) Windows XP: open Control Panel, choose the Security Center icon, then click Window Firewall,click the Exception tab, then mark File and folder sharing radio button, then OK and you are done.3)Now, in order to share files, you would have to do the following:3-1) Windows XP: for example, right click Shared Documents, then choose Properties, click Sharingtab, in the Network sharing and security sub-section click Network Wizard for the firsst time, otherwiseclick Share this folder on the network.3-2) Windows 7: right click the folder, select Properties then the Sharing tab and click Share. To changethe setting go to Network & Sharing center.Windows 7 and PCLOS1)Setting samba on PCLOS:1-1) Click Configure your computer1-2) Choose Network & Internet, tthen click Hosts definition, click 17..0.0.1, then modify, change thehost name to something acceptable (eg. Mike, pclos1,..) and click OK.1-3) Now click Network Sharing, choose Share drives & directories with Windows, from the menu,click Samba Server then choose configure, then click Standalone and OK. Click the SAMBA Userstab, click Add and enter the user(s) id(s) and password(s0 for those allowed to access these remotedirectories from the machine having the Windows 7 OS.1-4) Now, click Local Disks. Then Share your Hard Disk Partitions and Allow all users.1-5) From the Control Center or you can exit and from the Network Center (clicking the icon in thesystem tray), you set the wired Ethernet network interface (IP address,...). Here, we shall continuefrom within the Control Center and later when we set up the network interface in Mepis we shall usethe Network Center icon. Click Internet & Network, click Set up a new network interface, click Wired(Ethernet), then Next, select the Network interface to configure, then click Next, Select thecommunication protocol (in this case Manual) then hit Next, enter the IP address ()192.168.1.1), theNetmask is entered automatically (if not it is 255.255.255.0) then the gateway (connection to theInternet) address (eg. 192.168.1.1) and the host name, hit Next, in this screen select the connectioncontrol methods you like (eg. Allow users to mange connection, start at boot,..),click Next answer the 3. question whether you want the connection to start now and hit Next and thats it.2)Setting the Ethernet (wired) interface on the machine with Windows 7 operating systems:2-1) click Networks, then choose Network & Sharing Center, click Change Adapter Settings, right-click the pertinent connection (Local Area Connection, wired LAN), then from the pop-up menuchoose Properties, pick the Internet Protocol Version 4 TCP/IPv4 & click properties, from the windowthat will appear, click the Alternate Configuration, click User configured and enter the required data (inour example: IP address: 192.168.1.2, Subnet mask: 255.255.255.0, Default gateway: 192.168.1.1) thenclick OK.Windows 7 & MEPIS1)Windows 7: As above2)MEPIS: click the Network Control (center) icon in the system tray, from the pop-up menu, clickManage connections, click Wired tab, then click Add, from the screen you will get, first choose theEthernet tab and choose the networking interface you want to configure (in our case the wired Etherneteg. Eth0), then click the IP address tab and enter the required data (in our example, they are192.168.1.1, 255.255.255.0 and 192.168.1.1). Click OK and thats it.A couple of smb. Conf files (found in /etc/samba directory) the first was tried successfully on MEPISand the second on PCLOS:The MEPIS one:;*******************section global*****************[global]# Do something sensible when Samba crashes: mail the admin a backtracepanic action = /usr/share/samba/panic-action %dprinting = cupsworkgroup = WORKGROUPserver string = %h server (Samba %v)hosts allow = 192.168.0. 192.168.1. 192.168.2. 192.168.79. 127. 10.0.0. 10.1.1.socket options = IPTOS_LOWDELAY TCP_NODELAYlog level = 1dead time = 15wins support = yeshide unreadable = yespassdb backend = tdbsamdns proxy = nohost msdfs = nomax log size = 1000security = usermap to guest = Bad Passwordrestrict anonymous = nodomain master = nopreferred master = nomax protocol = NTldap ssl = Noserver signing = Autooplocks = Nolevel2 oplocks = No;*******************section user***************** 4. [Shared]path = /home/kheirha/Sharedguest ok = yesread only = no[Music]path = /home/kheirha/Musicguest ok = yesread only = no;*******************section homes*****************[homes]comment = Home Directoriesbrowseable = noguest ok = noread only = no;*******************section printers*****************[printers]comment = All Printerspath = /tmpbrowseable = noprintable = yesguest ok = yescreate mode = 0700The PCLOS one:[global] workgroup = WORKGROUP ;netbios name = MYNAME security = user null passwords = true username map = /etc/samba/smbusers hostname lookups = yes hosts equiv = /etc/hosts hosts allow = All ;hosts deny = All interfaces = lo eth0 bind interfaces only = yes guest ok = yes printing = CUPS printcap name = CUPS[printers] comment = All Printers browseable = no printable = yes writable = no public = yes guest ok = yes path = /var/spool/samba printer admin = root 5. [DEFAULT PRINTER]comment = PRINTERNAMEprintable = yespath = /var/spool/sambapublic = yesguest ok = yesprinter admin = root[PUBLIC]path = /HOME/PUBLICbrowseable = yesread only = noguest ok = yespublic = yescreate mode = 766[home_directories]path = /home/%Uread only = novalid users = %U rootShowing hidden folders:Linux (eg. MEPIS or PCLOS):1)Open the file manager (eg. Dolphin)2)From the menu, click View, then choose Show hidden files3)the same process is used to hide the originally hidden filesWindows XP:1)Open Explorer (Windows)2)From the menu, click Tools and choose Folder options3)In the opened window, choose the View tab4)Click the radio button Hidden files & foldersSound adjustment in Linux (eg. MEPIS & PCLOS):1)Right click the volume icon found in the system tray2)Click Select Master Channel, click speaker and then OK3)Click the volume button and adjust the volume (using the virtual knob)4)Click the volume icon, then click Mixer5)Raise the virtual knob of the PCM to the maximum or close and you are set, enjoy listeningBuilding playlists in KMPlayer:1)To add one favourite video file at a time. Click the file under the Most Recent category and drag it tothe Prisistant Playlists, you will have the option to add it to Add to List or Add in New Group. Whenyou choose the first file in a group all the records in the group will be played one after the other.2)In order to add a list of files one shot to the playlist or to a group, you have to access the fileplaylist.xml and open it in a text editor (eg. gedit). This file is found in Home > .kde4 > share > apps >kmplayer. All files the starts with a dot (.) are hidden, show you should use the steps given abovesection Showing hidden folders to get them visible. 6. 3)You can copy the files you want to include in a list and paste them in the playlist.xml file and makesimilar modification as shown below then save the file and run kmplayer:For MEPIS, the file could be something similar to the following (having the files on a flash memoryUSB in folder named yyy):For PCLOS, the file could be something similar to the following (having the files on a flash memoryUSB in folder named yyy):Installing & setting up printers:There are 4 methods that any one of them may be used to install and setup printers in Linux. Hesemethods are: HP Printer Management Application (used mainly to install & setup HP machines),CUPS (in any web browser, Firefox, Opera, Seamonkey,......etc, type http://localhost:631/admin),using System Settings or Configure Computer and finally downloading the appropriate driver andinstalling it (using software management package eg. Synaptic or the terminal).A) HP Printer Management Application (this process used on PCLOS to install HP Deskjet D1663):1)Click Start (PC) button, then choose HP Printe33r Management Application, then select Setup Device(rather than CUPS web interface)2)From the screen with the title HP Device Manager, Device Discovery, select the appropriate radiobutton (in our example, Universal Serial Bus USB), click Next3)Select your printer from the list shown in Select From Discovered Devices (in our case, HP Deskjetd1600 series), click Next 7. 4)In the Setup Screen, accept the Printer name (or change it, its up to you), add Description & Location(if so you desire), accept the PPD file and click Add Printer push-buttonB) CUPS web interface:1)Open any web browser and type in the location bar the following: http://localhost:631/admin andenter or click the arrow in the location bar2)Click Find (or Add) Printer push-button, click on the local printer (radio button) attached to yournetbook (or laptop), through the USB (in our case), click continue3)Accept the name & description (or change them), add the location and click continue4)In the ADD printer page select the model (eg. HPDeskjet d1600 series, hpcups 3.10.9), click AddPrinter5)Leave the default options as is or change according to your likings, click Set Default OptionsC) Using Configure your Computer option:1)Click Configure your Computer icon, choose Hardware, then click Set up the Printers2)In the new printer found window, make sure it is the correct one attached to the USB of your machineand click OK and you are done.Starting database programs: MySQL, Firebird & Postgres (psql):After you have installed any or all of these database software packages under Linux, now you want tostart using them, you will find hereafter the starting steps to get going.A) MySQL:1)Open the terminal (konsole), then log in as the superuser (eg. typing su and entering your passwordwhen prompted to do so)2)Type the following on the command line: /etc/init.d/mysqld startyou get the following output: Starting MySQL: .,[ OK ]Now, type mysql and you are inB) Firebird:1)Open the terminal (konsole), then log in as the superuser (eg. typing su and entering your passwordwhen prompted to do so)2)type gsec, when you get the prompt inside Firebird, type display to get a list of users.3)Type help and you will get a list of acceptable commands for example adding a user with a name andpassword plus other options, .etcC) Postgres:1)Open the terminal (konsole), then log in as the superuser (eg. typing su and entering your passwordwhen prompted to do so)2)Type in su postgres (respecting the spaces given)3)type psql, now you are in the database, type help and you will get the essential help commands:Type: copyright for distribution terms h for help with SQL commands ? for help with psql commands g or terminate with semicolon to execute query q to quit4)Under certain circumstances you migt have to type 1 of the following lines before step 3 above:(this line starts the server)postgres -D /var/lib/pgsql/data 8. or pg_ctl -D /var/lib/pgsql/data -l logfile startBuilding a playlist manually that later can be opened (loaded and played) by Totem, kmplayer orRealPlayer:1)Open a text editor blank document (eg. gedit, kwrite, or any other one).2)Enter all the media files (videos) as shown in the example below:[playlist]NumberOfEntries=4File1=movie1File2=movie2File3=movie3File4=movie43)Save this file in the folder where the movie files are stored in,.and give it the name playlist.pls.4)Later on, you can right-click the playlist and choose the program to open the play list with ooo base a database program that runs under Linux and can import structure (schema) and data from Access (.mdb file extension) through gmdb2 0.6pre1 (GNOME MDB Viewer is a graphical interface to MDB Tools. It lets you view and export data and schema from MDB filesproduced by MS Access 97/2000/XP/2003)Fig. 1 9. Fig. 2 Fig. 3The first example, here, will cover the process to import a .mdb (Access database) into openoffice orgbase program. Though, to achieve this objective, you have to download and install MDB tools andGNOME MDB Viewer which is a graphical interface to MDB Tools. It lets you view and export data 10. and schema (structure) from MDB files (tables) produced by MS Access 97/2000/XP/200. You may usethe software package manager (eg. Synaptic) to search, download and install the above mentionedpackages. Having done that here is the procedure:1)Open the terminal (konsole). Type in gmdb2, the progam will open, choose from the menu File, clickit and choose Open or click the Open icon, choose the database with the .mdb extension that you wouldlike to export its table (as text). Fig. 1 above.2)Highlight the table you want to see its data, definition or to Export. Now, click Export, you will getthe window shown in fig.2 above. Click Browse and move to the folder where you want to save theexported file to (eg. dicthk.txt).and click OK, then Export. Gmdb2 didd its job.3)Now close the database and exit mdb2. Open openoffice org base program. The database Wizard willopen, Check Select Database, click Connect to an existing database (radio button), choose Text fromthe pull-down list, then click Next. Fig. 4 below.4)Now you are at Set up connection to text files, click browse and find the folder to which you hadsaved the exported tables using gmdb2 in point (2) above (select the path to the Text files), Fig. 5below. Click Finish, then save the new database with the already saved text tables (structure & data)under a name of your choice and the extension .ODF will be added automatically, click Save.5)Openoffice.org base database program will be opened with whatever tables you already save usinggmdb2, fig. 6 below.6) Now you can add new tables, construct queries based on any table in the database file, build screens(forms) to access the data in the tables (adding, modifying, deleting), prepare reports, write procedures,...etc. Fig. 4 11. Fig. 5 Fig. 67) In base, when you want to build a screen (form), you may use any of these 2 ways: Create Form in 12. Design View or Use Wizard to Create Form. In our example here we shall use the former method.Click forms to the left of you screen, the choose Create Form in Design View, the form design windowwill open. From the tool bar (that has the controls) find the Label co9ntrol and insert/size it on theform. Then either click the Form icon in the tool bar to the left or right click the Label (control) andchoose from the pop-up menu the Control item, click the General tab and enter the name of the form,then click the Data tab and in the Content Type field Query (you have the option to choose betweenTable, Query, SQL command) and the query name or t able in the content field. Now dd the text Boxesto which the query or table fields will be displayed.8) If you want to change the format of the text displayed in the label control, then right-click the labeland choose Control from the pop-up menu, then in the General tab go to font and click the square nextto this field and proceed from there. If you want to make changes a form that you have already created,right click it and choose Edit.9) You can create Queries in one of 3 available options, namely, Create Query in Design View, UseWizard to create Query and Create Query in SQL View. In our explanation here we shall use the firstmethod.10) Click Create Query in Design View, you will get a popp-up window listing all tables, choose thetable on which you want to run the query on, choose the table and click Add. Go to the table belowstarting with the field, click the arrow and choose the field name from the table you had chosen, thenconfirm the table having the field, then set the sort sequence (none, ascending, descending) then saveyou query and you are done. You may now create a screen (form) to display the query in it followingthe process given in (7) above.Here is an example file including screens (forms), queries and imported table using the aboveprocedure: dicttech.odb fileShown below are the macros used (using openoffice basic language), you will find them under Tools-->Organize Macros-->OpenOffice.org Basic-->dicttech.odb-->Standard-->Module1:Sub test1 oContexto = CreateUnoService("com.sun.star.sdb.DatabaseContext") oFonte = oContexto.getRegisteredObject("dicttech") oForms = oFonte.DatabaseDocument.FormDocuments oAConnection = oFonte.getConnection("","") Dim pProp(1) As New com.sun.star.beans.PropertyValue pProp(0).Name = "ActiveConnection" pProp(0).Value = oAConnection pProp(1).Name = "OpenMode" pProp(1).Value = "open" oForm = oForms.loadComponentFromURL("tech_dict", "_blank", 0, pProp())End SubSub test2 oContexto = CreateUnoService("com.sun.star.sdb.DatabaseContext") oFonte = oContexto.getRegisteredObject("dicttech") oForms = oFonte.DatabaseDocument.FormDocuments 13. oAConnection = oFonte.getConnection("","") Dim pProp(1) As New com.sun.star.beans.PropertyValue pProp(0).Name = "ActiveConnection" pProp(0).Value = oAConnection pProp(1).Name = "OpenMode" pProp(1).Value = "open" oForm = oForms.loadComponentFromURL("en_fr_f", "_blank", 0, pProp())End SubSub test3 oContexto = CreateUnoService("com.sun.star.sdb.DatabaseContext") oFonte = oContexto.getRegisteredObject("dicttech") oForms = oFonte.DatabaseDocument.FormDocuments oAConnection = oFonte.getConnection("","") Dim pProp(1) As New com.sun.star.beans.PropertyValue pProp(0).Name = "ActiveConnection" pProp(0).Value = oAConnection pProp(1).Name = "OpenMode" pProp(1).Value = "open" oForm = oForms.loadComponentFromURL("fr_en_f", "_blank", 0, pProp())End SubSub test4 oContexto = CreateUnoService("com.sun.star.sdb.DatabaseContext") oFonte = oContexto.getRegisteredObject("dicttech") oForms = oFonte.DatabaseDocument.FormDocuments oAConnection = oFonte.getConnection("","") Dim pProp(1) As New com.sun.star.beans.PropertyValue pProp(0).Name = "ActiveConnection" pProp(0).Value = oAConnection pProp(1).Name = "OpenMode" pProp(1).Value = "open" oForm = oForms.loadComponentFromURL("en_sp_f", "_blank", 0, pProp())End SubSub test5 oContexto = CreateUnoService("com.sun.star.sdb.DatabaseContext") oFonte = oContexto.getRegisteredObject("dicttech") 14. oForms = oFonte.DatabaseDocument.FormDocuments oAConnection = oFonte.getConnection("","") Dim pProp(1) As New com.sun.star.beans.PropertyValue pProp(0).Name = "ActiveConnection" pProp(0).Value = oAConnection pProp(1).Name = "OpenMode" pProp(1).Value = "open" oForm = oForms.loadComponentFromURL("sp_en_f", "_blank", 0, pProp())End Sub kexi a database that runs under Linux and can import structure and data from Access (.mdbfile extension)1)After installing kexi, open the database software.2)When you open the software you will have to make a few choices, the first is the tab, whethercreating a new project or opening an existing one, if you choose the former then the second would bewhether you want to create a blank database, create from template or import a database.3)In our case we shall be importing a database (with .mdb extension), click import a database, thenclick OK. You will be taken to the wizard screens (windows), when you click Next you will have toselect projects stored in a file or on a database server, then choose the file you want to import. ClickNext.4)Then you will be asked whether you want to store (destination) the database to a file or on a server, inour case will be the former. Click Next5)now you have to enter a name of the database being imported. Now select the location (folder) wherethe database file is going to be stored (saved), click Next.6)You will be prompted to choose between whether to import the structure and data or structure only, inour case the choice would be the former, then click Next. Follow the last 2 windows which are self-explanatory.7)Now in the opened database, you can add the screens (forms), select fields and data sources,..etc.8)Move the cursor over Create tab and click Forms, in the Property Editor, choose the Data Source tab,choose the Forms Data Source from the tables or Queries available in the opened database.9)Move to the Form Design area, move the cursor over Form Design and start adding the controls(labels, text boxes, button check box,..etc.), in our example her,e we shall click a text box and move tothe form and insert/size the text box. Now, move to the Property Editor, click Data Source, confirm theForms Data Source and choose the Widgets Data Source (widget is the text box and the data source isthe field in the table that will feed this text box).10) Now to have a main screen to call from which other screens and queries, click Create tab, selectForm, then click the Button control (after moving the cursor to the Form Design tab). Then you maypress the right button of the mouse and choose Assign Action or click the Assign Action (havinglightning symbol) button at the top of the screen.An example dicttech.kexi.tar.gzFor further information related Linux operating system, applications and programming refer to: Linux and linux related pages