Nested DIV -- Firefox3
Nested DIV -- IE7
DIVタグをネストすると、マージンをとった場合にIE7とFirefoxで結果が違う。IE7は内部のブロック要素のマージンの長さだけ外部のブロックのサイズを変更する。Firefoxでは、なぜか内部のマージンに合わせて外部のブロックも移動する。しかも不可解なことに、外部ブロックにボーダーをつけると位置が移動する。要注意。
ソースはこちら→ div.html
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
crypt function does the work. It encrypts in a pattern that can be set by another secret keyword.
crypt($password,"ea")
strcmp(crypt($entered_password,"ea"),$password_stored_somewhere)==0
strcmp -- it is PHP's ancient trap. Never compare strings with == operator. PHP's inherent conversion machine might convert the string to some integer (or to any type) before doing the comparison.
$springEquinoxDay=(int)(20.8431 + 0.242194 * ( $year - 1980))
- (int)((double)($year - 1980)/4) ;
$springEquinox=array(3,$springEquinoxDay,"春分の日");
$automnEquinoxDay=(int)(23.2488 + 0.242194 * ( $year - 1980))
- (int)(($year - 1980)/ 4);
$automnEquinox=array(9,$automnEquinoxDay,"秋分の日");
$official_holidays=array( array(1,1,"元旦"),
array(2,11,"建国記念日"),
$springEquinox,
array(4,29,"昭和の日"),
array(5,3,"憲法記念日"),
array(5,4,"みどりの日"),
array(5,5,"こどもの日"),
$automnEquinox,
array(11,3,"文化の日"),
array(11,23,"勤労感謝の日"),
array(12,23,"天皇誕生日"));
include("news/news.php");
ob_start();
include("news/news.php");
$eucContents=ob_get_contents();
ob_end_clean();
$utf8Contents=mb_convert_encoding($eucContents,"UTF-8","EUC-JP");
echo $utf8Contents;
import java.io.*;
public class Compare
{
public boolean contains(String str, String text)
{
boolean found=false;
if(0<=text.indexOf(str))
{
found=true;
}
return found;
}
private String readFile(String fileName)
{
String text="";
try
{
FileInputStream fis=new FileInputStream(fileName);
InputStreamReader isr=new InputStreamReader(fis,"utf-8");
BufferedReader reader=new BufferedReader(isr);
String line="";
while((line=reader.readLine())!=null)
{
//System.out.println(line);
text+=line+"\n";
}
}
catch(Exception e)
{
e.printStackTrace();
}
return text;
}
public void compareLine(String org, String dest)
{
String text=readFile(dest);
try
{
FileInputStream fis=new FileInputStream(org);
InputStreamReader isr=new InputStreamReader(fis,"utf-8");
BufferedReader reader=new BufferedReader(isr);
String line="";
while((line=reader.readLine())!=null)
{
if(contains(line,text))
{
System.out.print("o ");
}
else
{
System.out.print("x ");
}
System.out.println(line);
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
if(1<args.length)
{
Compare compare=new Compare();
compare.compareLine(args[0],args[1]);
}
}
}
try
{
$dbh=new PDO('mysql:dbname='.$MYSQL_DATABASE.';host='.$MYSQL_HOST,$MYSQL_USER,$MYSQL_PASSWORD);
$dbh->query("SET NAMES UTF8");
$sql="select * from photos where data_no=".$data_no;
$photoSet=$dbh->query($sql);
if(!empty($photoSet))
{
while($row=$photoSet->fetch())
{
echo $row['filename'];
}
}
}
catch (PDOException $e)
{
echo $e->getMessage();
}
$dbh=null;
lastInsertId()を使うとインデックス値を得ることができます。
$dbh->query($sql);
$data_no=$dbh->lastInsertId();
mb_detect_encoding 関数を使うことができます。mb_detect_encoding 関数を用いて文字コードを判定します。mb_convert_encoding 関数を用いて、コード変換することができます。| 単数 | 複数 | |
|---|---|---|
| 1 | მე ვარ (me var) | ჩვენ ვართ (chven vart) |
| 2 | შენ ხარ (shen xar) | თქვენ ხართ (tkven xart) |
| 3 | ის არის (is aris) | ისინი არიან (isini arian) |
| 主格 Nominative | ეს არის წიგნი (is aris ts'igni) | これは本です | ~は |
|---|---|---|---|
| 呼格 Vocative | მზეო! (mzeo!) | 太陽よ! | ~よ! |
| 対与格 Dative | წერს წერილს (ts'ers ts'erils) | 手紙を書く | ~を、~に |
| 所有格 Genitive | იმერეთის მხარე (imeretis mxare) | イメレティ地区 | ~の |
| 具格 Instrumental | მე ვწერ ფანქრით (me vts'er pankrit) | 私は鉛筆で書く | ~で |
| 副詞格 Adverbial | მეგობრად (megobrad) | 友人として | ~として |
| 単数 | 複数 | |
|---|---|---|
| 1 | ვწერ (vts'er) | ვწერთ (vts'ert) |
| 2 | წერ (ts'er) | წერთ (ts'ert) |
| 3 | წერს (ts'ers) | წერენ (ts'eren) |
| 単数 | 複数 | |
|---|---|---|
| 1 | დავწერე (davts'ere) | დავწერეთ (davts'eret) |
| 2 | დაწერე (dats'ere) | დაწერეთ (dats'eret) |
| 3 | დაწერა (dats'era) | დაწერეს (dats'eres) |
| 単数 | 複数 | |
|---|---|---|
| 1 | ავშენდები (a=v-shen-d-eb-i) | ავშენდებით (a=v-shen-d-eb-it) |
| 2 | აშენდები (a=shen-d-eb-i) | აშენდებით (a=shen-d-eb-it) |
| 3 | აშენდება (a=shen-d-eb-a) | აშენდებიან (a=shen-d-eb-ian) |
function tempFile($length)
{
$alphanumeric="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
$len=strlen($alphanumeric);
$name="";
for($i=0;$i<$length;$i++)
{
$index=rand(0,$len-1);
$name.=substr($alphanumeric,$index,1);
}
return $name;
}
function divide($x,$y)
{
if($y!=0)
$result=$x/$y;
else
$result=FALSE;
return $result;
}
$x=10;
$y=0;
$z=divide($x,$y);
echo "$x divided by $y equals to ";
if($z)
{
echo "$z";
}
else
{
echo "... undefined";
}
$a=(int)"10";
$str = mb_convert_kana($str, "a");
$a=(int)$str;
$variableName="newVariable";
$newVariable="value";
echo $$variableName;
$globalValue=100;
function summit($politicalFactor)
{
global $globalValue;
return $globalValue*$politicalFactor;
}
$globalValue=summit(1.3);
public class GeneratePassword
{
public static void main(String args[])
{
String alphanumeric="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
int len=alphanumeric.length();
for(int i=0;i<8;i++)
{
int index=(int)Math.floor(Math.random()*len);
System.out.print(alphanumeric.charAt(index));
}
}
}
boolean isLineEnd(char ch)
{
return (ch=='\u2029'||ch=='\u2028'||ch=='\u0085'||ch=='\n'||ch=='\r');
}
public int getLineEndPosition()
{
int index=-1;
String text=textArea.getText();
if(!text.isEmpty())
{
int pos=textArea.getCaretPosition();
index=pos;
int len=text.length();
while(!isLineEnd(text.charAt(index)) && ++index<len);
}
return index;
}
void cutLine()
{
int start=textArea.getCaretPosition();
int end=getLineEndPosition();
textArea.setSelectionEnd(end);
textArea.replaceSelection("");
}
void copyLine()
{
int start=textArea.getCaretPosition();
int end=getLineEndPosition();
textArea.setSelectionEnd(end);
textArea.copy();
}
Please remove or make sure it appears in the correct subdirectory of the classpath.
import easai.util.*;
...
OnScreenKeyboard keyboard
=new OnScreenKeyboard("Taiwanese",this);
keyboard.init();
OnScreenKeyboard constructor takes a string argument that specifies the language and an ActionListener. This ActionListener is a wonderful thing that makes this component usable for any of the application you wish.
public void actionPerformed (ActionEvent e)
{
String command=e.getActionCommand();
String ch=command.substring(0,1);
int pos=textArea.getCaretPosition();
textArea.insert(ch,pos);
}
/* TaiwaneseApplet.java -- Zhuyin on screen keyboard
*
* Copyright (C) 2008 Erica Asai
* This program is free software;
* you can redistribute it and/or
* modify it under the terms of the
* GNU General Public License
* as published by the Free Software
* Foundation; either version 2
* of the License, or (at your option)
* any later version.
*
* This program is distributed in
* the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without
* even the implied warranty of
* MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the
* GNU General Public License
* for more details.
*
* You should have received a copy
* of the GNU General Public License
* along with this program; if not,
* write to the Free Software
* Foundation, Inc., 59 Temple Place
* - Suite 330, Boston, MA 02111-1307, USA.
*
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import easai.util.*;
public class TaiwaneseApplet extends JApplet implements ActionListener
{
JTextArea textArea=new JTextArea(15,50);
JButton clear=new JButton("Clear");
JButton larger=new JButton("Font Size (+)");
JButton smaller=new JButton("Font Size (-)");
OnScreenKeyboard keyboard
=new OnScreenKeyboard("Taiwanese",this);
public void init()
{
keyboard.nButtons=10;
keyboard.init();
clear.addActionListener(this);
larger.addActionListener(this);
smaller.addActionListener(this);
JPanel control=new JPanel();
control.setLayout(new FlowLayout());
control.add(larger);
control.add(smaller);
JPanel textPanel=new JPanel();
JScrollPane textScroll=new JScrollPane(textArea);
textPanel.add(textScroll);
textPanel.add(clear);
JPanel panel=new JPanel();
BorderLayout layout=new BorderLayout();
panel.setLayout(layout);
JPanel keyboardPanel=new JPanel();
keyboardPanel.setLayout(new BorderLayout());
keyboardPanel.add(keyboard,BorderLayout.CENTER);
keyboardPanel.add(control,BorderLayout.SOUTH);
panel.add(keyboardPanel,BorderLayout.NORTH);
panel.add(textPanel,BorderLayout.CENTER);
JScrollPane scroll=new JScrollPane(panel);
add(scroll);
}
public void actionPerformed(ActionEvent e)
{
String command=e.getActionCommand();
if(0<command.length())
{
if(command.equals("Clear"))
{
textArea.setText("");
}
else if(command.equals("Font Size (+)"))
{
keyboard.resizeFont(2);
}
else if(command.equals("Font Size (-)"))
{
keyboard.resizeFont(-2);
}
else
{
String ch=command.substring(0,1);
int pos=textArea.getCaretPosition();
textArea.insert(ch,pos);
}
}
}
}
+--easai--util
--+
+--your Java application directory
javac -classpath ".;.." *.java
int pos=textArea.getCaretPosition();
String text=textArea.getText();
char ch=text.charAt(pos);
Character.UnicodeBlock block=Character.UnicodeBlock.of(ch);
Locale current=Locale.US;
if(block==Character.UnicodeBlock.BOPOMOFO)
current=Locale.TAIWAN;
Class.forName(driver).newInstance();
connection = DriverManager.getConnection(openDBString+database,user,password);
statement=connection.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM "+tableName+condition);
ResultSetMetaData meta = rs.getMetaData();
int nCol=meta.getColumnCount();
while (rs.next())
{
String buf=template;
for(int i=1;i<=nCol;i++)
{
String columnName=meta.getColumnName(i);
System.out.println(columnName,new String(rs.getBytes(i),"UTF8"));
}
}
Locale locales[]=Locale.getAvailableLocales();
Object selectedValue = JOptionPane.showInputDialog(null,
"Select a locale", "Language",
JOptionPane.INFORMATION_MESSAGE, null,
names,names[0]); public void langList(JMenuItem mi)
{
int x=mi.getX();
x+=mi.getWidth();
int y=mi.getY();
Locale locales[]=Locale.getAvailableLocales();
String names[]=new String[locales.length];
String languages[]=new String[locales.length];
String countries[]=new String[locales.length];
int index=0;
for(int i=0;i<locales.length;i++)
{
languages[index]=locales[i].getLanguage();
countries[index]=locales[i].getCountry();
if(!languages[index].isEmpty() && !countries[index].isEmpty())
{
names[index]=locales[i].getDisplayName();
index++;
}
}
int nLocales=index;
int sortedIndex[]=new int[nLocales];
String sortedNames[]=new String[nLocales];
for(int i=0;i<nLocales;i++)
sortedIndex[i]=i;
for(int i=0;i<nLocales;i++)
{
for(int j=i+1;j<nLocales;j++)
{
if(0<names[sortedIndex[i]].compareTo(names[sortedIndex[j]]))
{
int t=sortedIndex[i];
sortedIndex[i]=sortedIndex[j];
sortedIndex[j]=t;
}
}
}
for(int i=0;i<nLocales;i++)
{
sortedNames[i]=names[sortedIndex[i]];
}
if(0<nLocales)
{
Object selectedValue = JOptionPane.showInputDialog(null,
"Set Language Environment", "Language",
JOptionPane.INFORMATION_MESSAGE, null,
sortedNames,sortedNames[0]);
int i=0;
if(selectedValue!=null)
{
while(!((String)selectedValue).equals(names[i]) && ++i<nLocales);
if(i<nLocales)
{
Locale newLocale=new Locale(languages[i],countries[i]);
inputContext.selectInputMethod(newLocale);
}
}
}
}
InputContext inputContext=null;
inputContext=frame.getInputContext();
inputContext.selectInputMethod(Locale.JAPAN);
Locale locale=new Locale("hi","IN");Flask の Blueprint は、ルート、静的ファイル、テンプレートをまとめて管理できます。しかし、テンプレートが指定できません。 ここでは、Blueprint の template_folder の問題点と回避策を説明します。 Blueprint のテンプレート問題...