Sharing With Passion

July 14, 2012

Posted by Sabar Santoso in , , | July 14, 2012 No comments


C is a high-level imperative programming language, which characteristically provides a very close correspondence between high-level language statements and machine-language instructions. It was initially developed in the 1970s, being primarily used for systems programming, most notably for the implementation of the Unix operating system. In the 1980s its popularity broadened massively, coming into use in some form on almost all computing platforms, and it remained popular throughout the 1990s.

Two versions of C have been standardized, in 1989 and 1999. It has also spawned a profusion of dialects and descendant languages, most notably C++. Because of C's enormous popularity, parts of its syntax have also been adopted for inter-human communication among programmers.

More detailed information follows, organized into sections thus:

  • History: origins of the language, and mainline development through standardization
  • Dialects: relationship to other languages in the C language family
  • Technical aspects: notable technical aspects of C
  • References: further sources of information

History

The initial developments towards C occurred on the nascent Unix operating system in 1969. When the need was felt for a system programming language, Unix co-inventor Ken Thompson designed and implemented the language B, derived from BCPL, which is the descendent of CPL, and ultimately of Algol 60. The name "B" was chosen as the first letter of "BCPL". Like BCPL, B is a typeless word-oriented language, and B inherits BCPL's block structure. However, B had to be stripped down to fit into the DEC PDP-7 on which Unix was being developed. Its syntax is therefore largely novel, and very terse.

In 1970, the Unix project moved to the DEC PDP-11, a byte-oriented machine. Although B was ported to the PDP-11, its architectural assumptions made it an inconvenient language to use. Starting in 1971, Unix co-inventor Dennis Ritchie extended the B language to support bytes as well as words. The later addition of structures, more conventional array semantics, and later generalizations of the type system, yielded the earliest incarnation of C. Ritchie deliberately left unanswered the question of whether the name "C" was chosen as the next letter of the alphabet after "B" or as the next letter of "BCPL".

The remainder of C's most formative development occurred in 1972-1973, and in 1973 Unix itself was finally rewritten in C. Further development, primarily in the type system, occurred up to 1980. During this period, an intermediate version of the language was described in the book "The C Programming Language". This version of the language became a de facto standard, named "K&R C" after the authors of the book, Brian Kernighan and Dennis Ritchie.

During the 1980s, C compilers spread widely, and C became an extremely popular language. The previously largely unaddressed issues of portability that this raised, and the deficiencies of the K&R standard (which was already out of date), led to an observed need for more formal standardization. An ANSI standardization effort, from 1983 to 1989, led to a formal standard, ANSI X3.159-1989, which was subsequently adopted by ISO as ISO/IEC 9899:1990.

The 1989 standard went slightly beyond codifying the language already in use, by continuing the language development a little, in particular making the type system more complete. The resulting "ANSI C" or "C89" dialect was progressively adopted during the early 1990s, so that by around 1995 K&R C was viewed as a historical artifact, rather than as a current language.

A second round of standardization, starting in 1995, developed the language further, principally by adding syntactic features for the convenience of programmers. This resulted in the "C99" standard, ISO/IEC 9899:1999, which to date (2001) has yet to make any significant impact.


Dialects

The mainline C dialects (K&R C, ANSI C and C99) are discussed in the history section. Although most C compilers have always made a handful of changes to the C language that they implement, few such dialects have gained significance in their own right. One of the few, and probably the most significant current non-standard C dialect, is GNU C, which is the C implemented by the GCC C compiler. Although, like other compiler-specific dialects, many of its features are tied to the internals of the compiler, it has anticipated or even originated some of the features of C99, such as variable length arrays and the long long type.

