Tag Archives: go

Go Language compilation and installation protobuf: protoc-gen-go: program not found or is not executable

 

1.Introduction to protobuf

Google protocol buffer (hereinafter referred to as protocol buffer) is a mixed language data standard in Google company. At present, there are more than 48162 message format definitions and more than 12183. Proto files in use. They are used in RPC systems and continuous data storage systems

Protocol buffers is a portable and efficient structured data storage format, which can be used for the serialization of structured data. It is very suitable for data storage or RPC data exchange format. It is a language independent, platform independent and extensible serialization data format that can be used in communication protocol, data storage and other fields. At present, C + +, Java and python APIs are provided

2. When installing proto Gen go, configure the environment first and then download, otherwise the executable program proto cannot be downloaded; The error is as follows:

protoc-gen-go: program not found or is not executable

1.gedit ~/.bashrc

export PATH = “PATH:$GOPATH/bin”($GOPATH:/opt/gopath)

2.source ~/.bashrc

3.Go get – u GitHub. COM/golang/protobuf/proto
go get – u GitHub. COM/golang/protobuf/proto Gen go

4. Recompile the prototype file to succeed

3.Compile the proto file to generate the pb.go file: proto — go_ Out =. *. Proto (Note: * refers to the target file name)

VMware Workstation and Device/Credential Guard are not compatible

VMware Workstation and Device/Credential Guard are not compatible. VMware Workstation can be run after disabling Device/Credential Guard. ” error might be familiar with the VMware workstation users.

I ran in to this problem while I was starting to use my VMware workstation 14 pro on Windows 10 and it was throwing this error when I’m booting up the Virtual Machine. Actually, it was giving the direct VMware Knowledge base article to follow the steps to resolve it. But I thought to write this up to help all those who look for a step guide to fix the error.

This was the appeared error message in my Virtual Machine.

VMware Workstation and Device/Credential Guard are not compatible. VMware Workstation can be run after disabling Device/Credential Guard. Please Visithttp://www.vmware.com/go/turnoff CG DGfor more details.

I had to disable the Device/Credential Guard in my local group policy and I opened a “run” prompt by pressingWin Key + Rand typed ”gpedit.msc” to open the local group policy editor.

Once it opened up the Local group policy editor, navigate to ”Local Computer Policy &> Computer Configuration &> Administrative Templates &> System &> Device Guard” and open the ”Turn on Virtualization Based Security” setting by double click on it.

Set the setting to ”Disabled

Opened a Command Prompt elevating the “Administrative Privileges” and run the below piece of command

1

2

3

4

5

6

7

8

mountvol X: /s

copy %WINDIR%\System32\SecConfig.efi X:\EFI\Microsoft\Boot\SecConfig.efi /Y

bcdedit /create {0cb3b571-2f2e-4343-a879-d86a476d7215} /d “DebugTool” /application osloader

bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} path “\EFI\Microsoft\Boot\SecConfig.efi”

bcdedit /set {bootmgr} bootsequence {0cb3b571-2f2e-4343-a879-d86a476d7215}

bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} loadoptions DISABLE-LSA-ISO,DISABLE-VBS

bcdedit /set {0cb3b571-2f2e-4343-a879-d86a476d7215} device partition=X:

mountvol X: /d

This
X:should be an unused drive and if it is in use make sure to use another drive letter which is not in use.

Hyper-V role was not installed on my system, if it is installed make sure to disable it before you restart.

Rebooted the Computer and at the login screen it prompted to accept the change and pressed F3 and Operating system loaded without issues, after that my Virtual Machine started correctly.

5

1

4.6(92.73%)11votes

remove-weknow-ac from mac chrome

refer:https://macreports.com/how-to-remove-weknow-ac-malware-macos/

1-Remove the weknow.ac profile. Here is how:

On your Mac, openSystem Preferences(click the System Preferences icon in the dock)

ClickProfiles

SelectAdminPrefs

Delete this profile (AdminPrefs) by pressing the minus icon.

Now delete search engine settings:

Chrome: chrome://settings/searchEngines

Safari: Safari &> Preferences &> Search

