Long time no update
I haven’t had the desire to spend much time adding posts or upgrading this website lately although I still keep the O/S up-to-date.
Eliminate gtk warnings
The following post helped me out a lot this morning:
When executing the vmware workstation bundle, the following gtk2 errors are displayed:
Extracting VMware Installer…done.
Gtk-Message: Failed to load module “pk-gtk-module”: libpk-gtk-module.so: cannot open shared object file: No such file or directory
Gtk-Message: Failed to load module “canberra-gtk-module”: libcanberra-gtk-module.so: cannot open shared object file: No such file or directory
Create a gtk2 configuration file and reload libraries.
~]# echo “/usr/lib64/gtk-2.0/modules” > /etc/ld.so.conf.d/gtk2.conf
The installer should run without gtk2 errors.
Microsoft Excel Carriage Return in a Cell
To go to the next line in a cell without skipping directly to the next cell type in:
Banner for Red Hat Enterprise Linux 7
Below is the simplest way to change the login banner for RHEL 7.
sudo -u gdm dconf-editor —> org —> gnome —> login-screen
sudo -u gdm dconf update
Banner for Red Hat Linux 6
chmod u+s /lib64/dbus-1/dbus-daemon-launch-helper
#disable power button
sudo -u gdm /usr/bin/gconftool-2 —type bool —set /apps/gdm/simple-greeter/disable_restart_buttons true
#disable showing local user list
sudo -u gdm /usr/bin/gconftool-2 —type bool —set /apps/gdm/simple-greeter/disable_user_list true
#enable the banner and display /etc/issue
sudo -u gdm /usr/bin/gconftool-2 —type bool —set /apps/gdm/simple-greeter/banner_message_enable true
sudo -u gdm /usr/bin/gconftool-2 —type string —set /apps/gdm/simple-greeter/banner_message_text “$(cat /etc/issue)”
Intel Graphics for CentOS 6
Recently, I started seeing error messages regarding many bad sectors in the hard drive in my HP laptop. After looking at various websites I determined that it wouldn’t be a bad idea to purchase a new hard drive as opposed to trying to fix this issue with disk utilities.
After purchasing and installing the new hard drive, I had to install CentOS again. One thing I quickly noticed is that the default Installer did not seem to work so I tried “Install with basic video driver”. Long story short, after doing the install with the basic video driver I had to do 2 things to enable CentOS to use the Intel graphics card.
1. Edit the /etc/X11/xorg.conf file replacing the word “vesa” with “intel”
2. Edit the /boot/grub/menu.lst file by removing the word “nomodeset”
Credit is voluntarily given to the person who created the website below.https://jehurst.wordpress.com/2011/06/26/rhel-6-for-the-clueless-intel-graphics/
PostgreSQL Current Process List
To kill a process:
— don’t kill my own connection!
procpid <> pg_backend_pid()
— don’t kill the connections to other databases
AND datname = ‘database_name’;
Or you can just leave off the FROM clause
To view process details:
SELECT datname, procpid, current_query FROM pg_stat_activity;
Why can’t CompTIA reward their certification holders with a certificate that is a normal size? What’s up with the 8.5” x 5.5” dimensions??
Linux Authentication Without a Password
Steps to generate SSH keys on a client machine and transfer to a remote server for authentication:
On Remote Server:
Turn PasswordAuthentication off in /etc/ssh/sshd_config
Restart SSHD Service
On Client Server:
[username@localhost ~]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_rsa):
Created directory ‘/home/username/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_rsa.
Your public key has been saved in /home/username/.ssh/id_rsa.pub.
The key fingerprint is:
The key’s randomart image is:
—[ RSA 2048]—— | . . .. | |..oo | |
[username@localhost ~]$ cd /home/username/.ssh/
[username@localhost .ssh]$ cp id_rsa.pub authorized_keys
[username@localhost .ssh]$ chmod 700 /home/username/.ssh
[username@localhost .ssh]$ chmod 600 /home/username/.ssh/authorized_keys
[username@localhost .ssh]$ ssh-copy-id email@example.com
The authenticity of host ‘dommain.com (22.214.171.124)’ can’t be established.
RSA key fingerprint is 00:c9:00:be.
Are you sure you want to continue connecting (yes/no)? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed — if you are prompted now it is to install the new keys
Number of key(s) added: 1
Now try logging into the machine, with: “ssh ‘firstname.lastname@example.org’”
and check to make sure that only the key(s) you wanted were added.
Create a new PostgreSQL user
Example of how to create a user in PostgreSQL copied directly from:
$ createuser -P -s -e joe
Enter password for new role: xyzzy
Enter it again: xyzzy
CREATE ROLE joe PASSWORD ‘md5b5f5ba1a423792b526f799ae4eb3d59e’ SUPERUSER CREATEDB CREATEROLE INHERIT LOGIN;
-P prompts for password
-s specifies superuser
-e echoes the commands
Upgrade User Permissions in PostgreSQL
ALTER USER name WITH SUPERUSER;
“All matter originates and exists only by virtue of a force… We must assume behind this force the existence of a conscious and intelligent Mind. This Mind is the matrix of all matter.”
Check I/O in Linux
[root@wks1 ~]# hdparm -tT /dev/sda
Convert .ova to .vmx
[root@wks]# ovftool test.ova test.vmx
I found http://invoice-generator.com a few minutes ago.
Thoughts of the day
My manual database migration from Sybase 12.5.3 to 15.7 was a complete success. It makes me very happy.
Living and Learning
I’m just like anyone else. I make mistakes.
One thing I am still trying to do is learn from other people’s mistakes.
There are some points I need to remember that are below the next time I decide to work for another client:
1. Have a signed contract outlining the work to be performed and the amount of money to be paid.
2. Do not do ANY work without receiving a deposit, specifically half up front and the other half BEFORE receiving code, not after, no exceptions.
4. Know what your services are worth and charge accordingly.
5. Don’t do work outside of the contract. If you agreed on creating two different web pages, then do not do three pages just because the client asked.
Any questions? Read rules 1-5 again.
This site below is very useful for generating a textured background for a website.
I was really not wanting to hear tonight that I am going to have to get the speakers I bought online from bavsound.com professionally installed. Well, let me back up a minute. First, I went to their website which stresses how easy it is to replace the factory speakers by yourself. Then I took out my wallet and bought some speakers. I spent a few days waiting. And I was happy tonight that my speakers arrived. I didn’t think much of it that they wanted me to go to their website and download the instructions since they were not included. OK, no problem. Until I got the following:
Maybe this is for the best — I don’t know.
How do I log in to MySQL via the command line in Linux?
mysql -h localhost -u myname -p mydb
An A-Z Index of the Windows CMD command line
Helpful information below for those of us fortunate enough to work with Windows DOS batch files!
Burn ISO to DVD
Use ImgBurn! It’s Free!
Sing Your Death Song
So live your life that the fear of death can never enter your heart.
Trouble no one about their religion;
respect others in their view, and demand that they respect yours.
Love your life, perfect your life, beautify all things in your life.
Seek to make your life long and its purpose in the service of your people.
Prepare a noble death song for the day when you go over the great divide.
Always give a word or a sign of salute when meeting or passing a friend,
even a stranger, when in a lonely place.
Show respect to all people and grovel to none.
When you arise in the morning give thanks for the food and for the joy of living.
If you see no reason for giving thanks, the fault lies only in yourself.
Abuse no one and no thing, for abuse turns the wise ones to fools
and robs the spirit of its vision.
When it comes your time to die, be not like those whose hearts are filled
with the fear of death, so that when their time comes they weep
and pray for a little more time to live their lives over again in a different way.
Sing your death song and die like a hero going home.
Sybase 12.5 Useful Commands
From the command line: isql -U sa -D database_name
dump database database_name_no_quotes
The keyword go must be used unlike the semicolon Oracle uses.
Quote of the day
“Educated men are as much superior to uneducated men as the living are to the dead.” – Aristotle, 384–322 B.C.
Oracle NOT NULL Constraints
NOT NULL constraints can not be created “out of line” such as in the following example:
CREATE TABLE PORTS
(PORT_ID NUMBER, PORT_NAME VARCHAR2, CONSTRAINT PORT_ID_NN NOT NULL (PORT_ID) );
However, the following is correct syntax:
CREATE TABLE PORTS
(PORT_ID NUMBER, PORT_NAME VARCHAR2, CONSTRAINT PORT_ID_UN UNIQUE (PORT_ID) );
Forgot Your Windows Admin Password?
Install Programs In Citrix
D:\>CHANGE USER /INSTALL
Enable install mode. This command has to be run before installing any new software on a Terminal Server.
Loading Data into MySQL
These notes below are for me and me alone. :)
load data infile‘D:\filename.csv’into table tablenamecolumns ENCLOSED BY ‘’‘’ESCAPED BY ‘,’
Restore Master database
1. create a new master device:
dataserver -b “location of datafiles”
2. start ASA in single-user mode
startserver -f RUN_SYBASE -m
3. load the backup — once completed it will shut down ASA automatically
load database master from “location of master backup”
4. start ASA in single-user mode and check that all databases, devices, logins appear to be restored correctly
Sybase 15.7 Drop All Constraints
Below is a script to drop all of the constraints of a database regardless of the table owner:
sp_configure ‘allow updates’, 1
declare cur cursor
select SOR.Name as ‘constraint’, s2.name as ‘owner’, SOT.Name as ‘table’
from sysreferences SR
join sysobjects SOR on SOR.id = SR.constrid
join sysconstraints SC on SC.constrid = SR.constrid
join sysobjects SOT on SOT.id = SC.tableid
join sysusers s2 on SOT.uid = s2.uid
declareSQL varchar(500)open cur
fetch cur into
sqlstatus = 0)
SQL = 'setuser ' + '''' +owner + ‘’‘’
SQL = 'alter table '+owner+’.’‘ drop constraint ‘+@constraint
exec (SQL)fetch cur into
deallocate cursor cur
Empty The Sybase Transaction Log
One issue I’ve had is downloading a purchase made on another device and then playing on my iPod. For some reason something is not quite right and iTunes “thinks” I’m not eligible to listen to whatever it is I bought.
Delete all traces of the file on both my iPod and my computer. Sign Out of iTunes. Change my password. Sign back in iTunes. Download the file again.
By Pilot Officer John Gillespie Magee
Oh! I have slipped the surly bonds of Earth
And danced the skies on laughter-silvered wings;
Sunward I’ve climbed, and joined the tumbling mirth
of sun-split clouds, — and done a hundred things
You have not dreamed of — wheeled and soared and swung
High in the sunlit silence. Hov’ring there,
I’ve chased the shouting wind along, and flung
My eager craft through footless halls of air….
Up, up the long, delirious, burning blue
I’ve topped the wind-swept heights with easy grace.
Where never lark, or even eagle flew —
And, while with silent, lifting mind I’ve trod
The high untrespassed sanctity of space,
- Put out my hand, and touched the face of God.
SQL Server and Sybase Versions
It’s fairly easy to find out which version of SQL Server / Sybase you’re using. Both Microsoft SQL Server and Sybase implement T-SQL so the command below will work for either RDBMS. Just open a query window and type in:
But if you don’t have access to query a database that resides on a SQL Server instance you can always go to the registry and find out by going to the following key:
—> Microsoft SQL Server
—> “Your SQL Server Instance”
Connecting to Oracle Enterprise Manager
I don’t usually install Oracle that often, but when I do it’s usually a successful install without too much fuss. Well, lately I’ve noticed I can’t get Enterprise Manager up in Internet Explorer. At first I just blamed it on the internet security settings being too harsh, but today I had some free time so I decided to make certain I have the talent to open it.
Long story short not being able to view the Enterprise Manager is caused by a certificate with a key length of less than 1024 bits according to Microsoft: http://support.microsoft.com/kb/2661254
open a command prompt
certutil -setreg chain\EnableWeakSignatureFlags 8
browse to Enterprise Manager
If I could say one thing about working as an IT Professional it is this: the projects you are asked to complete usually have very poor documentation accompanying them (if any). I have a current project where I am converting an application and database over from Sybase to Oracle with IBM WebSphere as the application software.
It sounds really easy, but isn’t…
Oracle Install Tips
There are probably multiple data files that are zipped up that you need to unzip to install.
For me, installing 11g 32-bit on Windows 2003 Enterprise Server, I had 6 total zip files to unzip before officially attempting to install Oracle.
My biggest tip is to first unzip each zip file to the same directory. Otherwise you are guaranteed to get errors.
You may still get errors, but if you are trying to install each zip file separately then forget ‘bout it.
Converting Folder To ISO
A VMware Virtual Machine can connect to ISO files locally. However, not every file that needs to be uploaded to the VM is in an ISO format.
So, to solve this problem I have downloaded Folder2ISO. It does this one task and does it very well for FREE!
Cat 6 Cables
I’m really good with a lot of things computer-related. However, one thing I struggle with is making Cat 6 cables!
It’s been a long year but a good year. Instead of focusing on the negative I will focus on the positive for this post. The list below is in no particular order.
- Went to New Orleans for the first time
- Reconnected with some old friends
- Met some new friends
- Got a new job
- Finally got some use out of that SQL Server 2008 book I bought a few years ago
- Improved my web programming skills
- Ate some really good food
- Learned to be more patient in life and not be so down on myself all the time
I now have my MCITP for SQL Server 2008!
Debugging SQL Server Stored Procedures
I’ve written probably 100,000 lines minimum of SQL Server stored procedures. I had to. Otherwise they wouldn’t have paid me. Some of those stored procedures took hours to run. So if I was debugging them I couldn’t necessarily wait that long on the PRINT function in SQL Server to show me what results I was expecting because that function does not produce output until the stored procedure is over. So I turned to the RAISERROR function. It’s kind of a “hack” as it’s designed to show errors mainly (I think) but I use it since it has the option of NOWAIT which should be pretty explanatory. Below is an example:
raiserror ( ‘text goes right here’ , 0 , 1 )
Oracle 11g Client Install on Windows 7 x64
After many hours trying to get Oracle to work with SQL Server I decided to give up with the current software installed and reinstall the client for 11g. Long story short the only way I was able to get this to work was running the setup on the command line as follows:
I'm Still Here
The world didn’t end (yet). It’s 12 – 21 – 2012!
SQL Server Maximum Key Length
Warning! The maximum key length is 900 bytes. The index ‘PK_BATCH_ORACLE_SHIPMENTS’ has maximum length of 919 bytes. For some combination of large values, the insert/update operation will fail.
This message bothered me until I found a way around it (kind of sorta). Instead of using all 360 characters of a particular field to use as a key I chose to use only 320 (it’s a customer name). I used a calculated column with keyword PERSISTED.
So…instead of using
[customer] [nvarchar](360) not null
as my primary key I use part of it instead
[customer_truncated] as left ([customer], 330) persisted
I hope this helps anyone interested in overcoming this issue (although I hope you can find better columns to build a primary key…).
Divide by Zero
Instead of using a CASE statement inside a SELECT statement in SQL Server, I have found a better, cleaner method is to implement NULLIF which takes two parameters and compares them. If they are equal then NULL is returned. This forces the divisor to become NULL instead of zero. And dividing by NULL makes the entire equation NULL.
For my project this morning I need to return 0 instead of NULL so I will also implement a COALESCE function which compares the output.
So rather than use this logic below:
when isNull(divisor, 0) = 0
end as value
select coalesce( numerator / nullif( divisor, 0 ) , 0)
SQL Server Date Conversions from Excel
Going from Excel data to SQL Server data shouldn’t be difficult. A common problem when doing this conversion is how to go from an Excel date like ’6/4/2011 11:34’ to a SQL Server date that is identical, but with a datetime data type. The first thing to do in SQL Server is to convert the data from NVARCHAR to Float. From there convert the float to datetime. It really is almost too easy.
cast([column name] as float)
-2 as datetime
) from [table]
Oracle Patch Install
I ran into an issue installing an Oracle patch a few months ago. The solution was found at:
Just though I would share my findings on this issue.
I’m a Information Assurnace engineer for a large communications company. I’m responcible for developing security solutions for a vast array of Windows based devices. Recently it had come to my attention that our security solution was blocking the install of the JAVA Runtime Enviroment. I naturally set to work on a resolution and here is what ultimatly solved this problem. I noticed that the JRE install worked on a freshly installed copy of the OS, but after applying security settings. . .they immediatly failed. I was able to root cause our failure to two registry keys. Below is the details:
Please note, that we had this 1330 error due to the fact that our prodcuts are NOT connected to the internet, hence they are off-line.
This solution worked for: XP, 2003, 2008, Vista, and 7.
WARNING: I cannot be held responcible for any issues the below may cause. Plase use at your own risk. Take good notes so that you can restore the two settings below to the origional “as found” values. Exporting the registry key before making changes is a good idea, that way it can be restored.
Basically there are two registry keys that can cause the JRE install to fail with 1330.
The first Key is a very complex beast. It is located in:
Registry Hive: HKEY_CURRENT_USER
Subkey: \Software\Micorosft\Windows\CurrentVersion\WinTrust\Trust Providers\Software Publishing\
Value Name: State
The default windows value for “STATE” should be 23c00 in hexidecimal / 146432 decimal. If the STATE value is NOT 23c00, then someone, or something changed this setting for a reason, and this is the root cause of your problem. Now, the quick and easy fix is to set this key back to 23c00 HEX. But you may want to investigate why this value was changed. . .it may be important.
The resason why this settin is complex, is because the BINARY representation of this number activates a bunch of switches related to .NET security. 23c00 = 100011110000000000 in BINARY. Look at page 65 of this document (http://iase.disa.mil/stigs/checklist/dot_net_checklist_v1r2-3.pdf) to understand the individual switches, as I don’t have the time to explain them here. Please note however, that the DISA / FDCC / CIS security requriments for this setting is 10,000 HEX or 010000000000000000 BINARY, or 65536 DECIMAL. If you see this number, some form of security has been applied to your box. Please note that 10800 HEX, or 010001000000000000 BINARY, or 69632 DECIMAL will also fix the JAVA 1330 problem.
Lastly, since this setting is based on a “per-user” basis. . .this is the reason why logging into another account to install JRE sometimes works. If this setting was set in a LGPO or GPO. . .then all accounts would fail. But if this setting was only set in for one user, then all other user accounts would allow JRE to install.
NOTE: The above setting will fix 1330 ONLY if JRE had been installed previously. If the above setting does not resolve the problem, then you will need to change the following registry as well.
Registry Hive: HKEY_LOCAL_MACHINE
Value Name: DisableRootAutoUpdate
Quite simply, this registry value should NOT exist in a default install of any Windows OS. Once again, if this value exists someone or something has applied some level of security to the computer. Simply deleting this value (in conjunction with the about value) will enable JRE offline to install without errors.
PLEASE NOTE: It’s probably a good I idea to put these registry settings back to how your found them when you are done installing JRE. . .as these settings are important security settings.
Hope this helps,
Only a few more days and then I should be able to have a phone I can actually use in the office!
Clustered Server Issues
I was able to upgrade SQL Server 2008 with Service Pack 3 in a formerly clustered server by changing the following registry key from 2 to 0.
HKEY_LOCAL_MACHINE --> SOFTWARE --> Microsoft --> WindowsNT --> CurrentVersion --> Cluster Server --> ClusterInstallationState
Move All SQL Server System Databases
Copied directly from:
There are lots of articles, Links and sites that describe how to move system databases from the SQL default location to the location described by the DBA but still lot of users find difficult while moving them and land up in trouble. So I thought of wiriting an article for moving the databases so that the users can use the same and enjoy the task.
Tasks for moving system databases:
1.Moving tempdb databases.
a.) Execute the script below.
alter database tempdb
(NAME = tempdev,FILENAME=‘NEW PATH’);
alter database tempdb
(NAME = templog,FILENAME=‘NEW PATH’);
b.) Restart services.
c.) Confirm path of database files.
2. Moving model and msdb databases.
a.) Execute the script below.
alter database msdb
(NAME = MSDBData,FILENAME=‘NEW PATH’);
alter database msdb
(NAME = MSDBLog,FILENAME=‘NEW PATH’);
alter database model
(NAME = modeldev,FILENAME=‘NEW PATH’);
alter database model
(NAME = modellog,FILENAME=‘NEW PATH’);
b.) Stop services
c.) Copy the files to the new location
d.) Restart services.
e.) Confirm path of database files.
3.) Moving master database:
a.) Edit the startup parameters to reflect the new path for –d, –l and -e parameters.
b.) Stop the services.
c.) Move the master and resource database files to the new location
d.) Change the sql port to different one than usual to avoid excess connections and create an alias with that port
e.) Start the services using NET START MSSQLSERVER /f /T3608 (*MSSQLSERVER is for default instance, if you have installed named instance then you need to use NET START MSSQL$Instancename /f /T3608)
f.) Execute the script given below from sqlcmd
alter database mssqlsystemresource
(NAME = data,FILENAME=‘NEW PATH’);
alter database mssqlsystemresource
(NAME = log,FILENAME=‘NEW PATH’);
alter database mssqlsystemresource set READ_ONLY;
g.) Stop the services
h.) Change the port back to 1433
i.) Remove the alias
j.) Start sql services.
k.) Confirm if the data files and log files reside on desired path.
Passed my CompTIA Security+ test this morning. I am very happy as I don’t want to study for it any more and definintely did not want to spend another $276 to take it again if I didn’t pass. I am planning on upgrading my MCITP SQL Server 2005 Certification to the 2008 version next.
Microsoft Excel data import to SQL Server
This is a very common task, data import to SQL Server from Excel. Load the Excel file with First Row as Header off even it contains the header. This can ensure all the fields are read in text format. And then add a Conditional Split to skip the first row.
Oracle Date Comparisons
Comparing date ranges is a frequent action completed in Relational Database Management Systems. One of my favorite ways of decided whether an arbitrary date is between two other dates is use of the word BETWEEN in SQL Server. As luck (or something else) would have it, Oracle also has a BETWEEN function. This is a good thing! However, make sure the dates you’re comparing are actually of the date data type OR if they’re of the timestamp data type. And it’s very possible you may hardcode the date value so you would have to use the to_date(‘dd-mmm-yy’) syntax to convert your hardcoded value from a string data type to a date data type.
Oracle Table Details
Desc is a good way to find out vital details about an Oracle table. An even better was is to use SQL Developer, highlight the table name, right-click (or hit Shift – F4). Not only do you get data types, but also other vital details like table dependencies and primary key details.
I thought I knew PL/SQL fairly well, but there’s always something to learn. Today’s lesson involved the dreaded ORA-01971: not a SELECTed expression error. Long story short, it’s not cool to have an Order By and Distinct function in the same Select statement. CORRECTION: just found this bit of wisdom on stackoverflow.com: “When doing a DISTINCT your order by needs to be one of the selected columns.”
Obviously my Order By was incorrect. Oh well. Actually doesn’t matter a bit b/c it’s going straight into SQL Server 2008 R2 Enterprise Version.
It’s 11/11/11. All ones. Kind of neat.
Locked Out Of SQL Server??
How to get back in SQL Server 2005 / 2008 if you are locked out AND have local admin rights on your server:
- Start the instance of SQL Server in single-user mode by adding ;-m to the end of the startup parameters
- Start command prompt as local administrator
- Connect to the server:
sqlcmd -E -S . (be sure to add the period!)
- Add yourself (computername\username) to the sysadmin SQL group:
- create login [computername\username] from windows;
- exec sp_addsrvrolemember ‘computername\username’, ‘sysadmin’;
- Restart the server in normal mode
Not Giving Up
It was very frustrating to spend a week trying to figure out exactly why I couldn’t get an Oracle password to persist in a SQL Server Intergration Services Project, but decided this AM to try a different route of using an ADO NET data source instead of OLE DB mainly for the purpose of programmatically getting a connnection to work…But I finally did it.
A great day at Kiawah!
Had a great day at the Ocean Course today. It was windy and cold, but worth the drive.