Often times, projects just need a cool cam…
I have just read about a new feature in Microsoft .Net 3.5 named LINQ. Microsoft describes this as
General-purpose query facilities added to the .NET Framework apply to all sources of information, not just relational or XML data. This facility is called .NET Language-Integrated Query (LINQ).
That, in my opinion, is a rather vague description of what this does. A query facility? Reading more, I see
We use the term language-integrated query to indicate that query is an integrated feature of the developer’s primary programming languages (for example, Visual C#, Visual Basic). Language-integrated query allows query expressions to benefit from the rich metadata, compile-time syntax checking, static typing and IntelliSense that was previously available only to imperative code. Language-integrated query also allows a single general purpose declarative query facility to be applied to all in-memory information, not just information from external sources.
This still doesn’t quite explain what this query facility with syntax checking and IntelliSense does. When I continued reading the page, I finally came across an example. Imagine the following C# code:
Using System;
using System.Linq;
using System.Collections.Generic;
class app {
static void Main() {
string[] names = { "Burke", "Connor", "Frank",
"Everett", "Albert", "George",
"Harris", "David" };
}
}
Now, imagine you wanted to get all the names that were 5 characters long, and print them in all upper case. What you would probably do is similar to the following: (PSEUDO CODE)
string upperNames[]
//get all names that are length 5 and push them onto the upperNames
for (int x=0;x
upperNames.push(names[x].ToUpper());
Console.WriteLine(upperNames.peek());
}
}
Here is how you would accomplish the following with LINQ:
IEnumerable
where s.Length == 5
orderby s
select s.ToUpper();
Wow, that's some pretty cool stuff. There is some more stuff that is outlined in the article, but at a first glance, it's pretty neat.
I recently read about how some of the source code behind Facebook was leaked. I read through some of it and as a PHP developer, it surprised me at some of the things that they have done.
Here is a small list of the features of their code:
I have been working on the MyEPICS framework for a few things here and there, and we have this Role Based Access Control (RBAC) system in place. Now, one thing that has caught my attention is the need to find _every_ action that a user is able to perform, and what object he can perform them on. The query is pretty gnarly:
SELECT Object.name, Action.name FROM UserRole INNER JOIN DomainPrivilege ON DomainPrivilege.roleid=UserRole.roleid INNER JOIN Role ON UserRole.roleid=Role.id INNER JOIN Domain ON DomainPrivilege.domainid=Domain.id INNER JOIN DomainObject ON Domain.id=DomainObject.domainid INNER JOIN Object ON DomainObject.objectid=Object.id INNER JOIN Privilege ON DomainPrivilege.privilegeid=Privilege.id INNER JOIN PrivilegeAction ON Privilege.id=PrivilegeAction.privilegeid INNER JOIN Action ON PrivilegeAction.actionid=Action.id WHERE userid=?
Is there some other way to accomplish the same task, or do I just have to join 9 different tables to get this information, and what are the performance risks for doing this?
Adobe Interactive Forms vs. Microsoft Infopath in SAP
Please note, these are all my own personal views and are not in any way representative of the company I work for.
At Whirlpool, I have been working with two form building utilities for SAP. I was looking at these solutions for creating an offline expense reporting tool for SAP’s Travel Management module. One of them is Adobe Interactive Forms and the other is Microsoft Infopath. Both of these are extremely powerful tools that allow you to quickly create forms. What’s even better, is that given a web service, both of them can create a form that molds to it in a matter of a few clicks.
A tool is needed to be developed to allow for an employee to create an expense report while traveling on the plane. Like e-mail, this tool should be able to synchronize all data when it is first launched. When offline, the traveler should be able to fill out the expense report as if at the office, connected to the network. When the traveler comes back online, the report would synchronize again and submit the data that has been changed. We believed that the best solution for our scenario was to create web services that would allow us to accomplish all of the synchronizing calls to the back end system.
Adobe Interactive Forms seemed to be the most widely used method by companies that use SAP. When looking online and through documentation, creating them to use web services didn’t seem to be used at all. I investigated and poked and prodded until I was able to find that you can access Adobe LIveCycle Designer directly from: “C:\Program Files\Adobe\Designer 7.1\FormDesigner.exe” without having to go through SAP NetWeaver. From here I was able to bind it to a WSDL file, but for some reason it would never submit the data, or receive anything back. Clicking a button did nothing. It was like an HTML input button w/o a form surrounding it. After a few attempts to get it to work, I noticed that if I click on the button, go over to the “Execute” tab, then tell it to post to server, and not the client, then it appears to do something.
Then I went and tried to submit the form and this is the result that I got
I was never able to find a solution to this error, as descriptive as it is.
Using Microsoft Infopath, File->Design a form
You want to send and receive data from this web service
Then manually type in the address to your WSDL file.
Click next a few times until you get to this screen, and choose to send the entire XML file.
Now, expand all your fields and drag the queryFilter folder into the top box, and choose the relevant selection. I was using BAPI_GET_USER_DETAILS
Do the same with the lower field.
Preview the form and you should have a fancy web service running with Microsoft Infopath.
Near the time we were going to get into the thick of the tools, we had the web services take a dump on us. I was investigating how we were going to create web services for our travel expense solution when our project stopped. It was a shame as it was interesting to see how such powerful functionality can be built in a relatively short amount of time.
I recently bought Linux Format which featured an article on the E programming language. It is written in java and is an interpreted language. If you don’t like java, there is also one based on common lisp. Just make sure that you don’t use gcj to try and get it up and running, I experienced quite a few problems when attempting to use this JRE.
E is a programming language that removes deadlocks for multi-threaded applications by using promises. I have coffee and am waiting on sugar, you have sugar and are waiting on coffee. Deadlock. Normally, this is overcome by stating you must get coffee before trying to get sugar, and thus you remove the deadlock. What E does, is it says I promise to give you the coffee if you give me the sugar. Not only is this pretty powerful, but here is the kicker: the computation for each thread doesn’t have to be on the same machine. Imagine that the coffee thread is on machine A, and that sugar is on machine B connected over a network. Once machine A promises to give the coffee to machine B, machine B acts as though it has a value until it needs the value. So machine B can go and … buy snacks from the vending machine while machine A makes his coffee. When A is done making coffee, it hands over the coffee and the sugar to B for him to make his coffee: automagically. If machine B got his snacks from the vending machine and now wants to drink his coffee, but doesn’t have it yet, it will patiently wait until machine A is done making coffee before continuing.
I imagine that the types of applications that would get the most use out of this would be SETI @ home and Folding@Home. Although these probably have a robust and flexible model for doing this, I’d imagine that it was pretty difficult to create and could have been done more quickly when E matures.
So I felt like I would be productive this evening. After a few hours trying to have Eclipse PDT installed and running, I just about cried. It was dependency error after dependency error after dependency error. Eclipse’s update manager should resolve these w/o me having to hassle with it. End of story.
So after messing around for about 2 hours, I finally stumbled upon Zend PDT, which kindly suited my exact needs: php development tools with a PHP debugger. Wow, that was so much quicker to install and use, I had it up and running in 20 minutes.
The reason why I installed these was for a PHP debugging tool, as I have started to find a need for one. I have recently been attempting to combine PHPFreeChat with Net_SmartIRC to make a really, really nice IRC AJAX client. This has not been going well at all so far, but hopefully things will turn around. It doesn’t help that I get IRC codes that are unrecognized and not stated in RFC 1459, namely 265, 266 and 250. Maybe somebody can help me out with this issue?
While I was testing, I also found out that Pidgin has a querky bug… for which I submitted Bug #2052. That took a couple of hours to nail down. Turns out that for certain values of your idleaway status in your prefs file, Pidgin crashes. I didn’t look too heavily into the issue, maybe someone on their end can easily fix it without me having to learn too much of their code base.
Now onto bed as I have work tomorrow.
**Edit**
After looking around in the ircd-hybrid (my IRC daemon), I found the following:
#define RPL_STATSCONN 250
/* RPL_STATSDLINE 250 Numerics List: IRCnet */
#define RPL_LOCALUSERS 265
#define RPL_GLOBALUSERS 266
For which I then didn’t feel like researching any further. Maybe someone knows where these are defined…
Bennett and I happened to head to BARCamp Chicago 2007 over the weekend, but we only ended up staying for the Saturday sessions. Being at BARCamp was very intimidating. Not often are you put into a single location with so many brilliant people. I really enjoyed my time there and hope I can attend the camp next year.
During Saturday’s sessions, I listened to Sean Johnson‘s talk on his opinions on startups and how to create a business model that supports your own life instead of your own life supporting your startup. It was a very interesting talk and had some insights which I had not thought of.
Later I listened into a talk by Tristian Sloughter on how to brew your own beer. That was fun and I learned a bit about the differences between brewing ales, lagers, and what exactly a lambic is. I know my roommate next semester at school has already looked into brewing his own beer which I will most likely help out when I go back to school.
John Quigley had a talk about Lisp that Bennett was interested in hearing. Unfortunately he had lost his original slides, which forced him to use a document which wasn’t really meant to be put used as a presentation. Still, it gave me a little bit of insight into a language which I knew just about nothing about.
Mike Mangino talked about ActiveRecord in Ruby. This was an interesting talk and one that I was probably most interested in when I first head about it as I am currently implementing an active record implementation into the MyEPICS 2.0 framework. Most of his talk was about Ruby’s technical implementation of ActiveRecord and how to dive into the Ruby code instead of a more general academic talk of the active record pattern. I felt it was hard for myself to follow along with much of what he was saying because I have never worked with Ruby, and the syntax is quite daunting for a new entry. Still, I was able to get that there is a lot of auto-magic that is put into ActiveRecord, which makes me happy as I have implemented a bit voodoo myself.
Overall, I enjoyed the talks, pizza and beer that was offered at BARCamp Chicago 2007 and will be attending when they do it next year.
I have been working on the MyEPICS 2.0 framework for creating a website to match roommates together. During this time, I was switching from the old layout, to a different look and feel. When the designing and implementing the MyEPICS framework, I tried to make it as modular as possible, and able to switch layouts easily.
The only big problem that I ran across was empty div tags. The author of the article does a good job of explaining exactly what happened, but doesn’t offer a solution. He may have lost 2 hours of his life finding the problem, but I lost 2 hours of my life attempting to find a solution. My solution was to add an <xsl:output> tag to my XSLT sheet, with a method of ‘html’, which then properly fixed the problem. No more were empty div tags consuming whatever was after them, and it adds a DOCTYPE declaration, which is a big bonus! Now the output passes xhtml strict.
So for the two-five people that read my blog know, I have joined the PHP documentation team and I have full CVS karma. My original involvement was looking at bug#41108 in PHP’s documentation. I just closed the bug report on it today as I felt that the solution was correct.
Yay me, first bug report fixed. More to come