Thursday, 26 April 2012

C# Threading

Threading enables you to perform more than one operation at a time. For example, you can use threading to monitor events or input from the user, at the same time you can do other operations.
The following code show a simple threading, 2 threads display  Name property of "Person" object simultaneously.
http://msdn.microsoft.com/en-us/library/aa645740%28v=vs.71%29.aspx
------------------------------------------------------------------------------
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

namespace Treading
{
    class MessageBox
    {
        public void Speak()
        {
            Thread t = new Thread(speak);
            t.Name = "Speaking Thread";
            t.Start();
        }
        private void speak()
        {
            while (true)
           {
                Console.WriteLine("Hello from {0}", Name);
           }
        }
    }
}
------------------------------------------------------------------------------
namespace Treading
{
    class Program
    {
        static void Main(string[] args)
        {
            var p1 = new Person{ Name = "Peter", Age= 21 };
            var p2 = new Person { Name = "Paul", Age = 42 };

            p1.Speak();
            Thread.Sleep(500);
            p2.Speak();

        }
    }
}
------------------------------------------------------------------------------

Monday, 23 April 2012

Java: Exception

Exception Handling in Java programing looks useful. There are lots of useful videos on youtube.com. I often check youtube.com, but I don't have enough time to watch them much. Anyway, this video is really interesting. I've learned the concept of Exception Handling from this.

Friday, 20 April 2012

Crazy guitars

Parker guitar is one of the most advanced guitars all over the world. The company must be really innovative and selling this kind of guitars are challenging task because most of the guitar players prefer to traditional guitars such as Gibson guitars or Fendar guitars. Actually I really like both Gibson guitars and Fendar guitars. But I want to check these guitars because I'm alwasys interseted in new technologies. I strongly believe they must be revolutionary guitars!!!
http://www.parkerguitars.com/


This is the one of the most innovative guitar in the world.
Looks so cool, against the traditional guitars!!!
All guitars of this type have been sold out.. I want to get one someday...
http://www.garykramerguitar.com/R36Turbulence.html

Thursday, 19 April 2012

php explode()

It splits a string into an array.
http://www.w3schools.com/php/func_string_explode.asp ----------------------------------------------------------------------------------------------------
<?php
    $str = "This is a test of explode()";
    print_r (explode(" ",$str));
?>
----------------------------------------------------------------------------------------------------
<Result>
Array ( [0] =>This [1] => is [2] => a [3] => test [4] => of [5] => explode() )
----------------------------------------------------------------------------------------------------

GregorianCalendar

"GregorianCalendar" in Java is interesting concept, it's bit complicated though. Actually I'd like to spend more time on it. I think ancient people who invented this kind of system was incredibly smart, must be gifted. We are lucky because we can use it and learn much from them.
http://docs.oracle.com/javase/6/docs/api/java/util/GregorianCalendar.html
http://en.wikipedia.org/wiki/Gregorian_calendar

Wednesday, 18 April 2012

Drupal7 page_tpl.php

This file defines how to display a drupal theme by php and html.
https://api.drupal.org/api/drupal/modules!system!page.tpl.php/7

 This is a sample code. There are lots of important classes and the variables
------------------------------------------------------------------------------------------
<?php

