Slashdot is powered by your submissions, so send in your scoop

 



Forgot your password?
typodupeerror

Comment: I find this useful, ignore the FUD! (Score 1) 488

by QX-Mat (#41519347) Attached to: TypeScript: Microsoft's Replacement For JavaScript

As a cocoa programmer tasked with implementing yet another embedded htmlfucking5 project thanks to Adobe Edge, I wish Javascript would die.

After looking at the myriad of patterns for my current project - a Javascript client REST API - I came to the swift conclusion that most of them are silly, namespace polluting, self initializing mindfucks. I gave up looking at patterns, found a preloader (lab.js - although require.js is looking good) and wrote my own module pattern objects to satisfy the clarity, structure and ease of maintenance requirements of a good API. Being verbose is not a sin in enterprise Javascript.

I have a lot of little helpers like this:

MyCompany.fetchSomething(function (things) { // actually gives you things
});

Plus some event handlers

MyCompany.addEventHandler('scope', function (data) { // handler
});

But by far the largest section of my code is the model fetching stuff - you know the really boring bits where copy by value doesn't cut it, I need functions and and objects.

My last trail by fire was a paginated e-book reader with support for embedded video and audio. That wasn't a lot of fun, but at least the CSS3 spec was helpful and the DOM readable. The Javascript in that project was limited to around 200 lines.

I recently discovered that REST libraries are pretty long winded - after 200 or so lines, Javascript becomes a horrible implementation specific mess of spaghettied anonymous function chains. I opted for the Module pattern and ran into lots of fun:

  1. I have to write all my getters and setters, as properties/getters/setters
  2. Variable lifting/elevating results in seriously ugly var blocks at the top of my functions and causes copy by value in some rather obvious block scopes
  3. Fast enumeration (for x in a) doesn't work
  4. Itterating through ordered keys is painful with associated hashes - you have to create a key enumerator (with pushes! ) each time you want order. jQuery doesn't particularly help.
  5. Everything runs on the same thread.
  6. Post increments don't work in for loops, for (i = 0; i
  7. Prototypical inheritance is pointless key bashing - it pollutes your vision with the use of 'self' everywhere god forbid you miss a one.
  8. Inheritance is a dirty word unless you've already written things in a special way (prototype extension is just a dirty hack!)
  9. Given a lack of compile stage, writing code is error prone and debugging a tiresome line by line experience
  10. Chained async callbacks are inflexible, hard to read and painful to edit. Expanding ajax piped promises to a colleague made him cry and take a week off sick.
  11. Everything has to be a fucking DOM element before jQuery/the DOM will play nice
  12. Preloading code, initializing it and handing off to that code is painful/ugly with self initializing modules.

So with MS actually targeting 5 or more of the annoying problems I face, I find this library really useful. But naturally I'll get modded down because, a) I develop Apple software and b) I don't pick sides, I program (I like Windows 7 as my desktop, XCode as my IDE, and Slackware on my shell - go fish!).

Oh well, I can only dream of this being adopted!

Comment: Re:Best Preference (Score 1) 468

by QX-Mat (#41102943) Attached to: Ask Slashdot: IT Contractors, How's Your Health Insurance?

It would appear you've been modded 'Funny', despite it being the same unfunny statement I intended to make.

Now I've read a post about someone saying disorders like autism could lead to higher premiums prior to Obama... wtf America? It's as if the more I understand about the US, the less I actually know :( I used to think Ireland was living in the middle ages for charging €35 for a GP (general practitioner aka family doctor) visit, now I think they're more like the slightly racist grandmother than the bat-shit crazy cat-lady nextdoor US :/

Comment: I use a fair bit (Score 1) 1086

by QX-Mat (#40935015) Attached to: Ask Slashdot: How Many of You Actually Use Math?

It depends on what you're trying to do. Not knowing what you're doing can be hurtful, for example, not knowing very basic algebra means you can't do simple things. Recently I noticed my colleague couldn't determine the row and column for given an index. Quite trivial stuff.

Fairly recently I've implemented a 3d cone curl for iBooks style page flipping and countless interpolation functions where an API doesn't give enough control. Being able to work with a continuous principle and derive a discrete function is very important in animation.

I guess it comes down to 3 things: how well you understand the subject, how well you can program and whether you can apply relevant maths in a way that won't obscure your code or make it more difficult to maintain. I don't want to tweak random values, and if you don't understand these random values and start exposing them, you're going to make spaggetti code.

Understand your chosen coordinate system and swap when you need to! Take an arrow with a head - you can place a static arrow head at the end of a line or you can derive the arrow head's position and and shape as a function of the line - the latter looks really nice if you understand the coordinate system. If you don't, you'll end up making a horrible mess.

But alas, your mileage may vary - if someone hadn't done the hard work for me, I wouldn't be able to implement many of the things I'm asked to as I'm merely an engineer (and yes, I have a few of those mid-level textbooks with titles like 'Maths for Engineers' or 'Somethingtotallypointlessbutitsyourjob Theory For Engineers'). Once you've solved a couple of matrices most of what you'll do in Unity is state orientated, so with the help of a good model you don't need to think, ie: in some model context, model->modelToWorldMatrix will transform model coords into wordspace, use modelToWorldMatrix.

Hope this helps!

Comment: A lot of C Programmers are missing Objective-C (Score 2) 793

by QX-Mat (#40521519) Attached to: What's To Love About C?

Disclaimer: I'm an Objective C Programmer by day

The LLVM compiler suite is tremendously powerful with Apple's billions advancing many select features, but key to it's success from a users prospective the core use of reference counted object graphs (of type 'id') and reflection (RTTI - via 'isa' and 'Class'). Obviously this means the entire language is dynamically typed at runtime, but with express qualification in 99% of the code you'll use there's absolutely no performance hit despite the ubiquity of the core object.

I worry that many C programmers will remember RTTI was once considered an unportable disaster in C++ because of the the many differing implementations owing to a spec that left the implementation up to each compiler... Don't let this kind of talk scare you! Although objective, objc is contained to a well defined spec, single inheritance and nary a template in sight.

I consider my programming work to be relatively easy. 50% of my ease comes from the object system above. The other 50% from the fast messaging system used in place of raw ADTs: In the objc world a nil object doesn't fault when messaged (in a C world dereferencing a NULL pointer, common if a struct fetching function fails and then passes NULL on failure) leads to all manner of crashes, or as seen recently, kernel exploits. The messaging system can even push around primitive values, not just nasty objects.

If you program in C, you may have missed Automatic Reference Counting, if you have, low and behold, it's amazing: at *compile time* the compiler adds lifetime qualifiers to the IR that automatically inserts retain and release messages (retain is +1 on alloc, -1 on dealloc - release occurs at 0). In other words the lifetime of an object in objective-c is now exactly the period of acquisition to last use. Yes, last use. ARC's use of a new 'weak' reference means that dangling pointers are a thing of the past: a __weak object is automatically nil'ed after last use: in all local instances of that object (did I say nil objects don't fault on message?).

Admittedly most of what I've mentioned is thanks to the advances in LLVM's Clang compiler, in particular it's static analyser, therefore much objc analysis also benefits C (LLVM's IR is quite specular ).

I could go on: methods can be heap objects with cblocks, objc encourages abstract programming with delegates, you can method swizzle at runtime, extend existing classes and link to C/C++ code.

Comment: Re:Too long? (Score 2) 290

This is a prime example of the EU doing what it does well: being reasonable. Sadly it's rarely ever reasonable when you want it to be. Domestic legislation tends to be more 'pro'-active.

Here in the UK we have a domestic statute that goes further than the mandatory 2 year EU Directive because of differing language: goods must be of satisfactory quality for a 'reasonable time'. Because reasonable time isn't defined in the statue or common law, it's possible to bring action under the Sale of Goods act within the civil limitation period (6 years from the date of purchase/contract).

The EU Directive is supposed to harmonise the law across member states. For some it is a backwards step and doesn't address the problem of faulty and wasteful electronics. On the plus side I believe the burden of proof is lower under the EU directive, unlike in the UK where it switches from the producer to the consumer after the first year (ie: if it's borked you have to show it's not your fault - easy when it's electronic, not so easy with unreasonable wear and tear).

That said, I'm a little weary of how long the older, better built, technology is lasting - I'm 27 and my parents have held on to a microwave many years older than me. Like a true horror movie it looks, sounds and acts evil - I wish it would go away :(

Comment: 27 minutes of 'fast' (Score 2) 247

by QX-Mat (#38030266) Attached to: Brits Rejecting Superfast Broadband

I was a Virgin subscriber for less than 28 days the other month. Thankfully I took advantage of their 28 day moneyback guarentee... why? All of their plans, except the most expensive one, capped you from 10Mb+ to 2Mb after 2Gb during 'peak time' (where peak time is a series of 4 hour slots throughout the day).

2Gb? That's less than movie on X-Box Live, 30 minutes of HD iPlayer or a 2Gb game patch... Deus Ex and BF3 are both 8Gb on Steam/Origin. The 2Mb cap is supposed to last until the end of the current peak period, or not more than 4 hours (iirc), but this didn't happen. If you hit the cap during the day, you were capped until 3am or later. Trying to use youtube or iPlayer on 2Mb is a painful experience. 480p would buffer and buffer and buffer - you had to load in the background and pause it regularly.

27 minutes of fast internet access, a package sold by misdescription, is a joke. Being able to fundamentally alter your service (by 80% or more) within 27 minutes is a joke. And people wonder why the target audience aren't running to sign up.

(Virgins ADSL2 service drop you to 5Mb, and are much more forgiving. Sky don't cap me at all - amazing!)

Comment: Re:Obviously No Strong Legal Standing (Score 2) 138

by QX-Mat (#37502228) Attached to: TOSAmend Automates Counteroffer Terms For Service Agreements

The OP is right... but it's interesting.

For ordinary agreements you need offer (contractee) and acceptance (contractor), in a ToS acceptance and assent to the terms is implied by some form of conduct. TOSAmend seeks to make a unilateral contract (one to the world) bilateral (between parties) with no real chance or form of agreement. I believe it can be construed as an unaccepted counter offer. In such cases the method of communicating acceptance/rejection is important. Merely the act of making a counter-offer rejects the original offer ('destroying' it).

Website ToS are unilateral agreements. Your acceptance is your participation on a website be it subscribing, visiting or checking a box that signs your soul away. The obvious basis is that you cannot accept an agreement you have not agreed, nor can someone accept an agreement you have not proposed - acceptance requires a positive act on behalf of the contractor. All in all this won't stand up in a real court... in a TOSAmend user's favour.

However, I find the interesting bit is what happens next. If you don't assent to the terms or the original unilateral contract, and it is clear from your conduct that you have not (striking out terms etc), and managed to propose and communicate a counter offer, is the contractee bound by any of the original terms?

In common law you have to assent to terms. Ambiguity and unfairness are often side with the consumer in litigation. Unfair unilateral contracts are the most unreasonable of them all. A website trying to enforce a unilateral contract where acceptance was clear through conduct might find themselves with another burden: proving the contract the end user saw and assented to was their unmodified copy. Post form, text input box, and server-side string match of the accepted contract and original would easily solve the problem. In the mean time... don't let the user interact with the website... at all.

Just thinkin'

Matt

Comment: Re:The problem for UK IT graduates (Score 1) 349

by QX-Mat (#37337746) Attached to: British CS Majors Doing Badly In the Jobs Market

I'm thankfully employed having spent over a year on the dole. If you're worried about your job now, it doesn't change much. To succeed and change jobs interviewers expect the impossible despite experience (Q: You know about static assertions? A: Yes I use them to guard external APIs [and why]. Q: How are static assertions implemented in a cross platform manner? Q: Ugh I er use them. I've not written my own handlers. I've not had time to research that - I've got deliverables and I'm relied upon.).

Things aren't going to pick up - there are so many shit programmers and shit team players who interview well for a desperate employer. This makes the market guarded and hard to penetrate (Q: This error took one of our programmers several hours to solve. What's the problem and why does it output this? A: He used the wrong braces in that array declaration, and but don't know what the comma operator does in that context. I wouldn't use it as I like to write maintainable and obvious code).

It didn't help that the last person to interview me on C++ was a former lecturer. Most of the questions you'll get have specific answers - it's not a case of thats on the heap, thats on the stack, const this and that, overruns and they're the same etc. It's more along the lines of what a MSVC specific nonstandard keyword does. (Q: How is so and so implemented internally in STL, A: I eurgh, use STL - I don't have time to write my own containers - I'm applying for the high-level Cocoa role you know!)

I'm also fed up with the 'undefined spec' questions. I know some of them. I shouldn't know everything - I'm supposed to be programming not memorising the spec/parashift FAQ!

Matt

Comment: Legally good and bad (Score 1) 758

by QX-Mat (#33540672) Attached to: Court Says First Sale Doctrine Doesn't Apply To Licensed Software

I've got to hand it to the supreme court, because they've managed to do two things that are both legally good and bad at the same time (from 'our' /. perspective). First of all they've upheld what they know, that is, the assignability (assignation?) of a contract or licence. Admittedly contracts and licences are not the same from a legal perspective (the phenomena of agreement has a few more formal common law hurdles to cross), but the goal is simple: protect a very real asset.

What asset? In law there are a few types of contract. The most obvious is a standard A <-> B agreement, the next is a less standard A <-> B (personally), and the one a lot of people gloss over is A <-> X (where X is anyone). The latter is unilateral, where the formers are standard contracts where the ability to assign differs depending on terms of the agreement. The assignment of a promise is so core to IP, Property and Contract law that without it, our world would crumble (they figure on corporate balance sheets). Take for example, the case of a landlord renting a spacious flat with several rooms to a vetted tenant. If that tenant was given the ability to assign his lease to another tenant of lesser stature, what kind of protection would the landlord have? The worst case scenario is a poor tenant who creates several illegal sublets and uses the property as a crack den. The best case is a more an affluent/big earner type who pays their bills on time and gets on with all the neighbours.

For as long as contract has existed the ability to protect the intent of the contract has reigned supreme, therefore that means protecting the interests of people who set the terms and those who agree to the terms. Allowing landlords to block assignment protects a landlord and their interests in *their* property (sublets are legally problematic - more layers of enforcement to get rent, no privity etc - and crack dens reduce the value of property). Hence the ability to restrict the assignability is an asset to a landlord but a balance sheet liability to tenant (a buyer of a commercial tenant will have to purchase the remaining liability of any leases out-right because no seller would sell a business any retain property liability unless they got a massive capital gain).

So... legally speaking protecting a licensor's interests in a licence agreement, specifically the ability to assign, is a big ideal. However, what is happening in software is not an A B licence, because A purchases B's software from C's shelf. This, but definition, is a carbolic smoke ball: it is unilateral A X licence, where X is anyone in possession (I am glossing over the agency/distribution perspective massively). Unilateral contracts don't gel with the ability to restrict a licensee because there is no requirement of individual assent in a unilateral agreement (in other words because B, where A is the author of some software, didn't have to sign anything, why should B be liable on a personal basis when A made the offer to the class of B - iow, any potential buyer). What I believe we have is a limited personal licence: A <-- licences --&gt B (personally). Any by personally I mean the first purchaser bares the burden of the licence, nobody else. When they sell the copyrighted protect, ie: the program/code, the initial purchaser does not reassign the licence. Therefore a purchaser of B's copy is not restricted by the same terms as B was - this is the principle behind first sale (US)/exhaustion of rights (EU).

(nb: i've drunk far too much tonight for this to make any sense tomorrow)

Matt

"No job too big; no fee too big!" -- Dr. Peter Venkman, "Ghost-busters"

Working...