我需要将WPF DataGrid Column Header文本与中心对齐.我使用HeaderStyle下面的属性创建了一个样式并附加了它.
样式
<Window.Resources>
<Style x:Key="CenterGridHeaderStyle" TargetType="DataGridColumnHeader">
<Setter Property="HorizontalContentAlignment" Value="Center"/>
</Style>
</Window.Resources>
Run Code Online (Sandbox Code Playgroud)
柱
<DataGridTextColumn
Binding="{Binding Path=Name}" Header="Name" IsReadOnly="True"
HeaderStyle="{DynamicResource CenterGridHeaderStyle}"/>
Run Code Online (Sandbox Code Playgroud)
但是这不会将列标题文本与中心对齐.我怎样才能做到这一点?
我有一个Java属性文件,有一个KEYas ORDER.所以我在加载属性文件之后使用该方法检索它VALUE,如下所示:KEYgetProperty()
String s = prop.getProperty("ORDER");
Run Code Online (Sandbox Code Playgroud)
然后
s ="SALES:0,SALE_PRODUCTS:1,EXPENSES:2,EXPENSES_ITEMS:3";
Run Code Online (Sandbox Code Playgroud)
我需要从上面的字符串创建一个HashMap.SALES,SALE_PRODUCTS,EXPENSES,EXPENSES_ITEMS应该是KEYHashMap,0,1,2,3,应该是VALUEs的KEYs.
如果它很硬,看起来如下:
Map<String, Integer> myMap = new HashMap<String, Integer>();
myMap.put("SALES", 0);
myMap.put("SALE_PRODUCTS", 1);
myMap.put("EXPENSES", 2);
myMap.put("EXPENSES_ITEMS", 3);
Run Code Online (Sandbox Code Playgroud) 我正在使用Entity Framework开发ASP.net应用程序.我正在使用DetailsView将数据插入数据库.有一个表Client,其主键是client_id.client_id是由数据库自动生成的.我需要client_id在将记录插入Client表格后将其自动生成并将其分配给隐藏字段以供将来使用.
我搜索了这个,我找到了很多解决方案.但我不知道如何使用它们,因为我是asp.net的新手.我发现Entity Framework在调用后自动使用db生成的值填充业务对象SaveChanges().我的问题是我应该在我的部分课程中将其称为何处?活动是什么?
我正在使用DetailsView和EntityDataSource并将EntityDataSource直接与实体模型绑定,所以我不是要创建插入数据的对象.
我低于错误.
由于以下原因无法解析JSON:com.google.gson.JsonSyntaxException:java.lang.IllegalStateException:预期BEGIN_ARRAY但在第1行第2列是BEGIN_OBJECT
服务器URL
public static final String SERVER_URL = "https://maps.googleapis.com/maps/api/timezone/json?location=-37.8136,144.9631×tamp=1389162695&sensor=false";
Run Code Online (Sandbox Code Playgroud)
执行请求
try {
// Create an HTTP client
HttpClient client = HttpClientBuilder.create().build();
HttpPost post = new HttpPost(SERVER_URL);
// Perform the request and check the status code
HttpResponse response = client.execute(post);
StatusLine statusLine = response.getStatusLine();
if (statusLine.getStatusCode() == 200) {
HttpEntity entity = response.getEntity();
InputStream content = entity.getContent();
try {
// Read the server response and attempt to parse it as JSON
Reader reader = new InputStreamReader(content);
GsonBuilder gsonBuilder = new …Run Code Online (Sandbox Code Playgroud) 我正在使用Angular Universal Starter repo.在angular 4 universal for ssr中,我们可以在开发模式下调试应用程序的浏览器和节点部分(参见控制台),但现在我没有看到调试节点部分的方法.我试图执行ts-node server.ts一些变化(路径文件等),但似乎角需求AOT编译应用程序,并
throw错误:您必须传入NgModule或NgModuleFactory才能进行自举.
来自docs:
开发(仅客户端渲染) - 运行npm run start,将启动服务
制作(也用于本地测试SSR /预渲染) - npm run build:ssr && npm run serve:ssr
乍一看,开发中的Node.js上的调试不起作用.至少从盒子里出来.可能有人解决了这个问题.
我有以下字符串.
ABC Results for draw no 2888
Run Code Online (Sandbox Code Playgroud)
我想2888从这里提取.这意味着,我需要no在上面的字符串之后提取字符.
我总是在这个词之后提取数字no.字符串不包含其他no地方的其他字母组合.字符串可能包含其他数字,我不需要提取它们.总是在数字之前会有一个空格,我希望提取的数字总是在字符串的末尾.
我怎么能实现这个目标?
我想通过长按在地图上添加标记.但它不起作用.正常点击正在运行.Toastin onMapClick()以正常点击显示.但是长按不起作用.长按不显示Toastin onMapLongClick().地图上也不显示标记.
我正在使用SupportMapFragment因为我想在android 2.x设备上使用我的应用程序.我已经在nexus上测试了我的应用程序,其中有Android版本2.3.7.
这是我的代码.
public class MainActivity extends FragmentActivity implements
OnMapClickListener, OnMapLongClickListener {
final int RQS_GooglePlayServices = 1;
private GoogleMap myMap;
Location myLocation;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
FragmentManager myFragmentManager = getSupportFragmentManager();
SupportMapFragment mySupportMapFragment = (SupportMapFragment) myFragmentManager
.findFragmentById(R.id.map);
myMap = mySupportMapFragment.getMap();
myMap.setMyLocationEnabled(true);
myMap.setMapType(GoogleMap.MAP_TYPE_HYBRID);
// myMap.setMapType(GoogleMap.MAP_TYPE_NORMAL);
// myMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
// myMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
myMap.setOnMapClickListener(this);
myMap.setOnMapLongClickListener(this);
}
@Override
protected void onResume() {
super.onResume();
int resultCode = GooglePlayServicesUtil
.isGooglePlayServicesAvailable(getApplicationContext());
if (resultCode == ConnectionResult.SUCCESS) …Run Code Online (Sandbox Code Playgroud) android latitude-longitude google-maps-markers google-maps-android-api-2 supportmapfragment
我想格式化2012-05-04 00:00:00.0来04-MAY-2012.我已经尝试过以下步骤.
SimpleDateFormat sdf = new SimpleDateFormat(
"yyyy-MM-dd 'T' HH:mm:ss.SSS");
Date date;
String dateformat = "";
try {
date = sdf.parse("2012-05-04 00:00:00.0");
sdf.applyPattern("DD-MON-RR");
dateformat = sdf.format(date);
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
但我得到了以下异常.
java.text.ParseException: Unparseable date: "2012-05-04 00:00:00.0"
at java.text.DateFormat.parse(DateFormat.java:337)
at com.am.test.Commit.main(Example.java:33)`
Run Code Online (Sandbox Code Playgroud)
我怎么能这样做?