source-code

Multi-language command-line source code formatter

Is there a command-line Unix tool that will format/indent/prettify source code in different languages? I'm especially interested in Java, JavaScript, PHP, and XML, but ideally it would handle others. (I'm not looking for something to generate syntax-highlighting markup; I already know of a few tools that do that.) ...

Manage data structures in the database or in code?

I've always had a difficult time deciding where the best place is to manage my "master" set of data structures for my data access layer. Traditionally, I've always started with a database and used a code generation tool to get a set of code models (i.e. ActiveRecord in SubSonic). Lately, however, I've been attracted by the idea of mana...

How can I set the default file format in the Delphi IDE to UTF8?

Delphi 2009 sets the default file format for new source code files to ANSI, this makes the source code platform-dependent. Even for a new XSD file created in the IDE, which by default starts with this line <?xml version="1.0" encoding="UTF-8" ?> Delphi sets the file format to ANSI (this looks like a bug, for new XML and XSLT document...

How to disable the Formatter in Delphi 2010

Hello, The formatter in Delphi 2010 is really an annoying thing to me. I prefer formatting my code manually. I believe I do it better. How can I disable it? NOTE: Answers on why I don't use it in the first place will not be accepted. I need it switched OFF. Nothing more, nothing less. Thank you. ...

Programmatically parse and edit C++ Source Files

Hi, I want to able programmatically parse and edit C++ source files. I need to be able to change/add code in certain sections of code (i.e. in functions, class blocks, etc). I would also (preferably) be able to get comments as well. Part of what I want to do can be explained by the following piece of code: CPlusPlusSourceParser cp = n...

"Number line" style of comparisons

I recently read in Code Complete that the recommended way of handling expressions that involve numbers is to order them like a number line. The book has 2 examples: if ( (MIN_ELEMENTS <= i) && (i <= MAX_ELEMENTS) ) if ( (i < MIN_ELEMENTS) || (MAX_ELEMENTS < i ) ) With the first example showing that i is between the min and max elem...

question about pl/sql stored program text

hi all. I use TOAD to do my PL/SQL development. In TOAD when i type a procedure name and press f4, I can see this procedure's source code. I think TOAD get the source code from v$sqltext view. To confirm my thought, I wrote a query: select * from v$sqltext but when I execute the upper query, Oracle give me an error: ORA-00942: tab...

Mathematical Evaluation of Source Code

Is there some mathematical relation or formula that can estimate a better source code from a less better one? If I write a program to do exactly the same task using PHP and PERL programming language, for example generating HTML with the text "Hello World!", can these two source code files be evaluated to conclude one is better than the ...

What is the most complicated, complex block of code you've ever written for a legitimate purpose in a real project (up to 20 lines)?

What is the most complicated, complex block of code you've ever written for a legitimate purpose in a real project (up to 20 lines)? ...

Script to remove python comments/docstrings

Is there a python script or tool available which can remove comments and docstrings from python source? it should take care of cases like """ aas """ def f(): m = { u'x': u'y' } # faake docstring ;) if 1: 'string' >> m if 2: 'string' , m if 3: 'string' > m Edit: So a...

Change C# code with multiple button controls.

Hi, I would like to know if it is possible to change the code "DefaultValue" in the C# file that is used by "example.aspx" by using a few button controls. SqlDataSource1.SelectParameters["id"].DefaultValue = "value"; As you can see I already have part of what I need. I would just like to be able to insert different numbers (e.g. 14) ...

Convert java syntax to actionscript

I'm porting an existing java library to actionscript and since they are both realy similar, 95% of the work is simply flipping variable and function definition around. public int foo(int bar) {} //converts to public function foo(bar:int):void {} Boring stuff. Is there a tool to automate the transition between java syntax and actionsc...

Get source from pre-compiled ASP.NET website?

Long story short, VSS decided I wasn't allowed to have some code changes. I am missing a decent sized feature that I don't want to have to re-write (gave to a co-op as work this past summer). It works great and does what the client wants. However... I don't have the machine and the machine it was developed on has since been paved low! D...

FogBugz On Demand + online source control at low/no cost?

I have a project in the free hosted FogBugz On Demand (FOD) product right now. This is great for feature/issue tracking. But I've been working from a codebase that is solely on my development machine. I'd like to collaborate with another guy who is thousands of miles from me. So we need a source control solution (SCM)! I use Visual Stud...

How to move all source code over when it was on VisualSVN Server on Vista and migrating to Windows 7?

I had VisualSVN Server running perfectly on a Windows Vista machine, and then now it is to run Windows 7 on that same machine (installed on a new partition). So now all the source code are in the repository on D: drive (it used to be on C:) (Windows 7 will be C:, and the Vista will now become D:) Can we just copy the D:\Repositories o...

eclipse debugger: attaching source-code of maven dependencies?

I'd like to use the source code of maven-managed dependencies when debugging our webapp in myEclipse 8. I have managed to attach the sources to the libraries in the "Maven Managed Dependencies" classpath container, i.e. when I open a class file from a dependency (e.g. using Ctrl-Shift-T), I see the source code. However, when I define a...

How should I organize the code for my software package?

I want to reorganize my C++ code project, which contains of hundreds of source files. I want to split everything into 4 libraries, taking care to avoid cyclic dependencies: (a) src/core (b) src/util (c) src/create (d) src/process Basically, core implements the basic data structures and util implements some basic utility functions to ...

Switch off the new Delphi 2010 Find feature

In Delphi 2010 a new Find bar has been added beneath the source editor. Though I sounds like a good idea I find it prettry anoying when F3 should be pressed multiple times for finding next matches. It works from time to time for me. How I can switch it off and use the old search fnctionality? ...

Corrupt files when debugging into .NET framework

When debugging into the .NET framework using Visual Studio 2008 Professional, the source files appear corrupted somehow, and the yellow debug line doens't hit the correct lines in the source. For example, a source file might start like this: // Copyright (c) Microsoft Corporation. All rights reserved. namespace System.Web.Mvc { ...

How to extract duplicate value in arraylist in c#

i have a array-list who have a list of a type but all value is defined by two times Means to say ex:-my blog url it's included in my arraylist two times http://anirudhagupta.blogspot.com/ http://anirudhagupta.blogspot.com/ how i can remove it's duplicate copy from my arraylist ...