Monday, October 08, 2012

Mac Mountain Lion: Mail Migration Taking Forever or Never Completes

Symptom:

We upgraded a Mac from Lion to Mountain Lion. After launching the Mail program, it says "Migrating" but it takes quite a while until the progress bar goes to 100% then it hangs.

Workaround (may not be a fix):

I do not have sufficient time to diagnose this completely but the reason for the migration is that it needs to copy all of the files in the Mail storage from one location to another. This is likely for a better security.
  • First, be aware that a lot of people do not manage their email. They simply have thousands and even millions of email messages, attachments and even undumped email trash. So this will take quite a while. I would do this over night to see if it was just taking time. Be sure that you change the computer sleep time to "never."
  • One possibility is that Microsoft Entrouge may be affecting it. I know a good chunk of people do not use Entrouge so in our case, I just dumped the entire Entrouge in the trash.
  •  Next, restart your Mac in the Safe Mode. Note that this can take about 10 - 20 minutes of its own time before it starts. This is because the Mac needs to do a process of file system check before allowing you to use it in the Safe Mode. Do not panic. Just let it do its thing.
  • Be sure to set the computer sleep time to Never. It will still be several hours of processing!
  • Launch the mail, and see if it starts, head for your favorite club, dance all night, come home sleep whatever left of the morning. When you wake up, do not go to the computer, make coffee or tea, take shower, dress and go back to your computer... and voila! I think your computer is showing the usual email list.
  • Note: Please do not post a comment if it does not work. Instead call Apple for support. I do not work for Apple and I myself do not use Mac Mail instead just check my email on the web or I use Nexus 7 Android tablet and iPhone. Perhaps you would want to start using web email just in case this sort of thing happens in the future. If you want to manually clean the email data, they are stored under ~/Library but you would want to search such topic using your favorite search engine provider.

Sunday, September 30, 2012

Firefox 16, Mac OS Mountain Lion, Fixing Missing QuickTime "Plug-In"

Symptom:

You have a recent version of Firefox and you run into a page that requires a QuickTime plug-in.
It asks you to install the plug-in manually but there is no way to do it. You probably looked for it everywhere and even Apple web site says, "it comes with your Mac already."

Root Cause:

It appears that if you have a QuickTime plug in file in  /Library/Internet Plug Ins/QuickTime Plugin.plugin this issue can occur. It also appears that this isn't really needed.

I had this Mac for quite a while with all different versions of Firefox running, so I would not be surprised if the old plug-in was not removed when it had to be after a certain version of Firefox.

Work Around:

If you hesitate to do any of these "internal" activities below, then try using Safari browser. That's I have been getting around before I found this answer.

Possible Fix:
  1. Quit Firefox
  2. Open your Finder and head to /Library/Internet Plug Ins/ and cut QuickTime Plugin.plugin and paste that onto the Desktop or any other directory outside of it. In fact you will need this since Safari will need this. 
  3. Start Firefox again.
  4. Try the page with Quick Time again
Note that if you remove the QT plugin, it apparently breaks Safari's ability to play the QuickTime.





Friday, September 28, 2012

"Dead" iPhone 4 (or 4S) Solution

Symptom:

This is what happened this morning. For no good reason at all, the phone was off completely when I went back to it. I know I made a call earlier in the morning.
  • Normally off-phones can be turned on by pressing the power button for 5-10 seconds. This time, it did not respond.
  • Normally if it is completely out of battery, it will also show some charging sign when it is plugged into the charger. This time, that did not happen.
  • I left it on the charging stand thinking that at some time the battery charging sign would come on. It never did.
Fix:

Try holding the big square "home" button in the bottom middle of the phone and power button pressed together for good 30 seconds or longer, and it worked for me.

Side Note:

This never happened to my iPhone 4 for the entire 3 or so years I owned it. I upgraded it to OS 6 recently, that may have something to do with it, and it might happen again because of this. If so I will post again if this tends to happen a lot now. Also ironically, it just happened at the time I was several weeks (looks like some delay) before my iPhone 5 arrives. If it was completely dead, I am certainly in a big bind, and may be forced to move to an Android phone.

Saturday, September 22, 2012

Using Windows PuTTY with SSH Keys

Well, I am embarrassed to say that it took me a bit of time to figure out how to log into a Unix system using PuTTY and SSH keys.

I could not find (or understand) this information easily in the PuTTY document site. I felt that this information is assumed to be known. So if you landed on this page, then you have the same issue as I had. Note that from Unix to Unix, the instructions are straight forward as to where you would store the keys and such. This is an article about the Windows PuTTY.

Based on my experimentation there are two ways that the SSH Key can be loaded. Once way is to specify the Private Key (I did not say Public Key) portion in the PuTTY configuration. I will explain this in a moment. And the second way is to use Pageant.EXE. The latter approach is the one I actually like better but both will work.

First, if you have never done this sort of things, then you are a bit out of luck as I am not going to explain how to use Puttygen to generate keys and where to find Pageant and the like. I can, however, give you one quick way to get those loaded is to install Tortoise Git on your windows.

Now, assuming that you got keys generated and stored them somewhere kind of safe (I put mine somewhere in my own Documents folder so only I can see it and not others on the network.)

Here are some key things you need to remember to do.
  • Start your PuTTY
  • Create a new profile, but most importantly you should set your user name in the [Host Name] field. For example, admin@192.168.1.10  Otherwise, your user name get prompted for and also the password too. This is more important if you are using Pagent to log-in.
  • If you are NOT using Pageant
    • Before you press that [Open] button, navigate to Connection: SSH: Auth node on the  Category panel.
    • You will find [Authentication Parameters] field. In there you specify the location of your Private Key.
    • Then you should go back to the Session node and save current configurations.
    • In this approach you will have to supply the password each time you connect, which kinds of defeat the purpose of using the keys.
  • If you are using Pagent, then the prime advantage of this is that once you give the password for the private key then from that point on you can log in to any SSH sessions that is associated with your key pair while its running without supplying it again.
    • Add your private key in Pageant. You can access Pagent from the notification tray section.
    • If it is not running, you will have to manually start it from the start menu where Pageant is stored.
    • (Note you may still have to do the Key Load part into the session as described in "If you are NOT using Pagent" but I did not have to. If I have to do that I will update this article.)
    • You do still need to load the key to Pageant each time you log into your Windows session.


Wednesday, September 19, 2012

Nexus 7 Screen Capture Does Not Work. It Actually Does.

Symptom:

I have learned that you can do Volume-Down plus Power simultaneous button press to capture the screen as a part of the Jellybean feature.

I tried this many times and it did not work. Only thing I saw coming up was the volume control.

Resolution:

The buttons work as advertised. I was not doing this right (as with a several other people posted this complaint). I was thinking that by pressing these buttons the screen shot starts right away. And that's where I was wrong.

The real trick is this.
  • Press the power and volume down button simultaneously and hold both buttons pressed for 1-2 seconds (and be patient) until the screen capture completes.
  • Note that if the volume thing comes up on the screen you messed up the timing of simultaneous pressing. Release both fingers and try again.
  • You could also be inadvertently pressing both Volume Up and Down simultaneously as you do this. Try holding the volume button really towards one edge. (Never use your thumb ;-) 
  • Do you have a teenager handy? Ask him or her try it. If it works with them, then, well, the machine is fine.

    Good luck!



Monday, September 17, 2012

java_sp.dll Corruption Issue, Version 7 Update 7

Symptom:

I was updating a Windows 7 Home Premium system with Version 7 update 7, and got java-sp.dll error and could not proceed. It was an account with a local machine admin privilege.

My Fix:

Open the download folder where you downloaded the installer and "Run as Administrator".

Time Wasted:

About 20 minutes.



Friday, July 13, 2012

Hyper-V Desktop OS Internet Access Shared Host IP Address

What I Wanted To Do?

