Nat Luengnaruemitchai

Geek Blog

  Home  |   Contact  |   Syndication    |   Login
  97 Posts | 0 Stories | 179 Comments | 236 Trackbacks

News

Archives

Post Categories

Blogroll

Thursday, June 18, 2009 #

If…

1. You installed Oracle XE but you cannot launch APEX or start up oracle.exe process

2. Your computer joined Windows domain

3. You installed it using Domain account

Very likely, it will try to install it using domain authentication which it may not work.

Therefore, the solution is to:

1. Create a local user with admin right

2. Log in using that local user and set regional setting to en-US

3. Install Oracle XE

4. Go to c:\Oracle\app\oracle\product\10.2.0\server\NETWORK\ADMIN\sqlnet.ora and remove the line that said SQLNET.AUTHENTICATION_SERVICES = (NTS)


Many times, I installed SQL Server 2008 and failed with just the error message “Access Denied”. One of the cases I found is that my Administrator account doesn’t have SeDebugPrivilege especially when GPO policy is in effect. I still don’t understand why anyone should be admin but cannot debug things :(

Check out the following links for more information:

http://blogs.msdn.com/joaol/archive/2008/12/02/sql-server-2008-installation-aborts-due-an-access-denied.aspx

http://social.msdn.microsoft.com/Forums/en-US/sqlreportingservices/thread/94f373ae-bb3e-4664-b0fd-95121d09f7de


Tuesday, February 17, 2009 #

The other day I ran into a page here. It mentioned that XP SP2 and Vista have an updated TCP/IP stack where it was designed to reduce the risk of your PCs to spread out the worm in case it gets affected. Some people found a way to work around it by manually editing the TCPIP.sys file. You might need this if you have to write an application where it attempts to connect to multiple PCs concurrently such as web crawlers, peer-to-peer application, system monitor where the remote hosts cannot be expected to be up all the time.


Monday, February 16, 2009 #

Many people have a problem when spawning multiple requests to get content from a server where only 2 requests can be processed concurrently. This is because the HTTP protocol standard suggests that HTTP client should not make more than 2 calls to a server at one time. However, in many cases, you have a need to make more than 2 requests at the same time by adding the following configuration in App.config.

 

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
 
<system.net>
   
<connectionManagement>
     
<add address="*" maxconnection="10"/>
   
</connectionManagement>
 
</system.net>
</configuration>

Wednesday, October 22, 2008 #

Some people may experience a problem with Java applet in Mozilla Firefox 3.0. For me, I noticed that after upgrading from Firefox 2.0 to Firefox 3.0, some of my applets don't work anymore. This happens when I have network.cookie.cookieBehavior setting = 1. This will disallow access to 3rd party cookies. However, it also has a side effect where it disallow cookie from the same site when fetching for Java applet codebase as well. Changing it back to 0 (Allow all cookies" fixes it.

http://kb.mozillazine.org/Network.cookie.cookieBehavior


Thursday, September 20, 2007 #

Yesterday, I had a problem where I need to hook up an event to a certain data condition. I first thought about EventTrigger. However, it does the other way around. This class is responsible for convert event into trigger. So I digged around WPF architecture to see what I can do and bingo. I found that I can create an attached property with the following construct

 

 

 

 

and then in XAML, you can register for this event by

<TextBox Text="Try me">
    <
TextBox.Style>
        <Style TargetType="{x:Type TextBox}">
            <
Style.Triggers>
                <
Trigger Property="Text" Value="Cool">
                    <
Setter Property="me:Window1.SomethingHappened" Value="True" />
                </
Trigger>
            </
Style.Triggers>
        </
Style>
    </
TextBox.Style>
</
TextBox>

 

public static readonly DependencyProperty SomethingHappenedProperty = DependencyProperty.RegisterAttached("SomethingHappened",typeof(bool),typeof(Window1),new PropertyMetadata(false,new PropertyChangedCallback(SomethingHappened)));public bool GetSomethingHappened(DependencyObject d)
{
    return (bool)d.GetValue(SomethingHappenedProperty);
}
public void SetSomethingHappened(DependencyObject d, bool value)
{
    d.SetValue(SomethingHappenedProperty, value);
}
private void SomethingHappened(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
    // do something here
}

Tuesday, September 18, 2007 #

Andrew Flick announced that Infragistics WPF Express Edition will be free as well. Before this release, xamDataGrid suffered a lot of performance problem. It seems that they have fixed various performance problem. So I think I will give it a try again later. To try it out visit http://blogs.infragistics.com/blogs/andrew_flick/archive/2007/09/13/infragistics-netadvantage-for-wpf-express-aka-free-grid.aspx for more information.

Sunday, September 16, 2007 #

In Windows Forms application, we can use Control.IsInDesignMode or LicenseManager.UsageMode == LicenseUsageMode.Designtime to check whether your code is executing in DesignMode or not. You might wonder how would you do the same in WPF. Fortunately, Cider and Blend offers a similar functionality. You can test the following condition DesignerProperties.GetIsInDesignMode(new DependencyObject()).

ClickOnce deployment has problem with Proxy that requires authentication. You might get the following error:

(407) Proxy Authentication Required

If so, you would need to get a hotfix at http://support.microsoft.com/kb/917952/en-us.

For more detail, you can check out at http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=294738&SiteID=1


If you try to run any XBAP application on the machine that has ISS Proventia Buffer Overflow Protection (vpatch.exe) installed, you might experience COMException with HRESULT 0xFFFFFFFF. The workaround is to stop vpatch.exe. I hope Microsoft and ISS work together to fix this issue.

 


If you experience bad handle leaks in svchost.exe process like I did, what happened was a bug in a dll that leaks handles when you have some antivirus software installed. It might worth to get a hotfix from Microsoft. It is detailed at KB892489.

Tuesday, August 07, 2007 #

Sometimes, you would like to get a combobox where a user can type. This can be done by turning on IsEditable property to true. However, it opens another can of worm, it means the user can type anything in the combobox even text that is not in the ItemsSource.

To provide LimitToList feature, you can hook up an event to PreviewLostKeyboardFocus as follows:

 

        private void ComboBox_PreviewLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)

        {

            if (!e.Handled)

            {

                TextBox textBox = e.OldFocus as TextBox;

                ComboBox comboBox = sender as ComboBox;

                if (textBox != null && comboBox!=null)

                {

                    DependencyObject common = comboBox.FindCommonVisualAncestor(e.NewFocus as DependencyObject);

                    // validate only the case when user step out of this control

                    if (common != comboBox)

                    {

                        bool invalid = !string.IsNullOrEmpty(textBox.Text) && comboBox.SelectedIndex < 0;

                        if (invalid)

                        {

                            e.Handled = true;

                        }

                    }

                }

            }

        }

