Restart Android device restore after factory reset

StuartProgramming Blog

If you find yourself in the situation where the initialization application crashes or something else goes wrong when starting a phone after a factory reset, you can be stuck without your apps. There is a way to restart the app restore process from a terminal or adb terminal. shell@username:/ $ bmgr list sets 1234567890abcdef : droid48 34567890abcdef12 : galaxy49 … … Read More

StuartRestart Android device restore after factory reset

Adding jquery listener for iframe content

StuartProgramming Blog

I have a solution that generates or downloads content, HTML formats it and pushes it into a dynamically generated iframe. Since the content is mostly forms, I need to know when the generated content is changed by a user. In this application, the following works fine for the first generated form: var iframe = element.find('iframe'); $(iframe.get(0).contentDocument).on('focusout', function (eventObject) { $(this).find("input,select,textarea").each(function … Read More

StuartAdding jquery listener for iframe content

PhoneGap build missing fonts

StuartProgramming Blog

I am making an application using Ionic Framework and PhoneGap build. Unfortunately, even though my fonts work properly during debugging in the browser, the deployed file is missing fonts and displays a fallback font instead. This took a long time to figure out because of the lack of documentation. The problem was that there was a resources folder “res” created … Read More

StuartPhoneGap build missing fonts

Touch events for canvas drawing PhoneGap

StuartProgramming Blog

Touch events and mouse clicks are handled very differently between browsers and devices. I discovered this on a PhoneGap app when I wanted the user to be able to drag their finger and draw on the screen. X,Y coordinate seeking code I finally landed on below. Note that some devices, including my Nexus 10 with Paranoid return a touches collection … Read More

StuartTouch events for canvas drawing PhoneGap

Crossbrowser HTML5 canvas drawing for PhoneGap

StuartProgramming Blog

While making a drawable HTML5 canvas overlay for my PhoneGap application, the testing version works just fine in my desktop chrome, but did not work when deployed.  Of course, this is the event position nightmare rearing its ugly head yet again.  Here is is, my cross browser PhoneGap drawing canvas solution for web and mobile. Find the existing annotation canvas … Read More

StuartCrossbrowser HTML5 canvas drawing for PhoneGap

NS_ERROR_FAILURE with jQuery.ajax()

StuartProgramming Blog

This had me stumped for too long.  When using an .asmx data lookup service that we wrote in house, and calling it from jquery.ajax, Firefox 28 was getting NS_ERROR_FAILURE and there was no data in the result even though Fiddler2 was showing that the request had completed successfully.  Apparently firefox is rejecting the results because of security in the headers. … Read More

StuartNS_ERROR_FAILURE with jQuery.ajax()


StuartProgramming Blog

I had a strange requirement to make a .NET client available for VBScripting through COM. This isn't generally a problem, except the functionality of the .NET application was to connect with a WCF Service Reference. The generated Reference.cs file that contains the WCF Service Reference code is all Public; therefore, making the entire project COM Visible has some problems. Specifically, … Read More

Stuart.NET DLL for VBS

Windows Service Threading Continued

StuartProgramming Blog

So appropriate threading in a Windows service continued to give me issues after the last discovery of the multi-threaded timer. This time, I discovered a few additional relevant items about starting and stopping a windows service. The first problem I identified in my service is that the OnStart function MUST EXIT or the service will stay in “Starting” status and … Read More

StuartWindows Service Threading Continued

Easily integrate check-in numbers to .NET assemblies

StuartProgramming Blog

Our team finds that it is very useful to have the Subversion repository numbers included in our build assembly versions.  To accomplish this (the easy way) you can use the subwcrev tool included in TortoiseSVN and: Move your AssemblyInfo.cs file to in all of your projects Setup your assembly number as you like in your .in file with the … Read More

StuartEasily integrate check-in numbers to .NET assemblies

Dangerous .NET Timer Setting

StuartProgramming Blog

I had an idea to set my initial timer interval to 1ms so that when this service was initialized, the timer would fire immediately. It took me a while to find out that 1ms is a short enough time to frequently have multiple threads enter the cycleTimer_Elapsed section. Make sure your initial interval is a few seconds or you will … Read More

StuartDangerous .NET Timer Setting

Windows 7 Desktop Background Locked

StuartProgramming Blog

My Windows 7 desktop background normally runs a slideshow, but one day during a computer crash the desktop background was in the middle of changing and locked with half a picture. This somehow froze out the desktop background manipulation completely. I tried changing themes, rebooting, removing the images in question. The problem is a locked system file where 7 caches … Read More

StuartWindows 7 Desktop Background Locked

Special row styling in JQGrid

StuartProgramming Blog

I had a customer who needed to highlight a row in their JQGrid when certain parameters are met. It turns out for the static table data they were using this is very simple. Just add a new handler to the JQGrid constructor that specified afterInsertRow behavior. afterInsertRow: function(rowID, rowData, rowElement) { if (rowData.onbasehandlerelated!=""){ $("#"+ rowData,jQuery('#receiptdatatable')).removeClass('ui-widget-content'); $("#"+ rowData,jQuery('#receiptdatatable')).addClass('ui-state-error'); } }, Here … Read More

StuartSpecial row styling in JQGrid

Rollovers for Dynamically Created Buttons with JQuery

StuartProgramming Blog

The button rollovers using .hover with JQuery look great, but what about when the buttons will be created dynamically. In this instance, the buttons are in a column in a table. Additional table rows are created programmatically while using the form. How can you add a .hover event to your newly created buttons? I've found a really simple answer to … Read More

StuartRollovers for Dynamically Created Buttons with JQuery

Custom configuration section for .DLL

StuartProgramming Blog

The configurationManager class provided in Visual Studio 2008 has made working with complicated custom configuration file layouts. Recently I needed to create a configuration file for a particular .DLL that could be included like a plug-in to another application whose code I could not control. A few special considerations when using .config files in this way. An application named application1.exe … Read More

StuartCustom configuration section for .DLL

Return a binary file to a VB Script caller

StuartProgramming Blog

It is occasionally necessary to do some heavy computing such as image manipulation while inside a VBScript. Since script isn't suited to this purpose, the way I've accomplished this in the past is to build a c# COM complaint .dll file and reference it from the script. Then the COM file can do the real processing. The downside here is … Read More

StuartReturn a binary file to a VB Script caller

iTextSharp Split on Bookmark

StuartProgramming Blog

If you've ever needed to work with PDF files in .NET the best library without a doubt is iTextSharp. For the problem below, I needed to take a PDF file that was generated by another process and split it up by the bookmarks. Each section was to become a new PDF. The solution below is translated to the iTextSharp library … Read More

StuartiTextSharp Split on Bookmark

JQueryUI Autocomplete Search from Beginning

StuartProgramming Blog

I love the integrated Autocomplete in the JQueryUI but I have gotten requests to change the search behavior. The default behavior is to search for the target value anywhere in the string of the values supplied. This works natively by using something like the following code: var matcher = new RegExp( term.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"), "i" ); return $.grep( array, function(value) { … Read More

StuartJQueryUI Autocomplete Search from Beginning