"; */ ?>

money


10
Sep 10

Spring Expression Language: Calling a Method with Parameters

Have you ever wanted to win $1,000,000 with a single SpEL ( Spring Expression Language ) call? Well, now you can, and here is how.

Let’s say there is a Lottery that deposits money to a winner’s bank account and congratulates the winner:

private class Lottery {
    // ...
    public String congratulateWinner( String name, BigDecimal amount, Date date ) {
    	String now = new SimpleDateFormat( "MM-dd-yyyy" ).format( date );
    	String cash = new DecimalFormat( "$#,###,###" ).format( amount.doubleValue() );
 
    	return "Congratulations " + name + "! " +
    	       "Today is " + now + ", and it's your lucky day, because " +
    	       "you just won " + cash + "!";
    }
}

Here is how to make Anatoly win money with SpEL:

"congratulateWinner( 'Anatoly', #amount, #date )"

( of course, let’s not forget to set an amount to at least a million dollars ).

And here is a million dollar unit test:

@Test
public void shouldInvokeMethodWithParameters() {
 
    Lottery lottery = new Lottery();
 
    GregorianCalendar calendar = new GregorianCalendar();
    calendar.set( 2010, 8, 10 );
 
    BigDecimal amount = BigDecimal.valueOf( 1000000.00 );
 
    // letting SPEL know about the "lottery", the "amount" won, and the "date"
    EvaluationContext context = new StandardEvaluationContext( lottery );
    context.setVariable( "amount", amount );
    context.setVariable( "date", calendar.getTime() );
 
    ExpressionParser parser = new SpelExpressionParser();
 
    // using '#' to identify a variable ( NOTE: #this, #root are reserved variables )
    Expression exp = parser.parseExpression( "congratulateWinner( 'Anatoly', #amount, #date )" );
 
    String congratulations = ( String ) exp.getValue( context );	
    assertEquals( "Congratulations Anatoly! " + 
                  "Today is 09-10-2010, and it's your lucky day, because you just won $1,000,000!", 
                  congratulations );
}

(!) Do not write code that does not earn you money :)


30
Sep 08

CNN: Bankruptcy, Not Bailout, is The Right Answer

Bankruptcy, not bailout, is the right answerI usually keep my blog technical and life oriented, however today, after the “$700 billion bailout deal” did not pass, and White House is cooking up a new deal, I think it is ultra important to convey the message of top US Economists from many US Universities that “This bailout is NOT the answer to the crisis!”.

Here is the official letter that was sent to Congress on Wed Sept 24 2008 regarding the Treasury plan as outlined on that date:

To the Speaker of the House of Representatives and the President pro tempore of the Senate:

“As economists, we want to express to Congress our great concern for the plan proposed by Treasury Secretary Paulson to deal with the financial crisis. We are well aware of the difficulty of the current financial situation and we agree with the need for bold action to ensure that the financial system continues to function. We see three fatal pitfalls in the currently proposed plan:

1) Its fairness. The plan is a subsidy to investors at taxpayers’ expense. Investors who took risks to earn profits must also bear the losses. Not every business failure carries systemic risk. The government can ensure a well-functioning financial industry, able to make new loans to creditworthy borrowers, without bailing out particular investors and institutions whose choices proved unwise.

2) Its ambiguity. Neither the mission of the new agency nor its oversight are clear. If taxpayers are to buy illiquid and opaque assets from troubled sellers, the terms, occasions, and methods of such purchases must be crystal clear ahead of time and carefully monitored afterwards.

3) Its long-term effects. If the plan is enacted, its effects will be with us for a generation. For all their recent troubles, America’s dynamic and innovative private capital markets have brought the nation unparalleled prosperity. Fundamentally weakening those markets in order to calm short-run disruptions is desperately short-sighted.

For these reasons we ask Congress not to rush, to hold appropriate hearings, and to carefully consider the right course of action, and to wisely determine the future of the financial industry and the U.S. economy for years to come. ”

Signed (updated at 9/27/2008 6:00PM CT) by 231(!) Top US Economists – go here to see all the signatures.


Although my personal opinion is that US Government instead of just give could possibly lend money to “unfortunate” corporation with a very high interest rate, CNN published a great article by Jeffrey A. Miron, a senior lecturer in economics at Harvard University, that suggests that US should not use US taxpayers money to bailout these “unfortunate” corporations at all.

some of the quotes from the article:

“Bankruptcy does not mean the company disappears; it is just owned by someone new (as has occurred with several airlines). Bankruptcy punishes those who took excessive risks while preserving those aspects of a businesses that remain profitable.

In contrast, a bailout transfers enormous wealth from taxpayers to those who knowingly engaged in risky subprime lending. Thus, the bailout encourages companies to take large, imprudent risks and count on getting bailed out by government. This “moral hazard” generates enormous distortions in an economy’s allocation of its financial resources.”

“Further, the current credit freeze is likely due to Wall Street’s hope of a bailout; bankers will not sell their lousy assets for 20 cents on the dollar if the government might pay 30, 50, or 80 cents.”

“The costs of the bailout, moreover, are almost certainly being understated. The administration’s claim is that many mortgage assets are merely illiquid, not truly worthless, implying taxpayers will recoup much of their $700 billion.”

“The right view of the financial mess is that an enormous fraction of subprime lending should never have occurred in the first place. Someone has to pay for that. That someone should not be, and does not need to be, the U.S. taxpayer.”


9
Jan 08

How does DIGG make money?

How does DIGG make money    Just came home today and had a random thought “How does Digg make money?”. Almost any unanswered question that I have I usually bounce against my friend Google. Even if I know the answer, I like to go there to see if there if there is any additional info. However to search information about Digg is quite hard, due to the reason that most of the Google search queries match to some Digg article that somebody posted, and not the real info about Digg. So, today, Google did not answer my question.

Try to enter How does Digg make money in Google, and all you will see is “how to make money with Digg”, “10, 40, 250… ways to make money online” from Digg, “Digg effect” links, but no real answer to my question about Digg.

So here, I am thinking on my own…

There is a definite income from Google Adsense,  but it does not seem all that much according to sources it is only $250,000.00 per month, which I am sure is cigarrette money for Digg boys. (do they smoke?)

There is another annoying source that probably brings more than Google Adsense, since that big rectangular thing in the upper left corner of digg.com is blinking pretty hard every time I am on Digg. I am not sure how much that brings, but that is a definite “plus one” source.

Now ads on Digg even talk “Congratulations, you have chance to receive … two iPods nano” – it might come from that blinking thing (flash), but also might be something totally different, so I guess it also may be counted as an independent source.

When you click “more” on a story, you’ll see a banner from (http://clk.atdmt.com)  guys, hence “another one”.

How about that “http://media.fastclick.net” colorful banner on the right hand side of all the comments? “one more”.

At the very bottom of a Digg page there is “Advertise: You can buy advertising on Digg through our advertising partner Microsoft“, hence some of the above also goes to Microsoft. (just a note)

But my question is still unanswered, I still do not see the full picture. If all Digg’s revenue comes from blinking ads, it’s just boring – it is Digg after all, there should be some other cool hidden/not as obvious way they are getting that cash flow – don’t you think?


19
Oct 07

Help Google to Generate Only Relevant Ads!

google money    I recently decided to participate in Google Adsense program where Google shows its ads on my blog, and I get paid when somebody clicks the ad. This tool from Google is far from being fresh and new, but I think it has a very cool idea behind it:
        – ad owner wins, because people go to her/his website,
        – Google wins, because ad owner pays Google for a click (through Google Adwords)
        – I win, because I keep writing stuff on my blog and get paid by Google for a click.

   One of the main challenges and the main thing about any kind of ads from any place is their relevance. Will you buy milk on a porno site? Or do you need a pack of Marlboro Lights, when searching for a Whitening Toothpaste? Probably not really…

    So you see the logic, the more relevant the ad is, the more chances people are going to pay their attention to it and, in the case of Adsense, "click it".

    Relevance is mostly achieved by the Google algorithm that analyzes your page (the page where ads are going to be displayed) by reading its content and "data mining" it. Then it makes a decision on what exactly "this" page is about, and what ads Google has on that topic. Once all is figured out, Google places the resulting ads on the page.

    But there are ways we can help Google not to "offer milk on the porno site" (although Google does not do porno sites – just a colorful example here :) ), but instead target its ads right to the point. One of such ways is "Section Targeting".

    how Google explains it:

    Section targeting allows you to suggest sections of your text and HTML content that you’d like us to emphasize or downplay when matching ads to your site’s content. By providing us with your suggestions, you can assist us in improving your ad targeting.

    You can read their short tutorial here. The idea is simple: your html page has a lot of text, including links, other advertisement, people comments, etc. but what you really want Google to focus on is your content ( in my case it is my blog post ). So you can use three HTML tags that will focus Google Adsense engine on your content. These tags are:

               Section start tag:               <!– google_ad_section_start –>

               Section end tag:                <!– google_ad_section_end –>

               Ignore section start tag:      <!– google_ad_section_start(weight=ignore) –>

    Sample from Google:

<html><head><title>Section targeting</title></head>
<body>
 
<!-- google_ad_section_start -->
 
This is the text of your webpage. Most of your content resides here.
 
<!-- google_ad_section_end -->
 
</body>
</html>

    From the sample above you can see how (start, end) tags can be used to focus Google only on the  main content. In order to ignore the content, wrap it with (ignore, end) tags as follows:

<html><head><title>Section targeting</title></head>
<body>
 
<!-- google_ad_section_start(weight=ignore) -->
 
This is the text of your webpage. Most of your content resides here.
 
<!-- google_ad_section_end -->
 
</body>
</html>

    But there is something interesting, that is not included in Google’s tutorial, that you can do with tags – you can nest them, as well as focus them on multiple sections! I have spoken to the Google Adsense representative, gave him a couple of examples I would liked to use the tags, and he confirmed that it works.

    So here is very cool and efficient things that you can do with adsense tags in addition to the usual stuff…

    nest those tags:

<!-- google_ad_section_start -->
 
     my content I want to focus on
     .....
 
     <!-- google_ad_section_start(weight=ignore) -->
 
          content I would like to ignore
 
     <!-- google_ad_section_end(weight=ignore) -->
 
     my content I want to focus on
     .....
 
<!-- google_ad_section_end -->

    so, in the above example we ignored a part of the section (content) we actually want Google to focus on – cool, right? :)

    That is not all, you can also focus on multiple sections, like this:

<!-- google_ad_section_start -->
 
     my content A I want to focus on
     .....
 
<!-- google_ad_section_end -->
 
     some other irrelevant content
     .....
 
<!-- google_ad_section_start -->
 
     my content B I want to focus on
     .....
 
<!-- google_ad_section_end -->

    This really opens the doors to finetune the relavence of your ads, which, who knows, maybe someday will make you a millionaire! ;)


1
Apr 07

Top 10 mistakes taxpayers make on returns

Ever make a mistake on your tax return? If so, you’re not alone. Mistakes can cost you money – taxpayers often miss deductions or tax credits.

They can also draw unwanted attention to your return from the Internal Revenue Service (IRS) and could result in penalty fees. The National Society of Accountants (NSA) identified these “Top 10 Mistakes” that taxpayers make:

1. Using the wrong column in the tax table.

2. For each level of income, tax rates listed in the tax table usually are different for taxpayers who are single, married filing jointly, married filing separately, and heads of households. It can be easy to pull a number from the wrong column.

3. Not claiming the right number of exemptions. Children count as exemptions up to age 23 – make sure they are claimed on the return as exemptions with the current exemption amount, which often increases year to year.

4. Not adding state income tax refunds as taxable income. It’s easy to forget the state tax return refund you got last year. Remember that this counts as taxable income on your federal return if you itemized last year.

5. Not being aware of tax credits. The federal government offers many tax credits, including earned income, energy, education, fuel, elderly, child care, child tax, and foreign tax credits. Many states offer renters’ credits. Take advantage of these if they apply to you.

6. Not calculating and comparing the Alternative Minimum Tax. Every taxpayer must calculate this alternative tax to see if it applies to their situation. Failure to do so could result in additional taxes and penalties.

7. Not claiming a refund of excess FICA (Social Security) tax. If you changed employers in 2006 and earned more than $94,200 (the 2006 income limit that applies to FICA tax) the employers together may have withheld more FICA than you owe. Make sure you calculate this and claim a refund if appropriate.

8. Not attaching W-2 forms and other forms. This common mistake is easy to make, so double check to make sure they are included.

9. Not entering Social Security numbers on all tax documents. In addition to the main return, documents such as Schedule A and other tax schedules should all have complete information, including Social Security numbers.

10. Not signing the return. After all the calculations, don’t forget this important step!

(bonus one)
11. Not enclosing the check for any payment owed. Yes, you must write a check if you owe money. Don’t forget to include it!

from cantonrep