Really?
Posted: 5 Aug 2013, 23:48pm - Monday

It's been a while I haven't work in oDesk... Weird! Sending some greetings even I'm inactive. Anyway, just posting this because my blog is bored.

odesk

jQuery Note ToolTip
Posted: 22 May 2013, 3:50am - Wednesday
Screenshot: note_tip HTML:
<a href="#" class="note-tip" note="The quick brown fox jump over the lazy dog...">Hover here...</a>
CSS:
div.note-tip {
    padding: 10px;
    background-color: #fffbea;
    color: #646464;
    font-size: 10px;
    font-family: verdana;
    position: fixed;
    z-index: 999;
    top: 100px;
    left: 50%;
    -moz-border-radius: 8px;
    -webkit-border-radius: 8px;
    -khtml-border-radius: 8px;
    border-radius: 8px;
    border: 2px #e38008 solid;
    max-width: 250px;
    max-height: 120px;
    overflow: auto;
}
jQuery:
$(document).ready(function () {
    $('a.note-tip').mouseover(function(e) {
        $('div.note-tip').remove();
        var tip = $(this).attr('note');
        $('body').append('<div class="note-tip">' + tip + '</div>');
        $('div.note-tip').css('top', (e.pageY - (30 + $('div.note-tip').height())));
        $('div.note-tip').css('left', (e.pageX - (100 + $('div.note-tip').height())));
    }).mouseout(function() {
        if ($('div.note-tip').height() >= 110) {
            $('div.note-tip').mouseout(function() {
                $('div.note-tip').remove();
            });
        } else {
            $('div.note-tip').remove();
        }
    });
  });
Edit Android Hosts file
Posted: 7 Mar 2013, 22:54pm - Thursday
I have a project that needs to be compatible with mobile devices. What I want  is to redirect my emulated android or AVD to my PC, like browsing http://grass.dev in the android browser, will lookup to my other PC in local network. This guide is for Windows and in my case I am using Windows 7. So, go to your installed directory of the Android SDK, then go to X:\...\sdk\platform-tools\ then cast the commands below (you will be using adb commands).
adb remount
adb pull /system/etc/hosts /tmp/hosts
Above commands is to pull the hosts file from the android you currently running. Next thing you will do is edit the file. In my case,
127.0.0.1		    localhost
192.168.7.126		    grass.dev
That's the content of my new hosts file. Next you need to push back the file to the android.
adb push /tmp/hosts /system/etc
  That's it.. it should work. :)  
MySQL SPATIAL Index for GeoIP Database
Posted: 6 Feb 2013, 2:32am - Wednesday
Few days ago, I had an experimental project called Website Visitor Tracker which will track the visitor what city or country they from and plot their location to Google WebGL Globe and the source of the data have to query in 2M+ rows for the IP blocks and 290k+ rows for the cities or 91k+ rows for the countries. The problem occurs is the the query which it will take 2 to 4 seconds each IP query from the database and it is bad sign. I found a solution suggested by BOTP from Kagaya-anon Linux Users Group (Thanks master BOTP) that I have to use SPATIAL Index. So I did and it works like a charm. This is the output without using SPATIAL Index...
mysql> SELECT b.id,l.city,l.latitude,l.longtitude FROM geoip_ip_blocks AS b, geoip_locations AS l WHERE b.locID = l.locID AND INET_ATON('203.114.138.95') BETWEEN b.startIpNum AND b.endIpNum;
+---------+------------------+----------+------------+
| id      | city             | latitude | longtitude |
+---------+------------------+----------+------------+
| 1859525 | Palmerston North | -40.3500 |   175.6167 |
+---------+------------------+----------+------------+
1 row in set (1.71 sec)

mysql>
So here's the steps implementing SPATIAL index... First I created a new table...
create table geoip_blocks (
	id bigint(20) unsigned not null auto_increment primary key,
	locID bigint(20) not null default 0,
	startIpNum bigint(20) unsigned not null,
	endIpNum bigint(20) unsigned not null,
	ip_poly POLYGON not null,
	SPATIAL INDEX(ip_poly)
) engine=myisam;
Note: use MyISAM engine for this to apply SPATIAL index, otherwise you will encounter some issues. :P Next, export your current table of your GeoIP...
WINDOWS: 

select locID, startIpNum, endIpNum into outfile 
'c:/geoip_blocks.dat' fields terminated by "," enclosed by "\"" 
lines terminated by "\n" from geoip_ip_blocks;

LINUX:

select locID, startIpNum, endIpNum into outfile 
'/home/user/geoip_blocks.dat' fields terminated by "," 
enclosed by "\"" lines terminated by "\n" from geoip_ip_blocks;
Then import again but this time into the new table where you will insert into POLYGON type field. WINDOWS:
LOAD DATA LOCAL INFILE "c:/geoip_blocks.dat"
         INTO TABLE geoip_blocks 
         FIELDS
            TERMINATED BY ","
             ENCLOSED BY "\""
         LINES
              TERMINATED BY "\n"
           (
               @locID, @startIpNum, @endIpNum 
             )
       SET
            id := NULL,
            locID := @locID,
           startIpNum := @startIpNum,
           endIpNum := @endIpNum,
           ip_poly := GEOMFROMWKB(POLYGON(LINESTRING(
          POINT(@startIpNum, -1),
          POINT(@endIpNum, -1),
          POINT(@endIpNum, 1),
          POINT(@startIpNum, 1),
         POINT(@startIpNum, -1))));
LINUX:
LOAD DATA LOCAL INFILE "/home/user/geoip_blocks.dat"
         INTO TABLE geoip_blocks 
         FIELDS
            TERMINATED BY ","
             ENCLOSED BY "\""
         LINES
              TERMINATED BY "\n"
           (
               @locID, @startIpNum, @endIpNum 
             )
       SET
            id := NULL,
            locID := @locID,
           startIpNum := @startIpNum,
           endIpNum := @endIpNum,
           ip_poly := GEOMFROMWKB(POLYGON(LINESTRING(
          POINT(@startIpNum, -1),
          POINT(@endIpNum, -1),
          POINT(@endIpNum, 1),
          POINT(@startIpNum, 1),
         POINT(@startIpNum, -1))));
And that's it.. You are good to go for testing...
OUTPUT AFTER SPATIAL INDEX IMPLEMENTED:

mysql> SELECT geoip_blocks.locID, geoip_blocks.startIpNum, geoip_blocks.endIpNum
    ->  FROM geoip_blocks INNER JOIN geoip_locations ON geoip_blocks.locID = geoip_locations.locID
    ->          WHERE MBRCONTAINS(ip_poly, POINTFROMWKB(POINT(INET_ATON('203.114.138.95'), 0)));
