Archive for category code

Oracle 10 Client on Windows 7

Posted by on Tuesday, 17 August, 2010

If you need the full Oracle Client on your Win7 machine, you are in a bit of trouble.

Windows 7 is internal windows 6.1 and the setup routine checks for windows 5, 5.someting and 6.0. So no Windows 7.

But there is a hack: turn off the system check with the flag -ignoreSysPrereqs

so running

setup.exe -ignoreSysPrereqs

form a cmd does the trick. You’ll have to overwrite the error later in the setup routine by clicking the failed checkbox.

mysql: removing a timestamps on update CURRENT_TIMESTAMP

Posted by on Monday, 2 August, 2010

Situation: you have a table and a timestamp in it. Thee is a on update CURRENT_TIMESTAMP on the column. But you want to get rid of it:

ALTER TABLE yourTable
CHANGE  someCol somecol TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP

cwrsync 4.0.4 to UNC Paths

Posted by on Thursday, 15 July, 2010

It seams to me that handling of UNC paths changed since the last version i used. After some pain i am now able to sync from europe to china again. Here are some hints for other poor souls that may prove helpfull:

* If you are using rsync on windows to sync to an UNC Path (\\server\some\path) on the receiving end – be sure to run the service as an account that can access the share. In my case a domain user was needed, the local service account  (svccwrsync) failed of course

* UNC Paths worked previously like this (in rsyncd.donf):
path    = \\fshsmsxxx\d$\Public Share\Engineering\somePath

Not any longer. Now with rsync 3.07 its
path    = //fshsmsxx/d$/Public Share/
Engineering/somePath

rsync on windows chown failed: Invalid argument (22)

Posted by on Monday, 12 July, 2010

Using cwrsync 4.04 a lot of  “chown failed: Invalid argument (22)” showed up.

After some research the following tricks removed those annoying erros:

In rsyncd.conf set user and group to :
uid = 0
gid = 0

in the rsync call, replace -a (which is short for -rlptgoD (recursive, copy symlinks, preserve permissions, preserve modification times,  preserve group,  preserve owner , preserve device files,preserve special files  ) )
with -rt (recursive, preserve times)

Now using
rsync –super –recursive –delete –compress –times testSource CWsync@targetServer::testDestination

see http://www.itefix.no/i2/node/12340 for details

Remotly killing a RDP Session

Posted by on Wednesday, 2 June, 2010

Server full, or a session handing .. you know it’s a pain. But how to remotly get you a free session?

First check the sessions

qwinsta /server:<servername>

SITZUNGSNAME   BENUTZERNAME      KENNUNG STATUS  TYP         GERÄT
console                        0                                     Verbunden                                    wdcon
rdp-tcp                     65536                              Bereit                                               rdpwd
rdp-tcp#5               xxchr95                         2                                      Aktiv       rdpwd
rdp-tcp#13            xxkla19                           1                                     Aktiv        rdpwd

Then, kick a sesson

rwinsta 2 /server:<servername>

Where 2 is the Session Id from the qwinsta command

Or, if you happen to be admin on the target machine take over the console RDP session

mstsc /console /v:<server>

Find out what mysql queries are slow

Posted by on Wednesday, 2 June, 2010

So you are using mysql and have some data in your DB … say 2 million rows or something.  Not it’s about time to see how your SQL queries are doing, do some profiling, but … but how to you find out what sql queries are slow? Where you are missing that index? Try the following in your mysql.ini

[mysqld]
#enable slow query logs
log-slow-queries = d:/your/path/to/log/slow.log
# default of “slow” is 10 seconds, set it to 1
long_query_time = 1
# log *EACH AND ANY* query not using an index (this may be a lot till you fix it)
log-queries-not-using-indexes


Then you see where you’re not using the index, where you forgot it. Maybe use EXPLAIN on some of your longer queries to find out how to improve them

[mysqld] 
#enable slow query logs
log-slow-queries = d:/phpapps/xampp/mysql/log/slow.log
# default of "slow" is 10 seconds, set it to 1
long_query_time = 1
# log *EACH AND ANY* query not using an index (this may be a lot till you fix it)
log-queries-not-using-indexes

VBS Database connection to MySQL usting ODBC

Posted by on Thursday, 15 April, 2010

Damn, this feels dirty …


Sub LogDateiInMSql(query)
db_server = "localhost"
db_user = "root"
db_pass = ""
db_name = "eparcel"

' init connection to MySQL
Set conn=CreateObject("ADODB.Connection")

' you need the odbc driver installed, obviously
strConnectString = "DRIVER={MySQL ODBC 5.1 Driver};" & "SERVER=" & db_server & ";" _
& " DATABASE=" & db_name & ";" & "UID=" & db_user & ";PWD=" & db_pass & "; OPTION=3"

conn.Open strConnectString

If conn.State = 1 Then
MsgBox "connected"
Else
MsgBox "connection failed"
End If
Set rs=CreateObject("ADODB.recordset")

Set rs = conn.Execute(Sql)
Do While not rs.EOF
MsgBox rs(0)
rs.MoveNext
Loop

conn.Close
End Sub

LogDateiInMSql("show tables")

PHP UTC timestamp

Posted by on Tuesday, 23 March, 2010

$utc_str = gmdate("M d Y H:i:s", time());
$utc = strtotime($utc_str);

Importing a SVN dump it a new repository

Posted by on Wednesday, 13 January, 2010

Do the dumping on the old repository

svnadmin dump /var/oforge/svn/PROJJECT_NAME > DUMPFILE

Importing in the new repository

svnadmin load /data1/svnroot/grz_yy_test/ < DUMPFILE

Note that the whole structure in imported/exported, so mind existing /trunk directories

Liferay – adding a Type to the Web Content (former Journal)

Posted by on Monday, 7 December, 2009

Adden of a Web Content Type

You can not do this via the GUI, you have to edit the property files

in WEB-INF\classes\portal-ext.properties: create key

# Article Types to webContent - added jobAnnouncement
journal.article.types=announcements,blogs,general,news,press-release,test,YOUR_CONTENT_TYPE

in  WEB-INF\classes\content\Language-ext.properties: resolving the language key

YOUR_CONTENT_TYPE=Name of your Content type displayed