Why this element is "undefined" -- it clearly exists - jscript

I am getting what seems to be a very odd error in a web page. This is happening in both VS2008 and VS2012. In the following:
<div class="content_header" onclick="tierMenu(menu2,img2)">
<img id="img2" alt="Colapse Trips" height="9" src="Images/plus.gif" width="9" />
Travel Summary
</div>
clicking the plus image is supposed to change the image to a minus (expanding the item to display data). The tierMenu javascript method is called upon clicking, and it exists. But I am getting an error:
0x800a1391 - Microsoft JScript runtime error: 'img2' is undefined
"Img2" definitely exists. There is similar code in other places in the page, and they all behave the same way -- getting the same error. Odd thing is, the code is working fine in production. It's calling:
function tierMenu(objMenu,objImage)
{
if(objMenu && objImage)
{
...
}
}
It happens that my dev machine is 64-bit Windows 7. I can't imagine that this would be a problem. Any ideas?
Edited to Add: A colleague whose workstation is Win XP tried this on VS2008 and the problem did not occur. Really odd. The problem occurs on my workstation even when running outside of Visual Studio, i.e. directly from the browser using localhost.

This turns out to be a browser compatibility issue. If I put IE9 into compatibility mode the problem goes away.
It isn't the first time compatibility has beat me over the head. I will have to learn to try that first thing as soon as something weird like this happens.
Thanks to everyone who looked at this and puzzled over it with me.

Related

NSProgressIndicator built-in animation raises CA_ASSERT_MAIN_THREAD_TRANSACTIONS

This looks like a bug in either NSProgressIndicator or Xcode 9 to me:
Run Xcode 9 Beta 1 or Beta 4, in macOS 10.12.6.
File > New Project, macOS, Cocoa app, Objective-C or Swift, ARC or not, no storyboards, latest (10.13) SDK.
In the app target's environment, set CA_ASSERT_MAIN_THREAD_TRANSACTIONS=1.
In app delegate, add a IBOutlet progressIndicator.
In the nib, add a NSProgressIndicator to the window, connect to that outlet. Leave the checkbox Indeterminate switched on.
In -applicationDidFinishLaunching, call -startAnimation: on progressIndicator.
Build and run.
Expected Result:
Progress indicator should happily show indeterminate progress, because I did everything on the main thread.
Actual Result:
App crashes, citing CA_ASSERT_MAIN_THREAD_TRANSACTIONS, when
-startAnimation: is called.
You can see this in a tiny demo project.
Did I do anything wrong? Is my Expected Result incorrect?
P.S. I asked this on Apple's Developer Forums, but still awaiting moderator approval after 2 working days, so I deleted it and came here instead :(
Update: Still lacking an explanation, I filed Apple Bug 33593575.
This was a bug in NSProgressIndicator. Your bug report (thank you for filing!) was marked as a duplicate of an earlier bug, which was already resolved in macOS 10.13.

ADB debugging in Android Studio - some basic issues