There is also a large group of languages derived from C. Because of C's familiarity and the ease of access to compilers, it has been used as the basis for many experimental and some non-experimental projects in adding specialized features to an existing general purpose language. A few such projects have grown to the status of being independent languages. There are also some true descendant languages, that do not maintain compatibility with C. In approximate chronological order, here are the most significant of both types of descendant:

  • C++ is an object-oriented programming language directly descended from C. Its initial development by Bjarne Stroustrup occurred in the early 1980s, and consisted of some simple additions to the C language to make the handling of basic class structures with member functions and polymorphism easier. Parts of C++'s cleaning up of C syntax influenced C's 1989 standardization, and the developments made in the C standard were in turn adopted into C++. C++ was itself standardized in 1998, and developments continue to pass in both directions between the two languages. The C and C++ standardization committees now actively cooperate to maintain as much compatibility as possible between the languages.
  • Objective C is an object-oriented descendant of C that uses a Smalltalk-derived message-passing paradigm. It was developed by Brad J. Cox starting in the early 1980s. Since then, Objective C has adopted changes made to mainstream C, and has had some independent developments in its object oriented features. There is also a variant, Objective C++, which incorporates C++'s features. Objective C remains a distinct branch of the C family tree, not quite independent of C, implemented in environments that also handle C.
  • Concurrent C, developed by Narain Gehani and William Roome starting in the mid-1980s, is an extension of C that builds multiprocessing into the language. Much like Objective C, its essence is a set of additions to the C language, rather than being a completely separate language, such that Concurrent C++ has been formed by merging Concurrent C with C++.
  • Alef is a distinct language from C, but in origin is a direct descendant. It is intended for much the same type of use as C; it is the system programming language for Plan 9, a derivative of Unix. Alef replaces C's type system, and adds some concurrency features.
  • Java is an object-oriented language descended from C; it has been described as having Objective C's semantics with C++'s syntax. It is not a traditional compiled language like the more closely related C variants, but rather is a fully safe language, with automatic memory management. It was developed by James Gosling starting in 1991, and after its public release in 1995 it rapidly became very popular for certain types of programming. Current development is still led by Sun Microsystems Inc., Gosling's employer.

Technical Aspects

C is a high-level imperative programming language, designed to be statically compiled into machine code for byte-oriented architectures. Many of its basic features are typical of languages in this class. For example, expressions and variables are strongly and statically typed; there is strictly lexical scoping with no function closures; dynamic storage allocation is entirely manual; and there are many details of the language semantics that vary with the target architecture, for efficiency.
There is also much about C that is atypical. The following paragraphs discuss C's unusual or original features.


C is, at its core, a fairly small language, due to its origin in very small computers. Because of its closeness to the machine, it is easily implemented, with C code naturally compiling into a very similar amount of machine code. There are no I/O primitives in the language itself; all interaction with the environment is relegated to a library of separately compiled functions. All of these aspects make it well suited to embedded computing, where it is indeed very popular.


Because so little is built into the language itself, those operators that are part of the language are reused for many purposes. The composition of complex data types from a handful of basic data types that are native to the target architecture is very transparent. The language gives a number of partial guarantees about the representation of certain data types, and the relationships between them, allowing the programmer to implement many operations by direct manipulation of bits in memory, essentially using the C language as a portable machine language. The language imposes few restrictions to impede the programmer in doing such things, and there is a history of lax enforcement by compilers of the official restrictions.


A particularly notable area in which C promotes direct manipulation of data structures is arrays. C guarantees that arrays are laid out contiguously, and so has remarkably flexible array handling, due to the flexibility of its pointer handling and direct memory manipulation. In fact, for historical reasons, even very basic array operations require the use of pointers; array indexing, for example, is made up of pointer arithmetic, with only a little syntactic sugar.


C has flow control primitives mostly typical of languages in its class, with the block structuring derived from BCPL. It includes the goto of imperative languages; it is not strictly necessary, due to the code structuring capabilities, but its use is not as controversial among C programmers as it is among, for example, programmers of Pascal-derived languages. Unusually for its class, though, C has no for loop in the conventional sense; it instead has some syntactic sugar for a while loop, leaving loop counter advancement for the programmer to specify.


