stablevalue.com a blog on stock market and things of interest
Articles

How Prius works

Posted by btr Fri, 11 Jun 2004 17:48:08 GMT

Here's the link to discuss how Prius transmission system works.

Posted in  | no comments

Better xsd.exe

Posted by btr Wed, 19 May 2004 03:10:39 GMT

now, it supports property, collection, import and option not to generate codes for imported types. download. for more info, check here. Statement.xsd <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:tns="http://microsoft.com/practices/ConsolidatedAccountStatementResponse" elementFormDefault="qualified" targetNamespace=http://microsoft.com/practices/ConsolidatedAccountStatementResponse xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <Code xmlns="http://weblogs.asp.net/cazzu" skipImportedType="true"> <Extension Type="XsdGenerator.Extensions.ArraysToCollectionsExtension, XsdGenerator.Library" /> <Extension Type="XsdGenerator.Extensions.FieldsToPropertiesExtension, XsdGenerator.Library" /> </Code> </xs:appinfo> </xs:annotation> <xs:import namespace="http://microsoft.com/practices/CashAccount" schemaLocation="CashAccount.xsd" /> <xs:element name="ConsolidatedAccountStatementResponse" type="tns:ConsolidatedAccountStatementResponse" /> <xs:complexType name="ConsolidatedAccountStatementResponse"> <xs:sequence> <xs:element name="CashAccounts" xmlns="http://microsoft.com/practices/CashAccount" type="ArrayOfCashAccount" /> </xs:sequence> </xs:complexType> </xs:schema> CashAccount.xsd <?xml version="1.0" encoding="utf-8" ?> <xs:schema xmlns:tns="http://microsoft.com/practices/CashAccount" elementFormDefault="qualified" targetNamespace="http://microsoft.com/practices/CashAccount" xmlns:xs="http://www.w3.org/2001/XMLSchema"> <xs:annotation> <xs:appinfo> <Code xmlns="http://weblogs.asp.net/cazzu" skipImportedType="true"> <Extension Type="XsdGenerator.Extensions.ArraysToCollectionsExtension, XsdGenerator.Library" /> <Extension Type="XsdGenerator.Extensions.FieldsToPropertiesExtension, XsdGenerator.Library" /> </Code> </xs:appinfo> </xs:annotation> <xs:complexType name="CashAccount"> <xs:sequence> <xs:element minOccurs="0" maxOccurs="1" name="AccountNumber" type="xs:string" /> <xs:element minOccurs="1" maxOccurs="1" name="Contract" type="xs:int" /> <xs:element minOccurs="1" maxOccurs="1" name="Balance" type="xs:decimal" /> <xs:element minOccurs="0" maxOccurs="1" name="AccountType" type="xs:string" /> </xs:sequence> </xs:complexType> <xs:complexType name="ArrayOfCashAccount"> <xs:sequence> <xs:element minOccurs="0" maxOccurs="unbounded" ref="tns:CashAccount" /> </xs:sequence> </xs:complexType> <xs:element name="CashAccount" type="tns:CashAccount" /> </xs:schema> ' Statement.vb ' _ Public Class ConsolidatedAccountStatementResponse Private _cashAccounts As CashAccountCollection ' _ Public Property CashAccounts As CashAccountCollection Get Return Me._cashAccounts End Get Set Me._cashAccounts = value End Set End Property End Class Public Class CashAccountCollection Inherits System.Collections.CollectionBase Public Default Property Item(ByVal idx As Integer) As CashAccount Get Return CType(MyBase.InnerList(idx),CashAccount) End Get Set MyBase.InnerList(idx) = value End Set End Property Public Function Add(ByVal value As CashAccount) As Integer Return MyBase.InnerList.Add(value) End Function End Class

Posted in  | no comments

MT 3.0 upgrade failed

Posted by btr Fri, 14 May 2004 21:54:38 GMT

After the upgrade from MT 2.63 to MT 3.0, I could not log in anymore. Not sure what's going on, so back out the upgrade.

Posted in  | no comments

why did i choose to use typed dataset in web service?

Posted by btr Thu, 06 May 2004 02:59:59 GMT

