Sunday, November 27, 2011

Friday, September 30, 2011

internet disconnects when using bittorrent - how to solve

The problem usually happens because your router can't handle too many connections at once.
Bit torrent programs like uTorrent open many connections at once to get total high speed in transfers.
Every router has its own limits to the maximum connections it can handle.
(Many routers can handle up to 255 connections only and even less than that)

To fine tune your bittorrent or emule or whatever P2P program you use to the maximum allowed, i suggest to do the following :

Set your P2P client to a very low amount of max connections in the settings.
I will demonstrate using uTorrent settings:

open options-> preferences , and then click 'bandwidth', you should see something like this:

start by setting both values to 25 and then download some popular file (just one).
Have a look at the total amount of connections you get by adding these 2 values:

(in the example above it is 120+55=177, where i set the max to 200, the remaining 23 connections can be uploads- which you should limit too - or connections being made at this moment)

now wait a few minutes see the connection is stable and then add 25 more to both settings above (while the download still continues) and re-check your connection download stability by waiting a few more minutes.

once you get a disconnections go back to the previous setting you had (if it disconnects at 200, then set it back to 175).

I found that my router, tplink WR641/2, can probably handle around the 200 connections.
Remember you have other connections in the house, including other computers/cellphones on the same router and the same computer browsing the web... so leave enough for everything.

Hope I helped !

Friday, September 23, 2011

pinnacle dvc 170 windows 7 64 bit

unfortunately, i saw on their site that they released a a driver for win7 but the 64 bit is only for older models not the dvc170:

they quote:
"Includes Windows Vista and Windows 7 drivers (for both 32 and 64 bit) for the DVC 100, 101, 103, 107 hardware NOTE: DVC130 and DVC170 don't have 64 bit drivers and can only be used with Windows XP and Windows Vista 32)"

link is here:

very very hard to download - always download stops.

pinnacle capture hardware is really bad quality even on xp i had so many problems with it - i have it now for 5 years and i really never managed to operate it without it crashing my operating system.

Friday, September 2, 2011

ASP.NET/ASPX How to return a simple non-html response

After too much time waste for this issue, there is a trivial solution that many ppl miss.
Instead of trying to do
Response.Clear() / ClearContent() / ClearHeaders(), like many web solutions show you - but don't work !
Just go to the aspx page that was created by the wizard (not the code-behind .cs page), delete everything except for the first directive tag telling the server to parse the page in the aspx engine :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ajax.aspx.cs" Inherits="Appcident.ajax" %>

and in your code behind, just return a response, like:

Response.AddHeader("Connection", "close");

Monday, August 29, 2011

some thoughts about Watin, windows 7, slow performance, upload dialogs & exceptions caused by UAC issues

When trying to figure out which to use between the two most popular web automation tools Watin & Selenium, I chose Watin as it was simple to start with at the time (a few years back) and worked great with C# and visual studio on windows.

Then my automation needs grew, and I needed to upload files into forms and with the new versions of IE I found out that I will have to use Firefox as IE has a permission/security problem automating the upload dialogs.
Firefox requires the jssh addon for receiving automation commands, which was OK at the time.

Jssh addon exists for Firefox up to version 3.6, but with the latest version race Mozilla took, Firefox is now up to version 6 and there is no compatible jssh plugin for it.

So, what options do we have ? it seems there are two :
1) remove your FF 6 and install the latest 3.6.X
2) use a VM with FF 3.6.X installed on it

There is another option:
3) Installing a portable FF version alongside the system FF 6 (you will still need to add the jssh add on to the portable version but that is not a problem).

The problem with this is that you will need to use the FireFox.PathToExe method and set it to the path of the portable firefox version (including the file name). But your problems won't end here, you will need to recompile Watin from the sources and do some changes too.

After doing all the above for solution #3, I still had exceptions from Watin, so I went back to option #1 (even though, as you will soon see below I could have stayed with option 3 and used the same fix for the exceptions too)

So back to option #1.
Still got an exception, and now in Process.HasExited inside the Watin library.
Didn't quit, compiled watin in debug and searched the internet - turns out Process.HasExited throws an exception when it is accessed from a non-privileged process (this pertains to Vista and Windows 7 which have the UAC feature on). Thanks Microsoft for not giving me just a 'process has no privilege' exception with a pointer to UAC :/ ) instead you get an Access Denied ...

So you need to run the process with 'run as an administrator' - then it worked !

But wait, I want to run it in visual studio in debug, but that doesn't work because it doesn't run it as administrator..., so you need to run visual studio itself has 'run as administrator' to causs all debug sessions to be run with the same privileges.

Everything seems to work now, except for my application hanging for a lot of time in different locations so that I see as if the Watin flow is very slow and sometimes seems to stop for several minutes before selecting radio buttons and clicking buttons onthe web page. So i ran it in debug and just pressed 'pause' in visual studio each time I saw it hang and not progress with running the web automation.