I have client-server type deployments and some of the applications only run on Windows XP as a desktop application. Occasionally, I need to run the app while servicing the server at the same time. It is thus a bit more convenient to launch a desktop OS running under Hyper-V from the same server. I really don't care if I cannot access it remotely outside of the server. Obviously, Microsoft thought that this use case is a rare one on servers, but I guess I understand...

Unfortunately, unlike VMware or Virtual Box, Hyper-V does not (seem to) provide a convenient Shared or Bridged configuration which would share the server's (host's) IP address to get out to the network outside. It does, by default, extends the network to the outside so if there is a DHCP server on the network, and if you are permitted, you can run the guest OS.

How I Solved It?

I have found this post from John Paul Cook very comprehensive and usable. Just in case we all lost an access to the post, here is the basic stuff you need to do.
  • Add Network Policy and Access Services Role
  • This will subsequently allows you to add Routing and Remote Access Services. Add Remote Access Service and Routing. Note that you already may have this installed.
  • From your Hyper-V manager, create a new Interface and give it a private IP address like (10.0.0.1) This will become the "router gateway" address for your guest OS.
  • Assign this interface in your Guest OS
  • In the server manager you will now find Routing and Remote Access. Create a Network Address Translation item.
  • Select the Destination (NAT target) as your host's interface that's on the network.
  • Select the Source as the private interface you've just created.
  • Start the Guest OS, configure the new interface with its own IP address in the private subnet and point the gateway address to the address of the interface you've just created (where I said 10.0.0.1) Also add DNS addresses.
  • Turn off Windows Firewall settings for the interface.
  • And test.

Sunday, July 08, 2012

Visual Studio 2010: The specified module could not be found. (Exception from HRESULT:0x8007007E)

Update: After the Windows 8 Release, this article became one of the top reads! This is mainly because you probably installed Visual Studio 2012 then realized that it broke your 2010. This is something even Microsoft support does not readily know!

Symptom:
  • You have installed Visual Studio 2012 recently while having Visual Studio 2010 SP 1
  • You then open the Servers and connect to an SQL server (either 2008 or 2012) from VS 2010
  • Try to create a table in one of the connected database.
  • You get an error "The specified module could not be found. (Exception from HRESULT:0x8007007E)"
  • Additionally if you want to design the DBML with LINQ to SQL, you cannot drag a table into the Design Surface
Cause

When you installed VS 2012 it has "corrupted" with the following DLL version that does not work right in VS 2010.

C:\Program Files (x86)\Common Files\microsoft shared\Visual Database Tools\dsref80.dll

Fix:

Note that "repair" of Visual Studio will not work. Do not go down that path! You pretty much need a completely clean installation of this, as it is in the shared file. So do not waste your time.

Instead...

Find a system that never had a Visual Studio 2012. Harvest dsfre80.dll  and copy this to the same location on your damaged computer and you are good to go.

At worst case, create a Virtual Machine, for example use the free Virtual Box, install a VS 2010 on it and harvest the file.




Saturday, June 16, 2012

LinqDataSource Control "Exception has been thrown by the target of an invocation."

Symptom


  • You are running Visual Studio 2010 SP1
  • You have an ASP.NET web page
  • You have dragged the LinqDataSource onto the design surface
  • You try to Configure Data Source and get the following error message
 Exception has been thrown by the target of an invocation

Root Cause

  • Appears to be Related to .NET Framework 4.5 present (as a result of installing Visual Studio 2012).

Fixes That Would Not Work

I have tried the following and none worked. So you may not want to go down the same path.
  • Use devenv /Log to find out what's happening.: It will not log anything useful.
  • Start devenv in /Safemode.: No effect
  • Repair Visual Studio 2010
  • Uninstall Visual Studio 2010 (note if you do this you will have to apply SP1 which takes a long time)
  • Remove or Repair Sliverlight SDKs
  • Remove or Repair .NET Framework 4.5

Possible Fix If You Do Not Need VS 2012

The following steps fixed my situation. You do not need to uninstall SQL 2012 Express
  • Uninstall VS 2012
  • Uninstall .NET Framework 4.5
  • Uninstall .NET 4.0 Multi-Traget Pack
  • Using VS 2010 Installer, Perform the Repair of VS 2010

Workaround If You Need VS 2012

  • Try another machine or a VM you have not installed anything "2012" on it, you should be able to continue to work on LinqDataSource. Once the LinqDataSource is configured, check the code in and it should work on your "corrupted" environment, though you won't be able to change anything in the data source. You can still work with the Data Grid to which the data source is connected and do add/remove columns and such. You can manually edit the web page source code to change minor things like some query changes.
  • If you can safely move up to VS 2012, then the LinqDataSource will work perfectly fine there.







Thursday, June 14, 2012

Firefox: WebGL Not Functional: Blocked for your graphics card because of unresolved driver issues

Symptom:


WebGL does not render at all on some graphics cards on the latest/later Firefox browser for Microsoft Windows for example Firefox 12. If you look at the Help->Troubleshooting page (or simply type in about:support in the URL) on Firefox, you see

WebGL Renderer Blocked for your graphics card because of unresolved driver issues.


By now, you probably figured you need the graphics driver installed (which is the first thing you should try), but still to no avail.

But if you use Google Chrome, WebGL probably works fine. The good way to test this is to go to the Chrome Experiments web site. For example, http://www.chromeexperiments.com/detail/webgl-aquarium/?f=webgl

Root Cause:


There is a fairly limited set of conditions in which WebGL is activated with the Google ANGLE WebGL rendering engine which Firefox for Windows uses. Rather than crashing the browser when WebGL functionality is dicey, Firefox has a Driver Blacklist and it is very likely that your graphics card and/or the driver version has been blacklisted.

Some graphics cards are simply not supported yet as they cause crash, which leads to poor user experience and developers do not want that to happen for regular users. Also since anything outside of NVIDIA and ATI will not be supported, unfortunately.

If you are using Remote Desktop, then the WebGL driver will be automatically disabled.

In addition to the model of the graphics card, if your laptop contains NVIDIA Optimus Technology, which allows you to use both GPU and the integrated (e.g., Intel HD 3000) graphics on laptops, then it is also subject to be blacklisted by Firefox, even if the base desktop model of the GPU works OK with Firefox. This was my situation.

Fix:


  • If you do not have NVIDIA or ATI graphics card, all bets are off. If it is a desktop, you could swap the card with at least some mid range "gaming" class graphics cards.
  • You cannot use Remote Desktop or most other ways to delegate the graphics driver such as virtual machines. Walk over to your computer and use its own display.
  • If you have a laptop computer with Intel Graphics integrated then turn off your GPU. I have the Intel HD 3000 graphics on my laptop and actually the built-in GPU works fairly well on Firefox. I get about 40 FPS with the HD 3000 and 60 FPS with the GPU on.
  • If you have read above mentioned black list article on the Firefox Wiki, it explains the way to force-enable WebGL. This, however, will be a very risky proposition and may render your Firefox  unusable. So if you don't want to risk this much and Chrome is working for you I would suggest you stick with Chrome for WebGL. These days, it is always good to get used to more than one browsers. Note that Internet Explorer and Apple Safari do not directly (out of the box) support WebGL.


Tuesday, June 12, 2012

Visual Studio 2010 Startup Very Slow

Symptom:


When I launch the MS visual studio 2010, it is really slow in coming up.

My Root Cause:


There are of course many root causes of this, but in my specific situation, it was the Microsoft Fusion Log left enabled.

I had to diagnose assembly loading errors previously using Fusion Log and I configured and left this on. This will cause a significant slow-down in your computer operations.

My Fix:


First you can check to see if Fusion Log is enabled. You can generally find this out by running the new Resource Monitor that comes with Windows 7 and 2008 family of OS. You will find that there is a lot of disk I/O with respect to the fusion logs.