Another unusual flow control feature of C is the relatively unstructured nature of its switch statement (its version of what is usually referred to as a case statement). Instead of selecting between alternative code sequences to execute, it selects between a set of labels to jump to; while in syntax it looks much like a conventional case statement, its semantics are more akin to the `computed goto' of FORTRAN. Full use of this facility is controversial, as particularly noted in the case of the infamous `Duff's device', which uses the freedom in label placement to interleave the structures of a switch statement and a while loop.


Another noted feature of C's syntax is its declarations, which avoid requiring additional keywords to describe pointers, arrays, and functions, by reusing the syntax for dereferencing pointers, indexing arrays, and calling functions. A C declaration consists of a base type and a `declarator', which gives the name of the object being declared and the means of deriving its type from the base type, in the approximate form of an expression involving the named object and having the type of the declared base type. This feature originated early in C's development, when multiply-derived types were added to the language, and is one of the features consistently copied in languages derived from C.

References

  • Brad J. Cox and Andrew J. Novobilski, "Object Oriented Programming: An Evolutionary Approach (second edition)", Addison-Wesley, 1991
  • N. H. Gehani and W. D. Roome, "The Concurrent C Programming Language", Silicon Press, 1989
  • B. W. Kernighan and D. M. Ritchie, "The C Programming Language", Prentice-Hall, 1978
  • B. W. Kernighan and D. M. Ritchie, "The C Programming Language (second edition)", Prentice-Hall, 1988
  • D. M. Ritchie, "The Development of the C Language", ACM, 1993
  • Bjarne Stroustrup, "The C++ Programming Language (second edition)", Addison-Wesley, 1991
  • Bjarne Stroustrup, "The Design and Evolution of C++", Addison-Wesley, 1995

July 09, 2012

Posted by Sabar Santoso in , , , | July 09, 2012 No comments

