Ruslan Ulanov’s Codeshack

The developer’s notebook

Useful JavaScript Regular Expression Functions

leave a comment

Here’s a few links for commonly used REGEXs..

10+ Useful JavaScript Regular Expression Functions to improve your web applications efficiency

[javascript]// check that an input string looks like a valid email address.

var isEmail_re = /^\s*[\w\-\+_]+(\.[\w\-\+_]+)*\@[\w\-\+_]+\.[\w\-\+_]+(\.[\w\-\+_]+)*\s*$/;
function isEmail (s) {
return String(s).search (isEmail_re) != -1;
}[/javascript]

 
 

[javascript]// returns a string with everything but the digits removed. Could be used to validate phone numbers, etc.

function getdigits (s) {
return s.replace (/[^\d]/g, “”);
}
[/javascript]

Written by Ruslan Ulanov

September 4th, 2009 at 12:16 pm

Posted in JavaScript

Tagged with ,

Regular Expressions in InstallScript

leave a comment

If you’ve ever had to parse strings in InstallShield’s InstallScript, you’d know that a few of InstallShield’s built-in String Functions might not be enough. Regular Expressions are a way to go, but unfortunatelly Acresso didn’t implement them (yet?) in their product.

This post from Acresso Community might have a solution for you (at least until Acresso will figure out a way to implement RegEx natively in their products).

Read the rest of this entry »

Written by Ruslan Ulanov

July 20th, 2009 at 11:16 am

Posted in Installer,VBScript

Tagged with

data Protocol – embed your data

leave a comment

Recently, looking for a completely unrelated subject I discovered that IE8 now supports the data protocol.

What is a data protocol?

In a few words, it’s a way to embed any data (like GIF images, for example) into text documents such as HTML or CSS. So, instead of linking to an external file, you can do something like this:

HTML

[html]<IMG
SRC=’data:image/gif;base64,R0lGODdhMAAwAPAAAAAAAP///ywAAAAAMAA wAAAC8IyPqcvt3wCcDkiLc7C0qwyGHhSWpjQu5yqmCYsapyuvUUlvONmOZtfz gFzByTB10QgxOR0TqBQejhRNzOfkVJ+5YiUqrXF5Y5lKh/DeuNcP5yLWGsEbtLiO Spa/TPg7JpJHxyendzWTBfX0cxOnKPjgBzi4diinWGdkF8kjdfnycQZXZeYGejmJlZ eGl9i2icVqaNVailT6F5iJ90m6mvuTS4OK05M0vDk0Q4XUtwvKOzrcd3iq9uisF81 M1OIcR7lEewwcLp7tuNNkM3uNna3F2JQFo97Vriy/Xl4/f1cf5VWzXyym7PHhhx4dbgYKAAA7′
ALT=’Larry’>[/html]

Read the rest of this entry »

Written by Ruslan Ulanov

July 8th, 2009 at 2:31 pm

Posted in CSS,HTML

Tagged with

Login To Multi Accounts Simultaneously In Same Site Using IE8

leave a comment

ie8_logo How many of you have multiple accounts for same site, say Yahoo or Orkut  or some other email or networking site or forums, which you would like to browse simultaneously. One of the option available was to install different browsers and then log in into the same site using different ids. But with the new features of Internet Explorer 8 you can do this within IE8 itself.

To make use of this feature, instead of creating a new tab, select “New Session” from File menu. Thus each new session will have its own cookies which will allow you to browse same site with simultaneous multiple ids.

Source: http://www.sanzrao.com

Written by Ruslan Ulanov

June 16th, 2009 at 10:20 am

Posted in HTML

Tagged with

InstallShield Skinning

leave a comment

Ever wanted to get rid of the InstallShield branding on custom skins? Now you can! Just download the attached ZIP file and use the files in this ZIP to create your skins. It works just like the original skin toolkit.

Happy skinning…

Elmery

Read the rest of this entry »

Written by Ruslan Ulanov

February 20th, 2009 at 1:20 pm

Posted in Installer

Tagged with

Using Regular Expressions in YUI CellEditor

leave a comment

Here’s a nice example of validating data in DataTable’s CellEditor using regular expressions.

http://www.satyam.com.ar/yui/2.6.0/invoice.html

Written by Ruslan Ulanov

January 28th, 2009 at 2:35 pm

Posted in JavaScript

Tagged with ,

Cyr2Lat Slugs – WordPress Plugin

10 comments

?? ??????? ??????? ????…

If you happen to write Word Press posts in one of the Cyrillic-based languages (i.e. Russian, Bulgarian, Ukrainian, Belarusian, etc.) and are using post’s title in Permalinks then you know that your post’s URL will become an unreadable mash of encoded characters (like %45%f0%…)

I got finally tired of changing encoded slugs to their latin equivalents on my son’s blog, and started looking for ways to automate this process. The Cyrillic Slugs plug-in written by Petko Bossakov was my only alternative at the time in WordPress plug-in repository. Unfortunatelly that plug-in didn’t work for me, since Cyrillic Slugs expects the page to be written in Windows-1251 encoding, and my blog uses WP’s default/recommended UTF-8. Hence Cyr2Lat Slugs plug-in was born.

