Modern C++: What you need to know (talk by Herb Sutter)

Interesting presentation by Herb Sutter on the modern C++.

The video won’t play very well on this page, so grab it from here. There are different formats and slides available for download.

Strangely enough he spends considerable amount of time explaining the use of the prefetcher and performance benefits it can provide. It is very useful, but, in my humble opinion, isn’t exactly related to the topic of the presentation.


 

Posted in C++ | Tagged , | Leave a comment

Pine Ridge. Ventana Wilderness. April 2014

Prologue

One more trip to our local wilderness place. I lead a trip there pretty much exactly two years ago. We visited Pine Valley that time. This time I thought of doing something different. Then, as usual, I just pointed a place on the map and decided to got there. It was Pine Ridge camp this time. In retrospect, it was a good idea – Pine Valley is nice when the weather is warm because then it is possible to swim there. It wasn’t warm at all this weekend, so the views from Pine Ridge were just fine. Since the map doesn’t have the mileage I only had some guesstimate, but it looked under 10 miles one way.

I’ve posted this trip for the weekend one week before. But it was going to be raining quite a bit, so I postponed it. Eventually a group of eight people collected.

Saturday, April 5, 2014

I like the Big Sur trips. Mostly because we can start early Saturday morning; not insanely 4AM early, but still at good time. However, we can still get going on the trip at the reasonable time. I also like to stop somewhere on the way to get good breakfast, mostly at some bakery, they are usually open early.

We started at 7AM from Sunnyvale. Three cars total so I had to find a place to meet and regroup. I was a bit tricky but I found an interesting Mexican bakery in Salinas, CA called La Plaza Bakery. It had big assortment of the pastries and Mexican food. It just didn’t have tough meat.

After the good breakfast the group collected together and proceeded to the starting point. I knew where it was – some old abandoned (perhaps) campground called China Camp. I also knew that the road was very beat up. I just forgot how beat up it was – long driving on gravel road in urgent need of repairs. The most surprising art was snow! Really, really snow. Not everywhere, just in some shaded areas. Weird. I did not expect that. Yes, there were some rains and the nights were a bit cold, but I thought it was warm enough during the day to melt everything. Apparently not. We quickly got our gear and started. There were cars on the trailhead, but not that many.

DSC_2198

The ‘before’ picture

The trail proceeded as expected without any events till the lovely lunch spot which is located in this tree shaded saddle at the crossing of different trails. It was possible to see some snow on the far away mountains. I guess this forests didn’t really wake up yet from winter. It seemed like it was just getting ready to bloom. It would probably be very lovely in a couple of weeks.

After lunch the fun part started. Mostly due to the fact that I had no idea how the trail would look. It was fine up to the junction with some unnamed trail, which was leading to Pine Valley. After that the trail was quite overgrown. However, there were new trail signs so some group was working on these trails. Perhaps they just didn’t get to clearing all of them. Well, one step at a time.

DSC_2235

Snow on the trail

There was snow on the trail, in some places. The snow was strange. It wasn’t that packed concrete that fills the Sierras after many freeze-thaw cycles. This snow was slushy like it just recently fell and the weather was warm. Strange.

The trail it this point was visible, in a strange way. It looked like this long thin cut on the body of the ridge. At least it wasn’t going up and down all the time. We did have to bushes or crawl over trees all the time. Why is it so bad? It is a lot more fun than some well maintained trail that feels like a walk in a park. Well, raw bushwhacking isn’t fun either, but there still should be some difficulty.

We reached the junction in another saddle with the Bear Basin. The Pine Ridge campsite was quite close after that. There was a very tiny easy to miss metal sign pointing to it. Then after some more bushwhacking I found it.

The cam site was great. The view of the ocean was obscured a bit, but other than that it was perfect. There was a running spring (coming out of a pipe). Someone left a large metal box there, locked from sides by two sliding padlocks. I’m not sure if anyone still remembers where the keys were. I suspect the box was for the food storage away from the local creators. But now the locks were rusted (and shot at numerous times, someone really tried opening it) so it was just sitting there making a decent table. There was even a toilet, but I found it the next morning.

