instruction
stringlengths
0
30k
|javascript|html|image|
How can I take a byte array of a TIFF image and turn it into a System.Drawing.Image object?
|c#|.net|image|tiff|
I have a `byte[]` array, the contents of which represent a TIFF file (as in, if I write out these bytes directly to a file using the `BinaryWriter` object, it forms a perfectly valid TIFF file) and I'm trying to turn it into a System.Drawing.Image object so that I can use it for later manipulation (feeding into a multi...
|c#|.net|image|tiff|
CSS: Getting image to stretch a div
|css|image|
How can i get an image to stretch the height of a div class? Currently it looks like this: <img src="http://i36.tinypic.com/34osrdg.png" width=650/> **Edit**: Turns out the img didnt embed properly. Here is the link http://i36.tinypic.com/34osrdg.png But i would like the div to be stretched so the image fits ...
How can i get an image to stretch the height of a div class? Currently it looks like this: <img src="http://i36.tinypic.com/34osrdg.png" width="650"/> But i would like the div to be stretched so the image fits properly. I do not want to resize the image. Here is the css for the div (the grey box) .pr...
How to handle file uploads to a dedicated image server?
|webserver|file-upload|
I got a webserver with a running application. There's a webpage with a form: some text data and a file upload field. Now, what I would like to have is it working like this: The file is sent to the dedicated server, diffrent then the one application is running on. The server should return some kind of path (or anythi...
User Interface Controls for Win32
|user-interface|winapi|
I see many user interface control libraries for .NET, but where can I get similar stuff for win32 using simply C/C++? Things like prettier buttons, dials, listviews, graphs, etc. Seems every Win32 programmers' right of passage is to end up writing his own collection. :/ Thanks, Sebastian
F# People keep asking "What is F# useful for?" let rec f n = f (n)
F# People keep asking "What is F# useful for?" let rec f n = f (n) performance optimized version (will fail faster :) ) let rec f n = f (f(n))
What's the best way to build a string of delimited items in Java?
|java|string|
While working in a Java app, I recently was needing to assemble a comma-delimited list of values to pass to another web service without knowing how many elements there would be in advance. The best I could come up with off the top of my head was something like this: public String appendWithDelimiter( String origina...
Whilst its been years since I have used spring, and I can't say I am a fan of it, I know that the App Fuse tool ([https://appfuse.dev.java.net/][1]) has been helpful to help people bootstrap in terms of generating all the artifacts you need to get going. [1]: https://appfuse.dev.java.net/
Instead of making the control public, you can create a property controlling its visibility: public boolean ControlIsVisible { get { return control.Visible; } set { control.Visible = value; } } This creates a proper accessor to that control that won't expose the control's whole se...
The first is not working of course. The controls on a form are private, visible only for that form by design. To make it all public is also not the best way. If I would like to expose something to the outer world (which also can mean an another form), I make a public property for it. public Boolean nameOfC...
Focus first on the heart of Spring: Dependency Injection. Once you see all the ways that DI can be used, then start thinking about the more interesting pieces like AOP, Remoting, JDBC Templates etc. So my best bit of advice is let your use of Spring grow out from the core. Best practice? If you're using the standard...
There are a few products available to add extra refactoring options to Visual Studio 2005 & 2008, a few of the better ones are [Refactor! Pro][1] and [Resharper][2]. As far as remove method, there is a description in the canonical Refactoring book about how to do this incrementally. Personally, I follow a pattern...
After reading the additional details, I agree with [robcthegeek][1]: raise an event. Create a custom EventArgs and pass the neccessary parameters through it. [1]: http://stackoverflow.com/questions/8566/best-way-to-access-a-control-on-another-form-in-c?sort=Newest#8567
I'm afraid I think the answer is no. From the help text on [http://docs.google.com/support/spreadsheets/bin/answer.py?answer=71291&query=arrayformula&topic=&type=][1] > The real power of ARRAYFORMULA comes when you take the result from one of those computations and wrap it inside a formula that does take array or r...
Notify Developer of a "DO NOT USE" Method
|.net|attributes|
OK, I know what you're thinking, "why write a method you do not want people to use?" Right? Well, in short, I have a class that needs to be serialized to XML. In order for the *XmlSerializer* to do its magic, the class must have a default, empty constructor: public class MyClass { public MyClass()...
OK, I know what you're thinking, "why write a method you do not want people to use?" Right? Well, in short, I have a class that needs to be serialized to XML. In order for the *XmlSerializer* to do its magic, the class must have a default, empty constructor: public class MyClass { public MyClass()...
There's generally two ways of doing it, with three possible implementations: 1. as you've touched on yourself, a library to evaluate formulas 2. compiling the formula into code The second option here is usually done either by compiling something that can be loaded in as a kind of plugin, or it can be compiled in...
I would suggest cleaning up the mess and changing the column to a datetime because doing stuff like this WHERE datediff(dd, convert(datetime, lastUpdate), getDate()) < 31 cannot use an index and it will be many times slower than if you had a datetime colum,n and did where lastUpdate > getDate() -31 ...
What about at the router level? My router as an URL blocker built in.
Threads are more light weight, and for the making several "workers" just to utilize all availabe CPUs or cores, you're better of with threads. When you need the workers to be better isolated and more robust, like with most servers, go with sockets. When one thread crashes badly, it usually takes down the entire proc...
Threads are more light weight, and for the making several "workers" just to utilize all availabe CPUs or cores, you're better of with threads. When you need the workers to be better isolated and more robust, like with most servers, go with sockets. When one thread crashes badly, it usually takes down the entire proc...
//C++ - joke, of course //Pay attention how void StackOverflow(){printf("StackOverflow!");} int main() { StackOverflow(); //:) }
//lang = C++... it's joke, of course //Pay attention how void StackOverflow(){printf("StackOverflow!");} int main() { StackOverflow(); //called StackOverflow, right? }
A "connection reset" does *not* indicate that the partner closed the connection, but that it *abruptly killed* the connection without calling close, often by the process crashing. If the partner deliberately closes the connection, you won't get an exception from the `Socket` input stream, you'll just read a -1 that sig...
In Oracle I'd do it with an analytical function, so you'd only query the emp table once : SELECT * FROM (SELECT e.*, MAX (sal) OVER () AS max_sal FROM scott.emp e WHERE deptno = 20 AND job = 'CLERK') WHERE sal = max_sal It's simpler, easier to read an...
The concept of state is very useful for applications to "remember" the current context of your system and react properly when a new piece of information arrives. Any non trivial application has that notion embedded in the code thru variables and conditionals. So if your application has to react differently every ti...
Both the IEEE and ACM put out a number of good computing magazines, which might be of interest depending on your exact interests. I'm a subscriber to both.
Rails uses a "method" parameter in the form and then fakes it, but calls the appropriate method if you designate it. I understand most clients won't support restful stack, but can asp.net mvc, auto-negotiate these verbs and place them in the appropriately deemed actions?
now i am beginning to sound like a marketeer for this product. i answered a question with it [here][1], then i answered another with it again [here][2]. in a nutshell, try sqlyog (enterprise in your case) from [webyog][3] for all your mysql requirements. it not only [schedules backups][4], but also [schedules synchr...
Ok, answered my own question. The answer is, don't...its a nightmare. Instead, I added a softDelete flag, and instead of removing the item from the collection, I just set this flag. Then, the repeater does not render items are marked for deletion. When the collection is saved, it discards the items marked for ...
As an easy and **clean** way of using an Enumeration with the enhanced for loop, convert to an ArrayList with java.util.Collections.list. for (TableColumn col : Collections.list(columnModel.getColumns()) { (javax.swing.table.TableColumnModel.getColumns returns Enumeration<TableColumn>.) Note, this may be v...
An easy route would be to have the gmail account configured/enabled for POP3 access. This would allow you to send out via normal SMTP through the gmail servers. Then you'd just send through smtp.gmail.com (on port 587)
I think that if the project is not part of the solution, you shouldn't include it there... but that's just my opinion I separate it by concept in short
Something like this (sounds like you just need to change your SMTP server): String host = “smtp.gmail.com”; String from = “user name”; Properties props = System.getProperties(); props.put(”mail.smtp.host”, host); props.put(”mail.smtp.user”, from); props.put(”mail.smtp.password”, “asdfgh”...
|css|image|
Coloring Algorithm
|algorithm|colors|
I'm looking for a simple algorithm to generate a large number of random, aesthetically pleasing colors. So no crazy neon colors, colors reminiscent of feces, etc. I've found solutions to this problem but they rely on alternative color pallets than RGB. I would rather just use straight RGB than mapping back and for...
|algorithm|colors|
ARBG to RGB
|c#|colors|
Let's say that we have an ARGB color Color argb = Color.FromARGB(127, 69, 12, 255); //Light Urple. When this is painted on top of an existing color, the colors will blend. So blended with white, the resulting color is Color.FromARGB(255, 162, 133, 255); The solution should work like this Color ble...
|c#|colors|
You'd probably have to keep a list of the processes you start, and kill them off one by one when you exit your program. I'm not sure of the specifics of doing this in C++ but it shouldn't be hard. The difficult part would probably be ensuring that child processes are shutdown in the case of an application crash. .Ne...
Prompt for Database Connection String
|.net|database|connection-string|
I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in .Net?
|.net|sql-server|database|connection-string|
I would like to offer a database connection prompt to the user. I can build my own, but it would be nice if I can use something that somebody else has already built (maybe something built into Windows or a free library available on the Internet). Anybody know how to do this in .Net? **EDIT:** I found this and though...
What do you use to capture webpages, diagram/pictures and code snippets for later reference?
If I understand the question, then Resharper calls this 'inline method' - Ctrl-R + I
When it comes to refactoring like that, try out <a href="http://www.jetbrains.com/resharper/index.html">ReSharper</a>. Just right click on the method name, click "Find usages", and refactor until it cannot find any references.
When it comes to refactoring like that, try out <a href="http://www.jetbrains.com/resharper/index.html">ReSharper</a>. Just right click on the method name, click "Find usages", and refactor until it cannot find any references. And as dlamblin mentioned, the newest version of ReSharper has the possibility to inl...
With the advent of ADO.Net and the newer version of SQL connection pooling is handled on two layers, first through ADO.Net itself and secondly by SQL Server 2005/2008 directly, eliminating the need for custom connection pooling. I have been informed that similar support are being planned or have been implemented in...
I actually quite liked Spring.. It was a fresh breeze of air in your average J2EE Java Beans.. I recommend implementing the example Spring provides: http://static.springframework.org/docs/Spring-MVC-step-by-step/ Also, I decided to go full monty and added Hibernate to my Spring application ;), because Spring ...
You'll probably find this out for yourself now that the others have pointed you in the right direction, but TryEnter can also take a timeout parameter. Jeff Richter's "CLR Via C#" is an excellent book on details of CLR innards if you're getting into more complicated stuff.
What's your "best practice" for the first Java EE Spring project?
|jakarta-ee|spring|aop|
I'm currently trying to get into the Java EE development with the Spring framework. As I'm new to Spring, it is hard to imaging how a good running project should start off. Do you have any *best practices*, tipps or major *DO NOTs* for a starter? How did you start with Spring - big project or small tutorial-like app...
|java|spring|jakarta-ee|aop|
The thing about XAML is that it is fine for 'simple' programs, but sadly, it doesn't work well when you want to do things like share functions. Say you have several classes and UI's all of which had commands that were never disabled, you'd have to write a 'CanAlwaysExecute' method for each Window or UserControl! That's...
Use TortoiseSVN (version.app if on mac). Just install and go. If you need a place to host your code look at http://beanstalkapp.com/
From personal experience, svn would be my recommendation. You can even use a service like [Beanstalk][1] that offers free accounts (with limits obviously, but sufficient for any smallish project) to test the waters. But as others have said, git is superior and is likely worth looking into. [1]: http://beanstal...
What's an alternative to GWL_USERDATA for storing an object pointer?
|winapi|win64|windows|
In the Windows applications I work on, we have a custom framework that sits directly above Win32 (don't ask). When we create a window, our normal practice is to put `this` in the window's user data area via `SetWindowLong(GWL-USERDATA, this)`, which allows us to have an MFC-like callback or a tightly integrated `WndPr...
|windows|winapi|win64|
In the Windows applications I work on, we have a custom framework that sits directly above Win32 (don't ask). When we create a window, our normal practice is to put `this` in the window's user data area via `SetWindowLong(hwnd, GWL-USERDATA, this)`, which allows us to have an MFC-like callback or a tightly integrated ...
A good key to remember is >"Test early, test often and test again, when you think you are done"
HTML using Groovy MarkupBuilder, how do I elegantly mix tags and text?
|groovy|
When using Groovy MarkupBuilder, I have places where I need to output text into the document, or call a function which outputs text into the document. Currently, I'm using the undefined tag "text" to do the output. Is there a better way to write this code? li{ text("${type.getAlias()} blah blah ") ...
I guess the tool I was looking for was under my nose the whole time! I've used Maintenance Plans for backups but I think I set those up at least 4 years ago or more, long before I knew anything about shrinking files and defragging indexes. Thanks!
If you want an IDE, try [Aptana Studio][1]. It supports HTML, CSS, JavaScript, PHP, XML, Ruby, Ruby on Rails, and more.... [1]: http://www.aptana.com/
"All Users" Folder
To follow up on Tithonium's point, this will also do the trick: @filtered = map {local $_=$_; s/&nbsp;//g; $_} @outdata; The "local" ensures you're working on a copy, not the original.
If it fits your case, you can keep loading new images to respond to user interaction, like [this website does][1] (just scroll down). [1]: http://flickriver.com/photos
The received wisdom answer is that you can use JavaScript (or any other technology) providing that it 'degrades gracefully'... I have experience with disability organisations, so accessibility is important to me. But equally, I'm in the business of building attractive, usable websites, so javascript can be a powerfu...
Do you need SVG or just vector-like graphics manipulation? John Resig ported the "Processing" visualization language to JavaScript. I never used it, but from the creator of jQuery it may help you out if you don't actually require SVG. [http://ejohn.org/blog/processingjs/][1] [1]: http://ejohn.org/blog/proce...
GWT Designer is very good and allows for rapid development of GWT websites. (http://www.instantiations.com/gwtdesigner/)
This requires a little domain knowledge that I don't have, but it seems to me that the ordered vs. non-ordered situation is a little bit irrelevant. If each couple has a score, the ordering in the final round can be deduced from each couple's score, right? That would mean that the final round's data structure would b...
Maybe you can find some sort of http proxy you could install to filter this content and use that when browsing. On Firefox you could easily define a rule for Adblock Plus.
Set up a proxy server and block it via that. -Adam
Editing XML in Flex using e4x
|javascript|apache-flex|e4x|