Using regular expressions with Visual Studio

0

Posted by Jaime | Posted in Coding | Posted on 28-02-2011

Tags: ,

Today, I began using regular expressions to change a whole bunch of code. However, what I learned from using RegEx in TextMate was not the same as in Visual Studio.

So, for example, the parenthesis around regular expressions to indicate a backreference in TextMate:
    (\w+)
is represented by curly braces in VS:
    {\w+}

And to get the backreference in TextMate, you would use the $:
    $1
but in VS, you would use a backslash:
    \1

You’ve been locked out!

0

Posted by Jaime | Posted in Not-so-funny | Posted on 28-02-2011

Tags: , , , ,

For some strange reason, my network account would be locked by the domain controllers on the network and I couldn’t authenticate using my credentials.

My workstation authenticates either through an ActiveDirectory server or an OpenLDAP server and only recently, I’ve been having problems with Apple Mail asking me for my password over and over again or my workstation not being able to log into the network.

I looked at the Console app to see if I could get more information and with some help from my IT admin, we were able to find the cause of the problem: the Contacts program was unable to bind to the authentication server.

So, I popped into Contacts, opened the app preferences and… would you look at that! The password I had changed for my account was not updated in Contacts.

That seemed a little silly that the System Preferences was able to change my LDAP password, but the Contacts app would hold it’s own copy of my network password.

When Apple Mail would query the Contacts program, the application would attempt to log in several times on the ActiveDirectory server, using the wrong credentials, and cause my account to be locked out.

Ugh…

The iPhone development continues

1

Posted by Jaime | Posted in Coding, Not-so-funny | Posted on 28-02-2011

Tags: , , , ,

I’m having the darn-est time with this UIPickerView thing.

I created a table view that has 4 rows. Two of the rows bring up a custom picker view, one row is a toggle switch control and the last is a text field.

The last two controls work fine, but the UIPickerView does not. What happens is that when the control comes up, all of the values are there, but the wheel is not responding to any gestures.

I already read the documentation provided by Apple on this control, so now, I’m doing the usual thing to troubleshoot this problem: look at sample code, read some newsgroups, Google, “My UIPickerView is not responding to gestures”, and I see other individuals having problems, but not the same thing that I am having.

So, what’s the solution? Well I don’t have one… yet. When I do… I’ll blog it.

Surprise!

0

Posted by Jaime | Posted in Coding | Posted on 25-02-2011

Tags: ,

I actually implemented a large if, else if statement on the Mac with no problems.

Go to compile that same code in Visual C++ 2008 and…. BANG! VC doesn’t play that!

Apparently, there is a limit as to how many control statements you can have. Go figure 🙁

Thanks again!

0

Posted by Jaime | Posted in What's New | Posted on 25-02-2011

Tags:

Thanks again to the same co-worker who showed me how to do a large search and replace in TextMate, he now gave me a new blog site worth reading: http://idevblogaday.com/

Performing a large search and replace

3

Posted by Jaime | Posted in Coding, Tip | Posted on 23-02-2011

Tags: , ,

Thanks to my co-worker for showing me this really cool trick in TextMate!

I have this project I’m working on where I need to represent enum values as text for analysis purposes. The enum though is not set up to be easily iterated over (Dr. Dobbs) (James Kanze), so I added a stream operator to do the job.

Now, using TextMate, it’s easy to use the Macro recorder to perform a text insert operation over a small enum. However, I came across a large one that would make this process way too cumbersome.

enum {
kFirstConstant = 0x001000,
kSecondConstant = 0x001002,
kThirdConstant = 0x001004,
[...]
kTwoHundrethConstant = 0x001216,
};

Thanks to my co-worker, he showed me how I can easily modify my text using TextMate‘s Search and Replace feature on left-justified code:

Find:
^(\w+)(.+)$

Replace:
else if (enumvalue == $1)
\tstringrep = "$1";

Making sense of CrashReporter…

0

Posted by Jaime | Posted in Coding | Posted on 23-02-2011

Tags: ,

So, if I have a CrashReporter dump for a release application I am trying to troubleshoot, I found the following page very helpful: http://developer.apple.com/tools/xcode/symbolizingcrashdumps.html

Essentially, I can take the crash report and find out what line of code the error occurred at. But, you have to have the source code in order to do this trick.

I had to rename Windows

0

Posted by Jaime | Posted in Tip | Posted on 18-02-2011

Tags: , , ,

I had to rebuild my workstation, and alone with it, install a new hard drive that is to be used for testing.

Now both drives have Windows 7 installed.

When the installation for the second drive started up, all I saw was:
Windows 7
Windows 7

as my boot options… Shoot! Which one do I pick?

Luckily for me, there is a way to fix this.

In Windows 7, there is an application, named bcdedit, that allows you to change the description of the installation.

So, I clicked on the “Start” menu, clicked in the search box and typed “cmd”. The program showed up on the top of the menu and I right-clicked on it to select the “Run As administrator” mode.

Once the program opened, I typed:
bcdedit /export c:\bcd_backup
to backup my configuration… just to be safe.

After I did that, I typed:
bcdedit /set {current} description "Windows 7 Working Install"
to rename the default Windows installation so that I know which one to pick.

You can type msconfig at the run line too so that you can set the default operation system to load using a nice UI.

Extra help from:
http://www.sevenforums.com/
http://technet.microsoft.com

Killer bunnies

0

Posted by Jaime | Posted in Funny, What's New | Posted on 18-02-2011

Tags: ,

I thought this was a little far fetched when I read the description on thefirearmblog.com, but the video was actually really good.

Hmmm… rebuilding my PC… again

0

Posted by Jaime | Posted in Not-so-funny | Posted on 16-02-2011

Tags: , ,

I love how stable the PC is… especially when I need to use it most…

I’m rebuilding my Windows 7 workstation… again… and this time, I’m cloning my disk… maybe in the hopes that I can restore from an image next time I have a situation like this.