Thursday, March 18, 2010

SharpDevelop: Open Source Visual Studio .NET

Fot those who are looking for an alternative IDE for Microsoft Visual Studio .NET, something that costs less (actually free), and does not require a lot of hardware specification, this this article may be of help.

SharpDevelop is a free IDE that imitates the user interface of Microsoft Visual Studio. It contains a lot of features similar to Visual Studio such as the project explorer, drag-and-drop design view, resource manager, syntax highlighting... etc. It uses the free distributable .NET Framework for compiling source codes. (So it requires .NET Framework installed first)


 


SharpDevelop may not posses the same quality and features which may be found at Microsoft Visual Studio but this could also be a good option for starters especially in Visual Basic and C# Programming. Users who are already used to may not feel comfortable because of some features. However, projects in SharpDevelop may still be opened in MS Visual Studio.

sharpdevelop


SharpDevelop may be downloaded at
icsharpcode.net



Latest Version for Microsoft .NET Framework
.NET Framework Page

Tuesday, November 17, 2009

Using Continue

In Programming languages such as C/C++, JAVA, PHP, Python.. etc the keyword continue is a jump statement like break and goto.
This is used to skip inside an iteration.
An example for this is the following for loop statement that prints all even numbers from 0 - 10.

for(int num = 0;num <= 10; num++){
if ((num % 2) > 0)
continue;
printf("%d ", num);
}


The code is written in C Language (actually it is more like an algotithm)
so even JAVA programmers can easily translate them.
Another example, for more sophisticated programming, continue may be also used for deleting entries in file manipulation.

Friday, November 13, 2009

Downloadable JAVA EBOOKS

Free JAVA Lectures (Slideshow).exe Free Java Lectures

How to Program in JAVA.rar JAVA How to Program - the password in this ebook is itspot.
This is a fully featured book where you can learn Java. The best book I know in that programming language.


Thinking in JAVA

I have a copy of this book and I find it easy to understand because of the detailed explanation.

The JAVA turoial A short course on the basics.chm This book helped me a lot on projects in school

squidoo.com/itebooks

Wednesday, October 21, 2009

C Recommended Books

Title:The C Programming Language ANSI C Version
Author:Kernighan & Ritchie
Publisher:Prentice Hall Software Series
ISBN:0-13-110362-8

Comment:Ideal reference book and goes well beyond the level of this course. It is expensive but the serious C programmer will kick themself if they don't buy this book.

Title:ANSI C - Made Easy
Author:Herbert Schildt
Publisher:Osborne McGraw-Hill
ISBN:0-07-881500-2
Comment:

Title:Learning to Program in C
Author:N. Kantaris
Publisher: Babani
ISBN:0-85934-203-4
Comment:A good cheap beginners guide.

Title:Illustrating ANSI C
Author:Donald Alcock
Publisher:Cambridge University Press
ISBN:0-521-42483-6
Comment:A good book for the mathematically inclined.

Title:C - The Complete Reference
Author:Herbert Schildt
Publisher:Osborne McGraw-Hill
ISBN:0-07-881263-1
Comment:

Title:Numerical Recipies in C
Author:W.H.Press, et al
Comment:An advanced level book with, as the name implies, ready-made solutions to your programming problems.

Monday, October 5, 2009

JAVA to Microsoft Access Connection

(Using the JDBC-ODBC bridge)
A video tutorial is also available Click here to watch
ODBC can be used to connect on any databases though processing is slow... but it would still be very helpful, and that's what were gonna use to connect a JAVA Program to an MS Access Database.
We'll be using Northwind Database, a sample database made by Microsoft Corporation for learning purposes. A database of this is also available in SQL server 2000. Click on the link to download the mdb File:


1. Configure the ODBC Settings
a. Go to Control Pane, then Choose Administrative Tools >> Datasources(ODBC)

b. In the ODBC Dialog box, choose the System DSN tab, then click the [Add] button.
c. A Dialog box appears, choose Microsoft Access Driver (*.mdb)

(Extension name Depends on what version of MS access you are using, in this article, we'll refer to Microsoft Access 2000)
Then choose [finish].

c. Another Dialog box will open. Fill up the Data Source name with the name you want. This will be used on Step # 2
(In this example, we will be naming this NWIND for the sample source code). Then on the Database Panel, click [Select] and browse for your database file.
Choose Driver

d. Click the OK Button and you will see that your database has been added in the System Data Sources List.

2. The Source Code

Here's a sample code I got from the book, Thinking in JAVA by Bruce Eckel. I've modified some of its parts so that it will work on our sample database, Northwind.
//: c15:jdbc:JLookup.java
// Looks up email addresses in a
// local database using JDBC.
import java.sql.*;

public class JLookup
{
public static void main(String[] args)
throws ClassNotFoundException {
try{
String dbUrl = "jdbc:odbc:NWIND";
String user = "";
String password = "";

// Load the driver (registers itself)
Class.forName(
"sun.jdbc.odbc.JdbcOdbcDriver");
Connection c = DriverManager.getConnection(
dbUrl, user, password);
Statement s = c.createStatement();
// SQL code:
ResultSet r =
s.executeQuery(
"SELECT * " +
"FROM Products");

while(r.next()) {
// Capitalization doesn't matter:
System.out.println(
r.getString("ProductID") + " " +
r.getString("ProductName"));
}
s.close(); // Also closes ResultSet
}
catch(SQLException se)
{
System.err.println(se);
}
}
}
*From Thinking in JAVA, www.bruceeckel.com



Another code that makes use on the JOptionPane. Some parts of it are simplified (if you find the Objects and Indentations a fuss on the previous example)
By Mykell Dick Soria

import javax.swing.*;
import java.sql.*;
import java.io.*;
public class ConnectionTask
{

private JTextArea txtView;
private JScrollPane jsp;

public ConnectionTask(){
txtView = new JTextArea(20,30);
txtView.setEditable(false);
jsp = new JScrollPane(txtView);

try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection jereme = DriverManager.getConnection("jdbc:odbc:NWIND","","");
Statement jer = jereme.createStatement();

jer.executeQuery("SELECT * FROM Customers");
ResultSet je = jer.getResultSet();

while(je.next())
{
txtView.append(je.getString(1) + "\n" + je.getString(2) + "\n" + je.getString(3) + "\n");
}
JOptionPane.showMessageDialog(null, jsp, "Database Products", JOptionPane.INFORMATION_MESSAGE);
}catch(Throwable exp){

JOptionPane.showMessageDialog(null,exp,"Error",JOptionPane.ERROR_MESSAGE);
System.err.println(exp);
}
}

public static void main(String[] args){
ConnectionTask app = new ConnectionTask();
}
}


Well, you'll know if you're doing right if your program displays the content you selected. The catch statement will display any errors about the connection


Exceptions Used In the Programs:
1. ClassNotFoundException
2 . SQLException
3. Throwable (if you've included this, you don't need to bother putting the first two)
4. IOException - though not in the example, according to Mr. Soria, it can also be substituted for SQLException.



enjoy! :D