Tuesday, December 20, 2005

Coca-Cola = Cocaine-Cola

Claim: Coca-Cola used to contain cocaine.
Status: True.

Coca-Cola was named back in 1885 for its two "medicinal" ingredients: extract of coca leaves and kola nuts. Just how much cocaine was originally in the formulation is hard to determine, but the drink undeniably contained some cocaine in its early days. Frederick Allen describes the public attitude towards cocaine that existed as Coca-Cola's developers worked on perfecting their formula in 1891:

The first stirrings of a national debate had begun over the negative aspects of cocaine, and manufacturers were growing defensive over charges that use of their products might lead to "cocainism" or the "cocaine habit". The full-throated fury against cocaine was still a few years off, and Candler and Robinson were anxious to continue promoting the supposed benefits of the coca leaf, but there was no reason to risk putting more than a tiny bit of coca extract in their syrup. They cut the amount to a mere trace.
Allen also explains that cocaine continued to be an ingredient in the syrup in order to protect the trade name "Coca-Cola":

But neither could Candler take the simple step of eliminating the fluid extract of coca leaves from the formula. Candler believed that his product's name had to be descriptive, and that he must have at least some by-product of the coca leaf in the syrup (along with some kola) to protect his right to the name Coca-Cola. Protecting the name was critical. Candler had no patent on the syrup itself. Anyone could make an imitation. But no one could put the label "Coca-Cola" on an imitation so long as Candler owned the name. The name was the thing of real value, and the registered trademark was its only safeguard. Coca leaves had to stay in the syrup.
How much cocaine was in that "mere trace" is impossible to say, but we do know that by 1902 it was as little as 1/400 of a grain of cocaine per ounce of syrup. Coca-Cola didn't become completely cocaine-free until 1929, but there was scarcely any of the drug left in the drink by then:

By Heath's calculation, the amount of ecgonine [an alkaloid in the coca leaf that could be synthesized to create cocaine] was infinitesimal: no more than one part in 50 million. In an entire year's supply of 25-odd million gallons of Coca-Cola syrup, Heath figured, there might be six-hundredths of an ounce of cocaine.
So, yes, at one time there was cocaine in Coca-Cola. But before you're tempted to run off claiming Coca-Cola turned generations of drinkers into dope addicts, consider the following: back in 1885 it was far from uncommon to use cocaine in patent medicines (which is what Coca-Cola was originally marketed as) and other medical potions. When it first became general knowledge that cocaine could be harmful, the backroom chemists who comprised Coca-Cola at the time (long before it became the huge company we now know) did everything they could with the technology they had available at the time to remove every trace of cocaine from the beverage. What was left behind (until the technology improved enough for it all to be removed) wasn't enough to give a fly a buzz.

Have to realy realy stop drinking this, No one knows the secret formula for Coca Cola !!!

Sunday, December 18, 2005

How to open windows in the same browser control

The problem: how to make a browser control on a form, that will not open new windows after clicking a link with the _blank in the target property. It will open the same form (your form with the browser control).


Make form, put a Browser control

Forms Name = frmBrowser
Browser Control Name = AxWebBrowser1

Then just copy paste the this method in the form code.

Private Sub AxWebBrowser1_NewWindow2(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_NewWindow2Event) Handles AxWebBrowser1.NewWindow2
Dim frmWB As frmBrowser
frmWB = New frmBrowser(Me._URLClicked)

frmWB.AxWebBrowser1.RegisterAsBrowser = True
e.ppDisp = frmWB.AxWebBrowser1
frmWB.Visible = True
End Sub

Wednesday, December 07, 2005

How to Handle Click events of AxShockwaveFlash cotrol in .Net

Raise an event from Flash movie, and catch it in you application in the FSCommand handler

1. In your Flash movie you set this event for a button.


// This is an actionscript and to use it you need for Macromedia Flash
on (release) {
//On clic event
fscommand("exec", "Click_01");
}

