Archive for Tips and Tricks

How to protect the image from being copied?

Well, it is so sad to say that there is no way to protect the images from being copied until the time of writing this post. You may probably tell me that you found a lot of “Image Protection” tools on web. Yeah. I know. I did even tried some of them once. Those tools make people difficult to copy the images from your website. but there are always some sort of hecks for copying images. No matter what tools or technologies you use.

I will tell some attempts that people tried to achieve this goal and the reason why those attempts were failed.

#1. Disabling “Right Click” on webpage by using Javascript.

This is very very old trick and it’s totally useless. Don’t forget “Save As” in File menu. Plus, there are a lot of DOM manipulators (eg: Firebug) to track the path of images.

#2. Adding new transparent image over the actual image

I found some sites (including flickr) that are using this technique to protect their images from being copied. It works for normal users who only knows “Right Click” and “Save Image As”. You can still check the source to get the correct path of actual image that you want. If you are familiar with firebug, you can easily delete the transparent image that you don’t want on the fly.

#3. Using third-part tools for image protection

If you do googling about this a lit bit, you will get a ton of tools advertising that those tools will help you to protect your image from being copied (some even said that those tools are able to protect HTML code too.) Don’t even never spend your money on those tools. I mean it. As I said above, I tried already. I know those tools are not good enough since they have their own limitations. So, don’t waste your money on it.

This fact applied for code protection tool also. Those tools are going to encrypt your webpage and will add a lot of whitespace in your actual source. So, if you check the “View Source” a lit in your browser, you will see plain text or some text you write instead of HTML code. but don’t forget to scroll a lit bit.. You will see goddammed things.. and those tools will eat your bandwidth and it made your visitors to view the web page in slow motion. :)
#4. Putting images in Embedded Object (Flash or ActiveX Object)

I think this is the best way to protect the image so far. but it is possible to download the whole flash file (*.flv) to local machine by using third-party tool or firefox extensions (eg: Download Helper). So, the individual image are safe from being copied but not for flash.

UPDATED (27th August, 2007):

Watermarking (Thanks to mmhan for reminding me about this.)

AFAIK, there are two ways of watermarking. The first way is that putting a watermark simply on the image. This watermark will be visible to everybody. The second way is that putting a invisible watermark on the image by using Steganography.

Yeah. those are the ways that I remember how people tried to protect their images. If you have other ways, don’t hesitate to let me know.

Remember! All images from the webpage are already sent to the temporary internet files of user’s local machine before showing to the web browser. So, user can still copying images from Temporary Internet File folder. And, What about “Print Screen”? :)
So, if you ask me how to protect the image, I would say “don’t do that!” . :)

[Weekly - QASW] - Questions and Answers in Software Development

Problem ~ Error while tryping to run project: Unable to start debugging on the web server. You do not have permission to debug the application. The URL for this project is in the Internet zone. Click Help for more information.

ASP.NET

I was getting this error recently when I was trying to debug ASP.NET 2.0 web project with Microsoft Visual Studio 2005 Professional Editor. Initially, I have no problem in debugging the web project in my machine. I think that the System Team made some security policies changes in my office. I did some experiments on this issue for some time and I found the following steps to solve this problem. Honestly, I’m not so sure which steps is the actual solution but I’m sure that this problem will be solved if you follow this step.

Solution ~

Step 1: Ensure that you account and ASPNET account is listed in Debugger Users group.

Step 2: ASPNET account has the permission to read (or write) your web directory.

Step 3: Add “localhost” or “*.local” in “Exception” panel of Proxy Setting. ( Internet Explorer>Internet Options>Tools>Connections>LAN Setting>Advanced button of Proxy Server>Exceptions>”Do not use proxy server for addresses beginning with ~”)

exception.png

Step 4: Add http://localhost to the trusted site.

Step 5. Run “iisrest” in Command Prompt

Then, it should work. If it doesn’t work, add ASPNET User account to Administrators Group. And try it again. I hope it will work for you. Feel free to let me know this solution doesn’t work for you or you know the better solution. Thanks.

———–

Problem ~ Visual Studio .NET has detected that the specified Web server is not running ASP.NET version 1.1. You will be unable to run ASP.NET Web applications and services.

aspnet-err.jpg

Solution ~

#1. Check the property of your web application. Most probably, your application is using ASP.NET 2.0 version instead of 1.1. So, you can simply change it to ASP.NET version 1.1.

#2. If it doesn’t work, run “aspnet_regiis” in command prompt.

