Sunday, November 27, 2011
Watin getting started tutorial with visual studio 2010
I posted a video that will help you getting started with WatiN and visual studio:
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 !
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:
http://www.pinnaclesys.com/PublicSite/us/Products/Consumer+Products/Home+Video/Studio+Plug-Ins/Instant+DVD+Recorder+Support/Download+Area/Drivers+-+Updates/IDVDR261.htm?mode=documents&Display=1
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.
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:
http://www.pinnaclesys.com/PublicSite/us/Products/Consumer+Products/Home+Video/Studio+Plug-Ins/Instant+DVD+Recorder+Support/Download+Area/Drivers+-+Updates/IDVDR261.htm?mode=documents&Display=1
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 :
e.g.,
and in your code behind, just return a response, like:
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 :
e.g.,
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="ajax.aspx.cs" Inherits="Appcident.ajax" %>
and in your code behind, just return a response, like:
Response.Write(pageResponse);
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 !
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 !
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.
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.
Subscribe to:
Posts (Atom)