Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

Questions and answers from the StackExchange network.

You can subscribe to an RSS feed of this list.

Aug 2012

  • I’m being asked to assess whether we can safely upgrade the java version on one of our production-deployed webapps. The codebase is fairly large and we want to avoid having to regression test everything (no automated tests sadly), but we’ve already encountered at least one problem during some manual testing (XmlStringReader.getLocalName now throws an IllegalStateExeption when it just used to return null) and higher-ups are pretty nervous about the upgrade.

    The current suggested approach is to do a source compare of the JDK sources for each version and assess those changes to see which ones might have impact, but it seems there’s a lot of changes to go through (and as mentioned the codebase is kinda large). Is it safe and easier to just review the java version changes for each version? Or is there an easier way to conduct this assessment?

    Edit: I forgot to mention the version upgrade being considered is a minor version upgrade, i.e. 1.6.10 to 1.6.33

Jul 2012

Jan 2012

  • Given a JSF/EJB stack, how do I filter the contents of a dataTable listing automatically using the values of a field in a pojo/entity bean?

    i.e. I have an entity bean Employee with name field having a value of “John” I would like to use this bean to filter the data table to show only records with name John, and not having to construct the where clause manually?

  • I’m trying to get a sense of what are the most commonly-used Java web frameworks, with a focus on large, enterprisey projects. I’m interested in which one is most favored by companies/enterprises (which may not be the same as the one most favored by developers or the open source community I guess). I’d also like to be able to cite specific projects used by each framework, preferably big-ticket or well-known ones.

    Anyone have any idea about this stuff or can point me in the right direction?

    Thanks!

Dec 2011

