Wednesday, December 23, 2015

netbeans spring mvc setup

netbeans spring mvc setup


* netbean 8.0 only support spring mvc 4.0.1 if I want to use latest spring mvc 4.2.4 I have to create maven project instead of java web project (netbean build in)




* project  source folder can't locate at tomcat8/webapp/, has to be somewhere else, such as c:/jh/tomcat/. Otherwise, when you run from netbeans, it will delete the whole project source at webapp folder.



* If error is cannot find symbol for any class, include spring mvc class, your class etc.... it is because netbeans use cached old path, should use current path, the solution is clean the cache by.


menu > help > about

it shows the cache directory at bottom.
Cache directory: C:\Users\HU_J\AppData\Local\NetBeans\Cache\8.1

go there and delete everything under it.

      

Friday, December 18, 2015

mysql sqlserver postgreSQL mongoDB use which one?

mysql sqlserver postgreSQL mongoDB use which one?


For spatial data,  use mongoDB, or postGIS


For table data, use mysql not PostgreSQL is mysql 2 times faster on read select query.

For table data, use mysql not MongoDB is mongoDB query text do not support integer column.
      if you want search a number in MongoDB will fail. Because search text do not support in number column. Maybe PostGIS will do.


Sql server express has 10GB size limit. Mysql community version do not have limit.


Friday, December 4, 2015

cartodb windshaft-cartodb CartoDBConfig

cartodb local unlimited tables


CartoDBConfig
https://github.com/UCL-ShippingGroup/shipviz/wiki/CartoDBConfig
By default, the limit of rows in CartoDB is 500000. To set custom platform limits for a user you can use the set_custom_limits_for_user rake task :
rake cartodb:set_custom_limits_for_user[username,import_file_size,table_row_count,concurrent_imports] 
For the user "development" in my local CartoDB install, I've used the following:
rake cartodb:set_custom_limits_for_user[development,157286400000,10000000,10] 
Also executing rake -D from $HOME/cartodb, we can see the list of all rake tasks and a description of what they do:
parallels@ubuntu:~/cartodb/script$ rake -D
(in /home/parallels/cartodb)
rake about
    List versions of all Rails frameworks and the environment

rake assets:copy_non_digest_files
    Copy digest assets files to non-digest files

rake cartodb:blog:get_last_posts
    Get last posts

rake cartodb:cache:invalidate_surrogate_key[key]
    invalidate Varnish surrogate key

rake cartodb:common_data:generate_s3_assets[all_public]
    Generates datasets assets and upload them to Amazon S3

rake cartodb:db:add_test_users_to_organization[org_name,first_index,last_index]
    Add users to an organization. Used to resume a broken :create_test_organization task

rake cartodb:db:add_the_geom_webmercator
    Add the_geom_webmercator column to every table which needs it

rake cartodb:db:add_timezones_to_timestamps
    Add timezone to timestamp users columns

rake cartodb:db:change_user_password
    Set the password of the user in the USER_NAME environment variable to the value of the USER_PASSWORD environment variable

rake cartodb:db:cleanup_importer_tables
    Moves left-over tables from failed imports from the public to the cdb_importer schema

rake cartodb:db:copy_api_keys_from_redis
    Copy user api_keys from redis to postgres

rake cartodb:db:create_default_vis_permissions[page_size,page]
    Setup default permissions on existing visualizations

rake cartodb:db:create_importer_schema
    Create importer schema and assign privileges to owner

rake cartodb:db:create_new_organization_with_owner
    Create new organization with owner

rake cartodb:db:create_organization_members_public_users
    Create public users for users beloging to an organization

rake cartodb:db:create_publicuser
    make public and tile users

rake cartodb:db:create_test_organization[org_name,n_users]
    Create an organization with an arbitrary number of users for test purposes. Owner user: -admin. Users: -. You might need to set conn_validator_timeout to -1 in config/database.yml (development)

