Wednesday, July 1, 2009

iPhone SDK 3.1 beta and iPhone OS 3.1 beta

Well, Apple seeded an iPhone SDK and OS v3.1 beta.

iPhone SDK 3.1 beta and iPhone OS 3.1 beta are now posted to the iPhone Dev Center. These versions are for development and testing only and should be installed on devices dedicated to iPhone OS 3.1 beta software development.

In terms of API there are a number of new methods added to AudioToolbox, OpenGLES, QuartzCore and UIKit (UIImagePickerController and UIVideoEditorController were updated).

Release Notes:

Known Issues and Fixes

Xcode/Developer Tools

  • Xcode only searches for codesigning certificate identities in the default keychain as selected in Keychain Access.

  • You may only use .png files for application icons for the device.

  • The iPhone SDK is designed for Intel-based Macs and is not supported on PPC-based Macs.

  • Xcode and the iPhone SDK only work in 32-bit mode; 64-bit mode is not supported.

  • When running and debugging on a device, be sure to turn off Passcode lock.

  • Trying to debug two applications at the same time on the same device fails with a broken pipe error in the debugger console.

Interface Builder

  • FIXED: If you use Interface Builder's UITabBarController inspector to add a UINavigationController to a tab bar controller, the navigation controller will be set up to show its toolbar. The toolbar won't be visible in Interface Builder, but will be visible at runtime, which is surprising. The workaround is to select the UINavigationController and uncheck "Shows Toolbar" in the inspector.

  • In some upgrade scenarios from beta SDK releases, Interface Builder may be left with duplicate files, which causes errors such as: "Two plug-ins both integrate a class description for the class X." Removing /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/Interface\ Builder and re-installing corrects the issue.

AddressBook

  • Image thumbnails are not displayed when ABPersonSetImageData() is called before [ABPersonViewController setDisplayedPerson:].

MessageUI

  • The Message UI framework exports class names without prefixes, which can cause namespace confusion. If you are using the Message UI framework, watch for compiler warnings about duplicate symbols. To avoid namespace issues, you can add prefixes to your own class names.

iPhone Simulator

  • iPhone Simulator does not support network home directories.

UIImage

  • You have to specify the image extension to -imageNamed: to get results.

UILabel

  • UILabel ignores its contentMode property.

UIPasteboard

  • UIPasteBoardNameFind is not populated automatically, nor is the value in the pasteboard used when displaying a search field.

UIScrollView

  • After zooming, content inset is ignored and content is left in the wrong position.

  • UIScrollView can be confused by overlapping touches in separate subviews.

UIStringDrawing

  • UILineBreakModeTruncateHead and UILineBreakModeMiddleTruncation do not work properly for multiline text.

UITableView

  • FIXED:UITableView can generate an exception when the data model changes during animation.

  • UITableView no longer ignores separatorColor. separatorStyle is still ignored.

  • A UITableView with sections cannot reorder a row to the bottom of the last section unless it started in that section.

  • Applications linked on iPhone OS 3.0 or later will get the new table view cell layout.

  • It is very, very expensive to customize row heights (via tableView:heightForRowAtIndexPath:).

  • Unable to resize table wider than the screen.

  • UITableViewCell’s accessoryAction property is deprecated. Instead, implement -tableView:accessoryButtonTappedForRowWithIndexPath in your table view delegate.

UITextField

  • No way to select all the text in a field if it exceeds the text field's visible area.

  • UITextField cannot be made to resign first responder once offscreen.

UITextView

  • Setting UITextView.editable to YES should not automatically show the keyboard.

UITouch

  • UITouch is not adjusted when a layer has a transform applied to it.

  • An application will not receive UITouchPhaseBegan if a swipe begins on or above the status bar.

UIView

  • Many UIKit controls cannot be resized properly if initialized with a CGRectZero frame.

  • animationDidEnd fires too soon and can cause animations to stutter if you do too much work in the callback.

  • If a view subclass implements -drawRect: then the background color for that view subclass cannot be animated.

