Technology Tidbits- Did you know how much data a DNA can store?

Do you know — 1 Gram of DNA Can Store 1,000,000,000 Terabyte of Data for 1000+ Years.
According to stats, 5.4 zettabytes (4.4 trillion gigabytes) of digital data, circulating and available worldwide, had been created by 2015, and it will boost to 54 zettabytes (ZB) by 2020.
The data storage density of DNA is enormously higher than conventional storage systems, as just 1 gram of DNA can store close to 1 Billion Terabytes of data.
Besides this, DNA is also remarkably robust, which means the data stored in DNA can stay intact and readable for as long as 1,000 to 10,000 years.

How are Exceptions Handled in Selenium ?

How are Exceptions Handled in Selenium ?: catch, Difference between Throws and Throw, Exception Handling, Exception Handling in Selenium, Finally, How are Exceptions Handled in Selenium ?, NoSuchElementException, Throw, Throws, try, Exceptions in Selenium, Exception Handling , Exceptions, try/catch block

What is the Difference Between HashTable and HashMap in Java? - Interview Question


HashTable

Class below implements a hash table, which maps keys to values. Any non-null object is used as a key or as a value.
The objects used as keys must implement the hashCode method and the equals method, in order to successfully store and retrieve objects from a hashtable,



Class Hashtable
   java.lang.Object
      java.util.Dictionary
         java.util.Hashtable

public class Hashtable
extends Dictionary
implements Map, Cloneable, Serializable

HashMap

This is Hash table based implementation of the Map interface. This implementation provides all of the optional map operations. It also permits the null key and null values.
(The HashMap class is almost equivalent to Hashtable, with major difference being that it is unsynchronized and also permits nulls.)
This class makes no guarantees as to the order of the map; in particular, it does not guarantee that the order will remain constant over time.

Class HashMap
   java.lang.Object
      java.util.AbstractMap
         java.util.HashMap

public class HashMap
extends AbstractMap
implements Map, Cloneable, Serializable

Type Parameters:

K - the type of keys maintained by this map
V - the type of mapped values
Map is an interface; HashMap is a particular implementation of that interface. HashMap uses a collection of hashed key values to do its lookup.

Similarities

• HashMap and Hashtable both are data structures

• Both store data in key and value form.

• Both use hashing technique to store unique keys.


Differences


• Hashtable was part of the original java.util and is a concrete implementation of a Dictionary. However, Java 2 re-engineered Hashtable so that it also implements the Map interface.

• HashMap inherits AbstractMap class whereas Hashtable inherits Dictionary class.

• HashMap allows one null key and multiple null values, while the Hashtable doesn't allow any null key or value.

• The hashmap cannot have the duplicate keys in it that is why there keys must only be mapped with only the single value. But the hashtable allows the duplicate keys in it.

• The hashmap contains an iterator which is basically fail-safe but the hashtable contains an enumerator, which is not fail-safe.

• The access to hashtable is synchronized on the table while the access to the hashmap is not synchronized.

• HashMap is fast as compared to Hashtable which is slow.

• HashMap is traversed by Iterator but Hashtable is traversed by Enumerator and Iterator.

• HashMap is non synchronized. It is not-thread safe and can't be shared between many threads without proper synchronization code but Hashtable is synchronized. It is thread-safe and can be shared with many threads.
We can make the HashMap as synchronized by calling this code
Map m = Collections.synchronizedMap(hashMap) but Hashtable is internally synchronized and can't be unsynchronized.

• Iterator in HashMap is fail-fast wheras Enumerator in Hashtable is not fail-fast.



Software Testing - An Easy Way: How are Exceptions Handled in Selenium ?

Software Testing - An Easy Way: How are Exceptions Handled in Selenium ?: What is an Error?   Error is a bug in application the we may not want to catch . What is an Exception? An Exception is a...

Built-in Functions In Python - Letter E



enumerate(sequence, start=0)

Return an enumerate object. sequence must be a sequence, an iterator, or some other object which supports iteration. The next() method of the iterator returned by enumerate() returns a tuple containing a count (from start which defaults to 0) and the values obtained from iterating over sequence:

>>>
>>> seasons = ['Spring', 'Summer', 'Fall', 'Winter']
>>> list(enumerate(seasons))
[(0, 'Spring'), (1, 'Summer'), (2, 'Fall'), (3, 'Winter')]
>>> list(enumerate(seasons, start=1))
[(1, 'Spring'), (2, 'Summer'), (3, 'Fall'), (4, 'Winter')]
Equivalent to:

def enumerate(sequence, start=0):
    n = start
    for elem in sequence:
        yield n, elem
        n += 1
New in version 2.3.


eval(expression[, globals[, locals]])

