Android Browser Scaling with target-densityDpi via Viewport TAG

Here is a list of options for “target-densityDpi”.

device-dpi: Use the device’s native dpi as target dpi.
low-dpi: 120dpi
medium-dpi: 160dpi, which is also the default as of today
high-dpi: 240dpi : We take any number between 70 and 400 as a valid target dpi Continue reading Android Browser Scaling with target-densityDpi via Viewport TAG

How do you fix this The AVD manager normally uses the user’s profile directory to store AVD files However it failed to find the default profile directory?

The AVD manager normally uses the user’s profile directory to store AVD files. However it failed to find the default profile directory. To fix this, please set the environment variable ANDROID_SDK_HOME to a valid path such as “”.

(Windows 7 and 8 Only… 64-bit version Tested) Continue reading How do you fix this The AVD manager normally uses the user’s profile directory to store AVD files However it failed to find the default profile directory?

Apache web server: Mapping a URL to a local directory in Ubuntu

We would like to serve the content of a local directory to the Web through the Apache web server. The problem is that the directory isn’t into the Apache document root and we do not want to move it there. :-/

To solve this we will map a URL starting with /desired_URL to files in the /path/to/directory/ directory.

Edit the /etc/apache/sites-enabled/site-configuration-file (this file should be a symbolic link to the corresponding file in /etc/apache/sites-available/).

Add an alias of the local directory to the desired URL, e.g. map the http://www.example.com/desired_URL to the /path/to/directory/ directory.

Alias "/desired_URL/" "/path/to/directory/"

Afterwards add the following instructions for the directory:

        <Directory "/path/to/directory/">
                Options +Indexes +FollowSymLinks
                Order allow,deny
                Allow from all
        </Directory>

This will enable access to the specified directory and its symbolic links, and produce an html page with the file list of the directory. Please ensure that all directories of the /path/to/directory/ has the required execute permissions.

Sources: http://cilab.math.upatras.gr/mikeagn/content/apache-web-server-mapping-url-local-directory

How to set viewport only for iphone or ipad?

One solution…

<!-- in head -->
<meta id="viewport" name='viewport'>
<script>
    (function(doc) {
        var viewport = document.getElementById('viewport');
        if ( navigator.userAgent.match(/iPhone/i) || navigator.userAgent.match(/iPod/i)) {
            doc.getElementById("viewport").setAttribute("content", "initial-scale=0.3");
        } else if ( navigator.userAgent.match(/iPad/i) ) {
            doc.getElementById("viewport").setAttribute("content", "initial-scale=0.7");
        }
    }(document));
</script>

Another way

I found a simple way with jQuery!

Add this to the head tag:

<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

<script>if ($(window).width() < 600) { $('meta[name=viewport]').attr('content','initial-scale=0.54, maximum-scale=0.54, user-scalable=no'); }</script>

Thetag sets the default scale and the tag re-writes the viewport if the device screen width is less than 600 pixels (I think all phone devices are under 600px).

Using Meta Tags for iPhone and iPad Orientation

The best way to detect the orientation of the device is by using meta tags. The viewport meta tag is used by Safari on the iPhone and iPad to determine how to display a web page. Properties of the viewport meta tag include width, height, initial-scale, user-scalable, minimum-scale and maximum-scale. Here is a table which shows the minimum and maximum values for those properties:

Property Default Value Minimum Value Maximum Value
width 980 200 10000
height based on aspect ratio 223 10000
inital-scale fit to screen minimum-scale maximum-scale
user-scalable yes no yes
minimum-scale 0.25 > 0 10
maximum-scale 1.6 >0 10

The initial-scale is the one that renders when the page initially loads. The scale is changed by pinching and double tapping on the device. Instead of using a fixed width, you should use the width=device-width which automatically makes the width equal to the width of the device’s screen:

<meta name="viewport" content="width=device-width/" >

To keep users from expanding the window size beyond the size it needs to display properly, you can set the maximum-scale to 1.0. I would use this technique carefully, as it takes away the user’s ability to enlarge the page for viewing on smaller screens such as that of the iPhone. That said, here is how it’s done:

