Logic At work

Google Ads Block

Subscribe


Comment Showcase

Tags

Logic At work

Why Learn Google Web Tool Kit at LogicAtWork.org ?

1If you ask a experience programmer working in any the web technology
platform , you will find that 80% of the time is spent not in writing code
but in understanding the ever changing behaviors of various browsers and
making a web page look nice when is moved due to user interaction . Some
times , it is too frustrating without a meticulously working web designer .





2If you ask a whether the principals of “ReUse of Code “ are implemented or
not ,then will be both yes and no ? Do you why it is difficult task to do
for programming team …especially in case we need to maintain and reuse
“Javascript Code “ .







3If you ask any programmer ? Have you ever calculated the burden of
reinventing the wheel again and again .., I mean learn a new technology or
language .., make the same

Controls , forms etc.., believing that you are learning the best and latest
techno.., only to find some new , more convincing technology has arrived .
He would say , I do not know

about the “How many hours mankind spends on learning and unlearning
technologies ?”

but , I m very uncomfortable to spend more and more hours on Learning new
techo buzzes .



Any way , this article in no way is going to debate the questions above ,but
will try to give some solutions for above said issues for buddy programmers
and senior programmers ..?



Check out !, This new Google Web Tool Kit , it helps to build
applications which have following benefits for programmer community .





a) Faster JavaScript: GWT takes advantage of concept of cross compilers , It
simply compiles the java in to javascript . You do have learn javascript as
separate entity .

By Compiling java into javascript it enhances the performance of the web
application to

Better scale .



b) Browser-specific optimizations:GWT has great features which also includes
optimization of the AJAX specific to browser . Some for which I personally
have many times got uncomfortable in other technologies .



c) Cross Compiler Optimization features : The compiler does numerous
optimizations to make code perform better .



d) Google's GWT provides the development community with a set of resources
enabling them to create web-based applications with relative ease and
support .



e) You can Edit Java code, then view changes immediately without
re-compiling , thus saving production time



f) Easy Debugging : Step through live AJAX code with your Java debugger and
check applications internals .



g) GWT supports an open-ended set of transfer protocols such as JSON and
XML, but GWT RPC makes all-Java communications particularly easy and
efficient.



h) Easily support the browser's back button and history



i) It works wonders with Google App Engine .



*We, at LogicAtwork.org understand the benefits of learning Google based
technology , therefore introduced here in chandigarh and Baddi(Himachal
Pradesh) Centers . This training program is best suited for students who
want to take Java as core competency skill to build their career. Google Web
Tool kit advance training program assumes that you already are familiar with
one programming language , HTML and CSS . Come join in , The Google
Platform of Success ! , For Course details email us at gwt@ecologic.co.in*

* *

Warm regards,

Puneet Arora
Ecologic Corporation
http://www.ecologic.co.in
H.O : 2138 , Sector 22 -C ,Chandigarh
Mobile: 9872856485
IM : puneet@ecologic.co.in
Branch Office: 360, Level III , Motia Plaza
Baddi, Himachal Pardesh

 del.icio.us  Stumbleupon  Technorati  Digg 

Creating Web Data Entry Form in Entity Frame Work in ASP.NET

Creating Web Data Entry Form in Entity Frame Work in ASP.NET





Step 1: Create New ASP.Net Project .

Step 2: Add New Item à Model.edmx

Step 3: Follow Entity Frame Work Wizard Steps 1

Step 4: Create Entity Model from the DataBase

Step 5: Once model is Create Now Create a New ItemàWebForm

Step 6: Choose the Table for which DataEntry Form is going to be made .

Step 7 : In Our Case we are taking a Table = Entity called “DashBoard “

*Step 8: How to LoadData from Table called DashBoard*

* *

* *

Dim db As New YourModel.YourEntities**

* *

'''

''' This Method Show Data in Grid View from Table

'''


'''

'''

Private Sub LoadData()

Try



Dim var = From c In db.Dashboard

GridView1.DataSource = var

GridView1.DataBind()

Catch ex As Exception

ErrMsg.Text = ex.Message

End Try

End Sub



*Step 9 : As you see above , we need to add a GridView to show the Data *

*In the Web Form . *

* *

* *

*Step 10: *

* *

*How to Save Data *

* *

* *

'''

''' This Function has two modes Mode= Insert New Row , Mode = 2 Update a
Row

'''


