Archive for the 'Programming' Category

14
Jan
13

Cleaning up user profiles

having large number of users’ profile on the file server creates problem in the long run.
Number of Cookies on the share can cause headache of its own.
Using Citrix User Profile Manager reduces the headache, but its still not good enough to leave unused cookies.

To clean it up from the file server, I’ve written some simple script.

For Normal single Company

For Citrix Provider (Multi-tennant)

18
Jun
10

you dont know your own software?

Its strange world indeed, my company uses a software that’s written by VB6 and runs within Citrix environment.

This software vendor decided to call me up asking for help integrating their software on OTHER customer’s Citrix environment.
Well, as a friendly Citrix dude, I did give him a few pointer but isnt it rather strange for the vendor to call the customer to seek help for other customer’s issue?

Its YOUR own software ppl, if you dont think it runs on Citrix or dont know how to troubleshoot software integration LEARN how to do it, seriously.

I really get frustrated when a developer calls an infrastructure engineer (usually me) saying, “I dont know anything about OS, Network, blah blah, can you fix it ?”
I have spent enough time learning C#, App debugging, network (switch/routing) so I can help myself integrating/debugging the issues I face.

Why is it always someone else’s problem when the problem is escalated to the developer ????

This is like a trend, dev who doesnt know SMTP, IIS, DBMS, firewall, TCP/IP.

or it must be just me working with horrible developers..

07
Jun
10

Python and Ruby on Windows

I find it pretty DAMN annoying to start some dev environment on Windows. (BTW, I run Win7 x64)
There are numerous binary gems and  python eggs that simply fails to run on x64.

I was going to develop my hobby project to run LDAP read/report tool and its damn painful to set these up on Windows.

Yes, I can run *nix and have Fedora 13 setup but if I am targeting Active Directory, I thought developing on Windows was a natural choice ?

well activeldap and openldap all seems to be abandoned or not well supported on Windows.
who am i kidding, I should be running C# on Windows not ruby or python. =(

04
Nov
08

when 3.5 isnt good enough

I like new functions in framework but every new version has SOMETHING thats missing where I need most.

.net 3.5 came out with nice/better wrapper for the AD modification, yet it didnt give me the function to modify all the properties especially the tsprofilepath.

well I’ve found the alternative but you need to import DLL(Interop.TSUSEREXLIB.DLL) from here

then use the code below


using TSUSEREXLib;
using System.DirectoryServices;
using System;
using System.Collections.Generic;
using System.Text;

