Tuesday, May 21, 2013

10 reasons Windows 8 will be painful for developers


Takeaway: If you plan to develop Windows 8 native apps, be prepared for some hurdles. Justin James looks at some of the biggest problems you’re likely to face.
Ever since the release of the Windows 8 Developer Preview, people have had a lot to say about the experience of playing with the new OS. But few folks are talking about the changes it represents for developers. Windows 8 is the biggest update to the Windows development model since the move from Windows 3.X to Windows 95. While there are lots of good things, there are also a lot of pain points. If you are looking to develop Windows 8 native applications with the new UI and WinRT API, be careful of these 10 things.
Editor’s note: This is an update of the original post, which published in December.

1: Market reboot

If you want your applications to be fully compatible with Windows 8 (including running on ARM CPUs), you’ll need to do a full rewrite in Windows 8/WinRT. This may be great for developers looking to break into markets with established players. But if you are the established player, you are suddenly back at square one.

2: The asynchronous model

Windows 8 development is highly dependent upon asynchronous operations for anything that is long running. While that may be a cute trick in some scenarios, it is downright frustrating in others (like trying to download a file). It isn’t just the work needed to handle the async call; it’s things like error handling and reporting problems back to the user. It requires a whole new approach to the UI from what developers (especially WinForms developers) are used to.

3: Lack of direct disk access

Windows 8 cuts off direct access to the system in quite a few ways, but the one that will hurt typical developers the most is the lack of disk access. Windows 8 follows an extreme isolation model for applications, and if your application requires access to data outside its own confined little world (including networked services you can access), you can forget about porting it to Windows 8.

4: Touch UI paradigm

Unless you have been writing a lot of mobile apps, shifting to the new UI style, which is designed for touch interaction, is going to pretty tough. It took me a long time to get a feel for what works well and what doesn’t. To make things more difficult, what looks and works well on a screen using a mouse and keyboard can be a poor experience with touch, and things that work well with touch often are a struggle to use on the screen. It’s a tricky balancing act, and as the uproar over the new UI in Windows 8 shows, even Microsoft is struggling to get it right despite having had a few years of experience with it.

5: Playing by Microsoft’s app store rules

If you want to be using the Microsoft app store, you will need to learn to play by its rules. While the rules are fairly reasonable, it will be a jarring experience if it is anything like the WP7 App Hub. For starters, Microsoft rigorously inspects the application and looks for all sorts of things, like unhandled exceptions and circular UI paths. Although this ensures a high quality app, it can be a surprise to developers. In addition, you need to work with an approval process. The details of the Microsoft application store are still under wraps, but recent experience with WP7 suggests that it won’t be fun.

6: Heavy emphasis on cloud

While there is no mandate to use the cloud, Web services, and other off-premise techniques and technologies, it is most definitely encouraged. Things like automatic syncing of settings and data between devices (regardless of how it is done) will become the rule, not the exception, and users will be expecting it. Windows 8 makes this easy (you can have your locally saved information synced automatically with Live), but you will want to be judicious about how you do it for sensitive data. Encryption and other privacy and security techniques will become more important than ever.

7: Shift to “contracts” and “interfaces” for interop

One unique aspect of the Windows 8 paradigm is the idea that applications can provide services to the OS (such as acting as a source of contacts or pictures), as opposed to just dumping the data into a common directory. This allows all sorts of sweet application concepts. But even though this is easy at the technical level, it’s difficult to figure out how to leverage at the conceptual level.

8: Market uncertainty

Now we get into the more high-level pains. Microsoft is clearly pushing Windows 8 for tablets and maybe even phones. Right now, we’re seeing Android struggle in the tablet space, and at the same time, the new Windows 8 UI has been heavily panned by people who have tried the preview versions.  Will the market adopt Windows 8 or reject it?  Will the tablet market for Windows 8 take off? These are all questions that won’t be answered until it is far too late to be a first mover in the market. If you are going to bet on Windows 8, you simply can’t properly assess the risks right now.

9: Lack of tablet hardware

