<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Cool hakE</title>
	<atom:link href="http://coolhake.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://coolhake.wordpress.com</link>
	<description>sharing...sharing..sharing....</description>
	<lastBuildDate>Fri, 20 Aug 2010 08:10:19 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='coolhake.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Cool hakE</title>
		<link>http://coolhake.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://coolhake.wordpress.com/osd.xml" title="Cool hakE" />
	<atom:link rel='hub' href='http://coolhake.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Tahapan Hubungan</title>
		<link>http://coolhake.wordpress.com/2010/08/20/tahapan-hubungan-2/</link>
		<comments>http://coolhake.wordpress.com/2010/08/20/tahapan-hubungan-2/#comments</comments>
		<pubDate>Fri, 20 Aug 2010 08:10:19 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/?p=138</guid>
		<description><![CDATA[Tahap-Tahap Dalam Hubungan Twit dr Mbak AlissaWahid tentang tahap perkembangan hubungan. Twit dari beliau telah dilakukan penyesuaian seperlunya. OK, mari kita belajar ttg perkembangan hubungan antara sepasang manusia yang merupakan hasil penelitian Andrew G. Marshall. Kata Titiek Puspa: jatuh cinta berjuta rasanya. Dunia milik berdua. Menjalani nasib seperti Romeo &#38; Juliet pun kita yakini, tapi [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=138&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Tahap-Tahap Dalam Hubungan</strong></p>
<p>Twit dr Mbak AlissaWahid tentang tahap perkembangan hubungan. Twit dari beliau telah dilakukan penyesuaian seperlunya.</p>
<p>OK, mari kita belajar ttg perkembangan hubungan antara sepasang manusia yang merupakan hasil penelitian Andrew G. Marshall. Kata Titiek Puspa: jatuh cinta berjuta rasanya. Dunia milik berdua. Menjalani nasib seperti Romeo &amp; Juliet pun kita yakini, tapi awas, rasa jatuh cinta yg melayang-layang itu ternyata cuma bertahan 18-36 bulan. Bahkan belum bisa dibilang loving relationship.</p>
<p>Lirikan mata yg bikin perut mulas, debar hati saat ketemu, masih bisa menghilang ditelan hari, tak berkembang jadi hubungan yang kuat. Saat jatuh cinta, ternyata frekuensi otak melakukan ‘sinkronisasi’ sehingga tiba2 menemukan banyak kesamaan. Misal: “tnyata kita sama2 suka GnR lho”. Saat jatuh cinta, perbedaan-perbedaan yang ada terabaikan karena sinkronisasi itu, makanya berasa ketemu soulmate, pasangan jiwa.. cocook bgt!</p>
<p>Saat jatuh cinta, kelemahan-kelemahan pasangan nggak bermakna. Misal: suka mukul? “cinta kami pasti akan membuatnya berubah..” Apalagi abis berantem. kl fase jatuh cinta, saat baikan ini saat makin dalem jatuhnya cinta.. dunia suejuuk! Nah, pasangan yang bilang “kok sudah tak ada lagi cinta di antara kami?” biasanya yang dimaksud ya rasa jatuh cinta itu.</p>
<p>Nah, setelah melewati fase jatuh cinta, baru masuk hubungan yang sesungguhnya. Ada 6 tahap yang biasanya dilalui pasangan, dengan tantangan yang berbeda-beda. 6 tahap hubungan : blending, nesting, self-affirming, collaborating, adapting, renewing.</p>
<p>Blending biasanya masa hubungan tahun pertama (di tengah fase jatuh cinta, fase blending sudah mulai muncul) sampai akhir tahun kedua hubungan.</p>
<p>Nesting terjadi dalam masa hubungan sampai akhir tahun ketiga. Di sini mulai muncul berantem beneran.</p>
<p>Self-affirming itu tahap hubungan di tahun keempat sampai kelima dimana kebutuhan individu mulai muncul lagi. Mulai ada kompromi.</p>
<p>Collaborating itu tahap hubungan mulai th ke5 sampai 15. Sudah mulai mapan, tapi kadang juga bosan. Besar kemungkinan “jalan sendiri2″.</p>
<p>Adapting ini masa hubungan yang paling rapuh. Penuh dengan tantangan di luar hubungan itu sendiri. Misalnya menghadapi anak remaja. Fase ini terjadi di tahun ke 15-25.</p>
<p>Tahap hubungan terakhir yaitu renewing. Ini yg kita lihat dr orangtua kita yg sudah melewati masa 25 tahun pernikahan: penerimaan total.</p>
<p>12-18bulan sejak saat jatuh cinta, chemistry sang dua sejoli mulai menurun. Perbedaan mulai terasa, menimbulkan kejutan-kejutan. Blending dlm hubungan adalah saat dimana 2 individu mulai menyatukan perbedaan2. Yg suka lagu metal mulai terbiasa dengan lagu2 opera. Kunci di tahun 2-3 dlm tahap nesting adalah mendengarkan, krn akan membantu kita memahami pasangan seutuhnya. Hubungan yang sehat memberi ruang yang seimbang untuk kedua dorongan diri tersebut. Kita belajar mengikhlaskan sebagian untuk mendapatkan keduanya.</p>
<p>Tahun ke2-3 hubungan adalah fase nesting (bersarang). Komitmen makin jelas. Di sini loving attachments mulai terbentuk. Dalam hubungan fase nesting, banyak hal yang sebelumnya ditahan mulai bermunculan. Tadinya cuek pasangan suka telat, sekarang mulai sebel. Di fase nesting, mata yang tadinya hanya tertuju untuk pasangan, sudah mulai bisa menyadari ada orangtua, keluarga, teman dll. Makanya dalam hubungan fase nesting, banyak pasangan mulai sering berantem. Jadi hal terpenting adalah mencari cara tepat untukmengatasi perbedaan.</p>
<p>Next stage: Self-Affirming. Ini saat pasangan mulai kembali ke kebutuhan personal, bukan lagi mendahulukan hubungan dengan pasangan. Tadinya berdua lebih baik, sekarang pengen yang sendiri-sendiri dong. Lebih bebas, nggak perlu jaga perasaan pasangan. Fase Self-Affirming ini di usia hubungan 3-4 tahun. Kadang bikin shock, apalagi kalo di fase-fase sebelumnya semua dilakukan barengan. Fase self-affirming ini saat kita mulai punya kompromi-kompromi utk menjaga keseimbangan individual dengan kebutuhan hubungan. Yang berat di fase Self-Affirming kalo ada 1 pihak yang dependen. Merasa ‘ditinggalkan’ saat pasangan mulai sibuk dengan diri sendiri. Padahal justru independensi di fase SelfAffirming itu jadi fondasi yang kuat utk interdependensi jangka panjang.</p>
<p>Fase Collaborating: usia hubungan 5-15 tahun. Rasa aman sudah ada, masuk bentuk kerjasama karena saling tergantung. Mapan deh. Tantangan: hubungan yang terlalu mapan kadang menimbulkan kebosanan. Nggak ada greng. Kalo komunikasi jelek, sibuk sendiri-sendiri. Fase Collaborating adalah fase terberat dalam perkembangan hubungan perkawinan. Di Inggris, sebagian besar perceraian terjadi di fase ini. Di fase Collaborating ini, yang paling menentukan adalah saling dukung yg besar, bukan saling tuntut. Bisa runyam.</p>
<p>Hubungan terus berkembang masuk ke fase Adapting, tahun 15-25an. Adaptasi bukan dalam hal hubungan, tapi ke hal-hal lain. Anak remaja, karir stuck, dll. Di fase adapting ini, pasangan juga sudah realistis terhadap kebiasaan/kepribadian pasangannya. “Abis gmn, dia emang judes..”. Jadi di tahap hubungan yang ini, yang berat adalah melawan pikiran jahat “dia sih nggak mungkin mau berubah demi saya/anak2..”. Skill yang diperlukan untuk survive di fase Adapting adalah mendengarkan, supaya betul-betul paham harapan pasangan.</p>
<p>Fase terakhir adalah Renewing, setelah usia hubungan melampaui 25 tahun. Jika mampu melewati tahap-tahap sebelumnya dengan baik, ini masa keemasan: damai, penuh cinta. Tantangannya hanya saat2 puber kedua atau menopause yg memang memunculkan hal2 khusus. Tp umumnya hubungan sgt oke. Bila sudah sampai tahap renewing ini, keluarga menjadikan pasangan ini sbg sumber inspirasi &amp; pusat kekuatan</p>
<p>Semoga kita semua bs melampaui keenam tahap hubungan dg baik smp jd kakek nenek &amp; jd teladan anak cucu. Amiin..</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/138/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=138&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2010/08/20/tahapan-hubungan-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Use Excel to compare two lists of data</title>
		<link>http://coolhake.wordpress.com/2008/09/05/use-excel-to-compare-two-lists-of-data/</link>
		<comments>http://coolhake.wordpress.com/2008/09/05/use-excel-to-compare-two-lists-of-data/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 02:08:45 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[MS Office]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/09/05/use-excel-to-compare-two-lists-of-data/</guid>
		<description><![CDATA[Applies to: Microsoft Office Excel 2003 For financial record-keeping, you often have to compare two lists to find data that appears on one but not on the other. Which new clients need to be added to the master database? Which credit card receipts are not reflected on the monthly statement, and vice versa? What checks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=131&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="cdAppliesTo"><span class="cdAppliesToTitle">Applies to: </span><span class="cdAppliesToText"><big><big><a class="cdOAnc cdBCTCCatLink" href="http://office.microsoft.com/en-us/excel/FX100646961033.aspx">Microsoft Office Excel 2003</a></big></big></p>
<p></span>
<p>For financial record-keeping, you often have to compare two lists to<br />
find data that appears on one but not on the other. Which new clients<br />
need to be added to the master database? Which credit card receipts are<br />
not reflected on the monthly statement, and vice versa? What checks and<br />
deposits are still outstanding? It&#8217;s a tedious task if you do it<br />
manually. </p>
<p>Microsoft Office Excel 2003 can help you perform this task faster<br />
and more accurately. In many cases, you can do it even if the data is<br />
not provided in a standardized form in both lists.</p>
<h2>Comparing two lists of assets</h2>
<p>In this article, you&#8217;ll use data from the <a href="http://office.microsoft.com/search/redir.aspx?AssetID=TC011117371033&amp;CTT=5&amp;Origin=HA011039151033" class="OAnc">Compare Two Lists</a> sample datasheet to learn how an accountant could use Excel functions to compare two lists of assets — the <b class="bterm">fixed asset records</b> for a company and a <b class="bterm">property tax affidavit</b> that must be updated annually. It&#8217;s a five-step process:</p>
<ol>
<li>Make sure each asset has a unique identifier.</li>
<li>Find assets on the property tax affidavit that are not in the fixed asset records.</li>
<li>Find assets in the fixed asset records that are not on the property tax affidavit.</li>
<li>Sort lists to see nonmatching assets more easily.</li>
<li>Review nonmatching assets and check for accuracy.</li>
</ol>
<h2>Step 1: Make sure each asset has a unique identifier</h2>
<p>The following illustrations show the two lists that you want to<br />
compare — a list of assets from a property tax affidavit and a list of<br />
fixed asset records.</p>
<p><i>Business assets on property tax affidavit and on  fixed asset records</i></p>
<p><img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011095921033" alt="Property tax affidavit and fixed asset records" border="0" /></p>
<p>As you see, the property tax affidavit does not have unique<br />
identifiers, such as asset numbers, for each asset. But to compare<br />
these lists, assets in each one must have a unique identifier. </p>
<p>In this example, the best way to identify each asset is by a<br />
combination of asset description and date, so you&#8217;ll add a new column<br />
called &#8220;Description &amp; Date&#8221; to each list. </p>
<p><b class="cntnote"> Note </b>  In the Compare Asset Lists sample<br />
datasheet, the property tax affidavit and the fixed asset records have<br />
been copied onto one worksheet.</p>
<h3>Add a &#8220;Description &amp; Date&#8221; column to the fixed asset records</h3>
<ol>
<li>In the Fixed Asset Records area of the worksheet, select the Asset column,<br />
				and then on the <b class="ui">Insert</b> menu, click <b class="ui">Columns</b>.</li>
<li>In cell G2, type <b>Description &amp; Date</b>, and then press ENTER.</li>
<li>Select cell G2.<br />
				On the <b class="ui">Format</b> menu, click <b class="ui">Cells</b>, click the <b class="ui">Alignment</b> tab, select <b class="ui">Wrap text</b>, and then click <b class="ui">OK</b>.</li>
<li>In cell G3, type <b>=H3&amp;&#8221; &#8220;&amp;YEAR(I3)</b>. This combines the description from cell H3 and the year from cell I3 into one field.</li>
<li>To copy the formula from cell G3 to cell G14, select cell G3 and then drag the fill handle <img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" alt="Fill handle" border="0" /> to cell G14.</li>
<li>To make the column width fit the results, double-click the boundary to the right of the Description &amp; Date column heading.</li>
</ol>
<p><i>Fixed asset records with combined description and date in new column</i></p>
<p><img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101401033" alt="Fixed asset records with combined description and date" border="0" /></p>
<h3>Add a &#8220;Description &amp; Date&#8221; column to the property tax affidavit</h3>
<ol>
<li>In the Property Tax Affidavit area of the worksheet, select the column to the right of the Cost column, and then on the <b class="ui">Insert</b> menu, click <b class="ui">Columns</b>.</li>
<li>In cell E2, type <b>Description &amp; Date</b>, and then press ENTER.</li>
<li>Select cell E2.<br />
				On the <b class="ui">Format</b> menu, click <b class="ui">Cells</b>, click the <b class="ui">Alignment</b> tab, select <b class="ui">Wrap text</b>, and then click <b class="ui">OK</b>.</li>
<li>In cell E3, type <b>=C3&amp;&#8221; &#8220;&amp;B3</b>.</li>
<li>To copy the formula from cell E3 to cell E12, select cell E3, and then drag the fill handle <img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" alt="Fill handle" border="0" /> to cell E12.</li>
<li>To make the column width fit the results, double-click the boundary to the right of the Description &amp; Date column heading.</li>
</ol>
<p><i>Property tax affidavit with combined description and date in new column</i></p>
<p><img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101741033" alt="Property tax affidavit with combined description and date" border="0" /></p>
<p>Now that you&#8217;re comparing apples to apples, you can get down to business.</p>
<h2><a id="step 1" name="step 1"></a>Step 2: Find assets on the property tax affidavit that are not in the fixed asset records</h2>
<ol>
<li>In the Property Tax Affidavit worksheet, select the column to the right of the Description &amp; Date column,<br />
				and then on the <b class="ui">Insert</b> menu, click <b class="ui">Columns</b>.</li>
<li>In cell F2, type <b>Missing?</b>.</li>
<li>In cell F3, type <b>=ISNA(MATCH(E3,$I$3:$I$14,FALSE))</b>.</li>
<li>To copy the formula from cell F3 to cell F12, select cell F3, and then drag the fill handle <img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" alt="Fill handle" border="0" /> to cell F12.</li>
</ol>
<p>Assets that are on the property tax affidavit but not in the fixed asset records will display <b class="ui">TRUE</b> in the Missing? column.</p>
<p><i>New</i><br />
			  Missing? <i>column showing whether an asset is not found in other list</i></p>
<p><img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101781033" alt="New Missing? column" border="0" /></p>
<h2>Step 3: Find assets in the fixed asset records that are not on the property tax affidavit</h2>
<ol>
<li>In the Fixed Asset Records worksheet, in cell M2,  type <b class="ui">Missing?</b>.</li>
<li>In cell M3, type <b>=ISNA(MATCH(I3,$E$3:$E$12,FALSE))</b>, and then press ENTER.</li>
<li>To copy the formula from cell M3 to cell M14, Select cell M3, and then drag the fill handle <img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" alt="Fill handle" border="0" /> to cell M14.</li>
</ol>
<p>Assets that are in the fixed asset records but not on the property tax affidavit will display <b class="ui">TRUE</b> in the Missing? column.</p>
<h2>Step 4: Sort lists to see nonmatching assets more easily</h2>
<p>To more easily see the assets that are not on both lists, you can sort the lists.</p>
<p><b class="cntnote"> Note </b>  If you sort the lists without first<br />
following these steps to convert the formulas to values, the formulas<br />
will not calculate correctly. In a large database, converting the<br />
formulas to values can also help avoid long recalculation times.</p>
<h3>Sort for nonmatching assets in the Property Tax Affidavit worksheet</h3>
<ol>
<li>Drag the pointer to select cells A2 to F12.</li>
<li>On the <b class="ui">Edit</b> menu, click <b class="ui">Copy</b>.</li>
<li>On the <b class="ui">Edit</b> menu, click <b class="ui">Paste Special</b>.</li>
<li>In the <b class="ui">Paste Special</b> dialog box, under <b class="ui">Paste</b>, click <b class="ui">Values</b>, and then click <b class="ui">OK</b>.</li>
<li>On the <b class="ui">Data</b> menu, click <b class="ui">Sort</b>.</li>
<li>Under <b class="ui">My data range has</b>, click <b class="ui">Header row</b>; in the <b class="ui">Sort by</b> box, click <b class="ui">Missing?</b>, and then click <b class="ui">OK</b>.</li>
</ol>
<h3>Sort for nonmatching assets in the Fixed Asset Records worksheet</h3>
<ol>
<li>Drag the pointer to select cells H2 to M14.</li>
<li>On the <b class="ui">Edit</b> menu, click <b class="ui">Copy</b>.</li>
<li>On the <b class="ui">Edit</b> menu, click <b class="ui">Paste Special</b>.</li>
<li>In the <b class="ui">Paste Special</b> dialog box, under <b class="ui">Paste</b>, click <b class="ui">Values</b>, and then click <b class="ui">OK</b>.</li>
<li>On the <b class="ui">Data</b> menu, click <b class="ui">Sort</b>.</li>
<li>Under <b class="ui">My data range has</b>, click <b class="ui">Header row</b>; in the <b class="ui">Sort by</b> box, click <b class="ui">Missing?</b>, and then click <b class="ui">OK</b>.</li>
</ol>
<p>You can now easily see which assets may need to be added or deleted to update the property tax affidavit.</p>
<p><i>Property tax affidavit and fixed asset records sorted by</i><br />
			  Missing? <i>column</i></p>
<p><img src="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101801033" alt="Property tax affidavit and fixed asset records sorted by Missing? column" border="0" /></p>
<h2>Step 5: Review nonmatching assets and check for accuracy</h2>
<p>Before you update the property tax affidavit, it&#8217;s a good idea to<br />
manually review the nonmatching assets — which is fortunately a lot<br />
faster than manually comparing the entire list. Review the nonmatching<br />
assets and determine why they don&#8217;t match. Were the assets retired or<br />
sold? Are they new assets that should be added, or are they assets that<br />
are not required to be reported on the affidavit? Or did the assets<br />
fail to find a match because of misspellings or other errors?</p>
<h2>Other ways to prepare data for matching</h2>
<p>Sometimes the data in two lists must be standardized before Excel<br />
can compare the lists. In the preceding example, the dates in one list<br />
were converted to years, and two fields were combined into one. The<br />
following table shows common data inconsistencies and suggested Excel<br />
functions that you can use to prepare data for matching. </p>
<table class="collapse">
<tbody>
<tr class="trbgeven">
<th>Problem</th>
<th>Example</th>
<th>How to modify</th>
</tr>
<tr class="trbgodd">
<td>Inconsistent abbreviations</td>
<td>Litware, Inc.<br />
vs. Litware, Incorporated</td>
<td>Use the LEFT function to create a field with only the number of characters from the left that you specify.</td>
</tr>
<tr class="trbgeven">
<td>Extra numbers or characters on one list</td>
<td>12345 vs. 12345-1033</td>
<td>Use the LEFT or RIGHT functions to create a field with only the number of characters from the left or right that you specify.</td>
</tr>
<tr class="trbgodd">
<td>Imprecise numbers caused by estimates, rounding variances, or sales tax</td>
<td>$12,000 vs. $12,011</td>
<td>Use the ROUND function to create a field with comparable amounts.</td>
</tr>
<tr class="trbgeven">
<td>Extra spaces</td>
<td>Jae B. Pak vs. Jae     B. Pak</td>
<td>Use the TRIM function to remove all spaces from text except single spaces between words.</td>
</tr>
</tbody>
</table>
<p><span class="cdAppliesToText"><br /></span></div>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/131/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/131/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=131&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/09/05/use-excel-to-compare-two-lists-of-data/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011095921033" medium="image">
			<media:title type="html">Property tax affidavit and fixed asset records</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" medium="image">
			<media:title type="html">Fill handle</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101401033" medium="image">
			<media:title type="html">Fixed asset records with combined description and date</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" medium="image">
			<media:title type="html">Fill handle</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101741033" medium="image">
			<media:title type="html">Property tax affidavit with combined description and date</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" medium="image">
			<media:title type="html">Fill handle</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101781033" medium="image">
			<media:title type="html">New Missing? column</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA060528981033" medium="image">
			<media:title type="html">Fill handle</media:title>
		</media:content>

		<media:content url="http://office.microsoft.com/global/images/default.aspx?AssetID=ZA011101801033" medium="image">
			<media:title type="html">Property tax affidavit and fixed asset records sorted by Missing? column</media:title>
		</media:content>
	</item>
		<item>
		<title>Install Ubuntu Hardy Heron (8.04.1) on the Acer Aspire One</title>
		<link>http://coolhake.wordpress.com/2008/09/04/install-ubuntu-hardy-heron-8041-on-the-acer-aspire-one/</link>
		<comments>http://coolhake.wordpress.com/2008/09/04/install-ubuntu-hardy-heron-8041-on-the-acer-aspire-one/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 01:09:57 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/09/04/install-ubuntu-hardy-heron-8041-on-the-acer-aspire-one/</guid>
		<description><![CDATA[Fully functional: Suspend / Resume Video (with desktop effects) Wireless Networking Wired Networking Webcam USB Silent Fan Partial Function: Card Readers (only work if card in when booting) Audio &#8211; there is sound, issues detailed below Not Functional: Hibernate on A110L Card Reader power saving wifi power saving wifi kill switch Prerequisites: Before you begin [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=127&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>Fully functional:</h3>
<ul>
<li>Suspend / Resume</li>
<li>Video (with desktop effects)</li>
<li>Wireless Networking</li>
<li>Wired Networking</li>
<li>Webcam</li>
<li>USB</li>
<li>Silent Fan</li>
</ul>
<p class="line867">
<h3>Partial Function:</h3>
<ul>
<li>Card Readers (only work if card in when booting)</li>
<li>Audio &#8211; there is sound, issues detailed below</li>
</ul>
<p class="line867">
<h3>Not Functional:</h3>
<ul>
<li>Hibernate on A110L</li>
<li>Card Reader power saving</li>
<li>wifi power saving</li>
<li>wifi kill switch</li>
</ul>
<p class="line867">
<h2>Prerequisites:</h2>
<p class="line874">Before you begin you will need the following:</p>
<ul>
<li>
<p class="line862">A copy of 8.04.1 Hardy Heron.<br />
This is the latest version.  If you downloaded the ISO a while ago, it may be 8.04.0. The original 8.04.0  release will not even boot.</li>
<li>An external USB CD-ROM. If not:
<ul>
<li>A 1+ GB memory key that can be formatted.</li>
<li>
<p class="line862">A copy of the liveUSB DEB. Website: <a class="http" href="http://klik.atekon.de/liveusb">http://klik.atekon.de/liveusb</a> and the  DEB: <a class="http" href="http://ppa.launchpad.net/probono/ubuntu/pool/main/l/liveusb/">http://ppa.launchpad.net/probono/ubuntu/pool/main/l/liveusb/</a>.</p>
</li>
<li>A wired network connection.</li>
<li>Another computer, with network access.</li>
</ul>
</li>
</ul>
<p class="line867">
<h2>Note on using this guide</h2>
<p class="line874">This guide was written with Ubuntu in mind. Generally  everything works the same with the other variants of the distribution (Kubuntu,  Xubuntu). For ease of use gedit is the text editor we&#8217;ll be using. If you are  using a variant please substitute a different text editor (kate for Kubuntu,  mousepad for Xubuntu or just use vim/emacs/nano).</p>
<p class="line867">
<h2>Step One: Preparation</h2>
<p class="line867"><em>(Skip this step if you have an external USB CD-ROM)</em></p>
<p class="line874">If we don&#8217;t have any external USB CD-ROM the first thing we  need to do is create a bootable copy of the Ubuntu LiveCD on a memory key. This  will be our install media for the Aspire One. Its actually pretty similar to  creating recovery media for Linpus Lite (the included version of Linux).</p>
<p class="line874">Download and copy the LiveUSB .deb file from the link above to  a memory key (you can use the same one we we are going to format to create the  install media, we only need this file once), and remove the memory key. The  LiveUSB software should only be installed when booted off the LiveCD  environment, so we do that next.</p>
<p class="line862">Boot to the 8.04.1 Live CD on your other computer, and choose  the first option off the boot menu (Try Ubuntu). When you reach the desktop  insert the memory key with the LiveUSB software one it and double click. Follow  the prompts to install it. Now we can create our bootable USB key. Start the  LiveUSB application from System -&gt; Administration -&gt; Install LiveUSB.  Select the target device (my two keys were listed by a human readable name, so  it was easy to find) and click Execute. It will give you a warning about data  loss, so double check that you selected the correct device and continue.</p>
<p class="line874">Once that is done, you can shut down the other computer and  remove the memory key.</p>
<p class="line867">
<h2>Step Two: Install Ubuntu</h2>
<p class="line874">Shut down your Aspire One and insert the external USB CD-ROM or  the memory key that we just used. Turn it on and tap F12 to bring up the boot  menu.</p>
<p class="line862">With a CD-ROM, choose the USB CD-ROM option. With the bootable  memory key created, choose the USB HDD option. This will boot you to the USB  CD-ROM/LiveUSB stick, and allow you to install Ubuntu. Install it like normal if  you have the hard disk Aspire One. If you have the SDD Aspire One, for good  performance and to increase the life of the SSD use a non-journaled filesystem  (suggestion: EXT2). If you have already installed with EXT3 then follow this  post: <a class="http" href="http://www.aspireoneuser.com/forum/viewtopic.php?f=5&amp;t=164&amp;st=0&amp;sk=t&amp;sd=a&amp;start=10#p1177">http://www.aspireoneuser.com/forum/viewtopic.php?f=5&amp;t=164&amp;st=0&amp;sk=t&amp;sd=a&amp;start=10#p1177</a> to convert to EXT2. Installation (file copy) will take a LONG time (hour +). If  your not currently connected to the internet on a wired connection, you may get  an error about setting up a mirror. Don&#8217;t worry about it if you do however, its  non-fatal.</p>
<p class="line867">
<h2>Step 3: Tweak / Fix</h2>
<p class="line862">So now we should have an installed Ubuntu system. At this point  wire your One into the network. If you use DHCP it should pick up an IP address  automatically. The first thing you will want to do is updates, since the  wireless driver needs to be reinstalled after every kernel update. Open a  terminal (Applications -&gt; Accessories -&gt; Terminal). Do the updates:</p>
<p class="line867">
<pre>sudo apt-get update
sudo apt-get upgrade</pre>
<p class="line867">
<h3>WIRELESS:</h3>
<p class="line862">Now we need to disable the hardware drivers that Ubuntu tries  to use before the ones we make will function. So go to System -&gt;  Administration -&gt; Hardware Drivers and uncheck everything. It should prompt  us to reboot, so lets do it now.</p>
<p class="line874">We need to grab the wireless driver, and the things we need to  build it, from a terminal:</p>
<p class="line867">
<pre>mkdir source
cd source
wget http://snapshots.madwifi.org/madwifi-hal-0.10.5.6/madwifi-hal-0.10.5.6-r3835-20080801.tar.gz
tar -xzvf madwifi-hal-0.10.5.6-r3835-20080801.tar.gz
cd madwifi-hal-0.10.5.6-r3835-20080801
sudo apt-get install build-essential linux-headers-$(uname -r)</pre>
<p class="line874">And we build and install:</p>
<p class="line867">
<pre>make
sudo make install
sudo modprobe ath_pci</pre>
<p class="line874">In order to have the wireless work after reboot, add the  following line to /etc/modules (&#8220;sudo gedit /etc/modules&#8221;) to automatically load  the module when booting:</p>
<pre>ath_pci</pre>
<p class="line862">You should now have working wireless. However you may want to  do the following to prevent problems <em>(the symbol mismatch)</em> when the  module is loaded:</p>
<p class="line862">Add <strong>ath_hal</strong> to the  <strong>DISABLED_MODULES=</strong> stanza in  <strong>/etc/default/linux-restricted-modules-common</strong></p>
<p class="line867"><em>(i.e. &#8216;DISABLED_MODULES=&#8221;ath_hal&#8221;&#8216;)</em></p>
<p class="line874">Every time there is a kernel update you will need to perform  the following steps to make the wireless work. Go to the directory  (madwifi-hal-0.10.5.6-r3835-20080801) and run:</p>
<p class="line867">
<pre>make clean
make
sudo make install</pre>
<p class="line867">
<h3>WIRELESS LED:</h3>
<p class="line862">To get your awesome wireless led to blink for you based on  traffic, put these lines in /etc/rc.local, just above the string <em>exit 0</em> (below doesn&#8217;t work).</p>
<p class="line867">
<pre>sysctl -w dev.wifi0.ledpin=3
sysctl -w dev.wifi0.softled=1</pre>
<p class="line874">The led on the front will now do the association blink, as well  as blink based on wireless traffic.</p>
<p class="line874">The wifi kill switch uses these keycodes (also to use in  rc.local):</p>
<pre>/usr/bin/setkeycodes e055 159
/usr/bin/setkeycodes e056 158</pre>
<p class="line867">
<h3>CARD READER:</h3>
<p class="line862">According to <a class="http" href="http://wiki.debian.org/DebianAcerOne">DebianAcerOne</a> the following  command enables the card reader:</p>
<pre>setpci -d 197b:2381 AE=47</pre>
<p class="line874">The card reader works fine if cards are inserted before  booting.</p>
<ul>
<li>it might help to suspend/resume</li>
<li>a static entry for the device /dev/mmcblk01p in /etc/fstab might help</li>
<li>powersaving can be done with the jmb38x_d3e.sh script</li>
</ul>
<p class="line867">
<h3>USB MOUNT:</h3>
<p class="line867"><em>(Do this step <strong>only</strong> if you get an error  inserting a USB stick)</em></p>
<p class="line874">If you insert a memory key, you may notice an error and that it  cannot be mounted. This is due to the CD-ROM entry in the fstab. Since we don&#8217;t  have an optical drive on the One we will comment that out. From a terminal  again:</p>
<p class="line867">
<pre>sudo gedit /etc/fstab</pre>
<p class="line874">You should see a line that looks like:</p>
<p class="line867">
<pre>/dev/sdb        /media/cdrom0   udf,iso9660 user,noauto,exec 0       0</pre>
<p class="line874">add a hash in front:</p>
<p class="line867">
<pre>#/dev/sdb        /media/cdrom0   udf,iso9660 user,noauto,exec 0       0</pre>
<p class="line874">Reboot, and automount should work.</p>
<p class="line867">
<h3>NOISE (FAN CONTROL)</h3>
<p class="line874">Bios v0.3114 doesn&#8217;t manage correctly Fan speed, resulting in a  very noisy AA0. Solution:</p>
<ul>
<li>
<p class="line862">Download the <a class="http" href="http://code.google.com/p/aceracpi/wiki/EmbeddedController">acer_ec.pl</a> script (<a class="http" href="http://electronpusher.org/~rachel/acerfand">Direct  download</a>).</p>
</li>
<li class="gap">
<p class="line862">Download the <a class="http" href="http://electronpusher.org/~rachel/acerfand">acerfand</a> daemon script (<a class="http" href="http://aceracpi.googlecode.com/svn/trunk/acer_ec/acer_ec.pl">Direct  download</a>).</p>
</li>
<li class="gap">Execute these lines in a terminal in the directory you downloaded  the above scripts:</li>
</ul>
<p class="line867">
<pre> chmod a+x acerfand
 sudo cp acer_ec.pl acerfand /usr/local/bin/</pre>
<ul>
<li>To run it straight away:</li>
</ul>
<p class="line867">
<pre> sudo acerfand</pre>
<ul>
<li>To run it at boot:</li>
</ul>
<p class="line867">
<pre> sudo gedit /etc/rc.local</pre>
<p class="line862">Insert the following line above the <em>exit 0</em> at the  bottom:</p>
<p class="line867">
<pre> /usr/local/bin/acerfand</pre>
<p class="line874">The fan is not completely disabled. When the default  temperature is reached (60ºC), fan works again. According to Intel, the Atom  chip could work until 99ºC.</p>
<p class="line867"><strong>Optional:</strong> Above instructions will work fine,  but if you want to define another temperature:</p>
<ul>
<li>Create an /etc/acerfand.conf file. The file is just a shell script that sets  up to three values. eg:</li>
</ul>
<p class="line867">
<pre>INTERVAL=5
FANOFF=60
FANAUTO=70</pre>
<p class="line874">Those are the default values, if the /etc/acerfand.conf file  isn&#8217;t found.</p>
<p class="line874">INTERVAL is the polling interval in seconds</p>
<p class="line874">FANOFF is the temperature (in Celsius Degrees) at or below  which to turn the fan off, if it&#8217;s currently on auto</p>
<p class="line874">FANAUTO is the temperature (in Celsius Degrees) at or above  which to turn the fan to auto, if it&#8217;s currently off</p>
<p class="line867"><a class="http" href="http://wiki.aspireone.net/index.php/How_to_hack_the_noisy_fan">More  information</a> from the original source, AspireOne Wiki.</p>
<p class="line867">
<h3>OPTIMIZING SSD PERFORMANCE:</h3>
<p class="line867"><em>(Skip this step if you have the hard disk Acer Aspire  One)</em></p>
<p class="line862">The performance of the SSD drive can be significantly improved  by a few tweaks described in <a class="http" href="http://blogs.zdnet.com/perlow/?p=9190">an article by Jason Perlow</a> (Tweek #1 is not working with Ubuntu on the Aspire One). The most important of  these are described here.</p>
<p class="line867">
<h4>Change the  file system mount options on SSDs to “noatime”</h4>
<p class="line874">Edit /etc/fstab (sudo gedit /etc/fstab) and change the the  option “relatime” to “noatime”. The line for the root partition should then be  something like:</p>
<pre>UUID=f0ae2c59-83d2-42e7-81c4-2e870b6b255d / ext2 noatime,errors=remount-ro 0 1</pre>
<p class="line867">
<h4>Use the “noop” I/O scheduler</h4>
<p class="line874">Edit /boot/grub/menu.lst using your favorite editor, and add  &#8220;elevator=noop&#8221; as an option. The default kernel configuration, found in the  last part of the file should be something like:</p>
<pre>title           Ubuntu 8.04.1, kernel 2.6.24-19-generic
root            (hd0,0)
kernel          /boot/vmlinuz-2.6.24-19-generic root=UUID=f0ae2c59-83d2-42e7-81c4-2e870b6b255d ro quiet splash elevator=noop
initrd          /boot/initrd.img-2.6.24-19-generic
quiet</pre>
<p class="line874">In order for the changes to remain when updating the kernel,  also in menu.lst, find the line</p>
<pre># defoptions=quiet splash</pre>
<p class="line874">and add &#8220;elevator=noop&#8221; as an option:</p>
<pre># defoptions=elevator=noop quiet splash</pre>
<p class="line867">
<h3>REDUCING SSD WEAR:</h3>
<p class="line867"><em>(Skip this step if you have the hard disk Acer Aspire  One)</em></p>
<p class="line874">Frequent writes to the SSD will cause failure eventually. We  can reduce the number of writes to the SSD my moving our logs to a temporary  filesystem in RAM that gets destroyed at ever reboot. Now this means your logs  will not be persistent across reboots making debugging difficult in some cases.  This step is optional of course, so if you need the logs for an extended period  of time do not follow these steps.</p>
<p class="line874">Open your fstab again, and add the following lines:</p>
<p class="line867">
<pre>sudo gedit /etc/fstab
tmpfs      /var/log/apt    tmpfs        defaults           0    0
tmpfs      /var/log        tmpfs        defaults           0    0
tmpfs      /tmp            tmpfs        defaults           0    0
tmpfs      /var/tmp        tmpfs        defaults           0    0</pre>
<p class="line867">
<h3>AUDIO:</h3>
<p class="line874">Out of the box there are various issues with the sound. These  range from headphone detection not functioning correctly, to the internal MIC  not working. There are solutions to these problems. Currently, however, there is  no known way to get everything working at once. All of the steps begin the same  way, rebuilding ALSA:</p>
<p class="line867">
<pre>sudo apt-get install module-assistant
sudo m-a update
sudo m-a prepare
sudo m-a a-i alsa
sudo alsa force-unload
sudo depmod -ae
sudo modprobe snd-hda-intel</pre>
<p class="line874">Add the following line to the end of /etc/modules in order to  ensure that the module is loaded during bootup:</p>
<pre>snd-hda-intel</pre>
<p class="line874">Now we need to make a choice. To have the internal MIC  non-functional (external works), but sound working after suspend and resume, we  edit /etc/modprobe.d/alsa-base (sudo gedit /etc/modprobe.d/alsa-base) and add  the following line to the bottom:</p>
<p class="line867">
<pre>options snd-hda-intel model=toshiba</pre>
<p class="line874">Reboot for that to take effect.</p>
<p class="line874">To have the internal MIC function correctly, but no sound after  suspending and resuming the computer add or change the following to the  /etc/modprobe.d/alsa-base as before:</p>
<p class="line867">
<pre>options snd-hda-intel model=auto</pre>
<p class="line874">Again, reboot for this to take effect.</p>
<p class="line874">For some unknown reason some people don&#8217;t hear any sound with  either option. If you experience this problem you might want to use the option  in /etc/modprobe.d/alsa-base as before to the following to resolve this problem:</p>
<p class="line867">
<pre>options snd-hda-intel model=acer</pre>
<p class="line874">If you experience crackling sound after rebooting, insert the  following line in /etc/modprobe.d/blacklist:</p>
<p class="line867">
<pre>blacklist snd_pcsp</pre>
<p class="line867"><strong>Optional:</strong> The default sound level is low. Open  a terminal and type <em>alsamixer</em> to adjust volume.</p>
<p class="line867">
<h3>TWEAKS TO  MAKE BETTER USE OF THE ASPIRE ONE&#8217;S SMALL SCREEN:</h3>
<p class="line874">There are various methods that will help you make better use of  the Aspire One&#8217;s small screen. One of the most important is being able to move  windows that are too large to fit on the screen at once. To move a hidden part  of the window into view, click and drag with the left mouse button on any part  of the window while holding down the ALT key. However, you won&#8217;t be able to drag  windows so the top of the window is above the top of the screen. To fix that,  enter the following in a terminal window:</p>
<p class="line867"><tt>gconftool-2 --set /apps/compiz/plugins/move/allscreens/options/constrain_y --type bool 0</tt></p>
<p class="line874">Since the Aspire One&#8217;s screen has almost twice as much  resolution horizontally as vertically, having panels on both the top and bottom  is not ideal. You may want to remove the top or bottom panels, make them  smaller, or move them so that they are vertical, on the left and right side,  instead of horizontal on top and bottom.</p>
<p class="line867">
<h3>HIBERNATE:</h3>
<p class="line862">In some set-ups, using hibernate has been reported to cause <a class="http" href="http://www.aspireoneuser.com/forum/viewtopic.php?f=28&amp;t=511">file  corruption</a>.</p>
<p class="line867">
<h3>TWEAKS FOR POWERSAVING  (Optional):</h3>
<p class="line874">Add the following to the /etc/rc.local file:</p>
<p class="line867">
<pre># Economize the SSD
sysctl -w vm.swappiness=1               # Strongly discourage swapping
sysctl -w vm.vfs_cache_pressure=50      # Don't shrink the inode cache aggressively

# As in the rc.last.ctrl of Linpus
echo ondemand &gt; /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo ondemand &gt; /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
cat /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate_max &gt; /sys/devices/system/cpu/cpu0/cpufreq/ondemand/sampling_rate

echo 3000 &gt; /proc/sys/vm/dirty_writeback_centisecs
echo 20 &gt; /proc/sys/vm/dirty_ratio
echo 10 &gt; /proc/sys/vm/dirty_background_ratio

echo 1 &gt; /sys/devices/system/cpu/sched_smt_power_savings
echo 10 &gt; /sys/module/snd_hda_intel/parameters/power_save
echo 5 &gt; /proc/sys/vm/laptop_mode

#Decrease power usage of USB while idle
[ -L /sys/bus/usb/devices/1-5/power/level ] &amp;&amp; echo auto &gt; /sys/bus/usb/devices/1-5/power/level
[ -L /sys/bus/usb/devices/5-5/power/level ] &amp;&amp; echo auto &gt; /sys/bus/usb/devices/5-5/power/level</pre>
<p class="line867">
<h3>NETBOOK REMIX (Optional):</h3>
<p class="line862">To install <a class="https" href="https://launchpad.net/netbook-remix">Ubuntu Netbook remix</a> -</p>
<ul>
<li>Insert the following into /etc/apt/sources.list:</li>
</ul>
<p class="line867">
<pre>deb http://ppa.launchpad.net/netbook-remix-team/ubuntu hardy main
deb-src http://ppa.launchpad.net/netbook-remix-team/ubuntu hardy main</pre>
<ul>
<li>then execute</li>
</ul>
<p class="line867">
<pre>sudo apt-get update
sudo apt-get install go-home-applet human-netbook-theme maximus ume-launcher window-picker-applet</pre>
<ul>
<li>
<p class="line862">Add maximus as startup program (system &gt; preferences &gt;  sessions &gt; startup programs)</p>
</li>
<li>
<p class="line862">Change the desktop theme to Human-Netbook (system &gt;  preferences &gt; appearance &gt; theme)</p>
</li>
<li>Delete the bottom panel</li>
<li>Reconfigure the top panel to contain the following items -
<ul>
<li>Go Home Applet</li>
<li>Window Picker Applet</li>
<li>Notification Area</li>
<li>Mixer Applet</li>
<li>Clock</li>
</ul>
</li>
<li>There is a bug in the ume-launcher after resuming from suspend. To work  around this place the following in /etc/pm/sleep.d/01UMELauncher -</li>
</ul>
<p class="line867">
<pre>#
# Copyright 2008 Matteo Collina &lt;matteo.collina@gmail.com&gt;
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.

export DISPLAY=:0.0

TMPFILE=/tmp/.launcher/resume-event

case "$1" in
        suspend|hibernate)
                rm -rf $TMPFILE
                echo "Removed resume-notify file"
        ;;
        resume|thaw)
                touch $TMPFILE
                echo "Created resume-notify file"
        ;;
esac

exit $?</pre>
<ul>
<li>Make the above file executable -</li>
</ul>
<p class="line867">
<pre>sudo chmod +x /etc/pm/sleep.d/01UMELauncher</pre>
<p class="line867">
<h3>Flash 9.0.48  (Optional, recommended for 512M of RAM):</h3>
<p class="line862">Ubuntu Hardy installs flash version 9.0.115, this version needs  a lot of memory to work and makes &#8216;AspireOne&#8217; slower than it is. A good option  is to come back to the last fast official version of flash (9.0.48). Just  download &#8216;Flash player 9 (99MB)&#8217; file from:</p>
<p class="line867"><a class="http" href="http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&amp;sliceId=2">http://kb.adobe.com/selfservice/viewContent.do?externalId=tn_14266&amp;sliceId=2</a></p>
<p class="line874">In this file there are a lot of old flash versions, navigate to  9r48 and uncompress this folder. Double click &#8216;flash-player installer&#8217;, choose  &#8216;Run in terminal&#8217; and follow the instructions.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/127/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/127/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/127/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/127/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/127/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=127&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/09/04/install-ubuntu-hardy-heron-8041-on-the-acer-aspire-one/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Runtime form controls</title>
		<link>http://coolhake.wordpress.com/2008/08/20/runtime-form-controls/</link>
		<comments>http://coolhake.wordpress.com/2008/08/20/runtime-form-controls/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 04:33:13 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/08/20/runtime-form-controls/</guid>
		<description><![CDATA[Creating runtime form controls can be useful in a variety of circumstances. Any type of control can be added at runtime: groups, string edits, buttons etc. Standard Axapta uses this technique to dynamically add &#8216;Action&#8217; buttons to forms when required. The code to add controls for these functions is called from the new() method of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=125&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Creating <b>runtime form controls</b> can be useful in a variety of circumstances.  Any type of control can be added at runtime:  groups, string edits, buttons etc.
</p>
<p>Standard Axapta uses this technique to dynamically add &#8216;Action&#8217;<br />
buttons to forms when required. The code to add controls for these<br />
functions is called from the new() method of SysSetupFormRun.
</p>
<table id="toc" class="toc" summary="Contents">
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>
<h2><span class="mw-headline">Introduction</span></h2>
<p>The basic process to add controls and intercept their events at runtime is as follows:
</p>
<ul>
<li>use form.addControl(ControlType, ControlName) to add the control
</li>
<li>call form.controlMethodOverload(true) to enable over-riding of the control events
</li>
<li>write appropriate event handler methods on the form
</li>
</ul>
<p>If you are dealing only with buttons, then it is possible to set<br />
the MenuItemType and MenuItemName on the button when it is created. In<br />
this way, you can directly call a report, class or another form, and<br />
you don&#8217;t need to write additional code on the form to deal with the<br />
button click.
</p>
<p><a name="The_Basics"></a><br />
<h2><span class="editsection"></span><i><span class="mw-headline"><em><strong>The Basics</strong></em></span></i></h2>
<p>The simplest example uses the init() method of a form to add the<br />
controls, and design-time methods to intercept the control events. Take<br />
note of the control names used during the .addControl() call. In the<br />
example below, the control names are &#8216;DynamicStringControl&#8217; and<br />
&#8216;DynamicButtonControl&#8217;.
</p>
<p>/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */<br />
.code .imp {font-weight: bold; color: red;}<br />
.code .kw1 {color: #0000ff;}<br />
.code .co1 {color: #007F00;}<br />
.code .coMULTI {color: #007F00;}<br />
.code .es0 {color: #666666; font-weight: bold;}<br />
.code .br1 {color: #0000ff;}<br />
.code .br2 {color: #0000ff;}<br />
.code .st0 {color: #FF0000;}<br />
.code .nu0 {color: #000000;}<br />
.code .me1 {color: #000000;}<br />
.code .me2 {color: #000000;}
</p>
</p>
<pre class="code"><span class="kw1">public</span> <span class="kw1">void</span> init<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>     FormStringControl   formStringControl;     FormButtonControl   formButtonControl;     FormGroupControl    formGroupControl;     ;

     <span class="co1">// Adding a group</span>     formGroupControl = this.<span class="me1">form</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">Group</span>, <span class="st0">"MyGroup"</span><span class="br0">)</span>;     formGroupControl.<span class="me1">caption</span><span class="br0">(</span><span class="st0">"It's my group!"</span><span class="br0">)</span>;

     <span class="co1">// Adding a string to a group</span>     formStringControl = formGroupControl.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">String</span>, <span class="st0">"DynamicStringControl"</span><span class="br0">)</span>;     formStringControl.<span class="me1">label</span><span class="br0">(</span><span class="st0">"Dynamic string control"</span><span class="br0">)</span>;

     <span class="co1">// Adding another string to the group using the same name.  This will use the same event method as the</span>     <span class="co1">// first "DynamicStringControl"</span>     formStringControl = formGroupControl.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">String</span>, <span class="st0">"DynamicStringControl"</span><span class="br0">)</span>;     formStringControl.<span class="me1">label</span><span class="br0">(</span><span class="st0">"Dynamic string control2"</span><span class="br0">)</span>;

     formButtonControl = this.<span class="me1">form</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">Button</span>, <span class="st0">"DynamicButtonControl"</span><span class="br0">)</span>;     formButtonControl.<span class="me1">text</span><span class="br0">(</span><span class="st0">"Dynamic button"</span><span class="br0">)</span>;

     this.<span class="me1">controlMethodOverload</span><span class="br0">(</span><span class="kw1">true</span><span class="br0">)</span>;

     <span class="kw1">super</span><span class="br0">(</span><span class="br0">)</span>; <span class="br0">}</span></pre>
<p>You can then write event handler methods for the controls at the top (element) level of your form.
</p>
<p>/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */<br />
.code .imp {font-weight: bold; color: red;}<br />
.code .kw1 {color: #0000ff;}<br />
.code .co1 {color: #007F00;}<br />
.code .coMULTI {color: #007F00;}<br />
.code .es0 {color: #666666; font-weight: bold;}<br />
.code .br1 {color: #0000ff;}<br />
.code .br2 {color: #0000ff;}<br />
.code .st0 {color: #FF0000;}<br />
.code .nu0 {color: #000000;}<br />
.code .me1 {color: #000000;}<br />
.code .me2 {color: #000000;}
</p>
</p>
<pre class="code"><span class="kw1">void</span> dynamicButtonControl_Clicked<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>     ;

     info <span class="br0">(</span><span class="st0">"Dynamic button clicked!"</span><span class="br0">)</span>; <span class="br0">}</span>

 boolean dynamicStringControl_Modified<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>     FormStringControl control = element.<span class="me1">controlCallingMethod</span><span class="br0">(</span><span class="br0">)</span>;     ;

     info <span class="br0">(</span>strFmt<span class="br0">(</span><span class="st0">"Modified dynamic control %1 to %2"</span>, int2str<span class="br0">(</span>control.<span class="me1">id</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>, control.<span class="me1">text</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span><span class="br0">)</span>;     <span class="kw1">return</span> <span class="kw1">true</span>; <span class="br0">}</span></pre>
<p>Note that the first part of the handler method names (before the underscore) <i>exactly</i> matches the control names used in init().
</p>
<p><a name="Adding_menu-item_buttons"></a><br />
<h2><span class="editsection">[<a href="http://www.axaptapedia.com/index.php?title=Runtime_form_controls&amp;action=edit&amp;section=3" title="Adding menu-item buttons">edit</a>]</span> <span class="mw-headline">Adding menu-item buttons</span></h2>
<p>It is usually preferable to keep the amount of code on a form to a<br />
minimum. By setting your dynamically-created buttons to call<br />
menu-items, you can avoid writing the event handlers completely.
</p>
<p>The following example adds a menu-item button to a form, which<br />
will open the SalesTable form using the standard Axapta menu-item. Note<br />
that we now must use a FormFunctionButtonControl, rather than a<br />
FormButtonControl.
</p>
<p>The button will correctly show the label from the menu-item.
</p>
<p>/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */<br />
.code .imp {font-weight: bold; color: red;}<br />
.code .kw1 {color: #0000ff;}<br />
.code .co1 {color: #007F00;}<br />
.code .coMULTI {color: #007F00;}<br />
.code .es0 {color: #666666; font-weight: bold;}<br />
.code .br1 {color: #0000ff;}<br />
.code .br2 {color: #0000ff;}<br />
.code .st0 {color: #FF0000;}<br />
.code .nu0 {color: #000000;}<br />
.code .me1 {color: #000000;}<br />
.code .me2 {color: #000000;}
</p>
</p>
<pre class="code"><span class="kw1">public</span> <span class="kw1">void</span> init<span class="br0">(</span><span class="br0">)</span> <span class="br0">{</span>     FormFunctionButtonControl   formFunctionButtonControl;     ;

     formFunctionButtonControl = this.<span class="me1">form</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">MenuFunctionButton</span>, <span class="st0">"SalesTableButton"</span><span class="br0">)</span>;     formFunctionButtonControl.<span class="me1">menuItemType</span><span class="br0">(</span>MenuItemType::<span class="me2">Display</span><span class="br0">)</span>;     formFunctionButtonControl.<span class="me1">menuItemName</span><span class="br0">(</span><span class="kw1">MenuItemDisplayStr</span><span class="br0">(</span>SalesTable<span class="br0">)</span><span class="br0">)</span>;

     <span class="kw1">super</span><span class="br0">(</span><span class="br0">)</span>; <span class="br0">}</span></pre>
<p>The same principle can be used to call your own &#8216;display&#8217;, &#8216;output&#8217;<br />
or &#8216;action&#8217; menu-item. This is useful if the button should perform some<br />
intensive database processing, which would benefit from being<br />
encapsulated in a server-side class.
</p>
<p>See the create() method on the KMActionMenuButtonAuto class for a further, more complex example.
</p>
<p>
See <a href="http://www.axaptapedia.com/images/5/59/AJ_DynamicControls.xpo" class="internal" title="AJ DynamicControls.xpo">this project</a> for two forms demonstrating the above concepts.
</p>
<p><a name="Adding_grid_control"></a><br />
<h2><span class="editsection">[<a href="http://www.axaptapedia.com/index.php?title=Runtime_form_controls&amp;action=edit&amp;section=4" title="Adding grid control">edit</a>]</span> <span class="mw-headline">Adding grid control</span></h2>
<p>In most cases you&#8217;d better use visible property of this control&#8217;s<br />
type. But sometimes you have to add a grid on an existing form and<br />
without any opportunity of change. This example will help you. Rather<br />
you are making this modification on forms, that are managed from class.<br />
In our tutorial case this is runable tutorial_AddRunTimeControls class.<br />
This following code adds a grid control of the selected table. You may<br />
find similar functionality in the form SysTableBrowser:
</p>
<p>/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */<br />
.code .imp {font-weight: bold; color: red;}<br />
.code .kw1 {color: #0000ff;}<br />
.code .co1 {color: #007F00;}<br />
.code .coMULTI {color: #007F00;}<br />
.code .es0 {color: #666666; font-weight: bold;}<br />
.code .br1 {color: #0000ff;}<br />
.code .br2 {color: #0000ff;}<br />
.code .st0 {color: #FF0000;}<br />
.code .nu0 {color: #000000;}<br />
.code .me1 {color: #000000;}<br />
.code .me2 {color: #000000;}
</p>
</p>
<pre class="code"><span class="kw1">void</span> addRunTimeControls<span class="br0">(</span>FormRun _formRun<span class="br0">)</span><span class="br0">{</span>     FormGridControl        formGrigControl;     Form                   _form;     FormBuildDataSource    formBuildDataSource;     FormBuildDesign        formBuildDesign;     FormBuildStringControl formBuildStringControl;     FormBuildGridControl   formBuildGridControl;     Object                 formBuildControl;     FormBuildGroupControl  formGroupControl;     CustTable              custTable;     DictTable              dictTable;     TableId                tableID;     ;

    <span class="co1">// Adding a Grid  control, this used in  SysTableBrowser</span>    tableID    = picktable<span class="br0">(</span><span class="br0">)</span>;    dictTable   = <span class="kw1">new</span> DictTable<span class="br0">(</span>tableID<span class="br0">)</span>;    _form = _formRun.<span class="me1">form</span><span class="br0">(</span><span class="br0">)</span>;    formBuildDataSource = _form.<span class="me1">dataSource</span><span class="br0">(</span><span class="nu0">2</span><span class="br0">)</span>;    formBuildDataSource.<span class="me1">name</span><span class="br0">(</span>dictTable.<span class="me1">name</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>;    formBuildDataSource.<span class="me1">table</span><span class="br0">(</span>dictTable.<span class="me1">id</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>;    formBuildDataSource.<span class="me1">autoQuery</span><span class="br0">(</span><span class="kw1">true</span><span class="br0">)</span>;    formBuildDesign = _form.<span class="me1">design</span><span class="br0">(</span><span class="br0">)</span>;    formBuildDesign.<span class="me1">widthMode</span><span class="br0">(</span><span class="nu0">-1</span><span class="br0">)</span>;    formBuildDesign.<span class="me1">widthValue</span><span class="br0">(</span><span class="nu0">600</span><span class="br0">)</span>;    formBuildDesign.<span class="me1">heightMode</span><span class="br0">(</span><span class="nu0">-1</span><span class="br0">)</span>;    formBuildDesign.<span class="me1">heightValue</span><span class="br0">(</span><span class="nu0">400</span><span class="br0">)</span>;

    formGroupControl = formBuildDesign.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">Group</span>, <span class="st0">'SecondGrid'</span><span class="br0">)</span>;    formGroupControl.<span class="me1">caption</span><span class="br0">(</span><span class="st0">"Dynamic Grid"</span><span class="br0">)</span>;    formGroupControl.<span class="me1">widthMode</span><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span>;    formGroupControl.<span class="me1">heightMode</span><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span>;    formBuildGridControl = formGroupControl.<span class="me1">addControl</span><span class="br0">(</span>FormControlType::<span class="me2">GRID</span>,<span class="st0">'Grid'</span><span class="br0">)</span>;    formBuildGridControl.<span class="me1">dataSource</span><span class="br0">(</span>dictTable.<span class="me1">name</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>;    formBuildGridControl.<span class="me1">name</span><span class="br0">(</span><span class="st0">'AddRunTime'</span><span class="br0">)</span>;

    formBuildGridControl.<span class="me1">widthMode</span><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span>;    formBuildGridControl.<span class="me1">heightMode</span><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span>;    this.<span class="me1">showFields</span><span class="br0">(</span><span class="kw1">tableNum</span><span class="br0">(</span>custTable<span class="br0">)</span>, formBuildGridControl, formBuildDataSource<span class="br0">)</span>;

    _formRun.<span class="me1">controlMethodOverload</span><span class="br0">(</span><span class="kw1">true</span><span class="br0">)</span>;    _formRun.<span class="me1">init</span><span class="br0">(</span><span class="br0">)</span>;    _formRun.<span class="me1">run</span><span class="br0">(</span><span class="br0">)</span>;    _formRun.<span class="me1">detach</span><span class="br0">(</span><span class="br0">)</span>;<span class="br0">}</span></pre>
<p>And define the fields on grid.
</p>
<p>/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */<br />
.code .imp {font-weight: bold; color: red;}<br />
.code .kw1 {color: #0000ff;}<br />
.code .co1 {color: #007F00;}<br />
.code .coMULTI {color: #007F00;}<br />
.code .es0 {color: #666666; font-weight: bold;}<br />
.code .br1 {color: #0000ff;}<br />
.code .br2 {color: #0000ff;}<br />
.code .st0 {color: #FF0000;}<br />
.code .nu0 {color: #000000;}<br />
.code .me1 {color: #000000;}<br />
.code .me2 {color: #000000;}
</p>
</p>
<pre class="code"><span class="kw1">public</span> <span class="kw1">void</span> showFields<span class="br0">(</span>tableId                 tableId,                       FormBuildGridControl    formBuildGridControl,                       FormBuildDataSource     formBuildDataSource<span class="br0">)</span>

<span class="br0">{</span>    FormBuildStringControl          formBuildStringControl;    DictTable                       dictTable;    fieldId                         fieldId;    <span class="kw1">int</span>                             i;    <span class="kw1">int</span>                             fieldCnt;    ;    dictTable   = <span class="kw1">new</span> DictTable<span class="br0">(</span>tableId<span class="br0">)</span>;    <span class="kw1">for</span> <span class="br0">(</span>i=<span class="nu0">1</span>; i&lt;=<span class="nu0">3</span>; i++<span class="br0">)</span>    <span class="br0">{</span>        fieldId = dictTable.<span class="me1">fieldCnt2Id</span><span class="br0">(</span>i<span class="br0">)</span>;        formBuildGridControl.<span class="me1">addDataField</span><span class="br0">(</span>formBuildDataSource.<span class="me1">id</span><span class="br0">(</span><span class="br0">)</span>, fieldId2Ext<span class="br0">(</span>fieldId, <span class="nu0">1</span><span class="br0">)</span><span class="br0">)</span>;    <span class="br0">}</span><span class="br0">}</span></pre>
<p>See <a href="http://www.axaptapedia.com/images/d/d9/Axaptapedia.xpo" class="internal" title="Axaptapedia.xpo">this project</a> for this example.
</p>
<p>
</p>
<p><a name="Removing_the_control"></a><br />
<h2><span class="editsection">[<a href="http://www.axaptapedia.com/index.php?title=Runtime_form_controls&amp;action=edit&amp;section=5" title="Removing the control">edit</a>]</span> <span class="mw-headline">Removing the control</span></h2>
<p>To remove a control again, use the following code:
</p>
<p>/* GeSHi (c) Nigel McNie 2004 (http://qbnz.com/highlighter) */<br />
.code .imp {font-weight: bold; color: red;}<br />
.code .kw1 {color: #0000ff;}<br />
.code .co1 {color: #007F00;}<br />
.code .coMULTI {color: #007F00;}<br />
.code .es0 {color: #666666; font-weight: bold;}<br />
.code .br1 {color: #0000ff;}<br />
.code .br2 {color: #0000ff;}<br />
.code .st0 {color: #FF0000;}<br />
.code .nu0 {color: #000000;}<br />
.code .me1 {color: #000000;}<br />
.code .me2 {color: #000000;}
</p>
</p>
<pre class="code">element.<span class="me1">design</span><span class="br0">(</span><span class="br0">)</span>.<span class="me1">removeControl</span><span class="br0">(</span>elementId<span class="br0">)</span></pre>
<p>This also can be usefull to see how a dialog field properties can be changed on the fly<br />
<a href="http://www.axaptapedia.com/Image:CopyPriceDisc2PriceDisc.xpo" class="external text" title="http://www.axaptapedia.com/Image:CopyPriceDisc2PriceDisc.xpo" rel="nofollow">PriceListCopy</a></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/125/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/125/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/125/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/125/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/125/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=125&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/20/runtime-form-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Infolog stack trace</title>
		<link>http://coolhake.wordpress.com/2008/08/20/infolog-stack-trace/</link>
		<comments>http://coolhake.wordpress.com/2008/08/20/infolog-stack-trace/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 03:13:04 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Axapta]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/08/20/infolog-stack-trace/</guid>
		<description><![CDATA[download (7K) &#124; This is an extension allowing to see stacktrace for each infolog item. Installation import Dev_StackTrace.xpo recompile add the following code to the \Classes\Info\add: // RPT DevTools bmi 060915 ---&#62; if(hasSecuritykeyAccess(securityKeyNum(AdminMisc), AccessType::Edit)) { _sysInfoAction = new SysInfoAction_StackTrace(_txt, xSession::xppCallStack(), _sysInfoAction); }// RPT DevTools bmi 060915 &#60;--- compile the info class Usage When infolog record [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=123&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.axaptapedia.com/images/b/b6/Dev_stacktrace.zip" class="external text" title="http://www.axaptapedia.com/images/b/b6/Dev_stacktrace.zip" rel="nofollow">download (7K)</a> |  This is an <a href="http://www.axaptapedia.com/Extending_IDE" title="Extending IDE">extension</a> allowing to see stacktrace for each infolog item.</p>
<p><img src="/Users/0420/AppData/Local/Temp/moz-screenshot.jpg" alt="" /></p>
<h2><span class="mw-headline">Installation </span></h2>
<ul>
<li>import Dev_StackTrace.xpo
</li>
<li>recompile
</li>
<li>add the following code to the \Classes\Info\add:
</li>
</ul>
<p>
<blockquote>
<pre class="code"><span class="co1">// RPT DevTools bmi 060915 ---&gt;</span>    <span class="kw1">if</span><span class="br0">(</span>hasSecuritykeyAccess<span class="br0">(</span><span class="kw1">securityKeyNum</span><span class="br0">(</span>AdminMisc<span class="br0">)</span>, AccessType::<span class="me2">Edit</span><span class="br0">)</span><span class="br0">)</span>    <span class="br0">{</span>        _sysInfoAction = <span class="kw1">new</span> SysInfoAction_StackTrace<span class="br0">(</span>_txt, xSession::<span class="me2">xppCallStack</span><span class="br0">(</span><span class="br0">)</span>, _sysInfoAction<span class="br0">)</span>;    <span class="br0">}</span><span class="co1">// RPT DevTools bmi 060915 &lt;--- </span></pre>
</blockquote>
<ul>
<li>compile the info class
</li>
</ul>
<p>
<h2><span class="mw-headline">Usage </span></h2>
<p>When infolog record is outputed this extension adds an action to it<br />
named &#8220;Stack trace&#8221; (it is only for users with admin rights). Just<br />
press the button and see stack trace.
</p>
<p>If the record has an action already, you can see stacktrace by holding Ctrl button while clicking on the action button.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/123/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/123/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/123/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/123/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/123/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=123&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/20/infolog-stack-trace/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Image Class</title>
		<link>http://coolhake.wordpress.com/2008/08/20/image-class/</link>
		<comments>http://coolhake.wordpress.com/2008/08/20/image-class/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 02:36:16 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Axapta]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/08/20/image-class/</guid>
		<description><![CDATA[Image is a system class for handling image data. The class can construct and manipulate Image objects of the following file types: Raster (bitmap) formats &#8211; .bmp, .gif, .jpg, .png, .tiff, and .exif Vector formats &#8211; .emf and .wmf Because of security reasons the class in Dynamics Ax can not be run from the server [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=119&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Image</strong> is a <a title="System Classes" href="http://www.axaptapedia.com/System_Classes">system class</a> for handling image data.</p>
<p>The class can construct and manipulate Image objects of the following file types:</p>
<ul>
<li> Raster (bitmap) formats &#8211; .bmp, .gif, .jpg, .png, .tiff, and .exif</li>
<li> Vector formats &#8211; .emf and .wmf</li>
</ul>
<p>Because of security reasons the class in Dynamics Ax can not be run from the server and is bound to the client.</p>
<p>The image object can be created from scratch, captured from the screen<br />
or loaded from a file. It can then be cropped, resized, flipped,<br />
rotated etc&#8230;</p>
<p>Load an image from file and place it in a table:</p>
<blockquote>
<pre class="code">Image      image;<span class="kw1">str</span>        fileName;;

filename = myImagePath + myImageFile;

<span class="kw1">if</span> <span class="br0">(</span>Image::<span class="me2">canLoad</span><span class="br0">(</span>Filename<span class="br0">)</span><span class="br0">)</span><span class="br0">
{</span>
   image.<span class="me1">loadImage</span><span class="br0">(</span>Filename<span class="br0">)</span>;
   myTable.<span class="me1">imageContainer</span> = image.<span class="me1">getData</span><span class="br0">(</span><span class="br0">)</span>;<span class="br0">
}</span></pre>
</blockquote>
<p>&#8230;and to display the image on a form:</p>
<blockquote>
<pre class="code">Image   Image;<span class="kw1">container</span> imageContainer;;

imageContainer = myTable.<span class="me1">imageContainer</span>;

Image = <span class="kw1">new</span> Image<span class="br0">(</span><span class="br0">)</span>;
Image.<span class="me1">setData</span><span class="br0">(</span>imageContainer<span class="br0">)</span>;

imageWindow.<span class="me1">image</span><span class="br0">(</span>Image<span class="br0">)</span>;
imageWindow.<span class="me1">widthValue</span><span class="br0">(</span>image.<span class="me1">width</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>;
imageWindow.<span class="me1">heightValue</span><span class="br0">(</span>image.<span class="me1">height</span><span class="br0">(</span><span class="br0">)</span><span class="br0">)</span>;</pre>
</blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/119/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/119/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=119&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/20/image-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Specifying empty date values</title>
		<link>http://coolhake.wordpress.com/2008/08/19/specifying-empty-date-values/</link>
		<comments>http://coolhake.wordpress.com/2008/08/19/specifying-empty-date-values/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 07:13:04 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Axapta]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/08/19/specifying-empty-date-values/</guid>
		<description><![CDATA[If you want to set a date field to an empty date or need to compare if a date field is empty, you can use the datenull() function. It is a method of the Global class and will simply return 011\1900. This leads to more things: You can write dates in Axapta X++ editor using [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=117&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you want to set a date field to an empty date or need to compare if a date field is empty, you can use the <em><strong>datenull</strong></em>() function. It is a method of the <strong>Global</strong> class and will simply return 011\1900.</p>
<p>This leads to more things:
<ol>
<li>You can write dates in Axapta X++ editor using backslashes, e.g. 144\2006 </li>
<li>An empty date in Axapta is specified as January 1st, 1900. </li>
<li>You<br />
can use methods from the Global class without having to write<br />
&#8220;Global::&#8221;. So, you can write &#8220;if date == datenull()&#8221; and you do not<br />
have to write &#8220;if date == Global::datenull()&#8221;. This works with all the<br />
methods from the Global class.</li>
</ol>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/117/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/117/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/117/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/117/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/117/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=117&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/19/specifying-empty-date-values/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Using global search for virtual tables</title>
		<link>http://coolhake.wordpress.com/2008/08/19/using-global-search-for-virtual-tables/</link>
		<comments>http://coolhake.wordpress.com/2008/08/19/using-global-search-for-virtual-tables/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 07:07:25 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Axapta]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/08/19/using-global-search-for-virtual-tables/</guid>
		<description><![CDATA[The global search is a feature in Dynamics Ax 4.0 which allows you to search for a string in several tables (like a full text search). You setup some tables and fields to be searched in and start a data crawler that collects the data to be searched. Now, if some of your tables that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=116&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The global search is a feature in Dynamics Ax 4.0 which allows you to<br />
search for a string in several tables (like a full text search). You<br />
setup some tables and fields to be searched in and start a data crawler<br />
that collects the data to be searched.</p>
<p>Now, if some of your<br />
tables that are searched belong to a virtual company, the data crawler<br />
will mark them as records of the company it is running in. That means<br />
that if you want to search for your virtual data from a different<br />
company, it will return no results.</p>
<p>Example: you have the<br />
companies xxx and yyy and a virtual company vir. Table CustTable is<br />
virtual (dataareaid of the records is vir). The data crawler runs in<br />
company xxx and will mark the CustTable records as belonging to company<br />
xxx .<br />Now, if you start a search in company yyy, it will not find<br />
the Custtable records as they seem to belong to a different company.<br />
You could only set up a second data crwaler for company yyy which would<br />
collect exactly the same records and you would need to store them twice<br />
in your database.</p>
<p>The following changes will circumvent that:<br />
you will be able to see data from different companies. There are some<br />
drawbacks, however: you will be able to see search results from your<br />
&#8220;data crawler company&#8221;. But it the data is from a non-virtual table,<br />
you will not be able to see the results. But I hope it will lead you to<br />
a way where you can make your own modifications to get the best out of<br />
the global search. Remember: all changes you make are at your own risk.</p>
<p>Here are the changes you have to do:</p>
<p><strong>Class SysGSSearchStart, method startSearch</strong><br />comment the following line:<br />
<blockquote><span style="font-size:85%;"><span style="font-family:courier new;color:rgb(255, 0, 0);">infolog.add(Exception::Warning,&#8221;@SYS98793&#8243;);</span></span><br /><span style="font-size:85%;"></span></p></blockquote>
<p>With that, there will be no warning if you are working in a company where the data crawler is not running.</p>
<p><strong>Class SysSearch, m</strong><strong>ethod search:</strong></p>
<p>at line 28, just after<span style="font-family:courier new;font-size:85%;"> &#8220;if (!searchname)&#8221;</span> add:<br />
<blockquote><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">select firstonly RecId from sysSearchName </span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">where sysSearchName.Design == &#8216;SDS_xxx_default&#8217; </span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">&amp;&amp; sysSearchName.LanguageId == this.languageId();</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);"></span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">if (!sysSearchName)</span></p></blockquote>
<p>replace the xxx in the &#8216;SDS_xxx_default&#8217; with the company id where the data crawler is running.</p>
<p><strong>Class SysSearch, methods searchWord and searchExactWord:</strong></p>
<p>at line 11, replace the <span style="font-family:courier new;font-size:85%;">&#8220;where sysSearchName.Design == this.design() &amp;&amp;&#8221;</span> with:<br />
<blockquote><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">where (sysSearchName.Design == this.design() </span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">sysSearchName.Design == &#8216;SDS_xxx_default&#8217;) &amp;&amp;</span></p></blockquote>
<p>again, replace the xxx in the &#8216;SDS_xxx_default&#8217; with the company id where the data crawler is running.</p>
<p><strong>Class SysSearchDoDataSearch, method buildItemListXML:</strong></p>
<p>at line 11, after a <span style="font-family:courier new;font-size:85%;">while select indextable from sysDataSearch</span> block, add the following code:<br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);"></span><br />
<blockquote><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">changecompany(&#8216;xxx&#8217;)</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">{</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">sysDataSearch = null;</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">while select IndexTable from sysDataSearch</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">{</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">dictTable = new DictTable(sysDataSearch.IndexTable);</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">if (dictTable.rights() != AccessType::NoAccess)</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">searchTableMap.insert(dictTable.id(),0);</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">}</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">}</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">sysDataSearch = null;</span></p></blockquote>
<p>Replace &#8216;xxx&#8217; with the company id where the data crawler is running.</p>
<p>At line 77, after <span style="font-family:courier new;"><span style="font-size:85%;">select sysDataSearch where sysDataSearch.SearchGroupId == m_eSearchGroupDef &amp;&amp; sysDataSearch.IndexTable == tableid;</span> </span><span style="font-size:0;">add the following code:</span></p>
<blockquote><p><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">if (!sysDataSearch)</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">{</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">changecompany(&#8216;xxx&#8217;)</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">{</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">sysDataSearch = null;</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">select sysDataSearch</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">where sysDataSearch.SearchGroupId == SearchGroupDef </span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">&amp;&amp; sysDataSearch.IndexTable == tableid; </span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">}</span><br /><span style="font-family:courier new;font-size:85%;color:rgb(255, 0, 0);">}</span></p></blockquote>
<p>Replace &#8216;xxx&#8217; with the company id where the data crawler is running.</p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/116/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/116/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=116&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/19/using-global-search-for-virtual-tables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Using the Windows API from within Axapta</title>
		<link>http://coolhake.wordpress.com/2008/08/19/using-the-windows-api-from-within-axapta/</link>
		<comments>http://coolhake.wordpress.com/2008/08/19/using-the-windows-api-from-within-axapta/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 06:23:56 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Axapta]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/2008/08/19/using-the-windows-api-from-within-axapta/</guid>
		<description><![CDATA[It seems that calling Windows API functions from Axapta is viewed as some sort of mysterious magic by most Axapta developers. Unfortunately, there are times when you need to do something that requires tight integration with functionality that exists outside of the system. While there are other methods of interfacing between bits of code, including [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=112&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>It seems that calling Windows API functions from Axapta is viewed as some<br />
sort of mysterious magic by most Axapta developers. Unfortunately,<br />
there are times when you need to do something that requires tight<br />
integration with functionality that exists outside of the system. While<br />
there are other methods of interfacing between bits of code, including<br />
COM, XML-RPC, or even .NET, using the Windows API can sometimes be very<br />
efficient, and powerful.</p>
<div class="serendipity_entry_body">
<p>For beginner <em>WinAPI</em> coders who are also Axapta programmers, with at least some programming experience in <a href="http://en.wikipedia.org/wiki/C_programming_language">C</a> or <a href="http://en.wikipedia.org/wiki/C%2B%2B">C++</a>,<br />
I felt it might be better to answer a question from my colleagues about<br />
calling WinAPI calls from Axapta, outside of those already wrapped by<br />
the <em>WinAPI::</em> or <em>WinGDI::</em> classes.</div>
<p>Axapta<br />
provides basic functionality to open a handle to a library (DLL file),<br />
and a handle to a function within that library. The functionality is<br />
handled within two classes, <em>DLL::</em> and <em>DLLFunction::</em> respectively, and allows you to call practically any piece of code within any dynamic link library.</p>
<p>The most common use for this is naturally to make calls into the<br />
Windows API, but there&#8217;s no reason why you can&#8217;t provide your own<br />
functions within a DLL and call them from Axapta, but be aware that the<br />
DLL file must be installed on either the client or server, depending on<br />
where the code will execute.</p>
<p>The <em>DLL::</em> class opens a DLL file and acts as a handle for <em>DLLFunction::</em><br />
to use when defining handles for calls. If the DLL isn&#8217;t already opened<br />
by Axapta internally (as would be the case with the standard Windows<br />
API DLL files), it will also silently handle the opening,<br />
initialisation, and closure of the DLL in conjunction with the garbage<br />
collector.</p>
<p>The <em>DLLFunction::</em> class defines a handle to a function&#8217;s<br />
symbol within the DLL, and defines the return value and the parameters<br />
of the function. This is important to define correctly, as defined by<br />
the C/C++ headers; otherwise you will head straight into problems with<br />
Axapta crashing, either during the call, or later on. Don&#8217;t worry, this<br />
is easily determined, and I&#8217;ll explain how this works. If you don&#8217;t<br />
have the header files (<em>*.h</em>) with a windows compiler, you can look at <a href="http://www.google.com/codesearch">Google Code Search</a>.</p>
<p>Before going into detail with how this works, you might need to know<br />
what&#8217;s going on behind the scenes, especially how functions call other<br />
functions from the computer&#8217;s perspective. Since that&#8217;s not really in<br />
scope here, I&#8217;ll very quickly describe only the elements of this you<br />
need to know to make your calls work from Axapta. If you already know<br />
this, you can <a href="http://simon.butcher.name/archives/2006/12/01/Using-the-Windows-API-from-within-Axapta#skip">skip past it</a>.</p>
<p>When you call a function, its parameters get pushed onto the <em>stack</em>, which is a <a href="http://en.wikipedia.org/wiki/FILO">FILO</a><br />
data model. The function being called then takes these items off the<br />
stack and can use them as variables. The calling function knows<br />
precisely how many items it needs to put onto the stack, and the<br />
function itself knows how many items it needs to take off the stack.</p>
<p>As you know, once a called function has done its work, it can return a value. The process works the same way in reverse, <em>pushing</em> the return value onto the stack for the caller to <em>pop</em> from the stack.</p>
<p>Sometimes an example helps, so let&#8217;s consider the following simplistic example in <em>C</em>:</p>
<blockquote>
<div class="c" style="text-align:left;"><em><span style="color:#993333;">int</span></em><em> foo<span style="color:#66cc66;">(</span><span style="color:#993333;">int</span> bar, <span style="color:#993333;">char</span>* baz<span style="color:#66cc66;">)</span><br />
<span style="color:#66cc66;">{</span><br />
<a href="http://www.opengroup.org/onlinepubs/009695399/functions/printf.html"><span style="color:#000066;">printf</span></a><span style="color:#66cc66;">(</span><span style="color:#ff0000;">&#8220;Qux: %s&#8221;</span>, baz<span style="color:#66cc66;">)</span>;</em></p>
<p><em> <span style="color:#b1b100;">return</span> <span style="color:#66cc66;">(</span>bar * <span style="color:#cc66cc;">2</span><span style="color:#66cc66;">)</span>;<br />
<span style="color:#66cc66;">}</span></em></p>
<p><span style="color:#993333;"><em>void</em></span><em> quux<span style="color:#66cc66;">(</span><span style="color:#993333;">void</span><span style="color:#66cc66;">)</span><br />
<span style="color:#66cc66;">{</span><br />
<span style="color:#993333;">int</span> corge = foo<span style="color:#66cc66;">(</span><span style="color:#cc66cc;">10</span>, <span style="color:#ff0000;">&#8220;Grault&#8221;</span><span style="color:#66cc66;">)</span>;<br />
<span style="color:#66cc66;">}</span></em></div>
</blockquote>
<p>Consider when the <em>quux()</em> function calls <em>foo()</em>, it will push the value <em>10</em> and a pointer to the null-terminated string <em>&#8220;Grault&#8221;</em> onto the stack, and jump to the location in memory where the code for <em>foo()</em> exists. Subsequently, <em>foo()</em> will pop these two values from the stack to be able to use them. When <em>foo()</em> returns, it will push the value of <em>20</em> onto the stack, and <em>quux()</em> will pop that from the stack and use it as the value for <em>corge</em>.</p>
<p>Of course, there&#8217;s a lot more going on in the stack, in fact there are a few stacks, but we don&#8217;t need to cover that here.</p>
<p><a name="skip"> </a></p>
<p>To be able to call your function, you will need to know which DLL<br />
your function is in, and the real name of the function as exported by<br />
the DLL&#8217;s symbols. I mention this because it seems obvious, but you<br />
should remember that Microsoft generally provide two versions of<br />
functions if they use strings, for ANSI and wide-characters, normally<br />
with an <em>&#8220;A&#8221;</em> or <em>&#8220;W&#8221;</em> suffix respectively. The headers<br />
for these functions often hide this fact, as does MSDN. Opt for the<br />
ANSI version &#8211; Axapta will convert strings based on the locale.</p>
<p>To cover the subject quickly, let&#8217;s build a small example form that<br />
uses the Windows API to draw the appropriate icon for a specified file<br />
within a window pane.</p>
<p>Build a form with a <em>Window</em> control. In this example, I have named the window <em>Icon</em>. The window control needs have the width and height both set to 32 pixels (icon size), and the <em>AutoDeclaration</em> property enabled.</p>
<p>The form needs some code. Add some variables we will need to the class declaration of the form:</p>
<blockquote>
<div class="xpp" style="text-align:left;"><em><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">class</span> FormRun <span style="color:#0000ff;">extends</span> ObjectRun<br />
<span style="color:#000000;">{</span><br />
<span style="color:#007f00;">// DLL file handles</span><br />
DLL shellDLL; <span style="color:#007f00;">// shell32.dll</span><br />
DLL userDLL; <span style="color:#007f00;">// user32.dll</span></em></p>
<p><em> <span style="color:#007f00;">// Function call handles</span><br />
DLLFunction extractAssociatedIconFunc;<br />
DLLFunction destroyIconFunc;<br />
DLLFunction drawIconFunc;</em></p>
<p><em> <span style="color:#007f00;">// Our icon handle, taken from windows</span><br />
<span style="color:#0000ff;">int</span> hIcon;</em></p>
<p><em> <span style="color:#007f00;">// These are from the windows headers, used later in the code!</span><br />
#define.<span style="color:#000000;">DI_MASK</span><span style="color:#000000;">(</span>0&#215;01<span style="color:#000000;">)</span><br />
#define.<span style="color:#000000;">DI_IMAGE</span><span style="color:#000000;">(</span>0&#215;02<span style="color:#000000;">)</span><br />
#define.<span style="color:#000000;">DI_COMPAT</span><span style="color:#000000;">(</span>0&#215;04<span style="color:#000000;">)</span><br />
<span style="color:#000000;">}</span></em></div>
</blockquote>
<p>We need to initialise many of these variables first. Using the <em>init()</em><br />
function on the form, we can initialise the DLL handles, and the<br />
functions. The DLL handles only need the name of the DLL file,<br />
obviously, but the DLL function handles need to be configured with the<br />
primitive types that will be appearing on the stack. Even parameters or<br />
the return value are not used, you must specify them, or the stack will<br />
be out of synchronisation.</p>
<p>To help you define your primitive types, Axapta has a kernel enumerator called <em>ExtTypes</em>,<br />
which contains all the basic types you will need. You need to then take<br />
what&#8217;s listed in the header file and determine what primitive type it<br />
is. For example, windows defines many functions which return a value of<br />
<em>BOOL</em>, however this is simply a type definition in C for an<br />
integer. It&#8217;s your responsibility to match these values up logically by<br />
working through the definitions. Don&#8217;t worry; I&#8217;ve done the hard work<br />
for you in this example!</p>
<p>Override your form&#8217;s <em>init()</em> function with the following code:</p>
<blockquote>
<div class="xpp" style="text-align:left;"><em><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> init<span style="color:#000000;">(</span><span style="color:#000000;">)</span><br />
<span style="color:#000000;">{</span><br />
;</em></p>
<p><em> <span style="color:#007f00;">// Initialise the form first</span><br />
<span style="color:#0000ff;">super</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="color:#007f00;">// Set up our call for ExtractAssociatedIcon()</span><br />
extractAssociatedIconFunc =<br />
<span style="color:#0000ff;">new</span> DLLFunction<span style="color:#000000;">(</span>shellDLL, <span style="color:#ff0000;">&#8220;ExtractAssociatedIconA&#8221;</span><span style="color:#000000;">)</span>;<br />
extractAssociatedIconFunc.<span style="color:#000000;">returns</span><span style="color:#000000;">(</span>ExtTypes::<span style="color:#000000;">DWord</span><span style="color:#000000;">)</span>; <span style="color:#007f00;">// HICON</span><br />
extractAssociatedIconFunc.<span style="color:#000000;">arg</span><span style="color:#000000;">(</span>ExtTypes::<span style="color:#000000;">DWord</span>,      <span style="color:#007f00;">// HINSTANCE hInst</span><br />
ExtTypes::<span style="color:#000000;">String</span>,     <span style="color:#007f00;">// LPTSTR lpIconPath</span><br />
ExtTypes::<span style="color:#000000;">Pointer</span><span style="color:#000000;">)</span>;   <span style="color:#007f00;">// LPWORD lpiIcon</span></em></p>
<p><em> <span style="color:#007f00;">// We also need a function to destroy the icon handle once we&#8217;ve used it</span><br />
destroyIconFunc = <span style="color:#0000ff;">new</span> DLLFunction<span style="color:#000000;">(</span>userDLL, <span style="color:#ff0000;">&#8220;DestroyIcon&#8221;</span><span style="color:#000000;">)</span>;<br />
destroyIconFunc.<span style="color:#000000;">returns</span><span style="color:#000000;">(</span>ExtTypes::<span style="color:#000000;">DWord</span><span style="color:#000000;">)</span>;           <span style="color:#007f00;">// BOOL</span><br />
destroyIconFunc.<span style="color:#000000;">arg</span><span style="color:#000000;">(</span>ExtTypes::<span style="color:#000000;">DWord</span><span style="color:#000000;">)</span>;               <span style="color:#007f00;">// HICON hIcon</span></em></p>
<p><em> <span style="color:#007f00;">// This is our call for drawing the icon onto a window</span><br />
drawIconFunc = <span style="color:#0000ff;">new</span> DLLFunction<span style="color:#000000;">(</span>userDLL, <span style="color:#ff0000;">&#8220;DrawIconEx&#8221;</span><span style="color:#000000;">)</span>;<br />
drawIconFunc.<span style="color:#000000;">returns</span><span style="color:#000000;">(</span>ExtTypes::<span style="color:#000000;">DWord</span><span style="color:#000000;">)</span>;  <span style="color:#007f00;">// BOOL</span><br />
drawIconFunc.<span style="color:#000000;">arg</span><span style="color:#000000;">(</span>ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// HDC hDC</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// int xLeft</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// int yTop</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// HICON hIcon</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// int cxWidth</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// int cyWidth</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// uint istepIfAniCur</span><br />
ExtTypes::<span style="color:#000000;">DWord</span>,       <span style="color:#007f00;">// HBRUSH hbrFlickerFreeDraw</span><br />
ExtTypes::<span style="color:#000000;">DWord</span><span style="color:#000000;">)</span>;      <span style="color:#007f00;">// UINT diFlags</span><br />
<span style="color:#000000;">}</span></em></div>
</blockquote>
<p>When the form runs, we want the icon to be updated with an icon from a file. To do this, we will override the <em>run</em> method on the form. After the form has started normally, we will make a call to <em><a href="http://msdn2.microsoft.com/en-us/library/ms648067.aspx">ExtractAssociatedIcon()</a></em> to find our <em>hIcon</em> (icon handle) value. We&#8217;ll save this value for later use. Once this is done, we&#8217;ll need to draw the icon for the first time.</p>
<p>Axapta provides one additional bit of help here for complex<br />
structures containing primitive types, or any other place where you<br />
need to pass a pointer on the stack. The kernel class <em>Binary::</em><br />
lets you allocate memory in the system, and have it freed by the normal<br />
Axapta garbage collection routines. This of this as your answer to <em>malloc()</em>, and also your answer to creating and reading C-style structures.</p>
<p>Override your form&#8217;s <em>run()</em> method with the following, and feel free to change the file to any file on your system:</p>
<blockquote>
<div class="xpp" style="text-align:left;"><em><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> run<span style="color:#000000;">(</span><span style="color:#000000;">)</span><br />
<span style="color:#000000;">{</span><br />
Binary binary;<br />
;</em></p>
<p><em> <span style="color:#007f00;">// Run the form normally</span><br />
<span style="color:#0000ff;">super</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="font-style:italic;color:#007f00;">/* We need to build a binary item for two bytes (a short), since windows<br />
* has an &#8220;in/out&#8221; pointer for the icon information.<br />
*/</span><br />
binary = <span style="color:#0000ff;">new</span> Binary<span style="color:#000000;">(</span><span style="color:#000000;">2</span><span style="color:#000000;">)</span>; <span style="color:#007f00;">// 2 bytes = short</span></em></p>
<p><em> <span style="color:#007f00;">// Call the ExtractAssociatedIcon() function</span><br />
hIcon = extractAssociatedIconFunc.<span style="color:#000000;">call</span><span style="color:#000000;">(</span><span style="color:#0000ff;">NULL</span>,<br />
<span style="color:#ff0000;">&#8220;C:<span style="color:#000000;">\\</span>WINDOWS<span style="color:#000000;">\\</span>EXPLORER.EXE&#8221;</span>,<br />
binary<span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="color:#007f00;">// Make sure we got an icon (we should, if the file exists)</span><br />
<span style="color:#0000ff;">if</span> <span style="color:#000000;">(</span>!hIcon<span style="color:#000000;">)</span> <span style="color:#000000;">{</span><br />
<span style="color:#0000ff;">throw</span> error<span style="color:#000000;">(</span><span style="color:#ff0000;">&#8220;Unable to get hIcon&#8221;</span><span style="color:#000000;">)</span>;<br />
<span style="color:#000000;">}</span></em></p>
<p><em> <span style="color:#007f00;">// Do the initial drawing of the icon</span><br />
this.<span style="color:#000000;">drawIcon</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;<br />
<span style="color:#000000;">}</span></em></div>
</blockquote>
<p>Since the Windows API will allocate stuff on its side, we need to<br />
clean up some memory when the form is closed. To do this, we call <em><a href="http://msdn2.microsoft.com/en-us/library/ms648063.aspx">DestroyIcon()</a></em> with the icon&#8217;s handle. Override your form&#8217;s <em>close()</em> method with the following snippet:</p>
<blockquote>
<div class="xpp" style="text-align:left;"><em><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> close<span style="color:#000000;">(</span><span style="color:#000000;">)</span><br />
<span style="color:#000000;">{</span><br />
;</em></p>
<p><em> <span style="color:#007f00;">// If we have an icon handle, we need to clean up</span><br />
<span style="color:#0000ff;">if</span> <span style="color:#000000;">(</span>hIcon<span style="color:#000000;">)</span> <span style="color:#000000;">{</span><br />
destroyIconFunc.<span style="color:#000000;">call</span><span style="color:#000000;">(</span>hIcon<span style="color:#000000;">)</span>;<br />
<span style="color:#000000;">}</span></em></p>
<p><em> <span style="color:#007f00;">// Close the form</span><br />
<span style="color:#0000ff;">super</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;<br />
<span style="color:#000000;">}</span></em></div>
</blockquote>
<p>Now the fun part: We need to grab the device context of the window,<br />
and use it to draw the icon on to the form. We will use the function <em><a href="http://msdn2.microsoft.com/en-us/library/ms648065.aspx">DrawIconEx()</a></em>.<br />
Note that we need to lock the device context of the window before<br />
passing it outside for the library to chew on. Add the following method<br />
to your form:</p>
<blockquote>
<div class="xpp" style="text-align:left;"><em><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">void</span> drawIcon<span style="color:#000000;">(</span><span style="color:#000000;">)</span><br />
<span style="color:#000000;">{</span><br />
;</em></p>
<p><em> <span style="color:#007f00;">// Lock the device context of the window so we can use it</span><br />
Icon.<span style="color:#000000;">lockDC</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="color:#007f00;">// Paint the icon (we&#8217;ll use the window size to determine the icon size)</span><br />
drawIconFunc.<span style="color:#000000;">call</span><span style="color:#000000;">(</span>Icon.<span style="color:#000000;">hDC</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>, <span style="color:#000000;">0</span>, <span style="color:#000000;">0</span>, hIcon,<br />
Icon.<span style="color:#000000;">widthValue</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>,<br />
Icon.<span style="color:#000000;">heightValue</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>,<br />
<span style="color:#000000;">0</span>, <span style="color:#0000ff;">NULL</span>,<br />
<span style="color:#000000;">(</span>#DI_IMAGE | #DI_MASK | #DI_COMPAT<span style="color:#000000;">)</span><span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="color:#007f00;">// Unlock the device context of the window</span><br />
Icon.<span style="color:#000000;">unlockDC</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;<br />
<span style="color:#000000;">}</span></em></div>
</blockquote>
<p>Finally, you will also need to override the function <em>paint()</em><br />
on the Window control. The following code will be called by Axapta<br />
whenever Windows asks Axapta to paint the window. This allows you to<br />
redraw the icon when the form is covered or uncovered by another window<br />
in the foreground, for example. Without this, your icon will disappear<br />
if anything other than the mouse moves over it! Add this code to the <em>Icon</em> control:</p>
<blockquote>
<div class="xpp" style="text-align:left;"><em><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">int</span> paint<span style="color:#000000;">(</span><span style="color:#000000;">)</span><br />
<span style="color:#000000;">{</span><br />
<span style="color:#0000ff;">int</span> ret;<br />
;</em></p>
<p><em> <span style="color:#007f00;">// Paint the window first</span><br />
ret = <span style="color:#0000ff;">super</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="color:#007f00;">// Draw the icon</span><br />
element.<span style="color:#000000;">drawIcon</span><span style="color:#000000;">(</span><span style="color:#000000;">)</span>;</em></p>
<p><em> <span style="color:#0000ff;">return</span> ret;<br />
<span style="color:#000000;">}</span></em></div>
</blockquote>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/112/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/112/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=112&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/19/using-the-windows-api-from-within-axapta/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
		<item>
		<title>Color-code your Dynamics environments</title>
		<link>http://coolhake.wordpress.com/2008/08/15/color-code-your-dynamics-environments/</link>
		<comments>http://coolhake.wordpress.com/2008/08/15/color-code-your-dynamics-environments/#comments</comments>
		<pubDate>Fri, 15 Aug 2008 08:55:16 +0000</pubDate>
		<dc:creator>coolhake</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://coolhake.wordpress.com/?p=107</guid>
		<description><![CDATA[Since implementing Axapta / Dynamics AX in 2003, we&#8217;ve found it invaluable to provide an environment for testing and training as well as our live system (or production environment) to end users. This lets people try different processes or train new employees without fear of screwing up the &#8220;real&#8221; data. Occasionally, though, we&#8217;ve run into [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=107&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="font-family:Arial;">Since implementing Axapta / Dynamics AX in 2003, we&#8217;ve found it invaluable to provide an environment for testing and training as well as our live system (or production environment) to end users. This lets people try different processes or train new employees without fear of screwing up the &#8220;real&#8221; data.</span></p>
<p><span style="font-family:Arial;">Occasionally, though, we&#8217;ve run into a problem where someone thought they were using the live system, but were actually in the test environment. It&#8217;s an easy mistake to make. There is no obvious visual cue to alert a user that they are working on a test system.</span></p>
<p><span style="font-family:Arial;">There is a way change the color of the Dynamics forms to help indicate what environment is in use. It involved overriding the SysSetupFormRun.run() method, which will be called every time a form is opened. On the class SysSetupFormRun, create a new method with this code:</span></p>
<blockquote><p><span style="font-size:85%;font-family:courier new;">public void run()</span><br />
<span style="font-size:85%;font-family:courier new;">{</span><br />
<span style="font-size:85%;font-family:courier new;">SysSQLSystemInfo systemInfo = SysSQLSystemInfo::construct();<br />
; </span><br />
<span style="font-size:85%;font-family:courier new;">super();<br />
</span></p>
<p><span style="font-size:85%;font-family:courier new;">// Set the color scheme of this instance of the SysFormRun to RGB</span><br />
<span style="font-size:85%;font-family:courier new;">this.design().colorScheme(FormColorScheme::RGB);<br />
</span></p>
<p><span style="font-size:85%;font-family:courier new;">// If the database name is not the live version, change the color of the form</span></p>
<p><span style="font-size:85%;font-family:courier new;">if (systemInfo.getloginDatabase() != &#8216;MyDBName&#8217;)</span><br />
<span style="font-family:courier new;"><span style="font-size:85%;">this.design().backgroundColor(0&#215;112255);<br />
}</span><br />
</span></p></blockquote>
<p><span style="font-family:Arial;">That&#8217;s all there is to it. If your live and test systems use the same database name, but the AOS is running on different servers you can modify this code to to match on systemInfo.getLoginServer() != &#8216;MyServerName&#8217;.</span> <span style="font-family:arial;">You can change the</span> <span style="font-family:arial;">color by setting the hex value. It uses the RGB values in reverse order: </span><span style="font-family:courier new;">0xBBGGRR</span>.<span style="font-family:arial;"> </span></p>
<p><span style="font-family:Arial;">Variations of this code could switch form colors to indicate the current user account, application layer, or company. Less practical uses could match color to the time of day or season of the year. If you find this code useful, leave me a message noting what you did with it.</span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/coolhake.wordpress.com/107/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/coolhake.wordpress.com/107/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/coolhake.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/coolhake.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/coolhake.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/coolhake.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/coolhake.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/coolhake.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/coolhake.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/coolhake.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=coolhake.wordpress.com&amp;blog=4283937&amp;post=107&amp;subd=coolhake&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://coolhake.wordpress.com/2008/08/15/color-code-your-dynamics-environments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/94175892822b480b7f3362d63e770be0?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">coolhake</media:title>
		</media:content>
	</item>
	</channel>
</rss>
