Category Archives: How to Fix

PHP CI (CodeIgniter) log level setting

1, Ci error level setting is generally in index. PHP, you can set the ENVIRONMENT. Generally speaking, development mode is selected when developing, and production mode is selected after the official release. The code is as follows:

/*
 *---------------------------------------------------------------
 * APPLICATION ENVIRONMENT
 *---------------------------------------------------------------
 *
 * You can load different configurations depending on your
 * current environment. Setting the environment also influences
 * things like logging and error reporting.
 *
 * This can be set to anything, but default usage is:
 *
 *     development
 *     testing
 *     production
 *
 * NOTE: If you change these, also change the error_reporting() code below
 *
 */
	define('ENVIRONMENT', 'development');
/*
 *---------------------------------------------------------------
 * ERROR REPORTING
 *---------------------------------------------------------------
 *
 * Different environments will require different levels of error reporting.
 * By default development will show errors but testing and live will hide them.
 */

if (defined('ENVIRONMENT'))
{
	switch (ENVIRONMENT)
	{
		case 'development':
			error_reporting(E_ALL);
		break;
	
		case 'testing':
		case 'production':
			error_reporting(0);
		break;

		default:
			exit('The application environment is not set correctly.');
	}
}

2, CI error log by default in the application/logs/log – [time]. PHP, log level, path, time format, etc., in the application/config/config. The PHP file Settings, the code is as follows:

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
|	0 = Disables logging, Error logging TURNED OFF
|	1 = Error Messages (including PHP errors)
|	2 = Debug Messages
|	3 = Informational Messages
|	4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;

/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| application/logs/ folder. Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';

/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';

3, in their own code to log, you can call the global function log_message(‘ level ‘,’ message ‘), the level of parameters is (debug Debug, error error, information info), the content can be defined by themselves.

log_message('error', 'error message.');
log_message('debug', 'debug message.'); 
log_message('info', 'info message.');  

UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd6 in position 3089: invalid continuation byte

The cause of
New Ubuntu16.04LTS, then ctags+cscope+taghighlight. Cscope-rb, and then open the source input :UpdateTypesFile and you encounter the following error.


  45 #define CREATE_TRACE_POINTS
  46 #include <trace/events/asoc.h>
  47 
  48 #define NAME_SIZE 32
  49 
  50 #ifdef CONFIG_DEBUG_FS
  51 struct dentry *snd_soc_debugfs_root;
  52 EXPORT_SYMBOL_GPL(snd_soc_debugfs_root);
  53 #endif
Error detected while processing function TagHighlight#Generation#UpdateAndRead[16]..TagHighlight#Generation#UpdateTypesFile[106]..TagHighlight#RunPython
Script#RunGenerator:
line   54:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/home/zz/.vim/plugin/TagHighlight/module/worker.py", line 52, in RunWithOptions
    GenerateTags(config)
  File "/home/zz/.vim/plugin/TagHighlight/module/ctags_interface.py", line 65, in GenerateTags
    tagLines = [line.strip() for line in tagFile]
  File "/home/zz/.vim/plugin/TagHighlight/module/ctags_interface.py", line 65, in <listcomp>
    tagLines = [line.strip() for line in tagFile]
  File "/usr/lib/python3.5/codecs.py", line 321, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 3089: invalid continuation byte
Press ENTER or type command to continue

Analysis:
1. There was no problem when browsing the same code on the server of the company. The temporary exclusion is the problem of the code. 2. Taghighlight and python would have been taghighlight and python, amateurish, but not vim. 3. Notice the last line of the error:

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd6 in position 3089: invalid continuation byte

