Friday, November 20, 2015

windows server 2012 open port

Restart need after open port on firewall !!!!


-----------------
click inbound rules,  on right side, click New Rule...


rule type: custom rule(at bottom)
program: all
protocol and ports -->
remote port : must be all ports, (see pic)

===================================================

Managing Firewall Settings

The Windows Firewall with Advanced Security is a host-based firewall that runs on Windows Server 2012 and is turned on by default. Firewall settings within Windows Server 2012 are managed from within the Windows Firewall MMC (Microsoft Management Console). To review and set Firewall settings perform the following:
1. Open the Server Manager from the task bar.
2. Click the Tools menu and select Windows Firewall with Advanced Security.

3. First review the current configuration settings by selecting Windows Firewall Properties from the MMC landing page. This allows access to modify the settings for each of the three firewall profiles, Domain, Private, and Public as well as IPSec settings.

Applying Custom Rules

Custom Rules allow the finest level of control over inbound and outbound traffic to your Windows Server 2012.
1. If you have not done so already load the Windows Firewall MMC by opening the Server Manager from the task bar, clicking the Tools menu, and selecting Windows Firewall with Advanced Security.
2. Select either Inbound Rules or Outbound Rules under Windows Firewall with Advanced Security on the left side of the management console. 
Note: This will provide a listing on each of the currently configured firewall rules. Rules that are currently enabled are denoted by green checkbox icon, while disabled rules display a grey checkbox icon. Rightclicking a rule will allow you toggle enable/disable.

3. From the right side of either the Inbound Rules or Outbound Rules tab click New Rule.

4. Select Custom from the Rule Type radial button and click Next.

5. Select the Program association for the Custom Firewall Rule either All programs or the path to a program and clickNext.

6. From the Protocol type field select the protocol type and click Next.
Note: This walkthrough uses TCP on port 80 (HTTP) for example purposes.

7. Select an IP address association for both local and remote addresses and click Next.

8. Select an action to take on matching traffic and click Next.

9. Select the profiles associated with the custom rule and click Next.

10. Provide a name for your Firewall rule and an optional description and click Finish.

11. Once created the rule will be enabled. The firewall rule can be found on the corresponding Rule tab, either inbound or outbound depending on the type created. To disable or delete the rule find the rule in the MMC, right-click it, and select either Disable Rule or Delete.


Tuesday, November 17, 2015

access accdb import to sql server

1) split access to table
menu -> database tools -> access database, click split database, next...
you will get a file xxx_be.accdb
   

used Microsoft Office 15.0 Access Database Engine OLE DB Provider For the Source
and SQL Server Native Client 11.0 For the Destination

2)
error: 

Error 0xc02020e8: Source - Amounts [1]: Opening a rowset for "Amounts" failed. Check that the object exists in the database.

There is import wizard bug, when you select 'copy data from one or more table...', the automatic generated sql have single quote on table name, which cause error message, [Opening a rowset for "Amounts" failed. Check that the object exists in the database.] Click the 'preview' button(next to 'edit mapping' button), you can see the sql.
The solution is remove the single quote around table name by go back, choose 'write a query to specify the data to transfer'. now write your query. then next, then double click the [dbo].[query] change to the table name you want, [dbo][your_table_name]
you have to do one table by one table, i finally figure it out and make it works.

3) access column(date time) data value run out of range when conversion. These type of error  might be some bad value in some row cause failure to copy to destination table.  
the best way to do it is export each table to excel, then import excel to sql server. I test it with this way, no date time conversion error.

Thursday, November 12, 2015

find and replace text in a file use batch file command line

Create file replace.vbs:
Const ForReading = 1    
Const ForWriting = 2

strFileName = Wscript.Arguments(0)
strOldText = Wscript.Arguments(1)
strNewText = Wscript.Arguments(2)

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(strFileName, ForReading)
strText = objFile.ReadAll
objFile.Close

strNewText = Replace(strText, strOldText, strNewText)
Set objFile = objFSO.OpenTextFile(strFileName, ForWriting)
objFile.Write strNewText  'WriteLine adds extra CR/LF
objFile.Close
To use this revised script (which we’ll call replace.vbs) just type a command similar to this from the command prompt:
cscript replace.vbs "C:\Scripts\Text.txt" "Jim " "James "

Friday, November 6, 2015

Cannot read property 'getSouthWest' of undefined

getBounds() in Google Maps API v3


If you need to know the latitude and longitude for the corners of the visible area of the google map, you’ll probably use something like getBounds(); 
In Google Maps API v2, to get them, you will do something like this:
But in API v3 you will get “bounds is undefined” error.
So to get our latitude and longitude we need to move getBounds(), to some event listener.
Most common probably will be bounds_changed:
Description of bounds_changed in documentation is: “This event is fired when the viewport bounds have changed.”
It seems, that it’s the best moment to get our bounds. But if you want to make some ajax call in it, then every time when position of map has changed the ajax call will be fired. Most of the time we don’t need to firing ajax until we get our final map. With this event every zoom or panning will fire ajax call.
In my opinion, better solution is to use event “idle”. Especially if you want to make that ajax call. Description says: “This event is fired when the map becomes idle after panning or zooming.”. So the code will look like that:
But you can choose event which will suits your needs, not mine ;o). Just read description of them in documentation ofgoogle.maps.Map class – section events and decide which one is best for you.