?>
<div id="page-wrapper">
  <div id="page">
    <div id="header" class="<?php print $secondary_menu ? 'with-secondary-menu': 'without-secondary-menu'; ?>">
      <div class="section clearfix">
        <?php if($logo): ?>
        <a href="<?php print $front_page; ?>" title="<php print t('MyTheme'); ?>" rel="home" id="logo">
          <img src="<?php print $logo; ?>" alt="<?php print t('MyTheme'); ?>" />
        </a>
      <?php endif; ?>

      <?php if($site_name||$site_slogan): ?>
      <div id="name-and-slogan"<?php if($hide_site_name&&$hide_site_slogan) {print 'class="element-invisible"';} ?>>

        <?php if($site_name: ?>
          <?php if($title): ?>
            <div id="site-name"<?php if ($hide_site_name) {print 'class="element-invisible"';} ?>>
              <strong>
                <a href="<?php print $front_page; ?>" title="<?php print t('Home'); ?>"
                  rel="home"><span><?php print $site_name; ?></span></a>
                </strong>
              </div>
             <?php endif; ?>
          </div>
      <?php endif; ?>
 
      <?php print render($page['header']); ?>

      <?php if($main_menu): ?>
        <div id="main-menu" class="navigation">
          <?php print theme('links__system_main_menu', array(
            'links' => $main_menu,

            'attributes' => array(
              'id' => 'main-menu-links',
              'class' => array('links', 'clearfix'),
            ),
            'heading' => array(
              'text'=> t('Main menu'),
              'level'=>'h2',
              'class'=>array('element-invisible'),
            ),
          )); ?>
          </div>
        <?php endif; ?>

   <div id="main-wrapper" class="clearfix"><div id="main" class="clearfix">
  ------------------------------------------------------------------------------------------

Sunday, 15 April 2012

Drupal7 Block Class module

This module is used by developers. It's simple, but helpful when you use CSS for designing a theme.
https://drupal.org/project/block_class

Fibonacci number

The Fibonacci numbers are the integer sequence 0, 1, 1, 2, 3, 5, 8, 13, 21, ..., in which each item is formed by adding the previous two.
It looks simple, it's fun to calculate by using a programming language
http://en.wikipedia.org/wiki/Fibonacci_numbers

Saturday, 14 April 2012

Can you solve this problem?

I could solve this problem, but not quickly. I hope I still have the mind of a pre-school student.
Take your time to solve it before checking the answer by visiting the website below.
http://colleenyoung.wordpress.com/

Friday, 13 April 2012

Making music!

Ableton Live is an amazing software for making music. I can feel happy to use this software for writing and composing songs. For me, this is the one of the most revolutionary software. You should check it out, you can download the free trail one  from the website and use for a while.

A days ago, I got an email from Avid Technology, Inc.which is an American company specializing in video and audio production technology. Their products are used in the television and video industry to create TV shows, feature films, and commercials.
I definitely think they are building our bright future because all of their products are absolutely innovative!
Website: http://www.avid.com/US/
Youtube: http://www.youtube.com/avid?elq_mid=5658&elq_cid=1804502&elq_mid=3724&elq_cid=3192070&elq=625f0d5d58f24ab58901cb26e6a0310b

Thursday, 12 April 2012

Drupal7 template.php

Usually all functions for building a theme structure should be written in this file. You should be familiar with the variables and API that are used in this file.
https://api.drupal.org/api/drupal/themes!garland!template.php/7
https://drupal.org/node/1089656

Here's a sample code. There are lots of important APIs and the variables
-------------------------------------------------------------------------------------
function mytheme_preprocess_html(&$variables) {
    if(!empty($variables['page']['featured'])) {
    $variables['classes_array'][] = 'featured';
    }
}
function mytheme_process_html(&$variables) {
    if(module_exists('color')) {
        _color_html_alter($variables);
    }
}
function mytheme_process_page(&$variables) {
    if(module_exists('color')) {
        _color_page_alter($variables);
    }
    $variables['hide_site_name'] = theme_get_setting('toggle_name') ? FALSE:TRUE;
    $variables['hide_site_slogan'] = theme_get_setting('toggle_slogan') ? FALSE:TRUE;

    if ($variables['hide_site_name']) {
        $variables['site_name'] = filter_xs_admin(variable_get('site_name', 'My Theme'));
    }
    if($variables['hide_site_slogan']) {
        $variables['site_slogan'] = filter_xs_admin(variable_get('site_slogan', ''));
    }
 }
------------------------------------------------------------------------------------- 

ASP.NET Postback Event

Understanding the concept of "postback" is very important in ASP.NET
Postback is the process of submitting an ASP.NET page to the server for processing when a action is performed by a contol on a asp.net page.
If you click on a button or press Enter key,  the data on the page is posted back to the server for processing it.

http://msdn.microsoft.com/en-us/library/aa720416%28v=vs.71%29.aspx
http://delphi.about.com/library/weekly/aa051705a.htm

Wednesday, 11 April 2012

Autumn Leaves

I feel like listening to this song when summer is over and autumn comes. The melody of the song is very simple but has nostalgic feel. Bill Evans: a legendary pianist plays this song flawlessly. It's really amazing!!!

Monday, 9 April 2012

ASP.NET Session

Because  HTTP is a stateless protocol, a Web server can't  hold client information on a page.
ASP.NET session state identifies requests from the same browser during a limited time window as a session. and gives a variable values for the duration of that session.
I used Session property to get a date from a calender.  And pass it to the another page which convert its data type"Datetime" to String.

http://msdn.microsoft.com/en-us/library/ms178581%28VS.100%29.aspx


-------------------------------------------------------------------------------------------------------------
public partial class SessionTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {       
        if (Session["Date"] != null)
        {
            lblDatePref.Text = "Date: " + Session["Date"].ToString();
        }
        else
        {
            lblDatePref.Text = "--WARNING-- Go to preferences page and choose the date!";
        }
    }
}
-------------------------------------------------------------------------------------------------------------

