How2
iPod Charger
Di, 09/07/2010 - 19:54 | by ReoxSimple Method to build a iPod Charger (does not work with iPhones (you need to adjust the resistors here..))
Notes on Migrating Drupal Sites
Di, 08/17/2010 - 08:28 | by ReoxYesterday I had some troubles while migrating an drupal site from a) multisite and b) aegir and c) other domain to another server.
I had done some preperations, so i drushed me a brand new installation to a temp dir (drush dl drupal-6.19) and mkdired sites/example.com/ with all subfolders.
The I used the command drush status-modules to generate a list of all enabled modules on the old site. With the power of Bash i was able to download every package also with drush.
And here was my first fault: I downloaded all the packages to /sites/example.com/modules instead of /sites/all/modules. If it was a fresh installation it wouldn't make any difference (besides that other sites cant use modules which are in other sites/*/modules folder) but in my case drupal is unable to find the modules (sometimes) right so i runed into the first trap.
-> Note here: for a better and faster setup just copy your modules in the same folder! Especially Templates have their own mind, when drupal cant find the style.css on the place it was left before migrating - it will not load! (not before you competly disabled the theme and renabled it...)
Ok so the next step was easy. Dumping the database. But: clear all caches before dumping! Sometimes the data in the cache tables is that big that mysqldump produces errors (also you dont need the caches to be in your dump)
So now i had to replace every apperance of the old domain (this was example.free-minds.net) with the new one (example.com) - so just open up vim (or just use sed) and replace it all! :%s/.free-minds.net/.com/g was really handy here!
Next step on db migration. The new Webserver has only one database so i really should use a prefix here... So do some reseach in the sql file and I found out that a table name always (and only) is after EXISTS, TABLE, TABLES, INTO (if you look into the SQL Documentation there are more (FROM, ON, ...) but not in our SQL Dump).
So just replace some things and we are done (replace like this :%s/EXISTS `/EXISTS `prefix_/g)
Next step. The real migration! fire up a ftp client of your choise and here you go.
Then i run mysql again, thanks to the server admin mysql is public reachable (WTF?!?!), i just connected with the given username and password and here we go!
And now... going to the new Site and F5 :) and ---- WHAT THE FUCK?? Big PHP Error!
Whats wrong? After some research I found out that this error means that cck is missing but other modules which uses cck are enabled. Why is cck disabled?? whats going on here??? After some cd and dir on the server i found out: cck is not even installed! Now i really got angry, why why why???? The reason is simple. cck is the project name but drush just print out module names - so i got a error message downloading ->content<- (which is the module name of cck) but i just needed fucking cck......... Ok copy cck from modulerepo and here we go!
pressing F5 and....
NOTHING! Same error - fuck that shit -.-
ok yay... i know whats going on, the module is now (dont know why) disabled in the database....
So - hack a little bit in mysqlcli and finally
pressing F5 anddddd.....
YAY! There we go! everythings online :) (except for one permission, idk why its lost while migrating but ok...)
never ever :D next time i will leave the page on my server :P
Insert into select with extra data
Mo, 08/09/2010 - 10:02 | by Reoxmay you had the problem to insert data into a table with the key from another table. The only data you had is the key of your foreign table. So the quick and dirty variant is to select first the keys, then insert them. But i think this one is better:
insert into review select id, pid, (select datetime('now')), (select 'mycomment') from documents where rowid = 1337
So whats done here? Really simple, we select id and pid (these are the keys) and we have our data (in my case the actual datetime and a comment. because we can just "select" these two values its possible to insert them within the select statement.
Check for running thread
Mi, 08/04/2010 - 09:23 | by Reoxmaybe you have a program with many threads and want to know if any thread is running.
[...]
Hashtable<String, Object> threadPool = new Hashtable<String, Object>();
[...]
private static boolean isThreadRunning(){
for(Object o : threadPool.values()){
if(((Thread)o).isAlive())
return true;
}
return false;
}
Determinate if debian package is installed or not
Fr, 07/30/2010 - 12:27 | by Reoxif [ "$(dpkg -s locales 2>/dev/null | grep Status | awk -F' ' '{ print $4 }')" != "installed" ]
then
apt-get install locales -yy
fi
i think thats the best way, or is there a better?
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- …
- nächste Seite ›
- letzte Seite »