| M | T | W | T | F | S | S |
|---|---|---|---|---|---|---|
| « Nov | ||||||
| 1 | 2 | 3 | 4 | |||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| 12 | 13 | 14 | 15 | 16 | 17 | 18 |
| 19 | 20 | 21 | 22 | 23 | 24 | 25 |
| 26 | 27 | 28 | 29 | 30 | 31 | |
4. November 2009 by Monkk.
Well, while I am very fond of WordPress, I have been playing around with Drupal and have decided to switch my blog over to it. I will keep this one up and around for a while but I have moved all the content over to the new site and will be moving forward from there!
http://www.monkk.com or http://blog.monkk.com will get you there
The RSS feed is : http://blog.monkk.com/rss.xml
Posted in Monkk.com | Print | 1 Comment »
27. October 2009 by Monkk.
A couple of days ago I stumbled across the reporting on the announcement of the White House switching over to an OpenSource content management system, Drupal. I’ve hosted or setup a number of sites over the years using various CMS platforms, for example: PHPNuke, PHPNuke Evolution, Xoops, Joomla, WordPress. All of which are good depending on what you’re trying to do. Since all of these we run at my host which uses a typical LAMP stack (Linux, Apache, MySql, PHP), my requirements are something along the lines of:
All of those met my needs (well with the exception of Wordpress being specifically for blogs….
I have heard of Drupal but never had the opportunity to try it. The White House moving to Drupal was enough to pique my interests. It was definitely on the list of software to evaluate when the chance presented itself, and like most, I figure that this lends some serious legitimacy to the OpenSource movement, and to the Drupal platform specifically. I know I am late to the party and that there are already a number of books on Installing/Configuring/Maintaining it, but I consider this taking the time to vet out the development, and I think now it’s prime time for it!
So yesterday afternoon, I downloaded the latest release of Drupal and set up a spot on my host and a new database and went to installing. Relatively pain free install, I just uploaded it to the server and navigated to the install page and it did the rest. Though I did have to do a few tweaks to my php.ini and .htaccess files. The information was easy to find, as the installer presented links to tracking down the solutions. Which in my case where setting PHP5 as the default PHP handler for the site, and disabling a php global resources restriction. I did create a few directories manually prior to the install, but it may have done that during the process had they not been there.
Drupal is set up to handle multiple sites and enhancements are typically provided in the form of add-on modules that install simply by copying them to your host and dropping them in the correct directory (themes in themes, libraries in libraries, modules in modules sort of thing). So I grabbed a few that sounded helpful (WordPress Import, WYSIWYG editor, Trackback’s). And in the first 30 minutes I had my entire WordPress blog from a year and a half of blogging all converted over to the blog in Drupal. And it has a better tag and taxonomy categorization for blogs to boot!
It handles traditional pages, blogs, forums, navigation linking very nicely, arguably a super custom navigation system might require converting your existing code to a Drupal module but for 90% of the navigation tasks, the built in system is grand. Off the bat, the administration can seem daunting, many configuration settings broken up and categorized, but they do make sense, it’s just in a CMS system, you need all these features. I found I got used to their placement in about a day’s worth of using it. Not too terrible, all things considered, relatively intuitive.
I have to investigate a Wiki module and get the WYSIWYG editor fully working. I am using it right now, but I just noticed the mark-up seems to be using a BBCode-like system, though I believe I saw the option to change that, Hmm, now where did I see that setting again
Overall, a great CMS platform, and you can not beat the price. The community is very alive and there are books on the topic. Now is a great time to hop in and learn!
Posted in Monkk.com | Print | 2 Comments »
4. August 2009 by Monkk.
Well, here is an interesting little story that was passed on to me from a friend with a jail-broken iPhone. Complete with screen-shots (nice touch)
So it seems, in the Settings application, the item for “Mail, Contacts, and Calendars” was missing. And upon closer examination, so was the Push settings, and likely anything new with the 3.0 OS update. Here is a screenshot of the Settings app in it’s “confused” state (it does look a little off doesn’t it
) :
Well after some digging, and let me tell you it’s not that easy to come up with a search term for this… Suffice it to say, someone forgot something… Not sure if it’s the theme’s fault (see, jail-broken iPhones let you stack on themes to make your phone look just the way you like it. Unfortunately, it’s not without it’s drawbacks and this is likely why Apple has not provided a way for you to do this… Though I find it odd as I could easily see a $1.99 theme in the App store…) At any rate, if you are using Winterboard, and if you are running themes and reading this, you likely are, there is a setting to dis-able themes for anything except the Springboard (which is the main app launcher for the iPhone).
In the Settings application, choose the Winterboard settings and enable “SpringBoard Only” :
And as if by magic, the Settings application will look normal again:
The side effect it, ONLY the Springboard is themed (main screen) all the apps, do not benefit from the theme if it provides replacement Dialer or Lock screens (etc…) So the beautiful:
Again becomes the mundane:
Fortunately, the settings retain their values, you just can’t get to ‘em so you can go ahead and make whatever changes you needed to make and then re-enabling theming for all apps again. It’s annoying and lame… It’s really too bad so much time has to be wasted circumventing apple to be able to do what we want with the devices we paid for.
Update (2009-08-04 9:17 AM): The “Winterboard Settings” item is added to the Settings App by installing the “WinterBoard Settings” package via Cydia or Icy:

Posted in iPhone, Personal | Print | 1 Comment »
7. June 2009 by Monkk.
While playing Team Fortress 2, I’ve found that some servers are set up for higher bandwidth usage allowing for a smoother game. To really take advantage of that, typically a few client side cvars need to be changed. However, many servers also run the default settings on their server and you’ll need to set the cvars back.
Conveniently, the source engine allows TF2 players the ability to create client side scripts / configs that will automate these changes. I have taken the liberty of creating a config that will let you bind a key to a “nextrate” command which will toggle the cvars between their High and Low rate settings.
First off, I am only changing the values for two CVARS, there may be more and they would be simple to add, but for the sake of this discussion I will be changing “rate” and “cl_updaterate” cvars.
The Low settings are:
rate: 30000
cl_updaterate: 20
The High settings are:
rate: 60000
cl_updaterate: 100
All that really needs to be done is, when connecting to a High rate server, in the console type:
rate 60000;cl_updaterate 100;
And when connecting to a Low rate server, in the console type:
rate 30000;cl_updaterate 20;
but who wants to type that everytime…. So, without further ado, enter the script:
alias ShowHighRateMsg echo rate set to 60000, cl_updaterate set to 100
alias ShowLowRateMsg echo rate set to 30000, cl_updaterate set to 20
alias SetHighrate "rate 60000; cl_updaterate 100;alias nextrate SetLowrate;ShowHighRateMsg;"
alias SetLowrate "rate 30000; cl_updaterate 20;alias nextrate SetHighrate;ShowLowRateMsg"
alias nextrate SetLowRate
nextrate
This uses the alias command which lets you set chains of console commands together and reference later by the name you give the alias.
Above five aliases are created:
1. ShowHighRateMsg – Simply echoes the text we want the user to see in the console after executing the nextrate command to set the High Rate settings
2. ShowLowRateMsg – Simply echoes the text we want the user to see in the console after executing the nextrate command to set the Low Rate settings
3. SetHighRate – Actually sets the cvars for High Rate server use. It also sets the alias for “nextrate” to SetLowRate. This is what implements the Toggle functionality. The user keeps calling “nextrate” and nextrate is pointed to different aliases every time it is called. It also displays the setting changes it is making in the console for the user to see if they bring up the console.
4. SetLowRate – Actually sets the cvars for Low Rate server use. It also sets the alias for “nextrate” to SetHighRate. This is what implements the Toggle functionality. The user keeps calling “nextrate” and nextrate is pointed to different aliases every time it is called. It also displays the setting changes it is making in the console for the user to see if they bring up the console.
5. nextrate – This declares the nextrate alias and by default points it to SetLowRate. This is the alias that you bind to a key. To bind it, it must exist first which is why it is by default pointed to SetHighRate (it assumes you play on more Low Rate servers then High Rate, besides it’s the default value from Valve so, hard to go wrong.)
The final line of the script is a call to nextrate, which as mentioned set to SetLowRate, so this actually execuste the nextrate alias and sets the cvars to Low Rate server use.
You could then bind a key to nextrate and execute it during the game. For example, in the console type:
bind m nextrate
Which will bind your M key to the nextrate alias. Pressing M at this point will execute the nextrate alias whenever it is pressed.
At this point, were you to paste the above script line by line into the console window of TF2, you could call nextrate over and over again and see it change. Well again, who’s going to paste all that in every time?
So you have 2 options at this point. Open up the AutoExec.cfg file in your TF2 cfg directory:
C:\program Files (x86)\steam\steamapps\<YOUR STEAM NAME>\team fortress 2\tf\cfg
and paste the entire script in there. You could also bind it to the key of your choice by adding the bind command from earlier here.
The other option, and I think the cleanest, is to create a new text file called “ServerRateToggle.cfg” in the \cfg\ directory (same place as the AutoExec.cfg) and paste the script into the new file. Then open the AutoExec.cfg and add the following line at the bottom:
exec ServerRateToggle.cfg
now, whenever the AutoExec.cfg file is parsed by TF2 (in this case, every time you start the game) it will execute the Rate toggle script which will reset the values to their defaults. You could also add the bind command in the autoexec.cfg after the call to exec ServerRateToggle and it will be bound forever more for your convenient use.
Here is a link to the ServerRateToggle.cfg to avoid copy and paste errors
Enjoy, and let me know if you come up with anything better or more commands that need to be added to the cvars I’m currently setting!
Posted in Gaming | Print | 1 Comment »
7. June 2009 by Monkk.
This little tutorial will cover making custom TF2 sprays. How to make a static spray, a transparent spray, and animated sprays.
First, to give credit where credit is due. I found the information on making sprays from a few blogs/sites. Unfortunately, there was no comprehensive information for dealing with transparency and animation so this article you are reading now attempts to bring it all together in one place. Here are the direct links to the articles I used as a base:
- “Create Animated Sprays in Team Fortress 2 and Counter-Strike” @ www.maximumpc.com
Resolution: Sprays resolution maximum is: 256 x 256 pixels
They can be smaller, but they can’t be larger! If they are larger the 256 in either width or height, the spray simply will not show.File Size: Currently the Source Engine (the Valve game platform that Team Fortress 2 is built on) has a file size limit for sprays of 120 KB do not exceed that or the spray will simply not work. This usually isn’t an issue with Non-Animated sprays, but Animated ones use 1 image per frame so you’re probably not going to get more than 4 or 5 frames with a resolution of 128 x 128 (note that is smaller then the largest supported spray resolution, we choose that to allow for more frames.)
In all cases, when we import images into VTFEdit, they are re-sampled to align to a resolution that is a power of 2, this is due to the rendering engine and an optimization for faster and easier rendering. Suffice it to say. the engine just needs them that way. VTFEdit gives you a drop-down box to give you further control. It defaults to “Nearest Power of 2” but there are options for “Smallest Power of 2” and “Largest Power of 2”.
During the import, VTFEdit looks at the dimensions of the image, for an example, let’s say our image is 220 x 220. If the image’s dimensions do not align to a power of 2 in both their X and Y dimensions, VTFEdit figures out the next largest and next smallest even power of 2 to align to and re-samples the image to these new dimensions. It uses the value in the drop-down list as a guide-line. In our case the next smallest is: 128 x 128 and the next largest is 256 x 256. If “Nearest Power of 2” is chosen, since 220 is closer to 256 then it is to 128, 256 x 256 is used. If our image size was 130 x 130, the next smallest is: 128 x 128 (again) and the next largest is: 256 x 256 (again), and 128 x 128 would be used. If you select “Next Smallest Power of 2” it will always pick the next smallest value, and likewise, should you choose “Next Largest Power of 2” it will always choose the next largest.
How do I know what the next powers of 2 are? Well I wrote a simple program to dump a bunch out for me and I just compared
Below is a convenient table for your use:
2 to the Power of Dec. Value Bin Value
——————————————————————
2 ^ 0 1 0000000001
2 ^ 1 2 0000000010
2 ^ 2 4 0000000100
2 ^ 3 8 0000001000
2 ^ 4 16 0000010000
2 ^ 5 32 0000100000
2 ^ 6 64 0001000000
2 ^ 7 128 0010000000
2 ^ 8 256 0100000000
2 ^ 9 512 1000000000Using square images (same X and Y dimensions) is easiest. But in the case of a rectangular image, the X and Y and handled separately, so an 65 x 130 image, using “Nearest Power of 2” ends up being 64 x 128, which may or may not stretch / compress your image inappropriately and you’ll want to either force the re-sampling or manually resample it with padding in the image to make the resolutions easier to work with. Square, as I mentioned is the easiest
![]()
Usually, leaving the default of “Nearest Power of 2” is sufficient, but I feel it’s better to resample the image yourself during the image preparation phase of the procedure because it is likely Gimp or Photoshop have a highly superior re-sampler then VTFEdit. I’m not saying it is, I’m just saying it’s likely, especially as the tool hasn’t been updated in 2+ years at this point. Plus it’s nice to know what’s really going on under the hood.
Sprays are stored in 2 places for Team Fortress 2. By default they are:
C:\Program Files\Steam\steamapps\<STEAM_ACCOUNT_NAME>\team fortress 2\tf\materials\VGUI\logos\
C:\Program Files\Steam\steamapps\<STEAM_ACCOUNT_NAME>\team fortress 2\tf\materials\VGUI\logos\UI\
where <STEAM_ACCOUNT_NAME> is the login name associated with your Steam account.
-If the C:\Program Files\Steam\steamapps\<STEAM_ACCOUNT_NAME>\team fortress 2\tf\materials\ directory does not have a sub-directory called “VGUI” create a new folder with that name there.
-If the VGUI folder does not have a logos directory, create a new folder with that name there. Once the .vtf is in here, you can import it from here using the TF2 Options –> Multi-Player, Import Spray option and browse to this directory. The importing process will create a file with the same name as the .vtf file but will have a .vmt extension (not sure what that is though, any thoughts?) This will also copy the .vtf and .vmt to the logos/UI directory.
-If the logos directory does not have a UI directory, create a new folder with that name there. One the .vtf and .vmt files are in this directory, they will appear in the Choose Spray drop-down list for choosing.
For most cases it does not matter what you name the image file that you import into VTFEdit. Whatever the file is named, will be used by VTFEdit as the default .vtf name for saving but you can always type a different name.
For Animated Sprays, it DOES matter however. Animated sprays are created by making a series of images, 1 per frame, and giving them a sequential file name so that VTFEdit recognizes them as multiple frames for the same spray. Basically, they just need to be alphabetized so when VTFEdit sorts the multi-selected images, it sorts the filenames alphabetically and frame 1 goes to the 1st file, frame 2 goes to the second, and so on. For ease of use you could use filenames like: “1-MySprayImage.tga”, “2-MySprayImage.tga”, “3-MySprayImage.tga”, etc.
The process is relatively simple, create or find an image you want to use as a spray. Make sure it is cropped or scaled down to a resolution of (at largest) 256 x 256. Open VTFEdit, on the File Menu, choose the Import item. Browse to the spray image and select it, verify the VTFEdit import options are correct (the tool remembers it’s last settings so typically you’ll only need to set it up the first time you make a spray) and hit OK.
A screenshot of pretty useable settings follows:
Non-Animated Spray:
Animated Spray:
Please note, the only difference in the above two screen-shots is the value of the “Texture Type” drop-down list item. Non-Animated sprays use “Volume Texture”, animated ones use “Animated Textures”. It would be fine to use an Animated Texture with a 1 frame animation, but I have found no information to say use one method or another. I’ve successfully created non-animated sprays with Volume Texture and animated sprays with Animated Texture.
At this point VTFEdit will display to you the imported image and you simply go to the File menu again, choose the "Save As” item, browse to your local logos directory and save the file with whatever name you’d like with a .vtf extension.
You’re ready to use it! Just start Team Fortress 2, go to Options, then the MultiPlayer Options tab, then press the import spray button and browse to your logos directory (as mentioned above) and choose the new spray. Click apply, connect to your favorite server and spray away!
VTFEdit makes the whole process of creating the .vtf file for use by TF2 a very easy process. The hard part is preparing the image before importing it into VTFEdit. Non-Animated, Non-Transparent images are the easiest, they only require the correct 256 x 256 or smaller size constraint. Transparency requires Alpha channels and TGA file format.
Some of the Articles I listed at the beginning have more detail on making transparent images and animation image preparation, I urge you to check them out if you are unsure.
Good luck!
Here is a link to a Quicktime movie of the actual spray in game showing the animation. Not very exciting but enjoy! Click here to view the movie!
Posted in Gaming | Print | 2 Comments »
25. May 2009 by Monkk.
I returned home from a week long vacation out of state to find my internet connection is down, which after some calls to tech support, yields a technician coming to my house in three days. At any rate, as I’m a pretty avid gamer, I have a stash of single player games which typically I save for these “rainy days”.
Well, over time, it seems I have picked up a fair amount of single player games which were purchased and delivered on Valve’s Steam system, which I am a pretty big fan of. The ability to just download and play the games you have already purchased is awesome!
Now normally, when your internet connection temporarily goes down, Steam supports an “Offline Mode” which allows you to play your games even though it can not connect to the Valve servers to validate the purchase. And usually it works fine. Games which require internet access don’t work so well, but you’d run into that with or with-out Steam, no doubt.
The problem I have run into however is, I would have to call a bug. As I mentioned I have been away for a week and my machine was turned off. So after some period of time, the Steam client decides it needs to check for an update, which ultimately falls as the internet connection is down. So, really that’s fine, the problem is, when an update fails the Steam client will not allow anything else to happen and closes Steam. An even more frustrating, it pops up the dialog which let’s you either Cancel running Steam or to start it in “Offline Mode”, however, when a Steam client update fails, it can only close steam and will not allow “Offline Mode” to proceed.
Here are some screenshots of the process:
1) So far, so good, starts up and tries to update

