SDE Tools Tips & Configurations


#Git

Your configuration specifies to merge with the ref <> from the remote, but no such ref was fetched.

  • 本地索引的远端Branch不存在(通常是在server上被删除或改名)
  • Solution:
$ git branch --unset-upstream
$ git branch -r
$ git branch --set-upstream-to=origin/<new_branch_name>
$ git pull

PyCharm

MemoryHeap Size

Ecplise

ECLIPSE MAVEN JAR 没有主清单属性

  • 由于使用了maven-assembly-plugin所致。在修改如下后,问题解决
		<plugin>
        	<artifactId>maven-assembly-plugin</artifactId>
        	<executions>
          		<execution>
            		<phase>package</phase>
            		<goals>
              			<goal>single</goal>
            		</goals>
          		</execution>
        	</executions>
        	<configuration>
    			<!-- 加入如下archive session -->
        		<archive>
        			<manifest>
        				<mainClass>com.xxx.yyy.zzz</mainClass>
        			</manifest>
        		</archive>
          		<descriptorRefs>
            		<descriptorRef>jar-with-dependencies</descriptorRef>
          		</descriptorRefs>
        	</configuration>
      	</plugin>

参照博文,尝试了maven-jar-plug-in 和maven-shade-plugin,貌似都不生效。故暂时记录下如下Dirty Fix:

  • 使用Run As -> Maven Install生成JAR
  • 在Eclipse项目下的target目录,找到生成的JAR。改后缀为ZIP。
  • 打开ZIP,在META-INF目录下找到MANIFEST.MF,复制到临时目录。
  • 使用任意文本修改器打开,加入如下内容并保存:
Main-Class: com.xxx.yyy.zzz
  • 将该MANIFEST.MF文件拷回ZIP文件中。
  • 将ZIP文件改名为JAR。
  • 运行。
java -jar xxx.jar
# 修改前:java -cp xxx.jar com.xxx.yyy.zzz

Jupyter

安装

  • 包名是Jupyter,不是Notebook.不需要sudo
$ sudo apt update
$ sudo apt install python3-pip
$ pip3 install jupyter

设置远程访问

$ jupyter notebook --generate-config
# generated in Linux: /home/USERNAME/.jupyter/jupyter_notebook_config.py

$ python
>>>from notebook.auth import passwd
>>>passwd()
Enter password:
Verify password:
# output is : 'sha1:67c9e60bb8b6:9ffede0825894254b2e042ea597d771089e11aed'

# edit jupyter_notebook_config.py as follows:
c.NotebookApp.ip = '*'
c.NotebookApp.notebook_dir = r'/home/XXXX/jupyter'
c.NotebookApp.open_browser = False
c.NotebookApp.password = 'output from passwd()'
c.NotebookApp.port = XXXX

# start the server
$nohup jupyter notebook >~/.jupyter/jupyter.log 2>&1 &

Selenium

Selenium+Firefox在Ubuntu22.04上不工作

  • 原因:Ubuntu22.04上默认使用snap的Firefox,如果设置使得firefox在sandbox运行时无法访问系统/tmp目录,会造成geckodriver驱动Firefox失败。

Github原文如下

Firefox running in Linux Sandbox (e.g. Snap package):

Using geckodriver to launch Firefox inside a sandbox – for example
a Firefox distribution using Snap or Flatpak – can fail with a
“Profile not found” error if the sandbox restricts Firefox’s ability
to access the system temporary directory. geckodriver uses the
temporary directory to store Firefox profiles created during the run.

This issue can be worked around by setting the TMPDIR environment
variable to a location that both Firefox and geckodriver have
read/write access to e.g.:

% mkdir $HOME/tmp
% TMPDIR=$HOME/tmp geckodriver

Alternatively, geckodriver may be used with a Firefox install that
is not packaged inside a sandboxed e.g. from mozilla.org.

Proguard

编译

  • 下载代码
> git clone https://github.com/Guardsquare/proguard-core.git
> git clone https://github.com/Guardsquare/proguard.git
  • 下载gradle zip包并解压,并创建默认目录 %USER%.gradle
>gradle -version
  • 编辑文件%USER%.gradle\init.gradle以使用mirror(参考)
allprojects{
    repositories {
        def ALIYUN_REPOSITORY_URL = 'https://maven.aliyun.com/repository/public'
        def ALIYUN_JCENTER_URL = 'https://maven.aliyun.com/repository/public'
        def ALIYUN_GOOGLE_URL = 'https://maven.aliyun.com/repository/google'
        def ALIYUN_GRADLE_PLUGIN_URL = 'https://maven.aliyun.com/repository/gradle-plugin'
        all { ArtifactRepository repo ->
            if(repo instanceof MavenArtifactRepository){
                def url = repo.url.toString()
                if (url.startsWith('https://repo1.maven.org/maven2/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
                    remove repo
                }
                if (url.startsWith('https://jcenter.bintray.com/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
                    remove repo
                }
                if (url.startsWith('https://dl.google.com/dl/android/maven2/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GOOGLE_URL."
                    remove repo
                }
                if (url.startsWith('https://plugins.gradle.org/m2/')) {
                    project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_GRADLE_PLUGIN_URL."
                    remove repo
                }
            }
        }
        maven { url ALIYUN_REPOSITORY_URL }
        maven { url ALIYUN_JCENTER_URL }
        maven { url ALIYUN_GOOGLE_URL }
        maven { url ALIYUN_GRADLE_PLUGIN_URL }
    }
}
  • 编辑文件%USER%.gradle\gradle.properties以指定JDK(Kotlin需要JDK8,请在清华镜像下载。我用的是hotspot。同时,请设置JAVA_HOME,及PATH(没设CLASS_PATH))(参考)
# gradle.properties内容
org.gradle.java.home=C:\\SDE\\Lib\\<JDK Folder>

# JAVA_HOME
JAVA_HOME='C:\\SDE\\Lib\\<JDK Folder>'

# PATH
PATH=%PATH%:%JAVA_HOME%\bin
  • 编译proguard-core
>gradle clean assemble
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值