namespace Set_Terminal_Service_Properties
{
class Program
{
static void Main(string[] args)
{
string acctName = “chrisca”;
string tsHomeDrive = “H:”;
string tsHomeDirectory = “\\\\servername\\tshomedirectory\\”;
string tsProfilePath = “\\\\servername\\tsprofilepath\\”;
int enableLogon = 1; // enable terminal service logins

DirectoryEntry entry = new DirectoryEntry
(“LDAP://CN=Chris Calderon,CN=Users,DC=corp,DC=contoso,DC=com”);
ADsTSUserEx oUser = (ADsTSUserEx)entry.NativeObject;
oUser.AllowLogon = enableLogon;
oUser.TerminalServicesHomeDirectory = tsHomeDirectory + acctName;
oUser.TerminalServicesHomeDrive = tsHomeDrive;
oUser.TerminalServicesProfilePath = tsProfilePath + acctName;
entry.CommitChanges();
entry.Close();
}
}
}

Alternatively, my code looks like below (need reference to System.DirectoryServices.AccountManagement in .net 3.5)

var context = new PrincipalContext(ContextType.Domain);
var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, UserNameBox.Text);
Debug.WriteLine(“UserNameBox” + UserNameBox.Text);
ResultBox.Text = ResultBox.Text + Environment.NewLine + “ScriptPath ” + user.ScriptPath;
Debug.WriteLine(“user.GetGroups().Count()” + user.GetGroups().Count());
Debug.WriteLine(“user” + user.DistinguishedName);
foreach (GroupPrincipal group in user.GetGroups())
{
ResultBox.Text = ResultBox.Text + Environment.NewLine + group.SamAccountName;
}
DirectoryEntry de = new DirectoryEntry(“LDAP://”+user.DistinguishedName);

ADsTSUserEx tsu = (ADsTSUserEx)de.NativeObject;
Debug.WriteLine(“tspath” + tsu.TerminalServicesHomeDirectory );

Well using Interop will be messy but I think its better than writing process execute code to start vbs. (Alternative method is to use invokeSet, but I could not find better example so I’ve passed using it.)

Above original Code is refered from here

30
Sep
08

I hate JS! (no you dont)

I believe I am not ONLY one who would cry out loud that JS was bad design solution. Internet Explorer used to pop-up that JS has caused an error or misplace object that is critical on page operations.

As a support person.. again you get all the blame from the users. Why isnt this page showin up correctly ? It only failes in Citrix! Fix it!

Please… IE on server is not same as IE on XP or Vista. We have more LOCK downs and restrictions!!! and sometimes even on different patch level!

and worse case scenarios that is developers NEVER able to help you why JS is broken.

I hate JS..

well point is that JS hater like me, can not live in the dark scared of JS, web is moving towards more and more AJAX and without JS, nothing works these days. (well either that you get flash based site)

and thanks to firebug, even without dev’s useless help. I can at least READ the JS and help debug the issue.

Dont we just love AJAX? (at least I must admit I do), M$ predicts that over 90% of new applications are now web based. (I think this is sort of true, controlled environment, centrallised GUI, one place to change/update the code. All helps to maintain flexibility and agility in development)

so if you are keen on JS now, I guess you may wish to check 75 really useful JS technique.

15
Sep
08

Bots turns against its creators..

The robots then seized back control of events! Automatic stock-trading systems helped push down the price of UAL amid panicked selling triggered by the Bloomberg report. The stock plummeted to $3 from $12.50 before some good robots finally halted trading.

Well UAL stock crash, tribune VS Google news is nothing new but what interested me more was that auto trading bots gone selling frenzy and stock crashed for UAL.

Wow.. so where we invest (especially in managed funds/superannuation) are controlled by robots?
In fact, this is not the first time I’ve read similar story, last yr when we first started to hear “sub-prime” mortgage market crash, some article did mention auto trading bots were at selling frenzy.

Again, bots LOGIC are controlled by its human creators, but frankly I DONT THINK written rules(pre-set logics) can drive the trading and as reliable as experienced traders.

However, I really doubt this will be the last mistake the BOTs will make as human costs usually out weights bots mistakes..

11
Sep
08

When you start learning.. you buy a book and..

errr…. example doesnt work.

I love when things change rapidly. (to catch bugs, add new features, to meed flexibility of customer who threats the vendor to cater their absolute minimum needs) and playing with new features. (I admit I use vistax64 !!)

Ok, enough rant.

I knew RUBY from last year, I have more knowledge in C# than anything but, since I hate JRE (I dont hate JAVA, but I hate JRE, I’ll cover that later) I didnt want to learn anything more than c# at this stage.

Recently I had to think “how can we design/adapt to requirement changes more rapidly?”
This is because lot of programmer works behind the system requirement specification like a bible and will not tolerate the change in the middle. So when new things or your friendly business managers comes to you requesting like dead monkeys telling project manager “I just realised, I need feature xyz”

You didn’t tell me that when we were discussing!

I know you have dead lines to meet, customer is waiting and breathing fire on your back. What can you do? I would tell them “its not in the initial specification” and wait for next release. <sarcasm>yay</sarcasm>

Since I understand in both positions, being able to code myself and being the end-user, I know the damn pain behind the logic change,  SQL code change and for end-users most importantly, UI change. And requirement/need for new features.

Back to the topic of “rapid” change.
I’ve decided to dig deeper on the Ruby on Rails than last year as it meets the “rapid” change requirement perfectly. (well not perfect perfect but reasonably offers the rapid change on the fly)

So I bought the book and go through some chapter and first it covers Test Driven Development (in chapter 2 !)

and since rail was UPDATED to v2.1 and book was based in v2.0.2… test case failed.

you know computer books arent cheap in australia!!!!

Amazingly, I went to the book’s web page and author said to the forum post that rails “quick” change has resulted in the mistake/error/no-longer correct pages on the book.