2) Starts doing something, in fact it gets to 27% pauses for a second, then retries. It will try 3 times in total never getting past the original 27% . This is likely due to the fact that the internet connection this machine is currently using is a tethered mobile phone using the 3G network of my provider. I’m not blaming Steam for this. With absolutely no internet connection, this #2 shot never happens, it just proceeds to #3.
3) After 3 failed attempts at completing the download and update, it errors out.
4) We are now presented with an option to Retry, Quit, or Start in Offline Mode. Retry repeats items 1 thru 3. Quit simply quits the steam client here. We then try the “Start in Offline Mode” to get to our games list or onto the game we started via Steam generated shortcut.
5) The Steam client update is apparently a MUST HAVE to proceed, and since it has failed (and in this case can never proceed as no internet connection is available). We are denied starting in “Offline Mode”
6) Surprise, surpise, there is a problem with the internet connection… We knew that, but I am now being denied access to any of my PURCHSED ($$$) games delivered by Steam.
WTF IS THAT ABOUT?!?
Surely this is normally a temporary inconvenience but I can’t play games I’ve paid for for 4 days, plus however long the internet connection actually was done while I was away… It’s not Valve or Steam’s fault, but it is there problem.
Regards!
Posted in Gaming | Print | 1 Comment »
18. May 2009 by Monkk.
Unit Testing ASP.NET? ASP.NET unit testing has never been this easy.
Typemock is launching a new product for ASP.NET developers – the ASP.NET Bundle - and for the launch will be giving out FREE licenses to bloggers and their readers.
The ASP.NET Bundle is the ultimate ASP.NET unit testing solution, and offers both Typemock Isolator, a unit test tool and Ivonna, the Isolator add-on for ASP.NET unit testing, for a bargain price.
Typemock Isolator is a leading .NET unit testing tool (C# and VB.NET) for many ‘hard to test’ technologies such as SharePoint, ASP.NET, MVC, WCF, WPF, Silverlight and more. Note that for unit testing Silverlightthere is an open source Isolator add-on called SilverUnit.
The first 60 bloggers who will blog this text in their blog and tell us about it, will get a Free Isolator ASP.NET Bundle license (Typemock Isolator + Ivonna). If you post this in an ASP.NET dedicated blog, you’ll get a license automatically (even if more than 60 submit) during the first week of this announcement.
Also 8 bloggers will get an additional 2 licenses (each) to give away to their readers / friends.
Go ahead, click the following link for more information on how to get your free license.
Posted in Programming Related | Print | 1 Comment »
2. May 2009 by Monkk.
So very recently I was approached by a team member to write some unit tests around a stored procedure that was being modified.I have never done any unit tests against for a Stored Proc so I was intrigued. I wasn’t really sure where I was going when I started but I opted to write a small console app in C# to proof it out.
For the sake of discussion, let’s say the stored procedure returns back a record-set with a single record containing five columns which describe time-zone information for a given US zip code and takes a single parameter, the zip code. I really couldn’t ask for a better test subject for a first pass, not too big, not too complicated.
My first inclination was to approach it like unit testing any other unit of code. So I figured I would need some variety of data store for my expected values and stored proc inputs. At this point it occurred to me, “Hey, I have a database full of inputs and expected results right here”, so I crafted a quick query to get my expected info. From that, I call the stored proc for each zip and verified the results. Worked like a champ. However, I was unaware the sp code refactoring had already been done on the database I was working against. It was around this point that I started getting a sinking feeling that something wasn’t right with the test. I attributed it to not being sure what to expect as this was a new testing scenario for me (typically the database developers are in charge of their development and testing of their code, while I can write SQL with the best of ‘em, a DBA I am not) and moved on.
Well ok, I have the behavior of the new code, the Actual results in testing terms. Now I can simply aim my program at the old database with the old code-base and get the expected results and modify my app to compare them. And then I discovered that the underlying data structure for the old code was different. The old way, the SP selects the five columns I need by joining three tables and then limiting on the passed in zip code. The new way, a nightly job is scheduled to populate a new “Time Zone” table and the SP simply selects all columns from the new table limiting by zip code.
So finally, it hits me… My test as it stands really is only testing that I get a result for every zip code I ask for and that it selected the same row that I got my expected result from. And maybe, that’s exactly what it should be testing, it does add some value… And yet it feels empty.
What I ended up doing was to retrieve the master list of zip codes from the old way’s table and ran both the new and old SP for each zip code and compared the result. This test felt better, the underlying data structures driving the stored proc could change and the test would be isolated and continue to work as long as the SP’s calling signature stayed the same.
The rub is, I could not have written my new test app without the new SP being developed. So what would I have been testing in it’s first iteration had I wrote tests for it at the time? I would have written my original test that would ultimately grab the expected data from the same database that the stored proc would.
What I should have done was adapt my initial test to work the same way with the old data and verified the stored proc returned the right data in my five columns. Then I should add a a test to verify the data in the new table matches the data from the old data structure. (This test typically would be the responsibility of the db job developers). Then I should modify my test to get it’s expected data from the new (and tested) structures and continue to verify the SP results to the data.
When unit testing code, you tend to have to “mock” out the data calls to control your tests, so from having to avoid all the database calls, it’s a “context-switch” to be requiring the database for everything. But the constant in both is testing the discrete parts from the bottom up. In retrospect, I could have done the test completely with SQL and suddenly the MS “Database Unit Test” makes a lot more sense.
–
Regards!
Posted in Programming Related | Print | 1 Comment »
29. April 2009 by Monkk.
In particular, Typemock Isolator.
DISCLAIMER: I am in no way affiliated or receiving any compensation from the makers of Typemock. Simply a developer in the trenches loving this tool in his tool box. From thier website: http://www.typemock.com/index.php
| “Isolate any .NET dependencies to make unit testing easy” What does Isolator do?Typemock Isolator gives .NET developers the power to easily perform unit testing by making unit tests easy to write and automate.Isolator improves the bug-fix-time factor, and increases your code coverage. |
I’m not really going to review it, but it is an excellent product for use in writing unit tests. Plays 100% with NUnit. This is simply a no brainer, a tool you must have as a professional developer working with .NET.
If you are familiar with unit testing, then you have run into the "Mock” object. It looks and works just like the real thing, but it’s not, it’s a fake that does your bidding so you can control the outcomes of the tests to hit the proper scenarios for verification. And for small loosely coupled objects, this works with the added overhead of making the mock objects. But invariably you will end up with a data-bound object or a class sub-classed 3 levels deep and controlling the testing inputs gets harder and harder to control.
There are many development patterns out there that help to mitigate this “cost” such as factories with delegated constructors to allow snapping in of the data-provider, but these quickly become very complex beasts, and the codebase is just as large as the production code. Yes it works, yes it’s thorough, but is there a better way?
Yes! Why just today, I was creating some tests around a subsystem that essentially picks what will be shown to the user based on various rules. We are re-using the subsystem with another application and since the codebase is well set up and shared between like applications, with proper testing in place, we will be able to re-factor the code to be used in both spots with much higher confidence.
For one scenario, a random number between 0 and 99 is picked values less then 50 see A and the values greater then 50 see B. Well to right a test for this, you really need a consistent value returned from the random number generator. In my case, the random number was being returned from a private static little wrapper function around Random.GetNext() which I wil call GettRandomInt for namesake.
Typemock Isolater allowed me to intercept the call to GettRandomInt and force a return value of whatever I need for that test to be able to fully test my scenario. In a single line of code. That’s right 1 DAMN LINE OF CODE, I almost cried. Mind you I got lucky in that it was a static function so I never needed an instance, but at worse, 2 lines of code. Not too bad. And it was a private member as well. It has always been a source of frustration to only be able to test public functions, or to break ideal object model integrity for testing purposes alone. I mean of course quality is the clear choice here, but it isn’t free.
I was just very impressed with the product through a single day’s use. If you have ever “mocked autoquote” (and you know who you are (-: ) I guarantee, that’s right I said it, GUARANTEE, your satisfaction! I will be buying the personal edition for myself to use on my own projects, and for $89.00 that’s quite affordable.
They also have SharePoint isolator which I have not used, but have worked with SharePoint. And I can only imagine how this would be an essential tool.
Anyway, thank you Rob Witt for showing me the light. Amazing!
–
Regards!
Posted in Programming Related | Print | 4 Comments »
27. February 2009 by Monkk.
While I’m at it, I’ve heard of a convenient way to help grind these things out. I don’t know if it’s ethical or not but, I’ll leave that decision to you.
1.) Start a server
2.) from console: mp_teams_unbalance_limit 0
2.) from console: sv_cheats 1
3.) from console (as many as you want): bot -team red -class scout
4.) from console: sv_cheats 0
5.) from console (DO NOT FORGET TO DO THIS!!): retry
6.) EARN YOUR ACHIEVEMENTS
7.) from conosle (just in case as some achievements require death): kill
8.) You’re done.
Notes:
This turns cheats on to add the bots, then turns it off. The retry tells the client to retry the last connection which will allow the client to detect that cheats are not on anymore (which means you can earn achievements). The bots will stay after the retry command.
To move them around you can use the console command: bot_mimic
bot_mimic 1 turns it on, bot_mimic 2 turns it off.
The only reason I know about it is because I don’t have a large set of steam friends and some of these achievements can’t be earned. Again, just disseminating information. I don’t know how Valve views this practice but it seems ok in my book (that and 5 bucks will get you a coffee at Starbucks) so don’t shoot the messenger.
Posted in Gaming | Print | 4 Comments »