The Java Swing provides the multiple platform independent APIs interfaces for interacting between the users and GUIs components. All Java Swing classes imports form the import javax.swing.*; package. Java provides an interactive features for design the GUIs toolkit or components like: labels, buttons, text boxes, checkboxes, combo boxes, panels and sliders etc. All AWT flexible components can be handled by the Java Swing. The Java Swing supports the plugging between the look and feel features. The look and feel that means the dramatically changing in the component like JFrame, JWindow, JDialog etc. for viewing it into the several types of window.
Here the following APIs interfaces and classes are available:
The following interfaces and it's descriptions to be used by the Java swing.
Interfaces
Descriptions
ActionThis interface performed the action with the ActionListenerwhere the multiple controls are used for same purposes.
BoundedRangeModelThis interface defines the data model of components like: sliders and progressBars.
ButtonModelIt defines the state model for the buttons like: radio buttons, check boxes etc.
CellEditorThis interface used by the developer for creating the new editor and it has the new components implement interfaces. TheCellEditor implements the wrapper based approach.
ComboBoxEditorIn this interface, the editor component used to JComboBoxcomponents.
ComboBoxModelThis interface represents the data model in a list model with the selected items.
DesktopManagerThis interface has JDesktopPane object. The JInternalFrameimplements in the JDesktopPane with the help of DesktopManager.
IconThis interface used to graphical representation of the components. It has fixed size picture.
JComboBox.KeySelectionManagerThis interface has KeySelectionManager and used for the combo box data model.
ListCellRendererThis interface used for paint the cell in the list with the help of "rubber stamps" .
ListModelThis interface used for JList components method. It gets the value of each cell of list.
ListSelectionModelThis interface indicates the components, which are stable or not.
MenuElementThis interface used where the any components are implements in the menu.
MutableComboBoxModelThis interface extends from the ComboBoxModel. It is a mutable version of ComboBoxModel.
RendererIt defines the requirements of an object for displaying the values.
RootPaneContainerThis interface uses the RootPane properties and it has the components like: JFrame, JInternalFrame and JWindow etc.
ScrollableThis interface provides the scrolling to show the large amount of data with the help of JScrollPane.
ScrollPaneConstantsThis interface used for JScrollPane components.
SingleSelectionModelThis interface used to select the one index in a model.
SwingConstantsYou can set the components on the screen to own requirements.
UIDefaults.ActiveValueIt constructs the DefaultListCellRenderer.
UIDefaults.LazyValueThis enables one to store an entry in the default table. The entered value is not constructed until first time is a real value is created through it using LazyValue.createValue() method.
WindowConstantsThis interface has two methods setDefaultCloseOperation and getDefaultCloseOperation and provides the window close opration.
The following classes and it's descriptions to be used by the Java swing.
Classes
Descriptions
AbstractActionThis class handles the any types of action and provides JFC Action interface.
AbstractButtonThis class defines the nature of buttons and menu items.
AbstractCellEditorIt provides a list and contents of the data model.
AbstractListModelThis class defines the data model which provides the list with its contents.
ActionMapThis class works with InputMap and performs any action when the key is pressed.
BorderFactoryThis class extends from Object and creates the Border instance in the factory.
BoxIt provides the fixed spaces between two components and uses the BoxLayout object of the layout manager.
Box.FillerThis class participates in the Layout and uses the lightweight components.
BoxLayoutThis class uses the arranging the multiple components either horizontally or vertically. The Box container uses this class.
ButtonGroupThis class used to create the multiple buttons in aButtonGroup object.
CellRandererPaneThis class used to insert the components like: JList, JTable and JTree.
ComponentInputMapThis class has ComponentInputMap constructor and creates the components with the help of InpuMap.
DebugGraphicsIt extends from the Graphics and used to debug the graphics
DefaultBoundedRangeModelThis class provides the implementation of default BoundedRangeModel.
DefaultButtonModelThis class implements the generic ButtonModel.
DefaultCellEditorIt implements the TableCellEditor and TreeCellEditor for the table and tree cells.
DefaultComboBoxModelIt provides the default model for combo boxes.
DefaultDesktopManagerIt implements the DesktopManager. The DesktopManager has the JInternalFrame for creating the internal fame in a frame.
DefaultFocusManagerIt provides the implementing the FocusManager.
DefaultListCellRandererIt implements the default ListCellRanderer.
DefaultListCellRanderer.UIResourceThis extends the DefaultListCellRanderer and implementing in the UIResource.
DefaultListModelIt extends the AbstractListModel and implementing thejava.util.Vector.
DefaultListSelectionModelThis class used for select the list in a data model.
DefaultSingleSelectionModelThis class provides the default SingleSelectionModel.
FocusManagerIt handles all focus like: gainedFocus and lostFocus.
GrayFilterIt extends the RGBImageFilter and used for disabling the image through the button.
ImageIconThis class implements the Icon and paints the icons from the images.
InputMapThis class uses the ActionMap to performed the action when you press any key of keyboard. It bounds data between the input event and an object.
InputVerifierThis class helps you when you works with the text fields through the focus.
JAppletThis class extends the Applet and implements the Accessibleand RootPaneContainer.
JButtonThis class extends the AbstractButton and you can create the new button.
JCheckBoxThis class extends the JToggleButton and implements the check box in which buttons are selected or deselected.
JCheckBoxMenuItemIt extends the JMenuItem and determines the items which is selected or deselected.
JColorChooserIt extends the JComponent and implementing the Accessable. Here, you choose and manipulate the colors.
JComboBoxThis class extends the JComboBox. It provides the drop-down list where user select only one item or value at a time. But combo box is a combination of multiple text or buttons etc.
JComponentIn java swing, All components are used the JComponent except the top-level containers like: JFrame, JDialog etc.
JDesktopPaneThis class extends the JLayeredPane and when you create the object of JInternalFrame to be maintained in the JDesktopPane. The JDesktopPane has DesktopManager.
JDialogIt extends the Dialog. This class used to create the dialog window and when you want to create the custom dialog window with the help of JOptionPane method.
JEditorPaneThis class extends the JTextComponent. It edits the component by the EditorKit.
JFileChooserThis class provides the facility to choosing the file.
JFrameIt extends the Frame and supports the swing components architecture.
JInternalFrameThis class extends from the JComponent and provides the facility to dragging, closing, resizing and menu bar of the internal frame. The JInternalFrame added into the JDesktopPane.
JInternalFrame.JDesktopIconIt displays the desktop icon and create the instance of JInternalFrame and iconify.
JLabelThis class used to show the small text and image.
JLayeredPaneIt has JFC/Swing container that can be used to overlap the components to each other.
JListThis class used to create a list where you select the one or more than objects.
JMenuThis class used to create a new menu where you add the JMenuItems. When you select the item then shows the popup menu items in the JMenuBar.
JMenuBarIt used to create a new menu bar where the JMenu objects are added.
JMenuItemThis class used to create new menu items in the mebus.
JOptionPaneIt used to create some different types of dialog box like: message dialog box, error dialog box etc.
JPanelIt extends the JComponent and used to create a new panel.
JPassworkFieldIt provides the single line text editing. Here, don't available the original characters but view type indication characters are available.
JPopupMenuThis class used to create a popup menu. It provides small window where the various types of choices are available.
JPopupMenu.SeparatorHere the popup menu and the separator are available.
JProgressBarIt shows the integer types values in percent within a bounded range to determine the working process.
JRadioButtonIt implements the radio button and shows the state of an item selected or deselected.
JRadioButtonMenuItemIt extends the JMenuItem and implements the radio button menu item
JRootPaneThis class provides the component behind the scenes by JFrame, JWindow, JDialog etc. for providing the task-orientation and functionality.
JScrollBarThis class used to create a scroll bar. It provides the view content area where you show the content to scroll this.
JScrollPaneIt provides the scrollable view components.
JSeparatorThis class use the separator among the components.
JSliderThis class provides a control to represent a numeric value by dragging the slider.
JSplitPaneThis class used to divides the two components graphically like: top and button, left and right.
JTabbedPaneThis class provides the tab component through which you can switch from one component to another component regarding to the specific tab button by clicking on that.
JTableIt provides the user interface component and represents the two dimensional data.
JTextAreaIt provides the multi line plain text area.
JTextFieldIt provides the facility to editing the text in a single line.
JTextPaneThis class provides the component like JTexArea for multiple lines text with more capabalities.
JToggleButtonIt implements two state button that means selected or deselected.
JToggleButton.ToggleButtonModelIt extends the DefaultButtonModel and provides theToggleButton model.
JToolBarIt provides set of command buttons icons that performs the different actions or controls.
JToolBar.SeparatorIt provides the tool bar separator.
JToolTipIt shows the tool tips related to it's components.
JTreeIt shows the data in a hierarchical way.
JTree.DynamicUtilTreeNodeThis extends the DefaultMutableTreeNode and create children nodes.
JTree.EmptySelectionModelIt does not allows the any selection.
JViewPortIt gives you about the underlying information.
JWindowIt extends window and shows the any location or area on the desktop. It couldn't any title bar and window management buttons.
KeyStrokeThis class controls the key events on the keyboard for the equivalent device.
LayoutFocusTraversalPolicyThis class conducts the sorting objects according to their size, type, position or orientation.
LookAndFeelIt provides the dramatically changes in the component like frame related to the graphics for the application. Through this the application can be done very efficient and easier.
MenuSelectionManagerIt has menu selection hierarchy.
OverlayLayoutThe layout manager arrange the components.
ProgressMonitorThis class is used to monitoring the progress of any operation to be done.
ProgressMonitorInputStreamThis class creates a progress monitor to monitor the progress of reading input from the input stream. It cleanups all the rights when the stream is closed.
RepaintManagerThis class manage and override the repaint requests.
ScrollPaneLayoutIt implements the LayoutManager and manage the components like: scroll bar, row header, column header etc.
ScrollPaneLayout.UIResourceIt extends the ScrollPaneLayout and implements theUIResource.
SizeRequirementsIt calculates the size and positions of components.
SizeSequenceIt represents the order list of size and it's positions.
SwingUtilitiesThis class has utilities methods for swing.
TimerActions perform the predefined rate.
ToolTipManagerIt manages the all tool tips.
UIDefaultsIt extends the Hashtable and you set/get the value with the help of UIManager.
UIDefaults.LazyInputMapThis class creates a Input Map through it's createValue() method. The array of key after binding is passed to the constructor of this. Example of binding of key is array of pressing key information (e.g. ctrl + c or alt + f).
UIDefaults.ProxyLazyValueThis class is used to create a lazy value which is used to delay loading of the class to create instance for that.
UIManagerThis class has track of the current look and feel details.
UIManager.LookAndFeelInfoThis is the nested class of UIManager class i.e. used for getting information about all the look and feels installed with the software development kit.
ViewportLayoutIt implements the LayoutManager and defines the policy for the layout.


