Profile cover photo
Profile photo
Jacob Quinn
889 followers -
Enjoy coding, design, analytics, etc....
Enjoy coding, design, analytics, etc....

889 followers
About
Jacob's posts

Post has attachment

Post has attachment

Post has attachment
Heads up to everyone that almost all the JuliaCon videos for 2016 are up on YouTube!

Take a couple for a spin and make sure to like and subscribe: https://www.youtube.com/playlist?list=PLP8iPy9hna6SQPwZUDtAM59-wPzCPyD_S

Of course, I encourage you to watch at least my video about DataStreams.

/shameless plug

Post has attachment
Looking to revive this collection with a quick tip.

Just went through the process of setting up pretty, semi-automatic documentation for my CSV.jl package using the Documenter.jl package. Great stuff! Check out the guide here: https://juliadocs.github.io/Documenter.jl/latest/man/

You can also see the new docs for CSV.jl here: http://juliadata.github.io/CSV.jl/latest/

Still need to tag a new release for CSV to get all the latest updates I've been working on, but if you do Pkg.checkout("CSV"), everything should work fine on 0.4/0.5 right now.

Check out this photo from houzz.com- http://houzz.com/sr/m=7/u=L3Bob3Rvcy8yNjA2MDQxOQ==

Today's Julia tip follows in the same vein as my last post about compatibility.

How do I easily make my code portable cross-platform?

As much as a core language library tries to abstract away various platform differences (Windows, OSX, Linux, etc.), there are certain pieces of functionality that still persist where there are differences between platforms. This is a common problem when developing packages that use 3rd-party binaries (C or C++ shared libraries). Base Julia provides a few ways to easily make your code cross-platform.

Julia provides a few macros for convenience for dealing with cross-platform code:

 @windows_only really_cool_function(#= windows-specific code =#)
 @osx_only really_cool_function(#= OSX-specific code =#)
 @linux_only really_cool_function(#= linux-specific code =#)

Here, I'm defining a single `really_cool_function`, yet the implementation will be different depending on what platform the code is run on. This is wonderful for users of this code because they themselves don't have to put in any `@windows_only/@osx_only`, they just call `really_cool_function` and it "Just Works (TM)".

There is also a ternary operator form like
  
  t =@osx? "yes, I'm a mac" : "No, I'm not a mac"

Some don't like this form because it's "too cute" or a pun on the ternary operator, but it exists nonetheless.

Enjoy making your code cross-platform!

Post has attachment
I've been needing a reason to do more regular posts and this Collections features seems like a good way to organize content streams. This collection is called "Julia Programming Tips" and I'll try to post fairly frequently with tips and tricks (since I spend at least some time every day coding, I should be able to find something to post about...).

*Note: If you don't care to see updates about programming/Julia, you can navigate to my profile page (by clicking on my picture), then click on "Collections" and then click "Following" on the "Julia Programming Tips" collection to not see these posts.

First tip!

As a package maintainer, how do I maintain a single code source instead of branching different versions (say for version 0.3 vs. 0.4)?

This is a great question with a relatively new answer. Originally there was the `VERSION` variable defined in Base that allowed one to put something like:

  if VERSION > v"0.4.0"
       # version 0.4 code
  else
       # version 0.3 code
  end

While this works, it's a little clunky because often times the new feature/syntax you want to use was introduced at a specific commit, so just specifying `v"0.4.0"` means anyone on 0.4, but that doesn't yet have the new commit will see errors. It then becomes a hassle to track down the exact commit relative to 0.4 to version off of (e.g. `v"0.4.0-dev+4928"`). What's worse is that new syntax may not even be parseable in the new commit.

Enter Compat.jl (https://github.com/JuliaLang/Compat.jl). Compat.jl is a package that maintains compatibility changes between versions in Julia. It's a central repository for all packages to use to simplify the versioning process and provide an easy way to use new features/syntax in packages, while easily maintaining backwards compatibility. Like the new Dict syntax in 0.4? Try this:

    using Compat
    new_fancy_dict_of_lies =@compat Dict("money" => "happiness")

Boom! Code automatically compatible between versions of Julia. Super simple stuff.

Anyway, that's it for today's Julia tip, feel free to ask any questions, suggest future tip topics, or, shudder, correct my code :( Have a swell day!

Post has attachment
My wife is amazing!

Post has attachment
Wait while more posts are being loaded