+--------+------------+------------+
| locID  | startIpNum | endIpNum   |
+--------+------------+------------+
| 199902 | 3413280768 | 3413283071 |
+--------+------------+------------+
1 row in set (0.19 sec)

mysql> SELECT geoip_blocks.locID, geoip_locations.city, geoip_blocks.startIpNum, geoip_blocks.endIpNum
    ->  FROM geoip_blocks INNER JOIN geoip_locations ON geoip_blocks.locID = geoip_locations.locID
    ->          WHERE MBRCONTAINS(ip_poly, POINTFROMWKB(POINT(INET_ATON('203.114.138.95'), 0)));
+--------+------------------+------------+------------+
| locID  | city             | startIpNum | endIpNum   |
+--------+------------------+------------+------------+
| 199902 | Palmerston North | 3413280768 | 3413283071 |
+--------+------------------+------------+------------+
1 row in set (0.00 sec)
Hope this help for those who encounter the same problem I had... :) Thanks again to Master BOTP & DATA BOB JR. Reference: http://databobjr.blogspot.co.nz/2010/07/ip-to-country-lookup-table-using-mysql.html
Railway Hotel in Palmerston North, New Zeleand
Posted: 2 Feb 2013, 2:08am - Saturday
It's been two weeks now in Palmerston North. There's two accommodation that I choose, the Railway and @theHub. At the end, I chose to stay at Railway Hotel at 275 Main street. It is owned by Garry Young, a very good landlord... He always ask my comfort staying at his hotel/hostel/backpackers lodge. The room is excellent and I am satisfied what Garry offered me. He also include the WiFi internet for free of charge and with free car park. Unlike @theHub, their internet will cost you 27$ per week and the car park for 20$ per week. I will just share my experience looking for a place to stay with in Palmerston North. Monday, first prospect was @theHub introduced by my sister's friend and I booked the studio type 200$/week from their website. I visit the next @thHub to confirm if I could transfer on Saturday and they said, they will check the vacancy and the assigned staff that day showed me the room (rm 707 I think) and I saw the size, included furniture, bathroom, bed etc and the staff said its just 200$/week and 4 weeks bond which will cost $800 when I move in. So I came back again to @theHub after two days, they said their computer network is down, they cannot look up my bookings. So I came back again the next day, this droopy eyes staff said all he could offer is the 250$/week and 4 weeks bond (which will cost me 1000$ to move in) then I said if could I check the room. So this other big guy show me the room (703) and when I saw the room, its exactly the same the last room that I saw last few days ago and they said its 250$/week. Back in the reception area, I told them that if they could hold it for me because I'm contacting someone for my finances in my stay in Palmy which I've been contacting my sister if its okay to rent a studio type with a price of 250$/week. But my sister didn't reply and its Friday which I need to move on Saturday. A week before, my sister said they will visit me in Palmy to move me to a better place which I was currently staying at Pepper Tree backpackers. So Saturday morning, I told my sister that she will try to talk the receptionist without me if she can book and move as walk-in. Because I have this feeling this droopy eyes idiot staff @theHub is only good to females. So my sister and her friend talk to the receptionist, and guess what at the end of their negotiation, they offer to my sister that they could find a way that my sister and her friend could transfer or move right away to @theHub with a price of 200$/week! Fuck the @theHub accommodation staff and management! I said to my sister, this staff are shit! And I think they are racist too! So if you're a male Asian and attempt to book @theHub, don't bother to do it. You'll waste your time. They are morons! My verdict for @theHub, Female MANIAC! Next suspected accommodation is the Palmy 31. All I can say, its hard to book or talk to their staff. Their office hours is only 4PM to 5PM and if you are working from 8:30Am to 5AM, you can't catch this staff. When you called them, they will say to book online. And when you visit their website, there's a form but you cannot submit electronically. How dumb that website? They have to fill you up the form then print it and then fax it to them. That's their instruction! What kind of system was that? How hassle that could be for the people trying to book and visit the site. My verdict for this Palmy 31, dumb system! Lastly, Railway Hotel. I just visit the place and meet Garry, talk to him and show me the room, the laundry area, kitchen area and boom! He said, I could transfer right away and the transfer fee is only 2 weeks, the room is 195$/week with bathroom, and 6 weeks minimum stay which I will be staying in Palmy Nth for 3 months and its a good deal. The room includes; large LED HD TV, fridge, microwave, heater and furniture. So I took the room and staying in Railway Hotel comfortably. I am also walking distance to the Warehouse, New World, Asian store, fish & chips store and most of all, near enough to my work place. :) Railway Hotel website: http://www.railwayhotel.co.nz Contact Garry for your accommodation needs in Palmerston North. Phone: +64 6 354-5037 Fax: +64 6 354-6268
Writing Entity Framework (EF) Code-First
Posted: 4 Jan 2013, 15:05pm - Friday
Few days ago, I've been solving the issue of my project's EF Code First. Thanks to Decker Dong's tips in ASP.net and Ladislav Mrnka in stackoverflow.com. I solved the issue but not sure its the best answer/solution. I am not an expert in EF, Code-First nor ASP.NET. But so far, it works fine. Correction is welcome. :) Here are the common errors I always encounter;
Introducing FOREIGN KEY constraint 'FK_dbo.Requestors_dbo.Projects_ProjectId' on table 'Requestors' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.
Could not create constraint. See previous errors.
and ...
Unable to determine the principal end of an association between the types 'QICSkillsForce.Models.Requestor' and 'QICSkillsForce.Models.Project'. The principal end of this association must be explicitly configured using either the relationship fluent API or data annotations.
Honestly, I do not understand much on EF, Code-First, Poco and etc. But trying to learn them. My reference are;
  • http://stackoverflow.com/questions/5368029/need-some-help-trying-to-understand-entity-framework-4-1s-code-first-fluent-api
  • http://stackoverflow.com/questions/4442915/entity-framework-inserting-into-multiple-tables-using-foreign-key
My very question or problem is about relationship, defining them to EF. Defining the following relationships:
  • 1 Team has 0-many Users. (and a User is in 1 Team)
  • 1 User has 0-or-1 Foo's (but a Foo has no property going back to a User)
  • 1 User has 1 UserStuff
Answer in Entity Framework (sample):
public class User
{
    public int Id { get; set; }
    ...
    public Foo Foo { get; set; }
    public Team Team { get; set; }
    public UserStuff UserStuff { get; set; }
}

