我只是运行这个命令:
\n\nsudo pip install pyodbc \nRun Code Online (Sandbox Code Playgroud)\n\n然后我收到以下消息和错误:
\n\nsteven81@PythonWEBVM:~$ sudo pip install pyodbc\nThe directory \'/home/steven81/.cache/pip/http\' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo\'s -H flag.\nThe directory \'/home/steven81/.cache/pip\' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that …Run Code Online (Sandbox Code Playgroud) 我编写了一个C#控制台程序来尝试从Oracle查询一些数据,这是一个非常简单的查询,但是我不知道为什么在运行它时总是告诉我“缺少表达式”,请参见下面的代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Oracle.DataAccess.Client;
using System.Configuration;
namespace ConnectToOracle
{
class Program
{
static void Main(string[] args)
{
string strCon = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
using (OracleConnection oc = new OracleConnection(strCon))
{
OracleCommand cmd = new OracleCommand("select dname from dept where deptno = @deptno", oc);
OracleParameter op = new OracleParameter();
op.ParameterName = "@deptno";
op.OracleDbType = OracleDbType.Int32;
op.Direction = System.Data.ParameterDirection.Input;
cmd.Parameters.Add(op);
oc.Open();
string dname = (string)cmd.ExecuteScalar();
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
因此,在最后一行,将从cmd.ExecuteScalar()方法中引发错误“缺少表达式”,有人可以告诉我为什么吗?我很困惑
提前致谢!
我在我的chrome中使用以下URL,它运行正常:https: //westus.api.cognitive.microsoft.com/luis/v2.0/apps/62bea90c-9b0c-487b-8416-1a4d94772f99?subscription-key=29317e2237fb4b43a91959cadee6f143&staging=真冗长=真&的timezoneoffset = 480&q =哪个国家获得2010年世界杯第一名
它返回json字符串,如下所示:
{
"query": "??????2010???????",
"topScoringIntent": {
"intent": "Query",
"score": 0.9818858
},
"intents": [
{
"intent": "Query",
"score": 0.9818858
},
{
"intent": "None",
"score": 0.01755463
}
],
"entities": [
{
"entity": "2010?",
"type": "builtin.datetimeV2.daterange",
"startIndex": 6,
"endIndex": 10,
"resolution": {
"values": [
{
"timex": "2010",
"type": "daterange",
"start": "2010-01-01",
"end": "2011-01-01"
}
]
}
},
{
"entity": "2010",
"type": "builtin.number",
"startIndex": 6,
"endIndex": 9,
"resolution": {
"value": "2010"
}
},
{
"entity": "?",
"type": …Run Code Online (Sandbox Code Playgroud) 我想测试我的控制器,并使用以下方法对其进行测试:
package spittr.web;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.standaloneSetup;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.junit.Test;
import org.mockito.Mockito;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.web.servlet.view.InternalResourceView;
import spittr.data.Spittle;
import spittr.data.SpittleRepository;
public class SpittleControllerTest {
@Test
public void shouldShowRecentSpittles() throws Exception {
List<Spittle> expectedSpittles = createSpittleList(20);
SpittleRepository mockRepository = Mockito.mock(SpittleRepository.class);
Mockito.when(mockRepository.findSpittles(Long.MAX_VALUE, 20))
.thenReturn(expectedSpittles);
SpittleController controller = new SpittleController(mockRepository);
MockMvc mockMvc = standaloneSetup(controller)
.setSingleView(
new InternalResourceView("/WEB-INF/views/spittles.jsp"))
.build();
mockMvc.perform(get("/spittles"))
.andExpect(view().name("spittles"))
.andExpect(model().attributeExists("spittleList"))
.andExpect(model().attribute("spittleList", hasItems(expectedSpittles.toArray())));
}
private List<Spittle> createSpittleList(int count) {
List<Spittle> spittles = new …Run Code Online (Sandbox Code Playgroud) 现在有一个像这样的字符串:
789 + 456-239
我想得到一个这样的列表:
sign | num
+ 789
+ 456
- 239
Run Code Online (Sandbox Code Playgroud)