instruction
stringlengths
0
30k
You could add somthing like in the aspx even if its not a great solution: <script runat="server"> protected void Page_Load(object sender, EventArgs e) { IDOfYourControl.myintarray = new Int32[] { 1, 2, 3 }; } </script>
You could add to the page events inside the aspx something like this: <script runat="server"> protected void Page_Load(object sender, EventArgs e) { YourUserControlID.myintarray = new Int32[] { 1, 2, 3 }; } </script>
The GLUT port on Nate Robin's site is from 2001 and has some incompatibilities with versions of Visual Studio more recent than that (.NET 2003 and up). The incompatibility manifests itself as errors about redefinition of `exit()`. If you see this error, there are two possible solutions: 1. Replace the `exit()` p...
If you know the page the usercontrol is in you can do a ((PageName)this.Page).scriptmanager.Services.Add() from the user control
I think that gwt-chart is a better framework for you.
It really comes down to how much work your webserver and your sql server are doing. Without more information I doubt you are going to get any helpful answers.
Keyboard accelerators. Once you figure out what sorts of queries you write a lot, write utility stored procedures to automate the tasks, and map them to keyboard shortcuts. For example, [this article][1] talks about how to avoid typing "select top 10 * from SomeBigTable" every time you want to just get a quick look a...
It will depend on the expected load of the server. For small sites, it is no problem at all (if correctly configured). For large sites, you might want to consider distributing the load over different servers: web server, file server, database server, etc.
What XML do I send for a field thats declared as nillable?
|xml|xsd|
I have an application with a REST style inerface that takes XML documents via POST from clients. This application is written in Java and uses XML beans to process the posted message. Now, the XML schema definition for a field in the message looks like this: &lt;xs:element name="value" type="xs:string" nillable="...
I recommend using valgrind to track down unfree'd memory, as opposed to trying to make a bus error occur. It rocks for lots of other stuff as well. Sam
glibc provides backtrace() function. <http://www.gnu.org/software/libc/manual/html_node/Backtraces.html>
Ping everything in the rage, then you can get netbios info from the systems that respond to identify it's name.
I recently worked on a large enterprise application built with Kodo JPA framework. The SQLs produced by Kodo were generally not very scalable with large amount of data. In my opinion it produced too many queries with outer joins. Considering how many mappings we had to change when trying to scale kodo, I would not reco...
Is there any performance benefit with "inline" statements in .NET
|.net|performance|
When retrieving a lookup code value from a table, some folks do this... Dim dtLookupCode As New LookupCodeDataTable() Dim taLookupCode AS New LookupCodeTableAdapter() Dim strDescription As String dtLookupCode = taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL") strDescription = dtL...
Is there any performance benefit with "chaining" statements in .NET?
When retrieving a lookup code value from a table, some folks do this... Dim dtLookupCode As New LookupCodeDataTable() Dim taLookupCode AS New LookupCodeTableAdapter() Dim strDescription As String dtLookupCode = taLookupCode.GetDataByCodeAndValue("EmpStatus", "FULL") strDescription = dtL...
Lazy loading is the big gotcha in MVC applications that use Hibernate for their persistence framework. You load the object in the controller and pass it to the JSP view. Some or all of the members of the class are proxied and everything blows up because you Hibernate session was closed when the controller completed. ...
You don't want to do this, unless you are only going to be contacting people from one culture. For example: Guido van Rossum's last name is van Rossum. MIYAZAKI Hayao's first name is Hayao. The most success you could do is to strip off common titles and salutations, and try some heuristics. Even so, the ...
Junit output and OutOfMemoryError
|java|junit|
I'm running some JUnit tests on my applications. Every test has a for loop calling respective method 10000 times. The tested methods produce a lot of log. These logs are also automatically collected by JUnit as test output. This situation takes to OutOfMemoryError because the string buffer where JUnit keeps the out...
You might want to check internal and external framentation of current indexes and either drop and re-create them or re organize them.
For the second instance, you can press ESC before tab to solve it. I don't know the solution to your problem, but you could look in **/etc/bash_completion** or the files under **/etc/bash_completion.d** to determine what commands use autocompletion and how.
For the second instance, you can press ESC before tab to solve it. I don't know the solution to your problem, but you could look in **/etc/bash_completion** or the files under **/etc/bash_completion.d** to determine what commands use autocompletion and how. help complete Might also be helpful.
The essential steps in verifying a file upload
|file|file-upload|
What would you say are the essential steps in verifying a file upload? I'd tend to check the MIME type, give it a new (random) name, make sure its got an allowed file extension, and then I'd check the contents of the file. How do you go about it?
The knuth shuffle is an insignificant change compared to the naive shuffle: Just swap with any card in the remaining (unshuffled) section of the deck instead of anywhere in the entire deck. If you think of it as repeatedly choosing the next card in order from the remaining unchosen cards, it's pretty intuitive, too.
I really like [log4php][1] for logging, even though it's not yet out of the incubator. I use log4net in just about everything, and have found the style quite natural for me. With regard to system crashes, you can log the error to multiple destinations (e.g., have appenders whose threshold is CRITICAL or ERROR that ...
Yes, and no, it's not very useful in my opinion. It's not very stable, it's easy to get out of sync, and the "look how fast I generate this" advantage is virtually nil when compared to more mundane things such as code snippets. Then again, I am a total "Architect" luddite, so take this with a grain of salt.
> When I check the download page for Report Viewer 2008, it lists .NET 3.5 as a requirement. What leads you to believe that isn't true? Have you tried installing your app, including the RTM version of the Report Viewer, on a machine with no .Net Framework at all? With only the 2.0 Framework?
MSFT may have placed some sort of restriction on the Report Viewer requiring .Net 3.5. In your testing, make sure you can successfully install on a machine with both no Framework at all, and only the 2.0 Framework. Also, keep in mind that MSFT might be requiring the 3.5 Framework so they can write against it in fut...
Keep in mind that MSFT might be requiring the 3.5 Framework so they can write against it in future updates/releases, which might place your app in an unsupported (by MSFT) state.
> This early execution environment is highly implementation defined, meaning the implementation of your particular BIOS. Never make any assumptions on the contents of registers. They might be initialized to 0, but they might contain a random value just as well. from the [OS dev Wiki][1], which is where I get inform...
>>Simply writing them to a file won't be useful, will it? But of course it is - that's a great thing to do, much better than displaying them on the screen. You want to show the user a nice screen which says "Sorry, we goofed. Engineers have been notified. Go back and try again" and ABSOLUTELY NO TECHNICAL DETAIL, be...
You can always initialize them yourself to start with a known state. MSN
OK - I got this working. It looks like the primary assembly was the only one whose assembly attributes were being copied. With copyattrs set, the last one in would win, not a merge (as far as I can tell). I created a dummy project to reference the other DLL's and included all the web resources from those projects in...
Bezier clipping
|graphics|2d|csg|bezier|clip|
I'm trying to find/make an algorithm to compute the intersection (a new filled object) of two arbitrary filled 2D objects. The objects are defined using either lines or cubic beziers and may have holes or self-intersect. I'm aware of several existing algorithms doing the same with polygons, [listed here][1]. However, I...
|graphics|geometry|2d|bezier|csg|
salient concerns and questions to consider in designing a website content management system
|database|database-design|
I'm designing my website and was curious, before I go rip someone else's ideas, what were the salient considerations and questions one should ask in designing a database? Thanks!
I don't see any reason to believe that creating an object in the constructor will automatically dispose the object. Yes, your object will immediately go out of scope and be available for garbage collection, but that is certainly not the same as being disposed. There really isn't a great way to do exactly what you wa...
likely/unlikely macros in the Linux kernel
|linux|kernel|macros|
I've been digging through some parts of the Linux kernel, and found calls like this: if (unlikely(fd < 0)) { /* Do something */ } or if (likely(!err)) { /* Do something */ } I've found the definition of them: #define likely(x) __builtin_expect((x),1...
How can I uninstall an application using PowerShell?
|powershell|
Is there a simple way to hook into the standard 'Add or Remove Programs' functionality using PowerShell to uninstall an existing application? Or to check if the application is installed?
Role Based Access Control in PHP
|php|codeigniter|access-control|
Are there any open source PHP-based role-based access control system that can be used for a codeigniter framework?
Like Maxim already said: having tests will not add extra functionality to your application, but will enable you to make changes with more confidence. To determine which classes/methods chould be unit tested, I always ask myself two questions: - is this piece of code imported in relation to the overall functionalit...
I would say: that depends on which performance you want to monitor. Used CPU time? Free RAM? Disk IO? Number of beers in your freezer...
I would say: that depends on which performance you want to monitor. Used CPU time? Free RAM? Disk IO? Number of beers in your freezer... But regardless of this you can look at any files below /proc. I'm not sure for HP, but at least Linux and AIX should have that tree (if it's not deactivated at kernel compile time)...
iPhone development on Windows
|windows|iphone|
Is there a way to develop iPhone applications on Windows? I really don't want to get yet another machine. There is a project on http://code.google.com/p/winchain/wiki/HowToUse that seemed to work with iPhone 1.0, but had limited success with iPhone 2.0, plus it requires all the cygwin insanity. Is there anyt...
@about8 : there is a pretty serious bug there. Zam obj1 = new Zam("foo", "bar", "baz"); Zam obj2 = new Zam("fo", "obar", "baz"); same hashcode you probably want something like public int hashCode() { return (getFoo().hashCode() + getBar().hashCode()).toString().hashCode(); (can yo...
You may find the information contained in the <a href="http://msdn.microsoft.com/en-us/library/z1hkazw7.aspx">"ASP.NET State Management Recommendations" article</a> on MSDN useful for making your decision. Generally in ASP.NET 2.0 and above disabling the ViewState is less destructive due to the introduction of the C...
I researched this topic briefly and it seems you need an additional piece which is called *URL Rewrite (Go Live)*. [Here is an article][1] that walks you through how to create a rewrite rule using this. They also require IIS7, which I am not sure if it's really important. But it might be another thing you have to ta...
I never saw the point of the Visitor pattern until I had to manipulate Java bytecode directly using the [ASM][1] library. It was amazing how much the pattern simplified what would otherwise have been a really complex task. The pattern is also used in most Java IDE's when you want to write your own refactoring plugin...
__The Python Interpreter__ >>> Maybe not lesser known, but certainly one of my favorite features of Python.
Look up bit shifting, as this is basically all you need to do to swap from little -> big endian. Then depending on the bit size, you change how you do the bit shifting.
##Overwhelmed by thousands lines of code? Having one set of header/source files per class in a directory can seem overkill. And if the number of classes goes toward 100 or 1000, it can even be frightening. But having played with sources following the philosophy "let's put together everything", the conclusion is tha...
Using the meta data from your version control system should keep things simpler. It's how your developers already use the system. There is no additional file to maintain. My personal experience has taught me to version the satellite applications with the same as version as the main app. K.I.S.S
You could very easily implement your own XOR key-based bit encryption. With a little thought and ingenuity, you can come up with something that's more than suitable for you application.
You could very easily implement your own XOR key-based bit encryption. With a little thought and ingenuity, you can come up with something that's more than suitable for you application. Here's a PHP example: function XOREncryption($InputString, $KeyPhrase){ $KeyPhraseLength = strlen($KeyPhrase)...
Custom Text Wrapping in WPF
|wpf|text|
Is there a way of wrapping text in a non-rectangular container in WPF? [Here is how it is done in photoshop][1] [1]: http://www.photoshopessentials.com/photoshop-text/text-effects/text-wrap/page-3.php
Building from the command line with MSBuild is relatively easy to learn. Start by opening a Visual Studio Command Prompt, and running `msbuild /?`. Just read through the help once and then decide later if you want to learn more details. Writing project files is a bit more complicated. Most people don't need to l...
I don't care too much about the hotplugability of OSGi modules (at least currently). It's more the enforced modularity. Not having millions of "public" classes available on the classpath at any time protects well from cyclomatic dependencies: You have to really think about your public interfaces - not just in terms of ...
Are you making sure to add the Person to the Groups.Admin? You have to make both links.
I consider an aggregate root with a *lot* of child entities to be a code smell, or a DDD smell if you will. :-) Generally I look at two options. 1. Split your aggregate into many smaller aggregates. This means that my original design was not optimal and I need to identify some new entities. 2. Split your domain...
The knuth shuffle is an insignificant change compared to the naive shuffle: Just swap with any card in the remaining (unshuffled) section of the deck instead of anywhere in the entire deck. If you think of it as repeatedly choosing the next card in order from the remaining unchosen cards, it's pretty intuitive, too. ...
Is there a list of AJAX JSF Libraries available?
|ajax|user-interface|jsf|components|package|
I'm looking for an alternative to [www.jsfmatrix.net][1] to get a better idea of what JSF libraries are out there and to avoid having to write my own grid/table components. Or are these 27 the best the world has to offer (really only 3 are worth their salt.) [1]: http://www.jsfmatrix.net/
Not Managed c++ but C++/CLI for the .net platform. A set of Microsoft extensions to C++ for use with their .Net system. Bjarne Stroustrup's FAQ http://www.research.att.com/~bs/bs_faq.html#CppCLI C++/CLI is not C++, don't tag it as such. Txs
Why is '397' used for ReSharper GetHashCode override?
|hash-code-uniqueness|
Like many of you, I use ReSharper to speed up the development process. When you use it to override the equality members of a class, the code-gen it produces for GetHashCode() looks like: public override int GetHashCode() { unchecked { int result = (Key != n...
Like many of you, I use ReSharper to speed up the development process. When you use it to override the equality members of a class, the code-gen it produces for GetHashCode() looks like: public override int GetHashCode() { unchecked { int result = (Key != n...
|hash|hash-code-uniqueness|
What you are doing is building a string, and then parsing it all at once upon insertion. What about creating an actual table element (i.e. `$("<table>")`), and then adding each row to it in turn? By the time you actually insert it into the page, the DOM nodes will all have been constructed, so it shouldn't be as big ...
Automated way to detect tests that can't fail, checked in to get by minmum code coverage?
|testing|build-automation|people-skills|
I have a dev, that will get around our code coverage by writing tests that never fail. The code is just atrocious, but the tests never catch it because they assert(true). I code review, but I can't do everyones work for them, all the time. How do you get people like this motivated to make good software? Is the...
### Re my.cnf on Mac OS X when using MySQL from the mysql.com dmg package distribution By default, my.cnf is nowhere to be found. You need to copy one of `/usr/local/mysql/support-files/my*.cnf` to `/etc/my.cnf` and restart `mysqld`. (Which you can do in the MySQL preference pane if you installed it.)
Try this : RewriteRule ^/signup-(\d+)/$ /signup/?aff=$1 [I]
Slightly offtopic: Having seen a share of custom HTTP proxies, the usual feature their authors forget (and later discover that they need) is the support for the CONNECT method. Without CONNECT your proxy can't be used for TLS/SSL connections. Also, software that tunnels their non-HTTP traffic via the proxy won't work e...
**Set up Capistrano to deploy** You'll want to learn capistrano if you don't already know it, and use it to deploy your code in an automated way. This will involve setting up your shared directory and shared resources like database.yml. **Install C Based MySQL gem** If you don't have all the required libs, this can ...
if you're in c#, you should use ==; is uses reflection which is more expensive to compute, especially since there's only ever one instance of System.DBNull.