Back again ?!?
Just wanted to share link to this unbelievably great presentation
about Office 2007 user interface and UI in general. Worth every second.
Saturday, March 15, 2008
Wednesday, October 17, 2007
We have been using XLS file for managing localization string in our projects. With some custom macro, we have generated resource files from worksheets (which corresponded to each form in our ASP.NET application). Quite comfortable for translators, but when using in distributed environment with more programmers sharing the work through SVN repos, conflicts often appeared.
So we need to split this Excel workbook into separate files (one for each worksheet), keeping macros intact.
Saving files according to sheets name was quite easy (found it here).
Second problem was removing redundant worksheets from all files. So I have written something like this (must have all files opened).
So we need to split this Excel workbook into separate files (one for each worksheet), keeping macros intact.
Saving files according to sheets name was quite easy (found it here).
Sub SplitSheets()
Dim W As Worksheet
For Each W In Worksheets
W.SaveAs ActiveWorkbook.PATH & "/" & W.Name
Next W
End Sub
Second problem was removing redundant worksheets from all files. So I have written something like this (must have all files opened).
Sub RemoveSheetsFromWB()
Dim W As Worksheet
Dim B As Workbook
For Each B In Workbooks
For Each W In B.Worksheets
If W.Name & ".xls" <> B.Name Then
Application.DisplayAlerts = False
W.Delete
Application.DisplayAlerts = True
End If
If B.Worksheets.Count = 1 Then Exit For
Next W
Next B
End Sub
Tuesday, September 18, 2007
Back again ... removing LINQ
Sorry for being our for quite a long time, but I broke up with my girlfriend and had too much work.
Last week I was facing a problem - removing Microsoft(r) LINQ from our project's solution. We didn't wanted to use it anymore. After the code was rewritten and all references removed, we still weren't able to load the solution on fresh new computer.
After some digging, I found out, that in our .vbproj files, we still have something like:
So I removed this line, the solution was loaded into our VS.NET 2005 (SP 1), but could not compile. Again, after some digging (this line seems quit undocummented), I tried to replace this line with the following one (contained in normal .vbproj files).
Ok, finally it worked. But on our old machines after LINQ uninstallation, the WebDev server started to crash (immediately after starting debug mode) with some out of memory exception. Every second try worked. Reinstalling Visual Studio solved this issue(I was amazed that the reinstall of VS took half less time then reinstall of its service pack).
Another problem appeared, when the VS hit a breakpoint - the whole application disappeared, leaving simple message in the Windows event log (sry for czech language):
Unregistering and reregistering the regmon.dll helped:
Sorry for being quite brief today, had to work :).
Last week I was facing a problem - removing Microsoft(r) LINQ from our project's solution. We didn't wanted to use it anymore. After the code was rewritten and all references removed, we still weren't able to load the solution on fresh new computer.
After some digging, I found out, that in our .vbproj files, we still have something like:
<Import Project="$(ProgramFiles)\LINQ Preview
\Misc\Microsoft.VisualBasic.LINQ.targets" />
So I removed this line, the solution was loaded into our VS.NET 2005 (SP 1), but could not compile. Again, after some digging (this line seems quit undocummented), I tried to replace this line with the following one (contained in normal .vbproj files).
<Import Project="$(MSBuildBinPath)
\Microsoft.VisualBasic.targets" />
Ok, finally it worked. But on our old machines after LINQ uninstallation, the WebDev server started to crash (immediately after starting debug mode) with some out of memory exception. Every second try worked. Reinstalling Visual Studio solved this issue(I was amazed that the reinstall of VS took half less time then reinstall of its service pack).
Another problem appeared, when the VS hit a breakpoint - the whole application disappeared, leaving simple message in the Windows event log (sry for czech language):
.NET Runtime version 2.0.50727.832
- Závažná chyba spouštěcího modulu (7A2B8F82) (0)
Unregistering and reregistering the regmon.dll helped:
regsvr32 urlmon
regsvr32 /u urlmon.dll
Sorry for being quite brief today, had to work :).
Sunday, June 24, 2007
Finished my cursors
Today I have finished my first mouse cursor set. I had a little bit more time, so I made version for windows (posted it here) and for X11 and the other systems (posted it here).So I suppose, that next few days I will look at these sites, whether the users will like it or no. I have tested some preliminary version of these cursors for a few weeks on my notebook and they seems (for me) quite usable. Hour ago I noticed, that they look a bit worse on my CRT (then on my both TFTs), I'll give it a day and see, whether it's a problem or not.
While designing this cursor set I have stated some rules for me. Feel free to comment them on.
1. No colors in cursors - only black, white and shades of gray. I think, that users have on their desktops many various themes, and are using computers for many purposes (incl. computer graphics), so the cursors should be color-neutral (not to change the color feeling of the image).
2. 3D effect (and quite high contrast) will be fine, because it will look like not being a part of the UI (user interface) and the user can notice the cursors position sooner.
3. Minimum of animation - animation can lower users vigilance, so I used animation only when I wanted to attract the user's attention - for "busy" cursors and for "action running in background" cursor.
4. You can be original, but the users should immediately recognize the meaning of the current cursor.
5. Try to test the cursors for a quite long time. Some shapes sooner or later can start to bore you in an unbelievable way.
Project website can be found here.
Thursday, June 21, 2007
ASP.NET GridView Locale Issues
Last month we had strange problems using ASP.NET GridView component (accompanied with ObjectDataSource). String fields were O.K., but when creating or updating double field, exceptions arised.
The problem was, that GridView in this configuration (didn't tried with different type of DataSource), ignored locale settings, so typing numeric values with comma (or dash if you want) instead of period (point) produced exception. Using period caused this problem (when editing stored values, which where in business automatically converted to commas) also.
One quick solution was to switch the whole thread to the US locale, but that later caused some interferences with different parts of the code.
Luckily, I have somewhere (sorry, couldn't remember where) found the way to customize the conversion of data in GridView. It goes as follows (in VB.NET):
Simply create an ItemInserting event handler for the GridView and for all problematic values make the conversion as you need.
That's all folks.
The problem was, that GridView in this configuration (didn't tried with different type of DataSource), ignored locale settings, so typing numeric values with comma (or dash if you want) instead of period (point) produced exception. Using period caused this problem (when editing stored values, which where in business automatically converted to commas) also.
One quick solution was to switch the whole thread to the US locale, but that later caused some interferences with different parts of the code.
Luckily, I have somewhere (sorry, couldn't remember where) found the way to customize the conversion of data in GridView. It goes as follows (in VB.NET):
Simply create an ItemInserting event handler for the GridView and for all problematic values make the conversion as you need.
Protected Sub GridView_ItemInserting
(ByVal sender As Object,
ByVal e As System.Web.UI.WebControls.DetailsViewInsertEventArgs
)
Dim myconverter As System.ComponentModel.TypeConverter =
System.ComponentModel.TypeDescriptor.GetConverter(
GetType(Double))
e.Values("FieldName") =
myconverter.ConvertFromString(
CType(e.Values("FieldName"), String))
End Sub
That's all folks.
Wednesday, May 30, 2007
ASP.NET File Upload
Yesterday I had some problems with uploading files in ASP.NET. I've did this maybe thousand times before in PHP, CGI and some other systems, but now, it simply didn't worked.
I have used the classical FileUpload control, selected the file, pushed the button, but after Postback, the Request.Files variable has been entirely clean.
Form encoding was fine, generated HTML code looked ok. After some digging I found the ground of this problem. The FileUpload control has been placed in AJAX Update panel. After clicking the upload button, the panel (not the browser itself) tryied to send this request. And probably didn't knew how to send the file.
Placing the FileUpload outside of the UpdatePanel solved this issue. There is some kind of a workaround in this forum, but I hadn't enough time to test it. Maybe next time.
I have used the classical FileUpload control, selected the file, pushed the button, but after Postback, the Request.Files variable has been entirely clean.
Form encoding was fine, generated HTML code looked ok. After some digging I found the ground of this problem. The FileUpload control has been placed in AJAX Update panel. After clicking the upload button, the panel (not the browser itself) tryied to send this request. And probably didn't knew how to send the file.
Placing the FileUpload outside of the UpdatePanel solved this issue. There is some kind of a workaround in this forum, but I hadn't enough time to test it. Maybe next time.
Sunday, May 20, 2007
RCP Keybinding Issues
Currently I'm developing some RCP application (using Eclipse 3.2 and 3.3M6) and I noticed, that some keyboard shortcuts aren't working well.
By the way - sometimes it seems to me, that there must exists one secret URL containing complete and actual RCP documentation, which every developer - except me - knows.
Back to the problem - we were using older way (deprecated, but still functional) to specify key bindings in plugin.xml
It works fine, but not for keys, that are normaly used by RCP (common shortcuts like Ctrl+N, Ctrl+S, etc.). This combinations needs to override (of course, you can implement the corresponding actions, but sometimes you may don't want to do that) the default RCP setting, but how?
The way I found is as follows:
1. Create some context for your app in plugin.xml:
2. Move problematic keybindings into this context (by specifying contextId in the keyBinding element):
3. Active this context at run-time somewhere in the app init:
That's all folks. I suppose the command you have specified in commandId already exists (if not, create it). The same stands for action binded to this command.
Actually, not all actions are always specified in plugin.xml, but are created at runtime. Wiring this action (to command and its keybinding) through following methods worked for me.
Hope this post might have helped someone. The presented solution isn't very clean, but functional for me. If you have something better, please feel free to post it here.
By the way - sometimes it seems to me, that there must exists one secret URL containing complete and actual RCP documentation, which every developer - except me - knows.
Back to the problem - we were using older way (deprecated, but still functional) to specify key bindings in plugin.xml
<keyBinding
commandId="yournamespace.command.newempty"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
keySequence="Ctrl+N" />
It works fine, but not for keys, that are normaly used by RCP (common shortcuts like Ctrl+N, Ctrl+S, etc.). This combinations needs to override (of course, you can implement the corresponding actions, but sometimes you may don't want to do that) the default RCP setting, but how?
The way I found is as follows:
1. Create some context for your app in plugin.xml:
<extension point="org.eclipse.ui.contexts">
<context id="yournamespace.context" name="Default Context"
parentid="org.eclipse.ui.contexts.window"
description="..."></extension>
2. Move problematic keybindings into this context (by specifying contextId in the keyBinding element):
<keyBinding
commandId="yournamespace.command.newempty"
keyConfigurationId="org.eclipse.ui.defaultAcceleratorConfiguration"
contextId="yournamespace.context"
keySequence="Ctrl+N" />
3. Active this context at run-time somewhere in the app init:
PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
((IContextService) PlatformUI.getWorkbench()
.getService(IContextService.class))
.activateContext("yournamespace.context");
}
});
That's all folks. I suppose the command you have specified in commandId already exists (if not, create it). The same stands for action binded to this command.
Actually, not all actions are always specified in plugin.xml, but are created at runtime. Wiring this action (to command and its keybinding) through following methods worked for me.
undoAction.setId("yournamespace.action.undo");
undoAction.setActionDefinitionId("yournamespace.command.undo");
this.getActionBarConfigurer().registerGlobalAction(undoAction);
Hope this post might have helped someone. The presented solution isn't very clean, but functional for me. If you have something better, please feel free to post it here.
Subscribe to:
Posts (Atom)