terça-feira, fevereiro 24, 2015

SQL SERVER - Data Cursors


Artigo original:
https://msdn.microsoft.com/en-us/library/ms180169.aspx

Exemplo:

SET NOCOUNT ON;
DECLARE @vendor_id int, @vendor_name nvarchar(50),
    @message varchar(80), @product nvarchar(50);
PRINT '-------- Vendor Products Report --------';
DECLARE vendor_cursor CURSOR FOR
 SELECT VendorID, Name
 FROM Purchasing.Vendor
 WHERE PreferredVendorStatus = 1
 ORDER BY VendorID;
OPEN vendor_cursor
FETCH NEXT FROM vendor_cursor
INTO @vendor_id, @vendor_name
WHILE @@FETCH_STATUS = 0
BEGIN
    PRINT ' '
    SELECT @message = '----- Products From Vendor: ' +
        @vendor_name
    PRINT @message
    -- Declare an inner cursor based  
    -- on vendor_id from the outer cursor.
    DECLARE product_cursor CURSOR FOR
    SELECT v.Name
    FROM Purchasing.ProductVendor pv, Production.Product v
    WHERE pv.ProductID = v.ProductID AND
    pv.VendorID = @vendor_id  -- Variable value from the outer cursor
    OPEN product_cursor
    FETCH NEXT FROM product_cursor INTO @product
    IF @@FETCH_STATUS <> 0
        PRINT '         <<None>>'    
    WHILE @@FETCH_STATUS = 0
    BEGIN
        SELECT @message = '         ' + @product
        PRINT @message
        FETCH NEXT FROM product_cursor INTO @product
        END
    CLOSE product_cursor
    DEALLOCATE product_cursor
        -- Get the next vendor.
    FETCH NEXT FROM vendor_cursor
    INTO @vendor_id, @vendor_name
END
CLOSE vendor_cursor;
DEALLOCATE vendor_cursor;

domingo, fevereiro 22, 2015

TPLINK: How to configure alarm sending through FTP Client on TP-LINK IP cameras?



When the TP-LINK IP cameras detect a motion, they can send alarms to a specific email address or a FTP server to notify the owner. This article is about how to configure the camera to send an alarm to a FTP server automatically. Here we take TL-SC3130 for example
Step 1 Open your Internet browser and type in the IP address of the IP camera in the address bar. If you’ve no idea about the camera’s IP address, please click here.
http://www.tp-link.com.au/Resources/UploadFiles/image002(16).jpg
Step 2 In the pop-up window, please type in the username and password of your IP camera. The default username and password are both admin
http://www.tp-link.com.au/Resources/UploadFiles/image004(15).jpg
Step 3 After log in ,on the left hand side, click on Settings->Advance->FTP Client->General, check FTP Client On, and then make a name for the FTP client, for example, tp-link, and then type in the correct FTP server information. Click on OK to save the settings.
http://www.tp-link.com.au/Resources/UploadFiles/image006(9).jpg
Step 4 Click on Test button to check whether it is working or not. If it works, you will have the picture below.
http://www.tp-link.com.au/Resources/UploadFiles/image008(7).jpg
Step 5 Click on Alarm SendingOn the left hand side, and check Alarm Sending On, make a folder name in the Remote path bar ,this folder is for saving the image files. Make a name for the image file. Motion detection box should be checked.
http://www.tp-link.com.au/Resources/UploadFiles/image010(3).jpg
Step 6 click on the Motion Detection button, you can configure 3 motion detection areas. And the threshold and sensitivity can be set separately based on your application. Click on OK to save your settings.
http://www.tp-link.com.au/Resources/UploadFiles/image012(5).jpg
Now we have done all the configurations and camera will send pictures to the FTP server when some motions are detected
We could see the pictures on the FTP server when we flip the calendar
http://www.tp-link.com.au/Resources/UploadFiles/image014(6).jpg
If you still have some problems, please feel free to contact TP-LINK support.

Original lynk:
http://www.tp-link.com.au/article/?faqid=366

TPLINK: How to remote view IP camera via web browser

In this FAQ, we are showing you how to view the camera using a web browser such as IE, Firefox, Chrome or Safari. Here we just take IE as an example.
The steps below are based on the assumption that you have already connected your IP camera to a router or modem router on which you already has internet access.
Step 1
Login the web interface of the camera by typing the IP address of camera in the address bar of your web browser. If you don’t know the IP of it, please click here.
http://www.tp-link.com/resources/images/faq/20111192072641.jpg
Step 2
Go to SETTING->BASIC->Network->Information to find the HTTP port number used by the camera. The default is 80. Usually there is no need to change the port number. However some ISP blocks port 80, so you may need to change the port to accommodate it. Here we change it to 3333 for example.
http://www.tp-link.com/resources/images/faq/201111920758148.jpg
Step 3
After you change the port, please go to SETTING->BASIC->System->Initialize. You need to reboot the camera in order to make the port change take into effect.
http://www.tp-link.com/resources/images/faq/201111920822722.jpg
Step 4
After rebooting we can access the camera using http://192.168.1.101:3333 on local PC.
http://www.tp-link.com/resources/images/faq/2011119201047418.jpg
Then we need to do port forwarding settings on your router. The configuration depends on the router you are using, please consult your router’s technical support accordingly. Here we just take a TP-LINK TL-WR941ND for example.
Step 1
Login the router. Go to Forwarding->Virtual Servers and click Add New to add new virtual server entry.
http://www.tp-link.com/resources/images/faq/2011119201117720.jpg
Step 2
Type the IP and port used by the camera in the corresponding field. For the Protocol, we recommend you select ALL. Click Save to add this new entry.
http://www.tp-link.com/resources/images/faq/2011119201135109.jpg
Step 3
Now port 3333 is opened for the camera on the router.
http://www.tp-link.com/resources/images/faq/2011119201152943.jpg
Step 4
Go to Status page to check the WAN IP address of the router.
http://www.tp-link.com/resources/images/faq/2011526143116486.jpg
Step 5
Then on a remote PC, you can open your web browser. In the address bar, simply type in http://183.38.7.205:3333 and press enter, then you can access the web interface of the camera.
http://www.tp-link.com/resources/images/faq/201152614323363.jpg

Original Lynk
http://www.tp-link.com/en/article/?articleid=304