Tag Archives: extension

Implementation of screen cleaning in Python idle

screen things too much, need clear screen, window screen clearing command in Windows is CLS, in Python IDLE is the shortcut Ctrl + L

but this shortcut is not the default, need to do some operation

> Copy and save the following code into your new ClearWindow.py

"""

Clear Window Extension
Version: 0.2

Author: Roger D. Serwy
        [email protected]

Date: 2009-06-14

It provides "Clear Shell Window" under "Options"
with ability to undo.

Add these lines to config-extensions.def

[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>


"""

class ClearWindow:

    menudefs = [
        ('options', [None,
               ('Clear Shell Window', '<<clear-window>>'),
       ]),]

    def __init__(self, editwin):
        self.editwin = editwin
        self.text = self.editwin.text
        self.text.bind("<<clear-window>>", self.clear_window2)

        self.text.bind("<<undo>>", self.undo_event)  # add="+" doesn't work

    def undo_event(self, event):
        text = self.text

        text.mark_set("iomark2", "iomark")
        text.mark_set("insert2", "insert")
        self.editwin.undo.undo_event(event)

        # fix iomark and insert
        text.mark_set("iomark", "iomark2")
        text.mark_set("insert", "insert2")
        text.mark_unset("iomark2")
        text.mark_unset("insert2")


    def clear_window2(self, event): # Alternative method
        # work around the ModifiedUndoDelegator
        text = self.text
        text.undo_block_start()
        text.mark_set("iomark2", "iomark")
        text.mark_set("iomark", 1.0)
        text.delete(1.0, "iomark2 linestart")
        text.mark_set("iomark", "iomark2")
        text.mark_unset("iomark2")
        text.undo_block_stop()
        if self.text.compare('insert', '<', 'iomark'):
            self.text.mark_set('insert', 'end-1c')
        self.editwin.set_line_and_column()

    def clear_window(self, event):
        # remove undo delegator
        undo = self.editwin.undo
        self.editwin.per.removefilter(undo)

        # clear the window, but preserve current command
        self.text.delete(1.0, "iomark linestart")
        if self.text.compare('insert', '<', 'iomark'):
            self.text.mark_set('insert', 'end-1c')
        self.editwin.set_line_and_column()

        # restore undo delegator
        self.editwin.per.insertfilter(undo)

3, then find the config in this directory – extensions. Def this file (idle configuration file extensions), open it in notepad

[ClearWindow]
enable=1
enable_editor=0
enable_shell=1
[ClearWindow_cfgBindings]
clear-window=<Control-Key-l>

Clear shell window Ctrl +L

br>

How to use higher version of OpenGL SDK in windows?

 
 
Now OpenGL has version 3.2, Visual C ++ 2005 comes with OpenGL SDK is version 1.1, want to use the advanced version of OpenGL, go to the OpenGL official website, but that only defines the API standard, there is no implementation, I searched the Internet OpenGL2.0 SDK OpenGL3.0 SDK, but did not find the download address, finally found that is to use the extension library way.
 
Download glew (The OpenGL Extension Wrangler Library), http://glew.sourceforge.net/index.html
 
What’s inside:

├ ─ bin
│ glew32. DLL
│ glewinfo. Exe opengl support is used to view the current system of the graphics card
│ glewinfo. TXT
│ VisualInfo.exe is also used to view some graphics card situation
│ visualinfo. TXT

├ ─ the include
│ └ ─ GL
│ glew. H
│ glxew. H
│ wglew. H

└ ─ lib
Glew32. Lib
Glew32s. Lib
 
 
usage
 
 
1. First refer to the header file
#include < gl/glew.h> // must be put first
#include < gl/glut.h>
 
2. The initialization
// Glew is initialized after glutCreateWindow
GLenum err = glewInit ();
If (GLEW_OK! = err)
{
/* Problem: glewInit failed, something is seriously wrong. */
Fprintf (stderr, “Error: % s/n,” glewGetErrorString (err));
}
Fprintf (stdout, “Status: Using GLEW %s/n”, glewGetString(GLEW_VERSION));
 
 
Note: If you use a graphics card that does not support the advanced version of OpenGL functions, the operation will crash
 
 

