Monday, April 20, 2009
Sunday, January 25, 2009
Back in Lima, heading home tomorrow!
Jess and I made it back to Lima this morning after a 15 hour bus ride. Jess is getting on a plane tonight and I get on a plane tomorrow night at around 11. We had a great day in Arequipa yesterday and did get to go white water rafting! The boat almost flipped and when it did, Jess and I were 2 of the 3 people that sucessfully did not fall out of the boat!
Today we hung out on the beach in the hot, hot sun, and I'm hoping that my sunscreen did its work! I am TOO worn out from the sun to try to monkey with pictures, but I'll upload them all when I get back on Tuesday!
Friday, January 23, 2009
Made it to Arequipa!
I've finally got my camera cord so I was able to upload a few images!
The beginning of our 4 day trek, riding bikes down a big mountain in the rain! We ran into a river flowing over the road... We had to load our bikes back onto our van which was able to drive over the water which was at least 8 inches deep or so and flowing fast!
Posing in front of another river on the bike tour
Jess and I during our 13 mile hike on the 2nd day of our 4 day bike/hike/Machu Picchu trek! Jess is doing something new with her hair... can you spot it?
Day four of our hike in front of Machu Picchu! Pictures definitely don´t do this place justice!
Thursday, January 22, 2009
Back in Cusco, heading to Arequipa tonight!
We successfully finished our mini-trek and it was a blast! Our last day we got up at FOUR AM (I think I mentioned that last time) to hike up the Machu Picchu mountain. Other than the early hour it was really awesome. Machu Picchu is really unbelievable. In short, it's this huge Incan city made of rock and was abandoned only about 500 years ago! The Incans were living there and building this incredible city in the Mountains when they got word that the Spanish were coming to kill them and destroy their cities and build nice churches on top of the wreckage.
I think Machu Picchu get so much attention because it was one of the few Incan cities that avoided that fate. Scholars think it was because the Incans, in anticipation of the Spanish coming, burned down their own city (leaving only the rock walls, pottery and other non-burnables) and hid all the paths to the city. They did this so the Spanish couldn't follow the paths and use the city as a camp for their men.
ANYWAY, it was great. I have awesome photos, but unfortunately I forgot to bring my camera cord with me today, so they'll have to wait for another day. Tonight we're getting on an overnight bus at 9pm to arive in Arequipa tomorrow morning. We're hopefully going to do some fun stuff, like white water rafting! Then only a couple more days 'til Jess flies home on the 25th and I fly home on the 26th!
Tuesday, January 20, 2009
On a 4 day, 3 night trek, Going to Machu Picchu tomorrow!
That trip started at 8am the next day and we've had no Internet access until now. There is a world famous "Inca Trail" that is a multi-day hike to Machu Picchu but that is really pricey and generally requires 6-9 months advanced booking. SO: Our trip takes us on the OTHER Inca trail. Which is just as awesome, as far as I know, but less expensive... and easier to book.
The first day, we drove in vans to the top of a mountain... I think around 4,000 meters? Well, it was way too snowy and sleety and cold up there, so we drove closer to 3,000 meters (I'm making most of these numbers up) and they let us off and we BIKED DOWN on bicycles they provided. It was really fun. It was never too steep. It was cold and raining at the top, but by the bottom it was probably 80 degrees and sunny. It took a long time for the whole bike... probably 4 or 5 hours? One girl fell off her bike and sliced open her arm, but luckily one of the 12 people on our trip is a medical student from Argentina and SHE did the stiches to help the girl!
The NEXT two days were long hikes... 13 miles and 10 miles or something like that. We ended up at some awesome natural hot springs buried in the mountains last night. The trails are incredibly cool and incredibly rural. We passed a lot of native Peruvians and it's amazing to think how our lives would be different if we lived in these tiny huts seemingly hundreds of miles from civilazation. Despite being hard to imagine how different our lives would be, we've tried and here's what we came up with:
- We would watch fewer YouTube videos
- We would go on more hikes
- We wouldn't care as much about Obama being president
- Fewer facebook friends
- We would have more pet dogs and cats (they're everwhere)
- We wouldn't care as much about who will be the next American Idol
- We would care way more about who will be the next Peruvian Idol
So tonight, we're crashing in Aguas Calientes, and tomorrow at FOUR AM we are hiking up 1600 steps to Machu Picchu. (Apparently in South America they have a four AM in addition to the more traditional four PM)
I didn't bring my camera cord on this mini-trek, so this is all for now! Hopefully I'll have pictures later
Saturday, January 17, 2009
Arrived in Lima, Peru! Heading to Cusco
We´re headed to Cusco which is the city closest to Machu Picchu, which we´ll hopefully see in the next day or two!
Friday, December 19, 2008
Simple way to Draw a Circle with Google Maps
Here's a really basic circle drawing example adapted from the more complex example below. My simple example:
http://www.herculessolutions.com/GoogleMapsSimpleCircle.htm
The more complex example with dragable points and more:
http://maps.huge.info/dragcircle2.htm
Thursday, April 24, 2008
How does ChaCha make money?
ChaCha earns revenue from advertising on its website and through its strategic partnerships. Please text more questions to answer! http://chacha.com/u/theyxbp3
I don't see any advertising on their site, so I guess I don't really buy that answer. I think the real answer is, "ChaCha doesn't generate revenue yet, but hopefully we will some day, somehow". Or maybe they're funded by phone companies for some reason?
Wednesday, March 26, 2008
ROW_NUMBER() Sucks?
Is it just me, or does the SQL Server 2005 ROW_NUMBER() function's performance suck? I always used to complain about SQL Server's lack of a LIMIT clause like MySQL has. I was thrilled when 2005 came out with the ROW_NUMBER() function.
When we switched to SQL 2005, I dutifully recoded the main search query to use the ROW_NUMBER() function, only to find out that it hurt performance by almost 3 fold! In addition, using ROW_NUMBER() doesn't give you an easy way to get the total number of records a query would return. (Helpful to display something like, "Viewing records 51-100 of 2,120")
I should put a caveat here: My testing shows that ROW_NUMBER() is actually much faster when doing very simple queries with large numbers of rows. For example, if you need to quickly grab 10 rows in the middle of all 10,000 rows in a single table with no joins, ROW_NUMBER() is probably for you. However, if you're doing a more complex query like to search for specific records or joining with many other tables, my testing shows ROW_NUMBER() is a significant slow-down. Here are the results for my specific query:
Description | Rows | Estimated Cost | Actual Time | Slowdown |
My original query | 12,547 | 3.701 | 0.729 | - |
Using ROW_NUMBER() | 12,547 | 6.616 | 2.094 | 287.1%! |
So, if not ROW_NUMBER(), then what? My solution is to declare a temporary table and insert all of your result IDs into that table, along with the ordering. You can then join with that table to grab only the results you need. For example:
DECLARE @FirstRecord Int SET @FirstRecord=0 DECLARE @LastRecord Int SET @LastRecord=49 --First make a table to hold the order of the final sorted results DECLARE @ResultOrder TABLE ( OrderID int identity(0,1) not null primary key clustered, ResultID int ); --The main "search" query... this can be pretty slow with lots of rows INSERT INTO @ResultOrder (ProductID) SELECT p.ProductID FROM Products p WHERE p.Cost < 100 AND p.CategoryID=4 --Or whatever search you're doing --A very fast way to get the total number of results SELECT COUNT(*) FROM @ResultOrder; --A very fast way to get the details... you can even join with many more tables SELECT p.Name, p.Cost, c.Name AS CategoryName, s.Name AS SalesPerson FROM @ResultOrder ro, Products p, Categories c, SalesPeople s WHERE p.ProductID=ro.ProductID AND p.CategoryID=c.CategoryID AND p.SalesPersonID=s.SalesPersonID ORDER BY ro.OrderID
Obviously, that is a simple example, but I suspect as your query gets more complicated (especially the 2nd details part) you're way better off not using ROW_NUMBER().
As an ADDITIONAL speedup, that first result set is potentially PRIME cacheing material. For example, if a user (or a crawler) hits the first page of results, then clicks "next" a few times. You do the expensive search only once, then quickly pull up the details for each page on subsequent requests. You might have to analyze your usage to see how often and how close together different pages of the same search are requested.
How do you best cache those Result IDs you ask? And how do you get the IDs to and from SQL? Well, I'm about to implement that myself so hopefully I'll let you know in a subsequent blog post.
Tuesday, March 18, 2008
TWL Two Letter Words Sorted By Second Letter
In list format:
Sorted by the first letter AA AB AD AE AG AH AI AL AM AN AR AS AT AW AX AY BA BE BI BO BY DE DO ED EF EH EL EM EN ER ES ET EX FA FE GO HA HE HI HM HO ID IF IN IS IT JO KA KI LA LI LO MA ME MI MM MO MU MY NA NE NO NU OD OE OF OH OI OM ON OP OR OS OW OX OY PA PE PI QI RE SH SI SO TA TI TO UH UM UN UP US UT WE WO XI XU YA YE YO ZA Sorted by the second letter AA BA FA HA KA LA MA NA PA TA YA ZA AB AD ED ID OD AE BE DE FE HE ME NE OE PE RE WE YE EF IF OF AG AH EH OH SH UH AI BI HI KI LI MI OI PI QI SI TI XI AL EL AM EM HM MM OM UM AN EN IN ON UN BO DO GO HO JO LO MO NO SO TO WO YO OP UP AR ER OR AS ES IS OS US AT ET IT UT MU NU XU AW OW AX EX OX AY BY MY OY |
Sorted by 1st letter | Sorted by 2nd letter |
AA AB AD AE AG AH AI AL AM AN AR AS AT AW AX AY BA BE BI BO BY DE DO ED EF EH EL EM EN ER ES ET EX FA FE GO HA HE HI HM HO ID IF IN IS IT JO KA KI LA LI LO MA ME MI MM MO MU MY NA NE NO NU OD OE OF OH OI OM ON OP OR OS OW OX OY PA PE PI QI RE SH SI SO TA TI TO UH UM UN UP US UT WE WO XI XU YA YE YO ZA | AA BA FA HA KA LA MA NA PA TA YA ZA AB AD ED ID OD AE BE DE FE HE ME NE OE PE RE WE YE EF IF OF AG AH EH OH SH UH AI BI HI KI LI MI OI PI QI SI TI XI AL EL AM EM HM MM OM UM AN EN IN ON UN BO DO GO HO JO LO MO NO SO TO WO YO OP UP AR ER OR AS ES IS OS US AT ET IT UT MU NU XU AW OW AX EX OX AY BY MY OY |
Sunday, January 27, 2008
Back in Santiago!
This is the point in my post where I like to complain about either the speed of the Internet or the speed of my computer. Today you are in for a treat because I get to complain about BOTH! I was hoping to upload all 200 or so of my photos, but they are taking about 5 minutes each. There will be a few up, but I think we'll have to wait for later to see all of them. There are also some exciting VIDEOS on the way!
Today in Santiago, we got in, helped Jess finish moving out of her apartment, found a place to stay and explored the city! Tomorrow we may be hitting up two coastal cities about an hour from here, Valaprasio and Vina del Mar.
I'll post more photos and videos soon! You can see my Chile set of photos in progress here:
http://www.flickr.com/photos/jerschneid/sets/72157603748636020/
Saturday, January 26, 2008
3 Days In Bahia Inglesa
Unfortunately, I´m currently using the same computer that the Wright Brothers used to run their aviation simulations. The historical value is interesting, but uploading photos is nearly impossible (as it pre-dates the Internet by about 80 years).
The last two days we went SURFING on the Pacific coast! We wore wet suits as the ocean is still pretty cold here, but not too bad. This was my first time surfing and I did a bit better than I expected (although I had pretty low expectations, since my goal was to not drown). It turned out it is pretty easy to "catch" a wave, but standing up on the board proved to be the hardest part... I got up a few times but nothing you´ll see on ESPN2 any time soon.
We also stayed in this awesome little cabaƱa. Well, not little, actually. It had 3 rooms and SIX beds, plus a living room and kitchen and porch! We bought groceries and cooked dinner and drank Chilean wine last night. I think they charge per person, and foreigners don´t have to pay the 19% sales tax so we ended up paying about $80 per night, split 3 ways!
Tonight, we´re catching an overnight bus to Santiago. Dan leaves tomorrow and Jess and I leave on the 29th. I´ll be back in Michigan on the 30th! Photos and even some exciting VIDEOS will follow!
Wednesday, January 23, 2008
On our way to Bahia Inglesa!

Here we are in our beach clothes in 0 degree Weather! Actually, this is after the sun came up, so we were much warmer here.

Here is a shot of the mountain where we saw the geysers. Those are flamingos!

This is my feet as we are about to cross the Bolivian border. I didn´t sign up for snow!

Dan and I in the snow. SNOW? Seriously though... I didn´t sign up for snow.

This is a shot of the Bolivian customs building, which was more of a shack. To get here, we turned off of a nicely paved highway in what seemed like the middle of nowhere. I don´t even think we were on a road. We just drove off road for a while then got to this shack. (They did have two little gates, also in the middle of nowhere, as if that might prevent people from crossing or something). We actually had some trouble crossing. They said Americans had to get visas in advance, even though our tour booking guy specifically said we didn´t. Everyone else on our tour left and we were sitting there at this shack in the middle of nowhere, waiting for the Bolivian "boss" who was going to come sort it out. He actually did show up, and got us temporary visas. I have to imagine the tour company decided it was easier to have their guy bribe the officials rather than force American tourists to buy the expensive and time consuming visa. It would have been nice to let us know though!

The three of us in Bolivia in front of La Laguna Blanco

We drove around in Bolivia in these trucks for HOURS and HOURS and HOURS over virtually no roads. We all had serious headaches and car sickness by the end of the day. We also were in a BLIZZARD by the end and were concerned that we wouldn´t make it back at all. I certainly did not sign up for a blizzard.

Dan and Jess in natural hot springs in the middle of the Mountains! The hot springs were about 100 degrees here!

This photo doesn´t do this place even a little bit of justice, but it is a huge bright PINK lake with THOUSANDS of pink flamingos in the middle of gorgeous mountains. It was just really really beautiful, fertile land. Amazing stuff. And if you´re wondering how flamingo kebabs taste, they´re delicious.
Monday, January 21, 2008
Still Having Fun in San Pedro DE Atacama!
Last night was CLOSELY followed by this morning which started with a 3:15 am wake up call. That´s not "Chile" time where an hour is actually 4 hours or anything, Jessica actually made us drag our asses out of bed at 3:15 am. We did this to hit the Tatio Geysers in the best viewing time of between 6 and 7 am.
Our helpful tour booking agent informed us that these are HOT geysers that include a hot springs for bathing so we should make sure to bring our swim suits. Dan, Jess and I diligently dressed in flip flops, bathing suits and long sleeve t-shirts and our light jackets (in case it was cold). One point of interest was the native´s choice of clothing. While we chose "beach wear", they seemed to prefer parkas, long pants, scarves and hats. Apparently, when you are 5200 meters above sea level, in the desert, before the sun rises, 0 celcius is a pretty average temperature. We continually asked if we were in the right place for the beach volleyball tournament, but no one knew what we were talking about.
The geysers were hot, both literally and figuratively. We DID get in a swim after the sun came up! Our trip was capped by seeing some real live mountain llamas! Our guide then took us to a tiny local town where they were selling real dead llama-kebabs. He seemed to think it was hilarious to point towards the llamas and say "before" then point to the grill and say "after". If you are wondering how llama-kebabs taste, they are delicious.
Also: we went to the moon valley. We´re on a dial-up connection so more details and photos will follow! Tomorrow, we are heading to BOLIVIA, then a bus to Bahia Inglesa on Wednesday! I suspect they´ll have better Internet there.
Sunday, January 20, 2008
We're in San Pedro de la Atacama
The highlight of the bus ride was playing some mad boggle on the last leg (Jessica remains undefeated). The lowlight was the poop smell that engulfed us everytime another wayward passenger decided to venture into the unknown of the bus urinal. I personally made it all 17 hours with no potty breaks! Go blue!
Tomorrow we're getting up at FOUR AM to check out these geysers and hot springs and then doing a sunset trip to this famous valley area in the desert. The NEXT day we're going to Bolivia on a lake tour! That means I get one step closer to Jessica in terms of countries visited (proportionally, at least)
The Internet connection sucks here so no photos today! Hopefully in our next city! We'll be here for three nights, then off to Bahia Inglesa.
Saturday, January 19, 2008
In La Serena, Heading to San Pedro
After one night in Santiago, we took a morning bus to La Serena, which is about 6 hours north. We checked out the beach, went to a nearby town and hiked up a mountain and last night we had a midnight trip to an observatory. Chile, according to our guide, is the best place in the world for observatories and coutries from all over the world are building telescopes such as the VLT (Very Large Telescope), the ELT (Extremely Large Telescope) and the OWL (OverWhelmingly Large).
We´re headed to San Pedro tonight on an overnight 14 hour bus ride. Apparently it is the driest dessert in the world. I´m skeptical... I think I´ll be able to spot a FEW puddles, at least... I mean, how dry can it be? My computer time today is pretty short so I think I´ll end it here with some photos!
You can see my photos here http://www.flickr.com/photos/jerschneid/




Wednesday, January 16, 2008
Made it to Santiago!
This is my first time in the southern hemisphere. Things are not nearly as upside-down as I imagined. Also, it's summer here, which would have been helpful knowledge to have before I packed. Oh well...
Ok... Short on time today but more posts and photos to come!
Wednesday, January 02, 2008
FullSizePosters Review
I recently was looking for a way to print a reasonably high quality 24 x 36 inch poster to be placed in a frame in my living room. I checked out a ton of options, including getting ripped off by your local Kinkos or the vast array of online stores that claim to do it.
I finally decided on FullSizePosters.com. I made the decision based on their great prices, their focus on poster printing and a good feeling I got from the positive reviews on their site along with their phone number displayed at the top of every page. (I had read some horror stories from other printers where the print didn't show up for weeks with no way to contact the company)
The actual upload and checkout process was really nice. The site is strikingly simple, only a couple pages, but it's exactly what you want and need. They make really good use of Google checkout. I paid easily and quickly got a receipt by e-mail with a link to track the status of my order.
I placed the order around 1:20pm on December 28th and was thrilled that it was printed and shipped THAT DAY. They shipped via USPS 2-3 day priority mail with a reasonable shipping cost. (I paid $32.37 when all was said and done for my 2x3 poster)
I received my poster 2-3 business days later. It came in a really sturdy cardboard tube. Inside the tube, my poster was rolled in tissue paper and sealed in an airtight plastic bag.
The poster looks awesome. I mean... it's perfect. I've gotten used to being disappointed after ordering a print job, but this final product was exactly what I hoped for. The print is on really high quality glossy photo type paper. Kind of like a big version of a photo you might get developed, so it's thicker and heavier duty than a stock poster you would buy at the store.
ANYWAY, I was googling for "FullSizePoster Reviews" when I was making my decision, so hopefully this is helpful to others. Also, FYI, this is not a paid post of any kind. I'm just a dude trying to give back to the Internet community in my own little way. Thanks FullSizePosters.com! :)
P.S. The poster was actually to play a prank on my roommate. Here is what I printed:
Tuesday, April 03, 2007
E-mails bouncing back with error "smtp;554 refused mailfrom because of SPF policy"
I've recently been receiving reports e-mails sent in this fashion have been bouncing back with this type of error:
Final-Recipient: rfc822;john.doe@anotherdomain.com
Action: failed
Status: 5.5.0
Diagnostic-Code: smtp;554 refused mailfrom because of SPF policy
Thanks to some research and the Fanatical Support over at rackspace, I learned that "SPF" is a fairly new spam prevention technique (Sender Policy Framework). Basically the receiving server checks to see if the sending servers domain is the same as the "from" address domain. The goal is to prevent users from sending e-mails from "george.w.bush@whitehouse.gov" or whatever.
One workaround is to always have the "From" address be from your domain, but that's really not an option for most of these paradigms (You don't want to receive all the replies to someone else's evite)
Luckily openspf.org has a great page on how Web-Generated Emailers Can Avoid Looking Like Forgers. The solution is to tweak your e-mail headers to show that the sender is your domain, like this:
Return-Path: service@mydomain.com
Sender: service@mydomain.com
From: "Jane Doe" <jane.doe@hotmail.com>
Subject: Jane Doe has sent you an e-mail through my site!
In the above example, the e-mails you generate add the "Return-Path" and "Sender" header values to show that you are being honest about the source of the e-mails. One notable side-effect is that service@mydomain.com will now receive the bounce-backs instead of jane.doe@hotmail.com.
The final trick is to get your code to do this. In .NET, the following C# code function sends an SPF-safe e-mail.
static public bool Send(string to, string subject, string body,
string from, string cc, string bcc) { try { //Create your standard mail message MailMessage mail = new MailMessage(); mail.BodyFormat = MailFormat.Html; mail.To = to; mail.Cc = cc; mail.Bcc = bcc; mail.From = from; mail.Subject = subject; mail.Body = body; //Add the headers to avoid SPF errors. (Make sure to change this to your domain) mail.Headers["Sender"] = "service@mydomain.com"; mail.Headers["Return-Path"] = "service@mydomain.com"; //Send the message SmtpMail.SmtpServer = "localhost"; SmtpMail.Send(mail); } catch (Exception ex) { //Maybe log an error return false; } return true; }
You can check the success of this by viewing the original e-mail headers in the generated e-mails. Some receiving e-mail systems (like Gmail) will even append and SPF status to the header so you can see if you were successful.
The header line in my received e-mail went from this:
Received-SPF: neutral (google.com: 72.123.123.123 is neither permitted nor denied by best guess record for domain of jane.doe@hotmail.com)
To this:
Received-SPF: pass (google.com: best guess record for domain of service@mydomain.com designates 72.123.123.123 as permitted sender)
Wednesday, March 28, 2007
Hide form tag, but leave content
The problem is that a common practice in ASP.NET is to have a <form runat="server"> tag "high up" in the HTML, usually in the Master page. HTML doesn't allow overlapping <form> tags, so my PayPal button won't work. Since the higher level <form> is in the Master page, it makes removing it pretty messy. As far as I know, there's no built-in "hide this tag, but render the tag's contents" feature for controls. In the past I've maintained two master pages: the normal one and a "no form" version, but I've since discovered a more elegant solution.
I created a class called GhostForm that has a property RenderFormTag. When RenderFormTag is set to false, it doesn't render the <form> tag or closing tag, but does render all of the contents. This works perfectly so I can have my <form runat="server"> high up for most pages, but I can fine-tune it when I need forms posting to other sites or multiple forms.
Here's the code for GhostForm:
using System; using System.Web.UI; using System.Web.UI.HtmlControls; /// <summary> /// This is a special form that can _not_ render the actual form tag, but always render the contents /// </summary> public class GhostForm : System.Web.UI.HtmlControls.HtmlForm { protected bool _render; public bool RenderFormTag { get { return _render; } set { _render = value; } } public GhostForm() { //By default, show the form tag _render = true; } protected override void RenderBeginTag(HtmlTextWriter writer) { //Only render the tag when _render is set to true if (_render) base.RenderBeginTag(writer); } protected override void RenderEndTag(HtmlTextWriter writer) { //Only render the tag when _render is set to true if (_render) base.RenderEndTag(writer); } }