A T-SQL Table Function

By Michael McLaughlin, Planet MySQLFebruary 12, 2013 at 03:16AM

I had an interesting conversation about table functions in Oracle’s PL/SQL; and the fact that they’re not available in MySQL. When I explained they’re available in Microsoft T-SQL User-Defined Functions (UDFs), my students wanted a small example. One of them said they’d tried to do it but couldn’t get it to work because they found the Microsoft web pages difficult to read and use. Specifically, they didn’t like the sparseness of this one on how to create a function.

Here’s a quick definition of a UDF table function that runs in the studentdb schema (created in this post for migrating SQL Server into a MySQL database). The following getConquistador function takes a single string, which acts to filter the result set from a query positioned as the return value of the function.

CREATE FUNCTION studentdb.getConquistador
(@nationality AS VARCHAR(30))
RETURNS TABLE
RETURN SELECT * FROM studentdb.conquistador WHERE nationality = @nationality;

Unlike Oracle SQL, where you need to use the TABLE function to read the content of a table result from a function, you don’t need anything other than the function call in the FROM clause of a T-SQL query. Here’s an example of calling the table function:

SELECT * FROM studentdb.getConquistador('German');

The complete result from the query would produce these results when run from the sqlcmd command-line interface:

conquistador_id conquistador          actual_name          nationality
--------------- --------------------- -------------------- ------------
             11 Nicolas de Federman   Nikolaus Federmann   German
             13 Jorge de la Espira    George von Speyer    German
 
(2 rows affected)

However, you also have the ability to query only rows of interest without any specialized syntax, like this:

1> USE studentdb;
2> SELECT conquistador AS "Conquistador"
3> ,      actual_name AS "Name"
4> FROM   studentdb.getConquistador('German');
5> GO

This produces the following two-column result set:

Conquistador          Name
--------------------- --------------------
Nicolas de Federman   Nikolaus Federmann
Jorge de la Espira    George von Speyer
 
(2 rows affected)

Hope this helps those interested in T-SQL UDFs.

PlanetMySQL Voting:
Vote UP /
Vote DOWN

Top 10 Hacks for Automating Your Life

By Whitson Gordon, LifehackerFebruary 09, 2013 at 11:00AM

Top 10 Hacks for Automating Your LifeWhat if you were a wizard that could bend the entire world to your will? Chores would do themselves, bills would pay on time, and your appliances would obey your every thought. Well, you can’t do that exactly, but with a bit of ingenuity, you can automate a lot of your life so you don’t have to trudge through the boring stuff. Here are ten things you can automate right now.

10. Maintain Your Computer Without the Work

Top 10 Hacks for Automating Your LifeNo one likes to sit around and clean up their computer, but it’s something that has to get done. We’ve talked about what kind of maintenance you need to do on your Windows PC and Mac, and much of that you can automate—like running CCleaner on a schedule. You should also set up an automated backup program, so you never lose your data. Set it up once, and forget it.

9. Make Your Bills Pay Themselves

Top 10 Hacks for Automating Your LifePaying bills and managing your budget sucks. Luckily, we live in an age where computers can do a lot of the work for us. Have your bills automatically pay themselves online, and set up an automatic budget that’s easy to stick to with Mint. Check out our guide to automating your finances for more ideas, and be sure to check out when you shouldn’t automate your finances, too.

8. Create a Diet Without Thinking

Top 10 Hacks for Automating Your LifeWhether you’re trying to lose weight or just take the stress out of planning and cooking, you can automate what you eat with a number of tools. Gather all your recipes up in one place and plan your weekly meals ahead of time for stress-free shopping and cooking. If you need to pay closer attention to your diet (like if you’re trying to lose weight), try a service like Eat This Much or Swole.me, which will plan your diet for you based on your goals. That way, you can keep an eye on what you eat and stay on track with minimal effort.

7. Organize Important Documents and Files

Top 10 Hacks for Automating Your LifeWe’ve all got stacks of papers lying around, not to mention a hard drive full of unorganized files. Luckily, you can automate just about anything with those files using a few tools. First, if you’re having trouble organizing that paper, go paperless so you can organize it digitally—it won’t take you much time. Ditch hard drive clutter by organizing your home folder automatically. For everything else, you can use Actions on Windows or Automator on the Mac—they’ll let you automatically rename a bunch of files, crop a large number of images, or even extract text from a bunch of PDF files. Anything you can imagine, you can probably do—heck, I even put together a service that syncs iTunes with nearly any device.

6. Do Away with Shopping and Get Automatic Discounts

Top 10 Hacks for Automating Your LifeWhether you’re grocery shopping or trekking yourself to Home Depot, you can make shopping a lot easier by…well, not doing it. For example, Amazon Subscribe & Save will automatically send you everything you need on a schedule, and at a nice discount—heck, you can even use it to automate office lunches. Don’t like grocery shopping? Get what you can delivered, and plan your way through the store for the few things you can’t. While you’re at it, be sure to automate all your coupons so you don’t have to search for discounts—you’ll just get them automatically.

5. Make Your Phone Read Your Mind

