Возник ещё один вопрос по этому самому перфоРРРмансу.
Есть легаси система, в ней есть форма у которой в спрятанной области, скажем так, куча полей. Раньше они все были computed, ибо форма делалась только по @Command([Compose]) и сохранялсь только через UI.
Сейчас появилась надобность создавать документы по этой форме втихаря на фоне, не открывая никаких форм. Поэтому моим кожаными пальцами всё создание и эмуляция заполнения полей была переписана на горячо любимый LotusScript (compute with form я естественно не использую).
Сейчас мне надо эти поле превратить из ex-computed в некие, которые заполняются скриптом.
Какой тип предпочтительнее с точки зрения быстродействия? 1. editable без всяких default value 2. computed when composed с формулой @ThisValue
POWER TOOLS 7.0 IS A SET OF 98 ADMINISTRATIVE UTILITIES FOR LOTUS NOTES & DOMINO Power Tools simplifies management of the Notes/Domino environment by automating routine tasks. Power Tools can manage or monitor mail files, groups, ACLs, agents, LOG.NSF, templates and more.
So, we've seen how to show a table of data from a database. Now, let's see how to create a link in one of the columns to open one of the rows of data in its own page.
First, let's change the GridView we used on Default.aspx in to a Repeater element:
A Repeater is just an easy way of looping the set of items we data-bind to it and have it apply the ItemTemplate we specify, to each one. Should all make sense?
In the browser this will render like this:
Looks a bit better than before, no?
The link column points to URLs like "/Animal.aspx?id=2". To handle this we need to add a new ASPX Page, called Animal.aspx, like so:
Notice we're basing it on a template. On the next screen choose Site.Master and click ok.
Loading a Single Row of Data
Until now we've been loading the whole of the Animals table. However, in the Animal.aspx page, we only want information for one row.
To fetch a single row of data based on its ID we need to add a new method to our Table Adapter.
First, open the DataSet we created and then right-click the AnimalsTableAdapter part and choose "Add Query...".
In the next two screens that appear choose "Use SQL Statements" and then "Select which returns rows".
In the third screen enter this SQL:
On the next screen give the method a meaningful name, such as GetAnimalByID:
Notice how it adds the new method to the adapter and shows that's there a single parameter required (below). In this case it's the ID. Because VS is clever it knows the ID needs to be an INT, so when you call the method it insists that's what you pass! Clever, no?
Now, let's use this new method of the adapter to extend our AnimalFactory class. Here's the new method I added:
It should make sense what it's doing? Instead of returning a List of Animal objects it only returns one.
Now we can use this from our own pages. Here's the code from the Animal.aspx.cs file and shows what happens in the Page_Load event of the Animal.aspx Page.
As you can see it declares a public Animal object and then assigns data to it using the AnimalFactory class's new method we just added, passing to the method the ID part of the URL.
The Animal object is public so that we can refer to it from the actual Animal.aspx file, like so:
Notice the lowercase animal being used. This is because we're referring to the object we created rather than the class itself. Or something like that.
Here's what you should then see if you click a link on the homepage:
A lot of work to get to this point. I know. It's easier once you get the hang of it though. Most of the groundwork gets done up front.
Although it's more work to get to this point than with err, I dunno, Domino, the pay-off comes when you realise just how much control you have over absolutely everything.
You could have done this in Domino in a matter of minutes. The strengths of using SQL and ASP.NET don't become obvious until things get more complicated. Horses for courses and all that, but I'd rather spend more time up-front doing this sort of stuff knowing the end result would offer me complete flexibility.
Is anybody following along with the ASP.NET articles? I won't hold it against you if you say no. It must be obvious my heart's not in it? I'd forgotten just how much time you need in order to write a decent, well-thought-out technical article.
Instead of taking my time (which I don't have enough of) I've been rushing the articles. Still, there should be something to take away from them. I just don't feel very proud of them as it stands.
I'll continue with the articles, assuming you want me to though?
Since starting the articles Ferdy Christant convinced me to take a look at ASP.NET, which I did, and I now have that horrible feeling I've been doing it all "wrong".
I've not touched any flavour of MVC since I fell for Ruby on Rails five years ago. I came away from Rails amazed, but with an idea of what it was best suited to. I then assumed that's all MVC could do, whereas, obviously, there's no reason MVC can't be used for any site.
Within minutes of creating a new ASP.NET MVC 3 project in Visual Studio I got that same feeling I remember getting 5 years ago with Rails. The "Wow, wow, wow!" feeling. I've not really had the feeling since then. It's the feeling that makes you want to stop what you're doing and spend the next week just playing with what it is you've discovered.
One of the things that caught my attention was the Razor "view engine". It lets you code like this:
Nothing clever about the code. But. The best thing about what you see above is that I just made it up. In a kind of "I wonder if this would work" kind of way.
In reality you'd pass the View a Model of data, like so:
Which would produce:
Either way, I love it when things just work how you'd expect them to. Couple the simplicity of what you see above with the power of VS's autocomplete and it makes for an amazing coding experience you can only do justice to by using for yourself.
There's much more to MVC than an easy way to create HTML. It also makes lots of other aspects of web programming much less painful. Trust me.
The other thing Ferdy convinced me to look at was LINQ-To-SQL which seems like it will take a lot of the misery out of what I've been describing this week in using TableAdapters.
It's a shame I made this discovery so late in the day. Although I can seek solace in the fact that everything I've learnt with the WebForms approach acts as a good grounding in the base .NET approach to things. No regrets, but I do wish I'd taken a look at this a few months ago.
For now, I'll assume there's interest in me continuing with the ASP.NET stuff? If you're new to it I'd still suggest at least getting in to it this way before looking at MVC and stuff.
Now that we've seen how to view an entry from a database in its own page it makes sense to start looking at how we add new entries and edit existing rows.
Adding New Entries
First thing we need is a Stored Procedure (SP) in our database to insert a new row. We could just add the SQL directly to the Table Adapter, like we did before, but I thought I'd cover how to use an SP (which lives in the actual database rather than your .NET project) too.
You could work on the database directly from within SQL Server Management Studio. Or you could use the Database Explorer in VS, which is probably a little quicker, assuming you have it running, so we'll cover that approach.
In VS - at the bottom of the Solution Explorer pane - there's a Database Explorer pane. Open it up and, assuming you've got the "connection string" in you Web.Config file you should see the Zoo database listed.
Expand the Zoo DB like so:
Now, right click on Stored Procedures and choose to add a new one. In the window that appears type the following:
This will create an SP that we pass four arguments to. The third one (date of birth) is optional. Using these four values we INSERT a new row and then return the "ID" of the row we just added.
Save the new SP and call it AddNewAnimal.
Now we need to add the new SP to our TableAdapter in the project's DataSet, so that the ASP.NET application is aware of its existence.
Back in the Solution Explorer pane open the DataSet (Zoo.xsd) and right-click on the AnimalsTableAdapter section, like so:
Choose Add Query and in the first screen of the wizard that appears choose "Use Existing Stored Procedure".
On the next page you should get a dropdown list of SPs from the database. Choose "AddNewAnimal", like so:
Notice how it knows about the four parameters we need to pass it and the value it will return.
On the next screen be sure to choose "A single value". This means we get a simple way to convert the ID returned in to an integer value for use in C# (see later).
In the next screen give the method a simple name, like "Add":
Click Finish and you're done!
Our TableAdapter now has a new method:
To use this in C# would be as simple as this:
AnimalsTableAdapter adapter = new AnimalsTableAdapter();
adapter.Add("Snappy", DateTime.Now, null, "Crocodile");
Simple, no?
In practice, you'd never do this though. What we want to do is put this interaction inside the Animal class, inside a method called Save().
So, here, it's passing the properties of the current animal object to the adapter. We could use this in code, thus:
Cool. Not only are we creating our own objects we're adding methods to them. Any .aspx pages which modify Animals now only need to call Save. They don't need to know about the adapter and we can change how the save method works from one place.
Notice anything wrong with it based on what we've done so far?
You'd expect this code to load the animal whose ID is 1, change its name and then save it back to the database. It won't work though as our SP only INSERTs new entries. What the code above will do is add a new row with a new incremented ID, the name "Changed" but the same values in the other columns as already exist for animal with ID of 1.
What we need is an UPDATE Stored Procedure.
Updating Existing Entries
Following the same steps as before add a new SP with the SQL you see below:
We're passing the same data as before, along with the animal's ID, so that we know which row to UPDATE.
Back in the TableAdapter, following the same steps as before, add a new method that points to this new SP and call it "Change" or something like that.
Make sure you choose to have "no value" returned though:
Your TableAdapter should now look like this:
Back in the Animal class (Animal.cs file) update the Save method to look like this:
Which SP we call now depends on whether the Animal has an ID greater than zero. In effect this is like testing whether it's a new Animal. There's probably a more graceful way of doing this, but this works for now.
Now both of the code snippets mentioned earlier should work as expected.
Using With Forms
I was hoping to cover the creation of ASPX pages that contain forms to take user input and add or update Animals, but it's taken long enough to get this far, so that will have to wait for another day.
For now, if you feel like it, have a go at creating animals in your own pages. Perhaps add a new animal in the Page_Load event of Default.aspx and watch the table of animals grow each time you refresh the page. What fun.
I'll cover using Forms in the next post in the "series".
I would like to see Connections give us the ability to present the user with a "Log In With (Facebook|Twitter|LinkedIn)" button. Let us utilize an existing social network instead of having to build another one. This is obviously for public facing Connections deployments. These existing social networks already have user self-service and a much more mature community of users than any new Connections based site will generate in it's early stages. If a Connections public deployment were just another app hanging off of the existing public networks, adoption and inclusion of public people would be much easier. I saw this in a Portal Next demo, and think this will be great to bring to Connections.
Although in Sametime Classic meeting room we have a whiteboard, it's missing in LotusLive meeting room and this is strange. Even Microsoft IM server has it.
In the last time many developers had adopted Linux and MAC OS as their natural operating system to create programs.
Domino Designer is developed using Eclipse Platform, and as anyone knows Eclipse works in any operating system, Why doesn't Domino Designer work in the same way?
Documents may contain multi-valued items . Many times the values in the items are related (e.g. a document describing an invoice may contain multi-valued items for the purchased article codes, article titles, article price, ...)
Suppose we need to build a view that displays all invoice documents that have at least one article that costs more than 1000$. We need to list the article code, the article title and the prices
It is easy to build a selection formula.
We may display the article price for the article(s) costing more than 1000$ (could be on index 7 and 10 in the multivalued field). But there is no way to display only the 7th and 10th entry in the article code and article title column
What could be a solution:
- have a hidden column that calculates the indexes (7 and 10 in the example) and store the result in a temporary variable (this temp variable is a new concept to be implemented by IBM).
- the other view columns should be able to read this temp variable
Each row in the view has a dedicated set of temporary variables
Notes security is configured at different levels. We all know about the database ACL.
At document level we have reader fields (who is allowed to see the document), author fields (who is allowed to edit the document)
There is a similar need for document level delete protection. I propose a new concept of "deleter fields"
If you have reader level access in the ACL -> delete is never allowed
If you have editor level access in the ACL + delete rights in the ACL -> delete is allowed on all documents
If you have author level access in the ACL + delete rights in the ACL -> in case a "deleter field" is present on the document you should be listed in the field (as a group member, by notes user name, by wildcard or by role)
This topic describes known Apple device restrictions and limitations with IBM® Lotus Notes® Traveler. h2 Setup and login h2
Table 1. Setup and login issues Problem
Details
Microsoft® Exchange account setup fails when setting up an account with Lotus Notes Traveler. Verify that the mobile user ...
TippingPoint's Zero Day Initiative (ZDI) contacted IBM Lotus to report nine potential buffer overflow vulnerabilities in Lotus Notes and Domino; for four of which IBM Lotus has fixes, two of which IBM Lotus continues to investigate a fix, and three of which IBM Lotus cannot reproduce and is pursuing additional information.
An attempt to import DXL data results in error, "Base64 byte stream contains invalid data or is too large to store in a single note item," and import fails.
The ExpandAllSections method of the LotusScript NotesUIDocument class fails with the error, "Document command is not available." This note presents a workaround.
You have an XPage which is using the <xp:inputhidden> field. When the page is opened in edit mode you can see the value of the field within the HTML source. When the page is opened in read-only mode then the value of the field is not visible in the HTML source.
When attempting to upgrade a Lotus Notes 8.5.1 Fix Pack 4 client, to a later release using the Smart Upgrade process, you receive a popup box warning that there are "No matching kits available for your Notes client release".
IBM Lotus Notes Client Standard 8.5.2 Fix Pack 1 Interim Fix 2 (852FP1IF2) for W32/ Type: Incremental Installer / Release Date: 04 February 2011. See 'More info' link above for additional information.