'''

Private Sub Save()

Try

Dim c As New Dashboard



‘ This mode is for Inserting.on Add Data Button



If Mode = 1 Then

c.ID = HfKey.Value ‘Last Primary Key Value

c.UserManagement = txtUserManagement.Text

c.MaterialManagement = txtMatrialManagement.Text

c.CustomerManagement = txtCustomerManagement.Text

c.SalesManageManagemet = txtSalesManageManagement.Text

c.JobManagement = txtJobManagement.Text

c.VendorManagement = txtVendorManagement.Text

c.JobMasterData = txtJobMasterData.Text

db.AddToDashboard(c) ‘Add to the Object Conceptual Model

db.SaveChanges() ‘ Now Add to Storage Model/Database



End If



‘ This mode is for Updating .on UpDateButton

If Mode = 2 Then



Dim e = (From b In db.Dashboard _

Where b.ID = HfKey.Value _

Select b).First

e.UserManagement = txtUserManagement.Text

e.MaterialManagement = txtMatrialManagement.Text

e.CustomerManagement = txtCustomerManagement.Text

e.SalesManageManagemet = txtSalesManageManagement.Text

e.JobManagement = txtJobManagement.Text

e.VendorManagement = txtVendorManagement.Text

e.JobMasterData = txtJobMasterData.Text

db.SaveChanges() ‘ Save Changes to Storage Model/Database

Else



MsgBox("Not IN MODE 2")



End If

MView1.ActiveViewIndex = 0

LoadData()

Catch ex As Exception

ErrMsg.Text = ex.Message



End Try

End Sub**

* *

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs)
Handles btnSave.Click



Save()

End Sub**

* *

* *

* *

* *

*Step 11:*

*How to Delete Data *

'''

''' This Function Delete Data from Table

'''


'''

'''

Private Sub DeleteData(ByVal ID As Long)

Try

Dim e = (From b In db.Dashboard _

Where b.ID = ID _

Select b).First

db.DeleteObject(e)

db.SaveChanges()

LoadData()

Catch ex As Exception

Throw ex

End Try

End Sub







Enjoy Learning New things in Coding ! **



Warm regards,

Puneet Arora
Ecologic Corporation
http://www.ecologic.co.in
H.O : 2138 , Sector 22 -C ,Chandigarh
Mobile: 9872856485
IM : puneet@ecologic.co.in
Branch Office: 360, Level III , Motia Plaza
Baddi, Himachal Pardesh

 del.icio.us  Stumbleupon  Technorati  Digg 

Creating Search Web Form in LINQ using VB. NET

Creating Search Form in LINQ using VB.NET







Step 1: Create Two Text Boxes , Grid View (to show results) , Search Button
to fire LINQ Search Query , in New ASP.NET Website ASPX Page .



Step 2: Add New Item àLINQ2SQL in App_Code of your ASP.NET Website Project



Step 3: Drag & Drop the Tables of NorthWind(DB) using Sever Explorer on
LINQ ORM Tool space



Step 4 : Now let’s us take the Table Customers of NorthWind and Drop it on
LINQ ORM

(Object Relational Mapping Tool)



Step 5 : Now , It is time to work on the Search.aspx Page ‘s Code Behind
File i.e

Code File -àSearch.vb





Step 6:



Protected Sub Search_Click(ByVal sender As Object, ByVal e AsSystem.EventArgs)
Handles Button1.Click

Try

Using context As New NorthWindDataContext

Dim Customers = From c In context.Customers _

Where c.ContactName.Contains(TextBox1.Text.Trim()) _

AndAlso c.CompanyName.Contains(TextBox2.Text) _

Order By c.CustomerID Descending

GridView1.DataSource = Customers

GridView1.DataBind()

End Using



Catch ex As Exception

Throw ex

End Try



End Sub



Step 7 : Run and Check .., you can change the query Using Or or OrElse
Operator also .



Happy Learning !

Warm regards,

Puneet Arora
Ecologic Corporation
http://www.ecologic.co.in
H.O : 2138 , Sector 22 -C ,Chandigarh
Mobile: 9872856485
IM : puneet@ecologic.co.in
Branch Office: 360, Level III , Motia Plaza
Baddi, Himachal Pardesh

 del.icio.us  Stumbleupon  Technorati  Digg 

Move First Move Last Move Next In WinForms 2008 VB.NET

  

    ' Step 1 : Create a Table






    'CREATE TABLE [dbo].[emp](

    '    [empid] [int] NULL,

    '    [empname] [varchar](50) NULL

    ') ON [PRIMARY]



    'GO
... << MORE >>

How to create Orkut kind of Website in ASP.NET using Linq2SQL


Warm regards,

Puneet Arora
Ecologic Corporation
http://www.ecologic.co.in
H.O : 2138 , Sector 22 -C ,Chandigarh
Mobile: 9872856485
IM : puneet@ecologic.co.in
Branch Office: 360, Level III , Motia Plaza
Baddi, Himachal Pardesh

 del.icio.us  Stumbleupon  Technorati  Digg 

Invitation to connect on LinkedIn

LinkedIn
——————




Logic,

