This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// is there a perfomance difference between this: | |
var severalTimesAWeek = frequencies.Count(f => f.Frequency > 1.1M); | |
var sevenTimesAWeek = frequencies.Count(f => f.Frequency <= 1.1M && f.Frequency > 0.78M); | |
// plus many more of these | |
// and this: | |
int severalTimesAWeek = 0; | |
int sevenTimesAWeek = 0; | |
foreach (var f in frequencies) { | |
if (f.Frequency > 1.1M) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @days int | |
SELECT @days = DATEDIFF(DAY, @startDate, @endDate) | |
;WITH left_side AS ( | |
SELECT | |
ROW_NUMBER() OVER(ORDER BY a.UserId, DateUtc) as row_num | |
, a.UserId | |
, DateUtc | |
, u.DateCreated |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyClass { | |
public DateTime Date; | |
public string Name; | |
} | |
var list = new List<MyClass> { | |
new MyClass { Date = new DateTime(2012, 02, 01), Name = "Week 1" }, | |
new MyClass { Date = new DateTime(2012, 02, 06), Name = "Week 2" }, | |
new MyClass { Date = new DateTime(2012, 02, 13), Name = "Week 3" }, | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var groupedByWeek = new List<DateTime> { | |
new DateTime(2012, 02, 01), | |
new DateTime(2012, 02, 02), | |
new DateTime(2012, 02, 06), | |
new DateTime(2012, 02, 13) | |
}. | |
GroupBy(s => s.DayOfYear / 7). | |
.Select(s => new {Date=s.First(), Amount=s.Count()}) | |
.ToDictionary(s => s.Date, s => s.Amount); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.google.android.maps.GeoPoint; | |
import com.google.gson.JsonElement; | |
import com.google.gson.JsonArray; | |
import com.google.gson.JsonPrimitive; | |
import com.google.gson.JsonSerializationContext; | |
import com.google.gson.JsonSerializer; | |
import com.google.gson.JsonParseException; | |
import com.google.gson.JsonDeserializationContext; | |
import com.google.gson.JsonDeserializer; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class User { | |
public int UserId {get;set;} | |
// plus some other meta data | |
} | |
public class SearchInfo { | |
// some meta data here | |
} | |
public class UserSearch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Question 1: Given a String write a routine that converts the String to Long without using the built in Java functions that would do this. Describe what (if any) limitations the code has. For example: | |
Long StringToLong(String s) { | |
/* code here */ | |
} | |
void Test() { | |
Long i = StringToLong("123"); | |
if (i == 123) { | |
/* success */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Implement insert and delete in a tri-nary tree. Much like a binary tree but with 3 child nodes for each parent instead of two - with the left node being values < parent, middle nodes values == to parent and right node values > parent. | |
For example, if I added the following nodes to the tree in this order 5, 4, 9, 5, 7, 2, 2 - the tree would look like this: | |
5 | |
/ | \ | |
4 5 9 | |
/ / | |
2 7 | |
| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void show() { | |
map = TiledLoader.createMap(Gdx.files.internal("tiles/tiles3.tmx")); | |
atlas = new SimpleTileAtlas(map, Gdx.files.internal("tiles/")); | |
tileMapRenderer = new TileMapRenderer(map, atlas, 64, 64, 5, 5); | |
font = new BitmapFont(); | |
font.setColor(Color.RED); | |
batch = new SpriteBatch(); | |
// my world units are tiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Maintainer: Jakub Schmidtke <sjakub-at-gmail-dot-com> | |
# Contributor: Joel Pedraza <joel@joelpedraza.com> | |
pkgname=android-support | |
pkgver=r12 | |
pkgrel=1 | |
pkgdesc='Android Support Package' | |
arch=('any') | |
url="https://developer.android.com/sdk/compatibility-library.html" | |
license=('custom') |