Thursday, August 30, 2012

.NET Regex Tester

I came across a really good Regex tester for C# so I thought I'd share it

http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx

Yes, this one actually gives you a regex expression back that is C# compatible.

Keep it simple stupid

I love WPF. I write love songs about it. It also happens to be my main area of expertise when it comes to .NET framework but there are certain things about WPF that drove me nuts when they WPF-tized a former winforms control.

RichTextBox is one of them.

I needed a very simple textbox that can programmatically highlight a portion of my text given an index and a length. Now in Winforms, I can simply call the Select function on the text and change the selection color of it.
rtb.Select(startindex, endindex);  
rtb.SelectionColor = Color.Red;

Boom, two lines. Job done. How simple and elegant is that? You would think that you can get away doing the same thing in WPF but instead, they have to f$*% it up so hard that they make me write this monstrosity of a code:

 private static TextPointer GetTextPointAt(TextPointer from, int pos)  
 {  
     TextPointer ret = from;  
     int i = 0;  
     while ((i < pos) && (ret != null))  
     {  
       if ((ret.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.Text) || (ret.GetPointerContext(LogicalDirection.Backward) == TextPointerContext.None))  
         i++;  
       if (ret.GetPositionAtOffset(1, LogicalDirection.Forward) == null)  
         return ret;  
       ret = ret.GetPositionAtOffset(1, LogicalDirection.Forward);  
     }  
     return ret;  
 }  
 internal string Select(RichTextBox rtb, int offset, int length, Color color)  
 {  
     // Get text selection:  
     TextSelection textRange = rtb.Selection;  
     // Get text starting point:  
     TextPointer start = rtb.Document.ContentStart;  
     // Get begin and end requested:  
     TextPointer startPos = GetTextPointAt(start, offset);  
     TextPointer endPos = GetTextPointAt(start, offset + length);  
     // New selection of text:  
     textRange.Select(startPos, endPos);  
     // Apply property to the selection:  
     textRange.ApplyPropertyValue(TextElement.BackgroundProperty, new SolidColorBrush(color));  
     // Return selection text:  
     return rtb.Selection.Text;  
 }  


WHY SHOULD I HAVE TO GO THROUGH SO MUCH TROUBLE FOR SOMETHING SEEMINGLY SIMPLE? Wtf is the reason that I have to deal with entirely new paradigms like Textpointers for such a simple feature? Oh M$FT wanted to make the control more robust and powerful? Well what the hell is the problem with making a new control then? Call it Even-More-Rich-Text-Box I don't f**king care. And if I really wanted a powerful texteditor, I'd be using Avalonedit anyways. Leave my Richtextbox alone.

Sure, there is an option to include a element host and just use the Winforms version of it, but the richtextbox I was including was inside a WPF host control running as a Winforms application. Going Winforms-WPF-Winforms (is this even possible?) would be the last retarded thing I do before I cut my throat. And no, I didn't have a choice to build the application in WPF to begin with.

Look, my point is this. It's great that Microsoft was trying to provide the users with more features, but I don't want to have to use a Swiss army knife to carve a chicken. Textbox lacks the feature I need, other powerful editors like AvalonEdit and ScintillaNET is an overkill. RichTextBox is just the right tool I need, except they made it much more complicated than needed for typical use.

I love WPF, I really do. But sometimes, ridiculous upgrades on features or radical changes in paradigms really frustrates me. And I'm sure I'm not the only developer who faces this kind of a problem.

Keep it simple, Stupid.

Monday, August 27, 2012

Rationality

I need to seriously quit being retarded, and regain my rationality.

I've had enough of this emotional crap last year.

I'm old enough, I should've grown out of this.

I need to keep reminding myself that I am not normal,

Both in a bad way and a good way.

Thursday, August 23, 2012

여자어 사전

사귀시는 여자 있으신 분은 반드시 이거 참조하세요. 프린트 하시고 밖에 나갈때 꼭 가지고 나가세요.
» 사전 보기 «

Tuesday, August 21, 2012

PHP - It's time to reject the bad

Smoking is bad.

Drunk driving is bad.

Windows Vista is bad.

There are many things we encounter in life that we inherently know are bad. PHP is bad, but despite the myriad of evidences presented over the years of what makes PHP a truly bad language, it, to my biggest dismay, still remains the most used web scripting language in the world.

It's pretty much been established by most programmers that PHP is a bad language and there already are many, many, many places that already discusses what an abomination of this language is. Seriously, if you don't believe me, just google "Why PHP is bad" and "Why PHP is good", I guarantee you that you won't find much results for the latter keyword. If this still didn't convince you, let the numbers do the talking for you. But if you care about what I think on this matter, read on.


Monday, August 13, 2012

EVERYDAY I'M GANGNAM STYLE


 

OPPA GANGNAM STYLE

Thursday, August 9, 2012

프로젝트 Fate 모집 공고 (한글)


모집 인원: 최소 5명, 최대 10명

Project Fate 개발팀 모집 공고

개요: Fate / Another를 스탠드 얼론 기반으로 개발
프로젝트 개발 시작일: 2013년 1월
예상 개발 기간: 2년~3년
현재 팀 멤버: l46kok, Squally, Hecatic, Hyeon

저희와 함께 Fate / Another를 스탠드 얼론 기반으로 제작하시고 싶으신 분들을 찾고 있습니다.

게임 개발에 관심이 있으시며 페어를 사랑하시고 무엇보다도 열정을 가진 여러분들의 능력이 절실합니다.

무한한 가능성을 가진 이 게임을 지구상에서 최고로 좋은 게임으로 만들어 봅시다!

Project Fate Recruitment (English)

Aimed team size: 5 minimum, 10 maximum


Project Fate Development Team members recruitment post

Abstract: Create Fate / Another into a standalone game
Project launch date: January 2013
Expected length of development: 2 to 3 years
Current Team Members: l46kok, Squally, Hecatic, Hyeon

We are now recruiting team members to develop Fate / Another into a standalone game.

We are in a great need of people who are interested in game development, loves fate and above all, have a burning desire to make this project into a reality.

Fate / Another is a game that has limitless potential to make it into a big name. Let us make it happen with our hands!


Friday, August 3, 2012

Internet Community - An Ethical Consideration

Those of you who have been following my blog despite my seldom and spontaneous blog posts are likely to be aware of a pattern that I developed here. That is, although I write in both Korean and English, any posts that exceed a certain length or require a little bit of an in-depth thinking than my usual posts are always written in English. I know I've probably reiterated this fact a few times, but I only know how to perform academic or professional writing in English as I've spent my last ten years of education in the United States.

This post however, should probably be written in Korean as it directly addresses several peculiar situations that I have witnessed in our Fate/Another naver cafe. To my dismay, my Korean writing skills are far too pathetic to deliver the thoughts in my head to anyone with clarity. Actually, considering how difficult writing can be as there are people who spend their entire life just on learning how to write, I can't say I do such a spectacular job at writing in English either.

So for this particular post, I'm going to take a slightly different approach. Since I have to start from somewhere, why not with a language I'm most comfortable with? And then when it's time to make a post in the Korean language, I'll simply be translating what I have wrote on this post. Time consuming, sure but it's hell of a lot better than writing gibberish that could mislead the audience.