c**********e 发帖数: 2007 | 1 【 以下文字转载自 JobHunting 讨论区 】
发信人: careerchange (Stupid), 信区: JobHunting
标 题: C++ Q87: What is wrong with this swap function?
发信站: BBS 未名空间站 (Sun Oct 9 12:20:26 2011, 美东)
void swap(int *a, int *b) {
int *c;
*c=*a;
*a=*b;
*b=*c;
return;
}
int main() {
int x=5, y=10;
swap(&x, &y);
cout << x << " " << y << endl;
return 0;
}
The correct result is printed, but there is a segmentation fault. Is it
because *c is a local variable? |
|
f****n 发帖数: 4615 | 2 Adding more space to swap space, first mkfile a big file, then "swap -a"
this file to swap file. This mkfile command has two arguments: -n and -v.
"-v" specifies verbose reporting mode. "-n" indicates that the disk space
should be allocated as needed up to the specified size( instead of all
being allocated when the file is created). I don't know the meaning
in parentheses. Can you help me? |
|
s********h 发帖数: 286 | 3 我用我的linux客户端里用vi打开文件的时候,出现这个错误:
E297: Write error in swap file
我对swap一无所知,但是看到前面的帖子似乎swap跟系统空间有关,
我就用df -i查了一下,结果如下:
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/hda3 14385152 225181 14159971 2% /
/dev/hda1 26104 59 26045 1% /boot
none 257989 1 257988 1% /dev/shm
/dev/sda1 36634624 222591 36412033 1% /usbdrive
AFS 9000000 0 9000000 0% /afs
哪位知道这是什么问题,请指教!谢谢! |
|
c******s 发帖数: 58 | 4 SWAP is technically just a package of two bonds.
In your example, you BORROW 50m USD from counterparty and LEND 25m GBP to
him at the same time. During the life of the SWAP, you RECEIVE the interest
on the GBP and pay the interest on USD. At the end of SWAP term, you
exchange the notional amount back, just as paying/receiving bond princeples. |
|
b*****g 发帖数: 20 | 5 Total Return Swap includes prices return and coupon cash flow return
Asset Swap includs only cash flow return |
|
b***k 发帖数: 2673 | 6 ☆─────────────────────────────────────☆
zhyue (态度决定一切) 于 (Tue Sep 25 13:48:00 2007) 提到:
can someone help me to understand how the currency basis swap is determined
given the forward interest rate environment and forward FX rate? For example
, I was perplexed by the change in 2Y Canada/US basis swap (CDBS2 Index) in
the last month. It shot up from 3-4 bps to 12 bps and retreated back to 8
bps. What are the drivers behind that? How should the currency basis swap be
valued in a no-arbitrage mo |
|
c*********n 发帖数: 128 | 7 跟3m Libor对应的swap curve,可以短期用deposite rate,中期用eurodollar future
,长期用swap rate(against 3mLibor)。
那么跟12m Libor对应的swap curve应该怎么构造呢?尤其是,中期对应eurodollar
future的那一段用什么instrument比较好?(eurodollar future只有3个月的啊) |
|
c**s 发帖数: 39 | 8 How to upgrade your phone and keep your phone number with FreedomPop
In this article, I will explain how you are able to upgrade to a new device
the right way so you can retain your Freedom Friends, Phone number, and
account credit. There are different cases to this so I will try to address
everything one by one.
Case One - Upgrading to a FreedomPop phone off the FreedomPop website
If you intend to buy a phone from the FreedomPop website, purchase it while
signed in to your current account. This... 阅读全帖 |
|
d********f 发帖数: 8289 | 9 每次swap都是
There was a problem swapping your device.
If this new device is currently active on any carrier, it must be
deactivated before swapping into your account.
If you entered an ICCID, please try without the ICCID.
我把原来LG G2里面的sim换上来也不行。一定要重新买一个sim吗? |
|
k*****e 发帖数: 93 | 10 手头有一个刚从sprint退下来的iphone6. BYOD Check通过了。
可是要Swap Device的时候,总是说
"There was a problem swapping your device. If this new device is currently
active on any carrier, it must be deactivated before swapping into your
account."
计划是原来3250的有广告的计划。手机3天前刚从sprint退下来。
有谁知道这是为什么吗? |
|
k**********s 发帖数: 6409 | 11 60天里忘了打电话,结果账号被block了。需要把手机解放出来,swap到另一个ESN,总
是fail。
你们有过这样的经历吗?账号被block后就不能swap出去?
现在swap是$4.99了! |
|
c*********i 发帖数: 2749 | 12 那些Sprint,Boost, Virgin的手机有出路啦!
刚才趁着免费swap测试了一下,原来Sprint和Boost的moto E,从R+ swap出来,可以
马上在自由泡注册 500MB,200分钟,500短信免费月服务(Sprint网络,实际可以加好
友增加到1GB),但需要
缴纳20刀激活费。
总比这批手机被废弃强很多。
更新:全网通解锁果子机6s,也可以swap出来之后,马上在自由泡注册他家的sprint服
务,非常方便。 |
|
k****t 发帖数: 2288 | 13 R+ swap到nexus 6p,用的是sprint的SIMOLW506C(目前sprint官网只卖2.99刀)。(适
合iphone,nexus,moto等。。。)
一定要先将sim卡放入手机,然后再swap。
我开始没有放sim卡,怎么都不成功。检测都是说我的手机是没有问题的。
放狗搜了,说一定要放sim卡,手机才会去激活cdma,这样才能swap 成功。。。。。。 |
|
a***a 发帖数: 2493 | 14 swap时当前机子和要swap的机子最好都关机或起码在airplane mode下操作。
有版友swap不成功,关机后再操作就搞定。 |
|
d*******g 发帖数: 1265 | 15 我有一个Sprint 的iphone 5s,现在正在用Ring+。如果我想买一个新的iphone 6s用的
话,应该怎么swap device呢?
1. 把旧手机的sim拿出来,装到新手机里,然后到Ring+网站上Swap Your Device。
2. 用新手机自带的sim,到Ring+网站上Swap Your Device。
我怀疑是第二种方法。如果是第二种方法,那么如果买的是AT&T的手机,里面会有sim
吗?能用吗?如果是Verizon或者T-mobile呢? |
|
b******s 发帖数: 5329 | 16 Verizon Iphone 6用在R+上,打算Swap out出去然后回Verizon,死活Swap out不出去
。dummy id,真实的phone的id都试过,都是失败。最后我干脆拿Iphone 6直接去
Verizon网站Swap in,结果接受了!!!过去这种情况是会检测到Iphone 6还在其他
Carrier用的。。。难倒Sprint已经把R+的手机都Release啦? |
|
f****o 发帖数: 4067 | 17 我用flip phone swap. 没有SIM的旧电话。 死活不行。 ring plus自己的byod
checker没问题。
There was a problem swapping your device.
If this new device is currently active on any carrier, it must be
deactivated before swapping into your account |
|
H***a 发帖数: 189 | 18 拿新手机再开一条线,旧的cancel.
如果想保留旧的号码,这两条线之间可以swap,不需要swap SIM卡,不影响1-year free
plan。
我上星期才刚swap的。 |
|
d********r 发帖数: 211 | 19 附近的dealer都没有我想要一款特殊配置的车, 只有从外州swap.
但是本地的dealer都要Deposit, $500-1000. 谁有过类似经历?
如果最后不喜欢车, 拿回的机会有多大?
Dealer说一般都不退这种swap based deposit. |
|
i****a 发帖数: 36252 | 20 you don't get it. car swap, wife swap, etc are for fun |
|
l****a 发帖数: 17 | 21 需要到西岸小城市呆半年,租车的话没找到什么deal,不算保险一个月也要800+
买二手车又不会看,走的时候还要再卖出去(不需要带回东部)
所以打算lease,最好是接别人的那种lease swap。大家有swap car lease经验的能进
来讲讲吗?怎么去找这种lease呢,是去dealer那里吗
谢谢大家 |
|
r****x 发帖数: 3613 | 22 【 以下文字转载自 Auto_Fans 俱乐部 】
发信人: raymix (ray), 信区: Auto_Fans
标 题: lease swap靠谱吗?
发信站: BBS 未名空间站 (Fri Aug 14 13:17:54 2015, 美东)
想lease车但是不愿意那么长的合同,所以看到了lease swap,不知道这个东西靠谱吗
? |
|
c******n 发帖数: 2273 | 23 label ready
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle
我想要的物品:
[FBA求购]Skylanders Nintendo Wii U Bundle一包走
单张面值:
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle $199
可接受的价格(必须明码标价!):
4个以上, $225
2个以上, $220
一个不收
物品新旧要求:
new sealed
邮寄方式要求:
发email: chenjian.mitbbs at gmail.com
Subject:[FBA求购]Skylanders Nintendo Wii U Bundle 一包走 -mitbbs ID
BBSID: xxxxx,
面值和数量(要准确):
总金额: (加计算公式)
收款方式:billpay/amazon payment
电话号码: (xxx)xxx-xxxx (不可以是google voice)
地址, (cit... 阅读全帖 |
|
n***l 发帖数: 1368 | 24 label ready
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle
单张面值:
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle $199
可接受的价格(必须明码标价!):
4个以上, $220
2个以上, $215
一个不收
物品新旧要求:
new sealed
[email protected]
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.... 阅读全帖 |
|
c******n 发帖数: 2273 | 25 label ready
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle
我想要的物品:
[FBA求购]Skylanders Nintendo Wii U Bundle一包走
单张面值:
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle $199
可接受的价格(必须明码标价!):
4个以上, $225
2个以上, $220
一个不收
物品新旧要求:
new sealed
邮寄方式要求:
发email: chenjian.mitbbs at gmail.com
Subject:[FBA求购]Skylanders Nintendo Wii U Bundle 一包走 -mitbbs ID
BBSID: xxxxx,
面值和数量(要准确):
总金额: (加计算公式)
收款方式:billpay/amazon payment
电话号码: (xxx)xxx-xxxx (不可以是google voice)
地址, (cit... 阅读全帖 |
|
n***l 发帖数: 1368 | 26 label ready
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle
单张面值:
Skylanders SWAP Force Limited Edition Nintendo Wii U Bundle $199
可接受的价格(必须明码标价!):
4个以上, $220
2个以上, $215
一个不收
物品新旧要求:
new sealed
[email protected]
(function(){try{var s,a,i,j,r,c,l,b=document.getElementsByTagName("script");l=b[b.length-1].previousSibling;a=l.getAttribute('data-cfemail');if(a){s='';r=parseInt(a.substr(0,2),16);for(j=2;a.length-j;j+=2){c=parseInt(a.substr(j,2),16)^r;s+=String.fromCharCode(c);}s=document.... 阅读全帖 |
|
c**********e 发帖数: 2007 | 27 void swap(int *a, int *b) {
int *c;
*c=*a;
*a=*b;
*b=*c;
return;
}
int main() {
int x=5, y=10;
swap(&x, &y);
cout << x << " " << y << endl;
return 0;
}
The correct result is printed, but there is a segmentation fault. Is it
because *c is a local variable? |
|
c**********e 发帖数: 2007 | 28 【 以下文字转载自 Programming 讨论区 】
发信人: careerchange (Stupid), 信区: Programming
标 题: C++ Q 108: swap
发信站: BBS 未名空间站 (Fri Nov 25 12:00:26 2011, 美东)
Write a function to swap the two bytes of a 16-bit value.
What does it mean? |
|
n****r 发帖数: 120 | 29 An operation "swap" means removing an element from the array and appending
it at the back of the same array. Find the minimum number of "swaps" needed
to sort that array.
Eg :- 3124
Output: 2 (3124->1243->1234) |
|
A***o 发帖数: 358 | 30 May be I am wrong, consider the following ...
Let the unsorted array be V=a_0, a_1, ... a_k, ... a_m
assume min(V)=a_k
'swap' all a_i such that i
Let V_1 = a_0 ... a_(k-1)
w.l.g., assume min(V_1) = a_l
Let V_2 = a_(k+1) ... a_m
w.l.g., assume min(V_2) = a_r
Now scan V_2, 'swap' an a_i (k+1<=i<=m), if
(i) a_i > a_r and i < r; OR
(ii)a_i > a_l
O(n) time, O(1) space? :) |
|
z****p 发帖数: 18 | 31 I guess this problem is not about algorithm. It asks for the number of min
swaps. It's more like a math problem. As long as we give N-K, our job is
done, and we don't have to implement any algorithm.
Think this problem in another way:
-There is a large graph, where each node is a permutation of the given list
of data; there is an edge points from node i to node j if we can move from
permutation-i to permutation-j by using one "swap".
-Now the question is I pick two nodes i and k in the graph, wh... 阅读全帖 |
|
b*******e 发帖数: 217 | 32 incorrect.
see example 3214
first round (1) 32 needs swap
get 1432
second round (2) 4 need to swap
get 1324
not sorted.
I guess needs to use some advanced data structure like stack....
keep tracking the local min.... then pop us the elements larger than the
local min and insert them to the end one by one.
(1) push 32 into stack.
(2) when hit 1, see 1 is local min
(3) pop up 2,3 and insert them to the back of the array
(4) now array is 1423.
(5) the array pointer now go to 1 (note we can track th... 阅读全帖 |
|
b*******e 发帖数: 217 | 33 it is just to show how to find the swapping steps (only swap to the end can
be used to switch the locations).... |
|
g********r 发帖数: 58 | 34 真不知道 您在说什么
first round (1) 32 needs swap then step = 2
second round (2) 4 need to swap then step += 1
so step = 3
why we care about how to sort? |
|
b*******e 发帖数: 217 | 35 I think you are right.....
don't need to know how to swap. yet anyway we know some element needs to be
swapped. |
|
y****n 发帖数: 743 | 36 我的思路和你的一样,不过我觉得你的算法有问题。
你的swapMin应该是swap的对吧?
那么if A[i] > swapMin就一定没有数swapMin,
虽然返回时用了stepCnt+1,但怎能保证swapMin只出现一次呢?
needed
swap。 |
|
z****u 发帖数: 2629 | 37 有助于了解婚姻的多样性。
有时候回家吃饭的时间刚好碰到wife swap这个节目。 我觉得可以推荐大家看看。
里面展示的是各种婚姻和夫妻,亲子关系的互动,和mitbbs家版不同,家版更多的是出
了问题上来诉苦或者求答案的多,那个wife swap是展示各种多样性,我们作为
observer不必评判, 只是观察。
各种各样的婚姻互动都存在,只要找对了你能够忍受的那个模式,就行了。
你会发现,真的是彼之砒霜,吾之蜜糖。
有一个丈夫是surfer,每天每个话题都是surfing,身材好长得帅,妻子是supermom漂
亮能干。她就只要和他天天出去surf,出去hike跑步骑自行车,她就开心,其他的什么
都不要他做,粗活也是她来,而且哄他就像哄儿子一样,正面的,积极的,先肯定再提
醒他。另一个居家型wife换到这家来就觉得男人一无是处,什么都不做。
有一个丈夫什么都做,比较controlling,妻子穿什么他也管,每天控制妻子的热量摄
入1200卡以下,然后还带着妻子每天穿着thermal suit出去跑步锻炼减肥。这wife在家
就像bee queen,地位很高,丈夫都替她打理好,但是这wi... 阅读全帖 |
|
m****t 发帖数: 2684 | 38 目前有samba,transmission,asterisk,asterisk加上之后,拷文件明显慢不少,即使把
asterisk停了,如果有几个BT进程,打开文件也会慢一些,我看cpu还只有~50%,但
mem基本用完了,因为pogoplug里没有swap,我想加个swap是不是能缓解一点?因为以
后还想试试 miniDLNA 什么的。 |
|
n******7 发帖数: 12463 | 39 准备在windows下用vm跑linux
现在有两个问题网上看了半天也没搞明白
1. 我创建virtualBox虚拟硬盘的时候,是应该选择动态大小还是固定的?
动态大小可以节省空间,但是我担心会不会导致老是对一小块SSD读写?
2. SWAP分区要多大合适?我内存8G,linux不用起Xserver
感觉SWAP没有windows的page file方便,可以随时改大小,而且也不用在固定的磁盘区
域 |
|
S*A 发帖数: 7142 | 40
动态只是开始节省空间,如果 VM 后面慢慢用满了磁盘,或者磁盘写了又
删除了,那些磁盘空间都会分配的。动态盘不会只对一块 SSD 写,这个
其实由 guest OS 想写什么地方决定,动态和固定其实没有区别。
区别只是什么时候分配空间。动态是用到再分配,固定是预先分配。
看你的 guest。一般 swap 不需要过 2G. 1G 以内都可以了。
swap 1G 其实需要很多时间了。 |
|
g****y 发帖数: 323 | 41 变态吧。
find from deja.com
void swap( Object[] objects ) {
Integer temp = objects[0];
objects[0] = objects[1];
objects[1] = temp;
}
void testIt() {
Integer a = new Integer(1);
Integer b = new Integer(2);
System.out.println( "a = " + a + ", b = " + b );
Object[] integers = new Object[] { a, b };
swap(integers);
a = (Integer)integers[0];
b = (Integer)integers[1];
System.out.println( "a = " + a + ", b = " + b ); } |
|
I*******e 发帖数: 1879 | 42 ☆─────────────────────────────────────☆
goodbug (好虫) 于 (Sat Mar 3 01:07:40 2007) 提到:
I feel very annoyed that I have to restart Tomcat every time I make a fix.
Rebuild with Ant, redeploy and waiting Tomcat taking a minute. And I
estimate I spend an hour a day just on doing this.
Java 1.4+ has some limited hot swap ability, when public signature is not
changed.
This is very limited already. And sysdeo plugin can't really do any hot swap
. The other day someone suggest Jetty, the problem is |
|
z**r 发帖数: 17771 | 43 感谢大家的帮助,特别是wireonfire和minzhulj。不过这些link里的东西和俺实际操作
还是有点区别,俺把俺具体操作写出来,以便大家有类似情况可以照着做。
问题:目前ubuntu 9.04跑在virtualbox 2.1.4上,想增大swap空间做些应用,但是空
间不够,所以需要先扩容virtualbox的VDI盘,然后增大ubuntu的swap(从512MB-3GB)。
一、virtualbox扩容
参考 http://www.giannistsakiris.com/index.php/2007/11/25/how-to-enlarge-a-virtualbox-disk/
1、首先新建一个VDI文件,大小是你想要的新系统的大小,比如俺老的VDI是10G,俺的
新VDI大小是14G。加到你的Virtual machine里,Primary slave
2、找一张ubuntu CD,boot你的virtual machine,起来以后,用dd克隆你的旧系统,
比如你的旧系统在/dev/sda上,新加的这个VDI文件在/dev/sdb上。先用fdisk /dev/
sda把分 |
|
E*V 发帖数: 17544 | 44 如果你的计算用的不多的话,不需要swap
搞个swap file 大小空调 |
|
j*****h 发帖数: 2577 | 45 I did not see swap usage more than 20% ever on my laptop, 1gb swap |
|
z**r 发帖数: 17771 | 46 this depends on your applications on your linux box.
My ubuntu on VirtualBox has 1G physical mem and 4G swap, and my ubuntu on a
desktop has 4G physical and 9G swap |
|
l********0 发帖数: 283 | 47 问题描述:
我使用一块256G的SSD硬盘安装centos
服务器内存48G
安装时,我把80G分区映射为根目录,剩余(大约170G)全部作为swap space分区
但是安装完成后,我发现swap space的分区只有24G
请大家帮忙!这是什么原因?
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 76G 2.8G 70G 4% /
tmpfs 24G 0 24G 0% /dev/shm
使用fdisk的p命令
Disk /dev/sda: 256.0 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System |
|
a****t 发帖数: 720 | 48 Gparted 里面显示无法挂载。但是swap难道不自动挂载吗?Gparted对swap任何操作都
不行。
从来没遇到过,以前用server的kernel没这个问题,这次用pae之后,就发现了。
而且现在卸了pae,再装server,又回到pae kernel了。搞不懂了。
谢谢 |
|
|