Showing posts with label Web-programming. Show all posts
Showing posts with label Web-programming. Show all posts

Sunday, June 26, 2011

Calling Cross Domain WCF service using Jquery/Javascript

This post is about to call the cross domain WCF service from you page i.e Calling WCF service hosted on one domain and calling the service form jquery/javascript of page which is hosted on some other domain.

But before we start its better to get understand about the format of the data get exchange from one server to other server.


JSONP
Ajax allows to get data in the background without interfering with the display. Ajax call done by using XMLHttpRequest object, which is allow the client side javascript code to make HTTP connections.
But Ajax call does not allow to get data from cross-domain because of restrictions imposed by the browser. Security error get issued when requesting data from a other domain. one way to avoid security errors is to control remote server where data resides and every request goes to the same domain, that rise question what's the fun if data come form own server only? What to do if data require to get form the other server?

There is one way to come out form this limitation is to insert a dynamic script element in the Web page, one whose source is pointing to the service URL in the other domain and gets the data in the script itself. When the script loads, it executes. It works because the same-origin policy doesn't prevent dynamic script insertions and treats the scripts as if they were loaded from the domain that provided the Web page. But if this script tries to load a document from yet another domain, it will fail. Fortunately, you can improve this technique by adding JavaScript Object Notation (JSON) to the mix.

JSONP or "JSON with padding" is a complement to the base JSON data format, a pattern of usage that allows a page to request data from a server in a different domain. As a solution to this problem, JSONP is an alternative to a more recent method called Cross-Origin Resource Sharing.

Under the same origin policy, a web page served from server1.example.com cannot normally connect to or communicate with a server other than server1.example.com. An exception is the HTML <script> element. Taking advantage of the open policy for <script> elements, some pages use them to retrieve Javascript code that operates on dynamically-generated JSON-formatted data from other origins. This usage pattern is known as JSONP. Requests for JSONP retrieve not JSON, but arbitrary JavaScript code. They are evaluated by the JavaScript interpreter, not parsed by a JSON parser.


Calling Cross Domain WCF service
Now in following discuss I am going to show you how easily you can call the WCF service hosted on the other domain from the page hosted on the other domain.
Following is list of article you should look first before moving further
Create, Host(Self Hosting, IIS hosting) and Consume WCF servcie
Steps to Call WCF Service using jQuery

Read more: gMind solutions

Wednesday, June 22, 2011

500 jQuery tutorials

Web site with 500 jQuery tutorials

SelectSwitcher jQuery Plugin
jquery-select-switcher.jpg
A plugin to switch content visibility based on the selected option of a select. Use the full power of jQuery to define your affected elements.

gSlider Lightweight jQuery Image Slider
jquery-image-slider-2.jpg
gSlider is an interactive image slider built on jQuery. It is versatile, lightweight and easy to implement in any website or web applications.
Read more: jQueryRain

Monday, June 20, 2011

Developing a Simple HTTP Server in C#

This short video clip shows how to use the HttpListener class in order to develop a simple HTTP server in C#. This video clip was developed as part of the 'C# Fundamentals' course available for free personal usage at www.abelski.com.

Read more: Life Michael

Sunday, June 19, 2011

Howto Send and Read SMSs using a GSM modem, AT+ commands and PHP

I need to send/read SMS with PHP. To do that, I need a GSM modem. There are few of them if we google a little bit. GSM modems are similar than normal modems. They’ve got a SIM card and we can do the same things we can do with a mobile phone, but using AT and AT+ commands programmatically. That’s means we can send (and read) SMSs and create scripts to perform those operations. Normally those kind of devices uses a serial interface. So we need to connect our PC/server with a serial cable to the device. That’s a problem.
Modern PCs sometimes dont’t have serial ports. Modern GSM modems have a USB port, and even we can use serial/USB converters. I don’t like to connect directly those devices to the PC/server. They must be close. Serial/USB cables cannot be very long (2 or 3 meters). I prefer to connect those devices using serial/ethernet converters. Because of that I will create a dual library. The idea is enable the operations when device is connected via serial cable and also when it’s connected thought a serial/ethernet converter.

The idea is the following one: We are going to create a main class called Sms. It takes in the constructor (via dependency injection) the HTTP wrapper or the serial one (both with the same interface). That means our Sms class will work exactly in the same way with one interface or another.

Let’s start. First we’re going to create a Dummy Mock object, sharing the same interface than the others. The purpose of that is to test the main class (Sms.php)


class Sms_Dummy implements Sms_Interface
{
    public function deviceOpen()
    {
    }
    public function deviceClose()
    {
    }
    public function sendMessage($msg)
    {
    }
    public function readPort()
    {
        return array("OK", array());
    }
    private $_validOutputs = array();
    public function setValidOutputs($validOutputs)
    {
        $this->_validOutputs = $validOutputs;
    }
}

