我可以从我的DAL返回List吗?在互联网上,我在某处读到它并不好.如果返回List会有什么问题?
我正在尝试为我的jtextarea创建一个滚动窗格.以下是我的代码段.我想知道为什么它不起作用.有人可以给我一些见解吗?谢谢.
JTextArea textArea = new JTextArea(st);
textArea.setBounds(145, 51, 327, 53);
textArea.setLineWrap(true);
textArea.setWrapStyleWord(true);
textArea.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
//ScrollPane Code
JScrollPane areaScrollPane = new JScrollPane(textArea);
areaScrollPane.setHorizontalScrollBarPolicy(
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
areaScrollPane.setPreferredSize(new Dimension(250, 250));
panel.add(textArea);
Run Code Online (Sandbox Code Playgroud)
我错过了什么?我的textarea中没有出现滚动条.
我很难理解以下程序的意外输出:
class ThreadTest
{
static void Main()
{
for(int i = 0; i < 10; i++)
new Thread(() => Console.Write(i)).Start();
}
}
Run Code Online (Sandbox Code Playgroud)
查询:运行在不同线程的不同代码有不同的堆栈?如果是,那么变量应该保留它们的值,因为 int 是值类型?
我拆分了当前的数据库,因为它将由多个组使用.拆分时,它带来了我的主表,但没有表格.我试图重新创建一个表单并将表单(从原始数据库)拖放到新的(拆分)数据库,但它不允许它.
是否将数据库拆分为我正在寻找的错误路径?
我有这个方法,我怎样才能将小数点设为.00而不是.0000?
public static List<Product> GetAllProducts()
{
List<Product> products = new List<Product>();
string sqlQuery = "SELECT * FROM Products";
using (SqlConnection connection = new SqlConnection(connectionString))
{
using (SqlCommand command = new SqlCommand(sqlQuery, connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader(CommandBehavior.CloseConnection))
{
while (reader.Read())
{
Product product = new Product();
product.Id = Convert.ToInt32(reader["Id"]);
product.ManufacturerId = Convert.ToInt32(reader["ManufacturerId"]);
product.CategoryId = Convert.ToInt32(reader["CategoryId"]);
product.Name = (reader["Name"]).ToString();
product.Description = (reader["Description"]).ToString();
product.Price = Convert.ToDecimal(reader["Price"]);
product.ItemsInStock = Convert.ToInt32(reader["ItemsInStock"]);
products.Add(product);
}
}
}
}
return products;
}
Run Code Online (Sandbox Code Playgroud)
更新:抱歉提出愚蠢的问题.我看不到DataFormatString ="{0:F2}"的位置
这是我的网格: …
我有一个角度说60度,并希望在区间内生成随机角度[-120,120],其中区间以60度为中心,现在为[-60,180]
我有以下代码:
http://www.cs.princeton.edu/introcs/22library/StdRandom.java.html
我很困惑,因为它说高斯分布在[0,1]之内.
我怎么能通过范围[-120,120]?
60角是物体的相对旋转,所产生的随机角度是它下一个位置的预测
当测试代码我有角度时,比如65,55,如果我直接使用这个角度它会执行奇怪的,所以我采取差异65-60,55-60.
这个想法是否正确?
我将":foo"属性添加到我的用户模型中:
attr_accessor :foo
attr_accessible :foo
Run Code Online (Sandbox Code Playgroud)
但是当我从会话控制器或任何其他控制器设置此属性时:
User.foo = "my attributre"
Run Code Online (Sandbox Code Playgroud)
我得到这个属性:
User.foo
Run Code Online (Sandbox Code Playgroud)
所以这些都无法识别并给我一个错误,即:
undefined method `foo=' for #<Class:0xb75366fc>
Run Code Online (Sandbox Code Playgroud)
所以请在这里帮忙.我正在使用铁路2.3.5
当你想要计算一个上面小数字的数字时,我不知道英文中的正确名称.像1,5和小3一样(1.5*1,5*1,5的计算)
在java中有一种简单而简单的方法吗?我想计算音量.我希望你理解我的问题.
谢谢.
使用HTML验证器我得到两个错误,我无法弄清楚.
码:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Prime Properties Listing</title>
<link rel="stylesheet" href="prime.css">
<meta charset="utf-8">
</head>
<body>
<div id="wrapper">
<h1><img src="primelogo.gif" alt=“PRIMELOGO” height=“100” width=“650”/></h1>
<a href="index.html"><img src="primehomenav.gif" height="25" width="107" alt="Home"/></a>
<a href="listing.html"><img src="primelistingsbtn.gif" height="25" width="107" alt="listing"/></a>
<a href="financing.html"><img src="primefinancingnav.gif" height="25" width="107" alt="financing"/></a>
<a href="contact.html"><img src="primecontactnav.gif" height="25" width="107" alt="contact"/></a>
<h3> Schaumburg Colonial </h3>
<p>This single family home is a two-story colonial on a large lot</p>
<a href="listing.html"><img src="schaumburgthumb.jpg" height="113" width="150" alt=""></a>
<ul>
<li>Four bedrooms</li>
<li>Two and 1/2 baths</li>
<li>Two car garage</li> …Run Code Online (Sandbox Code Playgroud) 我试图将h2放在h1正下方,但它似乎正在创造一个巨大的差距/空间.是否有某种方法可以避免这种情况,或者这是编码中的错误?谢谢.
链接到网站:http: //younani.com/armen/musicindex.html
HTML:
<!DOCTYPE html>
<html lang="en">
<head>
<title>Armens website</title>
<meta charset="utf-8">
</head>
<body>
<div class="clearfix" id="container">
<p><link rel="stylesheet" href="armen.css" /></p>
<h1><i>Four To The Floor</i></h1>
<h2>Artist Management & Events</h2>
<p></p>
<h3>“It’s not where you take things from,<br /> it’s where you take them to.” <br /> …Run Code Online (Sandbox Code Playgroud) 目前使用以下forumlas来计算所有Z列中没有#N/A但不起作用的记录数.Z列中的所有行都有一个公式本身(这就是为什么它们中的一些显示#N/A,它是一个VLOOKUP).
=COUNTA(Z:Z)-SUM(IF(ISNA(Z:Z),1))
=SUMPRODUCT(--(TRIM(Z:Z)<>"#N/A"))
Run Code Online (Sandbox Code Playgroud)
这些返回"0"值不是真的,我做错了什么?