Say it’s a character cannot be resolved as utf-8, although the position is given, but don’t know is which files, is/usr/lib/python3.5/codecs. Py this file?I opened it up and I looked at it and I said, well, I don’t know, I’m not good at Python, I don’t see anything wrong. Then take this string to search on the Internet, no search to useful, they encounter is the source file itself has problems, modify their source code is good, but I encounter here should not be the source file problem, the reason in the above analysis also said. However, in the process of searching, I felt that the python version was a problem, so I checked the explanatory document of TagHighlight, and it did introduce the configuration of changing the Python version:

 953     PythonVariantPriority                TagHL-PythonVariantPriority
 954         The python part of TagHighlight can be run in a number of ways,
 955         depending on your system configuration.  For most users, this should
 956         be handled completely automatically, but if you want to customise
 957         things, this option is the best way to start.  There are currently
 958         four supported python variants:
 959 
 960             if_pyth3: When using this variant, the python code will be run
 961                       using the Python 3.x interface built into Vim.  If using
 962                       a Vim that is compiled with +python/dyn and
 963                       +python3/dyn, be aware that this may cause problems if
 964                       you want to use the python 2.x interface.  See the
 965                       details on case 4 under :py3file.
 966 
 967             if_pyth:  When using this variant, the python code will be run
 968                       using the Python 2.x (at least version 2.6 required)
 969                       interface built into Vim.  See the comments above
 970                       regarding potential conflicts between the two python
 971                       versions.
 972 
 973             python:   When using this variant. the python code will be run
 974                       using the version of python that is in the path or
 975                       specified with the option TagHL-PathToPython.
 976 
 977             compiled: When using this variant, the compiled executable version
 978                       of the python part of the plugin will be used (so no
 979                       system version of python is required).  Note that this
 980                       requires the compiled version to be installed as it is
 981                       not part of the main distribution.  See the installation
 982                       guide for more information: TagHighlight-install.
 983 
 984         Option Type: List
 985         Default: ["if_pyth3", "if_pyth", "python", "compiled"]

When I checked this again and again, I found that Vim also specifies the Python version when it is compiled, so I wanted to see the version of Vim in question:

zz@zzm:doc$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     -tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
-clientserver    +iconv           +packages        -toolbar
-clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             -perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       -python          +vreplace
+cscope          +lispindent      +python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      -lua             +rightleft       +writebackup
+diff            +menu            -ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xsmp
+emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax          
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl     -L/usr/lib/python3.5/config-3.5m-x86_64-linux-gnu -lpython3.5m -lpthread -ldl -lutil -lm      
zz@zzm:doc$ 

The obvious answer is that the version used is python3.5. A “+” in front of it means yes, and a “-” means no.
notice that python is preceded by “-” and python3 by “+”.
for comparison, check the vim version of the company’s server again:

zz@server5:~$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:42:52)
Included patches: 1-52
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by buildd@
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +syntax
+arabic          +file_in_path    +mouse_sgr       +tag_binary
+autocmd         +find_in_path    -mouse_sysmouse  +tag_old_static
+balloon_eval    +float           +mouse_urxvt     -tag_any_white
+browse          +folding         +mouse_xterm     +tcl
++builtin_terms  -footer          +multi_byte      +terminfo
+byte_offset     +fork()          +multi_lang      +termresponse
+cindent         +gettext         -mzscheme        +textobjects
+clientserver    -hangul_input    +netbeans_intg   +title
+clipboard       +iconv           +path_extra      +toolbar
+cmdline_compl   +insert_expand   +perl            +user_commands
+cmdline_hist    +jumplist        +persistent_undo +vertsplit
+cmdline_info    +keymap          +postscript      +virtualedit
+comments        +langmap         +printer         +visual
+conceal         +libcall         +profile         +visualextra
+cryptv          +linebreak       +python          +viminfo
+cscope          +lispindent      -python3         +vreplace
+cursorbind      +listcmds        +quickfix        +wildignore
+cursorshape     +localmap        +reltime         +wildmenu
+dialog_con_gui  +lua             +rightleft       +windows
+diff            +menu            +ruby            +writebackup
+digraphs        +mksession       +scrollbind      +X11
+dnd             +modify_fname    +signs           -xfontset
-ebcdic          +mouse           +smartindent     +xim
+emacs_tags      +mouseshape      -sniff           +xsmp_interact
+eval            +mouse_dec       +startuptime     +xterm_clipboard
+ex_extra        +mouse_gpm       +statusline      -xterm_save
+extra_search    -mouse_jsbterm   -sun_workshop    +xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz     -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1     -I/usr/include/tcl8.6  -D_REENTRANT=1  -D_THREAD_SAFE=1  -D_LARGEFILE64_SOURCE=1  
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -L/build/buildd/ruby1.9.1-1.9.3.484/debian/lib -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-1.9.1 -lpthread -lrt -ldl -lcrypt -lm  -L/usr/lib   

