A post after more than a year of absence: Things that happened in the last 400 days

OK! I know these all will be considered as excuses but I’m going to tell you anyway 😉

Caution: There’s not going to be anything interesting in this post 😀 ; just the story of why I’ve been absent in the last year and my plan for the future.

Last year was full of adventures for me. Lots of things happened, mostly good but there were challenging moments as well.

Moving to a new house

Exactly one year ago (Sep 21st 2016), we moved to a new house. After passing some difficult situation we finally could afford a small house in Tehran. We are very happy about it because the house is our own; therefore, we don’t need to pay any rent for it. This was a huge step for us because rentals are very high in Tehran and we can save more money now 🙂

The process of moving to another house in Iran is completely different from most other parts of the world; because, we have to transfer nearly all objects to a new house. Most houses in Iran are unfurnished and people usually transfer everything to a new house. So as you can imagine the process will be much harder.

We are now 3!

Yes! This is the best thing ever happened in my life. Our baby girl “Nika” was born 40 days ago. As a developer, actually, I never thought I could handle a baby. I thought I could not stand a baby more than 15 minutes; but, for me Nika is different. I can sit and stare at her for hours without being noticed. She is the best gift god could ever give us.

I can be now considered as a completely Linux guy

I started using Linux 3 years ago. By installing an Ubuntu alongside my Windows OS and used it for some web developments at Pichak (One of the best IT companies in Iran). I then moved to Fedora and used it for nearly 2 years on all of my machines. I also published a few posts about it which can be found here. But I realized a few difficulties with Fedora and decided to move to Arch. Arch is much better choice for me because it is very lightweight and customizable. One of the best things about Arch is that it does nothing until you tell it to. (I will post more about Arch Linux in future)

I learned a few other programming languages

After to moving to Linux, I forced to stop developing C# and .NET apps so I had to choose another programming languages to get my stuff done. After lots of research, I decided to learn more about Python, PHP, Bash and C++. When it comes to RDBMS, I prefer PostgreSQL and MariaDb and Mongo for NoSQL stuff.

That was a brief of what happened in the last 400 days for me. I’m going to build a habit to blog more frequently. What I really want is to make this place my social network instead of distracting ones like Facebook, instagram, etc. So stay tuned 🙂

Before install a Chrome extension, check out its permissions

Chrome-Store1It’s about a week that I am working on developing a Chrome extension. Actually, this was my first experience developing an extension. During the process of R&D, I’ve checked out some of existing Chrome extension for learning purposes. While searching, I’ve found some extensions which had suspicious activities. Actually, some of them has access to users’ sensitive information such as files on their computer!

The fact is that, extensions are one of the most dangerous piece of software I’ve ever worked with because of the access level they can get. A Chrome extension can get access to almost anything on your computer. from file system, to your web history. Even most desktop apps don’t have access to such resources. Here are some of things an extension can do and you may want to consider:

  • It can have direct access to all of your Chrome stuff: including your tabs, websites you visit, your password and a lot more.
  • It can have access your file system. This means that an extension can access all of your personal files in your computer.
  • It can execute a file: The extension developer can also include an executable file inside a chrome extension and run it in background without notifying you about. This can be very dangerous. Assume that extension developer develops a keylogger using C++ and run it on your computer. As a result, it can gather all of your password and personal information and then send it to a server.
  • It also can access system memory and CPU as well. This is ridiculous because only some low-level apps and services can have access to such resources.
  • And a lot more…

The following is an example of a chrome extension that has access to your computer resources more than it really needs (I’ve omitted the extension name and logo):

chrome-extension-permissions

As you can see in the above picture, This extension want to have access to nearly everything on your computer:

  • It can access your USB devices!
  • It can communicate with native applications such as kernel processes.
  • It can access your entire Google Drive account including all of your personal documents, photos, and etc.
  • It has full access over your network connections.

Permissions in a Chrome extension can be gained in the manifest.json file. The extension developer can request any access he/she wants. Google reads this file when a user attempts to install the extension and shows the above dialog.

Conclusions

You MUST check out an extension’s permissions before attempting to install it. An extension can be very dangerous. make sure it only asks for permissions it needs. For example, a game don’t need access to the browser proxy. You should not allow such permissions.

