tagged [language-agnostic]

Are global static classes and methods bad?

Are global static classes and methods bad? It's generally agreed upon that relying heavily on global stuff is to be avoided. Wouldn't using static classes and methods be the same thing?

30 Jun at 18:28

Elegantly check if a given date is yesterday

Elegantly check if a given date is yesterday Assuming you have a Unix timestamp, what would be an easy and/or elegant way to check if that timestamp was some time yesterday? I am mostly looking for so...

Why are many developers opposed to using the "protected" modifier in OOP?

Why are many developers opposed to using the "protected" modifier in OOP? A co-worker of mine is taking an class and was asked a discussion question by his professor: > When the question was brought u...

2 Sep at 21:2

Using pen strokes with fuzzy tolerance algorithm as encryption key

Using pen strokes with fuzzy tolerance algorithm as encryption key How can I encrypt/decrypt with fuzzy tolerance? I want to be able to use a Stroke on an InkCanvas as key for my encryption but when d...

How do libraries in different programming languages handle Date & Time, Timestamps & Durations, Leapseconds & -years, DSTs & Timezones, ...?

How do libraries in different programming languages handle Date & Time, Timestamps & Durations, Leapseconds & -years, DSTs & Timezones, ...? Is there a standard body or a specific normative way how ti...

23 Sep at 07:47

When designing a data structure, should helper methods be accessible to other users?

When designing a data structure, should helper methods be accessible to other users? I had a talk with my professor today about the layout of the Chunklist data structure that we've been working on. B...

19 Oct at 01:14

What is non-thread-safety for?

What is non-thread-safety for? There are a lot of articles and discussions explaining why it is good to build thread-safe classes. It is said that if multiple threads access e.g. a field at the same t...

how to always round up to the next integer

how to always round up to the next integer i am trying to find total pages in building a pager on a website (so i want the result to be an integer. i get a list of records and i want to split into 10 ...

31 Jan at 00:29

Why are function pointers not considered object oriented?

Why are function pointers not considered object oriented? In the C# language specifications it explicitly states: > Delegates are similar to the concept of function pointers found in some other lang...

20 Apr at 17:45

Why are reified generics hard to combine with higher-kinded types?

Why are reified generics hard to combine with higher-kinded types? There exists a notion that combining reified generics with higher-kinded types is a hard problem. Are there existing languages who ha...

Strangest language feature

Strangest language feature What is, in your opinion, the most surprising, weird, strange or really "WTF" language feature you have encountered?

Database, Table and Column Naming Conventions?

Database, Table and Column Naming Conventions? Whenever I design a database, I always wonder if there is a best way of naming an item in my database. Quite often I ask myself the following questions: ...

Difference between parameter and argument

Difference between parameter and argument Is there a difference between a "parameter" and an "argument", or are they simply synonyms?

How do you detect Credit card type based on number?

How do you detect Credit card type based on number? I'm trying to figure out how to detect the type of credit card based purely on its number. Does anyone know of a definitive, reliable way to find th...

C# logic order and compiler behavior

C# logic order and compiler behavior In C#, (and feel free to answer for other languages), what order does the runtime evaluate a logic statement? Example: Which statement does the runtime evaluate fi...

What is a good Hash Function?

What is a good Hash Function? What is a good Hash function? I saw a lot of hash function and applications in my data structures courses in college, but I mostly got that it's pretty hard to make a goo...

2 Sep at 12:5

Plain, linked and double linked lists: When and Why?

Plain, linked and double linked lists: When and Why? In what situations should I use each kind of list? What are the advantages of each one?

Equation for testing if a point is inside a circle

Equation for testing if a point is inside a circle If you have a circle with center `(center_x, center_y)` and radius `radius`, how do you test if a given point with coordinates `(x, y)` is inside the...

23 Jun at 15:30

When to use unsigned values over signed ones?

When to use unsigned values over signed ones? When is it appropriate to use an unsigned variable over a signed one? What about in a `for` loop? I hear a lot of opinions about this and I wanted to see ...

7 Jul at 15:23

Private vs Protected - Visibility Good-Practice Concern

Private vs Protected - Visibility Good-Practice Concern I've been searching and I know the theoretic difference. - - - That's all fine and well, the question is, what's the difference between them? Wh...

23 Aug at 16:31

Best way to display default image if specified image file is not found?

Best way to display default image if specified image file is not found? I've got your average e-Commerce app, I store ITEM_IMAGE_NAME in the database, and sometimes managers MISSPELL the image name. T...

28 Oct at 09:19

What is the difference between a deep copy and a shallow copy?

What is the difference between a deep copy and a shallow copy? What is the difference between a deep copy and a shallow copy?

Learning to write a compiler

Learning to write a compiler : C/C++, Java, and Ruby. I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Ja...

What's the difference between passing by reference vs. passing by value?

What's the difference between passing by reference vs. passing by value? What is the difference between 1. a parameter passed by reference 2. a parameter passed by value? Could you give me some exampl...

How do I check if a number is a palindrome?

How do I check if a number is a palindrome? How do I check if a number is a palindrome? Any language. Any algorithm. (except the algorithm of making the number a string and then reversing the string).

2 Nov at 22:36