Jsprintsetup Half Letter Epson LQ 1170

Print dokumen, misalnya faktur penjualan, akan bermasalah dengan auto header & footer yang menjadi bawaan browser. Auto header & footer umumnya berisi tanggal print, sumber website, dsb. Solusi menghilangkan auto header & footer bisa menggunakan plugin firefox: jsprintsetup.

Hari ini gue mendapat masalah. Requirementnya: faktur diprint pada kertas half letter menggunakan printer jarum Epson LQ 1170. By default printer menggunakan ukuran letter, yang notabene tidak sesuai dengan requirement.

Berhubung versi jsprintsetup yang digunakan masih 0.82, fungsi-fungsi enhanced paper data handling belum ada. Gue mencoba memanggil fungsi jsPrintSetup.setOption(width, 216) dan jsPrintSetup.setOption(width, 420), tapi tidak berpengaruh.

Akhirnya gue menemukan solusinya di http://www.pajak.net/blog/2007/08/22/bagaimana-cara-setting-kertas-custom-size-di-windows-xp/. It Works!

Google Apps Cpanel

NGADUide menggunakan google apps email service untuk keperluan email nya. Awalnya tidak ngeh kalau ada masalah, baru ketahuan waktu ada email uji coba dari panitia yang tidak masuk waktu dicek di google apps email service.

Lumayan panik tuh… Gimana kalau ada email penting ke info@ngaduide.org dan tidak sampai?! Untungnya selidik punya selidik, email uji coba nya ternyata ada kalau dibuka di webmail cpanel. Tanya kanan kiri, ada teman gue rekomendasiin http://www.jagoanhosting.com/blog/setup-email-gratis-dari-google-untuk-domain-anda/ untuk konfigurasi google apps email service dan cpanel.

Gue ikutin langkah demi langkah, tapi mentok di langkah ke-5 (Change MX records). Google Apps bilang untuk memasukan informasi billing. Waduh… agak susah kalau urusan billing gini.

Akhirnya gue matiin email service nya google apps, dan sementara pakai webmail bawaannya cpanel. Belum sempat ngoprek-ngoprek lagi… Heuu…

Elegant Theme Slider Error

Anda tahu elegant theme? Menurut gue, elegant theme salah satu provider theme wordpress premium yang paling affordable. Dengan membayar $39, kita dapat mendownload sekitar 60 theme yang ada di situsnya. Kalau di provider lain, harga segitu hanya dapat 1 theme.

Gue menggunakan theme Glow dari elegant theme untuk membuat mockup website http://pl.licht-soft.com. Setelah mockup di local rampung 70%, gue upload ke server. Di server ternyata ada masalah, muncul error di slider nya yang isinya seperti ini

: imagejpeg() []: Unable to open ‘/home/sloki/user/h58206/sites/pl.licht-soft.com/www/wp-content/uploads/2011/12/SoccerField-102631_500x298.jpg’ for writing: Permission denied in on line /home/sloki/user/h58206/sites/pl.licht-soft.com/www/wp-content/uploads/2011/12/SoccerField.jpg:

Dua hari ini gue bongkar-bongkar wordpress nya untuk mencari masalahnya. Akhirnya gue nemu sumbernya ada di variabel database: tabel wp_options, option_name = et_images_temp_folder. Variabel itu menyimpan file path ke folder et_temp, yang seharusnya diganti waktu kita deploy ke server.

Solved! Yeahh! Kesimpulan gue: meskipun theme nya oke, elegant theme masih kurang memberikan dokumentasi teknis.

WordPress 3.3

Woowww, wordpress 3.3 keren banget yaa! #telat Kadang malas untuk update wordpress, soalnya internet (dulu) agak lambat. Kalau update via web interface, takutnya gara-gara lambat akhirnya connection timeout, terus blognya jadi corrupt, hancur semuanya. Gaptek juga ya gw, jadi paranoid gini -_-. Kalau update via ftp malas masukin username yang belibet dan suka kelupaan.