For developers, not having tablets to try Windows 8 on has been a major problem. Yes, we’ve seen some tablets on Web sites, but not in person. Some (like the Lenovo Twist and some of the Samsung slates) resemble current devices enough that you can use what amounts to their predecessors to test. Others (especially the ARM devices) are just too different from existing products to allow a comparison, so you have to wait until October 26 to get an idea of what they are like on real hardware.
There has been no good way to get an idea of what the user experience will be like for your applications on those tablets. Not just in terms of the UI either, but of performance. Can the tablet CPUs run your app well? Is it too “chatty” for a device on a cellular connection? Are you using more storage than makes sense for the typical tablet we’ll see? Without a few tablet models easily available, we don’t know the answers here.

10: The trail of dead tech

This is the one that really breaks my heart. Microsoft has a history of pushing a technology as “the next big thing” and then leaving it dying on the vine a few years later. We don’t know if Microsoft will back off its Windows 8 strategy before launch, right after launch (Kin), or a few years down the road (Zune, Silverlight). If the new Windows 8 paradigm is not a success, Microsoft may very well change course in a way that renders all your hard work on Windows 8 native applications a waste of time.

Monday, May 13, 2013

Set Apache Password Protected Directories With .htaccess File


Q. How do I protecting a directory in Apache on linux?
A. There are many ways you can password protect directories under Apache web server. This is important to keep your file privates from both unauthorized users and search engines (when you do not want to get your data indexed). Here you will see the basics of password protecting a directory on your server. You can use any one of the following method:
  1. Putting authentication directives in a <Directory> section, in your main server configuration httpd.conf file, is the preferred way to implement this kind of authentication.
  2. If you do not have access to Apache httpd.conf file (for example shared hosting) then with the help of file called .htaccess you can create password protect directories. .htaccess file provide a way to make configuration changes on a per-directory basis.
In order to create apache password protected directories you need:
  • Password file
  • And Directory name which you would like to password protect (/var/www/docs)

Step # 1: Make sure Apache is configured to use .htaccess file

You need to have AllowOverride AuthConfig directive in httpd.conf file in order for these directives to have any effect. Look for DocumentRoot Directory entry. In this example, our DocumentRoot directory is set to /var/www. Therefore, my entry in httpd.conf looks like as follows:
<Directory /var/www>
Options Indexes Includes FollowSymLinks MultiViews
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>
Save the file and restart Apache
If you are using Red Hat /Fedora Linux:
# service httpd restart
If you are using Ubuntu Linux:
# /etc/init.d/apache2 restart

Step # 2: Create a password file with htpasswd

htpasswd command is used to create and update the flat-files (text file) used to store usernames and password for basic authentication of Apache users. General syntax:
htpasswd -c password-file username
Where,
  • -c : Create the password-file. If password-file already exists, it is rewritten and truncated.
  • username : The username to create or update in password-file. If username does not exist in this file, an entry is added. If it does exist, the password is changed.
Create directory outside apache document root, so that only Apache can access password file. The password-file should be placed somewhere not accessible from the web. This is so that people cannot download the password file:
# mkdir -p /home/secure/
Add new user called vivek
# htpasswd -c /home/secure/apasswords vivek
Make sure /home/secure/apasswords file is readable by Apache web server. If Apache cannot read your password file, it will not authenticate you. You need to setup a correct permission using chown command. Usually apache use www-data user. Use the following command to find out Apache username. If you are using Debian/ubuntu Linux use pache2.conf, type the following command:
# grep -e '^User' /etc/apache2/apache2.conf
Output:
www-data
Now allow apache user www-data to read our password file:
# chown www-data:www-data /home/secure/apasswords
# chmod 0660 /home/secure/apasswords
If you are using RedHat and Fedora core, type the following commands :
# grep -e '^User' /etc/httpd/conf/httpd.conf
Output:
apache
Now allow apache user apache to read our password file:
# chown apache:apache /home/secure/apasswords
# chmod 0660 /home/secure/apasswords
Now our user vivek is added but you need to configure the Apache web server to request a password and tell the server which users are allowed access. Let us assume you have directory called /var/www/docs and you would like to protect it with a password.
Create a directory /var/www/docs if it does not exist:
# mkdir -p /var/www/docs
Create .htaccess file using text editor:
# cd /var/www/docs
# vi .htaccess
Add following text:
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/secure/apasswords
Require user vivek
Save file and exit to shell prompt.