July 08, 2012

Posted by Sabar Santoso in , | July 08, 2012 No comments
Forms are a very common method of interactions in web sites. JSP makes forms processing specially easy.
The standard way of handling forms in JSP is to define a "bean". This is not a full Java bean. You just need to define a class that has a field corresponding to each field in the form. The class fields must have "setters" that match the names of the form fields. For instance, let us modify our GetName.html to also collect email address and age.
The new version of GetName.html is
  
What's your name?
What's your e-mail address?
What's your age?
To collect this data, we define a Java class with fields "username", "email" and "age" and we provide setter methods "setUsername", "setEmail" and "setAge", as shown. A "setter" method is just a method that starts with "set" followed by the name of the field. The first character of the field name is upper-cased. So if the field is "email", its "setter" method will be "setEmail". Getter methods are defined similarly, with "get" instead of "set". Note that the setters (and getters) must be public.
 package user;  public class UserData {
 String username;     
 String email;     
 int age;      
     public void setUsername( String value )     
     {         username = value;     }      
     public void setEmail( String value )     
     {         email = value;     }      
     public void setAge( int value )     
     {         age = value;     }      
     public String getUsername() 
     { return username; }      
     public String getEmail() 
     { return email; }      
     public int getAge() 
     { return age; }
}
The method names must be exactly as shown. Once you have defined the class, compile it and make sure it is available in the web-server's classpath. The server may also define special folders where you can place bean classes, e.g. with Blazix you can place them in the "classes" folder. If you have to change the classpath, the web-server would need to be stopped and restarted if it is already running.
Note that we are using the package name user, therefore the file UserData.class must be placed in a folder named user under the classpath entry.
Now let us change "SaveName.jsp" to use a bean to collect the data.
All we need to do now is to add the jsp:useBean tag and the jsp:setProperty tag!  The useBean tag will look for an instance of the "user.UserData" in the session.  If the instance is already there, it will update the old instance.  Otherwise, it will create a new instance of user.UserData (the instance of the user.UserData is called a bean), and put it in the session.
The setProperty tag will automatically collect the input data, match names against the bean method names, and place the data in the bean!
Let us modify NextPage.jsp to retrieve the data from bean..
    You entered
