Saturday, 31 March 2012

ASP.NET Request.QueryString

You can retrieve values of the variables in the HTTP query string which is passed between pages.
Request.QueryString can enable you to get it. I wrote the following C# code for testing.

http://msdn.microsoft.com/en-us/library/system.web.httprequest.querystring.aspx
----------------------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Target : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {   
        lblDetails.Text = "Hello " + Request.QueryString["name"] + " . You can sign in";
    }
}
----------------------------------------------------------------------------------------

Wednesday, 28 March 2012

C# Stopwatch Class

You can get a value of elapsed time using the properties or the methods of "Stopwatch Class". I used it to measure the elapsed time of search function.

http://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch.aspx
------------------------------------------------------------------------------------------------
public static void SearchName(ArrayList nameList)
        {
            string nameToFind;
            Console.Write("Enter the name to find : ");
            nameToFind = Console.ReadLine();
            Console.WriteLine("\nStarting manual search\n");
            bool found = false;
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Start();
            for (int i = 0; i < nameList.Count; i++)
            {
                if (nameList[i].ToString().Equals(nameToFind, StringComparison.OrdinalIgnoreCase))
                {
                    found = true;
                    stopwatch.Stop();
                    break;
                }
            }
            stopwatch.Stop();

            if (!found)
            {
                Console.WriteLine("Sorry the name " + nameToFind + " could not be found,\n");
                Console.WriteLine("The search took {0} Ticks", stopwatch.ElapsedTicks);
            }
            else
            {
                Console.WriteLine("The name " + nameToFind + " was found");
                Console.WriteLine("The search took {0} Ticks", stopwatch.ElapsedTicks);
            }
        }
------------------------------------------------------------------------------------------------

Tuesday, 27 March 2012

Unified Modeling Language

Unified Modeling Language is a method which visualize many kinds of idea or concept. Actually it's really important to design products before starting implementation. But using UML to design the products requires high level of knowledge or technical skill. In IT industory, we need to learn lots of skills because the products are getting more functional and getting more complicated. New products such as mobile gagdets are really advanced and high-performing.
http://en.wikipedia.org/wiki/Unified_Modeling_Language

Monday, 26 March 2012

ASP.NET: Cookie

Cookie is the small file which is created on the client's system and has information about clients. It is usually used for state management and are stored  in a client system and use it when needed.
It's necessary to know how to use it when the website need to send the data.

http://msdn.microsoft.com/en-us/library/ms178194.aspx
http://msdn.microsoft.com/en-us/library/system.web.httpcookie.aspx
http://www.codeproject.com/Articles/31914/Beginner-s-Guide-To-ASP-NET-Cookies
-----------------------------------------------------------------------------------
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class ColourCookie : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        HttpCookie cookieColour = new HttpCookie("prefColour");
        cookieColour.Value = lbxColours.SelectedItem.ToString();
        cookieColour.Expires = (DateTime.Now.AddHours(1));
        Response.SetCookie(cookieColour);
        Response.Cookies["VisitorData"]["FirstName"] = "John";
        Response.Cookies["VisitorData"]["FirstName"] = DateTime.Now.ToString();
    }
}
-----------------------------------------------------------------------------------

Sunday, 25 March 2012

Summer is over?

It's been getting cold these days. It looks like summer is over and fall is coming.
Summer is my favorite season because it don't like cold days.
Actually I don't like hot days either, but much better for me.
I hope summer days will last longer this year.

Friday, 23 March 2012

Glossary

Glossary is like a list of terms in a specific domain of knowledge with the definitions for those terms.
Actually you might not pay much attention to a glossary while you read books or documents. But it's really good for you to describe things, to explain things and to define things. A glossary must be written really carefully because there should be lots of important words to help the readers to understand the document.
http://en.wikipedia.org/wiki/Glossary

Thursday, 22 March 2012

Drupal 7 Font Your Face (@font-your-face) module

@font-your-face module allow you to add web fonts to your Drupal 7 website. You can use administrative interface which is easy to add web fonts simply by point and click.



Wednesday, 21 March 2012

Polymorphism

I think this function is a bit complicated to explain clearly and is also hard to understand deeply.
Roughly speaking, it means one method can be used for many different objects.
"Polymorphism" sounds bombastic for me, something like a philosophical term.
http://en.wikipedia.org/wiki/Polymorphism_in_object-oriented_programming

Now I'd like to get one of the source of energy, V energy drink tastes really good, good substitute for coffee, gives me some energy. I think it's good for an early start or working into the night.

Tuesday, 20 March 2012

Abstract...

"Abstract" is opposite of "concrete". In java language, it means something which contains imcomplete data or method. I think "abstract" sounds like something ambiguous, defined roughly. It's alomost true.
Abstract class is imcomplete class which cannot be instantiated.
Abstract method is imcomplete method which is not implemented.
It's really useful, but need to be handled carefully.
It must be a powerful tool.
http://docs.oracle.com/javase/tutorial/java/IandI/abstract.html
------------------------------------------
public abstract class NewObject {
   // declare fields
   // declare non-abstract methods
   abstract void draw();//No implementation
}
------------------------------------------

