Python os.walk + follow symlinks

Set followlinks to True. This is the fourth argument to the os.walk method, reproduced below: os.walk(top[, topdown=True[, onerror=None[, followlinks=False]]]) This option was added in Python 2.6. EDIT 1 Be careful when using followlinks=True. According to the documentation: Note: Be aware that setting followlinks to True can lead to infinite recursion if a link points to … Read more

How can I traverse/iterate an STL map?

Yes, you can traverse a Standard Library map. This is the basic method used to traverse a map, and serves as guidance to traverse any Standard Library collection: C++03/C++11: #include <cstdlib> #include <map> #include <string> using namespace std; int main() { typedef map<int,string> MyMap; MyMap my_map; // … magic for( MyMap::const_iterator it = my_map.begin(); it … Read more

Iterating over element attributes with jQuery

The best way is to use the node object directly by using its attributes property. The only difference in my solution below compared to others suggesting this method is that i would use .each again instead of a traditional js loop: $(xml).find(‘item’).each(function() { $.each(this.attributes, function(i, attrib){ var name = attrib.name; var value = attrib.value; // … Read more

Iterating over element attributes with jQuery

The best way is to use the node object directly by using its attributes property. The only difference in my solution below compared to others suggesting this method is that i would use .each again instead of a traditional js loop: $(xml).find(‘item’).each(function() { $.each(this.attributes, function(i, attrib){ var name = attrib.name; var value = attrib.value; // … Read more