Sunday, January 13, 2013

Databases (Course / Tutorial), Part 2 - XML Documents

XML DATA

XML can be considered an alternative for the Relational Data Model. There are situations in which using an XML rather than Ralational Model is more suitable. In general, you can say that XML is much more flexible because it was originally designed to share data. For example, a Relational Model requires a schema, which means you have to plan and design based on your understanding future of the data model your are building.

Today in many cases XML is use as an intermediary layer between users and database. For example, eBay has an XML that can be used to access their data and build applications from it, without directly accessing their database. Therefore, it could be said that XML is an excellent way to have computers talk to each other. For example airlines have XML Documents at specific locations in the internet that allow programmers and/or travel agencies to access their schedules and availability to create services like cheapoair or kayak.

XML Structure (Well-Formed)

 
 <Bookstore>  
      <Book ISBN="978-456321789" Price="15" Edition="2nd">  
           <Title>Learn Python</Title>  
           <Authors>  
                <Author>  
                     <First_Name>Pythonian</First_Name>  
                     <Last_Name>Pythoner</Last_Name>  
                </Author>  
                <Author>  
                     <First_Name>Ricky</First_Name>  
                     <Last_Name>Rich</Last_Name>  
                </Author>  
           </Authors>  
      </Book>  
      <Book ISBN="4218-127894413" Price="12">  
           <Title>Swimming</Title>  
           <Authors>  
                <Author>  
                     <First_Name>Michael</First_Name>  
                     <Last_Name>Phelps</Last_Name>  
                </Author>  
           </Authors>  
           <Remark>  
                Buy this book bundled with a CD - Great Deal  
           </Remark>  
      </Book>  
 </Bookstore>  

As seen above the document is indented and every tag has a closing tag. The tags can have any name you like or your project needs. Notice that the second book, doesn't have an Edition attribute. This is part of the great flexibility of XML. The structure of the XML can then be thought as:
  • Tagged Elements or Nested Elements
  • Attributes (in the elements)
  • Text
Well-Formed is the most flexible XML. The basic Structural requirements of Well-Formed XML are:
  1. Single Root element (In our example we start with  <Bookstore> , so we must have all our other XML content before the closing </Bookstore> ).
  2. Matched tags and proper Nesting (Above as you see all tags are indented depending to their level of hierarchy. For example, it would be wrong to have <Title>  at the same level of indentation as <Book>).
  3. Unique attributes within elements(For example, having 2 ISBN attributes in the <Book>  tag is not correct and therefore not valid for a valid Well-Formed XML)

XML Parser are used to validate the 3 structural requirements of an Well-Formed Document. When the document is parsed is returns a parsed XML in different standards DOM (Document Object Model), or SAX.

Well-Formed is useful when data is not structured, meaning that it is irregular. If there is a uncertainty about what kind of data a document may carry, then a more structured approach for the design of it could be to complex to use( for example DTD/XSD, explained below).

Dsiplay/Render XML

There are two options to diplay XML documents in a nice organized way. You can use CSS or XSL. CSS is the most know for it's usefulness for HTML styling, however, in XML XSL(Extensible style-sheet Language is often used).

A CSS/XSL interpreter is required. The interpreter has some rules for the conversion to the HTML output generated. The document (XML) should still be parsed to check for structural consistence.

Valid XML

The previously mentioned Well-Formed XML is suitable for many different purposes. However, there are cases in which considering content-specific rules for an XML document is required. Adhering content-specifics to an XML is achieved using DTD's or XML Schema(XSD), from which XML Schema is more powerful and widely used.

The validation process is similar to the Well-Formed XML. The only new difference, is that the parser now takes into account the requirements of the content-specific specification and verifies if the content of the document follows the specification for the document.

DTD

Since DTD is a specification language, what DTD allows you to define is:
  • Elements
  • Attributes
  • Nesting
  • Ordering
  • Frequency of Occurrences
  • ID and IDREF(S): Which are special attributes types that act as pointers within and XML Document
