Our company needs a localization/translation behavior which allows incomplete (ResX) resources.
If a String
isn't available in italian
fall back to the next roman language, like french
fall back to our invariant (in this case: german)
The easiest approach was a custom CultureInfo.
/// <summary>
I created a view called PullView which adds a level of interactivity to UI components. PullViews can be pulled sort of like a rubber-band and bounce a little when released. The code for it is fairly simple.
I would like comments on how to improve code structure, performance, etc. if possible.
...
Most properties have simple requirements so it should be possible to register their Dependency Property fields declaratively.
I made a small experiment and it seems to work just fine. The first attempt supports DefaultValue and Validation attributes.
It looks a little bit like JavaScript ;-)
...
I was reviewing for an interview and encountered the following question (and I'm paraphrasing):
Suppose you're given a shuffled array of numbers containing all of the numbers between a min and a max, inclusive, with one number missing. For example, for an array of size 5, you could have somet...
i was trying to solve a hackerrank problem, it looked simple but i'm having problem with one of the test cases, i'm afraid i don't truly understand what to do, though my code worked for all others test cases.
The problem is this: https://www.hackerrank.com/challenges/designer-pdf-viewer?h_r=next...
I'm building a stack of paths that each lead to a template directory. The idea is to crawl up the tree pushing paths onto the stack as long as there are contents in the template directory. This is an example file tree:
$ tree .
.
├── stack.rb
├── templates
│ ├── gem
│ │ ├── optionparser
│ ...
I've written this implementation of a binary search algorithm, and wanted to know if it was efficient and where I can improve.
function search(el, olist) {
// list = olist || LIST;
var LIM = ~~Math.log(list.length) + 1,
lb = 0,
ub = list.length - 1,
i;
while (...
I'm trying to make a simple app in C# that gets the weather data from http://openweathermap.org/api (OWM).
Here attached are two classes that I use to initialize WeatherData for selected City and to download and parse XML data from OWM API. I would like to know your opinion on the structure of t...
The next post in my Checker series: The C# wrapper for my F# library to make it cleaner for these methods to be called from C# code.
GeneralTypes.cs
public enum Player
{
White, Black
}
public enum PieceType
{
Checker,
King
}
public static class Extensions
{
public static Playe...
I've never even looked at Python code until a few hours ago, but I am familiar with enough other languages that I thought I could figure this out... I was wrong.
This is some old code that I downloaded. I installed Python 3.6, so I think it may be an issue with old code vs new compiler.
I'm us...
I put together script which goes through all of the files in google drive, and writes a spreadsheet with all of the files with their name, containing folder, url, and date last updated.
function Start_Up() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.ge...
For my side project, I am integrating github authentication and I wrote my own mini client for that using Silex. One of the many things I want to learn is writing testable code.
Here's the main part of the code:
interface Authentication
{
public function getState();
public function get...
(...as I learn Kotlin) I want to get the indices of the two numbers such that they add up to a specific target from a given array of integers.
Solution:
fun sum(values: Array<Int>, result: Int): Array<Int> {
for ((i, e1) in values.withIndex()) {
for ((j, e2) in values.drop(i + 1).withInde...
I have the following javascript code:
var selectEnabledGenerators = function(generators) {
//List of generator indexes to show
var list = generators;
var allGenerators = $(".generatorContainer");
//Hide all generators
allGenerators.hide();
//maybe use filter here?
for...
There's some behavior with Active Record's find_by that can be unexpected:
Say a table "Posts" has a numeric column "score". One could then say Post.find_by(score: 0) which is a typical use-case and works fine.
If there are many records, only the first matching the condition is returned. The so...
This is based on a programming challenge I recently solved. However, since the writer of the challenge asked me not to disclose the question and/or it's answer, I modified it a little. If it doesn't make sense: my mistake.
The target is to find all numbers in a file and sum those. So if the foll...