Looking at the server version again, the company server is Ubuntu 14.04.2lts (GNU/Linux 3.13.0-24-generic x86_64)
and my new one is 16.04, which is probably why 14.02 USES python2.7.
Python3.5 is supposed to be a bit more compatible than 2.7, but it turns out that python3.5 is more compatible than 2.7.
the next line of thought is clearer:
1. Either change my vim to use python2.7 as well; 2. Either install a python3.6 or later, and then figure out a way for vim to use this version;
obviously, method 1 is relatively easy to implement, and the way to add python2 to vim is as follows:
py2 package installed, under the command terminal input: sudo apt - get the install vim - nox - py2
please see the specific link https://blog.csdn.net/u012629369/article/details/53447555
I do the same thing, can use python2 results vim:

zz@zzm:doc$ sudo apt-get install vim-nox-py2 
[sudo] password for zz: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  vim-doc
The following NEW packages will be installed:
  vim-nox-py2
0 upgraded, 1 newly installed, 0 to remove and 23 not upgraded.
Need to get 0 B/1,100 kB of archives.
After this operation, 2,642 kB of additional disk space will be used.
Selecting previously unselected package vim-nox-py2.
(Reading database ... 220112 files and directories currently installed.)
Preparing to unpack .../vim-nox-py2_2%3a7.4.1689-3ubuntu1.2_amd64.deb ...
Unpacking vim-nox-py2 (2:7.4.1689-3ubuntu1.2) ...
Setting up vim-nox-py2 (2:7.4.1689-3ubuntu1.2) ...
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/vim (vim) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/vimdiff (vimdiff) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/rvim (rvim) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/rview (rview) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/vi (vi) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/view (view) in auto mode
update-alternatives: using /usr/bin/vim.nox-py2 to provide /usr/bin/ex (ex) in auto mode
zz@zzm:doc$ 
zz@zzm:doc$ 
zz@zzm:doc$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Nov 24 2016 16:44:48)
Included patches: 1-1689
Extra patches: 8.0.0056
Modified by [email protected]
Compiled by [email protected]
Huge version without GUI.  Features included (+) or not (-):
+acl             +farsi           +mouse_netterm   +tag_binary
+arabic          +file_in_path    +mouse_sgr       +tag_old_static
+autocmd         +find_in_path    -mouse_sysmouse  -tag_any_white
-balloon_eval    +float           +mouse_urxvt     +tcl
-browse          +folding         +mouse_xterm     +terminfo
++builtin_terms  -footer          +multi_byte      +termresponse
+byte_offset     +fork()          +multi_lang      +textobjects
+channel         +gettext         -mzscheme        +timers
+cindent         -hangul_input    +netbeans_intg   +title
-clientserver    +iconv           +packages        -toolbar
-clipboard       +insert_expand   +path_extra      +user_commands
+cmdline_compl   +job             +perl            +vertsplit
+cmdline_hist    +jumplist        +persistent_undo +virtualedit
+cmdline_info    +keymap          +postscript      +visual
+comments        +langmap         +printer         +visualextra
+conceal         +libcall         +profile         +viminfo
+cryptv          +linebreak       +python          +vreplace
+cscope          +lispindent      -python3         +wildignore
+cursorbind      +listcmds        +quickfix        +wildmenu
+cursorshape     +localmap        +reltime         +windows
+dialog_con      +lua             +rightleft       +writebackup
+diff            +menu            +ruby            -X11
+digraphs        +mksession       +scrollbind      -xfontset
-dnd             +modify_fname    +signs           -xim
-ebcdic          +mouse           +smartindent     -xsmp
+emacs_tags      -mouseshape      +startuptime     -xterm_clipboard
+eval            +mouse_dec       +statusline      -xterm_save
+ex_extra        +mouse_gpm       -sun_workshop    -xpm
+extra_search    -mouse_jsbterm   +syntax          
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -Wdate-time  -g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -Wl,-Bsymbolic-functions -Wl,-z,relro -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E  -Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now -Wl,--as-needed -o vim        -lm -ltinfo -lnsl  -lselinux  -lacl -lattr -lgpm -ldl  -L/usr/lib -llua5.2 -Wl,-E  -fstack-protector-strong -L/usr/local/lib  -L/usr/lib/x86_64-linux-gnu/perl/5.22/CORE -lperl -ldl -lm -lpthread -lcrypt -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions  -L/usr/lib/x86_64-linux-gnu -ltcl8.6 -ldl -lz -lpthread -lieee -lm -lruby-2.3 -lpthread -lgmp -ldl -lcrypt -lm     
zz@zzm:doc$ 

