我只想安装mongo-shell在我的 mac 上
我跑了brew update然后我跑了brew install mongodb-org-shell..但它没有被安装。下面是错误信息
bash-3.2$ brew install mongodb-org-shell
Error: No available formula with the name "mongodb-org-shell"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
git -C "$(brew --repo homebrew/core)" fetch --unshallow
Error: No previously deleted formula found.
==> Searching for similarly named formulae...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: …Run Code Online (Sandbox Code Playgroud) 我的要求是根据字符串在数据库中进行搜索.
该特定字符串可能以大写形式存储在数据库中.
所以,我将不得不通过HQL进行不区分大小写的搜索
我目前的HQL是
String query = "from OrganizationContent where orgUrl=:url";
Map<String,Object> parameterMap = new HashMap<String,Object>();
parameterMap.put("url", organizationUrlInput.toLowerCase());
Run Code Online (Sandbox Code Playgroud)
只有".toLowerCase"我可以从java端做到.现在我需要通过执行不区分大小写的搜索来获取数据.
感谢你对这位朋友的帮助
我正在春季学习AOP概念。我现在很了解@Before和@After注释的用法,并开始将其用于时间捕获目的。
这几乎可以满足我所有与AOP相关的需求。想知道@pointcut每个春季指南都在谈论的注释是什么?那是多余的功能吗?还是有单独的需求?
下面是我的landing-HTML页面
<div class="container">
<div>
<mat-radio-group class="selected-type" [(ngModel)]="selectedType" (change)="radioChange()">
<p class="question">Which movie report would you like to see ?</p>
<mat-radio-button id="movie-a" class="Movie-type" [value]="MovieType.HORROR">Horror</mat-radio-button>
<mat-radio-button id="movie-b" class="Movie-type" [value]="MovieType.ROMANTIC">Romantic</mat-radio-button>
</mat-radio-group>
</div>
<movie-report *ngIf="showMovieReport"></movie-report>
</div>
Run Code Online (Sandbox Code Playgroud)
这<movie-report>是一个不同的组件,它有自己的组件component.ts,可以生成REST Call和提供一些数据。
我想将MovieType数据传递给MovieReport组件。怎么做 ?
在我的项目中,他们以下面提到的方式使用Hibernate的会话,然后在事务中保存实体对象.
Session session = HibernateUtil.getCurrentSession();
session.beginTransaction();
Employee employee = new Employee() ;
employee.setName("someName") ;
employee.setEmailId ("someId")
employee.setID (100000) ;
session.saveOrUpdate(employee) ;
session.getTransaction().commit();
Run Code Online (Sandbox Code Playgroud)
现在我的功能很少,我决定运行本机SQL.下面是我用来运行本机sql的方式.我想在事务中运行查询,所以我决定以下面的方式编写代码
String query = "select name from master_employee where id=?"
Session session = HibernateUtil.getCurrentSession();
session.beginTransaction();
Connection connection = session.connection();
PreparedStatement psStmt = connection.prepareStatement(query);
psStmt.setInt(1,id) ;
ResultSet resultSet = psStmt.executeQuery();
// here i will take data from this result set
psStmt.close();
resultSet.close() ;
// I am not closing the connection object since am taking it from hibernate …Run Code Online (Sandbox Code Playgroud) 对不起基本问题.我是GoLang的新手.
我有一个名为的自定义类型ProtectedCustomType,我不希望其中的变量set直接由调用者,而是希望Getter/ Setter方法这样做
以下是我的 ProtectedCustomType
package custom
type ProtectedCustomType struct {
name string
age int
phoneNumber int
}
func SetAge (pct *ProtectedCustomType, age int) {
pct.age=age
}
Run Code Online (Sandbox Code Playgroud)
这是我的main功能
import (
"fmt"
"./custom"
)
var print =fmt.Println
func structCheck2() {
pct := ProtectedCustomType{}
custom.SetAge(pct,23)
print (pct.Name)
}
func main() {
//structCheck()
structCheck2()
}
Run Code Online (Sandbox Code Playgroud)
但我无法继续......你能帮我解决一下如何在GoLang中实现getter-setter概念吗?
正在学习Go,在此示例中,我可以看到该select语句使goroutine等待多个通信操作
我们真的需要select声明吗?我的下面做了同样的事情,没有select声明
func runForChannel1(channel1 chan string) {
time.Sleep(1 * time.Second)
channel1 <- "Hi Arun ... I am Channel-1"
}
func runForChannel2(channel2 chan string) {
time.Sleep(2 * time.Second)
channel2 <- "Hi Arun ... I am Channel-2"
}
func testSelect() {
channel1 := make(chan string)
channel2 := make(chan string)
go runForChannel1(channel1)
go runForChannel2(channel2)
chval1, chval2 := <-channel1, <-channel2
fmt.Println(chval1, chval2)
}
func main() {
testSelect()
}
Run Code Online (Sandbox Code Playgroud)
没有select陈述,我能够等待两个渠道获得其价值...为什么我们需要Select陈述?有人可以教育我吗?
我用来从一个对象Lombok-Builder构建我的apijava对象entity
RewardApi.builder()
.rewardId(rewardEntity.getrewardId())
.rewardTitle(rewardEntity.getrewardTitle())
.rewardText(rewardEntity.getrewardText())
.rewardFor(rewardEntity.getrewardFor())
.rewardType(rewardEntity.getrewardType())
.rewardFromDate(rewardEntity.getrewardFromDate().toZonedDateTime())
.rewardToDate(rewardEntity.getrewardToDate().toZonedDateTime())
.isDisplayOn(rewardEntity.getIsDisplayOn())
.createdId(rewardEntity.getCreatedId())
.updatedId(rewardEntity.getUpdatedId())
.createdDate(rewardEntity.getCreatedDate().toZonedDateTime())
.lastModifiedDate(rewardEntity.getLastModifiedDate().toZonedDateTime())
.build();
Run Code Online (Sandbox Code Playgroud)
我nullPointerException在设置lastModifiedDate字段时得到了结果,因为entity对象正在获取该字段并且null正在toZonedDateTime()执行null
如何在不使用传统方式(如下所述)的情况下解决这个问题
if (null!=rewardEntity.getLastModifiedDate(){....}
我想null在使用设置变量时进行检查builder-pattern,而不是null在构建对象后进行检查。无论如何 ?
我的印象是,当var声明 Java 中的关键字时,编译器将确保类型,而我无法根据条件动态分配类型。但我不确定我的理解是否错误,或者这是Java中的一个错误。看我下面的代码
public static void printDayOfWeek_new_style(int day) {
var dayOfTheWeek = switch (day) {
case 0 -> "Sunday";
case 1 -> "Monday";
case 2 -> "Tuesday";
case 3 -> "Wednesday";
case 4 -> "Thursday";
case 5 -> "Friday";
case 6 -> "Saturday";
default -> 2000;
};
System.out.println("New >> "+dayOfTheWeek);
if (dayOfTheWeek instanceof String) {
System.out.println("yes it is a string");
}else if (dayOfTheWeek instanceof Integer) {
System.out.println("yes it is an integer");
}
}
Run Code Online (Sandbox Code Playgroud)
如果 switch 落在语句中,则该dayOfTheWeek变量将变为 …