Monday, 19 March 2012

ASP.NET Response.Redirect("~/Target.aspx");

"Response.Redirect" method redirects the user to a new URL. This method is one of the most important methods in ASP.NET.

http://msdn.microsoft.com/en-us/library/a8wa7sdt.aspx
----------------------------------------------------------------------------------------
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Home : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnLogon_Click(object sender, EventArgs e)
    {
        if(txtName.Text=="")
        {
            Label1.Text = "Please Enter your ID";
           
        }
        else
        {
            HttpCookie cookInfo = new HttpCookie("name");
            cookInfo.Value = txtName.Text;
            Response.Redirect("~/Target.aspx?name=" + txtName.Text);
        }
    }
}
----------------------------------------------------------------------------------------

Saturday, 17 March 2012

Vision document

I just wanted to describe what "vision document" is. It sounds like something about eyesight.
But actually it's a document for designing a software.
http://en.wikipedia.org/wiki/Vision_document

To describe a plan or objective is not easy although it's also important.
-------------------------------------------------------
Vision document is a kind of document which describes a plan for a software to meet a client's requirement.
A vision document generally contains:
  • Introduction
  • Business Needs/Requirements
  • Product/Solution Overview
  • Major Features (Optional)
  • Scope & Limitations
  • Other Needs
-------------------------------------------------------

Friday, 16 March 2012

Drupal7 CSS Injector

CSS injector module allows you to add CSS code to your site. And it automatically created style sheets and saved it. You can apply CSS code for one or many pages. That saves a lot of time. You should install it if you know CSS.
https://drupal.org/project/css_injector
http://drupaltutor.com/blog/2013-06/using-css-injector-module-change-design-your-drupal-website

 Click "Create a new rule." 


Add CSS code and set up


Thursday, 15 March 2012

Managing a project

What is Project Management?
Project management is organizing project activities to meet project requirements.
And the project manager is the person responsible for accomplishing the project objectives.
http://en.wikipedia.org/wiki/Project_management

Actually you may not want to be the one who responsible for managing a project as long as you're not intereted in the project that much.
In theory "project management" works , but in practice most projects are too complicated to managing well.
Too much pressure, too many things to do will oppress the people involeved in the projects.
But we should try to do "project management" when the projects gets started. 
We should be happy to have a challenging job because it can make our work exciting and will make us grow up.

Wednesday, 14 March 2012

Best song of 2011

For me, this is the best song of 2011, Evanescence - What You Want.
http://www.youtube.com/watch?v=wVWazHTunSI&feature=related

This is really a high-quality song. And the singer, Amy Lee has a powerful, but pleasant voice.
It's definitely tempting and I actually affected and impressed by this song.
Lyrically, it's encouraging me and I just feel like doing what I want to.
I'm happy if you like it, this song is also heavy though...

Tuesday, 13 March 2012

Java inheritance

Object-oriented programming allows classes to inherit properties and methods from other classes.
In the following example, "Truck" class inherits properties and methods from "Car" class.
This syntax is really useful because many classes are used for making a software and some classes can be modified easily by using this function. It's cool!
-----------------------------------------------------------------------
public class Truck extends Car
{
         int load;

 public Truck (String name, String type, String model, int load)
 {
          super(name,type,model);
          this.load=load;
 }