2. Then in your Vb. Net application you catch the event

Private Sub AxShockwaveFlash1_FSCommand(ByVal sender As Object, ByVal e As AxShockwaveFlashObjects._IShockwaveFlashEvents_FSCommandEvent ) Handles AxShockwaveFlash1.FSCommand

If e.args.ToString = "Click_01" Then
MessageBox.Show("OK, an event occours")
End If


End Sub


How to reset a Seed Value in SQL Server

DBCC CHECKIDENT ( TableName , RESEED , NewSeedValue )

Simple, i didnt think it was this simple :D

Enjoy IT!

Thursday, December 01, 2005

Backup databases stored procedure using SQL LiteSpeed - new version

A lot of good information on Database Procedures that i didnt know about, like the registry, making directories, checking directory exists, and file exists.

And a very usefull procedure. Hope it helps

Tuesday, November 29, 2005

SQL Server 2000 Case ("COLLATION") problem

The problem that i was facing was with the case sensitiveness of SQL Server.
A default SQL Server installation is case insensitive, which means that SQL Server will not differentiate between upper and lower case characters/letters. That is, "Oracle" is the same as "ORACLE" or "oracle". But when it starts to differentiate, then its a very big problem.
The case problem now is callaed "COLLATION".

The steps to make things rite, do the following.

How to rebuild the master database (Rebuild Master utility)
To rebuild the master database

Shutdown Microsoft� SQL Server? 2000, and then run Rebuildm.exe. This is located in the Program Files\Microsoft SQL Server\80\Tools\Binn directory.


In the Rebuild Master dialog box, click Browse.


In the Browse for Folder dialog box, select the \Data folder on the SQL Server 2000 compact disc or in the shared network directory from which SQL Server 2000 was installed, and then click OK.


Click Settings. In the Collation Settings dialog box, verify or change settings used for the master database and all other databases.
Initially, the default collation settings are shown, but these may not match the collation selected during setup. You can select the same settings used during setup or select new collation settings. When done, click OK.

In the Rebuild Master dialog box, click Rebuild to start the process.
The Rebuild Master utility reinstalls the master database.

Thursday, July 21, 2005

Adding Serial Number in Crystal Reports

I had a requirement to add a serial number that would reset on each group, but i couldnt figure how to do it, until now. What I did to solve this. Just added an SQL Expression field, and gave its value 1. Then added a running total field for this SQL Expression, and had its Reset value to On Change Of Group.

Enjoy IT!!

Tuesday, July 12, 2005

Thursday, June 09, 2005

VS 2005 Beta

Now after looking at it a bit closer, i found out that Visual Basic with VS.NET 1.X was a mistake, vB 8 should have been released after VB 6.
As they have brought back all the goodies of VB 6 in VB 8. So the ppl that have not yet picked up VB 7, should just forget about it and start thereselves of with VB 8, that is with VS 2005.

Enjoy IT!

Wednesday, June 08, 2005

Create Insert Procedure for Tables

--Hope this is usefull, atleast it is for me

--USE DatabaseName

DECLARE @TABLENAME VARCHAR(100)
DECLARE @COLNAME VARCHAR(100)
DECLARE @COLTYPE VARCHAR(100)
DECLARE @LENGTH VARCHAR(100)
DECLARE @PROCEDURE VARCHAR(8000)

DECLARE ALLTABLES CURSOR FOR
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='U' AND SYSSTAT <> 8275
ORDER BY NAME

OPEN ALLTABLES

FETCH NEXT FROM ALLTABLES INTO @TABLENAME

WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT ''
SET @PROCEDURE = ''
--PRINT 'CREATE PROCEDURE AP_' + @TABLENAME + '_INSERT '
SET @PROCEDURE = @PROCEDURE + 'CREATE PROCEDURE ' + @TABLENAME + '_INSERT ' + CHAR(13)
--PRINT '('
SET @PROCEDURE = @PROCEDURE + '(' + CHAR(13)
--BEGIN PROCEDURE
DECLARE ALLCOLS CURSOR FOR
SELECT SC.[NAME],ST.[NAME], SC.LENGTH FROM
SYSOBJECTS SO INNER JOIN SYSCOLUMNS SC ON SO.ID = SC.ID
INNER JOIN SYSTYPES ST ON SC.XUSERTYPE = ST.XUSERTYPE
WHERE SO.XTYPE='U' AND SYSSTAT <> 8275 AND SO.[NAME] = @TABLENAME
OPEN ALLCOLS

FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT '@' + @COLNAME + ' ' + @COLTYPE
SET @PROCEDURE = @PROCEDURE + '@' + @COLNAME + ' ' + @COLTYPE
FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
if @@FETCH_STATUS = 0
BEGIN
--PRINT ', '
SET @PROCEDURE = @PROCEDURE + ', ' + CHAR(13)
END
END

CLOSE ALLCOLS
OPEN ALLCOLS
--SET @PROCEDURE = @PROCEDURE + CHAR(13)
--PRINT ') AS '
SET @PROCEDURE = @PROCEDURE + CHAR(13) + ')' + CHAR(13) + 'AS ' + CHAR(13)
--PRINT ' INSERT INTO ' + @TABLENAME + ' ('
SET @PROCEDURE = @PROCEDURE + 'INSERT INTO ' + @TABLENAME + ' ('

FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT @COLNAME
SET @PROCEDURE = @PROCEDURE + @COLNAME
FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
if @@FETCH_STATUS = 0
BEGIN
--PRINT ', '
SET @PROCEDURE = @PROCEDURE + ', '
END
END
CLOSE ALLCOLS
OPEN ALLCOLS

--PRINT ') VALUES ('
SET @PROCEDURE = @PROCEDURE + ') ' + CHAR(13) + 'VALUES ('

FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
WHILE @@FETCH_STATUS = 0
BEGIN
--PRINT ' @' + @COLNAME
SET @PROCEDURE = @PROCEDURE + '@' + @COLNAME
FETCH NEXT FROM ALLCOLS INTO @COLNAME, @COLTYPE, @LENGTH
if @@FETCH_STATUS = 0
BEGIN
--PRINT ', '
SET @PROCEDURE = @PROCEDURE + ', '
END
END
CLOSE ALLCOLS
DEALLOCATE ALLCOLS
--PRINT ')'
SET @PROCEDURE = @PROCEDURE + ')'
SET @PROCEDURE = @PROCEDURE + CHAR(13) + CHAR(13)
PRINT @PROCEDURE

--SELECT @PROCEDURE
--END PROCEDURE
FETCH NEXT FROM ALLTABLES INTO @TABLENAME
END
CLOSE ALLTABLES
DEALLOCATE ALLTABLES


--Enjoy IT!

Tuesday, June 07, 2005

Visual Studio 2005 Beta

At last got the VS.NET 2005 Beta CD's yesterday from Microsoft Germany through DHL,
now have to install and Run!!!


Try IT and Enjoy!

Changing Character Case in VB.NET

I wanted to change the case of characters in some textboxes,
i tried using the KeyPress, KeyDown, TextChange events, but to no use.
While searching the net, i found a very very simple solution to this,
there is a property for TextBox named "CharacterCasing" :D.
Just change it to Upper or Lower, as requirements.

But you know what, there should be another way of doing this,
have to search a bit more.

Enjoy IT.

Tuesday, May 31, 2005

No keydown event fires in a datagrid

I wanted to handle the key down event of a datagrid. But unfortunately havent succeeded in it. Found out this

No keydown event fires in a datagrid

If any of you out there know the solution, then do let me know ASAP.

Try IT and enjoy!!!

Sunday, May 29, 2005

Useful Scripts for SQL Server 2000