Why using DTD or XSD? This question can be considered in light of flexibility and your validation requirements. For example, if there is data coming in the XML that has DTD/XSD it is possible have the data pre-validated due to usage of structural standard for the XML. Thus, saving processing time and analysis time for consistency. Furthermore, working with documents that have a  defined structure make easier the task of using the information in the Document. It is also useful for documenting the data exchanging processes.

Conclusion

In the next post I will include example for both XSD and DTD. From this post the most important take, is to understand the what an XML is, how it structures make it useful. As you've seen in the code above, it is really simple. Tags can be named according to your needs and there are some basic principles to follow for validation if you are working with data that does not require or needs a structure. If the data requires a structure, you now know that there are ways of giving a the document a sort of schema, like in Relational DB's in the next post I will includes examples of this more structured content-specific satisfaction documents.

Databases (Course / Tutorial), Part 1 - Relational Model

This is the first article of a series of where I will explain the basics of Relational Databases. In this series I will cover Relational Database theory, XML, JSON, SQL, Querying, UML, Indexes, Views, Transactions, Constrains and Triggers, Authorization, Recursion in SQL, OLAP, and NoSQL Systems.

There will be a small section for Relational Algebra, which I consider you can skip. However, I highly recommend to go through it, it helps you to structure your relational analysis when designing a relation model.

There is no need to know a programming language. However, it would be best if you know one. I won't be providing any instructions on any language since this series deals only with databases. At some point I may use Python or Java to illustrate a db real life implementation, but the usage of the programming language is not required to understand the essence of the database theory.

If you have any question feel free to post them on the comments. I will try to answer them to the best of my knowledge, at the same time, I invite you to solve any questions that you may know the answer to in the comments.

Ok, so let's get started.

Introduction

Todays digital world is data driven. While programs are useful to manipulate, gather, analyze and present raw data in a way that it makes sense. Databases run in the background making the our interactions with websites, software, even shopping experience at the supermarket easier.

So in short we can think of databases as useful for:

  • Handling small and/or massive
  • Store data in a way that it outlives the programs that executes on that data. This means that data is persistent
  • Managing data safely following ACID (Atomicity, Consistency, Isolation, Durability). This means that databases should be:
    • Concurrent (multiple users)
    • Reliable (99.99999% up time)
    • Speed/Efficiency to query data
    • Transactions atomicity (i.e that data is process fully not partially)
It is important to know that Data-Intensive applications are not always using Database systems. Examples of data not stored in DB's is files like spreadsheets.

Relational Model Terminology

Database: Set of named Tables(or Relations)
Table/Relation: has a set of named Columns(or attributes) 
Row/Tuple: has a value/data for each Column(or attribute)
Column/Attribute: has a type(or domain)

Schema: Structure (description) of the relations in the database
Instance: Actual contents of the Table(Relation)

key: is an attribute whose values/fields should be unique for each Row/Tuple. The key values/fields uniquely identify a Row.
Null: value for undefined or unknown fields/value in the database.

Querying Relational Databases

To start I will not include any code for how to query a DB. Let's just focus on idea of how queries take place in a DB System.







To Query data we need:
1. Design (Scheme) 
2. Initial Data
3. Query language like SQL

When we perform a query we get a new relation. This makes it possible to query an initial query, that is known as composition.

Query Languages:
  • Relational Algebra - formal: in the example below we are querying employees id's that have a salary greater than 3500 and that have a job title of 'Assistant' to determine a promotion. This creates a natural join (⋈ ) between employee and promotion.