Here’s a sample that illustrates what this plug-in does.

Before Cyr2Lat Slugs:

  1. You write a post with title “?????? ?????????”
  2. WordPress creates permalink like this:

    http://www.myblog.com/2008/12/19/%d0%bf%d1%80%d…b2%d0%ba%d0%b0

After Cyr2Lat Slugs:

  1. You write a post with title “?????? ?????????”
  2. WordPress creates permalink like this:

    http://www.myblog.com/2008/12/19/primer-zagolovka

Cyr2Lat Slugs is based on Petko’s original idea and uses one of his functions, but otherwise is written in a more contemporary, object-oriented fashion. It also uses strtr function instead of str_replace which should be much faster.

Please note that you have to save post (click Save or Publish button) for slug conversion to take place!

Version: 1.0
Requirements: WP 2.3+ (WP MU compatible)
Author: Ruslan Ulanov
License: GPL

Download Cyr2Lat Slugs plug-in now.

Installation:

  1. Copy file cyr2lat-slugs.php to folder wp-content/plugins/ on your server.
  2. Activate Cyr2Lat Slugs in Plugins menu of your blog’s admin interface.
  3. You’re done. There are no options to configure.

Comments are welcome (moderated, no spam please).

 
#
*In Russian*

Cyr2Lat Slugs ??? ?????? ??? ????????? Word Press, ??????? ????????? ??????? ????? ? ????????? ????? ? ???????? (????????), ??? ????? ????? URL ???????? ? ????????? ??? ???????????.

???????????????? ?????? ??????? Cyr2Lat Slugs ?? ???????.

?? ????????? Cyr2Lat Slugs:

  1. ?? ?????? ???? ? ?????????? “?????? ?????????”
  2. WordPress ??????? ??? ???? ?????????:

    http://www.myblog.com/2008/12/19/%d0%bf%d1%80%d…b2%d0%ba%d0%b0

????? ????????? Cyr2Lat Slugs:

  1. ?? ?????? ???? ? ?????????? “?????? ?????????”
  2. WordPress ??????? ??? ???? ?????????:

    http://www.myblog.com/2008/12/19/primer-zagolovka

??????????: ???? ?????????? ????????? (?????? ?????? Save ??? Publish), ????? ????????? ??? ????????? ? ????????!

??????: 1.0
??????????: WP 2.3+ (???????? ? WP MU)
?????: ?????? ??????
????????: GPL

????????? Cyr2Lat Slugs.

?????????:

  1. ?????????? ???? cyr2lat-slugs.php ? ????? wp-content/plugins/ ?? ???????.
  2. ??????????? Cyr2Lat Slugs ? ???? Plugins ????????????????? ?????????? ?????? ?????.
  3. ??????. ?????? ?????? ??????????????? ?? ????.

??????????? ?????????????? (?? ????????????, ??? ?????????? ?????).

Written by Ruslan Ulanov

December 10th, 2008 at 7:41 pm

Posted in PHP

Tagged with

Mobile Web Best Practices 1.0

leave a comment

The World Wide Web Consortium (W3C) has recently published a document called Mobile Web Best Practices 1.0.

This document specifies Best Practices for delivering Web content to mobile devices. The principal objective is to improve the user experience of the Web when accessed from such devices.

It’s a good step toward making the Web accessible to millions of small screen devices, not blessed with a combination of iPhone’s hi-res LCD and a powerful Safari browser. :)

The document is available from W3C’s web site http://www.w3.org/TR/2008/REC-mobile-bp-20080729/

Written by Ruslan Ulanov

August 7th, 2008 at 2:30 pm

Unlocker for “in use” files

leave a comment

How many times have you had to completely reboot Windows to get Explorer or some other greed process to let go of a file you needed …

Unlocker really rocks.  It integrates into the right click menu and can show you what processes have a lock on a file.  You can shutdown the process (preferred) or simply unlock the file.  Not only is it free, but the author provides a comparison matrix against 19 other utilities that unlock files and it is apparent he has put some thought into making his comprehensive!

Obviously you have to be circumspect about ending processes to release a file lock – but I’ve seen Windows Explorer hang on to a file until reboot when it isn’t really using it. 

Visit Site

Source: http://desktopengineer.com

Written by Ruslan Ulanov

July 31st, 2008 at 7:51 pm

Posted in Utility

MS Patterns & Practices

leave a comment

Microsoft has assembled a nice library of best practices for all sorts of applications from Web Applications and Services to Desktop and Mobile Applications.

Quoting the site…
Microsoft patterns & practices was created to meet the demands of architects and application developers seeking guidance on how to apply Microsoft’s array of products and technologies to common application development scenarios and technical challenges. Microsoft patterns & practices are Microsoft’s proven recommendations for how to design, develop, deploy, and operate architecturally sound application for the Microsoft platform.

Check it out in Microsoft patterns & practices Developer Center.

Written by Ruslan Ulanov

July 31st, 2008 at 7:41 pm

Posted in C/C++,VB.NET