Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Mike Dahmus

Greenhorn
+ Follow
since Mar 07, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Mike Dahmus

followup: I now see the method getLocalAddr() was added in Servlet 2.4. Unfortunately, I'm stuck for now with Servlet 2.3 (can't afford to upgrade our embedded Tomcat to 5 at this point - way too risky). Any hacks which can get me there on 2.3?
15 years ago
I have code running on the server in a login servlet - in the case which is causing concern we're using a clustering solution which results in multiple IP addresses being active (on different interfaces) for the same machine. One is the 'normal' address and one is the 'cluster'. (i.e. one machine at a time 'owns' the cluster address).

For various reasons, I need to know which IP address is being used on a given servlet call. (i.e. the machine's normal eth0 address is 1.1.1.1, and it also has an eth0:0 address of 3.3.3.3 (cluster); the servlet needs to know which one is being used for the current HTTP activity so I can potentially tell them "don't log in here; log in there instead").

getServerName() works somewhat - but provides a hostname if the user had connected that way from the client. That makes me unsure that this is even going to work for the case I'm concerned about. Basically we used to do this on the client side but discovered that the NAT case doesn't work with this (where the servers are behind a NAT and thus the client can't compare what it sees in a well-known spot on the server against its own settings, since the client's versions of the addresses aren't the same).

Any suggestions?

Thanks,
Mike Dahmus
mdahmus@netbotz.com
15 years ago
I have an external app I need to drive by sticking data in its stdin - I create the process and grab the streams accordingly (see below). On unix, this works fine, but on Windows I'm getting

java.lang.IOException: The pipe is being closed

as soon as I try to write a second batch of data to it (I don't close the stream in between writes). Anybody seen this before? I could theoretically write to a local file and change how I call the app, but I'd rather not, since it works quite well done this way in its existing environment on the unix server and I'm trying to maintain common code.

Here's the creation code:




and writing to the process goes like this:

15 years ago
I have a chunk of code which is interacting with a cache (threaded) where cache-notification events attempt to kick off a runnable via SwingUtils.invokeLater as below. In my case, there are eleven cache events occurring (I hit all of them with the debugger and with the print statements) but the runnable only actually runs four times.

protected void notifyPostCacheListeners(final CacheEvent ev) {

System.out.println("notifyPostCacheListeners... outside");

Runnable r = new Runnable() {
public void run() {

System.out.println("notifyPostCacheListeners... runnable.run");

if (_cacheListeners != null) {
for (int i = 0; i < _cacheListeners.size(); i++) {
((CacheListener)_cacheListeners.get(i)).cacheUpdate(ev);
}
}
}
};
SwingUtilities.invokeLater(r);
}

It's ALWAYS four times here. That's what's hard to figure out - if I had a race condition, I might expect a different number of runs. (The cacheUpdate call inside the runnable always successfully completes).

Any ideas?
Another problem which has presented itself:
The path is like this, simplified:
1. Download DLL - this sticks it in the user's desktop on Windows (guh)
2. Execute code which calls DLL
3. Try (and fail) to delete DLL (to clean up user's desktop).
How can I, after 2, relinquish my hold on the DLL so it may be deleted?
16 years ago
Nope. The jar executes, determines local platform, and (if Windows) downloads the JNI DLL. Then and only then does it execute the java code backed by the JNI DLL.
(Obviously my jar is running with all possible privileges at this point).
Packaging the DLL inside the jar - never thought of this. It would add unnecessary download time on unix boxes, but that might not be a deal-breaker... any problems to look for here?
16 years ago
A lead engineer in my new company wants the new DLL (that I use to access the Windows registry - downloaded from an existing applet) to be signed, as is the jar with the applet itself.
I'm flummoxed - after 45 minutes with google, I can't find anybody doing this in any other environment than ActiveX.
Anybody ever dealt with this requirement? We already have all the certificates we need, I think; I just need some mechanical (and tool) help with the signing of the native-code DLL piece of it.
Thanks,
Mike Dahmus
mdahmus@io.com
16 years ago
I'm writing a Swing component which must function similarly on Apple and Windows; and am having trouble with which event to fire off of
(this is effectively a toggle button which would ideally just be interested in mouseClicked). For a variety of other reasons, I don't want to make my code act on the mousePressed event.
Originally, our QA person asserted that it was busted because she was clicking (and moving the mouse > 10 pixels) and it wasn't getting "toggled" (this was on Windows). I won the battle there by saying "don't move it 10 pixels; that's a drag, not a click". (after debugging and figuring out that if you moved the mouse more than approximately that much, the mouseClicked never came in).
However, she now claims that on Apple (OSX) that the button fails to toggle if you move the mouse even one pixel while pressing the button. (i.e. if you are not perfectly still while clicking).
Obviously this would be a different story. I don't have immediate access to an Apple machine, so was wondering if anybody else had seen this behavior. When I worked on the AWT on OS/2 at IBM, it was fairly clear that the mouse events were determined based on native operating system events (i.e. when Windows says it is a click, we'll say it is a click). Don't know if that's true now or not, since I haven't seen the code since Java 1.1.8.
16 years ago

Originally posted by Mark Herschberg:
Today the companies aren't colluding, they're just making the most of a soft labor market.


This is dishonest.
H1-B and L-1 are examples of the companies "colluding" in the sense that they are artifically manipulating the market.
16 years ago

Originally posted by Mark Herschberg:

In the US we have good roads, free public education, safe streets, public transportation systems, opportunities for personal growth, public libraries, FAA (allowing safe, low cost air travel), telephone service available (even if not paid for) in every house, social services, clean water in every town, etc. I'm guessing India doesn't have the same support for it's citizens.
Did you think this was free?!?! It costs money! If you don't like it, tell the politicans to pull the plug on these social services. We can live just like any other country, and even save money to boot!
--Mark


It must save you a lot of time to not bother reading the points of those with whom you argue.
The point is that the "race to the bottom" has begun; and to claim that we're competing "on a level playing field" only makes sense if you enjoy the least-common-denominator approach to economic development.
God lord, you're a smug git.
17 years ago

Originally posted by Mark Herschberg:

Realistically, however, child labor isn't taking software jobs from the US. Neither is environmental constraints. In our industry, India isn't do anything we can't do ourselves, if we so choose.
--Mark


Realistically, our overall tax burden (including that on corporations) and cost structure incorporates all of the above; so, in fact, we _can't_ do what India is doing without losing what makes us a first-world country.
17 years ago

Originally posted by Mark Herschberg:

It's a very level playing field. People in third world countries are simply willing to earn less and have a lower standard of living then people in the US. If you're willing to work for those wages and accept that standard of living, you'll get those jobs. If you're not, oh well. It's not an issue of fairness, it's an issue of you don't want to change your lifestyle. (As always in these cases, "you" is used for anyone in general.)


Oh, come on. I can't believe you wrote this nonsense.


What's the child labor law in Vietnam? What environmental protections are in place in India? What's the rule on paid overtime in Bangladesh?


Give me a break. You might as well just turn to a random page of Ayn Rand for all the thought you're putting into this.
17 years ago

Originally posted by Mark Herschberg:

You'll get no argument from me here on that. Those comapnies are the exception, not the rule. But that just makes it easier for me to find the few good comapnies; it saves me time from having to talk to not so good companies. If you want to be successful, always work with people smarter then you, because you learn from them. Smart people produce smart companies. Convesely, a smart company is likely to have people smarter then you, and you should work there.
(And just to avoid any misunderstanding, I'm using the term "you" in general. It applies to you, me, that guy over there, and everyone else.)
--Mark



Mark,
When I was your age, I thought and talked exactly like you do - I was sure that I'd always be able to find a job at a company that at least met a reasonable standard for "good". Microeconomics (my own skills) was all that mattered; as a "good" programmer, I'd always be able to find a job at a "good" company.


As my respected colleagues began to have trouble finding jobs, though, I was quickly disabused of the notion so common among programmers that macroeconomics doesn't matter. It does. Believe me. The collapse of the internet bubble meant that a lot of other "good" programmers were out there; far too many for each and every one to get a job at a "good" company (or jobs at all, for that matter).


I learned this lesson before I had trouble finding a job after my one and only layoff. I advise you to think long and hard about it too; because not only are you setting yourself up for a lot of hurt later on; you're carrying a mental blind-spot the size of Texas.
17 years ago

Originally posted by Mark Herschberg:

Well, you and I must be applying to different companies. Although I've never really worked with C/C++ (certainly not professionally), companies requiring a min of 2-3 years C/C++ experience have been talking to me.
--Mark


There you go again.


The smart person learns from others. The non-smart person has to learn from experience.


Yes, a few good companies will spend the time to talk to you because they see comparable experience in comparable technologies; but most will not, because even good companies are unwilling to filter thousands of resumes at that high a level of effort. So again, you're relying on either word-of-mouth or having the buzzwords (I've done both).
17 years ago

Originally posted by Mike Dahmus:

Even at good companies, one resume in a batch of 1,000 doesn't get more than a cursory glance. This is where macroeconomics can defeat the libertarian ideal.


By the way, this is not hypothetical; when I was interviewing for the position I have now held for about a year; I was unemployed (as were all of my current coworkers). At that time, there was exactly one other job posting even remotely relevant (and I cast a wide net - any kind of programming would do) in about three months either direction; and it was at a company in a very nice part of town for my purposes. I got to the point of a phone interview, which went something like this:


"Do you have any OOP and Javaexperience?"


"Yes, if you'll refer to job X listed here, you will see that I was one of three guys that ported the AWT from Windows to O/S NNNN in Java 1.1.1; and if you look here; you will see that I led the team that did the follow-on release for O/S NNNN".


"OK".


One week passes.


I call.


"Oh, we didn't think you were right for the position because you didn't have any OOP experience".


Point is that this recruiter; the gatekeeper; was looking for a specific, criminally stupid, buzzonym on the resume; and was incapable of extrapolating even from "Java" to "OOP". To say nothing of the C++ experience. Even after I told her!


The cyberlibertarian response to this is probably "they're not a good company". I agree. Problem was that at that time, they were the only company hiring. And my unemployment was nearing its end (as were my future coworkers, by the way, several of whom had an identical experience with the same company!). That's where macroeconomics comes in - N% of all companies will always be stupid; and when you've got bills to pay; you've often got to struggle with the bad companies; which sometimes won't hire you even if you're a perfect fit (otherwise they would be good companies, right?)


I think the only constructive advice here is to keep a version of your resume around which contains every possible buzzword even remotely related to your actual experience, in spelled-out and acronym form; and be ready to use it as your first entry into a company if you're desperate enough. The problem is that once you're at a good company, you weed those resumes out quickly (when we started hiring more people; one of the guys that works with me came up with a resume with a record for buzzwords that we still keep taped to his cubicle for entertainment value; and we did not invite him in for an interview; presentation being part of the reason why).


So maybe the constructive advice is: excrement happens; no advice will work at both bad and good companies; take your chances.
17 years ago