The arguments are a Unicode or Latin-1 encoded string and optional globals and locals. If provided, globals must be a dictionary. If provided, locals can be any mapping object.


The expression argument is parsed and evaluated as a Python expression (technically speaking, a condition list) using the globals and locals dictionaries as global and local namespace. If the globals dictionary is present and lacks ‘__builtins__’, the current globals are copied into globals before expression is parsed. This means that expression normally has full access to the standard __builtin__ module and restricted environments are propagated. If the locals dictionary is omitted it defaults to the globals dictionary. If both dictionaries are omitted, the expression is executed in the environment where eval() is called. The return value is the result of the evaluated expression. Syntax errors are reported as exceptions. Example:

>>>
>>> x = 1
>>> print eval('x+1')
2
This function can also be used to execute arbitrary code objects (such as those created by compile()). In this case pass a code object instead of a string. If the code object has been compiled with 'exec' as the mode argument, eval()‘s return value will be None.

Hints: dynamic execution of statements is supported by the exec statement. Execution of statements from a file is supported by the execfile() function. The globals() and locals() functions returns the current global and local dictionary, respectively, which may be useful to pass around for use by eval() or execfile().

See ast.literal_eval() for a function that can safely evaluate strings with expressions containing only literals.


execfile(filename[, globals[, locals]])

This function is similar to the exec statement, but parses a file instead of a string. It is different from the import statement in that it does not use the module administration — it reads the file unconditionally and does not create a new module. [1]

The arguments are a file name and two optional dictionaries. The file is parsed and evaluated as a sequence of Python statements (similarly to a module) using the globals and locals dictionaries as global and local namespace. If provided, locals can be any mapping object. Remember that at module level, globals and locals are the same dictionary. If two separate objects are passed as globals and locals, the code will be executed as if it were embedded in a class definition.


If the locals dictionary is omitted it defaults to the globals dictionary. If both dictionaries are omitted, the expression is executed in the environment where execfile() is called. The return value is None.

Note The default locals act as described for function locals() below: modifications to the default locals dictionary should not be attempted. Pass an explicit locals dictionary if you need to see effects of the code on locals after function execfile() returns. execfile() cannot be used reliably to modify a function’s locals.

Built-in Functions In Python - Letter D



delattr(object, name)
The arguments are an object and a string. The string must be the name of one of the object’s attributes. The function deletes the named attribute, provided the object allows it. For example, delattr(x, 'foobar') is equivalent to del x.foobar.
class dict(**kwarg)
class dict(mapping, **kwarg)
class dict(iterable, **kwarg)
Create a new dictionary. The dict object is the dictionary class. See dict and Mapping Types — dict for documentation about this class.
For other containers see the built-in list, set, and tuple classes, as well as the collections module.

UI Automator Viewer : Locate Elements in Mobile apk testing

Find android application element details using UI Automator Viewer



Friends, Let's see how to find element details of android application using Android “UI Automator Viewer”. Following are the steps:
1. Open android application on emulator or real device. Like I have opened below app on emulator.



2. Go to “tools” folder in your installed Android SDK folder.
3. Click on uiautomatorviewer.bat file you screen should be open below screen.



4. Click on Icon as marked on above screen, your opened application display in UI Automator Viewer like below screen. Move your mouse on element at left panel, you should see element details will show on right panel.

Jenkins - The Build and Test tool for continuous integration


  1. Jenkins is used to build and test our software projects continuously.
  2. Jenkins is installed on a server and the central build takes place on that server.
  3. Developer checks-in their source code on that server.
  4. Shared repository(for source code) and Jenkins are installed on the same server.
  5. Whenever a code commit occurs, a build is triggered. Jenkins installed on the same server(where the code has been checked-in), picks up the source code and triggers a build, and after that runs any tests if required.
  6. You can see the output of the build on the Jenkins Dashboard.
  7. Automatic email notifications are also sent to developers