We made it to the campsite quite early. There was enough time to set up, sleep, even for some wilderness acupuncture.

DSC_2257

Wilderness Acupuncture

However, after the sun went down it became really cold. I mean big time cold. No wonder there was still snow on the ground. It wasn’t freezing cold, but for some reason I felt colder than two weeks before in the snow. Perhaps I was wearing more clothes. The good thing was the campfire. I’m not sure if it was allowed, however, I did make sure I put it out well and we only burned down wood. Fire is always nice when camping. It’s the wilderness TV.

Sunday, April 6, 2014

The night passed without any events. No one was eating my stuff this time. Maybe the rodents were still hibernating. Krishna and his friend wanted to finish early so they were up and all packed by 8AM or something. The rest, including me, were still eating, washing, packing, etc. But we got going eventually by 10AM.

The main Pine Ridge trail looked a bit different going back. Perhaps the light was different. We made it to the same lunch spot by about noon and then to the trailhead by 3PM or so. We just met one couple on the trail going back from Pine Valley. But there were several groups going to Pine Valley area.

After the ending everyone just left quickly. We stopped by on the was at one of the wineries. Either I was dehydrated and empty or their wine was not good at all, but it felt like the worst wine tasting I’ve had so far. Perhaps it isn’t a good idea to enjoy wine right after a trip. That time usually calls for good steak or a bowl of ramen.


Photos.

Pine Ridge trail

Posted in Travel, Trip Reports | Tagged , | Leave a comment

New Attempt at Vegetable Gardens

My old contraption completely disintegrated. I bought these plane simple boxes from Office Max or something. They were inexpensive. However, after a couple of years under the sun the plastic became completely brittle.

Enter EarthBox. I found it while searching for the new planting ideas. It claimed to be made from better UV resistant plastics. It also has a water reservoir under the layer of soil. It should keep the plants more hydrated and thus produce better results. There are many DIY EarthBox-like designs – essentially get two plastic boxes and some PVC pipes and you are done. But I figured that factoring work and the materials needing replacement in a couple of years I won’t save much.

I just planted two boxes – one with green onions and one with beets (seeds we gotten for free at the Gravenstein apple fair). Stay tuned for the results.

Posted in Gardening, Life notes | Tagged | Leave a comment

Snow Camping in Lassen NP. March 2014

Prologue

This year was very bad for winter sports – drought in our state. All those storms from the Pacific that drench the coasts and dump snow in the mountains weren’t coming this year. It wouldn’t be much of the snow camping with snow. I even post a trip to Glacier Point. Same thing we did last year. But due to a sudden snow storm I had to postpone it. Eventually, by mid March there was enough snow to do something interesting. Actually, March is a nice time – there is still enough cold, but the days are much longer. So this year’s trip to the winter wonderland would be going to Lassen Volcanic NP under the leadership of Mr Igor. A different route from last time – now coming from the visitor’s center towards Mt Lassen.

Friday, March 21

The meeting time was at 1PM. However, with all the car rental and gear managing we barely got going at 5PM. Right at the best traffic time! Good thing I wasn’t driving. The bad thing is that I can’t read in a car – it would be nice to use the time for some reading. We stopped at the recommend Mexican place in Chico, CA called Tres Hombres. A bit large and noisy for my taste. I prefer more of a whole-in-a-wall type of places since they usually have best authentic food. After that it was a lot of winding road driving. Eventually we made it to the parking lot of the Kohm Yah-mah-nee Visitor Center at about 1AM. Nothing special there. The parking lot was plowed, the visitor center was open (good access to warm restrooms). All we had to do was to walk a bit off to the snow and setup camp. One problem came up – in all that rush leaving we forgot one sleeping bug. Had to improvise for one night – -meaning, Igor was sleeping with just a lot of dawn on him. The rest of us shared 4 people in 3 person tent. It was very cosy and warm there.

Saturday, March 22

