instruction stringlengths 0 30k ⌀ |
|---|
You might want \w which is a "word" character. From [javadocs][1], it is defined as [a-zA-Z_0-9], so if you don't want underscores either, that may not work....
[1]: http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/Pattern.html |
How to return a page of results from SQL? |
|.net|sql|linq|pagination| |
Many applications have grids that display data from a database table one page at a time. Many of them also let the user pick the number of records per page, sort by any column, and navigate back and forth through the results.
What's a good algorithm to implement this pattern without bringing the entire table to the ... |
Biggest single advantage for me would be the clear-cut separation between your Model, View, and Controller layers. It helps promote good design from the start. |
sed is quick and easy:
sed -e "s/pattern/result/" <file list>
you can also join it with find:
find <other find args> -exec sed -e "s/pattern/result/" "{}" ";"
|
If the comment string is EXACTLY like that you can use replace.
select replace(comment_col, 'activation successful of id ', '') as id from ....
It almost certainly won't be though - what about unsuccessful Activations?
You might end up with nested replace statements
select replace(replace(comment_col, 'ac... |
I found one not wholly satisfactory solution. In a seperate MDX query I retrieved all the members of the dimension corresponding to the page field. I also built a dictionary of the items to exclude. I then loop through the members like so:
PivotField.CubeField.EnableMultiplePageItems = True
firstTime = True... |
Any good templating engine worth its salt will have an "escape quotes" function. Ours (also home-grown, where I work) also has a function to escape quotes for javascript. In both cases, the template variable is then just appended with _esc or _js_esc, depending on which you want. You should never output user-generated ... |
> "the expression collapsing margins means that adjoining margins (no non-empty content, padding or border areas or clearance separate them) of two or more boxes (which may be next to one another or nested) combine to form a single margin."
Source: [Box Model - 8.3.1 Collapsing margins][1]
[1]: http://www.w3.... |
**Builtin Classes**
-------------------
In certain specific cases, the .net framework already provides tuple-like classes that you may be able to leverage.
***Pairs and Triples***
The generic
**<a href="http://msdn.microsoft.com/en-us/library/5tbh8a42.aspx">System.Collections.Generic.KeyValuePair</a>**
cla... |
You could make a separate properties file (outside the jar) for passwords (either direct DB password or or key passphrase) and not include that properties file with the distribution. Or you might be able to make the server only accept that login from a specific machine so that spoofing would be required. |
One aspect of low-cost -- high execution time is that when you are looking at large data-sets, it is often more efficient on the whole to do things in bulk, whereas if you want a quick results, it is more efficient to do as little work as possible to get the first record. The repetitiveness of doing the small operatio... |
I've run into this problem before, too.
I tried following the advice in the question response given by @Martin to rebind Ctrl+H to "File Search" in Window | Preferences | General | Keys, but for some reason, I don't have a "File Search" entry in the Command column. (I'm running Eclipse 3.3 currently; maybe the "Fil... |
I've run into this problem before, too.
I tried following the advice in the question response given by @Martin to rebind Ctrl+H to "File Search" in Window | Preferences | General | Keys, but for some reason, I don't have a "File Search" entry in the Command column. (I'm running Eclipse 3.3 currently; maybe the "Fil... |
How to abort a thread in a fast and clean way in java? |
|java|multithreading| |
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value.
If the user changes another value (or the same value again by clicking many times o... |
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value.
If the user changes another value (or the same value again by clicking many times o... |
Here is my problem: I've got a dialog with some parameters that the user can change (via a spinner for example). Each time one of these parameters is changed, I launch a thread to update a 3D view according to the new parameter value.
If the user changes another value (or the same value again by clicking many times o... |
The order is set by sql server, the only thing you can do is use a system sp (sp_settriggerorder) to set which trigger will fire first and which will fire last.
Beyond setting the first and last triggers to fire, you can't modify or tell which order sql server will use. Therefore you will want to build your trigger... |
Use sp_Settriggerorder stored procedure, you can define the execution order of the trigger.
sp_settriggerorder [ @triggername = ] ‘[ triggerschema. ] triggername’
, [ @order = ] ‘value’
, [ @stmttype = ] ’statement_type’
[ , [ @namespace = ] { ‘DATABASE’ | ‘SERVER’ | NULL } ]
The second parameter, “order” can... |
Write an "Adapter Class" and overwrite only the methods you care.
class MyAdapter extends MyClass {
public void A() {
}
...
} |
Where to put helper-scripts with GNU autoconf/automake? |
|automake|autoconf| |
I'm working on a project that will be distributed with GNU autoconf/automake, and I have a set of bash scripts which call awk scripts. I would like the bash scripts to end up in the $PATH, but not the awk scripts. How should I insert these into the project? Should they be put in with other binaries?
Also, is ther... |
Use this system stored procedure:
sp_settriggerorder[@triggername = ] 'triggername', [@order = ] 'value', [@stmttype = ] 'statement_type'
|
If you want to practice while having a little fun check out [http://typeracer.com][1]
It let's you compete against other people and trust me, there's nothing better to get you typing faster than normal than a little healthy competition.
[1]: http://typeracer.com |
Don't know a direct way but maybe this will help you:
- Open MainMenu/View/Other Windows/Code Metric Results
- Calculate Code Metrics Results
- Export the Results to Excel
- Use Excel to get the count of unique Types in the List.
Don't know if the Code Metrics Stuff is available in all Editions of VS. I'm usin... |
I came across <a href="http://www.iconbuffet.com/" target="_blank">IconBuffet</a> when registering my copy of Visual Studio Express. They have some awesome icons that you could use in your applications.
For application development I have also started playing with WPF interfaces in .Net, soon to be available on Mono ... |
In practise I don't often find sites developed not using MasterPages. They allow simple and easy manipulation of site look and feel and also makes navigation elements and shared content pieces a breeze.
ASP.Net 3.5 even allows multiple contentpages and manipulation of header sections across a single master pages.
... |
You can use the firebird embeded, it's just a dll that you will need to ship with you app.
About things being undocumented, that's not really true, the firebird .NET driver implements the ADO Interfaces, so if you know ADO you can work with Firebird, basically instead of SQLConnection you will use FBConnection and s... |
There's a similar question [here][1] that covers some of the pros and cons.
I would suggest not using the registry unless your application absolutely needs it. From my understanding, Microsoft is trying to discourage the use of the registry due to the flexibility of settings files. Also, I wouldn't recommend using .... |
For the record, .Net Framework 3.5 SP1 is required for Microsoft SQL Server 2008 to install and RTM'd around the same time as the release this week. Still a hefty install but you can extract the client profile from it. Just not to sure how. |
I agree with Daniel. If it's a large application I think I'd do things in the registry. If it's a small application and you want to have aspects of it user-configurable without making a configuration form, go for a quick INI file.
I usually do the parsing like this (if the format in the .ini file is option = value, ... |
Would you be open to writing a bit of code? One option, create a CLR User Defined function, then use Regex. You can find more details [here](http://msdn.microsoft.com/en-us/magazine/cc163473.aspx). This will handle complex strings.
If your above line is always formatted as 'activation successful of id #######', w... |
Is this what you're talking about?
SqlDataAdapter da = new SqlDataAdapter();
var cmd1 = ((IDbDataAdapter)da).DeleteCommand;
var cmd2 = ((IDbDataAdapter)da).UpdateCommand;
var cmd3 = ((IDbDataAdapter)da).SelectCommand;
var cmd4 = ((IDbDataAdapter)da).InsertCommand;
The SqlDataAdapter i... |
An exception to the rule mentioned above that you should generally use the stack for local variables that are not needed outside the scope of the function:
Recursive functions can exhaust the stack space if they allocate large local variables or if they are recursively invoked many times. If you have a recursive fu... |
No. When you have two adjacent vertical margins, the greater of the two is used and the other is ignored.
So, for instance, if you have two block-display elements, A, followed by B beneath it, and A has a bottom-margin of 3em, while B has a top-margin of 2em, then the distance between them will be 3em.
If you se... |
Managing localization and translations using .rc files and Visual Studio is not a good idea. It's much smarter (though counter-intuitive) to start localization through the exe. Read here why: [http://www.apptranslator.com/misconceptions.html][1]
[1]: http://www.apptranslator.com/misconceptions.html |
"Carriage Return" gets stripped out when compresssing file |
|c#|zip| |
When compressing a string "stream" the '/r' gets stripped out from '/r/n'. I am using the ICSharp.zip library for compression. Has any one else faced this problem, and if you have is there is a workaround? |
If you are using JUnit to test, use Mocks instead of stubs.
Read Martin Fowler's article "[Mocks Aren't Stubs][1]"
I recommend the [EasyMock][2] framework, it works like a charm automatically Mocking your interface using reflection. It is a bit more advanced that the code samples in Fowler's article, especially ... |
If you are using JUnit to test, use Mocks instead of stubs.
Read Martin Fowler's seminal article "[Mocks Aren't Stubs][1]"
I recommend the [EasyMock][2] framework, it works like a charm automatically Mocking your interface using reflection. It is a bit more advanced than the code samples in Fowler's article, esp... |
Use ab or httperf or curl or something to repeatedly load the CSS files from the webserver. Perhaps it's not consistently serving the pages. |
We are considering using machine.config to add one key for the environment, and then have one section in the web.config which is excactly the same for all environments. This way we can do a "real" XCopy deployment.
E.g. in the machine.config for every computer (local dev workstations, stage servers, build servers, p... |
Like a previous poster said, practice, practice, practice. But, if you are a developer (since you are on this site I assume that you are), then writing code will probably not be the type of practice that you need to improve your typing skills past your current maximum. I would even argue that 75wpm is more than adequat... |
The Symbian file server has the following capabilities:
TCB ProtServ DiskAdmin AllFiles PowerMgmt CommDD
So any DLL being loaded into the file server process must have at least these capabilities. There is no way around this, short of writing a new proxy process as you allude to.
However, there is a more f... |
I'd make the following changes to Longhorn213's example to clean this up a bit:
private List<T> FindControlsByType<T>(ControlCollection controls )
{
List<T> foundList = new List<T>();
foreach (Control ctrl in this.Page.Controls)
{
if (ctrl as T != null )
... |
> However, please note that "type=text" does not work in IE7.
It works in IE7, but not IE6 |
Someone else mentioned this, then deleted it. If you want to style all textareas and text inputs the same way without classes, use the following CSS (does not work in IE6):
input[type=text], textarea { width: 80%; } |
there is this plugin that costs $20+
http://satokar.com/viplugin/
I use it and it works great, you've got basic vi movement commands and a set of others.
Here is an open source, free plugin but i've never been able to get it working (i'm on a mac).
http://sourceforge.net/projects/vimplugin/
You can also g... |
I second the Visual SVN Server suggestion. It packages SVN with an Apache server (with SSL support!) and a really nice, easy to use control panel. You can be up in running in less than 10 minutes. It even integrates with Active Directory or your local Windows accounts very nicely.
http://www.visualsvn.com/server/ |
Use a CSS class for width, then place your elements into HTML DIVs, DIVs having the mentioned class.
This way, the layout control overall should be better. |
Check out Java's [Mapped Byte Buffers][1], also known as 'direct buffers'. Basically, this mechanism uses the OS's virtual memory paging system. It will manage moving the bytes from disk to memory auto-magically, and you won't have to worry about changing your virtual machine options. This will allow you to take adv... |
Database safety: Intermediary "to_be_deleted" column/table? |
|sql|database| |
Everyone has accidentally forgotten the WHERE clause on a DELETE query and blasted some un-backed up data once or twice. I was pondering that problem, and I was wondering if the solution I came up with is practical.
What if, in place of actual DELETE queries, the application and maintenance scripts did something li... |
The trick is not only to generate all possible letter combinations that match a given number, but to select the letter sequence that is most easy to remember. A suggestion would be to run the [soundex][1] algorithm on each of the sequence and try to match against an English language dictionary such as [Wordnet][2] to ... |
You should also use the Sandcastle Help File Builder. It provides you with a ndoc like GUI for generating help files so you don't have to do anything from a command prompt.
[http://www.codeplex.com/SHFB][1]
[1]: http://www.codeplex.com/SHFB
|
I've heard good things about [PC-Lint](http://www.gimpel.com/), but I imagine it's probably overkill for your needs. |
Have you gathered optimiser stats on all the underlying tables? Without them the optimiser's estimates may be wildly out of kilter with reality. |
Apache and J2EE sharing security realms/logins, single sign-on |
|java|apache|authentication|tomcat|jakarta-ee| |
Here is the situation I'd like to create:
* `www.blah.com/priv` - protected by Apache HTTP Basic Auth, realm "foo"
* `www.blah.com/application` - protected by Tomcat/Servlet HTTP Basic Auth, realm "foo"
* User access `/priv`, apache requests login info, they provide and are given access
* Same user then requests ... |
Make it so that you cannot see the keyboard, this will force your mind to remember where the keys are. I used this when starting on the Colemak keyboard layout and it worked really well. |
I've got the following in my `.emacs`:
(if (window-system)
(set-frame-height (selected-frame) 60))
You might also look at the functions `set-frame-size`, `set-frame-position`, and `set-frame-width`. Use `C-h f` (aka `M-x describe-function`) to bring up detailed documentation.
I'm not sure if there's... |
I believe the classical way is to make an abstract class with empty methods.
At least, that's how Sun did for MouseListener, creating [MouseAdapter](http://java.sun.com/javase/6/docs/api/ "MouseAdapter") to ease the use of these events. |
The biggest way I increased my speed was by never looking down at the keyboard. I also have a very ergonomic keyboard that splits the keyboard in half so I get use to the right hand using the right side and the left hand using the left side. |
Adobe ExtendScript development - How different than regular JavaScript? |
|adobe|javascript|extendscript| |
|javascript|adobe|extendscript| |
Overview
--------
I'm working on a media database (or a so-called "multimedia library") project and it is based on XMP (the eXtensible Metadata Platform). The logical tool for administering the metadata and keywording seems to be Adobe Bridge, however I need to contract out the development of a couple of scripts to... |
I recommend IconFactory, too. Or to be exact: [http://stockicons.com/][1] There are a lot of icon sets for an affordable price and I think buying a professional set is the best choice you have if you're not a graphics designer yourself.
If you only need a single icon, it's probably worth to hire a graphics designer.... |
FF3 WinXP != FF3 Ubuntu - why? |
|css|ubuntu|firefox| |
I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP.
Two things I've noticed on Ubuntu:
1. The favicon is missing
2. The background color isn't displaying (it's set in the stylesheet)
What have I done wrong? The CSS file is... |
I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP.
Two things I've noticed on Ubuntu:
1. The favicon is missing
2. The background color isn't displaying (it's set in the stylesheet)
What have I done wrong? The CSS file is... |
|css|firefox|ubuntu| |
I've got a website that I've just uploaded onto the interwebs, and it's displaying differently using Firefox 3.0.1 on Ubuntu and WinXP.
Two things I've noticed on Ubuntu:
1. The favicon is missing
2. The background color isn't displaying (it's set in the stylesheet)
What have I done wrong? The CSS file is... |
Previously, there was no favicon. The browser cached the lack of favicon. [Clear the Firefox cache][1], and all is well.
[1]: http://pcsupport.about.com/od/maintenance/ht/clearcacheff.htm |
A 304 Not Modified response can result from a GET or HEAD request with either an If-Modified-Since ("IMS") or an If-Not-Match ("INM") header.
In order to decide what to do when you receive these headers, imagine that you are handling the GET request without these conditional headers. Determine what the values of yo... |
Check out Java's **[Mapped Byte Buffers][1]**, also known as 'direct buffers'. Basically, this mechanism uses the OS's virtual memory paging system. It will manage moving the bytes from disk to memory auto-magically, and you won't have to worry about changing your virtual machine options. This will allow you to take... |
Check out Java's **[Mapped Byte Buffers][1]**, also known as 'direct buffers'. Basically, this mechanism uses the OS's virtual memory paging system. It will manage moving the bytes from disk to memory auto-magically, and you won't have to worry about changing your virtual machine options. This will also allow you to... |
Check out Java's **[Mapped Byte Buffers][1]**, also known as 'direct buffers'. Basically, this mechanism uses the OS's virtual memory paging system to 'map' your buffer directly to disk. The OS will manage moving the bytes to/from disk and memory auto-magically, very quickly, and you won't have to worry about changin... |
I believe that [IDA Pro][1] will do what you want. It was mentioned in the O'Reilly Security Warrior book and I've seen it recommended on Windows Mobile developer forums.
[1]: http://www.hex-rays.com/idapro |
From [Wikipedia][1]:
Microsoft Expression Studio is a suite of design and media applications from Microsoft aimed at developers and designers. It consists of:
* Microsoft Expression Web (code-named Quartz) - WYSIWYG website designer and HTML editor.
* Microsoft Expression Blend (code-named Sparkle) - Visual user... |
Question
--------
I'm wondering how different ExtendScript is from JavaScript? Could I theoretically hire a web developer who has JavaScript savvy to develop it without demanding an excessive amount of learning on their part?
Overview
--------
I'm working on a media database (or a so-called "multimedia libra... |
Have you tried profiling the requests using strace/dtrace/truss (depending on your platform)?
There are a wide variety of issues that could be causing this. What version of openssl is being used by wget - there could be an issue there. What OS is this running on (full information would be useful there).
There cou... |
How do I explicitly set asp.net session to expire on closing the browser? |
|asp.net|session| |
By default the session expiry seems to be 20 minutes. |
By default the session expiry seems to be 20 minutes.
Update: I do not want the session to expire unitl the browser is closed. |
How do I explicitly set asp.net sessions to expire on closing the browser? |
Using `pkg-config` as command line argument under cygwin/msys bash |
|cygwin|bash|windows|pkg-config|makefile| |
I'm trying to use cygwin as a build environment under Windows. I have some dependencies on 3rd party packages, for example, GTK+.
Normally when I build under Linux, in my Makefile I can add a call to pkg-config as an argument to gcc, so it comes out like so:
<pre>
gcc example.c `pkg-config --libs --cflags gtk+-2.... |
I'm trying to use cygwin as a build environment under Windows. I have some dependencies on 3rd party packages, for example, GTK+.
Normally when I build under Linux, in my Makefile I can add a call to pkg-config as an argument to gcc, so it comes out like so:
<pre>
gcc example.c `pkg-config --libs --cflags gtk+-2.... |
|windows|bash|cygwin|makefile|pkg-config| |