实现页面卷曲功能(Implementing page curl feature)

我正在创建一个类似于iphone地图应用程序的地图应用程序。 我需要具有页面卷曲功能,与地图应用程序中的相同。 在这种情况下需要帮助。


I am creating a map application similar to the iphone map app. I need to have the page curl feature, same as that in the map app. Need help in this case.


原文:https://stackoverflow.com/questions/8443280
2024-03-26 08:03

满意答案

在Linux上,该进程使用内存映射将可执行文件的文本部分和共享库直接映射到正在运行的进程内存。 所以如果你可以覆盖可执行文件,它会影响正在运行的进程。 但是,禁止写入映射为执行的文件 - 您会收到“文本文件忙”错误。

但是,您仍然可以重新编译该程序。 如果编译器(实际上是链接器)出现此错误,它将删除旧的可执行文件并创建一个新文件。 在Unix上,如果删除正在使用的文件,则文件内容实际上并未从磁盘中删除,只删除目录条目中的引用; 在所有对它的引用(目录项,文件描述符和内存映射)消失之前,该文件并未完全删除。 因此,正在运行的进程将继续映射到旧的无名文件。 您可以通过以下演示来看到这一点:

barmar@dev:~$ ls -li testsleep
229774 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:30 testsleep
barmar@dev:~$ ./testsleep &
[1] 17538
barmar@dev:~$ touch testsleep.c
barmar@dev:~$ make testsleep
cc     testsleep.c   -o testsleep
barmar@dev:~$ ls -li testsleep
229779 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:32 testsleep

当我在程序运行时重新编译程序时,inode号从229774改为229779 ,表示创建了一个新文件。


On Linux, the process uses memory mapping to map the text section of the executable file and shared libraries directly into the running process memory. So if you could overwrite the executable file, it would affect the running process. However, writing into a file that's mapped for execution is prohibited -- you get a "Text file busy" error.

However, you can still recompile the program. If the compiler (actually the linker) gets this error, it removes the old executable file and creates a new one. On Unix, if you remove a file that's in use, the file contents are not actually removed from the disk, only the reference from the directory entry is removed; the file isn't fully deleted until all references to it (directory entries, file descriptors and memory mappings) go away. So the running process continues to be mapped to the old, nameless file. You can see this with the following demonstration:

barmar@dev:~$ ls -li testsleep
229774 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:30 testsleep
barmar@dev:~$ ./testsleep &
[1] 17538
barmar@dev:~$ touch testsleep.c
barmar@dev:~$ make testsleep
cc     testsleep.c   -o testsleep
barmar@dev:~$ ls -li testsleep
229779 -rwxr-xr-x 1 barmar adm 4584 Apr 24 04:32 testsleep

The inode number changed from 229774 to 229779 when I recompiled the program while it was running, indicating that a new file was created.

相关问答

更多

Spring批处理:有条件地执行步骤(Spring batch: conditional execution of steps)

这就是我所做的: - 一旦我的属性被设置,我把所有必须在堆栈中执行的步骤名称, - 我创建了一个决定器,弹出堆栈,并决定哪一步必须通过返回新的FlowExecutionStatus。 Hejk Here is what I did: - once my properties are set, I put all the step names which has to be executed in a Stack, - I have created a Decider which pops the ...

AWS Elastic MapReduce中的Python程序在步骤执行中失败(Python program in AWS Elastic MapReduce fails in step execution)

通过SSH连接到群集并从终端应用程序启动程序“解决”问题。 movies.dat文件也需要在集群本地文件系统上。 Connecting to the Cluster via SSH and starting the program from the Terminal App "solves" the problem. The movies.dat file needs to be on the clusters local file system, too.

是否可以计算代码执行步骤?(Is it possible to count code execution steps?)

关于内存使用情况,如果您定义宏CALC_EXACT_MALLOC_SIZE (不确定在哪里,但在ruby.h可能有效)并重新编译Ruby,您将能够调用GC.malloc_allocated_size来了解malloc分配了多少内存(几乎所有内容),以字节为单位 No, it appears it is not possible.

如何防止在InstallShield中记录自定义操作的执行步骤?(How to prevent to log execution steps of Custom Action in InstallShield?)

那将是一个有趣的功能请求! 也许InstallShield可以被教导尊重(理论上) ISSuppressLogging属性的值,该属性在立即操作时或者在安排延迟操作时是非空的。 但是现在不可用,并且需要对InstallShield的自定义操作进行基于代码的更改。 回到现在。 InstallShield没有提供任何选项来抑制其日志记录语句,至少在它明确尝试支持的几种情况下,因此您可能会留下以下可能无法满足您需求的选项: 使用MsiHiddenProperties显式阻止记录特定属性的值。 请注意,有...