Even extensions which are downloaded from Chrome Web Store are not safe since there’s no review process behind them.

Note that everything I’ve mentioned in this post works the same in Firefox; consequently, a Firefox extension can also have unlimited access over your computer.

Hope it helps.

EPUBs are much better than PDFs!

It’s a fact that we really can’t live and grow without reading books. I remember a poetry from my elementary school that was saying “Book is your best friend.” It’s not my best friend in fact:-D But one of my best friends. EPUB and PDF

Anyway, book is important and we can’t ignore it. As a result, companies are trying to make it better every day. With the advancement of technology, IT companies decided to invest on book industry; consequently, on 15 June 1993, Adobe released the very first version of Acrobat Reader with support PDF 1.0. The goal of Adobe was to enable users to read and share documents in a file rather than a heavy book. PDF format became very popular as it’s the most popular file format for electronic books and documents today.

Everything was OK and PDF was rocking until September 2007! International Digital Publishing Forum (IDPF) released a new format for electronic books called EPUB.
EPUB (short for electronic publication) is a free and open e-book standard. Files have the extension .epub. EPUB is designed for reflowable content, meaning that an EPUB reader can optimize text for a particular display device. EPUB also supports fixed-layout content. The format is intended as a single format that publishers and conversion houses can use in-house, as well as for distribution and sale. It supersedes the Open eBook standard. WOW THAT IS AWESOME!!!

Amazon KindleWith the introduction of iPad, a new way to read books has opened. People prefer to carry an iPad rather than lots of books; also, reading books on a tablet is more enjoyable than a book. IT companies like Apple, Amazon, Samsung, Nook and even Microsoft did as good as they could to find a way to make it even better and easier to read books.

Amazon was the first to use EBUP files in their devices. The first version of Amazon Kindle supports EPUB format. Apple also has support for EPUB as well. In fact, the default format for all iBooks Store books are EPUB; also, the Apple’s new textbooks are EPUB too. Everybody is talking about EPUB because of its awesomeness.

Here are some of advantages of EPUB over PDF:

  • EPUB files are much lighter in size than PDFs.
  • You can customize the font type and size of the book you’re reading.
  • Background and text colors also can be changed to whatever colors you want.
  • Searching through the EPUB books are much faster and easier while the EPUB files contains XML files.

Although EPUB books are amazing but can’t replace the PDFs yet. PDF format still have a lot of advantages over EPUB like encryption, support for filling a form and more. However, IDPF is working on next version of EPUB to have more features.

Introducing ElegantBlue theme for BlogEngine

It’s about six years I’m blogging my life and using BlogEngineto publish my posts; because I believe it’s the best blog engine ever. As a matter of fact, BlogEngine is doing everything I need as a blogger and sometimes more than that. I highly recommend using it if you’re blogger!

But this post is not about BlogEngine itself! In this post I’m going to introduce a new theme for BlogEngine which is so cool!

Note: If you don’t know BlogEngine yet, please check out its website at: http://dotnetblogengine.net.

It was about five months I was going to change my blog’s theme to a new one that includes latest web standards such as HTML5 and CSS3 but I didn’t have time for that. Yesterday, I decided to change my blog theme and it took about 12 hours to create a new one. In fact, I didn’t create the theme from scratch! ElegantBlue Theme

The ELEGANTBLUE Theme

ElegantBlue originally designed by freecsstemplates.organd I’ve changed it a lot to get it compatible with BlogEngine. Here’s the list of things I’ve changed:

HTML5 & CSS3

Everybody is talking about HTML5 and CSS3 these because it’s awesome! It’s about a year that I’m using these in my projects. HTML5 and CSS3 give me lots of capabilities I didn’t have before and help me create user-interfaces like never before. Also, they help search engines to index your website faster than before! For example, with the new <header> HTML5 tag, search engines can recognize where your website’s header is. The ElegantBlue theme for BlogEngine is a HTML5 and CSS3 theme so search engines can find your blog contents faster and the user interface is much cooler!

Razor View Engine

In BlogEngine 2.5, you can create themes and extensions using Razor view engine. Here’s a brief explanation about Razor:

