让我们说,在PHP中,我试图将图像放在root上的特定目录中.
我想把它放在/images/afc/esp/stadium/目录上.图像文件夹,联合文件夹,国家ISO3文件夹,内容文件夹.
$folder_full = "images/".$getFed."/".$country_folder."/stadiums";
if (!is_dir($folder_full)) mkdir($folder_full);
Run Code Online (Sandbox Code Playgroud)
在你问之前,是的$getFed,$country_folder工作和输出文本.那么,我得到这个错误:Warning: mkdir(): No such file or directory
我不明白吗?
我刚开始使用AngularJS.但是,为什么这不起作用?
加载网页后,我进入控制台Uncaught ReferenceError: $scope is not defined线上81的$scope.processForm = function() {帮助?
// define angular module/app
var formApp = angular.module('formApp', []);
// create angular controller and pass in $scope and $http
function formController($scope, $http) {
// create a blank object to hold our form information
// $scope will allow this to pass between controller and view
$scope.formData = {};
// process the form
$scope.processForm = function() {};
}
// process the form
$scope.processForm = …Run Code Online (Sandbox Code Playgroud)假设我有这个:
const color = {
red: null,
green: null,
blue: null
};
const newColor = ['red', 'green', 'blue'].filter(e => color[e]);
Run Code Online (Sandbox Code Playgroud)
错误在color[e]底部附近:
元素隐式地具有“ any”类型,因为类型“ string”的表达式不能用于索引类型“ {red:null; 绿色:null;蓝色:null;}'。在类型“ {{red:null;}”上找不到带有参数“ string”的索引签名。绿色:null;蓝色:null;}'。
我尝试在TypeScript文档上到处查找,但是我interface对此到底想怎么想,以便它可以接受color[e]?
我正在尝试编写一个方法,根据loadBoard(NUMBER_HERE)中的数字加载地图; 但我在线上得到了"无法达到的声明"
return board;
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
public int[][] loadBoard(int map) {
if (map == 1) { return new int[][] {
{2,2,24,24,24,24,24,3,3,0,0,0,1 },
{ 2,2,24,23,23,23,24,1,3,0,0,0,1 },
{ 1,1,24,23,23,23,24,1,3,3,3,3,1 },
{ 1,1,24,24,23,24,24,1,1,1,1,3,1 },
{ 1,1,1,1,7,1,1,1,1,1,1,3,1 },
{ 5,1,1,1,7,7,7,7,7,1,1,1,1 },
{ 6,3,3,1,3,3,3,1,7,7,7,3,1 },
{ 6,3,3,1,3,1,1,1,1,1,7,1,1 },
{ 3,3,1,1,1,1,1,1,1,1,7,1,1 } };
}else{
return new int[][] {
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,24,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,24,1,1,1,1 },
{ 1,1,7,1,1,24,24,24,24,1,1,1,1 },
{ 1,1,7,1,1,24,1,24,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,1,1,1,1,24,1,1,1,1,1,1,1 },
{ 1,3,3,1,1,24,1,1,1,1,1,1,1 },
}; } …Run Code Online (Sandbox Code Playgroud) 好的,所以我正在尝试从放入列表的数组中输出当前字符串...但是,当我点击列表时,我得到一个NullPointerException ...:\
救命?:)
import java.applet.Applet;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class lisTry extends JApplet implements MouseListener {
public static String newline;
public static JList list;
public void init() {
DefaultListModel listModel = new DefaultListModel();
listModel.addElement("Debbie Scott");
listModel.addElement("Scott Hommel");
listModel.addElement("Alan Sommerer");
JList list = new JList(listModel);
this.getContentPane().add(list);
list.addMouseListener(this);
String newline = "\n";
list.setVisible(true);
}
public void mousePressed(MouseEvent e) { }
public void mouseReleased(MouseEvent e) {
int index = list.getSelectedIndex();
System.out.println("You clicked on: " + index);
}
public void mouseEntered(MouseEvent …Run Code Online (Sandbox Code Playgroud) 好的,所以我从JList切换到List,因为
1.)它与我绘制的图像不重叠2.)它可以禁用焦点但跟踪所选的内容
无论如何,这是我尝试编译时得到的错误:
C:\Users\Dan\Documents\DanJavaGen\inventory.java:30: cannot find symbol
symbol : constructor List(java.lang.Object[])
location: class java.awt.List
list = new List(arr.toArray());
^
C:\Users\Dan\Documents\DanJavaGen\inventory.java:50: cannot find symbol
symbol : method getSelectedValue()
location: class java.awt.List
Object index = list.getSelectedValue();
^
Run Code Online (Sandbox Code Playgroud)
代码:
import java.applet.Applet;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.util.ArrayList;
import java.io.*;
import java.util.*;
import java.awt.List;
public class inventory extends JApplet implements MouseListener {
public static String newline;
public static List list;
int gold = 123;
public void init() {
ArrayList<String> arr = new …Run Code Online (Sandbox Code Playgroud) 我在从自定义方法返回数组时遇到问题.编译好但我回来了:
[Ljava.lang.String;@20cf2c80
Press any key to continue . . .
Run Code Online (Sandbox Code Playgroud)
我用:
System.out.println(getItem(1));
Run Code Online (Sandbox Code Playgroud)
码:
public static String[] getItem(int e) {
String[] stats = new String[7];
String name = "Null";
String desc = "None";
String typeOf = "0";
String attackAdd = "0";
String defenseAdd = "0";
String canSell = "true";
String canEat = "false";
String earnedCoins = "0";
if (e == 1) {
name = "Pickaxe";
desc = "Can be used to mine with.";
typeOf = "2";
}
return new String[] { …Run Code Online (Sandbox Code Playgroud) 假设我有这个2D数组映射
{ 0,0,0,0,7,1,1,1,1,1,1,1,1 },
{ 0,7,7,7,7,1,1,1,24,1,1,1,1 },
{ 0,7,24,24,24,24,24,24,24,1,1,3,1 },
{ 0,7,23,23,23,23,23,23,24,1,1,3,1 },
{ 0,7,24,23,23,23,23,23,23,1,1,1,1 },
{ 0,7,24,23,23,23,23,23,23,1,1,1,1 },
{ 0,7,23,23,23,23,23,23,24,1,3,1,1 },
{ 0,7,24,24,24,24,24,24,24,1,3,1,1 },
{ 0,0,0,0,1,1,1,1,1,1,1,1,1 },
Run Code Online (Sandbox Code Playgroud)
我有HashSet充满定义被阻止的瓷砖的整数.什么是一个好方法,以便当我点击地图的一部分时,我的玩家站在那里做一个好的寻路?A*(使用节点/等)?你有什么建议?
谢谢.
我正在使用applet,我现在不想签名,那么如何从applet查看器中禁用安全管理器?
这样我可以更快地工作.:)
我收到错误"无法发布数据".
这是SSCCE
//package mysqltest;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.applet.Applet;
import java.awt.TextArea.*;
import java.sql.*;
import java.util.*;
import javax.swing.plaf.*;
import javax.swing.plaf.basic.*;
import java.net.*;
import java.applet.*;
public class test extends JApplet {
public JTextArea c;
public void init() {
c = new JTextArea();
add(c);
c.append("Looking for database...");
Connection conn = null;
Properties props = new Properties();
String url = "jdbc:mysql://localhost:3306/";
String dbName = "mystik";
String driver = "com.mysql.jdbc.Driver";
String userName = "root";
String password = "";
String loggedusername = getParameter("name"); …Run Code Online (Sandbox Code Playgroud)