A Distributed & Robust Feedly
In light of the recent attack on Feedly.com I thought it might be interesting to see other ways we could propogate data accross the Interent without being succeptible to attacks, or, at least less accessible.
With the approach outlined below we need to use an actual app instead of being able to use a browser (there might be a way to use a browser also, not sure how it would work though).
JavaScript
I’ve jumped ship from Excel programming over to JavaScript (in a
functional manner). I’ve also gone the way of Linux away from Windows. I
love Excel and its power. But I see the writing on the wall and am
moving to where I can hopefully get some work and starting making some
moolah. You can follow my new blog over at
http://thisisafiller.ghoster.io/.
If anyone is interested in the products I’ve made let me know how you
like them and send me an e-mail. Or tweet
me @NymanJon.
Prototypes & Compositions with Objects
I was trying to figure out the best way to have functions be both compatible with an object oriented paradigm and a functional oriented paradigm when working on objects. My implementations are probably naive, but instructive nevertheless. It seems that lo-dash and other libraries have done a good job bridging those worlds.
Let’s say you have an object O
such that
function O(a, b){
this.a = a
this.b = b
}
var o = function(a, b){
return new O(a, b)
}
Now, you want to extend
the object but you also want the option to use the object in a more fuctional way with compose
.
Functional Immutability in JavaScript
This is taken from Michael Fogus’ book Functional JavaScript in the chapter Purity, Immutability, and Policies for Change.
Immutability is impossible to achieve in JavaScript without using Object.freeze
but it only performs makes the object immutable shallowing, you have to roll your own deepFreeze
if you would like to make the object truly immutable.
So there are some practices you can do to make your functions and variables perform in a more immutable manner.
Functional or Object Oriented JavaScript?
When people are first exposed to JavaScript and its minimal set of tools (functions, objects, prototypes, and arrays), many are underwhelmed. Therefore, in order to “modify” JavaScript to conform to their idea of what it takes to model software solutions, they very often seek out or re-create class-based systems using the primordial ooze.
- Michael Fogus Functional Programming
Of course, the next sentence he softens that quote, I just enjoyed the first part though.
Notes on Monads, Monoids, and Make Believe
with Brian Lonsdorf
Working with Objects
the better way
var SSN = Constructor(function(number, current_user){
this.number = number
this.user = current_user
})
SSN.prototype = {
fmap: function(f){
if(this.user.is_admin)
return SSN(f(this.number), this.user)
}
}
social.fmap(replace('-', ''))
//=> SSN('123456789', user)
social.fmap(function(number){return number.reverse()})
//=> SSN('1234-56-789', user)
the functor way
Note: Functor function defined.
var AdminAccess = Constructor(function(val, current_user){
this.val = val
this.user = current_user
})
Functor(AdminAccess, {
fmap: function(f){
if(this.user.is_admin)
return AdminAccess(f(this.val), this.user)
}
})
var social = AdminAccess('1234-56-789', current_user)
fmap(removeDashes, social)
//=> AdminAccess('123456789', current_user)
fmap(validNumber, social)
//=> AdminAccess(true, current_user)
He then goes into other useful patterns with monads. But I’ll revisit that later after I get a better handle on this!
bilby.js & functional programming
I’ve been learning functional programming for quite some time and like the programming paradigm. But, it can be difficult sometimes. Some libraries like lodash.js can be easy to start learning, but others like bilby.js require that you understand more of the functional approach. So, here are some videos that have helped me understand bilby.js better.
This one gives a quick overview. Note that Maybe (Haskell) is similar to Option (Scala)
Notes On Functional Programming
Patterns for the Non-Mathematician with Brian Lonsdorf
Lenses
Using lenses for composable/polymorphic model manipulation.
E.g.,
var user = {id:1, name:{first:'doris', last:'day'}}
var L = makeLenses(['name', 'first'])
var firstNameChar = compose(L.name, L.first, _1)
over(firstNameChar, toUpperCase, user)
//=> {id:1, name:{first:'Doris', last:'day'}}
Maybe
Use Maybe
(Haskell) types (Option
types in bilby.js / Scala style) to make composition easier. This works with fmap
(functor maps). Returns resultant option
.
Error Handling (Either)
Either('need an int', 3)
//=> Right(3)
Either('need an int', undefined)
//=> Left('need an int')
fmap(function(x){return x+1;}, Right(2))
//=> Right(3)
fmap(function(x){return x+1;}, Left('need an int'))
//=> Left('need an int')
compose(fmap(f), Either(error))
Future Values
I’ll have to come back to this one later when I use it more.
Spreadsheet Budget Launched
This first version is pretty basic - yet powerful. It will import your financial data from KMyMoney (I’ll add more financial programs later). Soon I will add report templates so you can easily view your finances - how you like it. It comes with an auto updater (wyUpdate) so you can stay up to date with the latest version with small packages.
Bit Torrent Sync & Updating/Installing Programs
Bit Torrent Sync (BT Sync) is great software which can be used for syncing files. I use it for backing up all my pictures/videos/music/files/mobile computers. Well, I did some testing and it looks like it can be used for installing and updating software also.
I tested it with my Windows 8 computer over to my Windows XP computer. I created an Excel xla add-in file and I also created an executable file. Both worked fine after syncing. The following procedure was used: