我正在做这个油漆应用程序.这很简单.它由一个我将绘制的面板组成,然后我将保存为JPG或BMP或PNG文件.
我的应用程序工作完美,但我面临的问题是,当我保存输出时,不是面板上绘制的,它的黑色图像不仅仅是黑色.
我的所有工作都被保存为
Thepic = new Bitmap(panel1.ClientRectangle.Width, this.ClientRectangle.Height);
Run Code Online (Sandbox Code Playgroud)
在我的鼠标(向下,向上的东西)上
snapshot = (Bitmap)tempDraw.Clone();
Run Code Online (Sandbox Code Playgroud)
并且它保存了正常的工作但是再次声明是黑色图像不是面板包含的内容.
假设每首歌都有一组用户,一组歌曲和一组投票:
=========== =========== =======
User Song Vote
=========== =========== =======
user1 song1 [score]
user1 song2 [score]
user1 song3 [score]
user2 song1 [score]
user2 song2 [score]
user2 song3 [score]
user3 song1 [score]
user3 song2 [score]
user3 song3 [score]
user-n song-n [score]
=========== =========== =======
Run Code Online (Sandbox Code Playgroud)
什么是基于歌曲投票计算用户相似度的最有效方法?有没有比为每首歌重复每个用户和每次投票更好的方法?
当我在我的Django项目上运行manage.py shell以查看某些东西时,我总是希望在shell的开头运行常见的导入(例如,我总是要导入我的模型文件.)我怎样才能拥有这些每次运行shell命令时都会自动运行?
第二个相关的问题,当我点击向上箭头时,我得到了"^ A"字符,而不是在manage.py shell(以及我的常规python shell)中的先前运行的命令,我该如何修复它以便加载上一个命令喜欢在Linux/Unix命令行上?
我对JUnit很陌生,我真的不知道异常和异常处理的最佳实践.
例如,假设我正在为IPAddress类编写测试.它有一个构造函数IPAddress(String addr),如果addr为null,它将抛出InvalidIPAddressException.据我在google搜索时可以看出,null参数的测试将如下所示.
@Test
public void testNullParameter()
{
try
{
IPAddress addr = new IPAddress(null);
assertTrue(addr.getOctets() == null);
}
catch(InvalidIPAddressException e)
{
return;
}
fail("InvalidIPAddressException not thrown.");
}
Run Code Online (Sandbox Code Playgroud)
在这种情况下,try/catch是有意义的,因为我知道异常即将到来.
但是现在如果我想编写testValidIPAddress(),有几种方法可以做到:
方式#1:
@Test
public void testValidIPAddress() throws InvalidIPAddressException
{
IPAddress addr = new IPAddress("127.0.0.1");
byte[] octets = addr.getOctets();
assertTrue(octets[0] == 127);
assertTrue(octets[1] == 0);
assertTrue(octets[2] == 0);
assertTrue(octets[3] == 1);
}
Run Code Online (Sandbox Code Playgroud)
方式#2:
@Test
public void testValidIPAddress()
{
try
{
IPAddress addr = new IPAddress("127.0.0.1");
byte[] octets = addr.getOctets();
assertTrue(octets[0] == 127); …Run Code Online (Sandbox Code Playgroud) 我是WPF的新手,ScrollViewer令我很沮丧.或者我只是不"得到"它,或者它是一个有限的控制.
这是我的挫折:
水平滚动错误水平滚动条仅在列表底部可见(我必须滚动到底部才能看到它)
坏边框我的ScrollViewer中有一个ListBox.当我开始列表的底部没有边框时,当我向下滚动时,列表框的顶部边框(行)消失.我可以理解这一点,但尝试为ScrollViewer设置BorderThickness或BorderBrush结果没有变化(我想使用ScrollViewer的边框在列表内容周围保留一个常量框,就像网络世界中的大多数列表框一样).
短列表处理不当当列表中的项目未到达底部时,ScrollViewer会将滚动条保留在那里并将其抖动.为什么不释放一些空间并将其删除?
其中一些可能看起来很小(而且它们是).但是用户期望从他们的应用程序中获得一定的外观和感觉,而WPF则很难将其开箱即用.
如果你知道如何解决这些问题,我会很乐意回应.如果有一个更好的方法来处理滚动比使用ScrollViewer,欢迎.
我是CodeIgniter的菜鸟,我正在试图找出我正在构建的应用程序的配置.我的设置有问题.
我在Windows上运行XAMPP并使用别名目录指向应用程序目录.换句话说:" http:// localhost/app_name / "指向应用程序的根目录.在我为mod_rewrite执行.htaccess之前,这一切似乎都运行良好.然后,每当我尝试去控制器时,我都会回到xampp root.
我的配置是:
目录
/app_root
/app_root/codeigniter // where code igniter is located.
/app_root/main // where the main app is located. It' the applications
// directory cut from code igniter and renamed.
Run Code Online (Sandbox Code Playgroud)
的.htaccess
<IfModule mod_rewrite.**so**>
RewriteEngine On
RewriteBase **/app_name/**
RewriteCond %{REQUEST_URI} ^codeigniter.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
Run Code Online (Sandbox Code Playgroud)
的index.php
$system_folder = "@codeigniter";
$application_folder = "main";
Run Code Online (Sandbox Code Playgroud)
APP_NAME /主/配置/ config.php中
$config['base_url'] = "http://localhost/app_name/"; …Run Code Online (Sandbox Code Playgroud) 我正在维护为PHP 5.2编写的库,我想创建它的PHP 5.3命名空间版本.但是,我还会保留非命名空间版本,直到PHP 5.3变得如此陈旧,即使是Debian stable也可以发布它;)
我有相当干净的代码,大约80个类遵循Project_Directory_Filename命名方案(我\Project\Directory\Filename当然会改变它们)和只有少数函数和常量(也以项目名称为前缀).
问题是:并行开发命名空间和非命名空间版本的最佳方法是什么?
我应该只在存储库中创建fork并继续在分支之间合并更改吗?是否存在反斜杠代码难以合并的情况?
我应该编写将5.2版本转换为5.3版本的脚本,反之亦然吗?我应该使用PHP tokenizer吗?sed?C预处理器?
有没有更好的方法在可用的地方使用命名空间并保持与旧PHP的向后兼容性?
更新:毕竟决定不使用命名空间.
有一段代码:
class WCFConsoleHostApp : IBank
{
private static int _instanceCounter;
public WCFConsoleHostApp ()
{
Interlocked.Increment(ref _instanceCounter);
Console.WriteLine(string.Format("{0:T} Instance nr " + _instanceCounter + " created", DateTime.Now));
}
private static int amount;
static void Main(string[] args)
{
ServiceHost host = new ServiceHost(typeof(WCFConsoleHostApp));
host.Open();
Console.WriteLine("Host is running...");
Console.ReadLine();
}
#region IBank Members
BankOperationResult IBank.Put(int amount)
{
Console.WriteLine(string.Format("{0:00} {1}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread) + " Putting...");
WCFConsoleHostApp.amount += amount;
Thread.Sleep(20000);
Console.WriteLine(string.Format("{0:00} {1}", Thread.CurrentThread.ManagedThreadId, Thread.CurrentThread.IsThreadPoolThread) + " Putting done");
return new BankOperationResult { CurrentAmount = WCFConsoleHostApp.amount, …Run Code Online (Sandbox Code Playgroud) 我的ASP.NET应用程序在我的Web服务器上的IIS中运行,并使用Microsoft .NET Framework 4 Beta 2.(其应用程序池设置为.NET Framework版本.NET Framework v4.0.21006.)
它给出了这个新错误:
从客户端检测到一个潜在危险的Request.Form值...
这是由于.NET 4 的重大变化.
要恢复到ASP.NET 2.0请求验证功能的行为,我在Web.config文件中添加了以下设置:
<httpRuntime requestValidationMode="2.0" />
Run Code Online (Sandbox Code Playgroud)
现在Visual Studio 2008抛出编译时错误:
未声明'requestValidationMode'属性.
而且我无法再使用Visual Studio附带的ASP.NET Development Server在我的开发机器上进行调试.
我需要Visual Studio及其ASP.NET Development Server来识别新的.NET Framework 4 requestValidationMode属性.
如何在.NET 4中调试我的应用程序?我必须从Visual Studio 2008切换到Visual Studio 2010 Beta 2吗?
我需要开发一个基本的.NET文档管理系统,其中包含以下规范:
数据应该是可移植的和自包含的,因此我将文档(典型格式包括Word,PDF,Excel和Powerpoint)序列化为二进制数据.然后,我将所述二进制数据存储在SQL Server 2005数据库中.当用户需要下载文档时,系统将反序列化二进制数据并以原始格式呈现.
平均行大小不能大于200k.
我们预计每月最多可上传500份文件,为期三年.
我们不希望数据库的大小超过6 GB
我们的最大目标是20,000人,可能同时访问系统.
我的问题是:为了提供可靠的性能,防止网站停机等,该技术需要多么强大?
我是一名新手开发人员,对这种架构和设计并不熟悉.
.net ×2
php ×2
.htaccess ×1
architecture ×1
asp.net ×1
asp.net-4.0 ×1
c# ×1
codeigniter ×1
database ×1
django ×1
drawing ×1
java ×1
junit ×1
migration ×1
mysql ×1
namespaces ×1
python ×1
scrollviewer ×1
similarity ×1
testing ×1
threadpool ×1
uiscrollview ×1
unit-testing ×1
wcf ×1
wpf ×1
wpf-controls ×1
wpftoolkit ×1
xampp ×1