Thursday, 4 December 2008

mysql database copy

problem: its always good to have a dev version of any working database for learning purposes...

what im not doing: going all 'gui'... the command line rox and it all starts there


this is surprisingly difficult with my set-up. xampplite setup on a xppro box (its my work setup, dont judge me)! in the end i had to do the following;

create database test;

then export my production database to file via phpMyAdmin, .sql

then i seemed to hit a brick wall. found posts that advised adding 'use test;' at the top of the file then issuing the following command;

mysql < c:/backup.sql;

wouldnt work. tried;

mysql -u root -p ***** < c:/backup.sql;

no good :(

but then, almost as a last gasp;

use test;
source c:/backup.sql;

job done! always remember '\' escapes in mysql so windows absolute paths are initially annoying!

Friday, 21 November 2008

flac to mp3

problem: downloaded 'king of leon - because of the times', and all in flac format

what im not doing: just leaving it, got a cheapo mp3 player that doesnt support flac (i know flac is lossless and so much better, but needs must). im also installing nothing with a gui, not needed!


installed on ubuntu, flac & lame

sudo apt-get install lame flac

get into the terminal and navigate to dir with files for convertion. a wee for loop should sort it out

for i in *.flac; do $(flac -dc "$i" | lame -h "$i.mp3"); done;

point - could have stuck in a bit of magic to chop off .flac from resulting mp3 (something.flac.mp3) but no curly braces on wee boys keyboard!

outlook express opening s-l-o-w-l-y

problem: outlook express taking 14 fortnights to open

what im not doing: just installing 'live mail' (although it is slightly better...)


seems that a dodgy autopatcher run has resulted in the above behaviour, but fairly straightforward to repair. logs show dcom error for

FB7199AB-79BF-11d2-8D94-0000F875C541

so a wee search in the registry takes me to

HKEY_CLASSES_ROOT\CLSID\{FB7199AB-79BF-11d2-8D94-0000F875C541}

InProcServer32
LocalServer32

default value seems to be path to messenger. remove this to blank entry and we are back to normal!

Thursday, 18 September 2008

recursive for loops

problem: for example, reading a text file input, searching for the entry in a database and outputting specified csv's

what im not doing: hitting this with vbs, because vbs is only for when batch cant do it


try it, recursive for loops arent supported in winxp cmd / batch files, but here is a wee workaround

for /f %%a in (list.csv) do call :list %%a
:list
if not %1'==' for /f "tokens=1-5* delims=," %%a in ('findstr /i %1 db') do echo %%~c,%%~d,%%~e >> summary.csv

save the batch and watch it recurse!

winxp sucks again

slightly different post here, but ive not really been on for a while, but got to highlight this!

got
this message and here is the proof


now, you will notice that all of the google results feature either vista or enhanced ie7 issues, generally with network shares, but i got this when trying to extract a file from a compressed archive within another compressed archive, a zip within a zip if you will. now, i know that it was poor practice but that is how the file arrived.

also, do you want to move or copy files from this zone, yes / no? move or copy? yes or no? this is almost nonsensical to me...

Friday, 20 June 2008

update local website with live info

problem: customers stock system doesnt play nice with web, so stock levels and prices are manually updated each morning. local copy of website on sales laptops information can be out by two weeks!

what im not doing: calling in sales reps every day to get up-to-date info


so, vbs to the rescue again. as this is a text file, read into an array by php live it is uploaded using ftp binary type to preserve carriage returns. downloading via ascii should preserve this file characteristic.

on error resume next
url = "onlinepathhere"
path = "localpathhere"
Set xmlhttp = CreateObject("Microsoft.XMLHTTP")
xmlhttp.open "GET", url, False
xmlhttp.send()
if xmlhttp.Status = 200 then 'if status is anything other than 200 it is not ready
Set fstemp = CreateObject("Scripting.FileSystemObject")
fstemp.GetFile(path + "pricelist.bak").Delete 'on error statement ensure script carries on if file doesnt exist
fstemp.MoveFile path + "pricelist.dat", path + "pricelist.bak"
Set filetemp = fstemp.CreateTextFile(path + "pricelist", true)
filetemp.write (xmlhttp.responseText)
filetemp.close
else
msgbox "please ensure that you are connected to the internet to update stock figures" + vbcrlf + vbcrlf + "if you are connected please try again later"
end if
wscript.quit()

Wednesday, 18 June 2008

winxp wmi / wbem problems (for no good reason!)

problem: tasklist wont run (dialogue framedyn.dll not found) and the following error in event viewer

The Windows Security Center Service was unable to establish event queries with WMI to monitor third party AntiVirus and Firewall.

what im not doing: an 'inplace reinstall' [edit: i maybe am!]



step 1 - copy framedyn.dll from %windir%\system32\dllcache to %windir%\system32\wbem (as admin)... tasklist runs, but logging out & back in takes us back to problem!

step 2 - run rundll32 wbemupgd, UpgradeRepository to diagnose and repair wmi... wbemupdg module not found... no good!

step 3 - run rundll32.exe setupapi,InstallHinfSection WBEM 132 %windir%\inf\wbemoc.inf, insert winxppro cd then restart... now i have additional warnings along with initial problem!

A provider, HiPerfCooker_v1, has been registered in the WMI namespace, Root\WMI, to use the LocalSystem account. This account is privileged and the provider may cause a security violation if it does not correctly impersonate user requests.

A provider, CmdTriggerConsumer, has been registered in the WMI namespace, Root\cimv2, to use the LocalSystem account. This account is privileged and the provider may cause a security violation if it does not correctly impersonate user requests.

A provider, Rsop Planning Mode Provider, has been registered in the WMI namespace, root\RSOP, but did not specify the HostingModel property. This provider will be run using the LocalSystem account. This account is privileged and the provider may cause a security violation if it does not correctly impersonate user requests. Ensure that provider has been reviewed for security behavior and update the HostingModel property of the provider registration to an account with the least privileges possible for the required functionality.

may have to come back to this one...