/*
I work mostly on SQL Server 2000, and try to be as dynamic as possible. For this reason i created some SCRIPTS.
*/

/*
1. This SCRIPTS will return all the tables in a database.
It is useful if you want a select or delete query for every table.
*/
DECLARE @TABLENAME VARCHAR(100)

DECLARE ALLTABLES CURSOR FOR
SELECT NAME FROM SYSOBJECTS WHERE XTYPE='U' AND SYSSTAT <> 8275
ORDER BY NAME

OPEN ALLTABLES

FETCH NEXT FROM ALLTABLES INTO @TABLENAME

WHILE @@FETCH_STATUS = 0
BEGIN
PRINT 'SELECT top 100 * FROM [' + @TABLENAME + ']'
--PRINT 'DELETE FROM [' + @TABLENAME + ']'
FETCH NEXT FROM ALLTABLES INTO @TABLENAME
END

CLOSE ALLTABLES
DEALLOCATE ALLTABLES


/*
2. This SCRIPTS will return all the Column names for every user table in a database.

*/

DECLARE @TABLENAME VARCHAR(100)
DECLARE @TABLENAME2 VARCHAR(100)
DECLARE @TABLEID INT
DECLARE @COLNAME VARCHAR(100)
/*
--COLUMN COUNT IN TABLES
SELECT SO.NAME [Table], COUNT(SC.NAME) [Columns] FROM SYSOBJECTS SO, SYSCOLUMNS SC
WHERE SO.ID = SC.ID AND SO.XTYPE='U' AND SYSSTAT <> 8275
GROUP BY SO.NAME
ORDER BY SO.NAME

*/

DECLARE ALLTABLES CURSOR FOR
SELECT SO.[NAME], SC.[NAME] FROM
SYSOBJECTS SO INNER JOIN SYSCOLUMNS SC ON SO.ID = SC.ID
WHERE SO.XTYPE='U' AND SYSSTAT <> 8275
ORDER BY SO.[NAME], SC.[NAME]

OPEN ALLTABLES

FETCH NEXT FROM ALLTABLES INTO @TABLENAME, @COLNAME
DECLARE @COLS VARCHAR(1000)
SET @COLS = ''
WHILE @@FETCH_STATUS = 0
BEGIN

IF @TABLENAME = @TABLENAME2
BEGIN
PRINT @COLNAME
END
ELSE
BEGIN
PRINT ''
PRINT 'TABLE: [' + @TABLENAME + ']'
PRINT @COLNAME
SET @TABLENAME2 = @TABLENAME
END

FETCH NEXT FROM ALLTABLES INTO @TABLENAME, @COLNAME
END

CLOSE ALLTABLES
DEALLOCATE ALLTABLES


/*
3. Now to put the above knowledge into something important (atleast for me)
If you change the SELECT query to the one shown below, then it will only the first columns of each table, a good way to return the primary keys of tables, usually the first column of each table is the primary key. It will also be helpful if you want to make a fucntion, that return the next primary key value to help you inserts records.

SELECT SO.[NAME], SC.[NAME], SC.* FROM
SYSOBJECTS SO INNER JOIN SYSCOLUMNS SC ON SO.ID = SC.ID
WHERE SO.XTYPE='U' AND SYSSTAT <> 8275
AND SC.COLORDER = 1
ORDER BY SO.[NAME], SC.[NAME]

This script will return a script that will create a function, which takes as input a tablename and returns the next primary key value if the primary key is a numeric field.
*/

--USE DATABSENAME
DECLARE @TABLENAME VARCHAR(100)
DECLARE @COLNAME VARCHAR(100)

DECLARE ALLTABLES CURSOR FOR
SELECT UPPER(SO.[NAME]), UPPER(SC.[NAME]) FROM
SYSOBJECTS SO INNER JOIN SYSCOLUMNS SC ON SO.ID = SC.ID
WHERE SO.XTYPE='U' AND SYSSTAT <> 8275
AND SC.COLORDER = 1
ORDER BY SO.[NAME], SC.[NAME]

