Text Direction Button Disappeared From Gmail Message Editor

In last two days I found that the text directions buttons disappeared from gmail message editor. Today a fried told me that there is an option for that in Gmail settings.

For now me editor is like this:

Gmail Editor without Text Direction Buttons

 

So To add the text Direction button to the tools box of message editor simply do this:

Open Gmail options menu and select settings:

Gmail Options Menu

in the settings page, see the marked two options of text direction:

Gmail Settings - Text Directon

Select the second option to enable the Direction Buttons .. then save the settings.

 

Now the text direction buttons will appear and message editor will look like:

Gmail Message Editor

 

Thats it

Clear Saved Login

Sometime I want to access a network shared folder from normal user PC and when I call the computer using \\computer-name it ask me to type the credentials to access the destination computer shared folder, by mistake I type the administrator account Username and Password and even I select “Remember my credentials”

Then I needed to clear this connection session to log-in back with the correct user account not the administrator. So I found that I can use this command:

rundll32.exe keymgr.dll, KRShowKeyMgr

it will show you all active session to the computer then you can manage them (Add/Edit/Delete)

also you can use this command:

control keymgr.dll

it will open this page:

I tried both commands in windows 7 it works, I didn’t try on windows XP, but I guess at least first one will work.

References:

http://www.sakana.fr/blog/2007/02/27/windows-clear-saved-windows-networking-passwords/

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/key_howto_delete.mspx?mfr=true

http://www.faqforge.com/windows/how-delete-saved-passwords-for-network-drives-in-windows/

“Licensing for this product has expired” Adobe CS4 Applications

Licensing for this product has expired

If you are getting this error message when you start your Adobe CS4 application like Dreamweaver. And you want to tray another serial but not able to because application is not starting but only showing this message “Licensing for this product has expired”

Then.. Go to C:\Program Files\Common Files\Adobe\Adobe PCD\cache
and rename or delete the file “cache.DB”

Try to start the application again .. it should start .. then you will get a chance to enter your correct serial number.

check this link for more details.

 

BTW .. I am talking about Windows OS .. MAC people said another solution work for them, that is to do the following:

  1. Change your DATE to a previous (those working days)
  2. Re-open Program (It will, now)
  3. On the menus-> HELP->DEACTIVATE and close program
  4. Change DATE to present
  5. Open program again, it will ask for a new KEY, enter a new key

 

 

CF Function to Clean MS Word HTML Mess

I was have a trouble with our clients using our CMS system, that is, they used to copy their text from MS Word and paste into the CMS editor directly. If you already know, that will make trouble and create a lot of unwanted HTML and XML tags  (as I see on internet people call it MS Word Mess). I Used to paste the MS Word stuff into the design area of Dreamweaver because it gives me a control and options to clean unwanted things while pasting. you can find that options by :

Click in Design area in Dreamweaver > open Edit meun and select “Paste Special…

Then select the cleaning option you want.  Still after that you may need to do some RegExp replacements.

But as you know you can’t ask your clients to use Dreamweaver to clean MS Word mess.

Clean MSWord Mess Function

I decided to create a ColdFusion Function to replace all unwanted HTML and XML Tags from MS Word pasted text. Here is the function:

<cffunction name="cleanWordMess" output="no" returntype="string">
 <cfargument name="inString" default="">
 <!--- if nothing passed , return empty string --->
 <cfif Not Len(Trim(arguments.inString))><cfreturn "" /></cfif>
 <!--- create a tmporary variable to cold the passed text --->
 <cfset local.text = arguments.inString />
 <!--- remove the HTML comments --->
 <cfset local.text = REReplace(local.text, "<!--.*-->", "", "ALL") />
 <!--- remove most of the unwanted HTML attributes with their values --->
 <cfset local.text = REReplace(local.text, "[ ]+(style|align|valign|dir|class|id|lang|width|height|nowrap)=""[^""]*""", "", "ALL") />
 <!--- clean extra spaces & tabs --->
 <cfset local.text = REReplace(local.text, "\s{2,}", " ", "ALL") />
 <!--- remove exra spaces between tags --->
 <cfset local.text = REReplace(local.text, ">\s{1,}<", "><", "ALL") />
 <!--- remove any &nbsp; spaces between tags --->
 <cfset local.text = REReplace(local.text, ">&nbsp;<", "><", "ALL") />
 <!--- remove empty <b> empty tags --->
 <cfset local.text = REReplace(local.text, "<b></b>", "", "ALL") />
 <!--- remove empty <p> empty tags --->
 <cfset local.text = REReplace(local.text, "<p></p>", "", "ALL") />
 <!--- Remove all unwanted tags opening and closing --->
 <cfset local.text = REReplace(local.text, "</?(span|div|o:p|p)>", "", "ALL") />
 <!--- remove and repetation of &nbsp; and make it one only --->
 <cfset local.text = REReplace(local.text, "(&nbsp;){2,}", "&nbsp;", "ALL") />
 <cfreturn local.text />
</cffunction>

Of course the sequence of replacement code is very important. I think you know how to call this function .. or do I need to explain!  🙂

Feel free to use the function personally, commercially .. whatever.

Clean Truncated HTML Tags

While showing list of articles in a website usually you will see a short description with each article. As a programmer, sometimes I have to gather some number of words or characters from the article body text and show it as a short description.

When I get this number of letters from the body say by using CAST in SQL, as example:

SELECT TOP 10 ID, Title, CAST (Body AS NVARCHAR(100)) AS shortDescription FROM Articles

Assume I in one of the records I has this original value in the body field:

While comparing two entities, we tend to see both of them as competitors and <a href=http://www.somesite.com&#8221; target=“blank”>consequently comparing</a> them to find a winner.

After running the SQL I will get:

While comparing two entities, we tend to see both of them as competitors and <a href=http://www.so

As you can see the result has invalid/corrupted HTML which definitely will effect the page display if I output it as it is. Say I decided to strip out the HTML tags from the description before outputing it with this code:

<cfset text = REReplace(text, "<[^>]*>", "", "ALL")>

It will not do any thing because there is no correct tags in this string, so it will not replace any thing. For that you need to replace any unclosed tags, it could be ‘<blockquote class=”somting”‘ of even ‘<blockquo’. Hence, I use this line of code to clean any truncated HTML tags:

<cfset text = REReplace(text, "<[^>]*$", "", "ALL")>

Mostly I use the both replacement above.

 

Show & Hide Loading/Processing Indicator in iPhone App

To show the loading or processing indicator in your iPhone Application just add this line:

[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;

and to hide the loading indicator use the same with changing  YES to NO, like this:

[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;

You will need to use this feature normally when you are processing something in background using thread(I will try to write about thread later Inshallah) and you want user to know that something is going on in background.

thats it;

Using JSON in iPhone App Developlment

I am attending an iPhonh Application Development course these weeks. And in the next week we are going to deal with HTTP to gather XML data. As I know, and as instructor said, iPhone has built-in libraries to read and parse XML but there is nothing for JSON.

I decided to search and immediately I got this very useful post by Dan Grigsby on an interesting website:

Tutorial: JSON Over HTTP On The iPhon

http://mobileorchard.com/tutorial-json-over-http-on-the-iphone/

He explain “JSON and how to use” in very nice clear way, also there you will find a free library for JSON to use .. don’t miss it.