Archive

Archive for the ‘development’ Category

Rexiology@MSDN : C#: What does it mean about statement "int? varA = 3;" ?

July 3rd, 2007 No comments

Not having had the luxury of working in .NET 2.0 yet, a plethora of legacy 1.1 and Sharepoint 2003 and now SAP has prevented my migration I never knew about nullable types, sure I’d heard about nullable types, in fact I hated the idea, to me its just lazy, check your damn variables for DBNull I say.  Ok ok so sometimes you want to know something is un-set  e.g. a trisate  boolean of true or false or undefined (null).

But since we have them its worth knowing what they are and how to use them so in this article look for

int? varA =null;

And of course

int result1 = varA ?? varB;

Don’t you think it just looks nasty.

Rexiology@MSDN : C#: What does it mean about statement “int? varA = 3;” ?

 

Technorati tags:
Categories: development Tags:

Updated WebPart

June 6th, 2007 No comments

I had chance to make the xaml nicer last night so I updated the original article and the source code.  I also included a CAB file for those who can’t build the source code.  Again see original for source and cab links.

Technorati tags: , ,

Categories: development, Sharepoint Tags:

Sharepoint Silverlight Image Library Viewer Part

June 5th, 2007 12 comments

Well that’s a long title but I think you get the idea of what this post is about.

Building on top of my web part template I thought I ought to do something useful that I could share. So Combining the ability to peruse lists from a webpart and mangling this into Silverlight I made a webpart Image Library viewer.

Now this is pretty rough and ready the xaml is from the VB school of design, “Grey Blue and Boxy”, but get a designer on the case and your away.  It contains elements of a jscript Control.  The photos at the bottom scroll left and right and are added dynamically.  This is a good use of the CreateFromXaml but using the “true” option for the namespace scope, which is better than find and replace of the video library example.  It does full screen by clicking the little grey blue square (see what I mean about design) which is taken from the video library sample and doesn’t scale to exactly 4:3, again I don’t have time to investigate, it involves pencils and math’s and I’m a bit busy.

The webpart itself looks specifically for a list called “Image Library” one of the default lists created by portal sites.  This can be changed so that you could have a toolpart selection.  It relies on the list being an Image Library list.  If the list is not there it blows up I haven’t spent long on this making it bomb proof.

If there are no pictures in the image library it resorts to displaying text in the webpart that the list is empty, not some custom display in the Silverlight part.

Read more…

Categories: development, Sharepoint, Silverlight Tags:

Excellent developer quote and a pretty button

May 8th, 2007 No comments

I found this quote here and thought it so true.

Given this awesome power it is possible to create some really beautiful and functional user interfaces. It is also possible that if you nest a Button within a Button you may rip a whole in the space time continuum. So be careful. WPF and many of the tools that generate Xaml are to be used by designers, Designers are professionals who have been trained in good taste and judgement, subjects that are typically left out of the computer science curriculum. As you can see from my Xaml snippets, I am trained in computer science and should therefore not be allowed anywhere near the user interface”.

Yeh me too, but you can’t write a WPF app without putting some xaml in there.

However saying that do you like my xaml windows button, find the right tutorials and you too can start to knock up a library of xaml snippets.  In fact thats what this technology needs a web site devoted to xaml snippets, any takers ?

 

 

Technorati tags:
Categories: development Tags:

I Hate SAP

April 5th, 2007 2 comments

There are somethings you get so used to in visual studio that they become second nature, they are part of your programming experience.  Take for example the tooltips when typing a method or function, you know the one, it shows all the parameters and their types.

Now imagine that you don’t have that any more.  You just have some crappy “pattern” button where you can type in the method name and it inserts the method signature complete with blanks for you to fill in.

Then you still have to dip into the method code or help (if there is any such help) to figure out what types the parameters you are using are.

Undoubtedly SAP platform is very powerful and has a language built for helping customize and take advantage of your platform.  But the tools, the tools your given and the documentation really, really, suck. 

I one day hope that the MS/SAP interoperaility project goes so far as to have a ABAP plugin for visual studio, complete with MSDN style documentation. 

I can dream.

Technorati tags:

Categories: development, sap, Uncategorized Tags:

AJAX Vunerablilities

April 3rd, 2007 No comments

Its easy to say but I guess we already new that Certain AJAX techniques were vunerable to attack.  I mean I even published an article on bypassing the “same origin policy” see WebParts and Ajax I refer to the sites that use this bypass technique, hell I even call it a security by-pass and there’s your biggest clue.

This document talks about the various techniques in trying to prevent this and comes down hard on JSON.  I haven’t had chance to explore this, I reckon with a lot of jiggery pokery it might be possible to get xml data as well, depends on how that data is retrieved, the document suggests means in which bad script could try to circumvent certain security tactics in json, those same techniques could work for xml data I reckon.

But take a look the bits about session cookies sound good.

http://www.fortifysoftware.com/advisory.jsp

Technorati tags: ,

Categories: development Tags:

SAP progress

March 27th, 2007 No comments

I haven’t posted anything SAP for a while, thing is I’m the developer on the project whose goal is to implement a standard SAP solution.  We are in blueprint phase at the moment hence my dabbling with sharepoint integration. 

For those wondering what its like to work in SAP having come from .NET….its primitive.  I have come from an environment rich in tools, with a seamingly endless supply of help and information.  Microsoft has fantastic resources about its langauges and products with plenty of examples of how to use them.  Then there is the army of users providing help on blogs and forums.  Somewhere someone has done what you want to do, or at least tried something which could give you ideas.