Ok, I've squeaked by not needing to use ADB in the Studio, since back
in the 'beta' days of AS. (Just lucky, I guess.) But now, I need to
debug a crashing app.
I've gotten this far:
Learned how to put adb.exe on my Window's 'PATH'
(so that it's invokable from cmd-window):
My path-entry was: C:\Users\David\AppData\Local\Android\sdk\platform-tools
Am assuming that 'logcat' lives on Android device (I was incorrectly guessing it lives on the development machine). I'm assuming this, because when I dis-connect
the USB-cable and enter 'adb logcat' is says waiting for device.
Ok, now my (next) issue: When I fire up the app-being-developed, I'm getting
"Unfortunately has stopped"...which I'm assuming is an app-crash.
And, while I'm looking at 'logcat', I can see a stack-trace flow by. But
as I try to scroll-back to read it, logcat keeps dribbling in more data.
So, how do I tell it to shutup...so that I can look at a static copy
of logcat and see what has happened (without more data dribbling in)?
[If there is other beginner related info, beyond this question, feel free to
to add that info...I'm clearly in need of basic 'adb-related' enlightenment.]
TIA.
Cheers...

SQL CE 4.0 Error - ReleaseHandleFailed was detected

I keep getting this error in the dev environment - 'A SafeHandle or CriticalHandle of type 'System.Data.SqlServerCe.HasSafeHandle' failed to properly release the handle with value ...."
It is in a VS 2012 Winforms application and only seems to happen if a particular piece of code is run at some point. The error shows after the form is closed, but I can't understand why. It only happens in the dev environment and seems to be OK in the compiled version, but I don't want to just ignore it.
The error seems to be caused by this line of code, although weirdly at this point in time I have not opened a connection to the SQL ce database and the directory it is searching in does not have the SQL ce database in it. It is mearly reading in txt files that match a pattern
string[] fileNames = Directory.GetFiles(importDirectory, "BucketHistory*.txt")
I'll do some more digging tomorrow, it's late now, and I have no idea what is causing it.
Any pointers ??!
Turns out I was having a bit of brain fade yesterday. Been working too long hours !
For anyone interested, the problem was that I was opening a connection, then copying the file and running a shrink whilst the connection was still open. It had nothing to do with that line of code.
I would have expected the copy to have thrown an exception, but it didn't appear to. Oh, and opening another connection inside the using statement of the first one. Sigh.

wx.TextDropTarget not working in Linux

I have a desktop application developed with wxPython. The applications runs fine under Windows and OSX (same codebase, no platform specific code). Everything works on Linux except drag and drop. I can drag just fine, but DoDragDrop always returns wx.DragCancel. I can however, drag from my application or to another app/desktop which excepts text and DoDragDrop returns wx.DragCopy.
It seems to me like the DropTargets aren't getting called. I've added debug statements to OnData, etc and they are never activated.
Has anyone seen this and know of a workaround?
Found a known issue in wxWidgets that was considered fixed, http://trac.wxwidgets.org/ticket/2763, I am able to recreate this issue on linux. I reopened the ticket.
In the meantime you can swap your StaticBoxSizers or BoxSizers. or...
This works....
parent = DropTargetCtrn.GetParent()
boxes = [x for x in parent.GetChildren() if type(x)==wx.StaticBox]
tmpParent = wx.Panel(parent)
for box in boxes:
box.Reparent(tmpParent)
box.Reparent(parent)
parent.Destroy()
This solution seems to lower the StaticBox in the window hierarchy so it don't interfere with drop events. Note, box.Lower() does not work.

Strange error returned from mciSendString - Can anyone help?

A few months ago I added audio recording to a MFC app that I'm working on. This turned out to be easy enough and after an hour or two the code was working on my PC and on a couple of the customers test machines (one running XP the other Vista). Recently however one of their test machines was upgraded and now the recording feature refuses to work.
The basic code to start the recording is ..
mcierr=mciSendString("open new type waveaudio alias mysound",tmpstr,80,NULL);
mcierr=mciSendString("set mysound time format ms bitspersample 8 samplespersec 11025",tmpstr,80,NULL);
mcierr=mciSendString("record mysound",tmpstr,80,NULL);
which appears to work fine. To stop recording the following code is executed ..
mcierr=mciSendString("stop mysound",tmpstr,80,NULL);
mcierr=mciSendString("save mysound C:\\filename.wav",tmpstr,80,NULL);
mcierr=mciSendString("close mysound",tmpstr,80,NULL);
The following error occurs when the "save mysound C:\filename.wav" instruction is sent. The error returned is ..
MCI Error A parameter or value was specified twice. Only specify it once.
But I can't see any error in what I am sending and that error doesn't make sense. Is it possible that the error is because the program is trying to record using a format the PC doesn't support ?
Thanks for your time
Ian
OK I managed to find a solution to this. This line in the code ..
mcierr=mciSendString("save mysound C:\\filename.wav",tmpstr,80,NULL);
works fine on my development PC running XP but causes errors on some test PC's running XP and on all of them running Vista. The error goes away however if the filename itself is put within quotes like this ..
mcierr=mciSendString("save mysound "C:\\filename.wav"",tmpstr,80,NULL);
Now the code runs fine on all the XP and Vista PC's it has been tested on.
Ian
A detail more is necessary to have it working.
Please watch the double "" before and after the file name:
mcierr=mciSendString("save mysound ""C:\\filename.wav""",tmpstr,80,NULL);
This is fine, too:
mcierr=mciSendString(#"save mysound ""C:\filename.wav""",tmpstr,80,NULL);
With these double quotation marks the code works on my Windows 7 now.

Resources