rake cartodb:db:create_user
    Create a plain user account

rake cartodb:db:drop_other_privileges_on_user_schema[username]
    Drop other users privileges on user schema

rake cartodb:db:enable_oracle_fdw_extension[username,oracle_url,remote_user,remote_password,remote_schema,table_definition_json_path]
    Enable oracle_fdw extension in database

rake cartodb:db:get_modified_layers
    get modified layers

rake cartodb:db:get_viewed_visualization_ids[redis_ip,output_file]
    Get from redis the list of visualization ids viewed

rake cartodb:db:grant_general_raster_permissions
    Grant general raster permissions

rake cartodb:db:load_api_calls_from_es
    Load api calls from ES to redis

rake cartodb:db:load_functions[database_host,version,num_threads,thread_sleep,sleep,statement_timeout]
    Install/upgrade CARTODB SQL functions

rake cartodb:db:load_oids
    Load table oids

rake cartodb:db:load_varnish_trigger[num_threads,thread_sleep,database_host,sleep]
    Install/upgrade Varnish invalidation trigger

rake cartodb:db:load_varnish_trigger_user[username]
    Install/upgrade Varnish trigger for a single user

rake cartodb:db:migrate_to[version]
    Runs the specified CartoDB migration script

rake cartodb:db:move_user_to_schema[username]
    Move user to its own schema

rake cartodb:db:populate_permission_entity_id[page_size,page]
    Check all visualizations and populate their Permission object's entity_id and entity_type

rake cartodb:db:populate_visualization_total_map_views[visualizations_list]
    Populate visualization total map views from partial days

rake cartodb:db:recreate_table_triggers[username]
    Recreates all table triggers for non-orgs users. Optionally you can pass a username param to do this only for one user. Example: cartodb:db:recreate_table_triggers['my_username']

rake cartodb:db:register_ghost_table[username,table_name]
    Link one ghost table to the user dashboard, does not remove the original table

rake cartodb:db:register_table_dependencies
    Rebuild user tables/layers join table

rake cartodb:db:reload_users_avatars
    Reload users avatars

rake cartodb:db:remove_duplicate_indexes[database_host,sleep,dryrun]
    Removes duplicated indexes created in some accounts

rake cartodb:db:reset_trigger_check_quota
    reset check quota trigger on all user tables

rake cartodb:db:reset_trigger_check_quota_for_user[username]
    reset check quota trigger for a given user

rake cartodb:db:rollback_migration[version]
    Undo migration changes USE WITH CARE

rake cartodb:db:save_users_metadata
    Save users metadata in redis

rake cartodb:db:set_all_user_privileges[username]
    Set all user privileges

rake cartodb:db:set_all_users_account_type_to_free
    reset all Users account type to FREE

rake cartodb:db:set_all_users_private_tables_enabled_to_false
    reset all Users privacy tables permissions type to false

rake cartodb:db:set_all_users_to_free_table_quota
    reset Users table quota to 5

rake cartodb:db:set_organization_quota[organization_name,quota_in_gb]
    set organization quota to amount in GB

rake cartodb:db:set_organization_seats[organization_name,seats]
    set organization seats

rake cartodb:db:set_permissions
    Set DB Permissions

rake cartodb:db:set_table_oids
    Sets table_ids for all table metadata recors

rake cartodb:db:set_unlimited_table_quota[username]
    set unlimited table quota

rake cartodb:db:set_user_account_type[username,account_type]
    Set users account type. DEDICATED or FREE

rake cartodb:db:set_user_as_organization_member
    Set organization member group role

rake cartodb:db:set_user_private_tables_enabled[username,private_tables_enabled]
    set users private tables enabled

rake cartodb:db:set_user_privileges_in_cartodb_schema[username]
    Set user privileges in CartoDB schema and CDB_TableMetadata

rake cartodb:db:set_user_quota[username,quota_in_mb]
    set users quota to amount in mb

