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
switch (getResources().getDisplayMetrics().densityDpi) { | |
case DisplayMetrics.DENSITY_LOW: | |
// ... | |
break; | |
case DisplayMetrics.DENSITY_MEDIUM: | |
// ... | |
break; | |
case DisplayMetrics.DENSITY_HIGH: | |
// ... | |
break; |
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
<dependency> | |
<groupId>javax.servlet</groupId> | |
<artifactId>javax.servlet-api</artifactId> | |
<version>3.1.0</version> | |
<scope>provided</scope> | |
</dependency> |
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
#!/bin/bash | |
# /usr/bin/backup | |
# Backup www folder + database | |
# author: Alexandru Simonescu | |
# | |
a=$(date +%T-%d_%m_%Y) | |
b=$(date +%d_%m_%Y) | |
mkdir /home/webserver_backups/$b/ | |
cp -i -p -R /var/www/museo /home/webserver_backups/$b/museo_$a |
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 void determineScreenDensity() { | |
DisplayMetrics metrics = new DisplayMetrics(); | |
getWindowManager().getDefaultDisplay().getMetrics(metrics); | |
int density = metrics.densityDpi; | |
if (density==DisplayMetrics.DENSITY_HIGH) { | |
Toast.makeText(this, "DENSITY_HIGH: " + String.valueOf(density), Toast.LENGTH_LONG).show(); | |
} | |
else if (density==DisplayMetrics.DENSITY_MEDIUM) { | |
Toast.makeText(this, "DENSITY_MEDIUM: " + String.valueOf(density), Toast.LENGTH_LONG).show(); |
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
private int dp2px(int dp) { | |
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, | |
getResources().getDisplayMetrics()); | |
} |
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
package es.ineco.sima.helper.network; | |
/** | |
* Created by alexandru.simonescu on 29/09/2014. | |
*/ | |
import android.content.Context; | |
import android.util.Log; | |
import java.io.BufferedReader; |
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
using DuoVia.FuzzyStrings; | |
/// <summary> | |
/// Busca el fichero con el nombre que mas se parece en la ruta elegida. | |
/// Si no encuentra el fichero o carpeta devuelve Excepciones. | |
/// Depende de DuoVia.FuzzyStrings | |
/// </summary> | |
/// <param name="path">Ruta donde buscar</param> | |
/// <param name="filename">Nombre del fichero a buscar</param> | |
/// <returns>Coincidencia mas exacta del fichero encontrado</returns> |
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
/// <summary> | |
/// Execute the command Asynchronously. | |
/// </summary> | |
/// <param name="command">string command.</param> | |
public void ExecuteCommandAsync(string command) | |
{ | |
try | |
{ | |
//Asynchronously start the Thread to process the Execute command request. | |
Thread objThread = new Thread(new ParameterizedThreadStart(ExecuteCommandSync)); |