Search This Blog

Loading...

Monday, April 14, 2014

Developer options does not exist on Android 4.2+

While I am testing my android application, it is a good practice to test on real devices as much as I can.

I was testing my APK file on devices but it failed, while on emulators it runs successfully, so I need to enable debugging with logCat bundled with Android ADT (eclipse or new Android studio IDE).

So you need to connect your device to your computer via OEM USB driver, to deploy debugging APK package to your device to test from your IDE or command line.

But wait you will not be able to connect to your application and get it's runtime log, unless you enabled Developer options on your phone.

To enable it on most devices running Android 3.2 or older, you can find the option under Settings > Applications > Development.

On Android 4.0 and newer, it's in Settings > Developer options.

But note carefully: On Android 4.2 and newer, Developer options is hidden by default. To show it here is the magic, go to Settings > About phone and tap Build number seven times.

Return to the previous screen to find Developer options.


Happy debugging :)


Sunday, March 16, 2014

JavaSE: How to SET/GET your own Files and Directory Attributes

In the previous article "Determining Views Supported by a Particular File System" and see how to ask the file system store, and see supportability of a particular file attribute view.

We are going to explore in a nutshell, one of the most advanced and important files attribute views which is User-Defined File Attributes View.

Particularly, I am using this feature a lot in my exchanged files during integration between my systems, to hide my files meta-data and security related information from users and contents of the file. So the file content will be only regarding the content of the file only, no more irrelevant meta-data.

Therefore If you find that there are not enough built-in attributes for your needs or if you have some unique meta-data (meaningful to the file system) that you want to associate with a file, you can define your own attributes.

NIO.2 offers the user-defined file attributes view, extended attributes through the UserDefinedFileAttributeView interface. This facility allows you to associate to a file any attribute that you consider to be useful for your use cases.

Here you should know how to:

  1. Check User-Defined Attributes Supportability
  2. Operations on User-Defined Attributes as the following:
    1. Define a User Attribute.
    2. List User-Defined Attribute Names and Value Sizes.
    3. Get the Value of a User-Defined Attribute.
    4. Delete a File’s User-Defined Attribute.

Here is the class that has operations defined previously, also you need to use JDK 7+:


References


Thursday, March 13, 2014

JavaSE 7,8: Determining Views Supported by a Particular File System

If you have questions about a file or a directory, such as whether it is hidden, whether it is a directory, what its size is, and who owns it, you can get answers to those questions (and many others) from the metadata, which is data about other data.

NIO.2 associates the notion of metadata with attributes and provides access to them through the java.nio.file.attribute package. Since different file systems have different notions about which attributes should be tracked, NIO.2 groups the attributes into views, each of which maps to a particular file system implementation.

Generally, views provide the attributes in bulk through a common method, readAttributes(). In addition, you can extract and set a single attribute with the getAttribute() and setAttribute() methods, respectively, which are available in the java.nio.file.Files class. Depending On the view, other methods are available for additional tasks.

Here i will explain how with NIO.2 you can manage more details about files’ metadata than ever before. Attributes are divided into categories, and now they cover POSIX systems as well.

Before you attempt to access a view's attributes, make sure that your file system supports the corresponding view.

NIO.2 comes with a set of six views (Basic, Dos, POSIX, FileOwner, ACL and UserDefinedFileAttributeView).
  • POSIX (Portable Operating System Interface for UNIX).
  • All file systems support the basic view, so you should get at least the basic name in your output.

The supported views are:

  1. BasicFileAttributeView
    This is a view of basic attributes that must be supported by all file system implementations. The attribute view name is basic.
  2. DosFileAttributeView
    This view provides the standard four supported attributes on file systems that support the DOS attributes. The attribute view name is dos.
  3. PosixFileAttributeView
    This view extends the basic attribute view with attributes supported on file systems that support the POSIX (Portable Operating System Interface for Unix) family of standards, such as Unix. The attribute view name is posix.
  4. FileOwnerAttributeView
    This view is supported by any file system implementation that supports the concept of a file owner. The attribute view name is owner.
  5. AclFileAttributeView
    This view supports reading or updating a file’s ACL. The NFSv4 ACL model is supported. The attribute view name is acl.
  6. UserDefinedFileAttributeView
    This view enables support of metadata that is user defined.

Here are code snipets that shows different operations

  • Get all supported file system views

  • Check if the file store support a specific view
    You can test a particular view on a file store by calling the FileStore.supportsFileAttributeView() method. You can pass the desired view as a String or as a class name.

  • Check if a file store in which a particular file resides supports a single view
    Moreover, you can check if a file store in which a particular file resides supports a single view.


That all, have fun, if you like it share it.

Refrences:

Sunday, March 2, 2014

Creating right mobile icons sizes for Android, iOS and Windows applications.

