今天有人给我看了一个代码片段,我想知道它是如何工作的:
//using System;
//using System.Collections.Generic;
//using System.Text;
namespace ConsoleApplication1
{
class Test
{
int i = 0;
}
class Program
{
static void Main(string[] args)
{
Test obj = new Test();
obj.ToString();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果我们评论了上述命名空间,该ToString()
方法如何仍然与该对象相关联obj
?
目前我正在开发一个显示大约的Excel/VBA工作簿.预算中的500项,每项在不同的行上.我希望用户选择预算中的详细程度:在每个单独项目将显示的最高级别上,在较低级别的详细信息中,几个项目将分组在单个标题下.
下面概述的方法(隐藏/取消隐藏)是非常慢的:隐藏/取消隐藏大部分项目大约需要4分钟.我希望你有任何提示,如何加快程序!
通过对话框选择详细程度时,程序将执行以下步骤:
1)更新屏幕已设置:
Application.ScreenUpdating = False
Application.EnableEvents = False
Run Code Online (Sandbox Code Playgroud)
2)预算中的每个行项目确定是否应该隐藏该行.我正在使用的代码如下:
with sheets("[name sheet here]")
.Range("[identifier of budget line item here]").EntireRow.Hidden = False / True
...
[500 times]
...
end with
Run Code Online (Sandbox Code Playgroud)
3)其次,根据细节程度,对应于子标题的文本可以是白色或黑色.这大约需要20行:
With Sheets("[name sheet here]").Range("[identifier of budget line item here]").Font
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
End With
Run Code Online (Sandbox Code Playgroud)
4)最后,再次根据细节的高低,再次绘制一些在隐藏某些行时变得不可见的线条.对于各种范围,这样做了10次左右:
Range("[range here]").Select
Selection.Borders(xlDiagonalDown).LineStyle = xlNone
Selection.Borders(xlDiagonalUp).LineStyle = xlNone
Selection.Borders(xlEdgeLeft).LineStyle = xlNone
Selection.Borders(xlEdgeTop).LineStyle = xlNone
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = 0
.TintAndShade = 0
.Weight = xlThin
End With
Run Code Online (Sandbox Code Playgroud) 我正在尝试编写一个程序,让我输入 10 个字符并将它们存储在一个数组中。只需单个字符就足够了,例如 (d, s, a, e, h, j, e,)。然后让我使用线性搜索算法查找其中一个字符并给出数组中的位置。
我尝试对其进行编程,但只能使用整数进行编程。到目前为止,这是我的代码。
我不知道如何将其更改为字母/字符?
public static void main(String args[])
int c, n, search, array[];
Scanner in = new Scanner(System.in);
System.out.println("Enter number of elements");
n = in.nextInt();
array = new int[n];
System.out.println("Enter " + n + " Letters");
for (c = 0; c < n; c++)
array[c] = in.nextInt();
System.out.println("What letter do you want to find?");
search = in.nextInt();
for (c = 0; c < n; c++)
{
if (array[c] == search) /* …
Run Code Online (Sandbox Code Playgroud) 我有一个查询,可以使用like搜索关键字,但是我也想搜索全文,因此我将其更改为全文搜索查询,但是它不起作用。
工作正常的旧查询:
$data = $this->db
->select('content.title,content.id,content.category,content.body,path')
->from('content')
->join('categories','content.category = categories.id')
->like('content.title', $searchterm)
->like('content.body', $searchterm)
->order_by("content.id","DESC")
->get();
Run Code Online (Sandbox Code Playgroud)
这是我对全文搜索的新查询:
$data = $this->db
->select('content.title,content.id,content.category,content.body,path')
->from('content')
->join('categories','content.category = categories.id')
->where('MATCH (content.body, content.title) AGAINST ("'. $searchterm .'")')
->order_by("content.id","DESC")
->get();
Run Code Online (Sandbox Code Playgroud) 我需要创建一个音频播放器,但我不知道如何将其转换为 JavaScript。
这就是我到目前为止所拥有的......
HTML:
<audio id="music" src="http://www.sousound.com/music/healing/healing_01.mp3"
data-title="Title of the audio" data-author="Author's name"></audio>
<span class="volumeScaleHolder">
<span id="progressBar">
<span id="myVolume"></span>
</span>
</span>
Run Code Online (Sandbox Code Playgroud)
CSS:
#progressBar {
width: 100%;
height: 8px;
background-color: #666666;
display: inline-block;
}
#myVolume {
width: 10%;
height: 100%;
background-color: #B4BB6B;
display:block;
}
border: 0;
}
.volumeScaleHolder {
padding:0;
margin: 3px 0;
}
Run Code Online (Sandbox Code Playgroud)
JavaScript:
var audio = document.getElementById("music");
var audioVolumeBar = document.getElementById("progressBar");
var myVolumeBar = document.getElementById("myVolume");
var audioVolume = audio.volume;
function volumeAsProgressBar(volume) {
var audioVolumeProgressBar = document.getElementById("progressBar");
var audioVolumeMyBar = …
Run Code Online (Sandbox Code Playgroud) 我正在使用这里的Splash Screen .我喜欢它有多简单.但问题是,在我点击之前,启动画面不会消失.在IDE中运行时,它可以正常工作.有任何想法吗?我在这里附上代码,但由于某种原因它没有正确插入.
private System.Windows.Forms.Timer timer1;
//private Splash sp=null;
public Form1()
{
InitializeComponent();
Thread th = new Thread(new ThreadStart(DoSplash));
//th.ApartmentState = ApartmentState.STA;
//th.IsBackground=true;
th.Start();
Thread.Sleep(3000);
th.Abort();
Thread.Sleep(1000);
}
private void DoSplash()
{
Splash sp = new Splash();
sp.ShowDialog();
}
private void timer1_Tick(object sender, System.EventArgs e)
{
// sp.Close();
}
Run Code Online (Sandbox Code Playgroud) 我在这里发现了很多计算和一些php的例子,大多数都是我的头脑.
我找到了这个例子:
SELECT b.zip_code, b.state,
(3956 * (2 * ASIN(SQRT(
POWER(SIN(((a.lat-b.lat)*0.017453293)/2),2) +
COS(a.lat*0.017453293) *
COS(b.lat*0.017453293) *
POWER(SIN(((a.lng-b.lng)*0.017453293)/2),2))))) AS distance
FROM zips a, zips b
WHERE
a.zip_code = '90210' ## I would use the users submitted value
GROUP BY distance
having distance <= 5; ## I would use the users submitted value
Run Code Online (Sandbox Code Playgroud)
但是,我无法理解如何使用我的数据库实现查询.
它看起来像我需要的查询.
但是,我甚至无法找到/理解b.zip_code实际上是什么!(什么是b.
和zips a, zips b
?)
我也不需要state
在查询中.
我的mySQL数据库结构是这样的:
ZIP | LAT | LONG
33416 | 26.6654 | -80.0929
Run Code Online (Sandbox Code Playgroud)
我写这个是为了尝试返回某种结果(不是基于上面的查询)但是,它只会踢出一个邮政编码.
## Just for a …
Run Code Online (Sandbox Code Playgroud) 我想结束100次霜冻,但我想我说错了.
它只用于循环+数组代码.
for (int i = 0; i < 100; i++)
{
System.Random RandNum = new System.Random();
int nyrHiti = RandNum.Next(-10, 50);
Console.WriteLine(nyrHiti);
int[] frostDays = new int[100];
}
Console.ReadLine();
Console.WriteLine(frostDays[0]);
Console.ReadLine();
Run Code Online (Sandbox Code Playgroud) 边界半径有点问题.我已经成功地完成了我的矩形,但是我遇到了将我放在它上面的悬停的问题.您将在圆角矩形的顶角和底角看到悬停本身不是圆角的,实际上是一个矩形.我试过围绕它,但它也围绕中心.我知道这可能没有意义,但你会明白这里:http://jsfiddle.net/hCg3J/
我想做的就是让每个选择突出显示整个区域,而不是突出.
HTML:
<ul class="pageitem">
<li class="list" style="border-top:none;"><a href="iphone4.html";><span class="name">iPhone 4/4S</span><div class="arrow"></div></a></li>
<li class="list"><a href="iphone3.html";><span class="name">iPhone 3G/3GS</span><div class="arrow"></div></a></li>
<li class="list"><a href="ipod.html";><span class="name">iPod Touch</span><div class="arrow"></div></a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
CSS
.pageitem {
-webkit-border-radius: 8px;
behavior: url(/border-radius.htc);
border-radius: 8px;
position:relative;
zoom: 1;
-moz-border-radius: 8em;
-khtml-border-radius: 8px;
border-radius: 8px;
background-color: #fff;
border: #878787 solid 1px;
font-size: 12pt;
overflow: hidden;
padding: 0;
height: auto;
width: auto;
margin: 3px 9px 17px;
list-style: none
}
Run Code Online (Sandbox Code Playgroud) 如果我在圆上有两个点,是否可以找到圆的半径和圆心?
实际上我想在PIC中的位置放置圆圈.我只是有一个矩形,它将包含圆圈.我希望这些圆圈以圆形方式从矩形的左中心开始放置到右中心.如果需要更多解释,请告诉我...
实现线性回归如下:
from sklearn.linear_model import LinearRegression
x = [1,2,3,4,5,6,7]
y = [1,2,1,3,2.5,2,5]
# Create linear regression object
regr = LinearRegression()
# Train the model using the training sets
regr.fit([x], [y])
# print(x)
regr.predict([[1, 2000, 3, 4, 5, 26, 7]])
Run Code Online (Sandbox Code Playgroud)
产生:
array([[1. , 2. , 1. , 3. , 2.5, 2. , 5. ]])
Run Code Online (Sandbox Code Playgroud)
在利用预测功能时,为什么不能利用单个x值来进行预测?
试 regr.predict([[2000]])
返回:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-3-3a8b477f5103> in <module>()
11
12 # print(x)
---> 13 regr.predict([[2000]])
/usr/local/lib/python3.6/dist-packages/sklearn/linear_model/base.py in predict(self, X)
254 Returns predicted …
Run Code Online (Sandbox Code Playgroud) 为什么这些似乎都不起作用?
String.Replace("/", "_");
String.Replace("//", "_");
String.Replace(((char)47).ToString(), "_");
Run Code Online (Sandbox Code Playgroud)
名为"FileName"的字符串仍然显示"MyFile 06/06/09"
c# ×4
algorithm ×1
android ×1
angle ×1
arrays ×1
audio-player ×1
border ×1
codeigniter ×1
css ×1
excel ×1
excel-vba ×1
geometry ×1
java ×1
javascript ×1
math ×1
mysql ×1
performance ×1
perl ×1
progress ×1
python ×1
regression ×1
replace ×1
scikit-learn ×1
search ×1
sql-like ×1
vba ×1
zipcode ×1