AttributeError:’bytes’ object has no attribute ‘encode’

If you don’t know if a stringlike object is a Python 2 string (bytes) or Python 3 string (unicode). You could have a generic converter. Python3 shell: On Python 2 both these expressions evaluate to True: type(“hello”) == bytes and type(“hello”) == str. And type(u”hello”) == str evaluates to False, while type(u”hello”) == unicode is True. On Python 3 type(“hello”) == bytes is False, and type(“hello”) == str is True. And type(“hello”) … Read more

Android Completely transparent Status Bar?

All you need to do is set these properties in your theme: Your activity / container layout you wish to have a transparent status bar needs this property set: It is generally not possible to perform this for sure on pre-kitkat, looks like you can do it but some strange code makes it so. EDIT: I … Read more

readOGR() cannot open file

You could have shown that you have the right path with: perhaps try: or a simpler alternative that is wrapped around that: Update: rgdal has changed a bit and you do not need to separate the path and layer anymore (at least for some formats). So you can do (perhaps still using path.expand) Also, if you … Read more

Categories R

ggplot2 manually specifying colour with geom_line

As stated by @juba in the comments, you should use scale_colour_manual instead of scale_fill_manual. Moreover, you are trying to plot to many lines and errorbars in one plot. They overlap each other to much and it is therefore hard to distuinguish between the lines/errorbars. An example with the use of facetting (and some simplification of your code): this … Read more

Categories R

Unknown override specifier, missing type specifier

As @Pete Becker points out in the comments, you need to qualify the name string as std::string: The compiler just doesn’t know what you’re talking about, and it’s the equivalent of just writing: The compiler just doesn’t know what type that is unless you’ve declared, hence the error missing type specifier – int assumed You should read up … Read more

XPath: Get parent node from child node

Use the parent axes with the parent node’s name. This XPath will only select the parent node if it is a store. But you can also use one of these These xpaths will select any parent node. So if the document changes you will always select a node, even if it is not the node you expect. EDIT What … Read more