instruction
stringlengths
0
30k
I had the same problem. It turned out that if the VS window was non-maximized, it was really small. So after making the non-maximized wider, the problem disappeared.
Could do with some work but here is some sql select distinct T.itemid, A.mark, B.mark from (select * from A union select * from B) T left join A on T.itemid = A.itemid left join B on T.itemid = B.itemid;
Could do with some work but here is some sql select distinct T.itemid, A.mark as "A.mark", B.mark as "B.mark" from (select * from A union select * from B) T left join A on T.itemid = A.itemid left join B on T.itemid = B.itemid; This relies on the left join, which returns all the r...
You can always write a class that implements IList<T> and forwards all calls to the original list (so it doesn't have it's own copy of the data) after translating the indexes.
An object-relational mapping (ORM) tool, like [NHibernate][1] (or better yet, [ActiveRecord][2]), can help you avoid a lot of validation by allowing the data model to be built right into your code as a proper C# class. You may avoid trips to the database as well, thanks to great caching and validation models built into...
You could use yield return to create a filtered list IEnumerable<object> FilteredList() { foreach( object item in FullList ) { if( IsItemInPartialList( item ) yield return item; } }
Watch out for the difference in the way the empty string is treated. INSERT INTO atable (a_varchar_column) VALUES (''); is the same as INSERT INTO atable (a_varchar_column) VALUES (NULL); (I have no sqlserver experience, but I understand that it differentiates between the two)
How do the filtered elements need to be accessed? If it's through an Iterator then maybe you could write a custom iterator that skips the elements you don't want publicly visible? If you need to provide a Collection then you might need to write your own Collection class, which just proxies to the underlying Collect...
Since C isn't a [regular language](http://en.wikipedia.org/wiki/Regular_language) and C function calls can contain arbitrary argument expressions, I fear the answer to your question is “no.”
Try a method that returns an enumeration using yield: IEnumerable<T> FilterCollection<T>( ReadOnlyCollection<T> input ) { foreach ( T item in input ) if ( /* criteria is met */ ) yield return item; }
Depending on how you need to filter the collection, you may want to create a class that implements IList (or IEnumerable, if that works for you) but that mucks about with the indexing and access to only return the values you want. For example class EvenList: IList { private IList innerList; ...
You cannot do this through the SSMS GUI, but you can do it using a script. RESTORE DATABASE <name> from DISK='\\unc\path\filename' If you need this process automated, the best way is to setup a SQL Server Job and run it as a user with access to the file location.
The way I and my partner did it was we each made our own private Facebook applications, that pointed to our IP address where we worked on it. Since we worked in the same place, we each picked a different port, and had our router forward that port to our local IP address. It was kinda slow to refresh a page, but it work...
No more auto-generated html IDs!!! Anyone doing any sort of javascript appreciates this fact.
Make your stored procedure return 2 sets of data. The first can contain the actual returned data, then the second can return a text message. Your app code can then use the data where it needs to, then display whatever message comes back.
There's also [3rdRail][1] from CodeGear (from Delphi fame). The only catch is is that it's not free. [1]: http://www.codegear.com/products/3rdrail
There's also [3rdRail][1] from CodeGear (from Delphi fame). The only catch is that it's not free. [1]: http://www.codegear.com/products/3rdrail
Take a look at [Processing][1] and the associated Arduino and Wiring boards. [1]: http://processing.org/
Session Facade is a fantastic pattern - it is really a specific version of the Business Facade pattern. The idea is to tie up business functionality into discrete bundles - such as TransferMoney(), Withraw(), Deposit()... So that your UI code is accessing things in terms of business operations instead of low level da...
Adding to Nescio's thoughts - I'd suggest in code reviews actively hunting down expensive transparent operations in property accessors e.g. DB round tripping.
You could try using the parametrized equations for an ellipse rotated at an arbitrary angle: x = h + a*cos(t)*cos(phi) - b*sin(t)*sin(phi) [1] y = k + b*sin(t)*cos(phi) - a*cos(t)*sin(phi) [2] ...where ellipse has centre (h,k) semimajor axis a and semiminor axis b, and is rotated through angle phi. ...
You could try using the parametrized equations for an ellipse rotated at an arbitrary angle: x = h + a*cos(t)*cos(phi) - b*sin(t)*sin(phi) [1] y = k + b*sin(t)*cos(phi) - a*cos(t)*sin(phi) [2] ...where ellipse has centre (h,k) semimajor axis a and semiminor axis b, and is rotated through angle phi. ...
You could try using the parametrized equations for an ellipse rotated at an arbitrary angle: x = h + a*cos(t)*cos(phi) - b*sin(t)*sin(phi) [1] y = k + b*sin(t)*cos(phi) - a*cos(t)*sin(phi) [2] ...where ellipse has centre (h,k) semimajor axis a and semiminor axis b, and is rotated through angle phi. ...
Using a configuration file I want to enable myself to turn on and off things like (third party) logging and using a cache in a C# website. The solution should not be restricted to logging and caching in particular but more general, so I can use it for other things as well. I have a configuration xml file in which I ...
Try using myString.PadRight(totalLengthForField, ' ')
Designing a Yahoo Pipes inspired interface
|interface|yahoo-pipes|
I really like the interface for Yahoo Pipes (http://pipes.yahoo.com/pipes/) and would like to create a similar interface for a different problem. Are there any libraries that would allow me to create an interface with the same basic look and feel? I especially like how the pipes behave and how they are not just str...
I really like the interface for Yahoo Pipes (http://pipes.yahoo.com/pipes/) and would like to create a similar interface for a different problem. Are there any libraries that would allow me to create an interface with the same basic look and feel? I especially like how the pipes behave and how they are not just str...
Well, yes. Certainly if we had a time machine, going back and ensuring a lot of the Javascript features were designed differently would be a major passtime (that, and ensuring the people who designed IE's CSS engine never went into IT). But it's not going to happen, and we're stuck with it now. I suspect, in time, i...
I always version all stylesheets in "public/stylesheets/sass/*.sass" and set up an exclude filter for compiled ones: /public/stylesheets/*.css
How do I upload a file to an SFTP server in C# / .NET?
|c#|.net|sftp|
Does this capability come with .Net? If not, what's the best free library? I need something that will throw good exceptions when there is a problem, and allows me to monitor its progress.
Git by default attempts to store symlinks instead of following them ( for compactness and its generally what people want ) However, i accidentally managed to get it to add files beyond the symlink when the symlink is a directory. ie: /foo/ /foo/baz /bar/foo --> /foo /bar/foo/ba...
You need to use Expect.Call instead of SetupResult: using (repo.Record()) { Expect.Call(provider.Execute(23)) .IgnoreArguments() .Throw(new ApplicationException("Dummy exception")); Expect.Call(provider.Execute(23)) .IgnoreArguments() .Return("result"); } ...
Don't throw away your code! It's the single worst mistake you can make (on a large codebase). See [Things You Should Never Do, Part 1][1]. You've invested a lot of effort into that old code and worked out many bugs. Throwing it away is a classic developer mistake (and one I've done many times). It makes you fe...
How to remove published wmi schema?
|wmi|
I've published schema, and no longer have the dll's that contained the wmi provider that the schema was published from. How can I remove the schema?
That is a browser preference, not an actionscript property.
Thanks for the quick reply. The text isn't in a template. It's just a CheckBoxField with the Text property set to "Active": <asp:CheckBoxField DataField="Active" Text="Active" /> I've tried widening the field and the DetailsView control, but the text still disappears when I click the button.
Try this, I think it only works on Bash though sudo gem install ibm_db < <(echo 1)
Benefits of static code analysis.
|code-analysis|
The LINQ designer ads the connection string to the app.config of the class library, but the web site needed to see it in the web.config of the web project. Once copied across all was well.
No matter what, this is the way I go ! It looks the best. If(x) <br> {<br> &nbsp;&nbsp; print "Hello World !!" <br> } <br> Else <br> {<br> &nbsp;&nbsp; print "Good bye!!" <br> }
Custom URL Extensions/Routing
|iis-6|asp.net|
I have a need to use extensionless URLs. I do not have access to IIS (6.0) so I cannot map requests to ASP.NET and handle with a HttpHandler/HttpModule. However, I can set a custom 404 page via web host control panel. My current plan is to perform necessary logic in the custom 404 page, but it "feels wrong". Are ...
Custom URL Extensions/Routing Without IIS Access
|asp.net|iis-6|
I have a need to use extensionless URLs. I do not have access to IIS (6.0) so I cannot map requests to ASP.NET and handle with a HttpHandler/HttpModule. However, I can set a custom 404 page via web host control panel. My current plan is to perform necessary logic in the custom 404 page, but it "feels wrong". Are ...
You can statically dispatch on the type of iterator using iterator_traits Something like this : template<T_insertIter> get_sequence(T_insertIter inserter) { return get_sequence(inserter, typename iterator_traits<Iterator>::iterator_category()); } template<T_insertIter> get_sequenc...
Find a C compiler that supports 64bit (GCC does IIRC) compile a program that does just that, then get the disassembly. GCC can spit it out on it's own and you can get it out of object file with the right tools. OTOH their is a 32bX32b = 64b op on x86 a:b * c:d = e:f // goes to e:f = b*d; x:y = ...
Find a C compiler that supports 64bit (GCC does IIRC) compile a program that does just that, then get the disassembly. GCC can spit it out on it's own and you can get it out of object file with the right tools. OTOH their is a 32bX32b = 64b op on x86 a:b * c:d = e:f // goes to e:f = b*d; x:y = ...
Is there a control for a .Net WinForm app that will display HTML
|c#|.net|winforms|
I have a .net (3.5) WinForms application and want to display some html on one of the forms. Is there a control that I can use for this?
raytracing with CUDA
|raytracing|cuda|
I'm currently implementing a raytracer. Since raytracing is extremely computation heavy and since I am going to be looking into CUDA programming anyway, I was wondering if anyone has any experience with combining the two. I can't really tell if the computational models match and I would like to know what to expect. I g...
Git "bad sha1 file" error
|version-control|git|
Hello I have following error by git-fsck, witch cannot be cleaned by git-gc even in --aggressive mode. What can I do next to fix this repository error? $ git-fsck bad sha1 file: .git/objects/55/tmp_obj_a07724
What is the yield keyword used for in C#?
|c#|yield|
In the [How Can I Expose Only a Fragment of IList<>][1] question one of the answers had the following code snippet: IEnumerable<object> FilteredList() { foreach( object item in FullList ) { if( IsItemInPartialList( item ) yield return item; } } ...
If you want recursion: PI = 2 * (1 + 1/3 * (1 + 2/5 * (1 + 3/7 * (...)))) This would become, after some rewriting: PI = 2 * F(1); with F(i): double F(int i){ 1 + i/(2.0*i+1) * F(i+1); } Isaac Newton (you may have heard of him before ;) ) came up with this trick.
If you want recursion: PI = 2 * (1 + 1/3 * (1 + 2/5 * (1 + 3/7 * (...)))) This would become, after some rewriting: PI = 2 * F(1); with F(i): double F(int i){ 1 + i/(2.0*i+1) * F(i+1); } Isaac Newton (you may have heard of him before ;) ) came up with this trick. Note that I left out the e...
If you want recursion: PI = 2 * (1 + 1/3 * (1 + 2/5 * (1 + 3/7 * (...)))) This would become, after some rewriting: PI = 2 * F(1); with F(i): double F (int i) { 1 + i / (2.0 * i + 1) * F(i + 1); } Isaac Newton (you may have heard of him before ;) ) came up with this trick. No...
There are many ways to test the usability of a system. Please check any available literature you can find. I just want to insist that usability test is not so hard as you or anyone might think. In a famous paper called "A mathematical model of the finding of usability problems" in INTERACT'93 and CHI'93, J. Nielsen and...
What are the benefits of doing static code analysis on your source code? I was playing around with FxCop and I was wondering if there any benefits beyond making sure you are following the coding standards.
T-SQL: How do I get the rows from one table whose values completely match up with values in another table?
|t-sql|sql-server|
Given the following: declare @a table ( pkid int, value int ) declare @b table ( otherID int, value int ) insert into @a values (1, 1000) insert into @a values (1, 1001) insert into @a values (2, 1000) insert into @a values (2...
|sql-server|t-sql|
Given the following: declare @a table ( pkid int, value int ) declare @b table ( otherID int, value int ) insert into @a values (1, 1000) insert into @a values (1, 1001) insert into @a values (2, 1000) insert into @a values (2...
Multi tenant architecture and NHibernate
|.net|nhibernate|domain-driven-design|saas|
Could anyone explein me finally what is the best strategy to implement transparient and fluent support of multi-tenant functionality in NHibernate powered domain model? Im looking for the way, how to keep the domain logic as isolated as possible from the multi-tenant stuff like filtering by TenantID etc
Could anyone explain me finally what is the best strategy to implement transparent and fluent support of multi-tenant functionality in NHibernate powered domain model? Im looking for the way, how to keep the domain logic as isolated as possible from the multi-tenant stuff like filtering by TenantID etc
easiest way to do it is to just jump in head first. get some asp.net books and dive into visual studio. Do the examples, play with it, build something fun for yourself. You'll learn by doing.
.NET is really about the framework and the base class library. VB or C# - as Chris mentioned there is really just syntactical difference. Since you've done VBScript migration to VB.NET is more natural - you can learn the new syntax, then move onto the Framework and BCL, when you are familiar with those you can lear...
Sometimes, it might be worthwhile to try to get help via IRC. Quite some time ago, I found the #perl channel on the freenode network to be pretty friendly helpful. As always it's important that you have exhausted the normal means of solving your problem: Read the documentation, search the web, etc. However, I'll als...
Sometimes, it might be worthwhile to try to get help via IRC. Quite some time ago, I found the #perl channel on the freenode network to be pretty friendly and helpful. As always it's important that you have exhausted the normal means of solving your problem: Read the documentation, search the web, etc. However, I'll...
If you only have the text in the &lt;a&gt; ... &lt;/a&gt;, that's the only part that can be clicked on. Move your graphics, etc. inside the link.
You may also wan to look into C#. VB.Net and C# are both great for creating web applications, it really depends on the needs you will have. For example C# is great with events and VB.Net is great with XML. I'd say go with what ever your developers feel more comfortable.
I was looking at a site recently that lists average UK wages based on technologies. Can't find the link now (typical!) but I remember that the average C# wage was around £5k higher than the average VB.NET wage. If you're not going to learn both (and there's really no reason not to, as the only real difference betwe...
Static Analysis tool recommendation for Java?
|java|static-analysis|
Being vaguely familiar with the Java world I was googling for a static analysis tool that would also was intelligent enough to fix the issues it finds. I ran at CodePro tool but, again, I'm new to the Java community and don't know the vendors. What tool can you recommend based on the criteria above? Thank you!
use the Null Object design pattern on hfID http://www.cs.oberlin.edu/~jwalker/nullObjPattern/
Possibly, I can't work out for sure yet, but what I can tell you is AES256 appears to be restricted by US Export restrictions on high-security cryptography, and for this reason, some platforms may lack this capacity. Also, upon further searching, msdn pages ( such as [this one](http://blogs.msdn.com/ie/archive/2005...
This should catch both 'and' or ',' (?:\sand|,)
This should catch both 'and' or ',' (?:\sand|,)\s
I'm not sure there are any... but I found [Erlbol][1] on the web, and a [X11 GUI][2] which sounds interesting, and [GTK2][3] (pdf link) [1]: http://erlbol.dougedmunds.com/ [2]: http://projects.openmoko.org/forum/forum.php?forum_id=397 [3]: http://www.erlang.se/euc/05/1620cronqvist.pdf
I've used ProcessMonitor if you need something more powerful than perfmon.
Python syntax (used by Jython) is considerably more concise and quicker to develop for more programmers. In addition, you can use existing Python libraries in a Java application.
Python syntax (used by Jython) is considerably more concise and quicker to develop for many programmers. In addition, you can use existing Python libraries in a Java application.