I took the free online course "M102: MongoDB for DBAs" offered by MongoDB Inc. via https://education.mongodb.com/ and created a cheatsheet which can be download: MongoDB for DBAs-M102-Cheatsheet.pdf.
As I took the online course "M101J: MongoDB for Java Developers" first this cheat sheet only contains information not already provided in the developers course. Therefore you have to read the DBA cheat sheet together with the cheat sheet provided for the developers course.
Enjoy.
Thursday, 14 November 2013
Saturday, 2 November 2013
Vegetarian/Vegan restaurants in Germany (Munich, Hamburg, Berlin, Cologne, ...)
If you are looking for vegetarian/vegan restaurants in Germany:
Taken from http://www.zeit.de/2013/45/deutschlandkarte-vegane-restaurants
A list of vegie friendly restaurants in Germany can also be found here - this has also links to lists of restaurants in Austria and Switzerland: http://www.peta.de/web/restaurants.4546.html
You can also search by ZIP code or city name here: http://www.fleischlos-geniessen.de/
Taken from http://www.zeit.de/2013/45/deutschlandkarte-vegane-restaurants
A list of vegie friendly restaurants in Germany can also be found here - this has also links to lists of restaurants in Austria and Switzerland: http://www.peta.de/web/restaurants.4546.html
You can also search by ZIP code or city name here: http://www.fleischlos-geniessen.de/
Vegetarian/Vegan restaurants in Istanbul
Here are a few options I found if you want to eat vegetarian/vegan in Istanbul. All of those places are in Beyoğlu on the european side of the city.
- Parsifal Vejetaryen Restaurant & Cafe: Kurabiye Sokak No: 9/A
- lokanta helvetia: general yazgan sokak, no: 12 - very inexpensive - very good
- Zencefil: Kurabiye Sokak 3
Friday, 25 October 2013
Sencha Touch 2.3: Theming for multiple platforms
Sencha provides different CSS files for different platforms. In their documentation on theming they describe how you need to configure your app.json file, e.g.
The respective CSS-files are provided in the folder "touch\resources\css" and at first I thought that one had to copy those into the folder "resources\css" (in which by default already the CSS file "app.css" resides).
Turns out this is not how it works. The CSS file in "resources\css" are generated via Compass and Sass. Therefore one has to
1) copy the .scss files for the themes one is interested in from "touch\resources\sass" to "resources\sass", eg. copy "touch\resources\sass\cupertino.scss" to "resources\sass\cupertino.scss".
Note: You can also delete the existing "app.scss" file from "resources\sass" as you probably do not refer to it anymore from you app.json file. It really is only a copy of the default theme "sencha-touch.scss" and therefore only needed if you only work with one theme - the default one.
2) execute "compass compile cupertino.scss" in "resources\saas" (you need to have ruby and compass installed) -> this will generate "resources\css\cupertino.css". Repeat this for all the other theme .scss files you use.
When you build using sencha cmd ("sencha app build") it will also call "compass compile".
The "compass compile" process is controlled by the config file "resources\saas\config.rb". By default it is configured to generate a compressed CSS file (output_style = :compressed). Change this to "output_style = :expanded" if you want to get a readable version of the CSS.
Add your own styles to the themes
You can simply add your own Sass instructions or plain CSS to the copied resources\sass\[theme].scss files.
You can also externalize you Sass/CSS into a separate file and import this into the [theme].scss files (using for example @import '../mySass/myProject.scss';).
If you want to add you own custom (font) icons take a look at Bruno Tavares blog on how to do it.
"css": [
{
"path": "resources/css/sencha-touch.css",
"platform": ["desktop"],
"update": "delta"
},
{
"path": "resources/css/wp.css",
"platform": ["ie10"],
"theme": "Windows",
"update": "delta"
},
{
"path": "resources/css/cupertino.css",
"platform": ["ios"],
"theme": "Cupertino",
"update": "delta"
},
...
The respective CSS-files are provided in the folder "touch\resources\css" and at first I thought that one had to copy those into the folder "resources\css" (in which by default already the CSS file "app.css" resides).
Turns out this is not how it works. The CSS file in "resources\css" are generated via Compass and Sass. Therefore one has to
1) copy the .scss files for the themes one is interested in from "touch\resources\sass" to "resources\sass", eg. copy "touch\resources\sass\cupertino.scss" to "resources\sass\cupertino.scss".
Note: You can also delete the existing "app.scss" file from "resources\sass" as you probably do not refer to it anymore from you app.json file. It really is only a copy of the default theme "sencha-touch.scss" and therefore only needed if you only work with one theme - the default one.
2) execute "compass compile cupertino.scss" in "resources\saas" (you need to have ruby and compass installed) -> this will generate "resources\css\cupertino.css". Repeat this for all the other theme .scss files you use.
When you build using sencha cmd ("sencha app build") it will also call "compass compile".
The "compass compile" process is controlled by the config file "resources\saas\config.rb". By default it is configured to generate a compressed CSS file (output_style = :compressed). Change this to "output_style = :expanded" if you want to get a readable version of the CSS.
Add your own styles to the themes
You can simply add your own Sass instructions or plain CSS to the copied resources\sass\[theme].scss files.
You can also externalize you Sass/CSS into a separate file and import this into the [theme].scss files (using for example @import '../mySass/myProject.scss';).
If you want to add you own custom (font) icons take a look at Bruno Tavares blog on how to do it.
Thursday, 10 October 2013
JAX-RS Joda DateTime ParamConverterProvider
I have written a JAX-RS ParamConverterProvider for the Joda DateTime class:
import java.lang.annotation.Annotation;
import java.lang.reflect.Type;
import javax.ws.rs.ext.ParamConverter;
import javax.ws.rs.ext.ParamConverterProvider;
import javax.ws.rs.ext.Provider;
import org.joda.time.DateTime;
import org.joda.time.format.ISODateTimeFormat;
@Provider
public class DateTimeParamConverterProvider implements ParamConverterProvider {
@Override
public ParamConverter getConverter(Class type, Type genericType, Annotation[] annotations) {
if (type.equals(DateTime.class)) {
return (ParamConverter) new DateTimeParamConverter();
} else {
return null;
}
}
private static class DateTimeParamConverter implements ParamConverter {
@Override
public DateTime fromString(String value) {
try {
return ISODateTimeFormat.dateTimeNoMillis().parseDateTime(value);
} catch (IllegalArgumentException e) {
return ISODateTimeFormat.dateTime().parseDateTime(value);
}
}
@Override
public String toString(DateTime value) {
return value.toString();
}
}
}
Thursday, 26 September 2013
Book "SQL Performance Explained"
I just read Markus Winand's wonderful book "SQL Performance Explained" which can be bought as an e-book or print edition and even be read online. The books sole topic is B-tree backed database indices.
The preface already states that "Database indexing is a development task." This is because to define an optimal index one must understand how the application queries the data.
→ This means that every developer should read this book. It will show you how to read execution plans and how to create indices for a wide range of scenarios.
Here are some key points, but you really have to read the book:
1) It is better to have a single index for all columns of a where clause than one index for each column.
2) The column order of a concatenated index has great impact on its usability so it must be chosen carefully.
A database can use a concatenated index when searching with the leading (leftmost) columns. An index with three columns can be used when searching for the first column, when searching with the first two columns together, and when searching using all columns.
→ The most important consideration when defining a concatenated index is how to choose the column order so it can support as many SQL queries as possible.
3) If you use a function (TRUNC, UPPER, ...) on a column in the where clause you must also create an index on the function
4) When searching for ranges index for equality first—then for ranges. This will keep the scanned index range as small as possible.
Example:
WHERE date_of_birth >= TO_DATE(?, 'YYYY-MM-DD')
AND date_of_birth <= TO_DATE(?, 'YYYY-MM-DD')
AND subsidiary_id = ?
→ The index should be on SUBSIDIARY_ID and then on DATE_OF_BIRTH
5) Even if you have a full copy of the production database in your development environment, the concurrent background load can still cause a query to run much slower in production.
→ Careful execution plan inspection yields more confidence than superficial benchmarks.
6) An index can be used for an order-by sort. And because databases can read indexes in both directions this can even be in the other direction. It is only important that the scanned index range is in the exact opposite order to the order by clause.
7) And a last one not only for performance but also for security: Parameterized Queries are the best way to prevent SQL injection.
The preface already states that "Database indexing is a development task." This is because to define an optimal index one must understand how the application queries the data.
→ This means that every developer should read this book. It will show you how to read execution plans and how to create indices for a wide range of scenarios.
Here are some key points, but you really have to read the book:
1) It is better to have a single index for all columns of a where clause than one index for each column.
2) The column order of a concatenated index has great impact on its usability so it must be chosen carefully.
A database can use a concatenated index when searching with the leading (leftmost) columns. An index with three columns can be used when searching for the first column, when searching with the first two columns together, and when searching using all columns.
→ The most important consideration when defining a concatenated index is how to choose the column order so it can support as many SQL queries as possible.
3) If you use a function (TRUNC, UPPER, ...) on a column in the where clause you must also create an index on the function
4) When searching for ranges index for equality first—then for ranges. This will keep the scanned index range as small as possible.
Example:
WHERE date_of_birth >= TO_DATE(?, 'YYYY-MM-DD')
AND date_of_birth <= TO_DATE(?, 'YYYY-MM-DD')
AND subsidiary_id = ?
→ The index should be on SUBSIDIARY_ID and then on DATE_OF_BIRTH
5) Even if you have a full copy of the production database in your development environment, the concurrent background load can still cause a query to run much slower in production.
→ Careful execution plan inspection yields more confidence than superficial benchmarks.
6) An index can be used for an order-by sort. And because databases can read indexes in both directions this can even be in the other direction. It is only important that the scanned index range is in the exact opposite order to the order by clause.
7) And a last one not only for performance but also for security: Parameterized Queries are the best way to prevent SQL injection.
Monday, 23 September 2013
M101J: MongoDB for Java Developers - Cheatsheet
I took the excellent and free online course "M101J: MongoDB for Java Developers" offered by MongoDB Inc. via https://education.mongodb.com/ and created a cheatsheet which can be download: MongoDB-M101J-Cheatsheet.pdf
Enjoy.
Enjoy.
Subscribe to:
Posts (Atom)