Skip to main content

Posts

Unit Testing with the Jasmine JS

Recently had the opportunity to do pair programming on a project at work. Paring has proven to be invaluable in passing knowledge over to other developers on the team. It is in this paring that I was exposed to Jasmine test behavior development. Jasmine was developed at  Pivotal Labs  back in 2001, and was the first unit testing framework for JavaScript. I won't go into why you should be doing test or behavior driven development, but if your company has adopted the Agile methodology, Jasmine fits nicely into the flow of the Agile process. It gives you the additional security knowing that if at some point in the future someone updates your JavaScript, unless the test suite is updated as well things will begin to break. The Suite or Spec Conceptually, a suite or spec is a bunch of related tests clubbed together with an expected result or outcome. Suites or specs are defined with the global "describe" function. This describes what is being tested. The describe function
Recent posts

Maine summer 2014 photo shoot

Wells Maine beach drive I made a trip up to Wells-Ogunquit Maine last year for my vacation. I was fascinated with the coastal rock formations along the beaches that other photographers had posted throughout the web. I wanted to try my hand at capturing the dawn light and the sunlight reflecting off of the rocks with a long exposure time. In addition, some much needed away time to ride my bike and read. Marginal Way Day one consisted of scouting locations. Perhaps a quick bike ride or beach outing followed by a lobster sandwich. After unpacking I took my bike out through the streets of Wells Maine. I was struck by how similar it was to the town in the movie Jaws Martha's Vineyard. Wells is a small town with narrow streets and older homes. The beach drive featured a fantastic stretch of road just perfect for biking. After a great seafood dinner I scouted the Marginal way.  A combination of site seeing and shooting with the iPhone.  I really underestimated the amount of to

Database Normalization Basics

There are 3 primary reasons why a database should be normalized: It brings data integrity to the tables (entities). This facilitates proper inserting, updating, and deleting of data thereby preventing data anomalies. If a table is not normalized it runs the risk of inconsistent data, data redundancies, and inconsistent result sets.   To create entity relationships thereby providing referential integrity. Referential integrity ensures that relationships between tables remain consistent when entities are altered. To avoid having one set of users with a biased view of the data. For example a marketing department may view the data in line with their revenue needs rather than having an objective view of the data as it applies to the entire organization. We begin by analyzing the current relationships that exist between the attributes within each entity. Apparent in the Orders entity is the repeating data in the ITEM_NAME, ITEM_DESCRIPT, QUANTITY, and PRICE attributes. We break the en

When inspiration happens, what stands in the way?

I was making my way down a wooden walkway on an early morning photo outing - backpack and tripod in hand – when I was struck by this eerie scene that appeared before me.  A perfect moment, I instinctively reached for my iPhone and snapped off this. Had I taken the time to pull the equipment out and set everything up on the tripod, would I have grabbed a better image? Would it have the same wow factor had I used the better equipment? Would I have missed the sun in that particular spot in the sky? At what point does "gear" get in the way of creativity? Should inspiration drive the hardware choices? At a recent photo club outing, the leader was explaining why he continued to use older photography equipment on his hikes. His intention was to always travel light. His tripod was small; it featured no ball head mountings or other bells and whistles, very bare bones. His camera was a point and shoot with an attached lens. He would simply stoop down at an interesting scene and fir

A look at network traffic

Lets take a quick look into the network traffic that is generated when an activity occurs such as a file download via an HTTP request. We will also look further into the TCP protocol handshake, sequence numbers, and their values. We will examine their significance resulting from the HTTP request. What role does TCP play during HTTP requests? Is TCP a connection-oriented protocol? Explain in details. A TCP header has Flags field. Describe the meaning of flags "SYN", "SYN ACK" and "FIN". Transmission Control Protocol is, as its name states, controls the transmission of an application between end points. HTTP is the application layer in this case, TCP provides for the reliable delivery of HTTP requests. It passes over to the network layer. A user initiates an HTTP request by opening a browser and requesting a web page via a URL. The server will then deliver the request, and any objects such as images, movies, PDF files etc that the web page may have em

:nth-child structural pseudo-class selectors

There are 4 pseudo-class expressions that are part of the :nth-child pseudo-class. Structural pseudo-class selectors target HTML elements based on the DOM tree. Basically, elements that cannot easily be targeted by simple selectors or combinations of selectors. What makes pseudo-classes so handy is the ability style elements dynamically based on its position in the DOM. :nth-of-type(N) :nth-last-child(N) :nth-child(N) :nth-last-of-type(N) :nth-of-type(N) selector My favorite of the 4 is the :nth-of-type(N) selector. The nth-of-type selector allows you to select child elements of a parent based on the particular type of the element, for example every 5th "li" element in a list. You can select even or odd elements, or the nth (order number) child in the group of elements. The class accepts the argument "n" which can can be a keyword, a number, or strings "odd", "even", or an expression "-n+3". Let's look at a simple but ef

Creating triggers

Triggers are SQL statements which are stored with the intention of being activated or fired when an event associated with a database table occurs. This could be any event including an INSERT, UPDATE and DELETE. Lets begin by creating a few simple insert triggers CREATE a trigger on the ORDERLINE table for the insert event. The trigger will update the corresponding PRODUCT record QTY_ORDERED by adding the value of QTY to QTY_ORDERED. CREATE TRIGGER tr_qty_ordered_value_insert ON Orderline FOR INSERT AS BEGIN UPDATE product SET QTY_ORDERED = QTY_ORDERED + ((SELECT qty from INSERTED) * (SELECT unitprice from INSERTED)) WHERE product.ProductID = (SELECT ProductID from INSERTED); END; Command(s) completed successfully. CREATE a trigger on the ORDERLINE table for the delete event. The trigger will update the corresponding PRODUCT record QTY_ORDERED by subtracting the value of QTY FROM QTY_ORDERED. CREATE TRIGGER tr_qty_ordered_value_delete ON Orde