Feed on
Posts
Comments

I use MacPorts to get a whole host of utilities. In addition, I’ve always used it to obtain later versions of subversion that the one provided with the OS. Xcode, on the other hand, is locked into using the version of Subversion which is installed in /usr (currently version 1.4.4 where as I have 1.6.3). Since I often work in the command line, eventually I will use the newer version of Subversion on a directory which I also use in Xcode. This causes a problem since the command line utility will upgrade the local repository format in such a way that old versions of Subversion (Xcode’s) cannot use it.

So, my options are:

  • Only use the command line utility, or use Xcode, on a single repository checkout, but never both.
  • Use a horribly out of date version of Subversion
  • Hack Xcode’s plugin to work with newer versions of Subversion

I chose the last, as it should give me the best of both worlds. If you were to conduct a quick Google search, you would find a whole host of people posing a solution which involves moving around system libraries!!!!! This is a horrible idea, as it breaks other things such as Apache. Buried somewhere in the sea of bad ideas, I ran across a good one, written by Jean-Daniel Dupas and improved by Philippe Casgrain which only changes the path location of libraries used by Xcode’s Subversion plugin. This script worked well for Subversion 1.5, but recent versions of Subversion would cause Xcode to crash in libapr. The solution is to add libapr and libaprutil to the script. Here is the corrected script for your use.

#!/bin/sh

if [ "$#" -lt "2" ]
then
echo "Usage: xcode-svn-update.sh "
echo "Example: xcode-svn-update.sh /Developer/Library/Xcode/Plug-
ins/\c"
echo "XcodeSubversionPlugin.xcplugin/Contents/MacOS/
XcodeSubversionPlugin /opt/local"
exit 1;
fi

# Save a backup copy, if necessary
if [ -e "$1_Old" ]
then
echo "Backup copy of \"$1\" exists."
else
echo "Saving a backup copy of \"$1\"."
cp "$1" "$1_Old"
fi

echo "Updating install path using svn libraries in \"$2\"..."
install_name_tool -change \
/usr/lib/libapr-1.0.dylib \
$2/lib/libapr-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libaprutil-1.0.dylib \
$2/lib/libaprutil-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_client-1.0.dylib \
$2/lib/libsvn_client-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_delta-1.0.dylib \
$2/lib/libsvn_delta-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_diff-1.0.dylib \
$2/lib/libsvn_diff-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_fs_fs-1.0.dylib \
$2/lib/libsvn_fs_fs-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_fs-1.0.dylib \
$2/lib/libsvn_fs-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_ra_local-1.0.dylib \
$2/lib/libsvn_ra_local-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_ra_svn-1.0.dylib \
$2/lib/libsvn_ra_svn-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_ra-1.0.dylib \
$2/lib/libsvn_ra-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_repos-1.0.dylib \
$2/lib/libsvn_repos-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_subr-1.0.dylib \
$2/lib/libsvn_subr-1.0.dylib "$1"
install_name_tool -change \
/usr/lib/libsvn_wc-1.0.dylib \
$2/lib/libsvn_wc-1.0.dylib "$1"
echo "Done!"

Now, how long till Xcode supports Mercurial?

When I redesigned Sapphire, I decided that the metadata back end would be best served by Apple’s Core Data Framework. While the framework has a lot of power, several shortcomings in the implementation hindered its potential.

First, I should start with the many things that Apple did correctly in Core Data.

  • The whole data model with relationships and properties is quite powerful. With this data model, one can represent many data sets in a simple manner, such as the example below:
    core-data-model
    This example shows part of the data model within Sapphire pertaining to TV shows, where a TV shows contains multiple seasons, each of which contains multiple episodes. Additionally, an episode contains one or more sub-episodes, to handle the case where a single file or DVD contains multiple episodes. Lastly, the show and season objects extend from a superclass CategoryDirectory, which contains some common properties to all collections.
  • Since the relationships are defined, they can be automatically maintained. In the above example, if an episode’s show relationship is set to a particular TVShow object, that show’s object will automatically have the episode added to its episodes relationship.
  • Delete rules can be set such that if an object is removed, the delete can cascade to remove other objects as well. This is useful in the case of removing a directory, and all the files and directories contained within it.
  • Saving to a file is easy since the details of reading and writing a file are handled by Core Data
  • While I didn’t use it, undo management is also built into the system.