Due to the late evening the start was late too. I woke up early, as usual. The other groups on the parking lot were already getting ready to do what they planned. There were many who just came to play in the snow – it is pretty much free. There were some who were going to do some backcountry skiing (had nice skis with skins and fancy boots that can be clipped in differently for different activity). I hate to say it, but not everyone was prepared from the get go. I was packed, so was Yuhua. But some of the green people had to be coached in packing.

DSC_2047

The ‘before’ group shot.

So the process of packing and preparing lasted for a couple of hours. In the mean time we finished the leftovers of last night’s Mexican food. Eventually we started at about noon. I didn’t have a clue where we were going exactly. There was talk about going to Mt Lassen, but how I wasn’t sure. In the end we just followed the unplowed road. There was a point in the road, right after the first bubbling mud pool, to cut a significant chunk of the mileage by simply crossing through forest. One good thing about winter it that you can pretty much go anywhere – on snowshoes or backcountry skis just plow through, the snow shoes act as rudimentary crampons (that doesn’t mean that going uphill with a pack is physically easy). So we went up some hill, crossed the forest and met up with the same old road. Then we had lunch and moved on. Karen went back and the rest of us moved forward. Yuhua and I proceeded on snowshoes and the other two newbies, under Igor’s leadership, were struggling on skis. The distance wasn’t that large – maybe 3 miles or so. No wonder were reached the proposed camping area within a couple of hours. We found a quiet corner at the other side of the frozen lake Helen. It was secluded enough from the wind, but also open to see great undisturbed snowy expanses and enjoy the sunset.

DSC_2131

Winter kitchen

I dug the kitchen, almost set the tent, changed, walked around, but the rest of the group was still not in the view. Got me a little worried since the sun was going down and so were the temperatures. But they made it eventually. We had good dinner with lots of hot food. The weather was great – no wind at all. It was getting chilly and my fingers were getting numb, but it could be much worse with windchill. After the dinner Yuhua, Igor, and I went for a small walk to get the metabolism going so that it can process all that oil and generate some heat. There was a parking lot a bit behind the hill for the Bumpass Hell trail with a great view of the night sky and some glowing city in the distance.

Sunday, March 23

Beautiful morning. Even though everything was frozen solid. I got up again like an idiot in the early morning while the rest were sleeping. My tent mates seemed to have had a rather cold night because they were squeezing me in the middle all the time. I was fine. This time I brought two pads to keep warm.

DSC_2146

Beautiful Morning

Igor was still sleeping in his grave. There is nothing wrong with sleeping in a snow grave, as long as you have the right equipment. I walked around a bit feeling the crusty frozen snow. It really felt like real winter. But when the sun came above the mountains it started warming up. We had a couple of neighbours camping around the same lake Helen. Some groups came later. However, we were far away from each other. The original plan was to perhaps climb Mt Lassen. For that the group had to be up and ready by about 8AM. Instead the groups slowly got ready by about 10AM. There was no time to climb any peaks any more. We probably needed crampons also, half the time. The mountain didn’t have that much snow to only use crampons. So we broke the camp and went off … to the aforementioned parking lot.

There was some morning yoga there and after that we attempted to day hike to Bumpass Hell area. DSC_2176 It was a bit more difficult than I though. I was under the impression that it was just behind some small mountain. Well, maybe a bit more behind. But it turned out not being so simple. Igor went on skis on a more flat terrain. I decided to just ram it through. But it was a bit too steep for people not experienced with winter sports. As a results, after some painful adjustments we had to turn back. Sad, it would be interesting to see Bumpass Hell in winter.

After the regrouping at the same parking lot and short lunch we headed back. The route was simple – just follow the road down. I just wish I had skis instead of snow shoes. But still, I was able to cut one part of the route by sliding on my butt down the hill. We met Karen coming up the road enjoying herself. She really had good time without all that weight of a backpack. It was a bit of a slow slog for me. I’ve picked up the whole 3p tent we were using. The snow became slushy on the sunny side and frozen on the shady side. I just had to keep walking under all this weight, trying to enjoy the process.

