Monday, 6 September 2010

Saturday, 1 May 2010

Hello world in C

 

/* Program to print hello world to the screen */  /* title */

#include <stdio.h>                                           /* import library file */

main()                                                           /* Main function */

     {

printf(“Hello world”);                                /*out put statement */

 

}

 

how to compile the code into a executable file suppose you are using gcc and the source code file is helloworld.c,you need to do is simply type:gcc helloworld –o helloworld

You would have a new file named helloworld in the same folder as the source file saved.

Saturday, 17 April 2010

Image Compress websites

punypng

http://www.gracepointafterfive.com/punypng/

PunyPNG is a free website optimization tool that dramatically
reduces the file size of your images without any loss of quality.

 

Smush.it™

http://developer.yahoo.com/yslow/smushit/

Image optimization is an art few have mastered. Useful image editing tools exist that allow images to be edited to reduce their file size while retaining image quality. Using these tools is a good start for optimizing images, but more can be done using advanced tools like Smush.it.

 

OptiPNG: Advanced PNG Optimizer

http://optipng.sourceforge.net/

OptiPNG is a PNG optimizer that recompresses image files to a smaller size, without losing any information. This program also converts external formats (BMP, GIF, PNM and TIFF) to optimized PNG, and performs PNG integrity checks and corrections.

Wednesday, 7 April 2010

3D Ellipse in Xaml

2010-04-07 22-22-37

This example is using gradient to make the ellipse look like as  a 3d Ellipse .

here is the source code of the example. Because the code is short and easy to understand ,So just have a  look.

 

<Canvas>
  <Ellipse Canvas.Left ="120" Canvas.Top="60" Stroke="black" Margin="25,50,0,0" StrokeThickness="4" Height="100" Width="100">
    <Ellipse.Fill>
      <RadialGradientBrush Center="0.5,0.5" GradientOrigin="0.144,0.303">
        <GradientStop Color="LightBlue" Offset="0.1" />
        <GradientStop Color="SkyBlue" Offset="0.3" />
        <GradientStop Color="Blue" Offset="0.7" />
        <GradientStop Color="DarkBlue" Offset="1" />
      </RadialGradientBrush>
    </Ellipse.Fill>
  </Ellipse>
</Canvas>

Friday, 2 April 2010

播放器 musicplayer in silverlight

網上看了幾看文獻所寫的一個播放器,事先聲明很垃圾的.我純粹試試mediaelement而已.








Get Microsoft Silverlight



mainpage.xaml



  1. <UserControl x:Class="musicPlayer.MainPage"

  2.    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

  3.    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

  4.    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

  5.    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">

  6.     <Grid x:Name="LayoutRoot" ShowGridLines="True" Background="Black">

  7.         <MediaElement x:Name="media" Source="HUMAN_TOUCH.mp3" AutoPlay="False"/>

  8.  

  9.         <StackPanel VerticalAlignment="Stretch">

  10.             <Button Content="Play" x:Name="play" Click="play_Click" Margin="5" />

  11.             <Button Content="Pause" x:Name="pause" Click="pause_Click" Margin="5" />

  12.             <Button Content="Stop" x:Name="stop" Click="stop_Click" Margin="5" />

  13.             <Button Content="Mute" x:Name="mute" Click="mute_Click" Margin="5" />

  14.             <Slider Grid.Row="1" x:Name="vol" Minimum="0" Maximum="1" ValueChanged="vol_ValueChanged" Margin="5" />

  15.         </StackPanel>        

  16.     </Grid>

  17. </UserControl>



mainpage.xaml.cs



  1. using System;

  2. using System.Collections.Generic;

  3. using System.Linq;

  4. using System.Net;

  5. using System.Windows;

  6. using System.Windows.Controls;

  7. using System.Windows.Documents;

  8. using System.Windows.Input;

  9. using System.Windows.Media;

  10. using System.Windows.Media.Animation;

  11. using System.Windows.Shapes;

  12.  

  13. namespace musicPlayer

  14. {

  15.     public partial class MainPage : UserControl

  16.     {

  17.         public MainPage()

  18.         {

  19.             InitializeComponent();

  20.             vol.Value = media.Volume;

  21.         }  

  22.    

  23.  

  24.         private void play_Click(object sender, RoutedEventArgs e)

  25.         {            

  26.             media.Play();

  27.         }

  28.  

  29.         private void vol_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)

  30.         {

  31.             media.Volume = vol.Value;

  32.         }

  33.  

  34.         private void pause_Click(object sender, RoutedEventArgs e)

  35.         {

  36.             if (media.CanPause)

  37.                 media.Pause();

  38.         }

  39.  

  40.         private void stop_Click(object sender, RoutedEventArgs e)

  41.         {

  42.             media.Stop();

  43.         }

  44.  

  45.         private void mute_Click(object sender, RoutedEventArgs e)

  46.         {

  47.             if (media.IsMuted == true)

  48.             {

  49.                 media.IsMuted = false;

  50.             }

  51.             else

  52.             {

  53.                 media.IsMuted = true;

  54.             }

  55.         }

  56.     }

  57. }

Thursday, 1 April 2010

Silverlight 超入門 記錄1 Layout Control elements (Canvas)

silverlight 主要有三種Layout control element,分別是Canvas ,Grid 和 StackPanel.這裡暫時只介紹一下Canvas的用法,其他2個會在記錄2和3中後補

