我想每隔3秒更换一个图像,但是当我想改变时我想做一个淡入淡出效果,为此我做了:
<script type="text/javascript">
var images = [];
images[0] = "http://i2.ytimg.com/vi/Q1yo3mco40U/default.jpg";
images[1] = "http://i2.ytimg.com/vi/ivmoCcYLrEk/default.jpg";
images[2] = "http://i3.ytimg.com/vi/f7d8luQ6p2Q/default.jpg";
images[3] = "http://i1.ytimg.com/vi/XzFmOKNf8sc/default.jpg";
images[4] = "http://i2.ytimg.com/vi/-2m1e4g2MFM/default.jpg";
images[5] = "http://i1.ytimg.com/vi/lK2TSYBh7fw/default.jpg";
var loop;
var i = 0;
$(document).ready(function() {
setTimeout(fadeDivs, 3000);
});
function fadeDivs()
{
$('.product img').attr('src',images[i]).fadeOut(100);
if (i < images.length - 1) {
i++;
} else {
i = 0;
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
和:
<section id="product">
<article class="product">
<img src="http://i2.ytimg.com/vi/Q1yo3mco40U/default.jpg" />
</article>
</section>
Run Code Online (Sandbox Code Playgroud)
但是不起作用,我认为问题在于
$('.product img').attr('src',images[i]).fadeOut(100);
Run Code Online (Sandbox Code Playgroud)
有一个更好的方法吗?
假设我有List<int> NullValuesIds
包含索引.
如何初始化分配true
给来自NullValuesIds
和使用LINQ 的索引的布尔数组?(布尔数组大小类似于大小100).
I am doing some simple statistic stuff and need to compute sums of big numbers, I am using System.Numerics.BigInteger
for instance I am using 742^4
What Am I doing wrong?
我有一个点列表(每个点都有id,x,y,z
属性)。
我想获得属性的总不同值x,y,z
我在做:
var points = new List<MyPoint>
{
new MyPoint {Id = 0, X = 97.5, Y = 92.5, Z = -16.6666660308838},
new MyPoint {Id = 1, X = 292.5, Y = 92.5, Z = -16.6666660308838},
new MyPoint {Id = 2, X = 97.5, Y = 277.5, Z = -16.6666660308838},
new MyPoint {Id = 3, X = 292.5, Y = 277.5, Z = -16.6666660308838},
new MyPoint {Id = 4, X = 97.5, Y …
Run Code Online (Sandbox Code Playgroud) 我有一本字典,状态值为 c
stateC = {
"Washington" : 3,
"New York" : 5,
"Houston": 11,
}
Run Code Online (Sandbox Code Playgroud)
和一个数据框:
State b
Washington 09
New York 100
Houston 55
Run Code Online (Sandbox Code Playgroud)
我想根据字典的键值集成该列column c
,还有一个column d
具有值的列b/c
State b c d
Washington 09 3 3
New York 100 5 20
Houston 55 11 5
Run Code Online (Sandbox Code Playgroud)
如何在熊猫中做到这一点?
可能重复:
比较R中的svd和princomp
如何在R中使用2种方法(princomp()和相关矩阵的svd)执行PCA
我有一个数据集,如:
438,498,3625,3645,5000,2918,5000,2351,2332,2643,1698,1687,1698,1717,1744,593,502,493,504,445,431,444,440,429,10
438,498,3625,3648,5000,2918,5000,2637,2332,2649,1695,1687,1695,1720,1744,592,502,493,504,449,431,444,443,429,10
438,498,3625,3629,5000,2918,5000,2637,2334,2643,1696,1687,1695,1717,1744,593,502,493,504,449,431,444,446,429,10
437,501,3625,3626,5000,2918,5000,2353,2334,2642,1730,1687,1695,1717,1744,593,502,493,504,449,431,444,444,429,10
438,498,3626,3629,5000,2918,5000,2640,2334,2639,1696,1687,1695,1717,1744,592,502,493,504,449,431,444,441,429,10
439,498,3626,3629,5000,2918,5000,2633,2334,2645,1705,1686,1694,1719,1744,589,502,493,504,446,431,444,444,430,10
440,5000,3627,3628,5000,2919,3028,2346,2330,2638,1727,1684,1692,1714,1745,588,501,492,504,451,433,446,444,432,10
444,5021,3631,3634,5000,2919,5000,2626,2327,2638,1698,1680,1688,1709,1740,595,500,491,503,453,436,448,444,436,10
451,5025,3635,3639,5000,2920,3027,2620,2323,2632,1706,1673,1681,1703,753,595,499,491,502,457,440,453,454,442,20
458,5022,3640,3644,5000,2922,5000,2346,2321,2628,1688,1666,1674,1696,744,590,496,490,498,462,444,458,461,449,20
465,525,3646,3670,5000,2923,5000,2611,2315,2631,1674,1658,1666,1688,735,593,495,488,497,467,449,462,469,457,20
473,533,3652,3676,5000,2925,5000,2607,2310,2623,1669,1651,1659,1684,729,578,496,487,498,469,454,467,476,465,20
481,544,3658,3678,5000,2926,5000,2606,2303,2619,1668,1643,1651,1275,723,581,495,486,497,477,459,472,484,472,20
484,544,3661,3665,5000,2928,5000,2321,2304,5022,1647,1639,1646,1270,757,623,493,484,495,480,461,474,485,476,20
484,532,3669,3662,2945,2926,5000,2326,2306,2620,1648,1639,1646,1270,760,533,493,483,494,507,461,473,486,476,20
482,520,3685,3664,2952,2927,5000,2981,2307,2329,1650,1640,1644,1268,757,533,492,482,492,513,459,474,485,474,20
481,522,3682,3661,2955,2927,2957,2984,1700,2622,1651,1641,1645,1272,761,530,492,482,492,513,462,486,483,473,20
480,525,3694,3664,2948,2926,2950,2995,1697,2619,1651,1642,1646,1269,762,530,493,482,492,516,462,486,483,473,20
481,515,5018,3664,2956,2927,2947,2993,1697,2622,1651,1641,1645,1269,765,592,489,482,495,531,462,499,483,473,20
479,5000,3696,3661,2953,2927,2944,2993,1702,2622,1649,1642,1645,1269,812,588,489,481,491,510,462,481,483,473,20
480,506,5019,3665,2941,2929,2945,2981,1700,2616,1652,1642,1645,1271,814,643,491,480,493,524,461,469,484,473,20
479,5000,5019,3661,2943,2930,2942,2996,1698,2312,1653,1642,1644,1274,811,617,491,479,491,575,461,465,484,473,20
479,5000,5020,3662,2945,2931,2942,2997,1700,2313,1654,1642,1644,1270,908,616,490,478,489,503,460,460,478,473,10
481,508,5021,3660,2954,2936,2946,2966,1705,2313,1654,1643,1643,1270,1689,678,493,477,483,497,467,459,476,473,10
486,510,522,3662,2958,2938,2939,2627,1707,2314,1659,1643,1639,1665,1702,696,516,476,477,547,465,457,470,474,10
479,521,520,3663,2954,2938,2941,2957,1712,2314,1660,1643,1638,1660,1758,688,534,475,475,489,461,456,465,474,10
480,554,521,3664,2954,2938,2941,2632,1715,2313,1660,1643,1637,1656,1761,687,553,475,474,558,462,453,465,476,10
481,511,5023,3665,2954,2937,2941,2627,1707,2312,1660,1641,1636,1655,1756,687,545,475,475,504,463,458,470,477,10
482,528,524,3665,2953,2937,2940,2629,1706,2312,1657,1640,1635,1654,1756,566,549,475,476,505,464,459,468,477,10
Run Code Online (Sandbox Code Playgroud)
所以我这样做:
x <- read.csv("C:\\data_25_1000.txt",header=F,row.names=NULL)
p1 <- princomp(x, cor = TRUE) ## using correlation matrix
p1
Call:
princomp(x = x, cor = TRUE)
Standard deviations:
Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7 Comp.8 Comp.9 Comp.10 Comp.11 Comp.12 Comp.13 Comp.14 Comp.15 Comp.16
1.9800328 1.8321498 1.4147367 1.3045541 1.2016116 1.1708212 1.1424120 …
Run Code Online (Sandbox Code Playgroud) 在C#中有一个int数组列表,如:
List<int[]> arrList = new List<int[]>();
arrList.Add(new int[18] { 183, 184, 185, 186, 187, 188, 189, 190, 191, 153, 135, 117, 99, 81, 63, 45, 26, 25 });
arrList.Add(new int[4] { 183, 209, 210, 184 });
arrList.Add(new int[4] { 184, 210, 211, 185 });
arrList.Add(new int[4] { 185, 211, 212, 186 });
arrList.Add(new int[4] { 186, 212, 213, 187 });
arrList.Add(new int[4] { 187, 213, 214, 188 });
arrList.Add(new int[4] { 188, 214, 215, 189 });
arrList.Add(new int[4] { 189, …
Run Code Online (Sandbox Code Playgroud)