How to use high version OpenGL under Windows

Windows only supports OpenGL1.1, but graphics cards may implement the related functions of higher versions of OpenGL directly from the hardware. How do you call a higher version of OpenGL in development?
 
Let’s start with a look at the OpenGL version and related function extensions supported by a graphics card:
To see what version of OpenGL the graphics card supports: glGetString(GL_VERSION);
To see the supported extensions: glGetString(GL_EXTENSIONS);
See more detailed information.
http://www.opengl.org/wiki/GlGetString
Note: call glGetString(GLemun); Be sure to initialize the drawing window before doing so, otherwise only null will be returned.
 
Calling extensions with glew:
After confirm the graphics support high version of the function can be used to glew libraries (http://sourceforge.net/projects/glew/) to invoke, configured information can be used after glew libraries. What I want to point out here is that before using the OpenGL function declared in the advanced version of Glew, you must make the following call:
GLenum err = glewInit ();
if (GLEW_OK! = err)
{
* Problem: glewInit failed, something is seriously wrong. */
f>tf (stderr, “Error: %s/n”, glewgeterrorString (err));
}
 
 
You can also use glee,glext, and mesa.
Glee is similar to Glew,glext is a bit cumbersome to use, and mesa is a platform-independent implementation of OpenGL.

Resolve the problem of “event ID 4107” or “event ID 11” errors recorded in the application logs of windows and windows server

Problem description
An error similar to the following was logged in the application log on a machine running Windows 7 or Windows Server 2008 R2:
Log name: application
source: microcosm-windows-capi2
date: date and time
event ID: 4107
task category: no
level: error
key words: classic
user: N/A
computer: computer name
description:
from < http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/authrootstl.cab (http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/authrootstl.cab) > The automatic update CAB failed to extract the third-party root list with the error: the certificate required for verification based on the current system clock or the timestamp in the signature file is not valid.
Or, an application log on a machine running Windows Vista or Windows Server 2008 records an error similar to the following:
Log name: application
source: microcosm-windows-capi2
date: date and time
event ID: 11
task category: no
level: error
key words: classic
user: N/A
computer: computer name
description:
from < http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/authrootstl.cab (http://www.download.windowsupdate.com/msdownload/update/v3/static/trustedr/en/authrootstl.cab) > The automatic update CAB failed to extract the third-party root list with the error: the certificate required for verification based on the current system clock or the timestamp in the signature file is not valid.
why
The above error occurred because the Microsoft Certificate Trust List publisher certificate has expired. A copy of the CTL whose signature certificate has expired exists in the CryptnetUrlCache folder.
In addition, the event ID 4107 May be logged as a “data invalid” error rather than a “Certificate that is not valid when verified against the current system clock or timestamp in the signature file” error.
The solution
Our Fix IT team has provided you with an automated solution to help you solve this problem. You can download or run the solution directly by clicking the following picture or the “Fix it to help me solve this problem” text link:

Let Fix IT help me Fix this problem
Further reading
If you would like to learn more about this problem or try to solve it yourself manually, please refer to the technical articles on the Microsoft website:
http://support.microsoft.com/kb/2328240

 

Error code:10053

Symptoms:
Action.c(16): Error : socket0 – Software caused connection abort. Error code : 10053.

 

normal C/S communication process is :
Server Listen–>

Server Listen–> Client Connect–> Server Accept –> Client Send –> Server Recv–> Client Close –> Server Close
if you do not take the initiative to Close the connection and direct to withdraw from the Client end, Server end service thread will cause a 10053 error (this kind of error usually effect is not too big), and if in the process of the communication Server first initiative to Close the connection, the Client end can also cause a 10053 error

the situation of the bad network is usually refers to the latter, the Client thought the Server off (the actual network broken), so I cried. “10053

Recently, when I used LoadRunner to conduct the performance test of Winsock protocol, the WebServer tested was JBoss, and 10053 errors often occurred. The phenomenon was as follows: after I created the connection with lrs_create_socket, when the number of requests for this socket connection reached 100, the connection was not available, and it had to be closed before creating again. LoadRunner causes Connection abort. Error code: 10053. LoadRunner causes Connection abort.
After much exploration, it was finally found that the error was due to the configuration of the HTTP 1.1 KeepAlive parameter in Apach HTTPServer. From my test results of several different Webservers, it can be seen that JBoss and Tomcat made errors when a Socket connection made 100 requests, while other Web servers, such as IIS and WebLogic, did not have this problem.
several related parameters are described below: KeepAlive, KeepAliveTimeout, and MaxKeepAliveRequests.
KeepAlive Directive
Description: Enables HTTP persistent connections
Syntax: KeepAlive On|Off
Default: KeepAlive On
Context: server config, virtual host
Status: The Core
Module: the Core
In HTTP 1.0, a connection can only transfer one HTTP request, while the KeepAlive parameter is used to support the one connection, multiple transfers feature of HTTP 1.1, so that multiple HTTP requests can be passed in one connection. Although only newer browsers support this feature, this option is enabled anyway.
The keep-alive extension to HTTP/1.0 and The Persistent Connection feature of HTTP/1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over The same TCP Connection.In some The Keep Alive Extension to HTTP/1.0 and The Persistent Connection feature of 1.1 provide long-lived HTTP sessions which allow multiple requests to be sent over The same TCP Connection.In some cases this has been shown to result in an almost 50% speedup in latency times for HTML documents with many images. To enable Keep-Alive connections, set KeepAlive On.
For HTTP/1.0 clients, keep-alive Connections will only be used if they are specifically required by a client. In addition, A keep-alive connection with an HTTP/1.0 client can only be used when the length of the content is known in advance. This implies that dynamic content such as CGI output, SSI Pages, And server-generated Directory listings will generally not use keep-alive Connections to HTTP/1.0 clients.for HTTP/1.1 clients, persistent connections are the default unless otherwise specified. If the client requests it, chunked encoding will be used in order to send content of unknown length over persistent connections.
— — — — — — — — — — — — — — — — — — — — — —
KeepAliveTimeout Directive
Description: Amount of time the server will wait for subsequent requests on a persistent connection
Syntax: KeepAliveTimeout
Default: KeepAliveTimeout 15
Context: server config, virtual host
Status: Core
Module: Core
KeepAliveTimeout tests the time between multiple request transfers in a single connection. If the server has completed one request but has not received the next request from the client, the server disconnects after the interval exceeds the value set by this parameter.
The number of seconds Apache will wait for a subsequent request before closing the connection. Once a request has been received, the timeout value specified by the Timeout directive applies.
Setting KeepAliveTimeout to a high value may cause performance problems in heavily loaded servers. The higher the timeout, the more server processes will be kept occupied waiting on connections with idle clients.
— — — — — — — — — — — — — — — — — — — — — —
MaxKeepAliveRequests Directive
Description: Number of requests allowed on a persistent connection
Syntax: MaxKeepAliveRequests Number
Default: MaxKeepAliveRequests 100
Context: Virtual host
Status: Core
Module: Core
MaxKeepAliveRequests is the maximum number of HTTP requests that can be made with a single connection. Setting its value to 0 will support an unlimited number of transfer requests within a single connection. In fact, no client requests too many pages in a single connection, and usually the connection is completed before this limit is reached.
The MaxKeepAliveRequests directive limits the number of requests allowed per connection when KeepAlive is on. If it is set to 0, unlimited requests will be allowed. We recommend that this setting be kept to a high value for maximum server performance.
For example:MaxKeepAliveRequests 500
Finally, although this problem was caused by the parameter configuration of HTTPServer, only LoadRunner would have had this problem, and if Rational Robot had implemented the same functionality, it would not have had this problem, presumably due to the testing tool’s implementation strategy for Socket connections.

Error installing network file system: Mount error 20 = not a directory

After upgrading to Fedora 9, I found it impossible to mount the Samba Shared file system as before.

when I use the following command:

$mount-t cifs //192.168.1.2/ Samba/MNT/Samba-o Username =test,password=test

mount samba share file gets the following error:

mount error 20 = Not a directory

Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

a Google search revealed that the problem could be due to the cifs file system not being compatible with older samba Shared servers, so either upgrading the samba server program or restricting the cifs would be required to fix the problem. According to the online advice, you can use:

$echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled

modifies the cifs option to disable cifs extensions, and then mount is no problem.

but it was a bit cumbersome to do this every time I restarted, so I changed my system startup script so that I could put these mounts into my fstab and let the system mount automatically every time it was started. The methods are as follows:

modify /etc/init.d/netfs to add a line like the + sign in start as follows:

Case “$1” in the start)

+/sbin/modprobe cifs & amp; & echo 0 > /proc/fs/cifs/LinuxExtensionsEnabled

first execute “/sbin/modprobecifs” to load the cifs module, otherwise the file we want to modify LinuxExtensionsEnabled may not exist yet, and the modification will fail. Since rc*.d/S**netfs at different boot levels are linked to /etc/init.d/netfs, this change takes effect for all boot levels. Of course, if your system is not such a link, it is the same to modify the corresponding file.

there will be no problem installing the samba Shared file system after the restart.

Disk read error solution for new hard disk installation

below first said the process of the problems I encountered and the process of solving, more detailed and verbose, if you are more urgent, directly see the last summary.
 
(Problems arise)
In response to my mother’s strong request, I bought some accessories on JINGdong two weeks ago and installed a new machine. I officially eliminated the old desktop computer that I had used for nearly 10 years at home. My mother said that I would not be able to play QQ dream now.
The neighbor saw, also want to update his machine, I basically the same as before and under a single (at the request of the neighbor to add an OPTICAL drive, my home machine is not equipped with optical drive), the weekend back home to install the machine. The installation went well, but there was a very strange problem when installing the OS.
Listen to me slowly.
The hard disk USES Seagate 1TB (ST1000DM003) disk, and the motherboard USES Giga GA-A75KM-D2H disk. At first, I found some problems with these models, but I found it has nothing to do with the hard disk model after I studied it.
First of all, everything worked fine when I installed the system myself.
In the neighbor installed, I use my pre-carved rain forest wind Win7 Ghost plate, the first use of a key in four areas, four areas. (In fact, this function is to do a complete partition image, disk to disk, ghost will automatically adjust the size of the partition in proportion). Then use a key will win7 Ghost to c disk installation, but ghost is always a failure, generally go less than 50% of the card is dead, after a while optical drive read disk also stopped.
Later, if you boot from hard Disk, sometimes failure will prompt that OS cannot be detected, and sometimes failure will prompt “A Disk Read Error Occurred. Press Ctrl+Alt+del to RESTART”.
 
(Disc-Mounted system)
But the hard disk can only be unplugged, attached to my machine as a slave disk, the system installed in.
Now that I’m hanging them all off the slave disk, I’ll use Disk Genius to reprogram the slave disk partitions.
(The knowledge of primary partition, extended partition, logical partition is very important in manual partition, also not complex, a diagram plus three or two sentences can be explained, do not understand the students please baidu yourself first)
Specific methods:
1, copy win7 ghost from the disc image to the hard disk (or mount the image to the virtual optical drive)
2, if you use GHost32, you can directly ghost-> To partition – & gt; From image, when you select the target hard drive, don’t select your own hard drive or it will be a tragedy
(This is what I did for the first time since I already use Disk Genius.) To use the disk image widget, you need to first use software like Disk Genius to convert the primary partition from the disk to a logical partition and assign a drive letter.
3, ghost, note that the drive letters from each partition are probably not in order, need to pay attention to who is the first partition (Disk Genius, Win7 comes with disk management tools can be).
4. Convert from the first partition of the disk to the primary partition and set it to Active.
 
(New questions)
Restart and start from Disk. Once again, “A Disk Read Error Occurred. Press Ctrl+Alt+del to RESTART”. At first I thought I had damaged the hard drive, so I was taken aback (I had just dropped it accidentally). However, after starting with the master disk and entering the system, it was found that each partition of the slave disk was working normally and the files could be read and written normally.
Suspect is the new motherboard problem, will my hard disk unplug, put the neighbor’s disk on my motherboard to restart again, still invalid.
Put my hard drive on the neighbor’s machine and everything’s fine. It’s not the motherboard.
Things have come to an impasse.
 
(Real solution)
When depressed, use Disk Gunius to observe the partition parameters of two hard disks. Because I used to practice assembly when I wrote the operation of the partition table program, on the disk structure and various parameters or more familiar, boring want to calculate the partition capacity and it is not the same. Suddenly it is found that the starting head and sector from the first partition of the disk is not 1,1, but 31,1. This is not normal!
While the normal should be something like this (this picture was re-cut by the laboratory machine when I posted to illustrate the point) :

This means that after the BIOS has read Boot Sector, the primary partition of the boot partition should start at an abnormal position, with an inexplicably blank space in front of it. Disk Read Error occurs when the BIOS loads the operating system with a strict check and thinks it has read something wrong.
This explains why the BIOS will load the OS incorrectly, while the BIOS will load the OS correctly when it is suspended from the disk (follow the boot Sector start/stop parameter, regardless of OS loading).
I think: this may be caused by my conversion of the primary partition to logical partition, and then to the primary partition. Since this logical partition needs an extended partition header to record the starting and ending positions of each logical partition under it, naturally its real free space is moved back, and the primary partition is not moved back.
After knowing this is easy, I manually modify the partition parameters in the software, will start magnetic head and sector to 1,1, so the partition of the natural thing is not, with a new ghost into a system. Mount startup, everything is OK!
 
 
Some other information on the Internet is summarized as follows:
Occurred: “A Disk Read Error Occurred once again. Press Ctrl+Alt+del to RESTART”, there are generally several possibilities:
1. Hardware failure: Data line aging, interface loosing, motherboard aging (capacitor)
Performance: normal use, sudden occurrence of this problem, on and off.
Solution: Clean the ash and reinsert. Check the capacitance. In addition, someone on the Internet said that UDMA support was cancelled in the BIOS. I found the original post, and the original author said that the capacitor was found to swell, and this capacitor is UDMA circuit, so this method is not common, or fix the motherboard/replace the motherboard.
2. Hard disk failure:
Performance: normal use, suddenly this problem, and then continue to do so, and recall the case (hard disk) recently received a large impact.
Solution: Hard disk low grid.
3. Hard disk setup:
Performance: the new system appears, and is likely to be normally accessible from the slave disk on other machines.
Solution: Check the hard disk partition parameters, set the partition of the operating system installation as the primary partition, Active, non-hidden, start cylinder: 0, start head: 1, start sector: 1.

SOE deployment error ClassFactory cannot supply requested class

The original link: http://www.cnblogs.com/myyouthlife/p/3284291.html

Problem description:
An error message appears when the deployed SOE is enabled for a service. If the newly deployed SOE is enabled for SampleWorldCities, the error message is as follows:
service failed to start
SampleWorldCities.MapServer:

ClassFactory cannot supply requested class
 
Causes:
This error message usually appears in.NET SOE because.NET extension support was not enabled when ArcGIS Server was installed.
Solutions:
Fix arcGIS Server, enable.NET support. The screenshot below

==== dividing line ===
Update 9.29 days
In addition to the above, there is another situation in which the arcobjects SDK that is adopted by the opening of SOE is issued with the wrong version and the arcobjects SDK that is owned on the deployment machine. For example, the ARcobjects SDK for.NET 10.2 is adopted for soe development and deployed on a 10.1 Server machine, and only the Arcobjects SDK for.NET 10.1 is on the machine. The above error will also occur