instruction
stringlengths 0
30k
⌀ |
---|
Tools menu -> Options ...
Then go to Text Editor -> C# -> Fromatting -> new lines and there check when you want new lines with brackets
for css:
almost the same, but less options
|
Best way to do multi-row insert in Oracle? |
|sql|database|oracle-database| |
I'm looking for a good way to perform multi-row inserts into an Oracle 9 database. The following works in MySQL but doesn't seem to be supported in Oracle.
INSERT INTO TMP_DIM_EXCH_RT
(EXCH_WH_KEY,
EXCH_NAT_KEY,
EXCH_DATE, EXCH_RATE,
FROM_CURCY_CD,
TO_CURCY_CD,
EXCH_EFF_DATE,
EXCH_EFF_END_DATE,
EXCH_LAST_UPDATED_DATE)
VALUES
(1, 1, '28-AUG-2008', 109.49, 'USD', 'JPY', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),
(2, 1, '28-AUG-2008', .54, 'USD', 'GBP', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),
(3, 1, '28-AUG-2008', 1.05, 'USD', 'CAD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),
(4, 1, '28-AUG-2008', .68, 'USD', 'EUR', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),
(5, 1, '28-AUG-2008', 1.16, 'USD', 'AUD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008'),
(6, 1, '28-AUG-2008', 7.81, 'USD', 'HKD', '28-AUG-2008', '28-AUG-2008', '28-AUG-2008');
|
Here's a nice approach (from [the main Wikipedia entry on pi][1]); it converges much faster than the simple formula discussed above, and is quite amenable to a recursive solution if your intent is to pursue recursion as a learning exercise. (Assuming that you're after the learning experience, I'm not giving any actual code.)
The underlying formula is the same as above, but this approach averages the partial sums to accelerate the convergence.
Define a two parameter function, pie(h, w), such that:
pie(0,1) = 4/1
pie(0,2) = 4/1 - 4/3
pie(0,3) = 4/1 - 4/3 + 4/5
pie(0,4) = 4/1 - 4/3 + 4/5 - 4/7
... and so on
So your first opportunity to explore recursion is to code that "horizontal" computation as the "width" parameter increases (for "height" of zero).
Then add the second dimension with this formula:
pie(h, w) = (pie(h-1,w) + pie(h-1,w+1)) / 2
which is used, of course, only for values of h greater than zero.
The nice thing about this algorithm is that you can easily mock it up with a spreadsheet to check your code as you explore the results produced by progressively larger parameters. By the time you compute pie(10,10), you'll have an approximate value for pi that's good enough for most engineering purposes.
[1]: http://en.wikipedia.org/wiki/Pi |
For CSS you'll need the 'Semi Expanded' option. |
VisualBasic .NET's compatibility library contains strong typed control arrays. This is what the upgrade wizard uses to replace the current VB6 control arrays.
However, A control array in VB6 is just a collection of objects with VB6 doing some syntax magic on the surface. In the .NET world, by removing this, they are forcing better practices.
In closing, with the advent of generics, there is nothing stopping you from using List<YourControl> MyControlArray.
|
VisualBasic .NET's compatibility library contains strong typed control arrays. This is what the upgrade wizard uses to replace the current VB6 control arrays.
However, A control array in VB6 is just a collection of objects with VB6 doing some syntax magic on the surface. In the .NET world, by removing this, they are forcing better practices.
In closing, with the advent of generics, there is nothing stopping you from using
List<YourControl> MyControlArray.
|
Yeah, I've found manually layout out controls (incrementing their Top property by the height of the control plus a margin as I go) to be reasonably effective.
Another approach is to place your controls in Panels with Dock set to Top, so that each successive panel docks up against the one above. Then you can toggle the visibility of individual panels and the controls underneath will snap up to fill the available space. Be aware that this can be a bit unpredictable: showing a hidden panel that's docked can sometimes change its position relative to other docked controls. |
Are you JPEG's compressed in Jpeg 2000 Format? If so, there is a known bug:
- [https://bugs.webkit.org/show_bug.cgi?id=8754][1]
[1]: https://bugs.webkit.org/show_bug.cgi?id=8754 |
C# Dynamic Form Controls |
|c#|winforms|dynamicdata| |
Using C# 2.0 what is the best way to implement dynamic form controls?
I need to provide a set of controls per data object, so should i just do it manually and lay them out while increment the top value or is there a better way? |
|.net|winforms| |
"The image “http://kilkin.massiveatom.com/kilkin/images/dukkah.jpg” cannot be displayed, because it contains errors." and the image itself has some XML-fragment in it. So as others proposed: try to open with an editor and resave it. |
Another simple thing to do would be to use a debugger or logging statement to check the value of
> StringUtils.objectToString(currClip.get("market_local"))
to make sure it is what you think it is. |
+1 for VisualSVN being better than AnkhSVN, having tried both, and +1 for the FogBugz Add-in. |
have you looked into using facelets? It lets you get rid of the whole JSF / JSP differences (it's an alternate and superior view controller).
It also supports great design-time semantics with the jsfc tag...
<input type="text" jsfc="#{SomeBean.property}" class="foo" />
gets translated internally to the correct JSF stuff, so you can work with your existing tools. |
It's as stated elsewere a bug in the image.
[Irfanview][1] is a very good viewer that will display any image (and other formats as well), is small and free and will also let you adjust, crop or rescale images very easily without heavy programs like photoshop.
I suggest [download irfanview][2] and the image, open the image in irfanview and hit CTRL+S and save it over itself. Then upload the image again. Any problem should be solved.
[1]: http://www.irfanview.com/
[2]: http://www.irfanview.com/main_download_engl.htm |
Well that's the way we are doing it right now on a project. but that's only useful for simple cases. I suggest you use some sort of template for more complex cases.
For instance I used Reflection to map a certain type of control to a certain property on my domain objects on an older project.
You could try generating the code from templates using t4 see [T4 Templates in Visual Studio for Code Generation Screencast][1] for a simple example. You can apply this to WinForms.
Also DevExperience has a nice ( expensive ) framework, see DevExpress [eXpressApp Framework™][2] .
[1]: http://www.pnpguidance.net/Screencast/T4TemplatesVisualStudioCodeGenerationScreencast.aspx
[2]: http://www.devexpress.com/Products/NET/Application_Framework/ |
|database|logging|olap|hackery|text-files| |
To analyze lots of text logs I did some hackery that looks like this
1. Locally import logs into Access
2. Reprocess Cube link to previous mdb in Analisis Service 2000 (yes it is 2k)
3. Use Excel to visualize Cube (it is not big - up to milions raw entries)
My hackery is a succes and more people are demanding an access to my Tool. As you see I see more automating and easier deployment.
Do you now some tools/libraries that would give me the same but with easier deployment?
Kind of **embedded OLAP** serwice?
**Edit:** I heard of Mondrian but we don't do much with Java. Have you seen something similiar done for .Net/Win32 ? Comercial is also OK. |
|database|logging|olap|text-files|hacks| |
This is the effect of a new feature in Vista called "Boxing":
Windows has several mechanisms that allow the user/admin to set up applications to automatically run when windows starts. This feature is mostly used for one of these purposes:
1. Programs that are part of the basic work environment of the user, such that the first action the user would usually take when starting the computer is to start them.
2. All sorts of background "agents" - skype, messenger, winamp etc.
When too many (or too heavy) programs are registered to run on startup the end result is that the user can't actually do anything for the first few seconds/minutes after login, which can be really annoying. In comes Vista's "Boxing" feature:
Briefly, Vista forces all programs invoked through the Run key to operate at low priority for the first 60 seconds after login. This affects both **I/O priority (which is set to Very Low) and CPU priority**. Very Low priority I/O requests do not pass through the file cache, but go directly to disk. Thus, they are much slower than regular I/O.
The length of the boxing period is set by the registry value:
"HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\DelayedApps\Delay_Sec".
For a more detailed explanation see [here][1] and [here][2]
[1]: http://blogs.technet.com/askperf/archive/2008/03/28/startup-programs-on-windows-vista-inside-the-box.aspx
[2]: http://myitforum.com/cs2/blogs/scassells/archive/2008/02/05/boxing-and-the-case-of-the-slow-or-hanging-logon-script-in-vista.aspx |
You can set the Build Action/Copy to Output Directory property on individual files (select the file and hit F4 to open the properties window) to control what happens to them during build, but not for folders. This could probably be automated with a (pre) build task if you don't want to do it manually.
Alternatively, you can exclude these folders from the project (right click and 'exclude from project'); they'll still be there ("show all files" in solution explorer), but they won't be included when building the project. |
I am one of the authors of Drools, I will avoid pimping my wares.
But some other options are Jess (not open source) but uses the clips syntax (which we also support a subset of) - which is kinda a lisp dialect.
It really depends what you want it for, Haley have strong Natural language tech (and they recently aquired RuleBurst - who has also interesting natural language tech which could deal with word documents with embedded rules - eg legal documentation). RuleBurst was able to target .Net runtimes as well (there is a Drools.net "port" available as well - I haven't seen what it has been up to lately, alas, not enough time). Ok I will put my pimp bling away now... sorry about that. |
I've had no problems connecting to network shares transparently as if they were local drives. The only issue you may have is what you mentioned: having the `aspnet` account gain access to the share. Impersonation is probably the best way to do this.
You should be able to use any filestream objects to access the network share as long as it has a drive letter on the server machine. |
How Do I Read in the Contents of a Directory in perl? |
|perl|filesystems|fileio| |
How do I get perl to read the contents of a given directory into an array?
Backticks can do it, but I know there is some method using 'scandir' or a similar term? |
|perl|filesystems|file-io| |
|perl|file-io|filesystems| |
I did quite a bit of googling trying to find this answer. There are plenty of people asking for it:
- <http://developers.slashdot.org/comments.pl?sid=414610&cid=21996944>
- <http://www.arguingwithmyself.com/archives/75-the-biggest-feature-your-editor-is-missing>
- <http://intype.info/blog/screencast-parser-in-editor/#comment-221>
- <http://codewords.wordpress.com/2006/10/16/eclipses-achilles-heel/>
just to name a few...
so I don't think one exists yet, sorry :( |
Also don't forget that both Map and Hashtable are generic in Java 5 and up (as in any other class in the [Collections framework][1]).
Map<String, Integer> numbers = new HashMap<String, Integer>();
numbers.put("one", 1);
numbers.put("two", 2);
numbers.put("three", 3);
Integer one = numbers.get("one");
Assert.assertEquals(1, one);
[1]: http://java.sun.com/javase/6/docs/technotes/guides/collections/index.html |
Integrated GPUs are going to be really poor performers with games FSAA or no. If you want even moderate performance, buy a separate video card.
For something that's not crazy expensive go with either a nVidia Geforce 8000 series card or an ATI 3000 series card. Even as a nVidia 8800 GTS owner, I will tell you the ATIs have better support for older games.
Although I personally still like FSAA, it is becoming less important with higher resolution screens. Also, more and more games are using deferred rendering which makes FSAA impossible.
|
It really depends on what kind of security you are looking to integrate. Do you want security to ensure that the user isn't running any debuggers or such to flip bits in your application to change the votes? Do you want to ensure that the user doesn't install logging software to keep track of who voted for who? Do you want to ensure that the person who is supposed to be voting is actually voting? Security is a very broad subject, and it's hard to give an answer without knowing what exactly you are looking for. |
Yes, of course integrated cards are awful. :) But this wasn't a question about gaming, but rather about an application that we are writing that will use OpenGL/D3D for 3D rendering. The 3D scene is relatively small, but antialiasing makes a dramatic difference in terms of the quality of the rendering. We are curious if there is some way to easily determine which cards support these features fully and which do not.
With the exception of the 3100, so far all of the cards we've found that do antialiasing are plenty fast for our purposes (as is my GeForce 9500). |
How do I execute a file in Cygwin? |
|c|gcc|cygwin| |
I created a C file in Eclipse on Windows and then used Cygwin to navigate to the directory. I called gcc on the C source file and a.exe was produced. How do I execute a.exe in the Cygwin shell? |
You need to index an associative container two ways:
- Insertion order
- String comparison
Try [Boost.MultiIndex][1]. I haven't used it this way but I think it's possible.
[1]: http://www.boost.org/doc/libs/1_36_0/libs/multi_index/doc/index.html |
SQL Server 2005 Auto Updated DateTime Column - LastUpdated |
|sql-server| |
I have a table defined (see code snippet below). How can I add a constraint or whatever so that the LastUpdate column is automatically updated anytime the row is changed?
CREATE TABLE dbo.Profiles
(
UserName varchar(100) NOT NULL,
LastUpdate datetime NOT NULL CONSTRAINT DF_Profiles_LastUpdate DEFAULT (getdate()),
FullName varchar(50) NOT NULL,
Birthdate smalldatetime NULL,
PageSize int NOT NULL CONSTRAINT DF_Profiles_PageSize DEFAULT ((10)),
CONSTRAINT PK_Profiles PRIMARY KEY CLUSTERED (UserName ASC),
CONSTRAINT FK_Profils_Users FOREIGN KEY (UserName) REFERENCES dbo.Users (UserName) ON UPDATE CASCADE ON DELETE CASCADE
) |
You're going to have to use triggers for that. |
./a.exe at the prompt |
you should just be able to call it by typing in the file name. You may have to call ./a.exe as the current directory is usually not on the path for security reasons. |
just type ./a in the shell |
Just call it
> a
Make sure it will be found (path). |
One way to separate the MXML and ActionScript for a component into separate files is by doing something similar to the ASP.Net 1.x code behind model. In this model the declarative part (the MXML in this case) is a subclass of the imperative part (the ActionScript). So I might declare the code behind for a class like this:
package CustomComponents
{
import mx.containers.*;
import mx.controls.*;
import flash.events.Event;
public class MyCanvasCode extends Canvas
{
public var myLabel : Label;
protected function onInitialize(event : Event):void
{
MyLabel.text = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit.";
}
}
}
...and the markup like this:
<?xml version="1.0" encoding="utf-8"?>
<MyCanvasCode xmlns="CustomComponents.*"
xmlns:mx="http://www.adobe.com/2006/mxml"
initialize="onInitialize(event)">
<mx:Label id="myLabel"/>
</MyCanvasCode>
As you can see from this example, a disadvatage of this approach is that you have to declare controls like **myLabel** in both files. |
The main difference I noticed in moving from SQL Server to Oracle was that in Oracle you need to use cursors in the SELECT statements.
Also, temporary tables are used differently. In SQL Server you can create one in a procedure and then DROP it at the end, but in Oracle you're supposed to already have a temporary table created before the procedure is executed.
I'd look at datatypes too since they're quite different. |
What is the best way to convert an array to a hash in Ruby |
|ruby| |
In Ruby, given an array in one of the following forms...
[apple, 1, banana, 2]
[[apple, 1], [banana, 2]]
...what is the best way to convert this into a hash in the form of...
{apple => 1, banana => 2} |
|ruby|arrays| |
Actually, @ajmastrean, you are wrong, they are not.
The official MS guidelines tells you to have the curly brace on the same line as the method/property/class and many other things which are not enforced in Visual Studio.
You can change all these auto-text settings under:<br />
**Tools -> Options -> Text Editor -> [The language you want to change]** |
They way I have designed the database before is to have an News-table containing basic info like NewsID (int), NewsPubDate (datetime), NewsAuthor (varchar/int) and then have a linked table NewsText that has these columns: NewsID(int), NewsText(text), NewsLanguageID(int). And at last you have a Language-table that has LanguageID(int) and LanguageName(varchar).
Then, when you want to show your users the news-page you do:
SELECT NewsText FROM News INNER JOIN NewsText ON News.NewsID = NewsText.NewsID
WHERE NewsText.NewsLanguageID = <<Session["UserLanguageID"]>>
That Session-bit is a local variable where you store the users language when they log in or enters the site for the first time. |
If you're not on SQL Server 2008 and you have some solid reasons for putting specific image files in the database, then you could take the "both" approach and use the file system as a temporary cache and use the database as the master repository.
For example, your business logic can check if an image file exists on disc before serving it up, retrieving from the database when necessary. This buys you the capability of multiple web servers and fewer sync issues. |
Do you have any add-ins installed (or uninstalled)? I find that effects my intellisense. Besides that just making sure your Tools->Options->All Languages "Auto LIst Members" and "Parameter Information" are checked off.
|
I like the Request/Response object pattern, where you encapsulate your arguments into a single [Operation]Request class, which has simple public properties on it.
Something like AddCustomerRequest, which would return AddCustomerResponse.
The response can include information on the success/failure of the operation, any messages that might be used by the UI, possibly the ID of the customer that was added, for example.
Another good pattern is to make these all derive from a simple IMessage interface, where your general end-point is something like Process(params IMessage[] messages)... this way you can pass in multiple operations in the same web request. |
Most database engines should support dumping your database into a file. I know MySQL does, anyway. This will just be a text file, so you could submit that to Subversion, or whatever you use. It'd be easy to run a diff on the files too. |
Multiple submit buttons on a form |
|html|forms| |
Let's say you create a Wizard in an HTML form. One button goes back and one goes forward. Since the "back" button appears first in the markup, when you press Enter it will use that button to submit the form.
Ex:
<form>
<input type="text" name="field1" /> <!-- put your cursor in this field and press Enter -->
<input type="submit" name="prev" value="Previous Page" /> <!-- This is the button that will submit -->
<input type="submit" name="next" value="Next Page" /> <!-- But this is the button that I WANT to submit -->
</form>
What I would LIKE to do, is get to decide which button is used to submit the form when a user presses Enter. That way, when you press Enter the Wizard will move to the next page, not the previous. Do you have to use tabindex to do this? |
|html| |
Flat File Databases in PHP |
|php| |
What are your best practices around creating flat file database structures in PHP? A lot of the more mature PHP flat file frameworks I see out there attempt to implement SQL-like query syntax, which is over the top for my purposes in most cases (I would just use a database at that point).
Are there any elegant tricks out there to get good performance and features with the small code overhead one would want by taking on this problem in the first place? |
|php|database| |
PHP Session Security |
|php|security| |
What are some guidelines for maintaining responsible session security with PHP? There's information all over the web, so it's about time it all landed in one place! |
One guideline is to call [session_regenerate_id][1] every time a session's security level changes. This helps prevent session hijacking.
[1]:http://www.php.net/session_regenerate_id |
I think one of the major problems (which is being addressed in PHP 6) is register_globals. Right now one of the standard methods used to avoid register_globals is to use the $_REQUEST, $_GET or $_POST arrays.
The "correct" way to do it (as of 5.2, although it's a little buggy there, but stable as of 6, which is coming soon) is through [filters][1].
So instead of:
$username = $_POST["username"];
you would do:
$username = filter_input(INPUT_POST, 'username', FILTER_SANITIZE_STRING);
or even just:
$username = filter_input(INPUT_POST, 'username');
[1]: http://us.php.net/filter |
I would be a bit reluctant to use nested classes here. What if you created an abstract base class for a "multimedia driver" to handle the back-end stuff (workhorse), and a separate class for the front-end work? The front-end class could take a pointer/reference to an implemented driver class (for the appropriate media type and situation) and perform the abstract operations on the workhorse structure.
My philosophy would be to go ahead and make both structures accessible to the client in a polished way, just under the assumption they would be used in tandem.
I would reference something like a [QTextDocument][1] in Qt. You provide a direct interface to the bare metal data handling, but pass the authority along to an object like a QTextEdit to do the manipulation.
[1]: http://doc.trolltech.com/4.4/qtextdocument.html |
SSRS - Post Publishing Tasks |
|reporting-services|automation| |
As part of the publishing "best practices" i came up with my own, i tend to archive report groups and republish the "updated" reports. However, with this stratedgy, I lose users associated with each report, or have to rehide reports.
Is there an automated process I can use to hide reports, or add users, after deploying form Visual Studio? |
Changing the resolution of a VNC session in linux |
|linux|vnc| |
I use VNC to connect to a Linux workstation at work. At work I have a 20" monitor that runs at 1600x1200, while at home I use my laptop with its resolution of 1440x900.
If I set the vncserver to run at 1440x900 I miss out on a lot of space on my monitor, whereas if I set it to run at 1600x1200 it doesn't fit on the laptop's screen, and I have to scroll it all the time.
Is there any good way to resize a VNC session on the fly?
My VNC server is RealVNC E4.x (I don't remember the exact version) running on SuSE64. |
I always preferred to write my Ajax calls in javascript using JQuery or Prototype. ASP.NET Ajax Toolkit does make things easier, but it never seems to do so elegantly.
I personally would make a new Calendar Controller. This way you can control the AJAX (using JQuery/Prototype) calls that are being made. |
A lot of people don't know or use the debugger to it's fullest - I.E. just use it to stop code, but right click on the red circle and there are a lot more options such as break on condition, run code on break.
Also you can change variable values at runtime using the debugger which is a great feature - saves rerunning code to fix a silly logic error etc. |
As far as I know there's no way to change the client's resolution just using VNC, as it is just a "monitor mirroring" application.
[TightVNC][1] however (which is a VNC client and server application) can resize the screen on the client side, i.e. making everything a little smaller (similar to image resizing techniques in graphics programs). That should work if you don't use too small font sizes. VNC should theoretically be compatible between different VNC applications.
[1]: http://www.tightvnc.com/ |
Depending on what your requirements are, Windows Workflow Foundation (.NET 3.5) might be worth having a look at.
The .NET rule engine [InRule][1] supports WF and BizTalk; I've not tried it though so don't know if it's any good.
[1]: http://www.inrule.com/default.aspx |
Depending on what your requirements are, [Windows Workflow Foundation][1] (.NET 3.5) might be worth having a look at.
The .NET rule engine [InRule][2] supports WF and BizTalk; I've not tried it though so don't know if it's any good.
[1]: http://msdn.microsoft.com/en-us/netframework/aa663328.aspx
[2]: http://www.inrule.com/default.aspx |
[Fredrik](http://stackoverflow.com/questions/15716/design-problems-with-net-usercontrol#15803) is right, basically, when you need to enable the designer to persist the property to page so it can be instantiated at run time. There is only one way to do this, and that is to write its values to the ASPX page, which is then picked up by the runtime.
Otherwise, the control will simply revert to its default state each and every time.
Always keep in the back of your mind that the Page (and its contents) and the code are completely seperate in ASP.NET, they are hooked up at run time. This means that you dont get the nice code-behind designer support like you do in a WinForms app (where the form is an instance of an object). |
An other (better ?) way is probablby using the new keyword to prevent a particular method from being overiden:
class A
{
public virtual void Render()
{
}
}
class B : A
{
public override void Render()
{
// Prepare the object for rendering
SpecialRender();
// Do some cleanup
}
protected virtual void SpecialRender()
{
}
}
class B2 : B
{
public new void Render()
{
}
}
class C : B2
{
protected override void SpecialRender()
{
}
//public override void Render() // compiler error
//{
//}
} |
An other (better ?) way is probablby using the new keyword to prevent a particular virtual method from being overiden:
class A
{
public virtual void Render()
{
}
}
class B : A
{
public override void Render()
{
// Prepare the object for rendering
SpecialRender();
// Do some cleanup
}
protected virtual void SpecialRender()
{
}
}
class B2 : B
{
public new void Render()
{
}
}
class C : B2
{
protected override void SpecialRender()
{
}
//public override void Render() // compiler error
//{
//}
} |
Check out some of the [mono libs][2]. They have a great one to parse command line arguments but can't remember the namespace.
Miguel just posted some [terminal code][1] as well.
[1]: http://tirania.org/blog/
[2]: http://www.go-mono.com/docs/index.aspx?link=N:Mono.Terminal |
Take a look at the [Enumerable.SequenceEqual][1] method
[1]: http://msdn.microsoft.com/en-us/library/bb348567.aspx |
Take a look at the [Enumerable.SequenceEqual][1] method
var dictionary = new Dictionary<int, string>() {{1, "a"}, {2, "b"}};
var intList = new List<int> {1, 2};
var stringList = new List<string> {"a", "b"};
var test1 = dictionary.Keys.SequenceEqual(intList);
var test2 = dictionary.Values.SequenceEqual(stringList);
[1]: http://msdn.microsoft.com/en-us/library/bb348567.aspx |
Dispose does call DestroyHandle, but not always. If I close the parent window, then Windows will destroy all child windows. In this situation Dispose won't call DestroyHandle (since it is already destroyed). In other words, DestroyHandle is called to destroy the window, it is not called when the window is destroyed.
The solution is to override either OnHandleDestroyed, or Dispose. I'm opting for Dispose.
|
This is not an answer to my quetion, but a solution to my issue example.
Instead of using multiple fixtures or changing the fixtures, I edit the Model::_schema arrays by removing the fields that I wanted to test without. This has the effect that the model acts as if the fields was not there, but I am unsure if this is a 100% test. I do not think it is for all cases, but it works for my example. |
Consider using <a href="https://facelets.dev.java.net/">facelets</a>- it greatly simplifies the worst parts of JSF development. I'm doing a CMS-based JSF project now without facelets (after doing a project with it) and it feels like my left arm is missing....
|
Partial methods have been introduced for similar reasons to why partial classes were in .Net 2.
A partial class is one that can be split across multiple files - the compiler builds them all into one file as it runs.
The advantage for this is that Visual Studio can provide a graphical designer for part of the class while coders work on the other.
The most common example is the Form designer. Developers don't want to be positioning buttons, input boxes, etc by hand most of the time.
* In .Net 1 it was auto-generated code in a `#region` block
* In .Net 2 these became separate designer classes - the form is still one class, it's just split into one file edited by the developers and one by the form designer
This makes maintaining both much easier. Merges are simpler and there's less risk of the VS form designer accidentally undoing coders' manual changes.
In .Net 3.5 Linq has been introduced. Linq has a DBML designer for building your data structures, and that generates auto-code.
The extra bit here is that code needed to provide methods that developers might want to fill in.
As developers will extend these classes (with extra partial files) they couldn't use abstract methods here.
The other issue is that most of the time these methods wont be called, and calling empty methods is a waste of time.
Empty methods [are not optimised out](http://stackoverflow.com/questions/11783/in-net-will-empty-method-calls-be-optimized-out).
So Linq generates empty partial methods. If you don't create your own partial to complete them the C# compiler will just optimise them out.
So that it can do this partial methods always return void.
If you create a new Linq DBML file it will auto-generate a partial class, something like
[System.Data.Linq.Mapping.DatabaseAttribute(Name="MyDB")]
public partial class MyDataContext : System.Data.Linq.DataContext
{
...
partial void OnCreated();
partial void InsertMyTable(MyTable instance);
partial void UpdateMyTable(MyTable instance);
partial void DeleteMyTable(MyTable instance);
...
Then in your own partial file you can extend this:
public partial class MyDataContext
{
partial void OnCreated() {
//do something on data context creation
}
}
If you don't extend these methods they get optimised right out. |
Having seen a pile of machines recently that don't do it, I don't think that's quite true. The GMA 950 integrated ones don't do it to start with, and I don't think that the 3100/X3100 do either. Also, I don't believe that the GeForce MX5200 supported it either.
Or perhaps I'm just misunderstanding what you mean when you refer to "AA mode". Are there a lot of cards which support modes that are virtually unnoticable? :) |
Having seen a pile of machines recently that don't do it, I don't think that's quite true. The GMA 950 integrated ones don't do it to start with, and I don't think that the 3100/X3100 do either (at least not in hardware... the 3100 was enormously slow in a demo). Also, I don't believe that the GeForce MX5200 supported it either.
Or perhaps I'm just misunderstanding what you mean when you refer to "AA mode". Are there a lot of cards which support modes that are virtually unnoticable? :) |
HTML Select Tag with black background - dropdown triangle is invisible in Firefox 3 |
|html|css|firefox|html-select| |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.