Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
B

Bjorn T J M Spruit

@Bjorn T J M Spruit
About
Posts
23
Topics
5
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    And so the elitists decide whether they feel like helping or not. Mostly deciding whether they deem it worthy of their time and effort. Helping isn't performing an act in furthering yourself, it's an act of furthering others. A concept, it seems, hard to grasp for some. And yes, I'm not a novice. And yes, my question is valid and I'll not have that debated. So in the interest of furthering the one that asked a valid question, I gladly refer to the original post. Any insights, other than the ones given, are welcome.

    C# question

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    I see your point. Though, you'd get to the same point when a developer finds out, that the process it returns, is the one the developer is debugging or has built. It's much more effective if a developer is forced to assume responsibility for oneself,with the shaming conclusion that the developer in question needs to kick one's own behind. My point being, give what is asked for and engage in conversation as to what the context is. It'll result in a more social event that way. And as to answer your question, I think that what the user is going to see, is that they still have something like Ultra Edit/Notepad/etc... is still holding the file and they forgot to close the text editor before testing/running their application. If the question is:"Is it likely to be something silly?", the answer is most likely yes. In the end, however, that's besides the point. I'd prefer they'd find out for themselves in an easy way, instead of them having to bother me. I'm all for self-reliance. ;)

    C# question

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    Fair enough. And it's something I see more often. But it's not up to others to decide the validity of the question. A question was asked, why not answer it and then ask why someone is asking it, if one is truly interested? I can understand why some would feel frustrated with the ivory tower some developers are hiding in. The relevance of a question can only questioned by the one asking it, imo.

    C# question

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    You'll have to excuse my snappy reaction before, but I want to shoot down a spin-off debate on this topic on 'the validity of it all' before it gets a chance to start. I reckon you're right on the earlier links however. Unless someone has some knowledge on my WMI + C# question I posted as a reaction to said post. Fingers crossed.

    C# question

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    I'm very much inclined to agree with you. My searches have led me to this page already. I'm starting to believe I'll have to delve in to this in order to get what I need. Perhaps WMI offeres an entry point to my dilemma? I've only quickly glanced at C# in combination with WMI. I've done WMI with VB6 before, but don't know how to go about it in C#...

    C# question

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    Of course... there's always one that can't resist... Fine, I'll indulge you: I want to give someone the ability to see which process is locking a textfile. There's a reason they want to know and I'm not inclined to debate their need to know. Honestly... I don't care why they want to know. They know not to go shutting down running processes willynilly, so that's not a concern. Actually, whatever it is they want to do, from the point where they know which process is locking the file, isn't my concern. What IS my concern, is to provide the very basic functionality of showing them which process is locking the file. Lets hope this rant discourages anybody else that feels the need to debate the question or the validity of it. Unbelievable that you didn't pick up the 'hint': **The validity of the question is not up for debate** Alrighty ?

    C# question

  • Get the process-name that locked the file
    B Bjorn T J M Spruit

    Situation: There's a text-file, say mytextfile.txt, and it's opened by a process. Lets say that it's unknown which process locked the file. How would I go about getting the process that locked said file. So simply put, I want to get the process-name of the process that's locking mytextfile.txt. I've seen this question posted all over the net, without people actually giving good answers. What I see a lot, is people debating the validity of the question. :doh: The validity of the question is not up for debate, the question and the answer to it, are. So please, if you have any concrete advice or code samples, share them with me. If you want to debate why I'm asking this question or the validity of my question, don't bother. Because I'm certain there's a world of developers out there who would love to know the answer as well.

    C# question

  • RegEx to match formula groups [modified]
    B Bjorn T J M Spruit

    Thank you for your advise. The application is a good one and I would certainly advise it to anyone who's going to work with regular expressions. Limited, controlled recursions of a finite count, can be tackled with regular expressions, though it makes the regular expressions cumbersome. Infinite and intuitive recursions with regular expressions can't be done in .NET as of yet. http://badassery.blogspot.com/2006/03/regex-recursion-without-balancing.html[^] I'm still investigating this and will post my findings if there's anything interesting to report.

    C# regex question data-structures help tutorial

  • RegEx to match formula groups [modified]
    B Bjorn T J M Spruit

    Hmmm, not very friendly then. :wtf: No worries, I'm always optimistic and don't mind a 'challenge' when I come across one. I'll give you a more extended LaTeX formula example:

    \left ( Availability~ \right ) \times \left ( Performance~ \right ) \times \left ( Quality~ \right ) \times 100 ~ =~ \left (\frac{ I}{II} \right ) \times \left (\frac{ III}{ \left ( IV \times I \right ) } \right ) \times \left (\frac{ V}{III} \right ) \times 100

    This is an example from how it's actually being used at this very moment. I'm not sure what more information you need to clarify the "why"? "Nope" isn't a very articulate way of asking me for the information you require to clarify this to you. So please let me know what it is you require of me other than what I've told you in order to clarify the "why" more accurately. Just to recap, I need to objectify a LaTeX formula. All I need, is a regex that is able to work with nested and multi-dimensional formulas as explained in the previous posts. The reason I'm exploring this, is because I've been commented upon that I didn't use tokenization by regex to get the formula elements. If there's anybody who knows how to tokenize a string that is a formula with nested and/or multi-dimensional elements, please let me know, otherwise I'll set this aside as:"Not a viable option, can't be done within a reasonable amount of time."

    modified on Wednesday, November 4, 2009 12:25 PM

    C# regex question data-structures help tutorial

  • RegEx to match formula groups [modified]
    B Bjorn T J M Spruit

    The purpose is to create an object tree of the formula. The examples may be found in my previous post. These are simplified examples, mind you, but they are representative of the challenge. Simply put: Parent object is Formula. Formula has a collection of child objects of the base type FormulaItem. FormulaItem[0] could be of type SubFormula (\left (...\right )). FormulaItem[0], being of the type SubFormula, has one collection of child objects of the base type FormulaItem. FormulaItem[0].FormulaItem[0] could be of type Fracture (\frac{...}). FormulaItem[0].FormulaItem[0], being of the type Fracture, has two collections (top-part and bottom-part) of the base type FormulaItem. Etc... I hope to have clarified the "why" in this.

    C# regex question data-structures help tutorial

  • RegEx to match formula groups [modified]
    B Bjorn T J M Spruit

    Forgive me if my question is unclear, I'll do my best to clarify it as best as I can. What I'm trying to do is "Tokenize" nested formula's by using RegEx. Consider the following formula in LaTeX:

    LaTeX Example 1: text before \frac{ \frac{ SubPart 1 }{ SubPart 2 } }{ Part 2 } text after

    What I need is a RegEx that can tokenize this LaTeX formula to output the following tokenlist: Token[0] = text before Token[1] = \frac{ \frac{ SubPart 1 }{ SubPart 2 } }{ Part 2 } Token[2] = text after Looking at Token[1], it has a nested fracture (\frac{...}) in its top-part. That's the way I need it to be to build an object tree. In a sense, the fracture in the top-part is a child to it's parent fracture. Consider the following formula in LaTeX:

    LaTeX Example 2: text before \frac{ \left ( SubPart 1 + SubPart 2 \ right ) }{ Part 2 } text after

    This should result in the following tokenlist: Token[0] = text before Token[1] = \frac{ \left ( SubPart 1 + SubPart 2 \ right ) }{ Part 2 } Token[2] = text after Again, looking at Token[1], it has a nested subformula in it. In this case, the subformula is a child, associated to the toppart of the fracture, to the fracture object. Final example (and then I assume you catch my drift):

    text before \left ( \frac{ SubPart 1 }{ SubPart 2 } \ right ) + X text after

    This should result in the following tokenlist: Token[0] = text before Token[1] = \left ( \frac{ SubPart 1 }{ SubPart 2 } \ right ) Token[2] = + X text after The nested-/sub-formulas will be processed when the parent formula is being constructed, so we need not worry about that part of it here. What I need, is a RegEx that can handle formula dimensions to the nth degree. Right now I do this by stepping through the string and seeing if I have a match in the sub-string for a particular item. When found, I add 1 to a level counter and run an internal loop to find the final closing "}" that brings the level back to 0; This works fine, but I've been commented upon by using this method and not using tokens, begotten with the use of RegEx. If anyone has a suggestion of how I should construct my regex, then please let me know. I've gotten as far as: Fracture : (\\frac{[\W].*?((}\s)|(}$)))* Subformula : (\\left \([\W].*?\\right \))* But as you would guess, this fails miserably when having to deal with nested or multidimensional formulas. Any help and/or insight on the matter would be greatl

    C# regex question data-structures help tutorial

  • Text blurring using Graphics.Drawstring
    B Bjorn T J M Spruit

    The plot thickens... I was somewhat bored and still not satisfied with how the Graphics.DrawString() was working for me. So I went on a Google hunt for some answers. After looking around I came to a forum where a user had somewhat similar problems. There he had linked a convo he had with a Microsoft MVP. For more information please check this link: http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/362ab21b-1dc4-4140-a39a-a366beea9e40[^] Quote: "They couldn't fix the bugz in Graphics.DrawString() because way too much .NET 1.x code depended on its quirks. That's what Application.SetCompatibleTextRenderingDefault() is all about too. If you really want to use GDI+, you'll have to find the workarounds for the bugs yourself. Right now, using Graphics.DrawString() in a Paint event is a bug." Quote: "Graphics.DrawString() is too broken to be usable. It got replaced by TextRenderer.DrawText()." To simplify things: If you care for precision work, in particular with text rendering, then use the old GDI. GDI+ is bugged and unusable for precision work. If you don't care for precision work and you don't use text rendering (or very little of it or the quality isn't important), then use the new GDI+.

    C# question graphics css help tutorial

  • Text blurring using Graphics.Drawstring
    B Bjorn T J M Spruit

    Not a problem, your thoughts in this have been insightful. ;)

    C# question graphics css help tutorial

  • Text blurring using Graphics.Drawstring
    B Bjorn T J M Spruit

    True, that's what they say. I suggest you try it out and see if there's Glyph manipulation. Set the TextRenderingHint property of your Graphics object:

    g.TextRenderingHint = TextRenderingHint.AntiAlias;
    

    See how it's displayed. Then remove it and compare the two. Even though it's already visibly apparent, I would like to urge you to print the two results and compare them. In my humble opinion, the AntiAlias touches the Glyph. But I could be mistaken. If I am mistaken and somehow I seem to have missed what the default does as opposed to what AntiAlias does, then please inform me. Don't forget to add an informative link, not just for myself, but for others coming across this problem. Thanks in advance. Edit: I indeed stand corrected. Here's a link explaining how it works: http://msdn.microsoft.com/en-us/library/ms534404%28VS.85%29.aspx By setting the TextRenderingHint to AntiAlias, you kill the default corrective Glyph hinting the Graphics object does by itself. Quote: "TextRenderingHintSystemDefault Specifies that a character is drawn using the currently selected system font smoothing mode (also called a rendering hint)." Quote: "TextRenderingHintAntiAlias Specifies that a character is drawn using its antialiased glyph bitmap and no hinting. Stem width differences may be noticeable because hinting is turned off." Thank you Covean for this insight

    modified on Thursday, October 22, 2009 9:07 AM

    C# question graphics css help tutorial

  • Text blurring using Graphics.Drawstring
    B Bjorn T J M Spruit

    Here's the solution as I can tell it at this point. Dropping the following code solved the bluring for me:

        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.TextRenderingHint = TextRenderingHint.AntiAlias;
        g.InterpolationMode = InterpolationMode.HighQualityBilinear;
    

    From what I understood by reading Microsoft supplied information and the experiences from other developers, it's the Glyph hinting that causes the problem. I increased the DPI of the originating Bitmap and dropped the hinting. Problem solved. Some positioning adjustments are required, but nothing I can't fix. Hope this will help others as well.

    C# question graphics css help tutorial

  • how to create multiple connections in a client application
    B Bjorn T J M Spruit

    Can you be more specific as to how you want to connect to a machine ? Is it a database connection you wish to establish ?

    C# help tutorial

  • Text blurring using Graphics.Drawstring
    B Bjorn T J M Spruit

    I'm writing strings at a pre-determined location to a bitmap. Though, it seems that if the location isn't "snapped to the grid", blurring occurs. Simple example:

    public Bitmap WriteToBitmap(Bitmap bitmapToWriteTo, float X\_Pos, float Y\_Pos)
    {
        Graphics g = Graphics.FromImage(bitmapToWriteTo);
        g.SmoothingMode = SmoothingMode.AntiAlias;
        g.TextRenderingHint = TextRenderingHint.AntiAlias;
        g.InterpolationMode = InterpolationMode.HighQualityBilinear;
    
        g.DrawString(this.text, this.font, new SolidBrush(Color.Black), X\_Pos, Y\_Pos, this.stringFormat);
    
        return bitmapToWriteTo;
    }
    

    Nothing else is being done to the bitmap object or any of the other objects involved. So you may consider the code above as being used as is. The problem is, however, that using it like this, causes blurring in the text when drawn. There is a solution to stop the blurring and that is by changing the TextRenderingHint:

        g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
    

    Now, this causes the text being drawn to be "snapped to a grid". However, this messes up my positioning, making it look chaotic. My question is this, how can I get the result of TextRenderingHint.AntiAliasGridFit, without losing the positioning. And, to what "grid" is the text being snapped to and am I able to manipulate it ?

    C# question graphics css help tutorial

  • Dynamic Controls requires Dynamic event handling? [modified]
    B Bjorn T J M Spruit

    You guys are AWESOME... Total team effort. I thank M-Hall and Twofaced for their assistance.

    Visual Basic question csharp asp-net help

  • Dynamic Controls requires Dynamic event handling? [modified]
    B Bjorn T J M Spruit

    That works like a charm, except... How do I set the dynamic txtCalendar.text if it's not globally declared? How can I find the dynamicaly declared textbox and set the text value?

    Code so far:

    Public Class ListReportParametersControl Inherits System.Web.UI.UserControl Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim intCounter1 As Integer Dim strParamValue As String Dim arrSessionParams() As String = Session("ReportParams").ToString.Split(",") Dim arrTempTypeNValue() As String For intCounter1 = 0 To UBound(arrSessionParams) arrTempTypeNValue = arrSessionParams(intCounter1).ToString.Split(":") Select Case arrTempTypeNValue(0) Case "CALENDAR" SetCalendar(arrTempTypeNValue(1)) ReDim Preserve arrControls(intCounter1) arrControls(intCounter1) = arrTempTypeNValue(1).ToString End Select Next End Sub Public Sub SetCalendar(ByVal CalendarID As String) Dim lblCalendar As New Label lblCalendar.Font.Name = "Verdana" lblCalendar.Font.Size = FontUnit.Parse("10") lblCalendar.ID = "Label" & CalendarID lblCalendar.Text = CalendarID Dim myCalendar As New Calendar myCalendar.Font.Name = "Verdana" myCalendar.Font.Size = FontUnit.Parse("10") myCalendar.ID = CalendarID myCalendar.EnableViewState = True myCalendar.TodaysDate = System.DateTime.Today myCalendar.VisibleDate = System.DateTime.Today myCalendar.TitleFormat = TitleFormat.MonthYear myCalendar.SelectionMode = CalendarSelectionMode.Day myCalendar.NextPrevFormat = NextPrevFormat.CustomText myCalendar.TodayDayStyle.BackColor = System.Drawing.Color.Red myCalendar.OtherMonthDayStyle.BackColor = System.Drawing.Color.FromName("LightGray") AddHandler myCalendar.SelectionChanged, AddressOf myCalendarSelectionChanged Dim txtCalendar As New TextBox txtCalendar.Font.Name = "Verdana" txtCalendar.Font.Size = FontUnit.Parse("10") txtCalendar.ID = "Textbox" & CalendarID 'txtCalendar.Text = myCalendar.UniqueID.ToString Me.Controls.Add(lblCalendar) Me.Controls.Add(myCalendar) Me.Controls.Add(txtCalendar) End Sub Public Sub myCalendarSelectionChanged(ByVal sender As Object,

    Visual Basic question csharp asp-net help

  • Dynamic Controls requires Dynamic event handling? [modified]
    B Bjorn T J M Spruit

    If I use a withevents declaration, I end up with only one calendar on the resulting page. Seems as though it overwrites the first one. Perhaps because it uses a global identifier within the control instead of one contained in a sub?

    Visual Basic question csharp asp-net help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups