SQL Server Daylight Savings Fun

I’ll get straight to the point:

We had to change the timezone in which transactions were being logged from PST to UTC. However, we couldn’t yet fully convert over to UTC (it’s a lot of historical data to update). So, now we have a log table with logged events in PST up to a certain point in time, then after then everything is in UTC. I needed to modify existing ETL to dynamically shift all the UTC times to PST (full UTC conversion to come later). In short, this is how I did it (don’t scream too loudly – “it’s only temporary” ;)

(assume ’4/20/2012 08:00′ is the time after which things are in UTC)
(All I did was get the hour offset between the getdate() and getutcdate() functions. Provided the system time is correct, timezone and all, this should do it)

select
(case when t.LogTime >= ’4/20/2012 08:00′ then dateadd(hh, datediff(hh,getdate(), getutcdate()), getdate()) else t.LogTime end) as LogTime
from MyFunDB.dbo.MyBigLog t (nolock)

Posted in Uncategorized | Tagged , , | Leave a comment

IPVS, Piranha error

In Control/Monitoring in Piranha, the Daemon: was not starting up after a fresh Piranha install and config.

I did “tail /var/log/messages -n 400″ (this is the relevant error log)

The last line had this:
We are backup node and backup is marked inactive — exiting pulse

So, in the Piranha GUI, I just clicked the accept button, hoping it would reset whatever config file was mentioning “we are a backup”. It worked.

Posted in Uncategorized | Tagged , | Leave a comment

MySQL Replication

Recently I had some replication slave machines get a slug of bad binary log transactions – it seems to be a result of this bug: http://bugs.mysql.com/bug.php?id=40278. Since it was a good number of hours before I was able to fix everything, there was a lot of data to be pulled from the master servers…. and not enough disk space on the slave machine to hold it all. Bleh…

I’ll give you the solution: relay-log-space-limit=1G (or 15G or 12M or 4096.. whatever you want).

Effectively, this defines the amount of disk space your relay logs will consume. If the available binary logs from the master are much bigger, the slave relay log manger thread will pause until it knows there is less disk space being used by the relay logs.

Please, add this to your my.cnf files ;)

Posted in Uncategorized | Tagged , , , , | Leave a comment

Wireless network disappears with DD-WRT-flashed router (loads of Tx errors in DD-WRT interface)

I’ve had this happen a number of times over the past few months. I have a Motorola WR850G that I have flashed with DD-WRT (v24-sp2 (10/10/09) vp). It’s been a fine experience, but occasionally the wireless network will disappear. The XBox 360 won’t work and my phone doesn’t see it. When I check out the wireless status in the DD-WRT admin site, there are loads of Tx errors (100% of all attempts in fact).

The solution in my case is to simply change wireless security from, say, WPA to WEP, apply and save changes, then change it right back to what you had just changed from, saving and applying changes for good measure.

The specific reason the problem comes has something to do with a config file getting clobbered under some rare set of cicumstances, particularly if you’ve been doing config changes. It’s been awhile since I had tracked down the issue – I should have recorded what it was. You’ll find it in the DD-WRT forums if you’re Googling it.

Posted in Uncategorized | Tagged , , | Leave a comment

Concrete5 Content Management System

We have started using Concrete5 as the CMS for www.OCDemocraticSchool.com (we got .org and .net too). The short context is the idea is to start up a democratic school, much along the lines of Sudbury School. But that’s not the point of this post.

Concrete5 is pretty sweet. It came out of the need of a web design company in Portland, OR to be able to pump out really good web sites that allowed for what became ever more opportunity for the web site owners to make content and design updates on their own. I’ve done work with Joomla, Drupal, and a few other CMS packages… heh heh… I even wrote my own. Concrete5 is better. I haven’t research how well it scales to “enterprise-level” size, but I’ve seen tidbits that it may be quite good. Whatever the case, consider it. Lots of hosting providers have it available as a “one-click” install (I’m using Bluehost.com), so if you’re in need of such a thing, it’s worth a look-see.

Posted in Uncategorized | Tagged , | Leave a comment

CentOS 6.2 VMWare ESXi 5.0 Template Stuff

I want to have both Windows and Linux template VMs from which I can quickly create VMs so I can test stuff. If you want to use CentOS, ESXi won’t let you create a “Guest Customization Specificiation” for whatever reason. Just change the VM’s definition to say it’s going to be using RedHat of the same version number. They’re very nearly the same OS after all. It works fine after that. You will find other mentions of the same if you’ve been searching.

I flashed my router with DD-WRT awhile back, more for the heck of it than anything, but I have found it to be more flexible than stock router management software, at least back then, so it’s been good. One of the things I’ve done is enabled DNSMasq as a way to have hostname-to-IP mappings in the network (I’d like to use DHCP whenever possible too). Unfortunately, Linux machines wouldn’t show up with a hostname, even though their assigned IPs were showing as “active” in the DD-WRT interface. Doing “ping ” didn’t work either. As it turns out, by default some or most Linux DHCP clients don’t tell the DHCP server their hostname. It’s a one-line configuration change, so it’s not bad. In CentOS add the following line to /etc/sysconfi/network (I put it right below “HOSTNAME=“):

