小编Ale*_*lex的帖子

MySQL 转储的动态匿名化

我正在使用 mysqldump 创建实时应用程序的数据库转储以供开发人员使用。

该数据包含客户数据。我想匿名化这些数据,即删除客户姓名/信用卡数据。

一个选项是:

  • 创建数据库副本(创建转储和导入转储)
  • 触发对数据进行匿名化的 SQL 查询
  • 转储新数据库

但这需要很大的开销。更好的解决方案是在转储创建期间进行匿名化。

我想我最终会解析所有输出mysqlsqldump?有没有更聪明的解决方案?

php mysql anonymize

7
推荐指数
1
解决办法
6169
查看次数

从同事的电脑克隆,现在从Bitbucket拉下来仍然下载很多

我们有一个非常大的Git存储库,我们处于一个非常慢的Internet连接的背后.

我的同事已经有了最近的存储库副本,所以我做了一个

git clone him:/home/foo/repo
Run Code Online (Sandbox Code Playgroud)

在局域网 - 这是快:)

在那之后,他做了一些改变,所以我做了一个git pull.在那期间,我和我合并了冲突.

接下来,我做了

git remote rename origin him
git remote add <BITBUCKETURL>
Run Code Online (Sandbox Code Playgroud)

我做了一些改变并试图

git push origin master
Run Code Online (Sandbox Code Playgroud)

被拒绝(没有快进).

所以我试过了

git pull origin
Run Code Online (Sandbox Code Playgroud)

但是现在,Git想要下载数兆字节的数据,我不明白.我认为Git足够智能,可以交叉匹配已有的对象.对?另外,我尝试克隆并添加Bitbucket URL而不进行任何合并; 同样的问题.

我该怎么做才能解决这个问题?

编辑以解决评论中的问题:

  • 没有其他我知道的分支,git pull origin master具有相同的效果
  • 做git pull origin master打印:remote: Counting objects: 1535- 在此期间没有机会做出这么多机会.
  • 我确实比较了日志,网上没有变化(Bitbucket),这些变化不在我从中克隆的同事的计算机上

git

7
推荐指数
1
解决办法
205
查看次数

为什么在进行集成测试时我必须重新加载Auth :: user()

这是如何在Laravel集成测试中等待页面重新加载的后续内容

我正在做的是编辑用户的个人资料,然后重新显示视图.

我的个人资料操作:(UserController)

public function profile(){
    return view('user/profile');
}
Run Code Online (Sandbox Code Playgroud)

该视图包含类似的代码

{{ Auth::user()->firstname }}
Run Code Online (Sandbox Code Playgroud)

现在在我的测试期间,显示旧的(未更改的)用户数据.

考试:

protected function editUserProfile()
{
    $this->visit('/user/profile');
    $firstName = $this->faker->firstname;
    $lastname = $this->faker->lastname;

    $this->within('#userEditForm', function() use ($firstName, $lastname) {
        $this->type($firstName, 'firstname');
        $this->type($lastname, 'surname');
        $this->press('Save')
            ->seePageIs('/user/profile')
            ->see($firstName)   # here the test fails
            ->see($lastname);
    });
}
Run Code Online (Sandbox Code Playgroud)

当我像这样更改UserController时:

public function profile(){
    Auth::setUser(Auth::user()->fresh());
    return view('user/profile');
}
Run Code Online (Sandbox Code Playgroud)

一切正常.

现在我想明白,为什么会这样.

在这种情况下,为什么集成测试的行为与浏览器的行为不同?是否有更好的方法来协调该行为,以便测试只有在出现"真正的问题"时才会失败?或者我的代码是不是很糟糕?

php testing router laravel

7
推荐指数
1
解决办法
150
查看次数

Shopware 6:无法迁移数据库

我按照以下教程在 shopware 6 中自行创建自定义实体:

https://www.youtube.com/watch?v=mTHTyof4gPk

我通过使用创建了一个迁移

bin/console database:create-migration
Run Code Online (Sandbox Code Playgroud)

并添加了以下代码:

$sql = <<<SQL
CREATE TABLE IF NOT EXISTS  'applicationmanagement' (
    'id' BINARY(26) NOT NULL,
    'name' VARCHAR (255) COLLATE utf8mb4_unicode_ci,
    'created_at' DATETIME(3) NOT NULL,
    'update_at' DATETIME(3),
    PRIMARY KEY ('id')
)
    ENGINE = InnoDB
    DEFAULT CHARSET = utf8mb4
    COLLATE = utf8mb4_unicaode_ci;
SQL;

$connection->executeUpdate($sql);
Run Code Online (Sandbox Code Playgroud)

当我尝试使用执行迁移时

bin/console database:migrate PluginName --all
Run Code Online (Sandbox Code Playgroud)

我收到以下注释

bin/console database:create-migration
Run Code Online (Sandbox Code Playgroud)

我尝试重新安装并刷新插件,但没有任何作用。

有人可以帮我解决这个问题吗?

database-migration shopware shopware6

7
推荐指数
2
解决办法
1991
查看次数

在magento的pdo_mysql适配器中缺少"超过锁定等待超时"处理?

如果我比较两个Magento适配器类Varien_Db_Adapter_MysqliVarien_Db_Adapter_Pdo_Mysql,我可以在方法raw_query的查询异常处理中找到一些差异.

<?php

class Varien_Db_Adapter_Mysqli extends Zend_Db_Adapter_Mysqli
{

//....

/**
 * Run RAW Query
 *
 * @param string $sql
 * @return Zend_Db_Statement_Interface
 */
public function raw_query($sql)
{
    $timeoutMessage = 'SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded;      try restarting transaction';
    $tries = 0;
    do {
        $retry = false;
        try {
            $this->clear_result();
            $result = $this->getConnection()->query($sql);
            $this->clear_result();
        } catch (Exception $e) {
            if ($tries < 10 && $e->getMessage() == $timeoutMessage) {
                $retry = true;
                $tries++;
            } else …
Run Code Online (Sandbox Code Playgroud)

php mysql timeout magento

6
推荐指数
1
解决办法
3928
查看次数

Magento在非模板文件中获得包含税的价格

目前我正试图在我的产品Feed的php文件中获得包含税的产品价格.我现在有这个代码:

$_product = Mage::getModel('catalog/product')->load($productId);
$_priceIncludingTax = $this->helper('tax')
                               ->getPrice($_product, $_product->getFinalPrice());
Run Code Online (Sandbox Code Playgroud)

问题是因为当然'$ this->'部分在文件中不能很好地工作.谁知道我仍然可以在这个档案中获得含税的价格?

php get magento

6
推荐指数
1
解决办法
2万
查看次数

ezPublish不会生成CSS缓存(php 5.4不兼容?)

我们有一个在Debian Squeeze(PHP 5.3.3)主机上运行的站点,应该在Debian Wheezy(PHP 5.4.4)上复制.

在新安装中,我们面临的问题是,未生成样式表缓存.即/var/www/example.com/web/var/example_website/cache/public/stylesheets没有创建文件夹.当我们完全删除此缓存文件夹时,将创建结构,但不会创建样式表.

PHP 5.4是否存在一般兼容性问题?

怎么调试呢?

php caching ezpublish

6
推荐指数
1
解决办法
653
查看次数

如何在Laravel集成测试中等待页面重新加载

我们有一个操作来编辑重定向到同一页面的用户配置文件.这里seePageIs()似乎不等待加载新页面.

以下测试失败,因为在响应中找不到新用户名.当我们在测试后手动加载配置文件页面时,它已正确更新.

public function testCanEditUserProfileAsConsumer()
{
    $this->loginConsumer();

    $this->visit('/user/profile');
    $firstName = $this->faker->firstname;
    $name = $this->faker->name;


    $this->within('#userEditForm', function() use ($firstName, $name) {
        $this->type($firstName, 'firstname');
        $this->type($name, 'surname');
        $this->press('Speichern');
    });

    // here: how to wait for page reload ?
    $this->seePageIs('/user/profile');
    $this->see($firstName);
    $this->see($name);
}
Run Code Online (Sandbox Code Playgroud)

编辑

    $this->within('#userEditForm', function() use ($firstName, $lastname) {
        $this->type($firstName, 'firstname');
        $this->type($lastname, 'surname');
        $this->press('Speichern')
            ->seePageIs('/user/profile')
            ->see($firstName)
            ->see($lastname);
    });
Run Code Online (Sandbox Code Playgroud)

也不行

php testing laravel

6
推荐指数
1
解决办法
811
查看次数

Git gc使用了大量内存,即使我限制它

我在共享主机(uberspace.de)上运行git并在执行git push或运行时达到内存限制git gc.他们报告的内存消耗大约为1500 MB.

所以我遵循了建议

/sf/answers/613302511/

它似乎工作一次,但经过大量的提交它不再有用,内存消耗再次大约1500MB并且git pack进程被杀死.

我提交了一个120 MB的SQL转储,只有很少的更改(每次大约5行) - 所以打包的存储库只有大约150 MB,但解压缩大约3 GB(我达到了bitbucket的限制).

我看到哪个pmap打开了很多包对象 - 它是否会增加高内存?怎么限制?

最后,我得到了"装箱物品死于信号15"和来自主机的邮件,我的过程被杀死了.

sh-4.1$ git config --list|grep pack
pack.windowmemory=25m
pack.packsizelimit=25m
pack.threads=1
pack.deltecachesize=25m
sh-4.1$ git gc
Counting objects: 2586, done.
^Zmpressing objects:  15% (163/1085)   
[1]+  Stopped(SIGTSTP)        git gc
sh-4.1$ bg
[1] git gc &
sh-4.1$ pmap 14190
14190:   git pack-objects --keep-true-parents --honor-pack-keep --non-empty --all --reflog --indexed-objects --unpack-unreachable=2.weeks.ago --local --delta-base-offset .git/objects/pack/.tmp-14187-pack
0000000000400000   1848K r-x--  /home/foo/.toast/pkg/git/v2.11.1/1/root/libexec/git-core/git
00000000007ce000     36K rw---  /home/foo/.toast/pkg/git/v2.11.1/1/root/libexec/git-core/git
00000000007d7000    280K rw---    [ …
Run Code Online (Sandbox Code Playgroud)

memory git

6
推荐指数
1
解决办法
945
查看次数

Cmake无法在qt creator/collect2上编译简单的测试程序:error:ld

我正在尝试使用android NDK构建一个Android项目.

我已将NDK添加到Q​​T版本,自动检测到构建工具包但在运行CMake时出现以下错误:

Starting to parse CMake project, using: "-DCMAKE_CXX_COMPILER:STRING=/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-g++", "-DCMAKE_C_COMPILER:STRING=/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc", "-DCMAKE_PREFIX_PATH:STRING=/home/self/Qt5.9.6/5.9.6/android_x86", "-DQT_QMAKE_EXECUTABLE:STRING=/home/self/Qt5.9.6/5.9.6/android_x86/bin/qmake".
The C compiler identification is GNU 4.9.0
The CXX compiler identification is GNU 4.9.0
Check for working C compiler: /home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc
Check for working C compiler: /home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc -- broken
CMake Error at /usr/share/cmake-3.10/Modules/CMakeTestCCompiler.cmake:52 (message):
  The C compiler

    "/home/self/Downloads/addis/android-ndk-r17b/toolchains/x86-4.9/prebuilt/linux-x86_64/bin/i686-linux-android-gcc"

  is not able to compile a simple test program.

  It fails with the following output:

    Change Dir: /tmp/QtCreator-Tuub3S/qtc-cmake-XXSZ1kmJ/CMakeFiles/CMakeTmp

    Run Build Command:"/usr/bin/ninja" "cmTC_991f8"
    [1/2] Building C object CMakeFiles/cmTC_991f8.dir/testCCompiler.c.o
    [2/2] Linking C …
Run Code Online (Sandbox Code Playgroud)

c++ qt android

6
推荐指数
1
解决办法
708
查看次数