Oct 2011

  • I’m trying to build a CSS-based menu. I want it to be able to adjust when the browser resizes so I’m using floats to wrap the menu items to the next line as needed. However, I want to have an extra buffer cell at the end to round out the menu appearance, see the sample image below (this an image the designer made from photoshop).

    Example here

    I can set the background image of the containing div to fake it (using the clearing floats trick I found at http://quirksmode.org/css/clearing.html), but then I have the additional problem of having extra space on the right side because I the cited trick says I should set the width to 100% on the container. (see image below)

    enter image description here

    I also don’t have any borders on that extra area after the last item. So, what’s the proper way to go about this? Can anyone suggest any good online implementations I can check?

    Thanks!

Jul 2011

  • Some background: We’re working on projects that involve projects across 2 different countries, and we’ve been using CVS. Developers in the country not hosting the CVS server will take forever to connect to the remote server, so we’ve set up this system to have 2 separate CVS servers in each country and have a sync job that keeps them in sync every hour or so.

    Given this, we’re looking at migrating to a distributed version control system, mostly because we’ve been having problems with the sync job failing and the limitation that for a given set of files only one side can have the writelock for it at a time.

    We’re currently looking at Mercurial for this purpose, so can anyone help tell us if:

    a. Will Mercurial be a good fit for our use case above? How easy will it be for devs to make the transition, i.e. will they still be able to work the same way? etc

    b. Can Mercurial support branching a specific folder only?

    c. We also hold a lot of binary docs in version control, will they be suitable for Mercurial?

    d. Is there support for getting the “writelock” of particular files? i.e. I want no other people to update these particular files while I’m working on them

    Thanks!

  • We’re developing a BPM application to be run on Weblogic, and all the tutorials point to using Oracle ADF for rendering the task forms. My question is: is it feasible to use some other framework other than Oracle ADF for this? We’re not really that familiar with either Oracle BPM or Oracle ADF, but we can’t avoid using Oracle BPM (contract reqt), so we would like to see if we can avoid Oracle ADF instead to minimize the learning effort.

May 2011

  • We have a wifi router set up at home connected to our DSL router. And a lot of computers using it…there’s a desktop (connected to the router via a wired connection), 6 laptops, an ipad and a few internet-capable cellphones (yeah, there are a lot of us at home)

    Sometimes our internet will “act up”, meaning some of the wireless devices will register as being connected to the access point but unable to access any sites. In such a case the other devices seem to be access the internet just fine.

    I’m wondering if there’s some sort of limit or anything to the number of wireless devices we should be allowing to access the router that causes this problem? What things do I need to check?

Mar 2011

Jan 2011

  • So I came home and stumbled upon a bit of a mystery. When I got home my brother was using my desktop PC that was running Windows 7 (I have accounts for my 2 brothers and my mom on the machine, but mine is the only admin account). After he finished his game he logged out and I logged in to my account, but found only strangeness.

    My windows account seems to have been somewhat “reset”, meaning:

    • my quick launch shortcuts were gone
    • my dropbox account did not automatically login
    • my pidgin accounts were no longer there
    • I had to relogin Steam
    • iTunes could not launch (I had hooked up my iDevice before logging in)
    • The Documents/Pictures/Music shortcuts in the start menu no longer work

    However, despite that:

    • my desktop wallpaper was still correct
    • my documents folder was still there in c:\Users\my account name\My Documents as expected
    • Google Chrome settings seem to have been retained
    • other accounts on the same machine seem to be fine

    I asked my brother if he had installed anything strange during the day, he only installed Yahoo Messenger. I last used the machine around 24 hours ago and it was fine then.

    I’m not sure what else has been affected. I’m inclined to just create a new admin user for me to use, but I’d like to have some idea of what actually happened.

  • I have some legacy powerbuilder programs I need to take a look at (view the source, layouts, etc), they are from PowerBuilder 6.5. All I have available is PowerBuilder 11 (demo/eval version), and it seems to be unable to open the PBL files (selecting them in the file open dialog does nothing).

    I guess that it is because the version is very old. ANyone have any idea how I can view those old source files?

    Thanks!

Dec 2010

Nov 2010

Oct 2010

  • Anyone know of any guides for this? I’m a complete newbie to weblogic and to container-managed security. What I’ve done already is:

    1. setup an LDAP authenticator in Weblogic
    2. created a simple webapp in Eclipse
    3. Configure web.xml: Added security-constraint, security-role and login-config elements. The realm name used is “myrealm” which already exists in Weblogic. The role name I used is “Admin” which is a global role in Weblogic
    4. Create a simple jsp page “login.jsp”. It doesn’t actually do any logging in but just a Hello World type of thing. I set this page as form-login-page and form-error-page in login-config in web.xml
    5. Export this webapp to a war file and deploy it in Weblogic
    6. I test it by accessing http://weblogic-server/test/login.jsp, and I expect that I’ll be asked to login using an LDAP user first. This doesn’t happen, it just shows the Hello World jsp.

    I’ve also tried adding a weblogic.xml to map the “Admin” role to a specific LDAP user (didn’t work).

    Any advice? It seems there’s a lack of online references for this sort of thing (or I don’t really know what I should be searching for)

    Edit: I’ve also tried using BASIC auth instead of FORM (no luck)

    My web.xml settings are below:

    <security-constraint>
    <display-name>Test SC</display-name>
    <web-resource-collection>
        <web-resource-name>Test WR</web-resource-name>
        <url-pattern>/hello.jsp</url-pattern>
        <http-method>*</http-method>
    </web-resource-collection>
    <auth-constraint>
        <role-name>Admin</role-name>
    </auth-constraint>
    </security-constraint>
    
    <security-role>
    <role-name>Admin</role-name>
    </security-role>
    
      <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>myrealm</realm-name>
    </login-config>

Sep 2010

Aug 2010

Jul 2010

  • Back story: I’m planning to implement a casual game to be deployed in a webapp, but I don’t want to use Flash, instead just plain Javascript. One benefit of Flash that I would want though is that it distributes a binary and not the source code so it’s easier to protect your code from being reused/stolen by somebody else, or to prevent the client from modifying the code to “cheat” in the game?

    So my question is: what are the ways to similarly protect a Javascript application? Am I limited to the usual methods of using a code obfuscator? Will that be enough?

  • Say I have the following HTML:

    <head>
        <style>
            #container {
                border: 1px red solid;
            }
            .floaty {
                width: 200px;
                float: left;
                border: 1px green solid;
            }
        </style>
    </head>
    <body>
    <div id='container'>
        Text inside the container
        <div class='floaty'>
        Floaty block 1<br/>
        Floaty block 1<br/>
        Floaty block 1<br/>
        </div>
        <div class='floaty'>
        Floaty block 2<br/>
        Floaty block 2<br/>
        Floaty block 2<br/>
        </div>
        <div class='floaty'>
        Floaty block 3<br/>
        Floaty block 3<br/>
        Floaty block 3<br/>
        </div>
    </div>
    </body>
    

    This renders as: floaty divs

    What’s the proper CSS way to have the container (red-bordered box) completely surround the floaty green-bordered boxes?

  • I have an Acer Aspire 4920G that I’ve had for a couple of years, running Windows/Ubuntu.

    I have temperature monitors set up so i can see that with time my CPU temps go as high as 85C, sometimes even spiking to 90C. On startup, the temps are around 65C-75C.

    How bad is this, and anything I can do to avoid it/reduce the temp? I’ve already tried to open up the laptop to clean away any dust, but unfortunately some of the screws are really hard to remove. I don’t want to take it to a shop before trying stuff out myself as I’m no longer under warranty.

Jun 2010

Apr 2010

Mar 2010

  • MINUS is the same as saying “get all the rows of the first query, then from that set remove the rows that are also in the second query”, so you could like load the results from the first query into an array in-memory, then loop through the second query results and check them one-by-one against the first query results and remove them if they exist.

    I’m not sure that will actually perform better though (depends on a lot of things). You might also want to consider using NOT EXISTS instead and check that performance, i.e.

    SELECT  RTRIM(LTRIM(A.HEAD)),
      A.EFFECTIVE_DATE,
    FROM   TABLE_1 A
    WHERE  A.TYPE_OF_ACTION='6'
    AND    A.EFFECTIVE_DATE >= ADD_MONTHS(SYSDATE,-15)  
    AND NOT EXISTS (
      SELECT 1 fFROM TABLE_2 B
      WHERE RTRIM(LTRIM(A.HEAD)) = RTRIM(LTRIM(B.HEAD))
      AND A.EFFECTIVE_DATE = B.EFFECTIVE_DATE
    )
    

    Some functional indexing may also be needed on RTRIM(LTRIM(A.HEAD))

Jan 2010