Blog

Comfort In Christ

1:3Blessed be the God and Father of our Lord Jesus Christ, the Father of mercies and God of all comfort, 4who comforts us in all our affliction so that we will be able to comfort those who are in any affliction with the comfort with which we ourselves are comforted by God. 5For just as the sufferings of Christ are ours in abundance, so also our comfort is abundant through Christ. 6But if we are afflicted, it is for your comfort and salvation; or if we are comforted, it is for your comfort, which is effective in the patient enduring of the same sufferings which we also suffer; –2 Cor. 1:3-6

How is God described? (1:3)

  • Father of our Lord Jesus
  • Father of mercies
  • God of all comfort
  • Comforts us in our tribulation

(internal causation) Why does God comfort us in our tribulations? So that we may be able to comfort others also in the same way.

1:5 is adding support to this thought (notice the “for”/”because”): both the sufferings and our consolation are through Christ.

1:6 Internal cause and effect:

If we are afflicted             it is for your consolation and salvation
If we are comforted         it is for your consolation and salvation

Both comfort and affliction are for consolation and salvation (serving God’s purposes). Therefore we should rejoice regardless of whether we are afflicted or comforted.

Shepherd’s Voice

One of my friends posted this cartoon about John 10:27 on their facebook page yesterday. The message in it seems quite applicable in our “always on” society. If we don’t take time to listen to God, it can be awfully hard to hear him over all the “noise” of day to day distractions.

Challenges We Are Presented in Hebrews

Let Us…
4:1 Fear God
Lest we come short and miss the rest of salvation
4:11 Be Diligent to Enter God’s Rest
Lest anyone fall according to disobedience.
4:14 Hold Fast to Our Confession
because our High priest can sympathize with us in our weakness
4:16 Approach the throne of grace with confidence
So we can receive mercy and grace and help when we need it
6:1 Press on to Maturity
Leaving the elementary teachings of Christ
10:22 Draw Near to God
w/ a sincere, cleansed heart in faith
10:23 Hold fast to our Hope
because he who promised is faithful
10:24 Consider one Another
in order to stir up love and good works
10:25 Keep Meeting & Encouraging Each Other
12:1 Lay Aside Sin and Run With Endurance
since we have such a great cloud of witnesses
12:2 Fix our Eyes on Jesus
12:28 Be Thankful and Worship God
Since we are receiving an unshakable kingdom
13:13 Go to Him outside the camp
bearing his reproach
13:15 Offer up a sacrifice of praise
with our lips by giving thanks to His name

Joseph vs Jesus

I came across this interesting comparison of parallels between Joseph and Jesus. Some great food for thought.

Joseph and Jesus Compared

  • Joseph was a shepherd
  • Jesus was our Shepherd
  • Joseph was a beloved son
  • Jesus was a beloved Son
  • Joseph was stripped of his tunic
  • Jesus was stripped of His tunic
  • Joseph was sold for twenty pieces of silver by Judah
  • Jesus was betrayed for thirty pieces of silver by Judas
  • Joseph was abandoned by his brothers
  • Jesus was abandoned by His disciples
  • Joseph was falsely accused of crime
  • Jesus was falsely accused of crime
  • Joseph was imprisoned with two criminals, one of whom would be released
  • Jesus was crucified with two criminals, one of whom would be saved
  • Joseph was became ruler of all the land
  • Jesus was became King of heaven
  • Joseph provided food to hungry people
  • Jesus provided food to hungry people
  • Joseph was reunited with his brothers, who bowed down to him
  • Jesus was reunited with His disciples, who worshiped Him
  • Joseph was reunited with his father
  • Jesus was reunited with the Father in Him

Diving into the Bohemouth

One of the things I’ve been finding most challenging as I develop PopTrayU is how to test and debug issues with emails. There’s no easy way to select an arbitrary email and paste in it’s raw headers to test the email.

Or just in general, situations like this: a user reports some bizarre error message that doesn’t make sense and is poorly worded about how dollar sign underscore isn’t an integer…they got this email from ebay.de that caused the error message. A little searching the code and google reveals the error message is probably caused by trying to convert a string to a number. Well, ok, so have a good suspicion of a couple places that might do this, such as where it’s converting dates around…but I need an email with the bad headers to cause this behavior… no easy way in. This bug has been around for some time (since before I started messing with the code), and it seems, in my opinion, that if it’s going to give an error message it should at least make sense, eg: “this email message is corrupt” and it should try to display the bad data as best it can excepting the corrupted header if it can’t be salvaged.

