How to deal with deprecated classes in Android to keep compatibility

You can do that (checking the API version). You can also use reflection to call the newer classes. I wouldn’t worry about using deprecated methods as all Android versions are backwards compatible, saying that you want to watch when things are for 3.0 Honeycomb as these are a little different. Here’s an explanation of how … Read more

Blob download is not working in IE

Try this using, this or useragent if (navigator.appVersion.toString().indexOf(‘.NET’) > 0) window.navigator.msSaveBlob(blob, filename); else { var blob = new Blob([‘stringhere’], { type: ‘text/csv;charset=utf-8’ }); var link = document.createElementNS(‘http://www.w3.org/1999/xhtml’, ‘a’); link.href = URL.createObjectURL(blob); link.download = ‘teams.csv’; link.click(); }

What is more portable? echo -e or using printf?

printf is more portable. It should always be preferred over echo -e. If targeting bash/zsh/ksh specifically, echo $’…’ is also ok. If targeting zsh or ksh specifically, print is ok. http://cfajohnson.com/shell/cus-faq.html#Q0b http://www.in-ulm.de/~mascheck/various/echo+printf/ http://pubs.opengroup.org/onlinepubs/9699919799/utilities/echo.html#tag_20_37_16 POSIX (last link) also discusses echo -n problems, which should also be avoided. Basically, never use options to echo, and for portability, … Read more

CreateTextRange is not working in Chrome

CreateTextRange is a Microsoft specific function, but there is an easy work around. Use createRange instead as in this post for example: if (document.selection) { //IE var range = document.body.createTextRange(); range.moveToElementText(document.getElementById(containerid)); range.select(); } else if (window.getSelection) { //others var range = document.createRange(); range.selectNode(document.getElementById(containerid)); window.getSelection().addRange(range); }

How to make gradle generate a valid pom.xml file at the root of a project for maven users?

You can use the gradle maven plugin. This adds the pom convention method to your project, which you can use in a task to generate a pom.xml file, like task writeNewPom { doLast { pom { project { groupId ‘org.example’ artifactId ‘test’ version ‘1.0.0’ inceptionYear ‘2008’ licenses { license { name ‘The Apache Software License, … Read more

Android: Tint using DrawableCompat

In case anyone needs to use DrawableCompat‘s tinting without affecting other drawables, here’s how you do it with mutate(): Drawable drawable = getResources().getDrawable(R.drawable.some_drawable); Drawable wrappedDrawable = DrawableCompat.wrap(drawable); wrappedDrawable = wrappedDrawable.mutate(); DrawableCompat.setTint(wrappedDrawable, getResources().getColor(R.color.white)); Which can be simplified to: Drawable drawable = getResources().getDrawable(R.drawable.some_drawable); drawable = DrawableCompat.wrap(drawable); DrawableCompat.setTint(drawable.mutate(), getResources().getColor(R.color.white));

How to check SQL Server Database compatibility after sp_dbcmptlevel is deprecated?

select name, compatibility_level , version_name = CASE compatibility_level WHEN 65 THEN ‘SQL Server 6.5’ WHEN 70 THEN ‘SQL Server 7.0’ WHEN 80 THEN ‘SQL Server 2000’ WHEN 90 THEN ‘SQL Server 2005’ WHEN 100 THEN ‘SQL Server 2008/R2’ WHEN 110 THEN ‘SQL Server 2012’ WHEN 120 THEN ‘SQL Server 2014’ WHEN 130 THEN ‘SQL Server … Read more

How to use libraries compiled with MingW in MSVC?

Based on this error you put in a comment: error LNK2019: unresolved external symbol “int __cdecl openssl_call(struct ssl_State *,int,int,int)” (?openssl_call@@YAHPAUssl_State@@HHH@Z) referenced in function _main MyAPP.obj all other 4 errors are same only with other functions names Try putting extern “C” around your include files for openssl. For example: extern “C” { include “openssl.h” } using … Read more