OPEN ALLTABLES

FETCH NEXT FROM ALLTABLES INTO @TABLENAME, @COLNAME

PRINT 'CREATE FUNCTION fnGetIDByName (@TABLENAME VARCHAR(100)) '
PRINT 'RETURNS INT AS '
PRINT 'BEGIN'
PRINT ' DECLARE @ID INT'

PRINT ' IF UPPER(@TABLENAME) = ''' + @TABLENAME + ''''
PRINT ' SET @ID = (SELECT ISNULL(MAX([' + @COLNAME + ']),0)+1 FROM [' + @TABLENAME + '])'

FETCH NEXT FROM ALLTABLES INTO @TABLENAME, @COLNAME

WHILE @@FETCH_STATUS = 0
BEGIN
BEGIN
PRINT ' ELSE IF UPPER(@TABLENAME) = ''' + @TABLENAME + ''''
PRINT ' SET @ID = (SELECT MAX([' + @COLNAME + ']) FROM [' + @TABLENAME + '])'
END
FETCH NEXT FROM ALLTABLES INTO @TABLENAME, @COLNAME
END

PRINT ' ELSE '
PRINT ' SET @ID = 0'
PRINT ' RETURN(@ID)'
PRINT 'END'

CLOSE ALLTABLES
DEALLOCATE ALLTABLES

/*
How to execute this procedure
SELECT [dbo].[fnGetIDByName]('TABLENAME')

ANOTHER USE
INSERT INTO TABLENAME(PRIMARYKEY, ANYFIELD, ...)
VALUES ([dbo].[fnGetIDByName]('TABLENAME'), @ANYFIELD, ....)

There could be better use of this kind of scripts.
And there could be better ways of writing them as well. This is to my knowledge.

The important thing is the SYS.... tables in a SQL Server databases. They are tables that keep all the information about user tables, views, procedures etc. If you look closely in them, the primary key in them is the [id] field, make joins with it and you can get every bit of information about the database that you are working on.

Try IT and enjoy!!

*/

Saturday, May 28, 2005

BEDatePicker for Arabic

Click here to download the control, its an ActiveX control dll, made in .NET.

Try it.

Or want to see some other applications.

Goto TheBukharis.com.

Have a nice time.

.Net developer site from MS Arabia

Its new, so it will take time to fill it up with informations.
Keep checking it if you are in programing for Arabic language.

See IT

Wednesday, May 25, 2005

Hijri Calendar


VS.NET is cool, and you can do cool things with it as well.
I had a problem of saving Hijri dates in an application. To solve it i made a DateTimePicker for Hijri calendar. But in hijri calendar the main problem is of not knowing the number of days in a month and also not knowing on which date, which day will fall. As hijri calendar is based on Moon. If you see the moon then the months starts, and so no one can predict the dates.

The other problem, is showing arabic dates in Arabic numerals or characters.

So in my calendar, i dont have options like Day names or the number of days in a month. It contantly shows 30 days.

had to work hard to make it, but after completeion it looks cool.

Here is some things that are needed to complete this task in Visual Basic.Net

Import these classes.

Imports System.Threading
Imports System.Globalization

Convert the current date to Hijri date.
Dim myCal As New HijriCalendar
Year = myCal.GetYear(Now)
Month = myCal.GetMonth(Now)
Day = myCal.GetDayOfMonth(Now)

But if you want to show Arabic numerals as well.

"٠١٢٣٤٥٦٧٨٩" Numerics
"محرم", "صفر", "ربيع الأول", "ربيع الثاني", "جمادىالأولى", "جمادىالأخرة", "رجـــب", "شعبان", "رمضان", "شوال", "زوالقعدة", "زوالحجة" Months

All you need now is some functions to return the arabic numerals for english and the month name for specific month.

In SQL Server.

you can easily convert a varchar date to hijri date through

select CONVERT(datetime, '16/04/1426 5:51:59:967PM', 130)
Return '2005-05-25 17:51:59.967'

select CONVERT(nvarchar, getdate(), 130)
Return '16 ربيع الثاني 1426 5:53:00:5'
select CONVERT(nvarchar, getdate(), 131)
Return '16/04/1426 5:53:00:500PM'

The values 130 and 131 are called the Quati Algorithm to convert dates


Rest is all logic that you use to make this happen.

:D

Monday, February 21, 2005

ASP to ASP.NET and more

Just saw some thing important that can be used to make our lives a bit easier. ASP to ASP.NET Converter, now downloading them to see if they work as well.

Try IT and enjoy!!!

Thursday, February 03, 2005

From day b4 yesterday, i have got a new problem with my pc at home, and that is
with the Windows Explorer. I cant seem to open, it just gives "Memory read
error". Every thing else works fine, and some times it closes all the IEs
opened. I have antivirus installed, antispyware installed (may be too much
anti), they do catch one or two things here and there. When nothing seemed to
help, i tried google, and this is what i got
The Problem

(This is the problem described on the web page, which was similar to my
problem.)

Explorer.exe Application error - Explorer will be closed by Windows -
cycle

Every time I boot and log into Windows 2000, the desktop begins to appear and
then one of the following windows appears:

I click OK on the first window, explorer closes, the desktop disappears,
re-appears and then the error appears again. (Note - the memory address is not
always the same)

If the second window appears, explorer closes by itself automatically and then
the desktop disappears, re-appears and then the error appears again.


The errors also occur in Safe Mode.


I can End Task on explorer.exe before the error occurs and run almost any
program (except explorer.exe) through the Task Manager File\Run command -
(finding the correct commands and switches has been fun!)


I have done a complete online scan for Viruses at Symantec's site... It is Safe
and Clean


I have installed and uninstalled Win2K SP4 and IE 6 with all updates.


I have run the repair options with the Win2K Pro CD.


I used Dell's diagnostic tools to verify the memory and hardware


Solutions:


These came from website
http://www-level3.experts-exchange.com/


Repair IE


Start > Run rundll32 setupwbv.dll,IE6Maintenance
"C:\Program Files\Internet
Explorer\Setup\SETUP.EXE" /g

or

Start > Run rundll32.exe setupapi,InstallHinfSection DefaultInstall 132
C:\windows\inf\ie.inf


Reinstall IE


Description of the Internet Explorer Repair Tool


http://support.microsoft.com/default.aspx?scid=

http://support.microsoft.com:80/support
/kb/articles/Q194/1/77.asp&NoWebContent=1

How to Reinstall or Repair Internet Explorer and Outlook Express in Windows XP
http://support.microsoft.com/?kbid=318378

Repair Internet Explorer 6
http://www.theeldergeek.com/repair_ie6.htm
http://support.microsoft.com/?kbid=293907

Unable to Open Link
http://support.microsoft.com/
default.aspx?scid=kb;en-us;Q281679&sd=tech

IE Eradicators

http://www.litepc.com/ieradicator.html

Obsolete link: www. webattack.com/get/ieradicator.shtml

Downloads

IE Download (From 2.0 to 6.0) and Service Packs/Patches
http://helpdesk.uvic.ca/how-to/support/win95/msiexpl.html

IE Download (From 1.0 to 6.0) and service Packs
http://browsers.evolt.org/?ie/32bit

Wednesday, February 02, 2005

Just installed Google Desktop Engine, and was realy amazed by its results. Try it yourself and see

http://desktop.google.com



Best Smartphones/tech of 2019

So I was looking for the best tech of 2019. Here it goes: New Pixel 3 XL Google - Pixel 3 XL with 64GB Memory Cell Phone (Unlocked) - ...