程序执行步骤(Program execution steps)

在Linux上,该进程使用内存映射将可执行文件的文本部分和共享库直接映射到正在运行的进程内存。 所以如果你可以覆盖可执行文件,它会影响正在运行的进程。 但是,禁止写入映射为执行的文件 - 您会收到“文本文件忙”错误。 但是,您仍然可以重新编译该程序。 如果编译器(实际上是链接器)出现此错误,它将删除旧的可执行文件并创建一个新文件。 在Unix上,如果删除正在使用的文件,则文件内容实际上并未从磁盘中删除,只删除目录条目中的引用; 在所有对它的引用(目录项,文件描述符和内存映射)消失之前,该文件并未完...

Spring批处理:在java配置文件中执行并行步骤(Spring Batch : parallel steps execution in java configuration file)

这是通过java配置使用拆分的示例。 在此示例中,流1和2将并行执行: @Configuration public class BatchConfiguration { @Autowired private JobBuilderFactory jobBuilderFactory; @Autowired private StepBuilderFactory stepBuilderFactory; @Bean public Tasklet task...

javascript和执行步骤中的范围(scope in javascript and execution steps)

您正在创建一个匿名函数并立即执行( IIFE ) 然后,在此范围函数中: 你声明一个值为g a var 您声明了一个名为foo的函数,该函数具有父函数作用域(IIFE作用域)的可见性。 所以它可以看到a变量。 不立即调用此foo函数。 在log语句中,执行foo : 记录a(值g ) IIFE范围中a var更改为值7 foo什么都不返回 然后记录: foo返回undefined值(无返回值) a值,执行foo后为7 。 所以你在控制台中: g undefined 7 You are creat...

如何使有状态的JBehave步骤对于多线程执行是安全的(How to make stateful JBehave steps safe for multithreaded execution)

这是很久以前的问题,但答案是:只在ThreadLocal变量中保持状态,或者更好地将ThreadLocal变量包装在您自己的一个类中。 例如,请使用此代码 国家阶级 public class State { private ThreadLocal<String> state; public void setState(String state) { this.state.set(state); } public String getState() { ...

如何跳过具体的执行计划步骤?(How to skip specific Execution Plan Steps?)

您列出的第一种格式是正确的,但您必须确保使用的是步进路径而不仅仅是块的路径。 假设您通过此调用从部署计划中获取了块。 curl -uadmin:password http://localhost:4516/deployit/tasks/v2/28830810-5104-4ab9-9826-22f66dee265d 这将产生结果: <task id="28830810-5104-4ab9-9826-22f66dee265d" failures="0" state="PENDING" owner="...

案例陈述执行步骤(Case statement execution steps)

根据标准5.4节 ,只有第一个分支执行时: case陈述的执行选择了一种且只有一种备选方案,因为这些选择是详尽且相互排斥的。 从逻辑上讲,这也是有道理的,因为case语句的标题中的A可以是任何表达式,不一定是单个变量。 如果改变导致case表达式改变的状态可能导致选择其他分支,那么代码将变得更难以遵循(并且语言将成为实现的噩梦)。 According to the standard, section 5.4, only the first when branch would be executed...

相关文章

更多

linux命令 Curl

今天在学习Solr的时候看到用curl向Solr发送http请求来实现Solr的一些更新,转了一些Cu ...

Feature分支-git入门教程

软件开发中,总有无穷无尽的新的功能要不断添加进来。 添加一个新功能时,你肯定不希望因为一些实验性质的代 ...

PHP中CURL技术模拟登陆抓取网站信息,用与微信公众平台成绩查询

伴随微信的红火,微信公众平台成为许多开发者的下一个目标。笔者本身对于这种新鲜事物没有如此多的吸引力。但 ...

page-taglib分页问题

想做个分页,用page-taglib怎么没反应,大家帮忙看下 online waiting..... ...

asp.net 模拟CURL调用微信公共平台API 上传下载多媒体文

近公司项目上在开发微信服务号的接口,需要给用户回复图片或语音或视频,这个时候就需要用到 上传下载多媒体 ...

shell通过curl发送get请求,做一些很烦琐的事

概述 最近负债公司的搜索项目,索引部署采用主从模式,如果solr的core很多的话,第一次索引同步的时 ...

Scaling Pinterest - From 0 To 10s Of Billions Of Page Views A Month In Two Years

这篇文件写的非常好,推荐大家重温一下: http://highscalability.com/blog ...

sharepoint 2010 页面添加footer方法 custom footer for sharepoint 2010 master page

转:http://blog.csdn.net/chenxinxian/article/details/ ...

ArcGIS Basics[转载]

Feature and Feature Classes. Feature classesare h ...

Stack Overflow Architecture Update - Now At 95 Million Page Views A Month

A lot has happened since my first article on theSta ...

最新问答

更多

如何在Laravel 5.2中使用paginate与关系?(How to use paginate with relationships in Laravel 5.2?)

请尝试以下方法: $messages = $user->contact_messages()->paginate(10); Try the following: $messages = $user->contact_messages()->paginate(10);

linux的常用命令干什么用的

linux和win7不一样,win7都图形界面,都是用鼠标来操作打开,解压,或者关闭。而linux是没有图形界面的,就和命令提示符一样的一个文本框,操作linux里的文件可没有鼠标给你用,打开文件夹或者解压文件之类的操作都要通过linux常用命令。

由于有四个新控制器,Auth刀片是否有任何变化?(Are there any changes in Auth blades due to four new controllers?)

它创建了这些视图: 'auth/login.blade.php', 'auth/register.blade.php', 'auth/passwords/email.blade.php', 'auth/passwords/reset.blade.php', 'layouts/app.blade.php', 'home.blade.php' 并修改这些文件: 'Http/Controllers/HomeController.php', 'routes/web.php' 如果使用--views

如何交换返回集中的行?(How to swap rows in a return set?)

您可以使用特殊的CASE表达式进行ORDER BY如下所示: SELECT * FROM table ORDER BY CASE id WHEN 3 THEN 8 WHEN 8 THEN 3 ELSE id END You can ORDER BY using a special CASE expression like this: SELECT * FROM table ORDER BY CASE id WHEN 3 THEN 8 WHEN 8 THEN 3 ELSE id END

在ios 7中的UITableView部分周围绘制边界线(draw borderline around UITableView section in ios 7)

我建议你制作一个新的TableView Cell,在这个newTableViewCell中,加载第2节中的所有单元格,然后为newTableViewCell提供边框。 但如果您不想这样做,那么您可以使用以下代码: @property(strong,nonatomic) CAShapeLayer* borderPath; -(void)viewDidLayoutSubviews{ [_borderPath removeFromSuperlayer]; UIView *viewToGiveBord

使用Boost.Spirit Qi和Lex时的空白队长(Whitespace skipper when using Boost.Spirit Qi and Lex)

出于一些奇怪的原因,我现在发现了一个不同的问题, Boost.Spirit SQL语法/词法分析失败 ,其中提供了一些其他解决方案来进行空格跳过。 一个更好的! 以下是根据建议重新编写的示例代码: #include #include #include #include #include #incl

Java中的不可变类(Immutable class in Java)

1.如果我只有final变量的课程? 这会让你远离但不是全部。 这些变量的类型也需要是不可变的。 考虑一下 class MyImmutableClass { // final variable, referring to a mutable type final String[] arr = { "hello" }; // ... } 这允许有人做 myImmutableObject.arr[0] = "world"; 并有效地改变你的不可变类的对象。 此外,建议禁

WordPress发布查询(WordPress post query)

如果你想要在div中包含所有帖子: post_parent) { $myposts = get_posts('numberposts=10&tag=medical&order=DESC'); echo ' '; foreach ($myposts as $post): ?>

如何在关系数据库中存储与IPv6兼容的地址(How to store IPv6-compatible address in a relational database)

我不确定哪个是MySQL的正确答案,因为它本身还不支持IPv6地址格式(尽管“ WL#798:MySQL IPv6支持 ”表明它将在MySQL v6.0中,当前文档不支持)。 不过,你建议的人建议去2 * BIGINT,但要确保他们是UNSIGNED。 在IPv6的/ 64地址边界处有一种自然分割(因为/ 64是最小的网格块大小),这将与其很好地对齐。 I'm not sure which is the right answer for MySQL given that it doesn't y

是否可以检查对象值的条件并返回密钥?(Is it possible to check the condition of a value of an object and JUST return the key?)

您可以使用Object.keys和Array#find来获取匹配value的key 。 const letters = {a:'26',b:'25',c:'24',d:'23',e:'22',f:'21',g:'20',h:'19',i:'18',j:'17',k:'16',l:'15',m:'14',n:'13',o:'12',p:'11',q:'10',r:'9',s:'8',t:'7',u:'6',v:'5',w:'4',x:'3',y:'2',z:'1'}; function sw