Tuesday 24 February 2009

mysql order by

problem: selecting some columns from table, one sum of entries. cant seem to order by sum...

what im not doing: reverting to batch sorting or anything like that


3 columns, 'qty' and 'code', int, varchar(20) loaded from csv using the following;

create database inv;
create table in (
qty int,
code varchar(20)
);
load data local infile 'c:/inv.csv' into table in
fields terminated by ',' optionally enclosed by '"'
lines terminated by '\n'
(qty, code)
;

and im looking for sum of all qtys, grouped by codes, all qtys < 6;

select sum(qty) as count from in group by code having count < 6
fields terminated by ','
lines terminated by '\r\n'
;

obviously this outputs to a local file. the key is 'as count' & 'having count < 6'. job done :D

Wednesday 11 February 2009

ActiveX runtime error 429 when creating Lotus Notes object from VBA

Problem:

vba code creates Lotus Notes object, initiates the session and sends email. However the Notes registry needs updated and the users dont have access to C: drive to run the reg file.

solution:

create a batch file which will run the reg fix:

#######################################
Windows Registry Editor Version 5.00

Regedit.exe /s C:\Lotus\Notes\NOTESW32.REG
Regedit.exe /s C:\Lotus\Notes6\NOTESW32.REG
#######################################

save as a .bat file and run!

Friday 6 February 2009

Rebuild Boot.ini

Problem – winblows will not boot. Common errors are NTLDR Missing; Invalid boot.ini;

what im not doing:

a reinstall (just yet!)

boot into Recovery Console:

go to root;

> CD..

remove hidden, System & Read Only Flags;

> ATTRIB -H C:\\BOOT.INI

> ATTRIB -R C:\\BOOT.INI

> ATTRIB -S C:\\BOOT.INI

Delete the knackered boot file;

> DEL BOOT.INI

Rebuild the boot file.

>BOOTCFG /REBUILD
First, every Windows XP owner must use /FASTDETECT as an OS Load Option when the rebuild process is finalizing. Secondly,
if you are the owner of a CPU featuring Intel’s XD or AMD’s NX buffer overflow protection, you must alsou use /NOEXECUTE=OPTIN as an OS Load Option.

For the “Enter Load Identifier” enter the OS name - ie “Microsoft Windows XP Home Edition”

or be a smart arse and write something personalised.

> BOOTCFG /REBUILD

> FIXBOOT

Unable to Create Shortcut on Vista

more proof that Vista is crap - common issue with being unable to create shortcuts!

Solution:

paste the following into notepad:

[HKEY_CLASSES_ROOT\.lnk] 
@="lnkfile"

[HKEY_CLASSES_ROOT\.lnk\ShellEx]

[HKEY_CLASSES_ROOT\.lnk\ShellEx\{000214EE-0000-0000-C000-000000000046}]
@="{00021401-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\.lnk\ShellEx\{000214F9-0000-0000-C000-000000000046}]
@="{00021401-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\.lnk\ShellEx\{00021500-0000-0000-C000-000000000046}]
@="{00021401-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\.lnk\ShellEx\{BB2E617C-0920-11d1-9A0B-00C04FC2D6C1}]
@="{00021401-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\.lnk\ShellNew]
"Handler"="{ceefea1b-3e29-4ef1-b34c-fec79c4f70af}"
"IconPath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
74,00,25,00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
00,68,00,65,00,6c,00,6c,00,33,00,32,00,2e,00,64,00,6c,00,6c,00,2c,00,2d,00,\
31,00,36,00,37,00,36,00,39,00,00,00
"ItemName"="@shell32.dll,-30397"
"MenuText"="@shell32.dll,-30318"
"NullFile"=""

[HKEY_CLASSES_ROOT\.lnk\ShellNew\Config]
"DontRename"=""

[HKEY_CLASSES_ROOT\lnkfile]
@="Shortcut"
"EditFlags"=dword:00000001
"FriendlyTypeName"="@shell32.dll,-4153"
"NeverShowExt"=""
"IsShortcut"=""

[HKEY_CLASSES_ROOT\lnkfile\CLSID]
@="{00021401-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\lnkfile\shellex]

[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers]

[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\OpenContainingFolderMenu]
@="{37ea3a21-7493-4208-a011-7f9ea79ce9f5}"

[HKEY_CLASSES_ROOT\lnkfile\shellex\ContextMenuHandlers\{00021401-0000-0000-C000-000000000046}]
@=""

[HKEY_CLASSES_ROOT\lnkfile\shellex\DropHandler]
@="{00021401-0000-0000-C000-000000000046}"

[HKEY_CLASSES_ROOT\lnkfile\shellex\IconHandler]
@="{00021401-0000-0000-C000-000000000046}"

[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVrsion\Explorer\FileExts\.lnk\UserChoice]



and save as .reg (any name will do)



then double click the .reg file to sort the registry and it should be sorted (restart probably required)

My Music/My Documents Default Location

What im not doing:

having my music and documents on the same partition as any windows OS as it sucks!

What im also not doing:

Creating new shortcuts when there are already ones there

Solution:

Navigate to:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders

where you can change default values for most shortcuts; My music, my documents, my pictures, favourites etc etc

Problem solved