instruction stringlengths 0 30k ⌀ |
|---|
bash (unlike POSIX sh) supports arrays:
fruits=(apple orange kiwi "dried mango")
for fruit in ${fruits[@]}; do
echo "${fruit}"
done
This has the advantage that array elements may contain spaces or other members of $IFS; as long as they were correctly inserted as separate elements, they are re... |
bash (unlike POSIX sh) supports arrays:
fruits=(apple orange kiwi "dried mango")
for fruit in "${fruits[@]}"; do
echo "${fruit}"
done
This has the advantage that array elements may contain spaces or other members of $IFS; as long as they were correctly inserted as separate elements, they are ... |
To solve this issue I tried using the 8.2 dblink sources, instead of the latest version. |
To solve this issue I tried using the 8.2 dblink sources, instead of the latest version.
You also need to make sure you use gnu make not the sun make. |
WCF Oracle adaptor and UDT |
|oracle-database|wcf|biztalk| |
Is there any way to work with Oracle UDT's with current WCF adaptor? |
Actually, in C# 2.0 you can create your own iterator that traverses a container in reverse. Then, you can use that iterator in your foreach statement. But your iterator would have to have a way of navigating the container in the first place. If it's a simple array, it could go backwards like this:
static IEnumer... |
Consequences of changing USERPostMessageLimit |
|winapi| |
One of our legacy applications relies heavily on PostThreadMessage() for inter-thread communication, so we increased USERPostMessageLimit in the registry (way) beyond the normal 10.000.
However, documentation on MSDN states that "This limit should be sufficiently large. If your application exceeds the limit, it shou... |
I dont think there is a command switch to do this at all. If you want to force it off all the time then you may want to edit the registry:
Hive: HKEY_CURRENT_USER
Key: SOFTWARE\Microsoft\Notepad
Name: fWrap
Type: REG_DWORD
Value: 0
You could even create a .reg file and put it in a batch f... |
s/###(.+?)###/
if you want the ###'s then you need
s/(###.+?###)/
the ? means non greedy, if you didn't have the ?, then it would grab too much. e.g. '###token1### text text ###token2###' would all get grabbed.
My initial answer had a * instead of a +. * means 0 or more. + means 1 or more. * was wrong... |
/###(.+?)###/
if you want the ###'s then you need
/(###.+?###)/
the ? means non greedy, if you didn't have the ?, then it would grab too much. e.g. '###token1### text text ###token2###' would all get grabbed.
My initial answer had a * instead of a +. * means 0 or more. + means 1 or more. * was wrong b... |
It won't be much slower, but because an Integer[] must accept "null" as an entry and int[] doesn't have to, there will be some amount of bookkeeping involved, even if Integer[] is backed by an int[].
So if every last ounce of performance matters, user int[] |
Always store in GMT (or UTC). From there it is easy to convert to any local time zone value. |
Page can not be displayed |
|html| |
I've got a client that sees the "Page can not be displayed" (nothing else) whenever they perform a certain action in their website. I don't get the error, ever. I've tried IE, FF, Chrome, and I do not see the error. The client sees the error on IE.
The error occurs when they press a form submit button that has on... |
<ul>
<li style="color: #888;"><span style="color: #000">test</span></li>
</ul>
the big problem with this method is the extra markup. (the span tag)
|
Maybe if the following conditions apply:
1. The new programmers already understand the project and don't need any ramp-up time.
2. The new programmers already are proficient with the development environment.
3. No adminstrative time is needed to add the developers to the team.
4. Almost no communication is requir... |
Lifetime of temporaries bound to const references is one that few people know about. Or at least it's my favorite piece of C++ knowledge that most people don't know about.
MSN |
Unfortunately, according to the Hibernate [documentation][1] "Properties from superclasses not mapped as @MappedSuperclass are ignored." I ran up against this too. My solution was to represent inheritance through interfaces and not through the entity beans themselves.
In your case, you could define the following:
... |
Unfortunately, according to the Hibernate [documentation][1] "Properties from superclasses not mapped as @MappedSuperclass are ignored." I ran up against this too. My solution was to represent the desired inheritance through interfaces rather than the entity beans themselves.
In your case, you could define the follo... |
How do you use WebServiceMessageDrivenBean class? |
|java|spring|spring-ws| |
How do you use the the org.springframework.ws.transport.jms.WebServiceMessageDrivenBean class from the Java Spring Framework - Spring-WS project?
There is very little documentation or examples available on the web. |
How do you use WebServiceMessageDrivenBean in Spring-WS? |
egrep "\.sty$|\.cls$" |
Can I stop .NET eating IDs? |
|c#|.net|javascript|html|css| |
I've created batch programs using C# and SQL.
Pros of C#:
You've got the full library of .NET and all the power of an OO language.
Cons of C#:
*Batch program and db separate - this means, you'll have to manage your batch program separate from the database.
*You need to escape all that dang sql code.
P... |
I use unit tests to save time.
When building business logic (or data access) testing functionality can often involve typing stuff into a lot of screens that may or may not be finished yet. Automating these tests saves time.
For me unit tests are a kind of modularised test harness. There is usually at least one ... |
Vista UAC, Access Elevation and .Net |
|.net|uac|elevation| |
I'm trying to find out if there is any way to elevate a specific function within an application. For example, I have an app with system and user settings that are stored in the registry, I only need elevation for when the system settings need to be changed.
Unfortunately all of the info I've come across talks about... |
cscope. (wanted to mod up other scope post, but i don't have karma yet).
* global search and replace
* find all places a function is called
* find all places called by a function
* find files including this file.
really simple usage: $ cscope -R
if you don't know vi, then change your EDITOR and VIE... |
SQL commands time out because the query you're using takes longer than that to execute. Execute it in Query Analyzer or Management Studio, *with a representative amount of data in the database*, and look at the execution plan to find out what's slow.
If something is taking a large percentage of the time and is descr... |
A combination of ben's answer and Mike Dimmick's: you would be implementing a stream_buf_ that ends up calling OutputDebugString. Maybe someone has done this already? Take a look at the two proposed Boost logging libraries. |
You probably can't explicitly **detect** unmanaged devices... but you have MAC -> switch port mappings, on your managed ones, right? If so, you should be able to **infer** the presence of unmanaged switches / hubs with more than one connected client -- I don't know how you'd find a port with only one.
1. Record the ... |
I don't think you can get that answer with one SQL statement as you are trying to obtain one result from many records. The only way to achieve that in SQL is to get the timestamp field for two different records and calculate the difference (datediff). Therefore, UNIONS or Inner Joins are needed.
|
ORA-00161: transaction branch length 103 is illegal (maximum allowed 64 |
|c#|oracle-database| |
I'm using the DAC from Oracle, any idea if there is a patch for this? |
This course from IBM would also be excellent but a bit pricy!!!
http://www.redbooks.ibm.com/abstracts/sg247304.html?Open
|
What causes the error "Can't execute code from a freed script" |
|javascript|internet-explorer| |
I thought I'd found the solution a while ago (see my [blog][1]):
> If you ever get the JavaScript (or should that be JScript) error "Can't execute code from a freed script" - try moving any meta tags in the head so that they're before your script tags.
...but based on one of the most recent blog comments, the fi... |
Here is a detailed list of available features on different editions of Visual Studio : [Product Comparison][1]
[1]: http://msdn.microsoft.com/en-us/vs2008/products/cc149003.aspx |
The easiest way to make this work is probably to write a script in the same language your website is using (sounds like PHP) and call it from cron.
No need to make it more complicated than it needs to be by putting the logic in two places (your existing calculations and a stored procedure). |
All right then, I'll be the voice of agile here. The problem can't be solved at the end of that process, it has to be avoided by managing the project differently.
Aside from a specific methodology, the trick is to put those decisions into the hands of the customers. You have a list of things to be done. When th... |
In SQL Server this will generate your custom select you demonstrate. You can extrapolate to an insert
> select
> 'SELECT Species.ID, Country.CountryID FROM Country, Species WHERE (((Species.' +
> c.name +
> ')=1)) AND (((Country.Country)="' +
> c.name +
> '"))'
> from syscolumns ... |
You can also inherit the controls into your own classes, and set the property in there. This method is also nice if you tend to be doing a lot of set up that is the same on all of the controls. |
AppData on vista refers to C:\Users\xxxx\AppData\Roaming not the C:\Users\xxxx\AppData folder it's self. |
AppData on vista refers to C:\Users\xxxx\AppData\Roaming not the C:\Users\xxxx\AppData folder it's self.
Also this artical http://www.microsoft.com/technet/scriptcenter/resources/qanda/sept05/hey0901.mspx on a microsoft site implies that you simply have to use the path relative to the appdata folder
|
A large application that I used to work on in the early 1990s contained C-based exception handling using setjmp and longjmp. The volatile keyword was necessary on variables whose values needed to be preserved in the block of code that served as the "catch" clause, lest those vars be stored in registers and wiped out by... |
You don't need to use raw sockets to send and receive ICMP packets. At least not on Windows.
|
You shouldn't store images in the database, as is the general consensus [here][1].
The file system is just much better at storing images than your database is.
You should use a database to store meta information about those images, such as a title, description, etc, and just store a URL or path to the images.
... |
If you have no choice than to go row by row creating a FAST_FORWARD cursor. It will be as fast as building up a while loop and much easier to maintain over the long haul.
FAST_FORWARD
Specifies a FORWARD_ONLY, READ_ONLY cursor with performance optimizations enabled. FAST_FORWARD cannot be specified if SCROLL or... |
I recently set up an OpenMPI cluster using Ubuntu. Some existing write up is at https://wiki.ubuntu.com/MpichCluster . |
You can only use one dataset in a scatter plot, thus only one color.
<http://code.google.com/apis/chart/#scatter_plot>
*From the API description:*
> Scatter plots use multiple data sets differently than other chart types. You can only show one data set in a scatter plot. |
I have used
http://code.google.com/p/jarjar/
and found it to be pretty good.
Also, you will find out if you have broken any reflection easily if you have a good set of unit/acceptance tests :). |
You've forgotten the ServerControl.
In my understanding it is like that:
- There are only two different kind of controls: UserControl and ServerControl
- UserControl = CompositeControl
- All of them are WebControls (because they are all derived from System.Web.UI.Control)
- They are all rendered in any way so ... |
Could you have mistyped the PROTOCOL in the URL? It should be HTTPS, not "SSL". For example, HTTPS://www.google.com:443, not SSL://www.google.com:443. Can you double check this in your example client and make sure it is HTTPS, not SSL.
|
The function as it is shown when I'm writing this is wrong. It produces incorrect output even when _hex2asciiU_value is fully specified. The following code works, and on my 2.33GHz Macbook Pro runs in about 1.9 seconds for 200,000,000 million characters.
#include <iostream>
using namespace std;
... |
The function as it is shown when I'm writing this produces incorrect output even when _hex2asciiU_value is fully specified. The following code works, and on my 2.33GHz Macbook Pro runs in about 1.9 seconds for 200,000,000 million characters.
#include <iostream>
using namespace std;
static ... |
The function as it is shown when I'm writing this produces incorrect output even when _hex2asciiU_value is fully specified. The following code works, and on my 2.33GHz Macbook Pro runs in about 1.9 seconds for 200,000,000 million characters.
#include <iostream>
using namespace std;
static ... |
What is the best way to handle URL mappings between an RIA version and plain old HTML version of a site? |
|ria|url|mapping| |
So if you have a RIA version (Silverlight or Flash) and a standard HTML version (or AJAX even), should you have the same URL for both, or is it ok to have a different one for the RIA app and just redirect accordingly?
So, for instance, if you have a site (http://example.com), is it ok to have the about page URL for ... |
|ria| |
Go to the Tool menu and select "Import and Export Settings..." option. Then select "Reset all settings" in the Wizard. On the next screen you can save current settings. Then on the final screen, it should allow you to select which collection of settings you want to use. I don't have platform builder but hopefully that ... |
> [...] In any style command **the first row
> index** may be set to one of the special strings [...]
In your first example you're setting the *second* row index to a special string as well.
Not sure why the other two don't work... Are you sure this is where the exception is coming from?
|
javascript (jquery) calendar plugin |
|jquery|calendar| |
Does any know of a good calendar (not datepicker, but a BIG browsable calendar) plugin for one of the major javascript frameworks. I'd prefer jQuery. |
What you really need to do is store your settings the Application Data folder. |
Cross platform RTF control? |
|rtf|cross-platform| |
Does anyone know of an RTF control that can be used on Linux/Windows/Mac? It's unfortunate that I have to mention it, but it actually has to be able to save and open rtf files... unlike wxWidgets wxRichTextCtrl for instance. |
Does anyone know of an RTF control that can be used on Linux/Windows/Mac? It's unfortunate that I have to mention it, but it actually has to be able to save and open rtf files... unlike wxWidgets wxRichTextCtrl for instance.
Edit: Thanks to HappySmileMan for his reply. Better still if it's more of a standalone and n... |
|cross-platform|rtf| |
Does anyone know of an RTF control that can be used on Linux/Windows/Mac? It's unfortunate that I have to mention it, but it actually has to be able to save and open rtf files... unlike wxWidgets wxRichTextCtrl for instance.
Edit: Thanks to HappySmileMan for his reply. Better still if it's more of a standalone and n... |
I'm an Information Architect and JavaScript developer by trade nowadays, but recently I've been getting back into back-end coding again. And, whilst trying to get an HTML prototype integrated and working with our C#-based CMS, I've come to blows with our programmers over the HTML ID attributes being arbitrarily rewrit... |
This regex:
\\.(sty|cls)\z
will match any string ends with .sty or .cls
**EDIT:**
for grep \z should be replaced with $ i.e.
\\.(sty|cls)$
as [jelovirt][1] suggested.
[1]: http://stackoverflow.com/questions/38993/regex-to-match-unique-substrings#38995 |
For Java EE 5 there's a separate tutorial [JEE tutorial](http://java.sun.com/javaee/5/docs/tutorial/doc/). That's useful, as people often ask about persistence and xml binding in java. |
NUnit - How to test all classes that implement a particular interface |
|c#|.net|unit-testing|nunit| |
If I have interface IFoo, and have several classes that implement it, what is the best/most elegant/cleverest way to test all those classes against the interface?
I'd like to reduce test code duplication, but still 'stay true' to the principles of Unit testing.
What would you consider best practice? I'm using NUn... |
ls | grep -E "\.(sty|cls)$"
- `\.` matches literally a `"."` - an unescaped `.` matches any character
- `(sty|cls)` - match `"sty"` or `"cls"` - the | is an `or` and the brackets limit the expression.
- `$` forces the match to be at the end of the line
Note, you want `grep -E` or `egrep`, not `grep -e... |
If you consider REALbasic, this is extremely easy to do with RB and the MBS Plugins. I've just written an application that does timed screenshots using RB and the MBS Plugins. You can read about it here: http://tektalkin.blogspot.com/2008/08/screenaudit-for-mac-osx.html |
I don't use NUnit but I have tested C++ interfaces. I would first test a TestFoo class which is a basic implementation of it to make sure the generic stuff works. Then you just need to test the stuff that is unique to each interface. |
I agree with the previous answers but I have one remark to add.
If you want to add more information to the relation and allow more relations between the same two entities you need option one.
For example if you want to track all the times user 1 has used widget 664 in the userwidget table the userid and widgetid i... |
In Perl, you actually want something like this:
$text = 'text ###token1### text text ###token2### text text';
while($text =~ m/###(.*?)###/g) {
print $1, "\n";
}
Which will give you each token in turn within the while loop. The (.*?) ensures that you get the *shortest* bit between the d... |
In Perl, you actually want something like this:
$text = 'text ###token1### text text ###token2### text text';
while($text =~ m/###(.+?)###/g) {
print $1, "\n";
}
Which will give you each token in turn within the while loop. The (.*?) ensures that you get the *shortest* bit between the d... |
Wrap the text within the list item with a span (or some other element) and apply the bullet color to the list item and the text color to the span. |
It only helps if you have a resource-driven project.
For instance, consider this:
You need to paint a large poster, say 4 by 6 meters. A poster that big, you can probably put two or three people in front of it, and have them paint in parallel. However, placing 20 people in front of it won't work. Additionally, yo... |
If you are using java 1.3/1.4, Thread.UncaughtExceptionHandler is not available.
In this case you can use a solution based on AOP to trigger some code when an exception is thrown. Spring and/or aspectJ might be helpful.
|
You'll want to set a "list-style" via CSS, and give it a color: value. Example:
ul.colored {list-style: color: green;} |
If you really *have* to leave the data in the format you have - and adding a numeric sort order column is the better solution - then consider wrapping the text manipulation up in a user defined function.
select colname from table order by dbo.udfSortOperator(colname)
It's less ugly and gives you some abstractio... |