UIViewController

  • A full-screen modal navigation controller doesn't display under the status bar in a non-full-screen window.

  • For applications linked prior to 2.2, view controllers within a navigation controller will only underlap a translucent navigation bar if their view is a scroll view. For applications linked to 2.2. or later, view controllers within a navigation controller will always have their view positioned to underlap a translucent navigation bar.

  • FIXED:If a UITabBarController has more items than can be displayed onscreen and the selected item on startup is within the More collection, changing the title of that item's view controller changes that view controller's title and the title of that item's TabBarItem. It also has the erroneous result that that item's TabBarItem is overlaid on the first TabBarItem.

  • FIXED:View controllers added to a tab bar controller don't behave correctly when hidesBottomBarWhenPushed is set to YES.

  • FIXED: When view controllers are pushed onto the stack, toolbars with their translucency changed now hide correctly.

  • FIXED: Navigation controllers now respond correctly when popping from landscape view to portrait view.

UIWebView

  • UIWebView does not make public its UIScrollView.

Monday, May 18, 2009

Swipe Delete From UITableView

You probably like to use swipe to delete elements from UITableView. Here you have a short example how to implement so in your iPhone applications.


On Swipe you receive the following message, you don't need to do anything in it:

-(void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath
{
}

When a user hits DELETE you can process it:

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
// If row is deleted, remove it from the list.
if (editingStyle == UITableViewCellEditingStyleDelete)
{
// delete your data item here
// Animate the deletion from the table.
[self.tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}
}

Tuesday, May 12, 2009

Andrei Alexandrescu: "Iteratos Must Go"

Very interesting slides of Andrei Alexandrescu from BOOSTCon'09, where he talks about ranges. I wish to be there in Aspen at the time when BOOSTCon took place. So, here you get the slides.

Wednesday, April 15, 2009

Development under Mac OS X

Since long time already I have been not posting here... :( So, let's try to reload this blog...

With this post I am going to start a series of posts about development under Mac OS X. I will post about something I find interesting, difficult to implement, and some tricks I developed or just googled. :) Hope it helps to someone or at least it will help me to order my experience on that field.

Well, let's start from the environment.
I consider myself to be an experienced Windows and Linux developer. This stuff I do for many years already.
With Mac I met about five(!) moths ago. I mean, I knew it exists and I even worked briefly on it some years ago, but the truth is that, most of my projects were related to Windows or Linux.

I met Mac and that was love at first sight ;) As soon as I started to work on it I immediately suffered from the filling that I want to start an application development project under Mac and use it in my daily work... really!

As the hardware I use a new MacBook Pro, 15''



The only thing I can say is - WOW! It is a fucking amazing piece of hardware! Apple did a terrific job on this one.
I am just in love with the new trackpad device and the new keyboard of MacBook. No more words... Just get this laptop and enjoy!

BTW, I still do a lot of Linux development. In order to continue to do that on my Mac I use VMware Fusion. It works like a charm. One screen is a full screened Fedora 10 guest, another is a MS Windows XP guest and all under control of Mac OS X. ;)


The OS I am using is Mac OS X Leopard.
As the development environment I decided to use XCode (v. 3.1.2). Well, I am a bit disappointed with XCode and I tell you why. Mainly because of two thinks I see missing.
  1. A terrible SVN support. For example, I didn't find a way to set SVN properties on files. Also SVN plug-in sometimes living its own live and could be doing something, which blocks all version control operations on files in XCode. I didn't find a better way to just stop that plug-in by restarting XCode.
  2. No way to define custom formating rules. Formating preferences are very weak: a couple of checkboxes and that's it... If you do Objective-C development, then in a couple of weeks you will used to default formating and syntax coloring XCode does. But anyway, I would prefer to have a bit more flexible formating settings.
