Share the Love Sharing and Bookmarking Widget for Blogger
(Monday, July 5, 2010)
2 comments Posted by Wai Kit at 10:18 PM
2 comments Posted by Wai Kit at 10:18 PM
My first client server java coding:
1: import javax.swing.*;
2: import java.awt.*;
3: import java.io.*;
4: import javax.swing.border.*;
5: import java.net.*;
6: import java.awt.event.*;
7:
8: class Server extends JFrame implements ActionListener
9: {
10: private JTextArea jtaSend=new JTextArea();
11: private JTextArea jtaReceive=new JTextArea();
12: private JButton jbtSend=new JButton("Send");
13:
14: DataOutputStream output;
15: DataInputStream input;
16:
17: public Server()
18: {
19: jbtSend.addActionListener(this);
20:
21: try
22: {
23: ServerSocket server=new ServerSocket(8000);
24: Socket socket=server.accept();//wait connection from a client
25: System.out.println("connected to a client");
26:
27: output=new DataOutputStream(socket.getOutputStream());
28: input=new DataInputStream(socket.getInputStream());
29:
30: getContentPane().setLayout(new GridLayout(2,1));
31: JScrollPane scp=new JScrollPane(jtaSend);
32: scp.setBorder(new TitledBorder("Type your message here"));
33:
34: JPanel panel=new JPanel();
35: panel.setLayout(new BorderLayout());
36: panel.add(scp,BorderLayout.CENTER);
37: panel.add(jbtSend,BorderLayout.SOUTH);
38: getContentPane().add(panel);
39:
40: getContentPane().add(new JScrollPane(jtaReceive));
41: setTitle("Server");
42: setSize(300,300);
43:
44: setLocation(20,30);
45: setVisible(true);
46:
47: while(true)
48: {
49: jtaReceive.setText(input.readUTF());
50: }
51: }
52: catch(IOException ex)
53: {
54: ex.printStackTrace();
55: }
56: }
57:
58: public static void main(String[]args)
59: {
60: JFrame frame=new Server();
61: }
62:
63: public void actionPerformed(ActionEvent e)
64: {
65: try
66: {
67: output.writeUTF(jtaSend.getText());
68: }
69: catch(Exception ex)
70: {
71: }
72: }
73: }
4 comments Posted by Wai Kit at 10:05 PM
No doubt the Night Sky 2.0 Blogger template by Ray Creations is one of the best templates I’ve ever seen. There are other templates by Ray Creations which are as good too. You can check out more of its works here.
However, there is a bug in the template. I find the end of my right sidebar cuts off and goes to the far left side of the screen in posts page (not main page) whenever I add widgets on the sidebar to the extent that the sidebar’s height exceeds that of the post’s.
I figured this is because the sidebar-bottom is made to float:left; margin-left:20px. So, whenever there is no post on its left for the sidebar to “hold on to”, the sidebar will eventually floats itself to the most left that it can find with 20px margin from the left.
Here is the original extract from the template:
1: #sidebar-bottom {
2: width: 240px;
3: height:40px;
4: padding-right: 0px;
5: background: url(http://lh5.ggpht.com/_qYQcA5cg1OY/SsMdZU-8OAI/AAAAAAAAAG8/fRV84_un7sQ/rightsidePanelbottom.jpg) no-repeat right bottom;
6: float: left;
7: margin-left:20px;
8: overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
1: #sidebar-bottom {
2: width: 240px;
3: height:40px;
4: padding-right: 0px;
5: background: url(http://lh5.ggpht.com/_qYQcA5cg1OY/SsMdZU-8OAI/AAAAAAAAAG8/fRV84_un7sQ/rightsidePanelbottom.jpg) no-repeat right bottom;
6: float: right;
7: margin-right:11px;
8: overflow: hidden; /* fix for long non-text content breaking IE sidebar float */
0 comments Posted by Wai Kit at 1:23 PM
1: <!-- TWITTER RETWEET BUTTON START -->
2: <script type='text/javascript'>
3: tweetmeme_source = '[TwitterUserName]';
4: tweetmeme_url = '<data:post.url/>';
5: </script>
6: <script src='http://tweetmeme.com/i/scripts/button.js' type='text/javascript'/>
7: <!-- TWITTER RETWEET BUTTON END -->
1: <data:post.body/>
0 comments Posted by Wai Kit at 10:52 PM
For those of you who's not really into using Adobe Photoshop to add watermark to your photos or is just simply too lazy to use one, here's one of the simplest way to do the job.
PicMarkr
PicMarkr lets you to add custom watermark (image or text) to your images online and free. It is useful when you need to protect your copyrights or if you want to add comments
to your photos
Just follow the 3 simple steps in the website.
Step 1: Upload your photos. You can choose whether to upload it from your local computer or grab from Flickr, Facebook or Picasa.
Step 2: Customize the watermark. You can choose from the different alignments, write the text to display and its presets.
Step 3: Well, you're almost done. Just download the photos to your computer or upload them.
2 comments Posted by Wai Kit at 7:43 PM
1: <!-- DIGG BUTTON START -->
2: <script type='text/javascript'>
3: digg_url = '<data:post.url/>';
4: </script>
5: <script src='http://digg.com/tools/diggthis.js' type='text/javascript'/>
6: <!-- DIGG BUTTON END -->
1: <data:post.body/>
3 comments Posted by Wai Kit at 12:48 AM
0 comments Posted by Wai Kit at 1:52 AM
3 comments Posted by Wai Kit at 10:57 AM