The next step is to use :UpdateTypesFile.
The next step is to look at how to get vim and taghighlight to use python3.6 and see if there are any problems.

Solution to shell script error “expr: syntax error”

A few days ago, I wrote a shell script, which was normally run on my local test server. In the online server environment, I ran syntax error near token ‘. There was no problem looking at shell script left and right, so I could not Google search. It is as follows:
Open your SHELL script file with the command VI-b, and you will. Notice that each line of script ends up with an extra ^M.
So the next thing I need to figure out is what is this to the M?
long long ago….. The old teletype machine used two characters to start a new line. A character moves the slider backward (called carriage return, < CR> , ASCII code is 0D), another character moves the paper one line (called newline, < LF> , ASCII code is 0A). When computers came along, memory used to be very expensive. Some people decide that it’s unnecessary to use two characters for the end of a line. UNIX developers decided that they could use a single character for the end of a line. Linux follows UNIX, which is also < LF> . Apple developers prescribe the use of < CR> . The guys who developed MS-DOS and Windows decided to stick with the old fashioned. CR> < LF> .
Because MS-DOS and Windows are carriage return + line feed to represent line feed, Vim is used in Linux to view the code written in Windows with VC. The “^M” symbol at the end of the line represents the character.
To solve this problem in Vim, simply use the substitution function in Vim to eliminate “^M” and type the following substitution command line:
1)vi -b setup.sh
2) At command edit line < ESC key and shift+: colon > Input: % s/M ^// g
Note: the “^M” character on the command line above is not “^” plus “M”, but is generated by “Ctrl+ V” and “Ctrl+M”.
After this substitution, the save is ready to be executed. Of course there are other alternatives such as:
A. Some Linux versions have the DOS2UNIX program, which can be used to remove ^M.
b.cat filename1 | tr -d “/r” > Newfile gets rid of ^M to create a newfile, sed commands, etc. Any command that can be replaced can be used to create a newfile.

According to the above mentioned, delete the ^Mshell script and it will work fine. Later, I asked my colleague that he had changed the program path in Windows Notepad, resulting in an extra ^M in each line.

curl: (22) The requested URL returned error: 404 Not Found Server does not provide clone.bundle; ig

Android source code download, Repo Sync, report:
curl: (22) The requested URL returned error: 404 Not Found
Server does not provide clone.bundle; ignoring.Server does not provide clone.bundle; ignoring.
 
Solutions:
Ignore it…
1. Reference: Tsinghua University Open source software mirroring station – Help for Android mirroring
https://mirrors.tuna.tsinghua.edu.cn/help/AOSP/

2. Also see: 404 Not Found when repo init or repo sync
https://blog.csdn.net/QQ2010899751/article/details/81347599

PHP uses timthumb to generate thumbnails