rake cartodb:db:set_user_table_quota[username,table_quota]
    set users table quota

rake cartodb:db:setup
    Setup cartodb database and creates a new user from environment variables:
      - ENV['EMAIL']: user e-mail
      - ENV['PASSWORD']: user password
      - ENV['SUBDOMAIN']: user subdomain

rake cartodb:db:unregister_extraneous_cartodb_members[database_host,sleep,dryrun]
    Unregisters extraneous members from the "cartodb" extension

rake cartodb:db:unshare_all_entities[user]
    Unshare all entities for a given user

rake cartodb:db:update_cache_trigger
    update the old cache trigger which was using redis to the varnish one

rake cartodb:db:update_test_quota_trigger
    Update test_quota trigger

rake cartodb:db:update_the_geom_webmercator_trigger
    Update update_the_geom_webmercator_trigger

rake cartodb:db:update_timestamp_fields
    update created_at and updated_at to correct type and add the default value to now

rake cartodb:db:upgrade_postgres_extension[database_host,version,sleep,statement_timeout]
    Upgrade cartodb postgresql extension

rake cartodb:explore_api:drop
    Deletes the visualizations table

rake cartodb:explore_api:setup
    Creates visualizations at common-data user and loads the data for the very first time. This table contains an aggregated, desnormalized view of the public data at visualizations, and it's used by Explore API

rake cartodb:explore_api:update
    Updates the data at visualizations

rake cartodb:generate_random_csv
    Generates random CSV files in db/fake_data

rake cartodb:import[username,filepath]
    Import a file to CartoDB

rake cartodb:import_multitable_file
    Imports a multi-table file

rake cartodb:increase_limits_for_twitter_import_users
    Increase limits for twitter import users

rake cartodb:log:post_process_requests[input_file]
    Take an input with the format 'verb,request,respnse_time' and outputs 'verb,controller,action,response_time'

rake cartodb:overlays:create_overlays[clear_overlays]
    create overlays from url_options

rake cartodb:overlays:remove_duplicate_overlays
    removes duplicated overlays from visualizations

rake cartodb:prototypes:import_madrid_clubbing
    Generates data for Madrid Clubbing prototype

rake cartodb:random_table_with_lots_of_rows
    Create a table with thousands of random rows

rake cartodb:redis:purge_vizjson
    purge redis vizjson cache

rake cartodb:redis:user_metadata
    update redis with metadata for every user

rake cartodb:remotes:load_all[from_username]
    Load common data account remotes for multiple users, in alphabetical order. If you pass a username, it will do it beginning in the next username

rake cartodb:remotes:reload[username]
    Load common data account remotes. Pass username as first argument. Example: `rake cartodb:remotes:reload[development]`

rake cartodb:remotes:reload_org[org_name]
    Load common data account remotes for a whole organization. Pass organization name as first argument. Example: `rake cartodb:remotes:reload[my_team]`

rake cartodb:set_custom_limits_for_user[username,import_file_size,table_row_count,concurrent_imports]
    Set custom platform limits for a user

rake cartodb:setup_max_import_file_size_based_on_disk_quota
    Adapt max_import_file_size according to disk quota

rake cartodb:setup_max_import_table_row_count_based_on_disk_quota
    Adapt max_import_table_row_count according to disk quota

rake cartodb:sync_tables[force_all_arg]
    Runs the sync tables process

rake cartodb:upload_to_s3
    Uploads a single data import enqueued file to S3, triggering the normal flow afterwards

rake cartodb:users:update_remote_map_views
    Get map views from remote service for every user

rake cartodb:vizs:create_named_maps[order]
    Create named maps for all eligible existing visualizations

rake cartodb:vizs:delete_inconsistent[username]
    Purges broken visualizations due to bug during deletion.

rake dataimport:log:set_expiration
    Set expiration of DataImport logs to 2 days

