implementation

Building a lexer in C

I want to build a lexer in C and I am following the dragon book, I can understand the state transitions but how to implement them? Is there a better book? The fact that I have to parse a string through a number of states so that I can tell whether the string is acceptable or not! ...

C# Performance of nested yield in a tree

I've got a tree-like structure. Each element in this structure should be able to return a Enumerable of all elements it is root to. Let's call this method IEnumerable<Foo> GetAll(). So if we have A <-- topmost root / \ B C / \ / \ D E F G a call to GetAll on element C returns {C, F, G} (fixed order of eleme...

Which design option is better to use in coding a framework?

I'm coding up a framework (in Java, but question is generic) in which I will provide a set of interfaces for clients to implement. The functions in the framework are going to rely on how the implementation classes will be constructued, that is, thay depend on those implementations to provide other instances of interfaces. For example I ...

Simple Delegate Example?

Ok, I'm programming in objective-C and using Xcode. I have read through the documentation on Apple's website and understand what delegate's are but when I come to the part where it talks about how to actually implement delegate methods into code, I just become confused, especially when they say something like "now implement the delegate'...

How can I implement a string data type in LLVM?

I have been looking at LLVM lately, and I find it to be quite an interesting architecture. However, looking through the tutorial and the reference material, I can't see any examples of how I might implement a string data type. There is a lot of documentation about integers, reals, and other number types, and even arrays, functions and ...

ways to learn implementing workflow of a software

Hi... How many ways are there to learn implementing workflow of a software? What are them? ...

Access modifiers on interface members in C#

I am getting a compile error from the following property. The error is: "The modifier 'public' is not valid for this item" public System.Collections.Specialized.StringDictionary IWorkItemControl.Properties { get { return properties; } set { properties = value; } } but if I remove the IWorkItemControl it compiles fine. W...

Objective C - static variables

I don't quite understand static variables when defined in the implementation of an interface. In methods I do understand how they differ from local variables, but not when defined directly in an implementation. Look at these examples. What difference do these two make practically? #include "MyClass.h" @implementation MyClass int myInt...

How can we provide external authentication like twitter API?

I always wonder how can the Twitter and many social network application provides the API for developer via registered app key. How can it granted and track the using of those external application? Can you answer me this question? because I alway wondering about this. ...

Java: Implementing a Unsigned 128bit Integer

** first off I should ask: ** Does anyone knows of a current implementation 126b UINT for Java ? I need something to hold natural cardinal values. ie: A huge counter. I know of BigIntegers, which are slow and immutable. A 128b UINT makes sense ... I was think about implementing an OWORD, using a pair of primitive longs. Overflows wou...

How are regular and composite indexes implemented in RDBs?

In databases like MySQL or Oracle, how are indexes implemented? I think regular indexes are stored as B-trees, but couldn't find anything about composite indexes that index on multiple columns. I'm looking for the names of the data structures used so I can research them. More generally, where can I find more such information about datab...

C#: A good and efficient implementation of IEnumerable<T>.HasDuplicates

Does anyone have a good and efficient extension method for finding if a sequence of items has any duplicates? Guess I could put return subjects.Distinct().Count() == subjects.Count() into an extension method, but kind of feels that there should be a better way. That method would have to count elements twice and sort out all the distict...

What is the most efficient way to compare/sort items from two arrays?

I have a question about efficient implementation. Lets say I have two arrays: One array is all possible items in a house: Table, Chair, TV, Fireplace, Bed The other is an array of items in a particular house: Table, TV, Bed I also have two list boxes: 1. listbox for items in the house - the "HAS" list box 2. listbox items not in ...

Why InputStream and OutputStream implement Closeable and Socket doesn't?

Have seen this comment in a method: //I wonder why Sun made input and output streams implement Closeable and left Socket behind It would prevent creation of wrapper anonymous inner class which implements Closeable which delegates its close method to an instance of Socket. ...

Why ArrayList implement IList, ICollection, IEnumerable?

ArrayList declare that it implements IList, ICollection, IEnumeralbe interfaces. Why not only implement IList, because IList is also derived from ICollection, ICollection is derived from IEnumerable. What's the purpose of this kind of declare? there are many cases like this in .net BCL. ...

Reason for unintuitive UnboundLocalError behaviour

Note: There is a very similar question here. Bear with me, however; my question is not "Why does the error happen," but "Why was Python implemented as to throw an error in this case." I just stumbled over this: a = 5 def x() print a a = 6 x() throws an UnboundLocalException. Now, I do know why that happens (later in this scop...

What is https and SSL? How do they work? How can they be used in PHP?

I know the general definition but I need more details on how to implement them in general and PHP in specific, and what exactly are the features I gain from them? ...

What features to implement in a version control system?

Hi all, I will be implementing a version control system in C++ for my final year project. I would like to know: What are the features a version control system should must support. What features do you consider are missing in existing implementations (so that my version control system does more than just reinventing the wheel ) Referen...

Automating a Job at Work: Importing Powerpoint Bullet Text into an Excel Sheet

I have been asked to automate a particular task at work today which takes up a lot of our time! The following is what needs to be done and I would appreciate any help on how I can do this (Implementation Advice) within the realms of my knowledge, if possible. Problem I have a PowerPoint document (.ppt). I would like to extract text fro...

C#: How to implement IOrderedEnumerable<T>

I want to implement some various algorithms for practice, just to see how bad I really am and to get better :p Anyways, I thought I would try to use IEnumerable<T> and IOrderedEnumerable<T> and other .Net collection types just to be compatible (so that what I write can be used more easily later). But I can't find a way to return an ins...