Thursday, November 17, 2016

MySQL Delete all rows from table and reset ID to zero

http://stackoverflow.com/questions/12651867/mysql-delete-all-rows-from-table-and-reset-id-to-zero


I need to delete all rows from a table but when I add a new row, I want the primary key ID, which has an auto increment, to start again from 0 respectively from 1.
shareimprove this question

4 Answers

up vote198down voteaccepted
Do not delete, use truncate:
Truncate table XXX
The table handler does not remember the last used AUTO_INCREMENT value, but starts counting from the beginning. This is true even for MyISAM and InnoDB, which normally do not reuse sequence values.
shareimprove this answer
14 
Truncate works well with non-constrained tables, but if your table has a Foreign Key constraint, you may consider using the Delete method. See this post if you have FK constraints: truncate foreign key constrained table – Julian Soro May 16 '14 at 23:41

How to fix “table is marked as crashed and should be repaired”

http://dtbaker.net/web-development/how-to-fix-table-is-marked-as-crashed-and-should-be-repaired/

Power outage or a buggy mysql version could cause this error to appear:
Stops any php scripts from running etc..

mysql: Table ‘database/table’ is marked as crashed and should be repaired

To fix this, I ran this command via a shell:
$ mysqlcheck --all-databases -uroot -p
enter the root password, and it goes through checking all database tables for issues. hopefully fixing along the way ðŸ™‚
You may have to change root to whatever database username you have available (ie: whatever you use to login to phpmyadmin)
It any show the error, run this sql:
$ mysql -uroot -p databasename
  REPAIR TABLE tablename;
Or just jump into phpmyadmin and click on repair

Wednesday, November 16, 2016

How to convert stardict dictionary file format to any readable format?

http://superuser.com/questions/137007/how-to-convert-stardict-dictionary-file-format-to-any-readable-format

http://tempatmencatat.blogspot.co.id/2016/11/note-on-stardict-tools-in-ubuntu.html


How to convert stardict dictionary file format to any readable format (xml, txt or something)?
shareimprove this question

2 Answers


The stardict-tools tarball downloadable from their website has a stardict2txt tool that you'll need to build from source.
shareimprove this answer
  
It's almost impossible to compile though. I tried on FreeBSD, OS X, and finally Ubuntu. After numerous fixes to the code, I got it to compile but it segfaults when you run it. – Gazzer Sep 2 '10 at 4:29
  
You can now install the tools by sudo apt-get install stardict-tools in Ubuntu. The tools are at/usr/lib/stardict-tools/ – Raptor 2 days ago

I found this step by step guide on how to use the StarDict editor for Windows in order to decompile a StarDict dictionary to XML format.
  • Extract all files to a folder and then launch the file stardict-editor.exe, switch to the tab DeCompile.
  • Now look at the dictionary files of StarDict you got, there should be 3 files : *.idx, *.ifo, *.dz.
  • Rename the *.dz file to *.gz. Use WinZip or WinRAR to extract the *.dict file inside.
  • Rename all the *.dict, *.ifo, *.idx files to a same name.
  • Back to the StarDict Editor program, click Browse and select the *.ifo file and hit Decompile.
  • You will see a new *.txt file inside the folder.
  • Use it with DfM DictionaryGeneration.
shareimprove this answer

Wednesday, November 9, 2016

Cara pasang module PHP di virtualmin

contoh ingin memasang mbstring


Kapan Black Friday dan Cyber Monday 2016 di namecheap?

Supaya tidak ketinggalan gunakan waktu yang ada di http://time.wf karena dia tepat sampai orde detik. Jangan melihat waktu di komputer kita, karena kadang selisih detik. Ketika tepat jam langsung beraksi. time.wf ini juga bisa digunkan ketika momen black friday namecheap (kemungkinan Jumat 25 November 2016 Jam 12 Siang) dan cyber monday pada 28 Nov 2016 Jam 12 Siang

Tuesday, November 8, 2016

Cara Pasang OPCACHE di PHP 5.6 Centos Setup Zend OPcache on CentOS 7

1. buka terminal login ke server dengan bitvise sebagai root.
2.
https://www.webfoobar.com/index.php/node/31

http://stackoverflow.com/questions/17224798/how-to-use-php-opcache


Zend OPcache speeds up the execution of PHP codes. How? We know that PHP is an interpreted language where the instructions are written in a script and needs a process to parse/interpret and execute it. Zend OPcache removes the parse/interpret part by compiling the script to directly executed it by the target machine which makes the execution of your PHP application more faster. This article will show how to setup Zend OPcache on CentOS 7.
The following procedures are tested on my Linode server running Centos 7 64-bit Linux distribution.
  1. Install the PHP Zend OPcache:
      
    yum install php-pecl-zendopcache
      
    
  2. Configure Zend OPcache optimized for your PHP application. Edit opcache.ini:
      
    vi /etc/php.d/opcache.ini
      
    
    ... and change the following to:
      
    opcache.revalidate_freq=0
    opcache.validate_timestamps=0 
    opcache.max_accelerated_files=20000
    opcache.memory_consumption=128
    opcache.interned_strings_buffer=16
    opcache.fast_shutdown=1
      
    
    Comment out the line "opcache.validate_timestamps=0" in your development environment.
    To get the "opcache.max_accelerated_files" you may use this:
      
    find . -type f -print | grep php | wc -l
      
    
    Since I'm using Dupal, I added these:
      
    find . -type f -print | grep module | wc -l
    find . -type f -print | grep inc | wc -l
      
    
  3. If you don't want to apply Zend OPcache to your development site you may add its path at opcache-default.blacklist:
      
    vi /etc/php.d/opcache-default.blacklist
      
    
  4. Restart your Apache:
      
    service httpd restart
      
    
  5. You can download the web UI for Zend OPcache status at https://raw.github.com/rlerdorf/opcache-status/master/opcache.php. Make sure that you protect this web UI from prying eyes. untuk lebih baik gunakan https://github.com/PeeHaa/OpCacheGUI , download, upload, edit, termasuk edit karena di run di subdirectory, hilangkan user dan password..
Tags
PHP
Web Optimization