rake db:create[env]
    Create the database defined in config/database.yml for the current Rails.env - also creates the test database if Rails.env.development?

rake db:create:all
    Create all the local databases defined in config/database.yml

rake db:drop[env]
    Create the database defined in config/database.yml for the current Rails.env - also creates the test database if Rails.env.development?

rake db:drop:all
    Drops all the local databases defined in config/database.yml

rake db:force_close_open_connections
    Forcibly close any open connections to the test database

rake db:forward
    Pushes the schema to the next version. Specify the number of steps with STEP=n

rake db:migrate
    Migrate the database to the latest version

rake db:migrate:down
    Runs the "down" for a given migration VERSION.

rake db:migrate:redo
    Rollbacks the database one migration and re migrate up. If you want to rollback more than one step, define STEP=x. Target specific version with VERSION=x.

rake db:migrate:reset
    Resets your database using your migrations for the current environment

rake db:migrate:up
    Runs the "up" for a given migration VERSION.

rake db:reset
    Drops and recreates the database from db/schema.rb for the current environment and loads the seeds.

rake db:rollback
    Rolls the schema back to the previous version. Specify the number of steps with STEP=n

rake db:schema:dump
    Create a db/schema.rb file that can be portably used against any DB supported by Sequel

rake db:schema:load
    Load a schema.rb file into the database

rake db:seed
    Load the seed data from db/seeds.rb

rake db:setup
    Create the database, load the schema, and initialize with the seed data

rake doc:app
    Generate docs for the app -- also available doc:rails, doc:guides, doc:plugins (options: TEMPLATE=/rdoc-template.rb, TITLE="Custom Title")

rake log:clear
    Truncates all *.log files in log/ to zero bytes

rake middleware
    Prints out your Rack middleware stack

rake notes
    Enumerate all annotations (use notes:optimize, :fixme, :todo for focus)

rake notes:custom
    Enumerate a custom annotation, specify with ANNOTATION=CUSTOM

rake rails:template
    Applies the template supplied by LOCATION=(/path/to/template) or URL

rake rails:update
    Update configs and some other initially generated files (or use just update:configs, update:scripts, or update:application_controller)

rake resque:clear
    Clear pending tasks

rake resque:failures:sort
    Sort the 'failed' queue for the redis_multi_queue failure backend

rake resque:stop_workers
    Quit running workers

rake resque:work
    Start a Resque worker

rake resque:workers
    Start multiple Resque workers. Should only be used in dev mode.

rake rollbar:test
    Verify your gem installation by sending a test exception to Rollbar

rake routes
    Print out all defined routes in match order, with names. Target specific controller with CONTROLLER=x.

rake secret
    Generate a cryptographically secure secret key (this is typically used to generate a secret for cookie sessions).

