source-code

Programming question --

What would be the best solution for this problem?? if we have a question say by the pythagoran theorem. x^2+ y^2 = c then according to that if we are given the value of c, what shall be the best way to deal and find the values of x and y? x and y can be negative. Also, suppose c=0 then x=0 and y=0. Moreover, if we have c=1 then we hav...

Beginner Code::Blocks 10.05 Project vs. Program terminology and IDE issues

Here is the basic issue: when I use codeblocks to begin a "project" (they use this term as opposed to program...) I start with a console "project" and C::B immediately includes a file "main.c" file... with Hello world... the funny thing is the program name that I want to use is (example) would be something like Rick_practice.c for the so...

Writing a code beautifier

I'd like to write a code beautifier and i thought of using Ruby to do it. Could someone show me a place to get started? I've seen a lot of code beautifiers online but I've never come across any tutorials on how to write one. Is this a very challenging task for someone who's never undertaken any projects such as writing a compiler, parser...

Opening Curly Bracket (Brace) position on code

I'm used to write code (in C, Perl, or any language with curly brackets) like: Loops: for (int i = 0; i < 10; i++) { // <----- ... } Conditions: if (i == 10) { // <----- ... } Main: int main () { // <----- ... } Wherein I place the opening curly bracket right after the closing parenthesis. Yet, I see some templates ...

Sort methods in cpp file by header

Hey folks, in my eyes it is good style to sort methods in header files in the same order as in the cpp file. But often this order gets crude during development. Does anyone knows a tool which can reorder the methods in the cpp file to the order given in the header file? Best regards, Gerrit ...

Open Source PasteBin ?

frequently I write wiki pages or set up configuration files that I need to share with other developers. Are there any pastebin clones out there that you can install in your own network and if not, how do you manage code snippets or configurations you wish to share with other developers in your company where source control may be overkill...

When should you start being Open Source?

First of all this question is not intended to be a "subjective question". The actual specific question might be if being closed source (in web development for example) is a good protection measure. It was this article that got me thinking: http://techcrunch.com/2007/08/11/facebook-source-code-leaked/ Lets say you are quite a newbie to...

Is it possible to view the source code of a servlet?

I'm trying to get all of the courses for a college though: http://ohiostate.bncollege.com/webapp/wcs/stores/servlet/TBDropDownView?jspStoreDir=ohiostate&amp;deptId=&amp;campusId=30747395&amp;catalogId=10001&amp;dojo.transport=xmlhttp&amp;termId=44357427 And I was wondering if there was a way I could do this, like can I search the sourc...

User Control for source editing

Hi, Similar to other user controls in C# to add to a winform (such as commonly found for xml formatting) does someone know of one for source editing? Hopefully, this includes the source for the control and does a pretty nice job of making source code readable in a visual studio kind of way. thanks Or maybe Microsoft provides one, but ...

An error ocurred while calculating Code Metrics in VS2008

I have Office 2007 (and Excel 2007) installed in my Windows XP sp3, and I use VSTS 2008 Team Suite. I execute option Code Metrics about a csproj in my solution, and I get the error: An error ocurred while calculating Code Metrics How can I debug it ?? what happened ? ...

Sharing model between Camelot and non-Camelot apps

I would like to share my data model between different Elixir/SQLAlchemy applications, one of which would be a Camelot UI and the others stuff like web interfaces and so on. They would all connect to the same underlying database. As far as I know, to build a Camelot app my model would do from camelot import blah and that would prevent it...

Can I change source code from .NET Framework Library's class?

I got System.Collections.Generic.List<T> source code from mscorlib.dll using .NET reflector. I implemented INotifyCollectionChanged and INotifyPropertyChanged interfaces, renamed the class and builded it. Did I violate copyright? I not using MS source code release with Microsoft Reference License (MS-RL). What about the code deassembl...

TFS with VS 2005 and VS 2008

I was instructed by System IT to start using TFS for source control. I have both VS 2005 and VS 2008 on my machine. I have NO idea how to go by setting my environment to use TFS. Can someone please enlighten me as to what all I need to do in order use TFS? (No they did not supply me with any instructions.) ...

Github-like site for internal use?

I am looking into the creating a repository for work. Github would be perfect, except that, for security reasons, the repo must reside on our internal network. Is there a github-like project out there that I could use? Any recommendations? ...

ftp source code

I wanted to have a look at source code of basic networking services like FTP, Telnet, rlogin etc. Can anyone tell where can I get them. By the way, its not that i didn't google it, e.g. searching for ftp, gives me list of so many ftp variants, but i am intersted in looking at a ftp client/server which ships with Ubuntu. Thanks ...

dominator code to be reviewed in Java/C++

Dominator is a value which occurs on more than half positions in an array. For instance in the array: [3, 4, 3, 2, 3, -1, 3, 3] 5/8 > 0.5 The value 3 occurs in 5 out of 8 positions. , so 3 is a dominator: In this array the dominator occurs on indexes : 0, 2, 4, 6 , 7. Write a function int dominator(int[] A); that given an array return...

algorithm to find complementary solution to this problem

I had this coding question in an interview.I couldnt find an optimum solution to this. what I did was, for(i=0;i<n;i++) for(j=i;j<n;j++) if(a[i]+a[j]==k) print a[i], a[j] But that would give rise to a O(n2) complexity. Is there a better way to solve this?? Array A contains n integers. A pair (i,j) of indexes of the array A is called ...

Is there a speed benefit to using unsafe code in .Net to swap objects of complex types?

Here is my current swap code for swapping 2 KeyValuePair objects in an array: KeyValuePair<int, T> t = a[i]; a[i] = a[j]; a[j] = t; Would there be any speed advantage to using unsafe code and merely swapping the pointers of the 2 objects? Or does the complier effectively boil this safe code down to effectively ...

What SCM tool and approach would be best for this scenario?

I do freelance work from home - several websites based on Wordpress, OpenCart, other open source projects and sometimes some custom made CMS/ecommerce. I'm trying to get organized to have a local Source Code Control tool - to keep track of changes, etc. I've tried SVN - its ridiculously slow - I guess because of the number of small file...

Source code for java array

Where can i find the source code for java arrays? Example: double[] arr=new double[20]; All array's with any dimension implements Cloneable and Serializable interface.I searched the source code but couldn't find the code for this.Any help would be great. ...