Android Security

Ben FranklinI have recently had the pleasure of diving head first into some Android development. Putting asing my feelings about Java, and unnecessary nomenclature obfuscation of well-known, long pre-existing paradigms (e.g. Intent vs Message, Activity vs Window/Dialog), I have been quite impressed..  

However, the security model gets annoying and seemingly really really limits the scope of applications and services that could be provided by 3rd party developers. There are newish paradigms like Device Administration Application, but the support and the feature set still leaves a lot to be desired.

Overall, my sense is that Benjamin Franklin would not approve of the Android security model and I kind of agree.

"They who can give up essential liberty to obtain a little temporary safety, deserve neither liberty nor safety."

Cheers!

 

ccQuickMint Update - Fixed "format appears to have changed" issue

A little while ago Mint.com changed their export file format, which broke ccQuickMint - an application that converts Mint transactions to Quickbooks format, so they can be imported. 

I've updated the app to prevent the error below.

Error!

New version is available here. More information on how to use ccQuickMint is in this post.

Let me know how it works out or if there are other issues.

Cheers!

ccDirectoryManipulator - Arbitrary Action Given an Arbitrary Condition for Every Subfolder

I was recently re-organizing my music collection and.. Well, I suppose "re-organizing" implies a level of initial organization that my collection has never enjoyed. So..

I was recently organizing my music collection and noticed that it involved a number of repetitive tasks pertaining to folder management. Specifically, I wanted to 

  • get rid of folders that only had one file in them
  • get rid of all empty folders
  • Do some mp3 tag reading and make some decisions based on that

The goal is not really the point, but the general task I wanted to completed was enumerate every folder in some base folder, test a condition (e.g. Is directory Empty), and based on the result of the condition execute some action (e.g. delete the directory). 

Typically I'd write a script for this (vbscript or maybe batch) but I was recently doing some directory enumeration in C#, so I figured I'd reuse that code. 

Spam Filtering Issues

Sadly, it was just brought to my attention that the site has been filtering out some legitimate comments as Spam. Very sorry about that, I have disabled spam filtering and will keep it just captcha for now.

In light of the filtered posts, I'll be posting an update to ccQuickMint very soon to accomodate the new file format.. Hopefully, just in time to do the year-end books.

Cheers!

Code Snippets - Capture WebCam Image in C#

Recently I was messing around with some webcam image acquisition and thought I'd share some code that I wrote for this purpose. The code below implements a class that can capture a single image from a webcam and return it as an array of bytes or simply store it in a file - no dialogs, no frills. 

First, there are several ways to go about webcam image acquisition with C# in Windows. There is Windows Image Acquisition library (WIA), Direct X interfaces, and third-party libraries like EasyWebCam Library 

Finally, there is the option of using interop to call into avicap32.dll. This is the method I went with, because it is lightweight and works with more cameras than WIA (in my trials anyway). 

The avicap32 API is pretty goofy, however, and works as follows:

 

Problem: Dialog Gets Resized Automatically to a Larger Size (C#)

I recently discovered a little bug in Kwapture, a little screen cap app I wrote. The issue was that when the user selected a small area, it would automatically get resized to a larger size.

Yes. Another WTF file entry. Well.. sort of..

The way Kwapture works, is that after you select an area to capture, it creates another dialog over that area that uses the underlying image as a background and allows the user to draw/write on top of that. The dialog is dynamically sized using the size of the rectangle selected by user.

The dialog that is created is essentially blank:
AutoScaleMode = None
ControlBox = Flase
ShowIcon = False
ShowInTaskBar = False

However, I realized that when the user selection was below a certain size, it would always get resized to the same larger size... Approximately like this - the smallest size you can shrink Notepad into:

ccProjectTracker - Free Tool To Track Your Time

I originally wrote this light-weight application to get more precise measurements of how my time gets allocated on  software projects.  However, it evolved as a general consulting tool. 

ccProjectTracker  allows you to quickly start timing a task when you are in front of your computer (e.g. timing phone calls, email responses, etc). If you are in consulting that involves computer work, this is also handy to keep track how long each part of your project takes. Once the project is complete,  ccProjectTracker can export project tasks and their information (start time and end time,  duration) to Excel for billing.

ccProjectTracker Features

What do you call 'char stand;'??

A one-byte stand.

Cheers!

How to automatically download a file from an FTP server in Windows

There comes a time in every person's life when they have to automate a download from an FTP server. Man, I hope that is not true.. But that time came for me recently, so I thought I'd share the script snippet to accomplish this.

Basically, I needed to set up a scheduled task that would log into an FTP server once a day and download a file. That file would subsequently be consumed by another application, but that's not the point.

Windows comes equipped with a command-line FTP client which has option to receive a text file with instructions. Thus, the batch script for the scheduled task does the following:

  • Create a text file with commands for the FTP sessions
  • Calls FTP with the command file as a parameter (performs commands)
  • Deletes the file with the commands

Without further ado:

Code Snippets

A few code snippets below are a "quick'n'dirty". Please use with caution at your own risk.

Updating UI from Another Thread

Since not so long ago, your C# code will throw an exception if you attempt to update WinForm UI from a worker thread. The exception can take a couple of different forms, but typically looks something like:

Cross-thread operation not valid: Control '' accessed from a thread other than the thread it was created on

So in a situation where you have, say, a button that starts a thread that performs a computation AND you need to update a UI element with each iteration of the computation, you will now have to jump through some hoops.

The correct way to do this is to write a method that will check whether it is called from a 'safe' context by checking 'InvokeRequired' property of the control you are looking to update, and do the right thing.. Microsoft suggests a pattern like this:

Ads



User login