Entries tagged error

MySQL Workbench Error: line contains NULL byte

Posted on 21. April 2016 Comments

When importing CSV (or other) files into the database, scripts (especially PHP or C-related languages), will stop if there is – for whatever reason – a NULL byte in your file because it signals end of file/string, see Null bytes related issues.

So when importing a file like that with MySQL Workbench you will get this error:

line contains NULL byte

You can solve this by using the commandline tool tr (from coreutils):

tr < file-with-nulls -d '\000' > file-without-nulls

To check if there are any null bytes in your file, use the python IDE and type in:

open('filename.ext').read().index('\0')

Thanks to Pointy from Stackoverflow

Using a Perl script because refactoring of a project with Android tools didn’t work

Posted on 20. Dezember 2014 Comments

I wanted to rename my project but I guess since it has a lot of dependencies that caused an error somewhere and I got the error message:

Refactoring
A fatal error occurred while performing the refactoring.
An unexpected exception occurred while creating a change object. See the error log for more details.

So I just the normal refactoring feature of Eclipse which not surprisingly also caused an error. After editing the AndroidManifest package entry, the import of the resources in the sources files didn’t work. It still said

import com.example.oldpackage.R

Only a couple of resource files needed manual editing but the Java files were a problem. What did the trick for me was this one-liner

perl -pi -w -e 's/import com.example.oldpackage.R/import com.example.newpackage.R/g;' `grep -r -l "import com.example.oldpackage.R"`

I realise this is rather quick&dirty (do a backup 😉 ) but it did work for this project. A short explanation:

perl

  • -pi puts the code in a loop (like -n, but sed-style)
  • -w gives you warnings
  • -e is one line of programm and since -pi
  • /g global, for all lines in the file

grep

  • -r recursive
  • -l give out files that matches the following search string

„Incomplete statements not supported yet, sorry, you’ll have to retype“ Error with Scala and Eclipse

Posted on 15. November 2013 Comments

I got this error defining the function

object test {
  val f:AnyVal => String = {
      case 10.0 => "10.0"
      case _: Double => "Double"
      case _: Int => "Int"
      case _: Byte => "Byte"
      case _ => "anything else"
}

 -> Incomplete statements not supported yet, sorry, you’ll have to retype.

However, in REPL it worked just fine.

repat@laptop:~$ scala
Welcome to Scala version 2.10.3 (OpenJDK 64-Bit Server VM, Java 1.6.0_27).
Type in expressions to have them evaluated.
Type :help for more information.

scala>   val f:AnyVal => String = {
     |       case 10.0 => "10.0"
     |       case _: Double => "Double"
     |       case _: Int => "Int"
     |       case _: Byte => "Byte"
     |       case _ => "anything else"
     |   }
f: AnyVal => String = 

scala>

So aparrently the error is in Eclipse. I use the version 3.7.2. Have you tried turning it off and on again? 😉

Owncloud News Reader Error after update to 5.0.11

Posted on 21. Oktober 2013 Comments

After updating to owncloud 5.0.11 I got the following error in my Owncloud News Reader:

Screenshot_2013-10-21-10-20-56

(For Google: A Toast saying „End of input at line 1 column 1“)

In my owncloud instance, I got an error in the administrator menu saying:

SQLSTATE[HY000]: General error: 1 no such column: feeds.articles_per_update at db.php#391

I updated the owncloud instance and app framework/news app but it still showed me that everything was uptodate, even when 5.0.12 was released. Via phpMyAdmin I could see that the feeds were still in the database but I couldn’t see them in the web app or Android app. So I just deleted the owncloud folder, downloaded the new .tar.bz2 from owncloud.org, removed the oc_news tables(do not delete e.g. the contacts or bookmarks!). Then I changed my username in oc_users, used my old username as my new username and reinstalled owncloud, this time version 5.0.12.  I could then delete the old (changed) username via the admin panel.

This is the third time I had to reinstall owncloud, because the update mechanism didn’t work properly… And yes, as advised, I did deactivate the news app and app framework for the update process 😉

I just had a look at the SQL-statements from my last backup and saw that articles_per_update is supposed to be a column in oc_news_feeds in the new version of the news app. Somehow, the owncloud update process didn’t update the news app or didn’t trigger a 3rd-party update process. Anyways, I guess this could also be solved by just adding this column manually:
`articles_per_update` bigint(20) NOT NULL DEFAULT '0'

How to get facebook back online #facebookdown

Posted on 11. Dezember 2012 Comments

Seems like facebook has some kind of DNS-Problem right now(#facebookdown). To fix this enter the facebook IPs in your hosts-file. To get them, have a look at your DNS Cache with a tool like dig(or use the ones I provide below).

 

Linux

repat@laptop:~$ dig facebook.com

; <<>> DiG 9.8.1-P1 <<>> facebook.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 11887
;; flags: qr rd ra; QUERY: 1, ANSWER: 6, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;facebook.com.            IN    A

;; ANSWER SECTION:
facebook.com.        6010    IN    A    69.171.229.16
facebook.com.        6010    IN    A    173.252.100.16
facebook.com.        6010    IN    A    173.252.101.16
facebook.com.        6010    IN    A    66.220.152.16
facebook.com.        6010    IN    A    66.220.158.16
facebook.com.        6010    IN    A    69.171.224.32

 

So just enter this into your /etc/hosts file:

#vi /etc/hosts

66.220.158.16   facebook.com
66.220.158.16   www.facebook.com


Windows
Windows has a similar file, which is located in %SystemRoot%\system32\drivers\etc\hosts. Where %SystemRoot% is your Windows directory, so most likely C:\Windows.

At least in Windows 7 the file is locked by the system, so unless you have notepad++, which doesn’t care about all this, you have to open your explorer, go to C:\Windows\system32\, right-click notepad.exe and select „start with admin rights“(or something like that…). Then click File/open, go to C:\Windows\system32\drivers\etc and select „all files“ on the right side(see screenshot). Then again open the file and enter the following:

66.220.158.16   facebook.com
66.220.158.16   www.facebook.com

 

 

 

 

MacOS

1. Click on the looking glass icon in the top right corner of the screen
2. Type „Terminal“ and press Enter, a new app called „Terminal“ will appear
3. Don’t get confused by it, just follow the steps
4. Copy this text into your clipboard : echo „173.252.101.16 www.facebook.com“ | sudo tee -a /etc/hosts
5. Paste it into the „Terminal“ window and press Enter
6. You will be prompted to enter your password (it will not show up on the screen, don’t worry about it), press Enter again when you finished typing your password.
7. The line „173.252.101.16 www.facebook.com“ will appear on the screen.
8. Done!

prosody 0.8.2. still waiting

Posted on 10. Juli 2012 Comments

I tried to start prosody with user-privileges (with user/group prosody) but I kept getting this message from prosodyctl start:

Still waiting...
Proody is still not running. Please give it some time or check your log files for errors.

But there were no errors in the log-file. If I deleted the log-file nothing was created again. I tried giving all the prosody folders 777 rights and chown‚d them to the prosody-user, still…same error. I then went to the Prosody MUC. Once again, Zash helped me to isolate the error: the pid-file could not be written by the user. So I just changed the line

pidfile="/var/run/prosody.pid"

to:

pidfile="/home/prosody/prosody.pid"