Igor, Yuhua, and I made it to the car early. There was enough time to change, stretch, eat, talk with other groups (there was a group of three Indians – two man and a woman – from the Valley who summited Mt Lassen. Rather unusual case. Perhaps I should have talked to them a bit more.) Then the rest of the group returned and we headed out. Had dinner in Chico in the same Mexican place and arrived to Palo Alto at about 1AM.

Continue reading

Posted in Travel, Wilderness | Tagged , , , | 1 Comment

Amaluna in San Jose

There were a lot of advertisements for this event by Cirque Du SoleilAmaluna. Cirque Du Soleil has tons of shows. It seems that they are the only provider of shows in Las Vegas. But going there is a bit of a hassle. Since they came here to the valley I though it may be interesting to see what it was (plus a coupon really helped).

The venue was temporary – traveling circus basically. A bunch of tents with proper modern equipment like lighting, toilets, shops, etc. The actors were from the company, but the support staff was local.

The show looked like a mixture of a rock concert and gymnastic performance. It didn’t have trained animals, for example. Funny, but it looked like Chinese Opera thing. But it was solid non-stop performance with pretty much every person in the troupe doing something all the time (not like “I did my element and then I’m done for the evening”). Not too bad. There was nothing specific there to this or that audience or group of people. It could have been shown anywhere in the world (aside from some lunatic places that don’t like people in tight costumes).

 

Posted in Life notes | Leave a comment

Mechanical Design of Popping Beetles

I’ve noticed this ever since I was a kid. In Belarus there were these tiny beetles that would jump if you try holding them or put them on their backs. They were doing it by moving their head part really fast. However, I was never really curious to figure out how exactly they did it.

So comes this blog – Beetles In The Bush – that I subscribed to who knows when.

A large spine on the prosternum fits into a groove on the mesosternum.

A large spine on the prosternum fits into a groove on the mesosternum. From Beetles In The Bush

The author is very good at describing all sorts of insect species and, especially, at taking their photos. But, the reason I want to point to this blog today is that in his latest post – Pop! goes the beetle – he also explains the mechanism how the beetles do this rather interesting movement. How the muscles store the potential energy and the two mechanical parts allow for fast release of that energy.

There was some discussion on the reasons, from the evolutionary standpoint, for this ‘feature’ – to fight the potential predators or just recover from landing on their back. And also discussion on the reason why the beetles jump so high. Seems like waste of energy. But when getting away from a predator no energy should be spared.

Interestingly, this is the second example, for me at least, of insects building essentially mechanical devices out of their exoskeleton to achieve their goals. One more was listed by Gizmag last September – Insect uses gears to enable 200 g hops.

Continue reading

Posted in Life notes, Musings | Leave a comment

Universal Reference

C++11 brought in new reference type – rvalue reference. This reference is declared using “&&”. There are a whole slew of articles on how to distinguish between rvlaue and lvalue references, but we won’t go into this here. There are several very good articles listed in the references section.

One would assume that any declaration that uses “&&” will always represent rvalue reference. However, it is not necessarily the case – sometimes it means rvalue reference, but sometimes it means either rvalue reference or lvalue reference. Scott Myers calls “&&” universal reference.

If a variable or parameter is declared to have type T&& for some deduced type T, that variable or parameter is a universal reference.

Let’s conciser some examples:

template<typename T>
void f(std::vector<T>&& param);

In this case the type is explicitly specified – std:vector<T>. It doesn’t matter that the vector is templated, the vector itself is fixed. As a result, the param is rvalue reference.

template<typename T>
void f(T&& param);

In this  param is universal reference. If the template T is of an lvalue reference type, then based on the reference collapsing rules the final type becomes lvalue reference. If it is of rvalue reference – final type stays rvalue reference.

Keep in mind that regardless of the reference state the param is lvalue reference inside the f function. Simply because “if you can take its address it is lvalue reference”. The reference can be changed, or moved, to rvalue reference using std::move.

Continue reading

Posted in C++ | Leave a comment