Resize Infragistics UltraGrid to contents - winforms

How do I resize the entire ultragrid control in code to only show its contents?
i.e: I have
-----------------------------
| | | | blank |
| | | | |
| | | | |
| ------------ |
| |
| |
|____________________________|
and I want the borders to be tight to the grid

My best bet so far was to query DefaultLayout.Bands(0).GetExtent() and use that as the width of the grid.

Related

How to Structure React and bootstrap-react projects?

How to Structure React and bootstrap-react projects?
Here you can see my folder structure. Is this the best practice?
|-COPYRIGHT.md
|-dist
| |-app
| |-bundle.js
| |-bundle.js.map
|
|-index.html
|-.git
|-.gitignore
|- node_modules
|-package.js
|-README.md
|
|-src
| |-app
| | |-components
| | | |-Footer.js
| | | |-Header.js
| | | |-Home.js
| | |
| | |-index.js
| |
| |-css
| | |-bootstrap.min.css
| | |-footer.css
| | |-header.css
| | |-styles.css
| |
| |-fonts
| | |-glyphicons-halflings
| |
| |-images
| | |-logo.jpg
| |
| |-index.html
| |
| |-js
| | |-es5-sham.min.js
| | |-es5-shim.min.js
| | |-html5shiv.min.js
| | |-html5shiv-printshiv.min.js
| | |-react-bootstrap.js
| | |-react-bootstrap.min.js
|
|-webpack.config.js
In the next step I would make my homepage multilingual. I need three languages de, en, fr.
I would like separate the languages like this.
How to change the languages in the Navbar?
Which of you has something already programmed and sends me a link of his Github repository? How do I program the routes correctly? In Footer I'll use three images as a flag for switching languages. But to be recognized by the browser language principle.
|-Languanges
|-de
| |-Impressum.js
|
|-en
| |-Imprint.js
|
|-fr
| |-empreinte.js

WPF Datagrid Rowspan on one column depend of value

(sorry for my english)
I have a problem with my datagrid.
First, my datagrid is fill from a database, depend of a value selected in a combobox. When the SelectedValue of my combobox change the datagrid ItemsSource is refresh with good value.
For now my datagrid look like that
|---|---|---|
| A | + | 1 |
|---|---|---|
| A | - | 1 |
|---|---|---|
| B | + | 2 |
|---|---|---|
| C | - | 1 |
|---|---|---|
I would like to span row of column with number if letter are equal. Because the value of number is linked to the letter value.
To make the datagris look like
|---|---|---|
| A | + | |
|---|---| 1 |
| A | - | |
|---|---|---|
| B | + | 2 |
|---|---|---|
| C | - | 1 |
|---|---|---|

How to show several loops and doing stuff in it in a sequence diagramm?

I want to show what my UserControl/Control is doing when I plug a list of data in it, what happens when the user press certain keys, selecting text etc...
I feel somehow a sequence diagramm is not really suited for showing several loops and doing stuff within the loops.
Am I wrong or how can I cope with that case?
If you are talking about a loop, then you have a series of operations that take place for all elements in the loop.
I would model the operations done in the loop as a sequence diagram by itself, if the operation in the loop are fairly complex.
I don't think we can have rules of thumb here, but when the process with the loop itself is complex, and the loop is relatively less complex, we can have them in a single sequence diagram.
If the process that has the loop is not very complex, but the loop is complex, then I would draw a sequence diagram for the operations of the loop and have a note that this entire sequence is called by a loop.
You can also have both sequence diagrams if needed.
Update:
We have to add some notes to the diagram because it is not straightforward to denote a "condition" in a sequence diagram.
The validate is part is something like
do validation
if validation succeeds
proceed to next (business or other) logic
if validation fails
feedback to user (or some other logic)
+----+ +----+ +----------------+ +----------------+
|User| | UI | | Your Validator | | Business Logic |
+----+ +----+ +----------------+ +----------------+
| select | | |
|--------------->| doValidation | |
| |------------------>|----+ |
| | | | Validate |
| | |<---+ |
| | | |
| | | (validation fails: |
| | Validation Fail | feedback to client) |
| |<------------------| |
| | | |
| | | |
| | | (validation succeeds: |
| | | proceed to |
| | | business logic) |
| | | |
| | | someLogic |
| | |----------------------->|
| | | |
UPDATE 2
Why use sequence diagram in a case as mine?
Because you still have to show the sequence of operations, and the developer still needs this information for coding :-)
With UML, as you probably already know, nothing is imposed. You are at your freedom to denote something in some fashion, provided your team also understands it the way you intended. These notes are also helpful.
I should have mentioned this before, some use an "option" fragment to denote a if else. This is more or less a note (I see it this way) but is perhaps more evident. I use them only when both the IF and the ELSE parts are both complex.
+----+ +----+ +----------------+ +----------------+
|User| | UI | | UI - Backend | | Busines Logic |
+----+ +----+ +----------------+ +----------------+
| Add Record | | |
|--------------->| doinsertOrUpdate | |
| |------------------>| |
| | | exists(record) |
| | |----------------------->|
| | | |
____|________________|___________________|________________________|__________
|[Record exists] | | | |
| | | | Get Record | |
| | | |----------------------->| |
| | | | | |
| | | |--------+ | |
| | | | | Set UI Values | |
| | | |<-------+ | |
| | | | | |
| | | | Update Record | |
| | | |----------------------->| |
| | | | | |
| | | Send Message | | |
| | |<------------------| | |
| | | "Record found, | | |
| | | Updated" | | |
|___|________________|___________________|________________________|_________|
| | | |
| | | |
______|________________|___________________|________________________|_________
| [Record does not | | | |
| exist] | | | |
| | | |--------+ | |
| | | | | Generate | |
| | | | | Seqeuence | |
| | | |<-------+ | |
| | | | | |
| | | | Create New Record | |
| | | |----------------------->| |
| | | Send Message | | |
| | |<------------------| | |
| | | "New Record | | |
| | | Created" | | |
|_____|________________|___________________|________________________|_________|
| | | |
| | | |
| | | |
See this for an example using an alt block.

