Focus controls with-in JWindow from JFrame

I was designing a small application where I had to use JWindow object having a text box. Upon clicking on a button in my JFrame object, I attempted to focus the text box within the JWindow object in this way

public class MyWindow extends javax.swing.JWindow{
private javax.swing.JTextField myTextField;
public MyWinodw(){
myTextField = new javax.swing.JTextField();
addWindowFocusListener(new java.awt.event.WindowAdapter() {
            @Override
            public void windowGainedFocus(java.awt.event.WindowEvent e) {

               //When this window gets focus, put focus in the text field.
                myTextField.requestFocus();
            }
        });

//Other stuff like size setting, layout setting etc.,
getContentPane().add(myTextField);
validate();
setVisible(true);

}
}

and in my JFrame object, I tried to request focus like this.

MyWindow myWindowObj = new MyWindow();
myWindowObj.requestFocusInWindow();

But to my surprise with no compilation error, text field was not getting focus.

With little googling somewhere I read that JWindow will have a parent and if we didn’t supply one, it will take a null parent. I made a guess and used other constructor of JWindow where we can pass a container.

I used the constructor JWindow(Frame)

and called super constructor.

Thats all. It worked.

Error 1001 in PHP Manager 1.2 for IIS 7

While installing PHP Manager 1.2 for IIS 7, you may get the Error 1001 related Microsoft.Web.Administration to ike this



To avoid this, make sure that you opted to On the IIS Management Console in Windows Features like this

Add .settings folder to ignore list in Netbeans

If you want to add a particular file (which is visible in projects tab) to ignore list of Subversion in Netbeans, it is quite simple.

  • Right click on the file
  • Go to Subversion > Ignore



However if you want to add a particular file (which is not visible in projects tab) like bin folder, build.xml etc., to ignore list of Subversion in Netbeans, it is a bit tricky.

  • Go to Files tab
  • Right click on the file / folder
  • Go to Subversion > Ignore




Complex thing is to add a file / folder (which is not visible either in projects tab / files tab) like .settings folder etc., to ignore list of subversion in Netbeans, it is not straight forward. For this, you have to

  • Right click on the project
  • Go go Subversion > Svn Properties




  • There double click on property svn:ignore visible in Subversion Properties




  • Add .settings to the list and click on Update and then Close.




That is all you have to do.

DBML : The entity type [Table Name] does not belong to any registered model.

I’ve a grid view as shown below

<asp:GridView ID=”Menu1″ runat=”server” AutoGenerateColumns=”false”

        CssClass=”DDGridView” RowStyle-CssClass=”td” HeaderStyle-CssClass=”th” CellPadding=”6″>
        <Columns>
            <asp:TemplateField HeaderText=”Table Name” SortExpression=”TableName”>
                <ItemTemplate>
                    <asp:DynamicHyperLink ID=”HyperLink1″ runat=”server”><%# Eval(“DisplayName”) %></asp:DynamicHyperLink>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
 
and when Menu1.DataBind() is called, I was getting the error
 
The entity type [Table Name] does not belong to any registered model.
 
To resolve this,
 
Uncomment


DefaultModel.RegisterContext(typeof([Context name from dbml file]), new ContextConfiguration() { ScaffoldAllTables = false });
 
in
 
public static void RegisterRoutes(RouteCollection routes) 
 
in
 
Global.aspx.cs

The non-generic type ‘System.Collections.IList’ cannot be used with type arguments

When you use the types System.Collections.IList OR System.Collections.IEnumerable OR System.Collections.ArrayList, you will get a compiler error 

The non-generic type ‘System.Collections.IList’ cannot be used with type arguments

OR 

The non-generic type ‘System.Collections.IEnumerable’ cannot be used with type arguments

OR 

The non-generic type ‘System.Collections.ArrayList’ cannot be used with type arguments

based on the type of argument you used.

To avoid this issue

Use the corresponding base classes available in  System.Collections.Generic namespace viz

System.Collections.Generic.IList for System.Collections.IList
System.Collections.Generic.IEnumerable for System.Collections.IEnumerable
and 
System.Collections.Generic.List for System.Collections.ArrayList

DBML – The specified module could not be found – HRESULT:0x8007007E

After configuring database in database explorer in visual studio if you get the error 



As specified here (Extracted the working solution and copied here for quick reference)

The problem seems to be with the Visual Database Tools DLL.
This DLL file is installed by the VS 2010 installation, but during a SQL Server 2012 installation, it will be upgraded to the SQL 2012 version of the tools. Thereafter, uninstalling and reinstalling SQL or VS will not remove this newer DLL in order to allow the older version to be installed, and hence leave this annoying issue.
How I fixed it was I set up a clean virtual machine and installed VS 2010, then took this original DLL from my virtual machine and overwrote the DLL on my live machine. Simple as that.
I would assume though that deleting this DLL file and then doing a VS 2010 repair or uninstall/reinstall would also fix the problem.
The directory and file name of the DLL (on an X64 machine) is: C:\Program Files (x86)\Common Files\microsoft shared\Visual Database Tools\dsref80.dll

Download dsref80.dll 

Search for dsref80.dll in visual database tools folder (Generally C:\Program Files\Common Files\microsoft shared\Visual Database Tools) and replace with the downloaded file

Windows Help File Error – Internet Explorer Cannot download / from Help

If you get the error Windows Help File Error – Internet Explorer Cannot download / from Help while opening a help file in Windows Vista, follow the following instructions

Removed Bookmarks apears again in Firefox

This seems silly but I had a tough time to find a solution for this problem. 

Recently I deleted few bookmarks from Bookmark Manager (inside Library) and later they appeared again when I type some URL in the address bar.

After many days I got an idea where I opened the suggested (removed) bookmark URL and then from the address bar I removed the bookmark by clicking on the “star” icon and then using “Remove Bookmark” button.

Now the removed bookmarks are not coming again. Still confused about the strange behavior of Firefox.

Ignoring .settings, .project, .classpath etc., files and folders in SVN Commits in Eclipse

Since long I was searching for an option while committing my java projects from eclipse into SVN. There the files like .classpath, .project and folders like .settings are being shown as New files / folders and my project is shown as partially committed like this. (Observer the right arrow in the image)


Finally I found an option to ignore these files and folders while committing the projects. Here is how to do that.


Go to Windows > Preferences > Team > Ignored Resources and Add Pattern like this



not marked as executable error in Jar file execution

In Ubuntu, when you execute JAR file by double clicking the file, you  may get the following error.

The file ‘[JAR File Path]’ is not marked as executable.  If this was downloaded or copied from an untrusted source, it may be dangerous to run.  For more details, read about the executable bit.

To run that jar file, run it from terminal using java -jar [JAR file path]

OR

Create a shortcut on the desktop like this

Right click > Create New > Link to application


Under Permissions tab, provide permissions to others by clicking on the Advanced Permissions button



Provided application particulars in application tab


In command, provide java -jar ‘[JAR file path]’