So, i had a task that was one of those hard to solve.
I need to use the mouse events over the activeX. I tried all the solutions in all the foruns, none this work.
Some solutions, sugest the use of one iframe over the activeX, then, make it transparent. This solution didn't work for me, i beleave this solution work with some activeX, but not all of them, for example VLC web plugin.
In this activeX, the mouse move, click, mouseup,mousedown events, did not work. Because, none of them are exposed in the activeX. But, i tried something different, the drag, dragend, does work over this component. So, i changed the requiriments in order to implement my feature using drag events, scroll events also seem to work :).
Try the following:
window.document.body.addEventListener("drag", function(event){debugger;}, true); //will work if dragging over the activeX and you can get the mouse position
window.document.body.addEventListener("click", function(event){debugger;}, true); //will not work over the activeX
This is a matter that is all over the web, if you have some question, just add a comment.
I'm hoping that with this, i can give a little bit back.
Thursday, December 17, 2015
JS ActiveX Events Explained, in all IE Versions. Part 1
Just a note for the younger developers: Yes, activeX are just for IE.
It seems that there is a lot of questions about activeX and the behaviour of mouse events on this type of components.
To start, let me just explain that activeX (in general), behave like a completely separate object and doesn't work in the same processa as IE.
The only mouse events exposed in the activeX are the ones that the developer of the activeX component chose to implement. So, when you try to hook the mouse events in your page, (using js of course), you should use attachEvent method, but if your IE version does not support this method, then you should turn to this deprecated html tag:
For more details; https://msdn.microsoft.com/en-us/library/aa242436%28v=vs.60%29.aspx
You can choose to code a javascript method to implement this feature. For the activeX ctrl, and event Connect:
var scriptEventConnect = $("script[for='" + ctrl.id + "']");
if (scriptEventConnect != null && scriptEventConnect.length == 1){
scriptEventConnect.empty(); }
var s = document.createElement("script");
s.language = "JScript";
var a = document.createAttribute("for");
a.value = ctrl.id;
s.setAttributeNode(a);
s.event = "Connect(lSourceId, sType)";
s.innerHTML = ".............RIGHT HERE THE EVENT HANDLER CODE........ ";
(head || document.body).appendChild(s);
So, by now you should knowthe right way to use events that are exposed in the activeX. I love JQuery, but it seems that is not the rigth way of handling activeX events. It's not a JQuery related problem, activeX are not multibrowser, so....
You must be sure about the events that are exposed by the activeX and their arguments.
It seems that there is a lot of questions about activeX and the behaviour of mouse events on this type of components.
To start, let me just explain that activeX (in general), behave like a completely separate object and doesn't work in the same processa as IE.
The only mouse events exposed in the activeX are the ones that the developer of the activeX component chose to implement. So, when you try to hook the mouse events in your page, (using js of course), you should use attachEvent method, but if your IE version does not support this method, then you should turn to this deprecated html tag:
<script event="EventName" for="objectId" language="language">
For more details; https://msdn.microsoft.com/en-us/library/aa242436%28v=vs.60%29.aspx
You can choose to code a javascript method to implement this feature. For the activeX ctrl, and event Connect:
var scriptEventConnect = $("script[for='" + ctrl.id + "']");
if (scriptEventConnect != null && scriptEventConnect.length == 1){
scriptEventConnect.empty(); }
var s = document.createElement("script");
s.language = "JScript";
var a = document.createAttribute("for");
a.value = ctrl.id;
s.setAttributeNode(a);
s.event = "Connect(lSourceId, sType)";
s.innerHTML = ".............RIGHT HERE THE EVENT HANDLER CODE........ ";
(head || document.body).appendChild(s);
So, by now you should knowthe right way to use events that are exposed in the activeX. I love JQuery, but it seems that is not the rigth way of handling activeX events. It's not a JQuery related problem, activeX are not multibrowser, so....
You must be sure about the events that are exposed by the activeX and their arguments.
Thursday, November 28, 2013
Sql Testing with various DB Engines
http://sqlfiddle.com
You can test various database and send samples to others!
We got to love this!
You can test various database and send samples to others!
We got to love this!
Tuesday, October 15, 2013
How to backup/restore reports from Sql Server Reporting Services or create a deploy/installer
https://sqlserverfinebuild.codeplex.com/wikipage?title=Install%20Reporting%20Services%20Scripter
These small tool is very useful when handling Reports.
What these tool does, is backup the reports in a form that can be easily deploy in any server.
These small tool is very useful when handling Reports.
What these tool does, is backup the reports in a form that can be easily deploy in any server.
Monday, September 16, 2013
The only .net profiler that works how it is suposed
http://www.yourkit.com/
Try it! It is a must have dev tool. You can use it for tracking:
memory leaks, high cpu usage, check SQL commands....
Try it! It is a must have dev tool. You can use it for tracking:
memory leaks, high cpu usage, check SQL commands....
Friday, September 06, 2013
Dispatcher with database deadlock (or using queue with multiple workers)
I have a web service with the following set of operations:
-insert event
-get all available events
-send the events
-mark as sended
It's easy to generate a deadlock with this sequence, so what we need to do is use the sql hints to handle this matter.
BEGIN TRAN
--INSERT A NEW ELEMENT LOCKING ONLY THE INSERTED ROW
INSERT INTO [Tab1] WITH (ROWLOCK)
([objectTypeId]
,[objectId] )
VALUES
(8
,1)
--SELECT THE EVENTS AVOIDING SELECTING THE BLOCKED ROWS (READPAST)
SELECT * FROM [Tab1] WITH (READPAST, ROWLOCK)
WHERE objectTypeId = 8 AND objectId =1
--UPDATE ALL THE EVENTS THAT WE NEED, ALL THE UNLOCKED ONES
UPDATE [Tab1] with (READPAST, ROWLOCK)
SET operationTms = GETDATE()
WHERE objectTypeId = 8 AND objectId =1
COMMIT
"As a last note, the READPAST hint can only be specified in transactions operating at the READ COMMITTED or REPEATABLE READ isolation levels." in http://aartemiou.blogspot.pt/2011/08/updating-sql-server-tables-without.html
-insert event
-get all available events
-send the events
-mark as sended
It's easy to generate a deadlock with this sequence, so what we need to do is use the sql hints to handle this matter.
BEGIN TRAN
--INSERT A NEW ELEMENT LOCKING ONLY THE INSERTED ROW
INSERT INTO [Tab1] WITH (ROWLOCK)
([objectTypeId]
,[objectId] )
VALUES
(8
,1)
--SELECT THE EVENTS AVOIDING SELECTING THE BLOCKED ROWS (READPAST)
SELECT * FROM [Tab1] WITH (READPAST, ROWLOCK)
WHERE objectTypeId = 8 AND objectId =1
--UPDATE ALL THE EVENTS THAT WE NEED, ALL THE UNLOCKED ONES
UPDATE [Tab1] with (READPAST, ROWLOCK)
SET operationTms = GETDATE()
WHERE objectTypeId = 8 AND objectId =1
COMMIT
"As a last note, the READPAST hint can only be specified in transactions operating at the READ COMMITTED or REPEATABLE READ isolation levels." in http://aartemiou.blogspot.pt/2011/08/updating-sql-server-tables-without.html
Friday, June 15, 2012
carvoeiro vilanova
Novo site da Vila Nova de Carvoeiro.
New site for Vila Nova in Carvoeiro.
Vila Nova Carvoeiro - Apartments & Restaurant
New site for Vila Nova in Carvoeiro.
Vila Nova Carvoeiro - Apartments & Restaurant
Thursday, November 10, 2011
How to Turn On SIM900 with arduino.
We were getting some strange behavior out of the SIM900 module.
Some times the module was working ok, and others not so ok. :)
The main problem was in turning on method of the SIM900.
The solution:
Turn off and Then Turn on the SIM900.
The arduino code with the NewSoftSerial:
#define GSM_ON_PIN 8
int AvrHardwareHelper::TurnOffGsm()
{
mySerial.println("AT+CPOWD=1");
delay(3000);
digitalWrite(GSM_ON_PIN, LOW);
delay(2000);
digitalWrite(GSM_ON_PIN, HIGH);
delay(2500);
return atCommandResult;
}
int AvrHardwareHelper::TurnOnGsm(char* pin, int pinSize)
{
mySerial.println("AT+CFUN=1");
delay(600);
mySerial.flush();
mySerial.println("AT");
delay(600);
int numberOfBytesRead = 0;
while((mySerial.read()) > 0)
{
numberOfBytesRead++;
}
if(numberOfBytesRead==0)
{
digitalWrite(GSM_ON_PIN, HIGH);
delay(1200);
digitalWrite(GSM_ON_PIN, LOW);
delay(2500);
}
mySerial.flush();
delay(2000);
.... Do the rest here, at+cpin, etc....
}
pinMode(GSM_ON_PIN, OUTPUT); // sets pin 5 as output
mySerial.begin(9600);
TurnOffGsm();
TurnOnGsm("1234", 4);
This is the main difference with all the samples on the web.
If someone is searching for more info, please just leave a comment.
Some times the module was working ok, and others not so ok. :)
The main problem was in turning on method of the SIM900.
The solution:
Turn off and Then Turn on the SIM900.
The arduino code with the NewSoftSerial:
#define GSM_ON_PIN 8
int AvrHardwareHelper::TurnOffGsm()
{
mySerial.println("AT+CPOWD=1");
delay(3000);
digitalWrite(GSM_ON_PIN, LOW);
delay(2000);
digitalWrite(GSM_ON_PIN, HIGH);
delay(2500);
return atCommandResult;
}
int AvrHardwareHelper::TurnOnGsm(char* pin, int pinSize)
{
mySerial.println("AT+CFUN=1");
delay(600);
mySerial.flush();
mySerial.println("AT");
delay(600);
int numberOfBytesRead = 0;
while((mySerial.read()) > 0)
{
numberOfBytesRead++;
}
if(numberOfBytesRead==0)
{
digitalWrite(GSM_ON_PIN, HIGH);
delay(1200);
digitalWrite(GSM_ON_PIN, LOW);
delay(2500);
}
mySerial.flush();
delay(2000);
.... Do the rest here, at+cpin, etc....
}
pinMode(GSM_ON_PIN, OUTPUT); // sets pin 5 as output
mySerial.begin(9600);
TurnOffGsm();
TurnOnGsm("1234", 4);
This is the main difference with all the samples on the web.
If someone is searching for more info, please just leave a comment.
Subscribe to:
Posts (Atom)