Name: <%= user.getUsername() %>
Email: <%= user.getEmail() %>
Age: <%= user.getAge() %>
 
Notice that the same useBean tag is repeated. The bean is available as the variable named "user" of class "user.UserData". The data entered by the user is all collected in the bean.
We do not actually need the "SaveName.jsp", the target of GetName.html could have been NextPage.jsp, and the data would still be available the same way as long as we added a jsp:setProperty tag. But in the next tutorial, we will actually use SaveName.jsp as an error handler that automatically forwards the request to NextPage.jsp, or asks the user to correct the erroneous data.
Exercise:
1) Write a JSP/HTML set that allows a user to enter the name of a system property, and then displays the value returned by System.getProperty for that property name (handle errors appripriately.)
2) Go back to the exercises where you manually modified boolean variables. Instead of a boolean variable, make these come from a HIDDEN form field that can be set to true or false.

July 07, 2012

Posted by Sabar Santoso in , , | July 07, 2012 No comments
What Is RSS?
RSS is a format used by content providers to publish content. Originally, RSS stood for Rich Site Summary, but with the release of the RSS 2.0 spec in 2002, the name was changed to Really Simple Syndication.
RSS simplifies publishing by providing a standardized, no-frills approach to releasing content. No formatting is included with an RSS entry; only the content is sent. This allows for RSS aggregators,commonly referred to as feed readers, to accept and display RSS feeds from any number of sites in a uniform, easy-to-read manner.
The RSS format is built in XML, which learn more about in the next section. For a history of RSS, visit this article: http://en.wikipedia.org/wiki/RSS.


