A generic term meaning the process by which text transformed into a more meaningful or clearer output. A typical example would be the transformation of a decimal into a particular currency format with the correct number of decimal places.

learn more… | top users | synonyms

3
votes
1answer
84 views

First Javascript - Geocoder - Can it be improved?

So I'm pretty excited to have coded my first javascript file which now works, and I've spent my evening trying to improve it. It takes a location in the #loc input box and geocodes it (gets ...
2
votes
1answer
61 views

Json whitespace formatter

I couldn't quickly find Java code with googling to make serialized Json easier to read (this is a debugging library, obviously implementation code wouldn't use this as it's just more characters). This ...
0
votes
1answer
60 views

Format A TimeSpan With Years

I have a class with 2 date properties: FirstDay and LastDay. LastDay is nullable. I would like to generate a string in the format of "x year(s) y day(s)". If the total years are less than 1, I ...
2
votes
1answer
50 views

Haskell MultiWayIf extension: When is it considered useful syntactic sugar?

The new MultiWayIf extension (available with GHC 7.6) allows guard syntax in an if: {-# LANGUAGE MultiWayIf #-} fn :: Int -> String fn x y = if | x == 1 -> "a" | y < 2 ...
0
votes
1answer
66 views

Underscore-case version of ActiveRecord model's name

Is there a better way to get the underscore-case version of an ActiveRecord model's name? So far this works, but it's far from ideal: my_active_record_instance.class.name.underscore
4
votes
1answer
50 views

Thoughts on organizing code for multiple mysql queries in php scripts

I have a web application where I connect with a MySQL database using PDO and in some scripts there are a lot of queries one after the other which don't necessarily concern the same tables. i.e I will ...
2
votes
1answer
70 views

Stripping formatting from text - Am I using an efficient jQuery selector?

I'm making a comment box using a contenteditable div, but I want to remove formatting from text a user might copy/paste into it (also no CTRL+B or CTRL+I shortcuts allowed either). Only "approved" ...
4
votes
5answers
213 views

Want to remove the goto in my code

I want to remove my goto's in this code but I'm not sure how. There must be a cleaner way to write my code. Perhaps move the "if" statement to the end of each loop then use break? Sorry if this is a ...
0
votes
1answer
63 views

Not sure where to ask this but… does this make sense to anyone else? [closed]

I was reading through some code in a forum I shall not name, and found this snippet: $tempFile = ''; $tempFile2 = ''; $arrayLength = count($filesArr); { //some code } I'm by no means a php ...
1
vote
0answers
46 views

Is there a common variable name prefix/suffix for shortened, or formatted, dates

We have code that looks like this: start_date = Date.current.beginning_of_month end_date = Date.current.end_of_month start_date_s = start_date.strftime("%Y_%m") end_date_s = ...
2
votes
4answers
129 views

How would I format this JavaScript code so it's more readable

How can I format this code so it's more readable? $(".card").click(function(){ $(this).stop().animate({ width:'0px', marginLeft: margin+'px', opacity: ...
9
votes
4answers
1k views

Best practice in php for “If the variable is empty, set a default value”

This is the pattern I've been using for "If the variable is empty, set a default value", and for variables like $muffin it has all seemed well and good. But in the following real example this pattern ...
2
votes
1answer
117 views

How can my code for computing a Discrete Cosine Transform matrix be improved?

I'm learning Haskell and decided that my first program should also help me finish my homework (because if I'm going to procrastinate, why not make it worthwhile?). I needed to work with discrete ...
1
vote
2answers
332 views

Format a datetime like this “20120319”

Im working with some strange api's that requires the dates to be sent in YYYYMMDD format I was thinking to do something like this string date = string.Concat(DateTime.Now.Year, DateTime.Now.Month, ...