strip

Remove a revision in TortoiseHG and Mercurial

旧时模样 提交于 2019-12-05 06:35:45
In my repository I needed to revert to an older revision. I did reverting and made the changes I needed to. How do I push the new revision upstream? I was on rev 17 when I needed to revert back to rev 13. Now that I've made my changes, I'm on rev 18. Thing is, when I go to push these changes up (I'm using TortoiseHG), I get an error "abort:push create new remote head . I don't want to do a merge. Do I want to do a force with the --force command or do I need to delete rev 14-17. If I need to delete, how do I delete 14-17.? Proper solution is to actually merge with option Discard all changes

Strip whitespace in generated HTML using pure Python code

大城市里の小女人 提交于 2019-12-05 03:56:57
I am using Jinja2 to generate HTML files which are typically very huge in size. I noticed that the generated HTML had a lot of whitespace. Is there a pure-Python tool that I can use to minimize this HTML? When I say "minimize", I mean remove unnecessary whitespace from the HTML (much like Google does -- look at the source for google.com, for instance) I don't want to rely on libraries/external-executables such as tidy for this. For further clarification, there is virtually no JavaScript code. Only HTML content. If you just want to get rid of excess whitespace, you can use: >>> import re >>>

gcc vs. clang: symbol stripping

半城伤御伤魂 提交于 2019-12-05 00:46:12
gcc and AMD Open64 opencc both have a -s option to "strip symbol table and relocation information". So far I haven't been able to find the same option in Clang/LLVM. Does it exist? You can use a strip utility from binutils. Actually, a llvm-ld has this options http://llvm.org/cmds/llvm-ld.html -strip-all, -s Strip all debug and symbol information from the executable to make it smaller. -strip-debug, -S Strip all debug information from the executable to make it smaller. opt have something too: -strip-debug This option causes opt to strip debug information from the module before applying other

Is there an easy way to strip HTML from a QString in Qt?

笑着哭i 提交于 2019-12-04 22:18:54
I have a QString with some HTML in it... is there an easy way to strip the HTML from it? I basically want just the actual text content. <i>Test:</i><img src="blah.png" /><br> A test case Would become: Test: A test case I'm curious to know if Qt has a string function or utility for this. You may try to iterate through the string using QXmlStreamReader class and extract all text (if you HTML string is guarantied to be well formed XML). Something like this: QXmlStreamReader xml(htmlString); QString textString; while (!xml.atEnd()) { if ( xml.readNext() == QXmlStreamReader::Characters ) {

Python字符串常用处理函数

南笙酒味 提交于 2019-12-04 13:29:24
代码运行 python 版本 3.7 index() 获取子串在字符串中出现的位置索引值 lang = 'aaa1113234' lang.index('a') # 0 lang.index('1') # 3 lang.index('23') # 7 使用索引获取单字符 索引0为第一字符。索引可为负数,表示从尾部(右侧)起始 lang = 'python' lang1 = '老陆编程测试中文' lang[3] # h lang1[3] # 程 lang[-1] # n lang1[-1] # 文 使用切片获取子串 获取子串包括首索引字符,不包括尾索引字符 lang[1:4] # yth lang[1:] # ython lang[:3] # pyt lang[-2:] # on 注意此处尾索引不能为0,否则得到空字符串'' lang[-4:-2] # th lang[:-4] # py lang[:] # python 反转字符串 中文也有效 lang1 = '老陆编程测试中文' lang1[::-1] # 文中试测程编陆老 len()方法获取字符串长度 len(lang) # 6 len(lang1) # 8 in 操作符判断子串是否在字符串中 'p' in lang # True 'ab' in lang # False '测试' in lang1 # True max() 和

Regex to strip phpdoc multiline comment

◇◆丶佛笑我妖孽 提交于 2019-12-04 08:37:49
I have this: /** * @file * API for loading and interacting with modules. * More explaination here. * * @author Reveller <me@localhost> * @version 19:05 28-12-2008 */ I'm looking for a regex to strip all but the @token data, so the result would be: @file API for loading and interacting with modules. More explaination here. @author Reveller <me@localhost> @version 19:05 28-12-2008 I now have this: $text = preg_replace('/\r?\n *\* */', ' ', $text); It does the job partially: it only removes the * in front of each line. Who could help me so it also strips /** and the final slash /? Any help would

Python strip() not working inside a function

时光总嘲笑我的痴心妄想 提交于 2019-12-04 07:15:44
问题 I am trying to use strip() to trim off the space before and after a string. It works fine for str1 = " abdced " str1.strip() However when I use it inside a function, it is not working: def func(str1): return str1.strip() print func(" abdwe ") It won't trim off any space. Anyone can tell what's happening? Thanks! 回答1: strip is not an in-place method, meaning it returns a value which must be reassigned like so: str1 = str1.strip() # the string is reassigned to the returned stripped string 回答2:

Remove question mark from Paperclip-generated files in Ruby on Rails 3.2.6

扶醉桌前 提交于 2019-12-04 05:10:12
I'm using Paperclip-FFMEG to upload video files to my development environment (and, eventually, to a local server when my project goes into production). When videos are uploaded, the filename is, by default, as follows: /system/modelnames/paperclipnames/.../mynewfile.mp4?xxxxxxxxxx I believe the 10 digit figure after the questionmark is a timestamp. However, the player I will be using to play the videos doesn't like to have anything after the file attachment - so I would like to strip the questionmark, and the timestamp after it, before passing the URL into the player. I tried to use the

Get first word of all strings in lists

不羁岁月 提交于 2019-12-04 05:03:54
问题 I have a CSV file which I'm reading in like below. I need to get the first word of all the strings. I know how to get first letter but I'm not sure how I can get words. ['diffuse systemic sclerosis', 'back', 'public on july 15 2008'] ['diffuse systemic sclerosis', 'forearm', 'public on may 9 2014'] I want my output to be diffuse back public forearm 回答1: You can use a list comprehension , and split() function : >>> l=['diffuse systemic sclerosis', 'back', 'public on july 15 2008'] >>> [i.split

Android Strip Audio From Video

耗尽温柔 提交于 2019-12-04 01:03:39
问题 In my program, it gets MP4 video in, and I want it to output a MP3 (without any server-side stuff.) Since Android (and my app) needs to run on many different hardware configurations, this means I probably cannot use FFMPEG. I know this may be very battery and processing power intensive, especially for a mobile phone, but I need this option for my users. I cannot find any native libraries for Java that don't use FFMPEG. 回答1: I see little problem with FFMPEG, since apparently it runs on 11