Wednesday, October 17, 2012

VSPTree is alive!

I've been using Windows 8 for the last couple of months and have been having a great time with it. It's Windows 7 with a nice flat UI, much faster I/O. Stability is the same, and pretty much have never opened a metro app. I'm not even sure how to use those correctly. The new Start Menu is just a very big start menu to me.

Anyway I digress, I needed to profile something and went with the usual suspects. CodeAnalyst, Got no data. AQTime, failed to launch the exe. Very Sleepy, worked but no hierarchical call graph. Tried to resurrect VSPTree with the VS2010 profiler and I got a driver not allowed error.

Oh well. Some digging around and I found Remote Tools for Visual Studio 2012.

So I took a little time and updated VSPTree to work with it, and added some minor usability updates. It's not the best application in the world, but sometimes it's handy just to have it.

VSPTree 0.5 : Now with Windows 8 64 bit support. Here.

Friday, October 12, 2012

Conditionals in Property Sheets

I've since moved to using property sheets exclusively instead of wfMake and it's been going well. A bit more more typing but I like the fact that I can edit a bunch of includes and not have to regenerate the vcproj/vcxproj. The most time consuming part was going through all the projects and setting the right macros everywhere. But you only have to do it once.

It's one place to update everything and can be syntax highlighted and formatted quite neatly.

You end up with something like this. This is only an excerpt, the whole thing is quite huge. You can then string your macros any way you like. The fanciest bit of this is the conditionals at the top that I use because some sln's that include these projects are sometimes in different places, and there was no other way I could think of to correctly set the path.



  
  
    
      
        $(ProjectDir)..\..\..\
      
    
    
      
        $(ProjectDir)..\..\..\
      
    
    
      
        $(SolutionDir)
      
    
  
  
    
    
      WF_DEBUG;
      _DEBUG
    

    
      WF_RELEASE;
      NDEBUG
    

    
      WF_FINAL;
      NDEBUG
    

    
    
      WF_PC32;
      WIN32;
      _CRT_SECURE_NO_WARNINGS;
      $(FORCED_ENVARS)
    

    
      $(WF_DEBUG);
      $(PC32_PREPROCESSOR);
      __PLACEMENT_NEW_INLINE
    


  


Wednesday, March 28, 2012

Pre-commit goodness

This solution was used to solve programmers frequently accidentally committing debug executables into SVN. On developer machines you rarely see this issue because all the debug libs exist, but a level designer or artist will frequently run into the problem and will have no idea what the problem is, and someone will have to take a look at it and figure out what in the world is going on. Then the doh! moment happens and someone has to recompile and commit that.

The precommit hook also show an example of how to deny committing certain files like .argb and thumb.db

The solution is simple enough. Add a precommit hook that scans all the exe's for debug libs. This method uses Dependency Walker by Steve Miller.

So far I've tested it on rather large commits with 20 exe's and it doesn't take more than 20 - 30 seconds to complete. Server is running a i7-960 for reference.

cd /d %~dp0
SETLOCAL ENABLEDELAYEDEXPANSION
SET REPOS=%1
SET TXN=%2

SET PATH=E:\svn;E:\bin;E:\depends

svnlook changed %REPOS% -t %TXN% > E:\temp\svnlook%TXN%

grep -E "A.+(.argb)" E:\temp\svnlook%TXN%

if "%ERRORLEVEL%"=="0" (
 echo Do not commit ARGB files! >&2
 goto :error
) 

grep -E "A.+(thumbs.db)" E:\temp\svnlook%TXN%

if "%ERRORLEVEL%"=="0" (
 echo Do not commit thumbs.db! >&2
 goto :error
)

grep -P -o "(?<=\w\s\s\s).+\.exe" E:\temp\svnlook%TXN% > E:\temp\svnlook%TXN%_exegrep

for /f "tokens=1 delims=¶" %%f IN (E:\temp\svnlook%TXN%_exegrep) DO (
 svnlook cat %REPOS% -t %TXN% "%%f" > E:\temp\temp
 depends.exe /c /of:E:\temp\dep.txt E:\temp\temp
 grep -E "QT.+D4.DLL" E:\temp\dep.txt
 if "!ERRORLEVEL!"=="0" (
  echo Do not commit Debug executables! %%f is in debug>&2
  goto :error
 )
)

del E:\temp\svnlook%TXN%
del E:\temp\svnlook%TXN%_exegrep
exit 0

:error
del E:\temp\svnlook%TXN%
del E:\temp\svnlook%TXN%_exegrep
exit 1

