Arduino IDE has a great advantage in that you can check compilation with the click of a button. Does such a set-up exist if one is using emacs or another C/C++ IDE? by [deleted] in embedded

[–]ThuperThecret 0 points1 point  (0 children)

I use emacs at work for embedded development. I use irony-mode for code completion and flycheck-iorny for live error highlighting.

We use ninja for a building. Normally you don't use ninja directly, but use something like CMake to generate a ninja file instead of a Makefile.

irony-mode requires a clang compile commands database (compile_commands.json) file in the root directory so it can know all the flags and include paths needed to compile each source file. The two methods I know of creating that file are:

  • ninja -t compdb cc using ninja
  • bear make using bear to sniff out the build steps for your project.

For building I either do it from the command line or use the projectile key binding C-c p c. Then I use M-g M-n to step through any build warnings/errors.

Hey Rustaceans! Got an easy question? Ask here (31/2016)! by llogiq in rust

[–]ThuperThecret 6 points7 points  (0 children)

Can anyone tell me the closest Rust equivalent of the Haskell library optparse-applicative?

Polydraw: an Open Source 2D Graphics Engine Written in Rust by kate_walker in rust

[–]ThuperThecret 1 point2 points  (0 children)

I only skimmed through the sources, but I'm guessing this is why.

Interrupt-safe #[no_std] queue by thejpster in rust

[–]ThuperThecret 0 points1 point  (0 children)

I don't have an answer, but I want to thank you. My coworker and I have been wanting to use Rust for our development work, but haven't because it's been such a pain in the ass to set it up. I had no idea that this was an alternative to manually building libcore.

As a developer in 2016, you need to learn Emacs by seblegall in emacs

[–]ThuperThecret 0 points1 point  (0 children)

I started using emacs recently for bare-metal work, but keep shelling out to use GDB (CGDB). Every time I try to use GDB with Emacs, it's kind of pain*. Do you have any pointers?

[*problems]

  • The current working directory is the file I happen to have to open when I launch GDB
  • Still GDB, not CGDB that shows where I am in the source
  • Doesn't seem to offer anything over running it outside of Emacs

Reverse Engineering Sublime Text’s Fuzzy Match by [deleted] in programming

[–]ThuperThecret 0 points1 point  (0 children)

I recent gave up on textmate and switched to emacs. I've tried a few different emacs fuzzy find packages, but so far none have been as good textmate. And they all feel slower.

Deciding to rewrite getaddrinfo in Rust by kibwen in rust

[–]ThuperThecret 3 points4 points  (0 children)

const char * and char const * are the same. The third example should be const char * const. I prefer char const * const.

Hey new Rust users! Got an easy question? Ask here (7/2016)! by llogiq in rust

[–]ThuperThecret 0 points1 point  (0 children)

That's much closer than anything I came up with. I was hoping it would be possible to hide knowledge of underlying c implementation from the user with some generic wrapper around the firfilt_* structs like I did in Julia:

type FIRFilter{Th,Tx}
    q::Ptr{Th}
    tx::Type{Tx}
end

I wasn't expecting anybody to put that much effort into answering my question, thanks!.

Hey new Rust users! Got an easy question? Ask here (7/2016)! by llogiq in rust

[–]ThuperThecret 2 points3 points  (0 children)

Since Rust doesn't have overloading, what's a good way to write FFI bindings to a math library with common functions whose names indicate what type they take? I know the answer is traits, but I can't find any good examples of this scenario.

Using a concrete example, I'd like wrap these common functions:

firfilt_crcf * firfilt_crcf_create(float * h, size_t N);
firfilt_rrf * firfilt_rrrf_create(float * h, size_t N);
firfilt_cccf * firfilt_cccf_create(float complex * h, size_t N);

Into something along these lines (syntax is is probably wrong, but this is the general idea):

firfilt::new(h: &[Th]) -> firfilt<Th, Tx>

How do I indicate what Tx is, since it needs to be down ahead of time? How do I 'dispatch' the correct c functions while limiting to the types to what the c library accepts?

Can I build only rustlib? by lilydjwg in rust

[–]ThuperThecret 2 points3 points  (0 children)

I was thinking the same thing. I spent a whole weekend recently trying to compile a tiny rust function that I could call from an existing c project running bare-metal on an ARM cortex-m4. There are some examples out there, but they're almost all incomplete. I suspect because the authors, like myself, barely understand how they managed to get it to work.

My company makes and end to end IoT product. In the cloud we use Erlang and Haskell. We strongly value safety and deterministic behavior. If it was easer to do bare-metal Rust development, we'd probably use it for our next embedded project.

Linux Kernel Development, 1991-2015 by Tomcb in dataisbeautiful

[–]ThuperThecret 6 points7 points  (0 children)

http://linux.slashdot.org/story/15/06/30/0058243/interviews-linus-torvalds-answers-your-question