Hope it will work for you too.

—————

Question ~ Why doesn’t C# support multiple inheritance?

Answer ~

The following is answered by Microsoft C# Team. The original post can be found here. I posted the copy here in case the original one disappears and I like this answer so much. ( Honestly, it’s kinda hard to understand. :) )

There are a number of reasons we don’t implement Multiple Implementation Inheritance directly. (As you know, we support Multiple Interface Inheritance).

However, I should point out that it’s possible for compilers to create MI for their types inside the CLR. There are a few rough edges if you go down this path: the result is unverifiable, there is no interop with other languages via the CLS, and in V1 and V1.1 you may run into deadlocks with the OS loader lock. (We’re fixing that last problem, but the first two problems remain). The technique is to generate some VTables in RVA-based static fields. In order to deposit the addresses of managed methods (which probably haven’t been JITted yet), you use the VTFixup construct. This construct is a table of triplets. The triplets consist of a token to a managed method, an address in your image that should be fixed up (in this case, a slot of the VTable you are creating in the RVA-based static), and some flags. The possible flags are described in corhdr.h and they allow you to specify 32- vs. 64-bit pointer sizes, control over virtual behavior, and whether some reverse-PInvoke behavior should be applied in the form of a thunk that eventually dispatches to the managed method. If we are performing an unmanaged->managed transition, you also have some control over which AppDomain should be selected for us to dispatch the call. However, one of these options (COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN) doesn’t exist in V1. We added it in V1.1.

There are several reasons we haven’t provided a baked-in, verifiable, CLS-compliant version of multiple implementation inheritance:

1. Different languages actually have different expectations for how MI works. For example, how conflicts are resolved and whether duplicate bases are merged or redundant. Before we can implement MI in the CLR, we have to do a survey of all the languages, figure out the common concepts, and decide how to express them in a language-neutral manner. We would also have to decide whether MI belongs in the CLS and what this would mean for languages that don’t want this concept (presumably VB.NET, for example). Of course, that’s the business we are in as a common language runtime, but we haven’t got around to doing it for MI yet.

2. The number of places where MI is truly appropriate is actually quite small. In many cases, multiple interface inheritance can get the job done instead. In other cases, you may be able to use encapsulation and delegation. If we were to add a slightly different construct, like mixins, would that actually be more powerful?

3. Multiple implementation inheritance injects a lot of complexity into the implementation. This complexity impacts casting, layout, dispatch, field access, serialization, identity comparisons, verifiability, reflection, generics, and probably lots of other places.

It’s not at all clear that this feature would pay for itself. It’s something we are often asked about. It’s something we haven’t done due diligence on. But my gut tells me that, after we’ve done a deep examination, we’ll still decide to leave the feature unimplemented.

————-

I found this question and answer below in codeproject forum that I used to participate. I think it’s very interesting.

Question : True and False - Best Practices

A few colleagues of mine are in disagreement as to what is the best practice for coding boolean flags. Should you use the actual words “true” or “false” or use the integers “1″ or “0″ (or -1 in some languages) respectively.

I favor a boolean flag to show values as “true” or “false” because it makes reading 800 lines of code easier. 0’s and 1’s can be confusing, in my scenario, because we are constantly setting variables back to a regular integer values of 1 or 0.

Thanks!

Answers ~

I believe you are right. In terms of readability if the language you are using actually supports the boolean type and the true,false keywords then it means is recommended to use them. In certain cases this will not be true. For example C did not have a book type until C99 came out and then C++ provided bool type and true/false keywords as a built in feature. If you do use C++ then it is recommended to use the true/false type since they are provided. Even in C , it was a good coding practice to #define the keywords TRUE and FALSE to 1 and 0 respectively to provide a more readable code.
Just my humble opinion

I agreed with this answer for this question. Why you wanna use 0 and 1 while Microsoft is providing the boolean type for us? :)

Related ~

Fwd: About Cell Phone!!

This lady has changed her habit of how she lists her names on her mobile phone after her handbag was stolen. Her handbag which contained her mobile, Credit card, purse…etc…. was stolen. 20 minutes later when she called her Husband, from a pay phone telling him what had happened, hubby says ~

“I’ve Just received your text asking about our Pin number and I’ve replied a little while ago.”

When they rushed down to the bank, the bank staff told them all the money was already withdrawn. The pickpocket had actually used the stolen hand phone to text “hubby” in the contact list and got hold of the pin number.Within 20 minutes he had withdrawn all the money from the bank account.iphone - cell phone