The Razor syntax is a template markup syntax that enables the programmer to use an HTML construction workflow and is based on the C# programming language. Instead of using the ASP.NET / markup syntax using <%= %> blocks to indicate code blocks the Razor syntax starts of a code block with Razor using a @ character and does not require explicit closing of the code-block.

I totally used Razor view engine in ElegentBlue theme for BlogEngine.

Note: In order to implement Razor view engine, BlogEngine has RazorHost directory in the theme folder of the application. RazorHost folder is like a default template for Razor themes. If you’re going to use this theme in your website, you need to change the DOCTYPE to HTML5 in “site.master” file because it’s set to XHTML 1.0 by default. Besides, I include this change in the download file at the end of this post.

Download

You can download the theme right from here.

 ElegantBlue.zip (352.05 kb)

Update: I’ve uploaded this theme to .NET BlogEngine Gallery so you can download it right from here: http://www.dnbegallery.org/cms/List/Themes/ElegantBlue

 

Hope it helps.

How to add CSS3 integration to Visual Studio 2010

These days HTML5 and CSS3 are the most popular topic in web development communities because they make you more creative to develop cool websites or web applications.

Fortunately, Microsoft has added HTML5 intellisense to Visual Studio 2010 in SP1 release and it helped a lot in my project’s development. But one thing that makes me confuse is that CSS3 is still not supported in Visual Studio even in SP1! Microsoft Visual Web Developer Team did a post about HTML5 & CSS3 in Visual Studio 2010 SP1 and described about CSS3 improvements:

In SP1 there are a few improvements in the CSS3 support as well, though not as elaborate as with HTML5. The editor now supports the more advanced selectors such as div:nth-child(2n+1) without giving validation errors and the new color values rgba, hsl, hsla and 8 digit hex values are also supported.

In fact, this is not enough; because you still can’t access all of the features (Using Intellisense) of CSS3 in your applications. Because of that, I decided to post this in order to introduce a very cool Visual Studio Extension that helps you to have almost all of the features of CSS3 in Visual Studio Intellisense.

CSS 3 Intellisense Schema

This extension has been developed and released by one of my Iranian friends, Mojtaba Kaviani and it’s so cool!!!

You can download it now from here.

After you install this extension, you’ll have access to nearly all of the CSS3 features using Visual Studio 2010 intellisense:

CSS3 Intellisense in Visual Studio 2010

As you can see, you also have intellisense for Mozilla and WebKit exclusive attributes.

You can also download this extension right from Visual Studio Extension Manager:

CSS3 Tool In Extension Manager

In my opinion, life is much easier with this extension and I believe, this is one of the most useful extensions I’ve ever used. So download it now!!!

Hope it helps.

Iran has the slowest internet connection speed in the world!

Congratulations to all Iranians especially those who’re living in Iran! We’re now rated 168th of 168 countries that are using the internet in internet connection speed!

According to NETINDEX, Iran has the slowest internet connection speed in the world:Internet Connection speed in Iran.

Note: If you want to get the latest report, you can check it from here: http://www.netindex.com/download/allcountries/

What the hell is going on here?

I’m one of those who’re following some famous news websites in Iran to get the latest news about the country. According to them, Iran’s Communications Infrastructure Company’s manager promised Iranian people to upgrade the internet speed to 100X better than current speed in the future. Is it true?

Let’s imagine it’s true. In fact, the definition of internet that they (Government) are talking about is completely different from the definition that we’re talking about. Because this is a very important concept, let’s take a look at the definition of the internet from Wikipedia:

The Internet is a global system of interconnected computer networks that use the standard Internet Protocol Suite (TCP/IP) to serve billions of users worldwide. It is a network of networks that consists of millions of private, public, academic, business, and government networks, of local to global scope, that are linked by a broad array of electronic, wireless and optical networking technologies. The Internet carries a vast range of information resources and services, such as the inter-linked hypertext documents of the World Wide Web (WWW) and the infrastructure to support electronic mail.

I’m going to point the word “Global”. This word means that all people around the world are connected together. It means that people all around the world, can share data with each other.