I think XCode is a very new and fresh product and Apple is developing it very fast (you can tell that from new thinks you get every new release). So I believe we will see soon a strong competitor to MS Visual Studio and to Eclipse. So far I would say MS VS is the best, at least for C++ development.

Anyway I would give a big plus to XCode and the best mark just for its very good integration with Objective-C and Cocoa. In combination with Interface Builder, which is by the way just the best GUI builder I have ever seen, XCode does all you need for application development.

James Bond will return... I mean, I will continue posting on that subject ;)

Tuesday, September 30, 2008

Qt got rebranded

Trolltech web site got a rebranding and there was also a Qt 4.4.3 release dedicated to the rebranding only.

Qt 4.4.3 is a rebranding-only release. In all other aspects, it is the
same release as Qt 4.4.2. It maintains both forward and backward
compatibility (source and binary) with Qt 4.4.2, 4.4.1 and 4.4.0.


In June 2008 Nokia acquired Trolltech ASA to enable the acceleration of their cross-platform software strategy for mobile devices and desktop applications, and to develop its Internet services business. On September 29, 2008 Nokia renamed Trolltech to Qt Software.

Tuesday, July 29, 2008

Google Code Jam 2008 - Alien Numbers

As many of your may know Google Code Jam 2008 has been recently launched.
I found some free time and decided to have a look at the tasks of this competition. Just out of curiosity... :)

Today's morning I solved the first task - "Alien Numbers".
The task is just for practice and has almost nothing to do with the real competition. I mean, it is a simple problem, but it was very interesting to solve it as fast as possible :)

Problem

The decimal numeral system is composed of ten digits, which we represent as "0123456789" (the digits in a system are written from lowest to highest). Imagine you have discovered an alien numeral system composed of some number of digits, which may or may not be the same as those used in decimal. For example, if the alien numeral system were represented as "oF8", then the numbers one through ten would be (F, 8, Fo, FF, F8, 8o, 8F, 88, Foo, FoF). We would like to be able to work with numbers in arbitrary alien systems. More generally, we want to be able to convert an arbitrary number that's written in one alien system into a second alien system.

Input

The first line of input gives the number of cases, N. N test cases follow. Each case is a line formatted as

alien_number source_language target_language

Each language will be represented by a list of its digits, ordered from lowest to highest value. No digit will be repeated in any representation, all digits in the alien number will be present in the source language, and the first digit of the alien number will not be the lowest valued digit of the source language (in other words, the alien numbers have no leading zeroes). Each digit will either be a number 0-9, an uppercase or lowercase letter, or one of the following symbols !"#$%&'()*+,-./:;<=>?@[\]^_`{|}~

Output

For each test case, output one line containing "Case #x: " followed by the alien number translated from the source language to the target language.

Limits

1 ≤ N ≤ 100.

Small dataset

1 ≤ num digits in alien_number ≤ 4,
2 ≤ num digits in source_language ≤ 16,
2 ≤ num digits in target_language ≤ 16.

Large dataset

1 ≤ alien_number (in decimal) ≤ 1000000000,
2 ≤ num digits in source_language ≤ 94,
2 ≤ num digits in target_language ≤ 94.

Sample

Input
4
9 0123456789 oF8
Foo oF8 0123456789
13 0123456789abcdef 01
CODE O!CDE? A?JM!.

Output
Case #1: Foo
Case #2: 9
Case #3: 10011
Case #4: JAM!


The following is my solution in C++, be advised and don't blame me, there are many missing checks, I know that, and safety procedures. That is because I tried to solve this problems and get result as fast as possible. So, here you go with the solution I came up first.

#include <fstream>
#include <iostream>
#include <vector>
#include <string>

using namespace std;

typedef vector<int> IntVect_t;

size_t to_num( const string &_base_set, const string &_val)
{
size_t NumRes(0);
size_t PositionPower(1);
string::const_reverse_iterator iter = _val.rbegin();
string::const_reverse_iterator iter_end = _val.rend();
for(; iter != iter_end; ++iter)
{
NumRes += _base_set.find(*iter) * PositionPower;
PositionPower *= _base_set.size();
}
return NumRes;
}