Top 10 Hacks for Automating Your LifeSmartphones can be useful, but sometimes it feels like it takes forever to perform the simplest of tasks. With a few tools, you can essentially make your phone read your mind, performing tasks in response to related actions. For example, you could tell your phone to automatically dim your screen at night, or go into silent mode when you put it face down. Android users should check out Tasker, while iPhone users will need to jailbreak and try out some of these tools to make it happen.

4. Integrate Your Favorite Apps and Web Services

Top 10 Hacks for Automating Your LifeYou probably have a few apps and tools that you absolutely couldn’t live without—like Dropbox, Gmail, a to-do list, or something else. That’s great, but you can make those services even better by automating tasks—and even making them talk to each other—with If This Then That, also known as IFTTT. Make job searches easier, save articles for later, fix Instagram pictures on Twitter, add to-dos with Siri, make app deals last forever, archive your life, get digital doubles of your photos, and much much more. There’s barely a limit to what it can do.

3. Download Anything Without Even Searching for It

Top 10 Hacks for Automating Your LifeThe days of combing the net for good downloads is over. With a small collection of programs, you can have your computer automatically search for, download, and organize nearly any type of file in existence. You can even tell it the quality of videos you want to download, the file format of the music you want, or what program you want to use to download it. It takes a little work to set up, but you’ll never have to search for a file on the web again.

2. Put Your Chores on Autopilot

Top 10 Hacks for Automating Your LifeDoing chores is boring, so why waste time doing them when you can put them on autopilot? You can’t make your broom come alive and clean the room for you (unless you’re Merlin), but you can create a schedule that breaks everything up into almost unnoticeable chunks. Do your cleaning in regular short bursts, speed up your laundry, and even maintain your home without batting an eyelash. It isn’t true automation, but it’ll sure feel like it when you have all that extra time in your day.Photo by Maarten Takens.

1. Automate Everything In Your Home

Top 10 Hacks for Automating Your LifeEver wish you could change the thermostat without getting up, or unlock your door without fumbling with your keys? Home automation can make it happen. We’ve shared tons of tricks over the years, from transforming your digs into a home of the future, controlling everything with Siri, turning stuff off with your phone, or even watering the plants and feeding the cat. Check out all our posts on home automation for even more ideas—the sky’s the limit!

Toolbar.js for jQuery and Bootstrap: Flexible Toolbars in iOS Style

By Dieter Petereit, noupeFebruary 09, 2013 at 09:18AM


  

No matter whether you like the design style of iOS or you don’t. We need not participate in the ongoing discussion about sceuomorphism. One topic cannot be disputed. I’m talking about the toolbar design Apple’s iOS introduced. Modern websites tend to adapt that concept more often than not. Tapping an icon or a link unveils more options. This is space-saving and an established implementation by now. The jQuery plugin Toolbar.js, created by Paul Kinzett from New Zealand, allows for iOS-style toolbars on any website. The tool is dead-simple to integrate.

The Evolution of Star Trek

By Noemi Twigg, ForeverGeekFebruary 08, 2013 at 03:23AM

The Evolution of Star Trek Infographic Star Trek TV Series Films NASA Star Trek Science Fiction TV Films Space.com  470x303 The Evolution of Star Trek
Infographics are so ubiquitous these days that you can easily say “There’s an infographic for that!” instead of “There’s an app for that!”, can’t you?

Sometimes, though, you get to see an infographic that totally gets your attention. You start out thinking it’s just another infographic that may be interesting to browse, and before you know it, you’ve been on the page for longer than your break. Of course, the double-checking and other distracting elements come into play as well. Not to mention sharing the thing with friends and engaging them on chat at the same time, debating the finer points of the infographic.

That’s exactly what I came across today: The Evolution of Star Trek.

From Gene Roddenberry’s experience as a World War II pilot to William Shatner and Leonard Nimoy first appearing on TV as the iconic “couple” – The Evolution of Star Trek is nothing short of mesmerizing.

Another aspect of The Evolution of Star Trek that I think gives it an edge is the fact that it integrates real-life information related to man’s achievements in space. I don’t know if kids still learn about Yuri Gagarin these days, but the likes of him and the Challenger are mentioned.

There’s no point in me nattering on about the graphic when you can go over it yourself. Enjoy the weekend!

(Note: For more Star Trek infographic goodness, check out The Only Star Trek Character Chart You’ll Need.)

Star Trek 45 Years The Evolution of Star Trek

The Evolution of Star Trek

Today on Food Makers: How to Build Outdoor Ovens

By Stett Holbrook, MAKEFebruary 06, 2013 at 12:40PM

Screen Shot 2013-02-06 at 9.15.24 AMWarm weather is not so far away and that means the outdoor cooking season coming up. With that in mind, I thought it would be interesting to talk about how to build a variety of outdoor ovens. In this episode of Food Makers, a Google+ hangout on air at 2pmPST/5pmEST, I’ll be talking to experts Kiko Denzer and Eva and Max Edelson. Kiko is the author Build Your Own Earth Oven and Eva and Max founded Firespeaking, a website about masonry heaters, wood-fired heaters, and natural building.