What Is XML?
XML stands for Extensible Markup Language. In the context of programming, extensible means that the developer can define the markup elements. This might sound odd, but it’s actually incredibly useful.
XML is, on a basic level, extremely simple. In a parallel with HTML, XML information is enclosed in tags; however, you can name the tags anything you want, and these tags are basically labels for the enclosed information.
For example, assume you want to send personal information about someone via XML. The markup might read as follows:

Jason
24
male

The benefit of XML is that it’s easy to read. Take another look at the information in the preceding example—you don’t need to be an XML expert to understand what the markup means. In the next section, you’ll learn how RSS uses XML to syndicate content.

Creating an RSS Feed
RSS feeds follow a general format that allows for large-scale, easy compatibility with any feed reader in use right now. The basic format for an RSS consists of a channel that includes a title, description, link, and language setting. Within the channel, you declare each entry as an item. Each item contains a title, description, link, the date it was published, and a unique identifier.

To create your feed, you need to create a new folder and file in the simple_blog project. Next, add a new folder called feeds, and then create a new file called rss.php and in that folder (the full path: http://localhost/simple_blog/feeds/rss.php).

Before you can run your file, you need to modify .htaccess. This is as simple as adding an additional file extension to the first RewriteRule that prevents any rewrite from occurring if a file ending in .php is accessed. To accomplish this, add the following line in bold to your .htaccess file:

RewriteEngine on
RewriteBase /simple_blog/

RewriteRule \.(gif|jpg|png|css|ico|swf|js|inc\.php|php)$ - [L]
RewriteRule ^admin/?$ admin.php [NC,L]
RewriteRule ^admin/(\w+)/?$ admin.php?page=$1 [NC,L]
RewriteRule ^admin/(\w+)/([\w-]+) admin.php?page=$1&url=$2 [NC,L]
RewriteRule ^(\w+)/?$ index.php?page=$1
RewriteRule ^(\w+)/([\w-]+) index.php?page=$1&url=$2


Describing Your Feed
Now that your file is created and being handled properly, you can start to mark up your feed.
Begin by adding a Content-Type header to the document (using the aptly named header() function). This header tells the browser to serve the file as XML.

Next, you need to output an XML declaration. However, this causes issues because XML declarations conflict with PHP short tags. You can get around this by using the echo command to output the declaration in double quotes, which eliminates the conflict.

Now you need to state what you are doing, which you accomplish by adding an tag with a version attribute. This tells any feed reader what it’s receiving and ensures the information received is handled properly.

Next, you add the channel declaration and your feed’s basic information. As mentioned previously, the basic information consists of the title, description, link, and language of your feed. Add the following code to rss.php to create your feed:

// Add a content type header to ensure proper execution header('Content-Type: application/rss+xml');
// Output the XML declaration echo "\n";
?>
My Simple Blog
http://localhost/simple_blog/
This blog is awesome.
en-us

At this point, you can load your RSS feed in a browser to see what it looks like without any items; you can load the information at http://localhost/simple_blog/feeds/rss.php


Note : You don’t want to do anything further with the feed as it appears in your browser. The blog is not available publicly, so subscribing to the feed won’t work in a feed reader at this time.

Posted by Sabar Santoso in , | July 07, 2012 No comments
PHP adalah bahasa scripting yang menyatu dengan HTML dan dijalankan pada server side. Artinya semua sintaks yang kita berikan akan sepenuhnya dijalankan pada server sedangkan yang dikirimkan ke browser hanya hasilnya saja.

Shcema
Dalam Oracle database hanyalah satu, yaitu dibuat pada waktu kita menginstal oracle,kemudian
dibagi menjadi schema atau user.
Cara membuat schema dalam oracle adalah sebagai berikut :
· Buka Oracle manager console kemudian Login database.
· Pilih schema cemudian lihat jendela windows bagian kanan dan pilih create.
· Pilih user dan klik
· Masukkan name(nama schema/user yang di inginkan) dan password.
· Kemudian klik Role dan pilih : Aq_Administrator_Role,Aq_user_Role dan DBA.
· Klik System dan pilih : Administer Databese Trigger dan Administer Resource Manager
· Kemudian klik create.
· Buka TOAD dan login menggunakan User/Schema yang baru di buat.
· Jika Sukses maka pembuatan user/schema telah sukses.

Membuat Tabel :
create table anggota
(
id_anggota integer not null,
nama varchar(30),
alamat varchar(40),
telp integer,
email varchar(30),
komentar long,
primary key (id_anggota)
);

Mengisi data kedalam Tabel :
insert into anggota (id_anggota,nama,alamat,telp,email,komentar)
values ('1','Andi','Jl.Buduran','0318875442','andi@yahoo.com','nyoba inputkan database');

Update Data dalam Tabel :
update anggota set nama='apank' where id_anggota='1';

Delete Data dalam tabel :
delete from anggota where id_anggota='1';

Koneksi PHP dan ORACLE :
Cari file php.ini dalam directori C:\WINDOWS, kemudian tambahkan Script berikut dalam file tersebut :
extension=php_oci8.dll
extension=php_oracle.dll
Buat file koneksi dengan nama Koneksi.inc.php yang Isinya :

$db = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=codename) (PORT=1521)))
(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=Nama_database)))" ;
$c1 = ocilogon("nama_user ","password",$db) ;
?>