Moral of the lesson: Do not disclose the relationship between you and the people in your contact list. Avoid using names like Home, Honey, Hubby, sweetheart, Dad, Mom etc……. And very importantly, when sensitive info is being asked thru texts, CONFIRM by calling back. Also, when you’re being texted by friends or family to meet them somewhere, be sure to call back to confirm that the message came from them. If you don’t reach them, be very careful about going places to meet “family and friends” who text you.

PLEASE PASS THIS ON.

Note: Thanks to Julia for forwarding this msg.

CAB Problem - “Smart Client Development May 2007″ template doesn’t show in Guidance Packages

One of my friend asked me that she was not able to find “Smart Client Development May 2007″ template in Visual Studio 2005 - New Project Dialog. Then, I was looking for the solution and I got the solution as below. I hope it would be useful for those who are new to Smart Client Development.

Normally, the SCSF template should be shown as the following screenshot in Project Template dialog.

Project Template

But that template doesn’t show in template dialog then you have to follow the steps mentioning below to figure out the problem.

  • You have to check whether you have installed the corrected version of required software for SCSF (Smart Client Software Factory). In order to check what the required software are, click “Smart Client Software Factory - May 2007.msi”
  • Click “Check dependencis” button when the installer is loaded.
  • Checklist should be shown as picture below.

Smart Client Software Factory Installatin Checklist

  • All icons should be green icon. If not, you have to download the latest version of each setup files. and Install them in your machine before installing SCSF.
  • If you have installed the earlier version of those installers, I would recommend you to uninstall first. Note that you have to uninstall “Enterprise Library” before uninstalling Guidances Toolkit and Extension.
  • After uninstalling the old version, you can start installing the new version. Then check “check dependencies” which I mentioned in Step 1.
  • If it’s done, you should go to “Custom Setup”. Ensure that all checked boxes are checked as below.

Custom Setup

  • Then, Click “Next” to install.
  • After then, open Visual Studio 2005. Check the SCSF template in “New Project” dialog. (I hope you will get the template that you want. :) )

That’s all.. Hope it would help. Don’t hesitate to contact me if you have any problem. Thanks.

CompositeUI Application Block (CAB) Installation Problem on Windows Vista

Question : Are you getting the following errors while you are installing CAB (CompositeUI Application Block) on your Vista box?

CAB Installation Fucking Problem on Windows Vista Home Premier

CAB Installation Problem on Windows Vista Home Premier

Here is the Solution for you.

The shortest answer is “turn off UAC before installing CAB”.

Please read the following if you dont know how to do it.

  • Go to “Control Panel”

control-panel-window-vista.png

  • Go to “User Accounts and Family Safely”

User Accounts and Family Safely

  • Click “User Accounts” as picture below

user-account.jpg

  • Click “Turn User Account Control (UAC) on or off”

turn-user-account-control-on-or-off.jpg

  • Uncheck “Use User Account Control (UAC) to help protect your computer” and Click “OK” button

turn-off-uac.jpg
Then you may start to install CAB framework in your Windows Vista. I hope it would help. Feel free to let me know if you have any problem. I have tested this instructions on my Windows Vista Premier Edition. It works great.. Dont forget to turn on UAC once done.

Tips : devenv.exe Problem

Since I am super busy in my work :P, running devenv.exe from Run menu instead of finding the shortcut of VS 2003 in Start Menu can save me a lot of time. When Microsoft distributed a hundred versions of Whidbey I gladly installed/uninstalled the latest version for checking its new features [along with sending a thousand error report to microsoft .. ]:-))…

Unfortunately, after UNINSTALLING Whidbey from my machine I was unable to call “devenv.exe” to launch Visual Studio 2003 coz some of register keys have been changed when I installed Whidbey.So after a lot of effort I found out how to fix this and I am sharing it with you all.

Steps to perform

  1. Open registry editor (regedit.exe)
  2. Go to this path HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\Windows\CurrentVersion\App Paths\devenv.exe”
  3. Check the value of this key.. [ you will see this string " C:\Program Files\Microsoft Visual Studio 8\ Common7\IDE\devenv.exe"]
  4. Change this string to “C:\Program Files\Microsoft Visual Studio .NET 2003\ Common7\IDE\devenv.exe”
  5. Done!!

Check : Type “devenv” in run menu… Wow! Visual Studio 2003 is opening… Hope you will find it useful..