DHCP_HOSTNAME=

How does this then behave when deploying a VM from a template with this setting? Well, it’s not perfect. the DHCP_HOSTNAME line gets changed to just another “HOSTNAME=” line, so, yeah, there are 2 lines. And, as expected, the hostname still doesn’t show up. If you change the second of the two HOSTNAME lines to DHCP_HOSTNAME save and do a “service network restart”, it will show up…. but now it throws an error about eth0 not seeming to be present, which could be that a NIC MAC address is not being updated. However, networking seems to be fine, so it’s not a dealbreaker at the moment.

All a bit fragmented and not proof-read, but it may be helpful for someone

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Fast ways to set up Web/WCF servers

Here’s what I want:

Deploy a VM from a template VM in VMWare
Guest is renamed and added to a given domain
AD computer account is assigned to the Services Organizational Unit
Upon reboot/startup, the machine gets everything installed and configured that it will need as a server serving up WCF services
Bamboo automatically starts deploying to this new service machine upon next deployment
Load balancer automatically picks up new services machines and adds them to the rotation once their application health checks succeed
Life is good
Profit

Where I’m at:
VMWare vCenter guest customizations template that names the new VM and joins it to the domain
I have to manually move the computer account to the Services OU, though I’m experimenting with pre-creating the computer account in the services OU)
Group Policy on the Services OU that installs Web server role, installs Web Deployment agent, installs .Net 4.0
I have to manually create the IIS sites and ensure their application pool is using .net 4.0
Bamboo is using the below script to deploy to all servers in the Services OU, so that’s cool
I’m still in the process of getting a license for a Citrix NSVPX Express license (I want to use these as my load balancers)

The “%%a” is the chosen variable that houses the DNS name of the services machines in the “do loop”.

@echo off
setlocal enableextensions
for /f “tokens=* delims=” %%a in (
‘dsquery.exe COMPUTER “OU=Services, OU=Servers, DC=JC, DC=Home” -o rdn -limit 300 -u -p
) do (

C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBUILD.exe ${bamboo.build.working.directory}\PlatformServices\PlatformServices.sln /P:Configuration=Release /P:DeployOnBuild=True /P:DeployTarget=MSDeployPublish /P:MsDeployServiceUrl=%%a /p:DeployIisAppPath=vireco/Services/EcologyServices /P:AllowUntrustedCertificate=True /P:MSDeployPublishMethod=RemoteAgent /P:CreatePackageOnPublish=True /P:UserName= /P:Password=

)
echo %myvar%
endlocal

Posted in Uncategorized | Tagged , , , , , , , , | Leave a comment

Documentation on the Artemis C# Project

I’ve started committing intellisense summaries for the Artemis C# Entity Systems framework. “thelinuxlich” has been kind enough to allow me to act as a contributor on the project here: https://github.com/thelinuxlich/artemis_CSharp.

If you see any errors, please let me know. Be brutal and straight to the point. I’m more interested in seeing the project move forward than I am in bolstering my own ego ;) My hope is to provide enough intellisense summaries that someone can fairly readily understand how all the major parts fit together. It seems I’d have to put some amount of intended purpose, and likely some contextual references to other related methods. Not sure if this is considered a totally inappropriate use of intellisense, but let me know.

Posted in Uncategorized | Tagged , | Leave a comment

BlockJump – Gonna put it on the WP7 Marketplace

It’s time to push myself to polish something “enough” to get it accepted on the WP7 Marketplace. My chosen game is “Block Jump”. It’s an insanely simple concept, and it may be too much of a rehash: you jump over blocks of varying size that slide at you at varying speeds. You score points while you touch the ground, and you get more points faster the longer you touch the ground. I try to keep the score stored on my server and keyed off the deviceID of the phone. The game can operate just fine disconnected, as it stores the score locally as well. I have a tile/icon set up (properties of the game project in VS2010), and I have swapped out the main “actor” graphic for a higher-resolution version. I think I already have the game fitting within the requirements, as it doesn’t even have a full menu and it quits rather than tombstones.

Posted in Uncategorized | Tagged , , | Leave a comment

Block Jump project

My boy fairly regularly asks if he can see my game [on the phone]. I haven’t made anything new in about a week now, and his asking has been a reality check that if I’m serious about learning the game programming craft, I need to be pretty harsh about actually producing stuff as often as I can.

To that end, I added features and polish to my Block Jump game. The main character, a happy face is now of higher resolution and handles transparency better, an exploit has been fixed, there is a score multiplier based on how long you can stay on the ground before jumping or getting hit with a block, and the game will exit with both the back and home buttons. There is now a “Get Ready” state when first starting the game where nothing is affected until the first block rolls by. Combined with the fact that the game always exits when focus shifts away, this provides a crude “paused” state, which I think is actually within range of “appropriate”.

Posted in Uncategorized | Tagged , | Leave a comment