Buat Satu file dengan nama coba.php, yang Isinya :

include "koneksi.inc.php";
$kode="select * from anggota";
$stmt=OCIParse($c1,$kode);
OCIExecute($stmt);
while(OCIFetchInto($stmt,$row))
{ echo"Id Anggota :
$row[0]";
echo"Nama : $row[1]";
echo"Alamat : $row[2]";
echo"Telp : $row[3]";
echo"E-mail : $row[4]";
echo"Komentar : $row[5]
?>

Jika koneksi dari PHP ke Database Oracle berhasil, maka pada browser akan muncul tampilan seperti pada gambar dibawah ini :














July 01, 2012

Posted by Sabar Santoso in , | July 01, 2012 No comments
Photobucket


Dalam mempelajari bahasa pemrograman, sudah semestinya kita juga mengetahui, kira-kira bahasa pemrograman yang saat ini paling banyak digunakan oleh para programmer didunia itu apa sih..?

Pada akhir Juni, ternyata bahasa pemrograman yang paling populer adalah C, kemudian java pada urutan ke dua yang sebelumnya menduduki ururtan pertama.

Untuk mengetahuinya anda bisa mengunjungi website ini : http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html




Search

Bookmark Us

Delicious Digg Facebook Favorites More Stumbleupon Twitter