π (id) = σ Salary > 3500 ^ (job_title ="Assistant" (employee ⋈ promotion)
  • SQL = actual/implemented: The same query for the employee id for promotion in SQL would be:
 SELECT Employee.ID  
 FROM Employee, Promotion  
 WHERE Employee.ID = Promotion.ID  
 AND Salary>3500 and title="Assistant"  

Conclusion

From the above there might be a lot that seems confusing at first. Don't be dis-encouraged by the complexity of the Algebraic expressions used for the query. In real life applications you will not use them unless your are working on creating a database. 

From this first post, you learn the terminology and how an SQL looks like. You now know that a Relational Database is nothing more than a group of tables that are related with other tables. Later in this series you will see how relationships are established by using the Keys as the means to create relationships.

Links:

Additional to what I present here, I recommend the following link:

This video may be a little more graphic on the concepts that introduced here:

Thursday, February 17, 2011

The secrets behind Twitter and you SEO campaign

Just like it works for a website and blogs.  The more Twitter linking going on within your profile, the more Google is seeing your Twitter profile. So if you are company wondering how to get your posting on Google results. Focused first on a very well design campaign to get as many followers (who are really interested) in what say.

Now, doing a mass following like the spammers do,isn’t going to improve anything. In fact the only possible result of this would be making it worse. Use word of mouth and offline social networking to increase the amount of lists and followers. Follow only people who are ralated to you business (in the SEO Case Matt Cuts, Google and so on).

The same way people don't want to receive unsolicited emails from you. Is the same way their will not be expecting to follow them in twitter. Remember Quality over Quantity rule.

Wednesday, December 22, 2010

HollyDazzle your website

Want to to have your website ready for the holidays decoration in a non expensive way? Well, we have good news for you, and the way you can decorate your website for the holidays. Go to http://www.bluefountainmedia.com/holiday/ and type in the url on your website, a new ulr will be generated and your visitors will enjoy of your after seeing a nice animation that has as background your actual website.

Here is an example of how it will look, click here.

Happy Holidays!!
     

Tuesday, December 7, 2010

SSL - What it is, how to get it and what it is for

If you are running a website or websites with an online shop of any size, securing the information of your customers should be a big deal. In fact, secure eCommerce is successful only if you manage to provide a safe environment for eShopers.

SSL security should by all means included in you safe browsing experience of your website, at least at the checkout process. SSL stands for Secure Socket Layer, and it is a request/response protocol that involves public and private keys, as well as a digital certificate. Most current web severs work with 128-bit security certificates, and most current web browsers are capable of working with a 128 bit public key. Older browsers, work with an encryption level of 40 bits.

SSL certificates need to be requested before http://www.verisign.com, its price should be around USD $895 and your approval will be received within one week. If your request is accepted your certificate needs to be installed on ISS. To test if your certificate is working quickly create a html web page and instead of using http://www.yourwebsite.com use https://www.yourwebsite.com.

by:
Luis Alberto Villamarin Villamil

Monday, December 6, 2010

Google has entered the e-book market

Google has made the big move, e-book are going to be sold through Google editions. There is not going to be device limitations, apps for smartphones and other devices are going to be available for readers and most of the e-readers in the market are going to be able to display Google e-books.

Google also empowered readers and publishers as it is going to have an associates program that will allow individuals and companies to sell their books through their webistes, of course comission will be paid. To upload your content (e-books) go to http:books.google.com/ebooks.




Black Neo-Cushion Protective Cover Sleeve for Amazon Kindle Wireless ebook Reader (Fits 6" Display, Latest Generation Kindle) ***Includes Microfiber Screen Cleaning Cloth**

   

Sunday, October 17, 2010

Want to call a Taxi?

Why to use a taxi or request a taxi service, when you can do it yourself without a driver?

Sunday, October 10, 2010

Who said Google was on the Search Engine Business?

Impossible to believe for some, and long waited for others; intelligent cars that drive themselves will be within the market in some years from now. Scientists from many countries and companies have been working on it, but only one company can do it in such practical way. Google has already been testing its own technology for this purpose, in fact they have been doing for several months. The project is still under development, but based on Google awesomeness I believe that Google will start selling this technology if they sell it (maybe it'll be another freebie) in maybe one or two years.


As scientists not only from Google but from other several countries and companies around the world, this technology completely developed can change life forever, as it will reduce or eliminate the chances of accidents while driving and even lower gas usage. Please check the following video and feel free to spread the word and make comments:


Wednesday, September 8, 2010

Google is once again 1 Million steps ahead

Once again, Google made their browser better a million folds with the new feature just launched. It is unbelievable the way they change the market to make it better. What they have achieved today, is something experts have dreamed of and regular web users will find it very convenient.

This new improvement will allow to get results in Google as you type in.

I invite you to check the following video which will explain you better what Google Instant Search is about.

Tuesday, September 7, 2010

The market is about to change

Technology has no limit. Some new cool devices are out there in the market, or will be launched to the market soon. Just visit the following link to a video that will get you wondering what's coming next and how affordable technology is about to get. Let's say you consider very expensive the iPad, soon you'll get devices from Samsung, Toshiba and others that might beat market prices for tablet pc's.


http://www.pcworld.com/article/204830/tablet_wars_at_ifa_in_berlin_3d_cameras_and_more.html

Monday, August 23, 2010

Soccer Fans wait in line for FIFA 11

The already successful and great at sales FIFA 10 is going to be soon the old game. FIFA 11 is on the way, and people can pre-order it online. The new game promises to improve lots of things as usual. Graphics of course, would be one the issues to be improved, I don't really know what else can you improve when at this point graphics are almost real. Some of the new features will include better and more flexible for online gaming, some say that your triumphs will be also transferable to social network. The latest news say that now soccers fan who like the goalie position, can be the goalie.

Now for sure this are the new features of the game as listed on EA FIFA 11 website:
A new passing system where pass accuracy is determined by a gamer’s ability on the control pad, and player skill, situation and urgency on the pitch.
Personality + sees a soccer player’s performance on the pitch mirrored authentically in game, differentiated and replicated for every player’s skill-set
True freedom in man-to-man interactions, transforming physical play from individual lateral jostling to full 360° collisions involving multiple players
- Go online to craft your own player and create the team of your dreams. Plus, manage your team’s formations and tactics right from the web. Create your player’s appearance, accessories and attributes and then create a team with a distinctive crest and kits.
Assign customized chants for every team and league. Set your home club’s anthems and chants to play during player introductions, halftime, and after goals. Even hear your name echo in the stands of Old Trafford or San Siro with customized chants for your Virtual Pro. Plus, play music from your hard drive in game.
Save highlights from any match – including online – right to your hard drive to view, replay or upload to Footballworld.com at any time.


So far these are the feature from FIFA 11 website, log on or wait for the upcoming trailers.




Trackpad Connected Via USB

Trackpad from Apple is a very cool device and it's fun to use. However, it was really disappointing to have that device working only on Bluetooth mode way. First, because Bluetooth connects consumes more energy from your laptop and reduces the battery life. Second, even though wireless connectivity is where the world is heading it is very important to give users an alternative. This is where this spectacular product has fail to deliver the right solution.

As of today rumors, apparently Mac is working on a USB solution for this problem. Which is expected to be fixed soon, or at least that is what the rumors say. The rumors also indicate that the possible new feature would only take 5 volts of power from the battery whereas the original set up the Trackpad only takes 3 volts. So far the new idea is not ready as one of the issues was power management.

Sunday, August 22, 2010

Google Chrome Store

Google has really went in into the applications market. What one year ago was something mostly impossible, right now is happening, all efforts from Google to be serious contender in the apps market for its own device or at list products/services are paying off.

Google Chrome Web Store is no more than a store for apps that will work Chrome. Apps can be free or paid. As of now the store was opened for developers, the percentage of the paid apps will will 95 percent for developers and the remaining to Google. An extra 30 cents will be charged for transaction fees.

With this new feature rolling Google is totally lined up for its upcoming tablet pc.

For a test or preview of Chrome Store please check the following link:
https://chrome.google.com/webstore

Saturday, August 21, 2010

facebook places

It is a simple new app for Facebook users, that allows to display in your wall where your are located at certain moment. It is mostly intended to be used from a cellphone/smartphone, you just need to go to http://touch.facebook.com/ and from there you will be able to set the place where your are and check-in.

If you are using a computer you can also use the application just by going to the same link. It doesn't take long to do it, and it's fun enough to try. It also has some extra features like having a guest list so you can add people to a place where an event will be held, so they can check in and have a map view of the place their are going.

From my stand point the most important usage of this app, is Facebook when it is used for Business purposes, as it can enhance business owner a page that have some other good features that might lead into more sales getting to the know the place is going to be easier than ever. Check this link for some other ways of using this feature for business purposes.

This is a cool feature but it rises some security issues, while in the US is a safe feature to use and other developed countries. Countries like south american countries with social problems like kidnapping will have some issues as many user will be using this feature and it will be easier for terrorists to target their victims.

Google Tablet is getting closer

Today the new Google unveiled its new Google Chrome 6 version. It is still a beta version, but some major improvements have been included taking the most of html 5. Features like the geographical position where you are location while browsing the web are part of the new things to try out, this particular feature uses your ip connection ip or its uses GPS.

The weahterNear.me html 5 also works the same way as the Android, when you are close to a restaurant or specific landmarks etc, the this browser will let you know, it means that the Google tablet will definitely have this feature available.

The features have also been updated and adapted to the notifications,which have been integrated with  a transparent popup which doesn't interrupt at any point what you are doing. This would let you know when your Facebook friends send a new message or simply when you get a new email on your Gmail account.

Perhaps the most important of all is that it'll have multi-touch which means nothing that the table from Google is just around the corner, all its gadgets are ready to be installed on a new device.

Friday, August 20, 2010

Future of HP

HP's future may not look so bright, but it might look bright also. They have entered to the battle for the Tablet PC market. However this might a difficult one to one, having the current success of iPad and the imminentness success of Android Tablet.

HP bought Pam for $1.2 million, to get their apps teams to develop devices for their version table computing. They want to have a share and that is fair, however things everything is still plans even though the device is planned to be launched by early February of 2009.

I personally think HP is playing the catching up game, I don't see HP being competitive against guys that have already millions of developers interested in their devices, google's case it before it actually exists.Moreover, the market might not take as easy, this is a new technology that is attractive but given its simpleness can be tough to swallow.

Moreover, HP bought  a company which in its last days of independence was losing market share in every possible way. I hope the best to H but, they got to be careful, they should maybe install Android OS to their devices, why not? After all it is about to get the device rolling and HP knows about devices better than software.

User interface future - New devices Coming!

Many companies around the world in a battle to bring to life the new input device for computers that will rule the computing world as the mouse and keyboard do nowadays. Lots of imagination, creativity and extensive endless hours of work have brought new input devices that promise to be a blast in terms of coolness and productivity effectiveness.

Even though it is expensive, a company called Art Lebedev Design, a technology company focused on the developing new user interface and technology, is about to put in the market a device called the Optimus/Adaptive Keyboard. Known for being very expensive and for using touch screen controls system to display a keyboard. The device was built as a result of a contest that has as its only purpose to incentive new ideas.

This cool keyboard not lets people browse within applications and project, but also allows users to select the files they are looking for directly from the keyboard. I invite you to check this video I found on PCworld which will let some of you wondering when the digital future from the movies is going to be.



Thursday, August 19, 2010

McAfee purchased by Intel

From any stand point of view, Intel's move has been clever. At a Glance, it simply means that Intel is now going to have a field to start making money. It is also important to know that McAfee is going to play a very important role and security matters, such that important that McAfee can simple become the biggest computer security system in history.

It is also assumed that this move will let Intel develop better devices based on security threats, which is going to lead to better computers and maybe a new way of using computers. In Computing terms, Meego the new OS system developed by Intel and Nokia is going to be in the market, and now that McAfee in on their side, a security back up is available which is going to look more appealing to users as it is going to be secure, directly from the factory.

Whatever the outcome is, for sure Intel has something big and nice prepared for all us, so stay tunned.