Feb 26

Hello Folks,
As I was playing around with MVC4 Beta and watching some of the hype and the presentations about it – I wanted to share with you some of the features that I’m mostly excited about.  These I think would directly come into play. I’ll share my opinion about them and give you few tips on how to use them y0′
Btw if you still haven’t tried it – you can do so at:  http://www.asp.net/mvc/mvc4

Here is the list:

  • New WebAPI using REST
  • View Switcher Component
  • Mobile specific views
  • Inbuilt bundlers and minifiers for JavaScript and CSS
  • Inbuilt Ajax Scaffolding plus cool looking default template
  • Recipes

So here we go… :)

Recipes

recipe

Basically the recipes would give us the option to automate processes inside of our application. To create a recipe you would need to create a class library and implement IRecipe Interface.

There is also a package that would make it easier for you to create recipes made by Phil Haack – AspNetMvc4.RecipeSdk. You can install it using Nuget – press Tools->Library Package Manager->Package Manager Console and then type: “Install-Package AspNetMvc4.RecipeSdk”.

I recommend you reading the whole blog post on how to create recipes  at  Haack’s blog:

http://haacked.com/archive/2011/09/21/writing-a-recipe-for-asp-net-mvc-4-developer-preview.aspx


View Switcher Component

This is very neat feature that would basically allow us to use jQuery Mobile for rendering our website! In order to use this we would need to install the following package using the package manager:

In the package manager please type:  Install-Package jQuery.Mobile.MVC
This will add automatically the jQuery.Mobile.MVC and few other references to your project. Also in the default View’s shared folder it will add 2 additional files:

Here is how _ViewSwitcher should look like:

It basically detects if a mobile version of the view should be passed to the client or not! If you directly let jQuery to do everything for you – your page could be translated into something completely different, like this:

Note that the styles of your website would be completely overwritten by jQuery mobile, and would be defaulted to cleared black/gray functional UI.
This – could look ok for you. At least it looks functional and easy to click etc.  - however if you want to preserve the original feel – colors and styling of your website – you should definetely make your own Mobile specific views.

Mobile specific views
This feature is the one that comes most straight forward – and basically is the easiest to use.
Simply rename your existing or create a new view with the follwing convention:

Basically you need to rename the view inside of your view folder from “ViewName.cshtml” to “ViewName.mobile.cshtml”. In ViewName.mobile.cshtml you should optimize the page for mobile device, you could change a couple of css selectors, use partials etc.
Now when the request for this view resource comes from a mobile device – the ASP .NET will automatically pass your mobile version of the view overriding the jQuery mobile’s default styling.
That’s it – no strings attached. You could simply decide to do this for several or all of your views – depending on what you want to achieve. Or if you are too lazy you could leave all the view styling up to jQuery mobile – it’s all up to you :)

Inbuilt bundlers and minifiers for JavaScript and CSS

So this is one of the features that it would be so easy to benefit from. By minifying your js and css files you gain could performance of your website, because any white-space and newline is removed.
Also it makes it extremely easy to include additional js files and css files into your project. By now you had to add a “<link href=… or <script src=… for each file. Now you can do this:

<script src=”~/Scripts/js”></scripts>
<link href=”~/Content/css” rel=”stylesheet” />

Voilla – all the css files inside of Content/css and all files inside of /Scripts/js are added to your website.

You can also use:  @System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl

 <script src=@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl(”~/Scripts/js”)></scripts>
 <link href=@System.Web.Optimization.BundleTable.Bundles.ResolveBundleUrl(”~/Content/css”) rel=”stylesheet” />

The second option using Bundlers  will create a hash code in similar format:

<script src=”~/Scripts/js?fsdofso18eh1he9whd91”></scripts>

The generated hash will be different every time you change a js file inside of the Scripts/js folder. This way you will be always sure that the client always gets the lastes version of your css / js files. New hash-code  is generated only when you change / add something – this means that you havent changed anything in your js/css files and they will cached. Pretty cool huh :)
According to Scott Gu – there will be a helper with shorter syntax in the final version of .NET 4.5 (no kiddin :) ) Also the bundlers would be able to convert higher level languages like CoffeeScript directly into JavaScript!