public class Team
{
    public int Id { get; set; }
    ...
    public ICollection<User> Users { get; set; }
}

public class Foo
{
    public int Id { get; set; }
    ...
}

public class UserStuff
{
    public int Id { get; set; }
    ...
}

public class Context : DbContext
{
    public DbSet<User> Users { get; set; }
    public DbSet<Foo> Foos { get; set; }
    public DbSet<Team> Teams { get; set; }
    public DbSet<UserStuff> UserStuff { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {
        modelBuilder.Entity<User>()
            .HasRequired(u => u.Team)
            .WithMany(t => t.Users);

        modelBuilder.Entity<User>()
            .HasOptional(u => u.Foo)
            .WithRequired();

        modelBuilder.Entity<User>()
            .HasRequired(u => u.UserStuff)
            .WithRequiredPrincipal();
    }
}
And the result is; [caption id="attachment_849" align="aligncenter" width="654"]EDMX View EDMX View[/caption] Just as I wanted! Wew! In addition, I'm also bothered how to insert data to both tables that is related. So I learn that this is how I to do it;
public void populate_projects()
{
            AppDbEntities db = new AppDbEntities();

            var proj = new Project { ProjectName = "Test Project", Description = "description here", DesiredCompletionDate = DateTime.Now, Notes = "notes here", Deleted = false, RemoteJob = true, RequestStatus = "Completed", SkillSet = "ASP.NET, C#", UserId = 1 };
            var req = new Requestor { Name = "User sample", Email = "user@sample.com", DeptId = 2, ApprovedBy = "Admin" };

            proj.Requestor = req;
            db.Projects.Add(proj);
}
I think that's it.. I have a lot of learning for 3 days straight solving the issues. There are more problems ahead and I eager to solve them. Yeah! (Somehow, there's some point thinking to give up and use ADO.NET and pure SQL commands! hahahahaa!) --- after couple of hours --- And this is how to query the rows... CONTROLLER:
        public ActionResult Index()
        {
            // auto insert sample data to the db... [start]
            var count = db.Projects.ToList().Count().ToString();

            var proj = new Project { ProjectName = "Test Project " + count, Description = "description here", DesiredCompletionDate = DateTime.Now, Notes = "notes here", Deleted = false, RemoteJob = true, RequestStatus = "Completed", SkillSet = "ASP.NET, C#", UserId = 1 };
            var req = new Requestor { Name = "User " + count, Email = "user@sample.com", DeptId = 6, ApprovedBy = "Quack" };
            proj.Requestor = req;
            db.Projects.Add(proj);
            db.SaveChanges();
            // auto insert sample data to the db... [end]

            var projects = db.Projects.ToList();
            return View(projects);
        }
MODEL:
            <table border="0" width="100%">
                <tr>
                    <th>Project Name</th>
                    <th>Description</th>
                    <th>Requestor</th>
                    <th>Status</th>
                </tr>
                @foreach (var proj in Model) {
                    <tr>
                        <td>@proj.ProjectName</td>
                        <td>@proj.Description</td>
                        <td>@proj.Requestor.Name</td>
                        <td>@proj.RequestStatus</td>
                    </tr>
                }
            </table>
As you noticed, I access the extended table from Project to Requestor to get its Requestor Name by calling @project.Requestor.Name and it will show the related row from Requestor table. I found that handy... W00t!
Use Email as Username with ASP.NET Membership
Posted: 27 Dec 2012, 5:16am - Thursday
Couple of guides in the internet on using email as username with the ASP.NET Membership but the guide is too long and its a maze and crazy as hell for me. I found my own answer as simple as I wanted to. In my case, I created my own form. Form (View):
            <form action="/home/authenticate" method="post" name="login">
                <label>Email</label>
                <input type="text" name="email" />
                <br class="clear" />
                <label>Password</label>
                <input type="password" name="passwd" />
                <br class="clear" />
                <input type="submit" name="submit" value="Login" />
            </form>
  Authentication (Controller):
        [HttpPost]
        public ActionResult Authenticate()
        {
            Regex regex_email = new Regex(@"^(?("")("".+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$");

            var email = Request.Form["email"];
            var passwd = Request.Form["passwd"].Trim();

            if ((!regex_email.IsMatch(email)) || (passwd.Length < 6))
            {
                return RedirectToAction("Index", "Home", new {
                    msg = "Invalid username or password!"
                });
            }
            else 
            {
                string username = Membership.GetUserNameByEmail(email);

                if (Membership.ValidateUser(username, passwd))
                {
                    FormsAuthentication.SetAuthCookie(username, true);
                    return RedirectToAction("Index", "Project");
                }
                else
                {
                    return RedirectToAction("Index", "Home", new {
                        msg = "Invalid username or password!"
                    });
                }
            }
        }
  I just call the Membership.GetUserNameByEmail() then validate with Membership.ValidateUser(). That's it! Hope this help to others too.. :)
HowTo: Leche Flan
Posted: 24 Dec 2012, 2:12am - Monday
How to cook Leche Flan for Christmas/New Year! leche_flanWhats good about it is you don't have to separate egg yolks from the egg whites cause you will be using whole eggs. Just follow the recipe. Ingredients:
  • 4 large eggs (if eggs are small make it 8-10 and 6-8 for medium sized eggs)
  • 1 can condensed milk (same size/quantity sold here in Ph)
  • 1 can evaporated milk (same size/quantity sold here in Ph)
  • 1 tsp vanilla
  • 1/2 cup sugar for caramelizing
