Better way to find last used row

You should use a with statement to qualify both your Rows and Columns counts. This will prevent any errors while working with older pre 2007 and newer 2007 Excel Workbooks. Last Column Last Row Or

Recursively find all files that match a certain pattern

With gnu find you can use regex, which (unlike -name) match the entire path: To just count the number of files: (The %i format code causes find to print the inode number instead of the filename; unlike the filename, the inode number is guaranteed to not have characters like a newline, so counting is more reliable. Thanks to @tripleee for … Read more

Simple C program to read a file line by line

In C you have character oriented input functions (e.g. getchar, fgetc), you have formatted input functions (e.g. the scanf family) and then you have line oriented input functions. (e.g. fgets and POSIX getline). When you are reading lines of data, line oriented input functions are the proper tool for the job. (taking user input with scanf has many pitfalls that new (and even not so new) C programmers fall into) All line oriented functions read … Read more

RecyclerView vs. ListView

RecyclerView was created as a ListView improvement, so yes, you can create an attached list with ListView control, but using RecyclerView is easier as it: Reuses cells while scrolling up/down – this is possible with implementing View Holder in the ListView adapter, but it was an optional thing, while in the RecycleView it’s the default way of writing adapter. Decouples list from its container – so you can … Read more

Why would a “java.net.ConnectException: Connection timed out” exception occur when URL is up?

Connection timeouts (assuming a local network and several client machines) typically result from a) some kind of firewall on the way that simply eats the packets without telling the sender things like “No Route to host” b) packet loss due to wrong network configuration or line overload c) too many requests overloading the server d) … Read more

Convert pandas data frame to series

It’s not smart enough to realize it’s still a “vector” in math terms. Say rather that it’s smart enough to recognize a difference in dimensionality. 🙂 I think the simplest thing you can do is select that row positionally using iloc, which gives you a Series with the columns as the new index and the values … Read more