Tech and a few other things RSS 2.0
# Friday, February 05, 2010










The Problem:
Getting a Powershell script to run a batch script.

The Solution:
powershell.exe -noexit d:\<path to my batch script>\Reporting_Code_Load.bat

Explanation:
All you need to do is add the line above as is to your Powershell script. The "-noexit" tells the command prompt to stay open, simply remove it if you don't want the command prompt to open.
Friday, February 05, 2010 3:47:22 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
.Net | powershell
# Wednesday, January 20, 2010

I'm told the best way to keep your New Years resolutions is to write them down. What a better place than my personal blog to attempt to keep me on the strait and narrow. Here is my list.

1. Read 1 book a month.
Since I recently finished school I now have my time back to read what I like. I have decided to start off reading fiction for some feel good wins during the first couple months then move on to something that I may improve from. I'll do a quick post of every book I read.

2. Get my PMP
Apparently a Masters in Business Administration with a very strong focus in finance from a reputable, though not tier 1, business school isn't a big deal anymore. Being a slave to the corporate demands I'm diving into becoming a project manager professional (PMP). It might be a little interesting I suppose. Though I'm betting the challenge of organizing teams will be a tiny bit easier than calculating derivatives and bond valuations.

3. Finish my Second iPhone Application

My first application is a fun little Online Banking hack for the company I work for. The second one I would like to create is a wine cellar type application for the iPhone. I know a few wine'os out there that have a huge "library", I believe this would be useful and YES someone else has done this, but I think I can do it better. :)

4. Use Less Cliche Statements
This could just be me, but I feel statements I use such as "The grass is greener on the other side," are because I am lacking the creativity to express how I truly feel so I go with something easy to grab, because it's, what is said, and not necessarily indicative of my true feelings.


Wednesday, January 20, 2010 11:05:55 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Me
# Friday, January 01, 2010


The Problem:
Not being able to do a simple compare in an "if statement" between two alpha or numerical statements while programing in objective C.

The Solution:
NSOrderedSame

Example Of Use:
This compares the value of "key" to the value of "support." If they are equal then you get a return value of true.
if ([key compare:Support] == NSOrderedSame)
Explanation:
For some reason Objective-C decided to make it a little bit harder to compare values. Instead of just using the traditional way "[key compare:Support]" return a true value for the if statement OR "([key compare:Support] == 0) OR "([key compare:Support] == true)" they decided to make it a little bit more complex. As demonstrated above. I'm sure the writers of Objective-C have a good reason for this, but one more level of abstraction could make Objective-C that much friendlier to it's programmers and isn't that what it's all about in the end...getting more people to develop in your language.

Some of other comparisons you might want to use are:
NSOrderedAscending -- The left operand is smaller than the right operand.
This is equivalent to using "<" in most languages.

NSOrderedDescending -- The left operand is greater than the right operand.
This is equivalent to using ">" in most languages.
Friday, January 01, 2010 7:51:02 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Mac | Mac OS X | Objective C
# Wednesday, November 11, 2009
If Scott Hanselman lives and die's by unit tests, why don't we all just fall in line? It seems the nerd community, has an uncanny ability to adopt silly things quickly. Things like xkcd.com or the idea of ninja's. I have yet to laugh at one xkcd or understand how ninja's are relative in any shape or form, because of this I felt I needed to read up on unit tests, specifically for C#, to find out if it's just hype or this is something development shops with a strong QA team really need to look at.

I read two books that covered the topic of unit testing. The first book was Foundations of Programming (recommended by Scottie H. himself and is free) and the second is Pragmatic Unit Testing In C# with NUnit. Both of them start off with the same old song and dance on how you might have up front costs of introducing unit tests to your code, but the stability these tests provide over the duration of your codes lifetime will cause such dramatic cost savings for the company, it would be foolish not to explore the idea. What a compelling sales pitch, a pitch salesmen, for just about any technology, have used since the beginning of technology in businesses. I'll cut all the used car salesman tactics out and state the most intriguing argument to unit test. It increases code stability and it's easy.

The next question I asked myself: What do I exactly test in the code-base I am working on? In Pragmatic Unit Testing (PUT) they give us an acronym to use in order to answer this question. BICEP.