I'd like to add you to my professional network on LinkedIn.

- Puneet

Accept Puneet Arora's invite:
https://www.linkedin.com/e/isd/836787884/K9ERJFOs/




———
(c) 2009, LinkedIn Corporation

 del.icio.us  Stumbleupon  Technorati  Digg 

Coming Soon Tutorial ON How to LINQ !

Coming Soon Tutorial ON How to  LINQ !


Warm regards,

Puneet Arora
Ecologic Corporation
http://www.ecologic.co.in
H.O : 2138  , Sector 22 -C ,Chandigarh


Mobile: 9872856485
IM : puneet@ecologic.co.in
Branch Office: 360, Level III , Motia Plaza
Baddi, Himachal Pardesh





 


 del.icio.us  Stumbleupon  Technorati  Digg 

Coming Soon ARTICLES ON Silver Light 3.0


Warm regards,

Puneet Arora
Ecologic Corporation
http://www.ecologic.co.in
H.O : 2138  , Sector 22 -C ,Chandigarh
Mobile: 9872856485
IM : puneet@ecologic.co.in


Branch Office: 360, Level III , Motia Plaza
Baddi, Himachal Pardesh



 del.icio.us  Stumbleupon  Technorati  Digg 

How to upload Image in JFrame in Java

/** Returns an ImageIcon, or null if the path was invalid. */
protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}


Example for Loading Images in Frame

public class IconDemoApp extends JFrame {

private JLabel photographLabel = new JLabel();
private JToolBar buttonBar = new JToolBar();

private String imagedir = "images/";

private MissingIcon placeholderIcon = new MissingIcon();

/**
* List of all the descriptions of the image files. These correspond one
to
* one with the image file names
*/
private String[] imageCaptions = { "Original SUNW Logo", "The
Clocktower",
"Clocktower from the West", "The Mansion", "Sun Auditorium"};

/**
* List of all the image files to load.
*/
private String[] imageFileNames = { "sunw01.jpg", "sunw02.jpg",
"sunw03.jpg", "sunw04.jpg", "sunw05.jpg"};

/**
* Main entry point to the demo. Loads the Swing elements on the "Event
* Dispatch Thread".
*
* @param args
*/
public static void main(String args[]) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
IconDemoApp app = new IconDemoApp();
app.setVisible(true);
}
});
}

/**
* Default constructor for the demo.
*/
public IconDemoApp() {
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setTitle("Icon Demo: Please Select an Image");

// A label for displaying the pictures
photographLabel.setVerticalTextPosition(JLabel.BOTTOM);
photographLabel.setHorizontalTextPosition(JLabel.CENTER);
photographLabel.setHorizontalAlignment(JLabel.CENTER);
photographLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5,
5));

// We add two glue components. Later in process() we will add
thumbnail buttons
// to the toolbar inbetween thease glue compoents. This will center
the
// buttons in the toolbar.
buttonBar.add(Box.createGlue());
buttonBar.add(Box.createGlue());

add(buttonBar, BorderLayout.SOUTH);
add(photographLabel, BorderLayout.CENTER);

setSize(400, 300);

// this centers the frame on the screen
setLocationRelativeTo(null);

// start the image loading SwingWorker in a background thread
loadimages.execute();
}

/**
* SwingWorker class that loads the images a background thread and calls
publish
* when a new one is ready to be displayed.
*
* We use Void as the first SwingWroker param as we do not need to
return
* anything from doInBackground().
*/
private SwingWorker loadimages = new
SwingWorker() {

/**
* Creates full size and thumbnail versions of the target image
files.
*/
@Override
protected Void doInBackground() throws Exception {
for (int i = 0; i < imageCaptions.length; i++) {
ImageIcon icon;
icon = createImageIcon(imagedir + imageFileNames[i],
imageCaptions[i]);

ThumbnailAction thumbAction;
if(icon != null){

ImageIcon thumbnailIcon = new
ImageIcon(getScaledImage(icon.getImage(), 32, 32));

thumbAction = new ThumbnailAction(icon, thumbnailIcon,
imageCaptions[i]);

}else{
// the image failed to load for some reason
// so load a placeholder instead
thumbAction = new ThumbnailAction(placeholderIcon,
placeholderIcon, imageCaptions[i]);
}
publish(thumbAction);
}
// unfortunately we must return something, and only null is
valid to
// return when the return type is void.
return null;
}

/**
* Process all loaded images.
*/
@Override
protected void process(List chunks) {
for (ThumbnailAction thumbAction : chunks) {
JButton thumbButton = new JButton(thumbAction);
// add the new button BEFORE the last glue
// this centers the buttons in the toolbar
buttonBar.add(thumbButton, buttonBar.getComponentCount() -
1);
}
}
};

