Friday, 26 October 2018

Get table size (MB) in MySQL

SELECT
  TABLE_NAME AS `Table`,
  ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
  information_schema.TABLES
WHERE
  TABLE_SCHEMA = "sma_blink"
ORDER BY
  (DATA_LENGTH + INDEX_LENGTH)
DESC;

Compare two table structure in MySQL

SELECT column_name,ordinal_position,data_type,column_type FROM
(
    SELECT
        column_name,ordinal_position,
        data_type,column_type,COUNT(1) rowcount
    FROM information_schema.columns
    WHERE table_schema=DATABASE()
    AND table_name IN ('table1','table2')
    GROUP BY
        column_name,ordinal_position,
        data_type,column_type
    HAVING COUNT(1)=1
) A;

Sunday, 20 August 2017

Sunday, 1 February 2015

Fact about hashCode() in Java

Hash code method returns integer. If range of integer finishes then also two different object will have same hashCode. So it is not necessary that two different object will have same hashCode are equal.So, If the two objects have same name, then they would be equal, but still if their string field has different length, then their hashCodes will be different.
That is why, you should always use the same fields in equals and hashCode calculation.

Wednesday, 26 March 2014

Capability‬ Maturity Model (CMM)


####‪#‎Capability‬ Maturity Model (CMM)#####

--------------------------------------------------------------
The Capability Maturity Model (CMM) is a methodology used to develop and refine an organization's software development process. The model describes a five-level evolutionary path of increasingly organized and systematically more mature processes. CMM was developed and is promoted by the Software Engineering Institute (SEI), a research and development center sponsored by the U.S. Department of Defense (DoD). SEI was founded in 1984 to address software engineering issues and, in a broad sense, to advance software engineering methodologies. More specifically, SEI was established to optimize the process of developing, acquiring, and maintaining heavily software-reliant systems for the DoD. Because the processes involved are equally applicable to the software industry as a whole, SEI advocates industry-wide adoption of the CMM.

The CMM is similar to ISO 9001, one of the ISO 9000 series of standards specified by the International Organization for Standardization (ISO). The ISO 9000 standards specify an effective quality system for manufacturing and service industries; ISO 9001 deals specifically with software development and maintenance. The main difference between the two systems lies in their respective purposes: ISO 9001 specifies a minimal acceptable quality level for software processes, while the CMM establishes a framework for continuous process improvement and is more explicit than the ISO standard in defining the means to be employed to that end.

**CMM's Five Maturity Levels of Software Processes**
---------------------------------------------------------------

1. At the initial level, processes are disorganized, even chaotic. Success is likely to depend on individual efforts, and is not considered to be repeatable, because processes would not be sufficiently defined and documented to allow them to be replicated.



2. At the repeatable level, basic project management techniques are established, and successes could be repeated, because the requisite processes would have been made established, defined, and documented.


3. At the defined level, an organization has developed its own standard software process through greater attention to documentation, standardization, and integration.


4. At the managed level, an organization monitors and controls its own processes through data collection and analysis.


5. At the optimizing level, processes are constantly being improved through monitoring feedback from current processes and introducing innovative processes to better serve the organization's particular needs.

Tuesday, 25 March 2014

StringTokenizer in Java (Split the String in key value behavior)


StringTokenizer in Java (Split the String in key value behavior)

------------------------------------------------------------------------
StringTokenizer class provide the facility as similar String split() method,
but this class provided split the values on the base of Key value pair behavior.

import java.util.StringTokenizer;

public class TestStringTokenizer{
public static void main(String args[]) {
String checkSplit = "country=India," +
"state=Andra Pradesh," +
"city=Hyderabad";
StringTokenizer st = new StringTokenizer(checkSplit, "=,");
while(st.hasMoreTokens()) {
String keyCheckSplit = st.nextToken();
String valCheckSplit = st.nextToken();
System.out.println(keyCheckSplit + "->" + valCheckSplit);
}
}
}

o/p-

country->India
state->Andra Pradesh
city->Hyderabad

Open any file from java on any location of system


Open a file from Java 

-------------------------------------
import java.awt.Desktop;
import java.io.File;
import java.io.IOException;

/**
* @author prabhat@ezeon
*/
public class OpenDesktopFile{
public static void main(String[] args) {
try {
Desktop desktop = null;
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
}
desktop.open(new File("c:\\imp.docx"));
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}
-------------------------------------------