Friday, October 4, 2013

Database Website to Run and Practice SQL Query Online for FREE - SQLFiddle

Other day, I was looking for a website to execute SQL query online, since I have uninstalled Microsoft SQL Server because of memory and CPU constraint and I don't want to install it again, just for executing another query. Also, installing database is pain, it takes time and eats up lots of resources e.g. RAM memory, CPU etc; Given so many database to work with e.g. Oracle, MySQL, Sybase, PostgreSQL and SQLLite, it's not really possible to have all of them in your poor laptop. Fortunately my search leads be to this wonderful site called SQLFiddle, this is what exactly I wanted. This site offers support for lot of popular databases, allows you to build your database schema online and execute SQL query on the fly. I couldn't have asked more, It's a great resource to learn and practice SQL queries online. Apart from many sweet feature, it also allows you to share your problem with community. If you are writing a complex query and stuck in middle, looking for help, you can create your schema on SQLFiddle and can share with your query to any forum or question answer website like StackOverFlow or any forum. Having a collection of online database, just makes running SQL query a fun. You can understand, how happy I am to know about this site, which let me to run and practice my SQL queries online, that I am sharing with you guys. To be frank, there is not many online site, where you can practice SQL query in your favorite database. I was looking for online website to test SQL query from long time, but couldn't find anything like SQL Fiddle, May be I am not aware if couple of them like SQLFiddle already exists, but this a site every programmer, database administrator, SQL beginners and SQL Experts must bookmark, a great tool in SQL developer and any programmers armory.
Read more �

Wednesday, October 2, 2013

Tampa Hillsborough SQL User Group meeting.



I spoke at the Tampa - Hillsborough SQL Server User Group meeting on Thursday, September 26, 2013.



I presented "Cure your sysadmin addiction" covering how to strictly manage your SQL Server sysadmin role membership.



The projector cooperated or I've gotten better at using one. 



Interestingly, I am presenting a PowerPoint presentation using LibreOffice Impress running on Ubuntu Linux 12.04 LTS. How's that for interoperability? Linux plays nice even with Microsoft formats.



There were several good questions and a nice amount of discussion about the topic.



The materials can be downloaded here



Thank you to all that attended.

What is PriorityQueue or priority queue data structure in Java with Example - Tutorial

PriorityQueue is an unbounded Queueimplementation in Java, which is based on priority heap. PriorityQueue allows you to keep elements in a particular order, according to there natural order or custom order defined by Comparator interface in Java. Head of priority queue data structure will always contain least element with respect to specified ordering. For example, in this post, we will create a PriorityQueue of Items, which are ordered based upon there price, this will allow us to process Items, starting from lowest price. Priority queue is also very useful in implementing Dijkstra algorithm in Java. You can use to PriorityQueue to keep unsettled nodes for processing. One of the key thing to remember about PriorityQueue in Java is that it's Iterator doesn't guarantee any order, if you want to traverse in ordered fashion, better use Arrays.sort(pq.toArray()) method. PriorityQueue is also not synchronized, which means can not be shared safely between multiple threads, instead it's concurrent counterpart PriorityBlockingQueue is thread-safe and should be used in multithreaded environment. Priority queue provides O(log(n)) time performance for common enqueing and dequeing methods e.g. offer(), poll() and add(), but constant time for retrieval methods e.g. peek() and element().
Read more �

Monday, September 30, 2013

How clone method works in Java

clone is a tricky method from java.lang.Object class, which is used to create copy of an Object in Java. Intention of clone() method is simple, to provide a cloning mechanism, but some how it's implementation became tricky and has been widely criticized from long time. Anyway, we will not go to classic debate of clone in Java, at-least for now; instead, we will try to learn how clone method works in Java. To be fair, understating cloning mechanism in Java is not easy and even experienced Java programmer fail to explain how cloning of mutable object works, or difference between deep copy and shallow copy in Java. In this three part article, we will first see working of clone method in Java, and in second part we will learn how to override clone method in Java, and finally we will discuss deep copy vs shallow copy mechanism. The reason I chose to make this a three part article, is to keep focus on one thing at a time. Since clone() itself is confusing enough, it's best to understand concept one by one. In this post, we will learn what is clone method, what it does and How clone method works in Java. By the way, clone() is one of the few fundamental methods defined by objects, others being equals, hashcode(), toString() along with wait and notify methods.
Read more �

Sunday, September 29, 2013

Validity of Nanotyrannus