int main(int argc, const char* argv[])
{
ifstream f(argv[1]);
if( !f.is_open() )
return 1;

string outfile(argv[1]);
ofstream f_out( (outfile+".out").c_str() );

size_t nCase;
f >> nCase;
for(size_t i = 1; i <= nCase; ++i)
{
string _src;
string _dest;
string _to_convert;
f >> _to_convert >> _src >> _dest;

IntVect_t pos_dest;
size_t NumRes = to_num( _src, _to_convert );
for(; NumRes > _dest.size()-1;)
{
pos_dest.push_back( NumRes % _dest.size());
NumRes /= _dest.size();
}
pos_dest.push_back( NumRes );

f_out << "Case #"<< i <<": ";
IntVect_t::const_reverse_iterator iter = pos_dest.rbegin();
IntVect_t::const_reverse_iterator iter_end = pos_dest.rend();
for(; iter != iter_end; ++iter)
{
f_out << _dest[*iter];
}
f_out << endl;
}
return 0;
}

Thursday, June 12, 2008

StatSVN 0.4.0

A new version of StatSVN has been released. See changes.
Download StatSvn 0.4.0.

 
New Features:

o Added support for an XML export of the main reports, just use option -xml,
based on patched proposed by Nilendra Weerasinghe. Thanks to Nilendra
Weerasinghe.
o Applied patch for [ 1639462 ] Added TRAC Support. Fixes 1639462. Thanks to
Jean-Francois Burdet.
o Applied patch to StatCVS to show the Head Revision (had to change it to
hide it for CVS as it does not make sense for CVS). Fixes 1932689. Thanks
to Martin Majlis.
o Performance enhancement. If SVN 1.4 is available, do one diff per revision
instead of one diff per file per revision. Added -force-legacy-diff option
to retain previous functionality.
o Applied patch to StatCVS to add Affected files count per commit. Thanks to
Martin Majlis.
o Applied patch to StatCVS to add Revision number on commit page. Fixes
1839303. Thanks to Martin Majlis.
o I have added a validation mechanism that checks the Repository object once
the log is parsed, if root is null, it will terminate the execution.
o I have added a small project attribute which makes it more obvious which
cache belongs to what project in the repositories.xml and xml cache files.
Fixes 1687928.
o Added support for tags-dir as a way to specify 'top' directory where the
tags are stored, defaulted to "/tags/". Fixes 1692245.
o Added support for a '-anonymize' command line option, to anonymize
committer names. Fixes 1743119.

Fixed bugs:

o Changed RSS to use the common one:
http://feeds.feedburner.com/ObjectlabOpenSourceNews

Changes:

o The RepoMap and LOCChurn reports have been promoted to StatCVS and hence,
removed from the StatSVN source tree.

Wednesday, May 21, 2008

stropts.h: No such file or directory

If during compilation your compiler complains about missing "stropts.h", don't wary. Most probably you are running on MacOS X 10.3 or FreeBSD 6.0 or NetBSD 3.0 or OpenBSD 3.8 or Cygwin or mingw or BeOS... or Fedora 9 (probably all modern Linux'es).

Simply to say, your system doesn't support STREAMS.

Linux espesially:

Linux doesn't support STREAMS (many years ago it was available as a third party module, but it hasn't worked for years). stropts.h is part of a POSIX XSR option, which Linux now, matching reality, says it is not supported.
and here we have the POSIX recommended check:

#include <unistd.h>
#if defined _XOPEN_STREAMS && _XOPEN_STREAMS == -1
/* XSR option is not available, headers, data types etc. may not be available. */
#endif
Hope it helps.

Tuesday, May 13, 2008

Fedora 9 is out

Release Notes
Get Fedora 9 from here.

Tuesday, April 22, 2008

Bjarne Stroustrup on the Evolution of Languages

Bjarne Stroustrup on the Evolution of Languages