我正在为我公司的开发团队自动化构建系统,并希望在我们的办公室窗口中有一个红绿灯代表每晚构建的结果.
有没有人知道我可以购买的设备有一个我可以编码的API来打开/关闭电源?
我看到乐高积木有API,但我正在寻找其他想法.
我正在考虑用程序生成音乐.我希望找到一个非常简单的API,我可以在其中调出乐器,音符,持续时间和一首歌曲(我当然会采取任何措施,但这将是我的偏好).有没有这样做的图书馆?
我试图存储/检索存储在应用程序设置中的值.从我的控制台应用程序中,我似乎无法访问Properties.Setting命名空间.我的网上冲浪显示,在控制台应用程序中可能需要做更多的工作.怎么做到这一点?
string test = Properties.Settings.Default.MyString;
Run Code Online (Sandbox Code Playgroud)
谢谢!
我有一个非常简单的客户端 - 服务器应用程序,我用它来分隔两个不能在同一个进程中共存的组件.在开发它们时(服务器是一个exe,客户端是一个库),我所有的单元测试都像猪粪一样高兴.当我继续在其他地方重新使用库时,我得到以下异常:
System.Runtime.Remoting.RemotingException: An error occurred while processing the request on the server: System.Security.SecurityException: Cannot open an anonymous level security token.
at System.Security.Principal.WindowsIdentity.GetCurrentInternal(TokenAccessLevels desiredAccess, Boolean threadOnly)
at System.Security.Principal.WindowsIdentity.GetCurrent()
at System.Runtime.Remoting.Channels.Ipc.IpcServerTransportSink.ServiceRequest(Object state)
The Zone of the assembly that failed was:
MyComputer.
Run Code Online (Sandbox Code Playgroud)
我已经在代码中设置了双方的远程处理,而不是在此阶段为了简单而配置文件.它们实际上完全相同:
BinaryClientFormatterSinkProvider client = new BinaryClientFormatterSinkProvider();
BinaryServerFormatterSinkProvider server = new BinaryServerFormatterSinkProvider();
server.TypeFilterLevel = TypeFilterLevel.Full;
Hashtable config = new Hashtable();
config["name"] = "SomeName";
config["portName"] = "SomePortName";
config["typeFilterLevel"] = "Full";
config["impersonate"] = "true";
config["tokenImpersonationLevel"] = "Impersonation";
config["useDefaultCredentials"] = "True";
config["secure"] = …Run Code Online (Sandbox Code Playgroud) 我正在制作一个书签,并且认为我会抛出一个挑战:如何从尽可能少的字符中的链接注入外部javascript文件.
这是我能想到的最短的:
javascript:(function(d){d.body.appendChild(d.createElement('script')).src='URL'})(document)
Run Code Online (Sandbox Code Playgroud)
这是没有URL的88个字符.
Stack Overflow javascript大师可以做得更好吗?我将接受最少字符的工作答案,所以戴上你的思维帽!
(有一点:书签必须适用于所有主流浏览器.这是一个聪明的解决方案,但不适用于所有主流浏览器,因为它返回一个值.)
我在我的Flex项目中有一个名为HashMap的便捷集合类,它本质上是flash.utils.Dictionary的包装器,带有一堆便捷方法和一个添加的(同步的)ArrayCollection,这样我就可以将HashMap传递给想要的可绑定控件了一个ArrayCollection.一切正常.
什么是不行的,我刚才发现,将HashMap放在本地的SharedObject中.
注册该类会导致它被存储并以正确的类型返回,并且ArrayCollection成员返回正常,但是Dictionary不存储其数据.
这是一个片段:
[RemoteClass(alias="com.tamedtornado.collections.HashMap")]
public class HashMap extends Proxy
{
public var hash:Dictionary = new Dictionary();
// Keeps an array collection as well so we can give this to a data bound control
[Bindable]
public var collection:ArrayCollection = new ArrayCollection();
Run Code Online (Sandbox Code Playgroud)
这就是相关的东西.让字典正确存储的过程是什么?我实际上必须使ArrayCollection瞬态,就像现在每次刷新SO时,我得到另一个(在Dictionary中唯一键入)数据的副本.
.Net框架有一个Array.Sort重载,允许用户指定要处理的排序的起始和结束标记.但是这些参数只有32位.因此,当描述排序范围的标记只能使用64位数字指定时,我没有看到对大型数组的一部分进行排序的方法.我想我可以复制和修改框架的排序实现,但这并不理想.
更新:
我已经创建了两个类来帮助我解决这些问题和其他大型数组问题.另一个这样的问题是,在我达到内存限制之前,我开始得到OutOfMemoryException.我假设这是因为请求的内存可用但不连续.因此,我创建了类BigArray,它是一个通用的,动态大小的数组列表.它具有比框架的通用列表类更小的内存占用,并且不要求整个数组是连续的.我没有测试过性能,但我确信它存在.
public class BigArray<T> : IEnumerable<T>
{
private long capacity;
private int itemsPerBlock;
private int shift;
private List<T[]> blocks = new List<T[]>();
public BigArray(int itemsPerBlock)
{
shift = (int)Math.Ceiling(Math.Log(itemsPerBlock) / Math.Log(2));
this.itemsPerBlock = 1 << shift;
}
public long Capacity
{
get
{
return capacity;
}
set
{
var requiredBlockCount = (value - 1) / itemsPerBlock + 1;
while (blocks.Count > requiredBlockCount)
{
blocks.RemoveAt(blocks.Count - 1);
}
while (blocks.Count < requiredBlockCount)
{
blocks.Add(new T[itemsPerBlock]);
}
capacity = (long)itemsPerBlock …Run Code Online (Sandbox Code Playgroud) 我正在写一个针对iPhone的网站.<body>当iPhone的方向改变时(即当用户将手机转为横向和/或纵向模式时),我想在元素上设置一个类.
我可以通过JavaScript检测到此更改吗?有这样的事件吗?
我使用我从主分支机构创建的分支机构100%工作.既然一位同事已经回到原点/主人那里,我试图将这些变化推到我的个人分支中.当我做一个'git checkout master'然后是'git status'时,我会得到以下信息:
# Your branch is ahead of 'origin/master' by 2 commits.
Run Code Online (Sandbox Code Playgroud)
如何通过2次提交从未提交过的分支?什么是找出它们是什么提交并从根本上撤消它们的最佳方法?我不希望将任何东西推回原点/主人,因为这可能会导致未知的冲突.
.net ×4
c# ×3
javascript ×2
apache-flex ×1
arrays ×1
bookmarklet ×1
code-golf ×1
components ×1
delphi ×1
flash ×1
git ×1
int64 ×1
ios ×1
iphone ×1
minimize ×1
properties ×1
remoting ×1
safari ×1
sorting ×1
sqlite ×1