Archive

Archive for the ‘General’ Category

Happy New Year

January 1st, 2009 1 comment

I was coding since an hour before the new year. I know it does not sounds good for this night however i wish the best for everyone..

Hope it will be better in 2009.

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: General Tags: ,

A Comic about Microsoft

December 19th, 2008 2 comments

Well, mostly i use materials which are in english but this one is so much fun and it worths to put it. Just wanted to share it. It belongs to Erdil Yaşaroğlu. As the comic shows it is only the way that microsoft can save whole the world.

VN:F [1.9.22_1171]
Rating: 10.0/10 (1 vote cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: General Tags: , ,

CodeIgniter How to Pagination

November 12th, 2008 3 comments

CodeIgniter is a powerful PHP framework with a very small footprint, built for PHP coders who need a simple and elegant toolkit to create full-featured web applications. If you’re a developer who lives in the real world of shared hosting accounts and clients with deadlines, and if you’re tired of ponderously large and thoroughly undocumented frameworks.

CodeIgniter’s Pagination class is very easy to use, and it is 100% customizable, either dynamically or via stored preferences.

If you are not familiar with the term “pagination”, it refers to links that allows you to navigate from page to page, like this:

« First < 1 2 3 4 5 > Last »

function shownews()
{
if($this->userlib->logged_in()) 
//checking for security purposes
{
$this->load->library('pagination');
$per_page = 10; 
// How many pages you want to show in each page
$total = $this->db->get('posts', $per_page, $this->uri->segment(3)); 

//Here is the most important part actually. 
Basically $total variable determined which 
rows you are going to show in the page

$config['base_url'] = base_url().'/index.php/admin/shownews';
$config['total_rows'] = $this->db->count_all('posts'); // Count total rows in the query
$config['per_page'] = $per_page;
$config['num_links'] = 6;
$this->pagination->initialize($config);
$data['posts'] = $total;
$this->load->view('admin_shownews', $data);
} else {
$this->load->view('admin_logineed');
}
}

After getting done with this configuration part of pagination class all you have to do is just initialize it like you are doing it in most of programming languages.

Read more…

VN:F [1.9.22_1171]
Rating: 7.1/10 (41 votes cast)
VN:F [1.9.22_1171]
Rating: -1 (from 5 votes)

Java JCombobox Tutorial

November 6th, 2008 No comments

This tiny program lets you to choose background color of your pane.

import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class tut1 extends JFrame{

Color[] colors = {
Color.RED, Color.BLUE, Color.YELLOW, Color.BLACK, Color.ORANGE,
new Color(0,143,222)
};

String[] renk = {
"red", "blue", "yellow", "black", "orange", "turkuaz"
};

public JComboBox cmb = new JComboBox(renk);
public JPanel main = new JPanel();

public tut1() {

cmb.addActionListener(
new ActionListener(){
public void actionPerformed(ActionEvent e){
int index = cmb.getSelectedIndex();
main.setBackground(colors[index]);
}
});
cmb.setBackground(Color.blue);

JLabel lbl = new JLabel();
main.add(cmb);
main.add(lbl);
setContentPane(main);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300,300);
setTitle("my title");
pack();
}

Read more…

VN:F [1.9.22_1171]
Rating: 5.5/10 (2 votes cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)
Categories: General, Java Tags: , ,

Coding Guidelines For Developers

August 24th, 2008 No comments

@author andrej arn
@author sam blume
@version 4.6 updated 2005-11-24

Basically…
we’d like to have a clean and professional, bug-free code.
Most people have different coding styles. And most think that
“the other style” is ugly. We don’t want to force you changing
your style. Here is how we do it and like it:

o) We use capital letters for constants. e.g. define(‘CONSTANT’, 1).
We also use the capital form of TRUE, FALSE and NULL.
This is true for PHP, note that javascript needs lowercase.

o) If a function is described to return bool, expect to get a real bool
(TRUE/FALSE) and not an int (0/1). So please code your functions and
methods that way.

o) Don’t trust the return values from php methods. If they are stated
to return bool, they often return an int (0/1). So don’t directly
return that from your functions, convert to (bool) if necessary.

o) Never ever use echo, print and die and the like inside your methods.
Use return.

o) this applies also for white spaces. if you start your file with anything
(an empty line) before the   considered as output. This makes header() calls impossible (cookie,
session). The same applies for white spaces after the ?> tag. take care!
Even a newline is too much. This is a typical php newbie mistake.

o) Everything should be as os independant as possible. Including windows.

o) Make your code work with PHP version 4.3.0+ and 5.0.5+.
Don’t support php3.

o) Make the php exam. Repeat it from time to time.

http://www.blueshoes.org/en/developer/syntax_exam/

Read more…

VN:F [1.9.22_1171]
Rating: 9.2/10 (5 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: General, Research Tags: , , ,