Monday, May 30, 2011

how to make Apache run ASP.NET and MySQL on Linux Fedora


This will show how to make Apache run ASP.NET and MySQL on Linux Fedora.

dont ask me why ASP.NET on Linux/Apache, I was asked to make it works, and IT WORKED !!!

The guide was tried to run on Fedora 14, but it may works on other version of fedora

- Install packages

If Apache is not yet installed, then you the following command, Use yum to install Apache, mod_mono and the dependencies to xsp.

# yum install httpd mod_mono mono-web

If Apache is already installed, then we just need to install mod_mono and its dependencies

# yum install mod_mono mono-web

- Install xsp from rawhide

If you install xsp from the standard Fedora repository, you get this error in httpd error_log.

500 Internal Server Error

System.InvalidOperationException: mod_mono and xsp have different versions.

Use this command to install xsp from the rawhide repository.

# yum install --enablerepo=rawhide xsp

- Disabling SELinux

Set SELinux in permissive mode (setenforce 0) to avoid the following error.

503 Service Temporarily Unavailable

[error] Failed to connect to mod-mono-server after several attempts to spawn the process.

To put the system into permissive mode, issue this command.

# setenforce 0

Managing the policies for SELinux is beyond the scope of this article, but you can find more information about SELinux in the Fedora SELinux Project Page (http://fedoraproject.org/wiki/SELinux).

- Setting up a MySQL database

Assuming that MySQL is already Installed, then we need to create sample database and table to be fetched by ASP.Net code.

$ mysql -uroot -p
...

mysql> CREATE DATABASE cdcat;
Query OK, 1 row affected (0.10 sec)

mysql> USE cdcat;
Database changed

mysql> CREATE TABLE artist ( id INT AUTO_INCREMENT PRIMARY KEY, name VARCHAR(255) );
Query OK, 0 rows affected (0.09 sec)

mysql> INSERT INTO artist VALUES(null, 'Wire');
Query OK, 1 row affected (0.00 sec)

mysql> INSERT INTO artist VALUES(null, 'The Fall');
Query OK, 1 row affected (0.00 sec)

mysql> SELECT * FROM artist;
+----+----------+
| id | name |
+----+----------+
| 1 | Wire |
| 2 | The Fall |
+----+----------+
2 rows in set (0.00 sec)

mysql> GRANT SELECT, INSERT, UPDATE, DELETE ON cdcat.* TO cdcat@localhost IDENTIFIED BY 'hardpassword';
Query OK, 0 rows affected (0.12 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.13 sec)

What we've done here is setup the first table in a CD catalogue database, namely:

  • Created a new database called cdcat
  • Created a table called artist in that database
  • Put two artists into the table
  • Created a user called cdcat with SELECT, UPDATE, DELETE and INSERT privileges on all tables in the cdcat database
  • Made those privileges active
- Installing Connector/Net

Now you've got a MySQL database server, database, table and user set up, you'll need the MySQL connector for ASP.Net. You need to download Connector/Net from the MySQL website. The one you need is Windows Binaries, no installer (ZIP).

Once the zip file is downloaded, create a directory somewhere and unzip its contents into it. The file you're after is in the resulting bin directory, MySQL.Data.dll. To install it, use the gacutil tool included in the Mono installer, which puts it into the right place in your Mono library directory:

gacutil -i /path/to/unzipped/connector/bin/MySQL.Data.dll

If gacutil isn't on your path you'll need to reference it correctly using its full path.

Creating a simple page to show data from a table
To prove you've got everything installed correctly, we'll create a page to display the contents of the artist table using one of the standard ASP.Net controls. Like I've said before, this isn't going to be a full ASP.Net tutorial, so I'm not going to try to explain Web Forms and all that jazz: I'm just giving a few examples to help you get the pieces working nicely together. See one of the countless ASP.Net books for more detail. (By the way, if anyone can recommend a half-decent tutorial book for ASP.Net, please let me know, as the ones I've looked at are generally good reference works, but lousy tutorials.) I'll try to put more tutorial material in as I learn more about ASP.Net.

First, create a file called artists.aspx inside your project folder.



Next, put this code into the file and save it:



<%@ Page Language="C#" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="MySql.Data.MySqlClient" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>CD cat</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script runat="server">
private void Page_Load(Object sender, EventArgs e)
{
string connectionString = "Server=localhost;Database=cdcat;User ID=cdcat;Password=hardpassword;Pooling=false;";
MySqlConnection dbcon = new MySqlConnection(connectionString);
dbcon.Open();

MySqlDataAdapter adapter = new MySqlDataAdapter("SELECT * FROM artist", dbcon);
DataSet ds = new DataSet();
adapter.Fill(ds, "result");

dbcon.Close();
dbcon = null;

ArtistsControl.DataSource = ds.Tables["result"];
ArtistsControl.DataBind();
}
</script>

</head>

<body>
<h1>Artists</h1>
<asp:DataGrid runat="server" id="ArtistsControl" />
</body>

</html>
Finally, you need a web.config file, again in the project root directory. This contains application settings, such as which libraries your application needs. It should contain the following to enable the MySQL libraries to be loaded:

<configuration>
<system.web>
<compilation>
<assemblies>
<add assembly="MySql.Data"/>
</assemblies>
</compilation>
</system.web>
</configuration>


- Restart httpd

Start or restart httpd.

# service httpd restart

Now run your application again with xsp2 from inside the project directory and browse to http://localhost:8080/artists.aspx. You should see this:

Source:
1. http://www.inprose.com/articles/10-enable-aspnet-support-in-fedora-linux.html
2. http://townx.org/blog/elliot/using-mysql-asp-net-under-mono-linux

Sunday, May 22, 2011

Installing Apache, PHP and MySQL on Fedora

There's XAMPP that integrate Apache, MySQL, PHP and Perl in one bundle and installing them easily on a machine.

however, I've always found XAMPP on Linux to be hard to use. On Windows, it's great because it sets up a quick independent stack. I can have many of them, running easily.

For Linux, I just do:

"yum install httpd mysql php mod-suphp".

This much more easier, then I go through the list of PHP modules I think I'll need and install them too in the same manner.

or if you wanna see more explanation in step by step manner on how to install Apache (httpd) and PHP 5.3.6 on Fedora (11-14), go and check these links :

  1. www.if-not-true-then-false.com
  2. http://www.hackourlife.com
  3. http://library.linode.com/databases/mysql/fedora-14


-- Zeldi

Thursday, May 19, 2011

Enabling Flash on Ubuntu 11.04 (Natty)

I am used to Fedora Linux OS, however I decided to get familiar with Ubuntu 11 (Natty).
First thing first, I downloaded Ubuntu 11 and Installed it successfully.
with its Unity UI (apart from its classical UI), it just looks simple but pretty.. it is awesome.

Having Natty successfully installed, another first thing I tried was installing Google Chrome, it simple because I dont wanna miss Angry Bird game from it.
With the following simple command :

# sudo apt-get install chromium-browse

The Chrome also setup and run very well.

First thing I tried from Chrome of course its addicted "Angry Bird" game.
I download and run the game.. but uppppssss.... the game could not run well..

After short conversation with google, I found the reasons and solution for this issue. It is because the Angry Bird game is a flash based game, default installation of Ubuntu does not include flash support as it may violate the Intellectual Property.

Ubuntu is committed to Free software (free in cost and free in licensing restrictions), but in "the real world," most computer users are used to having proprietary or nonfree codecs and support software installed (to use Java, MP3s, Microsoft fonts, etc.), so Ubuntu has included an easy way to install these nonfree items. The free in the word nonfree refers to licensing restrictions, not to cost.

to solve this issue, I follow the following steps:



If you're using Unity, you can find Ubuntu Software Center on the left side of your screen.If you're using classic Gnome, go to Applications and select Ubuntu Software Center


Do a filter search for the word restricted and then click Install next to Ubuntu restricted extras.

When prompted for your password, enter it.



That's it!

You can find more details here (without all the screenshots).

There are also variations on Ubuntu that include proprietary/nonfree software in the default installation. One popular variation is called Linux Mint.

And now I can enjoy playing angry bird.....





Thursday, November 20, 2008

How to install MySQL on fedora
  1. Use yum to install both mysql command line tool and the server:yum -y install mysql mysql-server
  2. Enable the MySQL service:/sbin/chkconfig mysqld on
  3. Start the MySQL server:/sbin/service mysqld start
  4. Set the MySQL root password:mysqladmin -u root password 'new-password'The quotes around the new password are required.

Thursday, March 13, 2008

On-Demand Multicast Routing Protocol (ODMRP) is:

* A mesh-based, rather than a conventional tree-based, multicast scheme.
* Uses a forwarding group concept (only a subset of nodes forwards the multicast packets via scoped flooding): a set of nodes responsible for forwarding multicast data on shortest paths between any member pairs, to build a forwarding mesh for each multicast group.
* Flooding redundancy among forwarding group helps overcome node displacements and channel fading. Hence, unlike trees, frequent reconfigurations are not required.
* Applies on-demand procedures to dynamically build routes and maintain multicast group membership.
* Well suited for ad hoc wireless networks with mobile hosts where bandwidth is limited, topology changes frequently and power is constrained.

Tree-based Scheme is BAD
Multicast tree structures are fragile and must be readjusted continuously as connectivity changes. Furthermore, typical multicast trees usually require a global routing substructure such as link state or distance vector. The frequent exchange of routing vectors or link state tables, triggered by continuous topology changes, yields excessive channel and processing overhead.

Multicast Route and Membership Maintenance

* Group membership and multicast routes are established and updated by the source on demand.

* While a multicast source has packets to send:
o Multicast source periodically broadcasts a JOIN REQUEST (a member advertising packet) to the entire network. This periodic transmission refreshes the membership information and updates the route.

* When a node receives a non-duplicate JOIN REQUEST, it
o Stores the upstream node ID (i.e., backward learning), and
o Rebroadcasts the packet.

* When the JOIN REQUEST packet reaches a multicast receiver, the receiver
o Creates the source entry in its Member Table, or
o Updates the source entry in its Member Table.

While valid entries exist in the Member Table, JOIN TABLES are broadcasted periodically to the neighbors.

When a node receives a JOIN TABLE:

* It checks if the next node ID of one of the entries matches its own ID.
* If it does, the node realizes that it is on the path to the source and thus is part of the forwarding group.
* It then sets the FG Flag and broadcasts its own JOIN TABLE built upon matched entries.
* The JOIN TABLE is thus propagated by each forwarding group member until it reaches the multicast source via the shortest path. This process constructs (or updates) the routes from sources to receivers and builds a mesh of nodes, the forwarding group.

A multicast receiver can also be a forwarding group node if it is on the path between a multicast source and another receiver.

Example
Nodes S1 and S2 are multicast sources.
Nodes R1, R2, and R3 are multicast receivers.

Nodes R2 and R3 send their JOIN TABLES to both S1 and S2 via I2.
Node R1 sends its JOIN TABLE to S1 via I1 and to S2 via I2.

1. When receivers send their JOIN TABLES to next hop nodes, an intermediate node
2. I1 sets the FG Flag and builds its own JOIN TABLE since there is a next node ID entry in the JOIN TABLE received from R1 that matches its ID.
Note that the JOIN TABLE built by I1 has an entry for sender S1 but not for S2 because the next node ID for S2 in the received JOIN TABLE is not I1.
3. In the meantime, node I2 sets the FG Flag, constructs its own JOIN TABLE and sends it to its neighbors.
4. Note that even though I2 receives three JOIN TABLES from the receivers, it broadcasts the JOIN TABLE only once because the second and third table arrivals carry no new source information.
*Channel overhead is thus reduced dramatically in cases where numerous multicast receivers share the same links to the source.

Data Forwarding
After the group establishment and route construction process, a multicast source can transmit packets to receivers via selected routes and forwarding groups.

Periodic control packets are sent only when outgoing data packets are still present. When receiving a multicast data packet, a node forwards it only if

* It is not a duplicate and,
* The setting of the FG Flag for the multicast group has not expired. This procedure minimizes traffic overhead and prevents sending packets through stale routes.

Soft State
In ODMRP, no explicit control packets need to be sent to join or leave the group.

If a multicast source wants to leave the group, it simply stops sending JOIN REQUEST packets since it does not have any multicast data to send to the group.

If a receiver no longer wants to receive from a particular multicast group,

* It removes the corresponding entries from its Member Table and,
* It does not transmit the JOIN TABLE for that group.

Nodes in the forwarding group are demoted to non-forwarding nodes if not refreshed (no JOIN TABLES received) before they timeout.

Data Structures
Network hosts running ODMRP are required to maintain the following data structures.

* Member Table:
o Each multicast receiver stores the source information in the Member Table.
o For each multicast group the node is participating in, the source ID and the time when the last JOIN REQUEST is received from the source is recorded.
o If no JOIN REQUEST is received from a source within the refresh period, that entry is removed from the Member Table.

* Routing Table:
o A Routing Table is created on demand and is maintained by each node.
o An entry is inserted or updated when a non-duplicate JOIN REQUEST is received.
o The node stores the destination (i.e., the source of the JOIN REQUEST) and the next hop to the destination (i.e., the last node that propagated the JOIN REQUEST).
o The Routing Table provides the next hop information when transmitting Join Tables.

* Forwarding Group Table:
o When a node is a forwarding group node of the multicast group, it maintains the group information in the Forwarding Group Table.
o The multicast group ID and the time when the node was last refreshed is recorded.

* Message Cache:
o The Message Cache is maintained by each node to detect duplicates.
o When a node receives a new JOIN REQUEST or data, it stores the source ID and the sequence number of the packet.
o *Note that entries in the Message Cache need not be maintained permanently.
o *Schemes such as LRU (Least Recently Used) or FIFO (First In First Out) can be employed to expire and remove old entries and prevent the size of the Message Cache to be extensive.

Unicast Capability
One of the major strengths of ODMRP is its unicast routing capability. Not only ODMRP can work with any unicast routing protocol, it can function as both multicast and unicast. Thus, ODMRP can run without any underlying unicast protocol.

Advantages:

* Low channel and storage overhead
* Usage of up-to-date and shortest routes
* Robustness to host mobility
* Maintenance and exploitation of multiple redundant paths
* Scalability to a large number of nodes

Thursday, January 10, 2008

Surat Kepada Kawan Di Suatu Petang

Kawan, perjumpaan kita, barangkali, sebuah kebetulan yang tak pernah diniatkan. Tapi, begitulah hidup sering mengajarkan: Kerap ada perihal misterius yang mencemooh ikhtiar untuk menjabarkan, setiap kali kita berlagak rasional. Maka, Tuhan pun menautkan kita dalam cara yang amat sahaja, lugu, tak kebanyakan tingkah. Hingga pada suatu ketika.

Kau bertandang sambil menyuguhkan sepotong paras khas pemikir letih. Kau tiba-tiba ingin berhenti—atau setidaknya membikin interupsi—atas hidup yang bergerak menuju renta. Kau masih memanjakan kecewa dengan koar yang, sejujurnya, tak seluruhnya kumengerti benar. Tapi kau meneruskan muntab, setengah mengutuk. Tentang perselisihan, silap, khilaf, kalap, onar. Tentang dosa, dan salah.

Kawan, saya pun tidak mafhum mengapa perihal-perihal banal seringkali kekal dan kental bersahabat dengan kita. Sekurangnya, karena kita tahu, di semua jazirah para nabi pernah diutus dan firman sempat bergema. Adakah dengan begitu para aulia gagal mewariskan pekerti? Adakah dengan begitu kita boleh bertanya-tanya, apa gunanya wahyu bagi hidup manusia?

Saya tiba-tiba teringat pada cerita lama Ibrahim bin Adham yang hidup di abad ke-8. Seorang alim rendah hati yang tak pernah merasa lebih taat dan lebih dekat dengan Tuhan. Ia mengumpul kayu bakar dan pergi berladang. Penghasilannya, diderma pada orang yang tertimpa malang. Syahdan, ia menjenguk Ka’bah di sebuah malam ketika gemuruh guntur dan hujan deras datang berbarengan. Usai tawaf panjang ia mengangkat tangan, mengajukan permohonan. "Tuhan, jaga aku dari berbuat dosa terhadap-Mu."

Konon, sebersit suara tiba-tiba membisik. "Ibrahim, bila Kupenuhi doamu dan doa semua hamba-Ku yang serupa denganmu, pada siapa gerangan Kulimpah belas-Ku, kemaafan-Ku, ampunan-Ku?"

Kawan, entah apa yang melintasi benakmu ketika kututurkan cerita itu. Kisah sufi itu, bagi banyak orang terasa amat menggetarkan. Bukan karena bersitan suara yang tiba-tiba saja membisik telinga Ibrahim. Melainkan betapa Tuhan berkenan menerima kenyataan manusia, apa adanya. Yang tak seluruhnya mampu luruh dari silap dan khilaf yang mungkin. Kita dituntun ke pucuk kesadaran, betapa Tuhan, adalah rahman. Adalah rahim.

Saya pun kadang lupa akan hal itu. Yang kerap memaksa manusia lain tersungkur dalam kemustahilan sebuah itikad: menjadi si suci yang bebas dosa 24 jam sehari. Padahal kita gemar membolak-balik kitab-kitab sejarah seraya mendapati: Manusia yang memaksa manusia lainnya tak pernah berbuat salah justru karam dalam penindasan maha hebat. Ada indoktrinasi bertalu-talu, dan cemeti yang siap merobek kulit di setiap salah ucap. Kau tiba-tiba mendesiskan nama Pol Pot, Gulag, Hitler, Aurangzeb, dan entah siapa lagi.

Tuntutan kesempurnaan yang serba bulat itu justru tiba-tiba dihadapkan dengan realitas yang sama sekali lain: penghinadinaan atas harkat manusia. Sebuah degradasi kontras tentang nilai-nilai. Dan karenanya, terasa sangat tak pantas.

Salah, khilaf, dosa. Pada akhirnya kita mengerti akan batas. Mengerti akan kelemahan. Mengerti akan ketidaksempurnaan. Mengerti akan pentingnya rendah hati. Dan pongah serta merta tumpas, tersungkur di ambang haribaan-Nya dengan jantung yang hampir lepas. Paras dan Laku-Nya yang sempurna. Kita selamanya tak akan menjadi Dia. Lantaran itulah firman bergema. Lantaran Tuhan sajalah yang paling mengerti batas ciptaan-Nya.

Kawan,

salah, khilaf, dosa. Pada akhirnya kita belajar berendah hati, berikhtiar tulus, menyisipkan itikad ikhlas ke ruas hati. Manusia yang sadar akan batas, manusia yang sadar akan lemah diri. Ketidaksempurnaan adalah monopoli kita, dan Tuhan tak pernah kapok menyuguhkan pengampunan. Maka, kita menemukan sebuah alasan untuk selalu menghaturkan maaf, atas segala ketidakbecusan, kebanalan, khilaf, salah, dosa yang bertalu-talu pernah kita perbuat. Sebagaimana kini kita menemukan alasan untuk tak lagi kikir memberi kemaafan dan pengampunan bagi semua.

Kawan, selamat berlebaran di tahun ke-1428. Maafkan saya, mohon maafkan khilaf saya.

Monday, November 11, 2002

Kamis, 10 Oktober 2002 | Happy Birthday to ME (and the others)
Iya!!! Happy birthday to us... happy birthday to us... happy birthday, happy birthday, happy birthday to us... Hari ini ada 1 orang lagi yang ultahnya sama-sama aku. Ampon (T.Reza) adek sepupuku yang kuliahnya rada-rada bermasalah di ITB.

Nostalgia lagi. Hari ini 2 taon yang lalu, siang-siang abis istirahat kedua, kuliah Model & Simulasi-nya bu Leony yang imut2, aku sukses bobo' dengan manisnya (penyakit tidur itu sampai sekarang pun belum hilang) di bangku belakang. Tau-tau disampingku udah berdiri seorang yang imut2 membangunkanku sambil menjulurkan tangan dengan spidol ke arahku dan nyuruh aku ke depan kelas buat ngejelasin lg apa yang udah dia cuap2 ke seisi kelas, minus aku tentunya....... Sukses bikin aku bangun dengan tergagap-gagap.. Lha wong lagi enak-enaknya mimpi jé, ujug-ujug njedhul sesosok imut2 itu. Well that was pretty sweet :)

Dan ngomong-ngomong tentang mimpi, tadi pagi aku tidur nyenyak banget. Tapi trus bang zoel sms aku, dan di tengah sadarku aku mimpi disms sama mas itu... mimpi dia ngasih selamat juga via sms ^^;; Sebenernya dalam mimpi itu aku dah ngerasa lagi mimpi, soalnya aku tau mas itu nggak punya hp. Yah, dasar mimpi. Begitu bangun haruus balik ke dunia nyata...
Hari ini telpon rumah dan hp saya sibuk... Maklum seleb *selebar pintu*

oia, ada tiga sms masuk ke HP T189 Motorolaku,+6281xxxxxx nomor ini aku kenal karena lgs keluar namanya di hpku, adekku tersayang ngucapain "HAPPY BIRTHDAY ........", tapi 2 nomer lagi aku nggak kenal : 08122788843 dan 08122788293, dua-duanya ngucapin selamat ultah. Ada yang tau itu nomernya siapa?
 
powered by Blogger