instruction stringlengths 0 30k ⌀ |
|---|
My suggestion is just to start - pick a small project that you would generally use to learn an MVC-style language (i.e. something with a database, maybe some basic workflow), and then as you need to learn a concept, use one (or both!) of
Agile Web Development with Rails
or
The Rails Way
to learn about how it wo... |
If you access an intranet Web site by using an IP address or a fully qualified domain name , or a url with a dot in it the Web site may be identified as in the Internet zone instead of in the Local intranet zone.
<http://support.microsoft.com/kb/303650> |
The [System.Security.Cryptography][1] namespace contains multiple classes which can do hashing for you (such as [MD5][2]) which will probably hash them better than you could yourself and will take much less effort.
You don't always have to reinvent the wheel.
[1]: http://msdn.microsoft.com/en-us/library/syste... |
You can, as long as the fields follow the JavaBean conventions and the setter takes something Struts can understand.
So Thing needs getThingName() and setThingName(String). |
Sounds like you want double-buffering:
http://www.codeproject.com/KB/graphics/DoubleBuffering.aspx
Although this is mainly used for individual controls, you can implement this in your Windows Forms control or Form. |
Big differences:
- Platform
- Object orientation
- Laziness
The similarities are more important than the differences. Basically, you should use F# if you are on .NET already, Haskell otherwise. Also, OO and laziness mean that F# is closer to what you (probably) already know, so it is probably easier to le... |
On Windows I use APPDATA,and on Linux I use HOME. |
You could also build a lookup (if your key range is reasonable) so that you end up writing:
this->*Methods[num]( 999, "hello world" );
This removes the switch as well, and makes the cleanup a bit more worthwhile. |
This is some code to backup the idea of using a querystring method and if that's not available using the UrlReferrer property of the Request object. This can then be stashed in a session object (or somewhere else if that works better for you) so that you can track the source between pages. (Page_Load doesn't seem to be... |
I have to disagree with Dale... The strong element is actually the wrong element to use, implying something about the meaning, use, or emphasis of the content while you are simply intending to provide style to the element.
Ideally you would be able to accomplish this with a pseudo-class and your stylesheet, but a... |
What, if any, checksum is used for TNT.com tracking numbers? |
|algorithm|validation|checksum| |
I am writing some software to identify tracking numbers (in the same way that Google identifies FedEx or UPS numbers when you search for them). Most couriers use a system, such as a "weighted average mod system" which can be used to identify if a number is a valid tracking number. Does anyone know if TNT consignment nu... |
In the **dll source code** you should have this implementation so that the .lib file *exports* the symbol:
extern "C" _declspec(dllexport) char* MyNewVariable = 0;
The c client should use a **header** with this declaration so that the client code will *import* the symbol:
extern "C" _declspec(dllimport... |
I would try the `itemStateChanged()` method of the [`ItemListener`][1] interface if [jodonnell's][2] solution fails.
[1]: http://java.sun.com/javase/6/docs/api/java/awt/event/ItemListener.html
[2]: #58963 |
Robert Martin has an excellent paper on the Liskov Substitution Principle [here][1]. It discusses subtle and not-so-subtle ways in which the principle may be violated.
[1]: http://www.objectmentor.com/resources/articles/lsp.pdf |
There are two ways to do this easily. Either stick the results in a temp table and then reference the temp table from your sproc. The other alternative is to put the results into an XML variable that is used as an OUTPUT variable.
There are, however, pros and cons to both of these options. With a temporary table, yo... |
How do I get the current state of Caps Lock in VB.NET? |
|.net|windows|vb.net| |
How do I find out whether or not Caps Lock is activated, using VB.NET?
This is a follow-up to my [earlier question](http://stackoverflow.com/questions/58937/how-do-i-toggle-caps-lock-in-vbnet).
|
- Converters(simple and multi).
- Interoperability.
I think I would prefer a dev that would know **Blend**. He/She could communicate easily with the designer and also do some basic designer stuff faster than just writing in xaml.
The list is interesting, maybe links to the topics would help.
Cheers |
Referencing Tobi's answer: You can use pthread_attr_getstackaddr to get the base of the stack at any time, if setting a variable at thread initialization is difficult. You can then get the address of an automatic variable in your own function to determine how deep the stack is at that moment. |
JComboBox Selection Change Listener? |
|swing|java| |
I'm trying to get an event to fire whenever a choice is made from a JComboBox.
The problem I'm having is that there is no obvious addSelectionListener method.
I've tried to use actionPerformed but it never fires.
Short of overriding the model for the JComboBox I'm out of ideas.
**How do I get notified of ... |
|java|swing| |
I'm trying to get an event to fire whenever a choice is made from a JComboBox.
The problem I'm having is that there is no obvious addSelectionListener method.
I've tried to use actionPerformed but it never fires.
Short of overriding the model for the JComboBox I'm out of ideas.
**How do I get notified of ... |
I don't believe this value is stored on the client machine. It's stored in Active Directory, and you can get a list of inactive machines using the [Dsquery][1] tool.
The best option is to have your program do a simple test such as connection to a DC, and then store the timestamp of that action.
[1]: http://tech... |
I'm not sure if it is possible, as the GUI may have more capabilities than the terminal (yes, I've seen GUI terminals with only 16 colors very recently). It may depend on how the terminal is set. At any rate I would play with [Color Theme][1].
Anyway, why are you using Emacs in both, the terminal and the GUI? Genera... |
Try deleting the .csproj files (back them up first though). |
Simple XOR is a bad hash: you'll find lots of strings which collide. The hash doesn't depend on the order of the letters in the string, for one thing.
Try using the FNV hash http://isthe.com/chongo/tech/comp/fnv/
This is really simple to implement. It shifts the hash code after each XOR, so the same letters in a... |
zvon.org
http://reference.sitepoint.com/ |
Giving class unique ID on instantiation: .Net |
|.net|vb.net|vb| |
I would like to give a class a unique ID every time a new one is instantiated. For example with a class named Foo i would like to be able to do the following
dim a as New Foo()
dim b as New Foo()
and a would get a unique id and b would get a unique ID. The ids only have to be unique over run time so i ... |
I would go with Chart as an ItemsControl and its ItemsPanel be a Canvas(For some light use I would go with Grid as ItemsPanel). And each Pen will be a CustomControl derived from PolyLine class. Does that make any sense? |
In regards to best practices, Jeff posted an article on polluting user space that you might find useful: [Don't Pollute User Space][1]
[1]: http://www.codinghorror.com/blog/archives/001032.html "Don't Pollute User Space" |
My solution is to follow the same idea of the Roles table. After you've authenticated the user, look up that user's roles. If the user has role "Administrator" in the UserRoles table, then they can do whatever the Administrator can do.
I don't broadcast open ID's in my app. They're stored in the table. On every acti... |
[www.iconshock.com][1] has over 400,000 icons and you can buy the entire collection for around $400.
Alternatively there are a number of sites offering free icons, just be sure to check the licence.
[1]: http://www.iconshock.com/ |
I recommend disabling the auto update.
As a developer the last thing you need is to have random updates done to your workstation, especially while you are working. I set aside a time every month to go through the process manually. I avoid doing it if I am in the middle of testing something really important or u... |
Good Databases with sample data |
|database|free|sample| |
Does anybody know of any sample databases I could download, preferably in CSV or some similar easy to import format so that I could get more practice in working with different types of data sets? The Canadian Department of Environment has [historical weather data][1] that you can download. Unfortunately it's not in a... |
Can you pass the Collection into you method by refernce so that you can just add items to it, that way you dont have to return anything. This is what it might look like if you did it in c#.
class Program
{
static void Main(string[] args)
{
Collection<string> myitems = new Collection<string>();
m... |
Can you pass the Collection into you method by refernce so that you can just add items to it, that way you dont have to return anything. This is what it might look like if you did it in c#.
class Program
{
static void Main(string[] args)
{
Collection<string> myitems = new Collection<string>();
m... |
Maybe this helps? ([http://social.msdn.microsoft.com/forums/en-US/regexp/thread/5e87fce9-ec73-42eb-b2eb-c821e95e0d31/][1])
They are using the following regex to find the stringtable in the rc source:
(?<=\bSTRINGTABLE\s+BEGIN\s+).*?(?=\s+END\b)
[1]: http://social.msdn.microsoft.com/forums/en-US/regexp/thre... |
Maybe this helps? ([http://social.msdn.microsoft.com/forums/en-US/regexp/thread/5e87fce9-ec73-42eb-b2eb-c821e95e0d31/][1])
They are using the following regex to find the stringtable in the rc source:
(?<=\bSTRINGTABLE\s+BEGIN\s+).*?(?=\s+END\b)
Edit - And you can read the key values pairs with the following st... |
I got this working by writing a custom formatter specifically for this task. The code is about 120 -130 lines long, so I don't know if I should post it here as an answer (maybe a feature to attach .cs files to a topic would be a good ideea!) .
Anyway, if anyone is interested in this, let me know and I'll provide the... |
Will HTML Encoding prevent all kinds of XSS attacks? |
|security|xss|html-encode| |
I am not concerned about other kinds of attacks. Just want to know whether HTML Encode can prevent all kinds of XSS attacks.
Is there some way to do an XSS attack even if HTML Encode is used? |
As a general tip: If you know how to do something in excel, but don't know how to do it in VBA you could just record a macro and look at the recorded VBA-code (works at least most of the time) |
There's [AlivePDF][1], which is a PDF generation library for ActionScript that should work, it was made just for the situation you describe.
[1]: http://code.google.com/p/alivepdf/ |
I don't believe so. Html Encode converts all functional characters (characters which could be interpreted by the browser as code) in to entity references which cannot be parsed by the browser and thus, cannot be executed.
<script/>
There is no way that the above can be executed by the browser.
**Unle... |
If you encode everything it will. (depending on your platform and the implementation of htmlencode) But any usefull web application is so complex that it's easy to forget to check every part of it. Or maybe a 3rd party component isn't safe. Or maybe some code path that you though did encoding didn't do it so you forgot... |
Many of the Flex RPC classes, like `RemoteObject`, `HTTPService`, etc. return [`AsyncToken`][1]s when you call them. It sounds like this is what you're after. Basically the `AsyncToken` encapsulates the pending call, making it possible to register callbacks (in the form of [`IResponder`][2] instances) to a specific cal... |
Well consider this:
When serving as text/html, all you need a doctype for is to trigger standards mode. Beyond that, the doctype does nothing as far as browsers are concerned.
When serving as text/html, whether you use XHTML markup or HTML markup, it's treated by browsers as HTML.
So, really it comes down to u... |
Well consider this:
When serving as text/html, all you need a doctype for is to trigger standards mode. Beyond that, the doctype does nothing as far as browsers are concerned.
When serving as text/html, whether you use XHTML markup or HTML markup, it's treated by browsers as HTML.
So, really it comes down to u... |
Notice that some users in the Enterprise have no choice.
So if you target Enterprise customers, notice they are still on IE6. In general, Enterprise moves slower than consumer. |
I'm attempting to switch to the [Code::Blocks][1] IDE for all of my C/C++ editing, but have used Visual Studio 2003, and [Programmer's Notepad 2][2] for C/C++ projects. For Python, I currently use IDLE, but have been looking for something else that has a horozontal scroll bar.
[1]: http://www.codeblocks.org/
... |
i'd have thought outputting the actions via tee, and thence tail'ing (or using the loop <a href="http://stackoverflow.com/questions/62832#63446">above</a>) the file created by tee some use. |
You can say that I have an OCD on XHTML validity. I find that most of the problems with the code not being valid comes from programmers not knowing the difference between HTML and XHTML. I've been writing 100% valid XHTML and CSS or a while now and have never had any major rendering problems with other browsers. If you... |
Draining Standard Error in Java |
|java| |
When launching a process from Java, both stderr and stdout can block on output if I don't read from the pipes. Currently I have a thread that pro-actively reads from one and the main thread blocks on the other.
Is there an easy way to join the two streams or otherwise cause the subprocess to continue while not losi... |
It could be argued that there is still a use for the `<i>` tag: when expressing the scientific name (aka the Latin name) of a species. The scientific name of a species is, by convention, usually presented in italics. [*Example*][1]. It is semantically incorrect to use `<em>` in this situation because one is not trying ... |
Unfortunatly, I think that thins might just be a by-product of the .net framework. I am experiencing similar flickering albeit with custom controls. Many of the reference material I have read indicates this, alongside the fact the the double buffering method failed to remove any flickering for me. |
First five chars of each line variant, assuming that the large file called x.txt, and assuming it's OK to create files in the current directory with names x.txt.* :
split -l 2000000 x.txt x.txt.out && (for splitfile in x.txt.out*; do outfile="${splitfile}.firstfive"; echo "$splitfile -> $outfile"; cut -c 1-5 "$spli... |
<code>
<pre>
<?php echo date("Y"); ?></code>
</pre> |
strftime("%Y");
I love [strftime](http://us3.php.net/manual/en/function.strftime.php). It's a great function for grabbing/recombining chunks of dates/times.
Plus it respects locale settings which the date function doesn't do. |
How-To Auto Discovery a WCF Service? |
|.net-3.5|wcf| |
Is there a way to auto discover a specific WCF service in the network? I don want to config my client with the address if this is posible.
|
It seems that the `INotifyCollectionChanged` interface allows for updating when multiple items were added, so I'm not sure why `ObservableCollection<T>` doesn't have an `AddRange`. You could make an extension method for `AddRange`, but that would cause an event for every item that is added. If that isn't acceptable y... |
List<T> implies IList, so it's a bad idea to use both in the same class. |
How do I assign a keyboard shortcut to a VBA macro in Outlook 2007? |
|vba|outlook|macros|keyboard-shortcuts| |
How can I assign a keyboard shortcut to a VBA macro in Outlook 2007?
I know how to create a tool for the macro and put it in a menu with an underscore shortcut. This solution requires me to use a shortcut of ALT-{menu key}-{tool key}. What if I want to assign it to ALT-F12 or something like that?
The Visual Basic... |
xpath has an ancestor-axis which includes all ancestors of the current context node.
<p>//*[@id="z"]/ancestor::li</p>
**\*** any element<br />
**[@id="z"]** that has an attribute <i>id</i> with the value <i>z</i> (since the attribute is id there can(/should be) only be one such element)<br />
**/ancestor::li** al... |
What database engine are you importing into? That will help determine what formats you can include in your search.
The [Federal Energy Regulatory][1] Commission has some sample data for download in CSV format.
[1]: http://www.ferc.gov/docs-filing/eqr/soft-tools/sample-csv.asp |
For Microsoft SQL Server, there is the [Northwind Sample DB][1] and [AdventureWorks][2].
[1]: http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&displaylang=en
[2]: http://msdn.microsoft.com/en-us/library/ms124659.aspx |
You can use the <a href="http://dokan-dev.net/en/">Dokan library</a> to create a virtual drive. There is a .Net wrapper for interfacing with C#. |
# Product of everything except current in C
void product_except_current(int input[], int index[], int out[],
size_t len) {
// compute product of all non-zero `input` elements
int prod = 1, nzero = 0;
for (int* i = input; i != &input[len]; ++i)
... |
If you're looking to test the actual UI, you could try using something like Selenium (www.openqa.org). It lets you write the code in PHP (which I'm assuming would work with phpUnit) to drive the browser..
Another approach would be to have a common method that could be called by each test for your different user type... |
Follow up any question like this with: "How could you improve this code so the developer who maintains it can figure out how it works easily?" |
I have managed to get precompiled headers working under gcc once in the past, and I recall having problems then as well. The thing to remember is that gcc will ignore the file (header.h.gch or similar) if certain conditions are not met, a list of which can be found on the [gcc precompiled header documentation page][1].... |
I'm not an expert in VB.NET so only PInvoke comes to my mind:
Declare Function GetKeyState Lib "user32"
Alias "GetKeyState" (ByValnVirtKey As Int32) As Int16
Private Const VK_CAPSLOCK = &H14
If GetKeyState(VK_CAPSLOCK) = 1 Then ... |
<http://msdn.microsoft.com/en-us/library/system.windows.forms.control.iskeylocked.aspx>
Imports System
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Public Class CapsLockIndicator
Public Shared Sub Main()
if Control.IsKeyLocked(Keys.CapsLock) Then
... |
The _"incrementally carrying a an accumlating[sic] weight sum"_ part is expensive if you have a lot of records. If you also already have a wide range of scores/weights (ie: the range is wide enough that most records weights are unique. 1-5 stars probably wouldn't cut it), you can do something like this to pick a weig... |
Can you list the connection string you are using for this?
You might want to try adding an explicit User Instance=true/false to your connection string |
I'm seeing strange errors when my C++ code has min() or max() calls. |
|c++|windows| |
I'm seeing strange errors when my C++ code has min() or max() calls. I'm using Visual C++ compilers. |
Strange C++ errors with code that has min()/max() calls. |
|c++|windows|c| |
Another way of gettinga command object is to call "connection.CreateCommand()". That way you shouldn't have to set the Commection property on the command object. |
I use SciTE |
Steve Mcconell's advice, from [Code Complete][1]:
Use a multi-dimensional table. Each variable serves as an index to the table,
and the if statement turns into a table lookup. For example if (size == 3 && weight > 70)
translates into the table entry decision[size][weight_group]
[1]: http://www.amazon.com/Co... |
If the problem is that you want to transition to PHP and you are happy to continue running on a windows server with .NET support you might consider wrapping your code using [swig](http://swig.sourceforge.net/).
This can be used to generated stubs to execute from php and you can then go about rewriting the .NET code ... |
<a href="http://powerof2games.com/node/25">This post</a> at <a href="http://powerof2games.com">Power of 2 Games</a> might be relevant/interesting. |