• perkov

My open source project

Hello.

I want to share with you my open source project.

The purpose of my project is to demonstrate my visual filter builder WPF control in use. FilesFilter application allows you to filter your files by many parameters applying filtering expressions. Essentially my WPF user control builds LINQ binary tree lambda expressions to select a subset of items from a list. In terms of C sharp code it can be applied to lists of elements of any given classes. If you need such a filtering expression builder, you're welcome to use my component in your projects. Any changes and improvements would be also very much appreciated.

Please, take a look at this:
https://code.google.com/p/filesfilter/

I think you may find it useful and interesting.
driving
  • larryv

(no subject)

I was always impressed by the bing.com image search AJAX. The bit where where more images load as you scroll down the page. Is there an AJAX control in .Net that can do that sort of thing using an update panel and a repeater?
driving
  • larryv

.Net custom control help

I want to use a SEO friendly link button on my page. Mind you i am sure that the page is really not all that accessible as the page I am linking to will still have javascript running on it - but thats besides the point. The correct way to do this would be to put the href thats generated by a link button into the onclick event and return void or false or whatever. And then have a SEO / accessibility friendly URL in the HREF. This seems to be what Google recommends and t seems to make sense to me.

I found this nifty .CS file here - http://files.codes-sources.com/fichier.aspx?id=44402&f=CrawlableLinkButton.cs. Essentially it inherits a linkbutton and adds a NavigateUrl parameter to it so that I can put whatever href I want in there. Awesome. Just what I was looking for.

Trouble is I have no idea how to include it in my code. I feel ashamed for admitting my ignorance here. I can register a control at the top of the page, but I think I need to either use a .dll (like I do with things like the AjaxToolKit) and then reference the assembly name and the namespace. Or I can register an ascx control, and set the tagname and the src. How do I reference this .cs file in the aspx page the way this dude does? I feel like I am missing something so obvious.

For example:
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

And:
<%@ Register TagPrefix="uc1" TagName="videocontrol" src="~/controls/videocontrol.ascx" %>

Assume for the moment I have the file stored in ~/controls/CrawlableLinkButton.cs, and I want to refer to his control as he does:
<cs:CrawlableLinkButton runat="server" CommandName="Select" Text="Select" NavigateUrl='<%# "temp.aspx?PID=" + Eval("id").ToString() %>' />

Any help here? I am a bit thick and getting more and more tired. I know deep down I am a good .Net developer, honest - so why can I not figure out the little things?
vshleme

Socket Programming

Hi,

I have created a socket connection as described on MDSN web site:
client: http://msdn.microsoft.com/en-us/library/bew39x2a(v=VS.85).aspx
server: http://msdn.microsoft.com/en-us/library/fx6588te(v=VS.85).aspx

It works fine. Events here are:
1) Client sends request
2) Server receives it
3) Server sends response
4) Server shutdown the socket
5) Client receives response

Then, I know, that between 2) an 3) might be a time gap. I want to send few interim responses like:
2a) Server sends response: Still working on your request.
The problem here is that I cannot send a response without shutting down the socket, but as I shout it down I am not able to send neither 3) nor another 2a)

Is it possible for client to get response without closing the socket connection? Something like .flush()?

corresponding piece of code under cut...Collapse )
  • simbab

Marshaling a union with a pointer

I am using Mono on Linux, and want to marshal the following unmanaged structure to a native one:


int 	type
union {
   guint32   u
   gint32   i
   gboolean   b
   gdouble   d
   gchar *   s
} 	value


According to Mono's excellent page on native-library interop, the way to deal with unions is to use StructLayoutAttribute with LayoutKind.Explicit and specify a FieldOffsetAttribute that is the same for all union members. So you might do something similar to this:


[StructLayout(LayoutKind.Explicit)]
public struct Rpc {
 [FieldOffset(0)] public int type;
 [FieldOffset(4)] public uint value_u;
 [FieldOffset(4)] public int value_i;
 [FieldOffset(4)] public bool value_b;
 [FieldOffset(4)] public double value_d;
 [FieldOffset(4)] public string value_s;
}


