instruction
stringlengths
0
30k
|c#|asp.net|serialization|cookies|
I'm trying to store an xml serialized object in a cookie, but i get an error like this: A potentially dangerous Request.Cookies value was detected from the client (KundeContextCookie="<?xml version="1.0" ...") I know the problem from similiar cases when you try to store something that looks like javascript co...
From Hacker's Delight, p. 66, Figure 5-2 int pop(unsigned x) { x = x - ((x >> 1) & 0x55555555); x = (x & 0x33333333) + ((x >> 2) & 0x33333333); x = (x + (x >> 4)) & 0x0F0F0F0F; x = x + (x >> 8); x = x + (x >> 16); return x & 0x0000003F; } Execute...
You normally can't get instance attributes given just a class, at least not without instantiating the class. You can get instance attributes given an instance, though, or class attributes given a class. See the 'inspect' module. You can't get a list of instance attributes because instances really can have anything as a...
Using the stock Rails cache is roughly equivalent to this.
In fact, a variable is tuple (storage, scope, type, address, value): storage : where is it stored, for example data, stack, heap... scope : who can see us, for example global, local... type : what is our type, for example int, int*... address : where are we located ...
ASP.NET MVC: Making routes IIS6 and IIS7-friendly
|asp.net-mvc|routing|
I have an ASP.NET MVC-application which I want deployable on both IIS6 and IIS7 and as we all know, IIS6 needs the ".mvc"-naming in the URL. Will this code work to make sure it works on all IIS-versions? Without having to make special adjustments in code, global.asax or config-files for the different IIS-versions. ...
|asp.net-mvc|routing|iis|
ASP.NET MVC: Making routes/URLs IIS6 and IIS7-friendly
|.net|asp.net-mvc|iis|routing|urls|
|shellexecute|google-chrome|.net|
|.net|google-chrome|shellexecute|
For years I've been using ShellExecute() API to launch the default web browser from within my applications. Like this: ShellExecute( hwnd, _T("open"), _T("http://www.winability.com/home/"), NULL, NULL, SW_NORMAL ); It's been working fine until a couple of weeks ago, when Google released it...
Click through transparency for Visual C# Window Forms?
|visual|c#|forms|transparency|
I made a panel and set it to fill the screen, now I can see the windows under it but I want it to be click through, meaning they could click a file or see a tool tip of another object through the transparency.
I made a panel and set it to fill the screen, now I can see the windows under it but I want it to be click through, meaning they could click a file or see a tool tip of another object through the transparency. >>RE: This may be too obvious, but have you tried sending the panel to the back by right clicking and choos...
|c#|visual-studio|forms|transparency|
Python's advanced slicing operation has a barely known syntax element, the ellipsis: >>> class C(object): ... def __getitem__(self, item): ... return item ... >>> C()[1:2, ..., 3] (slice(1, 2, None), Ellipsis, 3) Unfortunately it's barely useful as the ellipsis is only supported i...
SharePoint 2007 performance issues
|performance|sharepoint|
I don't expect a straightforward silver bullet answer to this, but what are the best practices for ensuring good performance for SharePoint 2007 sites? We've a few sites for our intranet, and it generally is thought to run slow. There's plenty of memory and processor power in the servers, but the pages just don't 's...
How to get my own module handle?
|winapi|dll|
I'm trying to find a resource in my own module. If this module is an executable, that's trivial - `GetModuleHandle(NULL)` returns the handle of the "main" module. My module, however, is a DLL that is loaded by another executable. So `GetModuleHandle(NULL)` will return the module handle to that executable, which is o...
How to get my own code's module handle?
If you use Maven to build, you can define your dependencies in the pom.xml file. They will then be automatically downloaded if necessary.
I've done exactly this just recently - allowed run-time addition of C# scripting. It's not hard at all, and this article: http://www.divil.co.uk/net/articles/plugins/scripting.asp is a very useful summary of the details.
Yes. It's hard enough trying to deal with how different browsers will render valid HTML, never mind trying to predict what they'll do with invalid code. Same goes for search engines - enough problems in the HTML may lead to the site not being indexed properly or at all. I guess the real answer is "it depends on what...
Probably not if you have a non-complying site to begin with and are short on time. However, and you won't believe me because I didn't believe others to begin with, but it is easier to make a site compliant from the start - it saves you headaches in terms of browser compatibility, CSS behaviour and even JavaScript be...
TOAD has an interface to do SQL*Loads, I believe it can generate the control files too.
TOAD has an interface to do SQL*Loads, it can generate the control files too... http://www.toadsoft.com/get2know9/#Loader
Store the module handle away when it is given to you in DllMain and then use it later when you actually need it. A lot of frameworks (e.g., MFC) do this automatically.
Basically, you have two problems: how to define point of injections in your generated code, and how to run python / ruby / whatev scripts from there. Depending on how you generate the process, one possible solution would be to add a function to each possible point of injection. The function would check, whether the ...
The exception I was facing yesterday was caused by my stupid try to write on the headers of the already built page. When I started creating my Request following one of the mothods indicated here, I could write my headers. Now I'm using the WebRequest object, as in the sample indicated by @sectrean, [here][1]. ...
Cost of Inserts vs Update in SQL Server
|sql-server|
I have a table with more than a millons rows. This table is use to index Tiff Images. Each image have fields like date, number, etc. I have users that index this images in batch of 500. I need to know if it is better to insert first 500 and then 500 updates or when the user ends do the 500 insert with all the data. A ...
What is a good markup language to use for tests?
|testing|integration-testing|
I'm writing a tool to run a series of integration tests on my product. It will install it and then run a bunch of commands against it to make sure its doing what it is supposed to. I'm exploring different options for how to markup the commands for each test case and wondering if folks had insight to share on this. I'm ...
Black Box testing software
|testing|oracle-database|blackbox|
We are about to get a canned package in that has been modified to our needs. I am part of the team setup to prepare tests for it. It has an Oracle back end and I believe it's written in C++ .NET. My question is what free or open source testing tools would you recommend. Thanks Ken
|oracle-database|testing|black-box|
I found an Answer at [the bottom of this page in comments section][1] Repeated here for posterity (should the original comment be lost) > **jpwrunyan said on Apr 30, 2007 at 10:10 PM :** >>By the way, here is how to calculate age in years (only) from DOB without needing to account for leap years: >>>`privat...
Try using enumerations for each object, you can switch on enums quickly and easily.
Two things: 1. The scoping of the variables is done by the block they are declared in - in this case denoted by the presence of { }. Its not that there is a try scoping, just block scoping. 2 (and more importantly). You can't know where in the try block the exception was thrown. It may have been before your varia...
I don't think that there is a property like you specify, but as an alternative you could register a ClassHandler for the ListBox.SelectionChanged event in your Window class: EventManager.RegisterClassHandler(typeof(ListBox), ListBox.SelectionChanged, new SelectionChangedEventHandler(this.OnListBoxSelect...
This is quick response!! I am trying to run this "Simple Tabs" on this page: http://stilbuero.de/jquery/tabs/ I think it is the same with this one: http://docs.jquery.com/UI/Tabs I just copied and pasted the whole thing into my MVC view page, with corrected path to the jquery.js and .css files, but the conten...
The variables are block level and restricted to that Try or Catch block. Similar to defining a variable in an if statement. Think of this situation. try { fileOpen("no real file Name"); String s = "GO TROJANS"; } catch (Exception) { print(s); } The String woul...
There's ANTLR, which is LL(*), there's PyParsing, which is more object friendly and is sort of like a DSL, and then there's [Parsing][1] which is like OCaml's Menhir. [1]: http://www.canonware.com/Parsing/
I don't use VIM but Powershell's default output is Unicode. Notepad can read unicode, you could use it to see if you are getting the output you expect.
In the specific example you've given, initialising s can't throw an exception. So you'd think that maybe its scope could be extended. But in general, initialiser expressions can throw exceptions. It wouldn't make sense for a variable whose initialiser threw an exception (or which was declared after another variable ...
I have an ASP.NET MVC-application which I want deployable on both IIS6 and IIS7 and as we all know, IIS6 needs the ".mvc"-naming in the URL. Will this code work to make sure it works on all IIS-versions? Without having to make special adjustments in code, global.asax or config-files for the different IIS-versions. ...
You can also test if an object has a specific variable with: >>> hi_obj = hi() >>> hasattr(hi_obj, "some attribute")
Your example shows "instance variables", not really class variables. Look in `hi_obj.__class__.__dict__.items()` for the class variables, along with other other class members like member functions and the containing module. class Hi( object ): class_var = ( 23, 'skidoo' ) # class variable d...
In .NET it would be pretty simple to set up a method that looks through an assembly and identifies each class's inheritance/implementation hierarchy. I'm sure you could do it in Java, too, if you research the [Java reflection API][1]. You could then create an array of `ITargetInterface`s and call a test method on e...
Why not iteratively divide by 2? <pre> count = 0 while n > 0 if (n % 2) == 1 count += 1 n /= 2 </pre>
Why not iteratively divide by 2? <pre> count = 0 while n > 0 if (n % 2) == 1 count += 1 n /= 2 </pre> EDIT: Matt, I don't currently have enough reputation to comment... :P. I agree that this isn't the fastest, but "best" is somewhat ambiguous. I'd argue though that "best" should have an element of...
How do you change the style of a div programatically
|asp.net|asp.net-mvc|
How do I change the style (color) of a div such as the following? "<div id=foo class="ed" style="display: <%= ((foo.isTrue) ? string.Empty : "none") %>"> <%= ((foo.isTrue) ? foo.Name: "false foo") %>"`
Dinamically created operators
|dinamic|operator|creation|
I created a program using dev-cpp and wxwidgets wich solves a puzzle.<br> The user must fill the operations blocks and the results blocks, and the program will solve it.<br> Im solving it using bruteforce, i generate all non repeated 9 lenght number combinations using a recursive algorithm. It does it pretty fast.<br...
One thing that I don't often see discussed in these form layout questions, if you've chosen a table to layout your form (with labels on the left and fields on the right as mentioned in one of the answers) then that layout is fixed. A work, we recently had to do a quick 'proof of concept' of our web apps in Arabic. Th...
One thing that I don't often see discussed in these form layout questions, if you've chosen a table to layout your form (with labels on the left and fields on the right as mentioned in one of the answers) then that layout is fixed. At work we recently had to do a quick 'proof of concept' of our web apps in Arabic. Th...
Use MyObject.GetXXXX() when the method returns XXXX. Use MyObject.LoadXXXX() when XXXX will be loaded into MyObject, in other words, when MyObject keeps control of XXXX. The same applies to webservices, I guess.
Builtin methods or functions don't implement the descriptor protocol which makes it impossible to do stuff like this: >>> class C(object): ... id = id ... >>> C().id() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: id() takes exactly one argume...
No, generics in Java is purely a way to avoid casting of Object.
bitnami stack subversion it's easy to install. You can try to install so too xampp with portableapps.com and subversion.
No, this is not possible. Generics are not as powerful as templates. For instance, a template argument can be a user-defined type, a primitive type, or a value; but a generic template argument can only be <code>Object</code> or a subtype thereof.
From an ISO C++ viewpoint, there are two issues: (1) Is the object a POD? The acronym stands for Plain Old Data, and the standard enumerates what you can't have in a POD (Wikipedia has a good summary). If it's not a POD, you can't memset it. (2) Are there members for which all-bits-zero is invalid ? On Windows an...
Where can I learn about proven methods for sharing crypographic keys?
Manualy choose an interface on TCP to send data
|c|linux|networking|tcp|
I have a TCP server that is listening on a particular interface only. I want that after the accept() call if the incoming connection was from xxx.xxx.xxx.0 subnet then the data should go through intf1 otherwise the data should be sent through intf2 which is where my server is listening. Both the interfaces have the...
I am not sure if I followed correctly... I am assuming your application is dependent on this external app, while building? In that case it should be on the machine doing CI...
Its the same old thing used in ZX Spectrum era. You load programs/games from tape.Only the sound quality and the filters are probably better. In my opinion something like Bluetooth or WiFi is better. You can also send files that can be put on some storage and then load them. I find these methods much easier than so...
http://beanstalkapp.com/ will host your repository and make it navigable at the same time.
Problems with IronPython Studio and PictureBox
|ironpython-studio|
Right, so I'm having a go at Iron Python Studio as I'm quite familiar with VS2005 and want to try Python with an integrated GUI designer. But as soon as I add a PictureBox I'm in trouble. When running the project I get complaints about BeginInit and soon enough the form designer stops working. Is this because I'm ru...
Where should you enable SSL?
|security|ssl|
My last couple of projects have involved websites that sell a product/service and require a 'checkout' process in which users put in their credit card information and such. Obviously we got SSL certificates for the security of it plus giving peace of mind to the customers. I am, however, a little clueless as to the sub...
I would definitely recommend picking up [a book](http://www.amazon.com/s/ref=nb_ss_b?url=search-alias%3Dstripbooks&field-keywords=speech+recognition&x=0&y=0) or two if you are new to the field. I've got no experience in the field, so I can't make a recommendation. If you are still in college (or still have close ties...
Tables with no Primary Key
|mssql|indexing|
I have several tables whose only unique data is a uniqueidentifier (a Guid) column. Because guids are non-sequential (and they're client-side generated so I can't use newsequentialid()), I have made a non-primary, non-clustered index on this ID field rather than giving the tables a clustered primary key. I'm wonderi...
|sql-server|indexing|
SQL Server Management Studio Alternatives
|mssql|
I was wondering if there are any alternatives to Microsoft's SQL Server Management Studio? Not there's anything wrong with SSMS, but sometimes it just seem too big an application where all I want todo is browse/edit tables and run queries.
|sql-server|
How should I organize my master ddl script.
|mssql|sql|schema|ddl|