请建议从iFrame触发父页面中的事件的可能技术.我尝试了url Hashing并使用window.postMessage技术但没有任何成功.
我正在编写一个应用程序,主要目的是保持用户购买列表.
我想确保即使我作为开发人员(或任何完全访问数据库的人)也无法弄清楚某个人花了多少钱或者他已经购买了什么.
我最初想出了以下方案:
--------------+------------+-----------
user_hash | item | price
--------------+------------+-----------
a45cd654fe810 | Strip club | 400.00
a45cd654fe810 | Ferrari | 1510800.00
54da2241211c2 | Beer | 5.00
54da2241211c2 | iPhone | 399.00
user_hash(可能与盐渍等).如果有足够的用户,通过了解他的名字,几乎不可能知道特定用户花了多少钱.
这是明智的做法,还是我完全愚蠢?
有没有人处理过在.net紧凑框架中将BMP转换为PCX的问题.
我需要将签名从BMP转换为PCX,以便在Zebra RW420蓝牙打印机上打印.任何帮助将不胜感激.
谢谢!
我有三个对象(splistitemcollection)加入到一起工作很好,但我遇到的问题是合同对象和客户对象之间存在一对多的关系.我需要在连接期间仅抓取每个合同对象的第一个客户对象.
这是我得到的
(Contract)(Customer) 12345 John Smith 12345 Jane Smith 67890 howard Jones 67890 Mary Jones
这就是我想要的12345(只是其中一个客户,jane或john)
这是我目前正在使用的代码.
var joinedResults = from SPListItem contracts in _contractList
join SPListItem customers in _customerList
on contracts["ContractNumber"] equals customers["ContractNumber"]
join SPListItem loans in _loanList
on contracts["ContractNumber"] equals loans["Contract_x0020_Number"]
into l from loans in l.DefaultIfEmpty()
select new MergedData(contracts, customers, loans);
Run Code Online (Sandbox Code Playgroud)
在SQL中,我在我的连接中定义的子查询中定义了一个select top子句,我只是无法绕过我的新手linq大脑的语法.
最后结果
var joinedResults = from SPListItem contracts in _contractList
join SPListItem customers in
// Derived subset
(from SPListItem customers in _customerList
group customers by …Run Code Online (Sandbox Code Playgroud) 你能帮我理解吗,
words.Aggregate((workingSentence, next) => + next + " " + workingSentence);
Run Code Online (Sandbox Code Playgroud)
从下面的代码片段?如果有人解释我在C#1.1中实现这一点,那就太好了.
(来自MS的片段) -
string sentence = "the quick brown fox jumps over the lazy dog";
// Split the string into individual words.
string[] words = sentence.Split(' ');
// Prepend each word to the beginning of the
// new sentence to reverse the word order.
string reversed = words.Aggregate((workingSentence, next) =>
next + " " + workingSentence);
Console.WriteLine(reversed);
// This code produces the following output:
//
// dog …Run Code Online (Sandbox Code Playgroud) 我有一个类创建 aList<Action<int>>并将其保留到稍后的时间。此类可以在此列表中添加和删除委托。只要人们不太花哨,这种方法就很有效。为了对抗匿名函数(无法删除),我检查委托的目标是否为空。如果它为空,我会抛出异常。当存在包含函数的匿名委托时,就会出现问题。它有一个目标,但同样不可移动。下面的简化代码说明了我的问题
public class MyDelegateContainer
{
List<Action<int>> m_Container = new List<Action<int>>();
public void Add(Action<int> del)
{
if (del.Target == null)
{
throw new Exception("No static handlers");
}
m_Container.Add(del);
}
public bool Remove(Action<int> del)
{
if (m_Container.Contains(del))
{
m_Container.Remove(del);
return true;
}
return false;
}
}
public class MyFakeActionClass
{
public void Test(int temp) { }
}
class Program
{
static void Main(string[] args)
{
bool removed = false;
int counter = 0;
MyDelegateContainer container = new MyDelegateContainer();
MyFakeActionClass …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的主域(http://foo.com)和我的API(http://api.foo.com)之间开发请求.
为了绕过关于跨子域内容的限制,我在主页(http ////foo.com/main.html)上使用iframe,指向iframe.html页面:scripts.api.foo.com.
(scripts.api.foo.com和foo.com在同一台服务器上,api.foo.com在其他服务器上)
> iframe.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Iframe</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
document.domain = 'foo.com';
function testIframe()
{
$.ajax({
url: "http://api.foo.com/utctime",
timeout: 7000,
complete: function(jqXHR, textStatus){
parent.alert(jqXHR.status);}
});
}
</script>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
> main.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
document.domain = …Run Code Online (Sandbox Code Playgroud) 我想知道为什么会一直这样...... !! 我在c中编写了两个程序,在c ++中编写了另一个程序.两者都执行相同的操作.即打印1到2000000之间的数字.此外,我在执行开始时设置计时器..并且在打印之后还打印所有经过的时间.c ++程序所用的时间总是大于交流程序.我觉得时间差异很大.我很想知道这是什么原因.. ???? ..
这是两个程序
//iotest.c
#include<stdio.h>
#include<time.h>
clock_t start=clock();
int main()
{
for(int i=0;i<2000000;i++)
printf("%d\n",i);
printf("Time Elapsed: %f\n",((double)clock()-start)/CLOCKS_PER_SEC);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
//iotest.cpp
#include<iostream>
#include<time.h>
using namespace std;
clock_t start=clock();
int main()
{
for(int i=0;i<2000000;i++)
cout<<i<<endl;
cout<<"Time elapsed "<<((double)clock()-start)/CLOCKS_PER_SEC<<endl;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
// ver C++ 4.3.2通过发出命令编译c程序
g ++ iotest.c
执行给出
1
.
.
2000000
经过的时间:5.410000(并不总是相同..)
执行第二个程序
1
.
.
2000000
时间流逝:5.81(并非总是相同..)
我的任务是将这个Java代码迁移到C#版本,但是我遇到了这个ValueOf方法的问题,因为我似乎无法找到C#的等效版本(因为Radix在Java上使用的参数,在这种情况下为16) .
public String decrypt_string(String s)
{
String s1 = "";
int i = s.length() / 2;
int[] ai = new int[i];
for (int j = 0; j < i; j++)
{
// This is the "problematic" line \/
ai[j] = Integer.valueOf(s.substring(j * 2, j * 2 + 2), 16).intValue();
}
int[] ai1 = decrypt_block(ai, i);
for (int k = 0; k < i; k++)
{
if (ai1[k] != 0)
s1 = s1 + (char)ai1[k];
} …Run Code Online (Sandbox Code Playgroud) 我有一大堆代码
for i in range(0, len(a))
b[i] = func(a[i])
Run Code Online (Sandbox Code Playgroud)
其中a和b是相同长度的数组,a是给定的(和大),func是一些具有大量局部变量但不使用任何全局变量的函数.
我想在几个CPU上分配func的计算.大概我需要使用多处理模块,但我没有找到任何相关的例子.你能帮忙吗?谢谢.