Tapi serius, selalu mengupdate versi wordpress itu penting banget! Soalnya selain perubahan interface, ada celah-celah keamanan yang diperbaiki juga. Jangan sampai kejadian seperti http://www.dgi-indonesia.com/ yang kena deface. Kata milis sebelah sih situs DGI masih pakai wordpress 3.1.3, dan klo disearch exploitnya buanyak banget. Itulah kekurangan kalau pakai open source tools, cracker bisa membongkar kode nya untuk mencari area rawan di kodingannya.

Apa yang oke dari wordpress 3.3? Tombol add postnya jadi di atas, lebih praktis untuk menambah post baru. Upload image jadi digabung di 1 tombol, ditambah ada fitur drag and drop nya. Gue baru nyadar juga, fitur spam filtering wordpress canggih bener! Ada ratusan  spam yang ter-detect, padahal tulisan di commentnya normal banget, misalnya “This is an important strategy to implement, especially for those on your team who are serious team builders”.

#ilovewordpress. Do You?

Mission Impossibru

Deadline! Setelah sekian lama bekerja dengan terencana, hari ini gue menghadapi deadline gila-gilaan terkait pekerjaan Reliability Modelling. Hari ini gue harus menambahkan sekitar 200 availability box yang ada di 20 file terpisah, beserta rumus perhitungan availability di setiap box nya. Sudah jatuh tertimpa tangga, malamnya ada janji datang ke acara Natal bareng keluarga. Dengan semangat 45 dikebut seharian, untungnya berhasil diselesaikan sebelum jam6 XD. Ini salah satu tampilannya

Reliability Block Diagram

Apa hikmat dari kejadian ini ya…??? Hidup ga selalu terencana dan teratur, ada waktunya keadaan di luar kendali kita. Dan actually it’s fun, deg-degan, stress dan pressurenya. Membuat hidup lebih hidup, halah… Asal jangan deadline mepet terus tiap minggu aja bisa gila hahaha…

So excited, seneng banget tantangan ini bisa dilewati!

Connect Yii and SQL Server

We can connect Yii and SQL Server following instructions in http://www.youtube.com/watch?v=2iWa303gi1w. 100% correct, tested by some programmers in our team :D.

http://youtu.be/2iWa303gi1w

But sadly, it is not a perfect world for all of us, including me. I kept up with the video and repeated it thousand times just to end up with SQLSTATE[HY000][-1] error. It didn’t happen to fellow programmers mentioned in paragraph above, and I thought it was my beloved OS fault (Windows7 32 bit).

Mr Google couldn’t give proper answer, so I began asking coding geniuses I know. One genius told me to check Sql Server connection using telnet. Ok… I opened command prompt and write


telnet 127.0.0.1 1433

In seconds system answer me,  “Connecting To 127.0.0.1…Could not open connection to the host, on port 1433: Connect failed”. Yes, 1433 is SQL Server default port. And by the way, you could activate Microsoft’s telnet client through control panel. Continue reading Connect Yii and SQL Server

jQuery Flexigrid AJAX Asynchronous Search

Flexigrid is one cool lightweight jquery plugin to create javascript ajax dynamic table. It’s official site define flexigrid as Lightweight but rich data grid with resizable columns and a scrolling data to match the headers, plus an ability to connect to an xml based data source using Ajax to load the content.

Moreover, we can use flexigrid to show search results asynchronously (without reloading page) based on user’s keywords.

Javascript code

$("form[name='filter']").submit(function(){ //invoke function when user click search button
	var start_date = this.start_date.value; //start_date input by user

	$("#grid").flexOptions({
		params: [
			{ name: 'start_date', value: start_date }
		]
	});
	$("#grid").flexReload();

	return false; //prevent form to reload page
});

Server side (PHP) code. PHP can read start_date variable sent by flexigrid using

$_POST["start_date"];

And voila!

Easy jQuery Text Slider using easyslider