Later, I will show you how to create a visual clue to indicate that the combobox is invalid


Sunday, July 29, 2007 #

I posted in MSDN Forum a while ago that I ran into a WPF bug that occurs when you put one template inside another template like

    <ListBox HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
        Background="Honeydew" ItemsSource="{Binding}">
        <ListBox.ItemTemplate>
                <DataTemplate>
   <ListBox ItemsSource="{Binding}">
    <ListBox.ItemTemplate>
     <DataTemplate>
      <etc..............
     </DataTemplate>
    </ListBox.ItemTemplate>
   </ListBox>
  </DataTemplate>
 </ListBox.ItemTemplate>
    </ListBox>

The above code won't fail during the compilation. However,during the run, you will notice that only the first item of the outer listbox will show up but not the rest. Sam Bent, WPF/WinFX Dev Lead answered that this is a nested template bug. If template is used nestedly, the result will be unexpected. To workaround, the template should be defined as a separated template in Resources section like:

<Window.Resources>
    <DataTemplate x:Key="InnerTemplate">
        <StackPanel>
            <ComboBox ItemsSource="{Binding Source={StaticResource CategoryData}, XPath=Category}"
            SelectedValue="{Binding XPath=Category}"/>
            <TextBlock Text="{Binding XPath=Title}" />
            <TextBlock Text="{Binding XPath=Summary}" />
        </StackPanel>
    </DataTemplate>
    <DataTemplate x:Key="OuterTemplate">
        <StackPanel>
            <ListBox HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
                ItemTemplate="{StaticResource InnerTemplate}" Background="Honeydew" ItemsSource="{Binding XPath=.}">
            </ListBox>
        </StackPanel>
    </DataTemplate>
