<?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>Roland Li &#187; How-To</title>
	<atom:link href="http://www.rolandli.com/category/how-to/feed" rel="self" type="application/rss+xml" />
	<link>http://www.rolandli.com</link>
	<description>Designer + Coder</description>
	<lastBuildDate>Mon, 06 Sep 2010 19:18:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Asterisk + FreePBX + Google Voice on DNS-323</title>
		<link>http://www.rolandli.com/2010/01/14/comprehensive-guide-asterisk-freepbx-google-voice-on-dns-323</link>
		<comments>http://www.rolandli.com/2010/01/14/comprehensive-guide-asterisk-freepbx-google-voice-on-dns-323#comments</comments>
		<pubDate>Thu, 14 Jan 2010 19:55:04 +0000</pubDate>
		<dc:creator>rolandli</dc:creator>
				<category><![CDATA[Hardware]]></category>
		<category><![CDATA[How-To]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[google voice]]></category>

		<guid isPermaLink="false">http://www.rolandli.com/?p=594</guid>
		<description><![CDATA[It&#8217;s totally possible to receive and make calls using your Google Voice number for free! Basically we will setup a PBX server with Asterisk and FreePBX, and Sipgate.com provides unlimited free inbound calls. Here is how it works, quoting Nerd Vittles: For outbound calls, we&#8217;ll combine a little dialplan voodoo with pygooglevoice to instruct Asterisk [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-598  aligncenter" title="Google Voice" src="http://www.rolandli.com/wp-content/uploads/2010/01/Google-Voice.png" alt="" width="256" height="256" /></p>
<p>It&#8217;s totally possible to receive and make calls using your Google Voice number for free! Basically we will setup a PBX server with Asterisk and FreePBX, and Sipgate.com provides unlimited free inbound calls. Here is how it works, quoting Nerd Vittles:</p>
<blockquote><p>For outbound calls, we&#8217;ll combine a little dialplan voodoo with pygooglevoice to instruct Asterisk to place a click-to-dial call using your Google Voice forwarding number. Then we&#8217;ll stuff in the destination U.S. phone number. When you dial GV-678-1234567 from any of your Asterisk phones, Asterisk will park your initial call in a reserved parking lot slot and then join the called party to the originally parked call. The entire procedure is virtually transparent both to the caller and the callee. And, unlike the MeetMe conference, the parking lot fades out of the picture as soon as the call is connected. Thus, if either party hangs up, the active channel for the call is terminated on your Asterisk server.</p>
<p>For inbound calls from your Google Voice number, we&#8217;ll tweak the dialplan so that it can distinguish between a RingBack call that Google Voice initiated and a true inbound call. We&#8217;ll peel off the real inbound calls and route them to a separate Inbound Route in FreePBX for processing in any way you desire.</p></blockquote>
<p>With this method, you can make free calls on your smartphone whenever these is reasonable Wi-fi or 3G connections available. Or you can set up a SIP phone or connect a regular phone to an Analog Telephony Adapter at home and uses your Google Voice number. A free land line. You can also forward your calls from Google Voice to both your cell phone and the SIP home phone, when you are at home, you can pick up the home phone instead to save cell phone minutes.</p>
<p>Here is a comprehensive guide to how to set up Asterisk and FreePBX along with Google Voice in order to make and receive calls for free on your DNS-323. I did not come up with all these, but learned from various sites. The credits go to them. I just put them together specifically for DNS-323 users.</p>
<p>Before we start, I assume that you:</p>
<ul>
<li>Have a brand new DNS-323 on firmware 1.5 or 1.6 with fun_plug enabled and have SSH access. If not, follow <a href="http://wiki.dns323.info/howto:fun_plug" target="_blank">this guide</a> first.</li>
<li>Basic Linux knowledge and comfortable with command line interface (CLI).</li>
<li>Have a Google Voice Account. If you don&#8217;t have one yet, <a href="https://services.google.com/fb/forms/googlevoiceinvite/" target="_blank">request an invite here</a> or ask those who have one to invite you.</li>
<li>Have a SipGate account. <a href="http://www.sipgate.com/one" target="_blank">Sign up here</a>, it&#8217;s free. Make sure you write down the <strong>SIP Credentials</strong> in <strong>Settings</strong>.</li>
<li>Forward your calls in Google Voice to your SipGate number.</li>
</ul>
<p>It&#8217;s much easier to do this on a regular computer/server than on DNS-323, which involves many extra steps. On a regular computer you can simply install <a href="http://pbxinaflash.net/" target="_blank">PBX In A</a> Flash with minimal effort. But our frugal motto makes us squeeze out every drop of juice out of DNS-323 for our money&#8217;s worth.</p>
<h3>Step 0. Clean Up DNS-323</h3>
<p>First of all, we need to stop all unnecessary services on DNS-323. Of course you can leave them all if you have to use them, but it&#8217;s recommended to stop what you don&#8217;t need.  If you run too many programs on DNS-323, it will have to use swap frequently. Then you hard drive will never spin down, not good.</p>
<ol>
<li>Stop uPNP server.</li>
<li>Stop iTunes Media server. You can install FireFly later on on Debian.</li>
<li>Remove the built-in Bittorrent client. Simply delete the folder &#8220;<strong>/mnt/HD_a2/Nas_Prog/BT</strong>&#8220;. You can install rTorrent on it and start it whenever you need to instead of having a daemon always on. You can install rTorrent later on on Debian.</li>
</ol>
<p><span id="more-594"></span></p>
<h3>Step 1. Install Debian Lenny on DNS-323</h3>
<ol>
<li>Download <a title="http://mesh.dl.sourceforge.net/sourceforge/debnas/debnas-0.5.tar.bz2" rel="nofollow" href="http://mesh.dl.sourceforge.net/sourceforge/debnas/debnas-0.5.tar.bz2">http://mesh.dl.sourceforge.net/sourceforge/debnas/debnas-0.5.tar.bz2</a></li>
<li>Extract the two files &#8220;<strong>fun_plug</strong>&#8221; and &#8220;<strong>linux.tar</strong>&#8221; to the <strong>root</strong> directory of your DNS-323 volume.</li>
<li>Reboot DNS-323</li>
<li>Wait for a few minutes</li>
</ol>
<p>You should be able to access DNS-323 via SSH. Username <strong>root</strong>, default password is <strong>12345678</strong>. Make sure you change it! Now we are going to upgrade all the packages to the latest version.</p>
<p>First we need to edit the repository file: <strong>/etc/apt/sources.list.d/etch.list </strong>and replace the word &#8220;<strong>etch</strong>&#8221; with &#8220;<strong>lenny</strong>&#8220;. Save and  go back to command prompt:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">dlink-xxxx:<span style="color: #666666; font-style: italic;"># apt-get update</span>
dlink-xxxx:<span style="color: #666666; font-style: italic;"># apt-get dist-upgrade</span></pre></div></div>

<p>Debian is now installed.</p>
<p>Credit for this part goes to <a href="http://wiki.dns323.info/howto:chroot_debian" target="_blank">Mike Gore and Manuel Treitinger</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rolandli.com/2010/01/14/comprehensive-guide-asterisk-freepbx-google-voice-on-dns-323/feed</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Fix ZuckerReports Non-Admin Cannot Run Reports</title>
		<link>http://www.rolandli.com/2009/09/29/fix-zuckerreports-non-admin-cannot-run-reports</link>
		<comments>http://www.rolandli.com/2009/09/29/fix-zuckerreports-non-admin-cannot-run-reports#comments</comments>
		<pubDate>Wed, 30 Sep 2009 00:20:51 +0000</pubDate>
		<dc:creator>rolandli</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[zuckerreports zucker reports sugarcrm custome fields non-admin non-administrator empty blank results problem]]></category>

		<guid isPermaLink="false">http://www.rolandli.com/?p=551</guid>
		<description><![CDATA[Here is a fix to another problem in ZuckerReports. The symptom is when a non-admin user is trying to run an on-demand report under ZuckerReports, the page just redirect back to the list of available templates without showing any result. But admin users can run them just fine. It turns out the problem is a [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a fix to another problem in ZuckerReports. The symptom is when a non-admin user is trying to run an on-demand report under ZuckerReports, the page just redirect back to the list of available templates without showing any result. But admin users can run them just fine. It turns out the problem is a conflict between <a href="http://www.sugarforge.org/projects/zuckerreports/">ZuckerReports</a> and <a href="http://www.sugarforge.org/projects/ce-teams">CE Teams</a>. CE Teams is another nice module that enable simple team-based management of users. You can read more about it on their page.</p>
<p>I haven&#8217;t have time to dig into the codes yet, so the fix is rather primitive and simple, but it works. The problem is that both ZuckerReports and CE Teams have a field called &#8220;team_id&#8221; in the database but they have totally different meanings. So when CE Teams read the info from &#8220;team_id&#8221; in Zucker&#8217;s database table, it acts weird. Admins are not affected since they are above CE Teams&#8217; rules.</p>
<p>The fix:<br />
<span id="more-551"></span></p>
<ol>
<li> Make sure in CE Teams you keep the team &#8220;Everyone&#8221; and add all the users to that group.</li>
<li>Fire up your favorite MySQL management software, most likely phpMyAdmin, and go to your SugarCRM database</li>
<li>Go to table &#8220;<strong>team</strong>&#8221; and record the id for team &#8220;<strong>Everyone</strong>&#8220;. (If you didn&#8217;t delete the default team, the id is &#8220;1&#8243;)</li>
<li>Go to table &#8220;<strong>zucker_listingtemplates</strong>&#8221; and update all their id to team &#8220;<strong>Everyone</strong>&#8216;s&#8221; id.</li>
<li>In order you don&#8217;t have to modify future new templates by hand, change the default value of &#8220;team_id&#8221; to match &#8220;<strong>Everyone&#8217;s</strong>&#8221; id.</li>
<li>Repeat step 4 and 5 for the tables &#8220;<strong>zucker_querytemplates</strong>&#8220;, &#8220;<strong>zucker_reporttemplates</strong>&#8220;, and &#8220;<strong>zucker_wordtemplates</strong>&#8220;.</li>
</ol>
<p>Now everyone in team &#8220;Everyone&#8221; should be able to run all the reports.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rolandli.com/2009/09/29/fix-zuckerreports-non-admin-cannot-run-reports/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fix ZuckerReport Not Reporting Custom Fields</title>
		<link>http://www.rolandli.com/2009/09/28/fix-zuckerreport-not-reporting-custom-fields</link>
		<comments>http://www.rolandli.com/2009/09/28/fix-zuckerreport-not-reporting-custom-fields#comments</comments>
		<pubDate>Mon, 28 Sep 2009 23:59:58 +0000</pubDate>
		<dc:creator>rolandli</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[sugarcrm zuckerreports bug fix custom fields problem empty]]></category>

		<guid isPermaLink="false">http://www.rolandli.com/?p=540</guid>
		<description><![CDATA[One of my clients had me setup SugarCRM Community Edition for him. SugarCRM Community Edition is quite nice, it&#8217;s open source and free it helps my client to save quite some moeny. However it lacks some advance features such as generating reports. ZuckerReports fills that hole by providing user a way to create multiple types [...]]]></description>
			<content:encoded><![CDATA[<p>One of my clients had me setup SugarCRM Community Edition for him. SugarCRM Community Edition is quite nice, it&#8217;s open source and free it helps my client to save quite some moeny. However it lacks some advance features such as generating reports. ZuckerReports fills that hole by providing user a way to create multiple types of reports, kudos to the developers behind it. </p>
<p>But after installing it, I noticed there is a bug while creating a Listing Template, whenever there is a custom field (user-defined field) involved in filtering, the returning result is empty. So I dug into the code and found out that the bugs were simple to fix. Just modify one function in each of these two files:<br />
<span id="more-540"></span></p>
<p><strong>modules/ZuckerListingTemplateOrder/ListingTemplateFilter.php</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
99
100
101
102
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> create_where_clause<span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameter_values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$beanList</span><span style="color: #339933;">,</span> <span style="color: #000088;">$beanFiles</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$beanName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$beanList</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">module_name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$beanFile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$beanFiles</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$beanName</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$beanName</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$beanFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$beanFile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$seed</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000088;">$beanName</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$field_def</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$seed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_defs</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;type&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;relate&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;source&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;non-db&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;table&quot;</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;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;rname&quot;</span><span style="color: #009900;">&#93;</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: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;_c&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$seed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;_cstm.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</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;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$seed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">comparator</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">value_type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;parameter&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #000088;">$rpl</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> ReportParameterLink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$rpl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">retrieve</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$parameter_values</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$rpl</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</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: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">value</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;'&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p><strong>modules/ZuckerListingTemplateOrder/ListingTemplateOrder.php</strong></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>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
</pre></td><td class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> create_order_clause<span style="color: #009900;">&#40;</span><span style="color: #000088;">$parameter_values</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$beanList</span><span style="color: #339933;">,</span> <span style="color: #000088;">$beanFiles</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$beanName</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$beanList</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">module_name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$beanFile</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$beanFiles</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$beanName</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$beanName</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$beanFile</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #b1b100;">require_once</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$beanFile</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$seed</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #000088;">$beanName</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$field_def</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$seed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_defs</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;type&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;relate&quot;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;source&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;non-db&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;table&quot;</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;">$field_def</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;rname&quot;</span><span style="color: #009900;">&#93;</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: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</span><span style="color: #339933;">,</span> <span style="color: #339933;">-</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;_c&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$seed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;_cstm.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</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;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$seed</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">table_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">field_name</span><span style="color: #339933;">;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">order_type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;asc&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; asc &quot;</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;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot; desc &quot;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Basically what it does is checking if a field ends with &#8220;_c&#8221;, if so meaning it&#8217;s a custom field so loads it from the correct custom table. Hope this helps with those who have problem listing custom fields from ZuckerReports.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rolandli.com/2009/09/28/fix-zuckerreport-not-reporting-custom-fields/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building Qt with OpenSSL</title>
		<link>http://www.rolandli.com/2009/05/22/building-qt-with-openssl</link>
		<comments>http://www.rolandli.com/2009/05/22/building-qt-with-openssl#comments</comments>
		<pubDate>Fri, 22 May 2009 17:28:53 +0000</pubDate>
		<dc:creator>rolandli</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[OpenSSL]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[SSL]]></category>

		<guid isPermaLink="false">http://www.rolandli.com/?p=527</guid>
		<description><![CDATA[A project I&#8217;ve been working on requires the ability to visit SSL sites (sites with https in the URL). So I had to rebuild Qt with OpenSSL support since by default Qt does not have SSL. After a few failure, here are the steps. Please not this is for Qt 4.5 only: 1. If you [...]]]></description>
			<content:encoded><![CDATA[<p>A project I&#8217;ve been working on requires the ability to visit SSL sites (sites with https in the URL). So I had to rebuild Qt with OpenSSL support since by default Qt does not have SSL.</p>
<p>After a few failure, here are the steps. Please not this is for Qt 4.5 only:</p>
<p>1. If you don&#8217;t have Qt already, go download it at http://www.qtsoftware.com/downloads</p>
<p>2. Download OpenSSL here http://www.openssl.org/source/You can build it by following the instructions or get the binaries.</p>
<p>3. In command line, go to your Qt folder, configure the build with</p>

<div class="wp_syntax"><div class="code"><pre class="dos" style="font-family:monospace;">configure -openssl -I:path_to_openssl_include_folder -L:path_to_openssl_library_folder</pre></div></div>

<p>If you want the OpelSSL libraries linked, use &#8220;-openssl-link&#8221; instead.</p>
<p>4. Then you can start compiling with &#8220;make&#8221; or &#8220;nmake&#8221; depending on your OS.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rolandli.com/2009/05/22/building-qt-with-openssl/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Implement an auto update system</title>
		<link>http://www.rolandli.com/2009/04/19/implement-an-auto-update-system</link>
		<comments>http://www.rolandli.com/2009/04/19/implement-an-auto-update-system#comments</comments>
		<pubDate>Sun, 19 Apr 2009 21:32:39 +0000</pubDate>
		<dc:creator>rolandli</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[auto]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[qt]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.rolandli.com/?p=396</guid>
		<description><![CDATA[Auto update is widely used in modern software development. It simplifies and speeds up product upgrade to enhance features and fix problems. I have been working on an application which is still in alpha version and testers need to update it incrementally and frequently. The testers are not computer professionals, so I have to make [...]]]></description>
			<content:encoded><![CDATA[<p>Auto update is widely used in modern software development. It simplifies and speeds up product upgrade to enhance features and fix problems. I have been working on an application which is still in alpha version and testers need to update it incrementally and frequently. The testers are not computer professionals, so I have to make the update process as easy as possible. Below is the basic design and code. The toolkit that&#8217;s being used is QT 4.5. But the concept is universal.</p>
<p>To design such system, the following steps are considered:</p>
<ol>
<li>A server that contains the latest version and a list of updated files.</li>
<li>The application should connect to the server to retrieve the list and compare the versions.</li>
<li>If there is a new version, download the updated files to replace the new ones.</li>
<li>Clean up.</li>
</ol>
<p>Let&#8217;s work on it step-by-step. To save space, I will only post relevant code:<br />
<span id="more-396"></span></p>
<h3>1. Server Side</h3>
<p>The directory set up is as the following:<br />
<img src="http://www.rolandli.com/wp-content/uploads/2009/04/dir-structure-thumb.jpg" alt="dir_structure" title="dir_structure" width="375" height="182" class="size-full wp-image-418" /><br />
I used an XML file <em>latest.xml</em> to store the version and file list. It&#8217;s pretty self-explanatory.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #00bbdd;">&lt;!DOCTYPE XML&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;appname<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;version</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;0.5.1&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/version<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;app.exe&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;some.dll&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
                <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">&quot;another.dll&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/appname<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.rolandli.com/2009/04/19/implement-an-auto-update-system/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Darn Virus!</title>
		<link>http://www.rolandli.com/2007/12/01/darn-virus</link>
		<comments>http://www.rolandli.com/2007/12/01/darn-virus#comments</comments>
		<pubDate>Sat, 01 Dec 2007 11:20:02 +0000</pubDate>
		<dc:creator>rolandli</dc:creator>
				<category><![CDATA[How-To]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[virus]]></category>

		<guid isPermaLink="false">http://www.rolandli.com/?p=42</guid>
		<description><![CDATA[I haven&#8217;t had to deal with computer virus for a while. Today I had to spend hours just trying to delete two DLL files injected into my system by some ad-ware/spyware. Here are steps I took to removed them. Hopefully they will be helpful to you in removing those particular files or just in general [...]]]></description>
			<content:encoded><![CDATA[<p>I haven&#8217;t had to deal with computer virus for a while. Today I had to spend hours just trying to delete two DLL files injected into my system by some ad-ware/spyware. Here are steps I took to removed them. Hopefully they will be helpful to you in removing those particular files or just in general removing malicious files:</p>
<p>The two files are <strong>ddccy.dll</strong> and <strong>opnnljj.dll. </strong>You can Google them to see what they do. I made use of Windows XP Professional CD.</p>
<ol>
<li>I booted the system with the XP CD. </li>
<li>(Then inserted my RAID driver since I&#8217;m using RAID. You can skip this step if you are using IDE drives). </li>
<li>Choose &quot;Repair&quot; mode. Then choose an installation and log in. </li>
<li>Navigate to the folder where the files are located, use &quot;del&quot; command to remove them. </li>
<li>Reboot back into Windows XP and run <a href="http://www.spywareinfo.com/~merijn/programs.php#hijackthis" target="_blank">HijackThis</a>. </li>
<li>Choose &quot;Scan&quot; and check the result </li>
<li>Select the items that are related to the files you deleted, and click &quot;Fix Checked&quot; </li>
<li>Done. </li>
</ol>
<p>Good luck and be careful next time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rolandli.com/2007/12/01/darn-virus/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
