Comment on: Is it worth spending the time to learn Emacs today?
0 10 Jul 2015 22:35 u/sulami in v/programmingComment on: Is it worth spending the time to learn Emacs today?
Yes, emacs (and/or vim) pay off over time imo. If mastered and properly configured, both can increase productivity by a lot, because you can do pretty much whatever you want with just a couple of keys, and also write almost everything using those, so you can use one workflow for Java, Python, webdev, mails, etc. And because of the big and experiences userbases, support is excellent. I'd say, learning an advanced text editor starts to pay off maybe somewhere around the 2 month mark, depending on how much you use them.
Comment on: C/C++ and large file sizes (over 2GB)
So on 64-bit Linux this give me 8 bytes, so 64 bits, regardless of whether I use -D_FILE_OFFSET__BITS=64, as expected.
#include <stdio.h>
#include <sys/stat.h>
int
main()
{
off_t size;
printf("%d\n", sizeof(size));
return 0;
}
I did some more quick searching and found this, where OP found a MinGW-specific solution that involves a 64-bit stat struct, afaict.
Comment on: C/C++ and large file sizes (over 2GB)
I'm using MinGW on Windows for this, but that shouldn't matter, should it?
I don't think so. If you paste the whole section of whatever you wrote, I could throw it into a compiler here and check if I can find something odd.
Comment on: Favorite IDEs?
I really like vim, as well. You need time to learn to use it properly and write you own config, say a couple of months, but after that you have an extremely powerful text editor that runs everywhere, is insanely customizable and can be used for almost anything. I guess emacs is the same thing, but I haven't used it an awful lot.
Comment on: What do you do when you have a loss motivation?
Really? Just stop for a couple of days. Experience is valuable in years, if you don't touch a computer this weekend, you won't lose anything. Sooner or later, the fun will come back. I know it can be difficult to enjoy free time from personal experience, but not spending every minute you have on improving yourself is fine, too. Just think what 70-year-old you would say if you forgot living because you focussed on refactoring code.
Comment on: C/C++ and large file sizes (over 2GB)
So, according to this you need to use off_t, and compile with -D_FILE_OFFSET_BITS=64 if you are on a 32-bit system (using method 2). That is supposed to work on any platform.
Comment on: My Top 100 Programming, Computer and Science Books: Part One
I'll just leave this insanely long list of free online programming books here.
RSA: A simple and easy-to-read implementation in Python
1 0 comments 09 Jul 2015 23:57 u/sulami (..) in v/programmingComment on: Thoughts on Ruby?
I have not used Rails before, do you know how it compares to Django in terms of boilerplate? Because I can spin up something simple in Django literally within minutes, and imho Python is way more versatile than Ruby because of the huge amount of already available libraries.
Comment on: How do /v/, /r/ urls work?
Not having looked at the source, I assume there will be a central handler function behind this, and when requesting "/v/<some-regex>/" it looks for the name and if it exists returns the subverse for use in the templates.
Comment on: Thoughts on Ruby?
Disclaimer: Not a rubyist, don't know anything beyond basic Ruby.
I think Ruby got a big boost from Rails a couple of years ago, but nowadays there are frameworks like it in almost every other language. Ruby is not particularly fast and the available libraries lack a lot in direct comparison with Python. I personally just don't see the point of Ruby. And in terms of "big bucks", Java is (still) very strong in corporate, C++ as well, and more startup-y ventures often use Python, or one of the "hip" languages, node.js, Lisp, Clojure, stuff like that. But money is in pretty much any language. Decide what you want to do first and choose the best language for the job then.
Comment on: How can I grasp the concept of C sockets?
I'd say just use it, you will get to know what you need over time. Just write a chat progam or something like that.
The number of bytes are returned so you can check that a) everything you need has been transfered, because that is not always the case, and checking is always better than assuming, and b) so you can easily loop over it byte for byte.
Comment on: Hey /v/programming - What's your favorite language to program in and why?
First language was C, and still one of my favourites. It is not beautiful and forces you to pay attention or it leaks memory, segfaults or just fails silently. But unbeatably fast, and so small you can learn it in a day. Also runs on everything.
I then did Python for quite a while, because if it is possible, you can do it in Python, and there are already 3+ libraries to do it on PyPi. It is just amazingly slow most of the time, which is the price of interpreted dynamic typing. Also still a reasonable choice for most projects that are not that performance-dependent, hell reddit runs on Python.
But my favourite right now is Haskell. I like compiling my code, I like static typing, I like pure functional programming. It takes a while to get used to, but it is incredibly elegant and concise, so much that it makes it a lot of fun to use.
In the end, I try to try out a new language every couple of months, just to get a feeling for how languages behave. I also really like D, more than Go or Rust (or C++), all of which I have used for side-projects in the past, but I am not sure it has a future, at least not one where I can be sure that investing time into mastering it will not be a waste.
Comment on: Anybody own a Raspberry Pi? Care to share any cool projects you've done on it?
I currently have a model B (the old one with 256MB) at home with an uptime of almost 500 days. It is used to share an external drive to the network, serves some static pages to the web and is a gameserver (nethack, moria, etc) for me and a couple of friends. It is also my ssh-entrypoint from the outside, and running a mumble-server (umurmur) which can handle a couple of people without problems.
I've been meaning to do something cool with it, but the limited power is, well, limitng. But it excels everywhere where you just need any computer. Most of the load is coming from umurmur, some Django dev-server I forgot was even on there (including a running MySQL instance), and, when in use, NFS and SMB servers. It is currently running with ~10% CPU usage, a loadavg around 0.1 and 54M of used memory, with the rest used for cache. And I can continue playing my current run of nethack anytime I want without problems whatsoever. It seems, computer power gets vastly underestimated. I should also mention, it is running a preemptive kernel, mainly because it came with the distro and I don't want to sacrifice the glorious uptime.
Comment on: Language of choice?
Heavily depends on what I am doing. If I just want to mock up something, or do something that involves a library, pretty much always Python, because it is easy to just build something and there are libraries for literally everything from OpenGL to image analysis and meteorologic maths. If I want something small that is focussed on speed, I might also choose C, but it involves a lot more boilerplate to get something seemingly simple up and running. And since I started to understand it, I also try to write some things in Haskell, where appropriate, because functional programming is really nice once one understands the concepts, and has some benefits, like I love working with lists in Haskell, so much more convinient. Also, having the speed of a compiled language with a REPL for quick testing is really nice imo.
There are a couple tasks where [in my case vim, but emacs as well] really shines. Stuff like insert some braces in the begining of each line, for a couple hundred lines. I can do this within seconds, by just binding a macro to some key and executing it 500 times. Or working with chunks of text. Mass search-and-replace. Integrated linting, and generally great integration with any build environment you need. Once I start working on something, I don't exit my editor. I only switch between files using a fuzzy finder and use custom functions to build, test, run and commit.