compression - Arithmetic Coding Questions

I have been reading up on arithmetic coding and, while I understand how it works, all the guides and instructions I've read start with something like: Set up your intervals based upon the frequency of symbols in your data; i.e., more likely symbols get proportionally larger intervals.My main query is, once I have encoded my data, presumably I also need to include this statistical model with the encoding, otherwise the compressed data can't be decoded. Is that correct? I don't see this mentioned anywhere -- the most I've seen is that you need t...Read more

coding - What parts of Code Complete haven't stood the test of time?

I was looking at Code Complete on the shelf, thinking, "Outside of the Mythical Man Month, this may be one of the few mass market Software Engineering books to stand the test of time." For this reason, I'm thinking of jumping in to reread it.I'm curious - has anyone else given it a second look recently? I so, did you see anything he got very wrong?This isn't an attack, and not a request for a book review - I am more interested in which ideas have changed over the years.And please - no comment about, "Demarco/Spewak/Zachman stood the test of t...Read more

coding - Is it better to write the whole feature and then debug or do it incrementally?

Suppose there is a reasonably sized programming task(500 lines of code). Which is better?1/Code the whole task from start to finish without running the code and debug later.2/Code some small features, then test and debug, then repeat until the whole task is done.Personally from my experience, sometimes the first approach saves time. But sometimes it takes multiple compile-run-debug cycles to get it to work.The second approach works steadily, but sometimes it feels like it's not that efficient.What are your experience on which is generally the b...Read more

coding - Combine if blocks with repetitive code

I have this piece of codeif (!expr1) { codeblock1;} elseif (expr2) { codeblock2; codeblock1;}It is pissing the hell out of me because I am trying to refactor it in such a way that there is no repetitive code, but I keep getting different results.if (!expr1 || expr2) { if (expr2) { codeblock2; } codeblock1;}What is the logical difference between these two examples?...Read more

Any benefits of writing coding articles

I always wonder if there is any benefit of publishing programming/code related articles/tips either on ones own website or coding sites? I think it has a benefit that a programmer can have a record of his/her learning and refer them later, other than that?As far as I can imagine, forum participation like stackoverflow offers a place for mutual learning and you may get business also, but what will be returned if I write solution for "How to show toggle drawer on Android activity"... etc.Such writing will only attract junior coders who immediatel...Read more

coding - Dijkstra function for navigation for disadvantaged

Is there a way we can write a function for Dijkstra to determine which node to enqueue and which to discard. This is for a navigation solution for people with disabilities where path to stairs may be shorter but not preferable to wheelchair bound individuals. The navigation solution should also support all individuals and only give a path discarding stairs if the specified user group is someone who is wheelchair bound etc. So basically i am attempting to write a function that checks if user group = wheelchair bound then removes the shortest pat...Read more

coding - How would you highlight code?

While the basic scenarios are white on black and black on white, most programmers find more varied syntax highlighting useful.What advantages do you find from a general setup? (E.g. "a dark background allows...")What specific tweaks do you find most helpful? (E.g. "slightly off-white works to...", or "highlighting quote marks and escapes, like \n, differently shows...")One answer per person, please; list multiple points as part of your one response, if needed....Read more

How is your working time distributed between coding and thinking?

...in percentage. For example 60/40 or 90/10 or 100/0.My hypothesis is that the bigger the proportion of time you spend thinking the smaller your code can be as a result (and the less time will be needed to write it down). Think more, write less, in other words. Do you think it is true?As a side note, I think in typical software companies thinking is not part of the culture anyway: you are usually supposed to be sitting there at your computer typing something. You will almost definitely be noticed by your managers if you wander about with a bla...Read more

coding - Coming from QA, how can one land that first development job?

I have been in QA for 10 years, trying to get into development for about 5 of them. I have taken classes in C++, Java and C#. I was able to write some tools and unit tests in C# at my current job and (by all accounts) did a good job of it.However, 8 months ago, my employer tasked me with the responsibility of establishing the new QA group. Now I'm doing manual testing and deployment with no promise of returning to development. I have looked at the job boards and there are a lot of jobs for web developers, so what else can I do to get one? I've ...Read more

coding - How Much Logic in Getters

My coworkers tell me there should be as little logic as possible in getters and setters.Yet, I am convinced that a lot of stuff can be hidden in getters and setters to shield users/programmers from implementation details. An example of what I do:public List<Stuff> getStuff(){ if (stuff == null || cacheInvalid()) { stuff = getStuffFromDatabase(); } return stuff;}An example of how work tells me to do things (they quote 'Clean Code' from Uncle Bob):public List<Stuff> getStuff(){ return stuff;}public void loadStuff(){ ...Read more

Does your company have a coding standard?

I recently saw that Microsoft released a coding standards document (All-In-One Code Framework Coding Standards) and it got me thinking... The company that I work for has no formal coding standards at all. There are only a few developers and we have been together long enough to have evolved into similar styles and its never been an issue.Does the company you work for have a documented coding standards? If no, why not? Does having a standard make a difference? Is it worth writing a standard from scratch or should you adopt another standard a...Read more

coding - Should source-code in textbooks and the like be translated?

A few weeks ago, my class was assigned to translate to Portuguese the book Real World Haskell. As I did the translation of the text and comments, I started to wonder if I should translate the code as well, as the instructor suggested. For example:data BookInfo = Book Int String [String] deriving Showwould becomedata InfoLivro = Livro Int String [String] deriving ShowSince I haven't read any software-related books in Portuguese, I don't know if that's a common practice, neither if it should be done this way. In the end...Read more

experience: coding on netbooks

HI, i want to buy a netbook for doing some stuff in the train. Can someone report how it is to code simple stuff on a netbook? 10/12".I wanted to buy a very cheap one. like 1gb ram 1,6ghz blabla. and run linux on it with apache. i will code with JS/PHP. and as IDE i'll be using notepad++. so nothing big like eclispe or something else. maybe later on eclipse for java, but that doesn't really matter.so first, would this setup work fine on such a netbook and, is it okay for coding?I don't style any homepages on the netbook, I just want to code.wou...Read more

compression - Arithmetic Coding vs. Machine Numeric Precision

When subdividing intervals for arithmetic coding, the worst case scenario is that the final interval will have size 2^(1-n), where n is the number of unique symbols you are encoding. This will reach the limits of machine precision, when using regular datatypes, really quickly: For instance, I've made a JavaScript implementation and it breaks after encoding around just 15 characters!As this is pretty limiting, how do codecs get around this?Encode [very] short blocks, within the machine's limits, and concatenate them together? That will add overh...Read more