<meta name="viewport" content="width=device-width, maximum-scale=1.0" />

Another way

Using JavaScript for iPhone and iPad Orientation

The meta tags shown above work very well, however, you can also use JavaScript to do the same thing, since both the iPad and iPhone support the scripting language. The following JavaScript function detects and sets the device's viewport orientation by using the innerWidth property of the window object and setting the orient attribute of the body element regularly (in this case every 4 seconds):
<script type="text/javascript">
var updateLayout = function() {
  if (window.innerWidth != currentWidth) {
    currentWidth = window.innerWidth;
    var orient = (currentWidth == 320) ? "profile" : "landscape";
    document.body.setAttribute("orient", orient);
    window.scrollTo(0, 1);
  }
};

iPhone.DomLoad(updateLayout);
setInterval(updateLayout, 400);
</script>
You can place the above snippet in the HEAD of your iPhone/iPad-ready web page, and it will set the display to the appropriate orientation setting.

Using CSS for iPhone and iPad Orientation

Another method that you can use to your advantage is using Cascading Style Sheets (CSS). Obviously, you will need a style sheet that is devoted to portrait use, and another for landscape use. We will cover the creation of such style sheets in a future article, but for now you need to know how you will use them. It's as simple as adding a link to your style sheets within your HEAD tag:
<link rel="stylesheet" media="all and (orientation:portrait)" href="portrait.css">
<link rel="stylesheet" media="all and (orientation:landscape)" href="landscape.css">

 

Cell Counting Techniques – Excel

Excel provides many ways to count cells in a range that meet various criteria:

  • The DCOUNT function. The data must be set up in a table, and a separate criterion range is required.
  • The COUNT function. Simply counts the number of cells in a range that contain a number.
  • The COUNTA function. Counts the number of non-empty cells in a range.
  • The COUNTBLANK function. Counts the number of empty cells in a range.
  • The COUNTIF function. Very flexible, but often not quite flexible enough.
  • An array formula. Useful when the other techniques won’t work.

Continue reading Cell Counting Techniques – Excel

Summing hh:mm Time Values in Excel

Question

We have a column of cells in an Excel spreadsheet containing times like, 3:15, relating to the time spent on a task. At the bottom of the column I’ve used AutoSum to add up the times, but the result appears as either a date or funny number. What do I do to get a total in hours and minutes?

Answer

The formula you created with AutoSum is fine.

All you need do is apply an appropriate format to its result:

  • Select the cell containing the total
  • From the Format menu, choose the Cells command
  • From the Category list, select Custom
  • In the Type box, input the formatĀ [h]:mm
    (note the use of square brackets).
    If you want to show seconds in your total, input
    [h]:mm:ss
    (this format is listed in Excel’s Custom formats)
  • Click OK.

What’s the best way to move c:\users to d:\users under vista/Window 7

The easiest and recommended way is to move the individual special folders inside a user directory, such as Documents, Music, Video’s, etc. You can do this with the following steps:

Right click –> properties

Location tab Fill in the desired location and

click ‘move’

Downside to this is that this still leaves the main ‘Users’ folder inplace.

 

ERROR: Either the server is overloaded or there was an error in a CGI script – Apache Server in XAMPP

Windows XP Pro SP 2
XAMPP

Error Message:

Server error!

The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.

If you think this is a server error, please contact the webmaster.
Error 500
localhost
02/27/08 13:04:31
Apache/2.2.6 (Win32) DAV/2 mod_ssl/2.2.6 OpenSSL/0.9.8e mod_autoindex_color PHP/5.2.4

SOLVE:

Mod_rewrite needs to be enabled on xampp for htaccess to work. Its an apache server by the way so htaccess does work.

Find the file called httpd.conf, it should be located in
XAMPPInstallDirectory\apache\conf\

Open with notepad and find this line
#LoadModule rewrite_module modules/mod_rewrite.so
Remove the #, save it, restart apache (if running).