2-Delete weknow.ac. Remove anything weknow.ac related. Remove anything suspicious apps to the Trash folder. Look for recently added apps.

Open the Applications folder

Delete Weknow.ac or Weknow.ac.app also look for“MPlayerX”,“NicePlayer”. Look for suspicious apps.

Empty Trash

3-Remove the weknow addon

Safari: Safari &> Preferences &> Extensions &> Locate the weknow.ac extension and remove it

Google Chrome: Go tochrome://extensions/ and find the weknow.ac addon and remove it.

Firefox: Go toabout:addons and remove the addon.

4-Delete weknow files:

Go &> Go to Folder (or press Shift + Cmd + G)

Enter/Library/LaunchAgentsand click Go

Look for suspicious files such as“installmac.AppRemoval.plist”, “myppes.download.plist”, “mykotlerino.ltvbit.plist”, “kuklorest.update.plist”. Some other names you should look for Genieo, Inkeeper, InstallMac, CleanYourMac, MacKeeper, SoftwareUpdater, MplayerX, NicePlayer, installmac.AppRemoval.plist”, “myppes.download.plist”, “mykotlerino.ltvbit.plist”, “kuklorest.update.plist, com.aoudad.net-preferences.plist”, “com.myppes.net-preferences.plist”, “com.kuklorest.net-preferences.plist”, “com.avickUpd.plist”. If you see any of them, drag them to the Trash folder and then empty Trash.

And now repeat the same process on the following folders:

/Library/Application Support

/Library/LaunchDaemons

5-If your browser is Chrome, follow the steps below to change some Chrome policies, if you are still having the problem:

Open theTerminal app(Go &> Utilities &> Terminal or press Command+Space and search Terminal)

Enter the commands below, hit Enter after each

defaults write com.google.Chrome HomepageIsNewTabPage -bool false
defaults write com.google.Chrome NewTabPageLocation -string "https://www.google.com/"
defaults write com.google.Chrome HomepageLocation -string "https://www.google.com/"
defaults delete com.google.Chrome DefaultSearchProviderSearchURL
defaults delete com.google.Chrome DefaultSearchProviderNewTabURL
defaults delete com.google.Chrome DefaultSearchProviderName

3.Restart Chrome

Please note that the developers behind weknow.ac are very sneaky and they will likely further develop this malware so this means that those tips may not work in near future. We will try to keep updating this posts.

find appname and plist ,just like

find . -name “*” |grep -i UtilityOSDaemon

then delete all these files ;

source:https :// macreports.com/how -to-remove-weknow-ac-malware-macos/

“ weknow.ac ”A set of chrome policies will be changed to set up a new default home page, new tag behavior, etc. You can enter it in the address bar chrome://policy/ To see the current chrome policy. If you are infected, it should be very obvious, because we will show you about six policies that you know to change.

At this point, all we have to do is to use the command line to delete/modify the affected policies:
1, you need to open the “terminal” application.
2. Copy the following code to the terminal one by one, (add a [space] in the middle of each code) and press enter

defaults write com.google.Chrome HomepageIsNewTabPage -bool false
defaults write com.google.Chrome NewTabPageLocation -string "[https://www.google.com/](https://www.google.com/)"
defaults write com.google.Chrome HomepageLocation -string "[https://www.google.com/](https://www.google.com/)" defaults delete com.google.Chrome DefaultSearchProviderSearchURL defaults delete com.google.Chrome DefaultSearchProviderNewTabURL defaults delete com.google.Chrome DefaultSearchProviderName 

3,21551;”Chrome25913;” 25165;”25928;

38142; 25509b; http://www.jianshu.com

Android WebView monitors and rewrites window.history.go (- 1) method call


import android.annotation.SuppressLint;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.text.TextUtils;
import android.webkit.WebView;
import android.webkit.WebViewClient;

/**
 * Created by  on 2019/2/22.
 * desc:Make the webview support window.history.go()
 * Replace the history.go() method in js with webview.goBack
 */
public class WebViewGoBackSupport {