SAP however I find a little different, yes sure there is a large online help section to describe the base product installations and language syntax but like for like its not a patch on the MS stuff, its enough to get you going if your good at what you do.  Then when it comes to documentation about classes and API’s and process flow for SAP, well this is the point I tear my hair out.  There can be a lot of documentation or none.  When I asked my colleague, a SAP developer for quite a while now, “How do you find so and so?” his answer was you either know it or you have to debug the application!

Could you imagine having to debug excel to figure out how to locate a function to retrieve data ?  Or step-through outlook-express to find the smtp server ?

The SAP community is a lot smaller but efforts by some in this community are admirable.  The Sap developer network is a great place for finding answers, they tend to be answers to the technical side of sap and not the process side, but its a start.  Many times a question I search for though is a almost googlewhack, I’m convinced I will find one thanks to SAP.

So its a challenge and because I have to fight my way through it at times I’m loving it.

For those interested in the interop SAP things I have been doing, there will be more to come.  We still need to build a BI/BW system and get all the kit working as it should.  When this happens expect to see more on iViews, sharepoint interop, bw/bi interop etc.

Categories: development Tags:

SAP Webparts

February 20th, 2007 2 comments

I was going to write a piece on Sharepoint and SAP webparts that I had written, however I doubt I could do the topic justice when there is already a guide to doing this out there

Technical Guidance for Connecting Microsoft® Office SharePoint® Portal Server 2003 to mySAP™ ERP

This is an excellent document and covers off everything you might need to know about making SAP web parts (and what I believe are flaws especially coming from an MS background).

The key thing to remember before you start is that you need (list for sharepoint people really)

1. A SAP system to connect to
2. A SAP Market place user and password (cannot download tools without this)
3. The SAP .NET Connector, version 2 of this was really easy (ish) to use.
4. An SAP developer key, without which you are not licensed to develop, it won’t prompt for it but you should have it.
5. A Sharepoint dev system

 

I did not follow the guide though, I referenced it but not having SAP experience I stuck to existing BAPI’s and very simple, if somewhat useless functionality, its a demo after all.

So to start with, as a sharepoint developer I suggest you leave SAP alone to start with.

Get the SSO working, if you’ve not done this then it might present some problems.  In the guide it stores the SSO credentials in SSO but also in WebPart properties, this is not something I recommend, If you have secure data store it only in credentials. I believe it was most likely done this way as Custom ToolParts can be scary, but using a custom part can ensure better security by not storing that SSO information outside of the secure SSO components.  Also because you are using a toolpart you can add validation, something I achieved by calling the ExistenceCheck method on the User BOR (BAPI_USER_EXISTENCE_CHECK), this might not be the correct SAP way but it appeared to work.  Examine your SSO definitions do you need group login or user login.  *Update: Whilst I still think using WebPart properties as in the example is wrong, Just as bad is the toolpart, both methods end up posting the credentials over port 80 which is bad.  The correct and only way is to call the GetCredentialEntryUrl() method and ensure that SSL is configured for your SSO.  This does not give you the ability to validate your settings as my toolpart did but it guarentees security.  If your not fussed about the very few times that those credentials are passed over http then the toolpart method I described is a better solution and the credentials are not accessible via the web part properties, whilst I havent tried to find them in the database they were not designed to be secure like credentials.

Once you have the web part working and the SSO working, work on a web service for the web part to get its data from,  Displaying the data in the web parts is easy for any sharepoint developer now, just pass the credentials over the web service via SSL.

As I said earlier instead of using the guide’s example try your own. I decided to do a webpart that searched vendors (BAPI_VENDOR_FIND), this is an existing BAPI and once you understand the basics of BAPI calling (it is kinda weird MS guys) you can then just struggle getting the data out and in a sensible format and deal with errors etc in an MS way for your webpart to handle.

This post is not meant to be a guide so comes with no code, its a pointer to the guide and to hopefully point out what I think is an error in the guide regarding SSO but mainly to give you a hint of don’t blindly follow that guide as you will need ABAP skills to create the custom RFC ZIBF_OPEN_PO_NEW, stick to something already there.

 However here are some videos showing the parts I wrote in operation, the data is IDES and obviously copyright of SAP

VideoOne : A web part that searches for vendors via a postback then uses AJAX and sharepoint to display the Vendor and list of PO’s

VideoTwo : Two connected web parts that searches for vendors via a postback then passes the vendor ID to the second to display the vendor and PO’s then allowed a drilldown to PO items

 

Technorati tags: , ,
Categories: development, sap Tags:

Firebug

February 19th, 2007 No comments

On occasion I like to mess with javascript.  I write javascript for IE, its where I started so I’m comfortable there.  But as we all know you sometimes have to make it compatible with other browsers and rightly so (to a point).

I only bothered with making things work in firefox, opera and the others can take a running jump.  So last time I did anything I found the javascript debugger for firefox and installed it.  It worked and it didnt (sometimes) not exactly a visual studio experience but it got the job done.

Looks like a new kid on the block though and it looks good, I haven’t had a piece of work to try it out on but it provides the functionality of a debugger, a network monitor (fiddler equivalent), and a dom interogator (IE Dev toolbar equivalent).

From first glances I like this tool, so if your in the firefox dev pit give it a whirl.

http://www.getfirebug.com/

 

Categories: development Tags:

If I’ve broken it once, I’ve broken it a 1000 times

February 13th, 2007 No comments

Again and again I beat my head against a brick wall cos of page lifecycle and event firing in .NET.

The amount of times I’ve made the same error.

Don’t stick DataBind calls in the bloody render method.

Two days. Two days hunting for that one, sliding bits of code about before I spotted it.

Most of .Net web is coding by convention and leads to errors like this, perhaps FxCop in 2005 could spot stupid mistakes like this, after all if it spots typos why not something more fundemental !

Technorati tags: , ,
Categories: development Tags: