size

Listing files in a directory with Python when the directory is huge

僤鯓⒐⒋嵵緔 提交于 2019-12-11 03:38:58
问题 I'm trying to deal with many files in Python. I first need to get a list of all the files in a single directory. At the moment, I'm using: os.listdir(dir) However. This isn't feasible since the directory I'm searching has upward of 81,000 files in it, and totals almost 5 Gigabytes. What's the best way of stepping through each file one-by-one? Without Windows deciding that the Python process is not responding and killing it? Because that tends to happen. It's being run on a 32-bit Windows XP

Java program to calculate directory size keeps throwing NPE

偶尔善良 提交于 2019-12-11 03:36:36
问题 I'm working on a program that loops through a specific directory (example, C:\Documents) and calculates the total size taken up by it on the disk. For some reason, however, my program keeps throwing a null pointer exception at a point where it seems to be looking for a folder called "My Music" within the Documents folder. "My Music" does not exist in my Documents folder, so I am very confused about where it gets it from. I understand why it's throwing the exception (obviously if it can't find

Length of an XML file

☆樱花仙子☆ 提交于 2019-12-11 03:19:50
问题 I have an XML file of size 31 GB. I need to find the total number of lines in that file. I know the command wc -l will give me the same. However it's taking too long to perform this operation. Is there any faster mechanism to find the number of lines in a large file? 回答1: 31 gigs is a really big text file. I bet it would compress down to about 1.5 gigs. I would create these files in a compressed format to begin with then you can stream a decompressed version of the file through wc. This will

Maximum and minimum value of C types integers from Python

杀马特。学长 韩版系。学妹 提交于 2019-12-11 02:59:32
问题 I'm looking for a way to get (using Python) the maximum and minimum values of C types integers (ie uint8 , int8 , uint16 , int16 , uint32 , int32 , uint64 , int64 ...) from Python. I was expecting to find this in ctypes module In [1]: import ctypes In [2]: ctypes.c_uint8(256) Out[2]: c_ubyte(0) In [3]: ctypes.c_uint8(-1) Out[3]: c_ubyte(255) but I couldn't find it. Julia have great feature for this: julia> typemax(UInt8) 0xff julia> typemin(UInt8) 0x00 julia> typemin(Int8) -128 julia> typemax

jQuery: change fancybox width

◇◆丶佛笑我妖孽 提交于 2019-12-11 02:58:54
问题 I'm showing different types of images on a site. Attached to every image I want to add some text. I have written this text in the title-element in the html document. This text is a few sentences long. What happens now is that the fancybox becomes really narrow (since the picture is quite small) and the text looks really stupid. I've tried to change the width and height values within the fancybox code, but it still doesn't seem to work. I tried to fix it in css too, and I got the title text to

How To create A Large Size Custom Cursor In Java?

不问归期 提交于 2019-12-11 02:34:39
问题 I'm developing a Java Swing app for an award winning password protection system, and I need a large custom cursor [ 80 x 80 ], you might ask why so large, there is an online web demo you may look at to learn why it needs to be so large : http://gatecybertech.net That large cursor is used on the login page in the above link. Of course you need to create a test password first before you can try the login process. But anyway, in my Swing app, I hit a limit of 32 x 32 for the largest possible

Setting fixed width size of view with pt/mm/in ANDROID

妖精的绣舞 提交于 2019-12-11 02:28:28
问题 I'm trying to set fix width to a view. “in”, “mm”, and “pt” are density independent and the same size on every device or i am wrong? My view width should be 141.3pt/49.8mm , so i am setting in the XML android:layout_width="141.3pt" or via code: float requiredPx = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PT, (float) 141.3, dm); ViewGroup.LayoutParams params = mRequiredSizeLine.getLayoutParams(); params.width = (int)requiredPx; mRequiredSizeLine.setLayoutParams(params); The thing is

Size of reference of an class in JAVA

帅比萌擦擦* 提交于 2019-12-11 02:27:37
问题 What is the size of reference of a class in Java? Is it constant for a particular JVM and OS irrespective of the class for which the reference is made. Class A Class B Class C A a; B b; C c; Are the size of a , b and c the same irrespective of the size of A , B and C classes? 回答1: Yes, all references are "pointers" to Objects or indirect "pointers to pointers" to Objects. Their actual in memory size is an implementation detail of the JVM but you can be sure that they are equal in size for

operations with different int types

安稳与你 提交于 2019-12-11 02:24:55
问题 I have a program which uses multiple different int types. Most often used are uint64_t and the standard int . However I wonder if I can safely do operations mixed between them. For instance I have an uint64_t and I want to add an int to it and store that value as another uint64_t . Is doing such a thing safe? Do I have to cast the int to uint64_t before I can use operations on it? I can`t really find stuff about it online. It might just be allowed and no one questions it or my Google queries

Why would changing a structure size, change the size of an executable?

泄露秘密 提交于 2019-12-11 02:13:41
问题 Very strange issue I'm working to debug, currently at a loss so I wanted to see if anyone had any thoughts/ideas. There's a define in one of the char drivers in my code base (this is one of many drivers within a uCLinux distribution): #define MAX_BUFSIZE 500 When I build like this I see the output package size: -rw-rw-r-- 1 mike users 1720620 Jan 16 11:00 gcl-kernel.pkg When I change the define to 1000 and rebuild: #define MAX_BUFSIZE 1000 -rw-rw-r-- 1 mike users 2359596 Jan 16 11:17 gcl