size

How can I get the size of a folder on SD card in Android?

风格不统一 提交于 2019-12-27 20:07:09
问题 Is it possible to easily get the size of a folder on the SD card? I use a folder for caching of images, and would like to present the total size of all cached images. Is there a way to this other than iterating over each file? They all reside inside the same folder? 回答1: Just go through all files and sum the length of them: /** * Return the size of a directory in bytes */ private static long dirSize(File dir) { if (dir.exists()) { long result = 0; File[] fileList = dir.listFiles(); for(int i

堆积排序法 C#

╄→尐↘猪︶ㄣ 提交于 2019-12-27 05:41:06
using System ; using System . Collections . Generic ; using System . Linq ; using System . Text ; using System . Threading . Tasks ; namespace 堆积排序法 { class Program { static int [ ] data = { 0 , 5 , 6 , 4 , 8 , 3 , 2 , 7 , 1 } ; static void Main ( string [ ] args ) { int size = 9 ; Console . Write ( "初始数组:" ) ; for ( int i = 1 ; i < size ; i ++ ) { Console . Write ( "[" + data [ i ] + "] " ) ; } Heap ( data , size ) ; //建立堆积树 Console . Write ( "\n排序结果:" ) ; for ( int i = 1 ; i < size ; i ++ ) { Console . Write ( "[" + data [ i ] + "] " ) ; } Console . WriteLine ( ) ; Console . ReadKey ( ) ; }

三八节我靠这一招让她开心似女皇

主宰稳场 提交于 2019-12-26 13:59:17
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 作为一个有割掉的程序员,对不起,这里应该是格调,酒喝多了有些糊涂。 好吧我们重来一遍。 作为一个有格调的程序员,我们根本不是外界说的那种闷骚宅,此刻的我又含了一汤匙川贝枇杷膏,狠狠的怼了一口野格,据说这是当下欧美流行趋势,对于我这种有格调有品位的人,就得这么喝酒。 眼瞅着半边天的节日就要到了,女神那边似乎不能放假半天导致她有些小情绪。怎么让我的女神高兴起来呢?这个命题拷问着我已经晕晕乎乎的灵魂,实话实说,我的灵感已经在情人节释放殆尽,随着呼呼的北风吹到了遥远的陌生地方。 班儿加到一半儿,看着不断报错的日志,我竟然突然有了灵感。我是一名资深的程序员啊同志们,有报错就要溯源,有bug就要解决,有需求就要迎难而上啊同志们! 说干就干! 我准备用最擅长人工智能的Watson为我做点什么! 说干就干!毫不犹豫的干起来! 首先我悄悄收集了女神朋友圈里精心拍出来的照片,接着,利用IBM Watson的接口,我为所有的图片都打上了标签。聪明的你一定想到了,这些标签经过整理,高频出现的一定就是女神的最爱! 当结果输出的一刻,内心五味杂陈的我流下了两行热泪…… 泪眼迷离的我望着枇杷膏的空瓶,狠狠的生怼了几口野格,看了看帐户的余额,直接下单了一个能买得起的最贵的名牌包包…… 颤抖的双手久久不能平息删除代码的罪恶

centos6.5新增加硬盘挂载并实现开机自动挂载

落爺英雄遲暮 提交于 2019-12-26 07:14:14
在内网主机新增一个2T硬盘,先关机断电再连接硬盘数据线和电源线! 查看当前磁盘设备信息: [root@tb ~]# fdisk -l WARNING: GPT (GUID Partition Table) detected on '/dev/sdb'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sectors/track, 19457 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sdb1 1 19458 156290903+ ee GPT Disk /dev/sda: 2000.4 GB, 2000398934016 bytes 255 heads, 63 sectors/track,

IndexError on huge list in Python

主宰稳场 提交于 2019-12-25 14:16:15
问题 Handling a list product of 100x100 size is fine in python : >>> import itertools >>> import numpy as numpy >>> nested_loop_iter = itertools.product(range(100), range(100)) >>> probs = np.fromiter(map(lambda x: x[0] *x[1], nested_loop_iter), dtype=int) >>> probs array([ 0, 0, 0, ..., 9603, 9702, 9801]) But when the size of the list product grows to 100,000 x 100,000, it throws an IndexError : >>> import itertools >>> import numpy as numpy >>> nested_loop_iter = itertools.product(range(100000),

IndexError on huge list in Python

痞子三分冷 提交于 2019-12-25 14:15:30
问题 Handling a list product of 100x100 size is fine in python : >>> import itertools >>> import numpy as numpy >>> nested_loop_iter = itertools.product(range(100), range(100)) >>> probs = np.fromiter(map(lambda x: x[0] *x[1], nested_loop_iter), dtype=int) >>> probs array([ 0, 0, 0, ..., 9603, 9702, 9801]) But when the size of the list product grows to 100,000 x 100,000, it throws an IndexError : >>> import itertools >>> import numpy as numpy >>> nested_loop_iter = itertools.product(range(100000),

Android - Adjust button height by checkbox height?

可紊 提交于 2019-12-25 07:57:45
问题 I've got a ListView , one row of which contains Button , CheckBox and multiline TextView . The xml layout: <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_centerVertical="true"> <Button android:id="@+id/open" android:layout_height="wrap_content" android:layout_width="wrap_content" android:src="@drawable/play" android:text="Play" android:layout_centerVertical="true" /> <CheckBox

CSS Div re-sizing according to web browser

爱⌒轻易说出口 提交于 2019-12-25 06:52:03
问题 I have a few divs on my code all of them positioned correctly how i want it. The only problem is that they do not re size when i shrink the page. I want to be able to re size them according to the web browsers size. I do not know exactly how to do it and im worried it might mess up their correct top & left position. All of my divs are currently set as absolute positioning. 回答1: Set their sizes to percent values rather than pixels (I asume that's what you're using) 回答2: Set all divs with

How big should an Internet Explorer toolbar icon be?

对着背影说爱祢 提交于 2019-12-25 04:38:14
问题 I'm trying adding my own toolbar icon to Internet Explorer but am unsure what size it should be. The Designing Toolbar Icons for Internet Explorer articles on TechNet indicates 20x20 and 16x16 pixels. Messages (1, 2) in the Internet Explorer Toolbar (Deskband) Tutorial at Code Project imply 22x22 and 16x16 pixels. Using Internet Explorer 7, icons that are 20x20 pixels seem to get stretched. Measuring shows they should be at least 24x24. Anyone have a definitive reference? Alternatively, where