Thursday, November 12, 2015

Simple backup batch(using rar/winrar) - for Windows

Here is a simple backup batch file fow windows.
It will be called by a daily process and it provides to make a .rar backup file with day specification in the file name.
Here is the content of the .bat file that you have to create(suppose you have f:\DATI\ANAGRAFICA folder to backup):

echo

set WINRAR="C:\Program Files (x86)\WinRAR"

set mydate=%date:~6,4%%date:~3,2%%date:~0,2%
echo %mydate%

f:
cd DATI
%WINRAR%\rar a -r F:\BACKUP\ANAGRAFICA_%mydate%_BCK.rar ANAGRAFICA



That's all..... Bye...

Tuesday, November 10, 2015

Phonegap: your first easy mobile app.....

Here we see how to make a first simple mobile app starting to the real funny "Pokemon Fusion" web page realized by Alex Onsager and you find by clicking here....(http://pokemon.alexonsager.net/)

We will do a simple import(by an html iframe) of the page of Pokemon Fusion.
We will write only a single code row.
We will do a simple test to try how PhoneGap works.....

At the and we have an .apk file to install on our android phone

Prerequisites: PhoneGap development kit correctly installed on your pc... an android phone correcty connected and recognized by your pc(and phonegap).

Step 1: open a prompt and create a working directory(mkdir pokemonfusion_test)
Step 2: move under your working dir: cd pokemonfusion_test
Step 3: create a simple PhoneGap test project: phonegap create test
Step 4: move under www directory and open index.html for editing it....
Step 5: remove from the body tag element all its content and paste this
        <iframe src="http://pokemon.alexonsager.net/" style="width:100%; height:100%;">
        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
the last two rows are already existent in the file.......
So those three rows will be the only content of the body tag.....
Save and close the file.
Step 6: deploy all on your android phone(or your local emulator....): phonegap run android

After few minutes Pokemon Fusion will be displayed on your android system......
Your application will installed with "Hello World
" name. And its icon will be the default icon for test application.

All it's done, you can download by here:




Or checkout via SVN under this: svn+ssh://svn.code.sf.net/p/pokemonfusion/code
Access by anonymous user with no password.
If you have a svn client type this:
svn checkout svn://svn.code.sf.net/p/pokemonfusion/code/ pokemonfusion-code 

You can find here the project of the phonegap application as you see in this post.

Bye.....

Monday, November 9, 2015

Eclipse: installing egit plugin

Open eclipse, in the toolbar menu, under "Help" - "Install New Software"
Insert this url "http://download.eclipse.org/egit/updates" into the text field and click on the "Add" button.
Flags the "Eclipse Git Team Provider" and "JGit" check boxes.
You've done....

Friday, March 13, 2015

Eclipse: disinstalling plug-ins

For full removing installed plug-ins from Eclipse, go under

Help --> About Eclipse --> Installation Details(BUTTON) --> Installed Software(TAB)

then select plug-ins to remove....

Bye....

Thursday, February 26, 2015

Cordova/PhoneGap: prevent screen rotation

Fix the screen side of your app, preventing screen rotation.
Edit the config.xml file, the orientation preference tag in one of these ways:

<preference name="orientation" value="portrait" />

<preference name="orientation" value="landscape" />



Bye...

Monday, February 9, 2015

Font-size property dynamically proportioned to the browser window size

It's called viewport. It's the same to say browser window size.
We can assign to the font-size property a value expressed in percentage.
For example if the viewport width is 50 cm, assinging a font-size of 1vw matches to 0.5 cm.
So we give it simply:
a {
    font-size: 1vw;
}

Others use of dinamical font-size use should be:
- the vh: viewport height - for example: font-size:1vh;
- the vmin: the smaller between vw or vh - for example: font-size:1vmin;
- the vmax: the larger between vw or vh - for example: font-size:1vmax;

Bye...

Thursday, January 29, 2015

PhoneGap plugins: file transfer - download

file-transfer plugin needed.
Install it with this: 

phonegap plugin add org.apache.cordova.file-transfer

Here is my example.html(within javascript code).
This example provides a file download(pay attention to change the value of file url to download):

<!DOCTYPE html>
<html>
  <head>
    <title>PhoneGap Transfer - download - Example Page</title>

    <script type="text/javascript" charset="utf-8" src="cordova.js"></script>
    <script type="text/javascript" charset="utf-8">

    // !! Assumes variable fileURL contains a valid URL to a path on the device,
//    for example, cdvfile://localhost/persistent/path/to/downloads/

    function startDownload () {
        alert ("invoked startDownload function...") ;
        var fileTransfer = new FileTransfer();
        var downloadUrl = encodeURI("http://www.yoursite.com/file_to_download.txt");

        var relativeFilePath = "./papa-francesco.sqlite";  // using an absolute path also does not work

        window.requestFileSystem(LocalFileSystem.PERSISTENT, 0, function (fileSystem) {
           var fileTransfer = new FileTransfer();
           fileTransfer.download(
              downloadUrl,

              // The correct path!
              fileSystem.root.toURL() + '/' + relativeFilePath,

              function (entry) {
                 console.log("Success");
              },
              function (error) {
                 console.log("Error during download. Code = " + error.code);
              }
           );
        });
  
    }
    </script>
  </head>
  <body>
    <p><button onclick="startDownload()">start download</button></p>
  </body>
</html>


Bye...