hello world

Cannot build a hello world program with Stack because of flag bytestring--lt-0_10_4

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: With a bare "hello world" project generated by stack new myproject simple whenever I run stack setup , stack init or stack build I have the following error all the time: Downloading lts-10.0 build plan Downloaded lts-10.0 build plan. AesonException "Error in $.packages.cassava.constraints.flags['bytestring--lt-0_10_4']: Invalid flag name: \"bytestring--lt-0_10_4\"" I saw some guys talk about the issue, and argue about whether it is accepted or not to have two sequential - in a flag name, that it is the fault of stack or cassava or cabal etc.

iText or iTextSharp rudimentary text edit

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I can extract text from pages in a PDF in many ways: String pageText = PdfTextExtractor.GetTextFromPage(reader, i); This can be used to get any text on a page. Alternatively: byte[] contentBytes = iTextSharp.text.pdf.parser.ContentByteUtils.GetContentBytesForPage(reader, i); Possibilities are endless. Now I want to remove/redact a certain word, e.g. explicit words, sensitive information (putting black boxes over them obviously is a bad idea :) or whatever from the PDF (which is simple and text only). I can find that word just fine using the

Whats the difference between .asciiz vs .ascii

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I read that .asciiz null terminates the string (appending \n ?) ... but when looking at the User Data Segment of QtSPIM, User data segment [10000000]..[10040000] [10000000]..[1000ffff] 00000000 [10010000] 6c6c6548 6f57206f 00646c72 6c6c6548 H e l l o W o r l d . H e l l [10010010] 6f57206f 00646c72 00000000 00000000 o W o r l d . . . . . . . . . [10010020]..[1003ffff] 00000000 I don't see a difference? .data str1: .asciiz "Hello World" # string str1 = "Hello World" str2: .ascii "Hello World" # string str2 = "Hello World" .text .globl main

How to disable printf function?

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have three files as below Test.cpp void helloworld () { disable pf ; pf . Disable (); printf ( "No statement \n" ); } int main () { disable dis ; helloworld (); printf ( "Hello World" ); system ( "pause" ); return 0 ; } disable.cpp #include "StdAfx.h" #include "disable.h" disable :: disable ( void ) {# define printf ( fmt , ...) ( 0 )} disable ::~ disable ( void ) {} void disable :: Disable () { #define printf ( fmt , ...) ( 0 ) } disable.h #pragma once class disable { public : disable ( void ); ~ disable ( void ); void Disable (

Why CompletableFuture 's thenAccept() not running on the main thread

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I process the long running operation inside the CompletableFuture's supplyAsync() and get the result into thenAccept(). In some times thenAccept() perform on the main thread but some time it running on the worker thread.But I want run thenAccept() operation only on the main thread. this is the sample code. private void test() { ExecutorService executorService = Executors.newSingleThreadExecutor(); CompletableFuture<String> cf1 = CompletableFuture.supplyAsync(() -> { System.out.println("supplyAsync | I am running on : " + Thread.currentThread

用Itextsharp 组件导出PDF 的文档的方法