So, with all these advantages, why is Core Data not used more often. The answer is that it contains numerous short comings.

  • The compiler has no knowledge of the data model. One is expected to use setValue:forKey: and valueForKey: to set properties and relationships. This is prone to programmer errors such as assigning a value to the wrong type or even just misspellings. While a class name can be provided in the data model, there is no synchronization between the class files and that object. Being that this is the most glaring oversight in Core Data, Jonathan Rentzsch wrote mogenerator to resolve this. It creates a set of classes which are machine edited and human edited. The machine edited files contain the correctly typed setters and getters, making programmer errors detectible by the compiler, and thus reducing the debug cycle time. This is the kind of design that Apple should have done when they first made Core Data, or at the least when they redesigned it in Obj-C 2.
  • Lack of concurrency. One cannot have multiple programs edit the same object database at the same time, even when a SQLite format is used. Core Data will allow the edits to take place, but there is no apparent means by which another program will read these changes. Often, this results in a “nested transactions are not supported” exception when one tries to save. While concurrent editing is allowed within separate threads in a single program, this requires a separate context for each thread and synchronization commands sent between them. The only viable means I have found for concurrent editing between programs is to have a single master who saves all changes sent via interprocess communication by the other programs.
  • Unsafe relationship edit times. Editing the relationships is supposed to modify the inverse relationship so the two are consistent, but there are cases where this will happen and it has to do with the timings. Normally, if an object’s relationship is removed, the inverse relationship is also immediately removed, but if an object is deleted, that change is marked to be done later in a pending queue. These would not be an issue by themselves, but together they cause major headache.
    I will illustrate this through an example. Say I have a TV show with a two seasons, each with one episode, and I chose to delete one episode. The episode is marked for deletion and nothing else occurs until the pending changes are processed. Then, when episode is deleted, I no longer have any need for the season since it is empty. The natural solution is to override the changes to the episodes relationships so that if a season finds itself without any episodes, it should delete itself.
    This would be a great solution, except that it does not work. When Core Data is processing its pending changes, it appears to shut down its change notification, which is how these relationships are maintained. Additionally, objects marked for deletion in this time are not deleted. Due to these issues, I’ve actually managed to save an object model where objects contain relationships to objects that do not exist, and several objects that should have been deleted were not because the delete was ignored. My only solution to this has been to make my own pending queue, where objects are inserted while Core Data is processing its queue, then I process mine, and repeat until both are empty.

After overcoming these issues, I’ve been very happy with Core Data. It’s faster than the model that I could design, and consumes less memory. Furthermore, it has freed up much of the headache concerned with inter-object relationships, as well as object lifetime and retain cycles. So, if Apple would resolve these issues, then there should be no excuse to not use Core Data.

As many of you know, I work on Open Source Software (OSS). This means I release several projects free of charge that I create using my time. I’ve gotten a large amount of appreciation from users, but there is another side that’s quite disturbing. What’s worse is it appears to be indicative of a far more serious problem.

Often a user will ask for a feature that is not implemented. Sometimes I like the feature and it’s something I’ll use myself so I implement it immediately, sometimes it’s one I’ll work on if I have time, and other times I don’t care for it at all so I suggest that others work on it. I take a similar response to bugs, but with respect to whether I can reproduce it. Bugs I cannot reproduce nor fix tend to go unchanged. Most take these responses in stride, but there are some who do not, in particular, those reporting an issue that I cannot reproduce, and fail to give me the required information. A few of these, whom I will call the demanding consumer, demand their wishes to be met entirely at my cost in terms of time and effort. In the past few years, I’ve noticed this group grow in size.

Why are some people so demanding? In the case of an demanding OSS user, they take a free product, make their suggestion, it’s shot down, they become more irate and demanding, and often get to the point of insulting the producer. This is akin to someone receiving a gift from a complete stranger, declaring that it wasn’t good enough, and demand more. I, being the complete stranger, am now less inclined to give out gifts as a result out of fear that some demanding person will require more of me than I’m willing to give. How is it that people have become so greedy that they cannot be appreciative of something that was given to them for free?

What’s worse is these attitudes are not limited to Open Source Software. At least with OSS, the number of consumers of a product does not affect the producer’s costs (for the most part). If an OSS producer has 5 consumers or 5 million, his costs are largely unchanged, since software is easily and cheaply replicated. This has help build an OSS market with a small set of producers and a large set of consumers, and one that can survive a set of demanding consumers whose cardinality meets or exceeds that of the producers.

What happens if the market isn’t OSS, but instead involving physical goods and capital. What if the market is not a free market economy, but instead is inhabited by a single producer who charges different consumers different amounts and provides different services and products? What if the consumer has no choice but to purchase the producer’s product? What if a majority of the consumers can change the products and services as well as the prices? I’m speaking of a government here, where the consumers are the people, and the payments made by consumers are taxes. Here, a demanding consumer can thrive, especially if his views are shared by a majority of the consumers. Furthermore, unlike the OSS market where a producer can ignore and deny services to demanding consumers, one cannot choose whether they wish to fund government programs.

