希望在我的下一个项目中使用linq来缓解一些艰苦的劳动.在此之前,我深入探讨了linq世界,我想就使用linq的最佳方案提出一些建议.我仍然未决定EF和linq到sql
我有一个关于DDD的问题.我正在构建一个学习DDD的应用程序,我有一个关于分层的问题.我有一个像这样工作的应用程序:
UI层调用=>应用层 - >域层 - >数据库
以下是代码外观的一个小示例:
//****************UI LAYER************************
//Uses Ioc to get the service from the factory.
//This factory would be in the MyApp.Infrastructure.dll
IImplementationFactory factory = new ImplementationFactory();
//Interface and implementation for Shopping Cart service would be in MyApp.ApplicationLayer.dll
IShoppingCartService service = factory.GetImplementationFactory<IShoppingCartService>();
//This is the UI layer,
//Calling into Application Layer
//to get the shopping cart for a user.
//Interface for IShoppingCart would be in MyApp.ApplicationLayer.dll
//and implementation for IShoppingCart would be in MyApp.Model.
IShoppingCart shoppingCart = …Run Code Online (Sandbox Code Playgroud) 我听说过,如果程序员有足够的时间和技能,使用任何特定的语言和足够的代码行,那么任何程序都可以使用任何给定的语言创建.我知道它肯定不会具有成本效益,例如,在BASIC中重写Adobe Photoshop,但是一个足够好且耐心的程序员可能会用任何语言创建任何程序吗?
这似乎是一个非常愚蠢的问题.考虑一下:
我有一个带有getter和setter的简单Boolean对象.现在,很多线程都经常调用这两种方法.
[更新]: 我已经知道Atomic布尔了.我已经有了很多不同的解决方案,但我是专门为上述2个问题寻找答案和答案的理由.
我得到一个无法匹配此代码的预期类型错误,我不知道为什么.如果有人能指出我正确的方向来修复它,我将不胜感激.
import qualified Data.ByteString.Lazy as S
import Data.Binary.Get
import Data.Word
getBinary :: Get Word16
getBinary = do
a <- getWord16be "Test.class"
return (a)
main :: IO ()
main = do
contents <- S.getContents
print getBinary contents
Run Code Online (Sandbox Code Playgroud)
具体而言,它无法将预期类型'S.ByteString - > IO()'与推断类型'IO()'匹配
我正在尝试连接到mysql并收到错误.我把我的服务器IP地址放入并使用端口3306 whihch post应该使用?
<?php
$connection = mysql_connect("serer.ip:port", "user", "pass")
or die(mysql_error());
if ($connection) {$msg = "success";}
?>
<html>
<head>
</head>
<body>
<? echo "$msg"; ?>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是它产生的错误:
警告:mysql_connect()[function.mysql-connect]:对/home/admin/domains/domain.com.au/public_html/db_connect.php中的用户'user'@'localhost'(使用密码:YES)拒绝访问第3行拒绝用户'用户'@'localhost'访问(使用密码:YES)
我有以下代码:
foreach (var control in this.Controls)
{
}
Run Code Online (Sandbox Code Playgroud)
我想control.Hide()在那里做点什么.但是this.Controls集合中的项目不是类型Control(它们是Object).
我似乎无法记住将其强制转换为隐藏的安全方法,如果它真的是类型而不Control做其他事情.(我是移植的delphi程序员,我一直在想control is Control.)
我想在UITextField KeyBoard中单击完成按钮时调用方法?请帮我...
我正在处理大量数据文件(每个数百万行).
在开始处理之前,我想得到文件中行数的计数,然后我可以指出处理的距离.
由于文件的大小,将整个文件读入内存是不切实际的,只计算有多少行.有没有人对如何做到这一点有一个很好的建议?
我正在尝试查询bittorrent跟踪器并使用unpack从响应中获取IP列表.所以,像这样:
$ip = unpack("N", $peers);
$ip_add = ($ip[1]>>24) . "." . (($ip[1]&0x00FF0000)>>16) . "." . (($ip[1]&0x0000FF00)>>8) . "." . ($ip[1]&0x000000FF);
Run Code Online (Sandbox Code Playgroud)
但是,出于某种原因,当我打印$ ip_add时,我得到以下IP地址:
117.254.136.66
121.219.20.250
-43.7.52.163
Run Code Online (Sandbox Code Playgroud)
有谁知道会出现什么问题?
c# ×2
php ×2
architecture ×1
boolean ×1
c#-3.0 ×1
haskell ×1
ip-address ×1
iphone ×1
java ×1
linq ×1
mysql ×1
objective-c ×1
ruby ×1
types ×1
uitextfield ×1