    /**
     * Custom, links loaded when history.go is called by js to listen for history.go method calls
     */
    private final static String CONSTANTS_GO_BACK = "/CONSTANTS_GO_BACK#";
    /**
     * Methods to call back when the webview fails to return
     */
    @Nullable
    private Runnable whenCannotGoBackRunnable;
    @NonNull
    private WebView webview;

    /**
     * @param whenCannotGoBackRunnable Methods to call back when there is no previous page and history.go is called by js
     */
    @SuppressLint("SetJavaScriptEnabled")
    public WebViewGoBackSupport(@NonNull WebView webview, @Nullable Runnable whenCannotGoBackRunnable) {
        this.webview = webview;
        this.whenCannotGoBackRunnable = whenCannotGoBackRunnable;
        this.webview.getSettings().setJavaScriptEnabled(true);
    }

    /**
     * @param whenCannotGoBackRunnable Method to call back when there is no previous page and js calls history.go
     * @param defaultClient when true, no need to call it manually onPageFinished、shouldOverrideUrlLoading
     */
    public WebViewGoBackSupport(@NonNull WebView webview, @Nullable Runnable whenCannotGoBackRunnable, boolean defaultClient) {
        this(webview, whenCannotGoBackRunnable);
        if (defaultClient) {
            webview.setWebViewClient(new WebViewClient() {
                @Override
                public void onPageFinished(WebView view, String url) {
                    WebViewGoBackSupport.this.onPageFinished(url);
                    super.onPageFinished(view, url);
                }

                @Override
                public boolean shouldOverrideUrlLoading(WebView view, String url) {
                    WebViewGoBackSupport.this.shouldOverrideUrlLoading(url);
                    return super.shouldOverrideUrlLoading(view, url);
                }
            });
        }
    }

    /**
     * Called in the corresponding method of WebViewClient
     * Note: This method needs to be called manually, or use defaultClient == true
     */
    public void onPageFinished(String url) {
        //Rewrite js page window.history.go method
        String script = "javascript:(function(){window.history.go = function(index){" +
                "window.location.href='" + CONSTANTS_GO_BACK + "'+index;" +
                "}})()";
        webview.loadUrl(script);
    }

    /**
     * Called in the corresponding method of WebViewClient
     * Note: This method needs to be called manually, or use defaultClient == true
     */
    public void shouldOverrideUrlLoading(String url) {
        if (!TextUtils.isEmpty(url) && url.contains(CONSTANTS_GO_BACK)) {
            int step = -1;
            try {
                //Parsing the parameters passed in when js calls history.go
                step = Integer.parseInt(url.split("#")[1]);
            } catch (Exception e) {
                e.printStackTrace();
            }
            if (webview.canGoBackOrForward(step)) {
                webview.goBackOrForward(step);
            } else if (whenCannotGoBackRunnable != null) {
                //Callback method when there is no previous page and history.go is called by js
                whenCannotGoBackRunnable.run();
            }
        }
    }
}

When you install the software, you encounter a bullet box, and the Windows Installer coordinator is stuck in this bullet box all the time

 

Sometimes when you install software, you got stuck at window which says “Windows InstallerCoordinator”
There is easy fix for this, which involves changing setting of Group Policy.

To disable this group policy you need to perform these steps:
1 ) Log on to the system with a User that has Administrative Privileges
2 ) Open the Windows Control Panel
3 ) Perform a search for Group Policy
4 ) The search results should display a link to the “Local Group Policy Editor”
5 ) Once inside the editor, go to:

Computer Configuration

Administrative Templates

Windows Components

Remote Desktop Services

Remote Desktop Session Host

Application Compatibility

6 ) In the right pane, right click on ‘Turn off Windows Installer RDS Compatibility” and select Edit from the drop down menu
7 ) Select the Radio Button labeled ‘Enable’
8 ) Click OK

Eact Native Generate APP: You have not accepted the license agreements of the following SDK components:

1、 Error information

* What went wrong:
A problem occurred configuring project ':app'.
&> You have not accepted the license agreements of the following SDK components:
  [Android SDK Build-Tools 26.0.3, Android SDK Platform 26].
  Before building your project, you need to accept the license agreements and complete the installation of the missing components using the Android Studio SDK Manager.
  Alternatively, to learn how to transfer the license agreements from one workstation to another, go to http://d.android.com/r/studio-ui/export-licenses.html

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