The problem however is this, the Mono runtime crashes when this code is run, complaining that: "you cannot have a reference field that is the same offset as another field" in an [ExplicitLayout] structure. I assume this is referring to the last member of the union which is a pointer. Thing is, I'm not sure how else to do this.

I thought about just having a "public object value;" member of the structure, and then casting this as appropriate in managed code, but the runtime apparently cannot marshal to a vanilla object this way.

Thoughts?
driving
  • larryv

Help with Error Module

I posted my question here originally last night but I figured I might as well reach out to the LJ crowd to see if anyone here has answers.

I implemented an error handling httpmodule similar to the one described here:

http://wiki.asp.net/page.aspx/917/neater-handling-of-exceptions/

If I run the application locally through the Visual Studio Development Server everything works as expected. If I run it through IIS with a wildcard mapping set up in the ISAPI extensions to go to the dotnet dll, and I have the checkbox to "Verify that the file exists" turned off - it works as expected for .aspx files but not for anything else.

In my web.config I have the following:

    <customErrors mode="RemoteOnly" defaultRedirect="~/_errors/500-server-error.aspx">
      <error statusCode="403" redirect="~/_errors/403-forbidden.aspx"/>
      <error statusCode="404" redirect="~/_errors/404-page-not-found.aspx"/>
    </customErrors>
    <httpModules>
      <add name="HttpErrorModule" type="tmpw.applicationname.App_Code.HttpErrorModule, applicationname" />
    </httpModules>

And under IIS errors I have it set up so that 404 errors go to the same 404 URL in web.config.

The behavior I am expecting is that if I go to appliationname.com/xyz.html and the page does not exist, it is kicked into the error handling code. The error handling module is set up to log the event and I should get an email. And even failing that the 404 page should still load in IIS settings.

The error handling code does kick in if I go to appliationname.com/xyz.aspx - a page which does not exist. But for any other file extension the 404 processing is handled by IIS. So any error logging I am doing in the HTTPModule is not getting called.

When I run an HTML page it does get processed to some extent. The code I have in Application_BeginRequest in global.asax does get called. But at the end of that block it stops processing.

The application I am working on is a migration of older code. I want to be alerted to every 404 that comes through the application so that I can see if we missed anything. I could potentially get this sort of information from the IIS logs or I could try to move the error logging to the code behind of the error pages instead of the HTTPModule. But I shouldn't have to should I? Why won't it process HTML? And why does it work when when running the application through Visual Studio but bot when I run it through IIS?

Any help would be appreciated.
cymraeg: challenges

Graphics.DrawString

I'm getting very frustrated with trying to generate text on images in .Net. Whilst the process to do so is pretty simple, the results one gets simply aren't that satisfactory.

I have the following code (really very simple, as you can see) in an IHttpHandler, which I call in a loop to iterate through some of the fonts on my system as a proof-of-concept:

Far more detail here, behind a cut so as not to confuse / irritate all my non-techy friendsCollapse )
  • Current Mood
    confused confused
driving
  • larryv

Custom validator in a custom control

I am programming a control that will have a custom validator in it. The control will be called on a page inside a repeater. I was hoping to have client validation on this custom validator. If I do this, when the page is rendered, won't the javascript function names be repeated and won't that cause an error? Is there a way around this and does anyone have any example code I can look at?

(no subject)

Intro


For a long time I was wandering how easy and comfortable to work with smart tags. Actually I didn’t knew how it was called officially, but anyway I thought (and still think) that this feature is awesome! Some time ago I’ve started to develop my own components and also spend more time tuning user’s interface. I found that it’s very time consuming and boring to setup necessary properties from the Property view. Its okay to setup few controls in little program, but when you have over 30 complicated views with custom components – you quickly became in a sad mood. So I decide found out how to create for my controls those pretty little triangles on the top right corner at the most standard components.

I found articles, books; I performed several tests and finally made what I want. And you know, it’s really helps me with development! Time saving in action! )

Now I’d like to share how to make it from the very beginning.

For all described actions below I used VS2008, ReSharper5

Read more...Collapse )