Recently, I need an interface for online screenshots, but I haven’t found it suitable for a long time, and then It is a little troublesome to write it by myself. Suddenly, I remember that I encountered a slightly thumbnail class when I was using wordpress. Don’t use it too easily. I recommend it here.
Anyone who has used the Timthumb class should be familiar with it. This class can be used to generate and process thumbnails of images, or to take screenshots of websites if you have optipng or pngCrush installed in a Linux environment.
File download address: http://www.121xz.com/softdown/19577
Wordpress comes every time to upload the features of the thumbnails of all images by cutting according to set the image size, and cut the original image and the image stored in the web space, image cut only once, change the Settings of the size will not regenerate, so not only occupy the host space, after revision sites use the same images, even when otherwise image distortion or deformation. Timthumb. PHP is a thumbnail application project integrated in wordpress theme specially developed for wordpress. It will only crop the called images, and only generate a configuration file temporarily when there is an access request.
Parameter description:
SRC: the need for image zooming source address, or the need for screenshots operation web address webshot: if this value is true, for screenshots operation w: generate the width of the image, if the width or height only set up a value, according to one of the values for geometric scaling of h: the height of the generated images, if the height and width is not specified, the default is 100 * 100 zc: generate picture zoom mode, optional value of 0, 1, 2, 3, the default is 1, the difference between each value annotation line 100 q can see the following documents: Generated images quality, the default 90 a: beyond the cutting location of parts, and zooming pattern, optional value t, b, l, r, the default is cut from the top to f: need to generate images after use some filters, here are the different code and the value of the filter, the specific operation method is the line 821 annotations file below s: whether to sharpen the production pictures of cc: generating background canvas picture color ct: generate PNG image background is transparent
Warm tips:
Timthumb requires host support for GD libraries; The processing of Timthumb requires certain server resources. Timthumb does not support external linked images; There have been holes in Timthumb; The author indicates that Timthumb is no longer updated.
Patch the bugs in Timthumb. PHP:
Whitelists are removed using the latest version of timthumb. PHP (but the author says no more updates) server directory permissions Settings
Find the following code in the file, delete or comment it out

1
2
3
4
5
6
7
8
// external domains that are allowed to be displayed on your website
$allowedSites = array (
        'flickr.com',
        'picasa.com',
        'blogger.com',
        'wordpress.com',
        'img.youtube.com',
);

Arithmetic overflow error converting identity to data type int

This is a real problem in the project, resulting in the final collapse of all projects! It took two hours to figure out the problem
Background: All of a sudden before I went to work in the morning, I was told that the lights of all the projects could not be turned off normally. Oh, my god, this can’t happen. This has never happened before. Hurry to the company, first with the preparatory plan to all equipment to send instructions to shut down. Then start looking for problems.
Procedure: I initially thought there was a problem with either the server or IIS, because IIS often died at regular intervals and needed to be restarted. But obviously not this time, because the site is accessible. Then check the service. After checking for a long time, I found that there was a code error. It was just a simple statement to update the database.
Update XXX set XX = X where XXXX = XXXX
The following statement returns the Arithmetic overflow error IDENTITY to data type int
Although English is not good, but you can see that the conversion type is wrong, the conversion type int is wrong, the primary key identifies the column, overflow. But I’m sure this statement will be fine, but I still want to have a trigger after this table is updated. So look at the trigger, and there’s a job to insert into another table, and look at that table whose primary key is an int. Suddenly I understood, because the table will store tens of thousands of data a day, although it will be emptied regularly, but the self-growth ID will increase. So id is greater than 200 million, which is 2 to the 32nd power.
Solution: Change the field type to bigint or VARCHar (GUID). Bigint is also limited, but in theory it should be fine!

Error 1310 Error writing to file:C:\Windows\…*.dll. Verify that you have access to that directory

Once appear this error when you install software, then how do bad, head along while, then suddenly think of oneself in the process of installing software have the kind of rejection, and 360 security software popup allowing this reminded of what operation, and he was not too concerned about the installation process, a hand slide seemed to point the option to reject, oneself also not sure, also don’t know what will be after some refused to case, the result is out of such a moth. Then I quit 360 security guard, then install everything will be fine.

Prompt SQL server error 15023 solution memo when modifying user mapping

