Good Idea - Quote
19 Dec 2015Any good idea is only as good as its implementation
–– Inteist
I have stumbled across Tarantool database which seems to be a very fast storage for hot data. If you are looking for a very fast and efficient tool, check it out.
Tarantool is claiming to be about 30% faster than Redis.
Tarantool allows to write server side stored procedures with Lua, allowing to create in DB rest APIs.
Tarantool is not good for big (static/cold) data.
Since it is not always easy to separte cold data from hot data. They are working on an smart automatic solution that will analyze the patterns of data access and decide automatically which parts of data are cold and should be phased out to disk and which parts are hot and should be treated as such.
In April I have wrote how to solve a problem of poor highlighting for the search results for the Atom editor. Since then in the ever evolving editor after one of the updates something broke and the highlight feature became broken. Took me a while to get to it but I have finally had some time to take a look at it and I came up with the following replacement:
//
// Search highlight
//
atom-text-editor::shadow .highlight.find-result .region {
background: rgba(255,255,255,.2);
border-color: rgba(250, 248, 51, .6);
}
//
// the active search highlight - to distinguish from the other results
//
atom-text-editor::shadow .highlight.current-result .region,
atom-text-editor::shadow .highlight.current-result ~ .highlight.selection .region {
background: rgba(255,255,255,.05);
outline: dashed;
}
A neat method to test for a set containment in another set both of which are Collections
private boolean isSubsetOf(Collection<String> subset, Collection<String> superset) {
for (String string : subset) {
if (!superset.contains(string)) {
return false;
}
}
return true;
}
The history list in Safari is not timestamped. Yes, it is chronologically ordered but for some misterious reason is not timestamped. That sucks but fortunately there is a simple solution for that.
The history is actually saved as files on your machine.
So ….
is pretty simple:
cd ~/Library/Caches/Metadata/Safari/History && ls -lt | perl -MURI::Escape -lne 'print uri_unescape($_)' | less
or you can define a nice csh
alias using function
function safari-history() {
cd ~/Library/Caches/Metadata/Safari/History
ls -lt | perl -MURI::Escape -lne 'print uri_unescape($_)' | less
}
If you have recently upgraded to El Capitan and now your fonts in Android Studio are non anti aliased (they look thin and broken) you’ve come to the right place for a solution.
The source of the problem is in the different font rendering used in different SDK versions. The Java 6 (JDK 1.6) which is used by Android Studio by default has the subpixel antialiasing rendetin while the JDK 1.7 and JDK 1.8 do not.
I have upgraded from Mavericks to El Capitan and suddenly my JDK 1.6 was gone and not surprisingly Android Studio’s font rendering was horrible.
To confirm you don’t have JAVA 6, go to /Library/Java/JavaVirtualMachines
and run ls
cd /Library/Java/JavaVirtualMachines && ls -l
you will most likely see jdk1.7.0_60.jdk jdk1.8.0_31.jdk
as an output. (that’s what I saw)
You should download JAVA 6 from this Apple’s support article. It’s about 70Mb install file. Make sure to close any Java apps and run the installer. You should have the 1.6.0.jdk
folder inside your JavaVirtualMachines
folder I was talking about above.
Once this is set, you can launch Android Studio and enjoy the anti aliased fonts again.
Good luck!
Useful links:
A simple clang-format
style file that will get you 80% of what you want with 20% of effort (or even less):
BasedOnStyle: Chromium
AlignTrailingComments: true
BreakBeforeBraces: Attach
ColumnLimit: 0
IndentWidth: 4
KeepEmptyLinesAtTheStartOfBlocks: false
ObjCSpaceAfterProperty: true
ObjCSpaceBeforeProtocolList: true
PointerBindsToType: false
SpacesBeforeTrailingComments: 1
TabWidth: 8
UseTab: Never
The only significant difference you may want to make is with BreakBeforeBraces
. I prefer opnening bracket on the same line - makes the code more compact and looks better imo.
Learn how to simplify preformatting of the whole folder with clang-format
This is a snippet I use to format all the files (recursively from the current folder) for iOS projects
function clang-format-ios {
echo "\Clang-Format all files in current dir except ones in */libs/* folder and names containing *.framework.*\n\n"
find . -name "*.[hm]" ! -path "*/libs/*" ! -path "*.framework*" ! -path "*/Pods/*" -print0 | xargs -0 clang-format -i
echo "\nDONE\n"
}
this assumes you
clang-format
installedzsh
environment (e.g. ohmyzsh
)it is easy to install clang-format on OS X via homebrew
with
brew install clang-format
NOTE: this is the same script I have used in the past with uncrustify
but I have decided to switch to clang.
A great uncrustify
utility does not have (afaik) an option to recursively process all the files in the folder/project. Fear not. find(1)
to the rescue!
I am using zsh
(specifically ohmyzsh
) so I’ve put the following alias (it can certainly be done as an alias but I like the better clarity definition of a function provides)
The following will process all the .h
and .m
files except the ones that are in /libs
path and that have .framework
in their name – avoiding the libraries and system frameworks. You may want to add additional exceptions fitting to your usecase and naming conventions.
function uncrusrify-ios {
echo "\nUncrustify all files in current dir except ones in */libs/* folder and names containing *.framework.*\n\n"
find . -name "*.[hm]" ! -path "*/libs/*" ! -path "*.framework*" -print0 | xargs -0 uncrustify -c .uncrustify.cfg --replace --no-backup
echo "\nDONE\n"
}
Enjoy!
and I hope you find this snippet useful