Read the full article on MAKE

Get A Visual Taste Of History With Google Maps & Google Earth

By Joshua Lockhart, MakeUseOfFebruary 04, 2013 at 08:31PM

visual history googleGoogle Maps and Google Earth have always been known for helping mobility-impaired wunderlusters virtually adventure all over the globe. However, despite any of your current obstacles, it’s always possible – whether it be after time or financial gain – to travel at least once in your life.

What is actually impossible is the ability to go back in time and visit worldwide landmarks during different eras, but as expected, Google has already attempted to fix this small problem in the time-space continuum.

Our technological TARDIS remains on Earth, but nevertheless, the potential that Google Maps and Google Earth offer is impressive. I’m here to show you just how impressive they can be.

Street View Locations & Photo Tours

We all have used Street View to take a look at our house (or to see if the neighbors down the street actually have a pool). However, for those of you seeking to be more productive with your Google Map activities, there are a few historical sites to explore on your own. Most of them offer user-submitted images to view as well, and if you are up for browsing, you can find hundreds of these locations. Below are three of them.

Kronborg Castle

visual history google

The world of Hamlet comes to life through the Street View images of Kronborg Castle. Here, you can move about the castle’s courtyard on your own and view photos that showcase the structure in a variety of ways. On the historically-accurate side of the fence, I say it’s always interesting to tour places that were influenced so much by war.

Bletchley Park

visual history

While serving as a British decryption area for Axis-transmitted ciphers during World War II, the intelligence acquired from Bletchley Park helped the Allies take down the U-boats in the Battle of The Atlantic. That said, this secretive site is now open for the public to view today. It’s funny how history works, isn’t it?

Catherine Palace

visual history

Catherine Palace was a summer residence for Russian tsars, but it eventually came to be known for Catherine the Great – its namesake. The female leader of Russia called for several renovations during her lifetime, building it to be the beautiful structure we see represented today.

Note that I did say “represented”, for the Germans intentionally destroyed it during World War II. Fortunately, the Russians kept many records depicting its original state, and it was allowed to be rebuilt quite efficiently.

Google Photo Tours

visual history

There are quite a few other locations you can find in addition to the places I’ve shown here. However, with Google Photo Tours, you can be magically transported through an automatic 3D-like slideshow which jumps you from place to place throughout a location. As a matter of fact, Google has a map that links to each and and every single one that exists. Please note that you must use MapGL in order for these to work.

Derivative Creations

Beyond Street View and Google Photo Tours are sites and other creations that have integrated Google Maps and Earth. Keep reading to check out just a few of them.

There And Then

history google maps

There And Then may be my most favorite site out of all the ones shown here, and it’s because of its unique incorporation of video into Google Street View. The site exhibits an album of selectable historically significant locations, and after choosing one, a screenshot of its Google Street View image will take up the screen along with an extra snazzy feature.

Layered upon the Street View is a YouTube video displaying the same selected location in its former years. What makes this interesting is that the video content is graphically lined up with the Street View picture, providing the illusion of history happening in the present. As a note, Street View is not actually usable with There And Then.

History Pin

history google maps

History Pin lets contributors geographically pin their photographs of landmarks to a Google map. While on the site, you could search for a location like the Eiffel Tower. After “arriving” to your destination, you’ll see a group of photographs focused on the metal wonder that include an image from 1855 and one depicting a scene from New Year’s Eve of 2008. These are just a few samples of the many pictures found here, and it’s also a small sample of what History Pin has to offer as a whole.

Along with this image-sharing feature are on-screen tours, collections of landmark photos, and personalized channels. Users can easily add their own photos, highlighting the History Pin’s creators’ desire for a collaborative environment. Furthermore, a search-by-date function exists, helping you see the world at any point of time.

The Titanic

visual history google

Google Earth already offers several different 3D building models for web-world travelers to discover, but if you do a bit of searching, you’ll find a few 3D shipwrecks scattered across the seas, too. The above link will actually allow you to download a .KMZ file that whisks you away to the Titanic shipwreck site, taking you below the waters and to a crude 3D model of the behemoth.

Of course, the 3D model of the ship by itself isn’t very educational. Alongside the polygonal representation are a few photographs of the sunken Titanic paired with links to the photo source. All in all, this little feature is amazing.

Oh, and here are a few more .KMZ files for you to download:

If this doesn’t satiate your historical cravings, you can find a number of them at Google Earth Hacks.

Conclusion

The world is a vast and wonderful place, and the folks Google are just crazy enough to try and document it all. In real life, it would be impossible to visit every square inch of this planet, and unfortunately, it seems to be be the same case with Google’s electronic representation. However, I’m willing to bet you can see a lot more of the world in a lot less time using the above links. (Nothing beats breathing in a new kind of air, though.)

What other locations have you found with Google Maps and Google Earth? Do you have any suggestions for us here at MakeUseOf?

The post Get A Visual Taste Of History With Google Maps & Google Earth appeared first on MakeUseOf.