Canvas  -主要使用坐標來定義 Canvas本身的定位.

Grid      -主要使用類似表格(Table)利用橫行(rows)和直行(columns)來定義元素的位置,這方式最有彈性,同時是VS2008預建的顯示方法.

StackPanel  -將元素平均放成1行是平方和垂直方式來定位.

以下是VS2008 當我們開啟一個新的silverlight專案時所自動產生的代碼

<UserControl x:Class="dark6player.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
  <Grid x:Name="LayoutRoot">

  </Grid>
</UserControl>


我們可以看到VS2008 已經自動產生了一個Grid元素給我們並命名為LayoutRoot.


以下是幾個Canvas 的例子.


我們先不要理會上面的一堆宜告並在加入以下代碼:


<Canvas Width="480" Height="480" Background="blue">
    <Rectangle Canvas.Left="30" Canvas.Top="30"
       Fill="red" Width="200" Height="200" />
</Canvas>

效果:

2010-04-01 19-38-40

我們定義了一個canvas和在裡面定義了一個rectangle,留意rectangle當中的Canvas.Left和Canvas.right對這個元素影響.

 


我們再加上多一些元素試看看我們再多加入一個canvas和rectangle到上面的例子:


<Canvas Width="480" Height="480" Background="blue">
    <Rectangle Canvas.Left="30" Canvas.Top="30"
       Fill="red" Width="200" Height="200" />
    <Canvas Width="320" Height="320" Background="Yellow" Canvas.Left="80" Canvas.Top="80">
    <Rectangle Canvas.Left="30" Canvas.Top="30"
       Fill="green" Width="200" Height="200" />
       </Canvas>
</Canvas>

 


效果:


2010-04-01 19-55-32


我們所以看到同樣是同一個Canvas的child,比較後的會覆蓋比較前的,而已所有以canvas來定位的元素只會對自己上一個canvas對齊而不是根canvas.

Wednesday, 31 March 2010

Bru-ray 異世界の聖機師物語(Isekai no Seikishi Monogatari) 11話

[Yousei-raws] Isekai no Seikishi Monogatari 11 [BDrip 1920x1080 x264 FLAC].mkv_thumbs_[2010.03.30_00.31.55]

TV 版在不久之前就完結了,看結局最後的坑很深很強大希望會出續集. 藍光也只差2集就播完了.最後一集很可能會付一些補完之類的東西也說不定,BTW 我在用Windows live writer編輯中 不知道效果如何呢

Sunday, 28 March 2010

學校功課 JSP project


這個是學校功課的習作,雖然是一組人但是實際上九成九代碼都是我寫的.其他兩個組員只給了幾隻字的內容.這個網頁用了JSP+TOMCAT+Eclipse.達成了用TXT作資料庫 TOMCAT作容器 用JSP做個科目資料搜尋器.這是我第一次用JSP做的網頁,做得差別人生攻擊,謝謝.


源碼:下載
Source code download

Quick highlighter


之前簡短介紹過SyntaxHighlighter ,不過對於一些不用常分享的朋友這裡提供令一個方法.
就是使用 quickhighlighter, 另外quickhighlighter比SyntaxHighlighter 支援更多語言.

官方網址: http://quickhighlighter.com/

使用方法非常容易我們只需要將程式直接貼到quickhighlighter,然後點擊Highlight,之後就會得到著色了的代碼.

以下以C#為例的效果

  1. using System;

  2. class ExampleClass

  3. {

  4. static void Main()

  5. {

  6. Console.WriteLine("Hello, world!");

  7. }

  8. }



Saturday, 27 March 2010

ゆとりちゃん


日文:ゆとりちゃん
官方網址:http://yutori-chan.jp/

ゆとりちゃん是一套免費的動畫(第5集後要收費的說),每集只有幾分鐘(連OP),人物令我想起萌單(我沒有看萌單動畫,只是有買英文參考書=.=").

Friday, 26 March 2010

Darker Than Black OVA 02

上集到現在都不知道有多久了,這個沒記錯 是每3集DVD 就附送1集的.繼上集劇情今次黑和銀逃到香港所發生的事,銀還是一樣萌~ 好想要個美女DOLL

Thursday, 25 March 2010

Kiss X sis 第1話

剛看完第1話,劇情應該接著OVA 0之後的劇情, 這一話沒什麼過激的場面可以是TV版關係,我很在意那個 自主規則 的畫面, 等DVD版第1話出就知道了

Wednesday, 24 March 2010

Elastic Sounds

這些音樂是我朋友Ziad Oudi的,他是DJ.我得到他同意把他的連來放到這裡來.

請點這裡欣賞

れでぃ×ばと 第12話




原名:れでぃ×ばと
羅名拼音:Redi×Bato!
英文:Ladies versus Butlers!
中文:
大小姐×執事!/管家后宮學園


又一套動畫完了,這些是少數我全套看完的賣血作品.漫畫和小說我都沒有看過也沒什麼興趣去看.
新一季值得我期待只有最後的大魔王和Kiss X sis.

Eclipse 3.4介面一覽 View of Eclipse 3.4

Eclipse 是一個很強大的開源IDE,主要支持JAVA語言.Eclipse 可透過Plus-in來支持其他語言如php,python 甚至是微軟的 .net 語言.




可點這裡下載SWF檔

Tuesday, 23 March 2010

hello

just testing about my new blogger and the domain name