1

(1 replies, posted in General)

If you are having trouble converting MySQL  tables to SQLite tables then this tutorial is for you. On the other hand, if you have no idea what I just said then let me explain that both MySQL and SQLite are free, open source databases. While MySQL is the most used open source database in the world, SQLite is catching on as a great database for people who don't need a complex system to manage their data. I personally have been looking into it as a possibility for running my personal blog.

    SQLite is an embedded SQL database engine. Unlike most other SQL databases, SQLite does not have a separate server process. SQLite reads and writes directly to ordinary disk files. A complete SQL database with multiple tables, indices, triggers, and views, is contained in a single disk file. The database file format is cross-platform - you can freely copy a database between 32-bit and 64-bit systems or between big-endian and little-endian architectures. These features make SQLite a popular choice as an Application File Format. Think of SQLite not as a replacement for Oracle but as a replacement for fopen(). - the SQLite site

Anyway, if you have already started working with SQLite but have encountered problems with SQL syntax - I would like to explain some of the main differences in creating a table. Lets start with a basic MySQL table.

/* Table structure for mySQL table */

CREATE TABLE `tablename` (
`id` int(11) NOT NULL auto_increment,
`title` text NOT NULL default '',
`text` text NOT NULL,
`time` int(10) NOT NULL default '0000000000',
UNIQUE KEY `id` (`id`),
) TYPE=MyISAM;

If you try to just port that over into SQLite - you'll get so many errors it's not funny. First lets start with the "INT" column type. In SQLite it is "INTEGER" not "INT". So, that is the first thing that needs to be changed.

Second, in SQLite "auto_increment" is a given if the key is a PRIMARY KEY. So we can delete the "auto_increment" part of the MySQL query. This now leaves us with the following:

-- Table structure for NEW SQLite table
CREATE TABLE `tablename` (
`id` INTEGER NOT NULL ,
`title` text NOT NULL default '',
`text` text NOT NULL,
`time` INTEGER NOT NULL default '0000000000',
UNIQUE KEY `id` (`id`),
) TYPE=MyISAM;

Third, we don't need the "UNIQUE KEY `id` (`id`)," line. In SQLite, that data goes on the same line as the item that is set to the "PRIMARY KEY".

-- Table structure for NEW SQLite table
CREATE TABLE `tablename` (
`id` INTEGER PRIMARY KEY NOT NULL ,
`title` text NOT NULL default '',
`text` text NOT NULL,
`time` INTEGER NOT NULL default '0000000000',
) TYPE=MyISAM;

Forth, remove the bottom " TYPE=MyISAM" as there is no such type in SQLite. In MySQL you can chose from one of several DB types. However, SQLite only has 1 type - so there is no need to specify it.

Now the last thing we need to do is get rid of the " ` " characters in the code as SQLite doesn't like them in queries. So we just replace all the " ` " with double-quotes (NOT single quotes). You can also just leave them off as they are NOT required. Also, delete the ending comma. Our final output is:

-- Table structure for NEW SQLite table
CREATE TABLE "tablename" (
"id" INTEGER PRIMARY KEY NOT NULL ,
"title" text NOT NULL default "",
"text" text NOT NULL,
"time" INTEGER NOT NULL default "0000000000"
);

The following tables show how you can use double-quotes in any order without fear of trouble:

<?php

$query = 'CREATE TABLE temp2 (
                    id INTEGER PRIMARY KEY NOT NULL,
                    title TEXT NOT NULL ,
                    text TEXT NOT NULL ,
                    time INTEGER NOT NULL
                );
CREATE TABLE "temp3" (
                    "id" INTEGER PRIMARY KEY NOT NULL,
                    "title" TEXT NOT NULL ,
                    "text" TEXT NOT NULL ,
                    "time" INTEGER NOT NULL
                );
CREATE TABLE temp4 (
                    "id" INTEGER PRIMARY KEY NOT NULL,
                    "title" TEXT NOT NULL ,
                    "text" TEXT NOT NULL ,
                    "time" INTEGER NOT NULL
                );
