このテーブルの場合、IDがauto incrementで主要キーに指定されています。
複製したいレコードのIDを指定し、SELECT構文で値を取得。
その値を新規レコードとして登録します。
INSERT INTO pages SELECT '',title,contents,url FROM pages WHERE ID=$id
INSERT INTO pages SELECT '',title,contents,url FROM pages WHERE ID=$id
<div style="padding-bottom:0px;"> <div style="float:left;"> Floating block </div> </div>
<div style="margin: 20px 0;border:1px solid red;"></div>
public class Closure { class Test{}; Closure() { final int i=0; (new Test() { void test() { System.out.println(i); } }).test(); } public static void main(String args[]) { Closure closure=new Closure(); } }もちろん値は変更できません。:)
function getCommonPos($s0,$s1) { $len=strlen($s0); $len1=strlen($s1); if($len1<$len) { $len=$len1; } while($s0[$i]==$s1[$i] && ++$i<$len1); return $i; } function diffStr($s0, $s1) { $pos=getCommonPos($s0,$s1); $end=strrpos(substr($s0,0,$pos),"\\"); return substr($s0,$end); } function countSlashes($str) { return substr_count($str,"\\"); } function getRelativePath($p0,$p1) { $p0=realpath($p0); $p1=realpath($p1); $dir=diffStr($p0,$p1); if(!empty($dir)) { $n=countSlashes($dir); $path=""; for($i=0;$i<$n;$i++) { $path.=".."; if($i<$n-1) { $path.="\\"; } } } $newDir=diffStr($p0,$p1); $newDir=$path.$newDir; if(empty($newDir)) $newDir="."; return $newDir; }
![]() |
Silhouette Cameo |
![]() |
Shamrock |
class Test { function __call($name,$parameter) { $value=$parameter[0]; switch($name) { case "round": $value=round($value); break; case "floor": $value=floor($value); break; case "ceil": $value=ceil($value); break; } return $value; } } $test=new Test; echo "Rounding: round(16.4) = ".$test->round(16.4); echo "<br />"; echo "Floor: floor(16.4) = ".$test->floor(16.4); echo "<br />"; echo "Ceiling: ceil(16.4) = ".$test->ceil(16.4); echo "<br />";This actually is a potential technological breakthrough -- in that the methods bears arbitrary names that are pseudo-defined and typed not dynamically then at programming time. This is a conceptual revolution in the programming. Remember, OOP is just a different form of C's structure.
Rounding: round(16.4) = 16 Floor: floor(16.4) = 16 Ceiling: ceil(16.4) = 17
class HookTest { private $a=1; public function __get($name) { echo "$name is being retrieved<br />"; return $this->$name; } public function __set($name,$value) { echo "$name is being set<br />"; $this->$name=3; } } echo "<pre>"; $test=new HookTest; $test->a=2; echo $test->a;
List of fonts: European Cyrillic
select
's option
does not take br
tags, or new lines. All lines have to be in a single line.
Here is a jQuery code that select/deselect European and Cyrillic fonts at the same time. The code hooks any click on the European fonts to a handler that select/deselect Cyrillic fonts.
$('#European').live("click",function(){ var selected=$('#European').attr("selected"); if(selected=="selected") { $('#Cyrillic').attr("selected","selected"); } else { $('#Cyrillic').attr("selected",false); } });
// de-selects the Cyrillic option. $("#reset").click(function(){ $('#Cyrillic').attr("selected",false); });
table.background tr td { background-color:red; } table.background td { background-color:blue; }
<table class="background"> <tr><td>test<td>test <tr><td>test<td>test </table>
var array=new Array(); array[0,0]=0; array[1,0]=1; alert(array[0,0]); alert(array[1,0]);
int index=1; while(val/=base && ++index<len);
private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e) { if(e.ColumnIndex==5) { // If set, the following will be shown in the cell. The Cell's value typed as an int will not be set correctly. //e.Value = "1"; // Instead, directly access the Cell object. int row = e.RowIndex; int col = e.ColumnIndex; dataGridView1.Rows[row].Cells[col].Value = 1; break; } }
comboBox1.DataSource = TimeZoneInfo.GetSystemTimeZones(); comboBox2.DataSource = TimeZoneInfo.GetSystemTimeZones();
System.Collections.ObjectModel.ReadOnlyCollectionlist = TimeZoneInfo.GetSystemTimeZones(); TimeZoneInfo[] tzList = list.ToArray(); comboBox1.Items.AddRange(tzList); comboBox2.Items.AddRange(tzList);
public class InitTest { int test=0; InitTestClass testClass=new InitTestClass(test); public static void main(String args[]) { InitTest test=new InitTest(); } } class InitTestClass { int test=0; InitTestClass(int test) { this.test=test; } }
namespace InitTest { class Program { int test = 0; // Error InitTestClass testClass = new InitTestClass(test); static void Main(string[] args) { } } class InitTestClass { int test = 0; public InitTestClass(int test) { this.test = test; } } }
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e) { e.DrawBackground(); if (e.Index < comboBox1.Items.Count) { e.Graphics.DrawString((string)comboBox1.Items[e.Index], e.Font, Brushes.Black, e.Bounds); if (e.Index < modifiedMessages.Count() && modifiedMessages[e.Index]) { Bitmap bmp = new Bitmap(Properties.Resources.checkMark); int iconWidth = 16; int iconHeight = 16; e.Graphics.DrawImage(bmp, e.Bounds.Right - iconWidth, e.Bounds.Bottom - iconHeight, iconWidth, iconHeight); } } e.DrawFocusRectangle(); }
private void dataGridView1_CellFormatting(object sender , DataGridViewCellFormattingEventArgs e) { if (e.Value == null) { switch (e.ColumnIndex) { case 0: e.Value=dataGridView1.Rows.Count; break; case 1: break; case 2: e.Value = "Instant"; break; case 3: break; case 4: e.Value = "0"; break; case 5: e.Value = "0 sec"; break; } } }
public class NewClassTest { class A { int i=0; A(int i) { this.i=i; } } class B extends A { B() { super(1); } } public void test() { System.out.println(new B().i); } public static void main(String args[]) { new NewClassTest().test(); } }
class Class1 { protected string value = "to be overwritten"; public Class1(string convert) { value = convert; } } class Class2 : Class1 { public Class2(string additional, string convert) : base(convert) { value = convert + additional; } public string value { get; set; } } public partial class Form1 : Form { public Form1() { InitializeComponent(); Class2 test = new Class2(" additional text", "original text"); label1.Text = test.value; } }
using System.Runtime.InteropServices; const int WM_USER = 0x400; const int PBM_SETSTATE = WM_USER + 16; const int PBM_GETSTATE = WM_USER + 17; [DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)] public static extern IntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);
public enum ProgressBarStateEnum : int { Normal = 1, Error = 2, Paused = 3, } public static void SetState(ProgressBar pBar, ProgressBarStateEnum state) { SendMessage(pBar.Handle, PBM_SETSTATE, (IntPtr)state, IntPtr.Zero); } SetState(progressBar1, ProgressBarStateEnum.Error);
SetState(progressBar1, ProgressBarStateEnum.Normal);
if (progressBar1.Maximum * .9 < len) { progressBar1.Value = 0; SetState(progressBar1, ProgressBarStateEnum.Normal); progressBar1.Value = len; SetState(progressBar1, ProgressBarStateEnum.Error); } else { progressBar1.Value = len; SetState(progressBar1, ProgressBarStateEnum.Normal); }
private const int WM_LBUTTONDOWN = 0x201; private const int WM_NCLBUTTONDBLCLK = 0x00A3; private const int WM_NCLBUTTONDOWN = 0x00A1; public bool PreFilterMessage(ref Message msg) { switch (msg.Msg) { case WM_NCLBUTTONDBLCLK: case WM_NCLBUTTONDOWN: case WM_LBUTTONDOWN: { int lparam = (int)msg.LParam; int x = lparam & 0xffff; int y = lparam >> 16; Simulator simulator = (Simulator)sender; Point pos = simulator.RichTextBox1.PointToClient(new Point(x, y)); Rectangle rect = new Rectangle(0, 0, simulator.RichTextBox1.Bounds.Width , simulator.RichTextBox1.Bounds.Height + SystemInformation.HorizontalScrollBarThumbWidth); if (!rect.Contains(pos)) { simulator.focusOff(); } } break; } return false; }
LocalPrintServer myPrintServer = new LocalPrintServer(); PrintQueueCollection myPrintQueues = myPrintServer.GetPrintQueues(); string jobList = ""; foreach (PrintQueue pq in myPrintQueues) { if (!pq.IsWaiting) { PrintJobInfoCollection jobs = pq.GetPrintJobInfoCollection(); foreach (PrintSystemJobInfo job in jobs) { jobList = jobList + "Job: " + job.JobName + " ID: " + job.JobIdentifier+"\n"; } } }
chrome.browserAction.onClicked.addListener(function(tab) {
alert(tab.url);
});
$data=array();
array_push($data,1);
array_push($data,2);
array_push($data,3);
$width=300;
$height=10+10*count($data);
$image=imagecreatetruecolor($width,$height);
$white=imagecolorallocate($image,255,255,255);
imagefilledrectangle($image,0,0,$width,$height,$white);
$black=imagecolorallocate($image,0,0,0);
$i=0;
foreach($data as $item)
{
$y0=5+10*$i;
$x1=$item*10;
imagefilledrectangle($image,0,$y0,$x1,$y0+10,$black);
$i++;
}
$filename="t.png";
imagepng($image,$filename);
imagedestroy($image);
?>
function copyDirectory($imageDir, $destDir)
{
$handle=opendir($imageDir);
while($filename=readdir($handle))
{
if(strcmp($filename,".")!=0
&& strcmp($filename,"..")!=0)
{
if(is_dir("$imageDir/$filename"))
{
if(!empty($filename) && !file_exists("$destDir/$filename"))
mkdir("$destDir/$filename");
copyDirectory("$imageDir/$filename","$destDir/$filename");
}
else
{
if(file_exists("$destDir/$filename"))
unlink("$destDir/$filename");
copy("$imageDir/$filename","$destDir/$filename");
}
}
}
}
$fileName="hatch.gif";
$fd=fopen($fileName,"r");
$contents=fread($fd,filesize($fileName));
fclose($fd);
echo "<img src='data:image/gif;base64,". base64_encode($contents)."'>";
ソマリ語の数字
1 hal ハル
2 laba ラボ
3 seddex セッデフ
4 afar アファル
5 shan シャン
6 lix リフ
7 todoba トドボ
8 sideed シデード
9 sagaal サガール
10 toban トバン
11 kow iyo toban ク・イユ・トバン
12 laba iyo toban ラボ・イユ・トバン
13 sedex iyo toban セデフ・イユ・トバン
14 afar iyo toban アファル・イユ・トバン
15 shan iyo toban シャン・イユ・トバン
16 lix iyo toban リフ・イユ・トバン
17 todoba iyo toban トドボ・イユ・トバン
18 sideed iyo toban シデード・イユ・トバン
19 sagaal iyo toban サガール・イユ・トバン
20 labaatan ラバータン
30 soddon ソッドン
40 afartan アファルタン
50 konton コントン
60 lixdan リフダン
70 todobaatan トドバータン
80 sideetan シデータン
90 sagaashan サガーシャン
100 boqol ボコル
SELECT en, count( en ) AS cnt
FROM `species`
GROUP BY en
ORDER BY cnt DESC
int lineWidth=3;
BasicStroke stroke=new BasicStroke((float)lineWidth);
g2D.setStroke(stroke);
int d=(int)((double)(lineWidth-1)/2.0);
g2D.drawLine(x0+d,y0+d,x1-(lineWidth-d),y1-(lineWidth-d));
Object obj=table.getValueAt(i,0);
String className=obj.getClass().getName();
if(className.equals("java.lang.String"))
{
String str=(String)obj;
events.events.get(i).from=Integer.parseInt(str);
}
else if(className.equals("java.lang.Integer"))
{
Integer intValue=(Integer)obj;
events.events.get(i).from=(int)intValue;
}
/* Compare.java -- directory comparison program
*
* Copyright (C) 2009 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.io.*;
public class Compare
{
public void compare(String src, String dest)
{
try
{
File srcDir=new File(src);
if(!srcDir.isDirectory())
{
return;
}
File destDir=new File(dest);
if(!destDir.isDirectory())
{
return;
}
String srcList[]=srcDir.list();
String destList[]=destDir.list();
for(int i=0;i<srcList.length;i++)
{
int j=0;
while(!destList[j].equals(srcList[i]) && ++j<destList.length);
if(destList.length<=j)
{
System.out.println("(-)"+src+"\\"+srcList[i]);
}
else
{
compare(src+"\\"+srcList[i],dest+"\\"+destList[j]);
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String args[])
{
Compare compare=new Compare();
if(2==args.length)
{
String src=args[0];
String dest=args[1];
compare.compare(src,dest);
}
}
}
if(!class_exists("mysqli"))
{
class mysqli
{
public $dbname;
function __construct($host,$dbuser,$dbpassword,$dbname)
{
$this->dbname=$dbname;
echo $dbuser;
if(!mysql_connect($host,$dbuser,$dbpassword))
echo "No DB connection established";
}
function query($sql)
{
if(!mysql_select_db($this->dbname))
echo "Database not selected";
return new mysqli_result(mysql_query($sql));
}
};
class mysqli_result
{
public $records;
function __construct($results)
{
$this->records=$results;
}
function fetch_assoc()
{
return mysql_fetch_assoc($this->records);
}
};
function resizePhoto($fileName,$dest)
{
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($fileName);
$ratio=((float)$height)/$width;
$newWidth=90;
$newHeight=(int)($newWidth*$ratio);
$thumb = imagecreatetruecolor($newWidth, $newHeight);
$source = imagecreatefromjpeg($fileName);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height);
imagejpeg($thumb,$dest);
}
FileOutputStream out=new FileOutputStream(fileName);
String descriptor="PNG";
BufferedImage image=new BufferedImage(right-left,bottom-top,BufferedImage.TYPE_INT_ARGB);
Graphics2D g=(Graphics2D)image.getGraphics();
g.drawImage(bufferedImage,0,0,right-left,bottom-top,left,top,right,bottom,this);
g.dispose();
ImageIO.write(image,descriptor,out);
out.flush();
class DirFilter extends javax.swing.filechooser.FileFilter
{
public String getDescription()
{
return "Directories";
}
public boolean accept(File file)
{
if(file.exists())
{
if(file.isDirectory())
{
return true;
}
else
{
return false;
}
}
else
{
file.mkdir();
return true;
}
}
}
JFileChooser dlg=new JFileChooser(".");
dlg.setDialogType(JFileChooser.SAVE_DIALOG);
dlg.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
dlg.addChoosableFileFilter(new DirFilter());
int retval=dlg.showDialog(this,null);
if(retval==JFileChooser.APPROVE_OPTION)
{
...
プロジェクトごとの定数を扱うクラス Config\Constants の紹介です。 <?php namespace Config; class Constants { public const DB_USER = "linguist...