BICEP, breaks down as such.

Boundary Tests
Inversion Tests
Cross Check Tests
Error Tests
Performance Tests

These are the 5 major aspects one should test, according to PUT and it provides unit testers with a place to start. The next major topic in discussing how to test code is decoupling one piece of code to another. Does your code talk to a middleware? How do you test if middleware is not done creating your service to consume or if middleware is down? In steps NUnit Mocks, NMock2, and DotNetMock. These 3 mock frameworks provide the developer with the ability to feed your tests predefined values, values decided by you. Without going into how to use these mock frameworks, I believe that outside of a few isolated situations they should not be used. The entire purpose of testing your code is to test that you are getting information back that fits the criteria you are looking for. If this information, that is beyond your control, changes on whatever level for whatever reason, you as a developer need to know. Putting in mock objects hides this.

Since I work for a web shop, the topic of web UI unit tests interested me. PUT recommend using Selenium. This makes sense because it still uses the nunit style of testing keeping all your tests to one testing style. Selenium seems a bit cumbersome in comparison to WaitN or iMacro, but I feel keeping all your testing in the same style outweighs the cons of not using Selenium. The more desperate testing sources you introduce, the more confusing it is for an outsider to step in and see the whole picture when learning the code, especially when it's not contained in a single solution.

Finally, I recommend reading both of the books mentioned, but lets be honest most of us care so little about unit testing we'll be lucky to read all of 1 of these books let alone all of both. If this is the case I recommend PUT, while the first few chapters read like the high school teacher striving to gain his students social acceptance, it's an easy read and you can jump into the book at nearly any chapter and get the exact information you are looking for on unit testing. This is something I wish all programming books could achieve.
Wednesday, November 11, 2009 3:12:32 PM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
.Net | readings | Unit Testing
# Monday, September 28, 2009
Error Readout:
1st Error:
this class is not key value coding-compliant for the key managedObjectContext

2nd Error:
NSImageCell's object value must be an NSImage

Fix:
1st Error:
There is one prominent reason you could get this answer. You didn't spell your property correctly when you were binding it to....well....whatever you want to bind it to, in my case it was an Array Controller.

My problem however had nothing to do with this. When I created a new project after I upgraded to xCode 3.2 I forgot to check one very import checkbox, Create document-based application (Note: it was not a check box in older version of xCode it was a full icon selection upon creating a project). By not checking this I created a big variety of problems for myself. One of the errors occurring when I didn't check the Create document-based application, was the error this class is not key value coding-compliant for the key managedObjectContext.

2nd Error:
This error is very clear in it's issue. I was creating an entity with a property of native type binary and the compiler wanted NSImage. Grrr but I should be able to pass an image as a binary object, I would say to myself as I had urges to break my laptop and anything else in reach over my knee. My fix again was to simply create a project and remember to click Create document-based application. I know this is not your typical fix, but in case someone else runs into this issue the same way I did I hope they find this and it will be a quick and easy resolution.

Explanation:
All of this pain could have been resolved from the very beginning had I known to click Create document-based application. It was a silly little mistake that cost me a few hours. In my defense however I was under the impression of not checking Create document-based because in Hillegass's book he states that for this exercise we will not be using NSDocument, but NSPersistentDocument instead. It turns out this still means you have to check Create document-based application.

I will state that I should have known something was wrong when I didn't have a MyDocument.xib in the Resource folder after I created the project.

I've attached an image, mainly because blog posts are more fun when there is an image, but also because it shows where this one simple little check box changed my life for a hot minute.



Monday, September 28, 2009 10:55:19 AM (Central Standard Time, UTC-06:00)  #    Comments [4] - Trackback
Mac OS X | Objective C | Snow Leopard
Navigation
About the author/Disclaimer
        
My name is Ben Coffman. I'm in love with all things Mac yet I make a living in .NET. I view this as well rounded. When I turn the internet off I focus on family, random hobbies, and sharing moments in life.

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Ben Coffman

Archive
<February 2010>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
28123456
78910111213
All Content © 2010,

Sign In