<?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>logIt &#187; Coding</title>
	<atom:link href="https://lakm.us/logit/category/coding/feed/" rel="self" type="application/rss+xml" />
	<link>https://lakm.us/logit</link>
	<description>Log Around The Clock</description>
	<lastBuildDate>Sat, 06 Jun 2015 14:17:37 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Nebri Automation for Weather Feed to Twitter</title>
		<link>https://lakm.us/logit/2015/06/nebri-automation-weather-feed-twitter/</link>
		<comments>https://lakm.us/logit/2015/06/nebri-automation-weather-feed-twitter/#comments</comments>
		<pubDate>Tue, 02 Jun 2015 14:13:39 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[job automation]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[socialmedia]]></category>
		<category><![CDATA[wearable]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=842</guid>
		<description><![CDATA[The season was intermittently rainy or dry as I began to take interest in weather. After getting stuck with “If-this-than-that” (IFTTT) for multiple location feeds of weather, I found out that I wasn&#8217;t alone, a geek hit the same wall, yet bringing another automation forgery: Nebri OS, an event-driven development platform based-on writing rules in [...]]]></description>
				<content:encoded><![CDATA[<p>The season was intermittently rainy or dry as I began to take interest in weather. After getting stuck with <a href="https://ifttt.com/" title="IFTTT" target="_blank">“If-this-than-that” (IFTTT)</a> for multiple location feeds of weather, I found out that I wasn&#8217;t alone, a geek hit the same wall, yet bringing another automation forgery: <a href="https://nebrios.com/" title="Nebri: Event-driven development platform" target="_blank">Nebri OS</a>, an event-driven development platform based-on writing rules in <a href="https://www.python.org/" title="Python" target="_blank">Python</a>. Without despise, eventually I still use IFTTT on the other end to send weather alert to my smartwatch <a href="../../../2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/" title="Get Commuter Train Trouble Alert Delivered to Watch by IFTTT" target="_blank">again</a>.</p>
<p>A quick adaptation of <a href="https://nebrios.com/blog/weather-alerts-in-multiple-locations" title="Weather Alerts In Multiple Locations" target="_blank">Nebri&#8217;s straightforward blog post</a> is to first shortlist rain related codes into <a href="https://github.com/bandono/nebri/blob/master/tweet_rain/README.md" title="README.md" target="_blank">15 of them</a> and changing from forecast to latest measurement instead. Bridging Nebri and <a href="http://www.cookoo2.com/" title="COOKOO 2" target="_blank">my smartwatch</a> are <a href="https://twitter.com/" title="Twitter" target="_blank">Twitter</a> and <a href="https://ifttt.com/recipes/296352-bogor-jakarta-rain-weather-alert" title="Bogor-Jakarta rain weather alert " target="_blank">IFTTT recipe</a>–the watch merely mirrored my phone, you don&#8217;t need it actually. Why (again) Twitter? Well, rather than the &#8220;then that&#8221; side–the watch enabler, the &#8220;if this&#8221; side of IFTTT for Twitter recipes is quite powerful given so many tweet filtering options.</p>
<p><div class="wp-caption aligncenter" style="width: 460px"><img alt="Nebri OS workflow from YWeather to Twitter" src="../../../../images/nebrios-event-driven-workflow-illustration.png" title="Nebri OS workflow from YWeather to Twitter" width="320" height="262" /><p class="wp-caption-text">Key-value pairs as trigger for event driven Nebri OS workflow</p></div><br />
<span id="more-842"></span><br />
The workflow starts with Drips, a scheduler (<code>cron</code>) where key value-pairs (KVP) is created at certain time. A rule script (<code>yweather</code>) is triggered when this KVP is created. The weather results are sets of later KVPs feeding the <code>twitter</code> rule script where our simple Nebri workflow ends. This is how I get multiple cities, by using different Drips, different events, running the same workflow. Both <code>yweather</code> and <code>twitter</code> scripts are also example of API connectivity to Nebri.</p>
<p>Many things already taken care by Nebri, hence unseasoned programmer should easily cope with writing simple Python rule and focus on the automation, nevertheless complex rule should also be accommodated. I was having trouble on using previous KVP from different PID though–moved them to comment in the script, but they seem to be <a href="https://nebrios.com/blog/releases-2689" title="Releases 2689" target="_blank">working on it</a>. Check their <a href="https://nebrios.com/blog/weather-alerts-in-multiple-locations" title="Weather Alerts In Multiple Locations" target="_blank">YWeather blog post</a> on how the basics work and compare <a href="https://github.com/bandono/nebri/tree/master/tweet_rain" title="Nebri: tweet rain Github" target="_blank">what I did in Github</a>. I embed an example tweet from <a href="https://twitter.com/twithujan" title="@twithujan" target="_blank">@twithujan</a> below. <a href="https://weather.yahoo.com/" title="Yahoo! Weather" target="_blank">Yahoo! Weather</a> frequency of measurement and accuracy are of different topic by the way.</p>
<blockquote class="twitter-tweet" lang="en"><p lang="en" dir="ltr">Bogor is Light Rain with temperature at 23 °C. Taken at Thu, 28 May 2015 7:00 pm WIT</p>
<p>&mdash; Twit Hujan (@twithujan) <a href="https://twitter.com/twithujan/status/603908598314434560">May 28, 2015</a></p></blockquote>
<p><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>
<p>PS: &#8220;<em>hujan</em>&#8221; means &#8220;rain&#8221; in Indonesian</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2015/06/nebri-automation-weather-feed-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Commuter Train Trouble Alert Delivered to Watch by IFTTT</title>
		<link>https://lakm.us/logit/2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/</link>
		<comments>https://lakm.us/logit/2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/#comments</comments>
		<pubDate>Sat, 17 Jan 2015 14:31:02 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[job automation]]></category>
		<category><![CDATA[monitoring]]></category>
		<category><![CDATA[socialmedia]]></category>
		<category><![CDATA[wearable]]></category>
		<category><![CDATA[web-based]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=803</guid>
		<description><![CDATA[Imagine getting alerts of Commuter Line train service disruption right on your wrist! Well, the watch thing isn&#8217;t a must as any SMS-enabled phone will do. But without the watch, I won&#8217;t be introduced to &#8220;If-this-than-that&#8221; (IFTTT), a simple logic line that glues popular apps into trigger and action branded as recipes. Anyone can code [...]]]></description>
				<content:encoded><![CDATA[<p>Imagine getting alerts of Commuter Line train service disruption right on your wrist! Well, the watch thing isn&#8217;t a must as any SMS-enabled phone will do. But without the watch, I won&#8217;t be introduced to <a href="http://techcrunch.com/2014/08/28/ifttt-lands-30-million-series-b-from-norwest-venture-partners-a16z/" title="IFTTT Lands $30 Million Series B From Norwest Venture Partners, A16Z" target="_blank">&#8220;If-this-than-that&#8221;</a> (IFTTT), a simple logic line that glues popular apps into trigger and action branded as <a href="https://ifttt.com/recipes" title="IFTTT - Browse Recipes" target="_blank">recipes</a>. Anyone can code that line, a no-coding logic that cooks: <a href="https://ifttt.com/recipes/184610-natgeo-instagrams-wallpaper" title="IFTTT - NatGeo Instagrams - Wallpaper" target="_blank">sync wallpaper with Nat Geo&#8217; instagram</a>, <a href="https://ifttt.com/recipes/168783-so-mom-doesn-t-call-too-many-times" title="IFTTT - So mom doesn't call too many times" target="_blank">volume goes up when Mom calls</a>, <a href="https://ifttt.com/recipes/165588-change-the-color-of-the-lights-when-the-space-station-flies-over-a-specific-location" title="IFTTT - Change the color of the lights when the Space Station flies over a specific location" target="_blank">change bulb light color after some space station moves</a>, etc. As personal recipe, bring <a href="https://www.kickstarter.com/projects/cuckoo/cookootm-the-watch-for-the-connected-generation" title="KickStarter - cookoo™ - the watch for the connected generation" target="_blank">COOKOO connected watch</a> to the table and I&#8217;ve leveraged public service disruption–no matter how ironic–into edgy personal business.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="" src="../../../../images/ifttt-commuter-line-trouble-notifications.png" title="If this than that recipes alert for Commuter Train trouble" width="450" height="211" /><p class="wp-caption-text">If this than that recipes alert for Commuter Train trouble</p></div>
<p>The ingredient is tweet, <a href="https://twitter.com/search" title="Twitter Search" target="_blank">Twitter Search</a> use case is no longer just sentiment analysis, its function extends to alert, even close to real time–I&#8217;m pretty optimistic given the number of Commuter Line users joining the conversation. Now, the no-code part of our recipe, a <a href="https://twitter.com/search?f=realtime&#038;q=%28to%3Akrlmania%20OR%20%40krlmania%20OR%20from%3ACommuterLine%29%20AND%20%28gangguan%20OR%20pantograf%20OR%20wesel%20OR%20patah%29%20-semoga%20-smoga%20-moga&#038;src=typd" title="Twitter Search - Commuter Line Trouble" target="_blank">Twitter search query</a>, that is</p>
<p><span id="more-803"></span></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">&#40;</span>to:krlmania OR <span style="color: #000000; font-weight: bold;">@</span>krlmania OR from:CommuterLine<span style="color: #7a0874; font-weight: bold;">&#41;</span>
AND <span style="color: #7a0874; font-weight: bold;">&#40;</span>gangguan OR pantograf OR wesel OR patah<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #660033;">-semoga</span> <span style="color: #660033;">-smoga</span> <span style="color: #660033;">-moga</span></pre></div></div>

<p>and a brief explanation is that it queries for some keywords for potential trouble within mentions/replies to <a href="http://twitter.com/krlmania" title="@krlmania" target="_blank">@krlmania</a> and official announcements of <a href="http://twitter.com/CommuterLine" title="@CommuterLine" target="_blank">@CommuterLine</a>. Exclusion added to the search, the sentiment part of tweets, expressing wishes to shoo trouble away–I&#8217;m sorry, but keep praying online anyway.</p>
<p>When Twitter launched Twitter Stories in 2011, I read <a href="https://stories.twitter.com/en/ravi_pina.html" title="RAVI PINA shares train information through crowd sourcing and Twitter" target="_blank">about Ravi Pina</a> running the crowd sourced <a href="http://twitter.com/Caltrain" title="@Caltrain" target="_blank">@Caltrain</a>. Later now I see that official accounts like <a href="https://twitter.com/smrt_singapore" title="@SMRT_singapore" target="_blank">@SMRT_Singapore</a> is also a model of service disruption info center. We can go deeper to better stats from the API web service that shows real time position (<a href="https://play.google.com/store/apps/details?id=com.raia.infokrl&#038;hl=en" title="Google Play - Info KRL" target="_blank">an app is out there</a> showing that the location data API is working), but until its <a href="http://en.wikipedia.org/wiki/Open_data" title="Wikipedia - Open Data" target="_blank">open data</a> status is known, crowd sourcing stays as the most reliable solution, independent to regulation, and easiest to implement. Does the recipe work? During the first week of testing, alerts were flooding–within limit of course–as trouble really happened. So, cook your own ingredients or get my recipes served <a href="https://ifttt.com/p/bandono/shared" title="IFTTT - bandono" target="_blank">here</a>. </p>
<div class="wp-caption aligncenter" style="width: 460px"><iframe class="vine-embed" src="https://vine.co/v/OpU6LTOADvi/embed/simple" width="320" height="320" frameborder="0"></iframe><script async src="//platform.vine.co/static/scripts/embed.js" charset="utf-8"></script><p class="wp-caption-text">Train trouble alert on my watch</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2015/01/commuter-train-trouble-alert-delivered-watch-ifttt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Any m-by-n Matrix Keypad for Raspberry Pi</title>
		<link>https://lakm.us/logit/2014/02/any-m-x-n-matrix-keypad-raspberry-pi/</link>
		<comments>https://lakm.us/logit/2014/02/any-m-x-n-matrix-keypad-raspberry-pi/#comments</comments>
		<pubDate>Sat, 08 Feb 2014 18:30:57 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[ARM Linux]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[GPIO]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Raspberry Pi]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=746</guid>
		<description><![CDATA[What about instantiating any m x n matrix keypad by a Python class? Raspberry Pi takes me to learn how to build a Python class for the first time while expanding my initial WiringPi-based matrix keypad into a derivative work. A matrix keypad instance is defined by: Actual GPIO pins used forming the row and [...]]]></description>
				<content:encoded><![CDATA[<p>What about instantiating any m x n matrix keypad by a <a href="http://docs.python.org/2/tutorial/classes.html" title="Python Classes" target="_blank">Python class</a>? <a href="http://www.raspberrypi.org/" target="_blank">Raspberry Pi</a> takes me to learn how to build a Python class for the first time while expanding my initial <a href="../../2013/03/raspberry-pi-membrane-matrix-keypad-gpio-input-2/" title="Raspberry Pi: Membrane (Matrix) Keypad as GPIO Input" target="_blank">WiringPi-based matrix keypad</a> into a derivative work.</p>
<p>A matrix keypad instance is defined by:</p>
<ol>
<li>Actual GPIO pins used forming the row and column of the m x n matrix</li>
<li>Individual character in-use as symbol for each button</li>
</ol>
<p>Hence, I instantiate and call method like</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">...
<span style="color: black;">QPad</span>  = matrixQPi<span style="color: black;">&#40;</span>keyPad=keyPad,row=row,col=col<span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">print</span> QPad.<span style="color: black;">scanQ</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>to print the character being pressed. Some examples pushed to <a href="https://github.com/bandono/matrixQPi/tree/v2.0" title="Github: matrixQPi v2.0" target="_blank">my github</a> explains how the above <code>keyPad</code>, <code>row</code>, and <code>col</code> are defined to scan-read pressed button of 2&#215;2, 2&#215;3, and 4&#215;3 matrix keypads <time datetime="2014-02-23">(or have it 3&#215;4 matrix keypads in other words)</time>.</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="Illustration of any m-by-n matrix: 4x3, 2x2, and 2x3 keypad with different button symbols &#038; GPIO combinations" src="../../../../images/any-mxn-matrix-keypad-raspberry-pi.png" title="Illustration of any m-by-n matrix: 4x3, 2x2, and 2x3 keypad with different button symbols &#038; GPIO combinations" width="368" height="264" /><p class="wp-caption-text">Illustration of any m-by-n matrix: 4x3, 2x2, and 2x3 keypad with different button symbols &#038; GPIO combinations</p></div>
<p>I used deprecated <a href="https://github.com/WiringPi/WiringPi-Python" title="WiringPi-Python" target="_blank">Wiring-Pi Python</a> (they already moved to <a href="https://github.com/WiringPi/WiringPi2-Python" title="WiringPi2-Python" target="_blank">2.x version</a>) without problem. However, you&#8217;ll fail building from latest commit and must use combination of older commits as described by my updated part of <a href="../../2013/03/raspberry-pi-gpio-input-button-basics-1/" title="Raspberry Pi GPIO Input Button Basics" target="_blank">an old-post</a>. By the way, there&#8217;s I/O expander support for <a href="https://github.com/WiringPi/WiringPi2-Python" title="WiringPi2-Python" target="_blank">WiringPi2-Python</a> which is good, considering:</p>
<blockquote><p>GPIO is expensive and for the sake of a keypad, you should not spend all.</p></blockquote>
<p>(A friend told me that once)</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2014/02/any-m-x-n-matrix-keypad-raspberry-pi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Acknowledging Event: Zabbix Python API</title>
		<link>https://lakm.us/logit/2012/05/acknowledging-event-zabbix-python-api/</link>
		<comments>https://lakm.us/logit/2012/05/acknowledging-event-zabbix-python-api/#comments</comments>
		<pubDate>Mon, 14 May 2012 02:40:43 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[Zabbix]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=388</guid>
		<description><![CDATA[Acknowledgement is one of the things that is provided by Zabbix API in its event section. We can make use of the methods get() and acknowledge() to automatically acknowledge an event. Digging through the attributes of those methods, the official doc doesn&#8217;t provide complete example to follow. Added with some luck, my search get me [...]]]></description>
				<content:encoded><![CDATA[<p>Acknowledgement is one of the things that is provided by <a href="http://www.zabbix.com/" title="Zabbix" target="_blank">Zabbix</a> API in its <a href="http://www.zabbix.com/documentation/1.8/api/event" title="Zabbix API 1.8: Event" target="_blank">event section</a>. We can make use of the methods <code>get()</code> and <code>acknowledge()</code> to automatically acknowledge an event. Digging through the attributes of those methods, the official doc doesn&#8217;t provide complete example to follow. Added with some luck, my search get me to have the following JSON RPC that works in <a href="http://www.zabbix.com/rn1.8.7.php" title="Zabbix 1.8.7 Release Announcement" target="_blank">Zabbix 1.8.7</a> using <a href="https://github.com/gescheit/scripts" title="Gescheit github" target="_blank">Gescheit API implementation</a> written in Python. </p>
<p>When the goal is to acknowledge a specific event, the JSON call is however limited to some basic responses. It means that you can&#8217;t query a single RPC request for i.e. the following combination: <em>list of acknowledged events <strong>with</strong> &#8220;problem&#8221; status <strong>and</strong> trigger ID 500</em> (500 is merely an example).</p>
<p>However, combination in a single request do exist i.e. I&#8217;ve tried: <em>list of acknowledged events <strong>with</strong> &#8220;problem&#8221; status</em> as the following GET request:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #009900;">&#123;</span>
<span style="color: #3366CC;">&quot;params&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#123;</span><span style="color: #3366CC;">&quot;acknowledged&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;value&quot;</span><span style="color: #339933;">:</span> <span style="color: #009900;">&#91;</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;jsonrpc&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;2.0&quot;</span><span style="color: #339933;">,</span>
<span style="color: #3366CC;">&quot;method&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;event.get&quot;</span><span style="color: #339933;">,</span>
<span style="color: #3366CC;">&quot;auth&quot;</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;some-hash-authentication&quot;</span><span style="color: #339933;">,</span>
<span style="color: #3366CC;">&quot;id&quot;</span><span style="color: #339933;">:</span> some<span style="color: #339933;">-</span>RPC<span style="color: #339933;">-</span>sequence<span style="color: #339933;">-</span>integer
<span style="color: #009900;">&#125;</span></pre></div></div>

<p><em>(Note: <code>value=1</code> means status is &#8220;problem&#8221;)</em></p>
<p>For the basic example above, find the script in <a href="https://github.com/bandono/scripts" title="forked Gescheit API github" target="_blank">my fork</a> of Gescheit API.</p>
<p>Back to our goal of acknowledging events, our API can make the following RPCs:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">ack_list=zapi.<span style="color: black;">event</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;acknowledged&quot;</span>:<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
problem_list=zapi.<span style="color: black;">event</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;value&quot;</span>:<span style="color: black;">&#91;</span><span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
event_trigger_list=zapi.<span style="color: black;">event</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#123;</span><span style="color: #483d8b;">&quot;triggerids&quot;</span>:<span style="color: black;">&#91;</span>trigger_id<span style="color: black;">&#93;</span><span style="color: black;">&#125;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Yes, they are three requests. We can then filter out a single event to be acknowledged by intersecting the three results. The first intersection is between <code>event_trigger_list</code>, <code>problem_list</code>, and <code>ack_list</code> as illustrated below:</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="problem-list-acknowledgement-intersection.jpg" src="../../../../images/problem-list-acknowledgement-intersection.jpg" title="Intersection of problem list, event list with specific trigger ID, and acknowledged event list" width="309" height="211" /><p class="wp-caption-text">Intersection of problem list, event list with specific trigger ID, and acknowledged event list</p></div>
<p>After we opt-out those intersections, we can then get the event with problem status and choose the latest event only to be acknowledged. Check the code on <a href="https://github.com/bandono/zabbix-custom-integration/blob/master/bin/api/zabbix_event_ack.py" title="zabbix_event_ack.py" target="_blank">my github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/05/acknowledging-event-zabbix-python-api/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Close Low Level Socket in Python</title>
		<link>https://lakm.us/logit/2012/02/close-level-socket-python/</link>
		<comments>https://lakm.us/logit/2012/02/close-level-socket-python/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 05:12:11 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[socket]]></category>

		<guid isPermaLink="false">http://lakm.us/logit/?p=390</guid>
		<description><![CDATA[Important to do in socket programming is to close the socket. Python.org says Close the socket. All future operations on the socket object will fail. The remote end will receive no more data (after queued data is flushed). Sockets are automatically closed when they are garbage-collected. I implemented this low level networking interface for a [...]]]></description>
				<content:encoded><![CDATA[<p>Important to do in socket programming is to close the socket. <a href="http://docs.python.org/library/socket.html" title="Python Doc: Low-level networking interface" target="_blank">Python.org</a> says</p>
<blockquote><p>Close the socket. All future operations on the socket object will fail. The remote end will receive no more data (after queued data is flushed). Sockets are automatically closed when they are garbage-collected.</p></blockquote>
<p>I implemented this low level networking interface for a server listening to remote command. The complete code can be found on <a href="https://github.com/bandono/zoom-camera-board/blob/2.2/server.py" title="Github: server.py" target="_blank">Github</a>, the following lines are just part to show when to close socket:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>43
44
45
46
</pre></td><td class="code"><pre class="python" style="font-family:monospace;">        clientSocket,address =s.<span style="color: black;">accept</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        data = clientSocket.<span style="color: black;">recv</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">1024</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">print</span> <span style="color: #483d8b;">&quot;Receive command:&quot;</span>+data
        clientSocket.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>What happened with the TCP state when the socket wasn&#8217;t closed: it stayed in <code>CLOSE_WAIT</code> state. The screenshot below shows a clip of the TCP conversation in <a href="http://www.wireshark.org/" title="www.wireshark.org/" target="_blank">Wireshark</a> sniff and the <code>netstat</code> output:</p>
<div class="wp-caption aligncenter" style="width: 460px"><img alt="" src="../../../../images/python-tcp-socket-without-close-server-wait.jpg" title="python-tcp-socket-without-close-server-wait.jpg" width="420" height="297" /><p class="wp-caption-text">Listening port state of a socket server written in Python</p></div>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2012/02/close-level-socket-python/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Embed Tag Cloud (In Other Than Sidebar)</title>
		<link>https://lakm.us/logit/2010/03/embed-tag-cloud-in-other-than-sidebar/</link>
		<comments>https://lakm.us/logit/2010/03/embed-tag-cloud-in-other-than-sidebar/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 03:24:24 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tag cloud]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://xp-racy.lan/it/?p=188</guid>
		<description><![CDATA[I try to embed WordPress tag cloud to the header part of the theme. Tag print is called from wp_tag_cloud('smallest=8&#038;largest=16'). One example would be by inserting that function in this part of header.php of the corresponding theme: 1 2 3 4 5 6 7 8 9 10 &#60;div class=&#34;header&#34;&#62; &#60;?php if &#40;is_home&#40;&#41;&#41; : ?&#62; &#60;h1&#62;&#60;?php [...]]]></description>
				<content:encoded><![CDATA[<p>I try to embed WordPress tag cloud to the header part of the theme. Tag print is called from <code>wp_tag_cloud('smallest=8&#038;largest=16')</code>. One example would be by inserting that function in this part of <code>header.php</code> of the corresponding theme:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">	&lt;div class=&quot;header&quot;&gt;
        	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        		&lt;h1&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;span&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;&lt;/h1&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_tag_cloud<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'smallest=8&amp;largest=16'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
        	<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		        &lt;h1&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_settings<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
				&lt;span&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'description'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/span&gt;&lt;/h1&gt;
	        <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/div&gt;</pre></td></tr></table></div>

<p>Another embedding option is to use the famous <code>wp-cumulus</code> plugin.<br />
<span id="more-188"></span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
	<span style="color: #666666; font-style: italic;">//wp_tag_cloud('smallest=8&amp;largest=16');</span>
	<span style="color: #990000;">ob_start</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	wp_tag_cloud<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'smallest=8&amp;largest=16'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$tagcloud</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;&amp;nbsp;&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">ob_get_clean</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">//echo $tagcloud;</span>
	<span style="color: #666666; font-style: italic;">//echo &quot;'.urlencode('&lt;tags&gt;') . $tagcloud . urlencode('&lt;/tags&gt;').'&quot;;</span>
	<span style="color: #666666; font-style: italic;">/*$options = get_option('wpcumulus_options');*/</span>
&nbsp;
	<span style="color: #000088;">$movie</span> <span style="color: #339933;">=</span> plugins_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-cumulus/tagcloud.swf'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> plugins_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-cumulus/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'width'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'550'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'height'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'200'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bgcolor'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'333333'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'000000'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor2'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'000000'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hicolor'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'ffffff'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'speed'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'100'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'distr'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'true'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'tags'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'args'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'compmode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'true'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'showwptags'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'true'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'trans'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'true'</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #000088;">$soname</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9999999</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$movie</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'?r='</span> <span style="color: #339933;">.</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9999999</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$divname</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">rand</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9999999</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
	<span style="color: #666666; font-style: italic;">// write flash tag</span>
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'compmode'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">!=</span><span style="color: #0000ff;">'true'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ --&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot; src=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$path</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'swfobject.js&quot;&gt;&lt;/script&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div id=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$divname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'showwptags'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'true'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span> <span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;p style=&quot;display:none;&quot;&gt;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// alternate content</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;cats&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">urldecode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tagcloud</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;tags&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">urldecode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cats</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/p&gt;&lt;p&gt;WP Cumulus Flash tag cloud by &lt;a href=&quot;http://www.roytanck.com&quot;&gt;Roy Tanck&lt;/a&gt; and &lt;a href=&quot;http://lukemorton.co.uk/&quot;&gt;Luke Morton&lt;/a&gt; requires &lt;a href=&quot;http://www.macromedia.com/go/getflashplayer&quot;&gt;Flash Player&lt;/a&gt; 9 or better.&lt;/p&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;script type=&quot;text/javascript&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'var '</span><span style="color: #339933;">.</span><span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' = new SWFObject(&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$movie</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;, &quot;tagcloudflash&quot;, &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'width'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;, &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'height'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;, &quot;6&quot;, &quot;#'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bgcolor'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'trans'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'true'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addParam(&quot;wmode&quot;, &quot;transparent&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addParam(&quot;allowScriptAccess&quot;, &quot;always&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;tcolor&quot;, &quot;0x'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;tcolor2&quot;, &quot;0x'</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor2'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span> ? <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor2'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;hicolor&quot;, &quot;0x'</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hicolor'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;&quot;</span> ? <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hicolor'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;tspeed&quot;, &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'speed'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;distr&quot;, &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'distr'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;mode&quot;, &quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// put tags in flashvar</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;cats&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;tagcloud&quot;, &quot;'</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;tags&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tagcloud</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;/tags&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// put categories in flashvar</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;tags&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.addVariable(&quot;categories&quot;, &quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cats</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$soname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'.write(&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$divname</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;);'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/script&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;object type=&quot;application/x-shockwave-flash&quot; data=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$movie</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; width=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'width'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; height=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'height'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;param name=&quot;movie&quot; value=&quot;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$movie</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;param name=&quot;bgcolor&quot; value=&quot;#'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'bgcolor'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;param name=&quot;AllowScriptAccess&quot; value=&quot;always&quot; /&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'trans'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'true'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot; /&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;param name=&quot;flashvars&quot; value=&quot;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'tcolor=0x'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;tcolor2=0x'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'tcolor2'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;hicolor=0x'</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'hicolor'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;tspeed='</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'speed'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;distr='</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'distr'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;mode='</span><span style="color: #339933;">.</span><span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// put tags in flashvar</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;cats&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;tagcloud='</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;tags&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$tagcloud</span> <span style="color: #339933;">.</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;/tags&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #666666; font-style: italic;">// put categories in flashvar</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;tags&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&amp;amp;categories='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$cats</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// alternate content</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;cats&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">.</span><span style="color: #990000;">urldecode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$tagcloud</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$options</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'mode'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;tags&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">.</span><span style="color: #990000;">urldecode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cats</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt;'</span><span style="color: #339933;">;</span> <span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;p&gt;WP-Cumulus by &lt;a href=&quot;http://www.roytanck.com/&quot;&gt;Roy Tanck&lt;/a&gt; and &lt;a href=&quot;http://lukemorton.co.uk/&quot;&gt;Luke Morton&lt;/a&gt; requires &lt;a href=&quot;http://www.macromedia.com/go/getflashplayer&quot;&gt;Flash Player&lt;/a&gt; 9 or better.&lt;/p&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$flashtag</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;/object&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">print</span> <span style="color: #000088;">$flashtag</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2010/03/embed-tag-cloud-in-other-than-sidebar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Write WordPress Plugins to Play Freemind Mind-Map File</title>
		<link>https://lakm.us/logit/2010/01/write-wordpress-plugins-play-freemind-mind-map-file/</link>
		<comments>https://lakm.us/logit/2010/01/write-wordpress-plugins-play-freemind-mind-map-file/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 15:14:15 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[Freemind]]></category>
		<category><![CDATA[mind map]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=104</guid>
		<description><![CDATA[The first version main goal is to embed the *.mm file which is a Freemind file. I found similarity of embedding this kind of file in flash-video-player plugins (I used version 3.1.8). So, I tried to reverse engineer by mind-mapping how it works first and how to hook plugins to WordPress. Here is version 1.1 [...]]]></description>
				<content:encoded><![CDATA[<p>The first version main goal is to embed the <code>*.mm</code> file which is a <a href="http://freemind.sourceforge.net" title="Freemind SourceForge" target="_blank">Freemind</a> file. I found similarity of embedding this kind of file in <a href="http://wordpress.org/extend/plugins/flash-video-player/">flash-video-player</a> plugins (I used version 3.1.8). So, I tried to reverse engineer by mind-mapping how it works first and how to hook plugins to WordPress. Here is version 1.1 of the <a href="../../../../upload/freemind-wp-browser.1.1.zip" title="freemind-wp-browser.1.1.zip" target="_blank">fremind-wp-browser</a>. The final mind-map and plugin in-use in this post looks crowded, but you can find highlighted pointers below the mind-map.  </p>
<p></p>
<h4>Embedding with SWFObject</h4>
<p>The *.mm file is projected over <a href="http://freemind.sourceforge.net/wiki/index.php/Flash_browser">visorFreemind.swf</a> player with the help of javascript.</p>
<p>Using javascript from <a href="http://blog.deconcept.com/swfobject/">SWFObject</a>, the idea of flash embedding is to create an <code>SWFObject</code> and then <code>write()</code> that inside certain part of page body, i.e. <code>div</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span> 
   <span style="color: #003366; font-weight: bold;">var</span> s0 <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> SWFObject<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;visorFreemind.swf&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;n0&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;800&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;400&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;7&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
   s0.<span style="color: #000066; font-weight: bold;">write</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;video0&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<h4>Parsing a Post</h4>
<p>In general, the plugins will parse a post content to find <code>&#91;freemind file="path-to.mm" /&#93;</code> shortcode that will finally be replaced by the above javascript with respect to <code>*.mm</code> file that will be played over <code>visorFreemind.swf</code>.</p>
<h4>Hooking the Plugins to WordPress</h4>
<p>The above javascript needs to be loaded in every <code>head</code> part of each WordPress page, this action will call a function that will insert that script</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>163
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'FreemindMap_head'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Hence, we get</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;script type=&quot;text/javascript&quot; src=&quot;http://lakm.us/logit/wp-content/plugins/freemind-wp-browser/swfobject.js&quot;&gt;&lt;/script&gt;</pre></div></div>

<p>on the header source of every page.</p>
<p>To deal with content parsing looking for the shortcode, add the following filter</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>166
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'FreemindMap_Parse'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Activation/deactivation of the plugin is via the hook registration where it also create an option panel when activated by adding</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>99
</pre></td><td class="code"><pre class="php" style="font-family:monospace;">add_options_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Freemind Options'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Freemind'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'8'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'freemind-wp-browser.php'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'FreemindOptions'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>This initial version has limited options though; enough to set the width and height of the mind-map projection.</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2010/01/write-wordpress-plugins-play-freemind-mind-map-file/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MicroBlogger Add Search Feature (1)</title>
		<link>https://lakm.us/logit/2009/10/microblogger-add-search-feature-1/</link>
		<comments>https://lakm.us/logit/2009/10/microblogger-add-search-feature-1/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 05:27:33 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[OpenMicroBlogger]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=88</guid>
		<description><![CDATA[This is mainly about view of custom search page (not about searching itself). Adding &#8220;Search&#8221; To Main Link Tabs Changes to file under /app/omb/plugins/ wp.php security.php In wp.php: Adding $links&#91;'Search'&#93; = $request-&#62;url_for&#40;'search'&#41;; between &#8216;Personal&#8217; and &#8216;Profile&#8217; would bring out the &#8216;Search&#8217; tab in main link-tabs. In security.php Adding function security_init&#40;&#41; &#123; ... $request-&#62;connect&#40; 'search' &#41;; [...]]]></description>
				<content:encoded><![CDATA[<p>This is mainly about view of custom search page (not about searching itself).</p>
<p><strong>Adding &#8220;Search&#8221; To Main Link Tabs</strong></p>
<p>Changes to file under</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>app<span style="color: #000000; font-weight: bold;">/</span>omb<span style="color: #000000; font-weight: bold;">/</span>plugins<span style="color: #000000; font-weight: bold;">/</span></pre></div></div>

<ol>
<li><code>wp.php</code></li>
<li><code>security.php</code></li>
</ol>
<p>In <strong><code>wp.php</code></strong>:</p>
<p>Adding</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$links</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'Search'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">url_for</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'search'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>between &#8216;Personal&#8217; and &#8216;Profile&#8217; would bring out the &#8216;Search&#8217; tab in main link-tabs.</p>
<p>In <strong><code>security.php</code></strong></p>
<p>Adding</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> security_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #339933;">...</span>
<span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">connect</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'search'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #339933;">...</span></pre></div></div>

<p>would give the URI link if tab is clicked or hovered, that is: <code>http://<em>base_url</em>/<strong>?search</strong></code>.</p>
<p>Adding the search function would make the URI seek for the correlated viewing page</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> search<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$vars</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$vars</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'requested_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">base</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>I create a viewing page then, under <code>/app/omb/<strong>view</strong>/</code> by the name <code>_search.html</code>.</p>
<p>However, the main theme won&#8217;t appear correctly. So, what I do is: add a controller in <code>/app/omb/<strong>controller</strong>/</code> with the name <code>search_posts.php</code> (an empty one for a start) and its view with the name <code>_search_posts.html</code> (inside <code>/app/omb/view/</code>). And then, add rendering to our previous search-function as in</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> search<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$vars</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$vars</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$_SESSION</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'requested_url'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$request</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">base</span><span style="color: #339933;">;</span>
render<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'action'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;strong&gt;search_posts&lt;/strong&gt;'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>As I&#8217;ll be incorporating databases issue later. The following search is adequate to show relevant results, plain with no links etc. It is the content of the current <code>_search_posts.html</code>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>environment<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'authentication'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'password'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;table cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; width=&quot;770&quot; align=&quot;center&quot; style=&quot;margin-top: 30px;&quot;&gt;
&lt;tr&gt;
  &lt;td class=&quot;content&quot;&gt;
&lt;!-  &lt;form name=&quot;search&quot; action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
  &lt;form name=&quot;search&quot; action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> url_for<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'search_posts'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
&nbsp;
    &lt;table cellpadding=&quot;5&quot; cellspacing=&quot;0&quot; border=&quot;0&quot; align=&quot;center&quot; width=&quot;500&quot;&gt;
    &lt;tr&gt;
      &lt;td height=&quot;40&quot; align=&quot;center&quot; colspan=&quot;2&quot;&gt;Please enter search&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td height=&quot;10&quot; colspan=&quot;2&quot;&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td width=&quot;170&quot; height=&quot;30&quot; align=&quot;right&quot;&gt;Search:&lt;/td&gt;
      &lt;td&gt;&lt;input type=&quot;text&quot; maxlength=&quot;30&quot; name=&quot;search_&quot; value=&quot;&quot; style=&quot;width: 180px;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr height=&quot;30&quot;&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
      &lt;td&gt;&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Submit&quot; style=&quot;width: 180px; font-size: 10px; text-transform: uppercase; color: #003366; border: 1px solid #336699; background-color: #DDDDDD; padding: 3px;&quot; /&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td height=&quot;10&quot; colspan=&quot;2&quot;&gt;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
  &lt;/form&gt;
  &lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&nbsp;
&nbsp;
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'submit'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
   <span style="color: #000088;">$link1</span> <span style="color: #339933;">=</span> <span style="color: #339933;">@</span><span style="color: #990000;">mysql_connect</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;localhost&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;db_name&quot;</span><span style="color: #339933;">,</span><span style="color: #0000ff;">&quot;db_password&quot;</span><span style="color: #009900;">&#41;</span>
                 or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Could not connect to MySQL Server!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #339933;">@</span><span style="color: #990000;">mysql_select_db</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;omb_db&quot;</span><span style="color: #009900;">&#41;</span>
                 or <span style="color: #990000;">die</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Could not select database!&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$search_</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'search_'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$query</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;SELECT `title` , `id` FROM `posts` WHERE `title` LIKE '%<span style="color: #006699; font-weight: bold;">$search_</span>%'&quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$query</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">list</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id_</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_fetch_row</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$result</span><span style="color: #009900;">&#41;</span>	<span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> url_for<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'resource'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'id'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$id_</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">print</span> <span style="color: #000088;">$title</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;;
	&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
  <span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>  <span style="color: #990000;">mysql_close</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/10/microblogger-add-search-feature-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Function Return Value ?</title>
		<link>https://lakm.us/logit/2009/03/function-return-value/</link>
		<comments>https://lakm.us/logit/2009/03/function-return-value/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 07:42:19 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[General Linux]]></category>
		<category><![CDATA[shell script]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=53</guid>
		<description><![CDATA[The following function: 1 2 3 processLine&#40;&#41;&#123; &#60;strong&#62;line&#60;/strong&#62;=&#34;$@&#34; &#125; Does it have some sort of &#8220;return value&#8221;? (in this case the variable line) by calling it through: processLine $line echo $line In the above example, I echo the value of line after being processed by processLine(). (?)]]></description>
				<content:encoded><![CDATA[<p>The following function:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code"><pre class="bash" style="font-family:monospace;">processLine<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>
<span style="color: #000000; font-weight: bold;">&lt;</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span>line<span style="color: #000000; font-weight: bold;">&lt;/</span>strong<span style="color: #000000; font-weight: bold;">&gt;</span>=<span style="color: #ff0000;">&quot;$@&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></td></tr></table></div>

<p>Does it have some sort of  &#8220;return value&#8221;? (in this case the variable <code>line</code>) by calling it through:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">processLine <span style="color: #007800;">$line</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$line</span></pre></div></div>

<p>In the above example, I echo the value of <code>line</code> after being processed by <code>processLine()</code>. (?)</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/03/function-return-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Startup script for TAP interfaces</title>
		<link>https://lakm.us/logit/2009/02/startup-script-for-tap-interfaces/</link>
		<comments>https://lakm.us/logit/2009/02/startup-script-for-tap-interfaces/#comments</comments>
		<pubDate>Wed, 18 Feb 2009 15:31:12 +0000</pubDate>
		<dc:creator>Arif</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[General Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[startup]]></category>

		<guid isPermaLink="false">http://localhost/it/?p=8</guid>
		<description><![CDATA[To add startup script we can use: System > Preferences > Sessions local boot script (as services start/stop in /etc/init.d/) I added the following shell script: setup-tap: #! /bin/bash tap_up&#40;&#41; &#123; tunctl -t tap0 -u $USER tunctl -t tap1 -u $USER ifconfig tap0 192.168.20.1 ifconfig tap1 192.168.40.1 #iptables -t nat -A POSTROUTING -o eth1 -j [...]]]></description>
				<content:encoded><![CDATA[<p>To add startup script we can use:</p>
<ul>
<li>System > Preferences > Sessions</li>
<li>local boot script  (as  services start/stop  in  /etc/init.d/)</li>
</ul>
<p>I added the following shell script: <code>setup-tap</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#! /bin/bash</span>
tap_up<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
tunctl <span style="color: #660033;">-t</span> tap0 <span style="color: #660033;">-u</span> <span style="color: #007800;">$USER</span>
tunctl <span style="color: #660033;">-t</span> tap1 <span style="color: #660033;">-u</span> <span style="color: #007800;">$USER</span>
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> tap0 192.168.20.1
<span style="color: #c20cb9; font-weight: bold;">ifconfig</span> tap1 192.168.40.1
<span style="color: #666666; font-style: italic;">#iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE</span>
sysctl <span style="color: #660033;">-w</span> net.ipv4.ip_forward=<span style="color: #000000;">1</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
tap_down<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
tunctl <span style="color: #660033;">-d</span> tap0
tunctl <span style="color: #660033;">-d</span> tap1
sysctl <span style="color: #660033;">-w</span> net.ipv4.ip_forward=<span style="color: #000000;">0</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
start<span style="color: #7a0874; font-weight: bold;">&#41;</span>
tap_up
<span style="color: #000000; font-weight: bold;">;;</span>
stop<span style="color: #7a0874; font-weight: bold;">&#41;</span>
tap_down
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: $0 {start|stop}&quot;</span>
<span style="color: #000000; font-weight: bold;">;;</span>
<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></div></div>

<p>Basically it is used as <code>./setup-tap start|stop</code>.  The following steps add it to boot:<br />
copy it to <code>/etc/init.d/setup-tap<br />
</code><code>chmod +xr setup-tap</code><code><br />
update-rc.d setup-tap defaults</code><br />
The last updating will put it in default runlevel:<br />
<code>setup-tap <strong>start</strong></code> in runlevel 2,3,4, and 5 <code>setup-tap <strong>stop</strong></code> in runlevel 1 and 6.</p>
<p>Specific to this script itself, it didn&#8217;t run at first due to the <code>$USER</code> environment variable which must be set to <code>arif</code> (my username).</p>
]]></content:encoded>
			<wfw:commentRss>https://lakm.us/logit/2009/02/startup-script-for-tap-interfaces/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