/**
* Creates an ImageIcon if the path is valid.
* @param String - resource path
* @param String - description of the file
*/
protected ImageIcon createImageIcon(String path,
String description) {
java.net.URL imgURL = getClass().getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL, description);
} else {
System.err.println("Couldn't find file: " + path);
return null;
}
}

/**
* Resizes an image using a Graphics2D object backed by a BufferedImage.
* @param srcImg - source image to scale
* @param w - desired width
* @param h - desired height
* @return - the new resized image
*/
private Image getScaledImage(Image srcImg, int w, int h){
BufferedImage resizedImg = new BufferedImage(w, h,
BufferedImage.TYPE_INT_RGB);
Graphics2D g2 = resizedImg.createGraphics();
g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g2.drawImage(srcImg, 0, 0, w, h, null);
g2.dispose();
return resizedImg;
}

/**
* Action class that shows the image specified in it's constructor.
*/
private class ThumbnailAction extends AbstractAction{

/**
*The icon if the full image we want to display.
*/
private Icon displayPhoto;

/**
* @param Icon - The full size photo to show in the button.
* @param Icon - The thumbnail to show in the button.
* @param String - The descriptioon of the icon.
*/
public ThumbnailAction(Icon photo, Icon thumb, String desc){
displayPhoto = photo;

// The short description becomes the tooltip of a button.
putValue(SHORT_DESCRIPTION, desc);

// The LARGE_ICON_KEY is the key for setting the
// icon when an Action is applied to a button.
putValue(LARGE_ICON_KEY, thumb);
}

/**
* Shows the full image in the main area and sets the application
title.
*/
public void actionPerformed(ActionEvent e) {
photographLabel.setIcon(displayPhoto);
setTitle("Icon Demo: " +
getValue(SHORT_DESCRIPTION).toString());
}
}
}

 del.icio.us  Stumbleupon  Technorati  Digg 

Storing Temporary Data : VB.NET & ASP.NET in DataTable & GirdView

Storing Temporary Data : VB.NET & ASP.NET : Using DataTable & GirdView


step 1:Create Temporary DataTable &
Add a GridView control, two lable controls, three textbox controls and
button control in the page .

Private Function CreateTempDataTable() As DataTable
Dim myDataTable As DataTable = New DataTable()

Dim myDataColumn As DataColumn

myDataColumn = New DataColumn()
myDataColumn.DataType = Type.GetType("System.String")
myDataColumn.ColumnName = "id"
myDataTable.Columns.Add(myDataColumn)

myDataColumn = New DataColumn()
myDataColumn.DataType = Type.GetType("System.String")
myDataColumn.ColumnName = "username"
myDataTable.Columns.Add(myDataColumn)

myDataColumn = New DataColumn()
myDataColumn.DataType = Type.GetType("System.String")
myDataColumn.ColumnName = "firstname"
myDataTable.Columns.Add(myDataColumn)

myDataColumn = New DataColumn()
myDataColumn.DataType = Type.GetType("System.String")
myDataColumn.ColumnName = "lastname"
myDataTable.Columns.Add(myDataColumn)

Return myDataTable
End Function

Step 2:

Private Function PoputlateDataTable(ByVal username As String, ByVal
firstname As String,

ByVal lastname As String, ByVal myTable As DataTable)
Dim row As DataRow

row = myTable.NewRow()

row("id") = Guid.NewGuid().ToString()
row("username") = username
row("firstname") = firstname
row("lastname") = lastname

myTable.Rows.Add(row)
End Function



Now call the PopulateDataTable Function :

Private Sub Some ClickEvent_XXX()

If txtUserName.Text.Trim() = "" Then
Me.lblTips.Text = "You must fill a username."
Return
Else
AddDataToTable(Me.txtUserName.Text.Trim(), Me.txtFirstName.Text.Trim(),

Me.txtLastName.Text.Trim(), CType(Session("myDatatable"), DataTable))

Me.GridView1.DataSource = CType(Session("myDatatable"),
DataTable).DefaultView

Me.GridView1.DataBind()

Me.txtFirstName.Text = ""
Me.txtLastName.Text = ""
Me.txtUserName.Text = ""
Me.lblTips.Text = ""
End If

End Sub



Important Note:

Please note that "Session["myDatatable"] = myDt;" is important to ensure we
can add new data

continually until the page be closed.


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles

Me.Load
If Me.IsPostBack = False Then
myDt = New DataTable()
myDt = CreateTempDataTable()
Session("myDatatable") = myDt

Me.GridView1.DataSource = (CType(Session("myDatatable"),
DataTable)).DefaultView
Me.GridView1.DataBind()
End If
End Sub

 del.icio.us  Stumbleupon  Technorati  Digg 

Blog Software