2、 Cause of error

Starting from Android gradle plugin 2.2.0, gradle will automatically load the required SDK and build tools. However, because it does not accept the license, the loading dependency is terminated.

3、 Solutions

(1) Find your own Android SDK location and enter the tools/bin directory

(2) Open CMD (do not use any other one) and enter the above directory

(3) Enter the following command

sdkmanager.bat --licenses

(4) After input, a lot of things will pop up. We just need to write y in all of them

(5) Success tips

SQL statements generated by SQL compare

Creating tables and primary keys
Determining whether a table exists
OBJECT_ID

Determine if the primary key exists

SELECT 1 FROM sys.indexes WHERE name = N’PK_LISA_NoUseWebpartReplacement’ AND object_id = OBJECT_ID(N'[dbo].[LISA_NoUseWebpartReplacement]’)

/*
Run this script on a database with the schema represented by:

        WASYGSHA01-1020\SQL2014.Test    -  This database will be modified. The scripts folder will not be modified.

to synchronize it with a database with the schema represented by:

        WASYGSHA01-1020\SQL2014.Test

You are recommended to back up your database before running this script

Script created by SQL Compare version 13.4.5.6953 from Red Gate Software Ltd at 11/13/2018 5:18:41 PM

*/
SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL Serializable
GO
BEGIN TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
PRINT N'Creating [dbo].[LISA_NoUseWebpartReplacement]'
GO
IF OBJECT_ID(N'[dbo].[LISA_NoUseWebpartReplacement]', 'U') IS NULL
CREATE TABLE [dbo].[LISA_NoUseWebpartReplacement]
(
[Id] [int] NOT NULL,
[Category] [nvarchar] (255) NULL,
[WebpartCode] [nvarchar] (255) NOT NULL,
[WebpartName] [nvarchar] (255) NULL,
[WebpartFile] [nvarchar] (255) NULL,
[Replacement] [nvarchar] (255) NULL
)
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
PRINT N'Creating primary key [PK_LISA_NoUseWebpartReplacement] on [dbo].[LISA_NoUseWebpartReplacement]'
GO
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name = N'PK_LISA_NoUseWebpartReplacement' AND object_id = OBJECT_ID(N'[dbo].[LISA_NoUseWebpartReplacement]'))
ALTER TABLE [dbo].[LISA_NoUseWebpartReplacement] ADD CONSTRAINT [PK_LISA_NoUseWebpartReplacement] PRIMARY KEY CLUSTERED  ([WebpartCode])
GO
IF @@ERROR <&> 0 SET NOEXEC ON
GO
COMMIT TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
-- This statement writes to the SQL Server Log so SQL Monitor can show this deployment.
IF HAS_PERMS_BY_NAME(N'sys.xp_logevent', N'OBJECT', N'EXECUTE') = 1
BEGIN
    DECLARE @databaseName AS nvarchar(2048), @eventMessage AS nvarchar(2048)
    SET @databaseName = REPLACE(REPLACE(DB_NAME(), N'\', N'\\'), N'"', N'\"')
    SET @eventMessage = N'Redgate SQL Compare: { "deployment": { "description": "Redgate SQL Compare deployed to ' + @databaseName + N'", "database": "' + @databaseName + N'" }}'
    EXECUTE sys.xp_logevent 55000, @eventMessage
END
GO
DECLARE @Success AS BIT
SET @Success = 1
SET NOEXEC OFF
IF (@Success = 1) PRINT 'The database update succeeded'
ELSE BEGIN
    IF @@TRANCOUNT &> 0 ROLLBACK TRANSACTION
    PRINT 'The database update failed'
END
GO

Create stored procedure

First determine whether the stored procedure exists, if it exists, drop it first, and then create it. If it doesn’t exist, create it directly

/*
Run this script on a database with the schema represented by:

        WASYGSHA01-1020\SQL2014.Test    -  This database will be modified. The scripts folder will not be modified.

to synchronize it with a database with the schema represented by:

        WASYGSHA01-1020\SQL2014.Test

You are recommended to back up your database before running this script

Script created by SQL Compare version 13.6.3.8160 from Red Gate Software Ltd at 11/14/2018 11:11:52 AM

*/
SET NUMERIC_ROUNDABORT OFF
GO
SET ANSI_PADDING, ANSI_WARNINGS, CONCAT_NULL_YIELDS_NULL, ARITHABORT, QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
SET XACT_ABORT ON
GO
SET TRANSACTION ISOLATION LEVEL Serializable
GO
BEGIN TRANSACTION
GO
IF @@ERROR <&> 0 SET NOEXEC ON
GO
PRINT N'Dropping [dbo].[pi_NoUseWebpartReplacement]'
GO
IF OBJECT_ID(N'[dbo].[pi_NoUseWebpartReplacement]', 'P') IS NOT NULL
DROP PROCEDURE [dbo].[pi_NoUseWebpartReplacement]
GO
IF @@ERROR <&> 0 SET NOEXEC ON
GO
PRINT N'Creating [dbo].[pi_NoUseWebpartReplacement]'
GO
IF OBJECT_ID(N'[dbo].[pi_NoUseWebpartReplacement]', 'P') IS NULL
EXEC sp_executesql N'-- =============================================
-- Author:        Chuck Lu
-- Create date: 2018-11-14
-- Description:    
-- =============================================
CREATE PROCEDURE [dbo].[pi_NoUseWebpartReplacement]
    -- Add the parameters for the stored procedure here
    @Id INT ,
    @Category NVARCHAR(255) ,
    @WebpartCode NVARCHAR(255) ,
    @WebpartName NVARCHAR(255) ,
    @WebpartFile NVARCHAR(255) ,
    @Replacement NVARCHAR(255)
AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.
        SET NOCOUNT ON;
        IF EXISTS (   SELECT 1
                      FROM   dbo.LISA_NoUseWebpartReplacement
                      WHERE  WebpartCode = @WebpartCode )
            BEGIN
                UPDATE dbo.LISA_NoUseWebpartReplacement
                SET    Category = @Category ,
                       WebpartName = @WebpartName ,
                       WebpartFile = @WebpartFile ,
                       Replacement = @Replacement
                WHERE  WebpartCode = @WebpartCode;
            END;
        ELSE
            BEGIN
                INSERT INTO dbo.LISA_NoUseWebpartReplacement ( Id ,
                                                               Category ,
                                                               WebpartCode ,
                                                               WebpartName ,
                                                               WebpartFile ,
                                                               Replacement )
                VALUES ( @Id ,          -- Id - int
                         @Category ,    -- Category - nvarchar(255)
                         @WebpartCode , -- WebpartCode - nvarchar(255)
                         @WebpartName , -- WebpartName - nvarchar(255)
                         @WebpartFile , -- WebpartFile - nvarchar(255)
                         @Replacement   -- Replacement - nvarchar(255)
                    );
            END;
    END;
'
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
COMMIT TRANSACTION
GO
IF @@ERROR <> 0 SET NOEXEC ON
GO
-- This statement writes to the SQL Server Log so SQL Monitor can show this deployment.
IF HAS_PERMS_BY_NAME(N'sys.xp_logevent', N'OBJECT', N'EXECUTE') = 1
BEGIN
    DECLARE @databaseName AS nvarchar(2048), @eventMessage AS nvarchar(2048)
    SET @databaseName = REPLACE(REPLACE(DB_NAME(), N'\', N'\\'), N'"', N'\"')
    SET @eventMessage = N'Redgate SQL Compare: { "deployment": { "description": "Redgate SQL Compare deployed to ' + @databaseName + N'", "database": "' + @databaseName + N'" }}'
    EXECUTE sys.xp_logevent 55000, @eventMessage
END
GO
DECLARE @Success AS BIT
SET @Success = 1
SET NOEXEC OFF
IF (@Success = 1) PRINT 'The database update succeeded'
ELSE BEGIN
    IF @@TRANCOUNT &> 0 ROLLBACK TRANSACTION
    PRINT 'The database update failed'
END
GO