Hi all.  It's been a while, but I've been finishing the Lori matrix and earning money.  This post is based on Carr's excellent Tyrannosauroidea blog, which will be added to my blogroll once I update it.  Carr wrote a post arguing Nanotyrannus are juvenile Tyrannosaurus, and while I provisionally agree with this, I felt his reasons were partly flawed and that any modern defender of the genus wouldn't be convinced.  Arguing as Devil's Advocate, I commented about this, and Carr has since replied.  As my own reply to that is so long, I felt I would post it here and link here from his blog.  The points are numbered to correspond to Carr's, though this is rather messy as some points are made in multiple places.  Enjoy.

Thanks for the detailed reply, Tom!  As with before, I write as Devil's Advocate, as I do provisionally agree with you Nanotyrannus are juvenile Tyrannosaurus.  That said, it seems we do actually have some philosophical differences.

#1/#6- You seem to have a double standard here.  For Nanotyrannus you write "Instead, they have just heaped on new characters as if that�ll do the job of rescuing the taxon" but for Tyrannosaurus you say "there is no reason to think that T. rex is invalid, given the quality of specimens (including the type) and sample size that has been amassed. Certainly, the time has come to bring the diagnoses for T. rex and many other taxa up to date..."  So we can heap on new characters for Tyrannosaurus, but not for Nanotyrannus?  What's ironic here is that Bakker et al.'s (1988) diagnosis was itself heaping on new/all characters to the original diagnosis of lancensis by Gilmore (1946).  That original diagnosis was completely stratigraphic, as Gilmore viewed the few differences he saw between lancensis and sternbergi as potentially individual variation.  Thus he wrote "in view of the great interval of time that has elapsed between Belly River and Lance, one appears justified in believing that it is too great a span in time for a species to pass unchanged from one to the other, and that with the discovery of additional materials characters will eventually be found that will adequately distinguish them."

"In my mind, there is no reason not to accept the diagnosis of Nanotyrannus (or any other taxon) as, prima facie, the best argument for establishing a scientific name."  The reason is that diagnoses are a product of their time, both in the sense of less material being known and available, and the philosophy being outdated.  Original diagnoses are often terrible for this reason, though the taxa are still valid.

In my view, an original diagnosis is just a starting point for assessing validity.  If it fails, you then check subsequently suggested diagnostic characters.  If that fails, you then look yourself for unpublished diagnostic characters.  If that fails, synonymy or indeterminacy is reasonable.

#1/#2/#3- Now you do have a point that if Jane were diagnostic but the Cleveland skull were not, then Jane could not easily be called Nanotyrannus lancensis.  But this isn't true of all of the characters suggested by Larson.  According to him, the Cleveland skull has a large number of maxillary teeth, strongly labiolingually compressed lateral teeth, a narrow vomer, posteriorly located maxillary fenestra, shallow antorbital fossa, posterodorsal quadratojugal notch, subnarial foramen enclosed by maxilla, quadratojugal foramen, and dorsally opening jugal foramen.  Now I agree with you that most of these are ontogenetic (though even younger Tarbosaurus MPC-D 107/7 lacks the high maxillary tooth count, enclosed subnarial foramen, pneumatic quadratojugal and jugal foramen orientation, so on the surface those look potentially valid), but you can't write off new Nanotyrannus diagnoses as being only based on Jane.  And given that the Cleveland skull and Jane share some apparent apomorphies, it's perfectly valid to use the additional apparent apomorphies from Jane to support Nanotyrannus.

#X- I understand your not wanting to discuss Larson's (2013) proposed Nanotyrannus characters or those only preserved in Jane, due to your work on those topics being in prep..  In a sense, that stalls the issue on your blog for now and makes it so we really can't have a good modern defense of synonymy. 

But there is one character we can tackle, preserved in the Cleveland skull and presented as an autapomorphy prior to Larson's work- the high maxillary and dentary tooth count.  You say "I did propose a hypothesis to account for the difference in tooth count (Carr, 1999)" and that's true- that libratus and some modern crocodilians also show a reduction.  But since then Currie (2003- fig. 5) have graphed out both libratus and Tarbosaurus to show no decrease, and Tsuihiji et al.'s (2011) new tiny Tarbosaurus has an adult count too.  As a stable or increasing count is also seen in Coelophysis, Ceratosaurus, Majungasaurus and therizinosauroids, this makes the apparent condition in crocodilians irrelevent and argues against your hypothesis.  It's always possible Tyrannosaurus was unusual among theropods in reducing tooth count with age, or that the Cleveland skull is an outlier independent of age (though Jane strains the probability of this), but either rationale is ad hoc instead of fitting with expected trends.  This was always the strongest pre-Jane argument for Nanotyrannus in my opinion, and it remains so.  If the toothy Alioramus are Tarbosaurus, this would give some precedent (for the jugal foramen orientation too), but see below for that.

