小编ben*_*org的帖子

汇编语言中的全局_start是什么?

这是我的汇编级代码......

section .text
global _start
_start: mov eax, 4
        mov ebx, 1
        mov ecx, mesg
        mov edx, size
        int 0x80
exit:   mov eax, 1
        int 0x80
section .data
mesg    db      'KingKong',0xa
size    equ     $-mesg
Run Code Online (Sandbox Code Playgroud)

输出:

root@bt:~/Arena# nasm -f elf a.asm -o a.o
root@bt:~/Arena# ld -o out a.o
root@bt:~/Arena# ./out 
KingKong
Run Code Online (Sandbox Code Playgroud)

我的问题是全球_start用于什么?我和Mr.Google试了一下运气,我发现它用来说明程序的起点.为什么我们不能_start告诉程序在哪里开始,如下面给出的那个在屏幕上产生一种警告

section .text
_start: mov eax, 4
        mov ebx, 1
        mov ecx, mesg
        mov edx, size
        int 0x80
exit:   mov eax, 1
        int 0x80
section .data …
Run Code Online (Sandbox Code Playgroud)

assembly nasm

23
推荐指数
3
解决办法
3万
查看次数

在片段中在运行时更改方向而不重新创建视图时更改布局

我尝试开发第一个从网上下载图像并在gridview中显示它们的应用程序.gridview是主Activity的片段.下载过程是使用onCreate函数中的AsyncTask完成的.为了在更改方向时不再下载图像,我android:configChanges="orientation|screenSize"在Android Manifest中设置了它.然后onCreate函数只调用一次,一切都很好......除了我必须在横向模式下对gridview片段的布局进行一些更改.所以我创建了2个布局表:fragment_library.xmlfragment_library_land.xml在布局/文件夹中.为了使这些更改起作用,我尝试使用onConfigurationChanged函数手动更改库片段的布局.在运行时,程序会评估函数并传递好的情况(纵向或横向),但使用的布局仍然是纵向模式:fragment_library.xml...

public class LibraryFragment extends Fragment {
    public GridView gridview;
    private Boolean isImageAdapterPopulated = false;

    @Override
    public void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        GetLibraryTask getLibraryTask = new GetLibraryTask(this);
        getLibraryTask.execute(Config.URL + "action=getLibrary");
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
        Bundle savedInstanceState) {
        if (container == null)
            return null;

        // gridview
        View V = inflater.inflate(R.layout.fragment_library, container, false);
        gridview = (GridView)V.findViewById(R.id.gridview);

        if(this.isImageAdapterPopulated)
            this.setGridAdapter();
        return V;
    }

    @Override
    public void onConfigurationChanged(Configuration newConfig){
        super.onConfigurationChanged(newConfig);
        if (newConfig.orientation == …
Run Code Online (Sandbox Code Playgroud)

layout android runtime fragment orientation

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

如何将JSON文件转换为SQLite数据库

如果我有一些示例数据,如何将其放入SQLite(最好是全自动的)中?

{"uri":"/","user_agent":"example1"}
{"uri":"/foobar","user_agent":"example1"}
{"uri":"/","user_agent":"example2"}
{"uri":"/foobar","user_agent":"example3"}
Run Code Online (Sandbox Code Playgroud)

sqlite json

3
推荐指数
4
解决办法
5428
查看次数

使用 nginx 的 lua 验证 GitHub webhooks 并删除 cron-lock-file

我拥有的:

  • GNU/Linux 主机
  • nginx 已启动并运行
  • 有一个 cron-job 计划在删除特定文件后立即运行(类似于 run-crons)
  • 当有人推送到存储库时,GitHub 会发送一个 Webhook

我想要的是:

我现在确实想运行 lua 或任何类似的东西来解析 GitHub 的请求并验证它,然后删除一个文件(当然,如果请求有效)。

最好所有这一切都应该在没有维护额外 PHP 安装的麻烦的情况下发生,因为目前没有,或者需要使用 fcgiwrap 或类似的。

模板:

在 nginx 方面,我有相当于

location /deploy {
    # execute lua (or equivalent) here
}
Run Code Online (Sandbox Code Playgroud)

lua json github nginx webhooks

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

标签 统计

json ×2

android ×1

assembly ×1

fragment ×1

github ×1

layout ×1

lua ×1

nasm ×1

nginx ×1

orientation ×1

runtime ×1

sqlite ×1

webhooks ×1