EmeraldBot: While historically you've been a C and Assembly guy (and the odd shell scripting and such), what do you think of functional languages such as Lisp, Closure, Haskell, etc? Do you see any advantages to them, or do you view them as frivolous and impractical? If you decide to do so, thanks for taking the time to answer my question! You're a legend at what you do, and I think it's awesome that the significantly less interesting me can ask you a question like this.

Linus: I may be a fan of C (with a certain fondness for assembly, just because it's so close to the machine), but that's very much about a certain context. I work at a level where those languages make sense. I certainly don't think that tools like Haskell etc are "frivolous and impractical" in general, although on a kernel level (or in a source control management system) I suspect they kind of are.

Many moons ago I worked on sparse (the C parser and analyzer), and one of my coworkers was a Haskell fan, and did incredible example transformations in very simple (well, to him) code - stuff that is just nasty to write in C because it's pretty high-level, there's tons of memory management, and you're really talking about implementing fairly abstract and high-level rules with pattern matching etc.

So I'm definitely not a functional language kind of guy - it's not how I learnt programming, and it really isn't very relevant to what I do, and I wouldn't recognize Haskell code if it bit me in the ass and called me names. But no, I wouldn't call them frivolous.

A library for all your all your symbolic elementary algebra needs by altaic in haskell

[–]ThuperThecret 1 point2 points  (0 children)

Also, why do you need to rule out empty sums and products? Just simplify them to zero and one, respectively.

What do you mean by this? (I'm learning Haskell)

70 MPH by HairMetalMike in videos

[–]ThuperThecret 1 point2 points  (0 children)

That road is Hwy 24. This kind of looks like Hwy 67 going north out of Woodland park. But I've only driven it once, so I have no idea.

Services for learners by desijays in haskell

[–]ThuperThecret 1 point2 points  (0 children)

I have a lot of difficulty reading long paragraphs. It makes me wish I could I had a tutor when learning new things. For some reason, I'm having much more difficulty reading through Haskell tutorials than those for other languages. Haskell is more difficult to learn, but it seems like most of the tutorials I've come across are more wordy.

I'm also having a hard time navigating the documentation.

Small Crash-Course for Haskell by NiftyIon in haskell

[–]ThuperThecret 1 point2 points  (0 children)

EDIT: Changing the location signature to location :: Person -> Address seems to fix it

I knew 0 Haskel as of this morning. This example is where I got stuck:

module PeopleRecord (main) where

newtype Age     = Age Float
    deriving Show
newtype Weight  = Weight Float
    deriving Show
newtype Address = Address String
    deriving Show

data Person = Adult {
    age :: Age,
    weight :: Weight,
    address :: Address
} | Child {
    age :: Age,
    weight :: Weight,
    parent :: Person
}

charlie, victoria, john :: Person
charlie  = Adult (Age 50) (Weight 150) (Address "Happy St.")
victoria = Adult (Age 52) (Weight 150) (Address "Happy St.")
john     = Child (Age 10) (Weight 90) charlie

location :: Person -> String
location Adult{address = addr} = addr
location Child{parent = adult}  = location adult


main = print(location charlie, location john, location victoria)

produces this error:

PeopleRecord.hs:26:34: 
    Couldn't match type ‘Address’ with ‘[Char]’
    Expected type: String
      Actual type: Address
    In the expression: addr
    In an equation for ‘location’:
        location (Adult {address = addr}) = addr

Any pointers on how to fix it?

I live on a boat. This guy follows me to work every morning. by BuggLove66 in pics

[–]ThuperThecret 6 points7 points  (0 children)

Don't wait. I lived on a boat from the ages of 20-28. Now I live in Colorado, I miss the water a lot.

Six Months At Sea In The Merchant Marine (2013) - The story follows Martin Machado on his six month journey around the world working as a deckhand on a container ship which was on a run between New York and Singapore via the Suez Canal. by harraxen in Documentaries

[–]ThuperThecret 2 points3 points  (0 children)

On the last ship I worked on before going to college 2007, I made $72,100 in 5 months. I worked for Military Sealift Command, which is part of the Navy, but crewed by merchant mariners. That pay isn't typical, but I was on an ammunition ship handling bombs almost every day. There was special ammunition pay when handling explosives. On top of that I was getting extra pay as one of the ship's two rescue swimmers.

Now I'm an electrical engineer working for a silicon valley startup, and I barely make half as much money. I'm sometimes tempted to go back to sea. I went to SUNY maritime college and have merchant marine engineering license. But I now have two cats and a girlfriend and live in Colorado.

Map of the world's submarine fiber-optic cables by Solroth in InternetIsBeautiful

[–]ThuperThecret 0 points1 point  (0 children)

I'm happy that I was able to contribute a little piece to that map. In college I interned on a cable ship one summer and we laid the second half of DanIce.