When the database is restored from the backup file of another instance and users are added and mapped to the table, save the prompt that SQL Server Error 15023 user already exists. My solution:
EXECUTE sp_change_users_login ‘Update_one’,’login1′,’login1′
ALTER USER login1 WITH LOGIN = login1
Note that this is done on the corresponding DataBase (Use [DataBase]) and cannot be done on the Master or any other system DataBase
It is said that there is batch processing, not pro test, as follows:

 1 -- fix all orphan users in database
 2 -- where username=loginname
 3 DECLARE @orphanuser varchar(50)
 4 DECLARE Fix_orphan_user CURSOR FOR
 5 SELECT dp.name  As Orphan_Users
 6 FROM sys.database_principals dp
 7 left join sys.server_principals sp
 8 ON dp.sid=sp.sid 
 9 WHERE sp.name IS NULL 
10 AND dp.type='S' AND 
11 dp.name NOT IN ('guest','INFORMATION_SCHEMA','sys')
12 
13 OPEN Fix_orphan_user
14 FETCH NEXT FROM Fix_orphan_user
15 INTO @orphanuser WHILE @@FETCH_STATUS = 0
16 BEGIN
17 
18 EXECUTE('ALTER USER ' + @orphanuser + ' WITH LOGIN = ' + @orphanuser)
19 
20 FETCH NEXT FROM Fix_orphan_user
21 INTO @orphanuser
22 END
23 CLOSE Fix_orphan_user
24 DEALLOCATE Fix_orphan_user

 
References from the solution: http://www.sqlservergeeks.com/sql-server-error-15023-user-already-exists-in-current-database/
 

Reproduced in: https://www.cnblogs.com/hu123rong00/p/7116496.html

Urllib2.httperror: http error 403: forbidden solution

When using Python to crawl a web crawler, it is common to assume that the target site has 403 Forbidden crawlers
Question: why are the 403 Forbidden errors
answer: urllib2.httperror: HTTPError 403: Forbidden errors occur mainly because the target website prohibits the crawler. The request header can be added to the request.
Q: So how do you solve it?
answer: just add a headers

req = urllib.request.Request(url="http://en.wikipedia.org"+pageUrl)
HTML = urlopen(req)

to add a headers to make it become

 headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0'}
    req = urllib.request.Request(url="http://en.wikipedia.org"+pageUrl, headers=headers)
    # req = urllib.request.Request(url="http://en.wikipedia.org"+pageUrl)
    html = urlopen(req)

Q: How does Headers look?Answer: you can use the Internet in browser developer tools, such as in firefox
Q: Is there any other problem with pretending to be a browser?
answer: yes, for example, the target site will block the query too many times IP address

Reproduced in: https://www.cnblogs.com/fonttian/p/7294845.html

Indenta in Python tionError:unindent does Error

This Po is reproduced: https://blog.csdn.net/u010412719/article/details/47089473
 
Today in the net copy of a piece of code, the code is very simple, every line looks like the indentation of the indentation, run the time appeared the following error:

[solution]
1. The most common reason for this error is that, indeed, there is no indentation. Depending on the number of lines of error, the code looks fine, there are indenting, and there are no syntax errors.
2. After looking through the code and realizing that nothing really went wrong, it occurred to me to display all the characters in the current Python script (including Spaces and TAB characters) to see if there was any indentation or any other special characters.

Notepad++, the current text editor, has a setting to display all characters.
in:
view — > Display symbol – & GT; Show Spaces and tabs
so you can see whether or not our Python code is indented.

Finally, it turns out that the error is actually caused by the fact that the error line appears to be indented, but actually it is not. This is the root of the problem.
I found a problem that none of the Python code I copied was indent, which requires extra attention when We copy other people’s code. Don’t make it look like your code is indented to feel ok, it’s not actually indented.

How to solve runtime error r6016

2019 Unicorn enterprise heavily recruited Python engineer standard & GT; > >

Insufficient thread data space
The operating system does not give the program enough memory to complete the _BEGINThread call.

When a new thread starts, the library must create an internal database for the thread. When the database cannot be expanded in the memory provided by the operating system, the thread will not start and the processing of the call will stop.
You can try setting your virtual memory a little bit bigger:
Computer attributes –& GT; Advanced – & gt; Performance (Setting)–& GT; Advanced – & gt; Virtual memory (change..)
Set your virtual memory value higher

Reproduced in: https://my.oschina.net/u/2381604/blog/597812