重返零点
来源:互联网 发布:火麒麟红包软件 编辑:程序博客网 时间:2024/04/27 15:54
=== 2015-06-04 ===
Using Grep & Regular Expressions to Search for Text Patterns in Linux
=== 2015-04-22 ===
Problems with files with accents in name
For iso 8859-1 accented characters,set Custom Charset to iso 8859-1 (neither "Autodetect" or "Force UTF-8") then it can download properly to local machine
Safely change primary group of a user in Linux
sudo usermod -g NewPrimaryGroup -G mackey,adm,cdrom,sudo,dip,plugdev,sambashare,lpadmin mackey
chmod
chown
newgrp
chgrp group_name file/directory_name
The difference between Primary and Secondary groups in Linux
[chia]$ id
uid=1000(chia) gid=1000(chia) groups=4(adm),20(dialout),119(admin),1000(chia)
[chia]$ grep chia /etc/passwd
chia:x:1000:1000:chia,,,:/home/chia:/bin/bash
[chia]$ newgrp admin
[chia]$ id
uid=1000(chia) gid=119(admin) groups=4(adm),20(dialout),119(admin),1000(chia)
GID, current, primary, supplementary, effective and real group IDs?
The first distinction refers to how processes are being run. Normally, when you run a command/program, it is run with the privileges of your user. It has the real group id same as your user's primary group. This can be changed by a process in order to preform some tasks as a member of another special group. To do that, programs use the setgid function that changes their effective group id.
Linux Users and Groups
When set on a file or directory, the sticky bit, or +t mode, means that only the owner (or root) can delete the file, regardless of which users have write access to this file/directory by way of group membership or ownership.
Note, to change the sticky bit, you need to be either root or the file owner.
Files created in +s directories receive the ownership of that directory’s user and group, rather than the ownership of the user that created the file and their default group.
=== 2015-03-18 ===
stringstream
The basic methods for stringstream are:
- clear () -- clears the error bits in the stringstream object so that you can use it again. You need to call this each time you start parsing a new string with the stringstream object. If you don't, the object could still be in a bad state and you may not be able to read anything from the stringstream (even if you change its associated string).
- str () -- returns the string associated with the stringstream object.
- str (s) -- associates the string s to the stringstream object.
- operator<< -- add a string to the stringstream object.
- operator>> -- read something from the stringstream object.
Discover the traps when using stringstream.str()
In fact, when streamstring calls str(), it returns a temporary string object, which will be destructed along with the function return. Thenc_str() is called right afterstr() and the argument passed intoc_str() is a corresponding C string of the temporary string object. Thus, these strings cannot be referenced after the expression evaluation, and the memory will be retrieved or might be overwritten.http://stackoverflow.com/questions/1374468/c-stringstream-string-and-char-conversion-confusionC++ stringstream, string, and char* conversion confusion
stringstream.str()
returns a temporary string object that's destroyed at the end of the full expression. If you get a pointer to a C string from that (stringstream.str().c_str()
), it will point to a string which is deleted where the statement ends. That's why your code prints garbage.As soon as the statement const char* cstr2 = ss.str().c_str();
is complete, the compiler sees no reason to keep the temporary string around, and it's destroyed, and thus yourconst char *
is pointing to free'd memory.
- 重返零点
- 零点
- 零点
- 重返白桦林
- 重返理性
- 重返地球
- 重返CSDN
- 重返CSDN
- 重返博客
- 重返CSDN
- 重返英国
- 重返西安
- 重返人间
- 重返华师一
- 重返CSDN
- 重返CSDN
- 重返CSDN
- 重返CSDN
- 解决java获取oracle数据库值时丢失小数点前面的0
- duilib 封装VCL
- [转] 有些事,我们总是弄不懂;有些人,我们总是猜不透;有些坎,我们总是跨不过;有些伤,我们总是治不好;有些爱,我们总是得不到
- servlet(6) - servlet总结 - 小易Java笔记
- 桶装水站六成是黑店 杂牌水贴上名牌标
- 重返零点
- 【BZOJ】2434: [Noi2011]阿狸的打字机 AC自动机+树状数组
- Django模板遍历字典的方法
- View_Two_重绘+用代码加载控件_141104
- Android Activity的切换动画
- JSP自建标签_1_TLD文件描述
- Android 实现能够暂停的录音功能
- 错误信息 NSError
- 我所理解的c++编程技巧