我正在尝试在我的 mac 操作系统上安装 Pod(操作系统版本很确定),并且我正在使用 Xcode 13.1
我正在尝试从终端使用以下命令安装 Pod:
sudo pod install
Run Code Online (Sandbox Code Playgroud)
然后系统询问我密码,之后我可以在终端行中看到此错误:
Traceback (most recent call last):
16: from /usr/local/Cellar/cocoapods/1.11.2_1/libexec/bin/pod:23:in `<main>'
15: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `activate_bin_path'
14: from /Library/Ruby/Site/2.6.0/rubygems.rb:285:in `synchronize'
13: from /Library/Ruby/Site/2.6.0/rubygems.rb:286:in `block in activate_bin_path'
12: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1370:in `activate'
11: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1388:in `activate_dependencies'
10: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1388:in `each'
9: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1406:in `block in activate_dependencies'
8: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1370:in `activate'
7: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1388:in `activate_dependencies'
6: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1388:in `each'
5: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1406:in `block in activate_dependencies'
4: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1370:in `activate'
3: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1388:in `activate_dependencies'
2: …Run Code Online (Sandbox Code Playgroud) 我有这个问题.我已经创建了一个小应用Android.
我使用EditText显示AlertDialog.Builder,因此用户必须单击EdiText,选择Number 123然后插入一个int号.
我想展示一个只有数字的键盘.我们可以帮帮我吗?可以创建一个自动聚焦的AlertDialog吗?
我写了这段代码.我们可以帮帮我吗?
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Inserisci quantità");
alert.setMessage("Inserisci una quantità per l'articolo: "+articolo.getNomeArticolo());
final EditText inputText = new EditText(this);
alert.setView(inputText);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
String value = inputText.getText().toString();
try{
int quantita = Integer.parseInt(value);
ArticoliOrdine articoloOrdine = new ArticoliOrdine();
articoloOrdine.setIdArticolo(articolo.getCodArticolo());
articoloOrdine.setNomeArticolo(articolo.getNomeArticolo());
articoloOrdine.setQuantia(quantita);
listaArticoli.add(articoloOrdine);
adapter.notifyDataSetChanged();
}catch(Exception e){
AlertDialog.Builder alertErrore = new AlertDialog.Builder(getApplicationContext());
alertErrore.setTitle("Errore");
alertErrore.setMessage("Hai inserito una quantità non valida.");
alertErrore.show();
}
}
});
// Showing Alert Message
alert.show();
Run Code Online (Sandbox Code Playgroud) 我想在JPanel中显示Multiline JLabel.所以我有这个代码,但我无法显示多行JLabel.
public class NotificationFrame extends JFrame{
public NotificationFrame(){
JPanel panelBody = new JPanel();
panelBody.setBackground(Color.white);
GridBagConstraints GBC2 = new GridBagConstraints();
Container CR2 = new Container();
GridBagLayout GBL2 = new GridBagLayout();
CR2.setLayout(GBL2);
panelBody.add(CR2);
GBC2 = new GridBagConstraints();
CR2.add(labelTesto);
GBC2.gridx=0;
GBC2.gridy=0;
GBC2.insets.left = 10;
GBC2.insets.top=0;
GBL2.setConstraints(labelTesto,GBC2);
panelBody.setLayout(new FlowLayout(FlowLayout.CENTER));
add(panelBody,BorderLayout.CENTER);
}
}
Run Code Online (Sandbox Code Playgroud)
如果我更改了最后一行代码
add(labelTest,BorderLayout.CENTER);
Run Code Online (Sandbox Code Playgroud)
我可以证明我想要的.但它不正确,因为我想在JLabel上设置填充
编辑
我现在使用这个代码:
JPanel panelBody = new JPanel();
panelBody.setBackground(Color.white);
SpringLayout layout = new SpringLayout();
panelBody.setLayout(layout);
panelBody.add(labelTesto);
layout.putConstraint(SpringLayout.NORTH, labelTesto, 15, SpringLayout.NORTH, panelBody);
add(panelBody,BorderLayout.CENTER);
Run Code Online (Sandbox Code Playgroud)
这是布局:
这是我应该看到的所有测试:"Il 31Dicembrescadràl'assistenza,ricorda di rinnovare l'assistenza per …
我正在开发一个Android应用程序,它使用GoogleMaps.因此,当我点击按钮时,我会加载一个显示谷歌地图的registraPosizioneActivity.所以我注意到这项活动的加载速度很慢.是否有提高此活动加载速度的模式?
这是我的代码:
protected void onCreate(Bundle savedInstanceState) {
try{
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_recordposition);
locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
Criteria criteria = new Criteria();
criteria.setAccuracy(Criteria.ACCURACY_FINE);
provider = locationManager.getBestProvider(criteria, false);
locationManager.requestLocationUpdates(provider, 1000, 0, this);
settaMappa();
if(myPosition==null){
pDialog = ProgressDialog.show(this, "Attendere ...", "Localizzazione in corso ...", true);
pDialog.setCancelable(false);
}
}catch(Exception e){
Log.e("Errore onCreate:",e.getMessage());
Utility.generateNoteOnSD(fileName,e.getMessage());
}
}
public void settaMappa(){
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map2)).getMap();
mMap.setMapType(GoogleMap.MAP_TYPE_TERRAIN);
mMap.setMyLocationEnabled(true);
}
Run Code Online (Sandbox Code Playgroud)
这是activity_recordposition.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:map="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#000000"
android:orientation="vertical"
tools:context=".registraPosizioneActivity"
android:gravity="center">
<fragment
android:name="com.google.android.gms.maps.SupportMapFragment"
android:id="@+id/map2"
android:layout_height="0dp"
android:layout_weight="10"
android:layout_width="match_parent"
class="com.google.android.gms.maps.SupportMapFragment"
/>
<LinearLayout
android:layout_width="fill_parent" …Run Code Online (Sandbox Code Playgroud) 我想修改组合框的默认样式。所以我写了这段代码:
<!-- ComboBox style -->
<Style x:Key="{x:Type ComboBox}" TargetType="ComboBox">
<Setter Property="SnapsToDevicePixels" Value="true"/>
<Setter Property="OverridesDefaultStyle" Value="true"/>
<Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ComboBox">
<Grid>
<ToggleButton Name="ToggleButton"
Template="{StaticResource ComboBoxToggleButton}"
IsChecked="{Binding Path=IsDropDownOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
ClickMode="Press">
</ToggleButton>
<ContentPresenter Name="ContentSite" IsHitTestVisible="False"
Content="{TemplateBinding SelectionBoxItem}"
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Margin="3,3,23,3"
<TextBox x:Name="PART_EditableTextBox"
Style="{x:Null}" Template="{StaticResource ComboBoxTextBox}"
Text="{TemplateBinding Text}"
Foreground="DarkBlue"
IsReadOnly="{TemplateBinding IsReadOnly}"/>
<Popup Name="Popup" Placement="Bottom"
IsOpen="{TemplateBinding IsDropDownOpen}"
AllowsTransparency="True" Focusable="False"
PopupAnimation="Slide">
<Grid Name="DropDown"
SnapsToDevicePixels="True" MinWidth="{TemplateBinding ActualWidth}"
MaxHeight="{TemplateBinding MaxDropDownHeight}">
<Border x:Name="DropDownBorder"/>
<ScrollViewer Margin="4,6,4,6" SnapsToDevicePixels="True">
<StackPanel IsItemsHost="True" KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup> …Run Code Online (Sandbox Code Playgroud) 我想以编程方式更改语言.
所以我构建了两个xml文件.
values-it
-->string.xml
values-en
-->string.xml
Run Code Online (Sandbox Code Playgroud)
这是MainActivity中用于更改整个应用程序语言的代码:
//意大利
Resources res = getApplicationContext().getResources();
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.locale = new Locale("it");
res.updateConfiguration(conf, dm);
Run Code Online (Sandbox Code Playgroud)
//英语
Resources res2 = getApplicationContext().getResources();
DisplayMetrics dm2 = res2.getDisplayMetrics();
android.content.res.Configuration conf2 = res2.getConfiguration();
conf2.locale = new Locale("en");
res2.updateConfiguration(conf2, dm2);
Run Code Online (Sandbox Code Playgroud)
现在,如果我设置英语(例如),代码执行时没有错误,但标签不会更改其文本.
如果我更改设备的方向,标签会正确更改其文本.
现在我如何修改我的代码以自动刷新标签?
我在我的 OsX 10.11 El Capitan 上安装了 MySql。如果我尝试开始我的查询,如果我的查询具有 Group By,则会出现一个奇怪的错误。
因此,如果我尝试从终端执行此查询:
SET GLOBAL sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
Run Code Online (Sandbox Code Playgroud)
我可以执行我的查询从来没有问题。现在,如果我尝试重新启动我的 macbook,我会遇到一些问题,我可以重新执行查询。
有什么办法可以永久修复这个 sql_mode 吗?
我有 tro 打开“etc/mysql/my.cnf”文件,但我的 mac 上没有这个文件。如何应用此更改?
我使用Appcelerator来构建我的移动应用程序.所以今天如果我尝试启动Appcelerator工作室我就有这种情况.
如果我在一段时间后尝试点击该屏幕,我有一个像这样的Windows错误:
我该如何解决这个问题?
我尝试重新下载Appcelerator Studio,修复选项,修改选项,卸载并重新安装,但它不起作用.
如何重新打开IDE?
我有一个 T-SQL 存储过程。我想从日期和字符串创建一个日期时间。
所以我有这个:
DECLARE @DATE AS DATE
DECLARE @TIME AS NVARCHAR(5)
SET @DATE = NOW() /*2017-10-11*/
SET @TIME = '08:00'
Run Code Online (Sandbox Code Playgroud)
现在,我想创建这个日期 '2017-10-11 08:00:00'
我想使用JFrame从我的Java应用程序发送系统通知,我想在此通知中设置背景颜色.现在通知有效,但我无法更改背景颜色.这是代码:
public class NotificationFrame extends JFrame{
/**
*
*/
private static final long serialVersionUID = -2902763674924791105L;
public NotificationFrame(){
super();
setUndecorated(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBackground(Color.red);
setMinimumSize(new Dimension(300, 100));
add(new LabelFormat("Notifiche"));
}
}
Run Code Online (Sandbox Code Playgroud)
使用此代码,我的JFrame的背景颜色是格雷德时间.