We could use Require user valid-user

for any defined user

Step # 3: Test your configuration

Fire your browser type url http://yourdomain.com/docs/ or http://localhost/docs/ or http://ip-address/docs
When prompted for username and password please supply username vivek and password. You can add following lines to any file <Diretory> entry in httpd.conf file:
AuthType Basic
AuthName "Restricted Access"
AuthUserFile /home/secure/apasswords
Require user vivek
To change or setup new user use htpasswd command again.

Troubleshooting

If password is not accepted or if you want to troubleshoot authentication related problems, open and see apache access.log/error.log files:
Fedora Core/CentOS/RHEL Linux log file location:
# tail -f /var/log/httpd/access_log
# tail -f /var/log/httpd/error_log

Debian/Ubuntu Linux Apache 2 log file location:
# tailf -f /var/log/apache2/access.log
# tailf -f /var/log/apache2/error.log

See also:


Python

Python is an easy to learn and powerful programming language, with a comprehensive standard library that provides functions and interfaces for almost any task. It is object-oriented, extensible and interpreter-based, which means it scales well to all types of projects, from small scripts to extensive code bases. Its elegant syntax allows writing code that is extremely readable and concise.

QML for ubuntu mobile

QML at the heart of a set of technologies to bring the Ubuntu experience to mobile devices. QML is an a powerful JavaScript-based declarative language for designing intuitive, natural and responsive user interfaces. Marrying stunning design with a high-performing framework, the sky's the limit.

Howto get the Ubuntu SDK preview

With the latest ubuntu 13.04 : 

sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get install ubuntu-sdk

Sunday, May 12, 2013

How to clone a single branch in git?


git clone -b <branch> <remote_repo>

The Science in Computer Science


Communications of the ACM, Vol. 56, No. 5, May 2013
Peter J. Denning, editor-in-chief of Ubiquity, makes the case that computer science is indeed a “science” and that it is fundamentally distinct from any of the STEM fields. As Denning points out, how we define “computer science” matters for educators, researchers and practitioners. When it comes to education, for example, viewing computer science as a “science” will elevate it in any discussion of funding priorities for building a competitive IT workforce. When it comes to the workplace itself, it means that computer scientists will be seen as genuine collaborators with reliable predictive models and valuable analytic tools, rather than just as professional coders.
Denning points out that two external factors – the rise of computational science and the discovery of natural information processes - have spawned a science renaissance in computing. Experimental methods have regained their stature because they are the only way to understand very complex systems and to discover the limits of heuristic problem solution methods. New fields heavily based in experimental methods have opened up—network science, social network science, design science, data mining, and Bayesian inference. The widening claims that information processes occur in nature have refuted the notion that computer science is not "natural" and have complemented earlier arguments that computing is a science of the artificial. This brief history suggests that computing began as science, morphed into engineering for 30 years while it developed technology, and then entered a science renaissance about 20 years ago.
Although computing had subfields that demonstrated the ideals of science, computing as a whole has only recently begun to embrace those ideals. Some new subfields such as network science, network social science, design science, and Web science, are still struggling to establish their credibility as sciences. Denning discusses a list of criteria for “computer science” to meet the traditional ideal of a “science.” He then argues that the current educational system must shift so that it reflects the changing breadth and scope of computer science as a “science.” Students are losing interest in computing in high schools, half of which have no computer course at all, and many of the others relegated their one computer course to the basics, rather than teaching the principles of computing. The science renaissance in computing has led to an explosion of new content on the principles of computing that is beginning to reach into high schools, led by early work by the U.S. National Science Foundation and the Educational Testing Service.

Click Here to View Full Article