instruction stringlengths 0 30k ⌀ |
|---|
|java|system-monitoring| |
I would like to be able to monitor my major system health indicators from inside our Java-based system. Major points of interest include CPU temperature, motherboard temperature, fan speed, etc.
Is there a package available that:
1. Makes this sort of data available to Java?
2. Works on Windows or Linux or bo... |
If you've got the classes made, I'd suggest using a Strategy design pattern instead of switch or elseif. |
In PowerShell you can do something like:
$computers = "server1","server2","server3"
Get-WmiObject Win32_NetworkAdapterConfiguration -computer $computers -filter "IPEnabled ='true'" | select __Server,IPAddress,MACAddress |
How to get rid of Javascript Runtime Errors when running PDT + XDebug in Eclipse? |
|eclipse|drupal|eclipse-pdt|xdebug| |
I am currently developing a Drupal webpage using PDT. When running without XDebug, the site works fine.
When I enable XDebug, the site works fine but opens up tons of Javascript errors that I need to click through.
Example:
A Runtime Error has occurred.
Do you wish to Debug?
Line: 1
Error: Syntax error
... |
I am currently developing a Drupal webpage using PDT. When running without XDebug, the site works fine.
When I enable XDebug, the site works fine but opens up tons of Javascript errors that I need to click through.
Example:
A Runtime Error has occurred.
Do you wish to Debug?
Line: 1
Error: Syntax error
... |
ASP.NET 1.1 Page_ClientValidate Debugging |
|asp.net|debugging|1.1|client-pagevalidate| |
I have an ASP.NET 1.1 application, and on my local machine the submit button on my page works fine, but when I deploy it to our development application server, I click on Submit and nothing happens.. I'm assuming that the Page_Validate() function is failing and disabling the POSTBACK, but how do I debug this and determ... |
|asp.net|debugging|asp.net-1.1|client-pagevalidate| |
Eclipse is a pretty bloated IDE. You can minimize it by turning of the automatic project building under Project -> Build Automatically. It also can be helped by closing any open project you are not currently working on. |
Am I turning away customers by disabling SSL 2.0 and PCT 1.0 in IIS5? |
|ssl|iis-5|2.0|pct1.0| |
Do I risk losing sales by disabling SSL 2.0 and PCT 1.0 in IIS5?
Clarification: Sales would be lost by client not being able to connect via SSL to complete ecommerce transaction because SSL 2.0 or PCT 1.0 is disabled on the web server.
Microsoft kbase article: http://support.microsoft.com/kb/187498 |
|ssl|iis-5| |
@agnul
You were right. Here's the [relevant feature request](http://sourceforge.net/tracker/index.php?func=detail&aid=2016015&group_id=164845&atid=833327) from their bugzilla. |
|version-control|source| |
I've been programming for 10+ years now for the same employer and only source code control we've ever used is VSS. (Sorry - That's what they had when I started). There's only ever been a few of us; two right now and we usually work alone, so VSS has worked ok for us. So, I have two questions: 1) Should we switch to som... |
|version-control|source-code| |
I would take a look at Enum.Parse. It will let you parse your char back into the proper enum. I believe it works all the way back to C# 1.0. Your code would look a bit like this:
TransactionStatus status = (TransactionStatus)Enum.Parse(typeof(TransactionStatus), obj.ToString()); |
We use Cognos, it's a fairly complex system, but very powerful. |
[There was a pretty good blog post about it at Coding Horror][1]. I've only come across this anti-pattern once, and I pretty much just followed his steps.
[1]: http://www.codinghorror.com/blog/archives/000486.html |
I call it chaining.
You are asking the wrong question.
What you need to ask is: Which is more readable?
If chaining makes the code easier to read and understand than go ahead and do it.
If however, it obfuscates, then don't.
Any performance optimizations are non-existant. Don't optimize code, optimize... |
Programmatically editing python source |
|python|source-file| |
This is something that I think would be very useful. Basically, I'd like there to be a way to edit python source programmatically without requiring human intervention. There are a couple of things I would like to do with this:
1) Edit the configuration of python apps that use source modules for configuration.
... |
Initially, `temp1` and `temp2` both contain the memory address of `x`.
`temp2 = temp1` means "assign the value of `temp1` to `temp2`". Since they have the same value to start with, this command does nothing.
The expression `temp1->next` means "Look inside the data structure that `temp1` points to, and return the... |
If you have the option, you could add a reverse proxy in advance of your application. At work I have an Apache web server that receives all inbound HTTP connections. Based on the URL, it either forwards the request to another server or serves up the content itself. I've used this approach to accelerate serving up st... |
pointers questions. |
|pointers|memory| |
temp2, temp1 are pointer to some struct x. After execution of following lines
...
temp2=temp1;
temp1=temp1->nxt;
....
Will temp2 and temp1 still point to the same memory location or different? if diferent please explain.
|
C pointer assignment behavior |
|c|memory|pointers| |
`temp2`, `temp1` are pointers to some struct x:
struct FunkyStruct x;
struct FunkyStruct *temp1 = &x, *temp2 = &x;
Now, after execution of following lines:
temp2=temp1;
temp1=temp1->nxt;
...Will `temp2` and `temp1` still point to the same memory location? If not, please explain why they wo... |
How do I access cookies within Flash? |
|flash|cookies|actionscript| |
I'm looking to grab cookie values for the same domain within a Flash movie. Is this possible? |
|flash|actionscript|cookies| |
I'm looking to grab cookie values for the same domain within a Flash movie. Is this possible?
Let's see I let a user set a variable foo and I store it using any web programming language. I can access it easily via that language, but I would like to access it via the Flash movie without passing it in via printing i... |
In addition to the above choices, you can also use haxevideo (open source) |
We embed an Internet Explorer ActiveX control into our application for doing this. IE opens all of the files you listed. |
Topological sort, recursive, using generators. |
|python|generator|topology|recursion| |
Data: a dependency list, already verified to be acyclic. So here, 'a' depends on 'b','c','d' (c depends on d), etc...
A = { 'a' : dict(b=1, c=1),
'c' : dict(d=1),
'd' : dict(e=1,f=1,g=1),
'h' : dict(j=1)
}
I'd like to have a top-down, recursive solution to let's ... |
|python|recursion|generator|topology| |
Data: a dependency list, already verified to be acyclic. So here, 'a' depends on 'b','c','d' (c depends on d), etc...
A = { 'a' : dict(b=1, c=1),
'c' : dict(d=1),
'd' : dict(e=1,f=1,g=1),
'h' : dict(j=1)
}
I'd like to have a top-down, recursive solution to let's sa... |
Python has pytz (http://pytz.sourceforge.net) module which can be used for arithmetic of 'time' objects. It takes care of DST offsets as well. The above page has a number of examples that illustrate the usage of pytz.
|
Weborb can play flv over http, but cannot accept an rtmp live stream from a webcam, so cannot re-stream this input. In addition to the alternatives given for rtmp (FMS,red5,wowza) you could also use haxevideo. |
DataGridViewCell Bordercolor |
|c#|.net|datagridview|coding-style| |
Does anyone know how to change the Bordercolor for a Datagridviewcell in c#?
Here's a picture of what I mean:
![Datagridviewstyle][1]
[Picture][2]
Backgroundcolor, Textcolor and [Images][3] are no Problem, but I don't know how to realise the Borders.
Another problem is the cross in the second Row, but tha... |
Does anyone know how to change the Bordercolor for a Datagridviewcell in c#?
Here's a picture of what I mean:
![Datagridviewstyle][1]
[Picture][2]
Backgroundcolor, Textcolor and [Images][3] are no Problem, but I don't know how to realise the Borders.
EDIT: I want to realise this with winforms.
Another ... |
The `-L` option to `ls` will accomplish what you want. It deferences symbolic links.
So your command would be:
ls -LR
You can also accomplish this with
find -follow
The `-follow` option directs find to follow symbolic links to directories. |
Visitor stuck me the first time when working on a graph-heavy program, as a very elegant way to do operations on complex structures.
besides mvc (which isn't a pattenr per se), this is the "king of patterns" in regards to its complexity and potential to solve problems.
|
find /dir -type f -follow -print
-type f means it will display real files (not symlinks)
-follow means it will follow your directory symlinks
-print will cause it to display the filenames.
If you want a ls type display, you can do the following
find /dir -type f -follow -print|xargs ls -l
|
If you are trying to return only complete sets of records, you could try this. I would definitely recommend using meaningful aliases, though ...
select
a.pkid,
a.value
from
@a a
where
a.pkid in
(
select
pkid
from
(
select
c.pkid,
c.otherid,
count(*) matching_cou... |
If you are trying to return only complete sets of records, you could try this. I would definitely recommend using meaningful aliases, though ...
Cervo is right, we need an additional check to ensure that a is an exact match of b and not a superset of b. This is more of an unwieldy solution at this point, so this wou... |
`ls -R -L`
`-L` dereferences symbolic links. This will also make it impossible to see any symlinks to files, though - they'll look like the pointed-to file. |
You can automatically create the initial creation script, but ALTER scripts really need to be hand-coded on a case-by-case basis, because in practice you need to do custom stuff in them.
In any case, you'll need some way of creating apply and rollback scripts for each change, and have an installer script which runs ... |
descendant-or-self::*[contains(@prop,'Foo')]
Or:
/bla/a[contains(@prop,'Foo')]
Or:
/bla/a[position() <= 3]
Dissected:
descendant-or-self::
The Axis - search through every node underneath and the node itself. It is often better to say this than //. I have encountered some implementat... |
I found [a forum thread][1] that was talking about this, and it mentions that the best practice is to use the Error property. Between this thread and my own experiences, this is what I can conclude:
* In normal .NET code, the generated proxy class handles the exception properly by putting the exception in the Error ... |
User [Konrad Rudolph][1] advocates for DirectCast():
[Hidden Features of VB.Net][2]
[1]: http://stackoverflow.com/users/1968/konrad-rudolph
[2]: http://stackoverflow.com/questions/102084/hidden-features-of-vbnet#103285 |
If it happens exactly as you say then it **must** be an optimiser bug, you should report it to Oracle. |
[`System.Environment.MachineName`][1]
[1]: http://msdn.microsoft.com/en-us/library/system.environment.machinename.aspx |
Another way is to realise that Enumerable requires that you supply an each method.
So. you COULD mix in Enumerable to your class and give it a dummy each that works....
<pre>
class YourClass
include Enumerable
... really important and earth shattering stuff ...
def each
yield(self) if block_giv... |
profiling is key, but when using a profiling set you MUST be sure that it is an accurate test set of data, otherwise the tuning tools will not be able to get you an accurate result what is needed.
Also the management objects with fragmentation an usage reporting in 2005 are very helpful! |
I usually just hand write the queries to delete the records I don't want and save that as a .sql file for future reference. The pseudocode is:
1. select id's of records from the main table that I want to delete into a temp table
2. write a delete query for each related table which joins to the temp table.
3. writ... |
What are the benefits of the Iterator interface in Java? |
|java|oop|newbies| |
I just learned about how the Java Collections Framework implements data structures in linked lists. From what I understand, Iterators are a way of traversing through the items in a data structure such as a list. Why is this interface used? Why are the methods hasNext(), next() and remove() not directly coded to the dat... |
|java|oop|interface| |
No, all of the major consoles, except for the Xbox 360, do not have open development environments. There are various homebrew kits you can get, but these aren't sanctioned by the console makers (Nintendo, Sony, and Microsoft), so at best, you'll only be able to give away ROMs of what you make for free. If you try to ... |
My suggestion is to go ahead and write a script that will add the on delete cascade to each relationship in the database while exporting a list of modified relationships. Then you can reverse the process and remove the on delete cascade command on each table in the list. |
Try this:
import os;
print os.environ.get( "USERNAME" )
That should do the job. |
I haven't used it by [AppFuse](http://appfuse.org/display/APF/Home) is designed to facilitate the nasty setup that comes with Java Web Development. |
It's your print statement:
puts "test was run? (true expected): #{test.wasRun}"
should be
puts "test was run? (true expected): #{@test.wasRun}"
without the '@' you are calling Kernel#test, which expects 2 variables.
|
To add child elements that make your list you need to have your control setup a certain way:
[ParseChildren(true, "Actions")]
[PersistChildren(false)]
[ToolboxData("<{0}:PageActionManager runat=\"server\" ></PageActionManager>")]
[NonVisualControl]
public class PageActionManager : Control
{
The Actio... |
|python|source-file|fileio| |
|python|fileio|source-file| |
|python|file-io|source-file| |
|python|file-io|source-code| |
As others have mentioned you'll want to stash this information in a config file. In fact, I'd suggest using a different configuration file for each environment. This will address the inevitable problem of having multiple settings for each environment, e.g. you might have separate settings for the web service URL and ... |
I suppose you're talking about Adobe Flex, targeting the Flash Player?
If so, you can write your own logging wrapper class that propagates log messages sent to it to several targets (like the trace stack and internal memory so that you can access the log from within the app and e.g. send it to a server when the user... |
I suppose you're talking about Adobe Flex, targeting the Flash Player?
If so, you can write your own logging wrapper class that propagates log messages sent to it to several targets (like the trace stack and internal memory so that you can access the log from within the app and e.g. send it to a server when the user... |
I've used [OpenCSV][1] in the past.
<pre><code>import au.com.bytecode.opencsv.CSVReader;</code></pre>
<pre><code>String fileName = "data.csv";
CSVReader reader = new CSVReader(new FileReader(fileName ));
// if the first line is the header
String[] header = reader.readNext();
// iterate over reader.readNe... |
IRC-ing a lot helpen a great deal with me;
Especially playing those Trivia like games where the fastest one gets the points.
You can also try "typespeed" on Linux.
If you really need more speed and you think you've mastered the technique you can also consider using the [Dvorak keyboard layout][1]; It will help you t... |
The easiest thing is if you can make the WPF bitmap from a file directly.
Otherwise you will have to use System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap. |
Windsor is great, but why use that for caching when you have several built in ways to cache data. Windsor has its foundation in other areas not necessarily caching. From the cache object to session to cookies. There are many ways to cache. More importantly in large applications you end up needing distributed caching. M... |
Borland C++ Builder 6 compiler problem |
|c++|borland|6|builder| |
Why BCB 6 always compile all files. I make come changes on one file but BCB 6 compile all files when i start app.
Any idea?
I use WinXP SP2. |
|c++|borland|builder6| |
An example would be if you wanted to reuse a variable name, normally you can't reuse variable names
This is not valid
int a = 10;
Console.WriteLine(a);
int a = 20;
Console.WriteLine(a);
but this is:
{
int a = 10;
Console.... |
An example would be if you wanted to reuse a variable name, normally you can't reuse variable names
This is not valid
int a = 10;
Console.WriteLine(a);
int a = 20;
Console.WriteLine(a);
but this is:
{
int a = 10;
Console.... |
3.1 or 5.1 audio in Flash |
|flash|audio|3.1|5.1| |
Is it possible to do 3.1 or 5.1 audio using Flash? We're starting a project here for an interactive kiosk, and we've been told to use Flash. However, we also have a requirement to support either 3.1 or 5.1 audio (where 5.1 is the most wanted feature).
I haven't done any high-tech audio stuff using Flash, so I wa... |
If you can put code on the page then there's two things:
- Javascript looking for mouse movement, keyboard activity, and scrolling.
- Put a meta refresh tag in the html - if they're on that page for more than X minutes it'll automatically redirect to the login page.
If you can only put code on the server:
... |