Posted: January 12th, 2012 | Author: Eric | Filed under: Software | No Comments »
Since I was finding myself doing quite a lot of searches on Stack Overflow recently, I decided to write a real simple plugin for Sublime Text 2 that would allow me to do queries using the current word/selection or user input. It is available on GitHub and will be shortly available through Package Control.
The available commands are stackoverflow_search_selection and stackoverflow_search_from_input which are self-explanatory.
You can trigger them from the Command Palette:

Or through the Tools menu

This is definitely not the most complex plugin ever, but it does save me some time!
Hope this helps someone.
Posted: January 7th, 2012 | Author: Eric | Filed under: Software | No Comments »
After shopping around for a new text editor, I decided to stick with Sublime Text 2. While the editor is still in Beta, it is very fast and stable. See this video review at HeyBigName.com for a more detailed review.
Even for home projects, I tend to use Perforce (the licence is free if you have 2 users max). While Sublime Text 2 didn’t support a perforce integration, it was pretty easy to add a small python plugin to allow
- User command to be bound on a menu item or keyboard shortcut
- Call to p4 edit when a file is read only and about to be saved
I think the longest part was understanding that to call my PerforceCheckoutCommand I had to write perforce_checkout (no caps, _ added and command removed) in the config file.
For those of you who would be interested in using it, it’s available on GitHub
https://github.com/ericmartel/Sublime-Text-2-Perforce-Plugin
Edit: The plugin now supports auto checkout, auto add, checkout command and add command. I’m waiting for Sublime Text 2 to support delete and rename callback to add those. The plugin was also submitted to be part of Package Control (another useful plugin for Sublime Text 2) to ease its integration.
Edit: It is now part of Package Control, just use Package Control: Install Package and type Perforce and you’re all set!
Posted: July 1st, 2010 | Author: Eric | Filed under: Progress | 1 Comment »
For the last few weeks, I’ve been working on and off on a small android project. For number selection, I wanted to use something similar to what’s in the Alarm Clock that ships with most Android phones… a simple control made out of 3 elements, a text field, an “increase” button and a “decrease” button. I was really surprised to see that this is not part of the SDK. After checking on the net, I found this site:
http://www.quietlycoding.com/?p=5
It seemed to work well most of the time, but I had a strange behavior that I thought was coming from my side… After displaying the NumberPicker in a Dialog, I was using an OnClick on some button in this dialog, and sometimes the number I was getting from the picker didn’t correspond to what was on screen. Also, after seeing the application running on my phone, I decided to show it to my fiancée, and her first try at it broke the NumberPicker! If you hold one of the buttons, the picker will loop infinitely increasing or decreasing the value.
There might be other issues but here’s my fix to the two of them:
First, the infinitely increasing value problem, it appears that the code that’s constantly run does not have exit conditions, here’s how I fixed it:
private final Runnable mRunnable = new Runnable() {
public void run() {
boolean repost = false;
if (mIncrement) {
changeCurrent(mCurrent + 1);
if(mIncrementButton.isPressed())
{
repost = true;
}
} else if (mDecrement) {
changeCurrent(mCurrent - 1);
if(mDecrementButton.isPressed())
{
repost = true;
}
}
if(repost)
{
mHandler.postDelayed(this, mSpeed);
}
}
};
I simply check if the button is still pressed before reposting the “increase” callback.
As for the value, if the text edit was currently being edited and the value was fetched before it lost focus, it was still returning the old value… the fix is quite simple:
public int getCurrent() {
validateInput(mText);
return mCurrent;
}
Here’s the modified NumberPicker.java to be used with QuietlyCoding’s package, feel free to comment if you have any questions!
Thanks
Posted: April 8th, 2010 | Author: Eric | Filed under: Software | No Comments »
If you’ve happened to use a lib with debug information, chances are that you’ve tried to step into a function and was greeted with a pop up similar to (I’ve compiled real quick FreeImage, which is an awesome library available here, to have a lib with debug information, then moved the source elsewhere because the pdb contains the original path the source was built from):

If at this point, you press “Cancel”, you’ll be prompted with a pop up saying:

Sure, no problem.
The thing is that once this is done, anytime you’ll try to step into a function coming from the same cpp file you just canceled the look up, you’ll be prompted with the message without being able to select the file.
This is really easy to fix actually. This setting is stored in the Solution, under the Debug Source Files panel:

Simply removing the file from the “Do not look for these source files” will re enable the file selection dialog.
Posted: April 8th, 2010 | Author: Eric | Filed under: Software | No Comments »
A while ago I received the visit of two programmers from a middleware company at work. They were showing me how to properly use their software, so they had to integrate it in our solution. The more senior one was typing while the junior was learning from him. I saw him use something I’ve never seen before so I guess I learned something too!
He used “>” followed by “of” in the search tab, and as he typed, the drop down menu was populated by files matching his filter… hum! I didn’t know Visual Studio had this built in, I thought you had to use Workspace Whiz or Visual Assist!
Here’s an example:

(screenshot taken using the BWAPI solution)
The prefix > tells Visual Studio to interpret the rest as a command. The actual Command Window is accessible using Ctrl-Alt-A (default binding) for those who don’t want to use the mouse to select the “Quick Find” text box. You can either use an Alias (such as of for Open File) or the actual command (such as File.Open).
Microsoft lists some commands and aliases available here but using >Alias will list all the set aliases.
http://msdn.microsoft.com/en-us/library/c3a0kd3x.aspx
You can create aliases and remove aliases using the alias command:
http://msdn.microsoft.com/en-us/library/xasxzd71.aspx
Given that most people don’t use them at all, it is pretty standard across all PCs, so if you have to work on other people’s PCs, you should be able to use aliases instead of relying on an installed plug in!
Posted: November 5th, 2009 | Author: Eric | Filed under: Software | No Comments »
There’s a new programmer on my team and today I was reviewing his code. He had this weird scrollbar in Visual Studio which displayed a preview of the code with an highlighted “window” of what was on the screen.
For those who’d be interested in checking it out:
RockScroll
Also, the only other plugin I use is Visual Assist X, you can get it here (not free though, but totally worth it!):
Visual Assist X