Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename Monetization.java to Monetization.java..usagw #11751

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Jan 9, 2023

  1. Rename Monetization.java to Monetization.java..usagw

    Tags
    Users
    Companies
    COLLECTIVES
    Google Cloud
    Twilio
    TEAMS
    Create free Team
    SQL Server replication using FTP
    Asked 10 years, 6 months ago
    Modified 4 years, 10 months ago
    Viewed 4k times
    
    Report this ad
    
    4
    
    
    I have: SQL A - publisher (SQL 2008 R2 Dev) SQL B - subscriber (SQL 2008 R2 Standard)
    
    SQL A and SQL B are on different networks, not direct connection is allowed.
    
    I enable FTP publishing on SQL A. Created subscription on SQL B to get files from FTP.
    
    But for some reason when I ran agent on SQL B it gives an error can't connect to SQL A. Uhmm, duh? Of course because it is FTP replication, there is no connection.
    
    What am I doing wrong?
    
    -- THIS IS ON PUBLISHER:
    -- Enabling the replication database
    use master
    exec sp_replicationdboption @dbname = N'Publisher_DB', @optname = N'publish', @value = N'true'
    GO
    
    exec [Publisher_DB].sys.sp_addlogreader_agent @job_login = null, @job_password = null, @publisher_security_mode = 1
    GO
    exec [Publisher_DB].sys.sp_addqreader_agent @job_login = null, @job_password = null, @frompublisher = 1
    GO
    -- Adding the snapshot publication
    use [Publisher_DB]
    exec sp_addpublication @Publication = N'Test_S', @description = N'Snapshot publication of database ''Publisher_DB'' from Publisher ''SQL-A''.', @sync_method = N'native', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true', @enabled_for_internet = N'true', @snapshot_in_defaultfolder = N'false', @alt_snapshot_folder = N'\\SQL-A\D$\SqlReplica', @compress_snapshot = N'true', @ftp_address = N'SQL-A', @ftp_port = 21, @ftp_subdirectory = N'\\SQL-A\D$\SqlReplica', @ftp_login = N'anonymous', @allow_subscription_copy = N'true', @add_to_active_directory = N'false', @repl_freq = N'snapshot', @status = N'active', @independent_agent = N'true', @immediate_sync = N'true', @allow_sync_tran = N'false', @autogen_sync_procs = N'false', @allow_queued_tran = N'false', @allow_dts = N'false', @replicate_ddl = 1
    GO    
    
    exec sp_addpublication_snapshot @Publication = N'Test_S', @frequency_type = 1, @frequency_interval = 0, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = null, @job_password = null, @publisher_security_mode = 1
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'sa'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'NT AUTHORITY\SYSTEM'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'NT AUTHORITY\NETWORK SERVICE'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'DOMAIN\Developers & Test Admins'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'distributor_admin'
    GO
    
    -- Adding the snapshot articles
    use [Publisher_DB]
    exec sp_addarticle @Publication = N'Test_S', @Article = N'test_table', @source_owner = N'dbo', @source_object = N'test_table', @type = N'logbased', @description = N'', @creation_script = N'', @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N'none', @destination_table = N'test_table', @destination_owner = N'dbo', @status = 24, @vertical_partition = N'false', @ins_cmd = N'SQL', @del_cmd = N'SQL', @upd_cmd = N'SQL'
    GO
    
    -- Adding the snapshot subscriptions
    use [Publisher_DB]
    exec sp_addsubscription @Publication = N'Test_S', @subscriber = N'SQL-B', @destination_db = N'Publisher_DB', @subscription_type = N'Pull', @sync_type = N'automatic', @Article = N'all', @update_mode = N'read only', @subscriber_type = 0
    GO
    
    -----------------BEGIN: Script to be run at Publisher 'SQL-A'---------------
    use [Publisher_DB]
    exec sp_addsubscription @Publication = N'Test_S', @subscriber = N'SQL-B', @destination_db = N'Publisher_DB', @sync_type = N'Automatic', @subscription_type = N'pull', @update_mode = N'read only'
    GO
    -----------------END: Script to be run at Publisher 'SQL-A'-----------------       
    
    -----------------BEGIN: Script to be run at Subscriber 'SQL-A'--------------
    use [Publisher_DB]
    exec sp_addpullsubscription @publisher = N'SQL-A', @Publication = N'Test_S', @publisher_db = N'Publisher_DB', @independent_agent = N'True', @subscription_type = N'pull', @description = N'', @update_mode = N'read only', @immediate_sync = 1
    
    exec sp_addpullsubscription_agent @publisher = N'SQL-A', @publisher_db = N'Publisher_DB', @Publication = N'Test_S', @distributor = N'SQL-B', @distributor_security_mode = 1, @distributor_login = N'', @distributor_password = null, @enabled_for_syncmgr = N'False', @frequency_type = 64, @frequency_interval = 0, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 20120622, @active_end_date = 99991231, @alt_snapshot_folder = N'\\SQL-B\D$\SqlReplica\ftp', @working_directory = N'\\SQL-B\D$\SqlReplica\ftp', @use_ftp = N'False', @job_login = null, @job_password = null, @publication_type = 0
    GO
    -----------------END: Script to be run at Subscriber 'SQL-A'---------------
    Tags
    Users
    Companies
    COLLECTIVES
    Google Cloud
    Twilio
    TEAMS
    Create free Team
    SQL Server replication using FTP
    Asked 10 years, 6 months ago
    Modified 4 years, 10 months ago
    Viewed 4k times
    
    Report this ad
    
    4
    
    
    I have: SQL A - publisher (SQL 2008 R2 Dev) SQL B - subscriber (SQL 2008 R2 Standard)
    
    SQL A and SQL B are on different networks, not direct connection is allowed.
    
    I enable FTP publishing on SQL A. Created subscription on SQL B to get files from FTP.
    
    But for some reason when I ran agent on SQL B it gives an error can't connect to SQL A. Uhmm, duh? Of course because it is FTP replication, there is no connection.
    
    What am I doing wrong?
    
    -- THIS IS ON PUBLISHER:
    -- Enabling the replication database
    use master
    exec sp_replicationdboption @dbname = N'Publisher_DB', @optname = N'publish', @value = N'true'
    GO
    
    exec [Publisher_DB].sys.sp_addlogreader_agent @job_login = null, @job_password = null, @publisher_security_mode = 1
    GO
    exec [Publisher_DB].sys.sp_addqreader_agent @job_login = null, @job_password = null, @frompublisher = 1
    GO
    -- Adding the snapshot publication
    use [Publisher_DB]
    exec sp_addpublication @Publication = N'Test_S', @description = N'Snapshot publication of database ''Publisher_DB'' from Publisher ''SQL-A''.', @sync_method = N'native', @retention = 0, @allow_push = N'true', @allow_pull = N'true', @allow_anonymous = N'true', @enabled_for_internet = N'true', @snapshot_in_defaultfolder = N'false', @alt_snapshot_folder = N'\\SQL-A\D$\SqlReplica', @compress_snapshot = N'true', @ftp_address = N'SQL-A', @ftp_port = 21, @ftp_subdirectory = N'\\SQL-A\D$\SqlReplica', @ftp_login = N'anonymous', @allow_subscription_copy = N'true', @add_to_active_directory = N'false', @repl_freq = N'snapshot', @status = N'active', @independent_agent = N'true', @immediate_sync = N'true', @allow_sync_tran = N'false', @autogen_sync_procs = N'false', @allow_queued_tran = N'false', @allow_dts = N'false', @replicate_ddl = 1
    GO    
    
    exec sp_addpublication_snapshot @Publication = N'Test_S', @frequency_type = 1, @frequency_interval = 0, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 0, @active_end_date = 0, @job_login = null, @job_password = null, @publisher_security_mode = 1
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'sa'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'NT AUTHORITY\SYSTEM'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'NT AUTHORITY\NETWORK SERVICE'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'DOMAIN\Developers & Test Admins'
    GO
    exec sp_grant_publication_access @Publication = N'Test_S', @login = N'distributor_admin'
    GO
    
    -- Adding the snapshot articles
    use [Publisher_DB]
    exec sp_addarticle @Publication = N'Test_S', @Article = N'test_table', @source_owner = N'dbo', @source_object = N'test_table', @type = N'logbased', @description = N'', @creation_script = N'', @pre_creation_cmd = N'drop', @schema_option = 0x000000000803509D, @identityrangemanagementoption = N'none', @destination_table = N'test_table', @destination_owner = N'dbo', @status = 24, @vertical_partition = N'false', @ins_cmd = N'SQL', @del_cmd = N'SQL', @upd_cmd = N'SQL'
    GO
    
    -- Adding the snapshot subscriptions
    use [Publisher_DB]
    exec sp_addsubscription @Publication = N'Test_S', @subscriber = N'SQL-B', @destination_db = N'Publisher_DB', @subscription_type = N'Pull', @sync_type = N'automatic', @Article = N'all', @update_mode = N'read only', @subscriber_type = 0
    GO
    
    -----------------BEGIN: Script to be run at Publisher 'SQL-A'---------------
    use [Publisher_DB]
    exec sp_addsubscription @Publication = N'Test_S', @subscriber = N'SQL-B', @destination_db = N'Publisher_DB', @sync_type = N'Automatic', @subscription_type = N'pull', @update_mode = N'read only'
    GO
    -----------------END: Script to be run at Publisher 'SQL-A'-----------------       
    
    -----------------BEGIN: Script to be run at Subscriber 'SQL-A'--------------
    use [Publisher_DB]
    exec sp_addpullsubscription @publisher = N'SQL-A', @Publication = N'Test_S', @publisher_db = N'Publisher_DB', @independent_agent = N'True', @subscription_type = N'pull', @description = N'', @update_mode = N'read only', @immediate_sync = 1
    
    exec sp_addpullsubscription_agent @publisher = N'SQL-A', @publisher_db = N'Publisher_DB', @Publication = N'Test_S', @distributor = N'SQL-B', @distributor_security_mode = 1, @distributor_login = N'', @distributor_password = null, @enabled_for_syncmgr = N'False', @frequency_type = 64, @frequency_interval = 0, @frequency_relative_interval = 0, @frequency_recurrence_factor = 0, @frequency_subday = 0, @frequency_subday_interval = 0, @active_start_time_of_day = 0, @active_end_time_of_day = 235959, @active_start_date = 20120622, @active_end_date = 99991231, @alt_snapshot_folder = N'\\SQL-B\D$\SqlReplica\ftp', @working_directory = N'\\SQL-B\D$\SqlReplica\ftp', @use_ftp = N'False', @job_login = null, @job_password = null, @publication_type = 0
    GO
    -----------------END: Script to be run at Subscriber 'SQL-A'---------------
    sql-server-2008replicationpublishersubscriber
    carbon-apimgt/APIAuthenticationHandler.java at master - GitHub
    https://github.com › wso2 › gateway › handlers › securityself.topRightGameStatePublished var topLeftGameState: GameState = .notReady
    @Published var topRightGameState: GameState = .notReady
    @Published var bottomLeftGameState: GameState = .notReady
    
    private let timerPublisher = Timer.publish(every: 0.01, on: .main, in: .common)    
    // ...
     timerPublisher.autoconnect().sink(receiveValue: { currentDate in
            switch self.globalGameState {
            case .running(startDate: let startDate):
                let elapsedTime = currentDate - startDate
                if self.topLeftGameState == .ready { //,   {
                    self.topLeftGameState = .running(elapsedTime: elapsedTime.timeInterval)
                }
                if case .running(elapsedTime: _) = self.topLeftGameState {
                    self.topLeftGameState = .running(elapsedTime: elapsedTime.timeInterval)
                }
                
                if self.topRightGameState == .ready { //,   {
                    self.topRightGameState = .running(elapsedTime: elapsedTime.timeInterval)
                }
                if case .running(elapsedTime: _) = self.topRightGameState {
                    self.topRightGameState = .running(elapsedTime: elapsedTime.timeInterval)
                }
                
                if self.bottomLeftGameState == .ready { //,   {
                    self.bottomLeftGameState = .running(elapsedTime: elapsedTime.timeInterval)
                }
                if case .running(elapsedTime: _) = self.bottomLeftGameState {
                    self.bottomLeftGameState = .running(elapsedTime: elapsedTime.timeInterval)
                }
            default: ()
            }
        }).store(in: &cancellables)
    So this code looks really ugly and I would like to write a function for all the @Published variables:
    
        addTimePublisher(for: topLeftGameState)
        addTimePublisher(for: topRightGameState)
            //...
        private func addTimePublisher(for gameState: Published<GameState>.Publisher) {
            timerPublisher.autoconnect().sink(receiveValue: { currentDate in
                switch self.globalGameState {
                case .running(startDate: let startDate):
                    let elapsedTime = currentDate - startDate
                    if self.gameState == .ready {
                        self.gameState = .running(elapsedTime: elapsedTime.timeInterval)
                    }
                    if case .running(elapsedTime: _) = self.gameState {
                        self.gameState = .running(elapsedTime: elapsedTime.timeInterval)
                    }
                    
                default: ()
                }
                print(currentDate)
            }).store(in: &cancellables)
        }
    This throw an error: Cannot infer contextual base in reference to member 'ready'
    
    I do not know how to get the appropriate value from the publisher? Does anyone have any advice for me?
    
    Edit: How can I write a function and pass @Published variables?
    
    swiftuipublisher
    Share
    Edit
    Follow
    edited Oct 29, 2020 at 5:00
    asked Oct 28, 2020 at 16:51
    kuzdu's user avatar
    kuzdu
    6,83111 gold badge4949 silver badges6464 bronze badges
    It would make more sense to inject the entire viewModel with the published property as an EnvironmentObject rather than trying to pass in individual @Published properties. – 
    Andy Ibanez
     Oct 28, 2020 at 18:52
    Unclear to me what you're doing. What does "connected to the timerPublisher" mean? How and where are you attempting to call addTimePublisher and where is all of this happening - in the same view model? You might be asking an X-Y question. But to answer your last question - to get the value from a publisher you need to subscribe to (with .sink, just like you did with the timer publisher). I'm guessing that's not what you actually need – 
    New Dev
     Oct 28, 2020 at 20:38
    I'm sorry, I updated my question. – 
    kuzdu
     Oct 29, 2020 at 5:00
    Add a [email protected]:wso2/carbon-apimgt.gitgit@github.combe51160b94f5cb2d5c819a36800d5c1f81e24dd2
    sql-server-2008replicationpublishersubscriber
    Camille0183 committed Jan 9, 2023
    Configuration menu
    Copy the full SHA
    cd52bb5 View commit details
    Browse the repository at this point in the history