rake state_machine:draw
    Draws state machines using GraphViz (options: CLASS=User,Vehicle; FILE=user.rb,vehicle.rb [not required in Rails / Merb]; FONT=Arial; FORMAT=png; ORIENTATION=portrait / Draws state machines using GraphViz (options: CLASS=User,Vehicle; FILE=user.rb,vehicle.rb [not required in Rails / Merb]; FONT=Arial; FORMAT=png; ORIENTATION=portrait

rake stats
    Report code statistics (KLOCs, etc) from the application

rake time:zones:all
    Displays all time zones, also available: time:zones:us, time:zones:local -- filter with OFFSET parameter, e.g., OFFSET=-6

rake tmp:clear
    Clear session, cache, and socket files from tmp/ (narrow w/ tmp:sessions:clear, tmp:cache:clear, tmp:sockets:clear)

rake tmp:create
    Creates tmp directories for sessions, cache, sockets, and pids

rake user:query_api_key[username]
    Get the API key from a username

rake user:relocation:organize[username,new_organization]
    Relocate user to organization

rake user:relocation:relocate[username,new_database_host]
    Relocate user to another database_host




======================================================================
 "run fully" you specifically mean increase max tables, disk quota, account type, etc., see the commented out parts at the bottom of this script:
# Update your quota to 10GB
echo "--- Updating quota to 10GB"
bundle exec rake cartodb:db:set_user_quota["${SUBDOMAIN}",10240]
if test $? -ne 0; then exit 1; fi

# Allow unlimited tables to be created
echo "--- Allowing unlimited tables creation"
bundle exec rake cartodb:db:set_unlimited_table_quota["${SUBDOMAIN}"]
if test $? -ne 0; then exit 1; fi

# Allow user to create private tables in addition to public
echo "--- Allowing private tables creation"
bundle exec rake \
 cartodb:db:set_user_private_tables_enabled["${SUBDOMAIN}",'true']
if test $? -ne 0; then exit 1; fi

# Set the account type
echo "--- Setting cartodb account type"
bundle exec rake \
 cartodb:db:set_user_account_type["${SUBDOMAIN}",'[DEDICATED]']
if test $? -ne 0; then exit 1; fi
Run as a shell script or just paste into your console from the cartodb directory. First make sure SUBDOMAIN is set, or hardcode here.

Thursday, December 3, 2015

tilemill css

point
---------------------------------------------------------

Map {
  background-color: rgba(0,0,0,0);
}



#addresspoint {
  marker-width:6;
  marker-fill:#f45;
  marker-line-color:#813;
  marker-allow-overlap:true;
}
---------------------------------------------------------------------




polygon

===================
Map {
  background-color: rgba(0,0,0,0);
}



#cityparcels {
  line-color:#594;
  line-width:0.5;
  polygon-opacity:0;
  polygon-fill:#ae8;
}

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



line
+++++++++++++++


Map {
  background-color: rgba(0, 0, 0, 0);
}



#citystr {
  line-width:1;
  line-color:#168;
}

+++++++++++++++++++++

Wednesday, December 2, 2015

shape file shp geojson import mongodb




1)  install Chocolatey NuGet https://chocolatey.org/

     open cmd as admin, cd c:\

     copy and past after c:>

@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))" && SET PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin




2) install jq

      close and re-open cmd as admin

go to chocolatey folder by: 

cd C:\ProgramData\chocolatey

run

choco install jq --force -version 1.5


3)  go to where has geojson file

open cmd

cd C:\jh\other_map_geojson\Raw_geojson

run

jq --compact-output ".features[]" parcels.geojson > parcels0.geojson

parcels.geojson is input,  parcels0.geojson is output.




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

jq command CAN NOT do batch script, it error, not sure why, have to do one command by one command.

Some time jq error out, you have to do manually replace 


1) remove head and tail

2) remove last comma at each line.  by replace ]]]}, to ]]]},  point, line, polygon situation is different.
















==========================================================
import geojson to mongodb