Read more: PHP on Windows

Web Site Attack Vulnerabilities

Mr. Jordan Ehrlich wrote a excellent presentation that provider a good overview on Web Site Attack Vulnerabilities.
The presentation can be download from the following link.

Read more: Yuval14
Read more: Google Docs

Android App Engine Integration

Google App Engine is great for those of you in search of a complete, scalable and affordable hosting solution. Especially if you start a project and you don't yet know exactly how successful it'll be (which mostly you never know), how much potential users you'll have and so on, then App Engine is great.
It allows you to start with a free plan and then to scale your pricing as the number of users and CPU resources increases. The advantage: you don't have to setup (and pay) for a huge system to cover the maximum possible work load, but instead just pay the exact work load you need.

appengine_android.png
So far one had to create the connection between client-side applications, whether from Android or GWT by hand (I know what I'm talking about). This means also to handle authentication issues and so on.

The video below - presented at Google IO 2011 - demonstrates the creation of a task management app with an AppEngine back-end (using the Google Datastore as persistence medium) and an Android as well as a GWT app as the client-side front-end. It nicely demonstrates a new template which an updated version of the Google Plugin creates with build-in authentication and Android to AppEngine RPC call mechanism.

Read more: JavaCode geeks

Display ads to Internet Explorer users only

Internet Explorer users are often the ones that care the less about using a good browser or about the web designer’s development time. If you want to give them extra ads to punish them for using that browser, here is how to do it, insert the following code in your web page:



Read more: Design Tips

Thursday, June 16, 2011

Working with Chrome file browser handler

image00.jpg

During the day 2 keynote of Google I/O, I was excited to see Box's integration with the Chromebook's file browser handler getting demoed on the big stage. The integration makes local files and files you encounter on the web easily accessible to cloud services inside Chrome OS.

Chrome's file browser handler utilizes the new HTML5 file system API, designed to enable web applications to interact with local files. This API lets web applications read files, edit files, and create new files within a designated local space on a user's machine. This includes creating binary files for application data, and in Box's case, accessing user-created files to let people easily move their content to the cloud.
As mentioned during the Google I/O keynote, the integration between Box and the Chrome OS file browser handler only took our team a weekend to build. We were able to build the integration quickly because of the simplicity of both Chrome's file browser platform and Box's API, both of which were designed to make content integrations like this easy for developers to implement.

In this case, the Quick Importer tool from the Box API made the entire development process just a few steps:

1. We created a Chrome extension manifest to work with Box.

{
 "name”: "Box Uploader",
 ...
 "file_browser_handlers": [
     {
      "id”: "upload",
      "default_title": "Save to Gallery", // What the button will display
      "file_filters": [
       ]
     }
   ],

2. In the Chrome manifest, we specified the relevant file types to which the service applies. In our case, that's most file types, as seen below. Specialized services may just want certain types, such as images for Picasa.

"file_browser_handlers": [
     {
      "id": "upload",
      "default_title": "Save to Box",
      "file_filters": [
       "filesystem:*.*"
       ]
     }
   ],

Read more: Google code blog

Wednesday, June 15, 2011

Sleek Web UI Elements Free PSD Download

CreativeFan_Web_elements_set-500x325.jpg

CreativeFan is built around strengthening, informing, inspiring and empowering the creative media community in every way possible, from providing tutorials and articles to inspiration and freebies.
In order to better serve the community, we’ve decided to team up with a few elite designers to give away exclusive freebie design elements that you can use in your own work.
Please be sure to read the license, and if you like the freebie, send the link to this post to your friends as well.  Also, be sure to support these designers by checking out their portfolios and items for sale!

Read more: creativefun

Tuesday, June 14, 2011

Five little known files to help improve your web site

"Previously, I wrote about 5 web files that will improve your website and discussed files that, while small in size, pack a solid punch and make our work that little bit better. In this article, we’ll look at five more web files that can improve and your website.
Quick Overview
Here are the files we will cover:

  • P3P.xml – for user privacy
  • Geo.kml (and Geo.rdf) – for geolocation
  • Humans.txt – for attribution
  • vCard.vcf – digital business card
  • PICS.rdf – declares a website to be safe (or not safe) for young web users

10 superb jQuery plugins for working with images

This is collection of most interesting fresh jQuery plugins for images. Here are plugins to perform different animations and effects with images: zooming, and more.

1. AJAX-ZOOM
This plugin are very interesting. This is and ajax zoomer, and pan gallery, and also possibility to rotate objects (3D effect). Online demo you can find here.

img1.jpg


2. Transformable
Possibilities to transform image: rotate, skew, and scale (commonly – possible to work even with DIV elements). Online demo you can find here.
img2.jpg


Read more: Script tutorials

Monday, June 13, 2011

Полезные сайты с бесплатными PSD файлами

Здравствуйте! Сегодня хочу показать подборку сайтов, где можно получить файлы psd бесплатно!
Бесплатные psd, очевидно имеют большую ценность, чем обычные картинки разных форматов, в файлах с расширением (PSD) можно поиграть со слоями и настроить его под наши нужды, в отличии от обычного изображения форматов (PNG, JPG, GIF и т.д.). Бесплатные psd шаблоны, помогают улучшить навыки работы с фотошопом, готовые psd файлы значительно экономят время при создании того или иного эффекта. И так хватит уже расписывать, что такое пзд и для чего оно нужно, а давайте просто посмотрим на подборку сайтов.
На этих сайтах Вы сможете бесплатно скачать исходные файлы PSD.

365psd
FreePSDFiles
JackRebel.com
DesignBum

Read more: WeBigma  

Tuesday, June 07, 2011

Create Color Schemes For Websites using ColorSpire

Colorspire.png


Before you can get any website design off the ground, the first thing you need to decide is the color scheme. Whether you’re designing a page yourself or having someone do it for you, the colors are something that will take a lot of time. Colorspire is a web app that makes it easier to play around with colors; it lets you try different combinations in a simple interface by giving you simple blog type layout for a page. The page is divided in to five sections (including background); the color for each section can be changed. The hex code for the colors you select are given so you can share them with your designer or use them yourself.

Read more: Addictive tips

Sunday, June 05, 2011

50 Blue Web Designs To Inspire You

Kids find it in the sky in rainy season, teenagers find love in it, middle ages take it as a sign of confidence, keen attitude and clarity in the most deciding part of their life i.e. interview, senior citizen find experience of whole life it. Then what is it? This is a colour that hardly gets pronounced by people but finds a way to explore itself. This is the colour Blue.

tumblr2wp-A-tumblr-to-WordPress-Exporter1.png

Read more: Web Design burn

Google +1

Just added Google +1 to my blog.
The +1 is the Google "like" button. It should help Google to find what kind of pages people are interested in and improve the search experience.
In order the add the +1 button go to the documentation add to your page:

<!-- Place this tag in your head or just before your close body tag -->
<script type="text/javascript" src="http://apis.google.com/js/plusone.js" ></script>
<!-- Place this tag where you want the +1 button to render -->
<g:plusone></g:plusone>

In some pages (this blog platform for example) you can’t add this code so you must use HTML5 style (I think it is better)

<div class="g-plusone" data-size="standard" data-count="true"></div>

Read more: .Net && Beyond

Японский дизайн сайта

6.jpg


Сайты в японском стиле практически всегда смотрятся необычайно красиво и современно. При создании используется множество подходов и технологий. Минимализм и выразительность, реализованные с помощью flash. Яркость и динамичность, сделанная на javascript. Иллюстрации, фотографии, динамические вставки и, конечно же, иероглифы.
Исследуя японские сайты, мы заметили две отличительные особенности. Первая — большое количество сайтов сделаны на флеше. Сайт японского ресторана или кухни. Или же сайт, какого-нибудь очень популярного в Японии аниме. 90% что это будет flash. Вторая особенность — большой вес. Если мы стараемся сделать дизайн сайта легче и ускорить его загрузку, то для японцев такой проблемы нет. Красочный дизайн с множеством деталей и большим весом — нормальное явление.

В статье мы собрали примеры красивого и современного японского веб-дизайна. をお楽しみください.

Read more: WOMtech

Monday, May 30, 2011

Structure of an HTTP request

HTTP requests are not as mysterious as they may seem. Justin James helps make them more accessible by providing an overview of the common items in an HTTP request.

I recently wrote about using Fiddler to examine HTTP traffic for debugging purposes. To better use the information, it helps to know a bit about the guts of the HTTP specification. In this column, I’ll focus on the common items in an HTTP request, so you’ll know what the information means when you see it in a debugger.

The beginning of the HTTP request will have the request line, which will be followed by up to three headers: a general header, a request header, and an entity header. After that will be the message body. The request line specifies the method type (such as GET or POST), the URI requested, and the version of HTTP to use (the current standard is 1.1). Here is the full list of defined method types:
  • OPTIONS
  • GET
  • HEAD
  • POST
  • PUT
  • DELETE
  • TRACE
  • CONNECT
The URI is not necessarily the full URI (an absolute URI); for example, you can have the host specified in headers and use a relative URI. However, the specification says you should only use the absolute URI when communicating with a proxy server, and that normally you use the absolute path followed by a host header.

Read more: Tech Republic

Tuesday, May 24, 2011

Уникальные шрифты: Google Fonts

Kаждый веб-дизайнер встает перед выбором шрифтов для своего проекта. Сегодня мы рассмотрим API от гугла Google Fonts. Плюс шрифтов от гугла в том, что нам не требуется ничего скачивать. Мы просто подключаем нужный шрифт, прописываем стили CSS и все. В этой статье я приведу готовые куски кода для каждого из шрифтов, которые поддерживают кириллические символы.

Почему именно Google Fonts?

Достаточно долго продолжались дебаты по-поводу веб шрифтов. Было много разных идей и решений. Но понять кто выиграет было невозможно. А итогом борьбы стала победа @font-face.
Давайте посмотрим почему же победу одержал @font-face. Во-первых, достаточно чистый и простой CSS код. Во-вторых, @font-face поддерживает выделение и копипаст, что порадовало экспертов по юзабилити. И последнее – возможность самого широкого применения @font-face. Любой вебмастер может с помощью @font-face создать абсолютно любой шрифт.
Сейчас же соревнование происходит уже внутри мира @font-face. Кто-то использует шрифты с FontSquirrel.com. Чтобы использовать шрифты с FontSquirrel.com достаточно выбрать и скачать нужный комплект, а после подключить их с помощью CSS стилей.
Мы же сегодня будем использовать Google Fonts. Шрифты от гугла бесплатны и опциональны.
Советы при комбинировании шрифтов
Перед тем, как мы начнем работать со шрифтами, я хотел бы поделиться несколькими советами по комбинированию шрифтов.

Использовать шрифты из одного семейства. 
Первым делом, если это возможно, используйте шрифты из одного семейства. Шрифты из одного семейства обычно очень хорошо подходят друг к другу и они не будут создавать визуального неудобства.

Read more: RusDigi.org

Using Fiddler HTTP Debugger for CRM Troubleshooting and Performance Tuning.

Performance tuning continues to be one of the top requests from customers. When looking at performance from a client side perspective I will often use Fiddler (www.fiddlertool.com) to inspect HTTP traffic as the CRM pages are being loaded. Below is a screenshot that shows what the application looks like and then some of the top features I use.

1538.clip_5F00_image002_5F00_thumb_5F00_758E16E1.jpg

This tool has many features that give you good insight into what is happening during the page load. The data I use most often is:
Total number of requests and request size to pull up a page.

3817.clip_5F00_image003_5F00_thumb_5F00_3FF20B28.png

Wednesday, May 18, 2011

Silverlight Navigation With the MVVM Pattern

I recently had a query from a customer that was one of those ones that you think “Aha! That’s easy, you just do this”. Then you think a bit more about it and realise that if you want to do it properly it’s not quite as simple as you first thought.

This particular query related to how to use the navigation framework introduced in Silverlight 3 with the MVVM pattern. For those that don’t know the Model-View-ViewModel pattern is a common pattern often used to build Silverlight and WPF applications since it has strong support for databound UIs and provides good abstraction for unit testing and keeping your view logic separate from the view and the model.

Enter the Silverlight Navigation Framework
Handling the page style navigation that we’ve all become used to on the web can be a real pain in RIAs written using Silverlight, Flash or AJAX involving lots of tracking of page clicks using HTML bookmarks and some liberal use of JavaScript. Fortunately Silverlight 3 added a navigation framework to help with this.

This framework works by you adding a Frame element to your root XAML and then creating many Page derived classes. These classes can then navigate between each other by calling into a NavigationService instance that each page inherits from it’s base class.
The issue with MVVM is that page navigation is a view logic, that means that it should sit inside the ViewModel, however the NavigationService is only on the Page class which the ViewModel doesn’t have access to.

Solving this problem is simple, just pass the NavigationService instance to the ViewModel, job done! Well ok, that works if you hate unit testing. If you like unit testing though you may find you have problems then when it comes to testing your ViewModel as you won’t have a NavigationService instance to pass it.

Additionally since many pages are likely to want to do this I’d like to have a reusable approach that doesn’t take much code to reuse.

The Solution
The solution I came up with is one of a few different ways you could implement this but this works for me at the moment. Feel free to point out any glaring errors in my design though.
Wrapping the NavigationService
First I need to make the NavigationService mockable so I can use it in unit tests. To do this I created a new interface INavigationService that exposes the methods and properties of the NavigationService. This sample version only exposes Navigate() but you could easily expose more as needed.

public interface INavigationService
{
void Navigate(string url);
}

Not the most complex interface ever devised you’ll agree.
Next I created a class that implemented the interface and took a reference to a System.Windows.Navigation.NavigationService on it’s constructor.

public class NavigationService : INavigationService
{
private readonly System.Windows.Navigation.NavigationService _navigationService;
public NavigationService(System.Windows.Navigation.NavigationService navigationService)
{
_navigationService = navigationService;
}