Currently, only 59% of the US population pays federal income taxes. This is dangerously close to the 50% threshold. One can argue that once this threshold is crossed, it can never go back, the rational being that a representative is unlikely to raise taxes on the majority of his constituents. In addition, consider the social programs the government provides. Most of them are not targeted towards those who pay taxes, but rather towards those who do not, and the current administration seeks to increase these programs. Combine this with the ever present envy of the rich by those who are not, and the country is filled with demanding consumers. Their demands consist of: “give us more free stuff,” and “tax others to pay for it, not me.” The acquiescence to these demands yields a system where the minority is taxed heavily to pay for services given to the majority. Today, only 1% pays over 38% of the taxes. Tip the scales much more, and the paying minority, consisting of people who work hard and and good at their jobs, will see futility in their efforts to make a good living, and decided they will be much happier if they stop excelling or leave the country altogether. To compensate for this loss of revenue, the remaining minority will be taxed even further, and like a string of dominos, the best of a nation stop their hard work or leave. Everyone in the country is reduced to the lowest common denominator, and no nation can compete in the global market after losing its best.

While this is not wholly descriptive of our current situation, it could quickly become so. Getting our economy “back on track” is only solving the symptom, because true problem lies in the attitudes and expectations of the people. The perception of the American Dream has been corrupted over the years. Instead of the hope that through sacrifice, blood, sweat, and tears, you can have a better life for you and your children, we have those who cry out for their share while contributing little to nothing in return. Some say that everyone is entitled to a house (an attitude which got us in this whole mess to begin with), but what authority has granted them such a right? We are granted the right to life, liberty, and the pursuit of happiness. It is the ability to pursue happiness that drove so many to this country, and that’s the dream which built this nation to superpower status. Without that hope, and the work done by so many to achieve it, the dream fades to the harsh sea of mediocrity.

So, I occasionally get asked why I hate Microsoft software so much, and today was a great example of my rationale.

I was working with a tremendous amount of data within Excel. Due to how the data was generated, I actually needed the transpose of the data in the spreadsheet. I spent nearly an hour trying to find the transpose function which used to be in the “Paste Special” function, but now appears to have been removed. I searched the help, and found nothing helpful. Google’s results pointed to the “Paste Special” function which I know no longer contains a transpose.

End result: I wrote a small program which conducts the transpose within it. It reads the input file, performs the transpose, and write the result.

  • Time wasted trying to find a function Excel used to have: 1 hour
  • Time it took to write the program to do the job: 5-10 minutes
  • Time the program took to execute: 1-2 seconds

Due to a site license deal with my University, I only paid $20 for office, but I don’t think it’s even worth that. I lost an hour of my time due to the fact that one of the few functions I actually use was removed. After all this, Microsoft likely wonder why I turned down a job offer to work for them.

Digital TV Delay

As I am sure many are aware, the digital TV changeover has been delayed. Several broadcasters elected to change to their digital transmissions on Feb 17th anyway, while others delayed. So what are the results of this delay?

While I was at my parents’ in the country, I did a quick scan of the analog and digital transmissions. My parents are about an hour or hour and a half drive away from two large cities, and before Feb 17th, they could only receive one station in digital (because it was more local). I discovered that the remaining stations fell into one of three categories:

  • Transmitting their content only in digital, but their analog transmitter was busy transmitting instructions for installing a converter box. Several were doing this. Their digital transmission did not come in.
  • Continuing their concurrent digital and analog transmissions as they did before Feb 17th. Their digital content did not come in.
  • Eliminated their analog transmission altogether, and transmitted only in digital. Some of these did come in.

What did this delay of the digital TV transition accomplish? Most of the stations are no longer transmitting their content in analog anymore. So if someone did not have the ability to watch digital TV, this delay saved them very few stations. Chances are, the content they wished to watch is no longer available to them. The end result is this delay accomplished very little for the consumer.

What did this delay hurt? Any station that is transmitting in both digital and analog has to operate two transmitters. Often, in this case, the digital transmission is lower power. If a station transmits only in digital, they can save transmission costs by only running a single transmitter as well as the ability to run their digital transmission at higher power. I’ve already seen a few stations whose digital transmission was not even detected by a tunner that now comes in nearly perfectly after the station shut off their analog transmission.

Thanks Obama, for taking a slightly problematic situation, and making it worse. Now several stations which could be accessible via digital transmissions outside of the city are now completely inaccessible due to the fact that they’ve elected to keep their analog transmission active running useless instructions. You’ve effectively removed stations from the list that consumers could watch as a result of this delay. Furthermore, consumers must now continually have their tunners rescan the airwaves for digital signals since a station may do it’s changeover at any time. This, combined with the fact that several tunners “forget” digital signals they did not detect in the previous scan, makes the situation even more painful and confusing for the consumer. Lastly, now we have to endure more annoying ads concerning the digital tv changeover.

This is just one example of the things this new administration has done to completely tick me off. Many others have angered me to the point where I’ve seriously considered leaving the country. It’s only been one month. How much more will the people endure?

« Newer Posts - Older Posts »