To my surprise I found out the problem with the watin program running very slow and sometimes just hanging was in my code when i called a logging function that updated a RichTextBox with new text that says what phase has been done between watin operations:

private void LogPrint(string str)
    logTextBox.AppendText(logTextBox.Text + str + "\n");

I have no idea why this happens (some race condition between wating and GUI threads  with waitformultipleobjects() maybe ??? i don't know, i am just happy that after commenting it out the logging everything worked fast and good !)

Hope this helps some people out there - Watin is a great web automation tool !

Tuesday, August 9, 2011

netbeans 7 dark background theme (fonts and colors)

A good programming scheme/theme with a dark/black background for use with netbeans can be found here
I use it for java/jsp and netbeans 7 but it can be used for any language.

Here is a preview:

Recommended !

Sunday, August 7, 2011

Refreshing changes in a webservice in the client in visual studio

When working on a solution which contains a web service project and a client project that calls the web service, typically you will perform changes in the webservice definitions (changing/adding methods and signatures to the web service) which you would like to be shown in the intellisense and when compiling the client.

You would assume all you need to do is compile the webservice and publish it after the change and then right-click on the webservice web reference in the client project and do 'update web reference' and that's it.

But there seems to be problems with this method - as changes are still not reflected.

What i found to work is to 'rebuild' on the web service + publish it.
Then open the wsdl in a web broswer - see the actual change.
Then right-click on the webservice web reference in the client project and do 'update web reference'.
Then, republish the web service again.

Saturday, July 9, 2011

Recommended method of installing PHP on IIS (using fast cgi IIS module)

Choose the manual php zip method and configure the fast cgi to use the php.

Monday, July 4, 2011

בשורה לעצמאים ! תשלום מעמ אחרי קבלת הכסף ודמי אבטלה

סוף סוף הולכים בכוון הנכון נגד אפלית עצמאים ועסקים קטנים

למרות שדמי האבטלה עדיין לא משולמים מביטוח לאומי (אפילו שעצמאים מפרישים 16% לעומת 10% לשכירים) זה מראה צעד בכוון הנכון.

לינק לכתבה

Sunday, April 10, 2011

How to close all explorer windows in one click

A great util called nircmd lets you control many aspects of windows via command line:

download and create a batch file with this line -

nircmd.exe win close class "CabinetWClass"

Monday, March 28, 2011

Restoring an MSSQL DB but user can't log in (SQL Server authentication)

Very common and typical problem when using SQL server auth mode (instead of windows auth mode).

In MSSQL you have a server user entity that is mapped to a specific DB user entity.
When you restore a DB for the first time, you need to create an MSSQL user and map it to your DB's user.
When you restore a DB in the following times (not the first time), you just need to re-map the MSSQL user to the DB user.

Creating an MSSQL user is pretty straight forward - just go to the security node of the server (not of the DB) and create a user with the same name that you have in the DB.

Mapping/Re-Mapping the user can be done using this script (for example we will use the db "mydb" and user "myuser"):

USE mydb
EXEC sp_change_users_login 'Update_One', 'myuser', 'myuser';
EXEC sp_changedbowner 'myuser'

Tuesday, March 15, 2011

How to install an FTP Server on amazon AWS EC2

This seems to be a big issue as people usually waste a lot of time on this.

The problem lies with 2 elements: the security group settings & the ftp server settings.

FTP is not considered a good solution for passing files between EC2 instances and your computer as it is not firewall "friendly" - you can't just open port 21/TCP on the amazon security group settings because the server is actually sitting on a NAT address and when an ftp client connects to an FTP server using PASV mode then the server tells the client which port and which address to use for the data stream (like directory listing).

If you want an alternate easy solution for transferring files between yourself and the EC2 instance then setup a dropbox on both machines - it doesn't get easier than this... :)

If  you still want to set up an FTP server on your EC2 instance then read on...

Typically, people just try to open port 21 and then try to connect and get something similar to:

Status:    Server sent passive reply with unroutable address. Using server address instead.
Command:    MLSD
Response:    425 Can't open data connection.

The solution is (and for this example I will explain how to perform the setting on FileZilla FTP server on windows):
0. Install an FTP server on your amazon instance. For this example i will be using FileZilla FTP server. Just download it(google) and do next->next->next .... until it is finished.

1. Open FileZilla FTP server: Edit-> settings -> Passive mode settings:
 (x) Retrieve external IP from:
[ this tells the ftp server to perform a 'whatismyip' and give that to the ftp client, you can also specifically put the address DNS name you use in your remote desktop in the "Use the following IP:", e.g., ]

(x) Use custom port range:

[ these are the ports that will be given to the ftp client - we will open them in the following step in the Firewall ]

2. Amazon security groups: open ports -
   a. Custom TCP rule , Port range:21
   b. Custom TCP rule, Port range:1024-1048

3. Turn off the windows firewall on the EC2 machine (you don't need it - you have the amazon firewall)

That's it, and just as side note, you don't need to use Elastic IP feature for this to work.
Also don't forget to set your client to use PASV mode (which is typically the default).

You can verify this works by reading the answer the server gives the client when it enters PASV mode:

Command:    PASV
Response:    227 Entering Passive Mode (174,149,71,102,4,7)

This response means: "Yo FTP client, use and port 4*256+7=1031"

Sunday, February 20, 2011

Wifi connection problems on android on Samsung Galaxy tab

I have a Tplink router and I have noticed I get wifi connection problems when trying to connect to it using my Samsung Galaxy tab mini tablet. After a lot of checks, I managed to see that the problem is from the DHCP.
The problem happens only when using a secure network (WEP or WPA/PSK).
The problem was that after the phone would recognize the net and try to connect to it, it would say "Remebered" on the connection for a short period and them it would show "Disabled" without any reason.

Since the problem is in DHCP, and until they fix it, it can be soved by defining a manual IP address on the wifi settings of the tablet:

- Goto Settings -> Wireless and Network -> Wi-Fi Settings
- If your router is already shown in the list, "long click" on it and choose "forget"
- (ignore the entry if it re-appears automatically)
- Select Add Wi-Fi network
- Type the name of your network, set the security type (WEP or WPA/WPA2 PSK) and enter the password
- The network should appear now on the list, don't connect to it yet
- "long click" on your network entry, and then setup your ip address manually, choose one from the range defined in the router (e.g., or then set the network mask (typically and then set the gateway and dns addresses - these should be the address of your router, the same address you put on your home computer browser to access the admin of your router, you can see it by opening a 'cmd' window on your computer and typing 'ipconfig' , use the same gateway address listed there for your phones gateway and dns settings.

Note: i noticed that getting the possibility to set your ip manually on the tablet is not consistent and it won't always give you this option when 'long clicking' on your network - you will hav to use trial and error.

Wednesday, February 16, 2011

Using JQuery with Visual Studio ASP.NET when using master and content pages

Good article for beginners on how to use JQuery together with C# ASP.NET here.

Pay attention to the comments at the end if you are using a master page and content pages and pay attention you will need to use a different finder string to locate auto generated ASP.NET control IDs:

Comment posted by Konrad on Tuesday, January 05, 2010 10:23 AM 
Something important when referencing server controls,
if you have a asp:Button control, $("#Button1") won't work.
You need to use this $("#<%= Button1.ClientID %>") 

Comment posted by mayuresh on Wednesday, March 04, 2009 4:08 PM
Adding the same code to a child page inheriting a master page..cause the page to referesh on postback




Using JQuery with ASP.NET comes to mind immediately when thinking of using a datetime picker control that is so much missing from the tools section of visual studio (the calendar control is really not a solution for most of us ! )

Wednesday, February 9, 2011

How to disable windows Internet Explorer Enhanced Security Configuration

When you freshly install windows 2003, "internet explorer enhanced security configuration" is on by default which makes your life hell when you try to browse the web and doesn't let you download firefox either (because clicking download on firefox each time triggers a different server that needs to be authorized by adding it to the allowed sites).

To solve this issue, and just download a normal browser such as firefox, simply go to control panel -> add /remove programs -> add/remove windows components -> uncheck "internet explorer enhanced security configuration" -> next,next,next .... finish -> download firefox

In windows 2008 it is a little different, Windows Server 2008 implementation of Internet Explorer Enhanced Security Configuration is configured through Server Manager. Select the root of the Service Manager navigation pane, and under the Server Summary click Configure IE ESC, which is part of the Security Information section. A dialog box appears, letting Internet Explorer Enhanced Security Configuration be enabled/disable separately for normal users and administrators.

Sunday, January 9, 2011

Fixing paper jam problem with Xerox 3117 Phaser laser printer

Xerox 3117 Phaser has a problem when a paper is automatically loaded for printing it gets stuck half way through and then you need to pull it out physically.

I found a solution for this (heard it from an experienced printer servicing person), you need to take a strong tissue that doesn't tear easily (like baby wipes) and clean the the feeding roller (see pic below) and the rectangle below it (in the picture below the rectangle is under the pages) with some acetone or alcohol.

This worked like a charm for me !
You have to repeat the process every month or two.

And another good advice is always to have at least 15 pages in the feeder and not less - it helps loading the sheets.

Software and IT Freelancer sites

A small list of sites with projects for software and IT freelancers:

They are pretty much the same and I can't find any special affinity to either one.