sage

使用ls列出目录及其总大小

耗尽温柔 提交于 2019-12-21 14:27:29
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 是否有可能在Unix中使用 ls 来列出子目录及其所有内容的总大小,而不是通常的4K(我假设)只是目录文件本身? IE total 12K drwxrwxr-x 6 *** *** 4.0K 2009-06-19 10:10 branches drwxrwxr-x 13 *** *** 4.0K 2009-06-19 10:52 tags drwxrwxr-x 16 *** *** 4.0K 2009-06-19 10:02 trunk 在搜索了这些手册页后,我空洞地说。 #1楼 看看 du 命令 #2楼 尝试类似的东西: du -sh * 简短版本: du --summarize --human-readable * 说明: du : D isk U sage -s :显示每个指定文件的摘要。 (相当于 -d 0 ) -h :“人类可读”输出。 使用单位后缀: B yte, K ibibyte(KiB), M ebibyte(MiB), G ibibyte(GiB), T ebibyte(TiB)和 P ebibyte(PiB)。 (BASE2) #3楼 我总是使用 du -sk ( -k 标志显示文件大小,以千字节为单位)。 #4楼 你想要的命令是'du -sk'du =“磁盘使用”

Calling SageMath functions from Javascript

不羁岁月 提交于 2019-12-13 07:19:02
问题 I ask the question and I have to admit that I'm a bit confused on the way to be precise to ask the question... Sorry for that! Anyhow, I'm using from time to time SageMath on a local machine. I have seen that SageMath is also offering access from a server Sage Cell Server. If I understand well this is a way to access SageMath interpreter from a web browser. But this doesn't provide access to the "base functions" of SageMath from JavaScript. That would be a kind of "wrapping" of SageMath basic

Installing Sage 6 and opening it on windows 8 PC with 64 bit

ⅰ亾dé卋堺 提交于 2019-12-12 02:27:35
问题 This question is mainly about installation of Sage, but I figured I'd give here a try: also in general I'm a bit confused regarding installation of Sage: I went to the download page, after choosing the server close to my location: sage-6.1.1.tar.gz and downloaded it to my windows 8, 64-bit PC. However, the file is not opening (I double clicked on it in order to run it) in my PC, even after installing 7-zip, with which I could extract/convert it to a .tar file. What is your suggestion for

sage emacs mode not working in ubuntu

故事扮演 提交于 2019-12-11 17:56:40
问题 I am new to linux. and starteing to use Sage. I installed the sage mode for emacs. However its not working. I am not sure where is the init.el file for emacs located. I added the script given at the end of the installation in site-start.el(or a similar name file) file. But nothing is happening. The mode is not getting activated. Can someone suggest a way out. Thanks Anil 回答1: first of all you should read some introduction to emacs and its init file: "http://wikemacs.org/index.php/User's

Sage polynomial coefficients including zeros

早过忘川 提交于 2019-12-11 03:53:45
问题 If we have a multivariate polynomial in SAGE for instance f=3*x^3*y^2+x*y+3 how can i display the full list of coefficients including the zero ones from missing terms between maximum dregree term and constant. P.<x,y> = PolynomialRing(ZZ, 2, order='lex') f=3*x^2*y^2+x*y+3 f.coefficients() gives me the list [3, 1, 3] but i'd like the "full" list to put into a a matrix. In the above example it should be [3, ,0 , 0, 1, 0, 0, 0, 0, 3] corresponding to terms: x^2*y^2, x^2*y, x*y^2, x*y, x^2, y^2,

Is there a way to tell gedit that .sage files should always be highlighted as Python code?

送分小仙女□ 提交于 2019-12-11 02:27:19
问题 Well, that's about all there is to say. Currently I have to set the highlighting on each file by hand, which is getting annoying, especially since it sometimes forgets and I have to set it again. I'm using gedit 3.6.1 on a lubuntu machine, if that matters. Sorry if this is a really easy question, but I haven't been able to figure it out myself. Thanks. 回答1: Thanks to Fredrik's comment I found an easy solution, although it seems like more of a hack than one would want. go to /usr/share

compatibility between sage and numpy

冷暖自知 提交于 2019-12-11 01:23:38
问题 Here are two lines of code for the purpose of generating a random permutation of size 4: from numpy import random t = random.permutation(4) This can be executed in Python, but not sage, which gives the following error: TypeError Traceback (most recent call last) <ipython-input-3-033ef4665637> in <module>() 1 from numpy import random ----> 2 t = random.permutation(Integer(4)) mtrand.pyx in mtrand.RandomState.permutation (numpy/random/mtrand/mtrand.c:34842)() mtrand.pyx in mtrand.RandomState

XOR two blocks in python

自古美人都是妖i 提交于 2019-12-10 22:56:32
问题 i am new to programming in python...i want to make XOR between 2 blocks here is my code def XorBlock(block1, block2): l = len(block1); if (l != len(block2)): raise ValueError, "XorBlock arguments must be same length" return [(block1[j]+block2[j]) % 2 for j in xrange(l)]; but when i call it gives me TypeError: not all arguments converted during string formatting so please anyone help me where is the bug in this code..thanks in advance 回答1: Perhaps this is what you're looking for: def XorBlock

JDBC连接MySQL(记)

江枫思渺然 提交于 2019-12-10 19:18:01
回顾一下JDBC。 通过JDBC基本流程连接数据库,一般称为六部曲: 第一步:导入驱动包(这里用的是5.1.47版本的 地址是5.1.48的—— 官方下载地址 ) 第二步:加载驱动类-反射 Class.forName("com.mysql.jdbc.Driver"); 我们可以点进去看,是通过静态块进行加载的。 第三步:获取连接(与数据库进行联通操作) conn= DriverManager.getConnection("jdbc:mysql://地址:端口号/数据库的名字?useSSL=false&characterEncoding=utf-8","用户","密码"); 第四步:创建状态参数(流<--->既能读又能写)用一个结果集装起来 pstat = conn.prepareStatement("select * from student"); 第五步:执行数据库操作--增删查改(查是最复杂的。) // 如果是更新操作,返回值是更新数据库的行数 // int count = pstat.executeUpdate();//返回值--->更新数据库的行数 // System.out.println(count); //这里是读操作(查询) rs = pstat.executeQuery(); while(rs.next()){ int sid = rs.getInt("sid")

Why is creating a range from 0 to log(len(list), 2) so slow?

家住魔仙堡 提交于 2019-12-08 17:23:01
问题 I don't have a clue why is this happening. I was messing with some lists, and I needed a for loop going from 0 to log(n, 2) where n was the length of a list. But the code was amazingly slow, so after a bit a research I found that the problem is in the range generation. Sample code for demonstration: n = len([1,2,3,4,5,6,7,8]) k = 8 timeit('range(log(n, 2))', number=2, repeat=3) # Test 1 timeit('range(log(k, 2))', number=2, repeat=3) # Test 2 The output 2 loops, best of 3: 2.2 s per loop 2