CREATE TABLE temp5 (
                    id INTEGER PRIMARY KEY NOT NULL,
                    "title" TEXT NOT NULL ,
                    text TEXT NOT NULL ,
                    "time" INTEGER NOT NULL
                );';
?>

SQL As Understood By SQLite is a great read for anyone who wants to check advanced queries against the SQL standard. The SQLite Wiki also has a great list of command-line & desktop programs that you can use to create SQLite tables for you if you are still unsure about all this. I personally like SQLiteMan as I can create the database and tables right on my Windows desktop and then export a SQL Schema for use in my
soccer uniform | cheap jerseys | football shirt shop

2

(1 replies, posted in Miscalleneous posts)

Hello All!
I am going to crazy and feeling myself so stupid but I don't understand such behaviour.
I have code:
public int getNextAgentId()
{
Int32 agent_id = 0;
IDataReader dr = dbap.DBDataReader("SELECT MAX(agent_id) FROM Agents");
if(dr.Read())
{
agent_id = dr.GetInt32(0);
}
dr.Close();
return agent_id + 1;
}

where dpab is an instance of DB abstraction class, hence using IDataReader interface instead of
concrete DB DataReader such as SqlDataReader.

SELECT returns null due to database table is empty and I have
error message "Data is Null. This method or property cannot be called on Null values."
on line agent_id = dr.GetInt32(0);
As I understand in the begining datareader positioned before first reacord and when I call Read method
it should point to first record but why it returns true in conditions when now rows returned from DB?

Any ideas?
Thanks in advance to all.

Regards,
neeraj singh panwar
soccer uniform | cheap jerseys | football shirt shop

3

(0 replies, posted in Miscalleneous posts)

对于现代语言,比如java、c#、ruby等,很容易就可以从语言层面实现反射,从而实现ioc控制、依赖注入等,最典型的就是java中的 spring框架。而对于c、c++语言,从语言层面很难实现反射,如果非要实现,则只能从语言之后的东西来着手。语言之后是什么呢,不外乎编译器、可执行文件格式、加载器、操作系统等。
      从上面的几个选项上思考,因为反射需要根据运行时候的信息,反查找到代码信息,所以,如果要实现反射机制,至少应该在代码的可理解信息被编译器去掉将函数名称换成函数地址,变量名称换成变量)以前,就需要着手开始工作,记录下反射需要的信息,并设法将这部分信息一直保存到最终的可执行文件当中。     
      同时,为了实现动态的配置,动态载入代码运行,还需要设计一个加载器,在配置文件发生变化的时候,从新的地址加载代码,代替原来的代码,其实这可以理解成为以前经常使用的补丁机制。只有实现了所有这些机制,c语言的反射才可以发会作用。
      至于c++中的反射机制,还可以考虑修改编译器,编译的时候,在每个类中动态的插入静态的(static)获取类的名称的方法、获取类空间大小的方法、获取类的父类子类等的方法,这样可以获取运行时候的每个类的信息。至于类的动态加载运行,则需要考虑类的大小,动态的给类分配空间,并动态指定类的父类、子类的地址%E
soccer uniform | cheap jerseys | football shirt shop

4

(1 replies, posted in Miscalleneous posts)

Hi there, I don't know shit about mudbox, I've been using it at home for about 5 hours. Seems pretty cool so far but there are a couple things I would like it to do so perhaps someone could tell me if they exist.

1. Is there any way to morph back to your original mesh, ie I want to erase back to part of a mesh, unfortunately I don't have any of that work on a layer so the original subdivision has edits on it. It would be nice if I could load up the base mesh and apply the mudbox deformation as a layer and blend between the 2.

2. Is there an air brush feature, or do I physically have to move the mouse/pen for deformation to happen. I would like to click and hold in one spot and have that spot get pinched for example until I release.

3. Is there any way to apply a projection evenly across a model with one click, I saw you can go into projection mode but I still have to paint the projection so it's uneven. Wait, I'm guessing flood fill would do that?

4. Is there any way to reset all the brush settings to default?

5. Is there any way to invert a mask or should I always flood fill for a mask and then erase the part I want to be affected.


soccer uniform | cheap jerseys | football shirt shop