instruction
stringlengths
0
30k
One primary need I have for late static binding is for a set of static instance-creation methods. This [DateAndTime class][1] is part of a chronology library that I ported to PHP from Smalltalk/Squeak. Using static instance-creation methods enables creation of instances with a variety of argument types, while keepi...
Here's what I found on YUI's boards: http://tech.groups.yahoo.com/group/ydn-javascript/message/30836 Doesn't seem like there's currently any open "wiring widget" libraries, but YUI does seem like a good start.
[Google Charts](http://code.google.com/apis/chart/) is an excellent choice if you don't want to use Flash. It's pretty easy to use on its own, but for Rails, it's even easier with the [gchartrb](http://badpopcorn.com/blog/2008/09/08/rails-google-charts-gchartrb/) gem. An example: GoogleChart::PieChart.new('320x2...
(setq initial-frame-alist (append '((width . 263) (height . 112) (top . -5) (left . 5) (font . "4.System VIO")) initial-frame-alist)) (setq default-frame-alist (append '((width . 263) (height . 112) (top . -5) (left . 5) (font . "4.System VIO")) default-frame-alist...
I've used [SWiSH Max2][1] for a few years now (well, SWiSH Max then the second one). It's very much the "FrontPage" of Flash editing but it's got the advantage of being reasonably professional and easy to use and relatively inexpensive ($149 compared to $699 for Adobe Flash CS3, though I think I paid $99 for it so it's...
The best approach is to use a Calendar table. See http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html.
The best approach is to use a Calendar table. See http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html. Then your query could look something like: SELECT cal.* FROM myCalendarTable cal JOIN Order ON order.date = cal.date JOIN Lead...
The best approach is to use a Calendar table. See http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html. Then your query could look something like: SELECT c.dt FROM [statistics].dbo.Calendar c WHERE c.isWeekday = 1 AND c.isHo...
The best approach is to use a Calendar table. See http://sqlserver2000.databases.aspfaq.com/why-should-i-consider-using-an-auxiliary-calendar-table.html. Then your query could look something like: SELECT c.dt, l.*, o.*, c.* FROM [statistics].dbo.[calendar] c, [order] o JOIN lead l O...
I've used both wxWidgets and QT professionally. Both are certainly capable of meeting your goals. Which one is easiest is hard to say. You don't tell us whether you're looking for easy to use, or easy to learn. Qt is easier for big programs. WxWidgets is easier to learn. This for a large part due to the signal/slot mec...
First of all you could try a reset, like some other people mentioned here, you can do a quick margin and padding reset with this piece of css: *{margin: 0; padding: 0} When you design your css make sure you're using a modern, standars compliant browser (personally I would recommend firefox 3 which has an exc...
I managed to create this thing. It's not pretty but it does work. <?php # Path the config file, full or relative. $configfile="config.conf"; $tempfile="tmp.html"; # Read the file into an array $farray=file($configfile); # Count array elements $count=count($farray); i...
You may want to look at iCalendar software implementations or the standard itself (RFC 2445).
You may want to look at iCalendar software implementations or the standard itself (RFC 2445). Ones to come to mind quickly are the Mozilla projects http://www.mozilla.org/projects/calendar/ A quick search reveals http://icalendar.rubyforge.org/ as well. Other options can be considered depending on how you're going...
How to use stored procedures within a DTS data transformation task?
|sql-server|dts|
I have a DTS package with a data transformation task (data pump). I’d like to source the data with the results of a stored procedure that takes parameters, but DTS won’t preview the result set and can’t define the columns in the data transformation task. Has anyone gotten this to work? Caveat: The stored proced...
In C++, there are three *distinct* character types: - `char` - `signed char` - `unsigned char` If you are using character types for *text*, use the unqualified `char`: - it is the type of character literals like `'a'` or `'0'`. - it is the type that makes up C strings like `"abcde"` It also wor...
Alternatively, you can add it to the URL and let the scripting language (PHP, Perl, ASP, Python, Ruby, whatever) handle it on the other side. Something like: var x = 10; window.open('mypage.php?x='+x);
> now I'm looking for Core.pm That’s SVN::Core, which is a bit of a problem. Try installing [Alien::SVN](http://search.cpan.org/dist/Alien-SVN/) from CPAN. That worked for me on my freshly installed Slackware 12.0 on my laptop, but I have yet to get it to install on my workstation.
I googled for "basic fft". [Visual Basic FFT][1] Your question screams FFT, but be careful, using FFT without understanding even a little bit about DSP can lead results that you don't understand or don't know where they come from. [1]: http://logix4u.net/DSP/Fast_Fourier_Transform/Visual_Basic_program_for_Fast_Fou...
I've resorted to mapping a drive to the UNC path. The command line looks something like subst A: "\\\\ServerName\SomeDirectory"
I had similar problems a long time ago and ended up writing an applet to display the data that interacted with the page using livescript. My performance problems were the same as what you were seeing. The client took over 30 seconds to render the table data, and the server turned my response around in less than 2 sec...
In your parent window: var yourValue = 'something'; window.open('/childwindow.html?yourKey=' + yourValue); Then in childwindow.html: var query = location.search.substring(1); var parameters = {}; var keyValues = query.split(/&/); for (var keyValue in keyValues) { var keyVal...
UTF-8 works well for most small character sets (except the ones allocated on high code pages), and UTF-16 is great for two-byte character sets. There is a [table with more detailed numbers for various languages][1] on Wikipedia. If you need denser compression, you may also want to look at [Unicode Technical Note...
For any given language, your bytes-per-character rates are fairly constant, because most languages are allocated to contiguous code pages. The big exception is accented Latin characters, which are allocated higher in the code space than the unaccented forms. I don't have hard numbers for these. For languages with co...
If you want to write code, one way you can optimize is sending the file in chunks (like using [MTOM][1]). I used this approach for sending down huge files from a DataCenter down to our office for printing.. Also, check the TeraCopy utility mentioned [here][2].. [1]: http://www.codeproject.com/KB/XML/MTOMWebSe...
How do you get through the inevitable motivational "slump" near the end of projects?
|motivation|
When working on a project, after the interesting parts are coded, my motivation is severely diminished. What do you do to get over this problem?
|discussion|motivation|
Options: 1. Use a SocketAppender to send all logs to 1 server directly. (This could serverly hamper performance and add a single point of failure.) 2. Use scripts to aggregate the data. I use scp, ssh, and authentication keys to allow my scripts to get data from all servers without any login prompts.
One use of the Java "interface" is to allow strongly-typed mixins in Java. You mix the proper superclass, plus any additional methods implemented to support the interface. Python has multiple inheritance, so it doesn't really need the interface contrivance to allow methods from multiple superclasses. I, however,...
> DNA -- or does it have to involve silicon computers? ;-) Well, if you go down that road then the correct answer has to be **RNA** which existed before DNA. But then, do we have a Blind Programmer? ;-)
> typeof(callback) == "function"
try if (typeof(callback) == 'function')
How should I write code with unique sections for differnt versions of .NET
|.net|c#|preprocessor|
My source code needs to support both .NET version 1.1 and 2.0 ... how do I test for the different versions & what is the best way to deal with this situation. I'm wondering if I should have the two sections of code inline, in separate classes, methods etc. What do you think?
How should I write code with unique sections for different versions of .NET
|c#|.net|preprocessor|
As others have said, just set the Identity option.
I would be asking the question of WHY you have to maintain two code bases, I would pick one and go with it if there is any chance of it. Trying to keep two code bases in sync with the number of changes, and types of changes would be very complex, and a build process to build for either version would be very complex.
I do really like the Andrei Loskutov's plugins: http://andrei.gmxhome.de/eclipse.html
It's printing just "Array" because when you say echo "$_GET[$field]"; PHP can't know that you mean `$_GET` element `$field`, it sees it as you wanting to print variable `$_GET`. So, it tries to print it, and of course it's an Array, so that's what you get. Generally, when you want to echo an array element, y...
You can use: if ($(selector).is('*')) { // Do something } A **little** more elegant, perhaps.
You could do it with a <Location> directive and mod_rewrite on Apache: <Location /buyCrap.php> RewriteEngine On RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} </Location> You could make the Location smarter over time using Regexes if you want.
typeof(callback) == "function"
Log4j: Why is the root logger collecting all log types regardless the configuration?
|java|logging|log4j|
I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a log4j expert so any help is appreciated.
I am having problem that even though I specify the level to ERROR in the root tag, the specified appender logs all levels (debug, info, warn) to the file regardless the settings. I am not a log4j expert so any help is appreciated. Here is a bit more info on the subject: - I have checked the classpath for log4j....
As tgamblin already mentioned [Confluence][1] does what you want - it'll export to Word. However it also does more than that; with the (free) [Office Connector][2] you can edit wiki pages in word, edit individual tables in excel, import word documents into the wiki, etc. Quite nifty if you're looking for that level o...
There is one piece of pay software listed on this postgresql page: http://www.postgresql.org/download/products/1 and this is on pgFoundry: http://pgfoundry.org/projects/mysql2pgsql/
You have to ensure that the control exists on the page prior to .NET entering the "Postback event handling" step of the page lifecycle. Since the control is added dynamically you have to ensure that on every post back you recreate that control so that it can find the control to fire the event.
Caching is one of those topics where there is no one right answer - it depends on your domain. The caching policy that you describe may be sufficient for your domain. However, you don't appear to be worried about stale data. Often I would expect to see a timestamp against some of the entities - if the cached value i...
You can also find out information about the heaps in a process with Heap32ListFirst/Heap32ListNext, and about loaded modules with Module32First/Module32Next, from the Tool Help API. 'Tool Help' originated on Windows 9x. The original process information API on Windows NT was PSAPI, which offers functions which partia...
Non-iterative / Non-looping Way To Calculate Effective Date?
|sql|
I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished...
I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished...
I recently found the free [Oracle SQL Developer][1]. - nice looking GUI (makes you not poke out your eyes like the usual Oracle tools) - has many nice features, like showing tables filtered - lets you connect to multiple oracle instances at once - you can use sane configuration like ip:port username/pass...
By default, Sys::Syslog is going to try to connect with one of the following socket types: [ 'tcp', 'udp', 'unix', 'stream' ] On Solaris, though, you'll need to use an inet socket. Call: setlogsock('inet'); and things should start working.
By default, Sys::Syslog is going to try to connect with one of the following socket types: [ 'tcp', 'udp', 'unix', 'stream' ] On Solaris, though, you'll need to use an inet socket. Call: setlogsock('inet', $hostname); and things should start working.
Obviously, there's no "One Right Way", but there's a multitude of opinions on this one. ;) Personally i use trigger_error for things the exceptions cannot do, namely notices and warnings (i.e. stuff you want to get logged, but not stop the flow of the application in the same way that errors/exceptions do (even if yo...
As soon as your CUPS web interface (localhost:631) or some other thing to look at what CUPS sees shows you that CUPS received the job, you can quit the application.
pg_dump is indeed the proper solution. Be sure to read the man page. In Espo's example, some options are questionable (-x and -D) and may not suit you. As with every other database manipulation, test a lot!
I'm using 2008; and while I have only used it for small->medium sized projects, so far I haven't experienced any unexpected full links. I haven't used 03, but in my opinion 08 seems to be far better then 05.
If your database is that large you've got a few issues. 1. You have to lock the tables to dump the data. 2. mysqldump will take a very very long time and your tables will need to locked during this time. 3. importing the data on the new server will also take a long time. Since your database is going to be...
This has been an excellent start. A few more clarifications/comments: <ul><li>I probably don't care about IDs, since .net will mangle them</li> <li> some of the structure will be in a repeater or other such control, so I might end up having more or fewer repeating elements</li> </ul>
This has been an excellent start. A few more clarifications/comments: <ul><li>I probably don't care about IDs, since .net will mangle them</li> <li> some of the structure will be in a repeater or other such control, so I might end up having more or fewer repeating elements</li> </ul> further thought: I think a...
This has been an excellent start. A few more clarifications/comments: <ul><li>I probably don't care about IDs, since .net will mangle them</li> <li> some of the structure will be in a repeater or other such control, so I might end up having more or fewer repeating elements</li> </ul> further thought: I think a...
Alternatively, you can surely use the [WWW::Mechanize][1] module to create a agent as we do here at work. We have a tool called AppMon that is really just a dramatized wrapper around Mechanize. You can also move to Ruby and use Watir, but Selenium is another alternative, albeit not as interesting or automate-able. ...
Alternatively, you can surely use the [WWW::Mechanize][1] module to create a agent as we do here at work. We have a tool called AppMon that is really just a dramatized wrapper around Mechanize. The Mechanize module allows you to use scripts that look a lot like this: use WWW::Mechanize; my $Agent...
Multiple instances of an interator can be used concurrently. Approach them as local cursors for the underlying data. BTW: favoring interfaces over concrete implementations looses coupling Look for the iterator design pattern, and here: http://en.wikipedia.org/wiki/Iterator
Are you using an Inversion of Control Container? If so, the answer is simple. Assembly A contains: --- * MessageManager * IRepository * ContainerA (add MessageManager) Assembly B contains (and ref's AssemblyA): --- * Repository implements IRepository * ContainerB extends ContainerA (add Repository) ...
How do I prevent static variable sharing in the .NET runtime?
|c#|multithreading|.net|
I'm working on a game (C#) that uses a [Robocode-like](http://robocode.sourceforge.net/) programming model: participants inherit a base Class and add strategic behaviors. The game then loads instances of participants' Classes and the competition begins. Unfortunately, participants can "cheat" by sharing static variable...
|c#|.net|multithreading|
I'm working on a game (C#) that uses a [Robocode-like](http://robocode.sourceforge.net/) programming model: participants inherit a base Class and add strategic behaviors. The game then loads instances of participants' Classes and the competition begins. Unfortunately, participants can "cheat" by sharing static variable...
I like .NET for this. It provides good Date/Time manipulation, with the DateTime and Timespan classes. However, most date/time stuff is fairly simple in any language which will give you a unix timestamp to work with.
1st discover the current mongrel pid path with something like: > \>ps axf | fgrep mongrel you will see a process line like: **ruby /usr/lib64/ruby/gems/1.8/gems/swiftiply-0.6.1.1/bin/mongrel_rails start -p 3000 -a 0.0.0.0 -e development -P /home/xxyyzz/rails/myappname/tmp/pids/mongrel.pid -d** Take the '-P /h...
I've studied the docs and this is my result: I've put a time limit of one month hard-coded, but this is just an example. public void GetAllCalendarItems() { Microsoft.Office.Interop.Outlook.Application oApp = null; Microsoft.Office.Interop.Outlook.NameSpace mapiNamespace =...
If you're really worried about string/character size, have you thought about compressing them? That would automatically reduce the string to it's 'minimal' encoding. It's a layer of headache, especially if you want to do it in memory, and there are plenty of cases in which it wouldn't buy you anything, but encoding, es...
Are you retrieving the user data and attempting to set values in the DataGridView manually, or have you actually bound the DataGridVew to a data source? Because if you've bound the grid to a data source, you should just need to set the DataPropertyName on the column to be the string name of the object Property: ...
The easy way with Bayesian filters (Python example from http://sebsauvage.net/python/snyppets/#bayesian) from reverend.thomas import Bayes guesser = Bayes() guesser.train('french','La souris est rentrée dans son trou.') guesser.train('english','my tailor is rich.') guesser.train('french','J...
How to set the output cache directive on user controls with no code in front
|c#|asp.net|caching|outputcache|
I've written a control that inherits from the `System.Web.UI.WebControls.DropDownList` and so I don't have any code in front for this control, but I still want to set the OutputCache directive. I there any way to set this in the C# code, say with an attribute or something like that?
I've written a control that inherits from the `System.Web.UI.WebControls.DropDownList` and so I don't have any code in front for this control, but I still want to set the OutputCache directive. I there any way to set this in the C# code, say with an attribute or something like that? I'm particularly hoping to be able...
I've written a control that inherits from the `System.Web.UI.WebControls.DropDownList` and so I don't have any code in front for this control, but I still want to set the OutputCache directive. I there any way to set this in the C# code, say with an attribute or something like that? I'm particularly hoping to be ...
I modified the sample by dimarzionist. This version will only work with Enums and not let structs get through. public static T ParseEnum<T>(string enumString) where T : struct // enum { if (String.IsNullOrEmpty(enumString) || !typeof(T).IsEnum) throw new Exception("Type given must be...
I don't mind sfusco's method by using attributes. The only thing that i'm not sure of is where to attach the attributes to because If I attach then to the controls declaration which is in the designer code it will get regenerated when the form changes. Or am I completely misunderstanding sfusco's methods?
The short answer is you inherit from the ICloneable interface and then implement the .clone function which does a memberwise copy and performs a deep copy on any member that requires it and returns the resulting object. This is a recursive operation ( it requires that all members of the class you want to clone are eith...
The short answer is you inherit from the ICloneable interface and then implement the .clone function. Clone should do a memberwise copy and perform a deep copy on any member that requires it, then return the resulting object. This is a recursive operation ( it requires that all members of the class you want to clone ar...
|sql|date|
I have a table called OffDays, where weekends and holiday dates are kept. I have a table called LeadTime where amount of time (in days) for a product to be manufactured is stored. Finally I have a table called Order where a product and the order date is kept. Is it possible to query when a product will be finished...
Taken from: http://www.gnu.org/software/emacs/windows/old/faq4.html (setq default-frame-alist '((top . 200) (left . 400) (width . 80) (height . 40) (cursor-color . "white") (cursor-type . box) (foreground-color . "yellow") (background-co...
Here's the method I used [when I asked this question][1] - DELETE MyTable FROM MyTable LEFT OUTER JOIN ( SELECT MIN(RowId) as RowId, Col1, Col2, Col3 FROM MyTable GROUP BY Col1, Col2, Col3 ) as KeepRows ON MyTable.RowId = KeepRows.RowId WHERE ...