Procedure:
  1. In a medium heat place sugar in a non-stick pan and and allow it to melt , (you can also caramelize the sugar on an 8-inch pan) making sure not to burn the sugar as it will taste bitter. Once done transfer it to your molder or if you caramelize the sugar in the molder just remove it from heat and set aside.
  2. Prepare the steamer or you can preheat the oven at 295 degrees. In a bowl combine eggs, milk and vanilla mix well making it homogenous. Strain the flan mixture 2x and finally strain once more using a cheese cloth or any clean cloth to make your flan homogeneous to your caramelize sugar and cover it with aluminum foil (don't cover if you will be using an oven)
  3. When the steamer is ready or already boiling place your flan mixture covered with aluminum foil and steam for 30-45 minutes on medium heat. If using oven, submerged the molder/pan uncovered into a larger pan with water about 1 inch up the sides of of the leche flan pan- aka water bath.
  4. Steam for 30 minutes on medium heat (or bake for about 1 hr at 295 deg F). Its done if a toothpick inserted in the middle comes out clean or try wiggling it if it wiggles like a jello at the center then its done, if its still watery bake/steam once more.
  5. Once done let it cool before removing from the molder/pan. Enjoy!
   
Duck Scraper for fb
Posted: 7 Dec 2012, 11:10am - Friday
Duck Scraper is a facebook (fb) about page scraper. Kind of manual and semi-auto scraper, it scrape the name, email, contact number and address of the about page in fb. Since I am having a problem with google search result, you have to click the search result manually and once in the fb about page, click "Quack Choook!" to scrape the contents. Then you can save the collected data to MySQL dump file (.sql) or CSV format (as .csv or .txt). It was written from Visual C# .Net. The version is 1.0 -- initial release. And of course its free and clean. Just sharing! Just check it out and explore how to use it.

DuckScraper_v1.0.zip   Enjoy!   Prerequisites:
  1. Internet Explorer 7 or latest version
  2. .Net Framework 4.0
Warranty: NO WARRANTY! :P
Adding new packages in Cygwin
Posted: 23 Nov 2012, 12:04pm - Friday
I've been playing around with Cygwin after 7 years. I check on the new stuffs and it has been change a lot. One thing I puzzled about was how to add new commands aside from default cygwin installation. So here it is;
 setup.exe -q -P  wget,tar,qawk,bzip2,subversion,vim
So you will use the setup.exe of cygwin that you downloaded. Then install the commands that what you need. --=[ update as of 09 Dec 2014 ]=-- Below is the command to update all components:
cd C:\cygwin64\
wget -N http://cygwin.com/setup.exe
setup.exe --no-desktop --no-shortcuts --no-startmenu --quiet-mode
Visual C# Express 2010 + Firebird SQL
Posted: 29 May 2013, 2:10am - Wednesday
Requirements:
  1. Firebird .NET Provider
  2. Visual C# Express 2012
  Code:
private void Form1_Load(object sender, EventArgs e)
        {
            FbConnection con = new FbConnection("User=SYSDBA;" + "Password=masterkey;" + "Database=" + currentDir + "\\vshb.fdb;" + "DataSource=127.0.0.1;" + "Port=3050;" + "Dialect=3;" + "Charset=UTF8;");
            try  
            {
                con.Open();
                FbTransaction t = con.BeginTransaction();
                t.Commit();
                FbCommand cmd = new FbCommand("SELECT * FROM \"Bank_Branches\"", con);
                FbDataReader reader = cmd.ExecuteReader();

                textBox1.Text = "Ref. No.\t\tBranch\t\t\t\n";
                while (reader.Read())
                {
                    textBox1.AppendText(reader.GetValue(0) + "\t\t\t" + reader.GetValue(3) + "\n");
                }
                reader.Close();
                con.Close();

            }
            catch (Exception ex) 
            {
                MessageBox.Show(ex.ToString());
            }

        }
---- Sample Source: fbd_migrate.ra.zip
Few years back year 2008, attending World Youth Day 2008 at Sydney-Australia, I met Cardinal Luis Antonio “Chito” Gokim Tagle and that time he was a Bishop and also known as the Bishop of Imus, Cavite. Few weeks ago, when Pope Benedict XVI is about to resign which is uncommon to happen and it was really the first time to happen. So the rumors spread about the resigning Pope and the search of the new Pope has began. Watching the news, I saw a familiar face of the candidates to be a pope but I am not sure because its just a split of seconds and he was just a background. Today at OneNews.co.nz, they featured Cardinal Luis Antonio “Chito” Gokim Tagle that he may be a Pope. Really? If he will be the pope, he will be the first Asian Pope then. Here's the picture with him, of course I'm not in the picture because I am the one who took it. [caption id="attachment_950" align="aligncenter" width="744"]Cardinal Luis Antonio “Chito” Gokim Tagle Cardinal Luis Antonio “Chito” Gokim Tagle with Irra Angela Chiong and friends....[/caption] I just realised that I should have a picture with him.. Hahahahaa.. Cardinal Luis Antonio “Chito” Gokim Tagle is a very good high charisma and wisdom -- very energetic too. He enlightened us all during the catechism. There are 3 priest that time and two made us very sleepy but when Cardinal Tagle's turn as the last preacher, he put spirits to all youth. Awesome! More to read: http://www.catholicherald.co.uk/features/2013/03/09/the-men-who-could-be-pope-cardinal-luis-antonio-tagle/
Running Cronjob or Cron or Crontab in Cygwin
Posted: 28 Feb 2013, 0:37am - Thursday
You need to install few packages. So we need the setup.exe file of the cygwin to do the package installations. Cast the following commands to install cron:
setup.exe -q -P cygrunsrv
setup.exe -q -P exim
setup.exe -q -P ssmtp
setup.exe -q -P cron
exim and ssmtp -- You can install either of the package. Purpose of this is if you want to send an email after the task or job has been executed. So after installation... go to Cygwin terminal and cast the following commands and test it...
camilo@Camilo-PC ~
$ cygrunsrv -I cron -p /usr/sbin/cron -a -D

camilo@Camilo-PC ~
$ net start cron
The cron service is starting.
....
camilo@Camilo-PC ~
$ crontab -l
no crontab for camilo
That's it... You have running crontab in your Cygwin. You may now import or create task schedules. Hope this will help for those trying to do the same. [After an hour] ==---- After browsing why my cron is not working, it does not execute my task. So I researched and found the answer...
To be honest, making this work is tenuous at best.  MS doesn't want
things to work this way anymore because it's viewed as a security
hole (arguably a valid point).  If you're running XP, then you have
a better chance but, as you've noticed, it's not guaranteed
either.  And it will most certainly stop working if you move to a
later O/S version.  I know.  Not what you wanted to hear and some
additional research and perseverance on your part may unearth a
solution that works for you.  But there's no magic bullet here,
sorry.

--
Larry
Reference: http://cygwin.com/ml/cygwin/2012-08/msg00223.html Well, I guess our journey ends here on running cron in windows via Cygwin... :)
  AFTER YEARS PASSED... Zabby (tallalex[at]gmail.com) message me about this blog and would like to update this that the crontab in cygwin is now possible. I haven't tried it but I read few articles that they made it work. Commonly I read are (from stackoverflow.com): You have two options:
  1. Install cron as a windows service, using cygrunsrv:
    cygrunsrv -I cron -p /usr/sbin/cron -a -D net start cron
  2. The 'non .exe' files are probably bash scripts, so you can run them via the windows scheduler by invoking bash to run the script, e.g.:
    C:\cygwin\bin\bash.exe -l -c "./full-path/to/script.sh"
or read this: http://ehealth-aussie.blogspot.co.nz/2013/06/setup-cygwin-cron-service-on-windows.html   Updates: 5 May 2015 if option number 1 does not work, replace -D to -n
cygrunsrv --install cron --path /usr/sbin/cron --args -n
If you executed the last command, delete the old service first by typing the command below in MS-DOS CLI:
sc delete cron
I think that's it for the update for today.. :) In case you need to run ssh server or sshd, just cast the command below and follow the instructions.
ssh-host-config
make sure you allow it to your firewall.
Website Visitor Tracker
Posted: 5 Feb 2013, 4:44am - Tuesday
Last Sunday, February 3, 2013, I visited Google About page and saw their WebGL Globe. Checking the couple of samples, it rang a bell to me to create a website visitor tracker. So I start coding and I called it C3rd Visitor Tracker.. This is an experimental project. I used MaxMind GeoIP for locating the visitor's city name via their IP address and it took me a day to parse their CSV. Hahaha... I completed the project after 2.5 days... :) Below is the sample screenshot of Prendstah.com:

prendstah_vtracker

Most of the users are from Philippines, so it marked well and some kind of accurate. So if you want to track your website visitors, you can use my Visitor Tracker and start monitoring your visitors. Sign up at http://www.tracker.isourcery.com/ Thanks for the support...
[ZF2] Zend Framework 2 : Getting Started
Posted: 13 Jan 2013, 20:35pm - Sunday
Since you already installed your PHP composer, next is you will download the Zend Skeleton Application at
https://github.com/zendframework/ZendSkeletonApplication
Extract or save the files to your apache/httpd public folder. In my case, it was in;
D:\localhost\zend2>cd HelloWorld

D:\localhost\zend2\HelloWorld>dir
 Volume in drive D is WorkFiles
 Volume Serial Number is 3220-C192

 Directory of D:\localhost\zend2\HelloWorld

10/11/2012  04:20 p.m.    <DIR>          .
10/11/2012  04:20 p.m.    <DIR>          ..
10/11/2012  04:20 p.m.                83 .gitignore
10/11/2012  04:20 p.m.                92 .gitmodules
10/11/2012  04:20 p.m.               336 composer.json
10/11/2012  04:20 p.m.           570,295 composer.phar
10/11/2012  04:20 p.m.    <DIR>          config
10/11/2012  04:20 p.m.    <DIR>          data
10/11/2012  04:20 p.m.             1,812 init_autoloader.php
10/11/2012  04:20 p.m.             1,548 LICENSE.txt
10/11/2012  04:20 p.m.    <DIR>          module
10/11/2012  04:20 p.m.    <DIR>          public
10/11/2012  04:20 p.m.             1,753 README.md
10/11/2012  04:20 p.m.    <DIR>          vendor
               7 File(s)        575,919 bytes
               7 Dir(s)  111,679,717,376 bytes free
The composer.json is the requirement for the PHP composer.phar to update and install components/packages for the Zend Framework 2 (ZF2). The next you need to do is to self-update and install. Follow the command below;
D:\localhost\zend2\HelloWorld>php composer.phar update
This dev build of composer is outdated, please run "composer.phar self-update" to get the latest version.
Loading composer repositories with package information
^C
D:\localhost\zend2\HelloWorld>php composer.phar self-update
Updating to version dea4bdf.
    Downloading: 100%

D:\localhost\zend2\HelloWorld>php composer.phar install
Loading composer repositories with package information
Installing dependencies
  - Installing zendframework/zendframework (2.0.6)
    Downloading: 100%
4123 File(s) copied
5 File(s) copied
6 File(s) copied
1797 File(s) copied
37 File(s) copied
2268 File(s) copied
1 File(s) copied

zendframework/zendframework suggests installing doctrine/common (Doctrine\Common >=2.1 for annotation features)
zendframework/zendframework suggests installing pecl-weakref (Implementation of weak references for Zend\Stdlib\CallbackHandler)
zendframework/zendframework suggests installing zendframework/zendpdf (ZendPdf for creating PDF representations of barcodes)
zendframework/zendframework suggests installing zendframework/zendservice-recaptcha (ZendService\ReCaptcha for rendering ReCaptchas in Zend\Captcha and/or Zend\Form)
Writing lock file
Generating autoload files

D:\localhost\zend2\HelloWorld>
That's should do it... So you can view the installed ZF2 to your browser. It should look like the image below;

Installed Zend Framework 2.0.6

I hope this will help in your pursuance in studying Zend Framework or if you already into ZF but at version 1.x, then this is a good start for the ZF2.

ASP.NET: Guestbook App
Posted: 30 Dec 2012, 14:57pm - Sunday
Finally, I created a simple app in ASP.NET with my own, after reading a bunch of guides and tutorials... The app is Guestbook and written in MVC3 C#. Guestbook data is stored in SQL Server Database (mdf) and I use Entity Framework (EF) as my Object Relational Mapping (ORM). Here's the screenshot;

GuestbookApp

 If you check the codes of this Guestbook App, it demonstrate the following;
  • ASP.NET MVC3 pattern (Visual C# coding)
  • Entity Framework
  • Calling Function from View to Controller
  • Creating custom HELPER in the VIEW (Razor Helper)
  • Clean form-passed variables against XSS attacks (I guess? that's what they said :))
  • RegEx and its pattern, in this case is about email address
    Download Source code of ASP.NET MVC3 C# below: GuestbookApp.zip
Guide to Migrate in New Zealand as Skilled Migrant
Posted: 26 Dec 2012, 3:19am - Wednesday
Confidential Post!
HowTo: Access Controller method/function from a View
Posted: 20 Dec 2012, 11:32am - Thursday
I've been wondering how to access the controller method/function from a View. I found a solution from Jeffrey Palermo which he explain it in details. Though, my case that I want to happen is about random numbers. Controller Codes:
        public ActionResult Welcome(string name, int num = 1)
        {
            ViewBag.Message = "Hello " + name;
            ViewBag.Num = num;
            ViewBag.GetRandom = new Func<int, int, int>(getRandomNumber);

            return View();
        }

        private int getRandomNumber(int min, int max)
        {
            Random rand = new Random();
            return rand.Next(min, max);
        }
View Codes:
<ul>
    @for (int i = 0; i < ViewBag.GetRandom(3, 100); i++)
    {
        <li>@ViewBag.Message</li>
    }
</ul>
or...
@{ ViewBag.Num = ViewBag.GetRandom(3, 100); }

<h2>Welcome</h2>
Generated Random Number: @ViewBag.Num
<ul>
    @for (int i = 0; i < ViewBag.Num; i++)
    {
        <li>@ViewBag.Message</li>
    }
</ul>
One thing that confusing about this sample codes is; During the method declaration from the Controller, you use the new Func<>(method_name) -- the first int from <> is the minimum value, 2nd int is the maximum value and the third value is the return value.
oMarket - New Zealand Free Posting Classified Ads
Posted: 30 Nov 2012, 10:04am - Friday
oMarket is New Zealand Free Posting Classified Ads. This is my new personal project and my first website in NZ. Hope kiwis or new zealanders will post their classified ads at oMarket.
World's Largest Pearl
Posted: 18 Nov 2012, 9:29am - Sunday
A Filipino diver discovered what is now described as the world's largest pearl in a giant Tridacna (mollusk) under the Palawan Sea in 1934. Known as the "Pearl of Lao-Tzu", the gem weighs 14 pounds and measures 9 1/2 inches long and 5 1/2 inches in diameter. As of May 1984, it was valued at US$42 million. It is believed to be 600 years old. "Pearl of Lao-Tzu" is the the world's largest pearl in a giant Tridacna (mollusk). It weighs 14 pounds and measures 9 1/2 inches long and 5 1/2 inches in diameter. It was reportedly collected by a Filipino pearl diver named Etem, on May 7, 1934, at Palawan Island, Philippines. At one time it belonged to Wilburn Dowell Cobb, who allegedly received it as a gift from a chieftan of Palawan after having saved the life of his son. On May 15, 1980, Cobb's heirs sold it at auction to Peter Hofman, a jeweler from Beverly Hills, California, for US $200,000. In 1966, it was valued at $3.5 million. According to te Guiness Book of Records, the San Francisco Gem Laboratory has valuated it at US $40-42 million. It is believed to be 600 years old.   By: http://www.webanswers.com/profile.cfm?userID=639569
PHP + Firebird SQL Installation
Posted: 28 May 2013, 22:20pm - Tuesday
Download the following: (In my case, it's 64bit)
  1. PHP
  2. Apache
  3. Firebird (http://www.firebirdsql.org/en/firebird-2-5-2-upd1/)
After installation of PHP, edit the php.ini and uncomment:
  • php_interbase.dll
  • php_pdo_firebird.dll
At command prompt, cast php -v and you will have an error:
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php\ext\php_interbase.dll' - The specified module could not be found.
 in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library 'C:\php\ext\php_pdo_firebird.dll' - The specified module could not be found.
 in Unknown on line 0
PHP 5.4.9 (cli) (built: Nov 21 2012 19:54:46)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Install the Firebird... Try again casting a command php -v
C:\Workspace\localhost\vshbdata>php -v
PHP 5.4.9 (cli) (built: Nov 21 2012 19:54:46)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies
Meaning, the firebird is successfully installed. Second test is create a php script:
<?php

foreach(PDO::getAvailableDrivers() as $driver) {
  echo $driver.'<br />';
}

?>
You should see firebird in the list...
Sorting Multi-Dimensional Array
Posted: 10 Mar 2013, 5:57am - Sunday
I never tried sorting a an array using the inner array as a key for sorting. In this blog, been searching for the solutions and here it is... Sample Data:
Array
(
    [0] => Array
        (
            [id] => 1
            [user] => c test1
            [data] => Array
                (
                    [a] => 1
                    [b] => 2
                )

        )

    [1] => Array
        (
            [id] => 2
            [user] => b test2
            [data] => Array
                (
                    [a] => 3
                    [b] => 4
                )

        )

    [2] => Array
        (
            [id] => 3
            [user] => a test3
            [data] => Array
                (
                    [a] => 5
                    [b] => 1
                )

        )

)
Sorting Code:
// sort multidimensional array... [start]

$test_data = array(
        array('id' => 1, 'user' => 'c test1', 'data' => array('a' => 1, 'b' => 2)),
        array('id' => 2, 'user' => 'b test2', 'data' => array('a' => 3, 'b' => 4)),
        array('id' => 3, 'user' => 'a test3', 'data' => array('a' => 5, 'b' => 1))
);

// temporary container for sorting...
$sort_data = array();

foreach ($test_data as $key => $row) {
	// sorting by id
	$sort_data[$key] = $row['id'];

	// sorting by user
	$sort_data[$key] = $row['user'];

	// sorting by a in the inner array..
	$sort_data[$key] = $row['data']['a'];

}
// sort as ascending...
array_multisort($sort_data, SORT_ASC, $contract_data);

// sort as descending...
array_multisort($sort_data, SORT_DESC, $contract_data);

// sort multidimensional array... [end]
--- That's it.. It will be handy for those who love playing with arrays... :)
Remove Redundant Spaces, Tabs and New Lines
Posted: 8 Feb 2013, 4:43am - Friday
It's been a while that I've been dealing with long text. Commonly, users input with redundant new lines, tabs, spaces and long words. Here's my methods and just like others out there; Removing redundant new lines or line breaks:
$str = preg_replace('/(?:(?:\r\n|\r|\n)\s*){2}/s', "\n\n", $str);
Removing redundant tabs:
$str = preg_replace("/[ \t]+/", " ", $str);
Removing redundant spaces:
$str = preg_replace("/[ ]+/", " ", $str);
Shorten long word:
function ellipsis($str, $max = 45) 
{
	if (strlen($str) > $max) 
	{
		$str = '<abbr title="'.strip_tags($str).'">'.substr($str,0,$max).'...</abbr>';
	}
	return $str;
}
I think that's all... Hope this will help you... :)
Inserting and Retrieving File into MySQL Database
Posted: 5 Feb 2013, 3:44am - Tuesday
Today,  I encounter a task to save the file into the database and its been a while that I have been saving files into the database method. I usually save just the path and filename. So this is just recall... :)
create table pdf_files (
	id bigint(20) unsigned not null auto_increment primary key,
	filename varchar(64),
	file_path varchar(64),
	binfile blob,
	created datetime
);
There's a lot of method out there, but here's my way of inserting the file to the database.
$path = "public/pdf/";
$file = "test.pdf";

$fileHandle = fopen($path.$file, "r");
$fileContent = fread($fileHandle, filesize($path.$file));
$fileContent = addslashes($fileContent);
fclose($fileHandle);
mysql_query("INSERT INTO pdf_files (filename,file_path,binfile,created) VALUES ('$file','$path','$fileContent',NOW())");
You can also use LOAD_FILE(''/path/filename.xxx') in MySQL to save the file in the database.. :) Again, there's a lot of way... and this is my way how to retrieve the file...
$res = mysql_query(sprintf("SELECT filename,file_path,binfile FROM pdf_files WHERE id = %d", $xid));
if (mysql_num_rows($res) > 0) {
    $row = mysql_fetch_array($res);
    $bin_data = $row['binfile'];
    $filename_target = $row['file_path'].md5($row['filename'].'_'.time()).'.pdf';
    file_put_contents($filename_target, $bin_data);
	echo '<script>
            location.href="/'.$filename_target.'";
          </script>';
} else {
	echo 'File not found!';
	die();
}
And another way, force-download...
$res = mysql_query(sprintf("SELECT filename,file_path,binfile FROM pdf_files WHERE id = %d", $xid));
if (mysql_num_rows($res) > 0) {
    $row = mysql_fetch_array($res);
    $bin_data = $row['binfile'];
    $filename_target = $row['file_path'].md5($row['filename'].'_'.time()).'.pdf';
    file_put_contents($filename_target, $bin_data);
	// let the user download the file...
	header('Content-Description: File Transfer');
    header('Content-Type: application/force-download');
    header('Content-Disposition: attachment; filename='.basename($filename_target));
    header('Content-Transfer-Encoding: binary');
    header('Expires: 0');
    header('Cache-Control: must-revalidate');
    header('Pragma: public');
    header('Content-Length: ' . filesize($filename_target));
    ob_clean();
    flush();
    readfile($filename_target);
    exit;
} else {
	echo 'File not found!';
	die();
}
Hope this will help you... Cheers!
Installing PHP composer.phar
Posted: 13 Jan 2013, 20:18pm - Sunday
This guide is installing PHP composer.phar and proceed to ZendFramework 2.x setup/installation. First, go the your PHP installed directory then cast the command;
cd C:\php\bin
C:\php\bin>php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
At the same working directory, C:\php\bin, create a file named composer.bat and it should contains the following;
@ECHO OFF
SET composerScript=composer.phar
php "%~dp0%composerScript%" %*
Then test it if its working...
C:\php>composer.bat
   ______
  / ____/___  ____ ___  ____  ____  ________  _____
 / /   / __ \/ __ `__ \/ __ \/ __ \/ ___/ _ \/ ___/
/ /___/ /_/ / / / / / / /_/ / /_/ (__  )  __/ /
\____/\____/_/ /_/ /_/ .___/\____/____/\___/_/
                    /_/
Composer version dea4bdf

Usage:
  [options] command [arguments]

Options:
  --help           -h Display this help message.
  --quiet          -q Do not output any message.
  --verbose        -v Increase verbosity of messages.
  --version        -V Display this application version.
  --ansi              Force ANSI output.
  --no-ansi           Disable ANSI output.
  --no-interaction -n Do not ask any interactive question.
  --profile           Display timing and memory usage information
  --working-dir    -d If specified, use the given directory as working directory.

Available commands:
  about            Short information about Composer
  config           Set config options
  create-project   Create new project from a package into given directory.
  depends          Shows which packages depend on the given package
  dump-autoload    Dumps the autoloader
  dumpautoload     Dumps the autoloader
  help             Displays help for a command
  init             Creates a basic composer.json file in current directory.
  install          Installs the project dependencies from the composer.lock file if present, or falls back on the composer.json.
  list             Lists commands
  require          Adds required packages to your composer.json and installs them
  search           Search for packages
  self-update      Updates composer.phar to the latest version.
  selfupdate       Updates composer.phar to the latest version.
  show             Show information about packages
  status           Show a list of locally modified packages
  update           Updates your dependencies to the latest version according to composer.json, and updates the composer.lock file.
  validate         Validates a composer.json

C:\php>composer.bat -V
Composer version dea4bdf
That's it... You can now proceed in downloading the Zend Framework or Symfony. The next guide, I will be using Zend Framework 2.x in my case. Reference: http://getcomposer.org/doc/00-intro.md#installation-windows
HowTo: Black Mambaaaaaahh (Black Sambo)
Posted: 30 Dec 2012, 6:35am - Sunday
I tasted this dessert back in Innermax Support from Jinnah, birthday of Zack (her son). Then second time was Innermax anniversary in Midway Beach Resort. This tasty dessert made me curious how to make on. So here it is...

Black Sambo Recipe

Ingredients:

White layer:
  1. 2 sachets of Knox Gelatin (in NZ, I can't find any Knox Gelatin so I used Davis Gelatin [2 table spoon] and divided the Gelatin for both the white and brown layer)
  2. 2 packs (250ml) All Purpose Cream (in NZ, use Anchor Lite-Cream 250 ml)
  3. 1 can (301ml) Condensed Milk
  4. 1/2 cup cold water
Brown Layer:
  1. 2 sachets of Knox Gelatin (in NZ, I can't find any Knox Gelatin so I used Davis Gelatin [2 table spoon] and divided the Gelatin for both the white and brown layer)
  2. 1 can (378ml) Evaporated Milk
  3. 1/2 cup Cocoa Powder
  4. 1/2 cup Sugar
  5. 1/2 cup cold water

Procedure:

White layer:
  1. Dissolve the 2 sachets of Knox Gelatin (2 table spoon for the Davis Gelatin) in a pot with 1/2 cup of cold water. For the Gelatin, dissolve half of the Davis Gelatin in a pot with 1/2 cup cold water.
  2. Cook over low to medium heat until the gelatin dissolves.
  3. Add 1 can of condensed milk to the gelatin while stirring constantly.
  4. Cook for 5-10 minutes while stirring constantly.
  5. Add 1 box of All Purpose Cream to the mixture and cook for another 3-5 minutes while constantly stirring.
  6. Remove from heat and pour mixture in a mold, let it cool for 30 minutes then refrigerate for 2-4 hours until set.
Brown layer:
  1. Dissolve the 2 sachet of Knox Gelatin (2 table spoon for the Davis Gelatin) in a pot with 1/2 cup of cold water. For the Gelatin, dissolve half of the Davis Gelatin in a pot with 1/2 cup cold water.
  2. Cook over low to medium heat until the gelatin dissolves.
  3. In a separate bowl mix 1/2 cup of cocoa powder (Hershey's Cocoa Powder or Rich Cocoa Powder) and 3/4 cup of sugar.
  4. Add the cocoa mixture to the gelatin while stirring to dissolve cocoa powder cook for 3-5minutes.
  5. Add 1 can of evaporated milk and cook it for 5-10 minutes while constantly stirring.
  6. Remove from heat and pour mixture on top of the white layer, let it cool for 30 minutes then refrigerate for 2-4 hours until set.
  7. Once set, unmold by running a knife or spatula around the molding.
  8. Garnish it with Hershey's chocolate syrup or ground peanuts to compliment the sweetness.
  9. Serve and enjoy your Black Sambo dessert.
Try it yourself and tell us your experience.
HowTo: Edel's Hamonada
Posted: 24 Dec 2012, 9:12am - Monday
More than decades, my Mother cooks the Hamonada for us (family) every Christmas and New Year. But this year, I'm not in the Philippines, I'm with my sister (and her husband) here in New Zealand. There's a big difference celebrating Christmas in NZ and somehow, Filipinos here in NZ always miss the way Filipino celebrate the Christmas back in the Philippines. This day, my sister and I are in our own to celebrate the Christmas and New Year and for us, its not complete that we do not have the hamonada. So I cook the hamonada and of course with the guidance of my mother. Here's the steps how to cook the Edel's Hamonada.edels_hamonada Ingredients:
  • 2 - 2.5 kg of Pork (preferably leg part)
  • 0.75 liter of Pineapple Juice
  • 2-3 large onions (either white or violet class of onions)
  • 2-3 garlic
  • 2 packs of Del Monte Tomato Sauce (200g)
  • 1-2 lemon grass
  Procedure:
  1. Put the 2 kilos pork at the casserole and level the water with the height of the meat. Place also the garlic, lemon grass and onions (assumed you already sliced the onions and crushed the garlic. Use only the half mention in the ingredients because you will be needing the rest later on except of the lemon grass). You can also add some pinch of pepper to add some spice.
  2. Ignite your stove, heat it with 75-150 degrees and wait until the pork will be soften, approximately 3-5 hours of heating.
  3. Once the pork was soften, remove the water and all the spices your placed few hours ago. Literally just the pork must remain in the medium;
  4. Then pour the Del Monte tomato sauce together with the remaining onions and garlic. Heat up at the same temperature in step 1 then stir it. Then while stirring, add the pineapple juice slowly, then 2 tablespoon of sugar, 3/4 to 1 tablespoon of salt, and add some pepper in it.
  5. Monitor the meat, be sure all the sides of the meat are evenly immerse in the sauce.
  6. Taste it also from time to time, if taste is still more on pineapple juice, add little salt or sugar nor both sugar and salt until the taste will be sweet and sour with a taste of pineapple.
  7. Approximately about 2-3 hours, when the sauce will be viscosity then the hamonada is cooked.
I think that's it... Serve the Edel's Hamonada every Christmas and New Year! Merry Christmas to all!  Cheers!
Working on Html.ActionLink
Posted: 20 Dec 2012, 10:35am - Thursday
Few weeks ago, I've been studying Microsoft Visual Studio Web 2012 in my free time and focusing on Visual C# .Net since I have a background on desktop/window application development using Visual C#. I posted this just to remind the things that I took time to figure it out. I've been banging my head getting the good answers. Though there's the MSDN but there's no samples and I find it horrible documentation. So, I'm working on ASP.NET MVC 3 Web Application and wondering how I could create the Request URI using Html.ActionLink(). It took me almost an hour to figure it out. Thanks to Gavin Coates for pointing it out what made my codes wrong. The URI I want to have is;
http://localhost:xxxx/controller/action?task=view&xid=7
The syntax will be (according to http://msdn.microsoft.com/en-us/library/dd492124(v=vs.108).aspx);
public static MvcHtmlString ActionLink(
	this HtmlHelper htmlHelper,
	string linkText,
	string actionName,
	string controllerName,
	Object routeValues,
	Object htmlAttributes
)
And the right codes are;
@Html.ActionLink("Text Here", "ActionName", "ControllerName", new { task = "view", xid = 5 }, null)
That's it.. It works fine with my app. Wehehe! What when wrong before I solved was I didn't put null at the last arguments. If you don't put null, your object will become a RouteValueDictionary (I think and not sure about this terms yet) which it should be routeValues. See http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions(v=vs.108).aspx for more information about this. Somehow, the link creation above was crossing to another Controller. What if creating a link within a current controller? The answer will be;
@Html.ActionLink("Text Here", "ActionName", new { task = "view", xid = 5 })
As you can see, I didn't specify the Controller name because you are currently on the controller/page. Hope this helps too to the newbies... :)
Air New Zealand at the Hobbit Artisan Market
Posted: 28 Nov 2012, 9:13am - Wednesday

Air New Zealand was at the premiere of The Hobbit: An Unexpected Journey in Wellinton today.

URL: http://www.theflyingsocialnetwork.com/archives/6329
Installing subversion in CentOS
Posted: 4 Aug 2012, 22:31pm - Saturday
THIS IS A REPOST FROM electrictoolbox.com...
Subversion (SVN) is a version control system. This post looks at how to install subversion on CentOS (the process is similar for other Linux distros) and the setting up a repository. To install subversion on CentOS you need to have the RMForge custom repository enabled, and then issue the following command:
yum -y install subversion
This will check for any dependencies and then prompt you to install those and subversion itself. Type in "y" and <enter> to install these. Unfortunately it doesn't set up anything else after installing the necessary files, so you need to add a subversion user and set up the repositories etc yourself. If we decide to call the subversion user "svn" then you add them like so:
useradd svn
passwd svn
And then change to the subversion user like so:
su svn
Change to the svn user's directory and then create a "repositories" directory like so:
cd
mkdir repositories
And now create your project's repository. For example, if we had a project called "myproject" you would do this:
cd repositories
svnadmin create myproject
There will now be a "myproject" directory containing the following:
-rw-rw-r-- 1 svn svn  229 Nov 21 16:58 README.txt
drwxrwxr-x 2 svn svn 1024 Nov 21 16:58 conf
drwxrwsr-x 6 svn svn 1024 Nov 21 16:58 db
-r--r--r-- 1 svn svn    2 Nov 21 16:58 format
drwxrwxr-x 2 svn svn 1024 Nov 21 16:58 hooks
drwxrwxr-x 2 svn svn 1024 Nov 21 16:58 locks
You need to edit "myproject/conf/svnserve.conf" and uncomment the following lines:
auth-access = write
password-db = passwd
and edit the password file "myproject/conf/passwd" adding a new user and password. Note that the password is stored in plain text. In the following example we have a user called "john" whose password is "foobar123":
[users]
john = foobar123
And finally, as the svn user, start the subversion daemon like so:
svnserve -d -r /home/svn/repositories
You can now connect to the subversion repository at e.g. svn://svn@hostname/myproject You can add additional repositories under this user using the "svnadmin create" command and then access them at svn://[userame]@[hostname]/[project name] You can use tortoiseSVN as client.