instruction stringlengths 0 30k ⌀ |
|---|
I can understand the use for one level of namespaces. But 3 levels of namespaces. Looks insane. Is there any practical use for that? Or is it just a misconception?
|
You can't. This is an intentional design decision by the Git maintainers. Basically, the purpose of a Source Code Management System like Git is managing source code and empty directories aren't source code. Git is also often described as a content tracker, and again, empty directories aren't content (quite the opposite... |
I think you're going to have to be more specific about what you mean by 'OS'. It's by no means a clear concept. Some would say that the kernel is all of the OS. Others would say that the shell and core utilities such as 'ls' are part of the OS. Others would go as far as to say that standard applications such as Notepad... |
The ultimate best practice is to prevent the user from causing errors in the first place.
Don't tell users anything they don't care about; error code 5064 doesn't mean a thing to anyone. Don't tell them they did something wrong; disallow it in the first place. Don't blame them, especially not for mistakes your sof... |
You really want a big database of binary identifying markers to look for near the start of the file. Luckily, your question is tagged "Linux", and such a dabase already exists there; file(1) will do the job for you. |
Batching in REST |
|rest|wcf| |
Is there any way to batch call RESTful services? |
|wcf|rest| |
With web services it is considered a good practice to batch several service calls into one message to reduce a number of remote calls. Is there any way to do this with RESTful services?
|
[Quartz][1] is an open source job scheduling system that uses cron expressions to control the periodicity of the job executions.
[1]: http://www.opensymphony.com/quartz/ |
Couple items from some searching about:
Adobe.com : [Setting keyboard tap sounds][1]
> If you do not like the tapping sounds in your finished project, use the following procedure to remove them. The tapping sound is a project-level setting, so the sound either plays on all slides or is removed from all slides.
... |
mplayer -identify will do the trick. Just calling ffmpeg on a file will also work--it will automatically print a set of info at the start about the input file regardless of what you're telling ffmpeg to actually do.
Of course, if you want to do it from your program without an exec call to an external program, you ca... |
mplayer -identify will do the trick. Just calling ffmpeg on a file will also work--it will automatically print a set of info at the start about the input file regardless of what you're telling ffmpeg to actually do.
Of course, if you want to do it from your program without an exec call to an external program, you ca... |
You almost never want you use something like:
Object o = ...
if (o.getClass().equals(Foo.class)) {
...
}
because you aren't accounting for possible subclasses. You really want to use Class#isAssignableFrom:
Object o = ...
if (Foo.class.isAssignableFrom(o)) {
...
} |
Just the $ key. You can use 'A' to move to the end of the line and switch to editing mode. |
per [this][1]:
Press A to enter edit mode starting at the end of the line.
[1]: http://www.eec.com/business/vi.html |
Tools like Red-gate's SQL Compare are invaluable in making sure you have a complete script. You still may need to manually adjust it to make sure the objects are scripted in the correct order. Make sure to script triggers and constraints, etc as well as tables.In general you will want to use alter commands instead of ... |
The concept you are missing here, is that for every calloc, there must be a free.
and that free must be applied to the pointer passed back from calloc.
I recommend you create a function (named delete_matrix)
that uses a loop to free all of the pointers that you allocate in here
**for(int i = 0;i < size_x;i+... |
Interesting little challenge, I enjoyed solving it.
Here is my take at the problem:
String[] strs =
{
"eee 5 ddd jpeg2001 eee",
"eee 123 ddd jpeg2000 eee",
"ddd",
"aaa 5 yy 6",
"ccc 555",
"bbb 3 ccc",
"bbb 9 a",
"",
"eee 4 ddd jpeg2001 eee",
... |
|outlook|drop-down-menu|survey| |
I want to create a small survey in an email message. The user are to respond using free form text boxes, check boxes , or pre-defined drop downlist . I see applications that claim to be able to do that. my needs are not that elaborate. Just a few questions that need to be asked |
If ID is purely random, there is no algorithm to find an unused ID in a similarly random fashion without brute forcing. However, as long as the bit-depth of your random unique id is reasonably large (say 64 bits), you're pretty safe from collisions with only a million rows. If it collides on insert, just try again. |
Using SciTe, Notepad++ or other powerful text editor which have file processing routines, so you can create a script that colorizes parts of the log or just delete some non-important lines from it |
I believe that's valid, and the W3C validator agrees, but the authoritative source for this information is the ISO 8879:1986 standard, which costs ~150EUR/210USD. Regardless, it is not wrong to encode them, so if in doubt, encode. |
I believe that's valid, and the W3C validator agrees, but the authoritative source for this information is the ISO 8879:1986 standard, which costs ~150EUR/210USD. Regardless, it is not wrong to encode them, so if in doubt, encode. Additionally, if you are using an XML-based document type, you need to encode greater-t... |
depending on your database you might have the option of either using a sequenser (oracle) or a autoincrement (mysql, ms sql, etc). Or last resort do a select max(id) + 1 as new id - just be carefull of concurrent requests so you don't end up with the same max-id twice - wrap it in a lock with the upcomming insert state... |
Assuming .NET -
Console.WriteLine(Int32.MaxValue); |
The most correct answer I can think of is `Int32.MaxValue`. |
Consider switching to a keyboard layout that's designed for quick typing instead of just being layed out as it is for historical reasons, e.g. [Dvorak or Colemak][1].
For me, it also helped a lot to use the caps lock key as backspace, for example using [SharpKeys][2] on Windows.
If you are really hardcore, create... |
Here's an alternative solution using the built-in string.Split function:
string x = "foo[]=1&foo[]=5&foo[]=2";
string[] separator = new string[2] { "foo[]=", "&" };
string[] vals = x.Split(separator, StringSplitOptions.RemoveEmptyEntries);
|
Ants Profiler works for me
[http://www.red-gate.com/products/ANTS_Profiler/][1]
[1]: http://www.red-gate.com/products/ANTS_Profiler/ |
|delphi|com| |
How could i implement Type-Safe Enumerations in Delphi in a COM scenario ? Basically, i'd like to replace a set of primitive constants of a enumeration with a set of static final object references encapsulated in a class ? .
In Java, we can do something like:
public final class Enum
{
public stat... |
How to implement Type-safe COM enumerations in Delphi ? |
g95 is another cross platform/ mutliple cpu arcitechture free Fortran compiler. I had success in the past using it and it seems to be updated fairly often. Supprts F77, F90 and some parts of the F2003
http://www.g95.org/ |
Here's a CodeProject article that might help you out too...
[C#/.NET Command Line Arguments Parser][1]
[1]: http://www.codeproject.com/KB/recipes/command_line.aspx |
Here's a CodeProject article that might help you out...
[C#/.NET Command Line Arguments Parser][1]
IF VB is your flavor, here's a separate article (with a bit more guidance related content) to check out...
[Parse and Validate Command Line Parameters with VB.NET][2]
[1]: http://www.codeproject.com/KB/rec... |
Fortran compilers which I have worked with and have found useful (ordered in terms of recommended usage):
1. [Intel Visual FORTRAN][1] ($) Windows, Linux, MAC
2. [G95][3] (FREE) Windows (cygwin), Linux
3. [NAG Fortran Compiler][2] ($) Windows, Linux, MAC
4. [Lahey Fortran][4] ($) Windows, Linux
If you ... |
In C#, it was a question of performance. Specifically, out-of-box benchmarking.
When C# was new, Microsoft was hoping a lot of C++ developers would switch to it. They knew that many C++ folks thought of C++ as being fast, especially faster than languages that "wasted" time on automatic memory management and the li... |
You may still be able to find a "[PS2 Linux][1]" kit available - but the games you make there will only run on other instances of PS2 Linux - a limited audience.
[1]: http://en.wikipedia.org/wiki/PS2_Linux |
**enumerate**
Wrap an iterable with enumerate and it will yield the item along with it's index.
For example:
<pre><code>
>>> a = ['a', 'b', 'c', 'd', 'e']
>>> for index, item in enumerate(a): print index, item
...
0 a
1 b
2 c
3 d
4 e
>>>
</code></pre> |
[GridBagLayout][1] is usable. Once you get used to using it, it works great. I think the standard JDK layout managers are pretty powerful on their own. Plus, you get to minimize dependency on 3rd party libraries.
[1]: http://java.sun.com/javase/6/docs/api/java/awt/GridBagLayout.html |
You can always keep any extensions (modules) and/or applications you write closed source, but the kernel itself will need to remain open source.
There's a not-so-obvious aspect of the GPLv2 that you can exploit while testing the system: you only need to release source code to those who have access to the system. The... |
I use the [GridBagLayout](http://java.sun.com/javase/6/docs/api/java/awt/GridBagLayout.html). It seems to take alot of code, but it makes very good looking layouts.
I also like to combine [BorderLayout](http://java.sun.com/javase/6/docs/api/java/awt/BorderLayout.html) with GridBagLayout panels for great customiza... |
In your insert statement you have org(i) in single quotes. You shouldn't have that, you are probably inserting the words org(i) as values into the table. So your insert statement should be
INSERT INTO nbr.lien_item (lien_item_sid, excel_row, include_in_calcs, indent, header_level, sort_order, unit, lien_item_... |
What are best practices to implement security when using NHibernate? |
|security|nhibernate|orm|data-access| |
Traditionalist argue that stored procedures provide better security than if you use a Object Relational Mapping (ORM) framework such as NHibernate.
To counter that argument what are some approaches that can be used with NHibernate to ensure that proper security is in place (for example, preventing sql injection, et... |
Try to figure out a way to write your software so it corrects the problem for them. |
How do I remove objects from an Array in java? |
|java|arrays|array|delete|remove| |
Given an Array of **n** Objects, let's say is an **Array of Strings**, and it has the following values:
foo[0]="a";
foo[1]="cc";
foo[2]="a";
foo[3]="dd";
What do I have to do to delete/remove all the Strings/Objects equal to **"a"** in the Array?
Thanks! |
Paul Graham posted an article several years ago about why Python programmers made better Java programmers. (http://www.paulgraham.com/pypar.html)
Basically, regardless of whether the new language is relevant to the company's current methodology, learning a new language means learning new ideas. Someone who is willin... |
Why is ENUM better then INT |
|mysql| |
I just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs).
And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically static and won't change in the future, but if they... |
I just ran a "PROCEDURE ANALYSE ( )" on one of my tables. And I have this column that is of type INT and it only ever contains values from 0 to 12 (category IDs).
And MySQL said that I would be better of with a ENUM('0','1','2',...,'12'). This category's are basically static and won't change in the future, but if they... |
It is not clear to me if you are asking about the distro for the Vmware host, or for the guest operating system that will be your web server.
I generally really like Debian or Debian based distributions. But as far as Vmware is concerned Centos or anything really should work.
If you are looking at setting up man... |
I found the simple solution and it works. convert the .doc file tamplete to PCL using tool (available on net). open it in edit plus and study... i relize i can modify it according to my need. if u check it u wil see each charector is with its position Example:
*p0Y*p796Y*p1582Xn -- means charector n at position (x-axi... |
Interesting little challenge, I enjoyed solving it.
Here is my take at the problem:
String[] strs =
{
"eee 5 ddd jpeg2001 eee",
"eee 123 ddd jpeg2000 eee",
"ddd",
"aaa 5 yy 6",
"ccc 555",
"bbb 3 ccc",
"bbb 9 a",
"",
"eee 4 ddd jpeg2001 eee",
... |
I agree, Dundas has great controls. I used it in one of my projects.
This was the sample which I used to test out the CRI:
http://www.codeplex.com/MSFTRSProdSamples/Wiki/View.aspx?title=SS2005%21Custom%20Report%20Item%20Sample&referringTitle=Home
|
That's the right way of sending a nil value (assuming that the default namespace and the `xsi` namespace are set to the correct values, namely `"http://www.w3.org/2001/XMLSchema-instance"` for `xsi`.) so it looks like you might have come up against a bug in the CML parser you're using. What's the error message?
You ... |
Look for "For top level setup: ..." [here](http://trac.lighttpd.net/trac/wiki/HowToSetupTrac). |
Just change "/trac" to "/" in fastcgi.server |
Programmatically determine video file format? |
|linux|apache|php|file-io|binaryfiles| |
Ok, I get the basics of video format - there are some container formats and then you have core video/audio formats. I would like to write a web based application that determines what video/audio codec a file is using.
How best can I programmatically determine a video codec? Would it be best to use a standard library... |
|php|linux|video|file-io|binaryfiles| |
Unit testing of a GUI is also difficult, albeit not impossible, I guess. |
I tried to do this in MySQL. You would need to use a variable since there is no rank function in MySQL, so it would go like this:
set @trip1 = 0; set @trip2 = 0;
SELECT trip1.`date` as startdate, datediff(trip2.`date`, trip1.`date`) length_of_trip
FROM
(SELECT @trip1 := @trip1 + 1 as rank1, `date`... |
In unit testing, you should not test anything that does not belong to your unit; testing units in their context is a different matter. That's the simple answer.
The basic rule I use is that you should unit test anything that touches the boundaries of your unit (usually class, or whatever else your unit might be), an... |
There are some decent memory profilers.. can look at this question
[What Are Some Good .NET Profilers?][1]
[1]: http://stackoverflow.com/questions/3927/what-are-some-good-net-profilers |
I think what you're looking for is [here][1].
The technique involves handling the EditingControlShowing event of the DataGridView control and updating the datasource for the DataGridViewComboBoxEditingControl (presumably based on the values in the other columns in that row).
[1]: http://www.timvw.be/exploring-d... |
I think what you're looking for is [here][1].
The technique involves handling the EditingControlShowing event of the DataGridView control and updating the datasource for the DataGridViewComboBoxEditingControl (presumably based on the values in the other columns in that row).
[1]: http://www.timvw.be/exploring-d... |
It depends on how import the online documentation is to your product, a good documentation infrastructure can be complex to establish but once done it pays off. Here is how we do it -
- Help source [DITA][1] compilant XML, stored in SCC (ClearCase).
- Help editing [XMetal][2]
- Help compilation, customized [Open D... |
DatagridView virtual model with comboboxColumn |
|c#|datagridview| |
is it possible to have different items in different rows within a comboboxcolumn in a datagridview. This would be using virtual mode. Code samples would be great. |
You can do this pretty cleanly with this css:
.box {
width: 100px;
border: solid #884400;
border-width: 8px 3px 8px 3px;
background-color: #ccaa77;
}
.box ul {
margin: 0px;
padding: 0px;
padding-top: 50px; ... |
x & (x−1) == 0 |
bool is_power_of_2(int n)
{
return x > 0 && (x & (x−1) == 0);
} |
bool is_power_of_2(int n) {
return x > 0 && !(x & (x−1));
} |
Powers of two in binary look like this:
1: 0001
2: 0010
4: 0100
8: 1000
Note that there is always exactly 1 bit set. The only exception is with a signed integer. e.g. An 8-bit integer with a value of -128 looks like:
10000000
So after checking that the number is greater than zero, we ... |
Powers of two in binary look like this:
1: 0001
2: 0010
4: 0100
8: 1000
Note that there is always exactly 1 bit set. The only exception is with a signed integer. e.g. An 8-bit signed integer with a value of -128 looks like:
10000000
So after checking that the number is greater than ze... |
Powers of two in binary look like this:
1: 0001
2: 0010
4: 0100
8: 1000
Note that there is always exactly 1 bit set. The only exception is with a signed integer. e.g. An 8-bit signed integer with a value of -128 looks like:
10000000
So after checking that the number is greater than zero, ... |
Freeing the memory doesn't make it go away, it just means that another allocation might grab that same chunk of memory. Whatever you put in it will still be there until something else overwrites it.
Also, you're not freeing everything you allocated. You're only freeing the array of pointers and the first row. But ev... |
Freeing the memory doesn't make it go away, it just means that another allocation might grab that same chunk of memory. Whatever you put in it will still be there until something else overwrites it.
Also, you're not freeing everything you allocated. You're only freeing the array of pointers and the first row. But ev... |
In ruby:
puts File.read(_ _ FILE _ _) |
Insert the following into your .emacs file:
(setq x-select-enable-clipboard t)
Bonus: in order to make it work without restarting Emacs:
M-x load-file
When prompted:
.emacs |
Insert the following into your .emacs file:
(setq x-select-enable-clipboard t) |
One of my all-time fave sign-up forms was the original [Vox](http://www.vox.com/) one, which has since been changed; there was [a great break-down](http://www.askthecssguy.com/2007/03/form_field_hints_with_css_and.html) of it published online, and it goes into the things that made it so great to me. How they implement... |
Ohh forgot to say, make sure you have a good set of database backups before loading schema changes to production. Better safe than sorry. |
TCP send queue depth |
|tcp|network-programming| |
How do I discover how many bytes have been sent to a TCP socket but have not yet been put on the wire?
Looking at the diagram here:
<IMG SRC=http://www.tcpipguide.com/free/diagrams/tcpswpointers.png>
I would like to know the total of Categories 2, 3, and 4 or the total of 3 and 4. This is in C(++) and on both... |
How do I discover how many bytes have been sent to a TCP socket but have not yet been put on the wire?
Looking at the diagram here:
<IMG SRC="http://www.tcpipguide.com/free/diagrams/tcpswpointers.png">
I would like to know the total of Categories 2, 3, and 4 or the total of 3 and 4. This is in C(++) and on bo... |
It looks like it's grabbing the substring from the 3rd character (if 0 based) to the end, then if the substring has a length less than 2 it's making the length equal to 2 by adding 0 to the left side. |
I have been doing some more digging on this, and came across how to inject Javscript in to the client when required. This will obviously play a huge part in making the controls more responsive and lest round-trips to the server.
For example: [RegisterClientScriptBlock][1].
Look forward to playing with this more, ... |
ASP.NET Custom Controls and "Dynamic" Event Model |