instruction stringlengths 0 30k ⌀ |
|---|
In general, if you need a child to communicate with a parent, you should look at having it do so by broadcasting events. This decouples the child for the parent, and makes it possible to have other classes work with the child.
I would not recommend passing in a reference to the parent class into the child.
Here i... |
You can use the `-s` operator to obtain the size of a file and the Spreadsheet::ParseExcel and Spreadsheet::WriteExcel modules to produce an updated spreadsheet with the information. |
You can use [the `-s` operator](http://p3rl.org/-X) to obtain the size of a file and the [Spreadsheet::ParseExcel](http://search.cpan.org/perldoc?Spreadsheet::ParseExcel) and [Spreadsheet::WriteExcel](http://search.cpan.org/perldoc?Spreadsheet::WriteExcel) modules to produce an updated spreadsheet with the information.... |
You can use [the `-s` operator](http://p3rl.org/-X) to obtain the size of a file and the [Spreadsheet::ParseExcel](http://search.cpan.org/perldoc?Spreadsheet::ParseExcel) and [Spreadsheet::WriteExcel](http://search.cpan.org/perldoc?Spreadsheet::WriteExcel) modules to produce an updated spreadsheet with the information.... |
I had to intgrate an applicaiton with Siebel, and it did prove to be pretty difficult. In the end I had to use the CTI interface, designed for handling Telephone calls and routing them to siebel. I basically had to trick it into thinking it was receiving a call and piggy back the data onto this.
Obviously this would o... |
Is there some way to inject SQL even if the ' character is deleted? |
|sql|database|sql-injection| |
If from an SQL query I remove all the ' characters, is there some other way to do an SQL injection attack on the database?
How can it be done? Can anyone give me examples? |
Stay productive: When I'm working on a boring project and notice I don't do anything useful but reading news, I set a timer.
Simple enough, set your mobile on a 1-2 hour timer. Work during that period. When the timer rings, take a break and feel good about yourself :)
For some reason, this works (for me and a coupl... |
It fully depends on what you want to do. To answer your second question, would you really want to try editing an animation storyboard outside of Blend? If you're working with the actual Visuals of the application, Blend is best suited for this. If you want to hack around with databinding, validation and other things wh... |
How can I view the allocation unit size of a NTFS partition in Vista ? |
|windows-vista|ntfs| |
Which built in (if any) tool can I use to determine the allocation unit size of a certain NTFS partition ? |
There is a gotcha here to be aware of with Windows Forms.
If you want a Control/UserControl from which you can inherit, even if you have no logic in the base class, you don't want it abstract, because otherwise you won't be able to use the Designer in the derived classes:
[http://www.urbanpotato.net/default.aspx/do... |
The most important thing is that the program be good. If its not good, nobody will use it. You cannot hope that the chicken-and-egg will reverse and that people will take it for granted until it becomes good.
Of course, "good" merely means "better than any other practical option for a significant number of people,... |
The most important thing is that the program be good. If its not good, nobody will use it. You cannot hope that the chicken-and-egg will reverse and that people will take it for granted until it becomes good.
Of course, "good" merely means "better than any other practical option for a significant number of people,... |
Sounds like you're looking for a phonetic-based algorithms, such as [soundex][1], [NYSIIS][2], or [double metaphone][3]. The first actually *is* what several government departments use, and is trivial to implement (with many implementations readily [available][4]). The second is a slightly more complicated and more pre... |
The `text-align: center` should be sufficient, since you're centering the text inside a block element (h2) - adjusting the margins will change the position of the block, not the text.
I wonder if it's just that IE is having a dummy-spit at that `font` declaration you've got there? |
Tuples should be slightly more efficient and because of that, faster, than lists because they are immutable. |
Hit up Request.QueryString.Keys for a NameValueCollection of all query string parameters. |
Clearly, phone.Dial(number) |
Use text-align:center in the div/td that surrounds the h2.
<table style = "width:400px;border:solid 1px;">
<tr>
<td style = "text-align:center;"><h2>hi</h2></td>
</tr>
</table>
edit: wow, stackoverflow's community is pretty fast!
|
Just access Request.QueryString. AllKeys mentioned as another answer just gets you an array of keys. |
python static variable |
|python| |
Is it possible to have static class variables or methods in python? What syntax is required to do this? |
Does this information need to be in the footer? A lot of the information is available within the Office 2007 application. If you click on the round button in the upper left, and select "Server", you can view the version history, a lot of the other properties are available by clicking the round button and opening the ... |
You can do this:
$items[A] = "Test";
$items[B] = "Test";
$items[C] = "Test";
$items[D] = "Test";
for($i=0;$i<count($items);$i++)
{
list($key,$value) = each($items[$i])
echo "$i $key contains $value";
}
I haven't done that before, but in theory it should wo... |
Django doesn't directly handle the generation of dynamic content (specifically Zip files). That work would be done by Python's standard library. You can take a look at how to dynamically create a Zip file in Python [here][1].
If you're worried about it slowing down your server you can cache the requests if you expec... |
You should definitely use a set/map. Like hazzen says, you get O(log n) insert/find. You won't get this with a sorted vector; you can get O(log n) find using binary search, but insertion is O(n) because inserting (or deleting) an item may cause all existing items in the vector to be shifted. |
You might want to try [YAMI][1] , it's very simple yet functional, portable and comes with binding to few languages
[1]: http://www.msobczak.com/prog/yami/ "YAMI" |
I think the first option is considered the best practice. And make the code folder your first package. The Rietveld project developed by Guido van Rossum is a very good model to learn from. Have a look at it: http://code.google.com/p/rietveld
With regard to Dangjo 1.0, I suggest you start using the Django trunk code... |
1. insert the row with a known guid.
1. fetch the autoId-field with this guid.
This should work with any kind of database.
|
Data Access Pages have been deprecated by MS for quite some time, and never really worked in the first place (they were dependent on the Office Widgets being installed, and worked only in IE, and only badly then).
It is true that Access controls that can get focus only have a window handle when they have the focus (... |
SQLite is a really nice product although I miss features from PostgreSQL. There are other, especially non-SQL, databases you may to consider like Berkeley DB.
/Allan |
IMHO [BXE - The Wysiwyg XML Editor][1] can do this - i.e. create/edit XML document in browser, based on existing XML Schema.
I am not sure, but you probably have to include it in your own page, it is just the editor component, not the full web application.
[1]: http://bitfluxeditor.org/home/ |
Thanks John, that's very useful but doesn't show the revision for the root folder of a project.
Now that you've pointed me in the right direction, I have found that I can right-click the folder, select properties and a TortoiseSVN tab appears which contains the revision number. |
In <code>/proc/*process_id*/status</code> (at least on Linux) you'll find a line like this:
<pre>Uid: 1000 1000 1000 1000</pre>
This tells you the uid of the user under whose account the process is running.
However, to find out the process id of the current process you would need a system call, a... |
Your business objects should throw exceptions for bad inputs, but those exceptions should never be thrown in the course of a normal program run. I know that sounds contradictory, so I shall explain.
Each public method should validate its inputs, and throw "ArgumentException"s when they are incorrect. (And private me... |
[nice one][1] John Sheehan. I always just right clicked on the root folder and selected tortoise-svn | view log
.
[1]: http://stackoverflow.com/questions/89741/can-i-see-the-currently-checked-out-revision-number-in-tortoise-svn#89754 |
You actually want /proc/self/status, which will give you information about the currently executed process.
Here is an example:
$ cat /proc/self/status
Name: cat
State: R (running)
Tgid: 17618
Pid: 17618
PPid: 3083
TracerPid: 0
Uid: 500 500 500 500
Gid: 50... |
As I understand it, there is no "lift" event -- the only event happens when the stylus is brought back to the screen later. Of course, this depends on your specific driver and so on.
Worse, the bug you describe might be reproducible with just a typical mouse. Try moving the mouse as fast as you can -- it will almost... |
You can also use the free IDE [SharpDevelop][1]. They target .NET Compact Framework too...
[1]: http://www.icsharpcode.net/OpenSource/SD/Features.aspx |
Change CruiseControl for JetBrains' TeamCity. It's free for up to 20 users, and is more powerful and usable than CruiseControl.
|
Change CruiseControl for JetBrains' TeamCity. It's free for up to 20 users, and is more powerful and usable than CruiseControl.
It's easy to set up, and has some amazing features. Such as automatically sending off a build to be performed on any spare computer you may have sitting around in the office.
|
You can create a macro that runs in response to a breakpoint firing. In your macro, you could do whatever it takes to make a beeping noise. |
If you are using a version of Java before 1.5, java.util.Scanner doesn't exist.
Which version of the JDK is your Eclipse project set up to use? |
If you are using a version of Java before 1.5, java.util.Scanner doesn't exist.
Which version of the JDK is your Eclipse project set up to use?
Have a look at Project, Properties, Java Build Path -- look for the 'JRE System Library' entry, which should have a version number next to it. |
Ultimate++ [http://www.ultimatepp.org/index.html]
(but only if you are serious about programming!) |
I haven't used it myself, so I can't comment on the pros/cons , but one commercial alternative is [TotalView][1].
There is also [DDD][2] that gives you a frontend to GDB, but i guess you have already tried/used that?
[1]: http://www.totalviewtech.com/products/totalview.html
[2]: http://www.gnu.org/software... |
Control Panel -> Sounds and Audio... -> Program Events - Microsoft Developer -> Breakpoint Hit |
UndoDB sounds interesting in that it allows reverse stepping. However, it's expensive and I'm well adapted to gdb so I'm unlikely to change. Others I've seen don't have the extra features required to entice me away from my known environment. |
Not sure about the whole question, but one thing I noticed in your code:
ProfileCommon profile = (ProfileCommon)ProfileCommon.Create(user.UserName, user.IsApproved) as ProfileCommon;
You do not need both the (ProfileCommon) and the as ProfileCommon. They both do casts, but the () throws and exception while th... |
In your example, as presented. I believe so. However, I've experienced real-world experiences where spaces have been interpreted as nodes so:
<pre><code>
<a><b/><c/><d/></a>
</pre></code>
is different than
<pre><code>
<a><b/> <c/><d/></a>
</pre></... |
It sounds like you're hitting a deadlock.
If you can reproduce it in a dev environment then try attaching a debugger once it's happened. Take a look at your threads and see if you have any deadlocks.
If you can't get a debugger to attach you should be able to generate a thread dump, as Dustin pointed out. |
JavaScript in client-side XSL processing? |
|javascript|browser|xslt| |
Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL transformations? How is it done and how official is it?
Microsoft's XML DOM objects allow this on the server-side (i.e. in ASP/ASP.NET). For clarification, I do not mean HTML DOM scripting performed *after* the doc... |
Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL transformations? How is it done and how official is it?
Microsoft's XML DOM objects allow this on the server-side (i.e. in ASP/ASP.NET).
Clarification: I do not mean HTML DOM scripting performed *after* the docum... |
How to write an SQL query to find out which logins have been granted which rights in Sql Server 2005? |
|sql|database| |
I'm responsible for some test database servers. Historically, too many other poeple have access to them. They run on SQL Server 2005. I've been writing queries and wrapping them in scripts so I can run a regular audit of rights. Finding out which users had Administrator rights on the server itself was fine, as was ... |
For any jvm process, force a thread dump. In windows, this can be done with CTRL-BREAK, I believe, in the console window.
In *nix, it is almost always "kill -3 jvm-pid".
This may show if you have threads waiting on db connection pool/thread pool, etc.
Another thing to check out is how many connections you have... |
Do you use a natural keyboard, or a straight one? Keyboard preference can be intensely personal, but many higher-end keyboards have keys fitted specifically for the location of the key (slant and curvature), meaning for Dvorak you'll need to ignore the labels, move the keys and eliminate that advantage, or go with som... |
There isn't one yet, as far as I am aware. A friend and I are working on an open source Windows epoll implementation (link below) but we're running into issues figuring out how to make it act the same as the Linux implementation.
Current obstacles:
- In Linux, file descriptors and socket descriptors are intercha... |
It has a good set of plugins and the coding style is unobtrusive which means it's not too hard to replace. There is also a nice drop in replacement for Ruby on Rails helpers called jRails.
Performance-wise they are all pretty close: http://www.kenzomedia.com/speedtest/ However, MooTools, dojo, ext, and Prototype a... |
Well, it's an interesting question, but the real question is what the usage scenario for such a thing would be?
In particular, I see TFS as focusing heavily on supporting dev <i>teams</i>. (Whether it does a good job of that or not, it's a different matter). Certainly individual developers could benefit from things ... |
What's wrong with
return ((x>0) ==(y>0));
? |
What's wrong with
return ((x<0) ==(y<0));
? |
Pretty sure there isn't one out of the box. This thread seems to be pretty decent...halfway down they discuss creating a role and then locking that down further. Also you could just create a mini-program (sp even?) to email the results of the job as a summary, or add to each job an on completion event to email an ema... |
I can't say this is any good, I'm not a C# expert and I just whacked it out, but I think it's probably a canonical example of the use of `yield`.
internal IEnumerable Answer(N)
{
int n=0;
int i=9;
while (true)
{
if (i % 3 == 0)
{
n++;
yield... |
[**Wordpress**][1] is a very powerful but simple CMS.
[**bbPress**][2] is a very simple but integrated forum (easy, Wordpress user account integration with cookies and all).
Since you have programming experience you may find Wordpress to be the perfect match (PHP, MySQL) with plenty of plugins and hooks to help y... |
<p>Don't use WScript; use CScript. At the Windows command prompt, type the following to display help.
<pre><code>cscript //?</code></pre>
I suggest the following:
<pre><code>cscript //H:CScript</code></pre>
This will make CScript your default scripting interpreter. CScript prints messages to the console (i.e., st... |
How do you find the difference between 2 strings in PHP? |
|php|strings|comparison| |
I have 2 strings that I'd like to compare, and return the positions of the different characters in the second string. For instance, if I have
1. "The brown fox jumps over the lazy dog" and
2. "The quick brown fox jumped over the lazy dog",
I want it to highlight "quick" and "ed". What's the best way to go about th... |
|php|string|comparison| |
You can also use the [ViewSourceWith](https://addons.mozilla.org/en-US/firefox/addon/394) addon to achieve the same. Just right-click on any text input and you can edit it using Vim. |
Right-click on the working directory in windows explorer, and select "Properties". You will see the Properties dialog, which will have a tab called "Subversion". Click on it, and you will see the version number, and other info. |
You might want to put the big huge tables on their own partition and have this partition belong to a different file group. You would backup then backup and restore the main file group.
You might want to also consider doing incremental backups. Say, a full backup every weekend and an incremental every night. I hav... |
Nightly importable or attachable copies of production database |
When programming complex ad-hoc query type things, attributes can be your best friend. Take a more declarative approach and decorate your classes, interfaces, and/or properties with some custom attributes, then write some generic "glue" code that binds your UI to your model. This will allow your model and presentatio... |
Although I will get massively downranked for this, you won't find *anything* overlaying GDB which can compete with the raw power of the Visual Studio debugger. It's just too powerful, and it's just too well integrated inside the IDE.
For a Linux alternative, try DDD if free software is your thing. |
Make it disabled but have the tooltip explain why it's disabled |
Depends on the language. If on python, you are missing the re.S flag, like this (to remove the match):
re.compile('<div id="super_special">.*?</div>',re.S).sub(your_html,'')
Similar flags exist for other regexps implementations, they are called "Single Line" or something similar.
But **DO NOT USE REGEXPS T... |
Depends on the language. If on python, you are missing the re.S flag, like this (to remove the match):
re.compile('<div id="super_special">.*?</div>',re.S).sub(your_html,'')
Similar flags exist for other regexps implementations, they are called "Single Line" or "Multi Line" or something like that.
But **DO... |
How to test function call order |
|tdd|unit-testing|c++| |
Considering such code:
class ToBeTested {
public:
void doForEach() {
for (vector<Contained>::iterator it = m_contained.begin(); it != m_contained.end(); it++) {
doOnce(*it);
doTwice(*it);
doTwice(*it);
}
}
void doOnce(Contained & c) ... |
There's a built-in .NET utility for this: [HttpUtility.ParseQueryString][1]
//C#
NameValueCollection qscoll = HttpUtility.ParseQueryString(querystring);
'VB.NET
Dim qscoll As NameValueCollection = HttpUtility.ParseQueryString(querystring)
[1]: http://msdn.microsoft.com/en-us/library/ms15... |
Make a class iTerrain which accepts an argument which is the terrain type
example:
<code>field = new iTerrain("grass")</code> |
Make a class iTerrain and another class iUnit which accepts an argument which is the terrain type including a method for affecting each unit type
example:
<pre>
<code>
boat = new iUnit("watercraft")
field = new iTerrain("grass")
field.effects(boat)</code></pre> |
Old idea:
> Make a class iTerrain and another
> class iUnit which accepts an argument
> which is the terrain type including a
> method for affecting each unit type
>
> example:
>
> <pre> <code> boat = new
> iUnit("watercraft") field = new
> iTerrain("grass")
> field.effects(boat)</code></pre>
ok forget ... |
can I get PHP to stop replacing '.' characters in $_GET or $_POST arrays ? |
|php| |
Hiya - If I pass PHP variables with '.' in their names via $\_GET PHP auto-replaces them with '_' characters. For example:
<?php
echo "url is ".$_SERVER['REQUEST_URI']."<p>";
echo "x.y is ".$_GET['x.y'].".<p>";
echo "x_y is ".$_GET['x_y'].".<p>";
... outputs the following:
url is /SpShip... |
So the requirements are: you need to enumerate through an IList<> without making a copy while simultaniously adding and removing elements.
Could you clarify a few things? Are insertions and deletions happening only at the beginning or end of the list?
If modifications can occur at any point in the list, how should ... |
I guess the thing to really be careful with is working with the Hibernate sessions. Hibernate caches stuff, and that might get in the way.
Frankly I would recommend that if you adopt Hibernate, drop the Entity beans entirely. Do your Hibernate work within session beans and let the session beans manage your transac... |
The most important thing is that the program be good. If its not good, nobody will use it. You cannot hope that the chicken-and-egg will reverse and that people will take it for granted until it becomes good.
Of course, "good" merely means "better than any other practical option for a significant number of people,... |
TortoiseSVN allows you to relocate your repository
http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-relocate.html#tsvn-dug-relocate-dia-1:
> If your repository has for some reason changed it's location (IP/URL). Maybe you're even stuck and can't commit and you don't want to checkout your working copy aga... |