2017-03-30

php database connection example

php connect to mysql database, oracle database


  1. <?php 
  2. @$dbcnnct = mysql_connect("localhost", "username", "password");
  3. if(!$dbcnnct)
  4. {
  5. echo "could not connect";
  6. }
  7. @$db=mysql_select_db("project");
  8. if(!$db)
  9. {
  10. echo "could not select";
  11. }

  12. $sql = mysql_query("SELECT * FROM country ");
  13. if(!$sql)
  14. echo "error==".mysql_error($sql);
  15.         while($row = mysql_fetch_array($sql))
  16.         {
  17.             
  18. echo ("$row[table column name]");
  19.         }

  20. @$dbcls = mysql_close($dbcnnct);
  21. ?>


Java Socket Programming (Java Networking Tutorial)

Java Socket Programming using swing. instant messaging program.

Server




  1. import java.io.*;
  2. import java.net.ServerSocket;
  3. import java.net.Socket;

  4. import javax.swing.*;

  5. import java.awt.*;
  6. import java.awt.event.*;
  7. public class server extends JFrame
  8. {
  9. private JTextField userText;
  10. private JTextArea chatWindow;
  11. private ObjectOutputStream output;
  12. private ObjectInputStream input;
  13. private ServerSocket servers;
  14. private Socket connection;

  15. public server()
  16. {
  17. super("Chat Messenger");
  18. userText=new JTextField();
  19. userText.setEditable(false);
  20. userText.addActionListener(
  21. new ActionListener(){
  22. public void actionPerformed(ActionEvent event){
  23. sendMessage(event.getActionCommand());
  24. userText.setText("");
  25. }
  26. }

2017-03-23

Recursion

What is Recursion?

            A function calls itself is called recursion. Recursion is a useful technique. it is shorter and easier to write.


Example:

Factorial problems using Recursion.

      Java
  1. int fact(int n){
  2.      if(n==1)
  3.         return 1;
  4.      else if(n==0)
  5.         return 1;
  6.      else return n*fact(n-1)
  7. }
  8. fact(5)


     Python
  1. def fact(n):
  2.       if n==0:
  3.           return 1
  4.       return n*fact(n-1)
  5. print(fact(5))
    

2017-03-21

How to determine time complexity of an algorithm

      There are some general rules to determining the running time of an algorithm.
Below are few Example

Loops


      The running time of a loop at most, the running time of the statements inside the loop multiplied by the number of iterations.


for (i=0; i<=n; i++) 
{
 total = total + 1;   // constant statement 'c'
}

Total time =  constant x n = c x n = O(n)

Nested loops


 Total running time of the sizes of all the loops(inside to out).

//outer loop executed n times
for (i=1; i<=n; i++) {
      // inner loop executed n times 
       for (j=1; j<=n; j++) 
       {
             k = k+1; //constant time 'c'
        } 
}

Asymptotic Notation

                       Asymptotic Notation is a concept of analysis Algorithms for best case, average case and worst case. For all the three cases we need to identify the upper bound, lower bounds using syntax and Notation .

Big-O Notation



This notation gives the tight upper bound of the given function.

In general we represent algorithm in the form of function f(n)

f(n)= O(g(n))

This means, for larger values of n, The  upper bound of f(n) is g(n).

For example, if algorithm is given
f(n)=n2+10n+5
Then n2 is g(n), g(n) gives the maximum rate of growth for f(n) at larger values of n.

2017-03-20

Data Structures

Data Structures


A data structure is a special structure or format for organize and storing data. Data structure is a way of storing, organizing and manipulating data in a computer.

In General data structures includes concepts like array, file, list, stack, queue, tree, graph etc.

Data structures are classified into two types:

             Linear Data structures:
                      Elements are accessed in a sequential order.
Example: Arrays, Linked List, stacks, queues
             Non- Linear data structures:
                        Example:: Trees , graphs

2017-03-17

IBM sterling commerce tutorial

What is a hub?
  • Hub is the center of the organization. there can be only one hub for the entire business.
What is an enterprise?
  • Enterprise are modeled as high as possible in organization structure. They define business rules, they control the business rules. Enterprise has highest priority ,follow different business rules, then they are configured as a separate Enterprise. Enterprises can inherit the default configuration from hub.
What are document types?
  • Document type is used to carry the business rules throughout the workflow. An administrator can create a new document Type. 
          Process Type level attributes
                     Status inventory Types
                     Modification Types
                     Modification rules
                     Transactions
                     Transaction pick up status
                     Transaction drop status 
                     Events

Order Management System, Process and Allocation

Sourcing Rules 

Sourcing Rules are the Set ups for determining the nodes from which a product can be sourced for Delivery to the customer.

Scheduling Rules 

Scheduling Rules are the Set Ups used  to determine “How an Item Needs to be shipped to a customer”

How to create article in wikipedia

If you want to create a article/page in Wikipedia follow this step.

               

  •           If the article is already present it will ask you to EDIT
  •           If the article is not present then it will ask you to create 

      

  •           Click on the name of the article you have entered
  •           It will ask you to login 
                           

2017-03-16

Compare XML using Java

It is developed specially for the SOAP service xml request and response where you can compare according to names and also you can Find the Difference in values.Refer Below code,


  • Compare two xml files.
  • By Using Difference method you can Get the Difference in values.
  • It Also Comapres XML Bi-Directional. 



  1. package com.example.Test;

  2. import java.io.File;
  3. import java.io.IOException;
  4. import java.util.ArrayList;
  5. import java.util.Collection;
  6. import java.util.HashSet;
  7. import java.util.List;
  8. import java.util.Set;

  9. import javax.xml.parsers.DocumentBuilder;
  10. import javax.xml.parsers.DocumentBuilderFactory;
  11. import javax.xml.parsers.ParserConfigurationException;

  12. import org.custommonkey.xmlunit.DetailedDiff;
  13. import org.custommonkey.xmlunit.Difference;
  14. import org.custommonkey.xmlunit.XMLUnit;
  15. import org.w3c.dom.Document;
  16. import org.w3c.dom.Element;
  17. import org.w3c.dom.NamedNodeMap;
  18. import org.w3c.dom.Node;
  19. import org.w3c.dom.NodeList;
  20. import org.xml.sax.SAXException;

2017-03-14

Ping Error Message - Destination Net Unreachable

Destination Net Unreachable


If your computer is connected a router or a shared network, and you are requesting for PING from your computer. Your computer fail to find the network destination / IP and your computer will get "Destination net Unreachable" error message.

CMD
---------------------------------------------------------------------------------------------------------------
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2017 Microsoft Corporation.  All rights reserved.

C:\Users\xyz>ping 1.2.3.4

Pinging 1.2.3.4 with 32 bytes of data:
Reply from 192.168.0.129: Destination net unreachable.
Reply from 192.168.0.129: Destination net unreachable.
Reply from 192.168.0.129: Destination net unreachable.
Reply from 192.168.0.129: Destination net unreachable.

Connection pooling in java example with oracle

  • Oracle connection pool example
  • Java connection pooling
  • Oracle database connection with JDBC
  • Implementing  own Connection pooling in Java
  • how to implement connection pooling in java with example

Here we are creating a class and declaring all database information. This call will execute only one time at the program beaning. If you are using Web server, this call will execute one time at the beginning of the server start. 


  1. import java.sql.Connection;
  2. import java.sql.DriverManager;
  3. import java.sql.ResultSet;
  4. import java.sql.SQLException;
  5. import java.sql.Statement;

  6. public class ConnectionPool {
  7. static Connection con;
  8. static Statement st;
  9. static{
  10. try {
  11. Class.forName("oracle.jdbc.driver.OracleDriver");
  12. } catch (ClassNotFoundException e) {
  13. e.printStackTrace();

2017-03-13

Notepad++ regular expression

Notepad++ regular expression


  • How to go to the end of the line.
          Open Notepad++  
                             => press Ctral and F in a same time.
                             => Search mode Regular expression.
                             => enter $ in find box to go to the end of the line.
  • How to go to the start of the line.
          Open Notepad++  
                             => press Ctral and F in a same time.
                             => Search mode Regular expression.
                             => enter ^ in find box to go to the start of the line.

2017-03-12

Delete and Rename a file using VBA

 Delete and Rename a file In VBA macro Excel




  • To Delete a file using VBA script use Kill and a file name.
          Kill "Filename.txt"

  • To Rename a file use Name keyword and old file name and a new File name.
          Name "Old" As "New"

VBA to create a file with utf-8 format

You can create any text or html file or any other file with utf-8 encryption.


  1. Dim TempFile As String
  2.   TempFile = "TempFileName.html"
  3.     Dim fsTrm As Object
  4.     Set fsTrm = CreateObject("ADODB.Stream")
  5. With fsTrm
  6.   .Type = 2             'Stream Type - we want Text Data.
  7.   .Charset = "utf-8"    'Specify Character Set.
  8.   .Open                 'Open the Stream And write Binary data to the Object
  9.   .WriteText "String"
  10.   .SaveToFile TempFile, 2      'Save Binary Data to Disk (Overwrite)
  11. End With

Excel Macros VBA to read data from a file and store into a string Variable

VBA to read data from a file


In this vba script you can read text from Text, HTML, JS and any other file and store into a string variable.



  1. Dim oFSO As Object
  2.     Dim oFS As Object, sText As String

  3.     Set oFSO = CreateObject("Scripting.FileSystemObject")
  4.     Set oFS = oFSO.OpenTextFile(sFile)

  5.     Do Until oFS.AtEndOfStream
  6.         sText = oFS.ReadAll()
  7.     Loop
  8.     FileToString = sText
  9.     
  10.     Set oFSO = Nothing
  11.     Set oFS = Nothing

2017-03-11

ConceptWave tool

Conceptwave is web development tool built in Java.
Earlier Conceptwave was company established in 1984. From 2000, it is part of Ericsson. With web development, it is also used for order management, catalog management. It supports mostly all the database.
1)       It is built in Java and works on hibernate principle. You will code only in Javascript (more specific Object Oriented Javascript).
2)       It is proprietary tool so hard to find tutorial on web. You can use “Help document” comes with tool. 
3)       No idea. Surf Ericsson website.  
4)       Many MNC are using this tool.
5)       Very few developer of this tool so it is in demand J

ConceptWave Order Care Product Suite

ConceptWave Order Care® Product Suite

Order Negotiations (ON):
Provides a highly fl exible, fully customizable order negotiation process that integrates with virtually all back-end systems to speed new services to customers, reduce order errors, and improve flow through. ON capabilities include order entry, telecom sales support, service negotiation, Web/contact center support, customer account management, product data, & front offi ce automation.

Catalog Management (CM):
An intuitive environment allowing the central defi nition of attributes like product features, availability, and bundles. Workfl ow rules can be tied to the product items at the product catalog level. Easily interfaces with downstream systems to manage and fulfi ll complex multi-product
orders.

what is conceptwave?

• Automates manual order and exception handling tasks and system interactions

• Graphical work? How management tools enable end users to rapidly create and confgure processes, business logic, ordering screens, and data models 

• Integrates easily with other systems through XML/JMS/EAI interfaces

• Pre-built service-specic data and How templates minimize implementation costs/timeframes

• Fully web-based, intuitive front end supporting guided order entry and negotiation

About ConceptWave

ConceptWave tool


ConceptWave now part of Ericsson, is a leading provider of customer, product, and order lifecycle management solutions that enable communications service providers to rapidly introduce new market offers and to empower superior customer experience. ConceptWave's unique offer is to provide an end-to-end catalog-driven suite of order fulfillment automation software with ConceptWave Order Care and Rapid CRM. ConceptWave products and solutions enable service providers to address competitive requirements and simplify the management of customers, products, and orders, for any product, on any network, in any market, using any channel.

     ConceptWave tool is order management, catalog management web development tool. ConceptWave tool built in Java and hibernate principle. Many MNC are using this tool for order and product lifecycle management solutions to communications service providers (CSPs).

ConceptWave is headquartered in Toronto with presence in Americas, Europe and Asia.


Specialties

Order Management, Centralized Product & Service Catalog, Rapid Customer Relationship Management

2017-03-06

Understanding Java Singleton with Example

Singleton


Singleton is a design pattern purpose is to control object creation. Which means limiting the number of objects to only one.


Example


  1. public class Singleton {

  2.    private static Singleton singleton = null;
  3.    
  4.    //Private Constructor
  5.    private Singleton() {

  6.    }

  7.    public static Singleton getInstance() {
  8.       if(singleton == null) {
  9.          singleton = new Singleton();
  10.       }
  11.       return singleton;
  12.    }
  13. }


2017-03-01

5G in India

expected 5g launch  in India - Mid 2018

In Fab-2017 Reliance Jio has tied up with Samsung to bring 5G in India. Both the company are working on LTE-Advanced Pro and 5G. The project will be utilizing spectrum in the 850, 1800 and 2300MHz bands. expected 5g speed 1000 Mbps (1gbps).