04 Feb 2012
Monologue
Códice Software: An arrow story
Well, a few weeks ago someone posted some comments from the Mercurial folks about our (and Git's) recursive merge strategy. I covered it a few days ago here.
Interestingly, some people argued that the way in which we render the branches in the branch explorer (merge links pointing from source to destination) is not correct. I really don't care about how correct it is since I don't feel like teaching graphs theory on a daily basis, but we do always listen :P.
This is basically how the Branch Explorer renders branches and commits (changesets):
And well, in Plastic SCM 4.1 (it is ready down here and soon will be published under "labs" for the impatient among you) there's a hacker hidden option:
edit branchexplorer.cfg
and add:
display.options.dag_mergelinks=true
and then you'll see:
Which, ok, well, whatever, I guess it has its own audience! :P
Vertical
4.1 features the long awaited, begged, proposed and requested "2D version tree feature" that I'm not unveiling today... :P And together with it it comes the possibility to render your branch explorer... vertically... up means newer.
All credits to Mr. Daniel Peñalba! :P
Enjoy!
04 Feb 2012 12:02pm GMT
02 Feb 2012
Monologue
Unity Technologies: How to Submit content to the Unity Asset Store
UPDATED! The above video is the updated version from 3rd February 2012. Some of you have gotten in touch with us, asking for a tutorial on what is required to submit your content to the Asset Store. So we have made you the video above on the current procedure for submitting content to us. Even...
02 Feb 2012 11:25pm GMT
Códice Software: Migrating from SVN to PlasticSCM

There are a lot of ways to do the same and with different tools, but this one is pretty and quite simple.
02 Feb 2012 3:29pm GMT
30 Jan 2012
Monologue
miguel de icaza: Bubbles
Recently one of our customers asked about how to implement a conversation display similar to the iOS SMS/Messages display. You can find the BubbleCell sample in our Github repository.
This is what the conversation looks like:

To implement this, I used iOS's UITableView as it already provides a lot of the functionality that we need for this. What I did was to write a custom UITableViewCell that can render bubbles with their text.
I wrote both a MonoTouch.Dialog Element that you can host in your DialogViewController as well as a custom UITableCellView which can be reused by those using UITableViews directly.
This is how you could populate the initial discussion inside MonoTouch.Dialog:
Section chat;
var root = new RootElement ("Chat Sample") {
(chat = new Section () {
new ChatBubble (true, "This is the text on the left, what I find fascinating about this is how many lines can fit!"),
new ChatBubble (false, "This is some text on the right"),
new ChatBubble (true, "Wow, you are very intense!"),
new ChatBubble (false, "oops"),
new ChatBubble (true, "yes"),
})
};
And this is how you would add a new element to the conversation:
chat.Section.Add ( new ChatBubble (false, "I want more cat facts"));
Implementation
Bubble rendering is implemented in Bubble.cs and contains both the UITableViewCell as well as the element. It follows the pattern for creating UITableViewCells that I documented before.
Each cell is made up of two views: one contains a UIImageView that paints the bubble and the other one contains the text to render inside the bubble.
This is what the two bubbles images look like:

We load these using UIImage.FromFile and then use the iOS 5.0 UIImage.CreateResizableImage method to create a UIImage that can be stretched on demand. To create the resizable image we need to tell CreateResizableImage the region of the image that can be stretched. Anything outside of the UIEdgeInset will be kept as-is:
left = bleft.CreateResizableImage (new UIEdgeInsets (10, 16, 18, 26)); right = bright.CreateResizableImage (new UIEdgeInsets (11, 11, 17, 18));
This will stretch the region highlighted in red, while rendering the external border as-is:

With the above code, the image will be rendered in a variety ways depending on the Frame that is assigned to the UIImageView that hosts our resizable UIImage:

The only remaining interesting bit in the code is to configure our UILabel properly. We want to set its BackgroundColor to UIColor.Clear to avoid painting the background in a solid color and we also specify that the text should be word-wrapped if it does not fit in a single line:
label = new UILabel (rect) {
LineBreakMode = UILineBreakMode.WordWrap,
Lines = 0,
Font = font,
BackgroundColor = UIColor.Clear
};
Finally in our LayoutSubViews method we must compute the proper sizes for the bubbles and the text that goes in them. I made it so the bubbles did not take the entire space in a row. Instead they take 70% of the row to give a similar effect to the rendering of the iOS messages UI. The code is pretty straight-forward:
public override void LayoutSubviews ()
{
base.LayoutSubviews ();
var frame = ContentView.Frame;
var size = GetSizeForText (this, label.Text) + BubblePadding;
imageView.Frame = new RectangleF (new PointF (isLeft ? 10 : frame.Width-size.Width-10, frame.Y), size);
view.SetNeedsDisplay ();
frame = imageView.Frame;
label.Frame = new RectangleF (new PointF (frame.X + (isLeft ? 12 : 8), frame.Y + 6), size-BubblePadding);
}
30 Jan 2012 3:22pm GMT
Jb Evain: IL fun fact: not is not !
Picture yourself working on crafting a specific piece of CIL.
You need to write the compiled equivalent of:
bool b = ...; bool n = !b;
It would be tempting to write:
ldloc b not stloc n
Except that it would not always work. not doesn't negate booleans, it computes the bitwise complement of the value on the stack. It's also not to be confused with the neg opcode, which negates a value, as in a multiplication by -1.
The usual pattern to negate a boolean is:
ldloc b ldc.i4.0 ceq stloc n
But that's not really fun, is it?
Actual fun fact: there's a misused ?not? in the ECMA 335 in the example of the section 14.5 of the partition II.
30 Jan 2012 3:00pm GMT
Ruben Vermeersch: Awesome details
I like small details in software. Here's a nice one I spotted the other day:
The Amazon Kindle app for iPad changes its background depending on the hour of the day. It even has some very nice effects, for instance, when switching to the night view, a falling star flies by.
Small details and nice polish shows your users that you care. Don't be happy when it works, go the extra mile.
30 Jan 2012 2:14pm GMT
Alex Rønne Petersen: GithubSharp with ServiceStack.Text
At Xamarin, we've been using GithubSharp to access the GitHub API for some time. We ran into some issues with it, however, because the JSON serializers in .NET are buggy as hell (one had trouble deserializing a simple dictionary; another couldn't handle large payloads). Therefore, we forked and branched the project and made it use [...]![]()
30 Jan 2012 11:05am GMT
27 Jan 2012
Monologue
Códice Software: P4 break
Are you confined in perforce? Do you want to escape from it?
Materials
We need some tools to success in our adventure!
- Python 2.7 (http://www.python.org/getit/releases/2.7/)
- P4PythonLib 2010.1 for Python 2.7 (http://public.perforce.com:8080/guest/sven_erik_knop/P4Pythonlib/bin/?ac=83)
- Bzr Standalone (http://launchpad.net/bzr/2.4/2.4.2/+download/bzr-2.4.2-1-setup.exe)
- Bzr Python Based (http://launchpad.net/bzr/2.4/2.4.2/+download/bzr-2.4.2-1.win32-py2.7.exe)
- Git for windows (http://msysgit.googlecode.com/files/Git-1.7.8-preview20111206.exe)
- P4-fast-export.py (bzrp4)(http://dl.dropbox.com/u/2974293/trunk.rar)
- I assume you have the P4 client and server.
Dangers
It?s not going to be a Boy Scout trip? some brave people failed.
- If the Bzr and P4PythonLib is not able to find the Python installation directory please review the following link: (http://selfsolved.com/problems/setuptools-06c11-fails-to-instal/s/63)
- If the p4-fast-export.py fails regarding a Git error you have to follow this:(http://stackoverflow.com/questions/5299122/unable-to-import-with-git-p4-on-windows)
- Install all the materials, just install it, you don?t need to open or configure anything.
- Place the http://dl.dropbox.com/u/2974293/trunk.rar content inside a directory called ?bzrp4? under the "C:\Program Files\Bazaar\plugins" directory, the path to the python migration file should be like this: ?C:\Program Files\Bazaar\plugins\bzrp4\p4-fast-export.py?.
- Customize the ?setup_env.bat? parameters with your environment info, adapt the Git path, P4PORT, and the Perforce server Path. Finally run it.
- Open a command line window and run: ?python p4-fast-export.py //my/repo/path@all > p4fe.dat?. If you are strong enough you can review the command help. Make sure you are using the Python 2.7 executable.
- Create a temporal directory, change your command line directory to it and perform the following: ?git init .? ?type p4fe.dat | git fast-import? and then ?git fast-export --all --tag-of-filtered-object=drop --signed-tags=strip > gitFe.dat?
- The last step is ?cm fast-import p4ImportedRep gitFe.dat?
27 Jan 2012 3:32pm GMT
25 Jan 2012
Monologue
Códice Software: CmdRunner power!





25 Jan 2012 10:30am GMT
Unity Technologies: The Global Game Jam 2012
Its that time of year again! It seems like a lifetime ago that I was attending my very first Global Game Jam back in early 2009. I doubt I could ever have imagined that in the subsequent years I would be working for the company who's tools I was using for the 48 hour...
25 Jan 2012 5:04am GMT
Unity Technologies: Unity 3.5 Developer Preview: Expanding Horizons!
The recently released Unity Developer Preview is jam-packed with new features. Among the most exciting of these features are previews of two new export options for publishing to the web: Google Native Client and Flash. In addition to leveraging users' already-installed software to get them into your games even faster, these platforms will allow Unity...
25 Jan 2012 12:00am GMT



