- Create hidden tooltip element:
- Create JS scripts for showing/hiding tooltip:
function show()
{
var tooltip = document.getElementById('tooltip');
tooltip.style.top = event.clientY;
tooltip.style.left = event.clientX + 10;
tooltip.style.display = 'block';
}
function hide(){
var tooltip = document.getElementById('tooltip');
tooltip.style.display = 'none';
} - Set Javascript events for the chosen page element:
Element content
Friday, 29 May 2009
JS: Display tooltip over page element
Monday, 4 May 2009
The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
"The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state."
Most of the suggestions found in Web blamed the invalid code, giving examples similar to the following one:
Since I was sure this was not the case I had to discover the real exception reason by myself.
using (MyWebServiceClient service = new MyWebServiceClient())
{
service.DoSomeOperation();
service.Close();
service.DoAnotherOperation();
}
Solution:
The using statement in the form presented above will mask any errors coming from the web service client and throw the "faulted state" exception instead, which may be irrelevant to the actual problem. To find out the real issue you can examine the InnerException property of the exception thrown (e.g. by logging it or debugging your app).
Alternatively you can add an additional try/catch to ensure that the real exception is thrown by your application rather than the "faulted state" one:
You can read more about the reason for the "faulted state" exception on MSDN page (Thanks to Carl for the link).
try
{
MyWebServiceClient service = new MyWebServiceClient()
service.DoSomeOperation();
service.Close();
}
catch (CommunicationException e)
{
service.Abort();
}
catch (TimeoutException e)
{
service.Abort();
}
catch (Exception e)
{
service.Abort();
throw;
}
Tuesday, 14 April 2009
Join the Java Black Belt community
It offers many free java exams created by community users. In order to get the black belt you need to contribute to the portal so the amount of testing material is still growing.
It's a great way to refresh your java knowledge. I hope that this belt-system will keep me motivated so I not only prove my current skills but also learn something new.
After I get to the certain level (let's say the blue belt) I'll update my blogger profile to display the belt icon so you can see my progress directly from this page.
Tuesday, 24 March 2009
Debugging .NET applications
The biggest part of the session was dedicated to WinDBG tool. Its interface is very poor and user-unfriendly. However, Ingo demonstrated that once you learn how to use it, it can be very helpful in finding the reason for application failures.
At first Ingo simulated situation where the developer has access to production machine (with no Visual Studio installed) where they can run WinDBG. Once he started this tool he attached it to the process of sample application that was throwing unhandled exceptions. With a few commands he was able to find out the exception message and the reason for failure. With the same tool Ingo was able to find out the reason for unexpected application exit by attaching breakpoint at the end of app’s process.
Ingo showed us also that remote debugging can be achieved with the WinDBG installed on developers machine and its console version – CDB – on client’s machine. After you configure the port for CDB you can access it from outside using WinDBG (option “Connect to remote session”).
Next, Ingo explained what to do when WinDBG and CDB are also not available on the production machine. He proved that we can find the same error as in the first part by studying the memory dump created for that application. To get the memory dump we can ask the client to create it manually using a simple program (Adplus) or OS built-in functionality (only on Vista) immediately after the error occurs. Then, all we need to do is load the dump into WinDBG (option “Open crush dump”) on the developer’s machine and examine it using the same commands as in the first case.
Finally, Ingo presented simple program GFlags for Windows registry keys modifications that would allow launching CMD/WinDBG immediately after specified process is started and attaching the debugger to this process. This can be handy when an error does not occur regularly and it’s not easy to reproduce. He warned us that you have to be very careful when using that tool and change system’s default settings only if you’re absolutely sure what you’re doing. Registry modifications can cause a lot of damage to your OS if the are not done correctly.
To sum up - the pase of presentation was high so it was not possible to learn all the commands that Ingo was using. The goal of this session was to show to the audience what is possible if we use the presented tools and that it doesn't require much work once you learn how to use them.
The session itself came out to be the highlight of the conference. Mixture of Ingo’s knowledge and charm proved to be the formula for perfect presentation. I just wish Ingo had some more time so we could study the examples more carefully.
Some WinDBG commands used by Ingo:
.hh Debugger Help
sxe clr Break on all CLR Exceptions
sxi clr Ignore CLR Exceptions
sxn clr Notify on CLR Exception
.loadby sos mscorwks
Loads SOS Debugging Extension;
Enables use of following options:
!help
!printexception (!pe)
!clrstack
~ list threads
!threads list managed code threads
Some Useful links:
All presented debugg tools for Windows
Ingo's page at Thinktecture
Tess Fernandez blog “If broken it is, fix it you should”
Ingo also recommended book "Debugging .NET" by John Robins.
Wednesday, 4 March 2009
Syntax highlighter toolbar covers first code line
Solution:
Solution is quite simple: I decided to lift it up a bit by overwritting toolbar's style:
Place this style definition anywhere in
<head> and the result should be similar to that:Monday, 2 March 2009
Code snippets on blogger
Xml:
Java:
sample
class HelloWorld
{
public static void main(String args[])
{
System.out.println("Hello World!");
}
}
The usage is really simple. In addition all required CSS an JavaScript files are available online so you can refer them from your blogger page! Can't wait to submit some more code ;)
Quick Note: When using this on blogger you'll need to turn the bloggerMode on. You can do it in JS:
SyntaxHighlighter.config.bloggerMode = true;.
Sunday, 1 March 2009
PHP: Redirection fails after moving to new server
After the move it came out that some pages didn't work as expected i.e. some redirections were failing. The redirections were implemented using header function e.g.
header('Location: http://www.targetpage.com/');When I checked the php logs I found common error "Headers already sent". Don't want to explain here what does it mean - there's plenty of answers here ;) The only thing that made me wonder was why it was working on the old server. When I compared the php.ini files from both servers I found out that the new one was configured not to useoutput buffering. The temporary fix was enabling this by setting in php.ini:
output_buffer=On
This is not the cleanest solution and may affect application's performance but works immediately. The long-term solution is to ensure that your app is not sending any output before calling the
header method.
Subscribe to:
Posts (Atom)