The only bad thing is that you won’t be able to use this features with VS2010 and .NET 4.0 you will need to wait for VS2012 – or download the beta of VS2011 from here:
VS2011 Beta Offline Download

I’ll try to finish this post – adding info about the Inbuilt Ajax Scaffolding  and the updated default template in the next few days!

Peace

Apr 29

The MySql database backup website backup is very similar to the previous backup that I showed you 2 days ago. We are going to create a php file that is going to dump our database into filename with the current date and time.

Ok so let’s get going:
1. Create the file “backup_database.php” and input the following code into it:
<?php exec(‘cd /home/your_user/backup/db/;mysqldump –add-drop-table -h localhost –user=your_user –password=your_pass database_name > `date +%y-%m-%d_%H-%M`.sql’); ?>

Sometimes the path to your home dir looks different than ‘/home/your_user/’, so execute the ‘pwd’ command like explained in my previous post

Here we use the command mysqldump in a tutorial that I wrote previously about the dumping the sql database from one host to another. Now the database will be saved directly on the server that is hosting your website

Apr 26

Hello guys and ladies,
Long time no see :) . Today I’m going to show you how to make a php script to perform full website backup the script can be executed via http request or via ssh shell or like a cron job .
We all know about the most standard way to add backup for your website maintenance for example using the Cron Jobs in the CPanel. If you already don’t know this – if your hosting provider does support CPanel you should be able to access it via this URL: www.yourwebsite.com/cpanel
Cron Job CPanel

May 10

Today i found this very cool tutorial regarding the using of using ssl with PHP.

I’ll copy here the most interesting of it.

HTTP with PHP Sockets

// don’t need to specify http, it’s the default protocol
$hostname = “www.google.com”;
$port = 80;

// create and configure the client socket
$fp = fsockopen($hostname, $port); // optional: $error_number, $error_string, $connect_timeout
if ($fp) {
stream_set_timeout($fp, 30); // seconds to wait for i/o operations

// send request headers
fwrite($fp, “GET / HTTP/1.1\r\n”);
fwrite($fp, “Host: $hostname\r\n”);
fwrite($fp, $additional_headers); // Accept, User-Agent, Referer, etc.
fwrite($fp, “Connection: close\r\n”);

// read response
$response = “”;
while (!feof($fp)) {
$response .= fgets($fp, 128);
}
echo $response;

// close the socket
fclose($fp);
}

Apr 08

Hello fellas,  because these days i had a case where i had to include some RSS feed on my site and i needed a very simple and fast solution in php how to do it i was very dissapointed from what i’ve found on the web. There are all kind of widgets, tools PHP scripts using the xml-reader class, whatever – but i just needed some very simple solution. So ofcourse i had to write it myself at the end :)

in this example i’m going to import feed from yahoo’s technology news rss:

Mar 30

I’m going to talk about some good object oriented practices for small/medium projects. The object oriented programming itself will save you enourmous amount of time. The inheritance is part of the Object Oriented Programming (OOP) and is very good thing that is going to save you even more time when you start to use some object oriented model in your programming.

Let’s say we need to have some root class – lets say “Base”, with the __construct() (the class’s constructor) – notice that since PHP 5.0 the constructor of a class is defined in __constructs(), instead of “the-name-of-your-class”(). Anyway you can define the constructor information in Base() as well, but better do it in __construct, because you don’t know if there will be support for the old PHP 4 constructors in PHP 6 :)

so let’s get on business..

Mar 20

I don’t know if this will be interesting for you, but it was very interesting for me when i found that it is very easy to modify header information and send POST/GET variables through header using php. Anyway with CURL you are able to do much more that just modify the header information etc., but we wont have that time-frame :)

I will give you simple example where i login through script on localhost on some site – in this example: “gametrailers.com” – without actually enter any username and password :) , i think this will be the easiest way to understand it.

so here is the example:

Mar 19