Unfortunately, the definition of the internet is something different from their view:

The internet consists of some websites and web applications that are hosted in Iran. You will be monitored during your internet usage and most of external websites will be blocked.

Very disappointing 🙁

In my opinion, the government has to do something serious about this. People in Iran can’t even see a YouTube video! Most of interesting and popular websites are blocked! I really can’t understand what’s wrong with them 🙁

Last but not least, I’m going to name some of the websites that are blocked and I’m sure you’ll be shocked if you take a look at:

Facebook, Twitter, FriendFeed, Google Reader, Google Videos, YouTube, Flickr, Yahoo Answers, gizmodo, lifehacker, CNN, Apple’s AppStore, Netlog.

I’m sure the list above, is only 0.000001% of websites that are blocked in here.

I really hope that everything get back to normal and I’m looking forward to see that day.

Internet connection speed in Iran is everyone’s problem these days

I really can say this: “The World is required an internet connection to move on”. Nearly all people who work with computers/mobile-based devices are working online so the internet is something necessary.

Old 33.6 modemI can remember days that I was using Dial-Up connections in order to connect to the internet. The process for connecting to the internet was so boring and also the internet connection’s speed was so slow (about 33.600 kbps since I can remember). After sometime, Modern Dial-Up modems showed up with 56 kbps; and it was a huge move since the first generation of modems, in my opinion. 56kbps V92 US ROBOTIC ModemFor about 5 year or so, Iranian people had accessed the internet using 56 kbps modems and after that, the first company in Iran introduced ADSL service to the market. I think this was the most important event in internet service providing in Iran. They were providing 128kbps internet for the commercial use and 64kbps for home use. But the problem was their price that was so expensive. Only a few range of people in Iran could bought those services and most of the people trying to get used to traditional dial-up connections because they couldn’t afford ADSL.

Today's Adsl modemAs the world grows, the internet grows side-by-side and it’s a fact that these days every single person needs a high speed internet connection for doing everyday tasks.

In developed countries, most people can’t live without the internet because tasks are becoming online and people are preferred to stay behind their desks and get their jobs done.

The quality of connection is also matters. People want to access the internet easily. They want to access their websites as fast as possible and one of the most important factors is SPEED!

Unfortunately, the internet connection’s speed is awful in Iran and also the government has limited the internet connection’s speed for home use. Currently, they offer 128kbs connections for home and up to 2Mbps for commercial use. The price of 2Mbps connection is so expensive, by the way! As far as I know, it’s about 210 USD per month! I know that the limitations for internet connections have relationships with politics in Iran but this speed I talked about is nothing compared other countries.

People want to see more of the web and they need more speed of internet connection. I think government should do something for internet connection’s speeds and find a solution. In my opinion, the minimum speed for internet speed is 2Mbps for home use!

Some of the disadvantages of WCF Data Services

ODataSince I’m working with WCF Data Services as my project’s data source, I’ve experienced some cons in WCF data services and going to share with you now. I hope Microsoft find a solution for these:

  • Some of lambda expressions don’t work on WCF Data Services. I want to list a few of these. (In some cases, lambda expressions can be replaced with old style LINQ but I prefer to use lambda):
  • Sub-queries are not supported in WCF data services.
  • Debugging in WCF data services is such a pain in the neck.
  • Application security. Implementing role based security in WCF data services is very difficult as I’m currently planning to implement a role based security in my application.

Maybe there are solutions for any of the items above but I don’t know about them. If you really know, update this post by sending comments.

A brief overview of OData and WCF data services

People all around the world want to share data. They want to share their interests with others. Companies want to share data too. For example, EBay wants to distribute data of latest products and interests to the web and enable other companies to use that data in their own websites. There were ways to do that:

  • RSS/ATOM feeds.
  • XML Web services.

But each of the items above has their own problems and both of them have lots of limitations. In fact, there is no way to query the source’s database. In the EBay example, it’s impossible to select some data with specific parameters except the EBay has been developed some methods in order to that but it’s not enough in some cases, as you know.

But there’s a new way to distribute data and that’s OData!

OData is the short form of “Open Data Protocol” which is a new standard way for distributing data. The result of OData is standard XML so you can access to it using any programming language/tools. Here’s the OData definition from its official website:

The Open Data Protocol (OData) is a Web protocol for querying and updating data that provides a way to unlock your data and free it from silos that exist in applications today. OData does this by applying and building upon Web technologies such as HTTP, Atom Publishing Protocol (AtomPub) and JSON to provide access to information from a variety of applications, services, and stores. The protocol emerged from experiences implementing AtomPub clients and servers in a variety of products over the past several years.  OData is being used to expose and access information from a variety of sources including, but not limited to, relational databases, file systems, content management systems and traditional Web sites.

Companies have started to use OData too; for example you can access Netflix’s latest movies and use them in your application using OData! In order to do so, visit http://odata.netflix.com.

The table below shows the libraries which currently support OData:

OData Currently supported programming languages' library

 

You can download any library you want depend on what programming language you’re working with. As you can see in the table above, .NET Framework 3.5 SP1 and 4 is supported. In order to use OData in .NET 3.5 SP1, you have to download and install Data Service Support for .NET Framework 3.5 SP1 and then start working with but if you’re developing your application based on .NET Framework 4, you don’t need anything at all because Data Services is supported built-in.

In order to get more information about OData standards and documentations, you can checkout: http://odata.org.

WCF Data Services

WCF Data Services is the implementation of OData in .NET Framework. Hopefully, Microsoft has done a great job on this and it’s very easy to use. Data Services is not dedicated to databases; in fact it’s all about entities. You can build any entities and access it via Data Services. For example you can create an Entity Framework 4 entity and the access it via a Data Service. It’s the same story for LINQ to SQL, XML, etc.

As an example, I decided to create a Data Service for my EF 4 database model. Here are steps you can create a Data Service:

  1. As I mentioned, I preferred to use LINQ to Entity in my project so first you need to do is to create a database model by creating an ADO.NET Entity Data Model.
  2. After creating the database model, it’s time to create the data service. There’s nothing else to do! If you want to create a data service, you can add new WCF Data Service file to the project.
    Adding a WCF Data Service
  3. After a WCF Data Service file to your project, Visual Studio will create a .NET class which is inherited to DataService class. The DataService class in a generic class so you have to assign a data source to it. If you’re using EF, all you need is to type the name of your entity. For example “NorthwindEntities”.
    wcf-data-service-class-view
  4. Then you need to set permissions for the data service. The WCF data service that is created by Visual Studio contains a static InitializeService method that has an input parameter as a DataServiceConfiguration class which includes some methods in order to set permissions for the data service. The most important method for setting permissions is SetEntitySetAccessRule that you can set access rule for your entity. Here’s an example:
  5. As you can see, SetEntitySetAccessRule accepts two parameters. The first parameter is the name of the entity as string and the second parameter is the entity set rights. In the example above, the entity set rights is set to AllRead which means that users can only read from this entity. If you want to allow users to read and also write data using your service, you can set the entity rights to “All”.

Now your service is ready to use! It’s that easy! You can add your service to another application as same as adding a WCF service and use it. But the difference is that the service is using OData to publish the data. Also you can use LINQ expressions to access whatever you want!

Unfortunately, some of the lambda expressions are not supported by WCF Data Services. For instance, you can’t use Single method like this:

var x = myService.Table.Single(p=>p.Id == 1);

You have to use Single like this:

var x = (from i in myService.Table where i.Id == 1 select i).Single();

I hope Microsoft fix this problem as soon as possible.

I’ll post about WCF Data Service in my future posts but for now if you want to know more about it, you can check out WCF Data Service Client Library in MSDN

Welcome back!

Update: I just restored my previous posts from http://mmr.name. I hope I can continue to post in future.

Hi my name is Mohammad Mahdi Ramezanpour.

As you may know, my previous blog was at http://mmr.name and I had uploaded a lot of posts in it. but I think those posts weren’t so useful except a few of them; so I decided to establish a new blog a better domain name (ramezanpour.net).

Ramezanpour.net is much better than my previous website URL (mmr.name) because it shows my identification clearly.

I hope I can send more useful posts here and this will be my official website forever.

Stay tune for upcoming updates.