- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
抱歉,代码有点多,但到目前为止还相当简单。
因此,我尝试在类被修改和编译时即时执行动态类重新加载。我创建了一个与 WatchDir 示例类似的 JavaSystemCompiler 类,只不过每次保存 .java 文件时它只编译一次。我还创建了一个 JavaSystemClassLoader 应用程序,它执行加载项目目录中所有类的任务,无论包如何(它尚未处理 jar),以及 ClassLoader 类 (JSCL_2.java),以便实际执行加载和重新加载。一切正常,直到我尝试使用代理动态链接新类(在本例中为 RunContinually.java 和 RunContinuallyI.java)。我收到的错误是:
线程“main”中的异常 java.lang.IllegalArgumentException:类 RunContinuallyImpl 在类加载器中不可见
我已经尝试了以下四种组合:
JavaSystemClassLoader.class.getClassLoader().getParent();
JavaSystemClassLoader.class.getClassLoader();
JSCL_2.class.getClassLoader();
and
JavaSystemClassLoader.class.getClassLoader().getSystemClassLoader();
它们都不起作用。下面列出了可编译的 .java 文件:
public interface RunContinuallyI {
public abstract void printHobby();
}
public class RunContinuallyImpl extends Thread implements RunContinuallyI {
public static int runNum = 0;
public RunContinuallyImpl() {
}
public void run() {
while(true) {
printHobby();
try {
sleep(5000);
} catch (InterruptedException ie) {
}
}
}
public void printHobby() {
System.out.println(++runNum + ": Compiling");
}
public static void main(String[] args) {
new RunContinuallyImpl().start();
}
}
import ca.tecreations.Global;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.Iterator;
import java.util.stream.Collectors;
import org.apache.commons.io.*;
/**
*
* @author Tim, with starter source from Advanced Java Class Tutorial: A Guide to Class Reloading
*
* https://www.toptal.com/java/java-wizardry-101-a-guide-to-java-class-reloading
*
*/
public class JSCL_2 extends ClassLoader {
private static final String className = JSCL_2.class.getName();
ClassLoader parent;
JSCL_2 loader;
Class<?> _class;
byte[] data;
public JSCL_2(ClassLoader parent) {
super(parent);
this.parent = parent;
loader = this;
// System.out.println("Parent : " + parent.getParent());
// System.out.println("ParentClassLoader: " + parent.toString());
}
public Class<?> loadClass(String name) {
if (name.startsWith("java.") | name.startsWith("javax.")) {
try {
return parent.loadClass(name);
} catch (ClassNotFoundException cnfe) {
System.out.println("Class Not Found: " + name);
}
} else {
String path = Global.getProjectPath() + name.replace(".",File.separator) + ".class";
//System.out.println("" + className + ".loadClass : " + path + "," + name);
data = loadClassData(path);
if (data != null) {
try {
_class = defineClass(name, data, 0, data.length);
resolveClass(_class);
return _class;
} catch (Error e) {
System.out.println("Error while resolving: " + name);
e.printStackTrace();
}
}
}
return null;
}
public Class<?> reload(String path, String name) {
try {
new Thread().sleep(2500);
} catch (InterruptedException ie) {
System.out.println("Interrupted.");
}
System.out.println("" + className + ".reload: " + name);
data = loadClassData(path);
if (data != null) {
try {
_class = defineClass(name, data, 0, data.length);
resolveClass(_class);
// is this where you use the proxy????
// or is it better off in JavaSystemClassLoader.java?
return _class;
} catch (Error e) {
System.out.println("Error: " + e.toString());
}
}
return null;
}
protected byte[] loadClassData(String path) {
FileInputStream in = null;
try {
in = new FileInputStream(path);
} catch (FileNotFoundException fnfe) {
// So using this package, that shouldn't happend, but anyway
System.out.println(className + ".loadClassData: File not found: " + path);
}
// okay, so load the class
byte[] data = null;
try {
data = IOUtils.toByteArray(in);
in.close();
} catch (IOException ioe) {
System.err.println("IOException: reading class data.");
}
return data;
}
}
import ca.tecreations.*;
import java.awt.BorderLayout;
import java.awt.event.*;
import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*;
import static java.nio.file.LinkOption.*;
import java.io.*;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.*;
import java.util.stream.Collectors;
import javax.swing.*;
public class JavaSystemClassLoader extends TFrame implements ActionListener {
boolean _switch = true; // start with true, switch off, then on
public static final String className = JavaSystemClassLoader.class.getName();
public static final long buildNumber = 0L;
String classpath;
DefaultListModel<String> model = new DefaultListModel<>();
JList<String> list = new JList<String>(model);
JButton clear = new JButton("Clear");
private WatchService watcher = null;
private Map<WatchKey,Path> keys = null;
private boolean trace = false;
boolean debugDirs = false;
List<String> loadedClasses = new ArrayList<String>();
List<JSCL_2> loaders = new ArrayList<JSCL_2>();
List<String> unavaiClasses = new ArrayList<String>();
private ClassLoader parent = JavaSystemClassLoader.class.getClassLoader();
@SuppressWarnings("unchecked")
static <T> WatchEvent<T> cast(WatchEvent<?> event) {
return (WatchEvent<T>)event;
}
/**
* Register the given directory with the WatchService
*/
private void register(Path dir) {
WatchKey key = null;
loadDir(dir.toAbsolutePath().toString());
try {
key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
} catch (IOException ioe) {
if (trace) System.err.println("Skipping: " + dir.toString());
}
if (key != null) {
Path prev = keys.get(key);
if (prev == null) {
if (trace) System.out.format("register: %s\n", dir);
} else {
if (!dir.equals(prev)) {
if (trace) System.out.format("update: %s -> %s\n", prev, dir);
//model.addElement("dir.rename: " + prev + "," + dir);
}
}
keys.put(key, dir);
}
}
/**
* Register the given directory, and all its sub-directories, with the
* WatchService.
*/
private void registerAll(final Path start) {
// register directory and sub-directories
File[] roots = start.toFile().listFiles();
if (roots != null) {
for(int i = 0; i < roots.length;i++) {
// exclude the one's giving errors
// watch, this happens on windows 7 at least,
if (roots[i].isDirectory()) {
if (
!roots[i].getAbsolutePath().toLowerCase().endsWith("config.msi") &&
// now, i like comments in between, so
!roots[i].getAbsolutePath().equals("/System/Library/DirectoryServices/DefaultLocalDB/Default")
) {
//so we excluded those, now
register(Paths.get(roots[i].getAbsolutePath()));
registerAll(Paths.get(roots[i].getAbsolutePath()));
//model.addElement(roots[i].getAbsolutePath());
}
}
}
}
}
/**
* Creates a WatchService and registers the given directory
*/
public JavaSystemClassLoader(String classpath) {
super(className);
this.classpath = classpath;
setTitle("Java System Class Loader");
try {
watcher = FileSystems.getDefault().newWatchService();
keys = new HashMap<WatchKey,Path>();
} catch (IOException ioe) {
System.out.println("IOE: " + ioe);
}
if (getStorage().wasCreated()) {
setSize(640,480);
setLocationRelativeTo(null);
}
add(new JScrollPane(list,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS),BorderLayout.CENTER);
JPanel panel = new JPanel();
panel.add(clear);
add(panel,BorderLayout.SOUTH);
clear.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(clear)) {
model.removeAllElements();
}
}
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
/**
* Process all events for keys queued to the watcher
*/
void processEvents() {
for (;;) {
// wait for key to be signalled
WatchKey key;
try {
key = watcher.take();
} catch (InterruptedException x) {
return;
}
Path dir = keys.get(key);
if (dir == null) {
System.err.println("WatchKey not recognized!!: " + key.toString());
continue;
}
for (WatchEvent<?> event: key.pollEvents()) {
WatchEvent.Kind kind = event.kind();
if (kind == OVERFLOW) {
System.out.println(className + ": KEY: OVERFLOW");
continue;
}
// Context for directory entry event is the file name of entry
WatchEvent<Path> ev = cast(event);
Path name = ev.context();
Path child = dir.resolve(name);
// print out event
//if (child.toString().toLowerCase().endsWith(".class")) {
// System.out.format("%s: %s\n", event.kind().name(), child);
//}
// if directory is created, and watching recursively, then
// register it and its sub-directories
if (kind == ENTRY_CREATE) {
if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
registerAll(child);
}
}
// on create compile. if .java
if (event.kind().name().equals("ENTRY_CREATE")) {
if (Files.isDirectory(child,NOFOLLOW_LINKS)) {
//if (debugDirs) model.addElement("dir.create: " + child + File.separator);
} else {
if (_switch && child.toAbsolutePath().toString().toLowerCase().endsWith(".class")) {
//model.addElement("file.create: " + child);
//model.addElement("Load : " + child.toString());
//System.out.println("Load : " + child.toString());
String className = getClassNameFromClassFilename(Global.getProjectPath(),child.toAbsolutePath().toString());
//model.addElement("Class : " + className);
load(child.toString(),className);
}
}
} else if (event.kind().name().equals("ENTRY_DELETE")) {
if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
//model.addElement("dir.delete: " + child + File.separator);
} else {
if (_switch && child.toString().endsWith(".class")) {
System.out.println("Deleted: " + child.toString());
}
}
} else if (event.kind().name().equals("ENTRY_MODIFY")) {
if (Files.isDirectory(child,NOFOLLOW_LINKS)) {
//model.addElement("dir.modify: " + child);
} else {
if (_switch && child.toString().toLowerCase().endsWith(".class")) {
//model.addElement("Reload: " + child.toString());
System.out.println("Reload: " + child.toString());
reload(child.toAbsolutePath().toString());
}
}
}
int lastIndex = list.getModel().getSize() - 1;
if (lastIndex >= 0) {
list.ensureIndexIsVisible(lastIndex);
}
// reset key and remove from set if directory no longer accessible
}
boolean valid = key.reset();
if (!valid) {
keys.remove(key);
// all directories are inaccessible
if (keys.isEmpty()) {
break;
}
}
_switch = !_switch;
}
}
public String getClassNameFromClassFilename(String classPath, String classFilename) {
String target = "";
if (classPath.endsWith(File.separator)) target = classFilename.substring(classPath.length());
else target = classFilename.substring(classPath.length() + 1);
target = target.substring(0,target.length() - 6); // remove .class
target = target.replace(File.separatorChar,'.'); // form filename to class name
return target;
}
public void printLoaded() {
java.util.List<String> loaded = loadedClasses.stream().sorted().collect(Collectors.toList());
for(int i = 0; i < loaded.size();i++) {
System.out.println("Loaded : " + loaded.get(i));
}
}
public void printUnavailable() {
java.util.List<String> unavailable = unavaiClasses.stream().sorted().collect(Collectors.toList());
for(int i = 0; i < unavailable.size();i++) {
System.out.println("Unavailable: " + unavailable.get(i));
}
}
public static void main(String[] args) {
// parse arguments
//if (args.length == 0 || args.length > 2)
// usage();
JavaSystemClassLoader loader = null;
loader = new JavaSystemClassLoader(Global.getProjectPath());
long start = Runtime.getRuntime().freeMemory();
loader.register(Paths.get(Global.getProjectPath()));
loader.registerAll(Paths.get(Global.getProjectPath()));
loader.printLoaded();
loader.printUnavailable();
long finished = Runtime.getRuntime().freeMemory();
long total = start - finished;
System.out.println("Memory Consumed: " + getMB(total));
new RunContinuallyImpl().start();
loader.processEvents();
}
public static String getMB(long total) {
int megabytes = (int)(total / (1000 * 1000));
return (megabytes + " MB");
}
public void loadDir(String path) {
File[] f = new File(path).listFiles();
for(int i = 0; i < f.length;i++) {
if (f[i].isFile() && f[i].getAbsolutePath().toLowerCase().endsWith(".class")) {
load(f[i].getAbsolutePath(),getClassNameFromClassFilename(Global.getProjectPath(),f[i].getAbsolutePath()));
}
}
}
public void load(String fileName, String name) {
//System.out.println(className + ".load : " + fileName + " : " + name);
//try {
// Class<?> cls = Class.forName(className);
//} catch (ClassNotFoundException cnfe) {
// System.err.println("load : Class not found: " + className);
//}
JSCL_2 loader = new JSCL_2(parent);
Class<?> _class = null;
_class = loader.loadClass(name);
if (_class == null) {
model.addElement("Load : null: " + fileName + " , " + name);
unavaiClasses.add(name);
} else {
loadedClasses.add(name);
loaders.add(loader);
}
}
public void reload(String fileName) {
String name = getClassNameFromClassFilename(Global.getProjectPath(),fileName);
JSCL_2 loader = new JSCL_2(parent);
Class<?> _class = loader.reload(fileName,name);
if (_class == null) {
model.addElement("Reload: null: " + fileName + " , " + name);
// couldn't/wouldn't do it....
} else {
int found = unavaiClasses.indexOf(name);
if (found == -1) {
int index = loadedClasses.indexOf(name);
loaders.set(index, loader);
model.addElement("Reloaded: " + name);
// so is this where I need the proxy?
InvocationHandler handler = new DynaCodeInvocationHandler(loader);
Class<?> proxy = (Class<?>) Proxy.newProxyInstance(parent, new Class[] { _class}, handler);
} else {
System.err.println("This change necessitates an application restart.");
}
}
}
}
import ca.tecreations.Global;
//import ca.tecreations.apps.viewer.FileViewer;
import java.awt.*;
import java.awt.event.*;
import java.nio.file.*;
import static java.nio.file.StandardWatchEventKinds.*;
import static java.nio.file.LinkOption.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
/**
* Example to watch a directory (or tree) for changes to files.
*
*/
public class JavaSystemCompiler extends TFrame implements ActionListener {
private static boolean _switch = true; // start at true, switch off, then on.
public static final String className = "JavaSystemCompiler";
String classpath;
DefaultListModel<String> model = new DefaultListModel<>();
JList<String> list = new JList<String>(model);
JButton view = new JButton("View");
JButton clear = new JButton("Clear");
private WatchService watcher = null;
private Map<WatchKey,Path> keys = null;
private boolean trace = true;
boolean debugDirs = false;
@SuppressWarnings("unchecked")
static <T> WatchEvent<T> cast(WatchEvent<?> event) {
return (WatchEvent<T>)event;
}
/**
* Register the given directory with the WatchService
*/
private void register(Path dir) {
WatchKey key = null;
try {
key = dir.register(watcher, ENTRY_CREATE, ENTRY_DELETE, ENTRY_MODIFY);
} catch (IOException ioe) {
System.err.println("Skipping: " + dir.toString());
}
if (key != null) {
Path prev = keys.get(key);
if (prev == null) {
System.out.format("register: %s\n", dir);
} else {
if (!dir.equals(prev)) {
System.out.format("update: %s -> %s\n", prev, dir);
//model.addElement("dir.rename: " + prev + "," + dir);
}
}
keys.put(key, dir);
}
}
/**
* Register the given directory, and all its sub-directories, with the
* WatchService.
*/
private void registerAll(final Path start) {
// register directory and sub-directories
File[] roots = start.toFile().listFiles();
if (roots != null) {
for(int i = 0; i < roots.length;i++) {
// exclude the one's giving errors
// watch, this happens on windows 7 at least,
if (roots[i].isDirectory()) {
if (
!roots[i].getAbsolutePath().toLowerCase().endsWith("config.msi") &&
// now, i like comments in between, so
!roots[i].getAbsolutePath().equals("/System/Library/DirectoryServices/DefaultLocalDB/Default")
) {
//so we excluded that one, now
register(Paths.get(roots[i].getAbsolutePath()));
registerAll(Paths.get(roots[i].getAbsolutePath()));
//model.addElement(roots[i].getAbsolutePath());
}
}
}
}
}
/**
* Creates a WatchService and registers the given directory
*/
public JavaSystemCompiler(String classpath) {
super(className);
this.classpath = classpath;
setTitle("Java System Compiler");
try {
watcher = FileSystems.getDefault().newWatchService();
keys = new HashMap<WatchKey,Path>();
} catch (IOException ioe) {
System.out.println("IOE: " + ioe);
}
// enable trace after initial registration
this.trace = true;
if (getStorage().wasCreated()) {
setSize(640,480);
setLocationRelativeTo(null);
}
add(new JScrollPane(list,
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS),BorderLayout.CENTER);
JPanel panel = new JPanel();
panel.add(clear);
panel.add(view);
add(panel,BorderLayout.SOUTH);
clear.addActionListener(this);
view.addActionListener(this);
setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if (e.getSource().equals(clear)) {
model.removeAllElements();
} else if (e.getSource().equals(view)) {
String s = list.getSelectedValue();
String filename = s.substring(s.indexOf(":") + 1).trim();
if (s.startsWith("file")) {
// if (new File(filename).exists()) new FileViewer(filename);
}
}
}
public void windowClosing(WindowEvent e) {
super.windowClosing(e);
System.exit(0);
}
/**
* Process all events for keys queued to the watcher
*/
void processEvents() {
WatchKey key;
for (;;) {
// wait for key to be signalled
try {
key = watcher.take();
} catch (InterruptedException x) {
return;
}
Path dir = keys.get(key);
if (dir == null) {
System.err.println("WatchKey not recognized!!: " + key.toString());
continue;
}
for (WatchEvent<?> event: key.pollEvents()) {
WatchEvent.Kind kind = event.kind();
if (kind == OVERFLOW) {
System.out.println(className + ": KEY: OVERFLOW");
continue;
}
// Context for directory entry event is the file name of entry
WatchEvent<Path> ev = cast(event);
Path name = ev.context();
Path child = dir.resolve(name);
// print out event
if (child.toString().toLowerCase().endsWith(".java")) {
if (_switch) {
System.out.format("%s: %s\n", event.kind().name(), child);
}
}
// if directory is created, and watching recursively, then
// register it and its sub-directories
if (kind == ENTRY_CREATE) {
if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
registerAll(child);
}
}
// on create compile. if .java
if (event.kind().name().equals("ENTRY_CREATE")) {
if (Files.isDirectory(child,NOFOLLOW_LINKS)) {
//if (debugDirs) model.addElement("dir.create: " + child + File.separator);
//register??
} else {
if (child.toAbsolutePath().toString().toLowerCase().endsWith(".java")) {
//if (!buildUpdate) {
if (_switch) {
//model.addElement("file.create: " + child);
model.addElement("onCreate: " + SystemTool.compile(Global.getProjectPath(),child.toString()));
}
//}
}
}
} else if (event.kind().name().equals("ENTRY_DELETE")) {
if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
//model.addElement("dir.delete: " + child + File.separator);
} else {
if (child.toString().endsWith(".java")) {
if (_switch) {
model.addElement("onDelete: " + getDeleteClassFile(child.toString()));
}
}
}
} else if (event.kind().name().equals("ENTRY_MODIFY")) {
if (Files.isDirectory(child,NOFOLLOW_LINKS)) {
//model.addElement("dir.modify: " + child);
} else {
if (child.toString().toLowerCase().endsWith(".java")) {
//System.out.println("Child: " + child.toString());
if (new File(child.toString()).exists()) {
if (_switch) {
model.addElement("compile: " + SystemTool.compile(Global.getProjectPath(), child.toString()));
}
}
}
}
}
int lastIndex = list.getModel().getSize() - 1;
if (lastIndex >= 0) {
list.ensureIndexIsVisible(lastIndex);
}
}
// reset key and remove from set if directory no longer accessible
boolean valid = key.reset();
if (!valid) {
keys.remove(key);
// all directories are inaccessible
if (keys.isEmpty()) {
break;
}
}
_switch = !_switch;
}
}
public static String getDeleteClassFile(String filename) {
//so take the filename and modify to be .class file
filename = filename.substring(0,filename.lastIndexOf(".")) + ".class";
new File(filename).delete();
// return the result of wether it exists or not.
if (new File(filename).exists()) return filename + ": false";
else return filename + ": true";
}
public static void main(String[] args) {
// parse arguments
//if (args.length == 0 || args.length > 2)
// usage();
JavaSystemCompiler compiler = null;
compiler = new JavaSystemCompiler(Global.getProjectPath());
compiler.register(Paths.get(Global.getProjectPath()));
compiler.registerAll(Paths.get(Global.getProjectPath()));
compiler.processEvents();
}
}
Global.getProjectPath 仅返回源文件和 .class 文件所在的路径。
我想您需要 org.apache.commons.io.jar,它可用 here .
最佳答案
要调试的代码太多了!
我认为您违反的限制来自 java.lang.reflect.Proxy
API 文档。
All of the interface types must be visible by name through the specified class loader. In other words, for class loader
cl
and every interfacei
, the following expression must be true:
Class.forName(i.getName(), false, cl) == i
在行
Class<?> proxy = (Class<?>) Proxy.newProxyInstance(parent, new Class[] { _class}, handler);
parent
应替换为 loader
- 加载接口(interface)的 ClassLoader
(假设 _class
是一个接口(interface)- 我没有遵循它)。
关于java - 动态链接 : Class not visible to ClassLoader, 但我已经尝试过每一个?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59673384/
在 JavaScript 中,我们可以动态创建 元素并附加到 部分,以便为大量元素应用 CSS 规则。 这种方法的优点或缺点是什么? 如果它确实提供了与元素上的 javascript 迭代相比的性
我有这个代码 import "./HTTPMethod.dart"; import '../../DataModel/DataModel.dart'; mixin RouterMixin { HT
哪些 OLAP 工具支持动态、动态地创建维度或层次结构? 例如,层次结构将成员定义为:“前 5 名”、“前 6-10 名”、“其他”... 计算成员是通常的答案,我正在寻找不同的东西。计算器的问题。成
我正在 CakePHP 中创建一个“表单编辑器”。 该界面允许用户选择要应用于字段的验证,例如数字、电子邮件等 因此,我需要根据用户输入为模型动态创建验证。为此,我可以使用验证对象:https://b
这是一个场景: 我有一个Web服务,我们将其称为部署在tomcat(轴)上的StockQuoteService。通过此 Web 服务公开了 getStockQuote() 方法。 现在,我想构建一个
我正在尝试从服务器获取 JSON 响应并将其输出到控制台。 Future login() async { var response = await http.get( Uri.
我从另一个问题中得到了这段代码(感谢 chunhunghan)。我需要创建一个登录屏幕,并尝试根据服务器发回给我的响应来验证用户凭据,但是每次我尝试运行代码时,它都会给我“未处理的异常:Interna
当我在“Dart”主程序中运行它时,一切正常,并且我得到了一个与会者列表。但是,当我在我的 Flutter 应用程序中调用它时,出现错误: flutter:“List”类型不是“List>”类型的子类
本文实例为大家分享了js实现验证码动态干扰的具体代码,供大家参考,具体内容如下 效果一 效果二 代码一 ?
目前我正在为我的网站使用 No-Ip,我想使用 cloudflare 来抵御 ddos 和机器人程序。我注意到您需要一个用于 cloudflare 的域。我还搜索了网络,发现了一个叫做 cloud
有没有办法在 Excel VBA 中构建动态 if 语句?基本上我正在尝试创建一个参数化计算,用户将能够输入不同的变量,即 变量 1 “变量 2” “变量 3” 在这种情况下 变量 1 是单元格引用
大家好, 请查看上面的图片,我有两张 table 。在下面代码的第一个表中,我得到了这种格式。 但我想像 Table2 那样格式化,每个合并单元格中的行数是动态的,而且不一样。 有没有办法像table
如何根据我添加的 View 修改标题部分的高度?heightForHeaderInSection在 viewForHeaderInSection 之前被调用我不知道 View 大小,直到我创建它。 最
是否存在在运行时生成 AST/解析树的解析器?有点像一个库,它会接受一串 EBNF 语法或类似的东西并吐出数据结构? 我知道 antlr、jlex 和他们的同类。他们生成可以做到这一点的源代码。 (喜
我在持有汽车制造商的表格上有一个 MultipleChoiceField。我想将我的汽车数据库过滤到已检查的品牌,但这会导致问题。如何动态获取所有 Q(make=...) 语句? 我如何开始:['va
$end = preg_replace($pattern, $replacement, $str); 如何使替换字符串 $replacement 随 $str 中的每次匹配而变化?例如,我想用关联的图
我正在编写一个 VBA 程序,用于过滤表中的值。我试图使其成为一个适用于您提供的所有表格的通用程序。在我的程序中,我必须设置它正在过滤的表的范围:Set rng = dataSheet.Range("
我正在循环一个元素数组,并且我想使用给定的模板递归地显示该元素 然后在该模板内使用带有切换功能的按钮来显示/隐藏给定元素的Child的更深级别模板(Child也是一个元素) 这是我的模板
从客户端(html)发送表单,服务器端通过选择选项之一决定运行哪个函数。 const decideWho = (form) => { const choice = form.choice; c
我有一个具有以下属性的按钮: circle_normal.xml(在 res/drawable 中) circle.xml(在 res/drawable 中)
我是一名优秀的程序员,十分优秀!