Second you can check in the Start Menu, under Visual Studio 2010 -> Microsoft Windows SDK Tools -> Fusion Log Viewer

You may find this in the situation where the logging is stuck and you cannot disable it.

If you find that you cannot disable it, you many need to do the following registry tweaks. You may not find all of the keys, but do not worry, just remove the ones that are still there.


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Fusion

Remove the following keys

ForceLog
LogFailures
LogResourceBinds
LogPath 

Conversely, if you want to re-enable fusion logging...

DWORD ForceLog set value to 1
DWORD LogFailures set value to 1
DWORD LogResourceBinds set value to 1
String LogPath set value to folder for logs, for example D:\FusionLog\

Restart your computer just to be extra sure and you should be fine after this.

Monday, June 11, 2012

IE 9 Crashes on MSN

Symptom:

You open IE 9 and go to http://msn.com   IE 9 crashes with the "Internet Explorer Stopped Working" dialog box.

Root Cause:

I do not know. I am suspecting that it is the Flash player.

Fix:


  • Try manually re-installing the latest version of Adobe Flash player. In my case this has corrected the issue.
  • If going to MSN is only your goal, MSN works perfectly fine with Firefox or any other non-Microsoft web browsers.
  • If you have to use the IE for testing and debugging and such, you can go to Internet Options on the control panel and make the home page to Blank.






Saturday, June 09, 2012

VS 2010 Web Debug Fails To Start Due to "Invalid file name for file monitoring"

Symptom:

You try to launch your ASP.NET web application from Microsoft Visual Studio (2010) and you get the following error (you swear it was working an hour ago.) Note that the file name mentioned does not really matter. The symptom is that you cannot launch a web page in debug mode.

Invalid file name for file monitoring: 'C:\Blah\Whatever\App_LocalResources'. Common reasons for failure include:

Cause:

The root cause is completely understood, but it has something to do with catching all un-handled CLR exceptions in the debug menu.

My Fix (May Not Work With You):


  • Go to Debug->Exceptions and un-check all un-handled exception checking.
  • Try to launch the debug session again. This time, it worked for me.
  • Go to Debug menu and then clear all break-points. This time, I can re-enable un-handled CLI exceptions and back to be able to launch and debug the app.
  • If above does not work, clear the .NET temp files for the framework version you are using. For example,

    C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files




Tuesday, June 05, 2012

Windows 7 Desktop Freezes Up But Start Menu OK

Symptom:

For "no obvious strange reasons" (actually for a good reason, see the cause below) the Windows 7 desktop suddenly freezes. For example, you cannot "right mouse click" on any items on the desktop. But Start Menu works just fine.

Cause:

This turns out to be iexplorer.exe process not completely closing down. You can find out if this is actually your case by going to the task manager and manually killing the iexplore.exe (may have *32 next to it if you are running a Windows 7 64-bit version)

Fix:

This may be due to the IE configuration or plug-ins being messed up. You can optionally reset the IE settings using this information.

IE is totally a fine browser but you can use Firefox as your default browser and you can avoid this problem in exchange for possibly other problems.

Note:

Around June or July of 2012, my Google Chrome is starting to exhibit similar behavior. I am investigating but usual "clean everything" seems to be working.



Saturday, June 02, 2012

Visual Studio 2012 Show Stopper Collections

Just installed the VS2012 RC a few days ago. I am tallying any show stoppers.

SQL CLR "Corruption"


Symptom:

I had an MSMQ triggering CLR in SQL Server 2012 Express. It seems that after installation of VS2012 the assembly stopped working.

When the assembly was called from a stored procedure, I got a message somewhat like this:

Server: Msg 6522, Level 16, State 2, Line 1
A .NET Framework error occurred during execution of user defined routine or aggregate 'getsid':

System.IO.FileLoadException: Could not load file or assembly 'System.Messaging, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. Assembly in host store has a different signature than assembly in GAC. (Exception from HRESULT: 0x80131050)

System.IO.FileLoadException:

Fix:

You can correct this condition by ALTER ASSEMBLY. For example, if the Messaging DLL is corrupted in the above manner, I would do;

ALTER ASSEMBLY Messaging 
FROM
'C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Messaging.dll'
WITH PERMISSION_SET = UNSAFE 
GO

Note, be sure to exit Visual Studio 2012 when you do this. You may get yet another issue which results in "Out of Resource" error.


Other Possible Issues:


  • Exception has been thrown by the target of an invocation when dragging in the LinqDataSource control. -> See This Article



Wednesday, May 16, 2012

SQL Express Connection Times Out Even Though It is Up

Symptom:

I can access the local SQL Express server instance without a problem using the SMSS, but from my application the SQL connection times out almost immediately.

Cause:

In my situation, it was a connection string issue. In production I use a mirrored connection. So just out of a laziness, I just change two of the hosts in the connection string to be the same.

Like this,

Data Source=localhost;Failover Partner=localhost;Initial....

Apparently the driver does not like this type of conneciton string and give you an immediate timeout error.

Fix

Just remove the Failover Partner part and try. It always does the trick to me.


Monday, May 14, 2012

WFC Services Runs OK on Visual Studio Web Server But Not on IIS When Deployed


Symptom:

You have created an WCF "web" service. It debugs and runs fine on the Visual Studio's web server, but when deployed the directory to the IIS 7 (even on the same local machine) you get a script error.

The Root Cause

The WCF is not fully enabled on your IIS 7.

The Fix

The complete fix is from this web site at Microsoft. http://msdn.microsoft.com/en-us/library/ms752252(v=vs.90).aspx 


  • Open the IIS manager and Go to the Default Web Site, Double-click Handler mappings in the Features View.
  • In the list of application mappings, verify that the .svc file for the .NET Framework in use (2 or 4) is mapped to the aspnet_isapi.dll. If the file has not been mapped:
  • Click Add Managed Handler.
  • Type *.svc into the Request path:.
  • Type System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 into the Type textbox.
  • Type svc-Integrated into the Name: textbox.
  • Click OK.
  • Click Add Script Map.
  • Type *.svc into the Request path:.
  • Type %SystemRoot%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll into the Executable: text box.
  • Type svc-ISAPI-2.0 into the Name: text box.
  • Under the right "Actions" Panel, select "View Ordered List" then Using the Move Up/Move Down controls, ensure that the managed handler (svc-Integrated) appears before the aspnet_isapi (svc-ISAPI-2.0) handler in the list.
  • Click OK.
  • Give it a shot.


Visual Studio 2010 Reloads Microsoft.VisualStudio.IDE.ToolboxControlsInstaller,ToolboxInstallerPackage'{2C298B35-07DA-45F1-96A3-BE55D91C8D7A} Every Time

Symptom

When opening a forms designer on Visual Studio the following toolbox loads each time and it takes a long time by loading the toolbox with the following information.

Microsoft.VisualStudio.IDE.ToolboxControlsInstaller,ToolboxInstallerPackage'{2C298B35-07DA-45F1-96A3-BE55D91C8D7A}

Root Cause

When you installed a later version of Sliverlight SDK, it has corrupted some data in the older version of the SDK (it is rather complex matter that I fully do not, nor tired to, understand.)

Possible Solution:

There are various options on this, and the best discussion about this is at this URL:  But it appears that this is related to Silverlight SDK corrupting some data in the SDK based on this post.

There are other discussions on this post.

In my specific case, setting

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Packages\{2c298b35-07da-45f1-96a3-be55d91c8d7a}\Toolbox\DefaultItems to 0

made it worse.  I cannot recommend this.

Instead try un-installing and re-installing the Sliverlight SDK in the order of versions to fix the toolbox issue. Namely remove 5.0 SDK and 4.0 SDK then install the 4.0 first then 5.0 if you are still (having to) coding with Sliverlight.

As with anything, approach your fix with a big caution when dealing with config issues like this. Have a good back-out plan like backing up the registry settings etc.