Download jq (it's sed-like program but for JSON)
Then run:


jq --compact-output ".features[]" input.geojson > output.geojson


then


mongoimport --db dbname -c collectionname --file "output.geojson" --jsonArray






--jsonArray
Accepts the import of data expressed with multiple MongoDB documents within a single JSON array. Limited to imports of 16 MB or smaller.

If the file size larger than 16MB, you could do this
jq --compact-output ".features[]" input.geojson > output.geojson
This will give you exactly one line for one object, no comma at end.
{.....}
{.......}
{...}

{"type":"Feature","geometry":{"type":"Point","coordinates":[-80.87088507656375,35.21515162500578]},"properties":{"name":"ABBOTT NEIGHBORHOOD PARK","address":"1300  SPRUCE ST"}}
{"type":"Feature","geometry":{"type":"Point","coordinates":[-80.83775386582222,35.24980190252168]},"properties":{"name":"DOUBLE OAKS CENTER","address":"1326 WOODWARD AV"}}
{"type":"Feature","geometry":{"type":"Point","coordinates":[-80.83827000459532,35.25674709224663]},"properties":{"name":"DOUBLE OAKS NEIGHBORHOOD PARK","address":"2605  DOUBLE OAKS RD"}}
{"type":"Feature","geometry":{"type":"Point","coordinates":[-80.83697759172735,35.25751734669229]},"properties":{"name":"DOUBLE OAKS POOL","address":"1200 NEWLAND RD"}}
{"type":"Feature","geometry":{"type":"Point","coordinates":[-80.81647652154736,35.40148708491418]},"properties":{"name":"DAVID B. WAYMER FLYING REGIONAL PARK","address":"15401 HOLBROOKS RD"}}
{"type":"Feature","geometry":{"type":"Point","coordinates":[-80.83556459443902,35.39917224760999]},"properties":{"name":"DAVID B. WAYMER COMMUNITY PARK","address":"302 HOLBROOKS RD"}}
{"type":"Feature","geometry":{"type":"Polygon","coordinates":[[[-80.72487831115721,35.26545403190955],[-80.72135925292969,35.26727607954368],[-80.71517944335938,35.26769654625573],[-80.7125186920166,35.27035945142482],[-80.70857048034668,35.268257165144064],[-80.70479393005371,35.268397319259996],[-80.70324897766113,35.26503355355979],[-80.71088790893555,35.2553619492954],[-80.71681022644043,35.2553619492954],[-80.7150936126709,35.26054831539319],[-80.71869850158691,35.26026797976481],[-80.72032928466797,35.26061839914875],[-80.72264671325684,35.26033806376283],[-80.72487831115721,35.26545403190955]]]},"properties":{"name":"Plaza Road Park"}}
mongoimport --db dbname -c collectionname --file "output.geojson" --jsonArray










----------------------------------------------------------------------------------------------------------------
this worked:
mongoimport --db mean-dev -c points --file "points.geojson" --jsonArray

Let me save you the hours lost in trying to figure out getting GeoJSON features into individual documents in a collection versus one document with nested features.
MongoDB 3.0.2. Valid GeoJSON file full of 809 features.
Using this code:
mongoimport --db test --type json --file ./'mobilemaps.geojson' 
I was able to create one document in the collection named 'mobilemaps'. That single document had all the features (points and descriptive data) correclty imported.
But, I wanted a collection of documents. I'm new to MongoDB, so I'm studying and thought that might work better for my needs. Could not figure out how to get a successful import. I had read about pulling out the surrounding object and array tags:
{
  "type": "FeatureCollection",
    "features": [
...
   ]
}
The cleaned file then generated errors upon import due to the comma between features. 
So, I created a file with my feature collection, stripped off the surrounding tags. 
Then I did a search and replace:
}
 },
{
replace (e.g., remove the comma and add a new line)
}
 }
{
Running mongoimport on the resulting file gave me 809 documents in the collection. 
=====================================================================

Right now you have an array of features. MongoDB will consider this to be one document. Try deleting the following from the beginning of your geojson:
{
"type": "FeatureCollection",
"features": [
Also, delete the following from the end of your geojson:
]
}
EDIT - Also, mongo expects one document per line. So make sure that your only \n is between documents! e.g.
...    
},\n
    {
        "type": "Feature",
        "id": "node/2664472516",
...

Tuesday, December 1, 2015

IIS error

HTTP Error 500.19 - Internal Server Error

remove name="ExtensionlessUrlHandler-Integrated-4.0"


There are two things to check that you have appropriate installed .Net. And also the following configurations are checked.
enter image description here




===========================================================
Handler "ExtensionlessUrlHandler-Integrated-4.0" has a bad module "ManagedPipelineHandler" in its module list

if you have 64-bit operation system use Framework64 instead of Framework in path:
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -i

Run these commands:
c:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i
c:\Windows\Microsoft.NET\Framework64\v4.0.30319\aspnet_regiis.exe -I

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.