instruction stringlengths 0 30k ⌀ |
|---|
Yes, there is a point
If you don't explicitly use interfaces your code still uses the object as though it implemented certain methods it's just unclear what the unspoken interface is.
If you define a function to accept an interface (in PHP say) then it'll fail earlier, and the problem will be with the caller not ... |
Some people just don't understand what is required. You can try to guide the conversation by using some key phrases.
If someone is giving too much detail then you can try to cut them off with a "What else". This will hint that they are done on that point. Or you can try the "OK, can we discuss that offline" type ... |
How can I specify the local address on a java.net.URLConnection? |
|java|tomcat|ip|urlconnection| |
My Tomcat instance is listening to multiple IP adress, but I want to control what source IP address is used when opening a URLConnection. How can I specify this? |
Are we talking GUI Widgets? If so, I can suggest 3
FLTK:
http://www.fltk.org/
GTK:
http://www.gtk.org/
QT:
http://trolltech.com/products/qt/ |
I like pyDes (http://twhiteman.netfirms.com/des.html). It's not the quickest, but it's pure Python and works very well for small amounts of encrypted data. |
Yahoo supply a Geocoding API:
<http://developer.yahoo.com/maps/rest/V1/geocode.html>
You'd need to make an XHR request for each location and pull out the lat/long from the XML response. This might be too slow for what you need, and there's a 5,000 reqs/day rate limit. |
It's my understanding that the Cairngorm framework for Adobe Flex is just one example of an HMVC implementation. It's open source, so you can find out more information and download the code at [Adobe's website][1].
[1]: http://opensource.adobe.com/wiki/display/cairngorm/Cairngorm |
Use the GetSel() function before your change to store the location of the cursor, then use SelSel() to set it back. You can use these functions to get/set the location of the caret, not just to get/set the selection the user has made. |
Alas, I think I'm guilty of asking the wrong question.
The simple factory I was trying to test looked something like:
<pre>
public Wrapper wrapObject(Object toWrap) {
if(toWrap instanceof ClassA) {
return new Wrapper((ClassA) toWrap);
} else if (toWrap instanceof ClassB) {
return new ... |
Just calculate it in application code ... much easier and you won't have to write a really ugly query in your sql |
My guess is that you are probably not running in "Real" mode, which is needed for MSDOS programs in general (and Int 21h interrupts in specific) to work.
Windows has been running exclusively in "Protected" mode since Windows 95; The Command Prompt has been in Protected mode since, I think, Windows 2000.
You m... |
I've been quite happy with the [PEAR Date][1] class for PHP. It does everything you're asking about, I believe, with the exception of multiple calendars, although there's also Date\_Human, which could be a template for that sort of thing.
Also, I haven't worked with it yet, but [Zend\_Date][2], also for PHP, looks l... |
Ok. Just to clarify this strictly has nothing to do with the declaration. It relates only to "jumping over the initialization" (ISO C++ '03 6.7/3)
A lot of the posts here have mentioned that jumping over the declaration may result in the variable "not being declared". This is not true. An POD object can be decla... |
[Mark Russinovich][1] has written the excellent book [Windows Internals][2]. A new edition that covers the Vista and Server 2008 operating systems is currently in the works with David Solomon, so you may want to pre-order that if your questions are about the new Windows operating systems instead of the old ones.
... |
Don't forget TemplatedParent:
<Binding RelativeSource="{RelativeSource TemplatedParent}"/>
or
{Binding RelativeSource={RelativeSource TemplatedParent}} |
So far I've found the following Python solution:
>>> import wmi; c=wmi.WMI()
>>> o=c.query("select * from Win32_NetworkAdapter where NetConnectionID='wifi'")[0]
>>> o.EnableDevice(1)
(-2147217407,)
which is translated, AFAIU, to the generic WMI error 0x80041001. Could be permissions. |
If you want to bind to another property on the object:
{Binding Path=PathToProperty, RelativeSource={RelativeSource Self}}
If you want to get a property on an ancestor:
{Binding Path=PathToProperty, RelativeSource={RelativeSource AncestorType={x:Type typeOfAncestor}}}
If you want to get a property o... |
It's legal, but not wise. The Thread part of the instance will be completely initialised, but your constructor may not. There is very little reason to extend Thread, and to pull tricks like this isn't going to help your code.
|
You might want to also consider using [Checkboxes][1] on the list view. It's an obvious way to communicate the multi-select concept to your average user who may not know about Ctrl+Click.
From the MSDN page:
> The CheckBoxes property offers a way to select multiple items in the ListView control without using the... |
If you get a MSDN developer license, you can run TFS workgroup edition. That has source control and document management rolled all up in one package that's pretty easy to use and manage. That, in addition to an internal wiki, is what my company does. |
The registry path for Visual Studio 2008 is the same, but with 9.0 as the version number:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor |
Mantis is good for issue tracking. Subversion for source control. Both are free.
For documents, I do not know. Sounds like you would do fine with a network share. |
Can anyone recommend a decent C image library?
I'm after loaders for bmp, gif, jpg, png and tga.
I want to use this for programming my Sony Playstation Portable, so opensource would be very handy.
After some googleing I've found FreeImage and CImg, but both feel rather heavy, and CImg is C++ not C.
Cheers
... |
|c|images|psp| |
Can anyone recommend a decent C image library?
I'm after loaders for bmp, gif, jpg, png and tga.
I want to use this for programming my **Sony Playstation Portable**, so opensource would be very handy.
After some googleing I've found FreeImage and CImg, but both feel rather heavy, and CImg is C++ not C.
Chee... |
Strictly speaking this doesn't exactly answer your question, but its pretty neat.
Assuming you can live with specifying the number of days after the start date, then using a Common Table Expression gives you:
WITH numbers ( n ) AS (
SELECT 1 UNION ALL
SELECT 1 + n FROM numbers WHERE ... |
JIT stands for Just-in-Time which means that code gets compiled when it is needed, not before runtime.
This is beneficial because the compiler can generate code that is optimised for your particular machine. A static compiler, like your average C compiler, will compile all of the code on to executable code on the d... |
In addition to Harrison's excellent answer:
* Assuming the databases are in sync (schema, data, same version) to start with, it should just work
* If it doesn't, then it may be that you're using something non deterministic in your queries or trigger. Fix that.
* Regardless of how you use replication, you need to h... |
I think it depends on the direction you're looking at changing the priority.
Normally you shouldn't ever increase thread priority unless you have a *very* good reason. Increasing thread priority can cause your app's thread to start taking away time from other applications, which probably isn't what the user wants. ... |
You can ask the map object to do the geoCoding, and catch the callback:
<script type="text/javascript">
var map = new YMap(document.getElementById('map'));
map.drawZoomAndCenter("Algeria", 17);
map.geoCodeAddress("Cambridge, UK");
YEvent.Capture(map, EventsList.onEndGeoCode, function... |
If you plan to write your own implementation I would definately suggest that you take a look at the [NVelocity][1] (C#) or [Velocity][2] (Java) template engines.
I have used these in a code generator before and have found that they make the job a whole lot easier.
[1]: http://www.castleproject.org/others/nveloc... |
How do you implement unit-testing in large scale C++ projects? |
|c++|unit-testing|coding-style| |
I believe strongly in using unit-tests as an approach to building large multi-platform applications. We currently are planning on having our unit-tests within a separate project. This has the benefit of keeping are code base clean. I think, however, that this would separate the test code from the implementation of the ... |
Alex, most of the times you need multiple inheritance is a signal your object structure is somewhat incorrect. In situation you outlined I see you have class responsibility simply too broad. If Message is part of application business model, it should not take care about rendering output. Instead, you could split respon... |
Alex, most of the times you need multiple inheritance is a signal your object structure is somewhat incorrect. In situation you outlined I see you have class responsibility simply too broad. If Message is part of application business model, it should not take care about rendering output. Instead, you could split respon... |
I doubt you can find something that specific. But it's easy enough to create your own logic. Here's some pseudocode...
private long CalculateTimeSpan(DateTime BeginDate, DateTime EndDate, ArrayList<DateTime> BankHollidays)
{
long ticks = 0;
while (BeginDate <= EndDate) // iterate until ... |
I too vouch for eclipse (or IDEA if you have the money, actually IDEA is better than eclipse by a small margin).
But, make sure that you know how to compile and debug without an IDE first, and also learn to read the compiler's warning/error msgs - they are essential skills for developers that using an IDE can preve... |
I have tried Refactor!, as its features seemed promising, as did its testing with a simple testing project, but it failed to work with our real project at all - a lots of CPU activity, sometimes even frozen VS IDE, Refactoring UI not appearing at all for most of the code.
We are using Visual Assist X instead. While ... |
unintentional pitch change using MS SAPI TTS |
|windows-vista|microsoft|sapi|tts| |
Has anyone else experienced (and possibly solved) unintentional pitch changes using MS SAPI TTS voices?
I'm using the SpVoice automation interface with SAPI 5.1.
Right now, my application (VB6 app) can get into a state where the TTS (Microsoft Anna) starts to sound like a chipmunk (proper rate, but high pitch) a... |
@Hboss
that's all fine and dandy if you know exactly all the files (and the dimensions of each) that you're going to be displaying - it'd be a royal pain to maintain that CSS file, but I suppose it'd be possible. When you want to start using transparent PNGs for some very common purposes: a) incidental graphics such... |
Using CreateItemFromTemplate to process an olEmbeddeditem Outlook attachment |
|outlook|c#|attachment| |
I am using C# to process a message in my Outlook inbox that contains attachments. One of the attachments is of type olEmbeddeditem. I need to be able to process the contents of that attachment. From what I can tell I need to save the attachment to disk and use CreateItemFromTemplate which would return an object.
... |
|c#|.net|outlook|attachment| |
Excel - Macro to conditionally copy rows to another worksheet |
|excel|vbscript|macros| |
Does anyone have a macro or could point me to a way that I could conditionally copy rows from one worksheet to another in Excel 2003.
I'm pulling a list of data from Sharepoint via web query into a blank worksheet in Excel, and then I want to copy the rows for a particular month to a particular worksheet (e.g., all... |
@Matt Cruikshank
"Well, experimenting with VS2005, I can't get an honest leak out of scalar delete on memory that was made by vector new. I guess the compiler behavior is "undefined" here, is about the best defense I can muster."
I disagree that it's a compiler behavior or even a compiler issue. The 'new' keywo... |
You could use a trigger for this (if I've read you correctly and you want the value incremented each time you update the row).
|
Columns in the Table can have an **Identity Specification** set. Simply expand the node in the property window and fill in the details (Is Identity, Increment, Seed).
The **IDENTITYCOL** keyword can be used for operations on Identity Specifications. |
Doesn't
cvs history -a -l | head -1
give you what you want?
I'm doing this of the top of my head. I've done exactly this, for exactly the same reasons, in a previous project.
I'll check my shell script tomorrow |
Wow.
I'd forgotten how hard this is to do. What I'd done before was a two stage process.
Firstly, running
cvs history -c -a -D "7 days ago" |
gawk '{ print "$1 == \"" $6 "\" && $2 == \"" $8 "/" $7 "\" { print \"" $2 " " $3 " " $6 " " $5 " " $8 "/" $7 "\"; next }" }' > /tmp/$$.awk
to gather info... |
The more standard, usable and comprehensible way is the join table. It's easily supported by many ORMs, in addition to being reasonably performant for most cases. Only enter in "clever" ways if you have a reason to, say a million of users and having to answer that question every half a second.
|
I was under the impression that [Python doesn't have interfaces][1]. As far as I'm aware in Python you can't enforce a method to be implemented at compilation time precisely because it is a dynamic language.
There are interface libraries for Python but I haven't used any of them.
Python also has Mixins so you co... |
JSTL/JSP EL (Expression Language) in a non JSP (standalone) context |
|java|jsp|el|expression-language|text-formatting| |
Can anyone recommend a framework for templating/formatting messages in a standalone application along the lines of the JSP EL (Expression Language)?
I would expect to be able to instantiate a an object of some sort, give it a template along the lines of
Dear ${customer.firstName}. You order will be dispatched... |
A filter converting any dates in various ISO-related formats (and who'd use anything else after reading [the writings][1] of the Mighty Kuhn?) on standard input to seconds-since-the-epoch time on standard output might serve to illustrate both parts:
martind@whitewater:~$ cat `which isoToEpoch`
#!/usr/bin/pe... |
*Disclaimer, I don't know Python, I assume a Python function can be identified by "function" or "def" from your question. Just change the regex in consequence.*
May be something like:
:nnoremap <buffer> [m :call search('def\|function', 'b')<cr>f(
?
NB:
- I have used search() in order to not mess... |
Or if you need an entire script:
Do the Run a script with the MailItem as the parameter.
Sub RewriteSubject(MyMail As MailItem)
Dim mailId As String
Dim outlookNS As Outlook.NameSpace
Dim myMailItem As Outlook.MailItem
mailId = MyMail.EntryID
Set outloo... |
The syntax is valid. And you can set different access modifiers. You aren't on an Interface are you? And the class these are in isn't abstract is it?
Also, doesn't matter what v. of the framework you target because this is **a compiler feature**. VS2008 will implement the property w/ backing stores for you. |
Take a look at [this discussion][1].
And [this][2].
[1]: http://bytes.com/forum/thread584555.html
[2]: http://social.msdn.microsoft.com/Forums/en-US/netfx64bit/thread/bbb164c7-9d76-4804-b506-85172e586e99/ |
How long would a complete conversion/rewrite take? It's also going to depend on how you've structured your original project.
I **can** answer that you should just target v2.0 (3.5 if you want/need it's features) from the beginning. There's no need to subject yourself to 1.1 of the framework. |
What causes Firefox to make a GET request after submitting a form via the POST method? |
|firefox|firefox3| |
What causes Firefox to follow a POST request with a GET request when submitting a form via the POST method? The GET method is sent to the same url as the POST method but without the request parameters.
If you change the form method to GET, it will result in two identical GET requests. |
I think what I would suggest has a lot more to do with your objective. If you are looking to build your own application and want to get it to market quickly, and it has to be Windows, then I would go with C# WF as others have suggested.
If you are looking to make yourself more employable then I would go with C#/ASP... |
[Qt][1] has reimplemented most c++ standard library stuff with different interfaces. It looks pretty good, but it can be expensive for the commercially licensed version.
[1]: http://trolltech.com/products/qt/ |
A few years ago I used [JMeter][1] for such a task. I generally enjoyed using it, though I never did much research on what else is available and I don't know if it's still actively developed.
[1]: http://jakarta.apache.org/jmeter/ |
The C book (free online) has a chapter about linkage, which explains the meaning of 'static' in more detail (although the correct answer is already given in other comments):
[http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html][1]
[1]: http://publications.gbdirect.co.uk/c_book/chapter4/linkage.html |
I just responded to a [very similar question][1]. I ended up using Noel Llopis' UnitTest++. I liked it more than boost::test because it didn't insist on implementing the main program of the test harness with a macro - it can plug into whatever executable you create. It does suffer from the same encumbrance of boost::te... |
So, as everyone else here has mentioned, yes you need to test them. However, if you have created them because of a design need through TDD, you will find that once you run your code coverage tool, those POJOs (or POCOs for us .net peeps) will in fact, be covered. That is because TDD will only allow you to write/refacto... |
Have a listen to the Pragmatic Programmers's [podcast][1] on using Ruby for GUI testing.
[1]: http://podcasts.pragprog.com/2008-08/ian-dees-on-scripted-gui-testing-with-ruby.mp3 |
there is some good info below on why certain things are functions and other are methods. It does indeed cause some inconsistencies in the language.
<http://mail.python.org/pipermail/python-dev/2008-January/076612.html>
|
How to implement in-process full text search engine |
|windows|winapi|full-text-search| |
In one of our commercial applications (Win32, written in Delphi) we'd like to implement full text search. The application is storing user data in some kind of binary format that is not directly recognizable as a text.
Ideally, I'd like to find either an in-process solution (DLL would be OK) or a local server that I ... |
I have seen the shell set to the `passwd` command so that logging in only gives an opportunity to change the password. This may or may not be appropriate in your non-interactive user case, but it has the upside of allowing people to change passwords without bothering an admin. |
create an index on a mysql column based on the length its contents? |
|mysql|indexing|myisam| |
How do I create an index on a column in mysql v 5.0 (myisam db engine) based upon the length of its value its a TEXT data type up to 7000 characters, do I have to add another column with the length of the first column.
Any help kindly received, cheers
|
Be careful, and do not believe that ADO is taking care of the problem. Universal SQL date format is 'YYYYMMDD', while both SQL and ACCESS are influenced by the regional settings of the machine in the way they display dates and convert them in character strings.
Do not forget that Date separator is # in Access, while... |
Be careful, and do not believe that ADO is taking care of the problem. Universal SQL date format is 'YYYYMMDD', while both SQL and ACCESS are influenced by the regional settings of the machine in the way they display dates and convert them in character strings.
Do not forget that Date separator is # in Access, while... |
|firefox| |
[This post][1] has sample code in C# to test if UAC is on and if the current app has been given elevated rights. You can download the code and interpret as needed. Also linked there is a sample that shows the same in C++
<http://www.itwriting.com/blog/198-c-code-to-detect-uac-elevation-on-vista.html>
[1]: htt... |
[This post][1] has sample code in C# to test if UAC is on and if the current app has been given elevated rights. You can download the code and interpret as needed. Also linked there is a sample that shows the same in C++
<http://www.itwriting.com/blog/198-c-code-to-detect-uac-elevation-on-vista.html>
The code... |
Yes it can be made a template in C++
template <typename T>
size_t getTypeSize()
{
return sizeof(T)/sizeof(*T);
}
to use:
struct JibbaJabba
{
int int1;
float f;
};
int main()
{
cout << "sizeof JibbaJabba is " << getTypeSize<JibbaJ... |
Yes it can be made a template in C++
template <typename T>
size_t getTypeSize()
{
return sizeof(T)/sizeof(*T);
}
to use:
struct JibbaJabba
{
int int1;
float f;
};
int main()
{
cout << "sizeof JibbaJabba is " << getTypeSize<JibbaJ... |
There are two issues: importation of encryption software, and exportation of encryption software.
Some countries (France, I hear) trample the civil liberties of their citizens by prohibiting them from using encryption. So, it is illegal to import encryption software to those countries.
Other countries, like the U... |
There are two issues: importation of encryption software, and exportation of encryption software.
Some countries (France, I hear) trample the civil liberties of their citizens by prohibiting them from using encryption. So, it is illegal to import encryption software to those countries.
Other countries, like the U... |
Found a nice one using the function GetNetworkParams().Seems to work quite good.
You can find it here:
http://www.swissdelphicenter.ch/torry/showcode.php?id=2452
|
Response.Clear in ASP.NET 3.5 |
|asp.net| |
I have recently upgraded some of my web applications to ASP.NET 3.5 by installing the framework on the server and setting up my web applications acrodingly and all is well, however.
On some pages, I want to clear the current contents of the response buffer with code like this:
Response.Clear();
// Output... |
I ended up using saxutils.escape(str) to generate valid XML strings and then validating it with Eli's approach to be sure I didn't miss any tag
from xml.sax import saxutils
from xml.dom.minidom import parseString
from xml.parsers.expat import ExpatError
xml = '''<?xml version="1.0" encoding=... |