instruction stringlengths 0 30k ⌀ |
|---|
|regex|perl|sgml-not-regex| |
Here's my reasons:
* Readability, easier to spot if you know there's only one on each line
* Version control, less intra-line changes, more single-line additions, changes, or deletions, easier to merge from one branch to another
|
In C++ :
int * i, j;
i is of type int *, j is of type int.
The distinction is too easily missed.
Besides having them on one line each makes it easier to add some comments later |
I think the ability to right click on a Stored Procedure in Server Explorer and debug.. |
I think that there are various reasons, but they all boil down to that the first is just less readable and more prone to failure because a single line is doing more than one thing.
And all that for no real gain, and don't you tell me you find two lines of saved space is a real gain.
It's a similar thing to what h... |
This is most likely a bug in the browser and/or plug-in. My suggestion would be to try telling JavaScript to open the window, using ExternalInterface. This may be more likely to trigger a pop-up blocker though. |
Don't go there. As a long term Mac developer, I can assure you, no solution is really working well. I tried so many solutions, but they are all not too good. I think the problem is that Apple does not really document the meta data format for the necessary data.
Here's how I'm doing it for a long time, very successfu... |
Sleep Less Than One Millisecond |
|c++|windows|winapi|sleep| |
On windows you have a problem you typically never encounter on Unix. That is how to get a thread to sleep for less than one millisecond. On Unix you typically have a number of choices (sleep, usleep and nanosleep) to fit your needs. On windows however there is only *Sleep* with millisecond granularity. You can however ... |
I don't think this was ever really a design goal of .NET - Microsoft has no particular interest in people writing software for non-Windows platforms ....
However, there is The Mono project (http://www.mono-project.com), which is "an open development initiative sponsored by Novell to develop an open source, UNIX vers... |
You can achieve this effect by creating a css stylesheet which is targeted directly to printing, and another targeted directly for the screen.
Use the link tag:
<link rel="stylesheet" type="text/css" href="print.css" media="print, handheld" />
<link rel="stylesheet" type="text/css" href="screen.css" medi... |
**edit:** Added information on hiding text.
You can achieve this effect by creating a css stylesheet which is targeted directly to
printing, and another targeted directly for the screen.
Use the link tag:
<link rel="stylesheet" type="text/css" href="print.css" media="print, handheld" />
<link rel="s... |
You lose your references when you make the remote call. You'll need to return the lists rather than expect them to be populated by the remote call.
|
As far as I know EXIF data in JPEG is continuous subpart of file.
So
1. prepare EXIF data in memory
2. write part of JPEG file upto EXIF
3. write prepared EXIF
4. write rest of JPEG file |
Try to use verbs in your dialog boxes.
It means use
![alt text][1]
instead of
![alt text][2]
[1]: http://img.usabilitypost.com/0808/osx_save.png
[2]: http://img.usabilitypost.com/0808/windows_save.png |
If you need the user to take some action as a result of the error (e.g. retrying the workflow) is it possible to create a task for that user with information on the error and the location of the workflow? |
Compound keys in JPA |
|java|jpa| |
I want to make an entity that has an autogenerated primary key, but also a unique compound key made up of two other fields. How do I do this in JPA?<br>
I want to do this because the primary key should be used as foreign key in another table and making it compound would not be good.
In the following snippet, I need... |
To check for a timeout, I believe you check the value of ex.Number. If it is -2, then you have a timeout situation. |
To check for a timeout, I believe you check the value of ex.Number. If it is -2, then you have a timeout situation.
try
{
SqlConnection sql = new SqlConnection(@"Network Library=DBMSSOCN;Data Source=YourServer,1433;Initial Catalog=YourDB;Integrated Security=SSPI;");
... |
To check for a timeout, I believe you check the value of ex.Number. If it is -2, then you have a timeout situation.
Your code would read:
if (ex.Number == -2)
{
//handle timeout
}
Code to demonstrate failure:
try
{
SqlConnection sql = new SqlConnection(@"Network Lib... |
AES does not expand data. Moreover, the output will not generally be compressible; if you intend to compress your data, do so before encrypting it.
|
Write a webhandler that exposes the content of the database as an RSS feed. |
Ok, one way to approximate that:
1 - shuffle your list
2 - take the y first elements to form the next row
4 - repeat (2) as long as you have numbers in the list
5 - if you don't have enough numbers to finish the list, reshuffle the original list and take the missing elements, making sure you don't r... |
Call .NET objects/dlls across virtual sites |
|.net| |
Site 1 has dll's for x amount of object and data calls. Can Site 2 (a separate .net web app) call the objects/dll's of Site 1 ? |
Attributes in JSP tag libraries in general can be either static or resolved at request time. If they are resolved at request time the JSP will resolve their value at runtime and pass the output on to the tag. This means you can put pretty much any JSP code into the attribute and the tag will behave accordingly to wha... |
DateTimePicker: pick both date and time |
|c#|.net|winforms| |
Is it possible to use DateTimePicker (Winforms) to pick both date and time (in the dropdown)? How do you change the custom display of the picked value? Also, is it possible to enable the user to type the date/time manually? |
Classical ASP in IIS 6.0 not scaling |
|asp-classic|iis-6|scalability| |
The IIS 6.0 is serving my Classical ASP pages in a serial fashion (one at a time)
The #2 request will be handled by the web server only when the #1 request ends.
If the #1 request takes a little longer, the #2 request will have to wait for the #1 ends to starts being handled by IIS.
**Is this a missconfigurat... |
You could just toss it into a doc library.
If you are packaging your web part into a sharepoint solution, you could include it as a Module (VSEWSS item). Your manifest file would get something like:
<TemplateFiles>
<TemplateFile Location="LAYOUTS\somescript.js" />
</TemplateFiles>
Theres lots ... |
VS2008. So far doing a re-install seems to be the best advice. I am using the `<%@ Page Language="C#" MasterPageFile="~/common/masterpages/MasterPage.master" %>`. When I say design-view I mean that I right+click on the file and choose "view designer" - this gives me access to the toolbox and tabs for designer,split,... |
Use [connection_aborted()][1]
[1]: http://us2.php.net/manual/en/function.connection-aborted.php |
How do you disable a SharePoint webpart temporarily? |
|sharepoint|web-parts| |
Can this be done by setting a property?
I'd prefer that approach then to remove all security before re-adding it.
(As this may have other consequences.)
Another option I can think of is to replace the particular webpart dll with a temporary one, and restart the .net process, but that's not an approach I like a... |
Can this be done by setting a property?
I'd prefer that approach then to remove all security before re-adding it.
(As this may have other consequences.)
Another option I can think of is to replace the particular webpart dll with a temporary one, and restart the .net process, but that's not an approach I like a... |
I have philosophical problems with the use of exceptions. Basically, you are expecting a specific scenario to occur, but rather than handling it explicitly you are pushing the problem off to be handled "elsewhere." And where that "elsewhere" is can be anyone's guess. |
It's best to follow some Microsoft training on the subject. If you are looking for books, the following would be ideal:
[http://www.microsoft.com/MSPress/books/9469.aspx][1]
[1]: http://www.microsoft.com/MSPress/books/9469.aspx |
Try this Microsoft Knowledge Base article: [Can't Run Macro That Calls 16-bit DLL in 32-bit MS Excel][1].
Do you have the proper rights to access the DLL?
[1]: http://support.microsoft.com/kb/131525 |
Why is setInterval calling a function with random arguments? |
To check for a timeout, I believe you check the value of ex.Number. If it is -2, then you have a timeout situation.
-2 is the error code for timeout, returned from DBNETLIB, the MDAC driver for SQL Server.
Your code would read:
if (ex.Number == -2)
{
//handle timeout
}
Code to demons... |
To check for a timeout, I believe you check the value of ex.Number. If it is -2, then you have a timeout situation.
-2 is the error code for timeout, returned from DBNETLIB, the MDAC driver for SQL Server. This can be seen by downloading [Reflector][1], and looking under System.Data.SqlClient.TdsEnums for TIMEOUT_EX... |
keyboard scancodes |
|gnulinux|text|console| |
<pre>
GNU/Linux text console, X11 not involved, indeed not even
installed. Keyboard is US layout, keymap US default. Kernel
version 2.20.x or later.
An application written in C is getting keyboard input in
translation mode, i.e. XLATE or UNICODE. When a key is
pressed, the application receives the corresponding... |
|linux|console|text| |
GNU/Linux text console, X11 not involved, indeed not even
installed. Keyboard is US layout, keymap US default. Kernel
version 2.20.x or later.
An application written in C is getting keyboard input in
translation mode, i.e. `XLATE` or `UNICODE`. When a key is
pressed, the application receives the corresponding
k... |
Try to modularise the SQL as much as possible and have a set of tests which will enable you to maintain, refactor and add features when needed. I once had the pleasure of inheriting a Stored Proc that totalled 5000 lines and I still have nightmares about it. Once the project was over I printed out the stored proc for a... |
Best way to set up CruiseControl for IIS 5.1 dev box and IIS6 server |
|.net|iis|svn|cruisecontrol.net| |
Can anyone point me in the right direction on this. From reading the FAQs at cruisecontrol, it appears that you should develop in the same environment as you produce.
But i have Windows XP (which only runs IIS 5.1) on my dev machine and the server is 2003.
Thanks |
Java is a fairly verbose programming language that is getting outdated very quickly with all of the new fancy languages/frameworks coming out in the past 5 years. To support all the fancy syntax that people want in a language AND preserve backwards compatibility it makes more sense to add more languages to the runtime.... |
I remember back in the day with 1.1 Visual Studio used to destroy my event handler hookups occasionally.
If you are using Visual Studio 2003, make certain that the "generated" code still contains the event handler wireup for your control.
|
Entire url. I've seen a strange behavior in a few older browsers where case sensitivity came into play. |
The advantage to having other languages for the JVM is quite the same as the advantage to having other languages for computer in general: while all turing-complete languages can technically accomplish the same tasks, some languages make some tasks easier than others while other languages make other tasks easier. Since... |
Don't go there. As a long term Mac developer, I can assure you, no solution is really working well. I tried so many solutions, but they are all not too good. I think the problem is that Apple does not really document the meta data format for the necessary data.
Here's how I'm doing it for a long time, very successfu... |
Use the ouput clause from 2005:
DECLARE @output TABLE (id int)
Insert into A (fname, lname)
OUTPUT inserted.ID INTO @output
SELECT fname, lname FROM B
select * from @output
now your table variable has the identity values of all the rows you insert. |
I am fairly sure AES encryption adds nothing to the data being encrypted, since that would give away information about the state variables, and that is a Bad Thing when it comes to cryptography.
If you want to mix compression and encryption, do them in that order. The reason is encrypted data (ideally) looks like t... |
If you have the data in your database, creating one yourself is fairly straight forward - there's a simple tutorial [here](http://www.downes.ca/cgi-bin/page.cgi?post=56).
Once you've set up a feed, in the <head> of your page, you put text like:
<link rel="alternate" title="RSS Feed"
href="... |
Please run the next SQL statements. For me it works fine. If you still have this strange error, it will be a DB2 bug. I had some problems once with copying code from UNIX editors into Windows and vice versa. The SQL would not run, although it looked ok. Retyping the statement fixed my problem then.
create table prob... |
If memory region is accessed by both hardware in software simultaneously (hardware configuration registers for example or scatter gather list for dma) this region **must** be defines as non cached. For actual dma buffer the memory can be define as cached and in most cases it advisable to be cached to allow the applicat... |
Persisting Checkbox State Across Postbacks |
|asp.net| |
I have a web form that binds a DataGrid to a, normally, different data source on each postback. I have a static CheckBox column that is always present to the left of the autogenerated columns. I achieve a TabControl effect with a horizontal Menu control above the grid, with each menu item being a tab that contains a ... |
The iPhone and iPod touch can view PDFs already, as one of the TV adverts in the UK shows an email with a .pdf attachment (of swimming lessons) being viewed. It can also view .doc, .xls, and so on, so if he is creating a viewer type application then supporting those as well could be a nice feature addition later on.
... |
There really isn't a sound, cross-browser way to do this in CSS. Assuming your layout has complexities, you need to use JavaScript to set the element's height. The essence of what you need to do is:
Element Height = Viewport height - element.offset.top - desired bottom margin
Once you can get this value and set... |
AFAIK there is no possibility to somehow convert it. You have to basically rewrite in in VBA.
If you have converted to VBA, you cannot run as a standalone application. As VBA states Visual Basic for Application, it is living inside an application (Word, Excel, Scala, whatever).
You have to learn a standard langua... |
WMI - Using InvokeMethod(..) on a ManagementObject representing a singleton ManagementClass |
|c#|wmi| |
I've having trouble directly accessing the **Win32_OperatingSystem** management class that is exposed via WMI.
It is a singleton class, and I'm pretty certain "Win32_OperatingSystem=@" is the correct path syntax to get the instance of a singleton.
The call to InvokeMethod produces the exception listed at the bott... |
WMI - Directly accessing the singleton instance of Win32_OperatingSystem |
|c#|windows-vista|wmi|windows-xp| |
I've having trouble directly accessing the **Win32_OperatingSystem** management class that is exposed via WMI.
It is a singleton class, and I'm pretty certain "Win32_OperatingSystem=@" is the correct path syntax to get the instance of a singleton.
The call to InvokeMethod produces the exception listed at the bott... |
To be honest I am not against it. I think that its perfectly feasible to group similar variables on the same line e.g.
float fMin, fMax;
however I steer clear when the variables are unrelated e.g.
int iBalance, iColor;
|
Sounds cool, but how will you get around changes to the stored value (if it was a reference type) itself? If its immutable then all is well but if not you're kinda stuffed :-)
If you're not dealing with immutable values, I would suspect a better approach would be to handle persistence at the value level and to just... |
1. to be more apparent to you when using Version Control tools (covered by Michel)
2. to be more readable to you when you have the simplest overflow/underflow or compile error and your eyes failed to point out the obvious
3. to defend the opposite (i.e. multi-variable single-line declaration) has less pros ("code ... |
In C/C++, you also have the problem that the * used to indicate a pointer type only applies to the directly following identifier. So a rather common mistake of inexperienced developers is to write
int* var1, var2, var3;
and expecting all three variables to be of type 'int pointer', whereas for the compiler re... |
Not all soundcards support 24 bit sample playback, and even when they do, they often have to be exclusively opened in that mode. There is a similar issue with sample rates. Your soundcard may be operating at 44.1kHz, in which case 48kHz needs to be resampled to be played.
I have written an open source .NET audio lib... |
What about the case such as:
public static final int NORTH = 0,
EAST = 1;
SOUTH = 2;
WEST = 3;
Is that considered bad practice as well? I would consider that okay as it counters some of the points previously made:
* t... |
It is bad practice mostly when you can and want to initialize variables on the deceleration. An example where this might not be so bad is:
string a,b;
if (Foo())
{
a = "Something";
b = "Something else";
}
else
{
a = "Some other thing";
b = "Out of examples";
... |
Just use serialization. Look at the BinaryFormatter class. |
Another tool you can use for the builds is [TeamCity][1] which is free for 20 build configurations (enough for most small companies/projects.) This way you can run your tests as well as schedule builds.
[1]: http://www.jetbrains.com/teamcity/ |
On windows however, the use of select forces you to include the winsock library which has to be initialized like this in your application:
WORD wVersionRequested = MAKEWORD(1,0);
WSADATA wsaData;
WSAStartup(wVersionRequested, &wsaData);
And then the select won't allow you to be called without any so... |
Creating your own drop down list is more of a pain than it's worth. You can use some javascript to make the IE drop down work.
Check out this solution here:
http://www.hedgerwow.com/360/dhtml/ui_select_with_fixed_width/demo.php
http://www.hedgerwow.com/360/dhtml/ui_select_with_fixed_width/ie-select-width-fix.js... |
Creating your own drop down list is more of a pain than it's worth. You can use some javascript to make the IE drop down work.
Check out this solution here:
http://www.hedgerwow.com/360/dhtml/ui_select_with_fixed_width/demo.php
http://www.hedgerwow.com/360/dhtml/ui_select_with_fixed_width/ie-select-width-fix.js... |
|javascript|firefox| |
So, I am seeing a curious problem. If I have a function
// counter wraps around to beginning eventually, omitted for clarity.
var counter;
cycleCharts(chartId) {
// chartId should be undefined when called from setInterval
console.log('chartId: ' + chartId);
if(typeof chartId... |
How do you search for an XML comment covering N lines of a file? |
|xml| |
I am attempting to find xml files with large swaths of commented out xml. I would like to programmatically search for xml comments that stretch beyond a given number of lines. Is there an easy way of doing this? |
There is a realy nice educational story on [thedailywtf.com](http://thedailywtf.com/Comments/Classic-WTF-The-Complicators-Gloves.aspx) on designing software. The posed question should be solved by a proper design, not by techo-woopla.
Alexander, please read the linked story and think gloves, not email-driven webpage... |
**ZX ASM 3.0**
It had the best user interface and good feature set compared to other assemblers at the end of the twentieth century. |
Actually, you have no way of guaranteeing in which order threads will execute. So the behavior (if not what you expect) is not really wrong.
I suspect you have some kind of synchronization going on here. Possibly SQL*Plus only let's itself be called once? Some programs do that...
Other possiblilties:
- threa... |