Escaping single quotes in SQLite

 

I’m working on storing all tweets viewed in DestroyTwitter into a local SQLite database to improve performance with filtering and paging. I’ve already been using databases in order for Groups to work, but to avoid characters that might be trouble for the SQLite queries, I would simply run the escape() method to URL-encode the string. Lately, I’ve been on this testing-high, making sure every bit of code I write is the most efficient to my knowledge. After testing escape() vs String.replace(), I realized that the latter is ten times faster. Of course, it makes perfect sense.

My lazy self months ago used escape() without thinking, but now that I know the incredible speed difference, I’ve created an addSlashes() method to use a regular expression to prefix each single quote with a slash (\). This resulted in an error. After a bit of research aka Googling, I came across a mail archive that said that SQLite escapes single quotes a bit differently. Instead of a slash, you must escape it with another single quote. In all honesty, this makes no sense to me, but it works. Here are examples of what works and what doesn’t:

// Wrong – unescaped apostrophe
INSERT INTO tablename (id, name, text) VALUES (1, ‘Jonnie’, ‘That’s what she said’);

// Wrong – incorrectly escaped apostrophe
INSERT INTO tablename (id, name, text) VALUES (1, ‘Jonnie’, ‘That\’s what she said’);

// Correct – unescaped apostrophe
INSERT INTO tablename (id, name, text) VALUES (1, ‘Jonnie’, ‘That”s what she said’);

Please note that the correct query above uses two separate single quotes, not one double quote.

Do you use regular expressions with Include/Exclude keywords in DestroyTwitter?

 
Sorry, there are no polls available at the moment.

If you answer yes, please comment what regular expression you use.

DestroyTwitter in-app photo viewing within the main window or in its own?

 

I’ve decided to rethink things a bit in DestroyTwitter, so I’ll be conducting a survey over the next few weeks. Today’s question is whether in-app photo viewing is working within the main window or should it be its own window? There are benefits to both, but what do you think?

Sorry, there are no polls available at the moment.

Which window chrome setting do you use in DestroyTwitter and why?

 
Sorry, there are no polls available at the moment.

If there any other answers not listed here, feel free to fill up the comments. Also, if you’d like to extend your answer, further commenting is encouraged.

Icon memory usage in DestroyTwitter

 

Icon memory usage

In the next release of DestroyTwitter, I’m introducing a new icon preference. It lets the user choose whether they want small icons, big icons, or none at all. The choice is not entirely a visual one, but also one of resource usage.

The above profiler tests show the memory usage between the three options. As you can see, there’s a startling difference between DestroyTwitter when it has icons compared to when it doesn’t. That was expected to some degree, but what’s also interesting is the how slight the difference is between small and big icon memory usage. Since the big icons have 33% more bitmap data than the small ones, I assumed the margin would be greater than 641 kb.

Throughout development of DestroyTwitter, an option for bigger icons has always been high on the list of most requested features. I always pushed it to the side, claiming it would use a considerable amount of memory compared to the current size. After performing these tests, it’s safe to say that the difference is minimal. If you prefer a larger icon, you’re not going take a hit. With the option for no icons, however, are you tempted to go for text only?

Sync DestroyTwitter settings with Dropbox

 

Dropbox in DestroyTwitter

In the latest release of DestroyTwitter, you have the ability to choose where your settings are saved. Because of this, you can use Dropbox to keep your settings synced across multiple computers. Dropbox is a free, cross-platform application and service that gives you 2gb of space to sync over multiple computers, devices, and on the web. If you don’t already have Dropbox, download it here.

Dropbox in DestroyTwitter

Once you have Dropbox installed, go into DestroyTwitter and click the link next to “Settings directory” in the Preferences canvas. This prompts the window browser where you can select your Dropbox folder.

Dropbox in DestroyTwitter

In the window browser, you can make a new folder for your settings or simply select the root Dropbox folder. Whichever folder you select, a folder titled, “DestroyTwitter,” will be created and the settings files are written within that.

If you want to retain your current settings, you can do so by moving the default settings folder located at /[user]/Documents/DestroyToday/DestroyTwitter and placing it in your new location. Upon startup of DestroyTwitter, you will recognize the same settings you had before, but now they are synced through your Dropbox account.

DestroyTwitter 1.7.2 Beta release

 

Another day, another DestroyTwitter update. This one fixes a few more bugs, so hopefully they’re all flattened. Let me know if there are any difficulties with anything—you know I’m quick to draw.

Read Messages marked as unread in DestroyTwitter

 

There’s a bug in DestroyTwitter 1.7.1 Beta where some direct messages are marked as unread when they shouldn’t be. This is caused by the fix to Groups and Exclude where I lowercased all usernames. Unfortunately, I forgot to lowercase direct message usernames. If you’re getting this bug, it’s because your username has a capital letter in it. It’s already fixed and will be part of the next release.

DestroyTwitter 1.7.1 Beta release

 

Just a day after releasing 1.7.0, I present the DestroyTwitter 1.7.1 Beta update. It fixes a handful of bugs that occurred in the previous version. I’m happy to say they were fixed quickly and easily, hence the fast turnaround. I also added a couple features like the Remember login credentials preference. Restart for the update and enjoy!

Adobe + Destroy Today

 

Adobe employee

Last month, I spent a good two weeks flying to Chicago, San Francisco and New York City, meeting with Leo Burnett, Adobe, and Google. Leo Burnett showed interest for their Energy Pool, Adobe for their Experience Design (XD) team, and Google for their Creative Lab. Throughout each meeting, I soaked in as much as I could about each group and ultimately decided to join Adobe.

Working with Adobe, I will develop Adobe AIR apps full-time. I will work out of Baltimore for this next year, flying out to SF from time to time, and then take the trek out to the west coast. I am incredibly excited about working with Adobe and am ecstatic that I’ll be able to continue working on my applications.

But there’s more. Adobe is in the process of licensing DestroyTwitter. This means I’ll be working on the app full-time with the support and resources of the company. Not only that, I’ll be working on other exciting projects at the same time. Since DestroyTwitter is the product of free time between school and work, I can only imagine what it will become with considerably more focus. Stay tuned.