#4- "In the table I present (implicitly) the hypothesis that Daspletosaurus is peramorphic relative to A. libratus, in that the growth trends are carried further in the tyrannosaurine. That is why Daspletosaurus is under the heading �Stage 4�."  But in 1996, you explicitly said- "Four ontogenetic stages are defined ...  These morphotypes have been misinterpreted by previous workers as distinct taxa. Daspletosaurus torosus ... are found to be invalid taxa, representing the adult morphotype of Albertosaurus libratus ...".  So Daspletosaurus was explicitly thought to be a a stage 4 Albertosaurus by you at first, based on these stages.  Like I said, you changed your mind by 1998, but this indicates the list/table itself is not capable of distinguishing ontogeny from peadomorphy/peramorphy. 

"The salient point you make is the suggestion that the Cleveland skull is an adult, but it does not grow past stage 1. I think it is reasonable to expect that an adult of a true �pygmy� tyrannosaurid would have all of the adult characters seen in its closest relatives."
Wouldn't a paedomorphic taxon by definition not have all of the adult characters seen in its closest relatives?  More importantly for our actual argument, you showed the Cleveland skull has juvenile bone grain.  This seals the deal on its age for me, so I agree with you its a juvenile regardless of any other ontogenetically variable characters.  Unless paedomorphic vertebrates can have juvenile bone grain?  Does that happen?

#5- "With regard to Bakker et al.�s (1988) tyrannosaurid phylogeny, I do think that context matters. Their arrangement complements what they say in the text, together showing the deductions that led to their taxonomic decision. It is an excellent article in that the data are absolutely clear."  Not really important to our debate, but this further illustrates a difference in our philosophy.  Put basically, if a taxon is conceived in an inaccurate context (be it diagnosis or phylogenetic hypothesis), it's invalid.

#7- So put less obscurely, you disagree with your coauthors and think Alioramus is a juvenile Tarbosaurus?

#8- "Yes, it is fair because sufficient data was at hand (e.g., Rozhdestvensky, 1965), and there were two growth series (A. libratus, T. bataar) available with which to make comparisons."  Harsh, as the libratus sample in 1988 didn't get younger than "sternbergi".  But again, not a very useful point of contention.

#10- "That�s a good point! I have to admit that I was late on the scene as well (Carr and Williamson, 2004)."  In your defense, by 1999 the specimen was viewed as either a new species megagracilis, or an entire new genus Dinotyrannus.  Bakker et al. didn't have that excuse in 1988.

#11- "The bottom line is that the relative maturity of specimens and their taxonomic identity must be considered separately..."
Er, that seems contrary to your main philosophy and methodology, and of science basically.  You established an ontogenetic series in libratus, then compared Nanotyrannus and Maleevosaurus to that to go a long way to determining their age.  You also found striations and unfused bones in Nanotyrannus, but the importance of these also depend on their variation in other specimens with known age.
If Nanotyrannus were magically proven to be an adult, for instance, your whole argument for Maleevosaurus being a juvenile Tarbosaurus would collapse.  All of the juvenile libratus characters present in Maleevosaurus would also be present in adult Nanotyrannus, so Maleevosaurus could be an adult as well.  I don't think this situation is true (barring juvenile bone grain existing in paedomorphic adults), but philosophically it seems valid.

"Williamson and I (2004) showed that �Stygivenator� is referable to T. rex, but Larson (2013) did not engage with the evidence that we presented."
This is a good example.  IF Nanotyrannus is valid and sister to Tyrannosaurus, then the Tyrannosaurus-like characters you identified in "Stygivenator" don't mean it is Tyrannosaurus, because Nanotyrannus also has them.  They would only go as far to show "Stygivenator" was in the Nanotyrannus-Tyrannosaurus group.  Since Larson already believes this, he doesn't need to engage with them.

#Y- You say "it is curious that people are a lot less upset about my hypothesis that Maleevosaurus is a juvenile T. bataar".  I think it's just that less people have bothered with it.  You (1996, 1999) used Maleev's figures to argue the supposed cranial apomorphies were juvenile characters, but no one's even addressed Carpenter's (1992) postcranial characters (tall cervical neural spines; reduced acromion on scapula; pronounced spur-like obturator process; downcurved ischium; and metatarsals III and IV don't overlap the metatarsals medial to them much), adult characters (closed neurocentral sutures and fused astragalocalcaneum) or examined the specimen themselves since Maleev's work AFAIK.