If you don't care so much about Silverlight...

Because of my situation for needing to go beyond Mac and PC audience I have to avoid using Silverlight so I do not need it. If you are on the same camp as I am, just blow away the key altogether.

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\10.0\Packages\{2c298b35-07da-45f1-96a3-be55d91c8d7a}

For Additional Insights,


You may want to read this article from Infragistics people about How Visual Studio 2010 Toolbox Works.



Thursday, May 10, 2012

ATT Momentum 4G Adaptor Blue Screens Windows 7 X64

Symptom:

When you plug in ATT Momentum 4G (Sierra Wireless Momentum), you get a blue screen (with memory violation from a driver) when the driver in being installed.

Root Cause:

I do not know exactly which driver causes this, but...

It appears that the Sierra driver is not compatible with the USB-3 interface (at least on my ASUS u46s). Try plugging this into a USB-2 interface slot and start the installation over again.

Also, in my situation, I had to call the ATT's automated activation phone line to activate the SIM in it.







Thursday, April 26, 2012

Collecting PDF Form Data with ASP.NET C#

I recently had to investigate the technique to capture the form input data collected on Adobe PDF for radiological procedure report results.

This, though very simple, information was scattered around all over the places so I can provide you the gist of what you need to do by means of a simple demo code.
  • First you will need to use the PDF Form Editor, for example Adobe Acrobat Pro. I am sure there are a lot of different ones.
  • Next you either scan a form or create one which output the usual .doc file.
  • Import the document and edit the form using the PDF form editor, drag and dropping the fields.
  • Finally add a submit button with a submit action of http://localhost/xfdf
  • On Visual Studio, create the xfdf web project and you can add the following code in Page_Load of Default.aspx
public partial class xdf : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        var name = "junk.xfdf";
        string filename = Path.Combine(Server.MapPath(""), name);
        using (FileStream fs = new FileStream(filename, FileMode.Create))
        {
            byte[] bytes = new byte[8192];
            int bytesRead;
            while ((bytesRead = Request.InputStream.Read(bytes, 0, bytes.Length)) > 0)
            {
                fs.Write(bytes, 0, bytesRead);
            }
        }
    }
}
  • Compile above code.
  • Submit the PDF form to the URL
Then if you open junk.xfdf on your text editor, you will see something like this. The key part is that you will see the field and value elements in the XML. From this point it is quite easy to parse this stuff using the XDocument class and LINQ.

<?xml version="1.0" encoding="UTF-8"?>
<xfdf xmlns="http://ns.adobe.com/xfdf/" xml:space="preserve"
><fields
><field name="Heart Rate"
><value
>10</value
></field
><field name="Submit"
/></fields
><ids original="BFF11731D28F744F901901CF60BBED7A" modified="B0328D96D4E3F242A93BC5512C7B97E6"
/></xfdf
>

Monday, April 09, 2012

Getting XTIDE Up on Joyent SmartMachine (Solaris 11)

This is my note on getting the XTide (learn more) up on the Joyent SmartMachine on which I am running various personal web projects. My XTide was previously hosted on a shared Linux machine (i.e., no root access) before but the provider upgraded the Linux and then it broke. Since I now have an Intel Solaris 11 virtual machine of "my own," I have decided to transition to this server (as I find time, of course.) Installing and configuring XTide on a shared machine was a real hassle as they did not have X11 installed and they won't install it for me, but now with the virtual machine in which I have the "root" things are becoming much easier, in addition there are a lot of pre-built installs that's available (still require the root access.) {Why Joyent SmartMachine and Solaris? Don't ask. But I am extremely satisfied with it. }

Perhaps you may have the same problem and here is how I got around the issues.

Note that I am only interested in running this as a command line to compute the tide and graphics in the area I surf using a cron job. So if you have an X-Windows issue, this article won't help much.


Getting It Installed

Getting it installed is fairly simple.
  • The page http://www.flaterco.com/xtide/files.html tells that on Solaris you go to Blastware.COM, but almost all of the mirror sites it points to are broken. Instead, if you go to http://www.opencsw.org/packages/xtide/ it is still avilable. The maintenance of this stopped around 2.10 (in 2008) but for my purposes, it is OK. Someday, when I have more time, I may volunteer to contribute to Opencsw to maintain this. Not now...
  • It comes with required libraries, and also the original harmonics and wvs files it was built with in /opt/csw/share/xtide 
  • If you don't know what I am talking about but you have the root access to the machine, just follow the instructions on the OpenCSW web site, install the pkgutil installer first as a root (if you don't have) and then install the xtide with it. You would be all set in a matter of 5-10 minutes. And if you still don't know what I am talking about, then it is best to ask your IT admin buddy to get that done as it can affect other OpenCSW packages other people may be using on your machine. 
Getting it to Run
  • "Out of the box" by typing in {tide -l "princeton"} it did not run. In fact it threw an exception about saying  the following:

    XTide Fatal Error:  BAD_OR_AMBIGUOUS_COMMAND_LINE

    but do not dismay yet...!
  • Here is what I have done to get it going!
The "tide" command on /opt/csw/bin/tide is a shell script which, in turn, will run tide.bin after "tide" sets various environment variables. There appears to be an issue with the WVS_DIR environment variable and if only have the HFILE_PATH it works (in other words comment out WVS_DIR definition in the tide script), and it will output the tide. The graphics output also worked.

To test if anything works, you can first only EXPORT the HFILE_PATH in your shell then run /opt/csw/bin/tide.bin directly like this.

HFILE_PATH="/opt/csw/share/xtide/harmonics.tcd"
export HFILE_PATH
/opt/csw/bin/tide.bin -l "princeton"

The Harmonics Database Location Names Have Changed

