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

0
votes
0answers
7 views

Confused about unsigned in C [migrated]

#include <stdio.h> #include <stdlib.h> int main(void) { unsigned int i; i = -12; printf("%d\n" , i); system("pause"); return 0; } ...
6
votes
2answers
55 views

Building shape based on user input

The purpose of the below code is to build a shape based on the user input, specifically: Prompt the user to enter a shape - either a triangle or a square Determine which "texture" to use for the ...
9
votes
5answers
690 views

Vertically placing the words in a string

Please let me know a better approach to solve below problem: Problem: Vertically arrange the words in a string and print on console. Sample Input: Hello Jack ...
3
votes
1answer
69 views

Format string inline

For this project, I do not have access to Boost or C++11. Note: I updated the question's description to clarify what I am doing. I have not changed the code though, so no answer has been invalidated. ...
0
votes
1answer
39 views

Dealing with a dirty table

I have to deal with a really ugly looking response I get back from a particular device. The string represents a table. Each section of the string represents the form: ...
-1
votes
2answers
54 views

Efficient way to sort a formatted array (Chris Pine book, ch 7)

I'm on chapter 7 of Chris Pine's book, trying to work on the last exercise in that chapter. This code works fine, but I'm wondering if there is a better way to do this... ...
5
votes
2answers
137 views

Best way to display big data

I would like to display this data, callable at any time, but I'm not sure if this is the best practice to do so. ...
2
votes
1answer
40 views

Formatting the Lengthy Parameters in a better way

Should I have made a line break convert_to_quick_mode( and from_exported_cdf, ...
9
votes
2answers
147 views

Value formatters (for entities like price, currencies so on)

I am looking over some existing code (see below). The problem of grouping in the same place the presentation logic of some fields (like price, currency) was solved as extension methods on ...
5
votes
2answers
491 views
10
votes
1answer
90 views

Follow-up to tool for posting Code Review questions

Description This is a follow-up question to Tool for creating Code Review questions. Things that has changed include: Removed replacing four spaces with one tab, all tabs and all spaces in the ...
10
votes
2answers
86 views

Tool for creating Code Review questions

Description I have realized that there's a whole bunch of code I want to have reviewed, but copying file by file, selecting the code and pressing Ctrl + K is a slow process, and I want to remember ...
3
votes
3answers
192 views

Any recommendations to improve this logging framework? Or is it overkill?

So I've been kind of irritated with my logging recently as I find myself copying and pasting the same kinds of generic messages around to lots of different methods or retyping them ever so slightly ...
7
votes
2answers
122 views

Tool for automatically correcting indentation and formatting of CR & SO code

This is my tentative solution to How can I prepare my code so that I can paste it formatted? If you need to copy and paste code into the question or answer textarea when solving someone's problem, ...
4
votes
2answers
87 views

Is this the best way to print dynamic percent value?

Is there any better way of printing it? ...
8
votes
1answer
61 views

Number format in JavaScript

What's the best way to format a number? If decimal is less than 2 digits, add zero to make it 2 decimals If more than ...
5
votes
2answers
62 views

Specific PHP Data Access Class review

As part of a fun project to help build my knowledge of PHP. I've written a Data Access Class here to bridge the site to the database. I know there are a lot of ...
21
votes
3answers
953 views

Code indentation for declaring inputs/outputs in an array

I'm writing a list of inputs and outputs for to be compared in unit tests. ...
22
votes
6answers
5k views

“Guess a number” game

I began the journey to be a self-taught programmer about a month ago and my biggest fear about teaching myself is developing bad habits and not realizing it. I'm looking for criticism on this "Guess ...
3
votes
1answer
62 views

How to make this calender program simpler/optimized?

I've made a working calendar program, BUT I believe it's extremely inefficient. I think I have way too many else if statements: ...
3
votes
2answers
147 views

Efficient human readable timedelta

I wanted to write a human readable datetime.timedelta that can be used in log files. Eg, "Report issued 1 hour, 44 minutes, 20 seconds ago" I noticed that casting a timedelta to str() generates ...
2
votes
1answer
92 views

Drawing a table in Python3

I have created a module to draw text tables. The relevant parts are below and here's the full code for txtable). ...
8
votes
2answers
907 views

Printing a diamond of numbers

If you input the number 3 from the keyboard, the program will show this: 0 0 1 0 0 1 2 1 0 0 1 2 3 2 1 0 0 1 2 1 0 0 1 0 0 Here is my ...
1
vote
3answers
104 views

How to format Java code?

I am trying to format my code properly. I have already read the programming standards document and I believe that my code follows these rules. I have also used the Ctrl + Shift + F keys in Eclipse ...
2
votes
1answer
277 views

How can I get rid of SELECT…CASE and GOTO in this string formatting helper function?

A while ago I implemented .net's string.Format() method in VB6; it works amazingly well, but I'm sure there has to be a way to make it more efficient. I'll start ...
2
votes
2answers
151 views

Implementing an encryption standard over message text

I wrote the below code and tested some example files on it. I didn't find any errors, but I still want to be thorough about this. Also, any suggestions in improving the code? ...
3
votes
1answer
384 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
91 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 ...
1
vote
1answer
289 views

Format A TimeSpan With Years

I have a class with 2 date properties: FirstDay and LastDay. LastDay is nullable. I would ...
2
votes
1answer
98 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: ...
1
vote
1answer
517 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: ...
4
votes
1answer
129 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
377 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
301 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
69 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: ...
1
vote
0answers
95 views
2
votes
4answers
262 views

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

How can I format this code so it's more readable? ...
10
votes
4answers
7k 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
133 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
2k 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 ...
2
votes
2answers
388 views

Seeking tips for cleaning up simple calculator

Basically I just wrote this calculator as a sort of JavaScript test for myself. It's a simple calculator with addition, subtraction, and multiplication. I've made some improvements to it before ...