Hello :) today i’m going to talk about resizing your the images in your site.
So let’s say for example that you have a CMS system – like Joomla for example. In the administration you usually have functionality like – uploading images and linking them in your content.
But often the problem with that is that usually the customers will upload too large images (copied in raw jpeg directly from their cameras) and when they link them to the content of their website, it get’s really messy.
Anyway you can fix this by writing some script that directly resize the image to some resolution like 500px/* for example, but what will happen if you want to put lightbox or something other to show the image in large resolution, or you just want to put some function to download the original file etc. You simply can’t because the image was resized at the moment it was uploaded on the server.

How about dinamically resize the image at the very  moment that client requests it?

So that way we wont have a big image that the client has to download, and at the same time we will still have the original, good resolution copy of the image, in case that we need it. We can also use the following PHP script for creating thumbnails.

Well – as you will see below it’s not hard at all to do it,  i mean not hard at all :)

Mar 09

Hello everybody,

today i’ll be talking about how to export / import your Excel file into you your database using the PHP and the CSV file format.
First of all we need an Excel file with our data.

Every row of the excel file should be the same format as the previous row (so that we can make our life easier), for example if we want to import a excel file with name/url addres corresponding to this name we should have our excel file in a format like this:
exel file example
After u have the file in this excel format u should hit -> File -> Save as -> CSV (Comma Delimited) or more ofter its Called “Comma Separated Values”. For the comma separator use “;” if it asks you. So after you save the file in the CSV file format you should have something like this after you open the file with notepad etc.:

Mar 08

for everybody who is just starting to learn about the SSL оpportunities that you have with Open SSL (tool) and the mod_ssl for Apache for securing your site. The simplest and fastest thing that you can do is to create a self-signed certificate, after you generate a free RSA key :) . Don’t worry it’s not so sophisticated as it sounds :) actually it’s pretty easy. You can read more on the link below
ssl graph

Securing an Apache 2 Web server can be an intimidating prospect for those new to secure sockets layer (SSL) certificates. However, this need not be the case. SSL secures Web server to Web browser connections. Read on to better understand SSL certificates, learn how to set them up on Apache and launch your SSL-enabled site.

Nov 22

#

http://www.smashingmagazine.com/2007/01/26/tutorials-round-up-ajax-css-javascript-php-mysql-and-more/
AJAX provides Web developers with plenty of opportunities to enhance the user experience and improve the performance of their websites. There are countless ways that AJAX can be used, and fortunately there are plenty of good and useful AJAX tutorials out there to help you with your own implementation.

This post serves as a collection of useful tutorials on working with AJAX in a wide variety of ways. You’ll find tutorials on working with forms, building shopping carts, creating chat features, working with log-ins and usernames and much more.

  • Buy Cheap cialis vs viagra vs levitra Online Pharmacy Store. Guaranteed Shipping.
  • Buy cialis discoun Without Prescription Doctor. Pharmacy Store. Low Prices.
  • Buy Cheap cialis rx online Online Best Online. Drugs, Health And Beauty.
  • Buy Cheapest long term effects of viagra Online Low Prices. Order Cheap Meds Without Rx.
  • Buy Cheap is viagra good Online Pharmacy Store. Discount Pharmacy Online.
  • Buy Cheap levitra vardenafil hcll Now Special Prices For levitra vardenafil hcll! WorldWide Shipping.
  • Buy Cheapest buy viagra online in uk Now Best Internet. 24/Online Pharmacy.
  • Buy Cheap impotence levitra Now Cheap Prescription Drugs. Free Viagra Pills!
  • Buy Cheap buy viagra cialis levitra online prescription Now Cheap Prescription Drugs. Pharmacy Store.
  • Buy Cheap intensify effects of levitra Now Low Prices. All Medications Are Certificated!
  • Buy Cheap cialis wholesale online Online No Prescription Needed. Free Viagra Pills!
  • cialis softtab Online Without Prescription Low Prices. Free Viagra Pills!
  • Buy Cheapest cheap viagra soft tablet Online Guaranteed Shipping. Free Viagra Pills!
  • Buy Cheapest long term cialis use Now Discount Online Pharmacy. Best Online.
  • Buy Cheapest where buy cialis Online Free Viagra Pills! Top Online Pharmacy.
  • Buy Cheapest levitra prescriptions Now Pharmacy Store. Cheap Online Pharmacy.
  • Buy Cheap cialis online purchase Online Top Online Pharmacy. Cheap Pharmacy Online.
  • Buy Cheap cialis usa pharmacy Now Best Prices. Cheap Meds Without Prescription.
  • Buy Cheapest drug impotence levitra Now The Largest Internet Pharmacy. Best Prices.
  • Buy Cheap mg levitra Online Best Drugstore. Top Online Pharmacy.
  • Buy Cheap cheap viagra Now Discount Pharmacy Online. Top Online Pharmacy.
  • Buy Cheapest buy cialis from canada Online Low Prices. 24/Online Pharmacy.
  • Buy Cheapest cialis online sale Now Best Online. 24/Internet)(safe Pharmacy.
  • Buy Cheap cialis levitra vs Online Best Internet. Cheap Prescription Drugs.
  • Buy Cheap viagra pay with paypal Now Best Drugstore. 100% Satisfaction Guaranteed.
  • Buy Cheapest cheapest cialis erectile dysfunction pill Now Best Prices. Special Prices For cheapest cialis erectile dysfunction pill!
  • Buy Cheapest indian viagra Online Best Drugstore. Buy Medications Online.
  • teens taking viagra Online Without Prescription Best Internet. Best Prices.
  • Buy Cheap levitra tablet Online Best Online. Drugs, Health And Beauty.
  • Buy Cheap cheap herbal viagra Now No Prescription Needed For Drugs. Low Prices.
  • Buy Cheapest buy online viagra viagra Now Pharmacy Store. 24/Online Pharmacy.
  • Buy Cheap buy viagra now online Online Pharmacy Store. Online Medical Shop.
  • Buy Cheapest find cialis cheap Now 24/Online Pharmacy. Top Online Pharmacy.
  • Buy Cheapest viagra online in canada Now WorldWide Shipping. 24/Online Pharmacy.
  • Buy Cheap online viagra store Online Special Prices For online viagra store! Best Internet.
  • Buy Cheapest buy levitra us Now Safe And Secure Payment System. Low Prices.
  • Buy Cheap viagra discounts Online Internet Prices For viagra discounts! Best Internet.
  • Buy Cheapest genric viagra Online Online Medical Shop. Best Online.
  • Buy Cheap cialis impotence drug eli Online Cheap Pharmacy Online. Best Drugstore.
  • Buy Cheap buy pfizer viagra Online Best Online. Discount Pharmacy Online.
  • Buy Cheap buy brand name cialis Online Buy Medications Online. Pharmacy Store.
  • Buy Cheapest buy levitra vardenafil Online Drugs, Health And Beauty. Best Online.
  • Buy Cheap use levitra Now Best Online. Cheap Meds Without Prescription.
  • Buy Cheapest american cialis Now Online Prices For american cialis! Best Drugstore.
  • Buy Cheapest cheapest generic cialis Now Pharmacy At The Best Price! Low Prices.
  • Buy Cheap viagra cialis cheap Now No Prescription Online Pharmacy. Low Prices.
  • Buy Cheap order cialis without prescription Now Cheap Meds Without Prescription. Best Prices.
  • Buy Cheapest name cialis Now Pharmacy At The Best Price! Best Prices.
  • Buy Cheapest free viagra samples Online Special Prices For free viagra samples! Best Prices.
  • Buy Cheap no prescription viagra Now Discount Pharmacy Online. Top Online Pharmacy.
  • Buy Cheapest buy generic viagra cheap Now Best Drugstore. Drugs, Health And Beauty.
  • Buy Cheap cialis paypal Now Cheap Pharmacy Online. Cheap Online Pharmacy.
  • Buy Cheap viagra purchase on line Now No Prescription Needed. Best Drugstore.
  • Buy Cheap cialis ejaculation Online Best Prices. Buy Medications Online.
  • Buy Cheap viagra free samples Now 24/Online Pharmacy. WorldWide Shipping.
  • Buy Cheap levitra table Now Top Online Pharmacy Supplier. Best Prices.
  • Buy Cheap generic cialis tadalafil Online Discount Pharmacy Online. Best Prices.
  • Buy Cheap ordering cialis online Online Top Online Pharmacy. WorldWide Shipping.
  • Buy Cheapest levitra one a day Online Guaranteed Shipping. WorldWide Shipping.
  • Buy Cheap generic levitra cheap Online WorldWide Shipping. Guaranteed Shipping.
  • Buy Cheapest levitra cilias effects Online Pharmacy Store. No Prescription Needed.
  • Buy Cheap viagra cialis canadian pharmacy Online Best Prices. 100% Satisfaction Guaranteed.
  • Buy Cheapest buy sublingual viagra on the internet Online Special Prices For buy sublingual viagra on the internet! Low Prices.
  • Buy Cheapest viagra levitra cialis stuffy nose Online WorldWide Shipping. Pharmacy Store.
  • Buy Cheap substitute for viagra Now Best Internet. Cheap Prescription Drugs.
  • Buy Cheap information on levitra Now Free Viagra Pills! Drugs, Health And Beauty.
  • Buy Cheapest cheap order prescription viagra Online Best Internet. No Prescription Needed.
  • Buy Cheap cialis pro Online Best Drugstore. Drugs, Health And Beauty.
  • Buy Cheapest cialis online generic Online Best Drugstore. Top Online Pharmacy.
  • cheap cialis sale online Online Without Prescription Best Internet. Best Prices.
  • Buy Cheapest info levitra Now Cheap Pharmacy Online. Best Drugstore.
  • Buy Cheapest cheap no prescription viagra Now Internet Prices For cheap no prescription viagra! Best Online.
  • Buy Cheapest india cialis Online Guaranteed Shipping. Best Drugstore.
  • Buy Cheapest pfizer viagra discount Online Cheap Prescription Drugs. Best Online.
  • Buy Cheapest generic levitra effective Online Low Prices. Discount Online Pharmacy.
  • Buy Cheapest levitra one a day Online Guaranteed Shipping. Free Viagra Pills!
  • Buy Cheap cialis dosage Now 100% Satisfaction Guaranteed. Best Internet.
  • Buy Cheap levitra drug interactions Online Guaranteed Shipping. WorldWide Shipping.
  • levitra sperm pills Online Without Prescription Best Prices. Best Online.
  • Buy Cheap viagra alternative Online The Largest Internet Pharmacy. Best Prices.
  • Buy Cheap viagra oral sex Now Online Prices For viagra oral sex! WorldWide Shipping.
  • Buy Cheap cialis multiple orgasms Now FDA Approved Rx: Online Pharmacy. Best Online.
  • Buy Cheapest cheap cialis Now Drugs, Health And Beauty. Best Internet.
  • Buy Cheap woman take viagra Now Low Prices. The Largest Internet Pharmacy.
  • Buy viagra discount sales Online Without Prescription. Best Drugstore. Low Prices.
  • what to know about viagra jelly Online Without Prescription Low Prices. Guaranteed Shipping.
  • Buy Cheap levitra erectile dysfunction Now Best Prices. Pharmacy At The Best Price!
  • Buy Cheap cialis pricing Now WorldWide Shipping. Online Prices For cialis pricing!
  • Buy Cheap cheap viagra Now Best Online. Top Online Pharmacy Supplier.
  • Buying Cheap free samples viagra. Mexican Rx, Good Prices. 24/Online Pharmacy.
  • Buy cialis soft tabs cheap Online Without Prescription. Best Prices. Best Online.
  • Buy Cheap cialis cheap overseas Now Best Internet. Discount Pharmacy Online.
  • Buy Cheapest cialis prescription Now Buy Medications Online. Best Prices.
  • Buy Cheap viagra sublingual Online Drugs, Health And Beauty. Best Prices.
  • Buying Cheap levitra commercial. Mexican Pharmacy, Good Prices. Best Drugstore.
  • Buy Cheapest levitra drug interactions Now Cheap Online Pharmacy. Best Internet.
  • Buy Cheapest levitra uk Now Online Prices For levitra uk! Pharmacy Store.
  • Buy Cheapest viagra blue Now Safe And Secure Payment System. Low Prices.
  • Buy Cheapest viagra drug interaction Now Order Cheap Meds Without Rx. Best Prices.
  • Buy Cheap viagra soft tabs instructions Now WorldWide Shipping. Online Medical Shop.