Actually most of us not gets to work with the
technology stack we love. Even if the opportunities have not been
presented yet, it is mighty important to keep learning and practicing
the things you love. Because, we never know when the opportunity will
come knocking on your door. Mastering a language or a technology could
prove to be difficult, if we do not back our self and predict the
future developments based on the current context. The struggle could
prove to be immense, if we lose our direction in an industry that
changes everyday. Trust your instincts, take a leap of faith and let
our effort determine our success!
References Used :- Blog.zone24x7 > The-challenges-and-struggles-software-engineers-face-today
Saturday, April 27, 2019
Monday, March 25, 2019
Basic Security Threats , Technologies and Tools Used for Security and control
Computer crimes reported by most of the organizations may be related to different types of security problems such as
'Malware' includes
In simple words,
Sniffing means to illegally listen into another's conversation
Spoofing means to pretend to be someone else.
Sniffing and spoofing are security threats that target the lower layers of the networking infrastructure supporting
applications that use the Internet.
Sniffing is a passive security attack in which a machine separate from the intended destination reads data on a network.
Spoofing is an active security attack in which one machine on the network masquerades as a different machine.
This masquerade aims to fool other machines on the network into accepting the impostor as an original, either to lure
the other machines into sending it data or to allow it to alter data.
Identity theft is a form of stealing someone's identity.
Someone pretends to be someone else in identity theft, by assuming that person's identity, usually as
a method to gain access to resources or obtain credit and other benefits in that person's name.
What-is-the-difference-between-spoofing-and-sniffing
'Malware' includes
- Computer Viruses - computer programs that can spread across computers and networks by making copies of itself without the user's knowledge.
- Worms - similar to viruses but do not need a carrier program or document. create exact copies of themselves and use a network to spread.
- Trojan Horses - programs that pretend to be legitimate software, but actually carry out hidden, harmful functions.
- Spyware - includes methods to collect information about the use of the computer on which the software is installed.
In simple words,
Sniffing means to illegally listen into another's conversation
Spoofing means to pretend to be someone else.
Sniffing and spoofing are security threats that target the lower layers of the networking infrastructure supporting
applications that use the Internet.
Sniffing is a passive security attack in which a machine separate from the intended destination reads data on a network.
Spoofing is an active security attack in which one machine on the network masquerades as a different machine.
This masquerade aims to fool other machines on the network into accepting the impostor as an original, either to lure
the other machines into sending it data or to allow it to alter data.
Identity theft is a form of stealing someone's identity.
Someone pretends to be someone else in identity theft, by assuming that person's identity, usually as
a method to gain access to resources or obtain credit and other benefits in that person's name.
Phishing
is the act of attempting to acquire information such as usernames, passwords, and credit card details by
masquerading as a trustworthy entity in an electronic communication.
E.g.s
an e-mail can be sent to the victim
luring the victim to enter a site and when entered, information
such as
usernames, passwords and credit card information may be collected by the
criminal posing as the victim’s bank site.
These tools and techniques address how to:
Virus scanners, firewalls and Intrusion Detection Systems (IDS) .
References Used :- BIT UCSC Notes
Technologies and Tools Used for Security and control
These tools and techniques address how to:
- Authentication - Verify that users are who they say they are .
- Authorization - Control access to data and functions .
- Data Privacy and Integrity - Protect the privacy and integrity of information assets.
- Non-Repudiation - Ensure non-repudiation, so parties can't deny their actions .
Virus scanners, firewalls and Intrusion Detection Systems (IDS) .
| These techniques and tools cannot alone provide information security. Limiting physical access to servers, routers and other systems is required. By physically reorganizing or consolidating information assets, we can simplify the management of those assets while increasing their security. These servers and the other computer infrastructures should be physically protected as well.
Security Audits
The information security status of critical IT environments should be subject to thorough, independent and regular security audits/reviews.
In principle, security audits/reviews should be:
|
What-is-the-difference-between-spoofing-and-sniffing
Friday, January 25, 2019
Useful ways to working with Strings in Java
- When we want to print a array , We can use this way
System.out.println( Arrays.toString( text .split("a") ) );
The string you give
split defines a regular expression, so any characters special in regular expressions have to be escaped:
String[] parts = string.split("\\$@");
- When we want to convert List <String> stringListValues , to string value . We can use following way
- When we have string values set such as String names = "Saman , Kumara , Ramanayaka " ; and we want
String[] nameArray = names.split( " , " );
- String newStringValue = String.join( "-> ", "Wake up", "Eat", "Play", "Sleep", "Wake up" );
Output will be : Wake up-> Eat-> Play-> Sleep-> Wake up
- To reverse a string
String stringObj= "Hiiiiii Kamlal";
StringBuffer stringBufferObj = new StringBuffer( stringObj );
stringBufferObj.reverse();
Version : - 1.1.0
Tuesday, January 22, 2019
Singleton Class in Java
In object-oriented programming, a singleton class is a class that can have only one object (an instance of the class) at a time.
After first time, if we try to instantiate the Singleton class, the new variable also points to the first instance created. So whatever modifications we do to any variable inside the class through any instance, it affects the variable of the single instance created and is visible if we access that variable through any variable of that class type defined.
To design a singleton class:
In terms of practical use Singleton patterns are used in logging, caches, thread pools, configuration settings, device driver objects.
Configuration File: This is another usage of Singleton pattern because this has a performance benefit as it prevents multiple users to repeatedly access and read the configuration file or properties file. It creates a single instance of the configuration file which can be accessed by multiple calls concurrently as it will provide static config data loaded into in-memory objects. The application only reads from the configuration file at the first time and there after from second call onwards the client applications read the data from in-memory objects
We can use the cache as a singleton object as it can have a global point of reference and for all future calls to the cache object the client application will use the in-memory object
Why can’t we use a static class instead of singleton?
References Used :- singleton-class by geeksforgeeks
dzone.com- singleton-design-pattern
After first time, if we try to instantiate the Singleton class, the new variable also points to the first instance created. So whatever modifications we do to any variable inside the class through any instance, it affects the variable of the single instance created and is visible if we access that variable through any variable of that class type defined.
To design a singleton class:
- Make constructor as private.
- Write a static method that has return type object of this singleton class. Here, the concept of Lazy initialization in used to write this static method
public class Singleton {
private static final Singleton instance = new Singleton();
private Singleton() {}
public static Singleton getInstance() {
return instance;
}
}
In terms of practical use Singleton patterns are used in logging, caches, thread pools, configuration settings, device driver objects.
Configuration File: This is another usage of Singleton pattern because this has a performance benefit as it prevents multiple users to repeatedly access and read the configuration file or properties file. It creates a single instance of the configuration file which can be accessed by multiple calls concurrently as it will provide static config data loaded into in-memory objects. The application only reads from the configuration file at the first time and there after from second call onwards the client applications read the data from in-memory objects
We can use the cache as a singleton object as it can have a global point of reference and for all future calls to the cache object the client application will use the in-memory object
Why can’t we use a static class instead of singleton?
- One of the key advantages of singleton over static class is that it can implement interfaces and extend classes while the static class cannot (it can extend classes, but it does not inherit their instance members). If we consider a static class it can only be a nested static class as top level class cannot be a static class. Static means that it belongs to a class it is in and not to any instance. So it cannot be a top level class.
- Another difference is that static class will have all its member as static only unlike Singleton.
- Another advantage of Singleton is that it can be lazily loaded whereas static will be initialized whenever it is first loaded.
- Singleton object stores in Heap but, static object stores in stack.
- We can clone the object of Singleton but, we can not clone the static class object.
- Singleton can use the Object Oriented feature of polymorphism but static class cannot.
References Used :- singleton-class by geeksforgeeks
dzone.com- singleton-design-pattern
Version :- 1.1.0
Friday, January 11, 2019
May be Useful .......
- BeanPropertyRowMapper
a property by matching their names. Just make sure both the property and column has the same name, e.g property ‘custId’ will match
to column name ‘CUSTID’ or with underscores ‘CUST_ID’.
String sql = "SELECT * FROM CUSTOMER WHERE CUST_ID = ?";
Customer customer = (Customer)jdbcTemplate().queryForObject( sql, new Object[] { custId },
new BeanPropertyRowMapper(Customer.class));
References Used :- spring-jdbctemplate-querying-examples
- log4j vs System.out.println() Anything that you print to System.out will go to "standard out", and while you can redirect standard out to a file and compare it, what have you, that is very inflexible. Additionally, you cannot filter what goes to standard out if you use System.out... everything will be printed. With log4j, you can set different logging levels, so that logging messages that are below a certain severity/importance threshold are not printed (e.g. if you change the logging level to WARN, then DEBUG and INFO messages will not be displayed anymore). Additionally, log4j allows logging to be controlled on a class-by-class basis, whereas System.out can only be controlled at the granularity of the entire application (if you redirect System.out, you redirect it for the entire program). By contrast, each logger in log4j can be given a different appender. In addition, you can give a log4j logger multiple appenders (so that it goes the system logger, and over the network, for example). You can even have a log4j logger append to a StringBuilder, so that you can easily read what was written. And while System.out can be redirected, this redirection tends to be fairly limited; System.out can be redirected to a file or to a pipe (to another program), but you wouldn't be able to redirect it to a URL, for example; by contrast, it would be very easy to create an appender that transmits logging messages using HTTP POST. References Used :- log4j-vs-system-out-println
- Difference between a Web Server, an Application Server, and a Database Server
- Web Server: Web server handles web requests sent by visitors visiting your website(primarily respond to HTTP / HTTPS requests). Web server runs on Apache, Nginx, Microsoft IIS, etc.
- Application Server: Application server is the server that works between Web server and database server and basically manages, processes the data.Application server can contain web server in them. For example :- JBoss, WAS
Application server provides following features over web server :- Connection pooling , Transaction management , Messaging , Clustering , Load Balancing - Database Server: Database server handles database queries. It runs on MySQL, PostgreSQL, MariaDB, etc
- Thymeleaf is a modern server-side Java template engine for both web and standalone
environments.
Thymeleaf's main goal is to bring elegant natural templates to your development workflow — HTML that can be correctly displayed in browsers and also work as static prototypes, allowing for stronger collaboration in development teams.
With modules for Spring Framework, a host of integrations with your favourite tools, and the ability to plug in your own functionality, Thymeleaf is ideal for modern-day HTML5 JVM web development
- WildFly Server , formerly known as JBoss AS, or simply JBoss, is an application server authored by JBoss, now developed by Red Hat. WildFly is written in Java and implements the Java Platform, Enterprise Edition specification. It runs on multiple platforms.
- JSF Current (10th Jan 2019) version is . 2.3 is the designated user interface standard for Java EE 8. It went final on 17 April 2017. JSF 2.2 is the user interface standard for Java EE 7 The most recent major release of JSF is 2.2.
Version :- 1.0.1
Thursday, December 27, 2018
How to Change PrimeFace Theme According to User Preferences in SpringBoot Project
In web.xml file add this ,
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>#{settingsController.userTheme}</param-value>
</context-param>
Our controller class will be like this ,
@ManagedBean(name = "settingsController")
@SessionScoped
@Controller
public class SettingsController {
private String userTheme = "glass-x" ; //Initial Theme
private Map<String , String> themeMap ;
@PostConstruct
public void init (){
setThemeMapInit( );
}
public String getUserTheme() {
return userTheme;
}
public void setUserTheme(String userTheme) {
this.userTheme = userTheme;
}
public Map<String, String> getThemeMap() {
return themeMap;
}
public void setThemeMapInit() {
themeMap = new LinkedHashMap<String, String>();
themeMap.put("Aristo", "aristo");
themeMap.put("After-noon", "afternoon");
themeMap.put("After-Work", "afterwork");
themeMap.put("Black-Tie", "black-tie");
themeMap.put("Blitzer", "blitzer");
themeMap.put("Bluesky", "bluesky");
themeMap.put("Bootstrap", "bootstrap");
themeMap.put("Casablanca", "casablanca");
themeMap.put("Cupertino", "cupertino");
themeMap.put("Dark-Hive", "dark-hive");
themeMap.put("Delta", "delta");
themeMap.put("Excite-Bike", "excite-bike");
themeMap.put("Flick", "flick");
themeMap.put("Glass-X", "glass-x");
themeMap.put("Home", "home");
themeMap.put("Hot-Sneaks", "hot-sneaks");
themeMap.put("Humanity", "humanity");
themeMap.put("Overcast", "overcast");
themeMap.put("Pepper-Grinder", "pepper-grinder");
themeMap.put("Redmond", "redmond");
themeMap.put("Rocket", "rocket");
themeMap.put("Sam", "sam");
themeMap.put("Smoothness", "smoothness");
themeMap.put("South-Street", "south-street");
themeMap.put("Start", "start");
themeMap.put("Sunny", "sunny");
themeMap.put("Swanky-Purse", "swanky-purse");
themeMap.put("UI-Lightness", "ui-lightness");
}
public void setThemeMap(Map<String, String> themeMap) {
this.themeMap =themeMap;
}
public void sumbitUserSettings (){
System.out.println("****** User Theme ****** " + userTheme );
}
}
Finally our xhtml file will be like this
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:p="http://primefaces.org/ui"
xmlns:f="http://xmlns.jcp.org/jsf/core">
<body>
<ui:composition template="./mainTemplate.xhtml">
<ui:define name="content">
<h1 class="ui-widget ui-widget-header" style=" font-size: 15px;
font: bold;line-height: 2.8em;text-align: center;">Settings</h1>
<h:form id="changeThemeFormId" >
<p:growl id="changeThemeFormMsg" showDetail="true" showSummary="false" />
<h:panelGrid columns="3" cellpadding="5" styleClass="add-form">
<h:outputLabel for="userTheme" value="Theme Name *:" style="width: 300px"/>
<p:selectOneMenu id="userTheme" value="#{settingsController.userTheme}" style="width:200px"
required="true" requiredMessage="Theme Name is Required" >
<f:selectItems value="#{settingsController.themeMap}"/>
</p:selectOneMenu>
<p:message for="userTheme" display="icon"/>
<p:commandButton value="Sumbmit" styleClass="ui-priority-primary" style="font-weight:bold; font-size:13px"
resetValues="ttrue" actionListener="#{settingsController.sumbitUserSettings()}"/>
</h:panelGrid>
</p:fieldset>
</h:form>
</ui:define>
</ui:composition>
</body>
</html>
Version 1.1.0
Saturday, December 22, 2018
Subscribe to:
Posts (Atom)
Some interesting things to explore more
Here some some things to study more , How Google Search works https://developers.google.com/search/docs/fundamental...
-
"Injection attacks": Common Types of Injection Attacks : There are several types of injection attacks, including SQL injection,...
-
The AI-Driven Software Developer: Optimize, Innovate, Transform": AI Transformation in Software Development : Understand how AI is re...
-
With Java 25 , One interesting changes can view is JEP 512, "Compact Source Files and Instance Main Methods," significa...