On the one hand, I could modify that code to try to fix the bug, but without creating a repeatable test-case, I have no way of verifying the fix actually fixes anything and isn’t just an incorrect stab in the dark.

As I think about how could I make the code more testable, I keep coming back to the need to break the code up into modular pieces, rather than a 7000+ line uMain.pas file. If I could break apart the pieces where it’s doing the message processing from the UI and input data source, I could make a second unit test project that fakes the input data and does something different with the output rather than display it on the UI.

So, now that I fixed the internationalization code so all my new labels are translatable (unrelated, but needed to be done), I think some refactoring will be my next sub-project…see if I can break down the mammoth main file into more bite-size chewable testable sections.

Tables

I was looking online to refresh my memory how to make a table with only horizontal lines and not vertical lines between columns. I was kind of surprised the top results made it sound really complex and like it required all kinds of hacks to make it work in a cross-browser way. Really? What about just setting the table’s border property to 0 and then adding this css?

table { border: 1px solid #AAAAAA; border-collapse:collapse; }
td, tr { border-bottom: 1px solid #AAAAAA; }

Keep it simple.

Where to Store PopTrayU ini/user files?

One area where PopTray/PopTrayU is currently less than perfect when it comes to Vista/Win7 functionality is that it stores the poptray.ini file (and other files such as rules and whitelist) in the program files folder with the application. In Vista and above, writing to program files when you’re running normal user applications is a big no no. Those kinds of files are supposed to go in a per-user folder under the users/appdata folder to support multi-user environments, and protect users from malicious applications overwriting things they shouldn’t. It doesn’t make my job as a developer easier, but from a security perspective, it definitely helps cut down on certain opportunities for viruses and trojans to be destructive.

But that leaves me with a dilemma. The old design where everything was in the same folder, and the app doesn’t use the registry makes copying the app to a memory stick to use on other machines (say, internet cafe) with locked down machines pretty easy and doesn’t require an installer. Also makes side-by-side use with PopTray easy, since you can just plop poptrayu.exe in the PopTray folder and go.

But, with Vista/Win7, that model where everything goes in the app folder makes a lot of headaches for users who accidentally ended up with a virtual program files folder and can’t figure out why their changes aren’t “sticking” to poptray.ini or the plugins they are trying to install are suddenly “missing” and they have to approve all these UAC prompts to even install a plugin. Not the best of user experiences.

In order to support Vista/Win7 properly, the default storage location for those files needs to be appdata (aka a user-specific folder). I’ve been debating whether it would be best to keep things simple–now poptray.ini HAS to go in user/appdata/roaming/poptrayu/ unless they specify otherwise by using the command line options to specify the “ini folder”, or whether to come up with some more elaborate scheme such as falling back to the app directory if the user/appdata/roaming/poptrayu/ folder doesn’t exist.

Then, if I change the default storage location, there’s another ball of worms, as far as updating the installer to move/copy the ini file to the new storage location, whether it should import the ini file from poptray and/or poptrayu’s app folder if it’s there, etc.

So, please discuss in the comments, what you think the “right” behavior of the app should be. Do you actually use the use-case where having fall-back folders would be handy, or do you just run the installer and expect it’s going to magically put everything in the right place and you don’t care where it is so long as it works?

PopTrayU Beta version 4.0.1

About a week ago, I uploaded the first completed beta version of PopTrayU up onto Sourceforge. I sent a link to Renier to test/comment, and he sent me back some comments about some bugs–mostly minor stuff to fix, like an incorrect link to the help file. But a couple are bigger/trickier issues.

In particular, one is the issues with storing user-editable files in Program Files under Vista/Win7… well, you can, but it can cause quirky issues, like “virtual”/duplicate files to be created depending on the security settings, and that can cause it to look like there’s bugs in the app when there isn’t. On the one hand, having everything in the app’s directory is nice because you can run it off a memory stick with no installing required, on the other…well, trying to cooperate better with the OS can be a boon and not confuse users… 😉

I’m still contemplating the best way to fix that. How should the app decide where the default ini file storage goes? Should it always be in the appdata/user folder? Should it look in the user folder and if that folder doesn’t exist, fall back to the app folder? Use a registry key to store where the config files are? Make the ini file only have one line that points to the location of the “real” config file.

This problem doesn’t stop at just an ini file though. (and as an aside I’m not going to get into the holy war about “outdated” ini files vs “non-portable” registry entries at the moment), For PopTrayU, files the user might be more interested in editing than an INI file (no need to edit that one manually) would be to install plugins, sounds, or the skin files. So ideally, that should be in a user writable folder without needing to use UAC dialogs or administrator permissions, so not in program files. Maybe I need to explore how other open source software that have similar support files (Miranda IM comes to mind) have dealt with changes to OS restrictions on newer versions of Windows.

The second bigger one is a bug more than a design issue. Use the SSL plugin to connect to Gmail, and bam, get an access violation memory error. I was actually able to reproduce this the first time I set up my gmail account and accessed it. But then I turned break on exceptions back on and restarted the app, and it wouldn’t reproduce anymore, and additional testing of using my gmail account since has not reproduced the issue. So this one is going to be tricky to fix because I’m not sure what causes it. I guess I’ll have to keep my eyes out for additional hints on what factors are necessary to reproduce the bug.

Today I got an email from a sourceforge user thanking me for continuing the development of PopTray and letting me know about an issue the user was having with custom sound notifications, an area I haven’t thoroughly tested (nor made changes to). You mean people are actually using and finding my app even though I haven’t done a lick of promotion (aside from creating it’s sourceforge page) yet? Awesome. I kind of purposely haven’t been promoting the site yet, as I’d rather have bugs trickle in than flood in, so I have time to look at them and fix them rather than just queuing piles of duplicate bugs. That’s why you do beta versions, right? You want enough exposure to find the bugs, but not so much that you’re overwhelmed with duplicated feedback.

Sourceforge Project Set Up

Yesterday I logged onto Sourceforge account and created a project for PopTrayU, so I’d have somewhere to release my modified PopTray. Yes, I could probably do it all from scratch on my own site, but why bother when they have all the tools right there, it’s a respected site for looking for free software, and it’s also where PopTray’s verison history is hosted as well.

For some reason I had presumed that Sourceforge only provided hosting for files and I’d have to zip up complete versions of source code to save on Sourceforge (probably because that’s what PopTray did), but lo and behold, it has options to set up SVN or Mercurial. I wish I’d known about this sooner!

I’d previously looked into setting up SVN on my website for this purpose, but although creating the repository worked flawlessly without installing any additional tools, figuring out the username/password issues and proper URL repository path on the shared hosting environment was not successful. So I had been doing daily zip file backups every time I work on the project up until now with the hope that I would eventually get real version control set up where you can browse all the incremental changes to each file to track where a change was introduced, etc.

Now I am chugging away at setting up the repository structure, and going back to the original source code, checking that in, and checking in incremental bits of the changes in managable chunks. It may or may not compile on any of the intermediate versions because I’m mass importing changes via diff’s, but it’s a small price to pay, I’ll probably add a tag when I get to the point where I have something checked in that builds and compiles. Mostly I’m checking in incrementally so I can better document what changes I’ve made and isolate related changes in case any of them later need reverting or debugging…slightly more useful than here’s every change that’s in version 4.0

It just feels really good to get everything checked in, so I have a good, easy, up to date, not on my computer backup of everything, so there’s less risk of having to start over if my hard drive explodes.

Creating an Installer

Another thing I’ve been working on lately is a couple of finishing touches to my PopTray fork, so I can distribute it (icons, installer, graphics for the installer, etc).

In particular, my top priority was creating an installer. I thought I might have to start from scratch there, but it turns out Renier was using NSIS for the installer, and the configuration file used to create the installer is included, so while I tend to prefer applications that are a bit more visual than NSIS and have menu options and check-boxes to configure how your installer will work and function, this one was almost all the way there. It was easier to just fix the problems with the existing installer script (like creating images and folders needed by the installer) than to start over from scratch with a different installer.

I see the advantages in certain environments that the install script system used by NSIS is very customizable for specific install procedure needs and would be easy to track changes to the install script in version control systems since everything is stored in one text file until you compile it into a setup.exe, however, it is also a bit fragile by the same nature.

It would be quite easy to overlook or make a typo in the name of a file that needs to be deleted when uninstalling and have it not uninstall completely because of that. That, and I’d kind of rather not have to pull out a manual every time I want to know what a particular line of the script does, or to figure out whether the line is actually necessary. And then if you comment out an image here from the script, then the macro it creates needs to be commented out there as well or it just breaks and won’t compile. It makes a nice small installer without a lot of overhead, but less flexibility would also mean less opportunity to introduce a mistake into the installer script. I don’t want to worry about registry keys needed to uninstall the app being in my script, I want the compiler to take care of that part, I want to be spending my time specifying that the following files go in program files and the following files go in application data 😉