In my old script I had -l "half moon bay." This time it did not work as the program could not find the station name. So be sure that you look at the Location List (http://www.flaterco.com/xtide/locations.html)  that matches your Harmonic file you've downloaded.

Hope this helps in your situation.





Saturday, April 07, 2012

ASP.NET GridView and LinqDataSource Stuff...

The DataGrid is one of the components I use quite a bit in my line of work, and they are convenient.

I have also been using LINQ quite a bit. It is a significant time saver as well as making my code more easier to understand. But until today I never bothered to use LinqDataSource just because I did not spend time to learn a bit about it. Instead I always built the DataSets using the designer. The problem with the Datasets for me is that it does not show me exactly what I am querying easily.

Before I get into that, I have to tell you also that if your requirement is very simple, then you can feed the result of the Linq query directly to the GridView (or other data binding controls.) This might be a great way to bind the pull down menu or a list view with small number of selections.

For example,

var customers = from c in context.customers select c;
gridview1.DataSource = c;

And that really all it takes to feed a GridView. For more information on this, learn from this MSDN page.

But this won't allow you to sort or page the grid. For that purpose you need to attach a LinqDataSource. You can easily do that by:

  • Defining the LinqToSQL object in your project, or pull one in from other assembly
  • Dragging and dropping the LinqDataSource component on to of the GridView. The wizard will show you which of the LinqToSQL database context object to use.

Well that's great, but I really do not want to use the connection string that's built into Web.config. In my case, I pull the connection string common to all my applications from my own company's registry set. But at any rate, you would assign a newly created data context to e.ObjectInstance of the event argument.

So here is another trick.
  • Define an event processing method for ContextCreating event.
  • Re-instantiate the LinqDataContext class object with your connection string. Yes, just the Context is all you need here. The rest will be handled with the LinqDataSource you've created with the designer. (Yes, it is the Data Context object, not the Linq Select result.)

       protected void LinqDataSource1_ContextCreating(object sender,
           LinqDataSourceContextEventArgs e)
        {
            string myConnectionString="your connection string";
            e.ObjectInstance = new MyDataConext(myConnectionString);
        }

Here is another bonus thing you can do. If you do this type of connection string swapping, it is best to create a new context factory class of your own and then call that. This factory class can do the connection string swapping for you. This will centralize the connection string swapping.

In my case, the connection information is stored locally in a registry and many of my own applications pull that information from there at run-time. This way, all I need to do is to set the connection strings once and then all other applications I write will not need separate connection configurations. There are of course many other ways of doing it.


Sunday, March 25, 2012

Mac Lion: ssh hangs

Symptom:

On Mac Lion (10.7.3), when you try 'ssh' it times-out. You know you have the proper login and host parameters because it works from other computers (say Linux or Windows putty, or even running putty on the same Mac!)

Cause:

I do not know, but it appears that the Mac Lion SSH handles UTF-8 character sets in the manner that the remote side do not like.

There is nothing wrong with your network or network provider. Something wrong is introduced in Lion.

Fix:

Essentially finding a line in /etc/ssh_config file that says LANG LC_* should just be commented out. If you do not know exactly what I am talking about the following is the steps to accomplish this.

  1. Open Terminal
  2. sudo vim /etc/ssh_config
  3. Supply your password
  4. Type in below, including the first /
  5. /LANG LC_
  6. This will take you to the line where the problem is
  7. Hit the left arrow key several times,  until you are at the start of the line.
  8. Type i to insert
  9. Type # to comment out the line
  10. Press ESC to exit the insert mode
  11. Type wq (means write quit) to save the file and exit vim
  12. Now close the Terminal, Re-launch it and try ssh again
If you do not want to all of this, simply download other SSH clients and use them.


Saturday, January 21, 2012

Fix! Pythonwin (2.x) Windows 2008 Event Log Text Get Empty String

Symptom:

You used to be able to get the Event Viewer text under Windows 2003 using the following call in Pythonwin. After switching to Windows 2008 or Windows 7 the strings are all empty!

events=win32evtlog.ReadEventLog(hEvent,flags,0)

for ev_obj in events :      
   msg=str(win32evtlogutil.SafeFormatMessage(ev_obj, logType))

Now the majority of "msg" comes out blank. Oddly enough any newer programs the msg come out fine.

Fix:

The string messages logged can also be found as tuples in (using above code example) ev_obj.StringInserts as UNICODE strings.

Therefore, for example, to grab the strings as one msg string, you could write a quick loop like this to get you the full string.

                               msg = ''
             for si in ev_obj.StringInserts :
                   msg = msg + si + ' '                               
             print msg

Monday, December 26, 2011

VoIP "Can't Hear Me, Can Hear Them" Issue

Symptom:

You have (deployed) a SIP VoIP telephone set (can also be a software SIP phone) at home. Your phone rings and you can even dial out but the recipient of a call cannot hear you, though you can hear the recipient's voice.

Issue:

(1) This means that the SIP protocol is going though but the RTP protocol is not going through. This happens in a typical home WiFi "router" scenario connected to cable or DSL service.

(2) Has your phone been in your corporate office or a branch office? Sometimes, these phone are set behind an "EDGE BOX" that provides different protocols and have different codes in the firmware. 

Possible Fixes:

If your situation applies to (2) above then you need to call your IP service provider, explain to them that you have moved your phone from your office to home and requires a "Push of new config to your phone."

Below applies to everyone. In most cases the blocked UDP by your wireless router is the key! 99% of the case this is it.
 
Most people use a wireless router at home. However this will cause an issue as most of them prohibit UDP protocols to go through via their built-in firewall. Thus it is time for you to learn to open up firewall settings on your router.

If you cannot make a call at all or if you cannot receive any calls at all: Check UDP 5060-5063 ports.

If the sound is an issue then try opening UDP Port 16384 - 16482, or 10000 - 20000. This depends on the phone implementation.

Note: If you are an Astound customer, try connecting the phone directly to the DMZ port provided by Astound.








Sunday, December 11, 2011

Mac Lion Windows Remote Desktop Freezes - Alternate Solution

Symptom

When you "log out" from a Remote Desktop session using the Windows Remote Desktop client, it either freezes or hangs. If it is in full-screen mode, it would not even allow you to open the Apple Menu to force quit the application.

As of December 2011, there is no updated version of RDP Client from Microsoft. If you beg to differ on this, please let me know since I am no longer using the MS RDP.

Workaround/Alternate Solution


Try using CoRD from SourceForge. It actually provides better user experience than the RDP client from Microsoft. It works on all recent versions of MacOS X including the Tiger version. I especially like the fact that the user/password management is built in to the software. (for me the Keychain with MS DRP goes out of Sync very quickly if you are connecting to multiple hosts frequently, usually ending up typing user and password every time.)

Update (5/10/2012): CoRD is not that super-stable either on my iMac with Lion, but it never totally hangs. CoRD tends to crash hard when losing a connection that was running, for example, when I close the VPN connection while the RDP is still connected, it is guaranteed to crash right now.







Monday, December 05, 2011

LINQ To XML Tips


Use XElement instead of XDocument in LINQ to XML

I misunderstood that it is usually the XElement that is all I needed and not XDocument to work with LINQ to XML.

XElement has just about everything you need and also LINQ works mainly with XElement.

For example, the following code can locate all the "top level" nodes titled page. Within each of the element you can actually find the element titled "regex" no matter how deeply inside that elemenet's tree. This is because I am grabbing all descendant level nodes.


       public void Test(XElement FinderSpec)
        {

            var pages = from f in FinderSpec.Descendants()
                    where f.Name == "page"
                    select f;

            foreach (var i in pages)
            {
                var reg = from tre in i.Descendants()
                          where tre.Name == "regex"
                          select tre;

                foreach (var re in reg)
                {
                    var rs = re.Value;
                }
            }

        }


The XElement class also has handy Load and Save from file as well.

var el = Xelement.Load("test.xml");
el.Save("test2.xml");













Sunday, November 20, 2011

Taking Advantage of the Microsoft XPS "Virtual Printer" Even on Macs and iPADs

Symptom:

I was using an application and the result of which is only output via a Print interface. To make the matter worse, this was on a remote site so I could not print to my printer either. To make it even worse, I don't feel like adding any PDF printing driver to this machine as it belonged to a customer.

Fix:

I have been aware that Microsoft XPS driver is installed on just about any modern Microsoft OS machines, and it is even often annoying that it comes up as a default driver to my mothers-in-law PC and she cannot print to actual paper.

As it turns out, you can consider this XPS as the pre-installed "PDF" driver that works on Windows. And since .NET Framework 3.0 a "free" viewer comes "pre-installed"; all you need to do is to activate it! Like just about anything Microsoft (Apple) does, XPS is designed to kill  other company's product, in this case the PDF.

Whether XPS is superior to PDF or not, I don't care, I am not in printing business, but, this means that we can print at most computers without any physical printer, and take or email the XPS file back home and print at your leisure (or just view them to save the tree) or re-print them in PDF once you get it back on a PDF enabled computer.

To "install" or actually "activate" the XPS viewer, see this MS article. What is XPS Viwer

Other platform users do not need to dismay. You can try uploading the XPS file to your Google Docs account and view it online!

Note that the article is a bit obsolete, in systems with .NET framework 3.5 (probably) or later the XPS viewer enable is not within the .NET Framework feature but are listed in the top level list.


SQL Server 2008: Cannot Detach The Database

Symptom:

You have a dead file for a database that was active. For example, you have lost a disk drive or if you have lost file MDF file. Now you try to detach it from the SQL Server Management Studio, it won't let you do it.

Fix:

Try manually firing the query then

use master
drop database

The key above is that you are going to the master and not any other databases.


Saturday, November 19, 2011

Tortoise Git Tips: How To Use It Behind an HTTP Proxy

Problem:

You want to connect to the Git Server via HTTPS (say GitHub.com), but you are behind a proxy. You know the proxy information.

Fix:

Issue the following Git command from the Git Bash. In this example my proxy is at DaProxy... port 8123

config --global http.proxy http://DaProxy.myhospital.edu:8123




Monday, November 14, 2011

Where is The DLL for System.Windows.Media.Imaging Namespace?

Symptom:

You wanted to use classes from System.Windows.Media.Imaging Namespace, but there is no such class when you try to Add Reference from your Visual Studio.

Fix:

Add PresentationCore, which you should find under the .NET tab of Add Reference dialog box.


Monday, November 07, 2011

Bluetooth and/or WiFi Abruptly and Intermittently Goes Offline on Windows 7 Laptops

Recently I had a symptom in which Bluetooth and WiFi stops working temporarily. This is a problem for me because I often use RDP to connect to my laptop and it drops connections. Interestingly in my case, each time this happens the CPU fans go faster for a bit, so I suspected that this has something to do with the power.

As it turns out, both Bluetooth and WiFi network devices can shut itself down by default due to automatic power management controls.

This behavior can be disabled from the Device Manager (just type these words in at the Start menu) and go to each Bluetooth Radio and WiFi device properties. You will find the Power Management tab where you can configure this.

I just did it so I will update this will or will not work in a longer run.


Saturday, November 05, 2011

Windows SC.EXE Command Gotcha

Symptom:

You wanted to create/install a service using the SC.EXE command on Windows 2008 (XP as well) but it does not seem to work. It come back with the help message suggesting that you have had some errors.

sc create MyService binpath="c:\MyService\MyService.exe" type="own" start="auto"


This WILL result in errors and it won't tell you how you have errored.

Fix:

Fix your brains that it is not Unix that you are dealing with, since we cannot fix someone who designed it at Microsoft.


sc create MyService binpath= "c:\MyService\MyService.exe" type= "own" start= "auto"

Do you see the difference between the two?

There is a blank after each= sign.  Not an example of world-class coding.










Tuesday, November 01, 2011

How To Escape Textile Formatting

Problem

You want to write express on the text things like %TEMP%\My Directory\ on a Textile format (such as on Basecamp Writeboard) but The % character goes away.

Solution

Use the ==

==%Temp%== and the % will now appear in the text.


Sunday, August 28, 2011

MS ReadyBoost Implementation Tips - Do Not Bother

Recently I got a small Lenovo V470 IdeaPad and have been playing with it with Windows 7 Pro 64 bit version. Along with it I found out about the ReadyBoost technology they have added into the OS since Vista.

Initially ReadyBoost does not seem to be doing anything. In fact, initially it even slows you down as it builds the cache, and actually does not make Booting faster by much. What it makes faster is applications to launch faster, especially when more applications are running consuming more RAMs and disks are working hard to service the applications.

I ran into a couple of snags thought I resolved it so here is a quick summary of how you can implement Readyboost on your laptops.
  • As far as I know this works only with the Built-In SD card slot which is wired into the PCI bus and does not go through the USB.
  • Get at least a 16 GB SD card with at least Category 10 capability. I had Category 4 and that failed the qualification step to activate ReadyBoost.
  • Before doing anything, Format the card with NTSF and not FAT32. The reason for this is that for FAT32, the maximum file size will be limited to 4 GB.  For your laptop applications, you would want as much Readyboost cache space as possible. Typically this is 3 times or more of the RAM. Given most PCs are sold with 4 GB RAM. Having a 16 GB SD would be sufficient.
  • Don't use Readyboost on your laptop unless it is connected to the AC power (this makes ReadyBoot almost useless while in battery operation.) As soon as you boot, it starts to cache data and also re-encrypts data. This means this activity occurs during every reboot and every wake-up from hibernation. NOTE: If you run into this situation while in battery operation, you can pull the card out without causing a problem. Re-encryption cannot be turned off on external devices so there is no easy way to turn this off.
  • If you have lots of RAM, you may not notice the difference.
Hope this helps.

Sunday, August 21, 2011

MSMQ, You Get "Invalid queue path name" Exception When Opening a Remote Private Queue

Example Symptom:
  • You have a remote computer named XYZZY
  • Inside it is a private queue named MyQueue
  • You have written the MSMQ code in C# (or .NET)
  • When accessing locally within XYZZY, you can use .\private$\MyQueue it works.
  • When trying to get to the queue using "XYZZY\private$\MyQueue from another computer even on the same subnet and no firewall enabled, you now get an MSMQ exception stating "Invalid Queue Path Name"
Try This:

Instead of

XYZZY\private$\MyQueue

Try this way.

FormatName:DIRECT=OS:XYZZY\private$\MyQueue

Note, spell FormatName exactly how it is. It is the only part that is case sensitive!

--
This was tested on Windows Server 2008 R2 with .NET 3.5

Tuesday, August 02, 2011

Tortoise Git Annoyance Fixes and Tips Collection

I am collecting some quick fixes that I had to do to make this work the way I want it. I am using Windows 7 64-bits these days. If you are encountering other annoyances or want to share your fixes, please feel free to ask or comment on this article.

Annoyance 1: Cannot Delete A Folder, Folder in Use

This is because tgitcache.exe is running and not releasing the folder. You can temporarily kill this program from the task manager and then you can delete the folder.

Annoyance 2: The Icon Overlay on Folders are Gone

  • If the overlay icons are showing on certain drives then it is just the setup on the Tortoise Git. Just open the settings and look under Icon Overlays section. It is likely Network or Removable Drives are not checked.
  • If that is not the case then your computer has gone over the 11 icon limit as you may likely have installed DropBox or JungleDisk or such things that take up icons. If you are brave enough and take your responsibility then here is where the icons are referenced.

    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers
    and then remove anything you don't need above and beyond 11 total that's allowed
Want to use the Git behind an HTTP proxy? Read this article.

Friday, July 29, 2011

How To Use Your DropBox.COM Folder As a Git Repository with Tortoise Git

Update: If you have lost your Tortoise Git overlay icons, you need to do some registry work. See the bottom of this article.

You probably came to this article because you are new to the Git Revision Control System and want to know where to store the "source control database" somewhere other than your own computer.

In my specific situation, I develop software under the Windows OS and I may have some side-project such as some research I am doing outside of my work.

GitHub.com is great, and I use it for my business but in order to get your own private GiT repository, you have to pay. They only allows you to let you have a repository if it is open to the public. But in my case, I use Git not just for software source code but many other types of files, for example, my next epic surf novel.

The main problem for me is that I would like to maintain my small repositories without a need to have an elaborate GiT server. Fortunately a GiT repository server can be nothing more than a file system that's accessible from your computer, and even better there are many "cloud disk" services around, many of them are free. The Dropbox.com based cloud disk is very convenient because it maintains the local cache, so the interaction with GiT is very fast. You just need to remember to allow it the time to synchronize the data.

Before moving forward with my example, I assume that you have installed the Windows Git and Tortoise Git on your Windows machine. I also assume that you have used Git for other stuff, for example at your work, so you are generally familiar with synchronizing your own Git repository against the server.

So here are some very straight forward steps to do.

  1. On your DropBox, create a folder which has the name of your repository. For now I will call it MyRepo
  2. From your explorer go inside MyRepo
  3. Right click and select "Git create repository here..."
  4. A dialog box will appear with a box that says "Make it bare." You need to click that check box and OK.
  5. On  any other local disk, I assume you already have your project Git that you want to synchronize.
  6. Go your local project Git folder.
  7. Right click on the folder from the Explorer and select Tortoise Git, and select Settings submenu
  8. On the dialog box navigate down to the Git node and select the Remote sub node.
  9. You are likely to have the "origin" as the remote repository, but you may have others. Select whichever one you would like to connect it to the one on the Dropbox.
  10. On the URL box, type in the path on the dropbox containing the bare bone repo you have just created. For example, C:\Users\Manabu\Dropbox\MyRepo
Now you can synchronize between your repo and the one on the Dropbox.

Fixing the Lost Overlay Icons

Go to http://www.sitepoint.com/missing-tortoisesvn-file-status-overlay-icons/ for more information. But the key for this is to go to


HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\ShellIconOverlayIdentifiers


and then remove anything you don't need above and beyond 11 total that's allowed.






Saturday, July 23, 2011

Do and Don’ts of Email


While I am on the email topic from my previous post, I would like to pass on some of the things that made my email in work more effective. You may want to read some of my tips.

Consider Your Subject Line is Being Like a Tweet

Pack in as much useful information in the Subject line. I consider the subject line the Tweet area to contain almost the “body” of the message. This works because most people actually don’t read all email messages. They look at the subject line list and decide whether they will read the message or not.

Start Your Subject Line with the Name of Your Recipient

Again, compare these lines of subjects

1.     “Tonight’s Dinner Plan”
2.     “Want Join us for a dinner?”
3.     “John Let’s Have a Dinner at French Landry at 6”

Which do you think is most effective? To me, it is the third one. If you read the subject line #3, you almost don’t need to read the body of the email. And I know you will click the email to read on.

Start Your Subject Line with a Verb

Your email will be more effective if you start your subject line more in the “Call for Action” style.

Consider the following examples,

1.     “Blood Donation Drive This Afternoon”
2.     “Donate Your Blood This Afternoon!”

Do Not Send Additional Messages in a Quick Succession

My experience is that if you do that the recipients will only read either the first or the last message and they ignore the rest.

Carefully Time When To Send a Message

This is a bit tricky, but you need to know when your recipient will read your email message.  Most people have their email client set so that the most recent one would appear on top and messages are downloaded automatically. They usually scan only the top 10-20 lines of subject lines on their email clients. So if your message does not make it in that top 10 at the time they are reading, then you might as well consider the message lost.

Another strategy is actually just save it in your draft folder, phone call the recipient and then during the conversation mention to the person you have just send an email.

Typical times people read messages include;

The first thing in the morning
During or just after lunch
Just after dinner

You may want to start tracking the most effective time with respect to your important recipients.

Limit The Message Body Size to One Screen

People are busy (even if they really are not) they can only devote about 1 min of their time to read a message. If you wrote a message that do not fit in one screen then they tend stop reading it, moving on to the next one and never come back to your message.

Organize the Email For The Recipient

You have been frustrated with people who repeatedly ask you to send the same email message over and over again. It is not entirely the recipient’s fault; it is that the email is difficult to manage. Over time you will learn who would be asking for repeats, and in that case, make a CC copy of it on your end, put the copy in a folder with the recipient’s name on it. Then you can quickly re-send.

Use The Phone and Voicemail

If you are dealing with some emotional stuff such as one of you being frustrated, angry or extremely happy etc., then call the person up, or at least use the voicemail to leave your live message. Unless you are a NY Times Best Seller author, it is much easier to convey your emotions via voice. Talk to the person live!


Thursday, July 21, 2011

So What’s So Wrong About Email?


Everyone uses email, even if we asked them not to. I ask people to write issues into our issue tracking system. I ask people not to do attachments, instead upload them to our Google Docs and send links in the email to the document, even then people continue to attach documents, and when it comes to dealing with people outside of our organization, they don’t want to log into Basecamp account we provided, they claim they often cannot see Docs shared on the Google Docs…  Some people in my company think I am the search engine and send emails to me essentially the query to our KB or to the Google.

So what’s wrong with all these? Why can’t they use email for all of the above? It is super convenient to write about a product issue and send an email to someone whom you think can handle. Attachments are one of the best file transfer protocol there is, and I can push files to just about anyone without thinking about FTP or user accounts and passwords.

I am starting to think, can we get rid of the web, and we only use the email? It is an extreme thinking but can such a technology possible?

How would I go about to make this happen in a more realistic way? I think that the future email engines would contain a search engine front-end, a lot more statistics driven choice of automated answers, intelligent filters. This sounds awfully a lot like how Gmail works, for example, and I think they are doing a great job.

Email as the Search Engine:

I would like the search engine to already scan the KB or other places I designate based on the content I received and also the prior usage or response pattern, and suggests  possible responses I may have already written. I often get, “send me the server specifications PDF” email several times a quarter from the same person. I would like to tell the email system, next time this happens, just auto generate a reply. I then do not have to repeat myself.

I am experimenting with this using the “canned” response on Gmail but that’s not very smart yet, and it fires unnecessary responses.

Email as a File Version Control System:

If the email works a bit more like GiT and automatically aggregate the versions of different attachments that come by, and when I look for the attachments, it can give me a list of all versions, this will solve the problem of versions in attachments. This will also bring down the size of the in-box as duplicate files would be normalized.

Email as an Issue Tracking System

Gmail does this fairly well now, perhaps if I tag an email as an issue to track, then all of the related email messages will be visible by the team that I designate as a separate in-box where other people can respond, and workflow tag such as In Progress, Solved are also easy to put in. Assigning an issue is a snap then, I just forward the email to the person. 

Email as a Knowledgebase

May be I can tag some email as a knowledge and the next time I am writing on some topic, dynamic search would be performed to either suggest a response that I already wrote, or other similar email messages I have written in the past.

Most or all of the above can become possible without changing the existing email infrastructure. They are about how email servers are implemented, so it will not break the rest of the world, we do not have to change the behaviors of any of the people I am dealing with now.


Monday, July 18, 2011

DotNetNuke 5 Module Development Tips with Visual Studio 2010

I am jotting down some things I need to remember to know when starting a new C# DotNetNuke module development using the Starter Kit, most of the steps are described elsewhere, notably HERE, but sometimes they contain  wrong information in the original text that you need to dig through the user comments to find out the solution. Also there are a few key things I need to remember to do every time.

Local IIS is a Must for a Newbee DNN Module Developer

Install the base DNN in the local IIS and get that going completely first. It will complicate less for module development as it will need to look up images and other resources in the directory structure.


Where To Store The Project?

The best place seems to be within the DesktopModules folder, create a project directly in there. Then all the references are good to go. By the way, target your project to .NET 3.5

Be sure to uncheck Create Solution Folder box when creating a project in this manner.


What To Type into The Assembly Name and Default Namespace?
  • Type in the same info on both field by replacing YourCompany in the Assembly Name part with what you do, and then copy and paste that to the Default Namespace. This is for C#. I don't know VB at all so I will leave that up to you for VB.
  • Do not do a Globally Replace of YourCompany to whatever. See below!

Do Not Globally Replace YourCompany With Your Real Company


You will get the following type of error message from Edit....ascx.deginer.cs  if you immediately try to compile the project.

DotNetNuke Error 11 'System.Web.UI.UserControl' does not contain a definition for 'Text'

The reason why this happened was that global::DotNetNuke.UI. classes was inadvertently changed by the Visual Studio to global::System.Web.UI

How To Replace YourCompany


Note that order in which this is done is very important. Do not do these in out of sequence.

  1. Make a backup copy of the module project folder so that if you mess these steps, you can get them back.
  2. Open any of the classes in the control. And on the Namespace, right click over YourCompany and use the Refractor menu to change this to whatever you like.
  3. Open the Manifiest file (the one that ends with .dnn). On this one Replace YourCompany. with empty string. This fixes the install folder name from YourCompany.YourModule (make sure that the path does match with how you created your module root directory in the DesktopModules folder.
  4. Save everything.
  5. Make a backup copy of this folder again.
  6. You can now Quick Replace the rest of the files containing YourCompany (for example SQL Provider files). Use the Quick Replace at the Solution level.

Configure the Project's IIS

Next Configure the Project to Use the Local IIS Server so that images, controls and other resources in your development environment. Otherwise, your design surface will have errors. Also if any of the controls on the design surface errors out with a COM error, that means you probably did not follow my previous steps to refactor the classes properly which swapped the controls to the system default ones (not DotNetNuke.UI.Control ones), and ended up globally replacing YourCompany in the classes. You need to start over the project and follow the steps.
  1. Open the project property
  2. Select the Web tab on the left.
  3. Select "Use Local IIS Server"
  4. In the project URL, point it to the URL of your project within the DesktopModules folder. For example, http://localhost/DNN/DesktopModules/MT3 would be that I have the module project named MT3, and I have installed the DNN root at localhost/DNN
  5. Click Override application URL and type in the base URL for the DNN, for example, on my machine it is http://localhost/DNN
  6. This will also create web.config files in the folder which will interfere with the module loading. Rename it to xweb.config just in case you need it in the future.
Debugging

If everything is set right and the DNN itself is a debug version then you can attach to the IIS process w3wp.exe locally and you should be able to set a breakpoint in the project. I will write more as I find out how to do this a bit better without needing to rebuild the DNN from the source.


Sunday, July 10, 2011

GoToMeeting Mac - Microphone Level Adjustment Annoying You?

Symptom:

Every time I start GoToMeeting on my Mac, the microphone level adjusts to a very low level, and you'd need to open the System Preferences to re-adjust this level. You would want to get a single click solution to fix this issue.

Solution:

Use the Automator and create an level adjust applet. It is quite easy to do.

  • On the spotlight search on top right of your finder, type in Automator to locate it.
  • Click on the Automator to launch it.
  • Choose Application (and begin creating an application)
  • Select Utilities from the Libraries
  • Select Adjust Computer Volume
  • Adjust the Input Volume slider to the level you like.
  • Save the Application it creates.
  • Put it on the desktop or somewere you can readily click it.

Monday, June 13, 2011

Emacs csharp (C#) Mode Installation and Automatic Enable with Auto Hook on Windows

I like the editor in Visual Studio a lot.  But when it comes to do some repetitious editing, for example, writing code to insert or update database fields based on some pattern, it is a lot easier to do cut-paste-search-replace with Emacs than the GUI based editor by recording some macros.

So I do often use Emacs. And now we have the csharp mode available, the environment is quite nice.

I am not an Elsip hacker so by the time I need to do something more internal with Emacs, I have usually forgotten what I did the last time. So in order to save my own time in the future, for example, to duplicate what I have done on my home PC with another one somewhere, this article will help me do this. Perhaps you also may want to do the same thing.
  • Be sure that your emacs is installed at your C:\Program Files\ directory, for example, C:\Program Files\emacs.23.2 Unless you know a whole lot more about Emacs (in which case you should not be reading this), it is not correct to install it anywhere else, because the load-path really only points to that directory. Please do note, that even this is a 32-bit app, you still want to put the program in C:\Program Files and not in the X86 directory.
  • First, download the csharp mode Lisp code. You can Google for it as to where. But I got one from the Emacs Wiki under csharp-mode.el  Clicking this link will give you the content of the Elisp, so I would copy this into a suitable text editor (for some reasons, I tend to use Notepad for this sort of thing.) then Save As csharp-mode.el
  • Copy csharp-mode.el to site-lisp directory in your emacs installation. If the directory does not exist, I'd say it's OK to make one there. (For example, C:\Program Files\emacs-23.2\site-lisp).
  • Next, go to your Windows user home directory (at very top, above Documents), then create a .emacs file. The easiest way to do this by far is to create one from Emacs. Notepad does not allow creating files that start with a period. Just Control-X F and type in ~/.emacs   NOTE: On Windows 7, your home directory for .emacs is usually c:\Users\/AppData\Roaming\  If you used emacs to edit this, emacs will know this.
  • Now cut and paste the following lines of Elisp. I have added a bonus hook to enable HTML editing mode for aspx and ascx below. Save the file, re-launch emacs and you are good to go.
(autoload 'csharp-mode "csharp-mode" "C# Mode" t)
(setq auto-mode-alist (append '(("\\.cs$" . csharp-mode))
auto-mode-alist))
(setq auto-mode-alist (append '(("\\.aspx$" . html-mode))
auto-mode-alist))
(setq auto-mode-alist (append '(("\\.ascx$" . html-mode))
auto-mode-alist))

Sunday, June 12, 2011

Building DotNetNuke 5.6.2 Source with Visual Studio 2010 Professional

This weekend, I have finally decided to download the DotNetNuke Community Edition source code and decided to build it with Visual Studio 2010 Professional Edition.

It took several trial and errors so I am going to write down what has worked, mainly so that the next time I will remember how I did it and worked.
  • If you are on Windows 7 (and should be), be sure to permanently enable the Visual Studio to run as Administrator. This will save a lot of time re-running it as DNN projects install and configure IIS 7 and that requires an elevated privilege. If I tell you to just open the  privilege setting is in the Property of the Shortcut, then you know how to set this up even if you have not done that before. Still not making sense? See this Technet KB Article
  • Make sure you have a working SMTP server. You will most likely need to setup an email address then a password which is usually needed for modern SMTP servers.
  • Unzip it to Some Simple Directory, like C:\DNN  You will be editing the solution file pointing to this new location. When the solution loads, it will create a Virtual Dir on IIS 7 (that means you have to install IIS 7 beforehand
  • Add Web Management Tools -> IIS 6 Management Compatibility -> IIS Management Console AND IIS Metabase and IIS 6 configuration compatibility
  • Under the World Wide Web Services -> Application Development Features, ASP.NET should be added.
  • Make a first backup copy of the Unzipped version to somewhere safe. You will likely mess up the next step and will likely accidentally launch the solution (.sln) file before the required hand-edit,and corrupt it beyond repair.
  • Don't Launch the Solution File yet. You need to hand-edit it first.
    • Text Edit the Web Root name (the line that has http: in it) to something short and sweet like http://localhost/dnn  
    • To make sure you don't do an accidental start of the project, edit the solution file using Notepad by starting the Notepad then do the File->Open.
    • Go and find any places that has E:\blah\blah on it, and make the change that correspond to where you put the unzipped directory.
    • But don't change where it says VirtualPath that will break the loading of the web project.
    • If none of the above is making any sense to you, then definitely make a backup of the solution file before you do anything  and ask someone who might know.
  • On IIS if you don't have one create an Application Pool to .NET 4.0 Framework
  • Set the Application Pool User to Network Service. This can be done in the Advanced property menu. It is a lot simpler for me to use the Network Service than something else especially on a local develop machine. By default the Application Pool it uses is the Default Application Pool.
  • Give Full R/W permission to Network Service for the entire DNN tree.
  • Backup the DNN Directory to Another Directory. If you (are likely to) fail after the following steps any work you have done won't go to waste.
  • Now you can launch the Solution, and let it build. This should go smoothly.
  • Create a Database
  • Create a login account for the database on the SQL (Express) server and assign the dbo capability to the account. 
  • Copy development.config to web.config
  • Set the web project as the startup (this should be indicated as the URL you specified when you edited the solution file.)
  • Go to IIS Admin and make sure that the Virtual Directory is pointing at "Website" directory within  the  DNN development directory tree and assign the Application Pool that is running the .NET Framework 4.0
  • Then start the the debug session of the web project.
  • If everything compiles fine and the web site runs OK, then exit the Visual Studio, make a backup copy of the entire directory. In fact, you should always do this before a major change to your project, such as adding or removing a project. It is also a big time saver to back up your DNN database prior to making a major change to the DNN configuration, such as adding or removing a module.
Failure Recovery

The initial debug run goes exactly like installing a brand new site. If the startup jams during SQL script part, then without a hesitation, drop the database and create a fresh one. There will be some unfinished stored procedure or other stuff dangling and it won't install the second time.

Teralic Installation Issues during setup: I ignored this issue and the site is working fine. I will report if there will be issues.