instruction stringlengths 0 30k ⌀ |
|---|
Best way to license Microsoft software as a very small developer |
|visual-studio|windows|licensing|microsoft|consulting| |
I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer?
My previous boss suggested I get a TechNet Plus subscription for OS licenses, I've done that and appears to be what I need, but open to other options for the future.
Visual Studio I'm having a hard time figuring out exactly what is the difference between Professional and Standard. Also I'd really like a digital version, but seems that expensive MSDN subscription is the only way? |
I've recently switched from being an employee of a small consulting company to being an independent consultant and as time goes on I will need to upgrade Windows and Visual Studio. So what is the most affordable way to go about this for a small time developer?
My previous boss suggested I get a TechNet Plus subscription for OS licenses, I've done that and appears to be what I need, but open to other options for the future.
Visual Studio I'm having a hard time figuring out exactly what is the difference between Professional and Standard. Also I'd really like a digital version, but seems that expensive MSDN subscription is the only way?
Visual Studio 2008 Professional with MSDN Professional listed <a href="http://msdn.microsoft.com/en-us/subscriptions/aa718657.aspx">here</a> appears to be semi-reasonably priced at $1,199. That would make the TechNet Plus subscription unneeded.
|
Best way to license Microsoft software as an independent developer |
|windows|visual-studio|microsoft|licensing|consulting| |
This is to avoid confusion with `.ToString()` methods.
For instance:
double test = 1.54d;
//string.Format pattern
string.Format("This is a test: {0:F1}", test );
//ToString pattern
"This is a test: " + test.ToString("F1");
If Format was an instance method on string this could cause confusion, as the patterns are different. |
This is to avoid confusion with `.ToString()` methods.
For instance:
double test = 1.54d;
//string.Format pattern
string.Format("This is a test: {0:F1}", test );
//ToString pattern
"This is a test: " + test.ToString("F1");
If Format was an instance method on string this could cause confusion, as the patterns are different.
String.Format() is a utility method to turn multiple objects into a formatted string.
An instance method on a string does something to that string.
Of course, you could do:
public static string FormatInsert( this string input, params object[] args) {
return string.Format( input, args );
}
"Hello {0}, I have {1} things.".FormatInsert( "world", 3); |
Another possibility could be from side effects. Most min/max macros will include the parameters multiple times and may not do what you expect. Errors and warnings could also be generated.
<PRE>
max(a,i++) expands as ((a) > (i++) ? (a) : (i++))
afterwards i is either plus 1 or plus 2
</PRE>
The () in the expansion are to avoid problems if you call it with formulae. Try expanding max(a,b+c) |
Dog should return a Leg not a DogLeg as the return type. The actual class may be a DogLeg, but the point is to decouple so the user of Dog doesn't have to know about DogLegs, they only need to know about Legs.
Change:
class Dog : Animal
{
public override DogLeg GetLeg() {...}
}
to:
class Dog : Animal
{
public override Leg GetLeg() {...}
}
Don't Do this:
if(a instanceof Dog){
DogLeg dl = (DogLeg)a.GetLeg();
it defeats the purpose of programing to the abstract type.
The reason to hide DogLeg is because the GetLeg function in the abstract class returns an Abstract Leg. If you are overriding the GetLeg you must return a Leg. Thats the point of having a method in an abstract class. To propagate that method to it's childern. If you want the users of the Dog to know about DogLegs make a method called GetDogLeg and return a DogLeg.
If you COULD do as the question asker wants to, then every user of Animal would need to know about ALL animals. |
Comparing with .asmx: WCF is the next generation of Microsoft's Web service development platform, which addresses many of the issues with older versions, specifically:
- better interoperation, so you can interoperate with Web services that aren't from Microsoft or that are published on the Internet
- much more flexible, so it's easier and faster for developers to get their jobs done
- easier to configure without changing code, reducing the cost of maintenance significantly
It may be that they raise the question of how it relates to SOA, a "service-oriented architecture". WCF is the Microsoft solution for creating applications that participate in these distributed systems.
|
Did you try `[textView sizeThatFits:textView.bounds]` ? |
Did you try `[textView sizeThatFits:textView.bounds]` ?
Edit: sizeThatFits returns the size but does not actually resize the component. I'm not sure if that's what you want, or if `[textView sizeToFit]` is more what you were looking for. In either case, I do not know if it will perfectly fit the content like you want, but it's the first thing to try. |
The first thing I would look at is whether you have any asp controls being displayed on the page. The doPostback function will only be put into the page if ASP thinks that one of your controls requires it. |
The first thing I would look at is whether you have any asp controls being displayed on the page. The doPostback function will only be put into the page if ASP thinks that one of your controls requires it.
If you aren't using one of those you can use:
Page.ClientScript.GetPostBackClientHyperlink(controlName, "")
to add the function to your page |
The first thing I would look at is whether you have any asp controls (such as linkbutton, comboboxes,that don't normally generate a submit but requre a postback) being displayed on the page.
**The __doPostback function will only be put into the page if ASP thinks that one of your controls requires it.**
If you aren't using one of those you can use:
Page.ClientScript.GetPostBackClientHyperlink(controlName, "")
to add the function to your page |
Why can't you load the .net runtime into you process space? It is possible to host the .net runtime and call into .net using COM. |
Do indexes work with "IN" clause |
|sql|query|indexing| |
If I have a query like:
Select EmployeeId From Employee Where EmployeeTypeId IN (1,2,3)
and I have an index on the EmployeeTypeId field, does SQL server still use that index? |
While I do not have an algorithm for you, my first action would be to take a look at the process involved in entering a new contact. Perhaps users do not have an easy way to find the contact they are looking for. Much like on Stack Overflow's new question form, you could suggest contacts that already exist on the new contact screen. |
Binding Events to Event Handlers is usually your first introduction to delegates...You might not even know you were using them because the delegate is wrapped up in the EventHandler class.
|
I'm not sure if you can figure out the exact name of the build configuration. Howerver, if you use Debug.Assert(...), that code will only be run when you compile in debug mode. Not sure it that helps you at all. |
Usually it would, unless the IN clause covers too much of the table, and then it will do a table scan. Best way to find out in your specific case would be to run it in the query analyzer, and check out the execution plan. |
You can use [precompiler directives][1] within Visual Studio. The #if directive will allow you to determine if you are going to include code or not based on your custom solution configuration.
[1]: http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx |
Windows Mobile - What scripting platforms are available? |
|windows-mobile|scripting|system-administration|administration| |
We have a number of users with Windows Mobile 6 and need to apply minor changes. eg. update a registry setting. One option is push and execute an executable file using our device management software.
I'd like this to be a little more friendly for the admins who are familiar with scripting in VBScript/JScript etc. What are the options for scripting on Windows Mobile devices? |
|scripting|system-administration|administration|windows-mobile| |
|scripting|windows-mobile|system-administration|administration| |
add a const value assign to a value that designate the configuration you are in.
like
#ifdef _ENABLE_CODE1_
const codeconfig = 1;
#else
const codeconfig = 2;
#endif
and add _ENABLE_CODE1_ in your configuration preprocessor. |
A quick google search came up with this http://en.wikipedia.org/wiki/Delegation_pattern . Basically, anytime that you use an object that forwards it's calls to another object then you are delegating. |
I'm writing a plugin that will parse a bunch of files in a project. But for the moment I'm stuck searching through the Eclipse API for answers.
The plugin works like this: Whenever I open a source file I let the plugin parse the source's corresponding build file (this could be further developed with caching the parse result). Getting the file is simple enough:
public void showSelection(IWorkbenchPart sourcePart) {
// Gets the currently selected file from the editor
IFile file = (IFile) workbenchPart.getSite().getPage().getActiveEditor()
.getEditorInput().getAdapter(IFile.class);
if (file != null) {
String path = file.getProjectRelativePath();
/** Snipped out: Rip out the source path part
* and replace with build path
* Then parse it. */
}
}
The problem I have is I have to use **hard coded strings** for the paths where the source files and build files go. Anyone know how to retrieve the build path from Eclipse? (I'm working in CDT by the way). Also is there a simple way to determine what the source path is (e.g. one file is under the "src" directory) of a source file? |
Any information you can get about the user's environment can be fetched from
System.getProperty("...");
For a list of what you can get, take a look here: [http://mgrand.home.mindspring.com/java-system-properties.htm][1]
I don't think you'll be able to get the path you require (the All Users path) in an OS dependent way. After all - do other operating systems have an equivalent? Your best bet is to probably inspect:
System.getProperty("os.name");
to see if you are running Windows and then if so use "C:\Documents & Settings\All Users\".
But you'll be better off just constantly using
System.getProperty("user.home");
(as mentioned by other people) throughout the application. Or alternatively, allow the user to specify the directory to store whatever it is you want to store.
[1]: http://mgrand.home.mindspring.com/java-system-properties.htm |
Yep, you can do it across the 3 something like the below:
SELECT page_tag.id, page.name, group_concat(tags.name) FROM tag,page, page_tag
where page_tag.page_id = page.page_id AND page_tag.tag_id = tag.id;
Has not been tested, and could be probably be written a tad more efficiently, but should get you started!
Also, MySQL is assumed, so may not play so nice with MSSQL! And MySQL isn't wild about hyphens in field names, so changed to underscores in the above examples. |
You could use a treeview control and use a recursive XLinq algorithm to put the data in there. I've done that myself with an interface allow a user to build up a custom XML representation and it worked really well. |
Is there a html opposite to noscript |
|html|javascript| |
Is there a tag in html that will only display its content if JavaScript is enabled? I know noscript works the opposite way around, displaying its html content when JavaScript is turned off. but I would like to only display a form on a site if JavaScript is available, telling them why they cant use the form if they don't have it.
The only way I know who to do this is with the document.write(); method in a script tag, and it seams a bit messy for large amounts of html.
Thanks |
SimpleModal breaks ASP.Net Postbacks |
|jquery|asp.net|javascript|postback|simplemodal| |
I'm using [jQuery](http://jquery.com/) and [SimpleModal](http://www.ericmmartin.com/projects/simplemodal/) in an ASP.Net project to make some nice dialogs for a web app. Unfortunately, any buttons in a modal dialog can no longer execute their postbacks, which is not really acceptable.
There is one source I've found with a [workaround](http://blog.hurlman.com/post/jQuery2c-simpleModal2c-and-ASPNet-postbacks-do-not-play-well-together.aspx), but for the life of me I can't get it to work, mostly because I am not fully understanding all of the necessary steps.
I also have a workaround, which is to replace the postbacks, but it's ugly and probably not the most reliable. I would really like to make the postbacks work again. Any ideas? |
|asp.net|javascript|jquery|postback|simplemodal| |
I'm using [jQuery](http://jquery.com/) and [SimpleModal](http://www.ericmmartin.com/projects/simplemodal/) in an ASP.Net project to make some nice dialogs for a web app. Unfortunately, any buttons in a modal dialog can no longer execute their postbacks, which is not really acceptable.
There is one source I've found with a [workaround](http://blog.hurlman.com/post/jQuery2c-simpleModal2c-and-ASPNet-postbacks-do-not-play-well-together.aspx), but for the life of me I can't get it to work, mostly because I am not fully understanding all of the necessary steps.
I also have a workaround, which is to replace the postbacks, but it's ugly and probably not the most reliable. I would really like to make the postbacks work again. Any ideas?
UPDATE: I should clarify, the postbacks are not working because the Javascript used to execute the post backs has broken in some way, so nothing happens at all when the button is clicked. |
Compiling for a 64bit OS is an option in the compiler. You can absolutely compile to a 32bit exe from within Vista 64 bit. When you run the app, you can then see in the TaskManager that there is a "*32" next to the process...this means it's 32bit ;)
I believe your managers need some more education on what 64bit OS really means :) |
There are two possible solutions here.
1. Add a constraint to the ignore route to make sure that only requests that should be ignored would match that route. Kinda kludgy, but it should work.
RouteTable.Routes.IgnoreRoute("{folder}/{*pathInfo}", new {folder="content"});
2. What is in your content directory? By default, Routing does not route files that exist on disk (actually checks the VirtualPathProvider). So if you are putting static content in the Content directory, you might not need the ignore route. |
As long as you compile your executables as 32 bit, they will run on both 32 bit and 64 Windows machines (guaranteed). Using 64 dev machines has the advantage that you can start testing your code with 64 bit compilation (to check for things like pointers casted to 32 bit integers), this way making the transition to 64 bit easier in the future (should you your company choose to do a 64 bit version). |
Not an answer to your question, but possibly a solution to your problem: VirtualBox (and probably others) supports "seamless integration" mode, which just gives you a second start bar and lets you drag windows around freely.
Also, and this is an answer to your question, it depends on your compile settings. You can compile for different environments, and you can perfectly compile 32-bit programs on a 64-bit system with Visual Studio. Can't tell you how, but I'm sure some Visual Studio guru could help you out. |
Recommended iPhone Development Resources |
|iphone| |
This is my first post here and I wanted to get some input from people doing iPhone development. Other than the Apple DevCenter, where are there good sites to learn iPhone developement?
I know Apple has a tough NDA but there has to be people talking about writing applications for the iPhone.
Thank you,
Rob Bazinet
|
|duplicate| |
|iphone|duplicate| |
|iphone|resources| |
Craig Hockenberry (developer of Twitterrific) blogs about iPhone development issues at [furbo.org][1]
[1]: http://furbo.org/ |
> Why is a code solution that works
> getting voted down? Sure, it's ugly
> ...
Perhaps because as well as being ugly it isn't educational and **doesn't** work. Also, I suspect that like me, most people don't have the power to edit at present (and judging by the rank needed - never will).
The use of an array can be good for efficiency, but that's not mentioned in this code.
It also takes no account of upper and lower case so it does not work for the example supplied in the question. FFFFFFFE |
Although I use Vim, some of my cow-orkers use [SlickEdit](http://www.slickedit.com/) which looks pretty good. I'm not certain about integrated debugging because we wouldn't be able to do that on our particular project anyway.
SlickEdit does have good support for navigating large code bases, with cross referencing and tag jumping. Of course it has the basic stuff like syntax highlighting and code completion too. |
> could you clarify a little bit more how it was for you, what you had to change. Maybe you could point me in the right direction by providing some links to the information you used.
My first source were actually the tools' `man` pages. Just type
$ man toolname
on the command line (`$` here is part of the prompt, not the input).
Depending on the platform, they're quite well-written and can also be found on the internet. In the case of `make`, I actually read the complete [documentation](http://www.gnu.org/software/make/manual/make.html) which took a few hours. Actually, I don't think this is necessary or helpful in most cases but I had a few special requirements in my first assignments under Linux that required a sophisticated makefile. After writing the makefile I gave it to an experienced colleague who did some minor tweaks and corrections. After that, I pretty much knew `make`.
I used GVIM because I had some (but not much) prior experience there, I can't say anything at all about Emacs or alternatives. I find it really helps to read other peoples' `.gvimrc` config file. Many people put it on the web. Here's [mine](http://page.mi.fu-berlin.de/krudolph/stuff/gvimrc.html).
Don't try to master all binutils at once, there are too many functions. But get a general overview so you'll know where to search when needing something in the future. You *should*, however, know all the important parameters for `g++` and `ld` (the GCC linker tool that's invoked automatically except when explicitly prevented).
> Also I'm curious, do you have code completion and syntax highlighting when you code?
Syntax highlighting: yes, and a much better one than Visual Studio. Code completion: yes-*ish*. First, I have to admit that I didn't use C++ code completion even in Visual Studio because (compared to VB and C#) it wasn't good enough. I don't use it often now but nevertheless, GVIM *has* native code completion support for C++. Combined with the [ctags](http://ctags.sourceforge.net/) library and a plug-in like [taglist](http://vim-taglist.sourceforge.net/) this is almost an IDE.
Actually, what got me started was an [article](http://lucumr.pocoo.org/articles/vim-as-development-environment) by Armin Ronacher. Before reading the text, look at the screenshots at the end of it!
> do you have to compile first before getting (syntax) errors?
Yes. But this is the same for Visual Studio, isn't it (I've never used Whole Tomato)? Of course, the syntax highlighting will show you non-matching brackets but that's about all.
> and how do you debug (again think breakpoints etc)?
I use `gdb` which is a command-line tool. There's also a graphical frontend called `DDD`. `gdb` is a modern debugging tool and can do everything you can do in an IDE. The only thing that really annoys me is reading a stack trace because lines aren't indented or formatted so it's really hard to scan the information when you're using a lot of templates (which I do). But those also clutter the stack trace in IDEs.
> Like I said, I had the 'pleasure' to set my first steps in the Java programming language using windows notepad and the command line java compiler in high school, and it was, .. wel a nightmare! certainly when I could compare it with other programming courses I had back then where we had decent IDE's
You shouldn't even try to compare a modern, full-feature editor like Emacs or GVIM to Notepad. Notepad is an embellished `TextBox` control, and this really makes all the difference. Additionally, working on the command line is a very different experience in Linux and Windows. The Windows `cmd.exe` is severely crippled. PowerShell is much better. |
|javascript|html| |
It's not possible to obtain 'true' random numbers, a computer is a logical construct that can't possibly create 'truly' random anything, only pseudo-random. There are better and worse pseudo-random algorithms out there, however.
In order to obtain a 'truly' random number you need a physical random source, some gambling machines actually have these built in - often it's a radioactive source, the radioactive decay (which as far as I know is *truly* random) is used to generate the numbers. |
I believe that was on [thedailywtf.com][1] - ie. not something that you want to do.
It is not possible to get a truly random number from pseudorandom numbers, no matter how many times you call randomize().
You *can* get "true" random numbers from special [hardware][2]. You could also collect entropy from mouse movements and things like that.
[1]: http://thedailywtf.com/Articles/Random-Stupidity.aspx
[2]: http://en.wikipedia.org/wiki/Hardware_random_number_generator |
I think you may need to use multiple updates.
Something like (not tested):
select ID as 'PageId', Name as 'PageName', null as 'Tags'
into #temp
from [PageTable]
declare @lastOp int
set @lastOp = 1
while @lastOp > 0
begin
update p
set p.tags = isnull(tags + ', ', '' ) + t.[Tagid]
from #temp p
inner join [TagTable] t
on p.[PageId] = t.[PageId]
where p.tags not like '%' + t.[Tagid] + '%'
set @lastOp == @@rowcount
end
select * from #temp
Ugly though.
That example's T-SQL, but I think MySql has equivalents to everything used. |
Lets change this around a bit. If your program is trying to write to a file and failing you either need to change the location of the file to one where the user can write to, or check the correct rights when the program starts and refuse to run if the user doesn't have them. Trampling over the system permissions is not the answer. |
I have not done this, but here it goes.
1. Convert Visio file to Visio XML format.
2. Use [Dia for Windows][1] and [Dia VDX plug-in][2] to convert Visio XML into Dia.
3. Use [tedia2sql][3] to generate SQL.
[1]: http://dia-installer.de/index_en.html
[2]: http://www.redferni.uklinux.net/dia/vdx/
[3]: http://tedia2sql.tigris.org/ |
[According to Wikipedia][1] `/dev/random`, in Unix-like operating systems, is a special file that serves as a true random number generator.
The /dev/random driver gathers environmental noise from various non-deterministic sources including, but not limited to, inter-keyboard timings and inter-interrupt timings that occur within the operating system environment. The noise data is sampled and combined with a CRC-like mixing function into a continuously updating ``entropy-pool''. Random bit strings are obtained by taking a MD5 hash of the contents of this pool. The one-way hash function distills the true random bits from pool data and hides the state of the pool from adversaries.
The /dev/random routine maintains an estimate of true randomness in the pool and decreases it every time random strings are requested for use. When the estimate goes down to zero, the routine locks and waits for the occurrence of non-deterministic events to refresh the pool.
The /dev/random kernel module also provides another interface, /dev/urandom, that does not wait for the entropy-pool to re-charge and returns as many bytes as requested. As a result /dev/urandom is considerably faster at generation compared to /dev/random which is used only when very high quality randomness is desired.
[1]: http://en.wikipedia.org/wiki/Urandom |
The finally block will always be called (well not really [always](http://thedailywtf.com/Articles/My-Tales.aspx) ... ) even if an exception is thrown or a return statement is reached (although that may be language dependent). It's a way to clean up that you know will always be called. |
It means that the grouping is [atomic][1], throwing away backtracking information that would support non-possessive capturing.
[1]: http://www.regular-expressions.info/atomic.html |
It means that the grouping is [atomic][1], and it throws away backtracking information for a matched group. So, this expression is possessive; it won't back off even if doing so is the only way for the regex as a whole to succeed. It's "independent" in the sense that it doesn't cooperate, via backtracking, with other elements of the regex to ensure a match.
[1]: http://www.regular-expressions.info/atomic.html |
You can't use an array.
Or rather, you would need to pick a size, and if you ended up needing more then you would have to allocate a new, larger, array, copy the data from the old one into the new one, and continue on as before (until you exceed the size of the new one...)
Generally, you would go with one of the collection classes - ArrayList, List<>, LinkedList<>, etc. - which one depends a lot on what you're looking for; List<float> will give you the closest thing to what i described initially, while LinkedList<> will avoid the problem of frequent re-allocations (at the cost of slower access and greater memory usage).
Example:
List<float[]> _calibrationSet = new List<float[]>();
// ...
while (recordsToRead)
{
float[] record = new float[SensorCount];
for (int i = 0; i < SensorCount; i++)
{
record[i] = calibrationArrayView.ReadFloat();
}
_calibrationSet.Add(record);
}
// access later: _calibrationSet[record][sensor]
|
You can't use an array.
Or rather, you would need to pick a size, and if you ended up needing more then you would have to allocate a new, larger, array, copy the data from the old one into the new one, and continue on as before (until you exceed the size of the new one...)
Generally, you would go with one of the collection classes - ArrayList, List<>, LinkedList<>, etc. - which one depends a lot on what you're looking for; List<float> will give you the closest thing to what i described initially, while LinkedList<> will avoid the problem of frequent re-allocations (at the cost of slower access and greater memory usage).
Example:
List<float[]> _calibrationSet = new List<float[]>();
// ...
while (recordsToRead)
{
float[] record = new float[SensorCount];
for (int i = 0; i < SensorCount; i++)
{
record[i] = calibrationArrayView.ReadFloat();
}
_calibrationSet.Add(record);
}
// access later: _calibrationSet[record][sensor]
Oh, and it's worth noting (as [this guy with a really long name][1] did), that what i'm doing here doesn't give you the same memory structure as a single, multi-dimensional array would - under the hood, it's an array of references to other arrays that actually hold the data. This speeds up building the array a good deal by making reallocation cheaper, but can have an impact on access speed (and, of course, memory usage). Whether this is an issue for you depends a lot on what you'll be doing with the data after it's loaded... and whether there are two hundred records or two million records.
[1]: http://stackoverflow.com/questions/50558/how-do-you-initialize-a-2-dimensional-array-when-you-do-not-know-the-size#50591 |
I don't know if there's a universally preferred pattern. I tend to prefer adding the event to the view interface and having the presenter respond to the view. I described this pattern in [more detail here][1].
[1]: http://haacked.com/archive/2006/08/09/ASP.NETSupervisingControllerModelViewPresenterFromSchematicToUnitTestsToCode.aspx |
You could write a custom route that derives from the Route class GetRouteData to strip dashes, but when you call the APIs to generate a URL, you'll have to remember to include the dashes for action name and controller name.
That shouldn't be too hard. |
Are you using javascript to communicate between frames/iframes which point to different domains? This is not permitted by the JS "same origin/domain" security policy. Ie, if you have
`<iframe name="foo" src="foo.com/script.js">`
`<iframe name="bar" src="bar.com/script.js">`
And the script on bar.com tries to access `window["foo"].Location.toString`, you will get this (or similar) exceptions. Please also note that the same origin policy can also kick in if you have content from different subdomains. [Here][1] you can find a short and to the point explanation of it with examples.
[1]: http://www.mozilla.org/projects/security/components/same-origin.html |
Do you really care about the individual data points? Or will using the statistical aggregate functions on the day number instead suffice to tell you what you wish to know?
- [AVG][1]
- [STDDEV_POP][2]
- [VARIANCE][3]
- [TO_DAYS][4]
[1]: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_avg
[2]: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_stddev-pop "STDDEV_POP"
[3]: http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_variance "VARIANCE"
[4]:http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_to-days "TO_DAYS" |
As far as finalizers go:
1. They are virtually useless. They aren't guaranteed to be called in a timely fashion, or indeed, at all (if the GC never runs, neither will any finalizers). This means you generally shouldn't rely on them.
2. Finalizers are not guaranteed to be idempotent. The garbage collector takes great care to guarantee that it will never call `finalize()` more than once on the same object. With well-written objects, it won't matter, but with poorly written objects, calling finalize multiple times can cause problems (e.g. double release of a native resource ... crash).
3. *Every* object that has a `finalize()` method should also provide a `close()` (or similar) method. This is the function you should be calling. e.g., `FileInputStream.close()`. There's no reason to be calling `finalize()` when you have a more appropriate method that *is* intended to be called by you.
|
When we built the first version of our own framework ([Inon Datamanager][1]) I had it read pre-existing SQL tables and autogenerate Java objects from them.
When my colleagues who came from a Smalltalkish background built the second version, they started from the objects and then autogenerated the tables.
Actually, they forgot about the SQL part altogether until I came back in and added it. But nowadays we just run a trigger on application startup which iterates over the object model, checks if the tables and all the right columns exist, and creates them if not. Very convenient.
This turned out to be a lot easier than you might expect - if your favourite tool doesn't support a similar process, you could probably write it in a couple of hours - assuming the relational to object mapping is relatively simple.
But the point is, it seems to depend on whether you're culturally an object person or a database person - you can regard either one as the authoritative source.
[1]: http://www.inon.com/page.jsp?page=datamanager "Inon Datamanager" |
@Rob G - Hey! That's my post! ;)
For some other good examples, be sure to browse the NUnit source code. I work closely with Charlie whenever I can to make sure it is building and testing on Mono. He tries to run whenever he can as well. |
Check out section <b>5.14.2. Moving files and folders</b> (or check out "move" in the Index of the help) of the TortoiseSVN help. You do a move via right-draging. It also mentions that you need to commit from the parent folder to make it "one" revision. This works for doing the change in a working copy.
You can also do the move via the Repo Browser (section <b>5.23. The Repository Browser
</b> of the help). |
In TortoiseSVN right click somewhere and go TortoiseSVN > Repo Browser open the repository.
All you then have to do is drag and drop the file from one folder to the where you want it. It'll ask you to add a commit message and it defaults it to "Moved file/folder remotely" |
- First - calling an extension method.
This style of coding is called "[fluent interface][1]" as you mentioned.
- Second method is called [language integrated query][2]
[1]: http://www.martinfowler.com/bliki/FluentInterface.html
[2]: http://en.wikipedia.org/wiki/Language_Integrated_Query |
the first isn't even really linq, its a lambda expression, with a type invariant object created. (a) => new { blah = b}
The second is a linq query filling an on the fly class that has a property Line. There is no hashrocket operator in this one, so this one is just plain old linq. |
I recommend that you walk over to your local book store this weekend, get a cup of coffee and find jQuery in Action by Manning Press. Go ahead and read the first chapter of this 300 page book in the store, then buy it if it resonates with you.
I think you'll be surprized by how easy jQuery lets you perform what your describing here. From ajax calls to the server in the background, to showing and hiding div tags based on the visitor's actions. The amount of code you have to write is super small.
There are a bunch of good JavaScript libraries, this is just one of them that I like, and it really is easy to get started. Start by including a reference to the current jQuery file with a <script> tag and then write a few lines of code to interact with your page. |
[Kevin Frei](http://blogs.msdn.com/freik/) talks about exception handling performance cost in his speech "[The Cost of C++ Exception Handling on Windows](http://www.nwcpp.org/Meetings/2006/10.html)". (Under "Summary & Conclusions" there is one list item that says "[Exception handling performance cost is] not always measurable".) |
Printing DOM Changes |
|browsers|internetexplorer|firefox| |
What I am trying to do is change the background colour of a table cell <td> and then when a user goes to print the page, the changes are now showing.
I am currently using an unobtrusive script to run the following command on a range of cells:
element.style.backgroundColor = "#f00"
This works on screen in IE and FF, however, when you go to Print Preview, the background colours are lost.
Am I doing something wrong? |
You can't use an array.
Or rather, you would need to pick a size, and if you ended up needing more then you would have to allocate a new, larger, array, copy the data from the old one into the new one, and continue on as before (until you exceed the size of the new one...)
Generally, you would go with one of the collection classes - ArrayList, List<>, LinkedList<>, etc. - which one depends a lot on what you're looking for; List<float> will give you the closest thing to what i described initially, while LinkedList<> will avoid the problem of frequent re-allocations (at the cost of slower access and greater memory usage).
Example:
List<float[]> _calibrationSet = new List<float[]>();
// ...
while (recordsToRead)
{
float[] record = new float[SensorCount];
for (int i = 0; i < SensorCount; i++)
{
record[i] = calibrationArrayView.ReadFloat();
}
_calibrationSet.Add(record);
}
// access later: _calibrationSet[record][sensor]
Oh, and it's worth noting (as [Grauenwolf][1] did), that what i'm doing here doesn't give you the same memory structure as a single, multi-dimensional array would - under the hood, it's an array of references to other arrays that actually hold the data. This speeds up building the array a good deal by making reallocation cheaper, but can have an impact on access speed (and, of course, memory usage). Whether this is an issue for you depends a lot on what you'll be doing with the data after it's loaded... and whether there are two hundred records or two million records.
[1]: http://stackoverflow.com/questions/50558/how-do-you-initialize-a-2-dimensional-array-when-you-do-not-know-the-size#50591 |
While I would recommend using ToString in this case, always keep in mind you can use ANY VB.Net function or class from C# just by referencing Microsoft.VisalBasic.dll. |
From the documentation it does not appear to be possible without actually adding several category template files (unless you custom program it). I run Wordpress, and I have only seen it accomplished category by category.
[http://codex.wordpress.org/Category_Templates][1]
[1]: http://codex.wordpress.org/Category_Templates |
I figured it out.
I created a method that passed the **ContextMenu.SourceControl()** property by reference so I could manipulate the control that called the ContextMenu. In the beginning of the method, I got the **SelectedValue** of the ComboBox and the reloaded the data in the ComboBoxes. I then set the **SelectedValue** to the value I had got in the beginning of the method.
Thank you DaveK for pointing me in the right direction. |
I'm not sure exactly what you mean by multi-line, but if it is selecting multiple elements in a drop down list, see this [demo][1].
If its showing elements that wrap mulitple lines in a drop down, see this [demo][2]. You can put a break in the HTML to achieve what you might be looking for. I've used this control in this manner before, so I can confirm it works.
Good luck.
[1]: http://www.easylistbox.com/demoMultiDropdown.aspx
[2]: http://www.easylistbox.com/demoCustomized.aspx |
When one unsigned and one signed variable are added (or any binary operation) both are implicitly converted to unsigned, which would in this case result in a huge result.
So it is safe in the sense of that the result might be huge and wrong, but it will never crash. |
I don't really understand why you want it was "source" rather than as a perl library, but you can download the source for any CPAN module.
I haven't used it, but [Tree][1] looks to fill your requirements.
[1]: http://search.cpan.org/~rkinyon/Tree-1.01/lib/Tree.pm |
If you decide to continue using functions, you can get some inspiration from WordPress. You can probably reduce the "program" to a minimum by making templates more granular.
Also, good tools (i.e. HTML editors) can help designers ignore your PHP and work on the design without breaking the code. (But I have no suggestions, sorry.)
The other way to some things is to create own template system instead of SMARTY, but it would probably take too long to create a working system to satisfy your needs that would go past just a replacing something like %%VARIABLE%% with a text.
Our company uses SMARTY and even with a lot of code in templates, designers know how to work with it. For simple CMS sites we use ExpressionEngine, which uses HTML-like tags for inserting login into templates. |
If you decide to continue using functions, you can get some inspiration from WordPress. You can probably reduce the "program" to a minimum by making templates more granular.
Also, good tools (i.e. HTML editors) can help designers ignore your PHP and work on the design without breaking the code. (But I have no suggestions, sorry.)
The other way to some things is to create own template system instead of SMARTY, but it would probably take too long to create a working system to satisfy your needs that would go past just a replacing something like %%VARIABLE%% with a text.
Our company uses SMARTY and even with a lot of code in templates, designers know how to work with it. For simple CMS sites we use ExpressionEngine, which uses HTML-like tags for inserting logic into templates. |
[The C++ Programming Language][1] by Bjarne Stroustrup covers C++ in depth. Bjarne is the inventor of C++. It also provides insights into why the language is the way it is. Some people find the book a little terse. I found it to be an enjoyable read. If you have done some C++ before it's a great place to start. It is by no means a beginners book on C++.
[1]: http://www.amazon.com/C-Programming-Language-Special-3rd/dp/0201700735 |
concatenate several fields into one with SQL |
|sql| |
i have three tables *tag*, *page*, *page-tag*
With the next data
***page***
ID NAME
1 page 1
2 page 2
3 page 3
4 page 4
***tag***
ID NAME
1 tag 1
2 tag 2
3 tag 3
4 tag 4
***page-tag***
ID PAGE-ID TAG-ID
1 2 1
2 2 3
3 3 4
4 1 1
5 1 2
6 1 3
I would like to get a string containing the correspondent tag names for each page with SQL in a single query. This is my desired output.
ID NAME TAGS
1 page 1 tag 1, tag 2, tag 3
2 page 2 tag 1, tag 3
3 page 3 tag 4
4 page 4
Is this possible with SQL? |
|sql|mysql| |