在SO中尝试过很多例子,但似乎都没有.考虑一下我的设置:
/public_html/
/app/
/cgi-bin/
/lib/
/plugins/
/revamp/
/vendors/
Run Code Online (Sandbox Code Playgroud)
我目前有一个cakephp网站site.com,其文件位于/app/文件夹下,我现在使用的.htaccess看起来像这样:
<IfModule mod_rewrite.c>
RewriteEngine on
ReWriteRule ^$ app/webroot/ [L]
ReWriteRule (.*) app/webroot/$1 [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
我想将子域重定向revamp.site.com到/revamp/另一个cakephp站点的文件夹.
被要求创建一个vhost,我做了,它被设置为子域文件夹,我想要的帮助是htaccess规则适用于上述一个,如果请求的地址之前有子域,也可以重定向到子域域名......
以下内容.htaccess将我带到我的子域,但仅限于index.html
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site\.com$
RewriteRule (.*) app/webroot/$1 [L]
RewriteCond %{HTTP_HOST} ^revamp\.site\.com$
RewriteRule (.*) revamp/index.html [L]
</IfModule>
Run Code Online (Sandbox Code Playgroud)
它是两个答案的混合......虽然我放在子域中的路径,它只会让我到index.html(因为它在htaccess中是硬编码的).尝试也 revamp/$并 revamp/$1没有运气.
尝试编辑第一个答案:
<IfModule mod_rewrite.c>
RewriteEngine on
#subdomain simple site
RewriteCond %{HTTP_HOST} ^subdomain\.test\.com$
RewriteCond %{REQUEST_URI} !^/subdomain
RewriteRule ^(.*)$ subdomain/$1 [L] …Run Code Online (Sandbox Code Playgroud) 我正在创建一个嵌套数组,以两种不同的方式存储一些字母.第一种方式是这样的:
Array.new(rows, Array.new(columns){ O })
Run Code Online (Sandbox Code Playgroud)
第二种方式是这样的:
Array.new(rows) do
Array.new(columns) { O }
end
Run Code Online (Sandbox Code Playgroud)
它们看起来完全一样:
[["0", "0", "0", "0", "0"],
["0", "0", "0", "0", "0"],
["0", "0", "0", "0", "0"],
["0", "0", "0", "0", "0"],
["0", "0", "0", "0", "0"],
["0", "0", "0", "0", "0"]]
Run Code Online (Sandbox Code Playgroud)
当我想用另一个字母替换一个位置并执行:
array[1][3] = R
Run Code Online (Sandbox Code Playgroud)
使用第一种方式生成的数组,整个第一列将变为R.使用第二种方式,只有位置[1][3]将被替换为包含R.
我想知道这两种方式之间有什么区别.
我正在制作一个具有绘图板的应用程序,您可以在其中使用鼠标进行绘制,它会绘制在 BUfferedImage 中的标签之上。我现在正在尝试实现的是橡皮擦,问题是我找不到任何帮助将橡皮擦制作为 clearRect() 到 alpha 背景。(我无法定义颜色背景,因为用户可以将背景更改为他想要的任何图像)。总结:
以下是我的 DrawBoard 类,其中包含要绘制的所有内容。
public class DrawBoard extends JPanel implements MouseListener, MouseMotionListener{
public JLabel status;
private JLabel imgLabel; // this is where the drawing happens
public Point pstart, pfinish;
private List<Point> points = new ArrayList<Point>();
private List<BufferedImage> lines = new ArrayList<BufferedImage>();
private static final int BI_WIDTH = 1024;
private static final int BI_HEIGHT = 800;
private static int STROKESIZE = 7;
private BufferedImage bImage = new BufferedImage(BI_WIDTH, …Run Code Online (Sandbox Code Playgroud) 基本上我正在制作一块用鼠标绘制的绘图板; 有一组颜色按钮可供选择,这些颜色按钮是在自定义类ColoredButton中制作的,其颜色参数由setColor(int r,g,b)设置.
因此,在ColourToolbar类中,当您单击其中一个ColoredButtons时,它会将一个全局变量selectedCOlor设置为该按钮中的颜色集(如上所述),然后DrawBoard类使用getColor()来获取'selectedCOlor'中的颜色ColourToolbar类中的变量.
这是类(我拿出了不需要的代码):
public class ColoredButton extends JButton {
public Color color;
public ColoredButton(ImageIcon img){
super(img);
}
public void setColor(int r, int g, int b){
this.color = new Color(r,g,b);
}
public Color getColor(){
return this.color;
}
}
Run Code Online (Sandbox Code Playgroud)
下一堂课:
public class ColourToolbar extends JPanel implements ActionListener{
public Color selectedColor;
public boolean colorSelected = false;
public ColoredButton pink,black,blue,green,orange,yellow,darkp,red,white;
public ColourToolbar(){
setBackground(Color.DARK_GRAY);
setLayout(new GridBagLayout());
Dimension size = getPreferredSize();
size.setSize(1024,80); //w, h
setPreferredSize(size);
// NOTE: There are 8 more blocks of …Run Code Online (Sandbox Code Playgroud) java ×2
.htaccess ×1
arrays ×1
cakephp ×1
color-scheme ×1
erase ×1
graphics2d ×1
java-2d ×1
php ×1
ruby ×1