unix

PostgreSQL - pg_config -bash: pg_config: command not found

戏子无情 提交于 2020-01-22 17:05:08
问题 I'm on a Mac building an app in Rails 3 with PostgreSQL... PostgreSQL is working fine but in the command line I get the following error: $ pg_config -bash: pg_config: command not found Anyone know how to get this setup so I can run pg_config? Thanks 回答1: you can install postgresql-devel to get that. in rpm based distro yum install postgresql-devel will work or use yum provides "*/pg_config" to get the exact package 回答2: In addition to installing postgresql-devel I had to modify the PATH

PostgreSQL - pg_config -bash: pg_config: command not found

戏子无情 提交于 2020-01-22 17:05:08
问题 I'm on a Mac building an app in Rails 3 with PostgreSQL... PostgreSQL is working fine but in the command line I get the following error: $ pg_config -bash: pg_config: command not found Anyone know how to get this setup so I can run pg_config? Thanks 回答1: you can install postgresql-devel to get that. in rpm based distro yum install postgresql-devel will work or use yum provides "*/pg_config" to get the exact package 回答2: In addition to installing postgresql-devel I had to modify the PATH

Unable to open socket file: target process not responding or HotSpot VM not loaded

故事扮演 提交于 2020-01-22 16:00:15
Unable to open socket file: target process not responding or HotSpot VM not loaded The -F option can be used when the target process is not responding 在用jstack工具查看jvm线程的运行情况时出现上述错误。就是因为该进程长时间没有启停,在/tmp/hsperfdata_'username'/文件夹下的该进程文件被Linux自身的机制(tmp下面不能存放很多文件)删除,需重新启停。所以要注意/etc/cron.daily/tmpwatch改文件在生产的情况。否则出现内存泄漏,或者内存溢出时,很难排查,或者出现系统运行缓慢时,想要观察系统运行情况也没办法,再或者,想把现场保存至dump文件中,等待大神解决也不能做。 解决办法: 转载: http://zhangshaoxiong.blog.51cto.com/4408282/1310166 对线上服务器的java应用dump操作时发现,以下报错,不能dump。jps也获取不到java进程的pid。 # jmap -dump:file=/data/dump/jvm_en.hprof 20176 20176: Unable to open socket file: target

gnu screen: can you automatically name a window after the last invoked program?

寵の児 提交于 2020-01-22 12:33:05
问题 Is there a way to automatically have each window change its name to the name of the last program you ran from that window? This would be more convenient than having to rename the windows manually. 回答1: Yes, you can use shelltitle to do this. Assuming you use bash, the following should work. Add this to your .screenrc : shelltitle "$ |bash" where the "$ " should match whatever is at the end of your prompt string ($PS1) and "bash" is the default title. Then add a null title escape sequence to

What is the difference between find with grep?

情到浓时终转凉″ 提交于 2020-01-22 12:17:31
问题 What is the difference between these command: find . –type f –name '*txt*' and find . –type f | grep 'txt' I tried to run this and there is a difference but I want to know why? 回答1: The Major difference is FIND is for searching files and directories using filters while GREP is for searching a pattern inside a file or searching process(es) FIND is an command for searching file(s) and folder(s) using filters such as size , access time , modification time. The find command lists all of the files

开源许可的起源

北城余情 提交于 2020-01-22 10:57:54
如今的技术专家,是在微软Windows和商业专卖软件(专利软件)时代长大的,他们可能会认为开源许可是始于上世纪90年代的新趋势。虽然开源许可在最近20年大受欢迎简直被捧上了天,但事实上,开源才是软件许可的最初模式,之后才出现了专利许可。 实际上,开源许可和专利许可这两种模式源自同一个根:Unix 操作系统。Unix是AT&T贝尔实验室在上世纪60年到70年初开发出来的,这是第一个通用操作系统。当时,AT&T在市场占有绝对主导地位,这使得美国司法部发布了一个法令禁止AT&T参与电话服务领域以外的商业活动,电话服务是AT&T的主营业务。因为这一法令导致AT&T无法将Unix开发成商业产品,所以贝尔实验室将Unix的源代码捐献了出来,其所条款是允许对源代码修改和再发布。这使得Unix在上世纪70年代和80年代在计算机科学家中广发使用和普及。 在1983年美国司法部撤除法令后,AT&T对Unix商业化成专利产品而且采用了更为严格地许可条款——只允许Unix以编译后的二进制文件发布。同时,上个世纪80年代迎来微计算机(PC机),这引起了软件的标准化。标准化反过来又促进了各公司以二进制问津形式发布软件,因为这使得用户研究和解决源代码的需求减少了。因此,专利许可成为了软件许可的主要形式。 在上世纪90年代,随着Linux操作系统的开发,开源许可再次兴起。自从Unix系统私有化以后

Batch replace text inside text file (Linux/OSX Commandline)

*爱你&永不变心* 提交于 2020-01-22 10:02:13
问题 I have hundreds of files where I need to change a portion of its text. For example, I want to replace every instance of "http://" with "rtmp://" . The files have the .txt extention and are spread across several folders and subfolder. I basically am looking for a way/script that goes trough every single folder/subfolder and every single file and if it finds inside that file the occurrence of "http" to replace it with "rtmp". 回答1: You can do this with a combination of find and sed : find .

Convert a uint16_t to char[2] to be sent over socket (unix)

廉价感情. 提交于 2020-01-22 09:30:50
问题 I know that there are things out there roughly on this.. But my brains hurting and I can't find anything to make this work... I am trying to send an 16 bit unsigned integer over a unix socket.. To do so I need to convert a uint16_t into two chars, then I need to read them in on the other end of the connection and convert it back into either an unsigned int or an uint16_t, at that point it doesn't matter if it uses 2bytes or 4bytes (I'm running 64bit, that's why I can't use unsigned int :) I'm

Convert a uint16_t to char[2] to be sent over socket (unix)

天涯浪子 提交于 2020-01-22 09:30:08
问题 I know that there are things out there roughly on this.. But my brains hurting and I can't find anything to make this work... I am trying to send an 16 bit unsigned integer over a unix socket.. To do so I need to convert a uint16_t into two chars, then I need to read them in on the other end of the connection and convert it back into either an unsigned int or an uint16_t, at that point it doesn't matter if it uses 2bytes or 4bytes (I'm running 64bit, that's why I can't use unsigned int :) I'm

How to convert a text file to binary file using linux commands

旧时模样 提交于 2020-01-22 09:29:09
问题 I have hex code of a binary in text (string) format. How do I convert it to a binary file using linux commands like cat and echo ? I know command following command with create a binary test.bin. But what if this hexcode is in another .txt file ? How do I "cat" the content of text file to "echo" and generate a binary file ? # echo -e "\x00\x001" > test.bin 回答1: use xxd -r . it reverts a hexdump to its binary representation. source and source Edit : The -p parameter is also very useful. It