I am developing a mobile application that will serve all Egyptians people for a critical national project.

It a service and management based mobile application which is related to Fuel locations finder and Customers fuel subsidy management card System.

It will be released soon by the middle of March in Google play for Android platform and by the end of March 2014 in Apple App Store for iOS application, followed by windows mobile platform in May 2014.

It is a hybrid mobile development rather than native development.

While designing the application I have faced many challenges performance, design, Architecture, cross-platform development, and Graphics especially the logo design. Designing icons especially for iOS platforms is a tricky a little bit.

There are different icons sizes related to resolution (normal and Retina’s displays), places, and naming conventions for applications targeting iOS 3, 4, 6, and 7.

However, it was easier developing the icons for Android platform, but anyway I will share icons sizes for both platforms. and Microsoft Windows mobile platform as well.

It is a good idea and practice to develop

the larger icon size first then export it to different sizes. I used Adobe Photoshop and Illustrator CC. Illustrator is a great tool for logos because it is vector based, so scaling the artwork are easier to scale without losing the artwork resolution.

Android platform

The following table show different icons for different displays resolutions in pixel:


Display


Launcher Icons


Action Bar Icons


Google Play


512x512


---


Double Extra High dpi (xhdpi)


---


96x96


Extra High dpi (xhdpi)


96x96


64x64


High dpi (hdpi)


72x72


48x48


Medium dpi (mdpi)


48x48


36x36


Low dpi (ldpi)


36x36


---

iOS platform

The following table shows different icons for different iDevices displays resolutions in pixel, note that iOS 7 iPhone and iPod has Retina's display support only, as all iOS 7 supported iDevices are iPhone from 4 to 5s, and 5th generation iPod touch.


OS/ Device/ Place


Standard Resolution


High Resolution (Retina Display)


iPhone and iPod Touch


iPad


iPhone and iPod Touch


iPad


iOS 6 platform


Home Screen Icon


57x57


72x72


114x114


144x144


Settings Icon


29x29


29x29


58x58


58x58


Spotlight Icon


29x29


100x100


58x58


50x50


App icon for the App Stores


1024x1024


512x512


1024x1024


1024x1024


iOS 7 platform


Home Screen Icon


---


76x76


120x120


152x152


Settings Icon


---


29x29


58x58


58x58


Spotlight Icon


---


80x80


80x80


40x40


App icon for the App Stores


---


512x512


1024x1024


1024x1024

Windows Phone

The following table shows different resolutions in pixel for Microsoft windows platform application and marketplace icons:


Application Place


Icon Size


Application


Icon


62x62


Tile Image


173x173


Marketplace


Application icon for Windows Phone Marketplace catalog (small)


99x99


Application icon for Windows Phone Marketplace catalog (large)


173x173


Desktop application icon for Windows Phone Marketplace catalog


200x200



Monday, January 13, 2014

Microsoft: Adding IntelliSense for jQuery in WebMatrix and Microsoft development tools.

I had the opportunity to work with HTML5 APIs and jQuery development inside Microsoft WebMatrix, it is a light IDE and installed with libraries and extensions that made development richer.

In order for WebMatrix to really be a useful as an editor for jQuery, I really wanted to have IntelliSense support for jQuery. However, the annoying issue is that WebMatrix does not have a built-in IntelliSense support for jQuery in and other JavaScript tools.

As jQuery is one of our focuses here in this post, adding IntelliSense for jQuery is extremely easy, therefor I am going to explain how to add the IntelliSense support for jQuery into WebMatrix or other Microsoft development tools in an easy step.

The idea
---------------
Microsoft's developer tools like WebMatrix, Visual studio 2008 SP1 and upper versions, allow you to add IntelliSense for any JavaScript library by adding a Reference Directives (.vsdoc JavaScript file) to your page.

The files that you would use for your reference directives are available at the same Microsoft CDN where you can get the jQuery library from at:
http://www.asp.net/ajaxlibrary/cdn.ashx

How to do it
-------------------
In order to use IntelliSense for jQuery, you need to download the appropriate jquery-n.n.n-vsdoc.js file for the version of jQuery that you are using and store that in your page.
  1. Your project structure should be as the following


  2. Add the reference directive (jquery-2.0.3-vsdoc.js) into your html page as the following


  3. You also can add it to you JavaScript library file, to get the power of IntelliSense for jQuery as the following


Result
-------------
Now you have added the library reference directives for jQuery version, into your IDE inside your page write jquery call by just jQuery or $ you will get:


Hit the .(dot) and you will also get


Conclusion
-----------------

Also as you notice in the previous pictures, the reference not just get the IntelliSense but more than this, it gives you the power of getting the methods documentation and parameters explanations on the fly, or by hover over the method after writing it.

Thanks to Microsoft reference directives.

References
----------------
1- Microsoft Ajax Content Delivery Network.