</Window.Resources> 

<Grid VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
    <ListBox HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" HorizontalAlignment="Stretch"
            ItemTemplate="{StaticResource OuterTemplate}" Background="Honeydew">
        <ListBox.ItemsSource>
            <Binding Source="{StaticResource InventoryData}"
                    XPath="*[@Stock='out'] | *[@Number>=8 or @Number=3]"/>
        </ListBox.ItemsSource>
    </ListBox>
</Grid>

 


Sunday, February 11, 2007 #

As Bush's goverument proposed the extension of daylight saving time period, the daylight saving time will start in March and end in November in 2007 instead of April and October previously. This will cause a problem for unpatched system not to display time correctly. Therefore, several vendors have provided a patch for their own system including Microsoft. Microsoft released a KB928388 patch. What this patch does is to modify some registry keys that keep information about time offset and daylight saving information. This information is quite static. It stores time offset, the start of DST (Xth day of week of Yth month as well as the time difference between daylight saving time and regular time). For example, this information has been patched to Second Sunday in March at 02:00:00 and First Sunday in November at 02:00:00 respectively.

It looks OK right. System has been patched. Life is good. Not so fast, my friends. The operating system before Vista era doesn't really support Dynamic DST (Ability to keep different daylight saving information for different periods.) This means the time will be changed retroactively. For example,

Before the patch

TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(2006, 11, 1)) should return -05:00:00
TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(2007, 11, 1)) should return -05:00:00

After the patch

TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(2006, 11, 1)) should return -04:00:00
TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(2007, 11, 1)) should return -04:00:00

Expected behavior

TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(2006, 11, 1)) should return -05:00:00
TimeZone.CurrentTimeZone.GetUtcOffset(new DateTime(2007, 11, 1)) should return -04:00:00

First when I heard about this problem, I couldn't believe my own ears that Microsoft would provide a patch where it will cause a problem somewhere else but it is. The implication of this means if you store the data in UTC timezone to represent datetime, you stored 2006-11-1 12:00:00AM as 2006-11-1 05:00:00 AM previously and when you retrieve it back based on new patch, you will get 2006-11-1 01:00:00AM back instead. So if you search such date in the database probably you won't get anything back. The same problem applied with a case I found recently. We have a system that needs interopability between Java and .NET. We use the native implementation of Date where the DateTime in .NET will be converted into .NET ticks at UTC time sending over to Java side and then Java will convert .NET tick back to milliseconds since epoch and construct java.util.Date object in Java. Everything had been good until recently our beloved administrators installed timezone patch in every machine. One user started complain that she entered 2007-11-1 in the application but it turns out to get data on 2007-10-31 for her instead. What happened was 2007-11-1 in .NET Datetime will be converted into 2007-10-31 11:00PM and it got serialized into XML as 2007-10-31. When the data got transferred to the other side, it will return wrong data back to us. To make the story funnier, although Microsoft provided an API to get dynamic DST in Vista, .NET code seems to use the old function. Therefore it will return wrong timezone information as well. What a compatibility!

If you have a problem like me, I hope that the information provided here would help you not to spend too much time diagnose what's going on here.

Thanks Citrin Wayne for providing such responsive help, extensive information, and the great product.

Reference:
DYNAMIC_TIME_ZONE_INFORMATION
2007 time zone update for Microsoft Windows operating systems
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1180416&SiteID=1
More about JNBridgePro and the new daylight savings time rules


Wednesday, January 10, 2007 #

Bryant and Chris reported this issue a while ago. Now Microsoft just acknowledged the problem and put in a knowledge base article about this problem as KB911895. Hopefully Microsoft will release a resolution to this problem for Microsoft Vista Home Premium.