instruction
stringlengths
0
30k
in O-R mapping, inheritance maps to a parent table where the parent and child tables use the same identifier for example create table Object ( Id int NOT NULL --primary key, auto-increment Name varchar(32) ) create table SubObject ( Id int NOT NULL --primary key and also ...
Creating a fluid panel in GWT to fill the page?
|java|gwt|
I would like a panel in GWT to fill the page without actually having to set the size. Is there a way to do this? Currently I have the following: <pre> <code> public class Main implements EntryPoint { public void onModuleLoad() { HorizontalSplitPanel split = new HorizontalSplitPanel(); //split.setSize...
Opening Javascript based popup ads on the same page.
|javascript|php|html|
I own an image hosting site and would like to generate one popup per visitor per day. The easiest way for me to do this was to write a php script that called subdomains, like ads1.sitename.com ads2.sitename.com unfortunatly most of my advertisers want to give me a block of javascript code to use rather than a dire...
Close, you'd use var x = data[0].Make; var z = data[0].Model; var y = data[0].Year;
If you have large amount of data to be indexed or you expect high traffic, I'd suggest using some external search engine, like [Solr](http://lucene.apache.org/solr/). This way, you'll keep *shared-nothing* approach and be able to scale your site components independently.
Why would you think that t should be 0? Or, more accuractely phrased, "Why would you think that the binary representation of a floating point zero would be the same as the binary representation of an integer zero?"
Is there any Fuzzy Search or String Similarity Functions libraries written for C#?
|c#|.net|string|comparison|fuzzy|
There are similar question, but not regarding C# libraries I can use in my source code. Thanks.
There are similar question, but not regarding C# libraries I can use in my source code. Thank you all for your help. I've already saw lucene, but I need something more easy to search for similar strings and without the overhead of the indexing part. The answer I marked has got two very easy algorithm, and one ...
Using Themes for ASP.NET 2 and greater will provide you everything you need for this.
No. Wait for PHP 5.3.
The other option is to use bitfields: struct bits { unsigned int a:1; unsigned int b:1; unsigned int c:1; }; struct bits mybits; defines a 3-bit field. Bit operations now become a bit (haha) simpler: To set or clear a bit: mybits.b = 1; mybits.c = 0; To...
The other option is to use bitfields: struct bits { unsigned int a:1; unsigned int b:1; unsigned int c:1; }; struct bits mybits; defines a 3-bit field (actually, it's 3 1-bit felds). Bit operations now become a bit (haha) simpler: To set or clear a bit: mybits....
The other option is to use bit fields: struct bits { unsigned int a:1; unsigned int b:1; unsigned int c:1; }; struct bits mybits; defines a 3-bit field (actually, it's three 1-bit felds). Bit operations now become a bit (haha) simpler: To set or clear a bit: my...
I wanted to do this once, and the only thing that I could think of, is monkey patching Net::HTTP#read_body and Net::HTTP#read_body_0 methods to accept a length parameter and then in the former just pass the length parameter to the read_body_0 method, where you can read only as much as length bytes.
Or using the Maven assembly plugin (mvn assembly:assembly)
How to suppress Terminated message after killing in bash?
|unix|bash|shell|
How can you suppress the 'Terminated' message that comes up after you kill a process in a bash script? I tried set +bm, but that doesn't work. I know another solution involves calling 'exec 2> /dev/null', but is that reliable? How do I reset it back so that I can continue to see stderr? Thanks
ASCII mode changes new line characters between unix and DOS formats. \n to \r\n and viceversa.
Boost has a great range of [smart pointers][1] which impliment reference counting or delete-on-scope exit or intrusive reference counting. These have proven enough for our needs. A big plus is that it is all free, open source, templated C++. because it is reference counting, in most cases it is highly deterministic whe...
ACSII mode converts text files between UNIX and Windows formats based on the server and client platform (CR/LF vs LF), Binary doesn't. Of course, if you transfer nearly anything in ASCII mode that isn't text, it will probably be corrupted for that reason.
If you want an exact copy the data use binary mode - using ascii mode will assume the data is 7bit text (chars 0-127) and truncate any data outside of this range. Dates back to arcane 7bit networking days where ascii mode could save you time. In a globalized environment that we live in (such that it is quite common...
If you want an exact copy the data use binary mode - using ascii mode will assume the data is 7bit text (chars 0-127) and truncate any data outside of this range. Dates back to arcane 7bit networking days where ascii mode could save you time. In a globalized environment that we live in - such that it is quite commo...
My experience tells me that using by using linq you can get things done faster, however the actual actions to the database are slower. So... if you have a small database, i'll say go for it. If not, i would wait for some improvements before changing
Actually, ASCII/BINARY has nothing to do with the 8th bit. It's a convention for translating line endings. When you are on a windows machine talking to a Unix FTP server (FTPS or FTP - doesn't matter - the protocol is the same), the server will replace any &lt;CR&gt;&lt;LF&gt;-Combination with &lt;LF&gt; before stor...
This is a painful and hacky way to do it, but it's what we're doing where I work. We're also using classic asp so we're using inline sql calls. we actually wrap the sql call in a function (here you can check for a specific user) and add "SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED" to the beginning of the call. ...
Creating cursor rsrc files on Mac from png
|macos|png|cursors|rsrc|
I want to create cursor rsrc files on the Mac from png files. The application that uses the cursors requires it to be in a .rsrc format and I cannot change that. Does anybody know of any way I can create the cursor .rsrc files from png images. Thanks jbsp72
Use ATL, and CStringT then you can just use the assignment operator. Or you can use the USES_CONVERSION macros, these use heap alloc, so you will be sure that you won't leak memory.
It looks like you're working with C# and .net 3.5. I have come across some posts that suggest using a yield type of algorithm on a file stream with an XmlReader. Here's a couple blog posts to get you started down the path: - [Streaming With Linq to SQL Part 1][1] - [Streaming With Linq To SQL Part 2][2] ...
Best way to implement mutliple Default Buttons on a ASP.NET Webform
|asp.net|webforms|
What is the best way to implement mutliple Default Buttons on a ASP.NET Webform? I have what I think is a pretty standard page. There is a login area with user/pass field and a login button. Then elsewhere on the same page there is a single search field with a search button.
An easy way in perl (probably easily adaptable to bash) is to glob the filenames in an array then get the sequence number and remove those that are not divisible by 4
An easy way in perl (probably easily adaptable to bash) is to glob the filenames in an array then get the sequence number and remove those that are not divisible by 4 Something like this : @files = grep {my ($seq)= m{(\d*).jpg$};$seq % 4 ==0} glob ('/path/to/files/*.jpg');
An easy way in perl (probably easily adaptable to bash) is to glob the filenames in an array then get the sequence number and remove those that are not divisible by 4 Something like this will print the files you need: ls -1 /path/to/files/ | perl -e 'while (<STDIN>) {($seq)=/(\d*)\.jpg$/; print $_ if $seq && ...
you can use a keyboard macro for that:- C-a C-k C-x ( C-y C-j C-x ) C-u 9 C-x e **Explanation:-** - C-a : Go to start of line - C-k : Kill line - C-x ( : Start recording keyboard macro - C-y : Yank killed line - C-j : Move to next line - C-x ) : Stop recording keyboard macro - C-u 9 : Repeat 9 ti...
In short - yes. They are worth every ounce of effort... to a point. Tests are, at the end of the day, still code, and much like typical code growth, your tests will eventually need to be refactored in order to be maintainable and sustainable. There's a tonne of GOTCHAS! when it comes to unit testing, but man oh man ...
Find coordinates of every link in a page
|javascript|web|location|hyperlink|
In Javascript: How does one find the coordinates (x, y, height, width) of every link in a webpage?
Maybe a little obvious to some... Install firebug and use console.log("hello"). So much better than using random alert();'s which I remember doing a lot a few years ago.
Not necessarily. "Only use one dot" is an inaccurate summary of the Law of Demeter. The Law of Demeter discourages the use of multiple dots when each dot represents the result of a different object, e.g.: - First dot is a method called from ObjectA, returning an object of type ObjectB - Next dot is a method ...
Have you considered [Memoization](http://en.wikipedia.org/wiki/Memoization)? The basic idea is this; if you have an expensive function call, there is a function which will calculate the expensive value on first call, but return a cached version thereafter. The function looks like this; static Func<T> Remembe...
ReSharper sluggishness
|visual-studio|performance|ide|resharper|
I like ReSharper, but it is a total memory hog. It can quickly swell up and consume a half-gig of RAM without too much effort and bog down the IDE. Does anybody know of any way to configure it to be not as slow?
### Listing To see a list of current buffers, I use: :ls ### Opening To open a new file, I use :e ../myFile.pl with enhanced tab completion (put `set wildmenu` in your `.vimrc`). Note: you can also use `:find` which will search a set of paths for you, but you need to customize those paths...
### Listing To see a list of current buffers, I use: :ls --- ### Opening To open a new file, I use :e ../myFile.pl with enhanced tab completion (put `set wildmenu` in your `.vimrc`). Note: you can also use `:find` which will search a set of paths for you, but you need to customize those ...
### Listing To see a list of current buffers, I use: :ls --- ### Opening To open a new file, I use :e ../myFile.pl with enhanced tab completion (put `set wildmenu` in your `.vimrc`). Note: you can also use `:find` which will search a set of paths for you, but you need to customize those ...
I am 99.99999% sure that it is the entire url that is used to cache resources in a browser, so your url scheme should work out fine.
Our team use PMD and Cobertura, actually our projects are maven projects and there is very simple to include plug ins for code analysis. The real question would be for specific project which analysis you need to use, my opinion is that it's you couldn't use the same plugins for each project.
The answers refering to __int64 miss the problem. The enum *is* valid in C++ compilers that have a true 64 bit integral type. It only fails in compilers which lack such an integral type. Now, C++0x will likely have long long, which will make it work everywhere. Extensions to C++03 like __int64 work differently acro...
I'm not a dream weaver expert, but all Spry Accordian requires is the correct html structure. eg: <div id="Accordion1" class="Accordion"> <div class="AccordionPanel"> <div class="AccordionPanelTab">Panel 1</div> <div class="AccordionPanelContent"> Panel 1 Conte...
Instead of creating a temporary file, filling it up, and then sending a link, you can create a memory buffer, fill it up, and then send *that* as the response (serve it with mime-type 'text/html'). If you don't want to send page-buffers immediately, you can save them for later in the user's session. If you're worried o...
I would normally use the NotInList event to add data to a combo with Response = acDataErrAdded To update the combo. The Access 2007 Developers Reference has all the details, including sample code: <http://msdn.microsoft.com/en-us/library/bb214329.aspx>
Nero AAC is the only one as far as I know. Even if FAAC supported HE-AAC it would be useless, since as an encoder its pretty awfully designed and its quality is not even competitive with LAME, let alone a good AAC encoder. Kostya on the FFMPEG team is currently working on an AAC encoder but it has a long way to go-...
Tips in order of Importance: -Tip#1 Always remember to declare your destructors "virtual". -Tip#2 Use RAII -Tip#3 Use boost's smartpointers -Tip#4 Don't write your own buggy Smartpointers, use boost (on a project I'm on right now I can't use boost, and I've suffered having to debug my own smart pointers, I ...
Maybe detach the process from the current shell process by calling 'disown'?
Do not get scared by the prices, the freeware version (available from hex-rays.com) is perfectly sufficient for reversing Win32 x86 code.
i have been using the NetDataSerialiser to serialise my domain classes. [link text][1]http://msdn.microsoft.com/en-us/library/system.runtime.serialization.netdatacontractserializer.aspx the domain classes are shared between client and server.
You probably shouldn't do it at all, since such action may annoy the user when executed at the wrong time (95% of cases*), just like stealing focus with a "Yes/No" prompt. *Purely hypothetical figure
You probably shouldn't do it at all, since such action may annoy the user when executed at the wrong time (95% of cases*), just like stealing focus with a "Yes/No" prompt. There's no official API for that either. *Purely hypothetical figure
You probably shouldn't do it at all, since such action may annoy the user when executed at the wrong time (95% of cases*), just like stealing focus with a "Yes/No" prompt. Unless your product's task is to toggle the sidebar of course. ;) There's no official API for that anyway. *Purely hypothetical figure
Capture the enter key press for each area of the screen and then fire the corresponding button's click even.
One thing to bear in mind is that NHibernate can be an absolute pig to configure - especially since its based mainly on XML config files because of its roots as the original Hibernate. [Fluent NHibernate][1] goes some way to making this less painful. Linq certainly though fits in with the general 'way' in which ...
You should look into [Castle][1]'s ActiveRecord [ORM][2], which works on top of [NHibernate][3]. You develop a data model (like you've done with 'Product') which inherits from AR's base class, which provides great querying abilities. AR/NHibernate provide aggressive query optimization and caching. Performance and scala...
Try a rake task. For example: 1. Create the file **/lib/tasks/bootstrap.rake** 2. In the file, add a task to create your default user: namespace :bootstrap do desc "Add the default user" task :default_user => :rails_env do User.create( :name => 'default', :password => 'password' ) ...
What is the best way to handle files for a small office?
|versioning|version-control|filemanagement|
I'm currently working at a small web development company, we mostly do campaign sites and other promotional stuff. For our first year we've been using a "server" for sharing project files, a plain windows machine with a network share. But this isn't exactly future proof. SVN is great for code (it's what we use now)...
|version-control|versioning|filemanagement|
I'm currently working at a small web development company, we mostly do campaign sites and other promotional stuff. For our first year we've been using a "server" for sharing project files, a plain windows machine with a network share. But this isn't exactly future proof. SVN is great for code (it's what we use now)...
From the MSDN [Smart Client Data Blog][1]: > In this version, the .NET runtime > added support for what we call the > DataDirectory macro. This allows > Visual Studio to put a special > variable in the connection string that > will be expanded at run-time... > > By default, the |DataDirectory| > variable wi...
GLUT pop-up menus
|opengl|menu|glut|
Is it easy to create GLUT pop-up menus for my OpenGL application? If yes, how?
Creating and using pop-up menus with GLUT is very simple. Here is a code sample that creates a pop-up menu with 4 options: // Menu items enum MENU_TYPE { MENU_FRONT, MENU_SPOT, MENU_BACK, MENU_BACK_FRONT, }; // Assign a default value ...
What is the difference between mysql_real_escape_string and addslashes?
|php|
`mysql_real_escape_string` and `addslashes` are both used to escape data before the database query, so what's the difference? (This question is not about parametrized queries/PDO/mysqli)
It is true that a list that contains a large number of items with custom permissions applied, will slown down your server. This is document in the official Microsoft paper [Plan for software boundaries][1]. The recommended/magic number is 2000. Going further won't break anything, but it **could** be that you will ru...
By taking the python -c "print '#' * $TM_SELECTED_TEXT" a step further, you can duplicate the examples you gave in the question. Just make a snippet, called divider or something, set the `tab trigger` field to something appropriate `'--'` for example, then enter something like: `python -c "print '_...
Checking if another web server is listening from asp
|asp|
I'm using Microsoft.XMLHTTP to get some information from another server from an old ASP/VBScript site. But that other server is restarted fairly often, so I want to check that it's up and running before trying to pull information from it (or avoid my page from giving an HTTP 500 by detecting the problem some other way)...
Direct3D can only draw triangles (well, it can draw lines and points as well, but that's besides the point). So if you want to draw any shape that is more complex than a triangle, you have to draw a bunch of touching triangles that equal to that shape. In your case, it's a concave polygon triangulation problem. Give...
Article about ASP.net MVC Vs ASP.net Web form [http://weblogs.asp.net/shijuvarghese/archive/2008/07/09/asp-net-mvc-vs-asp-net-web-form.aspx][1] [1]: http://weblogs.asp.net/shijuvarghese/archive/2008/07/09/asp-net-mvc-vs-asp-net-web-form.aspx
If you are "just" needing one component to be pluggable, it's enough to simply instantiate the classes based on meta information, e.g. read via a classloaders META-INF/ information from the various jars that are on your classpath or in a certain plugin directory. OSGi on the other hand provides means to structure yo...
What's the best alternative to C++ for real-time graphics programming?
|c++|real-time|graphics|3d|polls|
C++ just sucks too much of my time by making me micro-manage my own memory, making me type far too much (hello `std::vector<Thingy>::const_iterator it = lotsOfThingys.begin()`), and boring me with long compile times. What's the single best alternative for serious real-time graphics programming? Garbage collection is ...
|c++|polls|graphics|3d|real-time|