 public String toString()
 {
           return  super.toString()+"  The limit of load: " + load;
 }
-----------------------------------------------------------------------

Monday, 12 March 2012

php Error Control Operators

In php, at sign(@) means "Error Control Operator".
If you put this operator, any error messages that might be generated will be ignored.
It is sometimes helpful, but basically it should not be overused.
http://www.php.net/manual/en/language.operators.errorcontrol.php

Sunday, 11 March 2012

Create the future

I had my birthday on this month.
Looking back, I have many regrets in my life. There are series of failures and many bad things I should not have done. However, those experiences are definitely valuable things which made me wiser and stronger.

Obviously the past cannot be changed, but we can change the meaning and the value of the past if we work hard to create a better future.

Therefore, I'm ready to face my hardships and difficulties.
I think there are still lots of things left to learn. Even if the things are terrible and difficult to accept, they will be great future assets.

Finally I really want to say "Thank you" to the people around me. Thank you very much!!!

By the way, new iPad is coming soon.

Should I get this kind of a tablet PC?
I'm wondering whether I should buy or not.
Actually I already have a netbook and a smart phone.
I don' t have enough time to use new tablet PC besides them.
Please let me know and tell me what you think about it if you have one.
http://www.techradar.com/news/mobile-computing/tablets/ipad-3-rumours-what-you-need-to-know-937498
http://ipad3newsblog.com/

Friday, 9 March 2012

Drupal7 External Links


You can handle internal links differently from external links on your website.  For instance, you can add icons to either mailto or external links, or both. You can display a confirmation message when visitors leave your site. It can provide useful functions which you may often use.
https://drupal.org/project/extlink
http://codekarate.com/daily-dose-of-drupal/drupal-7-external-links-module

 

Thursday, 8 March 2012

Palindrome Game by JavaScript


I just created a very simple game which checks whether a word is a palindrome or not.
You can copy and paste the following code in a html file, then open it in a browser.
----------------------------------------------------------------------------------------------
<html>
<head>
    <script type="text/javascript">
    function validatePalindrome()
    {
        if(document.getElementById('palindrome').value.indexOf(' ') != -1)
        {
            alert("Don't enter space");
        }
        else if(document.getElementById('palindrome').value!="")
        {
            var palindrome = document.getElementById('palindrome').value;
            var x=palindrome;
            var w=x.split("");
            var z=x.split("");
            var notpal=1;
            z.reverse();
            for(var i=0; i<w.length; i++)
            {
                if(w[i]!=z[i])
                {
                 alert(palindrome + " is not a palindrome");
                 var notpal=0;
                 break;
                }
            }
            if(notpal==1)
                alert(palindrome + " is a palindrome");
        }
        else
        {
            alert("Enter a word");
        }
    }
    </script>
</head>
<body>
    Please enter a word. The word will be checked if it's palindrome or not.<br />
    <input id="palindrome" type="text" />
    <input onclick="validatePalindrome()" type="button" value="Palindrome" />
</body>
</html>
----------------------------------------------------------------------------------------------
 1. Please enter a word




2. Click Palindrome button


Java RoundingMode

If you want digit to be rounded down, importing " java.math.RoundingMode" and using method,
setRoundingMode(RoundingMode.DOWN)
http://docs.oracle.com/javase/1.5.0/docs/api/java/math/RoundingMode.html
http://docs.oracle.com/javase/7/docs/api/java/math/RoundingMode.html
----------------------------------------------------------------------
<Source code>
import java.math.RoundingMode;
public void actionPerformed(ActionEvent e)
{
        NumberFormat formatter = new DecimalFormat("##.00");
        formatter.setRoundingMode(RoundingMode.DOWN);
}
----------------------------------------------------------------------

Wednesday, 7 March 2012

Drupal: Module developer's guide

When you develop Drupal module, the websites is definitely helpful. Also, lots of tutorials are available online
https://drupal.org/developing/modules

Beautiful guitars

GRETSCH G6128T-1962

Gretsch Duo Jet. What a beautiful guitar! I should save money to buy it because it costs more than $3000. Otherwise, I should find secondhand one.


Fender Lead II. Here's a beautiful guitar! This guitars are not manufactured, only secondhand ones are available. I really want to get it!!! 

Tuesday, 6 March 2012

Java iText API

This is a simple way to create a PDF file using iText API.
http://api.itextpdf.com/itext/
http://api.itextpdf.com/itext/com/itextpdf/text/pdf/PdfWriter.html -------------------------------------------------------------------------------------
String testline=(String) collectionList.getSelectedValue();
Document document = new Document();
try
{
         PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream("test.pdf"));
}
catch (FileNotFoundException e1)
{
         e1.printStackTrace();
 }
catch (DocumentException e1)
{
          e1.printStackTrace();
}
document.open();

try
{
         document.add(new Paragraph("First page of the document."));
         document.add(new Paragraph(testline));
}
catch (DocumentException e1)
{
         e1.printStackTrace();
}
document.close();

Monday, 5 March 2012

Microsoft Office Project

This is a software we can manage work projests with. Must be useful and convenient!

Sunday, 4 March 2012

Drupal : Amazing CMS

Drupal is an open-source content management system(CMS). It's very flexible and useful to build websites with PHP files, MySQL and so on... It's worth using it for big websites!
If you want to start it, please read the articles on the websites below. The installation of Drupal may be long and complicated process for beginners.
https://drupal.org/documentation/install
http://www.siteground.com/tutorials/drupal/drupal_installation.htm



Saturday, 3 March 2012

Java GridBag Layout

When you create GUI application using Java , layout method is complicated. I used GridBag Layout, which is very flexible to use. However, it's confusing at the same time
http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html
----------------------------------------------------------------------------
public WasteWeightWindow(CollectionWindow cw)
{
         this.collectionWindow=cw;
         frame.setSize(350,400);
         panel.setLayout(layout);
         GridBagConstraints gbc = new GridBagConstraints();
         gbc.gridx = 1;
         gbc.gridy = 0;
         gbc.gridwidth = 20;
         gbc.gridheight = 1;
         gbc.ipadx=150;
         gbc.fill = GridBagConstraints.HORIZONTAL;
         gbc.insets = new Insets(10, 10, 0, 0);
         weightBox=new JTextField();
         layout.setConstraints(weightBox, gbc);
         panel.add(weightBox);
}
----------------------------------------------------------------------------