We can make cool javascript text slider easily using jQuery easyslider plugin. By example, jQuery easyslider works for image slider, but we can customize it to create text slider like this one…

This is the html structure for text slider

<div id="s-prev"> <!-- previous button -->
	<a href="#fp-blog" id="s-prev-link"><img src="public/image/frontpage/prev.jpg" alt="" /></a>
</div>
<div id="slider">
	<ul>
		<li>
			<div class="s-item">
				<div class="s-title">
					Latest Blog Entries
				</div>
				<div class="s-content">
					<b>Title 1 .</b> Lorem ipsum dolor sit amet... <a href="#">read more</a>
				</div>
			</div>
		</li>
		<li>
			<div class="s-item">
				<div class="s-title">
					Latest Blog Entries
				</div>
				<div class="s-content">
					<b>Title 1 .</b> Lorem ipsum dolor sit amet... <a href="#">read more</a>
				</div>
			</div>
		</li>
		<li>
			<div class="s-item">
				<div class="s-title">
					Latest Blog Entries
				</div>
				<div class="s-content">
					<b>Title 1 .</b> Lorem ipsum dolor sit amet... <a href="#">read more</a>
				</div>
			</div>
		</li>
	</ul>
</div>
<div id="s-next"> <!-- next button -->
	<a href="#fp-blog" id="s-next-link"><img src="public/image/frontpage/next.jpg" alt="" /></a>
</div>

And this is the javascript code for easyslider

$('#slider').easySlider({
	auto : true,
	continuous : true,
	prevId : 's-prev-link',
	nextId  : 's-next-link',
	controlsShow : false, //hide default previous and next control, replace with custom control
});

Unfortunately, click both previous and next button do not make easyslider display previous or next slide immediately. My easyslider version is 1.7, and after a couple of searches, I found suspicious code on easySlider1.7.js line 108

$("a","#"+options.nextId).click(function(){
	animate("next",true);
});
$("a","#"+options.prevId).click(function(){
	animate("prev",true);
});
$("a","#"+options.firstId).click(function(){
	animate("first",true);
});
$("a","#"+options.lastId).click(function(){
	animate("last",true);
});

I modified it into

$("a#"+options.nextId).click(function(){
	animate("next",true);
});
$("a#"+options.prevId).click(function(){
	animate("prev",true);
});
$("a#"+options.firstId).click(function(){
	animate("first",true);
});
$("a#"+options.lastId).click(function(){
	animate("last",true);
});

And gladly previous and next button work find afterwards. Have questions? Fell free to ask 🙂

CodeIgniter MySQL Stored Procedure and Function

MySQL has procedure and function feature. There is good article explaining both topics in http://bit.ly/dWDh9w.

To call mysql function from codeigniter, we can simply use query() function from database class. For example

$query = $this->db->query("call storedFunction($param1, $param2) as A");
$row = $query->row();
echo $row->A;

Where storedFunction is the name of function we have created before.

To call mysql stored procedure from codeigniter, we can use query() function from database class. For example

$query = "CALL hello('Chandra', @a)";
$res = $this->db->query($query);
$query = "SELECT @a as A";
$res = $this->db->query($query);
$row = $res->row();

Where hello is the name of stored procedure.

Hope this article helps 🙂

Selenium and TinyMCE

There is a bit problem using selenium to type in textarea formatted by tinymce. We can’t use

page.FindElement(By.XPath("//textarea[@name='textareaName']")).SendKeys(content);

because tinymce uses html inside iframe instead of textarea to perform wysiwyg editing.

To make selenium type in tinymce iframe, write this in test code (this example using c#.net)

driver.SwitchTo().Frame(iframeLocator);
driver.FindElement(By.XPath("//body[@id='tinymce']")).<br>SendKeys(sValue);
driver.SwitchTo().DefaultContent();

where

driver = IWebDriver
iframeLocator = name of iFrame
sValue = desired content of textarea

Tinymce set the name of iframe as textareaid_ifr.
If textarea ID is content, iframe name would be content_ifr