subtable, extended table ExtJS

subtable or extended table, I do not know how to be more correct to call it.
I need to implement the table with the following structure:
Car | Number | Price | Date |
Mazda | 0122335 | $20000 | 01.08.10 |
____________________________| $19999 | 02.08.10 |
____________________________| $19500 | 03.08.10 |
____________________________| $19000 | 04.08.10 |
Toyota| 0254785 | $50000 | 01.08.10 |
_BMW | 1212222 | $80000 | 04.08.10 |
____________________________| $75000 | 06.08.10 |
____________________________| $70000 | 08.08.10 |
____________________________| $65000 | 10.08.10 |
____________________________| $60000 | 12.08.10 |
____________________________| $55000 | 15.08.10 |
as you see, one row of Сar - we have several lines with Price and Date.
I not found examples of such a structure, so please help on the forum. Maybe someone knows how to implement such a table.
Thks.
Grouping grid?
http://dev.sencha.com/deploy/dev/examples/grid/grouping.html
Yes, perhaps you're right, it is necessary to magic some standard examples

How do I find the most “Naturally" direct route using A-star (A*)

I have implemented the A* algorithm in AS3 and it works great except for one thing.
Often the resulting path does not take the most “natural” or smooth route to the target.
In my environment the object can move diagonally as inexpensively as it can move horizontally or vertically.
Here is a very simple example; the start point is marked by the S, and the end (or finish) point by the F.
| | | | | | | | | |
|S| | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
As you can see, during the 1st round of finding, nodes [0,2], [1,2], [2,2] will all be added to the list of possible node as they all have a score of N.
The issue I’m having comes at the next point when I’m trying to decide which node to proceed with. In the example above I am using possibleNodes[0] to choose the next node. If I change this to possibleNodes[possibleNodes.length-1] I get the following path.
| | | | | | | | | |
|S| | | | | | | | |
| |x| | | | | | | |
| | |x| | | | | | |
| | | |x| | | | | |
| | |x| | | | | | |
| |x| | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
And then with possibleNextNodes[Math.round(possibleNextNodes.length / 2)-1]
| | | | | | | | | |
|S| | | | | | | | |
|x| | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
x| | | | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
All these paths have the same cost as they all contain the same number of steps but, in this situation, the most sensible path would be as follows...
| | | | | | | | | |
|S| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|x| | | | | | | | |
|F| | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
Is there a formally accepted method of making the path appear more sensible rather than just mathematically correct?
You need to add a Tie-breaker to your heuristic function. The problem here is that there are many paths with the same costs.
For a simple Tie-breaker that favors the direct route you can use the cross-product. I.e. if S is the start and E is the end, and X is the current position in the algorithm, you could calculate the cross-products of S-E and X-E and add a penalty to the heuristic the further it deviates from 0 (= the direct route).
In code:
dx1 = current.x - goal.x
dy1 = current.y - goal.y
dx2 = start.x - goal.x
dy2 = start.y - goal.y
cross = abs(dx1*dy2 - dx2*dy1)
heuristic += cross*0.001
See also http://theory.stanford.edu/~amitp/GameProgramming/Heuristics.html#S12, which is an excellent tutorial about A* in general.
If you want paths that look natural, you need to make sure that your costs correspond to the length on a cartesian coordinate system. That means the cost of moving diagonally should be sqrt(2) times the cost of moving vertically or horizontally.
You can add 'control effort' to the cost calculations for each square. The actor will try not to turn or change direction too much as that will add a cost to the path:
http://angryee.blogspot.com/2009/03/better-pathfinding.html
If I remember correctly, the trick to this is to add an extra parameter to the cost function (for every step between adjacent nodes, or squares in your case) that penalises turns slightly more than normal (for example, having a relative cost of greater than sqrt(2) for digonal moves). Now, there's probably a fine line between smoothing out the path and actually decreasing the optimality of the route (elongating it), however, and you're not going to be able to avoid this in any way. There's a certain trade-off you'll need to discover specific to your own application, and this can only really be achieved by testing.
There was an article on a game dev site, I believe, that detailed exactly how this could be done, but I can't seem to find it at the moment. Have a play around with your cost function anyway and see what results you get - I'm pretty sure that's the way to go.
What is more 'sensible'? Straighter? You need to quantify it properly if the algorithm is going to do anything about it.
Since moving diagonally is as inexpensive as moving horizontally/vertically, all the paths are equivalent according to all the criterion available to A*. If you want a more 'sensible' path, you need to tell the algorithm that some paths are more desirable than others, effectively weighting horizontal/vertical as 'better' than diagonal. As far as I can see, that would be altering the parameters of your environment.

Resources