Studies in Computer Sciences and Practices in Software Engineering

Animating the Popping up of a Popup Window

In a medical device software I'm currently developing, I need a popup window animating like the windows poping up from the task bar. After some experiment, I got the following that works satisfactorily.

    Private Sub Form1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
        Dim screen = PointToScreen(e.Location)
        Dim dlg As Dialog1 = New Dialog1
        dlg.Opacity = 0.4
        Dim size As Size = dlg.Size
        Dim top As Integer
        Dim left As Integer
        dlg.Enabled = False
        For s As Single = 0.1 To 1.0 Step 0.1
            top = screen.y - size.Height * s
            left = screen.x + 10 * s
            If top < 0 Then
                top = 0
            End If
            'If left > Parent().Right - 10 Then
            '    left = Parent().Right - 10
            'End If
            dlg.Bounds = New Rectangle(left, top, s * size.Width, 20)
            If dlg.Enabled = False Then
                dlg.Enabled = True
                dlg.Show(Me)
            Else
                dlg.Refresh()
            End If
            System.Threading.Thread.Sleep(16)
        Next s
        top = screen.y - size.Height
        left = screen.x + 10
        If top < 0 Then
            top = 0
        End If
        'If left > Parent().Right - 10 Then
        '    left = Parent().Right - 10
        'End If
        dlg.Bounds = New Rectangle(left, top, size.Width, size.Height)
        dlg.Opacity = 1.0
        dlg.Refresh()
    End Sub

12:36:20 PM on 11/17/2008 by x mar - Programming - comments

Bad CVSROOT: Hostname required

The latest cvsnt is not compatible with wincvs.

10:50:48 PM on 10/31/2008 by x mar - General - comments

Bad Mouthing Microsoft

In journalism, bashing Microsoft won't get you fired!

So here we go again. Hardly a day has past since the news of Windows Azure hit the wire, Paul McDougall proclaimed Microsoft's Azure is DOA. And his argument is: "IBM's free Lotus Symphony office suite has seen more than 200,000 downloads to date. That's 200,000 users that don't need to buy Microsoft Office."

Funny how journalist always quote evidence that goes against their argument. Let's look at the equations:

(Lotus Symphony + Free) / (Microsoft Office + half a grant) = 200,000 / 1 billion

Like one commenter put's it: people "must love pain!" Sadly (or happily for Microsoft), so far it's proven to be true.

I rest my case!

09:13:55 PM on 10/31/2008 by x mar - xz@localhost~> - comments

Producing Manuscripts for SPIE Proceedings Using MikTex and TexnicCenter

It doesn't take long to locate the Latex and BibTeX style files for SPIE Proceedings. But it took me some time to figure out how to get it working. So if you're new to Latex like me and working on a Windows environment, this may save you some time.

1. Use MikTex Package Manager to make sure the packages ifthen and cite are installed. It's most likely so if you made a full MikTex installation.

2. Download the class file, spie.cls and the bibiography style file, spiebib.bst and place in a newly created folder for your manuscript project. This may not be the best way to do it but it works.

3. Download the example files: article.tex, report.bib, and mcr3b.eps and place them it the directory created in the previous step. The file mcr3b.eps is actually named mcr3b.ps. Make sure you rename it when or after you downloaded it. You may also want to rename the .tex file into a name that's more representitive of the topic of your article (e.g. myspiearticle.tex).

4. In TeXnicCenter, use "File->Open..." to open the .tex file. At this point, no project has been created yet.

5. To create the project for the article, go to TeXnicCenter main menu and select "Project->Create with active file as main file". In the popup window, check "Use BibTeX" check box and select a proper language (en) and Dialect (US). This will create a project named as your .tex file name.

6. At this time, you're ready to build the project by selecting "Build->Build Output" from the main menu or by pressing F7. You may repeat the build up to three times to remove all the warnings.

If the selected output profile is "LaTeX => PDF", you'll probably get the following LaTeX error: "Unknown graphics extension: .eps.". To get around the error, you may "Build->Select Output profile..." one other than "LaTeX => PDF". For example, MiKTeX comes with a nice "Yap" DVI viewer. If you do need a PDF file as an output, you can select "LaTeX => PS => PDF" as your output profile.

Finally, if anyone knows the proper way to install the style files, please drop me a note.

01:01:07 PM on 10/28/2008 by x mar - General - comments

The Death of Efficient-market Hypothesis (EMH)

a flaw in the model ... that defines how the world works."
What came from Former Federal Reserve Chairman Alan Greenspan carries a lot of weight.

07:10:38 PM on 10/23/2008 by x mar - General - comments

1. Where do you stand on the financial recovery plan?

Obama:

McCain:

Obama 0, McCain 1

Obama gives empty promises, McCain point out where the problem is.

2. Are the fundamental differences between Sen. McCain & Sen. Obama on how to solve financial crisis?

McCain: Earmark

Obama: Taxcut for 95% America McCain 0, Obama 1

McCain's attack of Obama on earmarks, although related, doesn't seemed to be on the point that solves the immediate crisis. As Obama made it, "eliminating the earmarks along is not a recipe how we're going to to make the middle class back on track."

3. As President, what priorities would you have to give up to pay for the financial recovery plan?

Obama: Things we can't short change: 1. Energy independence, 2. Health care, 3. Science

McCain: Control cost and eliminating federal agencies that is not effective.

Obama 0, McCain 0

Both tried to avoid the question directly.

4. What do you see as the lessons of Iraq?

McCain:

Obama: Opposed the war at the time when doing it is politically risky.

McCain 1, Obama 1

This has been talked so many times, most people are determined in this issue.

5. Should more troops be sent to Afghanistan, how many and when?

Obama:

McCain: "If you going to aim a gun to somebody, you'd better prepared to pull the trigger." I know how to work with Pakistan, will not say attack Pakistan in public.

Obama-1, McCain-1

6. What's your reading to the threat of Iran.

McCain: Impose sanctions to Iran will work. Talking to Iran will legitimate their behavior.

Obama: War in Iraq strengthened Iran. We need to talk to Iran.

McCain - 0, Obama - 1

7. How do you see the U.S. relationship with Russia?

Obama: Can't return to cold war. Invest in Energy independence to starve Russia of Petro-dollar.

McCain: Russia's behavior in Georgia in unacceptable. Will support Georgia and Ukraine to join NATO. Let Ukrainians know that we're their friend.

Obama - , McCain -

10:34:45 AM on 09/27/2008 by x mar - General - 1 comment

Does Wall Street Really Turned So Dishonorable?

Less than a week past since the Government's plan to assist the financial service companies, before talking is heard that Merrill Lynch (NYSE:MER) may/should/will back out from its deal to sell to Bank of America (NYSE:BOA).

I felt these kind of talk is incredibly naive and reflect badly of the integrity of some people in the Wall Street.

11:23:27 PM on 09/24/2008 by x mar - General - comments

It's Good to See Concenses Are Building to Rescue Banks

While Treasure Secretary Henry Paulson and Fed Chairman Ben Bernanke are working on putting together a plan to rescue banks from their bad debts, Sen. Charles Schumer urged Congress to offer a financial lifeline.

However, I feel that the punishment on AIG of taking a 79.9% stake in return for just extending a loan was too harsh. The shareholder has been punished hard enough. I hope there isn't a socialist agenda behind Sen. Schumer when he wants govenment to take equity stakes in return of capital infusion.

The government should dispose any equity stake as soon as feasible.

10:22:18 PM on 09/18/2008 by x mar - General - comments

It's not the Time to Worry About Moral Hazard

Words has been leaking out that AIG may get loan from the Fed. I would applause such an action by the Fed. I believe it's imparative for government agenciess to step up and rescue AIG. The financial market cann't afford another Lehman Brother fiasco.

For one thing, the AIG is in the need for capital stems from the down grade of its credit rating by the rating agencies. The irony is that these are the very institutions that played a major part in the financial crisis to begin with. These are the institutions that places top grade to exotic "financial instruments" that turned out to be toxic. While their credibilities are totally in trash, the financial world is, by and large, still operating arround their action. That, in my view, is completely unacceptable.

To be sure, the financial institutions, be it the insurance company, mortgage bank, or investment bank, each has their own share of blame. Unfortunately, the mistakes of each institution collectively caused the problem to feed to each other. When favor is returned back to each institution, the damages it can cause has been magified many times over.

While the officials that do have the tremendous power in their hand are saying that they're "not for a second considered using the tax payers money to ball out" any institution. One has to ask where are they when the speculation in real estate was running rampant a couple of years ago. Are they doing their job when anyone with good common sense should know wealth cann't be created out of thin air and going is bound to end badly?

Enough is enough! It's way passed the time of worrying about "moral hazard". It's time for the government to step in to halt the panic and restore confidence, to provide an environmnet and means to allow orderly unwinding of the excess, even if it means tax payer will end up carrying a share of the burden.

03:31:57 PM on 09/16/2008 by x mar - General - comments

Both Palin and Gibson Got a "C" Today

Palin is clearly nervous, as if she's interviewing for a job. She should losen up and throw some balls back to Gibson. She can be more assertive and take opportunity to enhance her Washington outsider image. I don't feel bad that Palin does not know exactly what "Bush Doctrine" is. I, for one, is very bad in memorizing the numenclactures.

The thing Palin is lacking is a self sense of being "Presidential". No, Palin, you didn't need to ask Gibson to clarify "in what sense" of "Bush Doctrine" you're asked, You should command him to "Define 'Bush Doctrine'".

02:22:00 AM on 09/12/2008 by x mar - General - comments
<   November 2008   >
MonTueWedThuFriSatSun
     12
3456789
10111213141516
17181920212223
24252627282930

My Links