Wednesday, February 15, 2012

Saving tortoiseGit password

Took me a little while to find this, so I thought I would immortalize it here.

Apparently you need to save a file called _netrc in %USERPROFILE%

So a quick little batch file :

@echo off
SET /P HOST=What is the hostname i.e github.com?
SET /P USERNAME=What is your username?
SET /P PASSWORD=What is your password?

echo machine %HOST% login %USERNAME% password %PASSWORD% > "%USERPROFILE%\_netrc"

Thursday, February 9, 2012

Crappy documentation? Internet to the rescue

So through some amazing series of events, I broke the TeamCity installation.

Things weren't building. I thought it might be a bug, so maybe I'll try a newer version. The newer version needed an upgrade to the database so I said OK, but I made sure to back up first of course.

Lo and behold the new version did solve the old problem, but it presented a host of new ones! Basically made it unusable. Of course this was a beta build, but hey beta is the new GMC nowadays right? WRONG!

Oh well, time to uninstall and go back to the backup. Cue the 30 minutes I spend trying to figure out how in the world do I restore this backup!

The manual says :

Just do this!

maintainDB[cmd|sh] restore -F <TeamCity backup file name>

Error : config is not empty. Ok I'll delete that then.
run again
Error : system is not empty. Ok I'll empty that too!
run again.
Needs a target!

Wuh? That's the "Restoring Data from Backup to Another Database" instruction not the standard restore.

But no. It doesn't work. Ok, scrounge around a bit more....

Hallelujah.

Turns out you need to copy the database.hsqldb.properties.dist out of the config directory in your backup zip first. Give that as the -T database.hsqldb.properties.dist

And then everything gets restored. Then it gives you some instruction that says, you have to copy that file into system\buildserver.properties.
Did I? Nope. Did the restore work? Yes.

Bad documentation is bad.

Friday, January 20, 2012

The difficulty of buy in

I've managed the company software infrastructure for many years. Along the way I've implemented every single idea or request that people have thrown at me.

Bug Trackers
Mantis
Redmine
Fogbugz

Company intranets
Google sites
Mediawiki
PhpBB
Wordpress

Email
Exchange
Gmail

Version Control
Visualsourcesafe
Sourceoffsite
Perforce
Subversion

Chat
IRC
XMPP server

The problem is once there is a preexisting system, and you have 80 - 120  people using it, and staggered projects there's almost no way to get everyone to switch at once! So you try and switch one project at a time, especially the ones that are eager to try a new system because of their complaints with the old one. Then the teams on new systems are faced with a learning curve, eventually fall back to the old system and you're back at square one.

So how do you get buy in? The simplest way is to use what most people already use at home. Which is why IRC, Gmail, AIM have continued staying on and all efforts to move everybody to gTalk will probably fail, and I can't believe gTalk doesn't have chat rooms! Which is what prompted the internal XMPP server. Campfire is definitely an option, but with > 100 users, you quickly reach your cap and can't scale.

Along the way we're picked up small pockets of other services like dropbox that are mainly used by people who cannot live without MS Word to share documents, while others like me just use Google Docs for sharing and collaboration.

I guess at the end of the day, there is no fit all solution, and that is really unfortunate.

On a side note, the wordpress with a custom plugin system works great as a wiki/intranet/annoucement system. The gist of it is this. Use wordpress, and a catchall address on googleapps that automatically adds every new user in your google apps account.

Then just add this plugin to wordpress :

post_content);
 $theauthor = get_the_author_meta( 'user_nicename', $thepost->post_author );

 // Get a comma separated string of categories
 $category_list = '';
 foreach((get_the_category()) as $category) { $category_list .= $category->cat_name . ' | '; }

 $subject = $category_list . $thepost->post_title;
 $body = "\n".
  "\n".
  "

$thecontent

". "

by $theauthor

". "

guid\">$thepost->guid

". "\n". "\n"; $headers = "From: " . get_bloginfo('name') .'' . "\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail('all@wayforward.com', $subject, $body, $headers); } add_action('new_to_publish', 'domainemail'); add_action('draft_to_publish', 'domainemail'); add_action('private_to_publish', 'domainemail'); add_action('future_to_publish', 'domainemail'); add_action('pending_to_publish', 'domainemail'); ?>

Replace everyone@yourdomain.com with your catchall.

This way you get emails sent for every announcement with a permalink sent to everyone, including any new person you ever add to your domain, till the end of time. Oh, and you have the full history too when you go visit the site.