References- Gilmore, 1946. A new carnivorous dinosaur from the Lance Formation of Montana. Smithsonian Miscellaneous Collections. 106, 1-19.

Bakker, Williams and Currie, 1988. Nanotyrannus, a new genus of pygmy tyrannosaur, from the latest Cretaceous of Montana. Hunteria. 1, 1-30.

Carpenter, 1992. Tyrannosaurids (Dinosauria) of Asia and North America. in Mateer and Chen (eds.). Aspects of nonmarine Cretaceous geology. Beijing, China. Ocean Press. 250-268. 

Carr, 1996. Cranial osteology and craniofacial ontogeny of Tyrannosauridae (Dinosauria: Theropoda) from the Dinosaur Park Formation (Judith River Group, Upper Cretaceous: Campanian) of Alberta. Masters Thesis. University of Toronto. 358 pp.

Carr, 1999. Craniofacial ontogeny in Tyrannosauridae (Dinosauria, Coelurosauria). Journal of Vertebrate Paleontology. 19, 497-520.

Currie, 2003. Cranial anatomy of tyrannosaurid dinosaurs from the Late Cretaceous of Alberta, Canada. Acta Palaeontologica Polonica. 48(2), 191-226. 

Tsuihiji, Watabe, Tsogtbaatar, Tsubamoto, Barsbold, Suzuki, Lee, Ridgely, Kawahara and Witmer, 2011. Cranial osteology of a juvenile specimen of Tarbosaurus bataar (Theropoda, Tyrannosauridae) from the Nemegt Formation (Upper Cretaceous) of Bugin Tsav, Mongolia. Journal of Vertebrate Paleontology. 31(3), 497-517.

Larson, 2013. The case for Nanotyrannus. in  Parrish, Molnar, Currie and Koppelhus (eds.). Tyrannosaurid Paleobiology. Indiana University Press. 15-54.

Wednesday, September 25, 2013

SQLSaturday #232 Orlando - The case of the pesky projector



On Saturday, September 14, 2013, I presented my session "Cure your sysadmin addiction" at SQL Saturday #232 in Orlando at Seminole State College. 



I can prove it. I have pictures. 



On the left, I'm wearing my speaker shirt "Bubba-style". 













The best #SQLSat232 tweet was...










































My session was right after lunch and the speaker group picture so I had to hurry to my session at 2 PM



Once again, getting the projector to play nice with my laptop proved to be difficult.



I could not get PowerPoint Presenter View to work correctly.  



Running Windows 8 as a guest OS in VirtualBox on a Ubuntu Linux 12.04 LTS host should not be this difficult.  Should it?



Why does this always happens when Rob Volk is in the room?









That's Rob on the right.


























I did test my setup prior to my talk.  It worked at home.  Here's proof.  

Believe me now Mr. Dunagan?  ;-)







































I think I need to run the Guest OS in Fullscreen mode for it to work correctly.

It might have been a resolution issue also. Adjusting the resolution I'm sending to the projector may have helped. I'll keep that in mind next time.



Despite the issues with the projector, I did get through my entire presentation and still had time to answer questions along the way.  It was my third time presenting this session so I was pretty pleased I remembered most of my notes.



If you need another good reason to manage sysadmin strictly, consider this.



Another great job by Karla Landrum, Kendal Van Dyke and the team in Orlando.  Seminole State College is one of the best SQL Saturday venues. Keller's BBQ provided a great lunch again with the speakers serving up the goodies. I'm glad the speaker shirts were the standard polo.  I can wear it to work although I could be mistaken for a Florida Gators or Clemson Tigers fan.



I'll get a chance to do my talk again at the Tampa SQL User group meeting at the end of this month.  Hopefully, I can get the pesky projector working.


Tuesday, September 24, 2013

JSTL forTokens Tag Example - Split String in JSP

JSTL forTokens tag is another tag in core JSTL library to support Iteration or looping. It effectively complements, more useful <c:forEach> tag, by allowing you to iterate over comma separated or any delimited String. You can use this tag to split string in JSP and can operate on them individually. forTokens tag has similar attribute like forEach JSTL tag except one more attribute called delims, which specifies delimiter. For example to iterate over colon separated String "abc:cde:fgh:ijk", delims=":". By the way, forTokens tag also accept multiple delimiter, which means, you can split a big string into token based upon multiple delimiter e.g. colon(:) and pipe (|), This will be more clear, when we will see examples of JSTL forTokens tag in JSP. Rest of attribute e.g. items, var, varStatus, begin, end and step are same, as they are in case of <c:forEach> tag. For quick review, items specify String which needs to be split-ed in token and var hold current String.
Read more �