instruction
stringlengths
0
30k
|asp.net|subjective|events|custom-server-controls|
OK, I am not sure if the title it completely accurate, open to suggestions! I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me. I am thinking about the event model. Since we are not using Web Controls there are no events being fi...
OK, I am not sure if the title it completely accurate, open to suggestions! I am in the process of creating an ASP.NET custom control, this is something that is still relatively new to me, so please bear with me. I am thinking about the event model. Since we are not using Web Controls there are no events being fi...
|asp.net|events|custom-server-controls|
|java|arrays|data-structures|data-manipulation|
Support for multilanguage applies for all kinds of messages, but tends to be forgotten in the case of error messages.
I would second not telling the user useless esoteric information like numeric error codes. I would follow that up however by saying to definitely log that information for troubleshooting by more technically savvy people.
Maybe you should try with ActiveReports.NET or DevExpress XtraReports to generate the reports first by code. Both have PDF export support so you can generate PDF files and send them by mail.
Resources that have to be manually cleaned up in C#?
|c#|resources|memory-management|garbage-collection|
What resources have to be manually cleaned up in C#? ...and what are the consquences of not doing so? For example, say i have the following code: myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); //Use Brush If i don't clean up the brush using the dispose method, i'm assuming the ...
Use a dedicated, locked-down SQL account
For any user input (strings, filenames, values, etc), always display the erroneous value with delimiters around it (quotes, brackets, etc). e.g. The filename you entered could not be found: "somefile.txt" This helps to show any whitespace/carriage returns that may have sneaked in and greatly reduces troubleshoot...
Big codebases will need it. Look at boost for an example. I don't think anyone would call the boost code 'insane'. If you consider the fact that at any one level of a hierarchy, people can only comprehend somewhere very roughly on the order of 10 items, then two levels only gives you 100 maximum. A sufficiently b...
Obviously it's a matter of opinion. But it really boils down to organization. For example, I have a project which has a plugin api that has functions/objects which look something like this: plugins::v1::function When 2.0 is rolled out they will be put into the v2 sub-namespace. I plan to only deprecate but ne...
Ruby and WS-Security
|ruby|soap|ws-security|
I'm having troubles finding good Ruby libraries that implement WS-Security. I've seen [wss4r][1] but have yet to use it (and the documentation is a bit light on it). What libraries do you use for this task, or is there a better alternative? [1]: http://rubyforge.org/projects/wss4r/
I work on XXX application in my company yyy, and I am writing a GUI subsystem. So I use yyy::xxx::gui as my namespace.
I think the biggest problem will be creating all the different angles (for when the characters turn, etc.). Can you develop 3d models of the characters based on different frames from the tv show / card game?
There is a very interesting white paper on migrating a .NET 2.0 winform application toward WPF, see [Evolving toward a .NET 3.5 application](http://www.ythos.net/pdfs/EvolvingDotNet35Apps.pdf) Paper abstract: *In this paper, I’m going to outline some of the thought processes, decisions and issues we had to face whe...
Add the objects you want to remove to a second array and, after the loop, use -removeObjectsInArray:.
FolderShare is also nice for syncing files. I use it to keep documents, etc. in sync between my laptop and my desktop, for example. Of course, for code especially this doesn't obviate the need for source control.
FolderShare ([http://foldershare.com][1]) is also nice for syncing files. I use it to keep documents, etc. in sync between my laptop and my desktop, for example. Of course, for code especially this doesn't obviate the need for source control. [1]: http://www.foldershare.com
As mentioned above by Greg, programmatically you can use the function_exists() method. Don't forget you can also use the following to see all the environment specifics with your PHP install using the following: <?php phpinfo(); ?>
Why don't you add the objects to be removed to another NSMutableArray. When you are finished iterating, you can remove the objects that you have collected.
Either use loop counting down over indices – for (NSInteger i = array.count - 1; i >= 0; --i) – or make a copy with the objects you want to keep. In particular, do not use a for(id object in array) loop or NSEnumerator.
this should do it: NSMutableArray* myArray = ....; int i; for(i=0; i<[myArray count]; i++) { id element = [myArray objectAtIndex:i]; if(element == ...) { [myArray removeObjectAtIndex:i]; i--; } } hope this helps...
source control with VB2005 Express
|vb.net|version-control|
Can anyone suggest a good source control system that interfaces with VB2005 Express? As the Express editions of Visual Studio do not allow add-ins does this mean that I will not be able to integrate source control into the IDE? I'm used to the check-in/check-out process of SourceSafe integrated into VB6. Can anyone rec...
Another idea might be to have the handsets divided into 2 to 4 categories based on say screen dimensions and create builds for them. It is a much faster route too as you will be able to support all the handsets you want to support with much lesser complexity. Another thing to see is the BREW versions on the handsets...
Casting a function which returns (void *) to instead be an (int *) is harmless: you're casting one type of pointer to another. Casting a function which returns an integer to instead be a pointer is most likely incorrect. The compiler would have flagged it had you not explicitly cast it.
Are EJB still alive ?
|ejb|
Do you still use session or entity EJB in your project ? Why ?
Although it cannot handle the UI side, I unit test MFC code using the Boost Test library. There is a Code Project article on getting started: [Designing Robust Objects with Boost][1] [1]: http://www.codeproject.com/KB/architecture/Designing_Robust_Objects.aspx
There's no magic number, but there's a few things that affect performance in particular: - Index Cardinality: don't bother indexing a row that has 2 or 3 values (like an ENUM). On a large table, the query optimizer will ignore these. - There's a trade off between writes and indexes. The more indexes you have, t...
One possible error could (depending on this is whether what you really want or not) be mallocing with one size scale, and assigning to a pointer of a different type. E.g., int *temp = (int *)malloc(sizeof(double)); There may be cases where you want to do this, but I suspect that they are rare.
Well, I think it's the exact opposite - always directly cast it to the needed type. [Read on here!](https://www.securecoding.cert.org/confluence/display/seccode/MEM02-C.+Immediately+cast+the+result+of+a+memory+allocation+function+call+into+a+pointer+to+the+allocated+type?focusedCommentId=15630941)
The problem with Google Docs is that it changes the format of uploaded docs in its own format, with catastrophic consequences (page layout, links, summaries...). What I would like is to keep my original documents as is , if I want to .
Complementing @vonc's answer, don't accept ambiguous abbreviations. Eg: myCli.exe describe someThing myCli.exe destroy someThing myCli.exe des someThing ??? In fact, in that case, I probably wouldn't accept an abbreviation for "destroy"...
I see a lot of Windows command line specifics, but if your program is intended for Linux, I find the [GNU command line standard][1] to be the most intuitive. Basically, it uses double hyphens for the long form of a command (e.g., `--help`) and a single hyphen for the short version (e.g., `-h`). You can also "stack" the...
File format of CF10-jpg
|file-format|
While working on a tool that allows to exchange images of several third-party applications and thus creating individual "skins" for those applications, I have stumbled across a jpg-format about which I cannot seem to find any decent informations. When looking at it in a hex-editor, it starts with the tag "CF10". Sea...
Sounds like you are participating in a bit of premature optimization. If the application is not built, while performance concerns are good to be aware of, your primary concern should be getting the app written. Includes are a fact of life. Don't worry about number, worry about keeping your code well organized (PEAR ...
Property Grid Object failing on combo box selection but OK when combobox scrolled or double clicked
|c#|winforms|propertygrid|
I have a Property Grid in C#, loading up a 'PropertyAdapter' object (a basic wrapper around one of my objects displaying relevant properties with the appropriate tags) I have a TypeConverter on one of the properties (DataType, that returns an enumeration of possible values) as I want to limit the values available to...
.NET Memory Profiler should allow you to do that: http://memprofiler.com/
You could try [CLR Profiler][1] which is free, or maybe the trial version of [ANTS Profiler][2]. HTH, Kent [1]: http://www.microsoft.com/downloads/details.aspx?familyid=a362781c-3870-43be-8926-862b40aa0cd0&displaylang=en [2]: http://www.red-gate.com/Products/ants_profiler/index.htm
curses API
|c|api|reference|ncurses|
Where can I find a complete reference of the ncurses C API?
Converting PostgreSQL database to MySQL
|mysql|postgresql|
I've seen questions for doing the reverse, but I have an 800MB PostgreSQL database that needs to be converted to MySQL. I'm assuming this is possible (all things are possible!), and I'd like to know the most efficient way of going about this and any common mistakes there are to look out for. I have next to no experienc...
For collections they need to have an Add method taking a single argument. If you just need a text format and not specifically xml you might try JSON. I've developed one for .NET, [JsonExSerializer][1], and there are others available as well at [http://www.json.org][2]. [1]: http://jsonexserializer.googlecode.c...
I use a PHP-based script to read from a database and send emails out (using the PEAR Mail_Queue library). I run it from within a bash script and based on the returned result (from "exit $status;") either halt, sleep X seconds, or immediately restart. (I also put a check of the load average/sleep into the PHP script to...
You can buy this book. I have it and recommend: John Strang, Programming with curses, O'Reilly, ISBN 0-937175-02-1 The best online source information: http://invisible-island.net/ncurses/ncurses-intro.html I learned a lot about ncurses reading the minicom source code and the iptraf linux network monitor. Regar...
It's equivalent to Nullable< DateTime>. You can append "?" to any primitive type or struct.
[Unitils][1] does this w/ the static method `assertRefEquals`. [1]: http://www.unitils.org
Since <code>DateTime</code> is a <code>struct</code>, not a <code>class</code>, you get a <code>DateTime</code> *object*, not a *reference*, when you declare a field or variable of that type. And, in the same way as an <code>int</code> cannot be <code>null</code>, so can this <code>DateTime</code> object never be null,...
It takes the last two digits of the year and pads the left side with zeroes to a maximum of 2 characters. Looks like a "just in case" for expiration years ending in 08, 07, etc., making sure that the leading zero is present.
There are a couple of different strategies to writing quines. The obvious one is to just write code that opens the code and prints it out. But the more interesting ones involve language features that allow for self-embedding, like the %s-style printf feature in many languages. You have to figure out how to embed someth...
You should be able to add `@login_required` decorators across the board and be done with it. Unless you have a boat-load of view functions, it shouldn't be too horrible.
OK so it's taking the value from the drop down, ABCD Then it takes the substring from position 2, CD And then it err, left pads it with 2 zeros if it needs too, CD Or, if you've just ended X, then it would substring to X and pad to OX
It's taking the last two digits of the year, then pad to the left with a "0". So 2010 would be 10, 2009 would be 09. Not sure why the developer didn't just set the value on the dropdown to the last two digits, or why you would need to left pad it (unless you were dealing with years 0-9 AD).
You'll need to associate the parameters with the command object, either by constructor or setter injection (or equivalent). Perhasp something like this: public classs DeletePersonCommand: ICommand { private Person personToDelete; public DeletePersonCommand(Person personToDelete) ...
You'll need to associate the parameters with the command object, either by constructor or setter injection (or equivalent). Perhaps something like this: public classs DeletePersonCommand: ICommand { private Person personToDelete; public DeletePersonCommand(Person personToDelete) ...
Can't be done. That control only supports showing some days in bold. What platform are you targeting (desktop or WM?) If desktop, is it really win32 or is an MFC solution acceptable?
The accepted answer is not actually answering the question correctly... You should not use a workflow to do this, if you want people to be able to edit items they create and only read ones they did not, use "List->Settings->Advanced Settings->Item-level Permissions", and this **is** available for document libraries ...
I've used [GroupLayout][1] as well. Again, its a standard JDK layout manager as of Java6, but you can find the library separate as well. [1]: http://java.sun.com/javase/6/docs/api/javax/swing/GroupLayout.html
Hierarchical namespaces do have a use in that they allow progressively more refined definitions. Certainly a single provider may produce two classes with the same name. Often the first level is occupied by the company name, the second specifies the product, the third (and possibly more) my provide the domain. There ...
JavaScript's document.write Inline Script Execution Order
|js|javascript|internet-explorer|firefox|google-chrome|
I have the following script, where the first and third `document.writeline` are static and **the second is generated**: <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'><\/sc" + "ript>"); document.write("<script l...
|javascript|firefox|internet-explorer|google-chrome|js|
I have the following script, where the first and third `document.writeline` are static and **the second is generated**: <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'><\/sc" + "ript>"); document.write("<script l...
How to read a barcode from an image
|ruby|ruby-on-rails|barcode|image-processing|
I'm seeking a library, technique or advice on how to read an [EAN-13][1] barcode from an image (including [ISBN][2],and [ISSN][3] encodings). The image would come from a mobile phone or webcam, so resolution may be quite poor. I'm specifically interested in something that could be used from ruby on rails, but answe...
I'm seeking a library, technique or advice on how to read an [EAN-13][1] barcode from an image (including [ISBN][2],and [ISSN][3] encodings). The image would come from a mobile phone or webcam, so resolution may be quite poor and not well aligned. I'm specifically interested in something that could be used from rub...
|ruby|ruby-on-rails|barcode|image-processing|c|
|c|ruby|ruby-on-rails|image-processing|barcode|
I'm seeking a library, technique or advice on how to read an [EAN-13][1] barcode from an image (including [ISBN][2],and [ISSN][3] encodings). The image would come from a mobile phone or webcam, so resolution may be quite poor and not well aligned. I'm specifically interested in something that could be used from rub...
Using FLOOR() - just cut time part. SELECT CAST(FLOOR(CAST(GETDATE() AS FLOAT)) AS DATETIME)
[Qt][1] is a good choice to start with. In my opinion it has a best (easy to use, simple & informative) API Documentation. Package also includes many examples - from very basic to complex. And, yep, it`s truly crossplatform. Check [Qt Licensing][2] page, the library is free only for GPL projects. I`m using [QDev...
[Qt][1] is a good choice to start with. In my opinion it has a best (easy to use, simple & informative) API Documentation. Package also includes many examples - from very basic to complex. And, yep, it`s truly crossplatform. Check [Qt Licensing][2] page, the library is free only for GPL projects. I`m using [QDev...
On the other hand, if you ever need to port the code to C++, it is much better to use the 'new' operator.
If you are using C# try [Mono.GetOptions][1], it's a very powerful and simple-to-use command-line argument parser. It works in Mono environments and with Microsoft DotNet. [1]: http://www.go-mono.com/docs/index.aspx?link=N%3AMono.GetOptions
If you are using C# try [Mono.GetOptions][1], it's a very powerful and simple-to-use command-line argument parser. It works in Mono environments and with Microsoft DotNet. EDIT: Here are a few features - Each param has 2 CLI representations (1 character and string, e.g. -a or --add) - Default values - Strong...
I use **i**, **j**, **k** (or **r** & **c** for row-column looping). If you need **more than three loop variables in a method**, the the method is probably too long and complex and your code would likely **benefit from splitting the method up** into more methods and **naming** them **properly**.
Generally define the process of testing
|testing|quotes|
How would you define testing? In the interest of full disclosure, I'm posting this because I already have some answers I like.
Integration of this sort is at the server level, it's IIS that decides that the user is not logged in; and it's IIS that sends back the authentication prompt to the user, to which the browser reacts. As you want to use the domain login there is only one way to do this; [integrated windows authentication][1]. This wi...
“Testing is the process of comparing the invisible to the ambiguous, so as to avoid the unthinkable happening to the anonymous.”– [James Bach][1] It sounds funny, but if you parse out each word, it's right on the money. [1]: http://www.satisfice.com/blog
You can probably restrict access to the entire site via apache with htaccess, taking the problem out of the django's project space entirely.