We can create generic classes using templates in C++. Generic classes can be used for different data types. In the example below we have one template class that can queue based on the data type. Here the example demonstrates that same generic class can be used to queue char data type as well integer data […]
About Pankaj Chhabra
This author has yet to write their bio.Meanwhile lets just say that we are proud Pankaj Chhabra contributed a whooping 14 entries.
Entries by Pankaj Chhabra
Virtual image is an instance of the operating system, which shares system resource such as CPU time, memory and file system to simulate a computer machine. At the heart of the operating system lies a component called HAL (Hardware Abstraction Layer), which converts the CPU instructions to meaningful operating system calls, which are further used by the high level application layers. Virtualization is a software layer and runs along with the HAL and operating system to allow the creation of machine instances called guest systems. Guest systems that simulate a computer are capable of running any operating system such as Windows and Linux. On a powerful machine multiple guest operating systems can run in parallel. This is similar to operating systems running several applications in multi tasking mode; the difference being that, in this case, several operating systems run using a shared CPU model in a multi threading mode. We have written about using virtual machines and VMware specifically for QA before and we are generally big fans of them. However, there are some security and networking issues that you should be aware of is you are planning on using virtual machines in your IT environment. Security Issues Hypervisor Security: The hypervisor is the layer between physical hardware and the operating system. It is bound to have vulnerabilities that can directly impact security. If the hypervisor is hacked, security of the entire host system is at risk and this can cause security issues for the entire organization Guest OS Security: Most of the time anti virus software is not installed on the guest OS and this can provide a entry point for a virus in to your IT environment. It is extremely difficult to detect the machine which caused the issue. Networking Security Issues: TCP IP communication between VM and host can’t be sniffed by intrusion detection systems if the communication is host only. So IDS systems fail to detect vulnerabilities and exploits happening within virtual machines. Host External Communication Security: In certain cases the firewall on the host is disabled in cases where the VMs require some port to be opened. This causes severe security threats for the host. Networking Issues Very High Bandwidth Utilization: VMs are operating systems. Windows and Linux try to update their software from the Internet and this causes N * Update size bandwidth usage in the enterprise. In situations where the VMs are restored from original images, this causes updates to happen again causing huge network bandwidth utilization in the enterprise. High DHCP Address Usage: When VMs are used in bridge mode, VMs consume DHCP addresses from the enterprise router. Many times VMs are shutdown within short duration of bringing them up. But since the DHCP server keeps the lease for 8 hours, this causes high DHCP address consumption .
How to access MySQL from Java including creating a database, setting the CLASSPATH, writing a Java database class and then checking the results. Create MySQL Database First we need to create a database. Setting CLASSPATH in Environment Variables on Your Windows System Now, download the MYSQL JDBC Connector and set the class path. Java Database Class Create your Java database class. Executing the Code And then watch the code in action.
It is very easy to create SQLite3 database from an Android application. Here are some well-commented samples to get you going. Here is SQLite Helper class that I have created for this demo: To use the SQL helper class, we can use a class to call the methods of SQL helper class. Code to see the contents of an Android SD card on an emulator. Output of above on an emulator.
Virtual image is an instance of the operating system, which shares system resource such as CPU time, memory and file system to simulate a computer machine. At the heart of the operating system lies a component called HAL (Hardware Abstraction Layer), which converts the CPU instructions to meaningful operating system calls, which are further used […]
How to access MySQL from Java including creating a database, setting the CLASSPATH, writing a Java database class and then checking the results. Create MySQL Database First we need to create a database. [code]C:WDevResearchProgrammingJavaDatabase>mysql -u root -p Enter password: ***** ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: Y ES) C:WDevResearchProgrammingJavaDatabase>mysql -u root […]
It is very easy to create SQLite3 database from an Android application. Here are some well-commented samples to get you going. Here is SQLite Helper class that I have created for this demo: [code lang=”java”]package com.example; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteStatement; import android.util.Log; import java.util.ArrayList; import java.util.List; public class SqliteHelper […]
Android apps all share a similar architecture. The fundamental building blocks of Android are Activities, Services, Broadcast Receivers and Content Providers. Communication between these blocks is handled by Intents which can be either Explicit or Implicit. The user interface is a collection of Views and Notifications. Building Blocks Activities The Activity is the basic building block of every visible Android application. It provides the means to render a UI. Every screen in an application is an activity by itself. Though they work together to present an application sequence, each activity is an independent entity. Activities typically involve an interaction with a user. Services The Service is another building block of Android applications. It is a program that can run in the background for an indefinite period and it does not provide a UI. Services fall under two categories: Started and Bound. A started service can run indefinitely and is used for things that don’t require a user interaction like downloading a file. A bound service has an interface to interact with the service. Broadcast Receivers The Broadcast Receiver is yet another type of component that can receive and respond to any broadcast announcements. In particular, it is used to listen for Intents. Content Providers The Content Providers are components that expose a specific set of data to applications. They provide the tools to manage access and define security for the data. If data is only going to be used in your application, then a content provider is unnecessary. It is only needed to communicate and share that data outside the application. Intents Communication between the above mentioned components is through Intents. Intents are messages that are passed between components. Intents are similar to to API calls, with the difference that the Intent-based mechanism is asynchronous whereas API calls are synchronous. The second difference between Intent-based and API-based mechanisms is that API-based mechanism are bound at compile time whereas Intents are bound at run time. Intents can be explicit or implicit. Explicit Intent In an Explicit Intent, we actually specify the activity that is required to respond to the Intent. In other words, you explicitly designate the target component. This is typically used for application internal messages. External Intents are invoked from a caller like in the following example. Called class gets invoked using the External Intent. Here is how we can use an External Intent to Invoke a class Here is the called class that gets invoked using External Intent. It just displays a view. Implicit Intent In an Implicit Intent , we just declare an Intent and leave it to the platform to find an activity that can respond to the Intent. Here, we do not declare the target component. It is typically used for activating components of other applications seamlessly. Applications which are interested in handling the Intents advertise their properties to the Android system using Intent filters. This is done in the AndroidManifest.xml file. A component can declare any number of Intent filters. There can be more than one component in the system that can handle the same Intent and Android system asks user to select the component. Priorities can be set on the Intent filters. The Intent object has the following major fields: Action, Category, Data and Component name. The Android system compares the Action, Category and Data to the Intent filters to find the component that can handle the Implicit Intent. This example shows how to use an Implicit Intent. User Interface Finally, the user interface elements are made up of Views and Notifications. Views The application UI screen is made up of views. A view has its UI elements. Widgets are Views Views can be nested in ViewGroups which are invisible containers that can hold views and define their layout properties. Notifications Notifications are messages used throughout the Android system. Primarily, you see notifications in places like the Status Bar.
The post Android Fundamentals: Building Blocks, Intents and User Interface appeared first on OptimusMobility.
Android apps all share a similar architecture. The fundamental building blocks of Android are Activities, Services, Broadcast Receivers and Content Providers. Communication between these blocks is handled by Intents which can be either Explicit or Implicit. The user interface is a collection of Views and Notifications. Building Blocks Activities The Activity is the basic building […]
NAnt is a free and open source software tool for automating software build processes. It is similar to Apache Ant, but targeted at the .NET environment rather than Java. The name NAnt comes from the fact that the tool is Not Ant. NAnt requires one of the .NET frameworks (1.0, 1.1, 2.0, 3.5 or 4.0) […]