This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
| $ adb -e pull /system/xbin/sqlite3 # get sqlite3 binary from emulator with the same CPU arch. | |
| $ adb -d push sqlite3 /mnt/sdcard # push it | |
| $ adb -d shell | |
| $ run-as <PACKAGE_NAME> # run as your app, which should be debuggable. | |
| $ cd databases; pwd | |
| /data/data/<PACKAGE_NAME>/databases | |
| $ cat /mnt/sdcard/sqlite3 > sqlite3 # copy it to internal storage directory | |
| $ ls -l sqlite3 | |
| -rw-rw-rw- u0_a138 u0_a138 36860 2014-03-26 06:37 sqlite3 | |
| $ chmod 777 sqlite3 # change mode bits, to be executable |
This file contains hidden or 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 System; | |
| using System.Collections.Generic; | |
| namespace SIMA.Core.Layers.Transversal.IoC | |
| { | |
| /** ServiceAnomalias serviceAnom = ServiceContainer.Resolve<IUniverseFileServiceAdapter>() **/ | |
| public static class ServiceContainer | |
| { |