How good are your SQL and/or general coding skills? I have a specific challenge I'd like your help solving. I am not sure it's possible, but I'd love to be proven wrong.
Since starting the innotop and mysqltoolkit projects on Sourceforge, I have learned a lot about how to use source control more effectively -- especially how branching and tagging can be used. Still, I have limited experience. I want to package all the tools in MySQL Toolkit together and release them in one archive, but I don't know the best way to do it; every idea seems to have drawbacks. Read on for the details, and if you have suggestions, would you please leave comments for me?
Today, doing one small task I thought: “Why can’t I do it with
PowerShell?”
So, here is a small example:
[void][system.reflection.Assembly]::LoadFrom("c:\devel\mysql\ps\MySQL.Data.dll") $myconnection = New-Object MySql.Data.MySqlClient.MySqlConnection $myconnection.ConnectionString = "server=localhost;user id=test;password=test;database=test;pooling=false" $myconnection.Open() $mycommand = New-Object MySql.Data.MySqlClient.MySqlCommand $mycommand.Connection = $myconnection $mycommand.CommandText = "SHOW TABLES" $myreader = $mycommand.ExecuteReader() while($myreader.Read()){ $myreader.GetString(0) } -- c:\devel\mysql\ps\MySQL.Data.dll - that is a connector
PowerShell is a quiet new thing, so I believe it could be helpfull.
Luhn algorithm can be used on Credit Card number
verification stage.
So, probably, it could be usefull for somebody else.
Here is my implementation:
DELIMITER // CREATE FUNCTION `LuhnCheck` (CC CHAR(19)) RETURNS BOOLEAN BEGIN DECLARE i, mysum, r INT; DECLARE skip BOOLEAN; SET skip = TRUE; SET mysum = 0; SET i = CHAR_LENGTH(CC); WHILE i > 0 DO IF NOT skip THEN SET r = SUBSTRING(CC, i, 1) * 2; SET mysum = mysum + IF(r > 9, r - 9, r); ELSE SET mysum = mysum + SUBSTRING(CC, i, 1); END IF; SET i = i - 1; SET skip = NOT skip; END WHILE; RETURN IF((MOD(mysum, 10) = 0) AND mysum <> 0, TRUE, FALSE); END; // DELIMITER ;
More elegant solutions are welcome.
And here it is implemented with PLT Scheme. …
… is how to get the last day of current quarter.
CREATE FUNCTION last_quarter_date (thedate DATETIME) RETURNS
DATE
RETURN last_day(CONCAT(YEAR(thedate) , ‘-’, QUARTER(thedate)*3,
‘-01′));
And I can not find other solutions. It is interesting if it is the only way.
This person dreamed that they were trying to compile part of Firefox, and the compile button was actually the snooze button on the alarm clock. I experienced a similar dream years ago: I dreamt I was a debugger, and this breakpoint kept firing (the breakpoint turned out to be my alarm clock).
Anyone else had dreams that you were a computer? Or a MySQL storage engine? Or a compiler?
Distributed development teams are becoming more and more commonplace - truly distributed teams with individual members living around the globe, not just a big company which happens to have independent teams in several different countries. The MySQL development team is organized this way, as are many other projects.
A new paper is available from Andrew Bennetts about distributed development: Coding in a Distributed Team: Testing, Reviewing, Sharing and Merging Code Without Going Crazy. This is definitely worth reading for anyone who does MySQL development even if you don’t consider yourself a developer - there are ideas in this paper which can make the life of both developers and operations folks much better.
Andrew speaks from personal experience working on …
[Read more]Every day I talk to many engineers and managers who want to be better. Better at developing software, better at shipping software, better at reacting to change in the marketplace, better at preserving backward compatibility, better at integrating new technologies, better at working efficiently, better at preventing and detecting bugs and errors, and so on.
I have often heard arguments that essentially say “all we need is a formal written process and things will be better”. I’ve consistently argued against that mindset, since I believe that principles are much more enduring than rules, and writing many rules often prevents people from doing the right thing.
You should all read this post from Jeff Patton why the best software design and development process is all in your head. Jeff explains so much more eloquently than I could why …
[Read more]I bought a new personal laptop a few weeks back, and I’ve been using it enough to final post a short review. I’ve run linux on several different laptops over the years, and it’s always been kind of tough. Even supergeeks endure a lot of teasing at conferences about getting wireless networking configured.
This time, I went with System 76, who offer laptops with Ubuntu preinstalled. Definitely the right choice! I chose a Gazelle, which is not quite as sleek as my previous MacBook. It is blazing fast. I was amazed at how quickly I was able to be productive with Ubuntu preinstalled and working perfectly: NetworkManager means my wireless connection works even better than on the MacBook, suspend to RAM and hibernate to disk worked flawlessly, and it compiles MySQL in about 13 minutes flat.
…
[Read more]
A good rule to remember - all is case sensitive (talking about
identifiers), even if it is false it will help you to avoid many
problems. But really in MySQL are case sensitive only table and
database identifiers and only on platforms with case-sensitive
filenames (Linux/Unix). It is so because tables and databases are
represented as files (filenames are used as identifiers). And I
think there is nothing good in such behavior because it
complicates databases portability.
It is interesting, and what about MSSQL and Oracle.