ASP.NET Profile properties

By using the ASP.NET profile feature, you can easily manage information with an individual user and stores the information. Profiles is quite handy, you can handle user information and you don't have to create and maintain database by yourself.

http://msdn.microsoft.com/en-us/library/2y3fs9xs
 --------------------------------------------------------------------------
[ web.config ]
<?xml version="1.0"?>
<configuration>
  <system.web>
    <profile>
      <properties>
        <add name="UserName"/>
      </properties>
    </profile> 
    <compilation debug="true" targetFramework="4.0"/>
  </system.web>
</configuration>
--------------------------------------------------------------------------
 [Profile.aspx.cs]
 protected void buttonProf_Click(object sender, EventArgs e)
 {
        Profile.UserName = txtUserName.Text;
        if (txtUserName.Text == "")
        {
            lblYourName.Text = "Please Enter your profile";
        }
        else
        {
            lblYourName.Text = Profile.UserName;
        }
}
--------------------------------------------------------------------------


Beach

"Beach" must be the place where many people feel comfortable. Definitely I always feel happy while I'm in a beach. Anyway, there were lots of people in the beach during holidays. Most of people there seemed to be relaxed and happy. Summer is over, but we still goes to beaches. I should find out why people like beaches. Sea? Sky? Sand? I'd like to know if someone has studied and has reported about that.

Friday, 6 April 2012

Drupal7 Book module Tips

This is very simple and important tip to build a website which has many book pages.
https://drupal.org/documentation/modules/book
http://www.youtube.com/watch?v=O_ZGYn51Y-g
When you design the outline of the order of book pages, go to "Content" and choose "Books" tab, then click "edit order and titles".

Now you'll see the table of the book titles. You can design the order just by using drag and drop easily.


By the way, Easter holidays is coming!
Celebrate Easter! It must be fun!
http://en.wikipedia.org/wiki/Easter

Tuesday, 3 April 2012

Noodle

I often eat noodles, Chinese, Japanese, Korean, Thai, Vietnamese and so on. All of those are sort of similar, but I enjoy the difference among them. I think I should not say what is the best. Probably it depends.
If I feel like eating thick type of noodle, I'll chose Chinese noodle.
If I want hot one, eat Korean noodle...
Actually I like spaghetti too, which I'd like to call Italian noodle.
Today I had Chinese noodle, It was a noodle with pork and won-ton noodle. It was so nice!!!

Sunday, 1 April 2012

Drupal7 JS injector

Administrators can inject JavaScript into your Drupal website. It's easily add your JavaScript code without modifying original php file in your Drupal  official theme.
https://drupal.org/project/js_injector
http://www.youtube.com/watch?v=lUl3BS-n-ZA
http://www.benmarshall.me/load-js-css-specific-page-drupal-7/

Click "Add"(or "Import") to add a new JavaScript



 Write JS code here