匿名 (未验证) 提交于 2019-12-03 00:43:02
首先,从 点击下载 Itextsharp.dll */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using iTextSharp.text; using iTextSharp.text.pdf; using System.IO; namespace PdfDemo { /// <summary> /// MainWindow.xaml 的交互逻辑 /// </summary> public partial class MainWindow : Window { public MainWindow() {

Spring Boot学习笔记(一)

匿名 (未验证) 提交于 2019-12-03 00:32:02
配置SpringBoot的开发环境有很多,最简单的莫过于使用Maven构建。也可以直接上 https://start.spring.io 选择好所需要的配置,然后下载项目压缩包解压之后导入IDE就可以开始了。而且IDEA自带有Spring Initializr,可以很方便的配置好开发环境。IDEA的配置方式如下: 打开IDEA新建项目,选择Spring Initializr然后Next 基本配置,需要注意的是打包的方式可以选择Jar或者war,如果说选择Jar的话,可以直接使用 java -jar demo.jar 来启动你的项目,其中内置了Tomcat。如果选择war的话,则可以部署到外部的tomcat等容器中运行。 这里目前只选择web就可以了,其他的以后会慢慢用到,选择好就可以下一步了。 等待Maven加载依赖完成之后,项目结构就是下面这个样子的。注意:最好将application.properties改为yaml格式,因为yaml格式相对清晰明了。 ├―― pom.xml └―― src ├―― main │ ├―― java │ │ └―― com │ │ └―― example │ │ └―― demo1 │ │ └―― Demo1Application.java //SpringBoot启动类,自动生成的 │ └―― resources │ ├――

[Shell习题] 常见题系列二

匿名 (未验证) 提交于 2019-12-03 00:19:01
$ cat test2.sh #!/bin/bash function f (){ echo "hello world" } f #函数调用 f #函数连续调用两次 # 输出: hello world hello world $ a= "hello" $ b= "world" $ echo $a $b helloworld $ echo $a $b # $a $b中间有空格 hello world $ c= $a $b $ echo $c helloworld $ d= $a $b #不能有空格 - sh: world: command not found a= 5 b= 6 $ expr $a + $b 11 $ echo $( (a + b)) 11 $ echo $[ a + b] 11 echo $( ( $a + $b )) # echo $( (a+b)),双小括号里面可以不用加 $符 号 echo $[ $a + $b ] # echo $[ a + b],可以不加 $符 号,可以没有空格 $ expr $a + $b 5 + 6 #!/bin/bash if [ -f "/home/qiuxianyin/mytest/test.sh" ] #紧挨着 [ ] 左右有空格,否则报错 then echo "file exists" fi if 参数 [ -f file ]

Widget 中的 State 解析

匿名 (未验证) 提交于 2019-12-03 00:11:01
StatefulWidget 应对有交互、需要动态变化视觉效果的场景 StatelessWidget 则用于处理静态的、无状态的视图展示 那么,StatelessWidget 是否有存在的必要?StatefulWidget 是否是 Flutter 中的万金油? 原生系统(Android、iOS)或原生 JavaScript 开发中,视图开发是命令式的,需要精确地告诉操作系统或浏览器用何种方式去做事情。比如,如果想要变更界面的某个文案,则需要找到具体的文本控件并调用它的控件方法命令,才能完成文字变更。 下述代码分别展示在 Android、iOS 及原生 Javascript 中,如何将一个文本控件的展示文案更改为 Hello World: // Android 设置某文本控件展示文案为 Hello World TextView textView = ( TextView ) findViewById ( R . id . txt ); textView . setText ( "Hello World" ); // iOS 设置某文本控件展示文案为 Hello World UILabel * label = ( UILabel *)[ self . view viewWithTag : 1234 ]; label . text = @ "Hello World" ; // 原生

6 go中defer关键字的用法

匿名 (未验证) 提交于 2019-12-03 00:03:02
defer关键字 defer是go里面处理异常的一个关键字,应用场景类似于java里面的finally,使用的时候就是所有的其他的正常的函数进程执行完毕之后都要执行defer。 也就是被defer修饰的函数或者语句都是等到所有的作用域内部的函数执行完毕才会执行。 而且defer修饰的语句应该是以压栈的方式存储在某一个指令栈里面,先放进去的后执行。 func main { for i := 1 ; i < 5 ; i ++{ defer fmt . Printf ( "%d" , i ) } fmt . Printf ( "AAA" ) } //输出 AAA12345 defer 与匿名函数搭配使用 func main { defer func ( a , b int ){ fmt . Println ( a + b ) }() f := func ( a , b string ){ fmt . Println ( a + b ) } defer f ( "a" , "b" ) } defer与panic panic你可以理解为抛出异常,然后panic执行之后,如果没有recover的话程序就会abort,但是在之前defer仍然会执行,释放资源做一些收尾的工作。如果是在panic调用之后再调用defer那肯定是来不及的。先做预防 package main import ( "fmt