<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Stealth Startup Blog</title>
	<atom:link href="http://www.stealthstartupblog.com/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.stealthstartupblog.com</link>
	<description>Watch and See a New Web 2.0 Company Born</description>
	<lastBuildDate>Sat, 23 Jan 2010 05:07:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Voice &amp; Video Streaming, Whiteboard and Desktop Sharing Available in Openfire</title>
		<link>http://www.stealthstartupblog.com/?p=123</link>
		<comments>http://www.stealthstartupblog.com/?p=123#comments</comments>
		<pubDate>Thu, 21 Jan 2010 19:16:46 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=123</guid>
		<description><![CDATA[<p>Installing Red5 plugin to my Openfire server and enabling it was a breeze using the Openfire  web control console.</p>
<p>Now, I am reading about Real Time Messaging Protocol, and ActiveX controls to embed Flash Media into .Net forms (axShockwaveFlash COM component that you can add to toolbox in Visual Studio).</p>
<p>The Jingle implementation that exists in Spark [...]]]></description>
			<content:encoded><![CDATA[<p>Installing Red5 plugin to my Openfire server and enabling it was a breeze using the Openfire  web control console.</p>
<p>Now, I am reading about <a href="http://en.wikipedia.org/wiki/RTMPS">Real Time Messaging Protocol</a>, and ActiveX controls to embed Flash Media into .Net forms (axShockwaveFlash COM component that you can add to toolbox in Visual Studio).</p>
<p>The Jingle implementation that exists in Spark supports voice chat without Flash. At least I can port that to my C# forms client implementation. However there seems to be a long delay. It may be due to my underpowered test server and hopefully improved when I start using our real server. If the delay is due to bandwidth, using better codecs to compress might solve the problem.</p>
<p>I have found out that ffmpeg supports flv and swf, and there are ways to use ffmpeg inside .net: <a href="http://forums.asp.net/t/1152700.aspx">calling ffmpeg.exe</a>, using ActiveX control, external ActionScript API for C# (tutorial uses an instant messaging application, so should be useful)<br />
<a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cb0.html">http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b90204-7cb0.html</a>, <a href="http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b8fc4e-8000.html">http://help.adobe.com/en_US/ActionScript/3.0_ProgrammingAS3/WS5b3ccc516d4fbf351e63e3d118a9b8fc4e-8000.html</a> [<a href="http://help.adobe.com/support/documentation/en/flash/10/Flash_ActionScript3.0_samples_CS4.zip">Code and Samples</a>]</p>
<p>Resources:<br />
Compiling Spark for Dummies:<br />
<a href="http://www.igniterealtime.org/community/docs/DOC-1521">http://www.igniterealtime.org/community/docs/DOC-1521</a></p>
<p>Spark client secure audio/video with Red5 plugin:<br />
<a href="http://www.igniterealtime.org/community/docs/DOC-1633">http://www.igniterealtime.org/community/docs/DOC-1633</a></p>
<p>Red5 Plugin Readme:<br />
<a href="http://www.igniterealtime.org/community/docs/DOC-1518"> http://www.igniterealtime.org/community/docs/DOC-1518</a></p>
<p>Red5 Linux Setup:<br />
<a href="http://www.igniterealtime.org/community/docs/DOC-1520"> http://www.igniterealtime.org/community/docs/DOC-1520</a></p>
<p>Simple C# and Flash interop:<br />
<a href="http://bojordan.com/log/?p=269">http://bojordan.com/log/?p=269</a></p>
<p>Note:</p>
<p>Need to check <a href="http://msdn.microsoft.com/en-us/library/dd375454(VS.85).aspx">DirectShow</a> [or <a href="http://msdn.microsoft.com/en-us/library/ms783323(VS.85).aspx">this</a>? which is latest documentation] and <a href="http://www.opensourcemediaframework.com/">OSMF</a> [<a href="http://www.adobe.com/devnet/flash/articles/video_osmf_streaming.html">tutorial</a>] as well.</p>
<p><a href="http://f-in-box.com/dotnet/order.html">F-IN-BOX</a> is a developer&#8217;s library (for <strong>$300</strong>) to enhance Macromedia Flash Player ActiveX features. It does not use its own engine to display movies but provide a wrapper around official swflash.ocx/flash.ocx code instead. Thus it is possible to avoid certain Macromedia Flash Player ActiveX limitations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=123</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Media Streaming Struggles</title>
		<link>http://www.stealthstartupblog.com/?p=118</link>
		<comments>http://www.stealthstartupblog.com/?p=118#comments</comments>
		<pubDate>Wed, 20 Jan 2010 16:37:58 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Chat Server]]></category>
		<category><![CDATA[Media Streaming]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=118</guid>
		<description><![CDATA[<p>Finally, I have our chat server (openfire by JiveSoftware) running, my client connecting to it successfully (using jabber-net C# implementation of an XMPP API). Now I need to figure out how to stream video and audio.</p>
<p>XMPP has Jingle extension for negotiating streaming parameters (format, ports etc.). However, I haven&#8217;t found a .Net implementation. I have [...]]]></description>
			<content:encoded><![CDATA[<p>Finally, I have our chat server (openfire by JiveSoftware) running, my client connecting to it successfully (using jabber-net C# implementation of an XMPP API). Now I need to figure out how to stream video and audio.</p>
<p>XMPP has Jingle extension for negotiating streaming parameters (format, ports etc.). However, I haven&#8217;t found a .Net implementation. I have used JiveSoftware&#8217;s Spark client to connect to my server and had a successful voice chat which means Spark has implementation of Jingle. However Spark is implemented in Java, while I had implemented my client in C#. Now the question is to port my client to Java or to extract and port their Jingle library to C#&#8230;</p>
<p>Another good news is Openfire supports Flash Video and Audio streaming via a plugin implementing Adobe Flash Media Server (through reverse engineering) called red5. This might come handy when I want to support video as well.</p>
<p>Jingle only negotiates the stream parameters. I have to work on what I can use for compressing and decompressing media. Jingle doesn&#8217;t handle such things. Microsoft has a DirectShow API to perform various operations with media files or streams. (Media Foundation is replacing it, but Wikipedia says it won&#8217;t support <a href="http://en.wikipedia.org/wiki/Usage_share_of_operating_systems">Windows XP, which is still has around %60 of the OS market share</a>.)</p>
<p>So currently I am researching about DirectShow and Flash based Media streaming APIs to incorporate into my client.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=118</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Get the Name of an Object&#8217;s Type (Class) in C#</title>
		<link>http://www.stealthstartupblog.com/?p=114</link>
		<comments>http://www.stealthstartupblog.com/?p=114#comments</comments>
		<pubDate>Sun, 10 Jan 2010 16:54:10 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[C# Programming]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=114</guid>
		<description><![CDATA[<p>string name = instanceVariable.GetType().Name;</p>
]]></description>
			<content:encoded><![CDATA[<p>string name = instanceVariable.GetType().Name;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=114</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;Indexed Properties&#8221; of a Class in C#</title>
		<link>http://www.stealthstartupblog.com/?p=105</link>
		<comments>http://www.stealthstartupblog.com/?p=105#comments</comments>
		<pubDate>Sat, 09 Jan 2010 22:31:06 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[C# Programming]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=105</guid>
		<description><![CDATA[<p>In Jabber-net library, which I am using for my client, I saw this piece of code, which basically stores an array of type-unsafe properties. It is a useful idiom to have in mind for C# developers.</p>
<p>/// &#60;summary&#62;</p>
<p>/// Sets or retrieves a connection property.</p>
<p>/// You have to know the type of the property based on the [...]]]></description>
			<content:encoded><![CDATA[<p>In Jabber-net library, which I am using for my client, I saw this piece of code, which basically stores an<strong> array of type-unsafe properties</strong>. It is a useful idiom to have in mind for C# developers.</p>
<p>/// &lt;summary&gt;</p>
<p>/// Sets or retrieves a connection property.</p>
<p>/// You have to know the type of the property based on the name.</p>
<p>/// For example, PORT is an integer.</p>
<p>/// &lt;/summary&gt;</p>
<p>/// &lt;param name=&#8221;prop&#8221;&gt;The property to get or set.&lt;/param&gt;</p>
<p>/// &lt;returns&gt;&lt;/returns&gt;</p>
<p>public object this[string prop]</p>
<p>{</p>
<p>get</p>
<p>{</p>
<p>if (!m_properties.Contains(prop))</p>
<p>return null;</p>
<p>return m_properties[prop];</p>
<p>}</p>
<p>set</p>
<p>{</p>
<p>m_properties[prop] = value;</p>
<p>if (PropertyChanged != null)</p>
<p>{</p>
<p>PropertyChanged(this, new PropertyChangedEventArgs(prop));</p>
<p>}</p>
<p>}</p>
<p>}</p>
<p>_________________________________</p>
<p>Used in this way (if stream is of this class):</p>
<p>stream[(string)parent.Tag] = GetControlValue(parent);</p>
<p>References:</p>
<p>While reading more about this, I learned it is called &#8220;Indexed Properties&#8221;.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa288464(VS.71).aspx">http://msdn.microsoft.com/en-us/library/aa288464(VS.71).aspx</a></p>
<p>For preliminary on Indexers (like operator [] in C++):</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa288465(VS.71).aspx">http://msdn.microsoft.com/en-us/library/aa288465(VS.71).aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=105</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>XML Configuration File for .Net Projects</title>
		<link>http://www.stealthstartupblog.com/?p=102</link>
		<comments>http://www.stealthstartupblog.com/?p=102#comments</comments>
		<pubDate>Sat, 09 Jan 2010 22:07:28 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[C# Programming]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=102</guid>
		<description><![CDATA[<p>ConfigurationManager class is used to load settings from an XML file at the start of an application. Usually people edit it outside the application (manually with a text editor), however, it is possible to change configuration inside the program:</p>
<p>http://blog.sb2.fr/post/2008/11/29/HowTo-Modify-Configuration-File-Programmatically-with-C.aspx</p>
<p>The Jabber-Net library uses this function to update its configuration file instead:</p>
<p>/// &#60;summary&#62;</p>
<p>/// Write the current connection [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager(VS.80).aspx">ConfigurationManager</a> class is used to load settings from an XML file at the start of an application. Usually people edit it outside the application (manually with a text editor), however, it is possible to change configuration inside the program:</p>
<p><a href="http://blog.sb2.fr/post/2008/11/29/HowTo-Modify-Configuration-File-Programmatically-with-C.aspx">http://blog.sb2.fr/post/2008/11/29/HowTo-Modify-Configuration-File-Programmatically-with-C.aspx</a></p>
<p>The Jabber-Net library uses this function to update its configuration file instead:</p>
<p>/// &lt;summary&gt;</p>
<p>/// Write the current connection properties to an XML config file.</p>
<p>/// TODO: Replace this with a better ConfigFile implementation that can write.</p>
<p>/// &lt;/summary&gt;</p>
<p>/// &lt;param name=&#8221;file&#8221;&gt;&lt;/param&gt;</p>
<p>public void WriteToFile(string file)</p>
<p>{</p>
<p>XmlDocument doc = new XmlDocument();</p>
<p>string name = &#8220;JabberClient&#8221;;</p>
<p>if (m_xmpp != null)</p>
<p>name = m_xmpp.GetType().Name;</p>
<p>XmlElement root = (XmlElement)doc.CreateElement(name);</p>
<p>doc.AppendChild(root);</p>
<p>WriteElem(root, this);</p>
<p>foreach (DictionaryEntry ent in m_extra)</p>
<p>{</p>
<p>root.AppendChild(doc.CreateElement((string)ent.Key)).InnerText = ent.Value.ToString();</p>
<p>}</p>
<p>XmlTextWriter xw = new XmlTextWriter(file, System.Text.Encoding.UTF8);</p>
<p>xw.Formatting = Formatting.Indented;</p>
<p>doc.WriteContentTo(xw);</p>
<p>xw.Close();</p>
<p>}</p>
<p>More:</p>
<p>More advanced configuration library: <a href="http://www.codeproject.com/KB/cs/SysConfiguration.aspx">http://www.codeproject.com/KB/cs/SysConfiguration.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=102</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Promise of Open Source for our Project</title>
		<link>http://www.stealthstartupblog.com/?p=79</link>
		<comments>http://www.stealthstartupblog.com/?p=79#comments</comments>
		<pubDate>Thu, 10 Sep 2009 19:00:17 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=79</guid>
		<description><![CDATA[<p>The XMPP protocol has many implementations in many projects, sometimes together with other protocols. Which implementation is the best to build up on.  Among c open source implementations listed, jabberd14 and jabberd2, latter seems to be more recent, more widely adopted, and hence have better community support,  so I played with jabberd2 for a while. Then [...]]]></description>
			<content:encoded><![CDATA[<p>The XMPP protocol has many implementations in many projects, sometimes together with other protocols. Which implementation is the best to build up on.  Among <a href="http://en.wikipedia.org/wiki/List_of_XMPP_server_software">c open source implementations listed</a>, jabberd14 and jabberd2, latter seems to be more recent, more widely adopted, and hence have better community support,  so I played with <a title="jabberd2" href="http://en.wikipedia.org/wiki/Jabberd2">jabberd2</a> for a while. Then I also looked at Java implementations. <a href="http://www.igniterealtime.org/projects/openfire/">Openfire</a> seems to be more complete than <a href="http://tigase.org">Tigase</a>. It also has a company behind it, rather than a single developer. So currently I am using Openfire.</p>
<p>On the client side development I plan to continue implementing from scratch. Because client program is to be distributed to users and except LGPL opensource, using an open source code would require me to open my source as I had <a title="Brief info about some Open Source Licences" href="?p=82">mentioned here</a>. Still, when I am stuck about solving an issue, I can check how they had solved it in one of the open source clients. A well established XMPP client project is: <a title="Empathy Wikipedia Entry" href="http://en.wikipedia.org/wiki/Empathy_(software)">Empathy</a> but it is targeting Linux where as we target customers on Windows initially . LGPL is more common among softare libraries, and there are a few <a href="http://en.wikipedia.org/wiki/List_of_XMPP_library_software">XMPP libraries</a> with LGPL, I initially considered the only C++ one, <a href="http://code.google.com/p/qxmpp/">QXMPP</a>, but now I am using <a href="http://code.google.com/p/jabber-net/">jabber-net</a> and ported my C++/CLI client code to C# as well since utilizing examples for this C# library was easier when I coded in C# as well.</p>
<p><a href="http://code.google.com/apis/talk/libjingle/index.html">libjingle</a> is a library implementing a useful extention of XMPP protocol, named <a href="http://xmpp.org/extensions/xep-0166.html">jingle</a>. Jingle is for initiating and managing peer-to-peer media sessions between two XMPP entities to be used for a wide variety of application types (e.g., voice chat, video chat, file transfer). Luckily, libjingle is made available under a <a style="color: #0000cc;" href="http://code.google.com/apis/talk/libjingle/license.html">Berkeley-style license</a>, which means you are free to incorporate it into commercial software. Using libjingle, I won&#8217;t waste time on the obstacles I would face, like reverse NAT traversal problem I had faced with my own client. As an example, (as described <a href="http://code.google.com/apis/talk/libjingle/important_concepts.html">here</a>) libjingle already implements STUN to solve this problem.</p>
<p>Resources:</p>
<p><a href="http://en.wikipedia.org/wiki/Comparison_of_instant_messaging_protocols">Comparison of XMPP and other IM Protocols</a></p>
<p>jabberd2 <a title="jabberd2" href="http://codex.xiaoka.com/wiki/jabberd2:start">home page</a>.</p>
<p><a title="Developer Documentation" href="http://codex.xiaoka.com/wiki/jabberd2:development">Developer documentation</a> for jabberd2.</p>
<p>jabberd2 <a href="http://jabberd2.xiaoka.com/wiki/InstallGuide">install guide</a>.</p>
<p>jabberd2 <a href="http://jabberd2.xiaoka.com/wiki/InstallGuide/Jabberd2Architecture">architecture doc</a>. Especially required database tables given at the end.</p>
<p>precompiled <a href="http://www.nanoant.com/projects/jabberd2-win32">windows binaries</a> and <a href="http://download.opensuse.org/repositories/server:/messaging/openSUSE_11.1/i586/jabberd-2.2.8-7.1.i586.rpm">suse rpms</a>.</p>
<p>All server implementations <a href="http://xmpp.org/software/servers.shtml">list</a> from official website.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=79</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Brief info about some Open Source Licences</title>
		<link>http://www.stealthstartupblog.com/?p=82</link>
		<comments>http://www.stealthstartupblog.com/?p=82#comments</comments>
		<pubDate>Thu, 10 Sep 2009 18:21:54 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=82</guid>
		<description><![CDATA[<p>I was initially thinking I would have to make my program open source if I was using GPL source. GPL requires you to make your source code available only if you are distributing your program. This is a loop-hole benefitting people developing server software for their own use. This loophole is later filled by AGPL, [...]]]></description>
			<content:encoded><![CDATA[<p>I was initially thinking I would have to make my program open source if I was using GPL source. GPL requires you to make your source code available only if you are distributing your program. This is a loop-hole benefitting people developing server software for their own use. This loophole is later filled by <a title="AGPL" href="http://en.wikipedia.org/wiki/Affero_General_Public_License">AGPL</a>, but most software still uses GPL, including XMPP servers I am inquiring about. So I can develop our server on top of open source projects. I would gladly send them patches when I make improvements to their code. I only like not being forced to open all of my source since this might cause security flaws in my code to be detected by hackers.</p>
<p>There is also <a title="LGPL" href="http://en.wikipedia.org/wiki/LGPL">LGPL</a>, which allows proprietary code to be built upon open code even if you are distributing your program to users. This licence is much less commonly used.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=82</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Standard Protocols, Libraries and APIs for Instant Messaging</title>
		<link>http://www.stealthstartupblog.com/?p=69</link>
		<comments>http://www.stealthstartupblog.com/?p=69#comments</comments>
		<pubDate>Wed, 26 Aug 2009 17:45:16 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=69</guid>
		<description><![CDATA[<p>I will be reading RFCs from IETF standardization committee to learn about the XMPP protocol. However there are preceding protocols to read about. For a few days you will be seeing short summaries from those protocols I will read. Later you may see some info about open source implementations of XMPP.</p>
]]></description>
			<content:encoded><![CDATA[<p>I will be reading RFCs from IETF standardization committee to learn about the XMPP protocol. However there are preceding protocols to read about. For a few days you will be seeing short summaries from those protocols I will read. Later you may see some info about open source implementations of XMPP.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=69</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter explosion a bubble (that will burst)?</title>
		<link>http://www.stealthstartupblog.com/?p=67</link>
		<comments>http://www.stealthstartupblog.com/?p=67#comments</comments>
		<pubDate>Thu, 07 May 2009 17:41:41 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=67</guid>
		<description><![CDATA[<p>Today I received two articles on research about twitter&#8217;s success from Karalyn through Bilumni group.</p>
<p>One study found that &#8220;more than 60 percent stopped using the free site a month after joining&#8221;, and the other article was mentioning exactly my question when I first saw a few status posts on Facebook  &#8220;Why would they want to [...]]]></description>
			<content:encoded><![CDATA[<p>Today I received two articles on research about twitter&#8217;s success from <a href="http://www.linkedin.com/in/karalyn">Karalyn</a> through <a href="http://www.linkedin.com/groups?home=&amp;gid=78154&amp;trk=anet_ug_hm">Bilumni group</a>.</p>
<p><a href="http://www.linkedin.com/news?viewArticle=&amp;articleID=34227420&amp;gid=78154&amp;srchCat=CMPY&amp;articleURL=http%3A%2F%2Fwww%2Emsnbc%2Emsn%2Ecom%2Fid%2F30475377%2F&amp;urlhash=DpDf&amp;trk=news_discuss">One study</a> found that &#8220;more than 60 percent stopped using the free site a month after joining&#8221;, and the <a href="http://www.omniblogs.net/putting-twitter-world-to-use">other article</a> was mentioning exactly my question when I first saw a few status posts on Facebook  &#8220;Why would they want to read short messages about what someone ate for breakfast?&#8221; and cites uses by marketing people as alternative use for twitter. I have been using twitter for a month now, and 8 out of 10 people who added me to their &#8220;follow&#8221; list were in fact marketers trying to grab my attention to their tweets.</p>
<p><a href="http://www.msnbc.msn.com/id/30032294/">Another article</a> points to fake celebrities on twitter and tells even <a href="http://twitter.com/god">god</a> has a twitter account!</p>
<p>I think these are all negative prospects for twitter&#8217;s future. I felt the idea is doomed for failure when I had first heard about it considering its usefulness for readers, but push by marketing people may keep it alive. Time will tell&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=67</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes about C++/CLI syntax</title>
		<link>http://www.stealthstartupblog.com/?p=51</link>
		<comments>http://www.stealthstartupblog.com/?p=51#comments</comments>
		<pubDate>Wed, 25 Mar 2009 14:17:15 +0000</pubDate>
		<dc:creator>DrOzgur</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.stealthstartupblog.com/?p=51</guid>
		<description><![CDATA[<p>Pointers vs Handles vs Native Types
^ similar to *
% similar to &#38;</p>
N* pn = new N; // allocate on native heap
N&#38; rn = *pn; // bind ordinary reference to native object
R% rr = *hr; // bind tracking reference to gc-lvalueR^ hr = gcnew R; // allocate on CLI heap
<p>Boxing, Unboxing:</p>
<p>Boxing implicit. </p>
<p> </p>
<p>Unboxing explicit: need [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Pointers vs Handles vs Native Types<br />
</strong>^ similar to *<br />
% similar to &amp;</p>
<pre>N* pn = new N; // allocate on native heap
N&amp; rn = *pn; // bind ordinary reference to native object
R% rr = *hr; // bind tracking reference to gc-lvalueR^ hr = gcnew R; // allocate on CLI heap</pre>
<p><a href="http://en.wikipedia.org/wiki/Common_Type_System#Boxing_and_unboxing"><strong>Boxing, Unboxing</strong></a><strong>:</p>
<p>Boxing implicit. </strong></p>
<p><strong> </strong></p>
<p><strong>Unboxing explicit: need a reinterpret_cast and then dereference.</strong></p>
<pre id="ctl00_mainContentContainer_ctl10" class="libCScode">int i = 1024;
int^ boxedi = i;          //Implicit boxing, boxedi doesn’t point to i;
         // A bit-wise copy is performed          // an int Object is created on the CLR heap         //Can use safe_cast&lt;int^&gt;(i) to explicitly castObject^ o = i; //Another implicit boxing
int k = *safe_cast&lt;int^&gt;(o); //unboxing

//Type-safe: When you box a value-type, // the returned object remembers the original value type.//reinterpret_cast could be used, safe_cast is better// to create safe code (to compile with /clr:safe) Console::WriteLine(o-&gt;GetType()); //same with typeid&lt;o&gt;?// Output:
// System.Int32//Can not cast to a different type!

float g = *reinterpret_cast&lt;float^&gt;(o);     //System.InvalidCastException</pre>
<pre id="ctl00_mainContentContainer_ctl10" class="libCScode">     // Cap or handle (^) denotes managed object reference     //  (.NET reference types)     //  (instead of *).     // Delete optional,      //  Garbage Collector will handle.     // These don't have a fixed memory address      //  they will be moved around during execution     // Type-safe (you cannot cast a handle to a void^)</pre>
<p><strong>Class (and struct) declarations :</strong></p>
<pre id="ctl00_mainContentContainer_ctl07" class="libCScode">class native {}; //Following create CLI types
value class V {};     // “value” =&gt; stack types beyond primitive types    // all value types derive from System::ValueType
ref class R {};     // “ref” =&gt;  managed class, instantiated with R^
interface class I {};</pre>
<p><strong>native enum &amp; cli class enum:</strong></p>
<pre id="ctl00_mainContentContainer_ctl08" class="libCScode">enum native_Enum { fail, pass };enum class cli_Enum: char { fail, pass}; public enum class cli_SomeColors { Red, Yellow, Blue};</pre>
<p><strong>Arrays</strong></p>
<pre id="ctl00_mainContentContainer_ctl10" class="libCScode">array&lt;int&gt;^ ia = gcnew array&lt;int&gt;{1,1,2,3,5,8};     // gcnew retuns handle (new returns pointer)

     // same with cli::array ia = gcnew array&lt;int&gt;(10){2,5};     //creates array of size 10,      //all after first two elements initialized to 0</pre>
<p><strong>Interior Pointer</p>
<p></strong>to access to memory within objects.</p>
<p>Lets you do pointer arithmetic.</p>
<p>Dangerous feature.</p>
<p>GC keeps track of changes in memory location and updates the interior pointer unless interior pointer is used by unmanaged code!</p>
<pre>const int SIZE = 10;
array&lt;int&gt;^ a = gcnew array&lt;int&gt;(SIZE);
interior_ptr&lt;int&gt; p = &amp;a[0];
for (int i = 0; i &lt; SIZE; ++i, ++p)
   *p = i;</pre>
<p><strong>Pin Pointer</p>
<p></strong>Pins the object in memory (GC doesn’t move it around), so the pointer won’t point to invalid memory.</p>
<pre id="ctl00_mainContentContainer_ctl10" class="libCScode">value struct smallInt { int m_ival; ... } si;
pin_ptr&lt;int&gt; ppi = &amp;si.m_ival;   // assign nullptr to pin pointer after its use is over   // so that GC knows it can now move the object around</pre>
<p><strong>Iterating Managed Arrays</strong></p>
<pre id="ctl00_mainContentContainer_ctl10" class="libCScode">//For each to iterate, but//Length attribute and the index also available for each (int v in a)
{
  Console::WriteLine("value={0}", v);
}</pre>
<p><strong>3D Array Creation</strong></p>
<pre>//All cells are initialized to 0 automaticallyarray&lt;int, 3&gt; ^threed = gcnew array&lt;int, 3&gt;(4,5,2);
Console::WriteLine(threed[0,0,0]);</pre>
<p><strong>Another example for handles</strong></p>
<pre>//This shows a window using WPFApplication().Run(%Window()); // % for referencing 

//===== equivalent toWindow w;
Application().Run(%w);//===== equivalent toWindow ^w = gcnew Window();
Application().Run(w); // no need to reference, pass handle//===== equivalent toWindow ^w = gcnew Window();
Application ^a1 = gcnew Application();
a1-&gt;Run(w);//===== equivalent toWindow ^w = gcnew Window();
Application ^a1 = gcnew Application();
a1-&gt;Run(w); // similar to pointer handles use -&gt;//===== equivalent toApplication ^a1 = gcnew Application();
Application %a2 = *a1;//like pointers, dereferencing via *
a2.Run(w);</pre>
<p><strong>Array of strings and using Tracking reference </strong>&#8220;^%&#8221; <strong>to iterate</strong>:</p>
<p>similar to &#8220;*&amp;&#8221; (reference to a pointer) in Standard C++</p>
<pre>array&lt;String^&gt;^ arr = gcnew array&lt;String^&gt;(10);
int i = 0;

for each(String^% s in arr)     s = i++.ToString();    //redundant: s = gcnew String( (i++).ToString() );</pre>
<p><strong>New parameter for main function</strong></p>
<pre>#using &lt;mscorlib.dll&gt;     //you don’t have to include this anymore    //automatically included whenever u compile with /clr
using namespace System;

int main(array&lt;System::String ^&gt; ^args)
{
  System::Console::WriteLine("Hello world");
  return 0;
}</pre>
<p><strong>Finalizer vs Deterministic Destructor</p>
<p></strong>Non-managed resources must be Deterministically destroyed.</p>
<p>Deterministic destruction recommended for system-wide limited resources (network/database connections, file streams, etc.).</p>
<p>Even with deterministic destructor also create a finalizer (GC-destructor) that just checks whether the destructor has been invoked and calls it if it hasn&#8217;t.</p>
<pre>// C++/CLI
ref class MyClass // : IDisposable (added by the compiler)
{
public:
    MyClass();  // constructor
    ~MyClass(); // (deterministic) destructor          // turned into IDisposable.Dispose() by compiler         // corresponds to Dispose() in C#
protected:
    !MyClass(); // finalizer           // corresponds to ~MyClass() in C#
public:
    static void Test()
    {
        MyClass automatic;           //compiler calls constructor here automatically          //will be destroyed by compiler when out of scope

        // Equivalent user code:
        MyClass^ user = gcnew MyClass();
        try { /* Use user here */ }         finally { delete user; }

        // Compiler calls automatic's destructor in the         // finally of a try containing the whole method
    }
};</pre>
<p><strong>Restricting what kind of classes can be used for template type(s):</strong></p>
<pre>generic&lt;class T&gt; where T : IDisposable
ref class DisposableType
{
   T t;
public:
   DisposableType(T param) {t=param;}
   void Close()
   {
      t-&gt;Dispose();      //since there is constraint on what T can be      // no need to cast t to use IDisposable methods
   }
};</pre>
<p>Constraints also possible for generic methods:</p>
<pre>interface class IPrintable
{
   void Print();
};
ref class Printer
{
public:
   generic&lt;class T&gt; where T : IPrintable
   void PrintDoc(T doc)
   {
      doc-&gt;Print(); //no need to cast doc
   }
};</pre>
<p><strong>Properties</strong></p>
<pre>// LibCLI.h
#pragma once
using namespace System;

namespace LibCLI {
public ref class Person
    {
    private:
       String^ _name;

    public:
        // The constructor.         // there is no _age, only property Age!         // see last line
        Person( String^ name, int age )
        {
            Name  = name;
            Age   = age;
        }</pre>
<pre>        // property for the member _name
        property String^ Name
        {
            String^ get()
            {
                return _name;
            }

            void set(String^ name)
            {
                _name = name;
            }
        }

        // A trivial property. No need to define
        // the getter and setter, compiler does it for you.
        property int Age;
    };
}</pre>
<p><strong>Operator overloading</p>
<p></strong>static for handles<strong>; </strong>casting to Object^ will remove the overloading semantics</p>
<pre>{   String ^s1 = "abc";
   String ^s2 = "ab" + "c";
   Object ^o1 = s1;
   Object ^o2 = s2;
   s1 == s2; // true
   o1 == o2; // false}</pre>
<p><strong>Parameter Array</strong></p>
<pre>void avg(String ^msg, ... array&lt;int&gt; ^values)
{ // “...” denotes parameter array,   // used to be [ParamArray]attribute before
  int tot = 0;
  for each (int v in values)
    tot += v;
  Console::WriteLine("{0} {1}", msg, tot / values-&gt;Length);
}

int main(array&lt;String ^&gt; ^args)
{
  avg("The avg is:", 1,2,3,4,5);
  return 0;
}</pre>
<p><strong>Wrapping your C++ classes:</p>
<p></strong>provides deterministic finalization of garbage- collected types. Ex: Wrapping class named Native</p>
<pre>ref class Wrapper {
    Native *pn;
public:
    // resource acquisition is initialization
    Wrapper( int val ) { pn = new Native( val ); } 

    // this will do our disposition of the native memory
    ~Wrapper(){ delete pn; }

    void mfunc();
protected:

    // an explicit Finalize() method—as a failsafe
    !Wrapper() { delete pn; }
};

void f1()
{
   // normal treatment of a reference type
   Wrapper^ w1 = gcnew Wrapper( 1024 );

   // mapping a reference type to a lifetime
   Wrapper w2( 2048 ); // no ^ token !

   // just illustrating a semantic difference
   w1-&gt;mfunc();
   w2.mfunc();

   // w2 is disposed of here automatically
}

//
// ... later, w1 may be finalized at some point</pre>
<p><strong>Another more complete wrapper template ref class with operator overloading, copy constructor and assignment operator</strong></p>
<pre>template &lt;typename T&gt;
 public ref class ptr_wrapper sealed
 {
 private:
 	T *m_ptr;
 	ptr_wrapper(T *i_ptr)
 	:m_ptr(i_ptr)
 	{
 		if (i_ptr == 0)
 		{
			throw gcnew System::Exception(				"Trying to initialize				ptr_wrapper with null pointer");
 		}
 	}
 public:
 	ptr_wrapper(const T &amp;i_ref)
 		:m_ptr(new T(i_ref))
 	{
 	}
 	ptr_wrapper(const ptr_wrapper %i_other)
 		:m_ptr(new T(const_cast&lt;const T&amp;&gt;(*i_other)))
 	{
 	}
 	static ptr_wrapper take(T *i_ptr)
 	{
 		return ptr_wrapper(i_ptr);
 	}
 	~ptr_wrapper()
 	{
 		delete m_ptr;
 	}
 	ptr_wrapper % operator = (const ptr_wrapper %other)
 	{
 		if (other.m_ptr != m_ptr)
 		{
 			T* new_ptr = new T(*other);
 			delete m_ptr;
 			m_ptr = new_ptr;
 		}
 	}
 	static T&amp; operator * (ptr_wrapper&lt;T&gt; %inst)
 	{
 		return *(inst.m_ptr);
 	}
 	static const T&amp; operator * (const ptr_wrapper %inst)
 	{
 		return *(inst.m_ptr);
 	}
 	static T* operator -&gt; (ptr_wrapper %inst)
 	{
 		return inst.m_ptr;
 	}
 	static const T* operator -&gt; (const ptr_wrapper&lt;T&gt; %inst)
 	{
 		return inst.m_ptr;
 	}
 };</pre>
<p><strong>Command line building</strong></p>
<p># run the script to set up environment</p>
<p># use with quotes!</p>
<p># path assumes VS 2008 (i.e 9.0) installed</p>
<p>”C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\vsvars32.bat”</p>
<p># then compile</p>
<p>cl your_file.cpp /clr</p>
<h4>Glossary</h4>
<p><strong>Garbage Collector (<a href="http://en.wikipedia.org/wiki/Garbage_collection_(computer_science)">GC</a>)</strong>:  reclaims garbage, or memory used by objects that will never be accessed or mutated again by the application.</p>
<p><strong>Common Language Infrastructure (<a href="http://en.wikipedia.org/wiki/Common_Language_Infrastructure">CLI</a>)</strong>: It is an open specification that defines a runtime environment that allows multiple high-level languages to be used on different computer platforms without being rewritten for specific architectures. [<a href="http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-372.pdf">Specification</a>]</p>
<p><strong>Common Type System (<a href="http://en.wikipedia.org/wiki/Common_Type_System">CTS</a>)</strong>: a standard that specifies how Type definitions and specific values of Types are represented in computer memory, so programs in different programming languages can easily share information.</p>
<p><strong>Base Class Library (</strong><a href="http://en.wikipedia.org/wiki/Base_Class_Library"><strong>BCL</strong></a><strong>)</strong>: a standard library available to all languages using the .NET Framework, comparable in scope to the standard libraries of Java.</p>
<p><strong>Framework Class Library (</strong><a href="http://en.wikipedia.org/wiki/Framework_Class_Library"><strong>FCL</strong></a><strong>)</strong>: a collection of thousands of reusable classes, interfaces and value types, within hundreds of namespaces. <a href="http://en.wikipedia.org/wiki/Base_Class_Library">BCL</a> is a part of FCL and provide the most fundamental functionality. [<a href="http://download.microsoft.com/download/4/a/3/4a3c7c55-84ab-4588-84a4-f96424a7d82d/NET35_Namespaces_Poster_LORES.pdf">Namespaces Poster</a>]</p>
<p>[<a href="http://msdn.microsoft.com/en-us/library/ms229335.aspx">Class Libraries for .Net 3.5</a>]</p>
<p><strong>Windows Presentation Foundation (<a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation">WPF</a>)</strong>:graphical subsystem in .NET Framework 3.0, which uses <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a> markup language, for rich user interface development. <a href="http://en.wikipedia.org/wiki/Microsoft_Expression_Blend">Microsoft Expression Blend</a> is a designer tool that generates <a href="http://en.wikipedia.org/wiki/Extensible_Application_Markup_Language">XAML</a> that may be exported into other tools.</p>
<p>[<a href="http://msdn.microsoft.com/en-us/library/bb546194.aspx">MSDN section</a>]</p>
<p><strong>managed classes</strong>: objects are under .NET automatic garbage collection (vs objects the programmer must remember to explicitly destroy)</p>
<p><strong>value type</strong> (vs reference type): a data type that directly contain their data (rather than through a reference or pointer), allocated on the stack or allocated inline in a structure.</p>
<p><strong>reference type</strong> (vs value type): data type that can be instantiated via dynamic memory allocation.</p>
<h4>References</h4>
<p>Best Quick Articles are from The Code Project: <a href="http://www.codeproject.com/KB/mcpp/quickcppcli.aspx">Quick C++/CLI &#8211; Learn C++/CLI in less than 10 minutes</a> and <a href="http://www.codeproject.com/KB/mcpp/cppcliintro01.aspx">A first look at C++/CLI</a></p>
<p>Article by Stanley B. Lippman from Microsoft: <a href="http://msdn.microsoft.com/en-us/magazine/cc163681.aspx">Pure C++ Hello, C++/CLI</a></p>
<p>Article by Richard Grimes from DDJ: <a href="http://www.ddj.com/cpp/184405968#l2">New Syntax C++ in .NET Version 2</a></p>
<p>Tutorials on functionx.com [<a href="http://www.functionx.com/cppcli/index.htm">C++/CLI</a>, <a href="http://www.functionx.com/vccli/index.htm">VC/CLI</a>, also <a href="http://www.functionx.com/vcnet/index.htm">VC.NET</a>]</p>
<h4>Resources</h4>
<p>MSDN website is full of useful materials, but hard to find, here is some gems I found.</p>
<p>If you would like to teach C++:</p>
<p><a href="http://msdn.microsoft.com/en-us/beginner/cc305129.aspx">Free Ebook</a> by Herbert Schildt,</p>
<p>and other higher level C++ educational materials at MSDN Developer Learning Center: <a href="http://msdn.microsoft.com/en-us/beginner/bb308891.aspx">beginner</a>, <a href="http://msdn.microsoft.com/en-us/visualc/aa336412.aspx">all levels</a>, <a href="http://msdn.microsoft.com/en-us/visualc/default.aspx">all levels</a></p>
<p>Root for all educational materials: <a href="http://msdn.microsoft.com/en-us/aa937802.aspx">Developer Centers</a></p>
<p><a href="http://www.microsoft.com/express/download/msdn/Default.aspx">MSDN Library download</a><br />
(Full Library of 2GB is on second link)</p>
<p><a href="http://msdn.microsoft.com/en-us/goglobal/bb978454.aspx">MUI Information</a>:</p>
<p>MS Technology to support easy translation of developed applications</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stealthstartupblog.com/?feed=rss2&amp;p=51</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
