首页 \ 问答 \ 本地Mongodb安全(Local Mongodb security)

本地Mongodb安全(Local Mongodb security)

所以我是noSQL浪潮的新手,我最近一直在使用MEAN Stack。 我在运行其余网站的同一台服务器上运行MongoDB时,我只有一个关于安全性的问题。 每当我有一个mySQL或SQL Server数据库时,我总是被建议远程运行它,但是当它涉及到MEAN堆栈时,它都是本地的。 通常当我在网上看时,每个人都使用其余的代码运行他们的MongoDB,我只是想知道这是不是这样做了?


So I'm new to the noSQL wave of things and I've been working with the MEAN Stack recently. I just have a question about security when it comes to running MongoDB on the same server I'm running the rest of my website. Whenever I have a mySQL or SQL Server database, I was always advised to run it remotely but when it comes to the MEAN stack, it's all local. And usually when I look online, everyone has their MongoDB running with the rest of their code and I was just wondering if that's just how it's done?


原文:https://stackoverflow.com/questions/23858638
更新时间:2023-09-19 19:09

最满意答案

每当您使用iTextSharp编写需要创建新文档的内容时,它都不会写入现有文档。 在您的情况下,页面重新排序需要编写,因此您需要创建一个新文档,将页面重新排序然后重新排序。 (当然,您也可以在导入时重新排序它们。)

        var inputFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.pdf");
        var output = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Output.pdf");

        //Bind a reader to our input file
        var reader = new PdfReader(inputFile);

        //Create our output file, nothing special here
        using (FileStream fs = new FileStream(output, FileMode.Create, FileAccess.Write, FileShare.None)) {
            using (Document doc = new Document(reader.GetPageSizeWithRotation(1))) {
                //Use a PdfCopy to duplicate each page
                using (PdfCopy copy = new PdfCopy(doc, fs)) {
                    doc.Open();
                    copy.SetLinearPageMode();
                    for (int i = 1; i <= reader.NumberOfPages; i++) {
                        copy.AddPage(copy.GetImportedPage(reader, i));
                    }
                    //Reorder pages
                    copy.ReorderPages(new int[] { 2, 1 });
                    doc.Close();
                }
            }
        }

Whenever you use iTextSharp to write something you need to create a new document, it will never write to an existing document. In your case, page reordering would require writing so you need create a new document, bring over the pages and then reorder them. (Of course, you could also just reorder them upon import, too.)

        var inputFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.pdf");
        var output = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Output.pdf");

        //Bind a reader to our input file
        var reader = new PdfReader(inputFile);

        //Create our output file, nothing special here
        using (FileStream fs = new FileStream(output, FileMode.Create, FileAccess.Write, FileShare.None)) {
            using (Document doc = new Document(reader.GetPageSizeWithRotation(1))) {
                //Use a PdfCopy to duplicate each page
                using (PdfCopy copy = new PdfCopy(doc, fs)) {
                    doc.Open();
                    copy.SetLinearPageMode();
                    for (int i = 1; i <= reader.NumberOfPages; i++) {
                        copy.AddPage(copy.GetImportedPage(reader, i));
                    }
                    //Reorder pages
                    copy.ReorderPages(new int[] { 2, 1 });
                    doc.Close();
                }
            }
        }

相关问答

更多
  • 你好,你可以简单地使用下面的代码添加新页面: - Document document = new Document(); document.Open(); document.NewPage(); 并添加标签请使用下面的代码: - static Font FontSubHeading = FontFactory.GetFont("gothic", 10, Font.NORMAL, new BaseColor(System.Drawing.ColorTranslator.FromHtml("#4040 ...
  • 您正在为每次传递创建一个新的PdfReader 。 这是非常低效的。 因为你从每个页面都有一个PdfImportedPage ,所有这些(可能是多余的) PdfReader实例都不会被PdfReader 。 建议: 两次通过。 首先建立一个文件和页面的列表。 其次依次对每个文件进行操作,因此您一次只能有一个“打开”的PdfReader 。 使用PdfCopy.freeReader()当你完成给定的读者。 这几乎肯定会改变你的页面添加顺序(也许是一件非常糟糕的事情)。 一次通过。 根据文件名缓存你的PdfRe ...
  • 请转到官方文档 ,然后单击问答以转到最常见的问题。 选择入门类别。 您将看到的第一件事是最受欢迎的iText示例(为方便起见,我将其移植到C#): // step 1 Document document = new Document(); // step 2 FileStream fs = new FileStream("hello.pdf", FileMode.Create); PdfWriter.GetInstance(document, fs); // step 3 document.Open(); ...
  • 扩展功能警告提示原始PDF已使用使用权限签名进行“读取器启用”签名,即告诉Adobe Reader在打开时激活某些附加功能,并且OP对其的操作已失效签名。 实际上,他经营使用 _pdfStamper = new PdfStamper(_pdfReader, _pdfOutputStream); 这会创建一个完全重新生成文档的PdfStamper 。 但是,要使签名无效,必须使用OP的固定代码中的附加模式(对于char pdfVersion = '\0', bool append = true ): _pd ...
  • 该解决方案是Acrobat / Reader中的首选项。 转到编辑 - >首选项 - >常规选项卡 - > 取消选中“从URL创建链接” 。 最好的部分是,此设置将在打开不同文档时保持有效。 Chris Haas的积分。 The solution was a preference in Acrobat/Reader. Go to Edit -> Preferences -> General tab -> Uncheck "Create links from URLs". The best part is, ...
  • 您的代码无法工作,因为您使用path创建PdfReader以及创建FileStream 。 您可能会收到错误,例如“文件正在使用中”或“文件无法访问”。 这在这里解释: StackOverflow: 如何在不创建新PDF的情况下更新PDF? 官方网站: 如何在不创建新PDF的情况下更新PDF? 您创建一个名为baos的MemoryStream() ,但您没有在任何地方使用该对象。 解决问题的一种方法是在第一次通过MemoryStream创建PDF时替换FileStream ,然后使用存储在该内存流中的字节来 ...
  • 我几乎没有使用iText编程或使用c#的经验,所以我很乐意回答你的问题:) 首先,如果您想要做的只是标记一个页面,然后再次找到它,请不要使用 PDF中的辅助功能。 辅助功能对于辅助设备是有用的,滥用这些功能并不好。 特别是因为 - 如果我正确理解你想要做的事情 - 不需要这样做。 如果要标记页面,则应查找页面字典,例如: PdfReader reader = new iTextSharp.text.pdf.PdfReader(file_content); PdfDictionary pageDict = r ...
  • 每当您使用iTextSharp编写需要创建新文档的内容时,它都不会写入现有文档。 在您的情况下,页面重新排序需要编写,因此您需要创建一个新文档,将页面重新排序然后重新排序。 (当然,您也可以在导入时重新排序它们。) var inputFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Test.pdf"); var output = Path.Combine(En ...
  • 您需要从输入流中读取pdf。 PdfReader reader = new PdfReader(m); PdfImportedPage page = writer.GetImportedPage(reader, i); // size information //page.PageSize.Width //page.PageSize.Height You need to read the pdf from your input stream (m). PdfReader reader = new PdfR ...
  • 您正在寻找启动操作 。 我是关于iText的书的作者,我通常不会谈论这个功能,因为它被认为是一个安全隐患(你在评论中指出:用户真的必须信任PDF)。 在iTextSharp中,您将创建一个这样的启动操作: Paragraph p = new Paragraph( new Chunk( "Click to open test.txt in Notepad.") .SetAction( new PdfAction( "c:/windows/no ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。