pros
  • vs.net support on xsd and class generation via xsd.exe (drag and drop from data model to dataset plus some final touch)
  • existing data access framework support on mapping xsd to relational data and vise versa using data adapter (minimum coding required)
  • updategram that works well with the mappings defined in 2 (works really well for applications and no much coding required)
  • vs.net generated proxy works!
  • cons
  • locked in on .net (mitigation - provide alternative interface based on xsd for j2ee if required; there's a way to transform typed dataset into a similar xsd and generate corresponding wsdl; however, it works best for readonly data since there's no simple way to map the returned data back to relational data w/o writing additional codes )
  • increased data traffic due to schema being serialized (limit dataset usage to minimum; typed dataset for updatable data only)
  • in some cases, typed dataset is too vague or loose specially when there're more than one table defined (this point is counter balanced by the no 2 in pros. gain something then lose something else ...)
  • i ditched the idea of separating schema from dataset since it would require both ends to deal with schema anyway.
    i ditched the idea of not using dataset since it would require us to write tons of mapping code for relational data and updategram.

    everything works if designed and used properly. besides, everying around us is galaxy apart from soa world anyway.

    Posted in  | no comments

    Roll your own Web Part

    Posted by btr Sun, 25 Apr 2004 03:26:04 GMT

    Web Part was introduced in SharePoint Portal and will be adopted in ASP.NET 2.0. The whole Web Part infrastructure involves with the aspects in catalog, configuration, persistence and connection. I'm particularly interested in the connection feature. To make a Web Part connectable to other Web Parts, it has to implement a set of interfaces. They are ICellProvider/ICellConsumer, IRowProvider/IRowConsumer, IListProvider/IListConsumer and IFilterProvider/IFilterConsumer. To coordinate the communication among the parts, each part also needs to override a few methods such as CommunicationConnect, CommunicationInit and CommunicationMain. In the implementation, there are two base classes desgined to set up the framework. The BaseControl class is listed here.
    	public class BaseControl : UserControl, IMessage	{
    		public BaseControl() : base() {
    		}
    		public event ErrorMessageEventHandler ErrorMessage;
    		public event MessageEventHandler Message;
    		protected void OnMessage(object sender, MessageEventArgs e) {
    			if (this.Message != null)
    				this.Message(sender, e);
    		}
    
    		protected void OnErrorMessage(object sender, MessageEventArgs e) {
    			if (this.ErrorMessage != null)
    				this.ErrorMessage(sender, e);
    		}
    
    		protected override void Render(HtmlTextWriter writer) {
    			base.Render(writer);
    		}
    
    		public virtual void CommunicationConnect() {}
    		public virtual void CommunicationInit() {}
    		public virtual void CommunicationMain() {}
    	}
    
    	public interface IRowProvider {
    		event RowProviderInitEventHandler RowProviderInit;
    		event RowReadyEventHandler RowReady;
    	}
    	public interface IRowConsumer
    	{
    		void RowProviderInit(object sender, RowProviderInitEventArgs e);
    		void RowReady(object sender, RowReadyEventArgs e);
    	}
    
    The BasePage class defines the overall page layout and style, it also fires the CommunicationConnect/Init/Main methods on each connectable controls, plus other basic features that each page needs to share in common. One needs to refactor and refactor the GUI design to get the best out of this architecture since suddenly many basic features of modern web user interface becomes reusable components that can be connected or composed into elaborate user interface to accompish rather sophisticated work.

    Posted in  | no comments

    Bullish computing ...

    Posted by btr Sat, 27 Mar 2004 21:42:47 GMT

    Posted in ,  | no comments

    COM+ like Transactions

    Posted by btr Fri, 19 Mar 2004 02:58:05 GMT

    I'm implementing a component that offers COM+ like programming model on local transaction on a single database. You will be able to decorate a class using attribute like [Transactional(TransactionOption, TransactionIsolation)]. Inside each method, SetComplete or SetAbort will vote to commit or rollback the transactions. It will support nested transactions on a single thread.

    The motivation is to ease business component development that needs flexible transaction management when component reuse is important. Here's a sample test case.

    [Transactional(TransactionOption.Required, TransactionIsolation.Standard)]
    public class Account : Transactional {
    	public Account() : base() {
    	}
    	
    	public void Debt(string account, decimal amount) {
    		try {
    			// make database calls in adapter via ADO.NET
    			Auditor auditor = new Auditor();
    			DA.PostDebt(account, amount);
    			auditor.Log("post debt trx");
    			
    			TransactionUtil.SetComplete();
    		}
    		catch (Exception ex) {
    			auditor.Log("error in posting debt trx");
    			TransactionUtil.SetAbort();
    		}
    	}
    	
    	public void Credit(string account, decimal amount) {
    		try {
    			// make database calls in adapter via ADO.NET
    			DA.PostCredit(account, amount);
    			Auditor auditor = new Auditor();
    			auditor.Log("post credit trx");
    			
    			TransactionUtil.SetComplete();
    		}
    		catch (Exception ex) {
    			auditor.Log("error in posting debt trx");
    			TransactionUtil.SetAbort();
    		}
    	}
    }
    
    [Transactional(TransactionOption.RequiresNew, TransactionIsolation.Standard)]
    public class TransferAgent : Transactional {
    	public TransferAgent() : base() {
    	}
    	public void Transfer(string from, string to, decimal amount) {
    		try {
    			Auditor auditor = new Auditor();
    			auditor.Log("validating balance in " + from);
    			
    			Validator v = new Validator();
    			v.Validate(from, amount);
    			auditor.Log(from + " balance checked OK");
    
    			Account account = new Account();
    			account.Debt(from, amount);
    			account.Credit(to, amount);
    			
    			TransactionUtil.SetComplete();
    			auditor.Log("transfer OK");
    		}
    		catch (Exception ex) {
    			auditor.Log("error in transfer");
    			TransactionUtil.SetAbort();
    		}	
    	}
    }
    
    [Transactional(TransactionOption.RequiresNew, TransactionIsolation.Standard)]
    public class Auditor : Transactional {
    	public Auditor() : base() {
    	}
    
    	public void Log(string msg) {
    		try {
    			DA.Log(msg);
    			TransactionUtil.SetComplete();
    		}
    		catch (Exception ex) {
    			TransactionUtil.SetAbort();
    		}
    	}
    }
    
    [Transactional(TransactionOption.Supported, TransactionIsolation.Standard)]
    public class Validator : Transactional {
    	public Validator() : base() {
    	}
    
    	public void Validate(string account, decimal balance) {
    		try {
    			if (DA.CheckBalance(account, balance))
    				TransactionUtil.SetComplete();
    			else
    				TransactionUtil.SetAbort();
    		}
    		catch (Exception ex) {
    			TransactionUtil.SetAbort();
    		}
    	}
    }
    
    [TestFixture]
    public class UnitTest : UnitTestBase {
    
    	[Test]
    	public void Test01() {
    		Account account = new Account();
    		account.Credit("a", 1000.00);
    		account.Debt("a", 100);
    		account.Credit("b", 100.00);
    	}
    	
    	[Test]
    	public void Test02() {
    		TransferAgent agent = new TransferAgent();
    		agent.Transfer("a", "b", 100.00);
    	}
    
    }
    

    Posted in  | no comments

    Shadowfax and SOA

    Posted by btr Sun, 14 Mar 2004 05:04:02 GMT

    SOA has been the buzz word recently. I'm considering to use Shadowfax reference architecture for an inventory project. I like to maintain the capablity of XCOPY in deployment, which would be an issue since Shadowfax does need to intstall some programs that can not be deployed with XCOPY such as Exception and Instrumentation related functionalitites. Any ExterperiseServices related components might need installation program as well. You can get a copy of Shadowfax source code from here.

    Posted in  | no comments

    iTunes or Media Player?

    Posted by btr Sun, 29 Feb 2004 04:22:54 GMT

    After I tried iTunes the first time, I really like it a lot. It's so much better than Media Player. I'm using iTunes or previously Media Player mainly as my internet radio to listen to the music or news from around the world. In iTunes, once you see a radio station, just one lick it's almost instant on, but Media Player forces you to go to radio web site to play, what a hassle!

    Posted in  | no comments

    My Prius runs at 48 MPG

    Posted by btr Fri, 27 Feb 2004 04:45:55 GMT

    My best record so far is 48MPG since last fill up. As the weather warms up, I am looking to reach my goal of 50MPG. I'm not sure if it's possible to reach even higher than 50MPG since A/C may decrease MPG considerably. Here's a URL to PirusOnline.com.

    Posted in  | no comments

    Older posts: 1 ... 3 4 5 6 7 8

    Market News And Commentaries
    Updated at Tue Dec 20 01:25:02 -0500 2011
    Volcker conundrums fuel confusion over rules

    As they finalise the ban on proprietary trading, regulators must ensure the proposal does not curb trading activity too much, says Tom Braithwaite more

    Source: Financial Times - Comment
    Stocks sell off as banks tank

    U.S. stocks closed sharply lower Monday as bank shares took a beating amid fresh concerns about the debt crisis in Europe. more

    Source: Business and financial news - CNNMoney.com
    During the first part of 2012, markets will be dominated by “risk off” as Europe’s sovereign-debt crisis prompts higher demand for safety, says Mohamed El-Erian. Right now, the continent is being buffeted by challenges on three separate fronts: economically, politically, and socially. It's clear that the ECB wants to see change from its national governments first, El Erian says, so next year will be characterized by de-levering, de-globalization and policy inconsistencies. (video)

    During the first part of 2012, markets will be dominated by “risk off” as Europe’s sovereign-debt crisis prompts higher demand for safety, says Mohamed El-Erian. Right now, the continent is being buffeted by challenges on three separate fronts: economically, politically, and social more

    Source: SeekingAlpha.com: SA Currents
    Tuesday Watch

    more

    Source: BETWEEN THE HEDGES
    Investors cautious on North Korea uncertainty

    Asian markets rebound from Monday’s steep losses following the death of Kim Jong-il more

    Source: Asia Pacific Equities Market Data - FT.com
    Futures Movers: Crude futures edge up, but stay below $95

    Crude-oil futures nudged higher in electronic trading Tuesday, consolidating on an overnight rebound, as Asian stock markets and U.S. index futures advanced. more

    Source: MarketWatch.com - Top Stories
    Stocks End on a Low Note

    Banks led U.S. stocks lower, sagging under the weight of another batch of worrisome headlines from Europe and fresh expectations for tighter capital standards. more

    Source: WSJ.com: Markets
    Groupon (GRPN) Files For IPO As Another Tech Bubble Looms

    The IPO market is really beginning to catch fire with the tech industry partying like it’s 1999.  The party lights glowed and the DJ began spinning the beats before the LinkedIn (LNKD) IPO a couple weeks ago and the party will continue reaching a feverish pitch with a Groupon (GRPN) IPO.  more

    Source: SelfInvestors | ETFs, IPOs & Breakout Stocks
    Links for 2011-09-27 [del.icio.us]

    more

    Source: Maoxian
    Foreclosures: Next shoe to drop for banks?

    Bank stocks have been shellacked lately as investors worry about what impact the foreclosure scandal will have on the results for the nation's largest financial institutions. more

    Source: Market, personal finance, media, and technology expert commentary - CNNMoney.com
    How To Maintain An Optimal State

    No matter what the market conditions may be, especially in weeks like this, it is very good idea to do everything you can to stick to the normal trading routine. While none of us can control what the markets do, we can control what we do everyday to be in the right place at the [...] more

    Source: The Kirk Report
    Out of the Money Calendar Spreads

    This is a guest post by Derek Devore, an experienced options trader. Find out more about his OptionBoost Video Training Program at http://optionboost.com One of my favorite structures when I’m evaluating a position which is slow moving, but is on its way to reaching a particular price point, i more

    Source: StockTickr Trading Journal Blog
    December 19th, 2011 Stock Market Analysis

    Today's key headlines: North Korea's Kim Jong II dies of heart attack, Bank of America falls under $5 for the first time in three years, ATT gives up on its $39 Billion bid to acquire T-Mobile.Original post: December 19th, 2011 Stock Market Analysis more

    Source: Stock Trading To Go