My contribution to the ProAudioStar / Ableton / Nerve Remix Competition:
A distorted guitar lick, straight drums and a wobbling bassline break down to integral excerpts of the original. May cause severe ear damage!
My contribution to the ProAudioStar / Ableton / Nerve Remix Competition:
A distorted guitar lick, straight drums and a wobbling bassline break down to integral excerpts of the original. May cause severe ear damage!
eiffel360x asked: What PHP IDE would you advise me? I want to dive into the PHP world and extend my knowledge in this language but I don't have so much time to practice 'cause I work full time.
eclipse or netbeans, whatever you feel more comfortable with.
fulltime work is the best practise ;)
No need for kpartx in this case. Just check the FreeBSD disklabels inside the logical volume. This can be done using fdisk:
#fdisk /dev/vg0/backup
Command (m for help): b
Reading disklabel of /dev/vg0/backup1 at sector 64.
BSD disklabel command (m for help): u
Changing display/entry units to sectorsBSD disklabel command (m for help): p
8 partitions:
# start end size fstype [fsize bsize cpg]
a: 4194367 25165886 20971520 4.2BSD 2048 16384 28552
b: 63 4194366 4194304 swap
c: 63 146785904 146785842 unused 0 0
d: 25165887 46137406 20971520 4.2BSD 2048 16384 28552
e: 46137407 146785904 100648498 4.2BSD 2048 16384 28552
Easier and faster with sfdisk:
#sfdisk -d /dev/vg0/backup# partition table of /dev/vg0/
backupunit: sectors
/dev/vg0/backup1 : start= 63, size=146785842, Id=a5, bootable
/dev/vg0/backup2 : start= 0, size= 0, Id= 0
/dev/vg0/backup3 : start= 0, size= 0, Id= 0
/dev/vg0/backup4 : start= 0, size= 0, Id= 0
/dev/vg0/backup5 : start= 4194367, size= 20971520
/dev/vg0/backup6 : start= 63, size= 4194304
/dev/vg0/backup7 : start= 25165887, size= 20971520
/dev/vg0/backup8 : start= 46137407, size=100648498
Now multiply the start sectors by 512 and use the result as an offset in the mount options:
#mount -t ufs -o ufstype=ufs2,offset=23622352384,ro /dev/vg0/backup /mnt/backup/
Notice the ro (read-only) flag, as most linux distributions don’t come with UFS write support.
tumblrbot asked: WHERE WOULD YOU MOST LIKE TO VISIT ON YOUR PLANET?
Namibia, Peru (Machu Pichu), Costa Rica, Cambodia (Angkor)
You know something’s wrong when you see this:
# cat /proc/mdstat
Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [linear] [multipath] [raid10]
md2 : active raid1 sdb3[2] sda3[0]
1458830400 blocks [2/1] [U_]
md0 : active raid1 sdb1[1] sda1[0]
4200896 blocks [2/2] [U_]
md1 : active raid1 sdb2[2] sda2[0]
2104448 blocks [2/1] [U_]
unused devices: <none>
U_ means, that one disk is gone. UU would mean, everything’s alright. In this example /dev/sdb failed. Just replace it with your own device.
Now to remove the physical disk you first have to remove every partition of that disk from the software raid:
#mdadm /dev/md0 -r /dev/sdb1
#mdadm /dev/md1 -r /dev/sdb2
#mdadm /dev/md2 -r /dev/sdb3
If one of the partitions is still fine and only part of the disk is damaged, you might have to flag that partition as failed before being able to remove it:
#mdadm —manage /dev/md0 —fail /dev/sdb1
Now shut down your computer and replace the disk (or simply replace the disk if it is hot swappable). The new disk has to be of the same size of course.
Copy the partition table from the working disk:
#dd if=/dev/sda of=/dev/sdb count=1 bs=512
Check if it worked by using fdisk on /dev/sdb. IMPORTANT: write out the partition table, this way the system syncs the disk changes.
Now all you have to do is add the partitions to the raid again:
#mdadm /dev/md0 -a /dev/sdb1
#mdadm /dev/md1 -a /dev/sdb2
#mdadm /dev/md2 -a /dev/sdb3
If you get an error message that your partition is “not large enough to join array”, you probably forgot to resync the partition table. In this case, remove the already added partitions from the raid (using the failed flag described above), enter fdisk again and write the changes to disk. Alternatively you could run
#sfdisk -R /dev/sdb
to resync the partition table.
To quickly setup a working Java SE project using Hibernate, download Hibernate Core 3.5.0-CR-1, which also includes EntityManager and Annotations.
Add all jarfiles in the lib/required directory to your project, with the exception of the SLF4J API, which is included in the SLF4J distribution. Download SLF4J, add the slf4j-api jarfile and any slf4j logprovider to the project. If using slf4j-log4j, the LOG4J jarfile of course has to be made available also.
Unfortunately the Java Persistence API is not included in Java SE (yet?) and Hibernate does not provide the necessary classes either. Browsing through Java EE to find the needed packages might get us the javax.persistence package, but leaves us with a NoClassDefFoundError on ProviderUtil.
The easiest way to make the javax.persistence.* and maybe even more importantly the javax.persistence.spi.* (including javax.persistence.spi.ProviderUtil) packages available is to download the EclipseLink distribution. The jlib/jpa directory has a JPA 2 jarfile.
Now we are all set to start coding. First of all we need a META-INF subdirectory in our sources, containing a persistence.xml like this:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<class>package.classname</class>
</persistence-unit>
</persistence>
We won’t add any provider specific properties here, as adding them in code makes our application more configurable.
Important! When ommitting the xmlns attribute, the following error will occur:
Exception in thread "main" javax.persistence.PersistenceException: Invalid persistence.xml.
Error parsing XML (line-1 : column -1): cvc-elt.1: Cannot find the declaration of element 'persistence'.
Now we create our first Persistent POJO:
package entities;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
@Entity
public class Person
{
@Id
@GeneratedValue
private int id;
private String name;
public Person()
{
}
public Person(final String name)
{
setName(name);
}
public int getId() {
return id;
}
public void setId(final int id) {
this.id = id;
}
public String getFirstName()
{
return name;
}
public void setName(final String name)
{
this.name = name;
}
}
We have to modify persistence.xml to make JPA aware of entities.Person:
<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence" version="1.0">
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<class>entities.Person</class>
</persistence-unit>
</persistence>
Now we are ready to load Hibernate properties, persist our Person and read it from database (which of course has to be already installed and running, we are using H2 Database in this example):
import entities.Person;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import org.apache.log4j.BasicConfigurator;
import org.apache.log4j.Level;
import org.apache.log4j.Logger;
import java.util.List;
import java.util.Properties;
public class JPATest
{
private static Properties getHibernateConfig()
{
Properties props = new Properties();
props.setProperty("hibernate.show_sql", "false");
props.setProperty("hibernate.format_sql", "false");
props.setProperty("hibernate.connection.driver_class", "org.h2.Driver");
props.setProperty("hibernate.connection.url", "jdbc:h2:~/test");
props.setProperty("hibernate.connection.username", "sa");
props.setProperty("hibernate.connection.password", "");
props.setProperty("hibernate.dialect", "org.hibernate.dialect.H2Dialect");
props.setProperty("hibernate.hbm2ddl.auto", "update");
return props;
}
static EntityManagerFactory emf;
static EntityManager em;
@SuppressWarnings("unchecked")
public static void main(String[] param)
{
BasicConfigurator.configure();
Logger.getLogger("org").setLevel(Level.ERROR);
emf = Persistence.createEntityManagerFactory("default", getHibernateConfig());
em = emf.createEntityManager();
Person markus = new Person("Markus");
em.getTransaction().begin();
em.persist(markus);
em.getTransaction().commit();
List persons = em.createQuery("from Person").getResultList();
for (Person p : persons)
{
System.out.println(p.getName());
}
em.close();
emf.close();
}
}
If there are a lot of SQL statements in the Apache logs, there’s most probably someone running blind SQL injection attacks against one of the local websites. Above all one has to make shure, scripts are not vulnerable to such attacks, but often attackers exploit bugs that can’t be easily fixed.
To block most of this kind of hacking attempts, one can use the following mod_rewrite rule in .htaccess:
RewriteEngine On
RewriteCond %{QUERY_STRING} [^a-z](cast|char|convert|declare|delete|drop|exec|insert|meta|script|select|set|truncate|update)[^a-z] [NC]
RewriteRule (.*) - [F]
Care has to be taken, not to use any of these keywords in the script’s parameters.
When using localhost for tunneling Samba on Mac OS X, the following error message will be displayed on trying to connect to smb://localhost:
The server “127.0.0.1” is available on your computer. Access the volumes and files locally.
A simple workaround is to add an alias to lo0:
sudo ifconfig lo0 alias 127.0.0.2 up
Then simply create the tunnel:
sudo ssh -L 127.0.0.2:139:DESTINATIONIP:139 SSHUSER@SSHSERVER
Now it’s possible to connect to smb://127.0.0.2 without a problem.
The easiest way I found to simulate a INSERT OR UPDATE using PostgreSQL (or pretty much any other RDB) is using the INSERT INTO … SELECT syntax:
INSERT INTO myTable (myKey) SELECT myKeyValue WHERE myKeyValue NOT IN (SELECT myKey FROM myTable);
UPDATE myTable SET myUpdateCol = myUpdateColValue WHERE myKey = myKeyValue;
This way you don’t need any complex trigger or transaction savepoint operations, using just plain SQL.
- install latest Ubuntu server
- install Xen 3.3
- get Xen kernel from Ubuntu Hardy Heron repos
- add hostonly network:
brctl addbr hostonly
- set dom0 IP for hostonly network:
ifconfig hostonly 10.0.0.1 netmask 255.255.255.0
- start Xen daemon:
/etc/init.d/xend start
- start domU:
xm create xxxx.xen [-c]
- access console on paravirtualized domU:
xm console domU-name
- close Xen console: “Ctrl”+”]” (on german macbook pro keyboard: ctrl+alt+6, on german windows keyboard: Ctrl+Alt Gr+9)
- forward Microsoft Windows Remote Desktop using iptables:
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A PREROUTING -p tcp -i eth0 -d 78.46.104.242 --dport 3389 -j DNAT --to 10.0.0.10:3389
iptables -A FORWARD -p tcp -i eth0 -d 10.0.0.10 --dport 3389 -j ACCEPT
- to allow ping to Windows domU, check ICMP settings in Windows Firewall