What is the Difference between hosting platforms, shared hosting server, VPS, dedicated hosting server and a cloud server ?


  • Shared hosting is a fast, easy, and cheap way to get started but is prone to overselling due to the highly competitive and saturated nature of the market. VPS gives you more control of your environment, but due to being on shared hardware, your service can still be potentially affected by other customers. 
  • Cloud Hosting is great if you have no idea how many resources you need, or have extremely variable usage patterns, but tend to be significantly more expensive for the same amount of resources and thus don't make a lot of sense for long-term, regular use. Their usual reliance on shared storage results in much higher disk latency, which may be problematic for applications like databases. 
 
  • They also have a more complex underlying environment, and are still relatively immature and sometimes prone to strange and difficult to diagnose problems. Dedicated Hosting, as the name implies gives you dedicated resources so you're not going to see contention for hardware resources due to anyone other than yourself. However, you generally need to have a good idea of what you're doing unless you opt to pay for managed services. 
 
  • You'll also need multiple servers for a proper redundant infrastructure, which may be overkill or not, depending on the level of hardware resources required.
  • It might help you to think of it as a matrix where the two columns are "real server" and "virtual server," the two rows are "shared" and "dedicated." A "real server" means that your operating system is directly accessing hardware without a virtualization layer while, conversely, a "virtual server" lives inside a virtual machine running on a real server. 
 
  • "Shared" and "dedicated" are just indicators of whether you were guaranteed a baseline performance level or whether another entity who's sharing the same hardware that you're using could monopolize all resources. Within this matrix, the shared hosting server is a "real server" that is "shared." The VPS is a "virtual server" that is "shared." The dedicated hosting server is a "real server" that is "dedicated." And the cloud server is a "virtual server" that is "dedicated."
  • If we follow the evolution of outsourced hosting, it reveals much of the pros and cons of each choice. At first the only outsourced hosting service available was shared hosting. You were limited to the platform choices established by the service provider and you shared CPU and memory with other hosting customers. 
 
  • To address these limitations, service providers began offering dedicated servers. While you're limited to a finite set of operating systems, what you put onto the server is your own business and every last CPU cycle is yours to keep. Server recovery does become more complex as the entire disk image needs to be cloned or saved somewhere and there are cost issues because you're paying for all of the hardware whether or not you're using all of the hardware.
  • Once virtualization technology came into being, with a VPS, it became possible to get the efficiency of shared hosting with the customizability of a dedicated server. Each virtual machine could get its own OS and could be customized as you see fit but, simultaneously, you'd be sharing the underlying hardware with many other customers. In practice, this usually worked just fine because most software works in bursts. 
 
  • And virtual machines can be snapshotted and recovered quickly by simply moving the guest OS to a new host server. But like a shared Internet connection, all it takes is one misbehaved customer to ruin the experience for everyone. To address that, cloud servers claim to provide each virtual machine a guaranteed performance baseline. Thus you know you won't ever be completely squeezed by your neighbor. 
 
  • This is very much analogous to WAN technology like MPLS, Frame Relay, and ATM: your carrier provides you with a "Commited Information Rate" that they guarantee while they also allow you to burst if no one else is using the bandwidth, except in this case you'd be getting a commited percentage of CPU cycles from your service provider.
  • Shared hosting is the most common form of low-priced hosting. Each site  on a shared hosting package lives on a server with many other sites. Virtual Private Servers use virtualization technology to partition a powerful server into smaller “virtual” servers. Dedicated servers are just what they sound like. Each hosting client has their site on a dedicated physical machine.

Shared Hosting Pros

- it's low cost
- good option for a small business that doesn;t expect a ton of traffic

Shared Hosting Cons

- Each site on a shared hosting package lives on a server with many other sites
- Typically have fairly limited storage and bandwidth allocations and you can hit upper limits (although more space can usually be purchased)
- you don't run the server and share it with others, which limits configurability
- security. Your neighbors issues are your issues (although this can be dealt with using CloudLinux)

VPS Pros

- completely configurable and upgradable to meet the needs of your business.
- can get them managed or unmanaged

VPS Cons

- you're still sharing the server

Dedicated Pros

- your own site on a dedicated physical machine
- easily scalable for higher traffic

Dedicated Cons

- cost
  • Sharing have never been easy:How do you feel when you have to share your room with your siblings or cousins or for hostel people, roommates, if the space is less, you definitely feel congested, same is the case in sharing of servers, you’ll have to share a limited space with a lot of other people who you are not even aware to.
  • Shared server:Sharing the same IP- All websites on a single server have the same IP address and therefore, you share your address with unknown people, who may be using it for malicious activities, in case they get blocked, you are blocked along with them, even when you are not the culprit.
  • Server response time:When a variety of tasks are lined up in a queue, the completion of tasks take time, same is the case with shared server, your task gets slowed down due to the completion of tasks of others on the same address.
  • Crashing of server: As the number of scripts generated in the case of shared server is more therefore, server crashes are greater in number.
  • Dedicated server- It’s all yours.If you are a medium or small enterprise then you should think twice before opting for a dedicated server because dedicated server is basically for large and busy sites like portal, search engine, online content provider, heavy traffic forums, etc.
  • You are your own boss- You can install whatever applications and scripts you want, the server is totally yours, you can decide how many websites you want to run through it, you will be able to customize the hardware and software on your server, all these benefits cannot be obtained in the case of shared server.
  • Bandwidth- Bandwidth too is all yours; you can upload and download according to your requirement which isn’t the case in shared server.
  • Security- You have your own firewall, so, all your information is safe and within the reach of only the ones who you want, everyone would not be able to access your information, therefore increasing the security of your data.
  • Performance- Better performance is obtained as response time increases and files are loaded faster as compared to the case in shared server, therefore increasing the performance of your website.
  • While you still share things on the property, you are ultimately responsible for maintaining your own property and repairs inside the condo. There is also significantly less residents per building and assigned parking. On a Virtual Private Server, you are allotted resources that are not shared by everyone. The over all CPU time and memory are shared across all accounts on the machine, but at the same time portions of those resources are always dedicated to each account. This allows for more power and flexibility than being on a shared account.
  • Shared hosting is normally the cheapest hosting available from a web hosting company. Once a site outgrows the shared environment, it can be upgraded onto a more flexible plan with higher capacity: normally a Virtual Private Server (VPS).
  • The VPS is based on sharing. In terms of its virtual existence, it's isolated, but it still shares a single physical server with a clutch of other VPS clients. VPS customers only have partial control over the hosting environment, and they can still run into problems if a neighbour behaves badly.
  • A dedicated server is just that: dedicated to one customer. The entire box is theirs. More importantly, it means that the customer is free to tweak and customise the whole environment, including the server operating system.
  • Starting from the cheapest, least readily-scalable hosting option, you have shared hosting, in which one server (usually located in a datacenter) hosts multiple clients on the same servers with shared resources and bandwidth.  Next up you have virtual private servers, which involve a usually heavy duty server hosting multiple complete virtualized servers.  
  •  This allows for more customization and generally better access, but either requires you to have knowledge of server management or to pay someone else to manage it for you (unmanaged vs. managed VPS).  Alternatively, you could purchase a physical server and collocate it at a datacenter, a scenario in which you would own your server, and pay a monthly fee to have a company host it at their datacenter, being billed for resources (electricity and bandwidth primarily) and management if you so choose.  This allows for the most flexibility as you are not limited by the number of virtual servers you host on your own physical machine, but again, requires knowledge of server configuration and management.  Finally there’s Cloud hosting, which involves multiple copies of your server applications being hosted across multiple servers at multiple locations.  This allows for greater uptime, and in the case of resource-intensive applications, better durability and access speed.  However, it is the most expensive solution to implement (for a single site) and requires a fair bit of know-how.  On the plus side though, cloud hosting is the single most scalable type of hosting solution and can become a more cost effective solution as you scale it up.
  • Shared Hosting is the cheapest of all the types of web hosting services and mostly comes with managed hosting. As soon as you got your shared hosting details you can set up your website on the web by uploading your website files or installing a script like Wordpress. Depending on the web host shared hosting is good to serve 50 to 100 concurrent web site visitors.
  • VPS Hosting is costlier than shared hosting and comes with managed VPS or unmanaged VPS. With a VPS you would get root access so that you can install any software you want to install on your account. VPS Hosting Servers are like mini Dedicated Servers and are cheaper than a full dedicated server depending on the configuration.
  • Dedicated Server Hosting is in which you get to use the resources of a full dedicated server. Dedicated servers are costlier than VPS Servers (depending on configuration). With a Dedicated server you would get to use all the resources of a dedicated server and won't share your server with anyone, hence it's called Dedicated Server.
  • And finally Cloud (Hosting) Server is in which several web servers are connected to one another to make it a cloud. Cloud hosting servers are good for your websites if you expect any spike in your websites traffic. With Cloud Hosting you get to pay per hour or the actual system resources your websites use.

Selenium Commands "assertNotSelectedLabel" and "assertNotSelectedLabels"

"assertNotSelectedLabel" and "assertNotSelectedLabels" 


  • WebElements : Used for drop down and list box type elements.
  • If any of the assert command fails, selenium IDE stops its execution immediately.
  • It fails if selected label string matches the expected label string. Else it will be pass.
CommandValue



addSelection
label=Germany
assertNotSelectedLabel
India
removeSelection
label=Germany
addSelection
label=India
assertNotSelectedLabel
India
First "assertNotSelectedLabel" command will become pass because actual value will not match with expected value. But last"assertNotSelectedLabel" command will fail. Run both examples in selenium IDE to confirm its function.

"assertNotSelectedLabels" Command

"assertNotSelectedLabels" command works same as "assertNotSelectedLabel" command but it is supporting multiple labels too. It will return error like '[error] Actual value 'India,Italy' did match 'India,Italy'' if both values will match.
Command
Value
open

addSelection
label=Italy
addSelection
label=Germany
assertNotSelectedLabels
India,Italy
removeSelection
label=Germany
addSelection
label=India
assertNotSelectedLabels
India,Italy