text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
Name: nt126004 Date: 01/08/2002 java version "1.4.0-beta3" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta3-b84) Java HotSpot(TM) Client VM (build 1.4.0-beta3-b84, mixed mode) This problem looks like it might be related to bug 4447156. When opening a connection to a url which has a server side redirect, URLConnection follows the redirect and opens a connection to the target URL. But it doesn't respect the protocol portion of the new URL (http, https,...) If the protocol of the new URL is different from the protocol of the original URL, I've found that URLConnection tries to connect to the new URL on the port that is used by the original protocol. For example, if the URL is and the redirect is to then it attempts to connect to port 80 on other.host.com when it should connect to port 443. Following are 2 programs. The first program just opens a connection to the HTTP port on the local machine and tries to read the contents of the url "/". The second program binds to port 80 of the local machine and tells any client that connects to it to connect to the SSL port (which is 443) of the local machine. If you run the second program and then the first, you should see the first connect to the HTTP port, get the redirect, and then fail to connect to the HTTPS port (unless you have something running on the HTTPS port on the machine you are running this on). What actually happens is the first program connects to port 80, gets the redirect but fails to notice that it is a redirect to another protocol, so it connects to the HTTP port again and again until the URLConnection class decides that there have been too many redirects and throws an exception. This is the exception: Exception in thread "main" java.net.ProtocolException: Server redirected too many times (20) at sun.net. at TestConnection.main(TestConnection.java:14) --- TestConnection.java --- import java.io.*; import java.net.*; // Copyright (c) 2001 Steven Procter // All rights reserved. // This program opens a connection to and reads the // contents and prints them to System.out. public class TestConnection { public static void main(String [] args) throws Exception { String connection closed"); return; } else if (line.length() == 0) { System.out.println("> found HTTP request terminating blank line"); sendReply(sock); } else { System.out.println("> got HTTP request header line"); // nothing, just another line of input } } } catch(Exception e) { System.err.println("Exception reading from peer"); return; } } // Loop forever getting a connection and servicing the peer until // it shuts down the connection. public static void mainLoop(int port) { try { ServerSocket sock = new ServerSocket(port); for (;;) { try { Socket conn = sock.accept(); System.out.println("> new connection accepted"); serviceConnection(conn); conn.close(); } catch(Exception e) { System.err.println("mainLoop: exception " + e.getMessage()); } } } catch(IOException io) { System.err.println("mainLoop: couldn't open socket on port " + port); System.err.println(io.getMessage()); } } public static void main(String [] args) { mainLoop(listenPort); } } --- end Redirect.java --- (Review ID: 137111) ======================================================================
https://bugs.java.com/bugdatabase/view_bug.do?bug_id=4620571
CC-MAIN-2021-21
refinedweb
518
57.06
Why MicroWebSrv not runnning on Wipy3.0 ? Hello everyboby, i need some help, I m using Wipy3.0 with the last firmware (1.18). I downloaded MicroWebSrv from I copied "main.py" to "start.py" and I m using this code in my Main.py : from network import WLAN # configure the WLAN subsystem in station mode (the default is AP) wlan = WLAN(mode=WLAN.STA) # go for fixed IP settings (IP, Subnet, Gateway, DNS) #wlan.ifconfig(config=('10.1.10.178', '255.255.255.0', '10.1.10.254', '10.1.10.178')) wlan.scan() # scan for available networks wlan.connect(ssid='my_network', auth=(WLAN.WPA2, 'azerty123')) while not wlan.isconnected(): pass print(wlan.ifconfig()) With console into VS Code, I m using the command import start Nothing happens. Nothing to navigator. The command seems blocked. I am obliged to make a hard reset Someboby to help me. Thanks Hello,. --> <--
https://forum.pycom.io/topic/3365/why-microwebsrv-not-runnning-on-wipy3-0
CC-MAIN-2021-10
refinedweb
150
63.56
This tutorial is far from visually stunning, but you will definitely learn a few new things by reading through it. I have had quite a few people ask me about extensions, and how to find out what extensions are supported on a particular brand of video card. This tutorial will teach you how to find out what OpenGL extensions are supported on any type of 3D video card. I will also teach you how to scroll a portion of the screen without affecting any of the graphics around it using scissor testing. You will also learn how to draw line strips, and most importantly, in this tutorial we will drop the AUX library completely, along with Bitmap images. I will show you how to use Targa (TGA) images as textures. Not only are Targa files easy to work with and create, they support the ALPHA channel, which will allow you to create some pretty cool effects in future projects! The first thing you should notice in the code below is that we no longer include the glaux header file (glaux.h). It is also important to note that the glaux.lib file can also be left out! We're not working with bitmaps anymore, so there's no need to include either of these files in our project. Also, using glaux, I always received one warning message. Without glaux there should be zero errors, zero warnings. #include <windows.h> // Header File For Windows #include <stdio.h> // Header File For Standard Input / Output #include <stdarg.h> // Header File For Variable Argument Routines #include <string.h> // Header File For String Management #include <gl\gl.h> // Header File For The OpenGL32 Library #include <gl\glu.h> // Header File For The GLu32 first thing we need to do is add some variables. The first variable scroll will be used to scroll a portion of the screen up and down. The second variable maxtokens will be used to keep track of how many tokens (extensions) are supported by the video card. base is used to hold the font display list. swidth and sheight are used to grab the current window size. We use these two variable to help us calculate the scissor coordinates later in the code. int scroll; // Used For Scrolling The Screen int maxtokens; // Keeps Track Of The Number Of Extensions Supported int swidth; // Scissor Width int sheight; // Scissor Height GLuint base; // Base Display List For The Font Now we create a structure to hold the TGA information once we load it in. The first variable imageData will hold a pointer to the data that makes up the image. bpp will hold the bits per pixel used in the TGA file (this value should be 24 or 32 bits depending on whether or not there is an alpha channel). The third variable width will hold the width of the TGA image. height will hold the height of the image, and texID will be used to keep track of the textures once they are built. The structure will be called TextureImage. The line just after the structure (TextureImage textures[1]) sets aside storage for the one texture that we will be using in this program.Image; // Structure Name TextureImage textures[1]; // Storage For One Texture LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration For WndProc Now for the fun stuff! This section of code will load in a TGA file and convert it into a texture for use in the program. One thing to note is that this code will only load 24 or 32 bit uncompressed TGA files. I had a hard enough time making the code work with both 24 and 32 bit TGA's :) I never said I was a genious. I'd like to point out that I did not write all of this code on my own. Alot of the really good ideas I got from reading through random sites on the net. I just took all the good ideas and combined them into code that works well with OpenGL. Not easy, not extremely difficult! We pass two parameters to this section of code. The first parameter points to memory that we can store the texture in (*texture). The second parameter is the name of the file that we want to load (*filename). The first variable TGAheader[ ] holds 12 bytes. We'll compare these bytes with the first 12 bytes we read from the TGA file to make sure that the file is indeed a Targa file, and not some other type of image. TGAcompare will be used to hold the first 12 bytes we read in from the TGA file. The bytes in TGAcompare will then be compared with the bytes in TGAheader to make sure everything matches. header[ ] will hold the first 6 IMPORTANT bytes from the header file (width, height, and bits per pixel). The variable bytesPerPixel will store the result after we divide bits per pixel by 8, leaving us with the number of bytes used per pixel. imageSize will store the number of bytes required to make up the image (width * height * bytes per pixel). temp is a temporary variable that we will use to swap bytes later in the program. The last variable type is a variable that I use to select the proper texture building params depending on whether or not the TGA is 24 or 32 bit. If the texture is 24 bit we need to use GL_RGB mode when we build the texture. If the TGA is 32 bit we need to add the Alpha component, meaning we have to use GL_RGBA (By default I assume the image is 32 bit by default that is why type is GL_RGBA). bool LoadTGA(TextureImage ) The first line below opens the TGA file for reading. file is the handle we will use to point to the data within the file. the command fopen(filename, "rb") will open the file filename, and "rb" tells our program to open it for [r]eading in [b]inary mode! The if statement has a few jobs. First off it checks to see if the file contains any data. If there is no data, NULL will be returned, the file will be closed with fclose(file), and we return false. If the file contains information, we attempt to read the first 12 bytes of the file into TGAcompare. We break the line down like this: fread will read sizeof(TGAcompare) (12 bytes) from file into TGAcompare. Then we check to see if the number of bytes read is equal to sizeof(TGAcompare) which should be 12 bytes. If we were unable to read the 12 bytes into TGAcompare the file will close and false will be returned. If everything has gone good so far, we then compare the 12 bytes we read into TGAcompare with the 12 bytes we have stored in TGAheader. If the bytes do not match, the file will close, and false will be returned. Lastly, if everything has gone great, we attempt to read 6 more bytes into header (the important bytes). If 6 bytes are not available, again, the file will close and the program will return false. { if (file == NULL) // Did The File Even Exist? *Added Jim Strong* return false; // Return False else { fclose(file); // If Anything Failed, Close The File return false; // Return False } } If everything went ok, we now have enough information to define some important variables. The first variable we want to define is width. We want width to equal the width of the TGA file. We can find out the TGA width by multiplying the value stored in header[1] by 256. We then add the lowbyte which is stored in header[0]. The height is calculated the same way but instead of using the values stored in header[0] and header[1] we use the values stored in header[2] and header[3]. After we have calculated the width and height we check to see if either the width or height is less than or equal to 0. If either of the two variables is less than or equal to zero, the file will be closed, and false will be returned. We also check to see if the TGA is a 24 or 32 bit image. We do this by checking the value stored at header[4]. If the value is not 24 or 32 (bit), the file will be closed, and false will be returned. In case you have not realized. A return of false will cause the program to fail with the message "Initialization Failed". Make sure your TGA is an uncompressed 24 or 32 bit image! } Now that we have calculated the image width and height we need to calculate the bits per pixel, bytes per pixel and image size. The value in header[4] is the bits per pixel. So we set bpp to equal header[4]. If you know anything about bits and bytes, you know that 8 bits makes a byte. To figure out how many bytes per pixel the TGA uses, all we have to do is divide bits per pixel by 8. If the image is 32 bit, bytesPerPixel will equal 4. If the image is 24 bit, bytesPerPixel will equal 3. To calculate the image size, we multiply width * height * bytesPerPixel. The result is stored in imageSize. If the image was 100x100x32 bit our image size would be 100 * 100 * 32/8 which equals 10000 * 4 or 40000 bytes! Now that we know how many bytes our image is going to take, we need to allocate some memory. The first line below does the trick. imageData will point to a section of ram big enough to hold our image. malloc(imagesize) allocates the memory (sets memory aside for us to use) based on the amount of ram we request (imageSize). The "if" statement has a few tasks. First it checks to see if the memory was allocated properly. If not, imageData will equal NULL, the file will be closed, and false will be returned. If the memory was allocated, we attempt to read the image data from the file into the allocated memory. The line fread(texture->imageData, 1, imageSize, file) does the trick. fread means file read. imageData points to the memory we want to store the data in. 1 is the size of data we want to read in bytes (we want to read 1 byte at a time). imageSize is the total number of bytes we want to read. Because imageSize is equal to the total amount of ram required to hold the image, we end up reading in the entire image. file is the handle for our open file. After reading in the data, we check to see if the amount of data we read in is the same as the value stored in imageSize. If the amount of data read and the value of imageSize is not the same, something went wrong. If any data was loaded, we will free it. (release the memory we allocated). The file will be closed, and false will be returned. } If the data was loaded properly, things are going good :) All we have to do now is swap the Red and Blue bytes. In OpenGL we use RGB (red, green, blue). The data in a TGA file is stored BGR (blue, green, red). If we didn't swap the red and blue bytes, anything in the picture that should be red would be blue and anything that should be blue would be red. The first thing we do is create a loop (i) that goes from 0 to imageSize. By doing this, we can loop through all of the image data. Our loop will increase by steps of 3 (0, 3, 6, 9, etc) if the TGA file is 24 bit, and 4 (0, 4, 8, 12, etc) if the image is 32 bit. The reason we increase by steps is so that the value at i is always going to be the first byte ([b]lue byte) in our group of 3 or 4 bytes. Inside the loop, we store the [b]lue byte in our temp variable. We then grab the red byte which is stored at texture->imageData[i+2] (Remember that TGAs store the colors as BGR[A]. B is i+0, G is i+1 and R is i+2) and store it where the [b]lue byte used to be. Lastly we move the [b]lue byte that we stored in the temp variable to the location where the [r]ed byte used to be (i+2), and we close the file with fclose(file). If everything went ok, the TGA should now be stored in memory as usable OpenGL texture data! for(GLuint Now that we have usable data, it's time to make a texture from it. We start off by telling OpenGL we want to create a texture in the memory pointed to by &texture[0].texID. It's important that you understand a few things before we go on. In the InitGL() code, when we call LoadTGA() we pass it two parameters. The first parameter is &textures[0]. In LoadTGA() we don't make reference to &textures[0]. We make reference to &texture[0] (no 's' at the end). When we modify &texture[0] we are actually modifying textures[0]. texture[0] assumes the identity of textures[0]. I hope that makes sense. So if we wanted to create a second texture, we would pass the parameter &textures[1]. In LoadTGA() any time we modified texture[0] we would be modifying textures[1]. If we passed &textures[2], texture[0] would assume the identity of &textures[2], etc. Hard to explain, easy to understand. Of course I wont be happy until I make it really clear :) Last example in english using an example. Say I had a box. I called it box #10. I gave it to my friend and asked him to fill it up. My friend could care less what number it is. To him it's just a box. So he fills what he calls "just a box". He gives it back to me. To me he just filled Box #10 for me. To him he just filled a box. If I give him another box called box #11 and say hey, can you fill this. He'll again think of it as just "box". He'll fill it and give it back to me full. To me he's just filled box #11 for me. When I give LoadTGA &textures[1] it thinks of it as &texture[0]. It fills it with texture information, and once it's done I am left with a working textures[1]. If I give LoadTGA &textures[2] it again thinks of it as &texture[0]. It fills it with data, and I'm left with a working textures[2]. Make sense :) Anyways... On to the code! We tell LoadTGA() to build our texture. We bind the texture, and tell OpenGL we want it to be linear filtered. // Build A Texture From The Data glGenTextures(1, &texture[0].texID); // Generate OpenGL texture IDs glBindTexture(GL_TEXTURE_2D, texture[0].texID); // Bind Our Texture glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); // Linear Filtered glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); // Linear Filtered Now we check to see if the TGA file was 24 or 32 bit. If the TGA was 24 bit, we set the type to GL_RGB. (no alpha channel). If we didn't do this, OpenGL would try to build a texture with an alpha channel. The alpha information wouldn't be there, and the program would probably crash or give an error message. if (texture[0].bpp==24) // Was The TGA 24 Bits { type=GL_RGB; // If So Set The 'type' To GL_RGB } Now we build our texture, the same way we've always done it. But instead of putting the type in ourselves (GL_RGB or GL_RGBA), we substitute the variable type. That way if the program detected that the TGA was 24 bit, the type will be GL_RGB. If our program detected that the TGA was 32 bit, the type would be GL_RGBA. After the texture has been built, we return true. This lets the InitGL() code know that everything went ok. glTexImage2D(GL_TEXTURE_2D, 0, type, texture[0].width, texture[0].height, 0, type, GL_UNSIGNED_BYTE, texture[0].imageData); return true; // Texture Building Went Ok, Return True } The code below is our standard build a font from a texture code. You've all seen this code before if you've gone through all the tutorials up until now. Nothing really new here, but I figured I'd include the code to make following through the program a little easier. Only real difference is that I bind to textures[0].texID. Which points to the font texture. Only real difference is that .texID has been added. GLvoid BuildFont(GLvoid) // Build Our Font Display List { base=glGenLists(256); // Creating 256 Display Lists glBindTexture(GL_TEXTURE_2D, textures[0].texID); // Select Our Font Texture for -0.001f); // Texture Coord (Top Right) glVertex2i(16,0); // Vertex Coord (Top Right) glTexCoord2f(cx,1.0f-cy-0.001f); // Texture Coord (Top Left) glVertex2i(0,0); // Vertex Coord (Top Left) glEnd(); // Done Building Our Quad (Character) glTranslated(14,0,0); // Move To The Right Of The Character glEndList(); // Done Building The Display List } // Loop Until All 256 Are Built } KillFont is still the same. We created 256 display lists, so we need to destroy 256 display lists when the program closes. GLvoid KillFont(GLvoid) // Delete The Font From Memory { glDeleteLists(base,256); // Delete All 256 Display Lists } The glPrint() code has only changed a bit. The letters are all stretched on the y axis. Making the letters very tall. I've explained the rest of the code in other tutorials. The stretching is accomplished with the glScalef(x,y,z) command. We leave the ratio at 1.0 on the x axis, we double the size on the y axis (2.0), and we leave it at 1.0 on the z axis. GLvoid glPrint(GLint x, GLint y, int set, const char *fmt, ...) // Where The Printing Happens { char text[1024]; // - Top Left) glListBase(base-32+(128*set)); // Choose The Font Set (0 or 1) glScalef(1.0f,2.0f,1.0f); // Make The Text 2X Taller glCallLists(strlen(text),GL_UNSIGNED_BYTE, text); // Write The Text To The Screen glDisable(GL_TEXTURE_2D); // Disable Texture Mapping } ReSizeGLScene() sets up an ortho view. Nothing really new. 0,1 is the top left of the screen. 639,480 is the bottom right. This gives us exact screen coordinates in 640 x 480 resolution. Notice that we set the value of swidth to equal the windows current width, and we set the value of sheight to equal the windows current height. Whenever the window is resized or moved, sheight and swidth will be updated. GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize And Initialize The GL Window { swidth=width; // Set Scissor Width To Window Width sheight=height; // Set Scissor Height To Window Height,640,480,0.0f,-1.0f,1.0f); // Create Ortho 640x480 View (0,0 At Top Left) glMatrixMode(GL_MODELVIEW); // Select The Modelview Matrix glLoadIdentity(); // Reset The Modelview Matrix } The init code is very minimal. We load our TGA file. Notice that the first parameter passed is &textures[0]. The second parameter is the name of the file we want to load. In this case, we want to load the Font.TGA file. If LoadTGA() returns false for any reason, the if statement will also return false, causing the program to quit with an "initialization failed" message. If you wanted to load a second texture you could use the following code: if ((!LoadTGA(&textures[0],"image1.tga")) || (!LoadTGA(&textures[1],"image2.tga"))) { } After we load the TGA (creating our texture), we build our font, set shading to smooth, set the background color to black, enable clearing of the depth buffer, and select our font texture (bind to it). Lastly we return true so that our program knows that initialization went ok. int InitGL(GLvoid) // All Setup For OpenGL Goes Here { if (!LoadTGA(&textures[0],"Data/Font.TGA")) // Load The Font Texture { return false; // If Loading Failed, Return False } BuildFont(); // Build The Font glShadeModel(GL_SMOOTH); // Enable Smooth Shading glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black Background glClearDepth(1.0f); // Depth Buffer Setup glBindTexture(GL_TEXTURE_2D, textures[0].texID); // Select Our Font Texture return TRUE; // Initialization Went OK } The draw code is completely new :) we start off by creating a variable of type char called token. Token will hold parsed text later on in the code. We have another variable called cnt. I use this variable both for counting the number of extensions supported, and for positioning the text on the screen. cnt is reset to zero every time we call DrawGLScene. We clear the screen and depth buffer and then set the color to bright red (full red intensity, 50% green, 50% blue). at 50 on the x axis and 16 on the y axis we write teh word "Renderer". We also write "Vendor" and "Version" at the top of the screen. The reason each word does not start at 50 on the x axis is because I right justify the words (they all line up on the right side). int DrawGLScene(GLvoid) // Here's Where We Do All The Drawing { char *token; // Storage For Our Token int cnt=0; // Local Counter Variable glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glColor3f(1.0f,0.5f,0.5f); // Set Color To Bright Red glPrint(50,16,1,"Renderer"); // Display Renderer glPrint(80,48,1,"Vendor"); // Display Vendor Name glPrint(66,80,1,"Version"); // Display Version Now that we have text on the screen, we change the color to orange, and grab the renderer, vendor name and version number from the video card. We do this by passing GL_RENDERER, GL_VENDOR & GL_VERSION to glGetString(). glGetString will return the requested renderer name, vendor name and version number. The information returned will be text so we need to cast the return information from glGetString as char. All this means is that we tell the program we want the information returned to be characters (text). If you don't include the (char *) you will get an error message. We're printing text, so we need text returned. We grab all three pieces of information and write the information we've grabbed to the right of the previous text. The information we get from glGetString(GL_RENDERER) will be written beside the red text "Renderer", the information we get from glGetString(GL_VENDOR) will be written to the right of "Vendor", etc. I'd like to explain casting in more detail, but I'm not really sure of a good way to explain it. If anyone has a good explanation, send it in, and I'll modify my explanation. After we have the renderer information, vendor information and version number written to the screen, we change the color to a bright blue, and write "NeHe Productions" at the bottom of the screen :) Of course you can change this to anything you want. glColor3f(1.0f,0.7f,0.4f); // Set Color To Orange glPrint(200,16,1,(char *)glGetString(GL_RENDERER)); // Display Renderer glPrint(200,48,1,(char *)glGetString(GL_VENDOR)); // Display Vendor Name glPrint(200,80,1,(char *)glGetString(GL_VERSION)); // Display Version glColor3f(0.5f,0.5f,1.0f); // Set Color To Bright Blue glPrint(192,432,1,"NeHe Productions"); // Write NeHe Productions At The Bottom Of The Screen Now we draw a nice white border around the screen, and around the text. We start off by resetting the modelview matrix. Because we've been printing text to the screen, and we might not be at 0,0 on the screen, it's a safe thing to do. We then set the color to white, and start drawing our borders. A line strip is actually pretty easy to use. You tell OpenGL you want to draw a line strip with glBegin(GL_LINE_STRIP). Then we set the first vertex. Our first vertex will be on the far right side of the screen, and about 63 pixels up from the bottom of the screen (639 on the x axis, 417 on the y axis). Then we set the second vertex. We stay at the same location on the y axis (417), but we move to the far left side of the screen on the x axis (0). A line will be drawn from the right side of the screen (639,417) to the left side of the screen (0,417). You need to have at least two vertices in order to draw a line (common sense). From the left side of the screen, we move down, right, and then straight up (128 on the y axis). We then start another line strip, and draw a second box at the top of the screen. If you need to draw ALOT of connected lines, line strips can definitely cut down on the amount of code required as opposed to using regular lines (GL_LINES). glLoadIdentity(); // Reset The ModelView Matrix glColor3f(1.0f,1.0f,1.0f); // Set The Color To White glBegin(GL_LINE_STRIP); // Start Drawing Line Strips (Something New) glVertex2d(639,417); // Top Right Of Bottom Box glVertex2d( 0,417); // Top Left Of Bottom Box glVertex2d( 0,480); // Lower Left Of Bottom Box glVertex2d(639,480); // Lower Right Of Bottom Box glVertex2d(639,128); // Up To Bottom Right Of Top Box glEnd(); // Done First Line Strip glBegin(GL_LINE_STRIP); // Start Drawing Another Line Strip glVertex2d( 0,128); // Bottom Left Of Top Box glVertex2d(639,128); // Bottom Right Of Top Box glVertex2d(639, 1); // Top Right Of Top Box glVertex2d( 0, 1); // Top Left Of Top Box glVertex2d( 0,417); // Down To Top Left Of Bottom Box glEnd(); // Done Second Line Strip Now for something new. A wonderful GL command called glScissor(x,y,w,h). What this command does is creates almost what you would call a window. When GL_SCISSOR_TEST is enabled, the only portion of the screen that you can alter is the portion inside the scissor window. The first line below creates a scissor window starting at 1 on the x axis, and 13.5% (0.135...f) of the way from the bottom of the screen on the y axis. The scissor window will be 638 pixels wide (swidth-2), and 59.7% (0.597...f) of the screen tall. In the next line we enable scissor testing. Anything we draw OUTSIDE the scissor window will not show up. You could draw a HUGE quad on the screen from 0,0 to 639,480, and you would only see the quad inside the scissor window, the rest of the screen would be unaffected. Very nice command! The third line of code creates a variable called text that will hold the characters returned by glGetString(GL_EXTENSIONS). malloc(strlen((char *)glGetString(GL_EXTENSIONS))+1) allocates enough memory to hold the entire string returned +1 (so if the string was 50 characters, text would be able to hold all 50 characters). The next line copies the GL_EXTENSIONS information to text. If we modify the GL_EXTENSIONS information directly, big problems will occur, so instead we copy the information into text, and then manipulate the information stored in text. Basically we're just taking a copy, and storing it in the variable text. glScissor(1 ,int(0.135416f*sheight),swidth-2,int(0.597916f*sheight)); // Define Scissor Region glEnable(GL_SCISSOR_TEST); // Enable Scissor Testing char* text=(char*)malloc(strlen((char *)glGetString(GL_EXTENSIONS))+1); // Allocate Memory For Our Extension String strcpy (text,(char *)glGetString(GL_EXTENSIONS)); // Grab The Extension List, Store In Text Now for something new. Lets pretend that after grabbing the extension information from the video card, the variable text had the following string of text stored in it... "GL_ARB_multitexture GL_EXT_abgr GL_EXT_bgra". strtok(TextToAnalyze,TextToFind) will scan through the variable text until it finds a " " (space). Once it finds a space, it will copy the text UP TO the space into the variable token. So in our little example, token would be equal to "GL_ARB_multitexture". The space is then replaced with a marker. More about this in a minute. Next we create a loop that stops once there is no more information left in text. If there is no information in text, token will be equal to nothing (NULL) and the loop will stop. We increase the counter variable (cnt) by one, and then check to see if the value in cnt is higher than the value of maxtokens. If cnt is higher than maxtokens we make maxtokens equal to cnt. That way if the counter hits 20, maxtokens will also equal 20. It's an easy way to keep track of the maximum value of cnt. token=strtok(text," "); // Parse 'text' For Words, Seperated By " " (spaces) while(token!=NULL) // While The Token Isn't NULL { cnt++; // Increase The Counter if (cnt>maxtokens) // Is 'maxtokens' Less Than 'cnt' { maxtokens=cnt; // If So, Set 'maxtokens' Equal To 'cnt' } So we have stored the first extension from our list of extensions in the variable token. Next thing to do is set the color to bright green. We then print the variable cnt on the left side of the screen. Notice that we print at 0 on the x axis. This should erase the left (white) border that we drew, but because scissor testing is on, pixels drawn at 0 on the x axis wont be modified. The border can't be drawn over. The variable is drawn on the far left side of the screen (0 on the x axis). We start drawing at 96 on the y axis. To keep all the text from drawing to the same spot on the screen, we add (cnt*32) to 96. So if we are displaying the first extension, cnt will equal 1, and the text will be drawn at 96+(32*1) (128) on the y axis. If we display the second extension, cnt will equal 2, and the text will be drawn at 96+(32*2) (160) on the y axis. Notice I also subtract scroll. When the program first runs, scroll will be equal to 0. So our first line of text is drawn at 96+(32*1)-0. If you press the DOWN ARROW, scroll is increased by 2. If scroll was 4, the text would be drawn at 96+(32*1)-4. That means the text would be drawn at 124 instead of 128 on the y axis because of scroll being equal to 4. The top of our scissor window ends at 128 on the y axis. Any part of the text drawn from lines 124-127 on the y axis will not appear on the screen. Same thing with the bottom of the screen. If cnt was equal to 11 and scroll was equal to 0, the text would be drawn at 96+(32*11)-0 which is 448 on the y axis. Because the scissor window only allows us to draw as far as line 416 on the y axis, the text wouldn't show up at all. The final result is that we end up with a scrollable window that only allows us to look at 288/32 (9) lines of text. 288 is the height of our scissor window. 32 is the height of the text. By changing the value of scroll we can move the text up or down (offset the text). The effect is similar to a movie projector. The film rolls by the lens, and all you see is the current frame. You don't see the area above or below the frame. The lens acts as a window similar to the window created by the scissor test. After we have drawn the current count (cnt) to the screen, we change the color to yellow, move 50 pixels to the right on the x axis, and we write the text stored in the variable token to the screen. Using our example above, the first line of text displayed on the screen should look like this: 1 GL_ARB_multitexture glColor3f(0.5f,1.0f,0.5f); // Set Color To Bright Green glPrint(0,96+(cnt*32)-scroll,0,"%i",cnt); // Print Current Extension Number After we have drawn the current count to the screen, we change the color to yellow, move 50 pixels to the right on the x axis, and we write the text stored in the variable token to the screen. 1 GL_ARB_multitexture glColor3f(1.0f,1.0f,0.5f); // Set Color To Yellow glPrint(50,96+(cnt*32)-scroll,0,token); // Print The Current Token (Parsed Extension Name) After we have displayed the value of token on the screen, we need to check through the variable text tosee if any more extensions are supported. Instead of using token=strtok(text," ") like we did above, we replace text with NULL. This tells the command strtok to search from the last marker to the NEXT space in the string of text (text). In our example above ("GL_ARB_multitexturemarkerGL_EXT_abgr GL_EXT_bgra") there will now be a marker after the text "GL_ARB_multitexture". The line below will start search FROM the marker to the next space. Everything from the marker to the next space will be stored in token. token should end up being "GL_EXT_abgr", and text will end up being "GL_ARB_multitexturemarkerGL_EXT_abgrmarkerGL_EXT_bgra". Once strtok() has run out of text to store in token, token will become NULL and the loop will stop. token=strtok(NULL," "); // Search For The Next Token } After all of the extensions have been parsed from the variable text we can disable scissor testing, and free the variable text. This releases the ram we were using to hold the information we got from glGetString(GL_EXTENSIONS). The next time DrawGLScene() is called, new memory will be allocated. A fresh copy of the information returned by glGetStrings(GL_EXTENSIONS) will be copied into the variable text and the entire process will start over. glDisable(GL_SCISSOR_TEST); // Disable Scissor Testing free (text); // Free Allocated Memory The first line below isn't necessary, but I thought it might be a good idea to talk about it, just so everyone knows that it exists. The command glFlush() basically tells OpenGL to finish up what it's doing. If you ever notice flickering in your program (quads disappearing, etc). Try adding the flush command to the end of DrawGLScene. It flushes out the rendering pipeline. You may notice flickering if you're program doesn't have enough time to finish rendering the scene. Last thing we do is return true to show that everything went ok. glFlush(); // Flush The Rendering Pipeline return TRUE; // Everything Went OK } The only thing to note in KillGLWindow() is that I have added KillFont() at the end. That way whenever the window is killed, the font is also killed. } CreateGLWindow(), and WndProc() are the same. The first change in WinMain() is the title that appears at the top of the window. It should now read "NeHe's Extensions, Scissoring, Token & TGA Loading Tutorial"'s Token, Extensions, Scissoring & TGA Loading Token, Extensions, Scissoring & TGA Loading Tutorial",640,480,16,fullscreen)) { return 0; // Quit If Window Was Not Created } } The code below checks to see if the up arrow is being pressed if it is, and scroll is greater than 0, we decrease scroll by 2. This causes the text to move down the screen. if (keys[VK_UP] && (scroll>0)) // Is Up Arrow Being Pressed? { scroll-=2; // If So, Decrease 'scroll' Moving Screen Down } If the down arrow is being pressed and scroll is less than (32*(maxtokens-9)) scroll will be increased by 2, andd the text on the screen will scroll upwards. 32 is the number of lines that each letter takes up. Maxtokens is the total amount of extensions that your video card supports. We subtract 9, because 9 lines can be shown on the screen at once. If we did not subtract 9, we could scroll past the end of the list, causing the list to scroll completely off the screen. Try leaving the -9 out if you're not sure what I mean. if (keys[VK_DOWN] && (scroll<32*(maxtokens-9))) // Is Down Arrow Being Pressed? { scroll+=2; // If So, Increase 'scroll' Moving Screen Up } } } } // Shutdown KillGLWindow(); // Kill The Window return (msg.wParam); // Exit The Program } I hope that you found this tutorial interesting. By the end of this tutorial you should know how to read the vendor name, renderer and version number from your video card. You should also know how to find out what extensions are supported on any video card that supports OpenGL. You should know what scissor testing is, and how it can be used in OpenGL projects of your own, and lastly, you should know how to load TGA Images instead of Bitmap Images for use as textures. If you find any problems with the tutorial, or you find the information to hard to understand, let me know. I want the tutorials to be the best they can be. Your feedback is important! GLut Code For This Lesson. ( Conversion by Ashley Harvey ) * DOWNLOAD JoGL Code For This Lesson. ( Conversion by Abdul Bezrati ) * DOWNLOAD LCC Win32 Code For This Lesson. ( Conversion by Robert Wishlaw ) * DOWNLOAD Linux Code For This Lesson. ( Conversion by Jay Groven ) * 23Lesson 25 > NeHe™ and NeHe Productions™ are trademarks of GameDev.net, LLC OpenGL® is a registered trademark of Silicon Graphics Inc.
http://nehe.gamedev.net/tutorial/tokens_extensions_scissor_testing_and_tga_loading/19002/
CC-MAIN-2014-42
refinedweb
6,257
72.46
Details - Type: Bug - Status: Closed - Priority: Major - Resolution: Won't Fix - Affects Version/s: JRuby 1.1.5 - Fix Version/s: None - Component/s: Java Integration - Labels:None - Number of attachments : Description irb(main):001:0> require 'rake' require 'rake' => true irb(main):002:0> import 'java.net.URL' import 'java.net.URL' => ["java.net.URL"] irb(main):003:0> URL URL NameError: uninitialized constant URL from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/ruby-token.rb:46:in `const_missing' from /home/phil/bin/jruby-1.1.5/lib/ruby/gems/1.8/gems/rake-0.8.3/lib/rake.rb:2465:in `const_missing' from (irb):4:in `irb_binding' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/workspace.rb:53:in `eval' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/workspace.rb:81:in `evaluate' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/context.rb:219:in `evaluate' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:150:in `eval_input' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:259:in `signal_status' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:147:in `eval_input' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/ruby-lex.rb:244:in `each_top_level_statement' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/ruby-lex.rb:230:in `loop' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/ruby-lex.rb:230:in `each_top_level_statement' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/ruby-lex.rb:229:in `catch' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb/ruby-lex.rb:229:in `each_top_level_statement' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:146:in `eval_input' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:70:in `start' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:69:in `catch' from /home/phil/bin/jruby-1.1.5/lib/ruby/1.8/irb.rb:69:in `start' from /home/phil/bin/jruby-1.1.5/bin/jirb:19Maybe IRB bug!! irb(main):004:0> Activity Tracking this in Rake as well. If it doesn't get moved in Rake, we could either: (0) - fix it in the copy of rake that gets bundled with JRuby (but this will break if rake gets upgraded) or (1) deprecate import in favour of import_java? Rake is very widely-used for testing, so telling people to use "import" when it will break in their tests seems questionable. For those of you playing from home, using 'java_import' instead of 'import' gets around this issue with Rake. Thanks Andy - that was the solution - and I'm up and running. Marking WONTFIX. Just an unfortunate coincidence, and java_import gets around it neatly. By the way, if you are building Rails project, and you use Google's appengine-jruby SDK, then Rake will stop working on you - because of this issue. In appengine-ruby they use 'import' to take Java classes, and this confuses Rake and it fails. I mean, even 'rake routes' will not work. (So somebody tell appengine-jruby folks to use java_import instead). My point is, maybe 'import' should be deprecated in favour of 'java_import', to avoid this type of problem. Valters: I agree...and there's actually a bug for that. I am encouraging people to use java_import as much as I can (and when I can remember) but mentioning that the shortcut "import" exists with caveats. Perhaps we should actually have a deprecation warning go out in 1.4? Can't believe I didn't realize this sooner: rake defines Object#import. Ouch!
http://jira.codehaus.org/browse/JRUBY-3171
CC-MAIN-2014-10
refinedweb
655
53.78
With the availability of a sneak preview version of SAP’s Web Application Server 2004s, one might wonder what kind of new gadgets will be available for us developers starting with this release. As Thomas Jung already pointed out in his blog, SAP has started to ship its latest incarnation of Web Dynpro in the ABAP realm with this new release. This is the first of a series of blogs that will delve into the depths of dynamic programming. It will focus on accessing, reading, deleting and changing objects that reside within a Web Dynpro component. Specifically, it will cover topics like changing the layout of a view and the structure of the context as well as the dynamic embedding of other components and the creation of popup windows at runtime. Since any form of dynamic programming involves handling objects one would rarely come across during developing applications with the workbench, we first need to take a look at the purpose of these objects and how they relate to each other. A Short Introduction to Dynamic Programming Dynamic programming mostly accesses objects of a component at runtime. So for a start lets do a quick recap on how a component is structured. It basically consists of a number of different controllers and a ComponentInterface. The three most often used controllers are the ComponentController, ViewController and WindowController. There are also a few more types of controllers, such as the Interface-, Configuration-, Custom- and WindowController. To simplify things a bit, I will be using the terms “view” and “window” instead of ViewController and WindowController. It is possible to access many of these objects at runtime and to change them as well as other referenced objects. As an example, a developer can change the layout of a view within method wdDoModifyView, since the view is the owner of the layout of a certain screen area. For this purpose, the interface of method wdDoModifyView provides a parameter called VIEW, which is a reference to an object of type IF_WD_VIEW representing the instance of a view at runtime. I am often getting asked questions like Which objects can be modified at runtime? or Which interfaces are public?. Well, to give a short answer developers are free to use the following interfaces to their advantage: - IF_WD_APPLICATION - IF_WD_ACTION - IF_WD_COMPONENT - IF_WD_COMPONENT_USAGE - IF_WD_COMPONENT_USAGE_GROUP - IF_WD_CONTEXT - IF_WD_CONTROLLER - IF_WD_EVENT - IF_WD_MESSAGE_MANAGER - IF_WD_OVS - IF_WD_PORTAL_INTEGRATION - IF_WD_VIEW - IF_WD_VIEW_CONTROLLER - IF_WD_WINDOW - IF_WD_WINDOW_MANAGER From their names you might already guess what kind of objects they represent or what their purpose is. In addition to the all those different interfaces, there is also the possibility to call static methods on certain public classes. The celebrities are: - CL_WD_UTILITY - CL_WD_DYNAMIC_TOOL - CL_WD_RUNTIME_SERVICES Don’t be scared. I will focus on each of these classes and interfaces in great detail in upcoming parts of this blog series, but I have got to mention them here so you know what lays ahead and to give you an overview. Once those other blogs will be online, I will update this one and turn the names into links. I hope, you understand that we would otherwise get sidetracked completely. So let’s move on to… The ViewElement Any layout of any Web Dynpro application is comprised of one or more views that contain View Elements. On each view, they are arranged within a tree-like structure. The root of such a tree is a TransparentContainer called ROOTUIELEMENTCONTAINER. Whenever you create a view in the Workbench, this container will be created as well. ViewElements can roughly be separated into two different categories – those that can be placed on screen (e.g. a Button) and those that can only be used within other ViewElements, such as a Column within a Table. ViewElements from this first category are as well called UIElement. ViewElements from the second category do not have a special name, but can be of one of two very important specializations: Layout and LayoutData. An important specialization of UIElements are UIElementContainers (or in short containers). Those are able to aggregate other UIElements and thus display them inside of a certain screen area. You might wonder how those UIElements are arranged within such the container. Will they be displayed in a single line next to each other, within multiple rows or even within a grid? As you might have already guessed, that’s what the Layout is used for. So every container also aggregates a Layout ViewElement. A FlowLayout i.e. arranges contained UIElements in a single row whereas a developer can set properties to influence i.e. if such a row should wrap to the next line at the right border of a window. By default, the RootUIElementContainer contains a FlowLayout, but this can be changed by a developer at any time. Every UIElement contains a LayoutData. Its type has to fit to the kind of Layout the container aggregates. For a FlowLayoutData this would a FlowLayout. Did you recognize the naming convention? It is always “Layout” or “LayoutData” with the same prefix for the same kind of layout. A LayoutData describes how a UIElement will be arranged within the layout of a container, such as if it starts in a new line or what kind of padding is used. Since a picture can tell more than a thousand words, I would like to provide you with a class diagram that describes the information presented above. A quick question for those who are not yet dizzy from reading all those technical background information: Is it possible to display a container within another container and if yes, why is it possible? The answer is: Yes, because a UIElementContainer aggregates UIElements and the UIElementContainer is derived from it. You might wonder if Web Dynpro ABAP differs from Web Dynpro Java in its UI element model. This is not the case. Although there are a few very rare platform dependent differences (e.g. there is no type available in ABAP to represent a mime object for a FileDownload/-Upload), especially the basics, which are covered in this blog, are exactly the same. Aside from the model, the implementation had to be adopted to the ABAP platform and thus names had to be shortened to fit 30 characters and since mixed case for identifiers is not supported, the resulting name of classes and interfaces uses underscore characters instead of camelcase syntax. So the names of the classes that represent the above mentioned ViewElements are as follows: - ViewElement -> CL_WDR_VIEW_ELEMENT - UIElement -> CL_WD_UI_ELEMENT - UIElementContainer -> CL_WD_UI_ELEMENT_CONTAINER - Layout -> CL_WD_LAYOUT - LayoutData -> CL_WD_LAYOUT_DATA Now let’s recap for a moment and look at the implications of the above mentioned class hierarchy before we take a closer look at how the model is implemented Web Dynpro ABAP, because understanding this part is crucial for mastering dynamic programming in regards to sucessfully modifying the layout of a view at runtime. Obviously, those classes are expected to be abstract. This means that you will of course have to cast pointers often. On the other hand, since everything that can be placed on screen, is derived from one of those five classes, it also offers you the opportunity to work with generic typed pointers. If you are uncertain about the type of an UI element, use the least generic typed pointer. It will always work. Four of the five classes mentioned above seem to follow a naming convention. They all start with CL_WD_ followed by the actual name of the ViewElement. You can apply this scheme to all other ViewElements as well. So, if you want to use a button, the class in question will be CL_WD_BUTTON. But why is CL_WDR_VIEW_ELEMENT an exception to this rule? The reason is that all classes derived from CL_WDR_VIEW_ELEMENT are generated and CL_WD_* is their namespace. Do you remember my earlier comment about Web Dynpro ABAP and Web Dynpro Java having the same UI model? Both platforms generate their objects from exactly the same centrally maintained model that was designed by using UML and Rational Rose as a tool. The class diagram shown above was copied from there. That’s all so far concerning the very basics of ViewElements. There are more aspects to be covered, such as aggregations, events and context binding, but those will be explained in detail due course of the upcoming parts of this blog series. The next part will deal with accessing ViewElements, creating/deleting them and setting properties. Of course, all this will be done at runtime. In contrast to all the necessary theory described in this blog, the next part will as well provide coding examples for each subtopic. Dynamic Programming is afterall what separates the hackers from the artists. 🙂 More seriously, dynamic UI programming is a critical part of real-world applications. It is also something that is painfully difficult to do in classic Dynpro. It is just one more reason to get excited about the brave new world that is WebDynpro. I am still playing around with the 2004s Sneak Preview, which I installed on my laptop. If possible, I will copy the examples to it and export them again as a transport request to make them available for download – but no promise on that as I am still a noob when it comes to admin a SAP system. 🙂 Hi Thomas, I have a requirement in which I wish to create a dynamic table which I could do.. I also wish to display this table on the screen in module pool. Is there any way of doing this or it is not possible to do this in module pool? Please help. Thanks and Regards. Piyush R. S. Hi Piyush, I am not sure that I understand your question. In Web Dynpro there are no module pools. Perhaps a good idea to have your question answered quickly is to post it to the Web Dynpro ABAP forums here in SDN. There, your question would be handled within a dedicated thread where further questions can be answered quite easily without loosing context. Moreover, this old blog post here is not monitored as good as the forums. Over there you have the shared knowledge of many more people. Best regards, Thomas Hi Thomas, Sorry to post the question at wrong place. Actually my question was regarding module pool only. Regarding the Web Dynpro, my understanding is we can create a TABLE UI element which may have dynamic structure. This dynamic TABLE ( and the structure of Table itself is dynamic) UI creation is possible using some class in web Dynpro. This programming is done in the views that we create in Web Dynpro. I assumed the screens in module pool analogues to the views in Web Dynpro. And with this assumption I thought of using the class for the dynamic TABLE UI creation in the module pool screens. But it seems views are quite more powerful compared to the screen in module pool. I could achieve the development I want using the custom control in module pool screen and then using the editable ALV in the same. the ALV columns, I could make dynamic. I still have one question, just for the knowledge purpose. I am creating a custom controller using the class “cl_gui_custom_container”. Do you think there is a possibility of using the class we use to create a TABLE UI element to create a table on the screen in module pool? Thanks and Regards. Piyush R. Sakharkar. Hello Piyush, classic dynpro based screens and Web Dynpro are two fully separate technologies. It is not possible to mix them. Hope, the answer helps. Best regards, Thomas Great Blog. I’m waiting for the next parts. It gave me a basic idea of Dynamic Programming and also i come to know about some important classes. Thank u janakiram glad that you liked it. Expect more to come now that I have a little more time on my hands. Best regards, Thomas
https://blogs.sap.com/2005/12/28/dynamic-programming-in-web-dynpro-abap-introduction-and-part-i-understanding-ui-elements/
CC-MAIN-2018-13
refinedweb
1,969
62.58
I'm experimenting with using cagradientlayer to draw gradients in our app instead of having a subclass of uiview manage gradients. One snafu that i've come across is that when the view that has the gradient as a sublayer of its main layer gets resized to fit the data i am trying to show, the layer doesn't resize along with it. I end up having the gradient layer end at the original frame size I am getting the following debugger error when I encounter a breakpoint on the device: Error from Debugger: Previous frame inner to this frame (gdb could not unwind past this frame) This occurs when the app hits a breakpoint. If I hit the continue button in the debugger, it continues happily until the next breakpoint, when it pops up the same issue. What doe I've got a frame by frame animation of a character that snaps it's fingers. I'd like to apply the snapping mp3 clip to frame 2 of the animation. I think I see how it should be done, but I'm stuck. Here's the animation: darnAn = new AnimationDrawable(); darnAn.addFrame(getResources().getDrawable(R.drawable.snap1), 2400); darnAn.addFrame(getResources().get I'm looking for a way to view HTML5 <video>, frame-by-frame. <video> The scenario: Having a video, with an additional button that skips to the next frame when pressed. What do you think is the best method to do this? timeUpdate import javax.swing.*;import java.awt.*;import java.awt.event.*;import java.sql.*;public class Prhr extends JFrame implements ActionListener,ItemListener{ JLabel l1; JLabel l2; JTextField ar; JTextField t; JButton b1; JButton b2; JButton b3,b4; JComboBox c1,c2; JLabel l3; Co In one of my application I need to know the map between frame position (frame number) and actual frame sample time for a given video file.I'm using Directshow SampleGrabber filter in callback mode. I'm overriding BufferCB method of ISampleGraberCB class, whenever the callback is called, I'm mapping the arrived sampletime to frame position in a map. Frame position is incremented whenever If a page has multiframes & multiple pages are loaded how to select a particulart frame page to debug or see the html source through IE Developer tool. I need this for running a jquery script using the console tab, against particular page in a frame how to do that in IE developer toolbar. Regards,Umesh V Basically I want to call JasperViewer from a button on my Main Application.I use this JasperViewer private void btnExportActionPerformed(java.awt.event.ActionEvent evt) { try { JasperPrint printer = JasperFillManager.fillReport(getClass().getResourceAsStream("reportRecharge.jasper"), params, new JREmptyDataSource()); JasperView I'm trying to use V4L2 api to enumertate supported frame size and frame rate of webcam device. I try to do it with the following code without success. The ioctl function always returns -1. #include <stdio.h>#include <fcntl.h>#include "linux/videodev2.h"int main(int argc, char **argv) { int fd = open("/dev/video0", O_RDWR); struct v4 Below is bit format for FC field for QoS Data: 00|01|0001 01000010 The first 2 bits represent version, the next 2 bits type, the next 4 bits subtype, with ToDS=0, FromDS=1,Protection bit=1. So, in what order is the above data sent through the interface on the air? (i.e left to right or right to left ) I see the wireshark catching
http://bighow.org/tags/Frame/1
CC-MAIN-2017-09
refinedweb
573
52.39
Inline::CPP - Write Perl subroutines and classes in C++. use Inline CPP; print "9 + 16 = ", add(9, 16), "\n"; print "9 - 16 = ", subtract(9, 16), "\n"; __END__ __CPP__ int add(int x, int y) { return x + y; } int subtract(int x, int y) { return x - y; } The Inline::CPP module allows you to put C++ source code directly "inline" in a Perl script or module. You code classes or functions in C++, and you can use them as if they were written in Perl. Inline::CPP just parses your C++ code and creates bindings to it. Like Inline::C, you will need a suitable compiler the first time you run the script. Choosing a C++ compiler can prove difficult, because Perl is written in C, not C++. Here's the rule: use any. Inline::CPP is very similar to Inline::C.: Example 1: use Inline CPP => <<'END'; int doodle() { } class Foo { public: Foo(); ~Foo(); int get_data() { return data; } void set_data(int a) { data = a; } private: int data; }; Foo::Foo() { cout << "creating a Foo()" << endl; } Foo::~Foo() { cout << "deleting a Foo()" << endl; } END After running the code above, Perl's namespace (and anyway, C++ wouldn't let you do that either, since extrafield wasn't defined). For information on how to specify Inline configuration options, see Inline. This section describes each of the configuration options available for C. Most of the options correspond either the MakeMaker or XS options of the same name. See ExtUtils::MakeMaker and perlxs. Adds a new entry to the end of the list of alternative libraries to bind with. MakeMaker will search through this list and use the first entry where all the libraries are found. use Inline Config => ALTLIBS => '-L/my/other/lib -lfoo'; See also the LIBS config option, which appends to the last entry in the list. Specifies extra statements to be automatically included. They will be added on to the defaults. A newline char will automatically be added. use Inline Config => AUTO_INCLUDE => '#include "something.h"'; Specifies code to be run when your code is loaded. May not contain any blank lines. See perlxs for more information. use Inline Config => BOOT => 'foo();'; Specifies which compiler to use. Specifies extra compiler flags. Corresponds to the MakeMaker option. Config => FILTERS => [Strip_POD => \&myfilter]; The filter may do anything. The code is passed as the first argument, and it returns the filtered code. Specifies extra include directories. Corresponds to the MakeMaker parameter. use Inline Config => INC => '-I/my/path'; Specifies the linker to use. Specifies. If you want to add a new element to the list of possible libraries to link with, use the Inline::CPP configuration ALTLIBS. Specifies the name of the 'make' utility to use. Specifies a user compiled object that should be linked in. Corresponds to the MakeMaker parameter. use Inline Config => MYEXTLIB => '/your/path/something.o'; Specifies a prefix that will automatically be stripped from C++ functions when they are bound to Perl. Less useful than in C, because C++ mangles its function names so they don't conflict with C functions of the same name. use Inline Config => PREFIX => 'ZLIB_'; This only affects C++ function names, not C++ class names or methods. Config => PRESERVE_ELLIPSIS => 1; or use Inline Config => ENABLE => PRESERVE_ELLIPSIS; For an example of why PRESERVE_ELLIPSIS is normally not needed, see the examples section, below. By default, Inline::CPP includes iostream.h at the top of your code. This option makes it include iostream instead, which is the ANSI-compliant version of the header. Usually, these include files are not compatible with one another. use Inline CPP => Config => ENABLE => STD_IOSTREAM; Specifies whether to bind C structs into Perl using Inline::Struct. NOTE: Support for this option is experimental. Inline::CPP already binds to structs defined in your code. Config => STRUCTS => 0; Disables binding structs to Perl. Overrides any other settings. See Inline::Struct for more details about how Inline::Struct binds C structs to Perl. Specifies extra typemap files to use. These types will modify the behaviour of C++ parsing. Corresponds to the MakeMaker parameter. use Inline Config => TYPEMAPS => '/your/path/typemap';. Here are some examples.; }.. :) Everyone who learns; };: Use Perl version 5.6.0 or better; or, Move the definition outside the class.: Use Perl version 5.6.0 or better; or, Make the strange expression a constant or macro and use that.. For information on using C with Perl, see Inline::C and Inline::C-Cookbook. For WMTYEWTK, see perlxs, perlxstut, perlapi, and perlguts.: templates operator overloading function overloading Other grammar problems will probably be noticed quickly. support for overloaded functions and methods binding to constants and constant #defines binding to unions autogenerated get/set methods on public members Neil Watkiss <NEILW@cpan.org> Brian Ingerson <INGY@cpan.org> is the author of Inline, Inline::C and Inline::CPR. He is known in the innermost Inline circles as "Batman". ;) All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself. See
http://search.cpan.org/~neilw/Inline-CPP-0.25/lib/Inline/CPP.pod
crawl-002
refinedweb
834
68.47
By: James Buchanan Abstract: Part 1 of a new series of network programming for Unix, Linux, and other operating systems. By James Buchanan If you've ever tried to write a network application of kind and have been discouraged, do not despair: Here I present the first of a series of articles focusing on practical network programming -- specifically for UNIX. That's not to say your new knowledge will be useless on other operating systems. In fact the core networking API is pretty much the same across all platforms. You will see them in any operating system with a C library of networking functions: socket, listen, accept, bind, send, and recv. Sometimes recv is #defined as read, and sometimes send is #defined as write -- the details can differ but the overall approach is the same. You don't have to use C. You can use Perl if you want, or Java, or any other language of sufficient power to write network programs. I will use C in these articles, partly because I've been using C for a long time, partly because C is the language of UNIX, and partly because most programmers know something about C. So I assume that you have a basic working knowledge of the C language: how to write functions, how to handle files, how to use the control structures, what a struct is, when to use the dot and hyphen-arrow operators, what a pointer is and what include files are. You should also have a conceptual appreciation of the Internet and some of its common lingo: IP address, server, client, and port. Basic stuff. Computer science authors go to great pains to tell you how many of their previous books you will need to read before you can write network programs, and how you need to know every last detail of the networking protocols as a prerequisite. What a load of garbage! A basic conceptual understanding of common network ideas and a knowledge of a suitable programming language is all you need to get a leg up on some serious, useful network programming. Nobody writes useless toy applications that talk over networks, or stupid "Hello World" network applications, when they need to get a job done. If you're working for a Web development company you will probably be called upon to write a program that gives a Website shopping cart functionality, a chat system, message boards pages, an online auction system, user/password login functionality, or any number of other e-commerce facilities. The network programming in these articles will focus on practical applications that are useful and have a leaning toward e-commerce. Maybe you'll go on to write some great e-commerce software and earn a nice living at it. Here is a brief rundown of the series I have planned. I won't go into too much detail here because if I know myself, and I do, I will change my mind about a few things down the track! But I do promise that we will cover these topics: We will also dissect heaps of real, practical code, including an echo client and server which I will use to illustrate common networking functions. Then we'll move on to more useful programs: a chat server and client, a multi-tier Website auction system, an e-mail client and server, and finally we'll have some fun and implement a real, working Web server and browser. We'll also dabble in some object-oriented Java network programming. So without further ado, let's go! A graphic would be in order here. No doubt you know what happens (or can guess correctly) in a simple client-server model, but let's have a look anyway. This diagram illustrates what happens in the echo client and server: You will use a handful of common networking functions in virtually all network client-server programs you write. They are: You will also use a socket address structure, a sockaddr_in. It is an IPv4 socket address structure, also known as an "Internet socket address structure." It contains -- suprise suprise -- the socket's address. It also holds the port number, the family of socket, the length (or size) of the structure itself, and an unused array of 8 characters. It's used directly in C programs, and indirectly in high level languages. sockaddr_in is a C struct. More about how to use it in the next article in this series. Now on to the functions. I would like you to have copies of the echo client and server source code with you as you read through these introductory articles, The source files will help put things in place and assist in a conceptual understanding of the socket address structure and the network functions. This is the level of understanding we want; after all, we could waste a good few years getting a deep understanding of the guts of the networking APIs, hacking networking protocols, and looking at kernel source code -- and in the process never get any useful network programming done. Or we can be happy with our conceptual, practical understanding and write some killer network apps. OK let's rock! Get the source for the echo client and server here. The socket function gets a socket descriptor for you, which is like a handle and similar to a file descriptor. It is the first function you will call in the networking part of your programs. A socket is an endpoint of communication through which applications can talk to each other. The socket function is prototyped like this: #include <sys/socket.h> int socket(int family, int type, int protocol); The protocol family parameter is normally the constant AF_INET (IPv4). For IPv6 we'd use AF_INET6. For UNIX domain protocols it is AF_LOCAL (also known as. AF_UNIX), for routing sockets AF_ROUTE, and for key sockets AF_KEY. We will be using only AF_INET and AF_INET6 in this series of articles. The protocol type parameter is normally SOCK_STREAM. You might also encounter SOCK_DGRAM (datagram socket) and SOCK_RAW (raw socket), but we won't be using these. The protocol parameter is almost always set to 0 (zero, not the capital letter O), except for raw sockets, which as mentioned we won't be using. The bind function is prototyped as follows: #include <sys/socket.h> int bind(int socket_fd, const struct sockaddr *myaddress, socklen_t address_length); The bind function exists to assign a local protocol address to a socket, which is a combination of an IPv4 or v6 address and a port number. It is dependent upon the protocol used. Let's not worry about the boring details -- it's time to move on. The first parameter is the socket descriptor that the call to the socket function would have returned, if it succeeded. The second parameter is a pointer to a protocol-specific address structure, our friend the struct sockaddr_in for IPv4. (We'll talk more about initializing our address structure a bit later. As it happens, we can specify to bind just an address, just a port number, or neither, passing this job to the kernel. Since TCP has well known port numbers, we'll be specifying the port.) The third and last parameter is the size of the address structure, which we give by passing sizeof(whatever-its-name-is). This is the prototype of the listen function: #include <sys/socket.h> int listen(int socket_fd, int backlog); The first parameter is our socket descriptor. listen is normally called after socket and bind but must be called before accept. The function causes the program to put its ear on the network, so to speak, and listen for incoming requests from clients that wish to establish a connection. Clients can and do call listen as well, as we shall see in a later article. The second parameter -- backlog -- is a funny one. If you ever get interested in the guts of networking and study it in detail, you will see that documentation is often a little vague about backlog. For our purposes, and for most people's purposes, it means the number of connections that the kernel will queue up. This definition is more than adequate. A simple server, or a useless one like a daytime server, may have a backlog of just 5. A busy HTTP Web server serving up millions of Web pages a day will have a larger backlog. Some Unix and Linux kernels #define it as 5, while actually supporting many more connections. So we will use a constant, LISTENQ, which is 1024. The connect function is prototyped as: #include <sys/socket.h> int connect(int socket_fd, const struct sockaddr *server_address, socklen_t address_length); The accept function is prototyped as: #include <sys/socket.h> int accept(int socket_fd, struct sockaddr *client_address, socklen_t address_length); The first parameter is the server's socket descriptor, the second is a pointer to an address structure containing details about the client, and the third is the size of the client address structure, again using sizeof(whatever-we-call-it-in-our-code). recv is prototyped as: #include <sys/socket.h> ssize_t recv(int socket_fd, void *buffer, size_t buffer_size, int flags); send is prototyped as: #include <sys/socket.h> ssize_t send(int socket_fd, const void *buffer, size_t buffer_size, int flags); Finally, in the source we use the bzero function. (You could also use memset). bzero sets the specified number of bytes to zero. It is not essential, but we do it anyway. I think it's good programming practice not to take short cuts, especially when you'd only save a line or two of typing anyway. I will use the dollar sign ($) to represent the shell prompt. $gcc -O -o echoserver1 echoserver1.c $gcc -O -o echoclient1 echoclient1.c $./echoserver1 Now open another shell on the same desktop area, cd to the directory where the programs are and run the client: $./echoclient1 Usage: ./echoclient1 <IP Address> <Message> $./echoclient1 127.0.0.1 "Hello network world" In writing a network client, the core networking API functions you will use, in order, are socket, connect, send/receive, and close. In writing a network server, the core networking API functions you will use, in order, are socket, bind, listen, (start loop), accept, (optional fork or pthread create), send/receive, close. Actually, when an application exits or returns to the operating system the kernel will close any file descriptors that may have been left open, including socket descriptors. The use of close is therefore optional. It is largely a matter of personal programming style. The next article in this series will examine conversion functions such as inet_pton, inet_ntop, ntohs, ntohl, htonl, and htons, plus other functions like gethostbyname, gethostname, getservbyname and getservbyport, among others. We'll also practice with some string-handling functions and write a library of reusable network code that we will use throughout the remainder of this series. If you are a beginner in network programming please e-mail me and tell me anything that could be improved, areas you found difficult, if any, and suggestions you have for helping me to improve these articles. Thanks! Server Response from: SC3
http://edn.embarcadero.com/article/26022
crawl-002
refinedweb
1,860
61.67
There are many utilities that you could create if you would be able to extract the color from a single pixel of a canvas, an interactive color picker etc. This task is relatively easy to achieve using pure javascript without any kind of library. To retrieve the color from a pixel of a specific canvas, we are going to : - Retrieve the location of the mouse event. - Use the coordinates to select the data on the canvas. - Use the RGBA data of the pixel. Let's get started ! Retrieving mouse location on event As there are many possible errors and things that the user could do, we need to be exact as possible, therefore to guarantee that the mouse coordinates are reliable, we are going to retrieve them according to the location of the canvas. Use the following function to retrieve the location of the element (in this case the canvas) , it expects the DOM element as first parameter. However this function will be internally used by the function that is going to retrieve the location of the click. /** * Return the location of the element (x,y) being relative to the document. * * @param {Element} obj Element to be located */ function getElementPosition(obj) { var curleft = 0, curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); return { x: curleft, y: curtop }; } return undefined; } The previous method returns the location (an object with x and y coordinates) of the element given as first parameter (canvas in this case) in the document. Now that we can get the location of the canvas, the following method will be the one that cares about the location of the click on the canvas (or another mouse event attached to the canvas) : /** * return the location of the click (or another mouse event) relative to the given element (to increase accuracy). * @param {DOM Object} element A dom element (button,canvas,input etc) * @param {DOM Event} event An event generate by an event listener. */ function getEventLocation(element,event){ // Relies on the getElementPosition function. var pos = getElementPosition(element); return { x: (event.pageX - pos.x), y: (event.pageY - pos.y) }; } The getEventLocation method return the coordinates (x,y) according to the mouse event (click, mousemove etc) even if the user zooms on the document as the use of the getElementPosition increases the accuracy of the getEventLocation function. Draw image on a canvas (testing purpose) This article assumes that you know how to draw an image on a canvas or you have already something drawn using paths and therefore you want to retrieve the color from a pixel etc. However, if you don't have anything you can use the following function to draw an image (from base64 or internet url) on a canvas : var canvas = document.getElementById("canvas"); /** * Draw an image (from your own domain or base64) * @param {String} sourceurl */ function drawImageFromWebUrl(sourceurl){ var img = new Image(); img.addEventListener("load", function () { // The image can be drawn from any source, the canvas will be filled with the image. canvas.getContext("2d").drawImage(img, 0, 0, img.width, img.height, 0, 0, canvas.width, canvas.height); }); img.setAttribute("src", sourceurl); } Note : you can draw any image if you want, however if the image is not providen from your own domain (yourdomain.com and the image comes from otherdomain.com), then you'll face a problem with the Tainted Canvas error, read more about this problem here. Therefore in our example we're going to use a base64 string instead of a web image. Retrieving pixel data according to the location Now to retrieve the color from a pixel, we are going to use the getImageData method from the context of the canvas and we are going to limit it to 1 pixel (x1,y1) according to the location of a click (or any mouse event that you want) event. The following snippet shows how to retrieve the color from a pixel on the click event of the canvas : Note: you can use a jQuery event listener instead if you want, only be sure to provide the event variable. var canvas = document.getElementById("canvas"); canvas.addEventListener("click",function(event){ // Get the coordinates of the click var eventLocation = getEventLocation(this,event); // Get the data of the pixel according to the location generate by the getEventLocation function var context = this.getContext('2d'); var pixelData = context.getImageData(eventLocation.x, eventLocation.y, 1, 1).data; // If transparency on the pixel , array = [0,0,0,0] if((pixelData[0] == 0) && (pixelData[1] == 0) && (pixelData[2] == 0) && (pixelData[3] == 0)){ // Do something if the pixel is transparent } // Convert it to HEX if you want using the rgbToHex method. // var hex = "#" + ("000000" + rgbToHex(pixelData[0], pixelData[1], pixelData[2])).slice(-6); },false); The pixelData is an UInt8ClampedArray with 4 items ( [0] => red, [1] => green, [2] => blue, [3] => alpha (transparency)). That was , manipulate the color as you want and use it as you want. You can even convert the RGBA to HEX color using the following method if you want : function rgbToHex(r, g, b) { if (r > 255 || g > 255 || b > 255) throw "Invalid color component"; return ((r << 16) | (g << 8) | b).toString(16); } Play with the following fiddle with the above code working. The attached example will draw a base64 image on the canvas and then the listener of mousemove will be attached to it, navigate to the Result tab and test it. Have fun Become a more social person
https://ourcodeworld.com/articles/read/185/how-to-get-the-pixel-color-from-a-canvas-on-click-or-mouse-event-with-javascript
CC-MAIN-2020-05
refinedweb
904
52.7
Patent On Software Downloads Upheld 180 PacketMaster writes: "A U.S. Federal Circuit Court today ordered a lower court to reconsider its ruling on this this patent -- detailing downloading software over a network or the Internet. The full story at news.com details this on-going battle. This latest ruling indicates that the courts consider the patent, filed by a company called E-Data in 1985, a valid patent. E-Data's plan is to charge a license fee for all data downloaded over the Internet. The main companies standing against this patent are Intuit and AOL/Time-Warner's Compuserve division." Yes, E-Data would like to collect on every software download. Slashdot Propoganda (Score:1) A federal appeals court has for the second time breathed life into a patent that could force software vendors to pay licensing fees to sell their products directly over the Internet. This is a helluva lot more accurate than what slashdot does with its: Yes, E-Data would like to collect on every software download There's a HUGE distinction between collecting on selling products over the internet and using FTP. As it stands now, all companies have the right to patent business processes. That's what gives companies competitive edges. If you had invented something don't you believe you have the right to protect that invention? Yes, you have this right, and that right extends even to the invention was a new way of doing business. I'm not sure that News.com wasn't trying to tap into the same vein as Slashdot users or perhaps wanted to use Slashdot to get more hits and knew this type of story would jump right to the front page of slashdot. With so many people use this service to get the "skinny" on what's happening on the net, doesn't the person that writes the caption at least owe an editor's debt to keep the stories honest?? That would only deal with Claim 28 (Score:1) Re:Why this patent will be declared invalid (Score:1) I bet AOL wishes they had thought of it first... (Score:1) Well, this is certainly the type of patent that I'd like to see revoked, and is an excellent case to cite when trying to show weakness in the patent system. But you have to wonder if the shoe was on the other foot, and AOL had this patent, how hard would they be fighting to keep it? Re:Seven years? (Score:3) And I don't think this is retroactive. Patents before some date in 1999 (IIRC) are still 17 years from awarding; anything after is 20 years from filing. Many companies, notably drug makers, used the prior rules, and the fact that they could accidently 'forgot' to fill in paperwork that would keep the patent approval process going, the USPTO charging them a minimal fee ( I think $500.00 ) for this 'late filing' charge. However, during this time, while the patent wasn't granted, the company filing did have some basic protection on the patent, and the patent documents were not public, so an enterprising company could easily get about 22 years of protection for a small incidental fee. Note that the typical time between submission and awarding of a patent is around 2 to 3 years in the first place (assuming that everyone plays by the rules). The new system says that once you've submitted a patent, the 20 year timeline starts ticking. In addition, as soon as it's reasonably possible, the patent document is placed in the public domain (eg USPTO's website), though the company does have protection on it's invention. This still gives companies sufficient protection on their inventions, but does prevent abuses of the system. Going from 17 to 20 years really doesn't drastically extend the protection a patent gives it's owners with the given rules, it simply helps avoid abuses in the system. damn straight! Re:Three words: Pay-per-view (Score:1) I remember distinctly reading about PPV proposals being proposed and tested as early as 1968. There was one partisan who was particularly vilified for broaching the notion at the time ( can't remember the name ). IIRC, the entire controversy was covered quite extensively in (wait for it..) TV GUIDE! How's that for prior art, eh? You *know* the patent system is fscked when.. (Score:1) Re:err, this patent is applicable how? (Score:2) It sounds like what Sam Goody's used to have - where you could pick 6 songs and have a custom made tape in 5 minutes. Put a card in, pick a file, and it spits out a floopy/cd-rom. Howdver, where is the point-of-sale location? I would imagine that it would be at the location of the web server, as that is where the transaction is validated, logged, etc... Bad example... (Score:2) ---------- downloading *is* storing data to some extent (Score:1) Re:Patent enforcement? (Score:1) (essentially, it's an abuse of patent to encourage others to infringe on your patent with the hope of later suing them for all the money they made when they were doing it) Re:Patent enforcement? (Score:1) However, it would probably be kind of tricky, and it would require someone being sued by Unisys to pursue this.... it's probably not going to happen. Maybe here it will. Re:Patent enforcement? (Score:1) Got me. You might as well go ahead and tell. what about java? (Score:1) Hey, if this kill java on the web dead, I'm all for this! -- Re:err, this patent is applicable how? (Score:1) "information in material objects" does. They say "By way of another example, a floppy disk is a material object in which information in the form of programs can be fixed". Now if you can fix information in non-material form, you're fine. -- Re:Patent drafting (Score:1) All of which mention "point of sale". > if you get one of the really narrow claims, you get all of its predecessors too Conversely, if FTP isn't prior art for the broadest claims, it can't be prior art for any of the narrower ones. -- Re:How old is FTP? (Score:3) Sure, it's still a dumb patent that should never have been granted, but it isn't _that_ dumb. -- Re:Coin Slot? (Score:1) Or heck, maybe even something more drastic, like going outside. --- Sensationalism (Score:5) The higher court merely sent the case back to the lower court for reconsideration. It did NOT issue a ruling on whether the patent was valid, only that the lower court should reconsider its original ruling. The words were also twisted in the submission to give it more controversy - for example, the company never claimed that they had any intention of exacting royalties for "every internet download". This was a statement made by the defendants to win favor with the court!! Any patent defense has two strategies - first, you can get the patent declared invalid, and second, you claim that you aren't infringing. This case applies only to the first. There's plenty of battle left ahead on the second point. I doubt they'll ever extort royalties from this. It's very clear after reading the patent that it is, indeed, extremely limited, regardless of the court's interpretations. Re:Link to patent (Score:1) Link to patent (Score:2) Cut and paste link What's important in a patent document (Score:2) I'm downloading [tothink.com] the patent now to take a closer look at the claims. - material objects at a point of sale location (Score:1) since when are downloads "Material objects"!?! And it doesn't apply to all downloads, since a point of sale location really needs something to sell!? But hey what do I know You must be like water, it fits into any container, but it can damage a rock. Re:Prior technology? (Score:1) Re:Link to patent (Score:2) So, it does not apply to the FREE stuff everybody is so fond of downloading... -- Knowledge is, in every country, the surest basis of public happiness. Re:I've got foolproof prior art (Score:2) Even if this person has a valid patent, this is one of those times where, for the good of the world, you have a moral responsibility to just let it go. Well, more like: it shows the patent system (particularly as applied to software and the internet) is invalid, and it's time to just let it go. When I first stated this position I found that, really, a good portion of the readers here didn't agree (usually relying on the "lone inventor" or "drugs are expensive" arguments). But now, hey, after a whole string of these really stupid claims, I think opinion is starting to come around. The next step is to take action. -- Re:err, this patent is applicable how? (Score:1) OK, so let's sum this up: 1. A user submits a request to download something. 2. The remote server sends a request for an authorization code. 3. The user provides the authorization code. 4. Pending authorization, the remote server sends the requested information. How about changing the process a little bit? 1. The user downloads the requested information WITHOUT a prior request for authorization. 2. The user THEN submits a request to purchase - perhaps days after the initial download. 3. User receives a serial number that activates the product. This scheme is used in some software - download a limited version, and upon purchase, you receive a code to unlock all of the features. 22 is low (Score:1) If you really really stretch things, you can file a patent and wait an eternity before it becomse public domain. The USPTO has no trouble collecting that late fee over and over and over again. I don't remember the details, but there is a patent involving machine vision that was filed in the 50's, but only was granted in the last 10-20 years. The original inventor is dead, but the foundation he created to handle his patents is trying to claim that his patents can cover bar-code scanners. If somebody remembers the guy's name, it would be nice to put it up. The guy has a huge collection of patents, and has taken huge advantage of that particular hole in the patent system. That and that they allow unlimited modification of the wording of your patent so long as it is true to the original spirit of the filing (read: remotely close). Re:Prior Art: Kermit, anyone? (Score:1) Re:Seven years? (Score:5) You thought wrong. It had been 17 years, and has been changed to 20 years. So that puts it at 2002 or 2005, depending on when the law was actually changed. But since E-Data has had this in court for years now, they can still try to collect fees retroactively. (Not to say they'll succeed, but they can try.) As the lower court originally decided, this patent appears to apply primarily to kiosk systems. In that context it might be valid. However, the higher court ordered the lower court to "reconsider the scope" of the patent, stating that it should apply to all downloads. This may be a smart move on the court's part, since there was lots of prior art in 1985 regarding information downloads. I was downloading from BITNET then, and the FIDOnet and UUCP networks were alive and well. If the scope is determined to apply to all such downloads the patent can probably be overthrown completely. Or then, the higher court may just be smoking something... Chelloveck Re:Good test of patent system (Score:1) this case refuses!! to die for 16 years now! Re:Information in material objects (Score:1) Heck, soon you'll have bought something just by blinking at it. Interesting: My Thoughts, More Info, and A Mirror (Score:1) Also, the patent was filed in 1973, with a 17 year rule, it's expired (2000), with a 20 year rule, it'll expire in 2 years. Just keep it in court for 2 years! Also, I mirroed the patent description. None of the title pictures or anything, just the acutal text. (links will not work from that page). Located Here [khawproductions.com]. Warning: File size is ~130KB. Standard Caveat of: I am not a lawyer!. Re:Interesting: My Thoughts, More Info, and A Mirr (Score:1) If you read the linked patent you'll see that I typoed the date. Someone already posted that the date is 1983, not 73. A slip of one key. Isn't http considered a "download" ? (Score:1) This patent is screwy. You can say there is definatly prior "art" Corvus Hard Drive (Score:1) I used to have a Corvus hard disk. It weighed 30 pounds, was roughly 3 feet deep, 20 inches wide, and 8 inches high, and had a capacity of 10 MB. It had it's own card that went into a slot on the original IBM PC (prior to the XT), and you started the boot from a floppy disk. This isn't just about downloading (Score:1) Re:All file retrieval? (Score:4) Nor does it appear that this patent applies to software protected using electronic licenses (i.e. copy protection or feature limiting licenses). And, to me at least, there lies the whole problem. It appears. It seems. What kind of judicial system allows laws and documentation that require advanced degrees to even understand? If ignorance of the law is no excuse, shouldn't law have to be written in understandable language. And don't give me any bullshit about $10 words being required in order to make the law more specific, 'cause that is complete bunk. I've seen enought technical documentation to know that it is possible to be clear, conscise and understandable all at the same time. All the bullshit rhetoric in patent applications and on the lawbooks are there simply to confuse the masses and make them hire lawyers. Why can't we elect some judges that will let people off because the law isn't in English (or other native language as it may apply) instead of some twisted, latinesque, lawyerese? For instance, this judge should simply rule that noone can infringe on this patent, because an average person would need weeks to understand what the fuck it means. Sorry for the rant, but the previous post was clear, concise and contained not noticeable misspelling. In short, Ronin Developer is literate in English, yet he can't decipher a document that purports to limit his activity. What kind of justice is that!?! Re:Software Download Patent? (Score:2) How I see the patent from a similiar brain numbing fugue is it covers all downloads which involve some payment mechanism built into the transaction. I love how it says "material objects" which would cover anything from a HD to a zip disk but that just seems to be how patents are written. I'm very surprised that a lot more companies aren't fighting this patent. Taken to an extreme any file you download and pay for, say music, a downloaded newspaper or e-book, any information really that would ultimately reside on a storage device could be pinched for a royalty payment. RIAA, newspapers, and publishers might have a reason for concern. But that's my completely lay person's scope on the thing. Take it with a tub of salt. Well, everyone says that my PC is a POS... (Score:3) Patents wars, yeah right... (Score:1) *sigh* This could be a good thing. (Score:1) I wonder, if the patent is upheld, if this will be the real spark that forces changes in patent laws. After all, the large corporations this patent will hurt, who spent huge amounts of money getting software under the umbrella of patent protection and, more recently, the DMCA, might realize the genie they let out of the bottle. This likely includes Intranets as well. (Score:1) Re:Patent enforcement? (Score:1) For the 6 millionth time, TRADEMARKS require enforcement to stay valid. PATENTS do not. Re:Good test of patent system (Score:1) Bad for companies like Microsoft, maybe - but not bad for patent law as a whole. Re:Information in material objects (Score:1) No matter how I try to warp my thinking, I don't see how this applies to a software download. It seems to have been intended to address things like CD or DVD purchase kiosks that would download and burn the content (thereby avoiding the need to have a stock of physical titles.) Even if it were to apply, there is prior art -- how many people were using a BBS back then? I know I was! What's the conceptual difference between a "catalog" code and directory listings for locating the desired files, particularly when file links allow multiple "catalog entries" to refer to the same file? Wasn't your login id your "authorization code"? Three words: Pay-per-view (Score:2) If I'm reading this correctly, pay-per-view cable television (which would be taped by the viewer) would violate this patent and/or be prior art (does anyone remember taping PPV movies before 1985?). I press the button on my cable box remote, the box and the cable co. validate my purchase (and bill me accordingly), and they deliver the information over their network to my VCR, where I make a "material object" out of the data. Even if the PPV is ordered via the phone I think it's pretty much the same mechanism described in the patent. To those posting a slashdot story: (Score:2) Real Headline: "Microsoft employee accidently drops large box on foot of stranger on the street". Slashdot Headline: "Microsoft now physically harming others to get their way" Slashdot User: "Well, that stranger could have been a leet linux coder.. Microsoft is stifleing innovation by causing that coder to go to the hospital! He could have been producing CODE at that time! (like a good communist!)" My point.. this article was more or less void before it was even an issue. Plus, it doesnt directly pertain to all downloads. Read the patent. If you can get all the way through it without feeling drowsy, that is. legaleese.. blech! Slashdot something useful. [thehungersite.com] Management is not a tunable parameter. Re:Patent enforcement? (Score:1) Re:Seven years? (Score:2) Don't they have to inform patent infringers formally before they start charging for it? As an infringer I have to have a choice whether to pay up or to change technology, no? Re:Not on "every" software-download... (Score:2) While being on US territory From a US-based server of which the verdict could be enforced by the Belgian courts (in my personal case). Same goes for providing downloads to US-based netizens. When I'm downloading something from a European/Australian/Asian/... server, E-data can't do anything at all. I acknowledge that the treaty can be abused in various ways, but I'm afraid that's the result of the originating country's poor jurisprudence(?). I always have to smile when I hear US citizens speak of "frivolous" lawsuits, when most people here in Europe (and probably in a lot of other places too) consider the USA the place where people can and will sue for about anything, not seldomly demanding absurd sums of money in damages. (no disrespect to those who do). The hague is only a small part of a much bigger problem. Okay... I'll do the stupid things first, then you shy people follow. Not on "every" software-download... (Score:5) Seriously - I don't consider my PC a "point of sale location", so the usual transactions over the internet are indeed as the lower court stated waaaay out of the scope of this patent. But it seems to me that a CD-shack downloading tracks to burn them for their customers would have to cough up the money. Same goes for "on-line digital cinema", where HDTV is streamed from the moviestudios to the local cinemas. Those two example applications fit much better in the scope of "reproducing information at a point-of-sale location", they would have a problem countering this (if it weren't for the infinite amount of lawyers and the infinite amount of time of the MPAA ;-)... You can't blame 'm for trying, after seeing the other patents that USPTO granted (and that were enforced in US courts). Okay... I'll do the stupid things first, then you shy people follow. Re:Seven years? (Score:2) As the previous posted mentioned, I suspect that this will be thrown out due to prior art when it reaches the lower courts. Let's hope that it is. RD Re:All file retrieval? (Score:2) Exactly. How can an IT professional ensure they are in compliance with the law when we can't make heads or tails of it. Even more so, the people who CAN read the legalize (i.e lawyers and judges) can't understand the technical aspects of what they are writing about. No wonder this case has been bantered around for so long. Laws written in a manner incomprehensible to the lay person should have no merit. Legal documents should be written concisely in the native language that is understood by all with normal intelligience and the ability to read for the society for which it governs. Naturally, those in the legal profession may feel differenty. They will make the claim that the language is needed to precisely and unambiguosly define what the document is meant to say. Again, it is clear that in this case, they failed miseraby. T professionals (ala programmers) also speak in a language the defines their problem domain in a precise and unambiguous manner. In our case, however, a miswritten statement is construed as a software defect and often considered unacceptable to the people that use it. We're forced to fix the problem or face consequences such as a lawsuit or losing business. Why are those in the legal profession not held to the same standard? Perhaps, it's because the people that enforce those standards are the same ones who setthem in the first place. Re:Seven years? (Score:2) Let's say you were using the XYZ algorithm in a product before the patent expired. Everyone in the industry knows that the algorithm is patented. You didn't license the algorithm but decided to take your chances and sold your product anyway. The company holding XYZ finds out about your actions and can immediately take action to protect their patent. In doing so, they may file suite to begin reclaimation for damages and/or seek an injunction to stop distribution of the product. They have the full support of the law on their side. My guess is that they would then attempt to settle out of court. But, let's say you told them F*** off. You could reengineer your product to use something else if you can afford the luxury of reengineering and/or the PR implications. They know they have the legal right to come after you and will do so if a settlement isn't reached in order to avoid voiding their patent. End result, you still get sued and have to bare the cost of redevelopment, remarketing and, of course, the legal battle. But, if you were shipping your product before they applied for the patent (and can prove it), then their patent can be overturned due to prior art. If the patent was pending, the company needs to inform others using their disputed idea that idea is patent pending. This allows those using it to decide what course of action you want to take. Once the patent is granted, you're on your own to make sure you aren't infringing and take the proper measure to license the use of the patent from its holder. If you were forewarned...your dead meat on a stick. Now, I'm no lawyer...but I've come up against patents in the past. The real solution is to eliminate the legalese, get people in the PTO who understand what they are granting patents on, and make it easy to research existing patents and those pending. The PTO does provide a web accessible search engine...Others provide similar services as well. But, its a cumbersome process to do yourself and you still face liability if you didn't do your homework. Re:All file retrieval? (Score:4) Nor does it appear that this patent applies to software protected using electronic licenses (i.e. copy protection or feature limiting licenses). Now, I'm too lazy to read the whole patent, but if I encrypt my file for download and then send the unlock code later (via snail mail, for example), do I violate this patent? RD Re:Good test of patent system (Score:2) Re:Good test of patent system (Score:3) Good test of patent system (Score:5) Really? Really really? If it's really about that large amounts of money, companies are going to fold or relocate outside the USA, rather than pay up. Does anybody here really think that's going to happen? In the unlikely event that a judge allows this company to win, the USA will have to reconsider its patent system or risk hurting the economy real bad. My prediction is that this case will sizzle and die, never to be heard of again. The stakes are simply to high. E-Data: Check this out (Score:2) H. Coin Slot? (Score:5) A dialog box will pop up "Please deposit 35 cents for the next 5megs please" -- A monetary transaction must take place? (Score:4) from the actual patent doc: 16. The method of claim 1 wherein each information is uniquely identified by a predetermined catalog code and a dollar charge code, the dollar charge code indicating the amount of money to be charged in connection with the reproduction of said information ...blah blah blah and The present invention relates generally to a system for reproducing information in a material object at a point of sale location. So basically things like FTP, HTTP, and Kermit don't really apply. They're not really saying they invented the concept of downloading. The district court previously ruled that the patent was too narrowly focused, applying for for download, sale, and "physical reproduction" (tape, VHS, CD?) at a specific kiosk or physical store front and not a ubiquitous browser or other software client. I'm curious what portions of the patent were broad enough that the U.S. Court of Appeals for the Federal Circuit would throw the decision out the window. Anyway, it looks like Intuit and Time Warner have the following options: battle this out in court wait for the patent to "expire" (4 more years) sidestep the patent by temporarily finding another way to facilitate online software purchases. Re:Information in material objects (Score:2) The quoted portion of the patent is, "reproduction in a material object at the point of sale." This means that the reproduction must be occuring at the point-of-sale (or, as an alternate reading, in a material object that is at the point-of-sale). The two readings are subtly different, but both invalidate the claim that this covers copying to a disk which is then distributed or the implication that this might not implicate pay-for-download sites. Re:Why this patent will be declared invalid (Score:2) January 10, 1983, actually. The patent wasn't granted until July 9, 1985. Remember, though, that it's not merely point-of-sale systems. It has to meet the specified claims, including the method of authentication. This is not to say that such systems did not exist prior to the filing. I'm reasonably sure that they did. Anyway, there's good reason to fight the patent as being so broad that it'll apply to all downloads and to treat it as such: the language of the patent doesn't unambigously dismiss this possibility. Therefore, regardless of the stated or actual intent of the patent holder(s), the possibility for enforcement exists. That is what should be dealt with; not the probability of enforcement. Re:Coin Slot? (Score:2) My Good Goddess, it's a conspiracy! Never mind what the patent says - it's all a secret plot by CmdrTaco to drive up banner revenue! Re:Coin Slot? (Score:3) Not quite - but close. If this patent stands, it will be the end of flat-rate access plans. Someone will do a study that shows that X% of a home user's traffic is downloads - and that number will be used to figure a royalty payment based on your bandwidth use. Think about it - how else could enforcing this patent work? Using anything other than averages and estimates would require detailed logging of a user's every online "move," in order to distinguish between downloading and other behavior. You can imagine how well *that* would fly. Remember, you read it here first! Re:fsck this shite (Score:2) The argument that there was prior art (as described elsewhere in these comments) was not brought before them so they couldn't rule on it. Re:If I understand this (Score:2) Prior Art: Kermit, anyone? (Score:4) There is prior art up and down the Yin Yang on this. this document [columbia.edu] places the innovation of Kermit in 1981, while RFC 765 [faqs.org], describing the FTP protocol, dates back to June 1980. You also mentioned Unix to Unix Copy Protocol. According to this history of the internet [davesite.com], AT&T labs developed the UUCP suite in 1976. Or then, the higher court may just be smoking something... Sometimes, I think the only reason that drugs are illegal is to prevent us from understanding the system. :) -- Prior technology? (Score:3) Wouldn't the concept of FTP, being designed in an RFC [isi.edu] from 1980 be prior art? Granted, this may not help for the sale of items over the Internet, but that DOES mean that they couldn't claim EVERY software download. All file retrieval? (Score:2) err, this patent is applicable how? (Score:3) Maybe I'm stupid, but from the abstract above, and a quick scan of the patent its constantly referring to the reproduction of material objects. I thought that patents were specific enough that if you say 'material object' then 'non-material information' doesn't get covered. By bending the meaning a bit I can see how this might be construed to cover, say one of those machines that can download and bind a book for you in a shop, but I can't see it meaning I have to pay to ftp a copy of Counterstrike, as there is no 'point of sale' there is no transaction and the exact material object isn't reproduced. Given that data down networks is older than 85 anyway (I remember strange TV programs that broadcast simple programs when you hooked your BBC micro up to them) I can't see this as right. Re:Sensationalism (Score:3) This, also, is misleading. The lower court didn't declare the patent invalid-- it said that it applied only to sales from kiosks and such. And when a higher court tells a lower one to "reconsider", it doesn't just say, "hmm, you should take another look at that". It gives its grounds for disagreement, and provides guidelines that the lower court should follow. In this case, it said that the lower court had interpreted the patent too narrowly. Any patent defense has two strategies - first, you can get the patent declared invalid, and second, you claim that you aren't infringing. This case applies only to the first. There's plenty of battle left ahead on the second point. Precisely the opposite, in fact. The lower court's ruling was that the patent applied to kiosks, and hence the companies involved weren't infringing. The higher court said the patent should be broader than that. If that holds, then there will be a huge argument over the validity of that patent, with a huge opportunity for prior art. Re:Link to patent (Score:2) The fact is that it's an incredible gouge, and a clear demonstration of why business method patents are bullshit... /Brian Even Pr0n? (Score:4) Re:Coin Slot? (Score:2) Damn, does this mean I'll have to pay for warez downloads after all? And once again ..... (Score:5) Dear E-Data: (Score:4) Love, The Internet Re:Seven years? (Score:2) Hey! (Score:3) And how sir, do you think you get to that store? I own patent 4711/12345 "A method of movement by moving one foot in front of the other to get from a place to another place, regardless of the pace with which this method is applied". So don't you dare to even walk(tm) to your car without transferring a lot of $$$ into my general direction. walk(tm), walking(tm), jogging(tm), running(tm) and feet(tm) are trademarks owned and controlled by CaptainZapp enterprises Information in material objects (Score:5) I also mis-read it the first time and was thinking the same thing, but if you check it a bit closer, it says "information" in material objects. That's a lot more relevant. I think the key point to this patent without having taken legal advice, is that it's talking about point of sale. As usual all the initial modded-up comments are uninformed and ranting about how they were downloading before 1985. (The slashdot writeup doesn't help.) But it's really only relevant to people and companies who are selling downloads. So if you require payment before someone can download some information, this patent might (or might not) be relevant. I'm wondering how easy it might be to get around simply by changing the system slightly, like checking for authorisation code twice instead of once for example. I'm sure I remember an audio clip of that patent office guy stating that Barnes & Noble could quite feasibly run a 2-click ordering system to avoid infringing on Amazon's 1-click, and that would seem like the same sort of thing. === Re:How old is FTP? (Score:2) Note this extract from the latter: "It is envisioned that the protocol may also be used for terminal-terminal communication ("linking") and process-process communication (distributed computation)." Not quite sure lawyers would be happy with this point, though. -- Re:Coin Slot? (Score:2) I've got foolproof prior art (Score:5) 28. The method of claim 27 wherein the material object is defined further as being selected from a group consisting of: audio tape capable of having fixed therein information in the form of sound recordings; audio disc capable of having fixed therein information in the form of sound recordings; video tape capable of having fixed therein information in the form of pictures and or audio; video disc capable of having fixed therein information in the form of pictures and or audio; media capable of having fixed thereon information in the form of printed matter (words, symbols and or pictures); devices capable of having fixed therein inforamtion in the form of digital data; or combinations thereof. (emphasis mine) Even if this person has a valid patent, this is one of those times where, for the good of the world, you have a moral responsibility to just let it go. Bryguy This has to be a hoax (Score:2) Besides, companies have to defend patents in a timely manner to keep them. [Or at least that's the excuse some companies use for raking smaller companies over the coals] If this 80's era patent was not used against Compuserve, how can they get away with using it now? Because the whole thing is a hoax meant to illustrate the ridiculous state [ridiculopathy.com] of software patent law. Patent drafting (Score:2) IANAL. Also, IANAPA (patent agent, or patent attorney, not all of whom are lawyers). Slashdotters evidently need more information about patents. I'm going to try and give what I know, using this patent as an example. First, each patent claim is separate from the others. Each one is effectively its own patent. You'll notice how patent 2 includes patent 1. This is because the first claim is the broadest claim that the patentholder can possibly lay claim to. Claim 2 is more specific, and then it just gets more detailed as you go on. This is normal. In most patent filings, you get a hierarchy of claims. If Slashdot would let me, I'd put up a table enumerating the hierarchy. But it won't. Sigh. :) Therefore, I will use my own webspace. Open this [publish.uwo.ca] in another window and keep it handy. Anyway, there appear to be three root claims in this particular patent. To wit, claims 1, 29, and 37 each have no dependencies, and set up their own trees. This is important. One thing to remember is that the root claim is most often just a case of wishful thinking on the part of the patent drafter. It is probably too broad, and will be struck down in court. In theory, the PTO and its equivalent agencies in other countries would get rid of these claims, but in practice, they don't. However, this does not mean that its dependent claims go with it. Actually, quite the opposite. Because they've been modified, they're narrower, they cover less, they're harder to attack. But on the other hand, if you get one of the really narrow claims, you get all of its predecessors too. For example, suppose you find prior art for Claim No. 12. That allows you to knock out Claims No. 1, 2, 5, and 7 through 11. That's why you get so many branches. This is a pretty good piece of drafting, this patent. 12 and 47 are the only big target claims. There's lots of others with only one or two dependencies. I was going to try and figure out the claims themselves today, but I won't. My head hurts. Maybe tomorrow. Patent Law - the Uruguay Round Agreements Act (Score:3) --CTH -- How will they track downloads? (Score:4) Re:err, this patent is applicable how? (Score:2) But there is the question: does the patent imply (strongly enough for the courts) that the material object constitutes part of the sale? If so, download to your hard drive is not covered. Re:Hey! (Score:2) Sorry, you can't do that. I own patent 1011/2389 "A system for registering innovations allowing a period of exclusity to the original registree, and prohibiting all others from using said innovation without paying obnoxious license fees to the registered owner of the innovation". Your "patent" infringes on this patent, so you'll have to transfer all that $$$ plus some more to me :) Re:Information in material objects (Score:5) #include "std_IANAL.h" My understanding of the patent system is that patents are very specific. Having a patent for exercising a cat with a laser pointer does not mean you can sue someone for exercising their dog, budgie or cute furry martian in the same manner. Similarly (as you have noted) having patented "1-click shopping" does not give Amazon exclusive rights to "n-click shopping", despite apparent similarities. Firstly: "Material object" has specific meaning under the law, which does not include non-physical (classically: intellectual) property. Material must, necessarily, be physical. Transferring information and then placing it on a disk and giving the disk to the purchaser would be covered by this patent. The catch arises in that downloading to your hard drive would also constitute placing data on a disk, and since the point at which the purchase was made was your computer, it would constitute a point-of-sale. Arguably the mere act of such information entering RAM is "reproduction in a material object at the point of sale"; so depending on where you draw the line on "material object" (can it already belong to the purchaser, or must it be included in the sale?) and "point-of-sale" that clause can be read in several ways. Secondly: As you kindly pointed out (all prior threads seem to miss this rather salilent point) this applies to a limited set of downloads, mostly commercial. Whenever an authorization is needed to initate the download or, conveivably, to interpret the downloaded information, the patent could take effect. In addition the use of "point of sale" as the description of the location strongly implies (but maybe not strongly enough for the courts) the requirement for a sale (negotiated trade or financial transaction) to occur. So: browsing the web under normal conditions and downloading free software is not convered. Download evaluation software where a registration and key is needed may be covered. Curve ball: web sites that require authentication and/or use SSL may be grey areas. Consider that under both systems the intended recipient of information must provide some form of authorization in response to a request for such authorization (in the case of SSL without client authentication, that "code" is randomly generated). The only missing part for you to stretch the patent over it (if you had good lawyers) would be the concept of sale. But how broad is sale? Well, the commercial (capatalist, Western, etc) world holds that no-one does anything for free. The courts have shown a bias towards that view (I'm not bothering to explain the references/logic here). So if you have registered with a site as a user, it could be argued that, in exchange for your right to use the site (the authorization code you were given), you have agreed to a trade, mostly likely the site has permission to e-mail you and share your e-mail address with its partners. That's a sale. Worried yet? Thirdly: the patent is specific about the method of authorization: the owner obtains a code, and supplies it in response to a prompt at the "point of sale". That's pretty broad -- sure, I believe we could make a protocol that avoided the problem (public keys and signatures, for example, in which case you prove identity rather than supply a code), but most site currently work on the prompt/authorization code principle. As much as I hate to admit it, I think it is possible to stretch this patent to cover a large amount of the net. But certainly it cannot cover all downloads: free http (non-SSL) websites, free software, e-mail, search engines, usenet and the like cannot (except by an lawyer) possibly be perceived to fit under the umbrella of this bastard. Re:err, this patent is applicable how? (Score:3) You didn't scan the text slowly enough. It talks about reproduction of information in material objects, so copying information to a disk would be covered by that. Re:I bet AOL wishes they had thought of it first.. (Score:5) Re:Prior technology? (Score:2) Certainly, as far as free downloads are concerned. The news article doesn't exactly say, but I think the case has been about paid downloads -- so to really kill this thing, you should find a paid download using encryption for security predating 1983. Re:fsck this shite (Score:2) Re:Coin Slot? (Score:2) Yeah, and just imagine the money that would made from all the downloading of the estimated 600 (in the first day alone) Slashdot articles in 'Your Rights Online' if this ever came to fruition :) Why this patent will be declared invalid (Score:2) In America ... (Score:3) First you get the patents. Then you get the power. Then you get ... the women. Just plain silliness (Score:2) Regardless of where this case goes, let's assume the court rules in favor of EData and they make billions from licensing the concept of downloads. The defendants can file an appeal and possibly even file for a patent revocation on the fact that such a concept is obvious. Experts on the topic can point out that such a concept is fndamental to operation of the Internet long before the patent was filed in 1985. The concept wasn't designed by EData, it was dreamed up by the original Internet founders in US Defense Dept and academia back in the 60s. EData will eventually lose this battle. It's just a matter of time until that happens. If I understand this (Score:2)
https://slashdot.org/story/01/07/17/0316219/patent-on-software-downloads-upheld
CC-MAIN-2017-30
refinedweb
7,519
71.75
Ajax CRUD with Struts2 and Tibco GI (9 messages) In this article you will learn how to create a new Ajax RIA front end to an existing Apache Struts2 .jsp application using TIBCO General Interface (GI), an open source Ajax toolkit with an MVC architecture similar to that of Java Swing. GI is optimized for creating business productivity applications and communicating with XML, SOAP, JSON and other types of services in a SOA. This is done by extending. - Posted by: Joseph Ottinger - Posted on: April 02 2007 17:16 EDT Threaded Messages (9) - Re: Ajax CRUD with Struts2 and Tibco GI by Luca Garulli on April 03 2007 10:36 EDT - Re: Ajax CRUD with Struts2 and Tibco GI by Philip Luppens on April 10 2007 05:41 EDT - Source code for the article would be good by KAK W on April 13 2007 12:33 EDT - Re: Source code for the article would be good by Chinchih Lu on August 02 2007 02:29 EDT - Re: Ajax CRUD with Struts2 and Tibco GI by Luca Garulli on April 14 2007 05:43 EDT - Struts2 Tiles by Wilfredo Villegas on March 05 2008 10:52 EST - Re: Ajax CRUD with Struts2 and Tibco GI by Rajil Davda on October 07 2008 01:21 EDT - Ajax CRUD with Struts2 and Tibco GI in news by Rajil Davda on November 05 2008 01:08 EST - JS-Error: 'jsx3.html' is null or not an object by Ajay Rathor on February 19 2010 07:17 EST Re: Ajax CRUD with Struts2 and Tibco GI[ Go to top ] Roma Meta Framework is much more simple to use: - render your domain objects (POJOs) as they are and - convention over configuration Take a look to the live demo developed using few lines of code. Ciao, Luca Garulli - Posted by: Luca Garulli - Posted on: April 03 2007 10:36 EDT - in response to Joseph Ottinger Re: Ajax CRUD with Struts2 and Tibco GI[ Go to top ] Oh yeah ? My SuperFOO3K framework is even easier ! Just *think* about some domain models, and it'll create a blog, for you, in just under 2 minutes ! Annoying, no ? Luca, as much as I appreciate your comment, or your framework, try to provide some *useful* feedback. Every framework has its strengths and weaknesses, and often a new framework B is started as a reaction against a shortcoming of framework A. Did you like the tutorial ? Do you see any room for improvement ? A comment like 'hey, that's nice, but even better would be to use , like they do in RMF, because .. '. Thát's useful and appreciated. FYI, Struts 2 has also convention over configuration, can turn any class/pojo into a controller, uses type convertors, ajax, annotations, plugin systems, etc, * ad infinitum. Sigh. So, next time you see a tutorial/guide/article about a framework other than Roma Meta Framework, try to resist the temptation to make a useless comment about RMF, unless asked by the author ('guys, what other framework can do this ?', or 'I am looking for recommendations for a new project') - or at least by another comment. -Phil - Posted by: Philip Luppens - Posted on: April 10 2007 05:41 EDT - in response to Luca Garulli Source code for the article would be good[ Go to top ] I see the note saying source code would be available incrementally, but didn't see anything related to Tibco GI in the war file. It would be very helpful if the source code becomes available soon before we lose track of the thread... - Posted by: KAK W - Posted on: April 13 2007 12:33 EDT - in response to Philip Luppens Re: Source code for the article would be good[ Go to top ] The article did mention that "Incremental source code for the solution in this article" can be downloaded at. I tried to deploy the GI-fied "showcase" war into Tomcat 5.5 and the app seemed to run just fine. However, the GI part did not work completely. However, when I clicked on the "Employee" tab of the GI matrix, I was getting the following error: There is no Action mapped for namespace /struts2-showcase-2.0.1/employee2 and action name list. When I checked struts.xml, I did find the the "employee2" action defined in the "employee2" package. Since I am new to Struts2, I'd appreciate if someone out there could offer some tips to fix this... Chinchih - Posted by: Chinchih Lu - Posted on: August 02 2007 14:29 EDT - in response to KAK W Re: Ajax CRUD with Struts2 and Tibco GI[ Go to top ] Hi Philip, since many people are interested to build RIA using Java+Ajax I would to write 4 lines of comment about another way to reach the goal. Ciao, Luca Garulli - Posted by: Luca Garulli - Posted on: April 14 2007 17:43 EDT - in response to Philip Luppens Struts2 Tiles[ Go to top ] I am using tiles in my result. Do I have to change my tile result type for CDF Result type ?. Thank you and Regards. - Posted by: Wilfredo Villegas - Posted on: March 05 2008 10:52 EST - in response to Luca Garulli Re: Ajax CRUD with Struts2 and Tibco GI[ Go to top ] Hi. V part of MVC can be improved by Tibco GI. As shown in sample CRUD Application. Very nice. I am looking for source code they have written under gi package. The interceptors, TypeConverter, Results etc classes are bundled along with the code. But can i also have source code for org.apache.struts2.showcase.gi Package to understand workground and implement the same in another applications? Also, will the same interceptors, results etc will work for all types of modules? Is it generalized or I need to write them seperately for different types of applications? I need your help regarding this topic, Specially, Mr. Joseph Ottinger, Thanks in advance. - Rajil - Posted by: Rajil Davda - Posted on: October 07 2008 01:21 EDT - in response to Joseph Ottinger Ajax CRUD with Struts2 and Tibco GI in news[ Go to top ] Hi everybody. I have found the source for the CRUD application developed using Tibco GI. I am able to build sample application that list available records. What i am not able to understand is how all JS files are created in given sample application. e.g. they have given some js files CRUDMatrix.js employeecrud.js blockEditMaskHelper.js etc. Are all these files created manually or generated automatically from Tibco GI? - Posted by: Rajil Davda - Posted on: November 05 2008 01:08 EST - in response to Rajil Davda JS-Error: 'jsx3.html' is null or not an object[ Go to top ] Hi All, I getting javascript error while accessing link 'Tibco General Interface Ajax' on showcase as : Error: 'jsx3.html' is null or not an object. Can any one help me for the same. I am biggner for Tibco GI. I am using IE6.0 - Posted by: Ajay Rathor - Posted on: February 19 2010 07:17 EST - in response to Joseph Ottinger
http://www.theserverside.com/discussions/thread.tss?thread_id=44838
CC-MAIN-2014-42
refinedweb
1,176
68.3
- NAME - SYNOPSIS - DESCRIPTION - METHODS - IMPLEMENTATION DETAILS - SEE ALSO - THANKS - AUTHORS NAME namespace::clean - Keep imports and functions out of your namespace SYNOPSIS package Foo; use warnings; use strict; use Carp qw(croak); # 'croak' will be removed sub bar { 23 } # 'bar' will be removed # remove all previously defined functions use namespace::clean; sub baz { bar() } # 'baz' still defined, 'bar' still bound # begin to collection function names from here again no namespace::clean; sub quux { baz() } # 'quux' will be removed # remove all functions defined after the 'no' unimport use namespace::clean; # Will print: 'No', 'No', 'Yes' and 'No' print +(__PACKAGE__->can('croak') ? 'Yes' : 'No'), "\n"; print +(__PACKAGE__->can('bar') ? 'Yes' : 'No'), "\n"; print +(__PACKAGE__->can('baz') ? 'Yes' : 'No'), "\n"; print +(__PACKAGE__->can('quux') ? 'Yes' : 'No'), "\n"; 1; DESCRIPTION Keeping packages clean. By unimporting via no you can tell namespace::clean to start collecting functions for the next use namespace::clean; specification. You can use the -except flag to tell namespace::clean that you don't want it to remove a certain function or method. A common use would be a module exporting an import method along with some functions: use ModuleExportingImport; use namespace::clean -except => [qw( import )]; If you just want to -except a single sub, you can pass it directly. For more than one value you have to use an array reference. Late binding caveat Note that the technique used by this module relies on perl having resolved all names to actual code references during the compilation of a scope. While this is almost always what the interpreter does, there are some exceptions, notably the sort SUBNAME style of the sort built-in invocation. The following example will not work, because sort does not try to resolve the function name to an actual code reference until runtime. use MyApp::Utils 'my_sorter'; use namespace::clean; my @sorted = sort my_sorter @list; You need to work around this by forcing a compile-time resolution like so: use MyApp::Utils 'my_sorter'; use namespace::clean; my $my_sorter_cref = \&my_sorter; my @sorted = sort $my_sorter_cref @list;. namespace::clean->clean_subroutines($cleanee, qw( subA subB )); will remove subA and subB from $cleanee. Note that this will remove the subroutines immediately and not wait for scope end. If you want to have this effect at a specific time (e.g. namespace::clean acts on scope compile end) it is your responsibility to make sure it runs at that time. a delete $SomePackage::{foo}; will remove the foo symbol from $SomePackage for run time lookups (e.g., method calls) but will leave the entry alive to be called by already resolved names in the package itself. namespace::clean will restore and therefor in effect keep all glob slots that aren't CODE. A test file has been added to the perl core to ensure that this behaviour will be stable in future releases. Just for completeness sake, if you want to remove the symbol completely, use undef instead..
http://web-stage.metacpan.org/pod/namespace::clean
CC-MAIN-2019-18
refinedweb
485
59.13
LANES TARGET NODE ADDRESS FORMAT REMOTE POOL ATTRIBUTES SSH LIBRARY API VERSIONING DEBUGGING AND ERROR HANDLING ENVIRONMENT EXAMPLE ACKNOWLEDGEMENTS SEE ALSO librpmem – remote persistent memory support library (EXPERIMENTAL) #include <librpmem.h> cc ... -lrpmem RPMEMpool *rpmem_create(const char *target, const char *pool_set_name, void *pool_addr, size_t pool_size, unsigned *nlanes, const struct rpmem_pool_attr *create_attr); RPMEMpool *rpmem_open(const char *target, const char *pool_set_name, void *pool_addr, size_t pool_size, unsigned *nlanes, struct rpmem_pool_attr *open_attr); int rpmem_set_attr(RPMEMpool *rpp, const struct rpmem_pool_attr *attr); int rpmem_close(RPMEMpool *rpp); int rpmem_persist(RPMEMpool *rpp, size_t offset, size_t length, unsigned lane); int rpmem_read(RPMEMpool *rpp, void *buff, size_t offset, size_t length, unsigned lane); int rpmem_remove(const char *target, const char *pool_set_name, int flags); const char *rpmem_check_version( unsigned major_required, unsigned minor_required); const char *rpmem_errormsg(void);. See SSH section are available and are recommended for most applications, see: RPMEMpool *rpmem_create(const char *target, const char *pool_set_name, void *pool_addr, size_t pool_size, unsigned *nlanes, const struct rpmem_pool_attr *create_attr); The rpmem_create() function creates a creation of the remote pool, the nlanes contains the maximum number of lanes supported by both local and remote nodes' hardware. See LANES section for details. The create_attr structure contains the attributes used for creating the remote pool. If create_attr is NULL, a zeroed structure with attributes will be used to create the pool. The attributes are stored in pool’s meta-data and can be read when opening the remote pool using rpmem_open() function call. Upon success the rpmem_create() returns an opaque handle to the remote pool which shall be used in subsequent API calls. If any error prevents the librpmem from creating the remote pool, the rpmem_create() returns NULL and sets errno appropriately. RPMEMpool *rpmem_open(const char *target, const char *pool_set_name, void *pool_addr, size_t pool_size, unsigned *nlanes, struct rpmem_pool_attr *open_attr); The rpmem_open() function opens an existing opening of the remote pool, the nlanes contains the maximum number of lanes supported by both local and remote nodes' hardware. See LANES section for details. If the open_attr argument is not NULL the remote pool attributes are returned by the provided structure. Upon success the rpmem_open() returns an opaque handle to the remote pool which shall be used in subsequent API calls. If any error prevents the librpmem from opening the remote pool, the rpmem_open() returns NULL and sets errno appropriately. int rpmem_set_attr(RPMEMpool *rpp, const struct rpmem_pool_attr *attr); The rpmem_set_attr() function overwrites pool’s attributes. The attr structure contains the attributes used for overwriting the remote pool attributes that were passed to rpmem_create() at pool’s creation. If attr is NULL, a zeroed structure with attributes will be used. New attributes are stored in pool’s meta-data. int rpmem_close(RPMEMpool *rpp); The rpmem_close() function closes a remote pool indicated by rpp. All resources are released on both local and remote side. The pool itself lives on the remote node and may be re-opened at a later time using rpmem_open() function as described above. If any error occurred when closing remote pool, non-zero value is returned and errno value is set. int rpmem_persist(RPMEMpool *rpp, size_t offset, size_t length, unsigned lane); The rpmem_persist() function copies data of given length at given offset from the associated local memory pool and makes sure the data is persistent on the remote node before the function returns. The remote node is identified by the rpp handle which must be returned from either rpmem_open() or rpmem_create() functions. The offset is relative to the pool_addr specified in the rpmem_open() or rpmem_create() function calls. The offset and length combined must not exceed the pool_size passed to the rpmem_open() or rpmem_create() functions. The rpmem_persist() operation is performed using given lane number. The lane must be less than the value returned by rpmem_open() or rpmem_create() through the nlanes argument (so it can take a value from 0 to nlanes - 1). If the entire memory area was made persistent on remote node the rpmem_persist() returns 0, otherwise it returns non-zero value and sets errno appropriately. int rpmem_read(RPMEMpool *rpp, void *buff, size_t offset, size_t length, unsigned lane); The rpmem_read() function reads length bytes of data from remote pool at offset and copies it to the buffer buff. The operation is performed on a given lane. The lane must be less than the value returned by rpmem_open() or rpmem_create() through the nlanes argument (so it can take a value from 0 to nlanes - 1). The function returns 0 if the data was read entirely, otherwise non-zero value is returned and errno set appropriately. The rpp must point to a remote pool opened or created previously by rpmem_open() or rpmem_create() functions respectively. int rpmem_remove(const char *target, const char *pool_set_name, int flags); The rpmem_remove() function removes a remote pool on a given target node. The pool_set_name is a relative path in the root config directory on the target node that uniquely identifies the pool set file on remote node. By default only the pool part files are removed and pool set file is left untouched. If the pool is not consistent the rpmem_remove() function fails, unless otherwise specified. The flags argument determines the behavior of rpmem_remove() function. It is either 0 or the bitwise OR of one or more of the following flags: RPMEM_REMOVE_FORCE Ignore errors when opening inconsistent pool. The pool set file must be in appropriate format though. RPMEM_REMOVE_POOL_SET Remove pool set file after removing the pool described by this pool set. The term lane means an isolated path of execution. Due to a limited resources provided by underlying hardware utilized by both local and remote nodes the maximum number of parallel rpmem_persist() operations is limited by the maximum number of lanes returned from either the rpmem_open() or rpmem_create() function calls. The caller passes the maximum number of lanes one would like to utilize. If the pool has been successfully created or opened, the lanes value is updated to the minimum of: the number of lanes requested by the caller and the maximum number of lanes supported by underlying hardware. The application is obligated to use at most the returned number of lanes in parallel. The rpmem_persist() does not provide any locking mechanism thus the serialization of the calls shall be performed by the application if required. Each lane requires separate connection which is represented by the file descriptor. If system will run out of free file descriptors during rpmem_create() or rpmem_open() these functions will fail. See nofile in limits.conf(5) for more details. [. The rpmem_pool_attr structure describes a remote pool and is stored in remote pool’s metadata. This structure must be passed to the rpmem_create() function by caller when creating a pool on remote node. When opening the pool using rpmem_open(). The librpmem utilizes ssh(1) client to login and execute the rpmemd(1) process on remote node. By default the ssh process is executed with -4 option which forces using IPv4 addressing. The SSH command executed by librpmem can be overwritten by RPMEM_SSH environment variable. The command executed by the ssh can be overwritten by RPMEM_CMD variable. See ENVIRONMENT section for details. See FORK section for more details. The ssh process is executed by rpmem_open() and rpmem_create() after forking a child process using fork(2). The application must take into account this fact when using wait(2) and waitpid(2) functions which may return a PID of the ssh process executed by librpmem. The librpmem library requires fork(2) support in libibverbs, otherwise rpmem_open and rpmem_create functions will return an error. By default libfabric initializes libibverbs with fork(2) support by calling the ibv_fork_init(3) function. See fi_verbs(7) for more details. A remote pool size depends on the configuration of a pool set file on the remote node. The remote pool size is a sum of sizes of all part files decreased by 4096 bytes per each part file. The 4096 bytes of each part file is utilized for storing internal metadata of the pool part files. The minimum size of a part file for a remote pool is defined as RPMEM_MIN_PART in <librpmem.h>. The minimum size of a remote pool allowed by the library is defined as RPMEM_MIN_POOL therein. libr() and rpmem_open() using this hardware can not be greater than or equal to 8GB. This section describes how the library API is versioned, allowing applications to work with an evolving API. const char *rpmem_check_version( unsigned major_required, unsigned minor_required);. If an error is detected during the call to librpmem function, an application may retrieve an error message describing the reason of failure using the following function: const char *rpmem_errormsg(void); The rpm librpmem function indicated an error, or if errno was set. The application must not modify or free the error message string, but it may be modified by subsequent calls to other library functions. A second version of libr RPMEM_LOG_LEVEL, which can be set to the following values: - This level enables a very verbose amount of function call tracing in the library. 4 - This level enables voluminous and fairly obscure tracing information that is likely only useful to the librpmem developers. The environment variable RPMEM_LOG_FILE specifies a file name where all logging information should be written. If the last character in the name is “-”, the PID of the current process will be appended to the file name when the log file is created. If RPMEM_LOG_FILE is not set, the logging output goes to stderr. Setting the environment variable RPMEM_LOG_LEVEL has no effect on the non-debug version of librpmem. librpmem can change its default behavior based on the following environment variables. These are largely intended for testing and are not normally required. Setting this environment variable makes it possible to override the default command executed on remote node using ssh. Setting this variable shall not be required normally, but it can be used for testing and debugging purposes. RPMEM_CMD can contain multiple commands separated by vertical bar ( |). Each consecutive command is executed on remote node in order read from a pool set file. This environment variable is read when library is initialized so RPMEM_CMD must be set prior to application launch or prior to dlopen(3) of librpmem in case of using dynamic linking loader. Setting this environment variable makes it possible to override the default ssh client command name. Setting this variable shall not be required normally. Setting this variable to 1 enables using fi_sockets(7) provider for in-band RDMA connection. By default the sockets provider is disabled. Setting this variable to 0 disables using fi_verbs(7) provider for in-band RDMA connection. The verbs provider is enabled by default.; } The librpmem API is experimental and may be a subject of changes in the future. However, using the remote replication in libpmemobj(3) is safe and backward compatibility will be preserved. librpmem builds on the persistent memory programming model recommended by the SNIA NVM Programming Technical Work Group: libpmemobj(3), libpmemblk(3), libpmemlog(3), libpmem(3), strerror(3) and The contents of this web site and the associated GitHub repositories are BSD-licensed open source.
https://pmem.io/pmdk/manpages/linux/v1.3/librpmem.3/
CC-MAIN-2022-05
refinedweb
1,826
53.1
Pipes created by the Unix implementation of apr_file_pipe_create are inherited by default, but you can't make them uninherited without registering a custom cleanup handler. Any objections to this patch, which lets apr_file_inherit_unset work on a pipe for Unix? (it looks like it might already work on Win32). Alternatively I wonder whether it would be better to not leak pipes by default, though presumably it was done this way for a reason... Index: pipe.c =================================================================== RCS file: /home/cvs/apr/file_io/unix/pipe.c,v retrieving revision 1.61 diff -u -r1.61 pipe.c --- pipe.c 7 Jan 2003 00:52:53 -0000 1.61 +++ pipe.c 5 Mar 2003 16:29:11 -0000 @@ -56,6 +56,8 @@ #include "apr_strings.h" #include "apr_portable.h" +#include "apr_arch_inherit.h" + /* Figure out how to get pipe block/nonblock on BeOS... * Basically, BONE7 changed things again so that ioctl didn't work, * but now fcntl does, hence we need to do this extra checking. @@ -223,6 +225,8 @@ #if APR_HAS_THREADS (*out)->thlock = NULL; #endif + + (*in)->flags = (*out)->flags = APR_INHERIT; apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup, apr_pool_cleanup_null);
http://mail-archives.apache.org/mod_mbox/apr-dev/200303.mbox/%3C20030305163328.GC10788@redhat.com%3E
CC-MAIN-2016-36
refinedweb
183
69.07
Suppose I do not subclass XML::Parser. But then, how do I pass parameters to XML::Parser handler methods and collect results of their run without using global variables of XML::Parser package? Only class that I get to handler methods is expat itself and there is no place for any aditional parameters/results of handler methods. And if I subclass XML::Parser, only advantage that I gain is using my own package namespace for global variables instead of XML::Parser's namespace. This do not looks to me like a good example of object oriented programming style. Possible silution is the one mirod suggested using Non-Expat-Options but it is just a little bit less ugly than these two. There best solution will be forcing XML::Parser to use my custom subclass of XML::Parser::Expat instead of XML::Parser::Expat itself. Is there some way how to do that? In reply to Re: Re: Re: XML::Parser Tutorial by gildir in thread XML::Parser Tutorial by OeufMayo Yes No Results (278 votes). Check out past polls.
http://www.perlmonks.org/?parent=62789;node_id=3333
CC-MAIN-2017-13
refinedweb
179
54.93
22/06/13 21:31, Kirk Joppy wrote: > Keith, I just noticed your extended comments on the wiki post. Thanks > for doing that. I'll read it and see if I can figure out why my specs > file doesn't seem to be doing what I want. Could this have anything to > do with the difference between invoking g++ as opposed to gcc? No; gcc and g++ share a common specs file. > I went with g++ because gcc doesn't know about std. You are right to use g++, when compiling C++ code; gcc may compile it, but it won't invoke the linker correctly. (However, if the source file is appropriately named, gcc *should* cope with namespace std just fine, when compiling to object format). > By the way, this would be a good opportunity to clean up that howto. > It seems like your comments at the bottom are really important. > Perhaps those should be moved upwards... I agree. I've considered rewriting that article, but I've never found a suitable round tuit. I'll get to it one day, if no one else beats me to the post. -- Regards, Keith. View entire thread
https://sourceforge.net/p/mingw/mailman/message/31085752/
CC-MAIN-2018-17
refinedweb
195
83.46
Dot net framework provides strong support for creating graphics with GDI+. Developing graphics application was never that much easier in past. You must have tried to create bar chart on your web site with dirty html or pie chart with third party components. In this article I am going to demonstrate GDI+ capabilities by creating component which can create a pie chart on fly for your web pages or for your windows application. Pie Chart component is made up of two classes chartData class which encapsulates and creates various data for creating pie chart and utChart class which contain method which returns stream object. Both of these classes are under namespace utCharting. ChartData Data required for creating chart is array of names and Vals which has to be distributed through pie. In new method of this class we take inputs as array of names and values , and using those values we have generated properties which describe percent values for each elements, similarly we determined span of pie for each elements by multiplying fraction of each element with 360 ( circle has 360 degree) and we obtained start angle for each elements by adding up span in loop. UtChart This class has one method(getpiechart) which returns stream object which contains pie chart Image in gif formate, this method require inputs as chartdata object and integer object for diameter of pie chart. We used fillpie method of graphics object to generate pie for all elements, most of the code is for determining size of string to be printed on image and determining size of image, to be created in memory. Attached: utCharting.vb , utCharting.dll. How to use this component Sample shows aspx page which utilizes charting component, for that copy utcharting.dll to your bin directory of web server and copy createPieChar.aspx to you rootdirectory. Our aspx page does following things: Attached: createPieChart.dll. Summary Although this sample is elementary, you can extend functionality by changing utchart class, one of things I missed is error handling and ways to make code work faster, you can also add barchart creation to this component. Or make 3D pie chart or cut out chart which shows chosen pie out of circle. View All
https://www.c-sharpcorner.com/UploadFile/desaijm/creating-a-pie-chart-on-fly-with-VB-Net/
CC-MAIN-2018-13
refinedweb
370
56.79
Talk:Euler problems/41 to 50 From HaskellWiki < Talk:Euler problems Problem 44 I think there's a mistake in Problem 44. It works in that it gives the right answer (I assume, didn't actually check), but to be guaranteed correct, the algorithm needs to move through the pairs in order of the magnitude of their difference, which it seems to definitely not. For example, I believe it would check (2,1), (3,1), (3,2)... where (3,2) is a smaller difference than (3,1). If (3,2) and (3,1) were both pairs that had a pentagonal difference and sum, this algorithm would return (3,1) which would be wrong. Feel free to delete this message if I'm missing something. --Jmcdon10 20:58, 17 March 2012 (UTC) I have posted my solution which I think is more correct, again I'm open to criticism. --Jmcdon10 19:20, 18 March 2012 (UTC)
https://wiki.haskell.org/index.php?title=Talk:Euler_problems/41_to_50&oldid=44955
CC-MAIN-2016-22
refinedweb
155
70.84
i’m having an issue where i need to compare 2 objects by comparing a Proc which is stored in an instance var. however, everything i have tried results in a false comparison. simple example: class Test attr :action def initialize(&block) @action = block_given? ? block : nil end def ==(obj) if obj.is_a?(Test) return @action.eql?(obj.action) end end end t1 = Test.new { puts “hello” } t2 = Test.new { puts “hello” } puts “comp: #{t1 == t2}” puts “t1 action: #{t1.action}” puts “t2 action: #{t2.action}” output: comp: false t1 action: #Proc:[email protected]_test.rb:15 t2 action: #Proc:[email protected]_test.rb:16 when the objects are created, i use the same block of code when i create each instance, however, it obvious that from the comparison output they aren’t the same. my question, how do i get the comparison i’m looking for?
https://www.ruby-forum.com/t/proc-comparison/116473
CC-MAIN-2021-43
refinedweb
146
61.73
(Further resources on Plone see here.) we have used a graphic application (ArgoUML) to draw a UML model that was automatically transformed by ArchGenXML into an Archetypes-based content type for Plone. In this article, we'll create a content type product with another tool, paster. It's not a graphic application, but it's as easy to use as writing a few characters. We used paster earlier to create a buildout-based Zope instance and an egg-structured Plone product. Here we'll use it to create a full Archetype product, its schema fields, and even the required tests to make sure everything is working as intended Creating an Archetypes product with paster There are several steps to take with paster to produce a full and useful content type. The first one should be the creation of the structure, meaning the product directory organization. Getting ready The final destination of this product, at least at development stage, is the src folder of our buildout directory. There is where we place our packages source code while we are working on them, until they become eggs (to see how to turn them into eggs read Submitting products to an egg repository). Thus go to your buildout directory and then get inside the src folder: cd ./src Make sure you have the latest ZopeSkel installed. ZopeSkel is the name of a Python package with a collection of skeletons and templates to create commonly used Zope and Plone projects via a paster command. easy_install -U ZopeSkel How to do it… - Create a package for the new add-on product: We are going to create a new package called pox.video. The pox prefix is taken from PloneOpenX (the website we are working on) and will be the namespace of our product. paster create -t archetype Fix the main configure.zcml file to prevent errors: Open the just created configure.zcml file in the pox/video folder and comment the internationalization registration like this: <!-- <i18n:registerTranslations --> Update the Zope instance with the new product: To let Zope know that there's new code to be used, let's update our instance buildout.cfg file. In the main [buildout] section, modify the eggs and develop parameters like this: [buildout] ... eggs = ... pox.video ... develop = src/pox.video Automatically add the product in a Plone site: We can install our brand new product automatically during buildout. So add a pox.video line inside the [plonesite] part's products parameter: [plonesite] recipe = collective.recipe.plonesite ... products = ... pox.video Rebuild and relaunch the Zope instance: Build your instance and, if you want to, launch it to check that the pox.video product is installed (not strictly necessary though). ./bin/buildout ./bin/instance fg How it works… So far we have a skeleton product, which is composed basically of boilerplate (we will build on it further). However, it has all the necessary code to be installed, which is important. The paster command of Step 1 in How to do it… creates a package using the archetype available template. When run, it will output some informative text and then a short wizard will be started to select some options. The most important are the first five ones: Add whatever you want to the remaining options (if you chose other than easy mode), or just hit Enter to each one. After selecting the last option, you'll get an output like this (a little longer actually): Creating template basic_namespace Creating directory .\pox.video Creating template archetype Recursing into +namespace_package+ Recursing into +package+ Recursing into content Recursing into interfaces Recursing into portlets Recursing into profiles Recursing into tests ... The project you just created has local commands. These can be used from within the product. usage: paster COMMAND Commands: addcontent Adds plone content types to your project For more information: paster help COMMAND The first group of lines tells us something about the created directory structure. We have a pox.video (project name) folder, containing a pox (namespace) folder, which contains a video (package) folder, which in turn contains several sub-packages: content, interfaces, portlets, profiles, and tests. In the following sections, we are going to deal with all of them except portlets, which will be tackled in Creating a portlet package, Customizing a new portlet according to our requirements, and Testing portlets. The second group of lines (after the ellipsis) gives us very important information: we can use particular local commands inside our fresh product. More of this in the next section. Step 2 in the preceding procedure is to tell Zope about the new available package. By adding pox.video in the eggs parameter, we add it in Zope's PYTHONPATH. We also have to add the package's location in the develop parameter. If not, the buildout process would try to fetch it from some of the URLs listed in the find-links parameter. During start up, Zope 2 loads (Five does the job actually) configuration files, usually configure.zcml, for all the products and packages inside the folders that are listed in the [instance] section's products parameter. For other Python packages outside those folders, a ZCML slug is required for the product to be loaded. Fortunately, from Plone 3.3 onwards, the ZCML slug is not needed if packages to be installed use z3c.autoinclude, which automatically detects and includes ZCML files. Although we were not aware of that, when we created the pox.video package with paster, z3c.autoinclude was added as an entry point in the setup.py file. Open it in the main pox.video folder to check it: ... setup(name='pox.video', version=version, description="Video content type for PloneOpenX website", ... entry_points=""" # -*- entry_points -*- [z3c.autoinclude.plugin] target = plone """, ... ) For those packages that don't have this feature, we must explicitly insert a reference to the package in the zcml parameter of the [instance] section like we did in Taking advantage of an enhanced interactive Python debugger with ipdb: [instance] ... # If you want to register ZCML slugs for any packages, # list them here. # e.g. zcml = my.package my.other.package zcml = iw.debug There's more… Do not forget to test your changes (paster changes in fact)! Fortunately, paster creates automatically a tests sub-package and a package-level README.txt file with the first part of a test (logging into our website). Feel free to take a look at it, as it is a very good example of doctest. Nevertheless, it really doesn't test too much for the time being. It will be more productive after adding some features to the product. You may find it really useful to read the content types section from the online Plone Developer Manual at. See Also - Submitting products to an egg repository - Taking advantage of an enhanced interactive Python debugger with ipdb - Adding a content type into a product - Adding fields to a content type - Adding a custom validator to a content type - Creating a portlet egg with paster - Customizing a new portlet according to our requirements - Testing portlets Adding a content type into a product In Creating an Archetypes product with paster, we were able to create a package shell with all the necessary code to install a product, although it was unproductive. We are now going to add some useful functionality by means of, again, our dear paster. Getting ready When we ran paster in Creating an Archetypes product with paster, we highlighted some of its output, copied below: The project you just created has local commands. These can be used from within the product. Paster local commands are available inside the project folder. So let's move inside it: cd ./src/pox.video How to do it… To add a new content type inside the product, run the following command: paster addcontent contenttype How it works… This will run the addcontent paster command with its contenttype template. After a short wizard asking for some options, it will produce all the code we need. - You'll get an output like this: ... Inserting from README.txt_insert into /pox.video/pox/video/README.txt Recursing into content Recursing into interfaces Recursing into profiles Recursing into default Recursing into types If you need more than just one content type in your product, you can run the paster addcontent contenttype command as many times as you want. There's no need to modify, buildout.cfg file, as we have already made all the required changes. If you didn't make these modifications, please refer to Creating an Archetypes product with paster. Open the interface file in ./src/pox.video/pox/video/interface/video.py: from zope import schema from zope.interface import Interface from pox.video import videoMessageFactory as _ class IVideo(Interface): """Description of the Example Type""" # -*- schema definition goes here -*- Empty interfaces, like this one, are called marker interfaces. Although they provide some information (they can be used to associate a class with some functionality as we will see in Using the ZCA to extend a third party product: Collage), they lack attributes and methods information (that is, their promised functionalities), and consequently and worse, they don't document. Interfaces don't exist in Python. However, Zope 3 has incorporated this concept to let components interact easier. All attributes and methods declarations in interfaces are a contract (not a binding one, though) with the external world. For more information about zope.interface, visit. The new content type class is in the video.py file located in the ./src/pox.vieo/pox/video/content package. Let's go through it and explain its pieces. """Definition of the Video content type """ from zope.interface import implements, directlyProvides from Products.Archetypes import atapi from Products.ATContentTypes.content import base from Products.ATContentTypes.content import schemata from pox.video import videoMessageFactory as _ from pox.video.interfaces import IVideo from pox.video.config import PROJECTNAME All paster-generated content types inherit from basic ATContentTypes, which is good given the large number of products available for them. Check the Products.ATContentTypes package for plenty of good working examples. VideoSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema(( # -*- Your Archetypes field definitions here ... -*- )) Schemas specify the fields available in content types. In our case, the Video content type is a plain copy of ATContentTypeSchema, which already includes all fields necessary to support Dublin Core convention. Dublin Core is supported thanks to the BaseObject and ExtensibleMetadata modules in the Products.Archetypes package. VideoSchema here is the result of the addition (yes, we can actually add schemas) of two other schemas: the aforementioned ATContentTypeSchema and the new empty one created with the atapi.Schema(()) method, which expects a tuple argument (check the double brackets). Up to ZopeSkel 2.16 (paster's package) the storage of title and description fields are changed to AnnotationStorage. This reduces performance and therefore it would be better to change it by removing these lines letting Archetypes deal with regular AttributeStorage: # Set storage on fields copied from ATContentTypeSchema, # making sure # they work well with the python bridge properties. VideoSchema['title'].storage = atapi. AnnotationStorage() VideoSchema['description'].storage = atapi. AnnotationStorage() here are plans to remove this from ZopeSkel, but there's no release date yet for it. After schema definition, we call finalizeATCTSchema to re-order and move some fields inside our schema according to Plone standard. It's advisable to get familiar with its code in the Products.ATContentTypes.content.schema module: schemata.finalizeATCTSchema(VideoSchema, moveDiscussion=False) Once defined its schema the real class is created. As we said earlier, it inherits from base.ATCTContent; this will be changed for our Video content type. class Video(base.ATCTContent): """FLV video file""" implements(IVideo) meta_type = "Video" schema = VideoSchema title = atapi.ATFieldProperty('title') description = atapi.ATFieldProperty('description') # -*- Your ATSchema to Python Property Bridges Here ... -*- atapi.registerType(Video, PROJECTNAME) The first line in our class body specifies that it implements IVideo interface (interfaces/video.py file). then VideoSchema is associated with the class. ATFieldProperty is required to create ATSchema to Python Property bridges. These are recommended for fields of a schema using AnnotationStorage. If you still have title and description fields storage as AnnotationStorage, you should keep these lines. Otherwise you can safely remove them. And finally, the atapi.registerType() call adds all getters and setters to the Video class. This is Archetypes' magic. You define just a schema and Archetypes will automatically create all methods needed to interact with the class. There's more… We do have some more interesting code now, that's why we should be more careful with it and test it. Again, paster has appended several functional tests in the README.txt file, including the creation (as Manager and Contributor users), modification, and deletion of a Video object. Test the product with the following command: ./bin/instance test -s pox.video We'd like to highlight the block of statements regarding the creation of content as a contributor member: Let's logout and then login as 'contributor', a portal member that has the contributor role assigned. >>> browser.getLink('Log out').click() >>> browser.open(portal_url) >>> browser.getControl(>> browser.getControl(name='__ac_password').value = default_password >>> browser.getControl(name='submit').click() This contributor member isn't mentioned anywhere inside the test. Nevertheless the login action doesn't fail. How can that be possible if there's no contributor member included by default in the PloneTestCase base class, like default_user or portal_owner? If we check the base.py file inside the tests sub-package of our product, we'll see that the FunctionalTestCase class has a special afterSetUp method, which is called just before the real test begins and registers the contributor member above. Could we have created the user inside the test? Definitely, because test code is a set of Python statements and we can do whatever we want with them. Is it sensible to perform this kind of set up actions inside the test code? Absolutely not. functional tests should be conceived as black-box tests, from the sheer end-user point of view. This means that code inside a functional test shouldn't assume anything about the underlying environment, but behave as if a regular user were acting through the user interface. Anything we need during testing that shouldn’t be done by the user must be placed outside the test code, as in this example. See also - Creating an Archetypes product with paster - Working with paster generated test suites - Zope Functional testing - Using the ZCA to extend a third party product: Collage Changing the base class in paster content types All paster-created (non-folderish) content types inherit from the basic ATCTContent class, which comes with ATContentTypeSchema. However, this is a very basic content type: title, description, and some more metadata fields. On top of this, we intend to upload videos to our website, not just text. ATContentTypes are native to Plone and many community developers had released extensions or plugins for them, such as LinguaPlone. That's why it is prudent to stay close to them. We are now going to change the ATCTContent parent class for ATFile to automatically inherit all the benefits, including the file upload field. How to do it… Open the video.py file inside the content sub-package of your product and make these changes. Be aware of commented lines — they can be just removed, but we wanted to keep them here to remark what's going on. Import the base class and interface to be used: from Products.Archetypes import atapi # from Products.ATContentTypes.content import base from Products.ATContentTypes.content import file from Products.ATContentTypes.interface.file import IATFile from Products.ATContentTypes.content import schemata This way we are importing interface and class of the out-of-the-box File content type. Change original schema: # VideoSchema = schemata.ATContentTypeSchema.copy() + \ # atapi.Schema(( VideoSchema = file.ATFileSchema.copy() + atapi.Schema(( # -*- Your Archetypes field definitions here ... -*- )) Now, our VideoSchema includes File fields. Change the base class and implemented interface: # class Video(base.ATCTContent): class Video(file.ATFile): """ pox Video """ # implements(IVideo) implements(IATFile,IVideo The last step is to change the parent class of Video so that now it inherits from ATFile instead of just ATCTContent. And then we adjust the interfaces this class now implements. Change the view action URL: Open profiles/default/types/Video.xml file and amend the url_expr attribute in View action by adding /view. <?xml version="1.0"?> <object name="Video" meta_type="Factory-based Type Information with dynamic views" i18n:domain="pox.video" xmlns: ... <action title="View" action_id="view" category= "object" condition_expr="" url_expr="string:${object_url}/view" visible="True"> <permission value="View" /> </action> ... </object> Tell Plone to use the new action URL in listings: Add a propertiestool.xml file inside the profiles/default folder with this code: <?xml version="1.0"?> <object name="portal_properties" meta_type= "Plone Properties Tool"> <object name="site_properties" meta_type="Plone Property Sheet"> <property name="typesUseViewActionInListings" type= "lines" purge="False"> <element value="Video"/> </property> </object> </object> Relaunch your instance and reinstall the product. By restarting the Zope instance all of the latest changes will be applied: ./bin/instance fg Go to and reinstall the product. Create a new Video object:Inside your Plone site, click on the Add new... drop-down menu and select the Video option. It should look like this. How it works… Since the first creation of the almost empty product (full of boilerplate, though), in Creating an Archetypes product with paster, we haven't tried to use it, except for the tests we have run. We can now say that it has grown up and it's ready to be seen in action. In Steps 1 to 3 above, we changed some of the basics in paster's original class and its schema to inherit all the benefits of another existing content type: ATFile. If you had tried to create a Video content type before Step 4, after saving, you would have been automatically prompted to download the file you just uploaded. Why's that? The reason is we inherited our class from ATFile, which has a special behavior (like ATImage) regarding its URLs. Files and images uploaded to a Plone site (using regular content types) are downloadable via their natural URL. For example, if you browse to, you will be asked to download the file. Alternatively, if you want to open the web page with a download link and metadata, you should use. That's why we had to change the view URL for our content type in Video.xml (Step 4) for users to be able to open an inline video player (as we plan to). All files included in the profiles folder are used by GenericSetup during installation of the product and are to give some information that Python code doesn't provide, such as whether we'll let users post comments inside the content types (allow_discussion).. Changes in Step 5 will make the site_properties update its typesUseViewActionInListings property. By including purge="False" in <property /> tag, we prevent other existing values (typically File and Image) in the property from being removed. (Further resources on Plone see here.) There's more… We have definitely made some changes in the code. And this time it wasn't paster, it was us! Wouldn't it be advisable to test the package? ./bin/instance fg Wow! What happened? Did we get a failure? Normally, you would add a pdb line before the reported as failing comment: >>> import pdb; pdb.set_trace() Or you might consider dumping browser.contents into a file to check what is wrong. >>> open('/tmp/contents.html', 'w').write(browser.contents) We'll skip that and jump straight into the problem. The new file field in our upgraded Video content type is required. We should adjust our functional test to upload a file.Open the README.txt file in the pox.video package and search for the following lines to make the changes below (you must change it twice in README.txt): >>> browser.getControl(>>() >>> 'Changes saved' in browser.contents True We first try to save the video with no uploaded file and get a validation error message. Then we create and upload an on-the-fly text file and everything works fine. See also - Creating an Archetypes product with paster - Adding a custom validator to a content type Adding fields to a content type According to "Video metadata model" available in Microformats.org () the Video content type, as a mere copy of ATFile, has just one metadata field left: creation date. We are now going to add this missing field with a different name—Original date—to avoid mistaking it with the creation date of the object. Getting started As we are going to run paster local commands, we must move inside the product folder cd ./src/pox.video How to do it… To add new fields in the Video class schema run the following command: paster addcontent atschema How it Works.. The above paster addcontent command with the atschema template will start a short wizard asking for some options, to give us with all the code we need: Hit Enter to accept the next default values. You may get a warning message but almost no output. However, your video.py file will be upgraded. The VideoSchema definition now has this new field including a specific validator: atapi.DateTimeField( 'originalDate', storage=atapi.AnnotationStorage(), widget=atapi.CalendarWidget( label=_(u"Original date"), description=_(u"Date this video was recorded"), ), validators=('isValidDate'), ), There's also a new ATSchema to Python Property bridge within the class body: originalDate = atapi.ATFieldProperty('originalDate') As we said in Adding a content type into a product, AnnotationStorage is not recommended for schema fields, so you can safely remove the storage=atapi.AnnotationStorage() line and then remove the Python bridge. And last, but not least, the interfaces/video.py file has also changed: class IVideo(Interface): """FLV video file""" # -*- schema definition goes here -*- originalDate = schema.Date( title=_(u"Original date"), required=False, description=_(u"Date this video was recorded"), ) Again, if you are keeping AttributeStorage, the default one, instead of AnnotationStorage, remove this schema definition. There's more… We should update the test to verify everything is still working and, of course, any update works as expected. Search for the first saving action and change the test according to the following: >>> browser.getControl(>> browser.getControl(name='originalDate_year').value = \ ... ('2009',) >>> browser.getControl(name='originalDate_month').value = \ ... ('12',) >>> browser.getControl(name='originalDate_day').value = \ ... ('31',) >>> browser.getControl('Save').click() To set a datetime field, we must fill all of its date combo-boxes; time is not required though. Now run the test; you should see no failures: ./bin/instance test -s pox.video See also - Adding a content type into a product - Adding a custom validator to a content type Adding a custom validator to a content type Given that we plan to show an embedded video player when opening a Video page in our website, we must ensure that users won't be able to upload any kind of file other than FLV videos. Archetypes can validate field inputs in different ways; the most common one is the use of a validators property inside the schema field definition, as it's used in the previous section for the originalDate field. We prefer using a more modern way to call a validator, a subscription adapter, which is basically a special class that declares to adapt another one and, in the case of Archetypes validators, it implements a specific event interface. How to do it… Create this validators.py file inside the contents sub-package of your product: from zope.interface import implements from zope.component import adapts from Products.Archetypes.interfaces import IObjectPostValidation from pox.video import videoMessageFactory as _ from pox.video.interfaces import IVideo from flvlib.tags import FLV # class name could be any one class ValidateFLVFile(object): """ Checks if file field has a real FLV file """ implements(IObjectPostValidation) adapts(IVideo) field_name = 'file' def __init__(self, context): self.context = context def __call__(self, request): value = request.form.get(self.field_name + '_file', request.get(self.field_name + '_file', None)) if value is not None: flv_file=FLV(value) try: flv_file.parse_header() except: return {self.field_name : _(u"Uploaded file is not FLV")} if not flv_file.has_video: return {self.field_name : _(u"Uploaded file is not FLV")} # Returning None means no error return None Configure the validator as a subscription adapter. Open the configure.zcml file inside the contents sub-package and add these lines at the bottom of the file (before the </configure> close tag): <subscriber provides= "Products.Archetypes.interfaces. IObjectPostValidation" factory=".validators.ValidateFLVFile" /> Add dependent packages in our egg: Open the setup.py file in the root pox.video folder of your product and modify the install_requires variable of the setup call: setup(name='pox.video', ... install_requires=['setuptools', # -*- Extra requirements: -*- 'flvlib', ], .... Rebuild, relaunch your instance, and reinstall the product: ./bin/buildout ./bin/instance fg How it works… When Archetypes-based content types are being saved, after schema-defined validation has taken place, all factory classes providing or implementing IObjectPostValidation interface (an event interface actually) will be called as event handlers. According to their return values, the content type will be saved or returned to the user to fix the presented errors. The adapts(IVideo) line in the code of Step 1 is vital and introduces a key concept of Zope 3 component architecture, adapters. We can alter the original behavior of a class object by means of another class (that is, we don't need to modify the source code of the first one). The rest of the code is the validation itself. When calling the validation routine, there's a request argument available from which we can get all submitted fields (including the file we want to check). The expected return value can be: - A dictionary with an error message for every non-passing field - None, in which case validation succeeds There's also an IObjectPreValidation interface whose subscription adapters will be called before schema-specific validation takes place. The difference between this subscription adapter and other adapters is that it implements an event interface, that's why it must be configured as <subscriber /> instead of a regular <adapter />. Finally, as we have used a special Python package (flvlib), we can include it as an egg dependency in the product in order to tell the buildout process to download and install it automatically. There's more… At this stage, you already know that our doctest in the README.txt file will fail. Until now we were uploading a plain text file. But the new validator will make things stop working or at least, it should. You might want to download the source files accompanying from its web page to get the video.flv file mentioned below. You could also use any other FLV video, and update paths and filenames accordingly. To check that validation is working as expected, add these lines in the README.txt file: >>>() >>> 'Uploaded file is not FLV' in browser.contents True We make sure that uploading anything but an FLV file is not allowed. >>> import os >>> pkg_home = os.path.dirname(pox.video.tests.__file__) >>> samplesdir = os.path.join(pkg_home, 'samples') Then get the location of a samples folder inside the tests sub-package. In that folder, there's a video.flv file that we will upload: >>> browser.getControl(name='file_file').add_file( \ ... file(os.path.join(samplesdir, 'video.flv')).read(), \ ... 'application/x-flash-video', 'video.flv') >>> browser.getControl('Save').click() >>> 'Changes saved' in browser.contents True There's another upload attempt at the end of the test. Modify it as well: >>> browser.getControl(>> browser.getControl(name='file_file').add_file( \ ... file(os.path.join(samplesdir, 'video.flv')).read(), \ ... 'application/x-flash-video', 'video.flv') >>> browser.getControl('Save').click() >>> 'Changes saved' in browser.contents True That's it. Test your instance to see if everything is okay. See also - Changing the base class in paster content types - Subscribing to others' events Modifying the view of a content type with jQuery Normally, after creating a content type, you'd like to make some visual adjustments for users to view it according to the website specifications. Given that this is directly related to the theming phase, which is not covered in this article, we won't dive into those details. However, we will make some minor changes in the basic view template and supply an inline video player. Getting ready We will use Flowplayer (a GPL-licensed video player) to watch videos online. There is a Plone add-on product named collective.flowplayer that works perfectly well for these requirements and it has even more options than we are developing here. The following is just for demonstration purposes. More information about this package is at:. As suggested by the online documentation at, we will use <a />-tagged HTML elements pointing to FLV files and turn them into video players via JavaScript code. More information about Flowplayer is available at their website:. How to do it… Install Flowplayer. Create a new flowplayer folder inside the browser sub-package of your product. Download Flowplayer and add the following files inside it (filenames may change according to the latest release): - flowplayer-3.1.5.swf: the base player. - - flowplayer.controls-3.1.5.swf: a plugin with play button, stop button, and other controls. It's called automatically by the base FlowPlayer SWF file. - - flowplayer.min-3.1.5.js: a minified JavaScript file containing all the necessary code to use Flowplayer. Create this video.js JavaScript file in the same browser folder: /* When DOM element is ready * call the following function */ jQuery(document).ready(function() { /* Get all links, inside the automatically generated view * template, pointing to the download link of a FLV file */ jQuery.each(jQuery('#archetypes-fieldname-file span a[href$=".flv/at_download/file"]'), function() { /* Get the jQueried link and * a copy of it to be inserted later */ var jq = jQuery(this); var clone = jq.clone() /* Change some style options, like display (required) * width and height, depending of the video dimensions */ jq.attr('style', 'display: block; width: 425px; height: 300px;'); /* Create a flash object based on given SWF file and passing * a config object to the *flashvars* parameter * Notice the use of encodeURIComponent to prevent flowplayer * from throwing an error while trying to load its controls * plugin */ jq.flashembed(encodeURIComponent('++resource++pox.video.flowplayer/flowplayer-3.1.5.swf'), { config: { clip: { autoPlay: false, autoBuffering: true, url: this.href } } }); /* Copy the link below the flash video player * to provide the user a download link */ jq.after(clone); }); }); Register the new flowplayer directory available in the website. In the configure.zcml file in the browser package, add the following block: <browser:resourceDirectory Add a new jsregistry.xml file inside the profiles/default folder of your product: <?xml version="1.0"?> <object name="portal_javascripts" meta_type="JavaScripts Registry" autogroup="False"> <javascript cacheable="True" compression="safe" cookable="True" enabled="True" expression="" id="++resource++pox.video.flowplayer/flowplayer.min-3.1.5.js" inline="False"/> <javascript cacheable="True" compression="none" cookable="True" enabled="True" expression="" id="++resource++pox.video.flowplayer/video.js" inline="False"/> </object> Launch the Zope instance and re-install the product. How it works… The video.js file is a jQuery based JavaScript that adds a Flowplayer whenever it finds particular HTML elements in the web page. Refer to the inline comments to understand how it works. jQuery JavaScript library is by default included with Plone That file and the previous three ones mentioned in the preceding Step 1 should be available on our website to be used from the Video view template. To achieve this, we must define browser resources as in Step 3. If we had a single or particular files to publish as browser resources, we could have used the <browser:resource /> directive for each of them instead of <browser:resourceDirectory />. This change will let all files in the browser/flowplayer folder be available via a URL like. This is what we have used in the video.js JavaScript above to create the embedded flash object. Step 4 is to register the two new JavaScript files in portal_javascripts. This tool merges several JavaScript source files into a single one so that fewer requests are made by the browser. The GenericSetup handlers, called during product installation, make it easy to add, remove, or modify configuration options in almost every tool available in Plone. These handlers can read XML files with particular syntax and translate them into the proper settings. If you go to portal_javascripts tool, you'll be able to automatically make an association between every <javascript /> directive and every JavaScript resource in ZMI. Once reinstalled, when opening a Video, you should see something like this: There's more… How could we test these little changes we have made? We could just try to access every resource's URL and check if they are available as intended. But would that be a real functional test from the user standpoint? Certainly not. What the final user would like to test is whether uploaded videos are really playable online. Given that zope.testbrowser doesn't support JavaScript, we must create a Selenium test. we must create a seleniumtests sub-package within tests: cd ./src/pox.video/pox/video/tests/ mkdir seleniumtests cd seleniumtests The __init__.py file inside seleniumtests must import the tests modules we are going to run: echo import testFlowPlayer >> __init__.py Then we place the testFlowPlayer.py file inside the same folder. The source Selenium testing code of this file is not fully copied here due to its length, you can find it in the downloadable code associated with this article. However, we want to highlight the following line in the test: self.failUnless(sel.is_element_present("//*[@id=\"archetypes-fieldname-file\"]/span/a/object")) This is the way Selenium can verify if there's a specific HTML element inside a web page. The XPath expression here is almost the same as the one in the jQuery we used for fetching links to be converted in video.js of the previous section. Feel free to check the whole testFlowPlayer.py for other details, like how to upload a file. To run this test, you should have a running instance and then, in another shell, run the following command: .\bin\seleniumRunner -s Products.poxContentTypes -i plone In Windows, run: python .\bin\seleniumRunner -s Products.poxContentTypes -i plone See also - Creating the user interface for Zope 3 content types - Using Selenium functional tests Summary In this article we have covered the creation of Archetypes content types from scratch by hand... kind of. We will actually use paster to automatically create most of it.]
https://www.packtpub.com/books/content/creating-custom-content-type-paster-plone-3
CC-MAIN-2017-17
refinedweb
5,760
57.06
Back up (Make a copy of) your hard drive first, if you don't know what you're doing! Back up anyway even if you do. Windows 95 is a very different beast from Windows 3.1, different from MS-DOS, different from anything else out there. Treat it like Windows 95 and not like DOS, and it will install and perform like Windows 95. This is especially true with installation. Try to remove as many old DOS drivers, TSRs, disk compressors, disk managers, etc before attempting to install. Setup will recognize a host of such programs and warn you to remove them before continuing. Heed that warning! And if you have any doubts as to what Setup will do to your computer, back up your hard drive first! One very useful function of Setup is creating a Startup Disk to start the computer from, in case Win95 can't start on its own. Setup will ask you if you want a Startup disk just before it copies its files to your hard drive. Make up a Startup Disk. You can even uninstall Win95 from this startup disk, provided you enabled Uninstallation in Setup (If you installed on top of Win 3.1). NOTE: The Startup disk that Setup makes for you will not contain any real mode (DOS) drivers for hardware. It only contains basic utilities you'd normally associate with DOS (scandisk, etc) plus utilities to import or export Registry keys (or the entire Registry), and the Uninstaller. You must add drivers to the disk's DOS configuration (and hence you should know how to configure stuff in DOS) if you expect to use such hardware after booting from that disk. Another very useful tool, though it doesn't get built during Setup, is the Emergency Recovery Disk. If you own a CD-ROM version of Win95, copy the ERU utilities, from \OTHER\MISC\ERU to your Win95 directory, after you finish installing Win95. Then, when you want to make a recovery disk, run eru.exe. Afterwards, if you ever corrupt your Win95 setup, run erd.exe (the DOS counterpart to eru) to re-build the lost configuration! * 2.1.1. Basics about OEM Service Release 2 vs original Win95, Win 3.x, and DOS Much of the original Windows 95 install rules above also apply to version 4.00.950B, more commonly known as OSR2, or even (quite mistakenly) "Windows 97". Here are additional points to know before installing 4.00.950B: * Without special "attention", 4.00.950B will only install on a clean computer (without DOS, Win 3.1, or Win95, or any other operating system). The OSR2 FAQ () contains details on how to install 4.00.950B on a system that already has a version of Windows. * 4.00.950B's version of DOS (DOS 7.1) will not run Windows 3.1 (as per FAQ pages 3 and 12). This version's IO.SYS includes special code to block other versions of Windows from starting. (Download this patch to fix DOS 7.1 so it can run Windows 3.x). However, this version of DOS will run other DOS apps, including games, as long as they don't perform direct disk writes (even if you use FAT32 file system). * Read the OSR2 FAQ after you read this one. [ Usenet FAQs | Web FAQs | Documents | RFC Index ]
http://www.faqs.org/faqs/windows/win95/faq/part2/section-1.html
CC-MAIN-2015-22
refinedweb
561
75.4
51687/how-to-get-permutations-of-list-or-a-set-in-python Permutation is an arrangement of objects in a specific order. Order of arrangement of object is very important. The number of permutations on a set of n elements is given by n!. For example, there are 2! = 2*1 = 2 permutations of {1, 2}, namely {1, 2} and {2, 1}, and 3! = 3*2*1 = 6 permutations of {1, 2, 3}, namely {1, 2, 3}, {1, 3, 2}, {2, 1, 3}, {2, 3, 1}, {3, 1, 2} and {3, 2, 1}. # Python function to print permutations of a given list def permutation(lst): # If lst is empty then there are no permutations if len(lst) == 0: return [] # If there is only one element in lst then, only # one permuatation is possible if len(lst) == 1: return [lst] # Find the permutations for lst if there are # more than 1 characters l = [] # empty list that will store current permutation # Iterate the input(lst) and calculate the permutation for i in range(len(lst)): m = lst[i] # Extract lst[i] or m from the list. remLst is # remaining list remLst = lst[:i] + lst[i+1:] # Generating all permutations where m is first # element for p in permutation(remLst): l.append([m] + p) return l # Driver program to test above function data = list('123') for p in permutation(data): print p Output: ['1', '2', '3'] ['1', '3', '2'] ['2', '1', '3'] ['2', '3', '1'] ['3', '1', '2'] ['3', '2', '1'] simply open the python shell and type ...READ MORE If you are talking about the length ...READ MORE len() >>> mylist=[] >>> print len(mylist) 0 READ MORE Good question - Considering that you are ...READ MORE You can also use the random library's ...READ MORE Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE can you give an example using a ...READ MORE You can simply the built-in function in ...READ MORE To initialize an empty list do this: new_list ...READ MORE This is one of the most frequently ...READ MORE OR Already have an account? Sign in.
https://www.edureka.co/community/51687/how-to-get-permutations-of-list-or-a-set-in-python?show=51701
CC-MAIN-2020-24
refinedweb
347
71.65
The Quine McKluskey algorithm is used for minimization of logical (boolean) functions. This is an important aspect in all electrical circuits allowing cheaper components and assuring that the simplest solution (circuit) for a problem (purpose) is used. Whether you need to learn the algorithm, or you need help to understand it for your University classes, or you want to tech the algorithm to your students in a graphical, attractive way, or need to include it in your commercial electric-circuit simulation application, this article, and specially the attached code, is for you. The reader should have basic notions of boolean algebra (logical functions, and-or operators, minterms, etc.). Knowledge of the Quine McKluskey algorithm is optimal. Basic notions of C# and OOP are required for understanding the code, but you can use it fine without this. To properly understand the algorithm, I strongly suggest reading the following articles, written by a man with more didactic capabilities than me: Quine McKluskey Wikipedia article, and here you find a clear (but not so trivial) example. The basic steps to follow are, as shown there:. The code that actually solves the minimization problem is isolated in the QM namespace. This class can and should be reused in case you want to replace the GUI, which is perfectly possible without many changes in code. The namespace contains a class: QMTools that handles non-algorithm related problems and the actual classes that deal with the algorithm. QM QMTools A lot of attention has been given to the interface, it should be easy to work with it in a mouse only way. You just click the rectangles on the Karnaugh map that should have the value 1 (true) and press Process. The status bar indicates what term the rectangle under the mouse represents and the number (base 10 value corresponding to the binary code ) of each minterm currently set to "true". Of course, you can choose the number of variables of your logical function between 2 and 6 if the default value (2) is too small. But keep in mind that for values greater than 4, using the Karnaugh maps becomes increasingly difficult. The algorithm works perfectly for greater values, but the interface cannot keep up with it, for lack of space. Instead, use a simple command line interface for logical function input if you want such functionality. Besides the minimized function (shown in a way that allows you to copy it), the code supplies the user with a series of lists that show exactly how each step of the algorithm has run, and the status after each step (minterms with checked or unchecked state). Besides the standard implementation of the algorithm, I added one last improvement. After step four (removal of duplicates), some implicants may make others obsolete (implicant A and implicant B may fully cover implicant C); this was solved by a Greedy method ( the implicant that covers the most uncovered elements is selected, until there are no uncovered elements left ) . I hope my code made understanding the algorithm easier, or that it helped you save valuable time. Please feel free to comment, as your opinions and ideas.
http://www.codeproject.com/Articles/15756/Quine-McKluskey-Algorithm?PageFlow=FixedWidth
CC-MAIN-2015-27
refinedweb
524
56.89
Random picking of sounds as variables Hi there, I am setting an experiment about sound comprehension. Here is the general loop of the experiment : As you can see, there are 96 elements executed. The plan of the experiment is 2 * 6 * 8. The elements are regrouped as follow : 2 main conditions 'a' and 'p', 6 conditions of silence by main conditions and 8 sentences by silent's condition. I already have 12 files (silent conditions), each filled with 96 sentences. Now, what I want is to prepare 96 sentences in a inline script, so when I start the experiment with a subject, the program will pick randomly 96 sentences with this rule : 8 sentences * 12 silent conditions. The general idea is to counterbalance the sentences between subjects. Unfortunately, I am not very familiar with python functions. So if people can help me to design the script it will be wonderful. I hope this is clear, Thanks, Aurélien. Hi Aurélien, I don't fully understand what you're trying to do. It seems like the looptable is correct the way it is, right? Is it a matter of selecting the right sound file based on the experimental variables that you've specified in the table? I.e. do you want to map these variables onto a file name? Details would be helpful 😊 Cheers! Sebastiaan Hi Sebastiaan, Thank you very much for your answer. I advanced a little. I had one problem with this loop : I need to play sequentially [silent] with [condition] (for example, I need to play sequentially the [sentences] of [silent]=0 and [condition]=a, so 8 sentences). I'll try to be as clear as I could. So, in the most simple way, what I need is to define a variable (a category of sound) and fill it with random sounds in the pool. Because all my files, in this example, are named like '20p(number).wav', here is what I thought I should do : So, theoretically, I now have one condition '20p' with 8 values, each corresponds to a real .wav file (for example '20p1.wav'). What I need now, is two things : 1) implement all values of 20p in a loop, so the loop will run randomly the 8 values (20p1 ... 20p6... 20p24...) 2) play each 8 values in a sampler. I thought to do this in the script of the sampler : but if I do this, it will try to find something like '20p[0 1 2 3 4 5].wav' and not '20p0.wav'. Maybe, this is to much for one post ! Thank you again, Cheers, Aurélien. Hi Aurélien, Ok—it's still not entirely clear to me, but I do see at least one basic confusion: The variable 20pis a list of multiple values. But then you're trying to use it as though it's a single value when you specify the sampler. And that's where things go wrong. Does that make sense? What I would do is first define a random list at the start of the experiment (or the start of the block if appropriate): And then, at the start of the trial, you randomly 'pop' one element from that list and use it in the sampler. Something along those lines should get you what you want, I believe. Cheers, Sebastiaan Hi Sebastiaan, Thank you for your advices, I solved the problem! I generated random value and assign them to my var : I put the script in the bloc sequence so it generate new random numbers every iteration (at last, I think...) and i1 to i8 are the value of sentences. Than, i1 to i8 where assigned to the variable [value] in a loop. So if the sample play [value] for i1 = 12, the sample will find and play the file 12.wav. Next step will be to access sound files not in the pool but in the experiment folder because I have 96*12 files. I will post the final step (hope it could help someone even if it is a bit messy :) ) Cheers, Aurélien. Good to hear! 💪 Here I am with more info ! So, if you want to play sounds as variable and randomly picking them from a file, here is one way to do it (I picked some lines of the script in this forum so thanks to everybody ! ) import os import random #set path and list for conditions folder = r'C:\Users\condition' list = [] for file in os.listdir(folder): # 'file' can be replaced by any 'name' if file.endswith('.wav'): #for other type of files path = os.path.join(folder, file) list.append(path) So now, you have a list with path of .wav files. Let say, you want to pick 8 random '.wav' from it to set a variable name sound: sound = random.sample(list,8) Now, you want to play them without repetition, place this in the beginning of the sequence : play = sound.pop() #every time play is executed, the file executed will be removed from the list var.play = play #set the variable 'play' for the sampler Here you are. I think it works !
http://forum.cogsci.nl/discussion/4958/random-picking-of-sounds-as-variables
CC-MAIN-2019-47
refinedweb
853
82.04
I’m working with a CAD file that contains over 6K objects that I would like to subgroup according to their display colors. None of the objects have material colors applied, only display colors. Does anyone know of a way or have a script that can accomplish this? I looked at CV-Object Manager Tools but do not see this function in their toolset. Any advice/help would be appreciated. Select objects by display color Unfortunately, a script will not be possible. The required function to obtain the display color from an object is not available in the Python SDK (apparently). I have started a discussion thread over at the PluginCafe, regarding this. However, a C++ plugin can be created to perform this action. But where a script would only need to be written once, a C++ plugin needs to be (well, maybe written once) compiled on pre-R20 Windows / macOS and again R20 Windows / macOS. Meaning that it would require 4 project files to be set up for the same number of resulting plugin files, instead of a quick single one prototyped in Python. EDIT: What could be done via script is to look for the same Layer (color layer). But I guess that doesn’t help you in your particular situation. As mentioned in the PluginCafé, you don’t need specific functions, you can go through the properties: import c4d def main(): selectlist = doc.GetSelection() for obj in selectlist: print obj.GetName(), " ", obj[c4d.ID_BASEOBJECT_COLOR] obj[c4d.ID_BASEOBJECT_USECOLOR] = True obj[c4d.ID_BASEOBJECT_COLOR] = c4d.Vector(0,0,1) obj.Message(c4d.MSG_UPDATE) c4d.EventAdd() if __name__=='__main__': main() To write a selector, one would need to know how the selection criterion (the color) is supposed to be entered: a dialog with a color field? hardcoded in the script? RGB values in 8 or 16 bit? Vector range 0-1? By sampling an object? Here, have a selector by sample: import c4d # Select an object with the desired display color set. # The script will select all objects in the scene with the same display color. def doToObject(obj, color): if obj[c4d.ID_BASEOBJECT_COLOR] == color: print "Object found: ", obj.GetName(), " color: ", color doc.SetSelection(obj, c4d.SELECTION_ADD) return def traverseTree(obj, color): if obj==None: return while obj != None: doToObject(obj, color) traverseTree(obj.GetDown(), color) obj=obj.GetNext() def main(): selectlist = doc.GetActiveObjects(c4d.GETACTIVEOBJECTFLAGS_SELECTIONORDER) if len(selectlist) == 1: obj = selectlist[0] if obj: color = obj[c4d.ID_BASEOBJECT_COLOR] print "Search for color: ", color # maybe check obj[c4d.ID_BASEOBJECT_USECOLOR] root = doc.GetFirstObject() traverseTree(root, color) c4d.EventAdd() if __name__=='__main__': main() Note that the script does not check whether the display color is used, so if you have objects with the same display color but the “use display color” flag is not set, these get selected nevertheless. Cairyn, thank you for your time and effort posting this script. It works perfectly and has saved me a lot of time. Thank you again, Ron Hi @LonChaney. I’ve seen versions of this requested before, so I decided to write a couple scripts tonight: You can get both of them for free from my dk-sandbox GitHub Repo. Cairyn has already addressed your needs for this project, but perhaps this will prove useful to future folks dealing with similar CAD data.
http://forums.cgsociety.org/t/select-objects-by-display-color/2050047
CC-MAIN-2020-10
refinedweb
548
58.89
Red Hat Bugzilla – Bug 56078 Uses non-standard C++ code Last modified: 2008-05-01 11:38:01 EDT Description of Problem: Dejagnu doesn't compile with gcc 3.1 because of its usage of non-standards compliant C++ code Version-Release number of selected component (if applicable): 1.4.1-3 How Reproducible: 100% Steps to Reproduce: 1. rpm --rebuild dejagnu-1.4.1-3.src.rpm Actual Results: c++ -DPACKAGE=\"dejagnu\" -DVERSION=\"1.4.1\" -I. -I. -I../.. -g -c unit.cc In file included from /usr/include/g++-v3/backward/strstream:51, from ../../dejagnu.h:70, from unit.cc:4: /usr unit.cc:4: ../../dejagnu.h: In function `char* testout(int)': ../../dejagnu.h:115: ISO C++ forbids declaration of `ostrstream' with no type ../../dejagnu.h:115: parse error before `(' token ../../dejagnu.h:116: `oss' undeclared (first use this function) ../../dejagnu.h:116: (Each undeclared identifier is reported only once for each function it appears in.) ../../dejagnu.h:116: `ios' undeclared (first use this function) ../../dejagnu.h:116: parse error before `::' token ../../dejagnu.h:117: `ends' undeclared (first use this function) [...] Expected Results: package rebuilds Additional Information: STL classes are (enforced) in namespace std these days. Adding "using namespace std;" will probably be a sufficient fix (and won't break older compilers, unless they're old enough to not support namespaces at all) Yeah, I know about it. Should be fixed in dejagnu-1.4.2, which I was waiting for (but now I see it has been released already).
https://bugzilla.redhat.com/show_bug.cgi?id=56078
CC-MAIN-2018-26
refinedweb
252
53.58
1,97 Related Items Succeeded by: Nassau County star Full Text dh __ [:':' L I . . ',, t' Jtiotib Jiirtot _ - ::1';' . "' . . : VOL. III. FERNANDiNA FLA. SATURDAY, JAXITAUY 1 )1881. N O. G, jr r.lt' STATK 1'1I ir.s.Ctay. Judge 1.1:. \ mn1im's law oilier was: burned, I I TJIK: (7IKI.sr.1MS HOLin.ll'S{ ..1V'1)i I planter, staking large crops of r"ttu! i. u rn, Thi"l\tiOI of tho gl'II'rl.I"IV:: of o irsi I but his books and faPPts11'et'e'58Vl: : : ; noinsuranco. inur ir.ts noxi Aitorr oat, :sugar, :syrup and l "tittaCM: At some i : : The McCall hoarding-house was I riAt\isriLu:. future time, will give you a description of change in the :South:of sentiment which t taken; place j A. 11. Moss[ : from lluntsville, Alabama 1 also burned, but, the furniture -\\11", saved) ; | 'I'n Ihr tolitoi-nfthc! Mirror: his plantation and his: management.In : ; mentioned. Dueling In regard! which to the wa utletc's+ at above time arrived here 'e tcrday, accompanied by nearly no i insurance. The attire of the /:1'1'1'IICW"plpl'r 1 The season of joy and festivity in the cy- the! afternoon. Dr. Uacoii: gave/ a five lot only countenanced, hut generally 01H ar-| J' I twenty person*, old and. young! drivinglive proved of as: the fairest tnort i : i is a total loss! ; no insurance.: do of time has come to ns again, and making matinee at I Sopor': ) : Hall, in (ClII> iineville. t for of settling diflloulties 111\:11'1111 hundred sucltpar- 10.h' tennis. 'rehlpl one The cause: of the lire i is unknown, but it i is I ready for the holiday the businessthoroughfares the entertainment of the white ,children amid man: has into di"rcputc 1'h\I(11 both man ties will in the coming !see our lam ro\\1 \ year supposed to. have ul'i illah',1 from :stove in I I of Onincl''jJll''l'rl' crowded and at night exhibited for j.I'OWIIIIII.1 young account of the farcical naturoofor.oli.ilf the with just such eyes: as these: men see it, and the store. The total loss: i is estimated at &:!,- all the week with teams and carts and the people, charging an admittance fee, the duel fought of laic year*, and tIll murderon ) proceeds consider it,as Mr.Thnddcus[ Iayidseepresscd circumstances whilh have attended, thl'othl'r 500. t'ltinu. business marts thronged with purchaser* to t"i be applied' to pun-basing a libraryfor ) ) half, while to ns yesterday, "The best land that ran hi Gnilstlcn. carrying 11' (rotireakdweapons supply the hundred* of :Santa t'laus' who has led, This the children laudable act. Iris elbrtsw''re to so many sickening and and settle . found! andcumc it11' TIIK. Mr. PI.K\\XT: : COTTON( : MIM.S AT \\'olllllIIake thousands: \ of happy soul* on appreciated! by a large and intelligentaudience. r"'I1ir I'4II:< as to t: justly render) the ,. .wa an unbiased! voluntary expression on 11'unl1'ui: '-'u:m n\T: .1TTUVmxr": V Christmas morning. 1.'riotl1\" lovely Although 'the Doctor) is : tllll 1,10rlC, stringency 1.1' the lrrnluserl his part for he is not interested in the land an amateur I ailt tlth prai ti'ces !i, .south Srcx'Ks'e :saw on exhibition jostordaysome : ; 11.lr.l\'igllt :o.ulI..hhll'llIll11'111.\ with happy he i is and the master ' to the amount of dollar but, has a keen a magician; wonder ('II'IIIII1hltlal : is! detcrm'tied,I to put one sliver. carded by the 11 It. Pleasant cotton people anticipating u brimful I of enjoyment.Christmas was- 111\1 upon thl'l and, crush eye to detect the beautiful' : in nature, and mills 1'1'011.lirt seed (cottim, at the rate morning i was echoed l in amid 1 tll'l out forever within her border*.--.'-lr- discern actual worth. ft..J. M. Moss[ : : from Not that his thing were rich or rare, I, AVlCX.T . . of twenty-five pounds of lint per hour, or the "Anvil Chorus" and a gentle .!lII1'1'.1' 1/11 . Hilt how (the 111'\'ildiI'hl', them there the same place arrived[ on to-day's: boat, gel ; 22":! > pounds: of lint per day 'i ten hours Amember tea IN rejoicing this: mild and pleasant dayover from below, accompanied as he bysome for I those who most 1II' .VnrMtltor Set tlem. says were I'r'lIl1t'I'rl' unable . I' of the company informs us that the 'the birth of the baby Emmanuel'the: 1il'll'l'lIor And soon detect his trick. b the : mtNor Florida Mlm : ) now as to The little : twenty. mills will be in full blast: :snot We are :Saviour;: of :Soul: *. Peal after peal cehocd to boys a* he gets little rest; lor he says moving is I who asUtt l him )performed; partscry PKUX,\xinx \, Decombcr'Jtl: tvvil. jInn anvils impromptu much. gratified to kilOthat this enterprisewill : the report lit'II 1101.1'1lr more awfully tiresome, work::> on the ridge will prove success.' : Our county needs enterprise cannon: for the occasion, reverberating well, and I if the Doctor, doe* not look out, my arrival 1'\1 the Northwest a Ii\ commence with a vim, and he pushed to an they will lay him in the closet turn Kip Van day: ago I failed to give you, :11 you requested - in this direction' and this through the salute : : we hope :: space returned : IIt'l for here have IlIl'n'ho the result of my rip( l'i .securingimmigrants accomplishment, we Winkle snoo/e. or spirit' him away to a Santa IIHumflC'tllril1g'I'lItlll'l': will encourage others our sister villages: then the bang: of hundreds made it all their lives to I (Clans Ilnll-"III I or '.. have point burn a 1:1111I1'I a IIItl. I to do liketvi"c. It'tlll'l'e is profit in the of guns, and pops of ,Chinese firecrackers in earnest.:; -The orange grove belonging i' manufacture of cotton we can :see no good from every boy who could raise I I have 'told you chiefly of what we have. I found tho \\'lntlr'r n-vi.ro, and wa Mrs. J.. 8. at Magnolia which compelled to cut shurt'timy intended operations to Houghton, reason: why such prnlit I-hlllll.ll1ot be gathered dime nod a box of matches or a cigar :stump. I loin ; now I will tell voii of'hllt we are the is in of J. ( t : My I (t.> visit[ certain charge J.Thomp I IIldhlllllll,1'l'l present year l by the fa I'll 1 l'l'oI11,1: business: men of Many[ complaint t* have been entered against going! to have You newspaper: men are :son, i is one of the most: thriving we have the South. T. J. Davis: A: Co. are entitled to the Dominican and old Topknots! for their always so Indiscreet : like old Mr*. !Parting- cities: and trl; 111.1 of friends: to our (GiO and lemon :Stale; ; give (to them all possible Information, visited.: Thcn'Ire orange the credit of putting the ball in motion, and. parsimonious supply of eggs! but Christmas ton when I Ike gave her a secret to keep) she : trees iiitllegrove, only one of which, however we hope now to see it roll on, gathering morning they 1':11I11'I: )! like :splendid kept it-yes, kept it /going. This is confi Irilh'lllll verbal ; get one "r more to visit ; , bore this !>il'Uson.llllll from that there force and momentum, until every lock of hens and disgorged profusely, from the 1It'IItinl.'i: were taken 2,000 oranges: and the best flavored cotton! raised: in the countyill be' manufactured abundance of cgg-nogg seru-d," up; even Peter presides: over (he Arlington, is going to give return and verify my statement<. it iII fruit we have ever taste i. There are into thread or cloth. 1 before it leaves Oliver's usually pale countenance flushed: one of the most: fashionable; and elegantNewYear's the confidence II' the entire community, one hundred trees in the grove coming into I the county. Let our o\\n l'l'ol'h'IHI\'I'' tlllI and grew a hl' g'htcr'I'll as he, tipped and : : balls' : and :supper of the season, and every 11\lltl'n'1-t.l becomes' n worker bloom, and the prospect; is fair that in a few I benctitand advantage of all the profits bo tipped again, and pronounced it ";ooi>, at his and invites: all of his friends, to dance and in our behalf.. During my last trip 1 visited years the grove will yield its owner a handsome I derived from the manufacture ul'1I1I thccotton I I auction mart. sup with him especially[ newspaper: men ;; "I'n'rlllcloilt!and brought with mo nlulI.'r There also in the persons Will will possibly remain are revenue. nurseryJ20 be hand. ot they pl'Olll1'I'-IlI'mltl. Ere 'twav noon the tears were dried ; theclouds so on trees all we believe budded, and ; t here permanently. C Others will passupleasant young Man roe had passed and t the li'cII' mint UI'Cgrt'W Very truly yours, ready to be added to the grove. :Several: hundred bright, which h'll111 l \ to believe :she FI.I.IX: M\vnruv.I winter Ilcll.tllrllllf. A. number seedlings are yearly being budded and Mr. KWIIII: of Miami[ \\'ill"Ol1tl'1-t' till :eat ) who could not get ready to canto with had taken trip with Pete from the glow of added to this already large grove. Mrs.[ I of Dr. !Porter.'ln' the' ensuing II' i.llItl\l'I"- her sunshiny brightness., SJI'Ill.I.\'U IllWUU.llS S1'11 the party have arrived since, mid others will Houghton hlIL beautiful location and I :Steamship: : Ailiniml i is: doing a good business: CAKOLIXA.Our be here the coming week Each: satisfudsettler when she builds there, as: we learn she intends : with passengers: to and from Havana.-.\II One round of hilarity and rejoicing at all sister state across: the river has made or happy visitor becomes ai: efllcieiitimmigration doing at no distant day, she will havea island adjoining the mainland), known as the private residences 1I11111'1I111il' place' told[ till her mind\ t for;, rl'l'rllllIlIcI, : is rcmovim? agent among hit rime of acquaintances - ': charming and attractive! home.The Dismal: Key, has changed its name to Pair- that: everybody bad abandoned[ themselvesto ancient landmarks with unsparing Jaal" and every linden* thin formed very rtrccn Cove fyriiiy. field, and i i" furnishing: us with line sugarcane pleasure and, enjoyment As the daywore This determination Is conspicuously shown becomes I source III'l'II't 11 t supply Those in the manner in which she Is handling) (liequestions the The coloredmasqueraders changed. . 11 it vat. fruit and vegetables.] : It i is occupied on, scene : dueling and[ carrying concealedweapons. who came: under my I immediate l'harl''I're, by Mr.[ Higgs: and others.: -AYy.Orange. \ : on horseback paraded; : timestreets if you choose \ give their unciea , , In the United States court on Friday of and dressed in tl.l'1I0..t , wearingfalse: faces :; The act against, 11111'1i1l'hidl ha* already .rll'lnl, wife and live dll.lrl'l, Mr.: .1. D. last: ,week, the grand jury brought eighteen \ grotesque: and ridiculous! manner, andperforming passed; the House of Iteprosentallvos meal; 2u1 <! Painter wife nod[ - daughter r. eo. Fuller of Altamontc who , Mr.[ T. I;:. re- J1'11'1.k. indictments. IJetwee'i thirty and forty which will ; ; . prmrnmptlypasstheFtmtteScnmiteis: : ; i the most ridiculous: and laughable [ [ : his death falling through nn Mr*. M. Keys, MNs: Ida llabb, t 1'"rllt.lyflll ; indictments have been presented:; so far during cently met : by nlltil''I'I: :<'JII'4 11111 Mm''* Ht.Mi: with the! most: stringent; on that !luhjl".t'e daresay the term. The grand jury was excused open hatchway on the steamship: ; H'entern in the Union.' TIII'II\.t In question begins Washington county 11'1; Mrs, MePhctridge - 7Ar at Pla. while returning his' llui Ditr.M M uou, whose! face was as by asserting; ; that inasmuch considerable : und son, Mr. .Aqullla : ) . , /from further service until the 12th of January. .' black as! tolrh"1'olor..1 Nights* us 1'01- uncertainty\ has: heretofore+ existed[ In[ I visit: C/oiincetlcuT; ;li-o'ic"I'i\1\ll, live l'hl }Ir. L. K. Corhmn nnd from to wns Ilr1 tV" a : .-The old building recently occupied could be made regard[ to the administration!! of (he law orelaot nights \ very agreeable l i another gentleman t whose nano I do not Townsend store highly respected citizen of Orange county against dueling, it i"1I1'cl'1I1Iary that !Iul'lIIIlW by Mr. I'" as: a grocery nearClark's marches "Pixie'ml' ! mill has been demolished the lie had been resident of Altamonte for music, playing' : should{ be [plainly declared and (hen it .proceeds remember I 11'11 111111 Ilt 011. Ind. ; find11r. property : kee Doodle\ ," "Put Me in My Little. Hcd"and declare,' it "so [plainly' that tlll'rl'I'1I11 I ( 'has. Knupp and , and bail the good will and having been purchased; by the Jacksonville eight years, won : overture to tint dusky damsels: : who showered bo no possihto[ : mistake IIhulIU it in future. Itpro'loIl'14 1.iJa I! f'lll regard of his neighbors and all who knew LI\I"vll.", Ky. Ilxh'l'l In all, besides the & Fernandina Kail road. This was one : thcir'l'l't"i' smiles the band I that whoever shall challenge: >t on men, of the oldest buildings in the city, and[ was him. He hll.ll\ daughter about t twelve yean another to light lit sword, [pistol' rapier, or 1.1lrt'lI.:1111'. : have settled I, others are visiting - occupied as a grist: mill before the war.- of age and his: mother, who lived[ wit II htm. the Drum Major in particular.Tho : any other 11all I'rllll"1'111"111., or who shall and spending time winter lit or 1'.il resident[ of latest feature In styles 1 : is the brightred accept any such dllllll'II1W111111: for, every Waldo, and have drilled Into other Tom William formerly a :; oth'f The annual conference of the Methodist; such utlinsetin! : conviction thereof, be' deprived Jol'i: *copal Church will convene in the Zion Orange county, but now living on the westside rose colored hue given to the cheeks of [ of (he right; of suffrage, and\ be disabled : parts of the Slate.:: All are satNr'od hi o far: the ebon lassie, remarked by all as becoming. ,I forever iioiu I know and will use best 1"' toget M. E. Church, in this city, on the 3th of of )Manatee may be regarded as a suc very holding any ollice of 1"1 thll i'lto \ cessfnliairad.. He recently went up on a Some of the wicked buck ra boys. profit or honor underfills t :state, and shall beimprisoned their friends to follow them.My r James Warren will January. Bishop: pre !! in (he l penitentiary for' a h',11IIlIIt thought. it was the :stain of poke berries, operations have 1 on side. During) the session: of the conference two weeks: camp hunt. The firstcck he exceeding two years: at (the discretion 1"(1'luh.t I the corner stone of the new 7.illldlnrdl killed seven bears: and, three panther The wlall'othI'.Il'clarl'll it was paint ; that was the court. And in 11"1'1111) [person: shall kill mall and I very economical M'alc. The expenses will be laid.-Dr. Kenworthy informs us next week he bagged three' panthers: and two voted down as i impolite--women never another in any duel, or ..hallllltlkt n wound have been met by private parties paint-and all declared tin- 1<'01'111'.1"'I'I'C or wounds 110111111)[ person In any 4h".11i0IL04 having connection with State othcials or fine bucks. The result of the hunt foots \ that Mr. Ernest Inge-moll:; of the United up the \ or so wounilcd shall , [person person their! unit the Dianas) .. I have the :States: Fish Commission, of Washington, seven bears, six i panthers and two deer. This changing spots were thereof die within the space of six months Ilhlil'IIII. 1'1'1\.1111 ('olr- 1). 0., is in this: city. He has been detailedby is'crowdinga good deal of successful: experience acquiring them, becoming rosy cheeked on then next' following, t mat such person[ lif) (,i', I 1111.1 desire: from the nfj'.cials: of into short time. Mr. Williams f is a an [invisible white surface. Jokes aside, killing i another, or so wounding any [person most of the line of transportation whoia Prof. Haird, of the Smithsonian; Institute : t tsides comments were made on the red- or [persons: whereby such (person or IK.INOIISso have had the This+, Ill'-l to investigate: the turtle and shell fish" interest successful; hog grower. He has an excellent many wounded I shall die as aforesaid, being pleasure IfIWf.tllJ. which he his hog! cheeked ebony' ladies as they promenaded convicted shall surfer death asin tint saving much C has Indicated) u of this: t State-. The results: of his investigation range upon keeps stay case of I I'II"l will be included the reports of the ing with and caring for them hinnelfi It is the street: being a new feature III the fashion wilful iii iruler." Then, lo make the law on ppirit of ('cooperation, mule my mission to state that ho seldom plate not beard of before. Collc: )"' this subject still mine stringent, tho act further I in many respect*, a phiiaat (lilt'. hardly : census of 1880. The gentleman leaves for necessary provides that whoover shall boar u I fashion editor will have to toliaincsville 1 11. H. PLACE.Waldo . come - St. Augustine: to-day. We trust that }persons' loses a hog from the ravages of vclrlllitmts.uOranye : challenge boa witness to n duel, or be in the beret/ tumult, to get the latest.It . whatsoever [ residing on the mustvitli: whom he may ( CuwtJll'plJdl'f.. any manner mixed up In such a dillkulty, shall be forever' disabled from IIfUN. come in contact, will aid him in every }possible : Judge Dolling linker, of Maitland. died at would have done! you good: to have holding, any ollice of trust or responsibility C Captain Doles' new two-Mory)' resblgicise'tuplcte(1uul j manner to further his investigations.Union. .- the Poyiitz House, in Sanford I, Wednesday been at the J. K. ISfvillc plantation I in tin "state. ; ,,111I11111' imprisoned in Ihept'nItenliary I is quite an addition t to oir on (Christmas morning and[ witnessed!!: the fora term not exceeding two morning, the 22d: ill!>t., having returned sick year, little t . at till discretion! of the court, ami shall be city.'the old! -time ceremonies of the plantation ! Adam Cooper! u colored man employed as: from Enterprise: last t Hatllrl1a)'. I His remainswere I l.of canal will fined I [ U sum not less (ban $.Vio or more than JIIIJ; tllkl hI('ullldt.tIII rook on the scow connected with the dredge sent to his home in Maitland, where negroes, going from the quarters up to :$:!,I Ntlm. llc..idcall llmiv, it is required that a few week. .lx>at t'httcf, was: found drowned yesterday two estimable: daughters are left to inouri! ) the big house (the. master's residence) fur ,I hcri'iilter all member of t ie general assembly : The new jfc. Knight! .1' (::,;i. tlll'lr1..11:11 Christmas treat and presents.About and all ollicers/ now required 1 totake and !\ llillt Coroner loss Deceased moved from Tallahassee morning near the cemetery bridge. their great !! situated at the Waldo of the Santa subscribe to tho oat li prescribed 1 [III article IJ. hrllllll04 and of hundred : , m sixty Jordan held, an inquest: over the remains at to Orange enmity three years since, negroes section a: +) of lhestate constitution shall, jir 1011111111..11 i full operation umi'1111.14! fair to Oak's burial rooms. Prom the evidence k and is acknowledged; 1 to have been one of both sexes; from those" bowed 1 down with i addition[ theretoSulenumlyswear bat lie lias be one of the largest Industrie*, 4'1' ( kind, appear that Cooper :started from the dredge the best: informed lawyers in the:State.; Many the weight of age, whose hair was frosted 1 I never participated in, cither as principal in, in the tlt with time, down to the piikuninny in themother's I I or second, or in any manner whatsoever tlh' boat about 7 o'clock evening to sincere friends here and elsewhere will Monday go The Peninsular road daily briiig'i set eml IM-CII an aider! or abet ter of, U ltui'I. We IlIId.Iwe his wife, and was! not seen alive mourn his death.&tnfurd Jnufitnl. inn' formed in procession: the i I hardly think there will be any difllculty [in orange' toaill... cj r*. afterwards. Dr. Kenworthy, whoexamined St. .Joint men, as U their custom, in the lead, brought : construing "such a law as that, should it ever cur1"t:\ h. the up by the women, hi their neat, tidy dresses, I bo placed 1 iqMdi (the :South Carolina statute .rt body, which had a slight \\'oulllion the tlr.1)anie1( J. Martin returned l from his I hooks.The. The rice mill) South of ton it In full right side of the head, was! of the opinion visit to the beach near Matanzas inlet, on and gay-colored gingham turbans, lieudcd provisions of (the (bill against: carrying bla t. , that the deceased was accidentally! drowned, successful in with all the musical talent on the piantati.nIh.ldiv's I concealed' weujmns) are equally a. stringent. \ Tuesday, havirtgbeen: !! recovering I The recent town ('11':101 I..dtu! [ in the having probably fallen overboard from the banjos tambouiinci, t triangles It declare; that any one found with any [ . theb Niy'of ids brother-in-law ) r )Felipe' elect ion of I' and IJI JI 1&''', to White bulks knew what it deadly vvcaixm' usually, used[ for lurl"/I'Ol'1I| of : .> scow which was moored to the bridge at Hernandez who with his wife lost were on M \.i\ lhs kiaum. offence or ilofcnce. concealed I for them. On the time Cooper was last! seen, and in falling the {I'era ,'r,:. The body was fully identified UU1I1I'a1lt,11Il1 were lr'llIm..1 Soil shall bo either! fine I or imprisoned I IIl'r- Minimi$. J. Kennard, Jr. ''"_, :struck the bridge or some log in the creek. and has been forwarded North. Mr. reaching the house, they marched tbsectinuNm both I, in the discretion of he court. It fur- 'rl' all Tre The jury returned a verdict of accidentaldrowning. the fact that Ids around to Iretlte buckets of punch twrrvih1, that I )IHTNOII become; en- ( !: \ Martin, notwithstanding and 1.111)1111Rwl ringing praWitto or Is convicted 1 'if as .\\ltletinen-KobcrtV.. c'ull.t."il.!) 11. luin- .-aim und J'(t/l.. sisters remains wen buried near the shut the ctrg-"t-)5t mauler and IlIi..tl'l"Vlu'll they j I IUO.Hi. assault and[ battery, assault with in ,1'ril, T. M. (Cauthen. Peck, IP Jenkim.Some , Heal estate is again tending upward in where her htialiandjwa.s I disintcrrclaid the I'nt kill or of manslaughter, and/ it shall of the alcove named are brought in front. In regular order the I t"'ltlII.J up I the trial thut be drew .e on 'thsi" city and vicinity. Jacksonville]] will efforts to find it on Ids part and those who proven a deadly Northern men and )jy-publicau*, i assault men ami I women wt'rciC'rnd with their weapon, or Cflllitt..1 l ( IutJIIl.cu Atlanta in the and business in three at the time of burial failed to tl. 811. which) show that hI"Mfccutcd equal were )present drink and ping of tobacco) and cakes, randies '. u weapon &'II''ul11 lei the tune of il WIM f'l n: years. Now is the time to buy propVrty.Kvery .- lo s.i owing undoubtedly to the want oflandmarks : offence in uMitol tho punishment for for opinion's\ sake, X. . I and toy M the women and children.After . the crime [ : thing has been put in readiness at the and the shifting and constant : wtJltle may L convicted he they hail drained the bucket and 1111'11 shall bo tried carrying the rice mill, and the mill will bo running to moving of the Hand on the beach. Mr. )[ become filled with the spirit of gcxnl feeling )>n<\' (,iilkt.1) weapon! or weaiorltmand shall 1.IIJr .'WJY. TICK'.A LM \v v; for 1*.t Is! out I:. I day. Two cargoes, containing .,. ems: of rice, are expected here every day. The (>f his sister will yet be. found, us the (-( fur not less than three nor more the Iim.tu.tJ of he wtutimer-their + long life and .pro>qrity to }faN John" ami than twelve month*, with or without hard WhIIW- 0' )proprietors of (ho mill, Mes.r-. Poster, )[uc- In tbt-jvicinity of the btiich fur miles buck vcritutoIJ in 1SHO ; how | )1i04"lloe Lizzy, ruck up their mu"!c and labor, or 11'1111 a sum of lot Ice (ban two ' fluff it Co., inform us that they have alreadycngu'ged are all deeply interested: and will use every songs, and returned to their! quarters, men Illdro [ or l fUel and imprisonedIxitb against lightning; when it !'I unsa'c tovttlt7' O.OOO bu-heU this ";""d m.-Uuion. Kisible means to find the Is ily. Mr. Marin ; 1111.1'IJI.'U joining i in I lit chorus, whichMam at the di"'retlJ tlt judge. I will deep well, mine, etc.; how to !>u'*"# IfMroast . J.\BGE'1-"RIo ix 3I.ui"IX'-J"L..t :Saturdaymorning speak<< in the most flattering terms of the'I rcinciulM.Tvd I that I few )'* ago .con ; cause of blight in fruit trve-2 wav : I dcnuicd! editorially too common 't aliout o'clock, a fire broke out in eople in $Augustine and on the coast '. John ltw'ill, I jierniitting 1t'1 tlt engage in affray I.rtkefr serious much other valuable matter.. A! .." af; . the store of Register liros in Madiaon. The where his cad duty called him, receiving: an Ills head' lebojHighhohuui.- 1 or otherwise, and who, in the difficulty, the present surptis-scs mums former lo iHripractical *tore and cuntents'n' bllrlll 1. The stock;: he saysthe, must cordial) treatment from all, )I < ." draw (''1I1'clel weapon, to CM-upe the cams ) information. For ..trnp<4i . wa fully I 1. covered by insurance, and the and their kind sympathies and) effort to Mu.i<%, kinging und iUnchi;l cun-titutc ,lime ..llll.lwrhut oflenc1, and of.. treating In ( i and term to the trade, send tw *ityThompwui .V building which it-as the j'roi'erty of J. .\. assist him in completing: the object. of his. pleasures of the fla)' 'UII" nixht. with theirimrlluuutlnuer. W the South Carolina importance.1 legUlalure 1.r"I"r tM.IJI Tier & JJIIingston.A'3 puht9t , l'urramort''a" iiiMired for a small I'UIII. I \'I"it.-Sl J'jhui WteUy. ( : Mr.licvlllcI( isu um.>*fiil I, decal pwially with thus matter. ) Pine strict( Ht. l.uuls. >!">. ! z r . " " , " . j.L L, , ) . ! ' y I1"R FLORIDA ' 11T112nl f AMIT f nV t --- .., -. '" ..- .. . 8.lr -- ,-----. . vor ---- . -- - TO-.110TIWW. ---- -- through the window to the shed. beneath he. his, n ------------ - J met nv noMEn J.AWKKXCK MAORI dropped. The to the two ground nilof the untcr- Sl\ll. own was calm and. steady, though deliberation, ;;bright thought; occurred to I use Let her t try. 0\1 t time cni of, the season they went on to a by-lnnc, where "They arc l1". It was to leave him with the Professor let her and her patient note the abatement t mining to . Say not to-morrow, for were presently joined l by two other those !see me to-night of Dust IndI'IJ about directly by to-morrow's sun boys-will ?" ( ; old! lifts, who lived in of the headache brought boys! whom you come May never gild the happy eastern sky; Tubbs. they greeted ns 'Brinlev nnd Not to-light-not( with them n small\ cottage in the rear of the college thc counter excblencmit of a nerve current And it may be that said: Lu- buildings."We Let her friend admit that ere to-day is done mar ; but I l't11' by music. Have willcomcsomctinie Loved ones shall you found out where he sleeps' ? and soon. carried him that hour, the I weep and sadly watch asked Fred. Good-bye.: there, laid him on the she hassufTcred! less! during thee die. "A door-step, knocked and been cOlllph.t'I called off front "Yes smouldering volcano loudly, then ran mind having l grapevine on the !second' floor ; but there's! a man, as lie watched; the said the old away ; not so far, though, hut that we saw the contemplation of a special pain, and the vigorous Say not to-morrow for thou trellis right under it," answered form the old man off or nhntell. cans't not rail Tubbs. I crashing through the underbrush.) come to the door, and heard a pain having meanwhile passed r The day thine own rather made an errand to his colloquy between\ with disorders - room and him and connected ; perform to-day So here's where the old his wife, Aunt There are cases chiefly found fellow The duty of to-day ; for what will all is out the lay of the land. The spring a woodchuck in his hole said lives, like Dinah, in which 'dcm there students' were of the spine, cases of >', wherc An the Fred i Thy promises avail if thou away is easier than right to(hand lower pane. Nothing/ as, after long tramp through f he woods Loring' he, spoken) of in no very complimentary' terms. music is also the only thing which scents to break the glass and reach : This we enjoyed and set ft co mnvocheek"Then - and his hugely. Then we saw them stir the torpid nerves up From earth tn-nirrlit olinnMuf throuch._ ... companions_ ..... just, at dusk. (:'neupon lift 11 tt _..! ... .._ ... ,,___ ,_ . -----. nose, 9 rri.lni. n toO'O /tl.. ) _1.:11"-/.1._ /.. ... .?..... ...!... m.t.- : 4l. ol t.- .n"t... fl",1.1nll'....... till_n_! -U'N' "' .n. mil nii.ii U '"111 JlUU LIlt.:: u.c ""'''' .0 I.h I it then no illore "Do you suppose hell resist?" asked JHIIU clearing nuout it. (house, and ucent I1Insic the shut 83'lct Of HClfI'." / And there he sits at the door away,feeling sure that,ifhe I open i a to-morrow, for the day belongs to "No!! doubt) his evening pipe," said Hrlnle,'. !l11oklng really had fainted, the good, old; souls would gate, and let health come in that way, II cnv G he all 1Live i will if we give him a 'Velcon1, thrice welcome do that was necessary: for him. testis janitor aulca !"-rootlWord... , thou within the and chance, said Brinley coolly. "However if my young '"Was Lnngforth true present, explore friends, said the hermit grit? Would he \ - when .The path of present duty, till the sod you to your arc getting mother.scared" you\l better go home boys coining up the well-worn, he foot saw path.the to tell me?' that in the was! the first thought that came TIlE BEGINNING OF 1)E LESSEPS' Shall cover thy still form, and thy freed soul I'm not scared I" said HOf4.1lndipnantly Shall!:; we go within, or shall we sit here "As I was morning hurrying LUCK. .Shall ; ; under the light of the stars?" across: the grounds: to Catholic seek His but it's the Isabella the - face who gave it unto thee, ns well to be prepared, and Lamar he in season for I in The Empress was Out prayers, saw Strong There to forever dwell while endless es roll, is no coward." which here, by all means," said one, to front of me. of the :Suez scheme. But for the Ppatushardor .Where no to-morrow comes, but all's That remains to be proved;" said Brin Be all agreed. '"Hallo, old fellow, wait a minute!1' with which she sustained it, the Isthmus - eternity.-Wavcrly Magazine. ley. See if he doesn't beg before we get seated, then, !said' their host, with a called Ii; and when I came with him I would still divide the Red from the hospitable up , " .', through with him." wave of the hand toward the asked, dropping voice Mediterranean Sea. Your head. she said my rocks : I "Have you brought the masks? asked and stumps which surrounded his 'Is Langforth here?' (speaking of course in a figure) to Count 4 OLD BILLINGS. Fred. dwelling.the And seated thus they listened to '' Here? Haven't you heard ?' said he. Walewski, "depends on the skill you show "I have them," said Tubbs "and story."Boys. 'I have heard in helping my cousin to cut his canal." M. the nothing. Has he told ? WORTH READING BY BOYS WHO THINK 1mA7.INO" cord, too, displaying the articles to his I wasn't always Old Billings. I said I. de Ixjsscps' father, who was descended from I GOOD SPOUT. panions. com was as young and gay as you are once, and 'Langforth is dead !' said he. the architect of the Cathedral of Edinburgh; , No one called him anything else ; not :Mr. And now you will wonder what deed of if you'll believe it, I was called good-look Fur a moment everything seemed to was sent with Lucien Bonaparte to Madrid nor Jo, though that ing. too. I was an only son, and had all because he been at was his name, nor anything darkness these four youths were contemplating the whirl round, and I leant..lagainst a tree for had brought up Bayonne t but just "Old advantages that wealth anti position and could talk ; as well as Billings. And yet he that they should steal forth at mid i could support. Spanish: : : was not so very old. Not older than Squire night with mask and cord ; but let me hasten them furnish. I didn't know how to prize "Strong went on, 'He was dead when French. Lucien was the first ambassador Erskine or Parson Dale, whom no one to assure you that you are not rending a talc of though. just took thcmus a matter old :Moses: and his wife found him.; named to the Court of Charles I\. by >apo- would have thought of calling Old Erskine of rapine nnd murder, but only of a schoolboy if course. Boys arc apt to, you know-or, Then he must have died in our hands,' leon. His mission: was to obtain the retrocession - I ,or Old Dale. What was it, then, that made frolic'; at least so they considered it.- As you don't know now, you will by and by. said I. of Louisiana, which LouisV.. had allowed - the difference? Perhaps it was partly that Not to be{behind certain higher institutions a rule, whether most what they have Yes.' to from his hands. M. de Los- Jhcse latter gentlemen wore fine broadcloth they were about to haze a new student who, to fight for, it's liberty, wealth or "The doctors said he died of heart ,disease sells, the elder, went about always with him, and immaculate linen while the hero of had had the misfortune to render himself education, and that, I take it, is why so the shock of the water killed him. So here; and was the soul of his diplomacy. The ''this sketch wore trousers of tow-bagging, unpopular, by keeping aloof from his fel ents.many of our great men come of poor par was murder added .to burglary and assault New Orleans ufTair brought him into rela- and no linen to speak of; but still more, 10w- tl1dents, which. they chose to attribute i and battery tion with the United States consuls, the 1 something_ which makes us couple the t)re- tfi pride and fanc 'lhnl1l'riort". r ..,:'I.., .never.... _L had____ any. difficulty_ in keeping.up \l'l19 liothill! done about. it?" nskcul__ _._ most intelligent. of whom was Mr. Kirkpat-_ fex old wiiit or "They he -fen ,i' : uii my l:1U1'jC: <, Jl'call 1 1/lrn'IJ caHilv ; Brin ley. n n. n rick, who was in business aiLcsieps Ialagn u. de vagatonttnleaning say Spaniard said Brin- who! but I never led then:. The fellows who ded. nnd assistedby thereby any man has no fixed relations ley. I Yes, there was an investigation, but it proceeded to that town, , to and and my companions called prigs' and amounted i Kirkpatrick, who like himself, was of society, cannot give satisfactory account He may be of Spanish descent but he 'book- to nothing. It would<< not have of himself. hails from Georgia," said Fred. vorns, and 'edamts' :My: ambition been to the credit of tho institution to find Scotch origin-but less remotely studied the His first lay in a different direction, and 15(1(11 us of resources of Andalusia and the political con api>earance in Dalton was after He's black enough to be of African de- achieved guilty murder and besides, we were this wise ; in the dress which I have described scent. said Tubbs. the distinction' of being leader I allgentlcmiien'ssons. So it was passed light dition of the south of Spain. They were he onc'day mado his way through "And ugly enough to be the missing among the fast' men of the college. If the ly over, or spoken] of as a, boyish: frolic which drawn closer together by a romantic i affair the crowd of loungers in :Mr.: Burnnbce's link," said lloss, at which there faculty awoke some morning to find their terminated an unexpected) manner. Lang- which sprang up. A notable of the province - store and asked for codfish and crackers, laugh."Come was ft general gates off the hinges, if the undertaker's sign! forth's mother died soon after. He was her Senor Jrcvigny, had two very pretty Mr. Barnabcc looked at him sharply, not to boys, this will never do," said was in found the over the doctor's olllce, or a jackass only son, and she was: a widow. Thus the daughters, with one of whom the consul fell chapel desk, I was at once suspected madman scattereth in love. The French diplomat became say superciliously, and said : Brinley "it will bo firebrands arrows and ; before You can pay, I suppose? know it, Now for the morning modus we! ) \ of being' at the bottom of the mischief death, and saith Am I not in sport ?' enamored of the youngest, and as Lucien For answer the threw operand and usually with reason. That was a "And now, hoya, know Bonaparte was in high favor at the Court or1aelrul strange man a half- 'Having got into the room and tied him fast you one reason part of the curriculum in which I was thor- why it is that 1 her father allowed her to M.dc r. dollar on the counter, Mr. Burnabee tossed what arc we to do with him ?" am what I am. I escaped) marry it once or twice and it Look tlughly'ersel.. Then there were our clubs the law, but a retribution worse than the whom she went to reside i in up finding like here fellows I've where , rang said ft plan; genuine coin, furnished him the desired Fred. Don't let's hurt him : and ourconvivial meetings, harmless! enough law has power to indict has followed me. Paris, in 1N)4) shega\e birth to Fer articles but let's ; set to begin with, but know what dinand. Her eldest sister became you Burns The continued brooding << : Mrs. Kirk- remarking that it was a pleasant day. him up in the arm chair, and dress him for in his 'Address of over Langforth's says the Unco' iuid death patrick, and the mother of the Contesse de "Ay, you call it pleasant because the sun an old woman. I've brought graI1l1I11a's'up : unsettled} me, 1 suppose, for my ! shines but Sec social' JI'all1I1M/ not been wholly right for Montijo, who was drawn by her de Lessens I' suppose:: it never rained ; what and spectacles.! life and glee sit down, many kindred then? All days are alike to the wise I" "Too tame," said Brinlcy ; "I say, give All joyous and unthinking, years. I have wandered front one part of had to winter, in Paris when her daughters ( And with this singular answer Mr. ]larna- him n ducking first, and then put him in Till, quite transmogrified they've grown the world to another, but have never been M.grown de up. "Thus you see, observed - able "what Lessees: number of to / bee's customer turned awl went out. not- costume \f \'ou Itlrn." Dnliiuirhprv and ilriukinir -- ----- set.. ,1I1'sc1fIout. ) anything. and- Inever ....hft.. "M" 1.'d: __.a. _dO _. _ Sinai 11('. Jet t-i";" l"It1lJ ""H.:: 'II I Cf"mllIlC/JICfl' UCIJ enOlelld'l'l'llIh'duon my story ue a there withstanding those who These other warning were would all piano, more or less!' " fain have him with other brutal Sometimes we went farther than we meantto. to you, my father's early knowledge " detained suggested the final decision . - , " questions. being of the It But little said Spanish\ tongue. in favor of was: one night when we had taken more was that night. The On the ducking their victim and then more wine than was good for us, that we four boys departed, sadder aid wistr, and as Another "hinge event" which led to the common him in were some boys playing securing the academy yard arrayed they had been the execution of the :ffucz Canal scheme the hall.II undertook the hazing of a student whose leading spirits in all thea.t was S'e that old said in throw shawl tramp, one cap andspectacles, where he would elder Lessens divined in of having mill name was Llln forth. He was a freshman insubordination, there was no more } a poor , the ball and the be ing in full view of hitting the between theshouldcrs. He unoffendingman and early rising part of and therefore fair game, we thought, and he hazing in the school during their connection unlettered Turkish officer, :Mchemet: Ali, a the turned in the community morning. Suddenly and took with! it.JIUSIC.is. vast: genius and the man who was to break was shy, never in said. For n les140ffcnce than this the prophet a voice said, in tones loud, distinct and 1 very any part down of the Mamelukes. The Elisha cursed the children of Jericho. and earnest any way of our athletic sports. So we calledhim diplomat! : A IIEALIXO ASH YIVI- French reported in this a milksop, and said to each other that \ \ sense to called two raging bears out of the woods to don't do it." Boys 1'T/A'tf his little rough handling\ would do him good. 1'0"'Ell. government and was instructed to be devour" them. They turned in consternation and surprise We set out at midnight, just as )'ollllid, :Music: has a vast; future before it We are guided by his own judgment in bringing the "Because Why don't you ? asked a buy for they had heard no footsteps, and but we hud better luck-that is to say, we only now beginning! to find out some of itules. officer forward. :JI.: de Lessees:! invited the I'm not the. prophet Klisha there stood old Billings. had planned the'thing so suddenly ana With the one exception of its obvious Turk to his house: and showed himself in said the man Boys'!, don't do it," he repeated. keptour and admitted various his friend. But ways theofficer secret so well, that no one arrested us in helpfulness as an adjunct of suddenly What a queer old fellow I Who is he? "Eavesdropping, ch?" said Brin ley, who our course. We called that good luck at the religious worship, as a vehicle for and incentive withdrew from Ids coup ,nnyand kept said the boys, watching his retreating figure, was the first to recover himself.! time. of religious feeling, I had almost said out of the way, When Mehcmet was a but. offering no further molestation.But Call it eavesdropping if you will," said All was: still and dark when we reached that we had us yet discovered: none of its great man lie said to M. Ferdinand de Les- the question, who is he?" was soon the old man ;" it mutters not so you'll heed the house. We called that a, piece of good uses. It has been the toy of the rich, it has :sees'our: father must have been answered for a day or two afterward the my warning luck too. And Langforth's room was on often been a source of mere degradation to to think what my reason was for keeping : stranger called at the post-office which occupied Suppose we don't choose:! to heed it." the first floor, so there was another point in both rich and poor, it has been treated us ft1 aloof from him niter I had accepted so much six square feet in corner of :Mr.: Bar- said Brin ley, what do you propose to do our favor. Not a word was spoken exceptin mere jingle and noise-supplying a rhythm kindness. It was this. A silver knife and nabee's store and asked for a letter for Joseph about it?" whimpers. "approached(" ] the window for the dance, a kind of terpsichorean tom- fork, I heard the servants)", had been stolen Billings, and what is more he got one. It "Nothing," said the old man, and his stealthily. It snsaimold-fashtoncdwiudnw tom or serving to start a Bacchanalian, chorus from his: table at a dinner to which I went. had the name of a New York bank printed voice was more in sorrow than in anger. and the gloss was small. We broke two -the chief feature which has certainly I was so poor that I fancied 1 would pass on the envelope, and contained check, Brinlcy was prepared for threats, and would )panes before we found the spring; but we not been the music.: And yet those who in his eyes for being the thief, and never I which he imtriediutcly got cashed. Similar have answered them with defiance, but to found it, and raised the window and en- have eyes and ears open, may read in those I dared alter to return." Soon after Mchemet f ( letters continued to arrive at intervals, the this unexpected reply ho did not know whatto tpreil. one after another-the four of us-I I primitive i : uses whilst they, run the hints of hud.. related. this anecdote.. he asked :M.: Fer J j f answers to which were directed in a bold, say. first of all. It was burglary, aid a state prison musics future destiny as a vast dvilizcr, recreator uinaml do Ijcssopd! to allow ITmce Said, h b , dashing hand He also took a daily paper, 18 Lamar a friend of yours?" asked offence, but we called\ it fun. health-giver, work-iispirerandpuri- son, to pass his afternoons at the French t and discussed the affairs of the country with Tubbs. .A11 the noise we had made had not wakened tier of man's life. Consulate, in order that he might pick up intelligence. It was plain he had not been "I have never yet spoken to him," said Lungforth, as we discovered by striking The horso knows what he owes to his the French that was spoken there. The boy : brought up in ignorance. But one day a Billings. a match. There he lay, his head a little bell The factory girls have been instinctively grew fondly attached to the intelligent and still more surprising thing happened.! Passing Then why do you take so much pains to on ono side, his arms folded<< on his: breast. forced into singing, finding/ in it a so- very kind-tlenrt.tliliplomat. When he was the academy yard, he saw Fred Loring save him from harm?" He had ft pink and white complexion, liken lace and assistance to work. And music, viceroy and the Suez concession was asked sitting on the fence, under tho butternut I do it for your sukes as much as his." girl's, u'lHllight hair, which he wore ft little the health-giver, what an untrodden field is for. he gave M. de Lcsseps a carte blunclie.I'al .- I tree, with a book in his hand. Ho is trying to frighten us I" cried Brin- longer than was the custom even then there? Have you never noticed an invalid ? Mill Gazelle. I "Confound the old l.ntlnl"! said Fred, ley. He thinks Lamur will defend him though: no one wore it prize-tighting style, forget pain and weariness under the stimulus - t Clapping the book against his knee impatiently self has warned warned\perhaps I" as you do now. There was something so of music? Have you never seen n, pale THE M\N WHO 1.\t'Glls.-Xo man who has p as if it were to blame for being I have not him;" said the old pt.'acefull1nd almost girlish in Lan forth's cheek flush up, and dull eyes sparkle, and once heartily and .: E "pri.nCdn. a dead.. language.. _..... .... u man, simply! '' Wheh! f he defends J him-! Itl'lll'ltranCe that Strong. the youngest and i alertness_u. L "'__u and__ __vigor_ ,take.. possession. _of the I. ._.1.--.1... .."...."... .nn.1..... 1..n_'n wholly:_._'.I..laughed,__ ....can. be ( -t UUIlIUUIltl 1" 9UU4 VIM JUlUngs. *''**j eCU Will liepenil on wncuitr you c/\tcn JIlin best of us, said : wiioic iruue, unit umiiiaiiuii succeCl.l to apathy -.b.: II l""O""UUUIy VUII.1 lie plat( ,. not so, my boy. We read that all tongueswere sleeping or waking. As to frightening you, It'sa shame to wake him/ ? What does all this mean ? It means who cannot laugh is only fit for treasons, confounded at the tower of Babel, but why four against one is pretty good odds.. Nonsense I' said one of the others, and a truth that we have not fully grasped, a stratagem spoils ; and his whole life is we have ever since been studying to make Brinley felt himself color at these words, I bent over Lungforth and shook him rudely truth pregnant with vast results t) body and already a treason and them plain. Let the old man. see your book. and Fred Loring cried, "That's true, anyhow mind. It means that music attacks thence stratagem. The remark - Cicero-ah. yes ; an old friend." 1 I" -" He started up, bewildered, asking what I vous system directly, reaches and rouses of De Maistre that the wicked man -And to the surprise of Fretl, )nouns verbs, So it is !" So it is !I" said Tubbs and was wan tl..1.II where physic and change of air can neither is never comic" is truly wise, as also is the and adjectives were quickly marshaled into nOS-i. You are wanted !' said I, in ft feignedvoice. reach nor rouse. converse, that a truly their places, with a due regard to number, "Now, boys, take the advice of a friend; Music will some day become a powerful wicked." A laugh therefore witty man is never to be 1 person and declension, and order was go homo and go to bed, and to-morrow What for? What's the matter?' he and acknowledged therapeutic. And it is must flow from a joyous heart genuine evolved from chaos. Seeing this, other boys night come to my house and I will tell youa asked. one especially appropriate in this excited and unfettered conscience. and a clear 1 !f 1 gathered round t41d Leo Kirk came running story," said Old Billings: sadly. What 0' Come with us, and )'UU'U find out,'saidI age Half ot our diseases some say all our Hare observes! that "some of those Archdeacon who have t up with his Greek reader, crying, "Say, say you 1"am : and two or three of us began dragging diseases, come from disorders of the nerves. been richest in wit and humor l cant you help me with my lesson, too?" "I ready to agree to both propositions. ; i- hint out of bed. How many ills of the mind precede the ills of among the simplest and kindest have been ' i "Doubtless ; and also with that wind-mill ." said Fred. What do you say, Brin- At this he cried 'Murder!I' and I clapped the body? Boredom makes more patients men ; and he instances Fuller hearted of , v! I saw you whittling just now." ley?" my hand over his mouth, telling him to than fever, want of interest and excitement, fontaine, Claudius and Charles, Bishop La-" This raised a shout of laughter at Leo expense Any way the game is up for to-night, I hush his noise. This you see was assault stagnutionul life, or the fatigue of over- This life would be but dull Lamb. and the ragged philosopher contin- replied he, "and we may as well disperse. and battery, punishable by law but still we wrought emotion, lies at the root of half the nous existence were not a the and monoto ued : "The lesson-first, always put your We can't do anything now" thought it fun. ill-health of our young men and women. everyday intercourse of ordinary and work before your windmills, and you'll be The next day, as Billings was walking "We got him out of the window without Can we doubt the power of music to breakup by sallies of wit and good humor society enlivened sure to prosper. I did not ; hinc ill* lachryWhat homeward through the woods, a hand was much trouble for he offered little resistance that stagnation? Or, again,can we doubt is probably no and there mre." laid upon his shoulder, and the dark but expressive -where would have been the use. He its power to soothe? to recreate an overstrained of which we derive enjoyment the so innocent out does that mean?" asked Leo. face of the new student appeared was shivering with cold for it was a frosty emotional by bending the bow gratification and pleasure same amount of I "Literally, hence these tears ; freely beside him. night, and he was in his night clothes ; but the other way ? There are moods of exhausted lau h. There is wisdom. then as a good, hearty I Do von know what saved me from of this we laughed feeling in which certain kinds of in a laugh. Billings he ' translated it means, hence. Joseph !!! you when. .complained_< <_ L__ LL._ 0.1 0.. nnlsic would. not .nun. .. '..vann .,.,. 1. n ...IJ.. imlosopliers: and wise men may eprrile la uThe hour vagnoona msteau 01 B u elUl last night? asked he, abrul1tlyoul ana win nun ii<" IU ww w u"ul. an:: UI\"U LU -------- ------ --- I. '" "" n 0"1' uieir rIsIble muscles without oTb"ei citizen" <' nothing worse than being the sub- say something else, but we neither heard and spur would encourage the racer at first, accounted fools. fear g academy at Dalton was one of those ject of some boyish trick, most likely." nor heeded him tire him to death at last There are other been favorite themes Laughter of and smiled have so plentifully among 41 It is more likely you saved me from being ."Well, boys, we dragged him to the kinds of music which soothe, and, if I may variably use this the poets who in England murderer stud I.amar.II Feel him under. 1 seized the use the word, lubricate the worn of metaphor when describing M' New towns, where boys can be a my pump and held ways nature in her most beautiful the and fitted for college, and at the same time receive Arm sir; lande.! nervous centres. You will ask what mu- pects. Beauty is varied as all the benefits of country air and Hy 'it's like Iron," said the old man, sur. 'O. f l1ows!'-he began ; but whateverhe sic is good for that? We reply, judgmentand adorned with a never smile so lovely as when and in prised. was'going was drowned in stream common sense, and above all, conversation; ing. Most of the students boarded private to say sympathy never sits easier attVetional than upon us t families and many had homes in alton. "There's good muscle for a lad of seventeen of water. and musical sympathy, and then dischargeourselvesin when we now :Mr. Koonce, the preceptor, was a staid family ," said Lamar. I've been cultivatingit He gasped and struggled, but did not will partly be your guide, but experi- of laughter. It is difficult a symphony must at first "a't ence decide. to Let feel I old. I heard of some friend well since man, who sometimes took the students un was eight years try to speak any more. home" with a der his own roof; and, moreover he had the visit Intended for me last night. No matter ""'Come, let him up,' said Strong, releas- versed in the divine art sit at the piano and ever brilliant and comparatively learned stranger, how let the tired his once studied for the ministry, so that on the how I heard of it-the same way that ing his hold one lie on a couch and prescribe may be, until conversation we strike 'whole, academy was thought to combine you did perhaps-but I knew the fellows "' One dose more,' said I. ''i little cold for" himself or herself.! This will hap chord. some mutually sympathetic We and I to give them a him. pen : Do not play that Tannhauser then know him to be various and uncommon advantages: Yet were coming, prepared water won't hurt just: human he earth has no spot so secluded, or so favored. warm reception. I did,not rely on my mus- .'' There, now, he takes it like a man, "now, it wears me out, I cannot bear it." through; which possesses to one vulnerable point that evil and temptation may not enter, and I cle alone, either. I had my revolver and I said some one. as Langforth ceased to stnig- Yes-sing that Dn bist die Huh, and after be capable of reach his: heart; and. if he Dalton was no exception to this rule, as you knew how to use it. From 11 to 2 I lay gle, 'I guess we've given him enough: that' "I must hear Mendelssohn's 'Nottur- unreasonably appreciating wit we may not awake and watched, and the first; one that 4 So be it,' said I. You may go back to no, out of the 1\Udununernlght; dream,' i Live to other conclude that he is also tlt.'nll-! > WIt KftowaiufwelY* kone moonless laid a hand on me would have had a bulletin bed now. Langforth. and we wish you avery I and then-and then-what must come next Journal and better Intluen .-7ir f :-nlfcht in autumn that Fred Loring him : not in a vital part if I could have pleasant night.' must be left to the tact and quick sympathy _ out earl bulkhead of his fathe'rs eel- helped it ; but one can t always be particular ; He neither spoke nor moved. of the musician I have known eased where EiSYMAXiMs.-If crept lar and making sure that be was not ob- on such occasions. They did not come, .. 4 I believe wy soul lies fainted' said an hour of this treatment did more good eral ; yet you arefnigal.be' served climbed a fence and went'through and to-day I have heard the reason why I one. than bottlesful of bark or pailsful\ of globules discreet though lib'radiscret't/ : though the fields to the back of a neighbor house ." He's only shamming.; said another.Wants ; but I do not wish to overstate; the case. and though, generous } though generous just. Then he picked ui..a pebble and threw it thAVd I thank Godl"! said old Billings to turn the tables on us by making I merely plead for an unrecognized truth will allow' just, merciful. Your frugality I second story .window. The window reverently. I hOw| it will atone in l1&rt- us carry him back to his room.' and I point to a new vocation-the vocation ality should yoU to be liberal, but your liber I against a be raised and a head thrust out. but no, we can't atone." Yea, and get found out by the means' of the Musical Healer discretion guided by discretion, your was Fred?" Lamar looked at him curiously, for the laid I. How many a girl might turn her at prt.'Sent should admit generosity, but your i : Is it you uick." words sounded to him like the vagaries of a "Still, we dared not leave him there for uncared-for and generally useless musical generosity must not forget justice; while justice - i'friu'dy: ?' whirred Ross, and slipping, (fanatic if not a lunatic; but the gaze which fear he really had fainted ; so, after some abilities to this: tender, gentU. iminan., Gretn should ever be tempered with mercy.J .- . .... ... - "- 111111' ....." ..-- ..... : L 1 T .... - "J :'U' :_rJ. il ' -- ( 1 L J I l I ...,,;L A..b.-- .. . . i .. THE "LOltlllllltllOlt : JANUARY 1. ' ..- --- -'- --.------ .- --- --" .. -- '- -_ --- .-- . .. . _... -- ---- - - --------- - II. J. BAKER fc BUG. The lleisl!' Taper Try It pONDENSED: TIME CARD Florida and. Western Railway and from M A LORY'S! '.1 :Savannah: and all Northern, Eastern: and I IL LUST 11:.\TEH.1:i OK THE Western Cities.At .CHtln.\ STEAMSHIP: l.1%E. Blt'TJFrLI.Y -SIXTIi: YEAR.: ATLANTICit'I.P&\ : WEST INDIA t ) TRANSIT Luke City daily with the Florida Central - 215 PEARL STREET NEW YORK :: RAILROAD, Railroad to and; from Jacksonville! St.Augustine Only (((reel Line to New York. The St'IC'II.IIIcmc'rlculi.. PENINSULAR: : : RAILROAD, Palatka, Enterprise: and Landings ,. ( W"ld Ilrnnrlt,) /; on the :St.: Johns River. _::t TilE :SCIENTIFIC .\ nHll'\S i is a largo, lir t. ANHCUMBERLAND' At Baldwin daily: with thtlnlllil', Gulf : " Manufacturers of l'la'Wl'l'k I\' newspaper of !' X fl'l'lIag"l'I.\ HOrn: and West! India; Transit Railway: tunnel from j-t printed in I the! most beautiful style, jmfiuvhiilliiflraleil Fernandina, Gainesville, Cedar Key, and i ; it'llh fplendidcnirariuls the representing 7/i. 1.t7i'ct:( IWruary ht, /..W.tioixu with steamers for Tampa Key West andHavana. inventions IIII1t't the newest! must! re- : . -+-Cu EMIC.IL .FEHTILIKEHS. (,l'ntll'alll'l' in the Arts and :Sciences At ('hat hiiucheethrue I times weekly with I SOUTH. THE: FINE: STEAMSHIPS: includingnets\ and interesting: facts' in Agriculture the I'I'oplt"1Lil1l' and Central Lltll.II:1:111\: to , ,- the Home, Health, Medical 1 Progress. Lt':1llal1ta., (Ga. '.!.tf. > P. M. and from Columbus, l Kulaulu: Fort Hail1epall1'h !',, "'LS'I'1ItTLt.1S: . Leave ... ..) I t tC,11 Maeon, (la. 7. I' :M : andAstronomy. Social Science Natural .\ l'IIII : : History, Geology and other River Landings Leave Brunswick: Ga............ <>.ir:; .t. :M.Arrhc i. / r. HINES: , The valuable : : most! practical .t.\'t"Elegant Sleeping and Parlor Poaches11'oodrnll' : ,, eminent writers in all Fernandina, Via.10.15 .\. :M. and Lucas I 'CITY OF DALLAS a aCAPT. J by departments Patent between , ------ papers, run daily a of will be Leave Fernandina.................10.30: \. M.Arrive . l'iCIIl'l" found in the Scientific Tallahassee! and Jacksonville.' oRANGETREE RISK. J.fJ" . -6 .. Baldwin, Fla............ l..Vj\:? i.I i. \II1l'r l'nll. .#t-Quick time, sure connection, }perfectsafety - Terms, $3.20: : per year, $U>half year which *'nve Baldwin .J\l'klon-ill; : l.\nl: M. llL1R'i.ihr) ONE: of the above Steamers' will (leave includes postage. Discount to Agents.' Sold Arrive Jacksonville: (Cum. Route: ).. 2.3.:! p. M: ::'tl-t f Master Transportation. for New York every Friday jj.Jr- MA X lilt K hv nil Newsdealers!, llemit: by postal' orderto Leave (to suit the tide). . > Baldwin for Cedar Key. l.fiO p. M. . This line transfersto make having no MUNN Publishers Park , t CO. Row -----A Arrive Waldo (Junction 1' 1,11)) .. ...11 1'. M. litter and Ocean Steamboats. between New York. Leave ,\.u It 10. ...:'0 I'. :M. -_. --- - -- -. --- ---- -. -4NE1 .--- - 1'ATIN'I'S.-Iu connection with I he Sci- Arrive Gainesville( ... .r>.17 I'. :at. FERNANDINA; NEW: YORK, .\ Most Superior Article, tinder our own --- l.nlilielIl1'ril'all, Messrs.Mfxx Leave Gainesville: ft.2: I'. :M. : { SI'iIEIVI.LIt Oilers! the : it (Co. are :Solicitor of American and Arrive Cedar .\'. !)1.30:; I'. :M. BEST AND CHEAPEST: : TRANSPORTATION : Special' Formula.COMPLETE Foreign Patents, have had :35 years c.\j eri- to.hll'kOIl\"illl'III1,1 North of Baldwin - \ : TO FLOIIl111l'l'EI) : : . ence, and now have the largest t esjabiishinent i daily. !-----"""w *'-----. I in the world.\ Patents: are obtained, on IOIS1l; : XOKTII. ] UEOIMJIA: | y. ] FLOICIDA | Vegetables! lull Fruits will receive :special the best! terms. .\ !special\ notice 1 Is: made in care tat haIHllill . the :SCIENTIFIC( : ( AMERICAN: : of all inveii- Leave Cedar J l'\''. 1.15 .\. M.Arrive -______-. *-___ ___* MANURES a tiiiis: patented throngli, ; this Agency, with Gainesville: :+.II A.M. PASSENGER:::: : C .\'n DIOfTIO1m: the name and residence! of the Patentee. Leave (Gainesville... 8.50 .\. :at. FIRST-CLASS . By the immeiisu circulation thus given Arrive Waldo ((1'.1 15.: R. June.). .is .\, M. {hov' I INLAN1) -1It The! traveling 'public are offered the advantages . Leave Waldo. !)t..').') . : : A.M. public attention I is directed to the merits of FOB EVERY: FARM CROP of n DIRECT LINE:, WITHOUTANY Arrive Baldwin.12.17:? I'. M. the new and sales introduction patent or . IIO CHANGES./ : Connections 11111111III. AT often easily effected.ny !. Leave Jacksonville: (Coil; Route.11.15) : A. :M. STEAM 1 r\f 0M1',1N1'I7Mr Jacksonville! with till steamboats for nil .\ person who has: made a new discovery Arrive Baldwin. -'.: I'. :SI. X.IS .-' ,points on the St, John's' Ocklawaha, and Prepared on scientific principles' to supply or invention can I'l'l'laill.'t'c: : of; charge Leave Baldwin. ...... .................12.40:? I'. :M. i \Indian (Rivers: and with the Transit Railroad ! I P the exact plant food for each crop, so as whether patent can probably be obtained, Arrive Fernamliia: ...... 3.40 I'. M t. at Fernandina all railroad stationsin by writing to Mrxx iV Co.rc also se11dfrrc ! to produce large yields : Ii : Leave Fernandina....................... ::1.1.I'. :M. Florida per acre. our land-Book: about the Patent Laws, Patents Leave Brunswick. S.oo p. :M. FREIGHT AND PASSENGER: RATES Caveats: Trade Marks, their costs t , and how procured, with hints! for procuring Leave M.-.con: S.40 .\,1\1. .\HoW\ AS BY INDIRECT) LINES.ifThrough ); . Arrive Atlanta ( 1.15 . advances on 1ln'lItion.t.1Tl':< for thepaper I' M. : Rates and Bills:l of Lading, ALSO DEALERS IN Train! to Cedar Key and :South< of Baldwin - or to nlll'l'illl4. concerning }patents: daily S1tiuhty.1'1NINSITLAR ! MUNN *: ('0.. except No SEASICKNESS: ::: No OCEAN: DANGERS: For passage: : or further information I apply PRIME AGRICULTURAL CHEMICALS : 37 Park Row, New York. : :: RAILROAD, tll Branch OlHec, Corner F and 7t h Streets, t lulu Jlrancli./ ) R. W. SOUTHW1CK, Agent, Washington.. C. <09!!> THE Fernandina. - : BTKAMKItH: : C10INU KOl'Tlt. SULPHATE AMMONIA ------- .--- -. .- .- - -- I C. II. MALLORY & CO. Leave Waldo Junction...............0.1X1 A. M. , Books and Stationery.HORACE Leave Hawthorne. 7.40 .\. M. CITY OF IIItllMilETONAmi Pier :20 East: : River, New York. 2-t( .. ... . --- --- -- - Arrive Lochloosa. 8.10A.M. ACID PHOSPHATES, 1)R1:11'I'holesale 1>AYII> CLAItK. SLIMMER: SCHEDULE: (1OINU NOHTII. \ and Retail Leave I,ochloosa: .10.00A.M. MURIATE OF POTASH : TIIK KTKAMKRH Leave Hawthorne. ... A. M. THKfpASSENGER : P.\-I'I' .. JM t51ti 0 STATIONERY, Arrive '''111,10 Junction..............12.15 1'. M. *_---->* a---_-.+ SULPHATE OF SODA, BOOKS Trains from "'111.10 to Lochloosa: and return . % TvEGETAULlT? | ST. JOHNS } 8 j CITY: POINT } And MUSIC Tuesday: Thursday and :Saturday.CONNECTIONS. : : ] i i : ...... .. ......---...... NITRATE OF SODA, 5!) WEST HAY STRET, ATLANTA. LINE. - Close connection i is: made at Atlanta. Gu., ' SUPJmPHOSI'lIA LISA, ..T.\CKSOSYIJ.U':, FLORIDA. to and from all points North, 'East: t. West and . Steamer City of Ilrldgefou, Northwest daily, SULPHATE: MAGNESIA: AT MACON, (a., CAPT. JOHN FITZGERALD\ , With Trains for Kufaula, Columbus! Ga., Waits tit Fernandina for the Monday and ;i-School Books a Specially.G.Z Montgomery, Mobile and New Orleans.AT Thursday: night Vegetable Trains of the "\T7"ILL !leave Fernandina for JacksonvilleTT Strictly Pure Ground no..( KEKNANUINA, KI.A., . ""VYI.I," &V CLARKE, With New York and Fcrnandina: :Steamship ATLANTK!, GULF? ,t WEST I INDIA\" TT on the Palatka:St. John's, and River intermediate, and Savannah landings ( 4S0TS to J. M. Cooper it Co.,) I Line from New York Wednesday: at A:NilPENINSULAR' and Charleston, as folows : Our circulars give full particulars, and arc 10.30: 1\. m., and, for New York on I"riclaat, : [ : RAILROADS) , JII ALKIU! IN ::1.401'. in.; from Nassau! N. P., on Wednesday From Fernandimi mailed free to all applicants. They contain ; for Nassau, N. P., tin Wednesday. leaving ('('l1ltl' Street \Duck direct for Savannah. ;School and J'h'C'IIIUIC'O"H..tj.1 Z With Georgia and Florida Inland :Steamboat Passengers: and I shippers' are assured: : FOR JACKSONVILLE: AMI ]PALATKA, information that will be of service to those Cu. from Savannah on Tuesday\ Wednesday / of connection at Suvunnan\ with the steamships ;.". EVERY: WEDNESDAY.-ft-x; : .. Friday and Sunday; for :Savannah on and trains:l for the Ii.Slcamcr . buying or using. Fertilizers.! 3-.fln ..-- Jsl I -- ,. Tuesday: 1-riday and Sunday. From Fernandina --- ---- '- - ---- With Charleston Steamers St. Jofm't and : ( -+?....... ......... .........} 1 ROOKS A IIOOKS j tJl City J'olut) from Savannah: and Charleston/ David Clark, FOR SAVANNAH AND CHARLESTON . : OUAXCJKS. : -- 0 .* Wednesday: and Sunday ; for Savannah and\ CAIT. P. H. WARD, .Jt"fJWNHY: F1iIIAY.1S. , -4.: ......... .................,+- f-- Charleston! Monday and. \ Friday. leaves Centre Street Dock Wednesday With :Steamer Finn daily to and from St.Mary's t. every Close: connection made with steamers for -- and I Ga., and! semi-\veekly to and from Saturday for SAVANNAH, touching litBRUNSWICK Mellonville ami Enterprise, also with steamers ST..TlOSJJtYXD: FANCY GOODS OF St.: Mary's River Landings.. !; ST. SIMON'S, DARIEN) : and for Ocklawaha Hh'l'ri; also at Savannah CONSIGNMENTS SOLICITED.-; ALL KINDS, AT li.ll.UWIN: .L.'., HOBOYOA. with steamers for Nework, Philadelphia} , Boston and Baltimorc.und Charleston, with With Trains! for Live Oak1'allahasseeaul: Memoranda.Steamers Hh'nll\\lir New York, Philadelphia Haiti Cor. Congress and :St. Julian Sts., , all points in Middle 11I111rl': \ Savannah, 'eorjla. AT LOfllLOOHV, FLA., with the Atlantic, Gulf .fc West India. 'l'rlll1'"it I Railroads fur routes North, East;: : and E. L. PALMER & CO. and Peninsular Railroads and via Savannah West., Kailroad.s. With Steamer Alpha for all points: and : . with I steamships, for, Baltimore Philadelphia landings l.akl' arrival of Peninsular ' -- --- on Orange on -.t............................................................aR'holesale Railroad Train New York and Boston: FIRST-CLASS PASSENGER: ; _('ODJO. > RAILROAD. IJA'l'lOSS.I'll . :. :. FumwCESTRAI. For :State-Ibsims'I'kkets, and all other i i i ATUUXKSVII.I.K: ;: FL.\., particulars, apply to the following Agents rOil!:" 'f l'k.tlllllll Staterooms secured t ..-+ FruitBALTIMORE Dealers,+- .. JACKSONviLLK: FLA., March 111.< 1879. With Stage Line for Ocala and Tampa on and Olllces: and I all information. furnished at office, corner - On and after this: date Trains: on this Road Monday, Wednesday and Saturday ; from (\'lIlrl'lIl1ll Second streets. . .;............. ..............................................} will run as: follows : Ocala and 'I'ainpa'1'uesduy! Friday and. Sun Agent Fernandina CentrcSt.,:: Fla., between-Capt.:Ol'l'ollllllllcl:.I. I.. Ronmillat Third., 2)ly) -L4. XOYJ': ( '. __ . ( = .Z ;;; -c :: - --- = : = DAY PASSENGER: (ExcKiT nw.\Y.) ly. :Savannah\ Ga.-Cor. Bull and Bryan Sts., MI). Leave Jacksonville ............ ......... HiIJO: .\, )(. With ATC'KIlVIt KT.Y, FLA., Line opposite\ Pnlaski! and Screven )House. 1880. THIRD VOLUME. 1881. Co.'s for Leave Baldwin ........................... 1):10!):: A. M. and Tumna Manatee Sleam.-hiit: ,' I Jacksonville: .-Corner Bay and Pine Leave Lake City.........................11::3:1: A. M. Tampa Slunluyaol'1'hursday West : andThursday Sis., Dr. L'Engle's Drug Store ; A. C. Limphere -TIIKFlorida 1 ;'- at 4 in. and for Key Sunday Leave Live Oak........................... 1:00: iM.\ p. Ticket Agent ; A. L. Hnngerford, REFERENCES: : Arrive at Savannah ..................... Sl" !'. M, With! thc, at United 0 )p. m! :Slates mid Havana Fu t Agent.St. Mirror. " Leave !Savannah.......................... K:00: .t. ::1(. Mail for Augustine: t 1"la.-OIl I the Bay, R. I". West Havana Rev. 0.1'. Thackani, Fcrnandina, Fla. Leave Live Oak........................... "'>:.'>,'> i>. 1\t. Steunier.ldntirrd arrival ofS: i''ialTruineverv'I'ut4day Key I Armstrong t Agent, . Mr. Frederick A. Fleming, Ilibernia, Fla. Leave Lake City .......................... 5:00: r. M. Cuba afternoon on at 4.:1I111.::") From i Havana Palatka, Fla.-Lilienthal Brothers Co., An Ilglit: -i'atge Weekly devoted to i )[r. C. )[. Bevan, :St. Augustine, Fla. Leave Baldwin ............................ 7OT: i'. M. Culm, and Key West: l'n'riutllrlay.\ : :Special : -, Agents: , (v31-2m) Arrive at Jacksonville ................. $:1E1: i'. :M. : train connect. \ Gl'STAVE;l : (LEVE: ):, THE INTERESTS of the STATE. ___ .. .. __ _____ .__ General; Passenger: : .\ l'lIt. With for u MAIL AND }:EXPRESS; : (DAILY.) :Steamer! Enterprise, points:lll1l the W. 1') BARRY, TRY THE Leave Jacksonville: ...................... 5:30: p. >i. Suwunnee River, Thursdays! at (Ii a. III. General Agent Savannah Leave White House" ..................... (;::15 p. 'g. For information n-speeting\ roullratl.s: J. N. HARRIMAN, (a o. FAIKIIAXKS, Editor.rilHE : . NEW YORK OBSERVER Leave Baldwin............................ 7OO I'. 1\1. etc.l1'Ily to 11 Manager.ICIVEIC . lA-ave Darbyville............... ........... 7:2. I'. M.Ixave .\. O. JlAcDONELL: : --- _.- -- - THIS YEAR. Sanderson: .......................... NU7: I'. M. D E. MAXWKLL(icn'1'1'icket Gen'i and Puss: Agent. N'I'. :M1 fly's : PACKET.rillli : : Ti i.w.':, .011 /1.1: .1'.'...\'1.'I .')'!. Leave Olw! tee.............................. 84.'J: : p. 1\(. Supt.' :21 Leave )U. Carrie......................... 0:03: : I'. M. .-. l'J': HACOU[ Arrive Luke City......................... S ::30 I'. M.' JAVKHOSVlI.U, since its THE LARGEST AXD REST FAMILY '; RAILROAD. MIRROR has establish' Leave Live Oak........................... 2:15: A. x. ; | 1 PAPER IX TUB WORLD. Arrive Tallahassee: ....................... 7:00 A. M. MASTER TKANM-OKTATIO.N'K: ( OFFICE, }I ITALLAHASSEE l c Io. meat, endeavored to fitrnUh its readers 3 : :: with journal devoted to the welfare of the Arrive Albany.............................10:45: A. M. Fu* February IHN Its On State reflecting all various Interests and .\rriveHu\.llnllah............... ........... 0:00: A. M. and after Monday, February 2, JK0, : STEAMER: ( FLOItA. trains of this road will fol localities us: well us our own giving such Leave Savannah .......................... 4:30: p. M. jiassenger run at JL and information , t-Send for Free.-ftS lows CAIT, JOHN RICHARDSON; gl'lIerlllllcwlI the timesafforded viz : as: : Sample Copy- ; Leave Albany ............................. 4:00: p. M. : : , Leave Tallahassee; ..,..,................. 5:45: p. M. PASSENGER TRAIN EAST: BOUND.Leave : WILL RUN ON THE ST. MARY'S Iaer \'- lias, discussing public questions to become fairly, Leave Live Oak........................... 2:15 A. M, L'hattalwodlt.l..llaily at.... 2 ''II) r. 1\1. during the season as follows! : and Bought visitor, moreover, and anacceptable Leave Lake City.......................... 3:50 A. M. Leave Juincy. 322P.M. I -ave ST. MAKY'H EVERY: MONDAY} and } from as a of family the blemishes literary NEW YORK OBSERVER, Leave Mt. Carrie......................... 4:18: A. u. J.eu\.eTullaltl1J4:< ....... (too p. M, THURSDAY} MORNING at 0 o'cl.nk, fur modern l' N'r, free many. of I l-3t 37 Park Row, New York. Leave Olustee: ............................. 4:40: A. M, Leave Monticello 7 10 p. M, FEUXANUISA ; and I will leave FKRXANMNA journalism.In third Leave Sanderson.....,.......,,....,,.... 5:20: A. H. Leave Greenville.............. 8 3M p. M. same days at H a. m., fur CAMP !)IN'KY r.r desire entering UMJIour establish year, we further G. F. VERY Leave Darbyyille.......................... 5:55: A. J. Leave Madison: .. .. 02 Leave Baldwin............................. 0:40: A. x. Leave Live Oak...............- 2 15 A. M.ArriveHavannah. IMuntlnIlty: TUESDAY: } and FRIDAY will take wo Interest, we the the public t Leave White House.................... 70. A. II. .. i) OJ A. N. } will arrive at ST. MAKY'S at 5 p. III., On great the 'i'Hh of the- history month our 1i- . Arrive Jacksonville.................... 7-50 A. M. Arrive Thomasville ... ...... U 55 A. M, touching at FEK.VANIUNA. shall State. in present columns we ......1025 commence a reprint our of Mall 'rriveIbanr. A. M. On WEDNESDAYS: and SATURDAYS On and Train Cars Express Sleeping Arrive Lake City............... 335 A, M. will leave HT. MAUV'H at 8:30 a. m., and can one of the lauHt valuable early works on to and from Jacksonville and LIVERY AND BOARDING STABLES. run through Arrite Baldwin<< ................ 0'15 A. x. be chartered fur excursions toJuUKfln..N" "Florida published in 17U5, in London. Savannah ; also, Lucas Sleeping;) Cars run This work was written by W. STORK, M. Arrive Jacksonville........- ...... 7 50 A. M. CARRIAGES AND WAGONSTo through to and from Jacksonville and Tallahassee. I). to call attention to the advantages afforded , Arrive Fernandina........... 3 40 p. x. : , and from Steamers and Trains. Arrive Gainesville 504 p. M. by Florida, and to promote the settlement - CONTRACTS FOR HAULING, ETC.: FERNANDINA EXPRESS: (DAILY.) Arrive Cedar Key............. 0 30 p. M, and other joints of interest in the vicinityof of the country. It treats of all the Fernandina. natural of Florida Leave Jacksonville.....................11:15: A. x.' PASSENGER THAIJf-WKST: BOUND productions and its capa FOR SALE : Arrive Baldwin...........................12:30: p. x. Leave Jacksonville .....daily at.... 5 30 p. M. Through IIIllH or Ladingby twive bilities. numliera U will be of published the in full in uc- HORSES, BUGGIES: HARNESS;; Arrive Fernandina...................... 3:40: p. u. :Leave Femandina.....,..... ...?1039 A. N, : MIRROR verbatim current literatim volume with ofTHE CARTS AND WAGONS. Leave Fernandina........................10:30A. x. ]Leave Gainesville........ ..... 002 A, M. MALLORY'8 LINK of Stcainen to allpolllt8 the Editor. ft , Leave Baldwin............................ 1:20 p. M. Leave Cedar Key..........,.. 4 30 A, X. on the Ht )Iary'.. notes OUr by readers will be able in this I. p"'TERYS CASILt ...... ..... way to Arrive Jacksonville .. .. 2:35 p. x. I. aue Baldwin ... 7 00 p. M. Close Connection obtain) this rare and valuable work, of which ;328-0ffiee and Stable-First Street near Passengers for Fernandina and Cedar Key Leave Savanna 040 p. x. General Sanford was able to find only this Broom Street Wharf 49-tf take this: train. No train from Baldwin toCedar Leave .. 4 30 p. x. made) with the New York and Savannah one copy in all England.: Key on Sunday.CoNNwvoNaAt Leave[ Live Oak.........,...... 2 15 A. M. Steamers. Mark all good. "Care of"tt'lllUcrJ'WI'll. Early: subscriptions) to TIIK: MIRROR NOTICE. Baldwin with A., G. W. I. T. R. R., for (fcdar Key Gainesville Leave ireenville........ ...... 439A.M. GOOD} ACCOMMODATIONS FOR PAS- Publishers to determine the number of copies POWERS ATTORNEY hereto and Fernandina. and all poinU North and Leave[ Monticello .....? 5 00 A. x. sengenExcur..ionitx/ : and Tourists will of required.Subscriptions . ALL given by me. to any one whomso- Wet ; at Lake City for Tallahassee Albany, Arrive Tallahassee....-..-. 700 A. M.l find this a very attractive trip, as the scenery can 1 be made through Mr. ever,. in the State of Florida have been Savannah and all points North and West ; ave Tallaha-sse....._....... .... 8 30 A. x. U grand and alligators and other game are Telfair Stockton at Drew's Book Stonyin revoked.. See records in office of County at Jacksonville with St. Johns River Steam. I l. save Quinry................. .". ....10 O$ A. M. abundant.For Jacksonville: or by direct application! to lids' t.'lerk. ers. J, s. MCELROY: Arrive Chattaho/x-Iiee....... ......11 30 A. x. further information apply to office. Address .. ' H. C. CUVELLIER.San W. M. DAViPbox, Master Trans /n. CONNECTIONS.At << JOHN RICHARDSON, .'LOJUD.IJlUtOn.. Francisco, Cal., Nov. 13, 1880. 3-4t Superintendent. Live Oak daily. with the Savannah, 25-tf }'enulII ina, Fla. 2-U Fcrnandina, Fla.- " k i '" - --- iA: r\\, ; s THE FLORIDA 1 ( MIRROR : JANUARY 1.I 1.SATVlibAY . \ ,., .. .. _ _ _ -=_ -- :: ... . .. .. -- -- .. - ; --- -- ------ -- -------- -- -- --- -'-" --- ---- .. . .---- -- -' - ---- -- ---- -- --- --j rrnu FL0IifDA f.liuHon. The SlmIll J' ('J.* has! a happy. faculty of Till:: XATtOXAL VAl'lTAL.ADJofHNS iroceeded from the flight, ( In )1 Ferry ntboli1l'lllol !OIIC) of "llih have to Leeft I __ ,, appearing the would-be regulator 'IIIIA they were thuuttglit 1) \ =- r-=: = -:!:== :-. _. general to withdraw tin; word "fllr ;j" but he !nn'll .\ 'first - : ,T.l YAUr // (fhe State, its politic! *, its interests t and its I l'n\uln: "$ !' ron Till I: llov0)IRISTMS | || !'- helll firm, and added the word "famine," pieces of dllt'on1C manuscriptwrit have been, iffatrs. Our esteemed! contemporary must, :MfsINf.s.To saying that t the church endeavored, to techithat ten uii bark rut into long strips. wen WEST VLOllIltA, AX1) Tim SKXATOltSUIl however, remember, that the rural district, ; tie J-'tlitol'! of he Mlrrw ; there could be no morality without rc- after lu h trouble, unrolled fhej - *. have opinions and judgments lof their own, WASIIIXOTOX, 11 I P. ('., l December\ :2!, h SI' o.) igion.. M. Ferry concluded I 11;%' asking (the foiiii.1 to be treatises UI music,1'l'11Ilcu"tOIS . I. At tho senatorial' election of 1878 the and do not as a rule take their cue from its After n week eventful, hidly fr a dis.graceful enate not to mutilate t the (,.luratiol scheme of the people, religion ami the, charcoal choice of the eastern portion of the State nctrbpolitan utterances.c all give room quarrel In the House, Congress! has: 1"y eliminating i moral jihilosophy. The Due) two glass eases arc to be Il'C1 their \, was yielded to in the selection of Senator with pleasure to anything which seems tobe taken a recess! for fourteen day, 1111.1n'. are Ic 1'roglie rose to !k wh.tl1 the I'r- tablets on which. the 1'01plinnlule Call, a rcnident of Duval the of public interest: in old Duval ; we will III the midst of the (Christmas. festivities I i gramme of (the council, after t the passing: of contracts of sales leases, etc. ]1 11\1 county, on extreme horseback, eastern border of Florida. Senator mblish:! its orange or any other statistics, which are enjoyed, ,by young and old, I in amore the 111.I wlulll include i ill"II'ucliol as to the there i is 1 statue of Nero, on of Scipi"Africanus fiad hut we insist! : that (the lltircau of Immigration whole-souled! thorough t way than t .' towards 00110111 h the immortality of taken from Pompeii ; also Matues Jones been elected fromVcst\ Florida ! of Ephestil. 5s: a State Institution and not a local they have been and Diana) at ! enjoyed anytime since soul. ) Apolo. re- ' I Ferry a when the Democratic party were not in the tlC r lIt \olulltcerill with bronze one ; and we admire the even-handed way the great financial crash of 1873. The young lIly> the article relating to morl philosophy The later I is of !>ler of Crea-fl'cl Since that time ; ascendancy. the Democratic the nurse as _ I party in West Florida has steadily increased in which the pamphlet gives general; and rejoice III a greater opulence presents, and was )put to the ballot, and carried by 100 to (Uia1 ion. aid represented has in her anus three Jon! and impartial view of all parts: of the State. We their parents are happy) in their greater power I 110 votes. After!< further!< ul'iol the( eight other animals, while her "! ia.Wned . in until in the election ole ( . recent strength, - have been formed. that the Imrt'ILullU4 righI- to There lack with (towers, sphinxes lions, l give. are no of those who i>ill I I in i I Its entirety i was adopted. "West Florida sends entire an Democratic I ly declined to he the medium of private lament that Christina is The Farncs.e bull ('OI1\(rccla lulerpien' any no longer the sc- Of all I I the i inducements eve;h'l.lout to capitalists here. of WI" delegation members to , twenty-five fireek art by of both houses of the general assembly and l interests! whatever: and the high character/ ties of happy festivals! of by-gone years, but surely the strangest 1 is t that which bus: transported from Rhodes to HOI(', ami was << of the commissioner. has never been !successfully they belong to that class: :! who describe a golden ; lieen devised by the Fiynru and by the bank found in Caracallo's bath. (!a Ia. and terra furnishes a majority of 2,500 in the election bemKmosaics ornaments, : assailed in quarter which exists III the cotta ware from 1'ompeii, any age only imagination. to which entrusted! the ta-k of In the election \1tlllgHI all covered with a . Governor lUoxham and 3,000 in glass buttons, I Whatever (the legislature! may in their wis-:! It difficult to believe, III the fa'cof ocular daily financial report in its: ('(II ii minis. I produced by the combined of :Mr. Da\idson to the House of Representatives. IJclmti lom do III reference to the bureau, no can- demonstration, that there is. any declinein announced that every applicant for Panama action fulluc.l tile'Ull'', 1:118. l't.ha1ds then the wishes of t Clearly ( 111111\11111 will refuse to give Dr. French a the appetite of the children of to-day ; C Canal shares receive silver medal fo toni feet votive oflerings paean , I West Florida yre primarily entitled! to consideration large measure of credit for his I : exertions in I their lamrhter no.nu \..... n.u.. b'irpmmm........ tl.ir...... tiMi.i.iiK.aj....IT... .... (*->VI* ">rV.7'(.lVf,;. ni.uit.-a.hal tli'it iii.it-Illiljt: l.ii.. !. lOIOlieil dll ttn.l in itl are to be found. here.There: h.1. ' in the choice of to i other rare and curious ofycctsuiai a !successor are many establishing the bureau: and his honest, !' as !simple and spontaneous as: ever. Nor are him Thl''ulle of the medal i is guaranteed 1 cannot now enumerate. The groups of Senator Jones. I straightforward:, efforts to make it as: usefulas thieViil_ tug fol ks.w ho are hy I this time too old to to be five flUH' Now, I if the Panama Canal statuary in the Museum are )urliulnrlyheuliful That choice to be that Senator , appears possible tinder t the narrow limitations, be called children, !so artificial i I as sonic would proves to he success% : the shareholders will Some were executed lchael Jones should \be his own stteccsor.Vet : (' are also paintings!by Hnhael financial and otherwise! which I 1 l has surrounded have us believe. It is true that( their tastes find an excellent in i vestment for their t IOI'fi; Igdl' A Tont . Florida has material interests of great importance > it.GO _ _ are in a certain !sense more cxtr.uagantthan but !-lluldlll' speculation I, prove disastrous t , to be subserved at "'a . _ _ hingtoll were I those! of their fathers and mothers at I the possession of silver medal would, to : : AMKltlCAX IlBl'lEJ "BnA'un IILOXIIAM'S CAtitxir.The : .UnTI The harbor of Pensacola is the. best on the :11 the same age. The increase of national, an .\lri'III, he 1 poor compensation for The latest number of (the Xorth American r whole flulf c m"tJill\ of great importance of the Shite, with. great good to press and. presentation wealth has taught all how many pleasant the capital I .11 not intend to gives compact vigorous to this State and the whole What taste have left the to select 11htursl't1 (. t Inllplti. country. governor-elect some matter of I immediate illcl. I things i money can get-things; not )Iihyl'aS. oiler any opinion as to the itself, WIintenlcll to be one of the principal his own cabinet without interference. no\-! cculalol tire value. To a hospitality so gelll'I'OIthnt ant in I themselves, but positively harmless, but I find it dillicult to understand t the condition includes both .Senator KdinumH and United BUitcs navy yards was established in ernor ISloxhatu we have no doubt, will appoint except where! the expense( they entail is selfish of an individual who is! induced by Senator. Walace, the Kditor: of (the "I..t'lit ' that harbor, large expenditures) were made, the members of his! cabinet with judgment I singularly apt I i of those or unjustifiable. The girls know how the promise of a one dollar medal to undertake ( a cr'l'pLo1 anti it had assumed great importance before and will seek to surround himselfand! robust subjects best worth taking f'OII the it i i" to ride t to within four . _ t pleasant along ringing frosty pay $ >00 years.Tho - swift current of I the Theopeningarticlcisa ..the war. During the war the buildings I were illustrate! his administration 1 by the choice of I ty road: on u well-trained, clI ;.goil1g pony'. ; .II'C/I'I.I"I I <' states t that t the Channel t thoughtful I i i t one tilC i by Professor JohnFiskc i I many of them destroyed and the. 'Iml.went gOIIIIIICII of high character and capacity.THK to drive a faultless horse in pretty ihitt1tmtO ; I Tunnel Company u is about to :ilk t the on The Philosophy'If ICIl'CUt.OI.! !,." into.. .(lisa*? and decay. For many 'years for the Ill'crelll' UI' have !sleitrh; ready, should tin exceptional second shaftj for the I purpose of sendingdown Afer'I''OIIIII and its dual there was no disposition in the dominant :; MOULD'S l,' Ull. fall I of snow give opportunity for it, and the plant necessary! for I the( horin The first: extinction persecuting, the Professor, 1ll'llidilg party: in Congress to make expenditures in The movement' for the World's Fair in to beable gratify that most: harmless of all !>hat has reached (the stratum in which it i is "We shall find that (the clang(' i I. tho Southern states. At the last session 18J:J has! progressed! to the designation of Jn- with (the of tastes! I the love of what i is pretty in itself, in intended to ('onltrue the and the deeply in-wrought !- wood as a :site.Vhuihe: its distance from (the hllc mankind both morally and intellectually.The . , however, :irenator Jones procured an appropriation business and populated }portions! of the city new dresses 141011 appropriate occasions.The :! diUicultics occasioned, by the invasion of (the persecuting spirit has its l1gilUorrllr of $150,000) to commence the restoration 1-111 serious objection, it appears\ [ to be I1holitthe hoys: too, know the delight of shoiildoring water have I been I' quite overcome. in the( : of man to .loI O\CI' of the Pensacola yard, the work11I)2 most ( location within the citylimits 11-vliiol intellectually in I.hl' ; navy eligible a gun, of 1 bestriding! a byciclc, :and of indulging his f'low''I'lIlnt' : I which has] already commenced. The available for the purpose.Inwood I. sown opinions are in' .I i is bounded (Iii the east by (the in other manly pursuits, I the onlydrawback .\ nIS.\: IIIIS Sf.NXY ITU.Y-X VfU5 1Ilull.lioll oll We know very well l how people of West Florida naturally regard this Harlem river and heights: on the south 1 by to which Is that they cont money) .\:' \ ITS IIIT: OK IXTKUKST.To : fallihl'orn''t l are apt to behave wh,1 arguing matter with great interest: t, and prefer tocon- Fort (icorge, formerly Fort Clear' View ; on lint because we have learned to appreciatethe the Kilituf of the : dlillr"I question of no great consequence.Their . timic at the seat of government the able the( southwest: and west by 1)It5Vnshimuig:!! almighty dollar, we ha\e not, on that : Jllrol December I 6*], 18.sO.I little passions warming with I the dis ' wheel in itiOll. ton, %l'llollallli Tryon, and on the north by X.\'ul h.u.\ ('USiOI, they pass from argument to abuse, " the hand which has set in account t Ill'collleIa'l's to it, and we may I write from the city of Naples, which, and, at I n wool Hill! it is! what i is:! more familiarly t they each other hard names, Again, the influence of this! Senator lilts beenshown known the I Parade (i iround, having onetime safely believe that the hearts of our young iyiiugas! it docs on its beautiful bay, with itI'oluialiul lat, 'al begin to. pound each other. Most[ in the prompt action he has )procured been selected! by the park conimisHion-:: folks: are as t true as ever, their instincts as of > \ place of much in people I imagine: must have had experiences and Seneral Shalcr for that ('. It :oo.ll\.I'41 of this sort in their childhood. I ; ) ers pllrpo of$25iouufor 1 the Senate appropriation what i is Iiy, byan ) their npproeiptioii' inhabitants ofO"l'l.k extends from ]) 'ckmlln street to :211th.streetand ( generous fn'lt tl tl(! tour t The are n' when quite little boy, coming (\ 1 tho erection of a custom-house at Pensa lies between :Sherman: avenue and the straightforward, and simple, and loyal as I" origin, 1\111 t their vivacity and gaiety oll.t.:! I schoolmate over the question cola. Th-3 various rivers and ]harbors on the Harlem river. It contains about two hundred keen as: it ever was. And Christmas, now I present I !singular contrast to the Ho- whether :-Napoleon Il'alWI'I the battle of jute coast require improvement, and other and lil'tyacrcs! which are level or gently more than ever, is the time to test :such (feel mans: whudillg'i to t the )bearing and '. 'lau.'I! I 1'11" in the scrimmage undulating.! It i is nerved with gas and grave and 11 the alfair is a quarter) of a century - interests of importance to that section" needan ings. It is the time when from every side I of t their forefathers. Jood nature : that I Croton water. It I I is I thought by competentauthorities dignity ( old I am ready to confess! ( fought ubic rep\'en' t8tlVC III \VUS1 llillgtoH. There to be easily accessible by railroad. appeals are made to Us ; the time when we and tolerance toward each Otl\1 arc especially on the wrong side-..the battle (.1' Ulraii was are many excellent men in Florida who and \'I' transportation.: \ :It i i i.s: eleven miles! can all I, each in his own way, do something to be observedamongthehumblerclais-: not much of a victory, after all Now the would their best exertions to advance from the City Hall and I is not yet reached to make others happier. Kven their spirit which prompts a dlilto pound hi* ; rate them give by the l'1c\'lll'llmill'oullol.: but undoubtedly at any (':-I. One may !see I !pushing way companion who resists Ilm argument isidentical the interests of thnt'ctiOHU1111 of all secI would be shouldthecxhihition beheld on it. those: who cannot give in substance canspare through their narrow streets, (elbowing each with the h prompts .,_ .... ... .. ... ., tpiri... I is do/.en drives .1 J! .1..1.1. .1 n.. ." : .1. iii-iti tit f"i1imitiittn. .. lnirii. nr .ntlir..>r. \t tions pf the State. It no disparagement.to : There. are, however, half a ineir nine- ami- irouoie ; umi- im-n- .unkindly inner, nUl un"1 JOKCS wun ., 2114111 I. t.IItI .IlItII" 'IItI I JtIIII "S to them that the )people) should prefer to either h completed or near completion, I bywhich words, :LJJllI1l'cll.lIl\Il I thought:" more greatest good"X"IlgllH I hUlor. To obtain I a perfect wiie put down and injure his neighbor who the I which h<', t the grounds: be reached from the refuses to reverence things ,I' continue that l'nl"itioHollewhohll4" shown! citv. The tenth avenue may! is completed 1 I to the precious than gifts, and equally pleasant: view of t their net i h'(! out-door life toni-ts himself deems !111 The more we reflect hU: JitnetM! for the place, and has: earned high point( of the blufl! south of the site and will both to those who give and t tho.se who take. would .11 1 \\1 to put their watches and upon it the \or !hnll.c convinced that t honor and a el1 expression of esteem! as I be ('ollth1\\'llnrO\ll1C1 t I I 1 Fort (;Jeorge avenue to Day) by day as: the dear old festival draws in their pockets and I'oI'ul at hotol the feeling sale in the two - hIUlkn'hicr" ! F.lcvcnthavenutiand h in the latter it i is accompanied ,, an, able, discreet wise and judicious Sena Eleventh avenue.Audtibon New avenue avenue, which are already nearer, ml.torieR and 1I-O'latl.II": cluster dowl (the ttrnttt q i j>tt)>nla (strata meaning and cases tisgui-I..1: by other fl.'lng1'l. Now, what tor. laid out, will completed, and from round usVo: are a year ol.hr (than wi !street.) At night I double range of illuminated i is t feeling I h'ut I the .1ipo"iiol to domineer - 1 'Wo: bcliovc the people of West, l"lorillul- the 'point of intersection !shown on (the were, and though a year: is but short: time stalls, covered with fruit and \'(. ca- to assert one's OWI ll\'iolat. at (the sire the rejection: : of :Senator:; Jones, 11I\11urI map, to the fairgrounds{ a boulevard will be h in itself, yet but a 'few years: go to (the making L1"ljlIIS.hou.l'; with their s.toyes and fireplaces I expense) C of neighboring -a disposition I 1' characteristic of the to have their wishes! rc'isvctetl.Ve made. llroadway is now a boulevard all I if'a I life.I "'0 are a perceptible t further on which are frying-pans ready for eminently ( entitled the way to t the ground. and the' ridge road 'o1'1 I brute and of the savage, but less: and less .bdie,'(', moreover, riiat the I'l\lIl'e feeling preni1utn ]leading! through :some of the. I finest: )private t removed from ouryouth, with il many- the macaroni, I favorite dish, of the Neapolitans I characteristic I of man as he becomes more and _vans_ nrcturn UH till "ui-.I.u"iis.. , 1' ; ; it"i;; ; fjblu. of the wolf ami thelamb to the Senate would be acceptable to tod.1I1Ii: can i be found (' ('. nearer t to the last rest of all I, which those t wares and the 1IIIIh',1 sellers of the same, remembering: . The! elevated railroad I I otllcials say that I I -remembering that a strong;: ,ill inever i- I all parts of the State. with two roads to t the place they can I land n'llINI1'It dread whose life has: hl'l'l hLtllIllVle(11tL"O and (the crowds which come partake) ( and at a loss fur reasons, and I that no OIH ;tuioo, \ \I )persons: an I hour i on the grounds. The they have made ]happy and I.rig' enjoy i render it a scene of life and Illl'I''lt1 is more thoroughly the dupe of (the fa No TJ1L EltVCATlOXAL JtlLL. Hudson I River road on the west! amid thwNcw- the lives: of ltlLI.' '$. Christmas may change Like other Kuropean cities Naples : reasons 1Ial tl man hi'inisclt'trIo i is under - - of this bill was to YO'k'lIll':1lulI: the vast, by carrying trains: and Christmas. inWashington The Via and I the ('(Pitt .1' strong pa:. iol-n'\l'm- The professed: purpose its customs and habits I jirti.0 I HUla ' 1 url.tolatl bering thi has the to of t twt'l'IU'i: (each can land:\OOllnn) hour one key a c:1'1 I.I carry out the suggestion/, of President Hayes! more. These, with the other roads: : connecting In this year of grace ixo i Is Victor Kinmamicl are (the two I finest streets. of t the history of -l' ulillll. The paradox, t of devoting, (the proceeds of the public lands and with t the steamboat facilities: will strangely_' unlike (.'liristmnuistis: it was enjoyedin The Itoma divides the city into two equal as f'gil'I't the "benevolent persecutors," I. to tho education of the illiterate masses! iI render it an ('a,,y matter to trauport111,004.1) t the days of t the (first I President and his: I immediate parts ; it is (the great thoroughfare, extending :paradox no longer. It becomes explicable our pcofle. The sum which may be expected or even and:'JOO.Ooo; back: persons which! II is 11ato precisely the fairgrounds tin successors, but the t human: side of from the lahwc to the Mu"ciim, the how doing a man Churtt may service sincerely, \\'bill.lle\ I believe is himself in realityol tobo : I I tobu realized from the s-ale of public problem the, committee on site have undertaken the festival, its interest and its .tltlil'-I.: Hroadway c.t Naples.- The Iial(public gar I >>-yinr'n. in.piiNc which, in an ultimate J. ,la'Hl;; ie obout two millions of dollars per to solve.- The tiuuth. t'laiUwhalg11 Our (' : tot den.-) along the sea shm re are iiiuirii frequented analysis, i neither domineer more nor Icf-s than theimpulse The bill passed devotes only the with and with the return (the fashionable people. to (\1 one's fellow-crea- nnm n. as: chango our fa.hioI1'l. ( by t tUt'-I. Thl". t though the plea of mistaken interest of the sum nt1 )per ('('nt., which Till::: IWUCATIOXAI* ItlLLTASSLIt.ITS of Christmas have again returned all Here, i in the long summer evenings, the benevolence may now and then I by properly wluld make (the available\ amount\ to be annually \ that I I\ our younger days made Christmas, rich costumes: uf the ladies and dlih1l'llll urgl'llu ('XIIUtilllf certain .special atls disbursed only $su,000. The amendment IiovIsLiNs-ANLM.tTPO: :HKIUTK.nXll\1EXT: ox: TIIF gatherings occasions to be long anticipate t the mn,>ie ((0 military band plays from nine I 1'rl'l'Uliou. it cannot excuse, rI''lliol. .UIEXI' Ir.X'N-TII.: TKLLFIt I or oh"l'url the fact that its i- proposed ,by )Ir. Teller of Colorado. I.O.VT IIV .\ TIt VOTK.WAMUXUTO.V :. Ulo utl'ectionatcly rl'11.mhl'n',1POI till \l'\1 in summer, and th'l twutill five largely due to a slow mural prln.-tl,111uitiol a and strongly supported hl'utor\ Jones I December! 1;.-The Educational in winter), make :1 fairy scene. E\I in December divrease I in ..ll-a"l..ti"l. I a concomitant I ( Hill the Senate:: at six.iO'hOt'k conitKsi'oxnuxvi:. increase in :10 WI1:4I':1-11'1l'II1\ 1:1 , was to UivMo the whole amount rC'l'h".tau111I111y this: evening. 'Ihe only amendment! tX the gardens look gay. I: people.Very, u-jicft rilt. of other r il1b -t'uII of the interest. The amendment lit' importune is that proposed by Senator rniiosornv I FOUFKF.M-H 1,1:1". M. n.: Undoubtedly t the mbst( I'autiul'il'W: of closely connected with this inoru I !prevailed in the' committee of the )Morgan providing' for (the instruction ot \H U:\, A lloU'EKS.TIIK Naples are from the Ulll'l of Calnuldola, I root \.1 the persecuting! spirit in men- arrogant 3 whole, b'lt.1: the final% vote there was a tie women i in the state agricultural colleges I in >.tI'uln.t'W4 UKTWEKX 1rt\.TO"TII'J; : AXIFUtM'K. Castle of St. Klmo, and l from (the terraces I :el.a..l.rtllll. I.- intellectual root in industrial TI' tL tSli.\\11 and I such branches of technical : You the : : one's own opinions is and St. are lust. It quite balcony If U"-lmlli.11 I ul the anu-ndment was lartil'll'ul\'IIt tinprovisions ' ar education! as are suited to their sex. Uy : di-po-iiion' to domineer proliabJo: that! this amendment will prevail : of the! bill I the proceeds of I the. :>:1ll'It' 7'o Hit }:lill'; ttftlte Mirnif : ha\e from these ramparts. tL I Naples' its it over r"ll' t'dllw-lwl-t", make him t.bev : in the H-i'i-e wh'rIw \\\.- and South, ( public ]land and (the earningof: the : : December 1J, 1 11 ') W'f' lying at your ft ft. The beautiful bay, ;, you or as.st'iil to jour opinions, whether 114 %vf.Ich have a l.irger proportionate. representation Patent olllce are to ho funded at1 per cent :I I 1.l.'ltSl higher education lit' the bland, Mount[ '"'stiVitLvhthi its burning will or no- i.only an evane.-cent! (,111. in ( divided the slates The debate on I fluId I the interest among: to if he r the .Senate:; will doubtless: actin liul.xiin rrattr on your left and a. far as the til 11"11)lllon 1.11111 illh'rl'1 in lhain ' loa : proportion to their t illiteracy.The I in the t"I..tChr11) unji"o any way wih t the accomplishment, (. yourp.nrpoe L concert. The constitutional! question\ hast : measure is Ill'il.tIll'l1'xdn..I'I'h., for gir..l _.. .._S'._..... 1..lw. .-.i> til Due. III' Ilrojilio- amM. l- eye can r'udl. long lines of villagi On 11 I 'II Jll'. very Mime_ diminnti.m.n._...jy b? n nuV: :h to the I power of Congress: to the benefit of the colored nice in the :South. H.l. Jules I Ferry, a> to whether Ilrl philosophy the eastern coast, the ruins of the ancient I hl t the\ 1IIIl'I'of military activity, attendant - .1I"l'Us.IIHWtL" \ within the .stateThe the most notable feature\ of t the i city of the ) and ofSrrentu. i upon ( "I f men into great and exercise MsOH'r th,' Teller'' amendment. I. to l''ll..i. ttll"l.fIU8 . I % that in regard I to ought illl.1l'lln Ih'urrk"I i-Minplex i .liticalNHietiishich( we found t answer 1 bm been given that it 1 b a u-e of This provided( that' tV proceed. lum of the .system. The 111l' It i> the beauty of these Ml'nl' to explain! the decreasing atrocity of ivrs'ecutiun - .JI'1'>I'Y for the public good, and that Congress tliem-clves of the land I !olhullll patents made several unflattering remarks us to )11 which gave rise to the ".I,'ilg. Sve :--iulll' : explains: Olsil the ,1"I'rca.ilJ, vitality for 111\111101 the interest, should L\ givt'ui to the and then. ,lIt'." i ..f its mural 'foundation tin *:*\\'&'( to donate WJiiey which t hut \ to nw: | manifestedin Ferry'.rvligiiiiu opinions .11i"'IIti\I'! . I fii-lina was MateConsiderable domineer . t IxMiviluIii! puiposes.The regard to this matter. It wa ut>,:,..1 with th'mU. on .rising to reply, ivquited 11'I I Mount Yll1iu.; ItalllJ solitary il Its j. The.' weakening u\'r ule';. of. thea-sun.ptloii- tf | . thai the South the education force that tlll'l'olur''lll''UI'I<,., through; ; \ awful grandeur, ha. for the U$ two : M.rauiiulity 1 fact ut much ( senate t" k:1l out of the questimi tlI.10 1 II in (HIV s IWI(opinion is i manifest. - or the \r.: ,\Jl'\.l rai-B 1 jo* I thrown almost entirely tin fault of their own are now in a condition conidcr hh public ai-tions. M. Ferry !; months-, iown sign* of unu-uul diMurb- I I ly a''acon-cqucncc uI'Ihiv "ame 't uf fo-7iHfw." from only to need t the benefits to lie derived I j uii.tNiit since l"7i, of tbeini (lug t'aLLcs. WhlIIIUJ life N the f.xtrcmclysimple addition to clause\ wllt'l I ; in of (the IlU I I. .1.I:1i1I: th) white )people. this HWI1CIllUdl. more than future generalions explained that the object Wll arid nuinotonoiiconiiino cJiu-atiM') of their own children., makes will il 'l'tl \\hiU-ou the other hand I, to pn>M-nt moral Ihi.stphy to youthful :.i habitants fled h'rr"t-.trkkt'l frumiuicini- ,. few ('xlori\'nn.lhal i I arc j ( of vtrv; . and) ..great interest the money will not I "uidc (heirstt'Ps I i ty, huts emitted vnluuait' Mitukci : l when is. 1'frlotUfCil't- 4 such aW.)? cipctial importance : the upon such a ml'r LS ) i "m.t ejl ; one not "nt'l compelled t<. ttt l'Hll'\ biMiorit! to he Smtbern:; people\ 1111in\ tILL iii. amount to i-iiough to confer any several appreciablebenefit through life. He explained! tlt1' the( !i and lava i ii tll'altll' uf one.own' ,'ulldu\l.ns\| , ycur' i . until the' '! : jii'wt qlL\11".bn.\ to the West.Tin t. iiiK'nitionii,, shall \\Irol'l't..l''\. t.itei. ". Tliiamendment (\1111'1101 i: luitttion proitostil fl) tn"tl> 'itltnentsiif i j The l'IIll' buil.ImgIn Naple are tlc ,lon\* 'th1 other with peoplenvf(the \( : ( .., . whih . was a bplt..l; in the e.nnmittoa honor, jK-rsonal re--pivtt.lK-dkmx'. !I Palace and National )hl>uJ. The' Palace i iI I Sllt, \'lit',. OIU1 llvt} amil fruf rt"l'group ; r.uiivAV or IMMHIKATIOX.tl I tif the whole, but wu... U...t by senatoroted u tie vote little to (lit' law., .levotion to tho country and duty I I i b I magnificent) building, richly dtvunUtxl. ':I If i U-lii-U, ,'I.t"l. ami uhstrt-iuiti.it ** '> of the Nun: tiul :Senate. The following; marble and tluit lire ie\er with fctutiu \ 'ho! fxivption into the ot' the young.M. painting by the brought into ''ttimpari-on tho bill : Jonas, towardtiod, liwk the. final iw-siigiMif I ( , It t..rrl I"-lml'lIb. and the KtyWitt ininpoii( ..... Uro Iie : tirst artist( .an' ll.rhul. m evterminatiuLwarfaru. ) I'm Il'i | McDonald\ } I. :SaivUbury. Vet, \ rhtv;> and t. Ferry obrvtd that the IhuH\l : with ; Decrat the new )pampblft of tho Williams. to think that no monil education l'cr.. as WI.I\'"fuhJt 1 with king* i p..iuhtlottett$, :titirllJ. i i.noticeable im.umil.r, that .nt''tuehs. f' dl\lli i'.mcr ul'l"\fS to meet with very Senator J-inas "aM U .i "' imvpondt'iif. ut tll''ar't1 that l.fl'ulllid"mI'l> |Ill"* I j many yiiirs Ill, and I'ineeUruntha 1 been I UllllllIrl' 1 lormed 1 with great promptiu bad bill mil I'ftrt and the Tfi'time that he- thought I III' llhl" : :11 ()nce formal ' ii Se's i'a-sanloin 'the'f no luj.jjcr toje I.I wlil are unthanie-abl ., by rtlaur - g.:'lel"o1t, a1>1'l"l\"I.I.! been weakened by be striking out of the rible, raWng a .torni f Snaiguatiun ct.rl'ah'l. these un' the ,' . ili vritic V.' 'in tn lit 11 ortill' J.tlNI jK inu oftfcf Teller amendmwit and in thatt'..rm vtt* will longer l be inhibit- in I i tlrtade, we will not dwell "'1 IIJ"11"4:.'. I ( conditions ull'r wliitli the nmi ..i to give other senator I : ,; 11 I i is KLT ? ..aIr..r'J" (t, tho d.it.r. i>ani!!>HU't in the. f"l : "* ui practically wort hit** The he that quarter tu st-lie oon-'i u%. L)' tit' The .Iuetti.i very intere iiii; Many 13nwtt.r tic m tiK wivu '.Ii -.L..fu..u. t ret'* iu 1 Duval county, are understutHl tu have voted" ut:1tIl"'t: I wiled *,. "ji'vttiit'fl.. fuynj in iho in I ,' (: yoi'Jn at one flrc tXtuniliuJ ri'it "I,- tiui. hll1lH.'t LII"l'.f the pro| .'iti(in that the jr-n- 'l.ht' j.urieuilv wa un. 10'U1tN I whj!., U. ) .r.;.,." lliiII IJIJJtI! I" ulI"l'rillgJ t-ral jjpiwrnmvnl would sndor\ H JIMW M'll\l fr applying. the epittu-t .li \l* 4a$ t t' I IDl''U )l lh'nulalt.U. anliibit 'l :I\dtu ihtaiig" (Imp tl1 Ihal t you ltuntt-r.co ilt.) twhr 9' f1t '* iUt ix'tVi< .I';f'f-.h ligurcs taken: by the. l'lnn' lI\\'r' t lie 'hlt..t' .i'teiiU'' "' .,f |lu-' )hItitteri'r Pu 4U-lttMirnfU ... ;uu3 .'f1J.- tl'. \Ut,tbe sert Zhuau4 t I; 4 ILt.---.V4'N'A"1 1'1 T.i tihIu1. w , l- -. rf'"' tlw Uultl"1! EU'U'Sm'ur : >> ,tatv". .. T i' ".Jiu\ . . ' " i e -; - . . --- - - -- -- k .- --- --- - - J L ...... If'! L . r . . FLORIDA MIKKOIt : JANUARY 1 I., -_ __ _. _. n_ n ___ ._ _. .__ __n .._. .. p-- -- .. 9- -- .- .. . AN ACCOUNT\ OKII the entrance lies 1.'urt't.: Mark's( so ",,111'11frolll <:roeerles! and Provisions.A. ' DKY GOODS 1r1': KW YOHK : .\ 1'1' I' I, O It I I* A the river it lies upon ; this'i fort i is a regular PHICES WITH _\ quadrangle, with four I bastions a ditch It. xovis.: AT 1'111: roiTi.Ait Uncoons norsi: 01' .Jo..r..I.KI.I'T fitly feet wide, with n covert-way, places of : AND) SHIP CHANDLKI)( !. : 11V arms, and glacis : the entrance of the gate a.IOl'EI Jells fl \niutal:: ; OK 1'1111.\1'.1.1" v, 1 U defended by, a raveline ; it I is ca''e-matcd Im:\t.IIm ix: -J &: T. iYDID.:-- P.otanMto )UN(i Majesty( t all round, and: l bomb-proof: the works are = . Provisions.! Liquors! EEC: ! for the Florida: ; ---- . entirely of hewn stone, and being! finished Journey 'from riiiNA St.: Augustine according to the modern, taste military .\ : KOH U. F. AVK1JY: CO.'S PLOWS.CK.XTKK DRY GOODS, CLOTHING, HOOTS AND SHOES, architecture it makes: : a very handsome appearance the.: Hi'crt.:\ John. t11'111 up) and may be, justly deemed the \ AM I'AX('\' 111)1)111. : : :STRKKT; \ I'rl'ttil'fort in the king's dominion I II I LONDON : riMIK' : LAKUKST I ::\ AND) HI-XT; : STOCK\ ) TO SKLF.CT\ : : \ FKO.M The of \ .- tf ; : ( : : ) (, AT 1'1ll'J'WHf'J: ::i ( ( . Sold hW.. Nicou. I :\ '* town :St. Augustine{ i is situated Dear >2. 1"lm .\\XtX.\)( FLA.JIKS. JL CANNOT IMM'NDKKSOLD.Iargo : ) . Church-Yard ui't'ii, .. the glacis of the fort, on the west side of the --- - Charing-Cross. harbour ; it is: an oblong square' : the streets: : .' .\ X X I.: ci'Aitiii::. shipments of I-'AM AXI WlVl'im: coons received weekly [Price :Shilling-.I \ ] are regularly laid out, ami intersect each .:#Wholesale and Detail: Onion: l h y mail receive prompt attention.New . 17s.(;: other at right angles: they are huHt narrowon rpIIIUD:) ST., HKT.: (' :xl'InI.t'IIl'.\, York OI1'1'J. J A ,',. M1 v l) i) > N'.K.: ('or. Centre and Third, 1 .; \ { < .S Walker :Street. purpose: to a I lord. shade. The town is ( l ,j lo'l'rllnlltilllJ.'II., St. Juan's, now l'lIlIcllt.:\ John's river, lies above half "FKIINANDINA: ) I.'L.I'UU .\., mile in a length regularly fortified ' ; 40 miles southward! of :St. Mary's( ; the tract! with bastions, half-ha"ttomis: and ditch' ; S A NIK) UN & HOYT\ I of land between them con-iKt: of plains covered : : IN TIIK: besides these work it has another fort of for with pine" those plain are called in ; : tifil'lIlioll"l'r singular, but well adapted' Choieest! l-'rnils! and Ve ;elables.CONFF.CTIONKIUKS. :SKCOND\ : ) :STKKKT.\ : : : NKAI: CKNTIJK.: America harrens 1)inc- : or highlands: contradistinction e aguit 't the enemy the :Spaniards\ had mostto I N'1Iu1t3511I.lxmi: mT: \11. to the swamp* and low lands: fear : it ell .i N of'-everal rows: of palmetto I ; : :I ::\. Kir.IMiss' : . We 'find a striking difference betwixt the GROCEKS; SHIP: CUAXDLERS: , trees, planted very elo.se along the ditch' , pine-barrens::! of Florida, and those to the northwards: ; the pine-barrens to the northwards up to the parapet: ; their pointed leaves are I : (arden; :Seeds: Flowers. Kami and AM I>K\I: .Kits: I.S I } I so many chuvauv de frieze, that make it Garden Implements.\ 7tf entirely .__* tit V'__ __ # from the poverty of the soil, do not M'c__ impenetrable: the two :southern iris, I IIAV I I COIIX | OATS IlltU'lt I I I .: answer the : of clearing.The J I j I/K': I necessary expense J ll.n. ' tions: are built of stone. In the middle of .\ \<; II: < &v I.'It II:\ n. J . V , * closeness: of the trees hinders! the grass: the tow n is: a spacious' square called the: : t parade --- from growing under them, so that large tract t : towards. "I > AKKIS: !:; AND) CONFKCTIONKKS: ): : : , i i2ItiIy thehaibour the bottom of land are no further useful than to make open : ; at .\ 1.1:11101'0:( : :; ( '" OF FPIXI'I'lJIW: : : ( ,\ \':-\ ON HAND.FUllCHGOTT . of this .<''ll1al'b the gon'I'lIol"111111'1'. ! pitch ami tarhereas: in Floiid.i\; as the l'II"WE: the apartments ot'wlaid are spacious and trees stand nt a greater distance: and both suited. to the rlim-ite (:roeeries.,, Cigars"- and liaeeos.! with : high windows. tic U""V*."I"1 .. .ti.n..<.1..i1n\ihi. .." arc mil V ni.- .fn. ..i.m(.tilt... tliilli tit,.. a I II .BENEDICT & CO. .I. balcony III front, and galleries on both. sides ; I I , the northwards, the pinc-han'cns a re covered to the back part: of the louse is joined aton.r TOXII:\ FANCY AKTICLKS.Weddings : :::. . with good grass: of a perpetualerdiire.. railed America a luuk-o11t, from In passing through this part of Florida. which i is Kntertainment.s: and Picnics: SOlllh"I' ' I tjicie an cxteusiyt'prt'L('(' towards ( 01'111'1' of Itu.i tutu I'ino tilrt>1'Is.! we find those plains; : frequently divided by furnished at the :shortest: notiie, at rock-bot the sea. as well as inland. There are two I. the swamps above mentioned whit being tom prices, at churches: within the walls of the town, the ANIJKL'S: II.\I: I-ty: : , full of forest-O'ees diversify the aspect of the \ parNh: church a plain. building, and another Centre t street: ' country, :as they 'lorm, !many thick woods. belonging) ; to the convent of Franciscan! : I ji:: 01'1'.01111'. I O.) nuilding.fir JACKSOXYILLH, .FLORIDA I ' The bwamp- Ire from half a mile to a mile friars, vvhiih( ( K coineiled into barracks' fir,, 'I' K Yfi broad, and from two to t five miles long ; the tN' the )garri on The housesnre built of !freestone depth of the water i is various, but is such . : commonly to ,tol'il'Idgh: t wo rooms OFFIU: : <11I:1-\1'! !: : 11.\1:0.\1\-: : :; IN that in travelling they are usually: rode 4 LOII.MANN'SFAMOl'S: : :\ I upon a lloor, with largo; windows. ami balconies 1.11. without much . through dilliculty.From .. before. the of : entry most 11ft the houses :St.\ John's: river southwards to :St.\ runs a portico of stone arches t the roofs ': - Augustine is VI'15 miles) the country i is much ; DDDDDDDDD) ) I iu11u: I: ; : \' Y Y\' l/O;< ;< ;< ;< ; ooo)( ( (ooo) ) ) I DDDD I I )) sssss: ::\:\:\:; the same as: has been' just described. but not toe commonly fiat. The :Spaniards\ consultedconveniency : lre|_ared I'loiir. ) ) ) ) ) t Iu1I1: : ; : ; \' \' YY (;(< ;illllCil< ;< ;< ;< ooooo ooooo) DDDDD) ) :ssssss::\:\: :\:\ more than taste! in their buildings DD) 11111:1/ : : iU: : YY YY quite) so good( the swamps being neither :so ; time( number of houses in the :Spaniards \ DD/ 1)1)hiih I I: : : \' \' Y lilt< ;< : (oooooo) OODD) I DD) :ssssss\:\:\:\: : , I frequent! nor so largo.( time in the DD) DDDDDDD 1:1: : IM: : YY <111; Will;< ;< : (oo) oo) oo) oo DD DD) ss::; town Before we speak of :St.: Augustine, it will and within the ONLY \FIVK: CKNTS' : : PKI: POUND ( ) ) ) IM: : 1:1: : YY (cccccc; : j(; ; I ooooo( ooooo) (DDDDD) )) sssssss:\ :\ - linesv. nliMvo 1,1111 ; many of t them. DDDD)) ) ) Kl: : lU! YY ; ;< ; ; be' proper to take some notice of the river :- t..loam's epedally in the suburbs' hring built of wood (Ii' tho principal river of this province pnl'iifM.i: Ifivos, are uutvgonmludecay. The. in point of utility and beauty and not inferior inhabitants of all colours, white, negroes, (;i-tf AT OLD 1'. O. lil'II! .UINII. to America.. The of this ++ +++ any source -- +HFJLOOK - mulattos, Indians, Ac. at the evacuation ofSt. ++, CARPETS i\IATTINGS\ :tHH *+ river, which i is not exactly ascertained, i is in ii. i':. OTTIICIK: : + : : +++: : .\u iMinc, amounted( to ;,7isl the garri all probability near the capes: of Florida ; it ! passes! through five lakes, the lowest of them a mile from the town, to tho west i is a line l, KUNANDINA: : FI.OIMDA) : 1 J is called 1 the Indians the lake it i is great! by ; . with a broad ditch and bastions' : running OIL (UL'I'IIH ..n'"rINI'V ISIIAIES.V a 1) miles long and 13 broad: lists eight feet M.M.IK'; : IN f.., 1'1'011Ir.:: Scbastian'sercek to :St.\ Mark's( river : water ; there are several i islands in it, and it a mile further another fortified line" with flue I'untila' <: r o e o rIcs, ! is now called lake Jcorge; ; it is: 170 miles some redoubts. forming a second ('UIII III 1111 i- V f from the mouth of the river. In going down .. : .. 'ationbetweenitstomeuta fort. upon St.' :Sebastian's \ \MI ;, I i.ATixr: Novimis 1 ) : ( ;:" IN '.1. .: - V : from hence the tint Kuropean habitation ii 1 : river, and foil Moiii the riverSt. )(1'. Sprtlding's' an Indian trader's store Mark's.Within upon PUO; VISIONS.( :\ I : _t!::l i: .. : 'j ji ;:, .' house15: ; miles lower is Mr. Ill settlement ( the first line, near the town o'astl 4-+ +4 14M.4+_- ++ ++ ++ ++ i+ ++ 4+ +4 ++ ++ 4+,. 4+ 4+ 14 _+*.. 44r--..-. +4,. ++ Mr. nolle'; the whole I is: 15 miles distance, and from the country the lake between to- small church settlement of their of. (I'pon!ernians:St.,Mark's who had river a, (Customers rely upon getting CIIOICK: 1 I 44i i::I: DRESS GOODS, SILKS, CASHMERES, I:H: the discovered! : yet upon the river. ,( -" " The fruits and found in within the same line, was also an Indian iOODS; :\, a* :;; +* ** ++ ++ ++ +* +* ** 4+ ++ ++ .H. ++ ++ +* +* 44. 44. 4>'"?t*' 4.off - tropical : plants: are "' town, with a church built of fn'l.-tolll', the 1++ :; I -f- great abundance, and afford the strongest! + ft ; steeple i is of good workmanship anil. taste, evidence that both, the soil ami climate are NOTHINU: r lilH': 1'111: Fl.NKST: ::; II :''p though built by the Indians : the lands he- CLOAKS ULSTERS SHAWLS and tit for sugar: l'ottOlllllleUgo, and other "-l. t- FLANNELS. longing to this town-Jiip, the governor( has India Mr. H01l1"-Iplalltation is productions. gin'lIl1i glebe-lands to the \parish church.Tlie are kept III slot k. FpI well situated I on the eastern banks, and is the . - -- -- -- lal1l111bolltugll..tinl', in all,,, appear1I101 \ most' considerable upon this: river which is I the \i'tirvt n _... ill tint. ruyi."...',.*. .f...i .\'ct fir <[L.. VIST. n. "nITI : | /. (OFIt) I UiM'ii l>c| iirliii<>nl i is ( 'O. "'I.I.'II': :: IN KVKUY: : : KKSPKcT.: :: : here very narrow ; -'J5 miles' from Mr.( Hollo's: from bring iinfiuitful ; it c.produces two- crops I <'. .t' .'<>., iUKAT( ; : !' CAIEI'lH': : :SAI.K\ : coinmc-nceil 1 on the ,1st of this {{{111tH.. Over 5OOililhrent downward, I U Piec-olata. a small fort with a of Indian corn a year ; the garden( vegetables Impoitcrs/ and Wholesale Dealers' in designs! > of llrus<'<>N anil "'0..1 <'arM'ls arc now o He red ntS garrison, the river is: here three miles broad. : are! in great( perfection ; the orange and The bar at low water i is nine feet deep its :, lemon trees grow' here, without (cultivation foreign anil nOIIlI''oIlI'! '1' HIC'I'LY' X O lt'I'Ii.EItN PII1C1 I :4. channel to lake ; i is much deeper George up ; too larger si/o" \,1'OllIl"obl'th'rfl'llit. \ than the breadth is very unequal from a quarterof in :-\I'llillor\ Portugal. i iOl'l'o"ito I'rnilsiils: ('tc.// NICK: lirssii.S! : : : : 1'.111'171trot: : { 75H.. upwards to $..IO. I i a mile to three miles. The tide rises at I wool, ('.\ 1:1'1':1'fa'OIl: : :; i5 rlI.' (to Mi.' 5. to the town 111'-1.:; A11g11stimme, lies Nos. ,Vi, .r>7 and .,!1 1.1I."ttrc'd." :: . the bar from five to eight feet and two feet the island Anastasia. ; this island is: about IIAI.F-WOOI) cAin-irrs: from :ioiw.. up. at )(1'. !bolts though; li": miles from theca 2" miles in length;: and divided 1 from the CHAKLIXroN.I: : :-11; 1'1'11 CAROLINA.Consignment : [ l.atc-st designs 4.ot' FANCY MATTINJS.' ( :\ llt.st Bradtn (White and I Checked.IVimlou !. There are neither shallows nor any rapidityin Shades madu. to order--mateiial in all colors. (In main lam: by a narrow channel, cullc.l3lutania ( :..?'- : of riuimivsolicited lIu\sIOl., ordering"; simplystate the river ; the ('lIrf'lItlIwill to the !fiat- river, though in reality, 111111I'11101' the and prompt returns Iliac h.. 1cl;; -mitt color and. dimension. (COUNICIvS: (( ; 'I.\ )II'I'O) ; OUDCH.; : : FINK' LACK; : CIMJTAINSot : :; ness of the country, i is very gentle, and \t- sea : the soil 1st/lit indilTercnt : at present it ----.----..-. -- -- 'I new designs.Itiil! . :.scKmay: go( tip the river almost: as easy as is used" for pasturage ; !but havingome: I K. iI.IITKIU11'1'! i down, for :SHI miles ; there i is perhaps no reeks and swamis: ill several part, mitt} in .\Ii'r: .\ large lot of HKOSCLs: :; (: MATS, COi'OA I.T1111.1/! ( 'IW; IU Cl.OTHS' |IO-|: .I river in the world more commodious fornavigation. time lie cultivated to :ulnlllll ,'. a'111LIrLLE \M> !:t.n II. I DI.IJINO:' ; FOI1:1'1:1': : : . w \ the ) : : AND :-\TI'J\ ( K DKALKIJ:I:, /o Hold and U"ul'd.JlJ-IIUlI"'I' HOCIMTN will ,find ilingly l .it north tnd of this i island i is a watchtower BL'T111:1 I our prices' cc - .-1. Mark's( river takes its rise near the or lotik-out built of white stone, AMIOealer I ; rt>as" mouth of :St. Johns river runs Irom north which also han.l 111ark for in Ice.TKNNKSSKK A, :;KS:; (while and colored). DoYI.II 4, NAPKINS: :\, CJtASIIKS: : : CJI\ ..; I.INKNS: :\, in serve aa vessel : ::;:\ : : IJKKF: : A : : to south parallel with the 101'a. till it empties SI'I'I.t1'I'1'I I large).: varieties. , at sea. At approach\ of any vessels, !sig.nals ) i srU' into the harbour of :Angio-tine) : Blum Hrmlr11; '1If', ('iir,,<>/.. 1,111'NIII'' Ties. Sitli( 1I..cllu'rt'h.I'I-latt..t; designs' at I are made from this tower to t the fort from the tlatnev of the country there are ; a JI-tf! FKKNANDIXA.: : ..\. I 1 very rcti.iuahle 1 figures.ITJlNfTFIti . few soldiers do duty there on that account.A ___ I many nil mar>hcon Jotht-itlt'2olorthl'l'in'r. quarry IIi' whitish stone I N oppose to : : CHINTZ( and 111:1'1'IX'Y: :; TASSKUS: : liIMP and. KIM.Niil.TO : '. almost to. its source these marshes. Stotes, mid Tiimare.OTICIITV I MATCH.JIJXTH1 I. up ; may Augustine, of which the fort and lumlI"(care 'l IH easily defended from the thics, timid will I l ( : J'A:-;<:UIEr: :.<\. "DO|'>iKINH, JUANS.: CASSIMKISS! : : TOU ItOYS') : WI.'Al: :. r built : t-toiiB quarries areery nine in the I i : : &v IIIOTIIIIC.Second : , make \'.-ry rich lands, cither for rice, indigo 1. CI.OAKINJS, MKAVKIJS.: : :: southern parts uf America, which muk.es i ithii "t"Otli..I. . or hemp. "'iti-l. IIPI"-i"'I"| ) LADIIX MI.-:''' '.oi' fXDJIUViaTS-all) : : ' of Ana.sta'ia the more valuable ; thestone aii Mxej.' nnd grad.from r..t IN. up (t.. ., ! W t n.,1c tu the li'trlniur of :St. Autfiistjiir ii nuiiifo-stly u eoncretion of Maall -- .1st. AI \oulot ,fKiD: FhANNi' :!, (FNDUUsiHIUTH: : : for (..wll.! ... .:ill" -r,,,\. t which wlIlI,11Il of the best in .1I1It" .hellsPctrihtsl ; itiIsoft-ttlrtlergrouudbat' ij i..- Our Gents' Furnishing Goods is in America Complete Every nespect.h &t were it not for its bar which will I Ijmseil becomevery hard and durable by lieingev ! nut udmir vok'ls of great burden, a* it ho" to the air. N imMis) \iblf for 'us" to mention every aril le vvi have for sine' ) |but every imaginable :,!; , inn eight it-rt water. The burls surrounded I I, article usually kept ill a FHIVI'-CLASS i; .. )DltY: ooDS; J J-X 1'\ 1t1.IS11311\1'(: | |: can l tM' bv br-aker, that have a formidable aplaruin Vi'LL OK AB-EXTF.:.."-Thd other day an ,I J found: in our Hou-- ." . .. xvhi-n you enter it, but $i.,not .danger) J'ugli"limun: w'ui over tit Ireland I to see a I, ,/.., SMM'Ial allciiliun. paiil to Orders nun <' >ri-.'''iioudeiu-e. "- it apK-ars'| on' account of the bar !J",- friend ot iii... who (i-in Irish landlord.) He Call ur add'"-> . ill_' 'rt. ,sl,<,rtsince the government ha* Kaidthu! he slalluM like to offset one lie the '! 1..IU.IIf.U..I.. 1111:1114"1': : &v ('(., iipniu.l| a goM ph! .t. no.vo-st-ls havebieno Must ardent oj>j ontiit.of laudlonl, and his IU..UJU, Corner of May and pineSiritt}: ,*. t : >i upon it. There I Ii it road; on the itm nortu*, friend referred him' to litvlllac Marks I v vtarl'IS - ',iI i .I"! tinbar, with #>(il smchorve. (>r tmith. who he ttaid. wu a gust( aoiijh fellow - ARLlNdTttN"' NURSERIES. 1 '". : i -' .:i1M:| a> draw too much water I" jj u but who ht .bei! fvej, mu-niplated It' r'> i. i!::arlidjir. I .IIIMlute:, him ,shortly.. To tlie for.;t? lie took ----. -- -- , \ i. ;k ..l the, main tU1I'tutbe u rth.undi tdttsetf and the hlack..mith explainetl the : I\TI.I: : :.. It.INI( .Ja: :". ' 1 I'HUI-H'\I. NI'U-'I'UO.-U\I, pomr! of \l1a..t;.l4 MdivJ to lliw m.utli. t.wruaj;" ...ll."lau,1.r(1 we not," lit ,aid, I I I 1'111'1"1'111:1:1: ItOSIlS. : nl'IU-,:lit, . ,form :l1.! ntraiuv of the t11. Opiii ite tu ".ijtferinj: tnn ttb.ent *.. taking from I TIN ccn -ul.a-r.HOX. 11',11115.Jlilt1.1'11 1'4)1'Suud 1\'IU"Ua: : : :% 111uIJItStuu11'1.//11'Iul1'1..11'1'1.: (: ,AXI i.T'tIT4T3IIJKIJ" : :. t , Ireland all the money that we cant 'Utolll iyjtu i ! I I' ; ti "< i-s.'ar11 olwt-rvis tdiU tlttfji'irtli i iI. --- r " U > that we JUt U to continue" topay ) ; \\.J l' : I> ] ru. 1r': ri " '' .-- mil'the harli>Hir' on UK ..i or<*,, of I '. \i':\\' ASH ('IIOWJ' : \'HI"t'fU; ; Uu l E 1fr m i-ritli, t-aiiimt I In-tftactly axvrtaiu; f :-tun'JI: ills "bund iivv n. .' { ih. i5iU tltrre ire thinly rt-gulatwl! l It y the! :plied the I':Jna Ii>h"1 I1). her ?th ?re are nwny u f-all. and cumjart our priivltft.. tlm*'* uf -- wmdi u tron>.; wr!trry! wind' will make j t tout I rt; idett landlordYwi are >stV'ii.. and an tsistrrly wind PJ fast; I i answered: the Llat-I."ith; "I tnt..tak"fI"1( AMIIHT: i, IIIU\\II.I.: . water up. ..11 tli.- bar of St. AujjU"-! at lowuutir ,''''Ullr.\.1.I1II1 I tit y.,u that it i U full of I IaL"h't'It fJ J Jol> PIMNTINt.: ;in ,\ t'r.t'l.|... nod I ut (lowest ratiui XVJLLKJ :. "'J.TILE ..\. t . . THE FLORIDA MIRROR : JANUARY 1.I . DREAM Awn 'fT:.'fORr' I I - I -rOI\'NHlonul mill nUHln'HH Cards : warring Mad[ . i\EKAf IHUECTQUV.United ue--1I,1L( ' ; I r. -- ItREVARD rot-NTY. Cullrcfof 0/ fcre+/+ I Like a radiant cloud of morn, I>AHTllim C. I'OItl>, Similes Officers Co only .J"tlt/IJ-A Whitlock, City Point ison. of T'l.Ia-I'. D. Wa'&!'Iwol'th, MadMINVTFE ( 1. Like dim Clerk-.\. A. Stewart, Titutville. .assessor music in Like ix rose without n a thorn fane:; DENTIST, LAND OFFICE, OAINESVILLE. AMcntor f of Taxes-J. I). Stewart: Titusville. i'Ol1.: COUNTY. Like a fountain without Rryiarr-L. A. Barnes, Gainesville. tWatorof lel'CIIlle-l-. M. Platt, Lake Jcs- atce.SheriffIVnt. . stain Like the moonlight's silver glem'n': Fourth St., bet Centre and Alachua, heccivcr-John F. Rollins, Gainesville\ sup, Orange County.biiprrinlemlcnt (' !''IfIC-1',. (" .u\lanatte Like an Image in ; Surrryor-G'e wrrd-L. D. Ball, Tallahassee. of Schools/ -Alexander Tin- Clerhohl) >rt H. ( ril1ith, Level I stream t a dall Lake C'. liaynlan, Fine Arc the dreams of love. 48 tf FERNANDINA, FLAVM. 1>I 'TRICT ('1>l'UT. View. TIIJl8Ill.! F. Parrish(. 'l'arAJI. - Juilje-Thomas Settle, Jacksonville. (.t.\V fOUNTY. $('.'. (j" of I Like sweet odors in the air; \ n. c. mmvii: ::, Marnhnr-J. H. Durkec, Jacksonville., County Judge, -\\'m. Peeler, Green Cove ri'h.' AYrcMarion( 0. Carlton, I Like the light in Beauty's eye; a T*Philip Walter, Jacksonville. Springs! t Cul1rrtor of I Like the sky at riENERAL t'crO.: A. Buddington Green Cove Pine I cvel.S.tperinklrknt. Seward evening ere COMMISSION( : : MERCHANT: INTERN: RKVE.NfE.: : S oj lwol.-t.IX J. [ , Its aerial colors die ; l'rlll !4. I r Like a solitary star, CENTRE ST., NEAR It. II. DEPOT, Collector-Dennis Engan: Jacksonville.lOLLECTOIW : S'criff-Jalll! "'. DcWitt, Green/ Cove Pine Level. :MARION: COUNT: Burning steadfastly afar, OF VHTOMS.: Springs. Are the dreams of love.it. FERNANDINA, KJ.A. flulV,1owell! Fernandina. .tR. emr of Tares-Win. Conway, Kingsley. Count y .hi Edward Hopkins( Jacksonville Collector of 1'I'ellllerill. S. Pluntmer, Cler '':''H. W. Long, Ooala. t flay Corn John ii'. House St. Maxville.SuiterntendcHt. S/'rriJj"-l''. I). Pooser, Ocala.Issrssor . Ont *. Augustine. Cotton Marco, r Like the mist upon a mountain ; J. M.( Currie, Cedar Key. of Scl'OIJls1. 1'. Geiger, of ,. somas Middleburg.( Like a shadow from a cloud ; A. W. COCKRELL, JNO. T. WALKER, COLUMIUV: COUNTY. I'lallt.Collector of AYreiiwe-Frcdcrick: 1 N. Foy, Like the darkness o'er a fountain WALTER R. YATES. State OfliccrN. 7. Like a maiden in her shroud! 5 ; EXECUTIVE DEPARTMENT.Governor : County Ju Like / 10CKRELL Clerk-John Vinzant, Jr., Lake City. + a meteor's lonely light), WALKER: it YATES: l i Falling through the depths of night -George P. Drew, Tallahassee.rrmilent Sheriff-J. W. Perry, Lake City Fort McCoy . i ( Arc love's memories. (COCKRELL WALKER I! pro tan. of fkimte-'\'. D. Barnes, Assetmr of Taren-L. "'. Rivers:Luke City. MONROE COUNTY.baorty JackMonvit1.ttor"3H .' West. < ,) Tallahassee.Secretary Baron Key Collector of TUJTCS-Thos. Getzen, Lake ( .Iudge-Chas..1./ \\ , ; Like a dream from which waken of f Mate-\\'. II. Rankin, Talla City. Or*'-John :Sitcher; Key West. Tremulous with dark emotion we \. and JoiiiiKcllorM hassee.CrnnltrollrrCulunpbus. Sujterintciitlrntnf School! *-Jllliu!'1',dliner!' .'crUT-Wct'r'l! :' Curry, 1 Key \\tt.rAtem . Like a heart forever shakenOn ; : Drew) Tallahassee.!I Like City. >r <>f Tiuw-Walfer! C. Maloney( Jr., r the waves sorrow's FEKNAND1NA, FLA. fr,"i'irer-Wan ter Gwynn, Tal1aluls! ocean Like whispered words with dying;breath; AIIlJrllry-aCfu."Tfll-jeorge> I' Ranev: Talla ('.1wlve-Willialll, A. Mcljvan, Jack OMrfc/y: RI'I't'tWCWalter C. Maloney, Like kisses from tho lips of death, OlHce adjoining Clerk of the Circuit Court.WALTER hassee., sonvillc.Clerk Jr., Kt.Wt! , Are love's memories.: ('uuuuisaiop+er of Jfll/ls-Hugh/ A. Corlcy, Thomas E.: Buckmaii: Jacksonville.Sheriff S"llrri"'ellfrlllifR"lflo7.-J." (>1 -Franfit Ji. lodge _____11.h YATKS_ __,__Notary_ ___ __Public._\ ___U( __4t Tallahassee.Super, !ntemlrtit. of I'tiliHc IlIlIfrllcfiQIJ'. .f..estor of Uriah Tujreg 1I0we-)Daniel len, Jacksonville.1' Smith Jacksonville X.\ !s\t' COUNTY.C9IuilyJrulycHinton : . Haisley, Tallaha!<! FOREIGN 1M4IIQIZdTIOX o. H. OAKIS10XTRACTOR : Adjutantlateral/ J. Dickison, Talla Collector of Ilercnue-Ilcnry A. L'Engle, dins ; hassee.Contmivnoner!' Jacksonville.Sujierlntentlcnt. -C. '\'. Maxwell( Fernandina.Sherifl'eter . VIEWED FROM A COMMON BEN8E STANDPOINT / AND BUILDER, of Iuouigratnz-1)r. Seth + of Schools Albert J. Russell Cone. Fernaiulina.Assessor . From the census of 1880, recently pub- French, Jacksonville. !' Jacksonville. nf Taxes"'111. H. Garland, lornandina. - lisped in the Yews, the population of Georgia MANUFACTURES: SUPREME ('Ol'ltT.eMI IIVMII.TON: ; C-OUNTY. ) i9a,542G18! an increase over that of 1870 ofi' Collector of Jieveitue Warren F. Scott, I'cr- :.358,509. This has tho appearance of u natu MOULDINGS, BRACKETS: SAWED: AND !,Juttlce-E.: :M.( Randall' Jacksonville!' County Jmli/e-Henry J. Stewart, Jasper.Clerk nandinn.Superintendent. . , TUIINED: BALUSTERS: NEWELS -luoc'llc Juftlce-J. '\ e.-Itc-ott: j jr., Tallahas -Robert: Stewart, Jasper. t r ral and healthy increase-an increase more of Schools: -W. A. Mahoney[ , by birth than f by immigration. STAIR HAILS, WOOD} EAVES- see Sheriff James! M. (Duncan, Jasper.AMewir Callalian. P TUOUOIIS, SHEATHING: Afnodnlc Justice-R. B. Van Val keuburg, of T/JrR-J. T. Co< Ancrum. f There is at this time a kind cf rivalry between Jacksonville. per OR\XC8ECOlNTY.C : . WEATHERBOARDING: Collector of Rf't'ellue-J.' I'. B. Goodbrcud the , states to see which of them cancrow 'LOOH- Clerk-ti. H. Foster, Tallahassee. Benton. Columbia County.Supertntenilcnt / ty Judge-II. L. Siuniuerlin, Orlando. the fastest. As I view it, there is but Clerk-J. P. Hughey, Orlando. ING. CIRCUIT JUIKE.K.First of Schools-Joshua II. Roberts little of good to the future union of the Sheriff Thomas W. Shine:; Fort Reid. United States, when a heterogeneous muss, Stair aiul Cln.rel1Vork Cticntt-Augustus Maxwell: ( Pen- Ancrum. Assessor of Tares-John C. Bryson, Haw, dissimilar in taste, habits, education, association sacolu. HEKNVNPO: COUNTY. kin vi11c. in sympathy or in sentiment, are A SPECIALTY. Second Circuit-David Walker, Tallahas County .Indye-1V. L. Frierson, Brooks. Collector of Rt'I'CltIlc-Xat. Poyntz, Orlando. . thrown together, not by natural causes, but see.Third! ville. Superintendent of Schools-John T. Reeks, by unnatural influences, so to speak, influences DOORS AND WINDOW FRAMES Cirmit-E.: J. Yaiin, :Maib'son. Clerk-J. C. Law Brooksville. Fort Reid. projected and built up upon the spiritof OF ALL SIZES. Fourth C'-rruit-It. B. Archibald 1, Jackson Sl.el'iff-J. B. Mickler, Brooksville.Astetmr TAYLOR COUNTY.GountitJuilye . :. speculation, nothing more or nothing Post Ofllcc Box 174. ville.Fifth of TII.rel1.: (1ar on, Brooks- ll. N.Cox less. In n word, by railroad rings, which, jan4 Fcrnaiulina, Fla. Circuit-James B. Dawkins, Gaines ville. Perry. Perry. having had to them millions ville. Collector Ret'elweTownl1enl1: SherijThoulasOsteen granted of of . JAMES 9Ic of acres public lands, desire to sell their Tampa. Brooksville. S'lwol.-Jo:. \ann, Perry. lands to a great advantage and profit, and so AND BUILDER, Seventh CircuitAn'her Cocke, Sanord. Superintendent of Schoola-Dr. S. Stringer, County/ Treasurer' of-I). H. Sutton, Perry, make milhoiis\ of dollars simply through tho CONTRAC'fOIt Brooksville. N. Cox Perry. County llrl't'yor-D. , Court Calendar. * of lands gift public to large moneyed tions. corpora- Alachua Street, between Second and Third, THIRD CIIICUIT.SprilU HILL8I10KOUUH COUNTY. Collector of Rt.t'cl/lw-John C. Calhoun, In 1850 the laws of Wisconsin Term County JulJe-lI. L. Crane, Tampa Perry. were pub / - FERNANDINA, FLA. Clerk-Wm. C. Brown Assessor. of Tarts Win. II. Parker, Perry. Tampa. lished in five differcnl.lanfluagC8, so that: her Taylor, 2<1 :Monday in April. citizens could read the laws of the state. Orders and estimates from a distance carefully Madison( 'M Monday in April.} 'iljeriff-D. Isaac Craft, Tamers. HT. JOHN'S: COUNTY. "1 That I would call heterogeneous mass of attended to. 25-tf Hamilton, 4th :Monday; in April A.Issessor of Tares-L. 0. Ix\she, Tampa.' Gnmty Judge-M.( It. Cooper, st. Augus 'people in fact and in truth. What bond of -- -- Suwannee, 1st Monday after 4th Monday Collector of Hrl'CIl/U-\. F. Buns, Tampa' tine. union can there be between such ft congregation Fertilizer in A|>ril.Columbia. Superintendent of Schools-H. L. Crane, Clt'rIartllll Oliveros, St. Augustine. of mixed peoples? What sentiment 2d :Monday after 4th :Monday Tampa.' Sher/-A.. N. PaeettI, St. Augustine to unite them together? What spirit of patriotism J. N. IIOIINON A SON, in April. JEFFERSON.: Assessor of Tares-}David L. Dunham St.Augustine. . to make them strong olIensl vcly or Lafayette, 3d Monday after 4th :Monday in Count>t uduf'-\. C. Whitner, Monticello: ,. . defensively? What nationality to _?_ April. Shcrifr=Vf. 7.. Bailey, :Monticello.( Collector of Ilercnue-Joseph F. Llambios, ,, the same forefathers and the same history ? I Commission ;.t"i; I Fall Term- Cltrl.-'V. B. Lunar, Monticello. St. Angustine.Suptrintendent. None whatsoever. I. Taylor, Monday: in October. Superintendent of Schools-J. B. Christie,, / of Schools-Thomas A. Pa- I hold as tho great and underlying principles Madison[ :3d Monday in October. Monticello. cetti, St. Augustine.SUMTER. CHARLESTON: S. 0. County' 'efl8urcr-"-. A. '\'. Simmons,, of political economy, tho fundamental Hamilton, 4th.Monday in October. : : ('Ol' T'ullIIfy.w1ueHl'nry \. und Suwannee, 1st Monday after 4th Monday 'Monticello.t primary principle that to the homogeneity .of a people ,is absolutely duo tho themselves strictly' to their III October. Collector of Revenue-Joseph Palmer, Mon ( Cassidy, Lecsburg. CONFINING Clerk-Thomas J. Ivey, Lecsburg.Sheriff . s, respectfully solicit consignmcn Columbia 2d after 4th in ticello.Atsctsor. > strength of that people. With birth, thero Monday Monday J. S. Dyches, Lcesburg.Asuefsor . Taxes Monti-! ts. O'tober.I.nfll'ettc. of -3.1 Grantham, is a sentiment born in tho human heart. 11'esee of Tares-Joseph Hutchinson it in the love of the Englishman for Eng- 3d Monday after 4th Monday in cello. .* Leesburg.Collector. , ----- --------- land ; the Irish for Ireland ; tho Scotch for October. LAFAYETTE COUNTY. of Ileveitue-John '\'. Dyches Scotland, and the German for his vatcr- [ FE1tTILI7.EltS. | FOURTH CIRCUIT. Cunntti Judi/e-"'. J. Dixon, New 'fro)'. I. 'e.; hurg. , land.." Can you mix different nationalities -- Sprint/ Term- Sheriff J, J. Johnson, New Trov.Clerk Superintendent/ of Schools-II. II. Duncan% of people and make them forget their language HtJOIlll'S, 3d Tuesday in March -Howell)Hawkins, New Troy.Sjrintendcnt Like Cirillin. , i habits and modes of thought? You This business has been our special trade Clay, 4th Tuesday!' in March of Sdloo/s-J. C. Ramsey,New might as well attempt to give them one cast endeavored Bradford 1st Tuesday in April. Troy SUWANXEE: : COUNTY.: of features. God has written the characterof ) : Baker, 2d Tuesday in April. County Trra.mrcr-J. J. Painter, S'ewTror. County Judg--Michael( A. Clouts, Live .. different nations in their features, and it ARTICLE, and their continued patronago is Nassau, 3d Tuesday in April. Collector of Ilercnue-Newton Sapp New Oak. can only bo wiped out in the third and our best indo ellll'nt. We arc prepared to Duval, Tuesday in May Troy. Clt'rknol'l'rt.H'iel, Live Oak. + i fourth generation of their children born fill orders for nil kinds of Fertilizers, together Fall TI'rm- Aiwtior' of TaresY. '\'. Cottrell, New ."'ll'f'ff-John R. Session. Live Oak. J r upon the soil, and who have partaken of the with our Cotton and Corn Fertilizer and St. John's &1 Tuesday in September. Troy Asset** of! Tares\\'. II. Sessions, ,,'cl- [ features of the people among whom they Compound Acid Phosphate. Clay, 4th Tuesday in September.: LEON COUNTY.Countii : born. I' were born. J. N, ROUSON: & SON, Bra'dford 1st Tuesday in October. Judi/e-H. C. \.", el'. Collector of lievenue-Robert F. Allison But to the point I wish to discuss immediately. CO Charleston, H. C. Baker, 2d Tuesday in October. "rriJj"Iol>ell')', Tallahassee\ Live Oak. 1 J I hold that Georgia, grand and Nassau, .M Tuesday: in October. (/uk-e.. Bryan, Tallahassee.! S>n>eriiitendent of School*'-J. O. C. Jones great old Georgia, h growing fast enough <;OITMFKIITIME) .C O.'H Duval, :3d Tuesday in November.FIFTH Superintendent of Schools-Henry N. Felkel, Live Oak. r without inviting in extraneous aids or riRCUlT. Tallahassee. ,"or.rr'J."H":>iT\. 1 t helps Increase population.any Our growth ................................................................... Spring Term- Tn'asllra-.T., L. Demilly, Tallahassee.: i County,! Judye-VniI.\ LaPenotiere, En- . is natural and homogeneous, and in that Sumter, 2d Monday in March. Collector of Rt'I'clllle-t' C. Pearce, TallaIiassee. terprisc.Clerk: . consists our great strength, and was our i: ; n'"t') .. Marion, :3d Monday in March. -John "'. Diekins, Enterprise. t strength'during the war. I have no objection ................................................................... Alachnla,1st Monday after 4th Monday in Assessor of Tares-R. A. Shine, Tallahassee. Sheriff \\'. _\. Cone, Enterprise.} to foreign immigration, but, I sity, as March.Levy. Assessor (if Taxeti-Benjamin Richardson: , n I I something of 'n political economist, let it 3d :Monday: after 4th Monday( in LEVY ('ol':>iTY. Enterprise.; t come of its own free will and accord. Sa- IS THE BUST :March.: County, Jiuli/e-"'. H. Sebring, Bronson; Collector /el't'llIIt'-John IJ. Jordan, De- r vannah is a good illustration of the foreign. Putnam, It-t Tuesday! after hot Monday in l.'lak-J. )\i. Barco, Bronson.Sheriff Land.Superintendent. clement among us. It came of itself, and rpniNG for FALL GAItDENS-lt): being :March.: -\\'. I). 1-'i nlI :: k s brought with it its own energy, industry and _|_ not only a perfect )plant food, but will /'<,// Term- esorof Tares-J. M. Willis, Brons4>n. dler, Enterprise. j capital. The result has been prosperity to keep all insects ut a respectful distance.! Sumter, 4th :Monday in October. Collector of ICI't'llIle-Jollll (c. Mi-Grew, W.Kl'LL.l''r T\. very many who saw an opening for business For sale in anIluantitr, large or small, Marion( Ut Monday after 4th Monday in Bronson.Sujteriiitendent. . among us since the war, and by trade. truffle and country orders delivered FREE on October. of Schools-Jos. F. Shards, .S"1"JtTV, : T IuvalC'raw funlville. and speculation have rich and are boats or cars. Vegetable growers, TRY IT. Alachua, 3d Monday after 4th Monday:: in Bronson. "#-> n-Y.alber' ('r ) grown ft'rk--'Snt. richer GOULD .fc; CO.. October. MAPIuN Col'NTY.CuiottyJudget. : ., : I Malker, ('rawfureh ille.: day. getting every l Gl 3m St., Jacksonville, Fla. 1st Monday after 4th Monday in Superintendent of Schools-John L. Craw- " native and home- 81V.Bay Levy They are iificalof M. Withc poon, Madison. ford, Crawfordville.\ - "---- -- November. 1 born element domestic . . how to make money and how to economy save it.; ,ILCOX, can us A co., Putnam, 2d Tuesday after 1st Monday inDecember. "It'Tiff-T. H. Willard Madison \'. County Treasurer-\\. T. Dtival, Crawford- What we want in Georgia arc men who are Imi>orters and Dealers in Clerk-John M Beggs, Madison! C"l 'rfur of Remwe-W. H. WalkerCratv-. ,not farmers, but men whose habits of SEVENTH CIRCUIT.Slwinq Si'i>erintendcnt of Schools-K.: S. Tyner, furrlville..fssossor. l t thought lead them to manufactories, mining -- -- Ttrm- Madison.County. . etc. The foreigner cannot teach the native 1'olusialst( Monday in May. Trt'lIIlIrt'r-H. S. Smith Madison.OC fonlnll ,. of TlJe8-Gco. V- Register, Craw- 1 , 1 r < t Georgian how to make corn, cotton, rice or |r CilTANOS J. { GUiNOS Brevurd, .M :Monday in May.Orange. ( --. ---- -- .. _- P, tobacca. We know how to raise the products 3d Monday in May. .- of the soil,though we may du it in somo- Dado, I'd Monday in June. t:::) what of a slipshod, slovenly sort of way, Fall Term- - No. 14vS IIiY STREET, in November. Volusia, 1st Monday CO gathering from two and three acres what we C " should from We are improving fast llrevurd,2t111ouday: in November. rr \ one. get Siivaiiiiali.Keep Georgia, wt 3d in November. Orange, Monday in that respect, however; and are farming 2I'll with more system and knowledge. constantly on hand a good supply of Dade, 2d Monday in December.County . t I I am opposed to going over to Europe and their celebrated -OtllcerH.ALACllCA ' collaring the foreigner, and begging him to ' T p- come to Georgia. Such a class.would, and ;.T MANIPULATEDNothing GlTANO.'fi. COUNTY. L.I.I -< justly too, feel that we owed them a living ul'ttercan be had for fall and win County Jud! -JunlVLs C. Gardner, Gainesville x h rC whether they tried to make one or not. Our ter crops. Price FIVE DOLLARS PER = I \J Jg C 7HE ONLY \ i state should publish a book of our resources: HAG or FIFTY DOLLARS PER TON, 'It'rl.-J. A. Carlisle, Gainesville. : )> G PAD ' give facts, scatter the facts through Europeif F.O.B. railroad or steamer Savannah.. Sheriff John W. Turner, Gainesville.AueMor ; : CFO LUNG YOU please, and then await immigration Send for circular giving certificates, etc. of Ttue.-J. M. Dell, Gainesville.Elector .:5 CQUitE 40E 'y1R _(,P f if it feels disposed to come. I would not of Revenue Q. P. Thomas, Gaines walk across my room to beg a foreigner or PATENTS obtained for new inventions, ville.Suiterinttndent. YOtril BACK-ACHE CURES BY ABSORPTION (NATURE'S WAY any other loan to come to Georgia, if our ,[ ? or for improvements in old of School*-O. A. Myers, diseases of the Kidneys, Bladder > grand and glorious old state cannot present ones. Caveats Infringements, TradeMarksand Gainesville and Urinary Organs, by wearing theIMPROVED LUNG IISEASES attractions: enough without our turning beggars all patent business promptly attendedto. BAKER COUNTY.County I1.LLTL TII1IOAT , to get a population to aid the state in INVENTIONS THAT HAVE BEEN Judge Jno. R. J'rntlonSanlle1'\lon. EXCELSIOR 153; DISEASES, such undertakings.Why REJECTED may still, in most cases, be i at- Clerk-F. J. Van, Sanderson.. Breathing Trouble. should we desire to drive our child anted by us. Being opposite] the IT. S. Patent Sheriff J. C. Williams, Sanderson.Author p- KIDNEY PAD.It It ren and grandchildren from the land and Office, and engaged PATENT BUSINESS of Tct.rt'G.. Rogerson, San DRIVIS INTO the system curative graves of their fathers by selling and wing EXCLUSIVELY; we can .secure l\Ut- derson. is a MARVEL of HEALING and RELIEF agents It and healing medicines. away our lands to foreigners, that is, emits in less time than those who are remote Collector of Revenue Richard Kennedy, : SIMPLE. SENSIBLE, DIRECT, poisons DEAR'S that FROM the diseased parts the j ducing an unhealthy and unnatural immigration from Washington. Darbyville.Sujxrinteiultnt. PAINLESS: and POWERFUL.; It CURES cause death ,just as the West has done? Why 'When Inventors send model or sketch, of School*-\\.. Hampton, where all else fails. A REVELATION and Thousands testify w lt's virtues, i this insane desire to grow so fast? As well we make search in the l'atent Office and Olustee. REVOLUTION in Medicine. Absorptionor YOU CAN BE might we desire our wives to present us with advise as to its patentability free of charge BBIPFOBP COUNTY. direct medication as opposed to unsatisfactory RELIEVED AND CURED. triplets and quartets, because we may Correspondence confidential ; fees reasonable internal medicines. Send for Don't until have twins, J. R. Richard, IVovidenee.Clerk our aible easily you tried this set. PATENT Cuuuty Judge-- , desire a large family (In a hurry. Make haste ; and NO CHARGE UNLESS York Lake Butler. treatise on Kidney troubles sent free. Sold applied anti RADICALLY EP. ( is idea, not only at : IS OBTAINED. -Henrv F. by FEC'TU AL slowly and naturally my Starke. drnjnnsts, or sent by mail on receipt ofprice Remedy. in families, but amongbtates,nation We refer bv pvrmisaldti to the City Postmaster t. Sheri/\\. W. Tumblin. TWO DOLLARS. Address SoI l by Druggbts, or sent to Increase people. Give me a homogeneous and lo the Superintendent of the Ae**>r of Tajeet-A. J. McKinney, Lake of price, Tll'0 by mail on receipt - and TUE "ONLY" LUNG PAD Co. DOLLAha Division in Wash Butler. by have strength. Upon Post-Office Money Order Tuz >eOple. and then we t\Jtfctor Revenue-Alfred D.Cone, Lake Williams Block, "ONLY" LUNG Yap Co. l lean In the bright days of prosriftr ington. For special references, circular, advice of ; such 1 can Detroit Williams Block Butler Mich. , confidence in the tents, etc., address , > and cling to with adversities.-/! V. C. A. SOW S CO. SuutrinteudtHt of School*-C, ?. Harrison, jfjr-This is the original and genuine Kid.ney.l'ad -ii/'Senl tituonialand for : trial8 and > te tourlbook '( (%k in Joun Savannah of J/on.i"f1.\'clI*. 2-tf Opp.Patent Office, Washington, D.C. t tar 'e. Ask for it and take no other. Gi "Three Millions a Year," Sent free. GI. , L5: ..... ---- - __+___ I I. I N I'' THE FLORIDA MIRROR I : JANUARY 1 1. &.., -" -- ------- -_.- -- --- .- .. _--- .... --- -. .. ... .. -.. ._. - ll1ttt; ':: Real Esfiifr.TOR oil A\n r 1 'r.cxs., food very rapidly, and the food i is scarcely J.880. 1881. Florida chewed tlait time more than sufllcicnt * 'tllf" <.. J.J i.., in au able critique a new - 1 r',; to ,gather, it into a wad swallowing\ whenit SAM': l work entitled i is immediately received Into tho paunch "'.11", .: "On\xcsn: ho( *I1'! : A Treatise on the Injurious afterwards to be cast up by mouthfuls into ;1j t: ...; ami. Beneficial Insects: Found on the the mouth and rccbewed, when it is for the ,.fj.' .....' ++----- ",-++ .. orange Trees of Florid. By William\ second time swallowed. and passes! at once ;,':;,:"l ++ ++ THE Ashmottd, Jacksonville, Fla., l$)," into the third stomach or manifold, whereit {I' "" ,I;,.t., A 1)ESilt.tHLE HOTEL, 1 \ which wo have not had the pleasure of yet is thoroughly nibbed\ down to a line pulp' -. by the grinding action of the leaves with :, ,\.."t.,. ++-- ---++ seeing, makes the following criticism : their hard tuberculous! edges, which extendacross ..:q.' +4 ++ The author states that the orange I is not tho cavity of that organ and effectually '' indigenous to Florida, and intimates the strain out all coarse, dry particles from : ::- ,. : :[ Situated directly on the Railroad, wild orange of this: State is:' identical with access to the stomach until they have been .;:r the "Seville\ orange." \\'( have reason to thoroughly rubbed down and I macerated It < believe that the wild orange of this :State; is must now be admitted that the precise circumstances s IX ONE OF THE indigenous: and t that it differs materially\ in which determine the direction i.. FLORIDA MIRROR foliage and fruit, from the "Seville orange." which t lie particular r kinds of food shall take HKALTIIIEST PARTS OF FLORIDA. through this remarkable not Upon this question, after a very considerable apparatus, arc clearly understood. The main facts are, examination, we entirely concur with however, sufficiently well established. We For particulars address )[r. A!>Ashmcad holding that the orange is will describe! us briefly and simply as possible FLOUIDA MIRROR, not indigenous to Florida, and would be the manner in which the successive portions , 53-tf Fcrnandiiia, Flu. glad of any proofs or arguments to the con of tho food from the paunch arc thrown back into the mouth to be rechcwed I trary. "'c are aware that the idea that the It must be understood that chewing the THE FLORIDA orange is indigenous to Florida a very cud is, in large degree, ft \'oluntnryro6 f general one, but we think it is an inconsiderate cess, and can be su'p'Jllletlnl1d resumeatthe LAND AND IMMIGRATION (,0 fP6\'Y I =SjT-EA..lV.[ := inference drawn from the existence! of )pleasure\ of the animal. >\ hen the paunch is full, the animal ceases ',, so-called wild groves in the hammocks und to graze, and seeking comfortable place OFFERS nnll'tt1C'tlllortioll!! of the country. and position, usually lying down, it proceedsto chew its cud-that is to belch by Upon the subject of the rust on the orange up Acres' mouthful, the food it swallowed .hurriedly the reviewer says ; grazing, and redrew it thoroughly, I I Of the most The author's researches regarding the rust to be swallowed a second time, when it flows IP on the orange will prove of groat importance over the surface of the unchewcd mass in P ACCESSIBLE AND DESIRABLELANDS l l'i to the orange growers of Florida.: I Heretofore the paunch and honey-comb cavities and j -1----1- the rust has been referred to the solar rays, goes the only place else it can go-that is to IN THE water at the roots? and deficiency of lime in nay, into time third stomach, whence it can the soil. Our ni'croseopio examination of not return, and must needs pass.on into the e STATE: OF FLORIDA, 5iJOB the insect justifies us in sustaining the viewsof stomach or dam and pack in between the j I )[Ashmoad regarding the cause of the leaven of the manifold, which it not infrequently At only $1.25 per acre to new settlers, with rust on the orange Tho f.unily; to which does in strange and extraordinary the privilege of selection in Parcels of -10nC'res the insect belongs) according to Professor manner. It used: to bo generally suppose!, These lands loaiti-d H 'nl Comstock, is a largo one, and they prey and it is :still thought by many physiologists. , are on F or more. H $ upon the epidermis of the leaves ; at 1'lIg1'II (that the honey-comb, which is smallish, and adjacent to the line of the we I find the following : On all oranges that spheroidal cavity, and has its opening opposite O w have begun to rust, wo found the insect in the foldof the oesophagus, above described ATLANTIC, GULF AND WEST INDIA I ., ryi great numbers, nor could we find them anywhere wits mainly instrumental, \ TRANSIT CO.'S:::! R.'u', o else, e\"I'I1I1I'l'r 1'llfl'flll1'XI1111Inntion'." vided indeed, for tho purpose of baling H This statement does not correspond with up tho food 1 as it came out of tho extending from FERNANDINA on the Atlantic J our experience At an ('IIr1yltnge/ of his In- paunch into mouthful, to bo cast It , \' '5(igutious. Mr. 6\!>mead directed my attention Lack into the esophagus} through the to CEDAR KEY, on the (iulf coast: H I 3 to the insect, and I instituted. an examination opening} between the everted edges of thus affording to the producer cheap, constant of time leaves of large orange t trees the slit portion of the tube; but this does and rapid transportation! to the best ,: H without fruit, IIIICIl'II\\IIll'IIIIS many as thirteen not seem to bo well established ; indeed', the insects! : on a portion of one leaf\\ithin process of rumination goes on, though these\ markets. .._ t- the lil'lerof an inch ohjcctiu I also: examined edges bo securely sewed up with silver wire. - The belt of country traversed! hy the Tran- the leaves of two years: old seedlings, and If an animal bo observed when chewing: till! sit R. R. embraces found the insects in great numbers. The cud, it will bo seen that by tho action of the J author refers to those insects puncturing the Abdominal muscles and tho diaphragm, aid; I EVERY VARIETY OF SOILto oil cells with their beaks .\'! these insects: 1'111\1110 by the Intercostal muscles, that portion prey upon the epidermis of the leaves, it I is of the food which lies next to till opening be found in the State, a large proportion I g ( that they also' prey upon of till! esophagus. i is thrust! with no inconsiderable being ll'cuiarlyalltptl'd! to the culture of the epidermis: of the fruit, and thereby) expose force against the )lower end of the air cells to atmospheric! : influence, that tube, when that. portion of it engaged SEM I-TROPIetr Fm'IT'IllIlIl:' Early Vegetables, -"l= with consequent. evaporation of tho oil as in the lower part of it by this decided upward - and The Isiryc, Cuinjmct Bodies (f Timber! tC>C>i AND== well us watery portions of the rind ; resulting thrust, is quickly carried up to the make these m lands: worthy of CAREFUL EXAMIXATIOX in drying, contraction and hardening of mouth by a reverse action of the muscular manufacturers of LCMDKR the !skin of the fruit. It '!! possible! that this! walls of the irsophagus.' Then the animal by insect preys upon the epidermis of till!loaves: begins chewing oy u single stroke of the AND NAVAL STORES. of !some: of our forest trees, and hits left its !lower jaw from left to right, und nil those! natural habitat for tho orange ; a' III the('asp: which follow are made in opposite{ direction, NEW SETTLERS of the white scale (reronphidte. ,',m';.) Tho or from right to left, and when tho rechew- natural habitat of tho white Sl'll'I'l'lI\.", to ing is complete tho t llnll is swallowed ugiiin, Purchasing land from this: company are furnished lie tilt gall berry. In my garden I first discovered : and in a few seconds: another bolus: is: : with entire free jui nfje on the Transit I it oil the myrtle (Myrtu commune), thrown up into the mouth, and so the pro- Railroad for family and personal etlVcts: PRINTING HOUSE from which it has iilfl''II'IIIII\! orange! trees.It !. 'oIlUnu'tllllltil: l tho animal satisfied, I seems: partial to tilt wlllovll'a11'arie- but the paunch and honey-comb are never I H to the station nearest the land purchased. ties of the tangierino.TllK entirely emptied, even though; the animal TITLE COMPLETE, being derived by dies of starvation, Now wo may understand grant from the United States and purchase COWS CU!). that inflammation of the howds,which of Florida.CORRESPONDENCE. renders the jerking action of the abdominal the State from A gentleman lately stopped us on tllcttlrl'l't muscles very painful, will putLi stop to rumination - with "I want to you answer mo one while of those muscles What is cow's cud, ?" paralyals SOLICITED. question : 11 will render It impossible. So, ul.solntlummu-, CcrtallllVII "A 'OW'lIl'11I1 !! our reply. ion within tho of the chest on the Descriptive MATS and CIRCULARS mailed on I is simply the food that the cow I swallowed other side of the cavity diaphragm will cause: those I ; in haste at the time of her feeding, brought , Beech Street Opposite Egmont Hotel which to bo application. back tube rechcwed or remasticated at IcisI thumps, are so painful' sus ." pended. Now then, why I in. tho numo of CIIAS. W. LEWIS ''' duos anybody in sura state t wontipr nopo' a " I knew it."sail he, "and now I'll tell of affairs! to do good! by poking salt Ijiiul Commissioner.Olllce asked any a t' : I tho This - why llll'tion! morning you herring down the animal's throat, or cor. Beach and Seventh Sts. I saw threw great strapping fellows hold by other such like proceeding poor When solid down calf and forcing something into 10-tf lug a : substances swallowed either its mouth which they called new cud.I On are they pass into the paunch or rcctlculum, and nfl! TIII FLORIDA asking! an explanation they went on testate thrown buck and forth from one into the that the calf was: sick III consenuencc of having other by movements, of the bowels and ahilotnlatall111ivclea.l''Inids / lost its cud which placed them under OWN' IMPROVEMENT COMPANY till! necessity supplying with a new IIIII!. co into the paunch \ T the FERNANDINA FLORIDA.Having und reoticuliim, or I into inanypheH. 1If111thl'lu'u I did not ask for information, but merely immediately to the stomach It in that I might bear what had to about you say not known whether or to what extent the It. Fcrimmliiia, will of the animal influences the direction could be ridiculous than Nothing more : ' taken by food und drink when HWiillowod ,. It. Line this Idea of a cow's having lost her cud," Towns It. on If the paunch and rccticulum be well filled and it to cxtl'flt.I'osihly . yet prevails! an amazing and their up strongly t'lJlltrnctctlupon; contents - tho fault does not all heat thclloul1l And Cedar Key. ! and fluid bo swallowed rapidly and the ridiculous. of the entertaining parties forcibly, it must needs glide At once into tin !notion and stimulated by such a thought, stomach through the manifold because it - wo IJhalll'l'Oct'l't} to oiler a paper on the subject \ cannot eJltewltercJllle1l.lJ it could go pause of the digestive apparatus ruminants; long enough to soak into the contents of the Offers to Lessees and Purchasers a large that is, animals that chew the cud. this be and rectlculum. Let paunch rl'lUl'U'bl'retlln number of the most eligible and desirable To begin we may state that in the cud drenching sick cattle, and let the chewers three cavities the stomach precede , drench be somewhat in Lots, suitable for Business Purposes, or for in which digestion is accomplished. The copious( quantity, and poured down as rapidly as possible, for first of these: is called tho paunch, or rumen, City or Suburban Residences, added. NEW TYI'E AND NEW PRESSES to our office, antI having size in if a small quantity bo allowed to trickle which is of great capable, a largo ox, slowly down the gullet and soak into the of several hundred of food. holding pounds SKILLED WORKMEN who know how to use tho same, we are now It possesses! a coarse structure, und but little contents of the paunch the medicine might UPON EASY TERMS. as! well, in some cases, bo j oiircd down a rat ibilit Between the of the lIen ) point hip) hole and remain out of the beu.it. prepared to do any and every kind of printing: J and the last rib, when distended, It lies in Nowwhen this strange: mechanism is fullycomprehended contact with the soft structures of the abdominal Liberal Values allowed to I, no man will think it strange Discounts on walls, and is covered only by the that ruminants, especially young ones, and thin muscular substance. It parties engaged in manufacturing or indus- also skin reaches some far forward when confined to dry 'hay, straw or fodder, osthediaphgram, without free to water will the trial who will erect the and the movements of that access get dry enterprises, on property greatly impedes food packed bard in the paunch, and es when much distended. Across the purchased substantial improvementsfor organ pecially the manifolds, where is Is often 6 somewhat into the large opening paunch found, as dry as |iowder in a horn. Nor will residence, or in which to conduct their extends oesophagus or swallowing tube, he marvel greatly if the beast then die. So, business. FROM A 500-PAGE BOOK TO A VISITING CARD, lag extending into the from second the mouth and third to near cavities the open-, but in their winter fUtlls feeding cut and calves steamed and, and yearlings they hare INDUCEMENTS TO MANUFACTURERS where it crosses the opening into the paunch plenty of water few will be lost. Many older It is not a perfect tube, but resembles perfectly - cattle lost from I when taken are Impaction by exemption for a term of years from a tube the end of which has been off of short and made too full of gross dry taxation offered by the several cities and slit up for several inches, the free edges of fodder neglecting to water them ; sup also ! which be either closed forced may or apart. in midsummer drought when towns. Apply to4'Ofce Between the opening into the paunch and grass parchesami : '\ water dries ul'-JIClbil Register the true or fourthetomach extends a sort of core Beach &: 7th sts., Fernandina. . cavity, on opposite sides of which, and open- 16-t( .. .. Ing into which, are two open cavities the ALL HAIL TO FLORIDA Oa.tros.-One of AH. Neatly und as Cheap an any Ofllce In Florida.,- second or honey-comb stomach, which is,in the sweetest issues of the rebellion, says UK , Undertaking.It. effect, a little paunch, and the manifold ornanyplies. Newark (N. J.) Adverttter, was the giving of 'J .. Beyond this manyplies lies the .. .r ', ' : )I. HENDERSON, ,,- fourth or true stomach long somewhat that long sandy peninsula to freedomand to conical-shat bag with the larger end toward the orange grove. From the headwaters of ,.. -. .e.. ,,'. the left side of the body This fourth the St.Johns, down to the romantic banks 1' + stomach, or reed, as it is (culled is the only of tho klawuha, circling the silver lake -., .-. ... > ; .. stomach, and the other cavities may be retarded skimmed by the 'heron and peopled by (the ! us dilitationsof theojHophagun, merely alligator, crowning the hills and stretching I R intended to receive the food. In fact, out over the plains do we find this golden t no digestive fluid U furnished, and no diestiou fruit nestling amidst Its herbage of velvety I ; takes place until the food reaches green. Ami if.: as no one denies the orange I the true stomach. In the btoinach there Is! U the king of fruits>>, neither can it be denied nothing peculiar or distinctive about the that the Florida is the king of oranges. It proass of digestion. Keeping in mind this sheds lustre upon tbe finest table, the eyes UNDERTAKER.FIFTH JUT Don't send your orders for PRINTING, BINDING and RULING to oflW outside outline sketch of tho apparatus, we may proceed of children sparkle as they see it, its juice U ST., FERNANDINA, FLA. .t to study the peculiar and remarkable nectar, they cool the blood quench fever in I the State Orders for either will receive prompt attention frum us. Addres: habit of ruminating or chewing the cud. the veins and add piquancy to the feast. The end chewers have no front teeth in the Florida should be the pet of the Union for ROBES. METALLIC CASES, upper law, but in place of them a bard, in- the glow of the color and the warmth of Its 1 BURIAL COFFINS AID CASKETS. ,I' FLOIU1JA.. MHlllOIt, sensible gristly pail against which the teeth landscape conies to us when the storm rage Telegraphic orders promptly attended to. > S of the lower jaw fit closely. With the help 'I and the cutting blasts of winter chill us to 37-3Ul. OCtO FCKSAMDISA 'u. of the tongue in gathering herbage, they the marrow. .. f -.- tfHE FLORIDA MIRROR : .JANUARY 1 I. - PC JLocAL REFLECTIONS. CLK\UKI' Thursday, by Mr. W. Lawtcy, Hut of Letter roic SAM:. TO1'I..1N'r1Its : .- .: ...-.. -- -. the Russian bark Vd-o, Captain Harlin, for Remaining I In the Pool-Office: at Fernandina, tutd UCltl'1I.1NTS.: M A YKARj $1.00 POll SIX'MOXTlt'ij.CorrcpoH(1cncc. QueriLstown for orders, with the following Xa"!>aucounty, Fla., )December.10IStO.. Persons A DESIRABLE: IIOI'SE: : CONTAINMNUJ. I I : _- _.-- cargo ; 279,000 feet pitch pine lumber and \ calling for they Ic.tter'llllwt \. live room, with (Closet! front Piazza, - :say advertised )barge Yard, ( Lemon and B.inan.v n'l'1\'EI.) Orange : 223: barrels of rosin. Value of cargo, $-tl, 80. : 1LWF.: jr The MIRROR denim to reflect\ the interests -. ._--- I TI'l'l'! Centrally located Oood title, etc.For !' "n' Blake Josev ( further particular, inquire at thHoffice. : 'mibonn'I'hnnta4 ! nf the whole State mul\ will publish with \Ve congratulate the people of Ocala (':M>i'iK'y Charles )DeMott, Isabella ) 4tfrniiix AND On'En1'11tt1rut( ( I'HICIW: ):: , pleasure'romtuunicntions from the interior and Marion county on the bright prospectsof Fniks,111': (liltnore Asbcrrv -- .. : . 'I'herearc many valuable experiments being having their railroad completed at an JJ'T1.00' iV-ll Hunter.,Gracie 011.1%ca: IL/XIS. - t carried on, the results of which would be of early day. Marion is! one of the best agri )Knight four(. ,Sam'l Thnd I l E lUy Lager Charles, Bonnedikc I 2OO na..I'" I great value to others and" information cultural and growing counties In the Rust WOOD) AND I HOOPS, t ; of the orange Hev.TerclI:lah Tho lIton.1 .\ : -L BOX 1':0: FOR OIIANUE]: : growth; and progress of the newly settled State, and with railroad connection, it will\ Thompson 1 Mrs( 0 A Turner, Mrs( A MWiUon for sale at Fcrnundinu by :. - portion are matters of general interest advance rapidly in every material interest." !' Miss( MarySVML. ''iO-tt p. 1'. 1J1SHOP.) : j,1 I'XTIL\: ':t. Florida Union. T. RiUDELL, 1'. M.I .. .V v- - Happy yew Year. .. -- -- Xotlce to Ta-l.ayers."VTOTICE ROSE POTATOES. t ; This is n very good opportunity for Fornandina Tit : Rev Hen Campbell: formerly, of the The Jrl tlte,.. I Is hereby J given that I am now I EARLY ie4! to shake its own hand, a* other stupendous Eufaula line,and now of the Cln. LOCAL OBSERVATION J.1 ready to receive the State and County I - cifdllg places do, and felicitate itself upon the cinnati Southern Railway, is I well known as! FERX\XIUX\: : FL\., December, I$M. Taxes i Is :at the assessed store for of lh I,Angel<; year t 188 Friend. My,( and oillceIs i i-< 4..!t SAXHORN) ; ; *: HOYT. 1 marked increase in its business! and prosperIty a high authority in the matter of scriptural _._ ___ 187U j 1 MXII. open on Tuesday, Thursday and Saturday* , which has taken place within the last quotations.! A striking instance! of his readiness -;--,---- ...;-- ;i;-- ---- except when collecting) in the country. I t.wclve months. But it is so content that it in Biblical research, occurred not long )I\r -1---1 :: 1:0' I I I !stated' I will below visit i :the follow ing places Itt time time J. ] I. I'RESCOTT.Style \ will probably not give Its satisfaction In ago. A company of general passenger __ _._ Odom's 13ranchi....ltunday( January 10, 1S81, - h wordy phrases, but simply evince it by abroad agents was discussing the advisability of Saturday 2iG) 78 'iIJ iU (1oue1l1ItelllY \'. kinds: Ferry........Tuesday. 11, " smile and a cordial welcome to visiting selling round trip tickets for Southern pointsto 1 2G 411; 48 42 'i2 Cloudy. ])unn'!' Crc'k.'l.th' \(' Monday 27 H jn 40 52 " h Fnlr. 13: htigginuthanm'sfhursday friends. go by one route and return by another. , Tuesday 2R 48 nt JII lit Fair.1Vedneslay Brandy< 0L r.Ig As to Its practical celebration, we hope that Our reverend brother suggested that he was ; :!) 1)2 H 411 no Clotll1\''. Cnllahan' ..............Satunlay, !.'>, :., our merchants will, at least, for the benefit accustomed to draw his! inspiration from Thtrsday ::10 se iO 18 :i2 1'air. Hart's Road.........Monday( ;3O, AM: of their employes, give a half holiday, If the Scriptures, and proposed to settle this Friday- ----.. -_-__-. _31- -JtfJ-- '-'if-- :3o-" a2.,. (lowly.1MdIt1N'E. .- C 1Iakcr\'llIc..TIII'.tla\'me\illo..,.........Tuemluy',. "" :31:31,, II" Durability. l.n they cI\l1nutgive a whole one. question! by turning to the first text that lie Amelia...............Friday,' 7, .F . . While we have not been so industrious as should happen) to open upon. Taking down \\'. F. sr(3TT: Collector.Fernandina . 1\t to obtain a list of the houses where there tho Bible, he opened to the following words: fort of I'crttandtna. Deu. 11,1880.) ..VtfOUTFIT will he formal receptions, we have no doubt "By the way that he came, by the fame ENTERED.Dec J 0k that all the ladies will be glad to receive shall he return"-2 Kings, XIX, 33. That 21-Brig Arcot, Small Fort an :Spain. $5 engage; in free the, most to those.pleasant: who\\ and wish:profitable to- '\'33O ' I their friends, and that the gentlemen will was considered to Kettle the question, and Ice 27-Sch. Haurbuck, Clark, Ponce. )business!\ known. Everything: new. ;1- industriously circulate those bits of pasteboard the company broke up more than ever convinced Dec. 27-lirigCcorgc: Morgan, St t.. C''roix.Iec24Sch ('npitulllot required. We will furnish you :: of the of II. Jones, Falkenberg, everything.: $10 a day and upwards) : is easily - which remind hostesses that advantage having an accomplished - they are New York.1)ec.: made without staving UWUfrom home over . Increased visitors, and open those seductive ;"ut Biblical scholar among them.1)t'llt :-Brig Kildonan (Br.), McLean( night. No risk whatever. plumy new workers Hating largely ut1'Sleek \\'E homes" which arc expected to be Issued 1r ---- New York. wanted at once. Many are making fortunes of Foot-wear, in both lice roil and 1'nradc. Dec. 31-S. S. City of ])alll\ Risk: New at the bu lII.'!!!>I. im lies make as much I ing the season. medium grades" I am cues \ \f ork.Dec.. and ed as! men, and young boys and girls make I -- -- ;j.l C.l'T.I1IltcmLll i is loading the brig If the day should be fine, the two military 31--Hch.K. C. Rommel,Sloan.CIiarleston. -' great pay. No one tvhn i is willing to work hlt'd to place before my customere "" '. ; ,0 companies will repeat the Christmas day falls to make more money e'cn11ay than , llIi Lucy for South America. parade and drill, on New-Year's day Timeto Dec. 31-Sch. Carrie Woodbury, Woodbury can be made in a week at any ordinary employment. a tery large assortment" of / Charleston. Those: who at once will the . engage made by ,' TUB schooner Kit Canon is taking on a form, 3:30:: p. aim, In front of Lyceum Hall Ih e. 3t )Sch. A. 1'. Nowell, Long, Savan find a short road to COI.ttIJ1tl.h'e, !>\\s II.HALLETT I Hoof and Shoe" h clf cargo for the West Indies. _h_ rah it Co., Augusta Maine. 0 I most'' competent ami "skilled<< .. For A'asRau.Tltosteartiship ('LEAKED.Dec. _____._.u __ .____ ___. .. _____ .. __ workmen. These" oods! were leit I.AWTEy's'Uverpool steamer, Loch Carry, Curondclct, of the Nassau 2J-Sch. John Lcnthul, .Brown, New nooks" and Stationery. I II and for CASH' are i \ I is loading at the steamship dock with cotton York. I purchased line, will leave this place Sunday, the 2d . sit ))cc. 2.)-S. S. Western Texas, Hines, New for the samecommodity. 011 seed.TIIK. inst., for Nassau. She i is a large and fat York.: .. 0 U.I': It It I,: ,,-_ only exchanged Fcrnandina & Jacksonville Railroad steamer, and Nassau passengers! will find no Dec. 29! -Sch. Saarbuck, Clark, Jackson' This will be deemed 'U1 engine No. 2 i is expected to arrive in a few more discomfort in the transfer than In crossing ville.Dec. 2!)-Sch. Kate V. AitkenThompson' Wholesale: and Retail :I a pleasure' after seeing, examining - Ccs 8 days. an ordinary sound.. Wilmington, Del. i > ooiis, STATIOMKY, and learning at what --- -- --- . Bark U koHII Dec.30: ( !! ), licrlinQueens- IS.vh TilE schooner /:'. II. Jfurriiwin is loading Waited Flftf/ Yearn for Ills Chance. town. .'iid MUSIC! !, e\tremely low prices' these : res at the lumber docks with lumber for It. O. A resident! of this place, who was out at Dec. :31-S. S. City of Dallas, RNk, New Gouda" are offered.ur J aidd. Cook fe Son. the Nassau!! crossing of the Fcrnandina & York IN I'OKT. .)!H'T:; B \\' foTJIT: : ,/ My "stock of GENTLIMEN'SI'11RNISIIING : ak \ ft )IE8tIn J. WELLEK, of Cincinnati, O., and Jacksonville Railroad, on Thursday morn- Schooner "'. II. Jones. JACKSONVILLE:, FLORIDA. took that occasion to fall overboard, ing Rommel. C. Schooner E. on J. P. Wcller of Wllkcsbarrc Pa. were , : the attention of those'' desiringline Schooner Carrie I K.: . In We hava not had such cold weather upon Woodbury.Schooner shq! guests; of the Egmont this week. that morning for fifty years in this State, A. 1'. Nowell. Schooner Kit Carson. itize 'hnt THE bark Congslerre, consigned to Win: and it would seem very hard that any one Schooner K. H. Ilayriman. sfKcliooI Hooks a Specialty.-fts I ./' Orders" left to my selection ,cop Lauvtoy, Is now discharging her cargo, consisting should have to wait no long for U cold bath. Schooner Ixmisu Fra/.er. I will receive careful and promptattention. miontlq But it is supposed that he thinks better Schooner Silas (J. Evans. . of about 3,000 bags of salt. V MKKF: . Schooner II. IT. (Sore. "T\\ ; -- late than never. Brothers. J. )r. t (' J. H. PRESCOTT o tit Schooner Five ( ( ( !>Iors to Cooper 0.,) , THREE coaches and one combination -- : passenger Louise Ocr Brig Mary ( ) rttdlefq car left Wilmington, Del., on the Steamer H. 11. riant. IJrig! Parnell (Br.) DEALERS I x I l-3in Fernandina. Fla. i1 2M ult., for. the Fcrnandina it Jacksonville\ i. As January 1111the completion of the Brig Arcot. 1-SchooI and )Ilscellikiieoiis"" II I. .-- '--. --- . Not IJ\ Railroad. Waycros-s it Jacksonville Railroad approach, Brig Ocorge. Z I YOURSELVES:;): by making Brig" Kildonan (Br.) HLP MONEY: when .u I -- much anxiety i is expressed in Brunswickand *- -* golden plIant THE remarkable scarcity of box and flat Bark James Kitchen (Hr.) chance i is ottered, Ih'rdlulwu keepingpoverty elsewhere lest the Macon it Brunswick 1 1J I. I RavcniclifleItr. continues andmost Bark : ( ) .- | -. from your door Those who always net curs all over tho country still Railroad should discontinue the ft h'umerf. Bark )Martha. Ttll'kl'r11I..) S take advantage of the good chances for making I str roads are unable to take all the business It. I'lant, which has been plying in the placeof Steamship Ixtch (tarry (Eng.) J HOOKS; IMXMiS [to's money I that are hired generally become is < offered. the Florence between Fernandina and .-- 1 f----. wealthy, while those who do not improve I ---- Xotlce.Office I such chances remain in poverty. Wo want ! 'md- see Ian. THE tops of tho coaches of tho passenger Brunswick.! The railroad hud chartered tho 01Jlce many men women, boys! and girls to work i Jonrn-From tiN: ) .\. M. to fi:00: ) I'. M. If Be t I' train on the Florida Central Itailroad, goingto steamer named only until January 1st, but Money( Orders and Registered Letters from HT.\TlO EItYXCY: ) 1(0)n': ) : ( for us right in their own localities. The Ian Jacksonville Thursday morning, were we take pleasure in announcing that on yesterday 8:00: .\. M. to 1:00 p. M.: and from 2:00: r. M. ALL KINDS, bu-iness will We,pay furnish more than un expensive ten times outfit ordinary \- of covered with snow. the boat was re-chartered, and will to 3:30: P. II. Sundays from 10:30: to 11:30:: A. and all wages.that you need free. No one who guI 1ni ---- bo continued upon her present route. The lit. and 3:30:: to 4:30: I'. M.ARRIVAL. ('01'. Congress ami St. Julian Sts., I engages fails to make money very rapidly' of COLONEL MOORE, of St. Louis, Mo.,and \\ completion of the Wuycross extension will AND PKPARTUIK OF Tin MULK.Xorthrrn Nataiuiah, Georgia. You can devote your whole time to the JV Arrives 11ailtit 10:30:: .. M. ____ _- ,I work of O. Taylor, of tho Fernandina & Jacksonville givotwo quick lines to loll'll1e.-'lacol& u or only your spare moments. Full Closes :3:0": ) p. M. information and nil that is needed sent free. cal Railroad stopping at the Kgmont In UBSCRIHE; : TO THE: MIItIi( )lt. $2 I'ER were 'Telegraph and Messenger. : : ) ' Southern .lail-\rrh'J: 1' Vr S Address :STINCON; A ( 0.Portland, Maine. G fo .. $1 for six months. annum the early part of tho week. Closes lOlMl: A. II, ; . .. '- \1p -- -------------- The Weather. .0;;:,. .11',1' and Trader' Hill _1l/il- - few THE steamer St.Johns abandoned her Wednesday's It is no very difficult matter to get an Arrives Tuesdays and Fridays at :2:30:: p. M. and Thursdays ut 8:(") .\. M. SANBORN HO YT trip this week, in order to make opinion from person about the weather Closes: Mondays She I is .S/ Mariff, (; expected some necessary repairs. just now; but there is so' much uniformity Arrives Mondays and Thursdays at 8:00: .\. M. I --- gris arrive here, bound south, on next Sunday. in them, it would scarcely be worth whileto Tuesdays and Friday at 20:! p. M. . -- ----- Wedn'sdaysaiidSafdaysat:00! : .\. M. dcjailed accounts of what the various h give )[ri. JOHN DOZIER, late agent of the Southern - Closes Tuesdays, 1Vetlnesdays, dignitaries of church and state think UJMJII : Express Company at this place, has removed Fridays and Satunlays ut 2:50: p. M.SOIL. GO tho subject or rather, what they expresg.The . , stti to Jesnp and taken charge of tho T. RIDIIKI.I.: I' )i. effect upon tho orange crop I is not yet . office of the Savannah, Florida Western: - .' Sot determined, but it is feared, und indeed almost Brick, WE HAVE JUST RECEIVED, at that place. ' cabl Hallway _. (certain that there have been heavy Lime I ;, + - - -- - Cement, V '.\ FEW Gut freight line, called tho South- losses! one gentleman being reported to Planter. : z 04-11 Dispatch, via Chicago and Eastern: Illinois have stated his at $:!OUOO. Hair c Itailroad, and extending to Pensacola We give tho temperatures different portions ATS\N ORX A HOVT'S.W. fly nail, Steamer and Sail -- ----- , v n and Southern Florida points and Havana, of the State and country on the 30th. R. TAPPVN-- Contractor- and Builder, td . Cuba, has just been established. At 7 o'clock a. ttt. the thermometer! stood Toledo. Ohio sa'l'In ExceMor Kidney a.g ...-- 5 below in the wdeof fifteen of -- --- Philadelphia\ zero. Pad l tl'ic\'C11me) pain .gb )[u. ".. 1.\WTt\ cleared on Friday the Wilmington\ })cl..-8 below zero. years' standingl'lcuse seal mo another O .gh l British bark Jtaeeiuclifft, Captain Hughes, lAmbcrtville, N J., 0 below y.cro. Va&L-& Adv.Xe A LARGE STOCK OF . Chicago, at zero. --' - - feet -- with -- orders 330,000 - IbrQuccnstown for I Louisville, Ky., 7 below zero. . .1t I pitch pine lumber. Value of cargo, $4,950. tlUI\'l': 1 l Cargo furnished: by Colonel" J. 0 Itcntl.I Dallas, Tex., 4 above zero, -- J t1e Cbrsicana, Tex.. 0 above zero. I.\,1U 1TRATIOX 11.\..... , (]I TILE Morgan arrived at Cedar Key from New York 3 above zero. ... Z 4 below ut 12: a. in., - Washington, zero; tlt1 I[ ( Pensacola on Thursday with a god number:. 7 below zero.1VilkesbarreVa.:10. BALL complimentary to JIox I WM. D.BLOXIIAM .J FURNITURE 1 of iKW-sengcrs and. a fair cargo of freight. A below zero. and LADY will be given special train on the Train It Railroad cons Danville Va.,-12 Mow zero. at Tt1l1aha !>It't'. Fla., on Tuesday evening, z. I Vicksburg, Miss., 16< above zero; January. 1r1. and the public are res-xi-l- ,t It iiccted with the ..lurglll&IUH1SSl'ng1'i: were Cedar Key, Fla.:, 2'o above zero fully invited to astcud.ho. ). \ 1 transferred without delay. Savannah. Ga., 10 above zero. (! 1' lUNEV", .1"". A. IlEMtERSOX, : -\XU- _ _ . np JXIL'ou: n. Augusta, Ga.8 above zero.Iuntgomer J. H. PERKIXH. I MR. HERNANDEZ:: foreman of the ear-hbps ) '. Ala., 3 above zero. (!hl\ A. BF.\RI A. I.. R\M> ,U>H. I . ' of tho Transit Railroad, has been directed Charleston 8. C.. 13: above zero. 0-U ComiuitU-e on Invitation. : ---- O GEN ------ E It A h J box immediately. His previous Norfolk, Va.. 10 above zero. --- MERCirAXIMSJ- bulllfift) cars N. C., 11 above zero. with full , Wilmington fn-e. . UTFITfumMieil . (> H that <5 1 A . record is sufficient guarantee Knoxville Tenn., 2 above zero. 5)1U instructions fUr conducting the If' . ,' under his: management the cars will be early At this place, by j-clf-rcgisterinK.thermom- most profitable business that any one can w. . .. '. completed,.and that he 'will fully maintainthe ctcrs, the lowest temperature reached was engage in. The business is so easy to learn, PQZ I '. ":;' .' i. : .... : which ho has alreadyatcxpulrer. the lowestreached und the instruction. are so simple and plain) .: .. : ." '''''.. .... '-... . high reputation at Jacksonville, : 18 above zero; that anyone can make gnat profits from .. ;;. .. I 0 .. .- was 19 degrees above. the Very tartu one can fad who is will.lug \ :-, _.. :( ,' -,..11. ... I' trees this "Wand' whichdo to work Women are us successful as ' born of but The upon Florida orange CLAIB is six years old, tho'uxuul Boand girls can earn large zunms.lauv CALL AND EXAMINE OUR : L Christ. not aggregate more.than eight men STOCKS * While discussing Yankee extraction. ) have made at the business over one . .. he wished unhurt, as far as can be ascertained. week Nothing ' are single mas with some of his playmates, hundred dollars in a / /4r r . to the ocean has probably known before. All who engage ... ..v.... Santa Claus would bring him a velocipede The proximity like it ever with I 00 e "' ,:'" y been the cause of this immunity.W are MirpriMxi' at the rae and rapidity needful to a boy'i : . und many other things ---- ---.-. which they are able to make money. You I I" P happlneta. Eddie broke in and said; "Pooh! Ashland Toledo. tan engage/ in this bn! ine.* luring your .. ;' ... . A. Tins. Gi avenue '. ' do not nee.1t.i t Santa Clans; it's your father Is strong al t-iui re time i ut great protiK You I . ain't My wife now as , there any Ohio nays; in it. We take all the ri k.Tho.M5 -- -- --- --- .. . and mother who give, you all the presents. ever, her regained health' being directly dtje invest capital, money.hould. writet '"- ------- - Pad. We wlv nml TfMly and ah air of pity, re- to the use of the Excelsior Kidney Add Clair with surprise all at ouiv. All funiisheil free. ' h'ttrtili'l't'OItIIIlt"1. it to kidney ) us r1c14fut't AJSTBORN & can . plied : "01", l*haw"! nobody but a Democrat trouble j>crson!!.-. f't' -If/if. : & e.-tt Augtikta, )ltain('. HOYTr believe . would that. . . ! w . --........."- .. ---- ' ... -- R- 1 I ..... U4 - . -:..:_........ ," U'f - Contact Us | Permissions | Preferences | Technical Aspects | Statistics | Internal | Privacy Policy © 2004 - 2011 University of Florida George A. Smathers Libraries.All rights reserved. Acceptable Use, Copyright, and Disclaimer Statement Powered by SobekCM
http://ufdc.ufl.edu/UF00054505/00097
CC-MAIN-2018-30
refinedweb
32,145
77.13
. I have been using various ways to implement logging when was that required in an ASP.Net application. I used the Enterprise Library Logging Application Block but only recently I discovered how easy and flexible Log4Net is.It is very easy to use, well documented and open source (Apache Software Foundation). I will create a very simple example where I open a connection to a database and print on the screen a simple message, if the connection was opened successfully or not. At the same time I will log various information to a text file. folder inside the App_Code special folder and name it DataAccess.>. Ιn my case it like the one below. In your case you must set the Data Source property to your SQL server instance. ) In the Default.aspx page add a Label control. Leave the default name. 8) Do not forget to add this line of code in the top of the Default.aspx.cs file using System.Data.SqlClient;using System.Data.SqlClient; 9) We need to add the Log4Net assembly to our website.I will use VS to add this assembly to our website. From visual studio Tools –> Library Package Manager –> Manage NuGet Packages… In Manage NuGet Packages… windows, search Log4Net then install log4net package to your project.The log4net.dll will be added to the Bin folder.Have a look at the picture below 10) Add a new item to your application, a Global.asax file.In the Application_Start() type void Application_Start(object sender, EventArgs e) { // Code that runs on application startup log4net.Config.XmlConfigurator.Configure(); } We initialise log4net at application start up. 11) We need to make changes to the web.config file.I provide the information where log4net configuration parameters are defined. In the configSections type the following <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> </configSections> Now we need to add more settings in the web.config regarding the LogFileAppender and the path to the actual log file. Type the following in the web.config file > The complete web.config follows. <?xml version="1.0"?> <!-- For more information on how to configure your ASP.NET application, please visit --> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> </configSections> <connectionStrings> <add name="NorthwindConnectionString" connectionString="Data Source=.;Initial Catalog=Northwind; Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> > <system.web> <compilation debug="true" targetFramework="4.0"/> </system.web> </configuration> 12) In the Page_Load event handling routine of the Default.aspx page type protected void Page_Load(object sender, EventArgs e) { log4net.ILog logger = log4net.LogManager.GetLogger(typeof(_Default)); if (!IsPostBack) { Label1.Text = "We will test the connection to the database."; try { logger.Info("Open Connection "); SqlConnection connection = Connection.GetDBConnection(); connection.Close(); Label1.Text = "We opened and closed the connection to the database"; logger.Info("We opened and closed the connection to the database"); } catch (SqlException ex) { Label1.Text = "We cannot connect to the database" + ex.Message; logger.Error("Error in opening the connection"); } } } The code is very easy to understand. We create an instance of the log4net object and use the Info and Error methods to log the information to the text file. Do not forget to add this line of code using log4net; 13) Run your application and then have a look at the test.log file.Have a look in the picture below to see what was logged when I run the example I ran the application the first time and everything was successful and the information I wanted was logged.The second time I intentionally changed the connection string to point to a non-existing SQL Server instance and then run again the application.This time the error message was logged in the log file. Hope it helps!!!
http://weblogs.asp.net/dotnetstories/using-log4net-in-an-asp-net-application
CC-MAIN-2015-32
refinedweb
620
51.44
. oops. I accidentally made a recursive call in the setter. scratch that, it should change the attribute. On Thu, Dec 29, 2011 at 6:58 PM, Gor Gyolchanyan <gor.f.gyolchanyan@gmail.com> wrote: >. -- Bye, Gor Gyolchanyan. On 12/29/11 2:04 AM, Vladimir Panteleev wrote: > I think it would be simpler to just make dstring the default string type. > > dstring is simple and safe. People who want better memory usage can use > UTF-8 at their own discretion. memory == time Andrei On Thursday, 29 December 2011 at 06:09:17 UTC, Andrei Alexandrescu wrote: > Nah, that still breaks a lotta code because people parameterize on T[], use isSomeString/isSomeChar etc. /* snip struct string */ import std.traits; void tem(T)(T t) if(isSomeString!T) {} void tem2(T : immutable(char)[])(T t) {} string a = "test"; tem(a); // works tem2(a); // works It's the alias this magic again. (btw I also tried renaming struct string to struct STRING, and it still worked, so it wasn't just naming coincidence!) Le 28/12/2011 21:43, Jonathan M Davis a écrit : > On Wednesday, December 28, 2011 10:27:15 Andrei Alexandrescu wrote: >> I'm afraid you're wrong here. The current setup is very good, and much >> better than one in which "string" would be an alias for const(char)[]. >> >> The problem is escaping. A function that transitorily operates on a >> string indeed does not care about the origin of the string, but storing >> a string inside an object is a completely different deal. The setup >> >> class Query >> { >> string name; >> ... >> } >> >> is safe, minimizes data copying, and never causes surprises to anyone >> ("I set the name of my query and a little later it's all messed up!"). >> >> So immutable(char)[] is the best choice for a correct string abstraction >> compared against both char[] and const(char)[]. In fact it's in a way >> good that const(char)[] takes longer to type, because it also carries >> larger liabilities. >> >> If you want to create a string out of a char[] or const(char)[], use >> std.conv.to or the unsafe assumeUnique. > > Agreed. And for a number of functions, taking const(char)[] would be worse, > because they would have to dup or idup the string, whereas with > immutable(char)[], they can safely slice it without worrying about its value > changing. > Is inout a solution for the standard lib here ? The user could idup if a string is needed from a const/mutable char[] Le 29/12/2011 07:48, Jonathan M Davis a écrit : > On Thursday, December 29, 2011 07:33:28 Jakob Ovrum wrote: >> I don't think this is a problem you can solve without educating >> people. They will need to know a thing or two about how UTF works >> to know the performance implications of many of the "safe" ways >> to handle UTF strings. Further, for much use of Unicode strings >> in D you can't get away with not knowing anything anyway because >> D only abstracts up to code points, not graphemes. Imagine trying >> to explain to the unknowing programmer what is going on when an >> algorithm function broke his grapheme and he doesn't know the >> first thing about Unicode. >> >> I'm not claiming to be an expert myself, but I believe D offers >> Unicode the right way as it is. > > Ultimately, the programmer _does_ need to understand unicode properly if > they're going to write code which is both correct and efficient. However, if the > easy way to use strings in D is correct, even if it's not as efficient as we'd > like, then at least code will tend to be correct in its use of unicode. And > then if the programmer wants to their string processing to be more efficient, > they need to actually learn how unicode works so that they code for it more > efficiently. > > The issue, however, is that it's currently _way_ too easy to use strings > completely incorrectly and operate on code units as if they were characters. A > _lot_ of programmers will be using string and char[] as if a char were a > character, and that's going to create a lot of bugs. Making it harder to > operate on a char[] or string as if it were an array of characters will > seriously reduce such bugs and on some level will force people to become > better educated about unicode. > > No, it doesn't completely solve the problem, since then we're operating at the > code point level rather than the unicode level, but it's still a _lot_ better > than operating on the code unit level as is likely to happen now. > > - Jonathan M Davis That is the whole point of D IMO. I think we shouldn't let an ego question dictate language decision. On 12/29/2011 07:53 AM, Walter Bright wrote: > On 12/28/2011 10:08 PM, Andrei Alexandrescu wrote: >> The only solution is to explain Walter no other programmer in the >> world codes >> UTF like him. Really. I emulate that sometimes (learned from him) but >> I see code >> from hundreds of people day in and day out - it's never like his. >> >> Once we convince him, he'll be like "ah, I see what you mean. >> Requiring .rep is >> awesome. Let's do it." > > If that ever happens, I owe you a beer. Maybe two! > > Maybe it's hubris, but I think D nails what a string type should be. I'm > extremely reluctant to mess with its success. It strikes the right > balance between aesthetics, efficiency and utility. > I fully agree. If I had to design an imperative programming language, this is how its strings would work. > C++11 and C11 appear to have copied it. On 12/29/2011 07:45 AM, foobar wrote: > On Wednesday, 28 December 2011 at 22:39:15 UTC, Timon Gehr wrote: >> On 12/28/2011 11:12 PM, foobar wrote: >>> On Wednesday, 28 December 2011 at 21:17:49 UTC, Timon Gehr wrote: >>>> >>>> I was educated enough not to make that mistake, because I read the >>>> entire language specification before deciding the language was awesome >>>> and downloading the compiler. I find it strange that the product >>>> should be made less usable because we do not expect users to read the >>>> manual. But it is of course a valid point. >>>> >>> >>> That's awfully optimistic to expect people to read the manual. >>> >> >> Well, if the alternative is slowly butchering the language I will be >> awfully optimistic about it all day long. >> >>>> There is nothing wrong with operating at the code unit level. >>>> Efficient slicing is very desirable. >>>> >>> >>> I agree that it's useful. It is however the incorrect abstraction level >>> when you need a "string" which is by far the common case in user code. >> >> I would not go as far as to call it 'incorrect'. >> >>> i.e. if I need a name variable in a class: codeUnit[] name; // bug! >>> string Name; // correct >>> >> >> From a pragmatic viewpoint it does not matter because if string is >> used like this, then codeUnit[] does exactly the same thing. Nobody >> forces anyone to index or slice into a string variable when they don't >> need that functionality. All engineers have to work with leaky >> abstractions. Why is it such a big deal? >> >> >>> I expect that most uses of code-unit arrays should be in the standard >>> library anyway since it provides the string manipulation routines. It >>> all boils down to making the common case trivial and the rare case >>> possible. You can use the underlying data structure (code units) if you >>> need it but the default "string" is what people expect when thinking >>> about what such a type does (a string of letters). D's already 80% there >>> since Phobos already treats strings as bi-directional ranges of >>> code-points which is much closer to the mental image of a string of >>> letters, so I think this is about bringing the current design to its >>> final conclusion. >>> >> >> Well, that mental image is just not the right one when dealing with >> Unicode. >> >>>> >>>> Exactly. It is acting less and less like an array of code units. But >>>> it *is* an array of code units. If the general consensus is that we >>>> need a string data type that acts at a different abstraction level by >>>> default (with which I'd disagree, but apparently I don't have a >>>> popular opinion here), then we need a string type in the standard >>>> library to do that. Changing the language so that an array of code >>>> units stops behaving like an array of code units is not a solution. >>>> >>> >>> I agree that we should not break T[] for any T and instead introduce a >>> library type. While I personally believe that such a change will expose >>> hidden bugs (certainly when unaware programmers treat string as ASCII >>> and the product is later on localized), it's a big disturbance in >>> people's code and it's worth a consideration if the benefit worth the >>> costs. Perhaps, some middle ground could be found such that existing >>> code can rely on existing behavior and the new library type will be an >>> opt-in. >> >> What will such a type offer, except that it disallows indexing and >> slicing? > > > From a pragmatic view point people can also continue programming in C++ > instead of investing a lot of effort learning a new language. > I disagree. Pragmatism: "Dealing with things sensibly and realistically in a way that is based on practical rather than theoretical considerations." In practice, programming in D beats the pants off programming in C++. > The only difference between programming languages is the human interface > aspect. No. There is also the aspect of how well it maps to the machine it will run on. An interface always has two sides. > Anything you can program with D you could also do in assembly > yet you prefer D because it's more convenient. I prefer D because it is more productive. > In that regard, a code-unit array is definitely worse than a string type. > A code-unit array type is a string type, albeit a simple one. > A programmer can choose to either change his 'naive' mental image or > change the programming language. Most will do the latter. A programmer does not care about how D strings work or he is happy that they are so simple to work with. > Computers need to adapt and be human friendly, not vice-versa. When I meet a computer that adapts itself in order to be human friendly, I'll buy you a cookie. On 28.12.2011 20:00, Andrei Alexandrescu wrote: > Oh, one more thing - one good thing that could come out of this thread > is abolition (through however slow a deprecation path) of s.length and > s[i] for narrow strings. Requiring s.rep.length instead of s.length and > s.rep[i] instead of s[i] would improve the quality of narrow strings > tremendously. Also, s.rep[i] should return ubyte/ushort, not char/wchar. > Then, people would access the decoding routines on the needed occasions, > or would consciously use the representation. > > Yum. If I understand this correctly, most others don't. Effectively, .rep just means, "I know what I'm doing", and there's no change to existing semantics, purely a syntax change. If you change s[i] into s.rep[i], it does the same thing as now. There's no loss of functionality -- it's just stops you from accidentally doing the wrong thing. Like .ptr for getting the address of an array. Typically all the ".rep" everywhere would get annoying, so you would write: ubyte [] u = s.rep; and use u from then on. I don't like the name 'rep'. Maybe 'raw' or 'utf'? Apart from that, I think this would be perfect.
http://forum.dlang.org/thread/jdf049$2n2v$1@digitalmars.com?page=8
CC-MAIN-2015-27
refinedweb
1,966
71.75
What state Read: Multithreading in Java Whats the need of a thread or why we use Threads? - To perform asynchronous or background processing - Increases the responsiveness of GUI applications - Take advantage of multiprocessor systems - Simplify program logic when there are multiple independent entities What happens when a thread is invoked? When a thread is invoked, there will be two paths of execution. One path will execute the thread and the other path will follow the statement after the thread invocation. There will be a separate stack and memory space for each thread. Risk Factor - Proper co-ordination is required between threads accessing common variables [use of synchronized and volatile] for consistence view of data -. Thread creation in Java Thread implementation in java can be achieved in two ways: - Extending the java.lang.Thread class - Implementing the java.lang.Runnable Interface Note: The Thread and Runnable are available in the java.lang.* package 1) By extending thread class - The class should extend Java Thread class. - The class should override the run() method. - The functionality that is expected by the Thread to be executed is written in the run() method. void start(): Creates a new thread and makes it runnable. void run(): The new thread begins its life inside this method. Example: public class MyThread extends Thread { public void run(){ System.out.println("thread is running..."); } public static void main(String[] args) { MyThread obj = new MyThread(); obj.start(); } 2) By Implementing Runnable interface - The class should implement the Runnable interface - The class should implement the run() method in the Runnable interface - The functionality that is expected by the Thread to be executed is put in the run() method Example: public class MyThread implements Runnable { public void run(){ System.out.println("thread is running.."); } public static void main(String[] args) { Thread t = new Thread(new MyThread()); t.start(); } Extends Thread class vs Implements Runnable Interface? - Extending the Thread class will make your class unable to extend other classes, because of the single inheritance feature in JAVA. However, this will give you a simpler code structure. If you implement Runnable, you can gain better object-oriented design and consistency and also avoid the single inheritance problems. - If you just want to achieve basic functionality of a thread you can simply implement Runnable interface and override run() method. But if you want to do something serious with thread object as it has other methods like suspend(), resume(), ..etc which are not available in Runnable interface then you may prefer to extend the Thread class. Thread life cycle in java Read full article at: Thread life cycle in java Ending Thread A Thread ends due to the following reasons: - The thread ends when it comes when the run() method finishes its execution. - When the thread throws an Exception or Error that is not being caught in the program. - Java program completes or ends. - Another thread calls stop() methods. Synchronization of Threads - In many cases concurrently running threads share data and two threads try to do operations on the same variables at the same time. This often results in corrupt data as two threads try to operate on the same data. - A popular solution is to provide some kind of lock primitive. Only one thread can acquire a particular lock at any particular time. This can be achieved by using a keyword “synchronized” . - By using the synchronize only one thread can access the method at a time and a second call will be blocked until the first call returns or wait() is called inside the synchronized method. Deadlock Whenever there is multiple processes contending for exclusive access to multiple locks, there is the possibility of deadlock. threads. Guidelines for synchronization - Keep blocks short. Synchronized blocks should be short — as short as possible while still protecting the integrity of related data operations. - Don’t block. Don’t ever call a method that might block, such as InputStream.read(), inside a synchronized block or method. - Don’t invoke methods on other objects while holding a lock. This may sound extreme, but it eliminates the most common source of deadlock. Target keywords: Java threads, javathread example, create thread java, java Runnable
http://beginnersbook.com/2013/03/java-threads/
CC-MAIN-2016-50
refinedweb
691
64.81
Using the debugger is just essantial in a huge complex project. But even for a tiny program, it is also useful. For this Eclipse debugguer tutorial we are going to test it with the C++ programming language. Of course you know how to install Eclipse on Windows, if not, follow this Eclipse installation tutorial for Windows. If you prefer GNU/Linux or MAC it is a bit much easy because all libraries are already installed on your OS. So let's get started. To debug a project we have to already have a project. So let's create it. Create a new project test-1 with a simple main.cpp file. #include <iostream> int main() { int myAge; std::cout << "Hello, my age is " << myAge << std::endl; return 0; } Let's build the project. For that right click on the project name and select Build project. A new folder appears named Debug and inside a binary test-1.exe. As you notice, because you are a C++ expert, this code isn't correct. Indeed, the myAge variable isn't initialized. So the result is unknown and this is not what we want. But let's assume that you don't see where is the error. To know what's going on we are using the debugger. Our program test-1.exe can now be debugged. Right click on the project name and select: Debug As > Local C/C++ Application. A new window appears asking if you want to switch to the debug perspective, click yes if you don't know what is this. You are now in the debug perspective with new icons to press and different splitted tabs. If you want to switch to the classic C/C++ perspective, at the top right of Eclipse, there is two buttons: C/C++ and Debug with an icon for each. Just click it. So let's continue! On your main.cpp file, at line: std::cout << "Hello, my age is " << a << std::endl; double left click on the left of this line, just before the line number. A new blue icon appears. It's a breakpoint. Relaunch your application with the debugger. Click on the green triangle within the Debug tab. On the right, the Variable tab is displaying the myAge variable with its type and its value! In my case, I have for this value something like that: 14135619. And this is a really weird age. So we know now why the program was bugged! A great help to understand what's going on with your program. Add new comment
https://www.badprog.com/eclipse-debugger-an-easy-example
CC-MAIN-2021-10
refinedweb
429
85.79
Today I prepared a huge list of React Interview Questions from this awesome repo For more info, I have developed a project with more than 500 questions for Frontend Devs Here you are: If you like the article, add to bookmark for future and follow me there: Table of Contents Core. text inside <h1> tag is returned as JavaScript function to the render function. class App extends React.Component { render() { return ( <div> <h1>{'Welcome> ); } }. For example, let us create an element with reactProp property: <Element reactProp={'1'} /> This reactProp (or whatever you came up with) name then becomes a property attached to React's native props object which originally already exists on all components created using React library. props.reactProp What is the difference between state and props? Both. Why should we not update the state directly? If you try to update state directly then it won't re-render the component. //Wrong this.state.message = 'Hello world'; Instead use setState() method. It schedules an update to a component's state object. When state changes, the component responds by re-rendering. //Correct this.setState({ message: 'Hello? Below are some of the main differences between HTML and React event handling, - In HTML, the event name should be in lowercase: <button onclick="activateLasers()"></button>.'); } - In HTML, you need to invoke the function by appending ()Whereas in react you should not append ()with the function name. (refer "activateLasers" function in the first point for example).Component { arrow function <button onClick={this.handleClick(id)} />; handleClick = (id) => () => { console.log('Hello, your ticket number is "key" prop and what is the benefit of using it in arrays of elements?? Before React. React 16.3+ - getDerivedStateFromProps: Invoked right before calling render()and is invoked on every render. This exists for rare use cases where you need derived state. Worth reading if you need. - getSnapshotBeforeUpdate: Executed right before. children prop? Children is a prop ( this.props, );? Below are the list of reasons, -? Below are the list of main? Apart from the advantages, there are few limitations of React too, -? Yes, it is safe to use setState() inside componentWillMount() method. But at the same>; } } ternary operator. const MyComponent = ({ name, address }) => ( <div> <h2>{name}</h2> {address ? <p>{address}</p> : <p>{'Address>; }; Update: */ }); OR; export default React.memo(MyFunctionComponent);? Both render props and higher-order components render only a single child but in most of the cases Hooks are a simpler way to serve this by reducing nesting in your tree. (OR), })); What is strict mode in React? React.StrictMode is a useful component for highlighting potential problems in an application. Just like <Fragment>, <StrictMode>)` ) } Are custom DOM attributes supported in React v16? Yes. In the past, React used to ignore unknown DOM attributes. If you wrote JSX with an attribute that React doesn't recognize, React would just skip it. For example, let's take a look at the below attribute: > But componentDidUpdate lifecycle method will be called when state changes. You can compare provided state and props values with current state and props to determine if something meaningful changed. componentDidUpdate(object prevProps, object prevState) Note: The previous releases of ReactJS also uses componentWillUpdate(object nextProps, object nextState) for state changes. It has been deprecated in latest releases.? There are approaches to include polyfills in create-react-app, - Manual import from core-js: Create a file called (something like) polyfills.js and import it into root index.js file. Run npm install core-js or yarn add core-js and((employee) => ( <li key={employee.name}> {employee.name}-{employee. How React Router is different from history library? React Router is a wrapper around the history library which handles interaction with the browser's window.history with its browser and hash histories. It also provides memory history which is useful for environments that don't have global history, such as mobile app development (React Native) and unit testing with Node.. What is the purpose of push() and replace() methods of history? A history instance has two methods for navigation purpose. push() replace() If you think of the history as an array of visited locations, push() will add a new location to the array and replace() will replace the current location in the array with the new one. 'react-router-dom'; // this also works with 'react-router-native' const Button = withRouter(({ history }) => ( <button type="button" onClick={() => { history.push('/new-location'); }} > {'Click Me!'} </button> )); - Using <Route>component and render props pattern: The <Route> component passes the same props as withRouter(), so you will be able to access the history methods through the history prop. import { Route } from 'react-router-dom'; const Button = () => ( <Route render={({ history }) => ( <button type="button" onClick={() => { history.push('/new-location'); }} > {'Click Me!'} </button> )} /> ); - Using context: This option is not recommended and treated as unstable API. const Button = (props, context) => ( <button type="button" onClick={() => { context.history.push('/new-location'); }} > {'Click('query-string'); const parsed = queryString.parse(props.location.search); You can also use URLSearchParams if you want something native: const params = new URLSearchParams(props.location.search); const foo = params.get('name'); 'react-router'; Then define the routes within <Switch> block: <Router> <Switch> <Route {/* ... */} /> <Route {/* ... */} /> </Switch> </Router> How to pass params to history.push method in React Router v4? While navigating you can pass props to the history object: this.props.history.push({ pathname: '/template', search: '? Below are the list of steps to get history object on React Router v4, - Create a module that exports a historyobject and import this module across the project. For example, create history.js file: import { createBrowserHistory } from 'history'; export default createBrowserHistory({ /* pass a configuration object here if needed */ }); - You should use the <Router>component instead of built-in routers. Imported the above history.jsinside index.jsfile: import { Router } from 'react-router-dom'; import history from './history'; import App from './App'; ReactDOM.render( <Router history={history}> <App /> </Router>, holder, ); - You can also use push method of historyobject similar to built-in history object: // some-other-file.js import history from './history'; history.push('/go-here'); How to perform automatic redirect after login? The react-router package provides <Redirect> component in React Router. Rendering a <Redirect> will navigate to a new location. Like server-side redirects, the new location will override the current location in the history stack. import React, { Component } from 'react'; import { Redirect } from 'react-router'; export default class LoginComponent extends Component { render() { if (this.state.isLoggedIn === true) { return <Redirect to="/your/redirect/page" />; } else { return <div>{'Login? Below: - Using react components: <FormattedMessage id={'account'} defaultMessage={'The amount is less than minimum balance.'} /> - Using an API: const messages = defineMessages({ accountMessage: { id: 'account', defaultMessage: 'The 'react'; import { injectIntl, intlShape } from 'react-intl'; const MyComponent = ({ intl }) => { const placeholder = intl.formatMessage({ id: 'message 'react 'react-intl'; const stringDate = this.props.intl.formatDate(date, { year: 'numeric', month: 'numeric', day: 'numeric', });={'heading'}>{'Title'}</span> <span className={'description'}>{'Description'}</span> </div> ); } Then you can assert as follows:>, <span className={'description'}>{'Description'}< 'react-test-renderer'; const Link = ({ page, children }) => <a href={page}>{children}</a>; const testRenderer = TestRenderer.create( <Link page={''}>{'Facebook'}</Link>, ); console.log(testRenderer.toJSON()); // { // type: 'a', // props: { href: '' }, // children: [ 'Facebook' ] // } './sum'; test('adds? You just need to export the store from the module where it created with createStore(). Also, it shouldn't pollute the global window object. store = createStore(myReducer); export default store; What are the drawbacks of MVW pattern? - DOM manipulation is very expensive which causes applications to behave slow>{'Loaded'}</div> : <div>{'Notfunction is connected to the container. You can import connect()from react-redux. import React from 'react'; import { connect } from 'react === 'USER === 'USER: 'SET = 'ADD_TODO'; export const DELETE_TODO = 'DELETE_TODO'; export const EDIT_TODO = 'EDIT_TODO'; export const COMPLETE_TODO = 'COMPLETE_TODO'; export const COMPLETE_ALL = 'COMPLETE_ALL'; export const CLEAR_COMPLETED = 'CLEAR_COMPLETED'; In Redux, you use them in two places: - During action creation: Let's take actions.js: import { ADD_TODO } from './actionTypes'; export function addTodo(text) { return { type: ADD_TODO, text }; } - In reducers: Let's create reducer.js: import { ADD_TODO } from '. './containers/ConnectedComponent'; <ConnectedComponent user={'john'} />; The ownProps inside your mapStateToProps() and mapDispatchToProps() functions will be an object: { user: 'john'; } You can use this object to decide what to return from those functions. How to structure Redux top level directories? Most of the applications has several top-level.: 'FETCH_USER_SUCCESS', userData, }); } What is Redux.? Some of the main features of Redux DevTools are below, - Lets you inspect every state and action payload. - Lets you go back in time by cancelling actions. - If you change the reducer code, each staged action will be re-evaluated. - If the reducers throw, you will see during which action this happened, and what the error was. - With persistState()store enhancer, you can persist debug sessions across page reloads. What are Redux selectors and why to use them? Selectors are functions that take Redux state as an argument and return some data to pass to the component. For example, to get user details from the state: const getUserData = (state) => state.user.data; These selectors have two main benefits, - The selector can compute derived data, allowing Redux to store the minimal possible state - The selector is not recomputed unless one of its arguments changes? Some of the main features of Redux Form are: - 'redux';: 'example',, let's take an action which represents adding a new todo item: { type: ADD_TODO, text: 'Add todo item' }? You need to follow below steps. Note: The above list of advantages are purely opinionated and it vary based on the professional experience. But they are helpful as base parameters. What is the difference between React and Angular? Let's see the difference between React and Angular in a table format. Note: The above list of differences are purely opinionated and it vary based on the professional experience. But they are helpful as base parameters.. i.e, create-react-app now supports typescript natively. Miscellaneous What are the main features of Reselect library? Let's see:.2 }, { name: 'orange', value: 0.95 }, ], }, }; console.log(subtotalSelector(exampleState)); // 2.15 console.log(taxSelector(exampleState)); // 0.172 console.log(totalSelector(exampleState)); // { total: 2.322 } Does the statics object work with ES6 classes in React? No, statics only works with React.createClass(): someComponent = React.createClass({ statics: { someMethod: function () { // .. }, }, }); But you can write statics inside ES6+ classes as below, class Component extends React.Component { static propTypes = { // ... }; static someMethod() { // ... } } or writing them outside class as below, class Component extends React.Component { .... } Component.propTypes = {...} Component.someMethod = function(){....}> ); } } Note: In React v16.3, ⬆ Back to. - Props Proxy (PP) and - Inheritance Inversion (II). But in quotes React.render(<User age={30} department={'IT'} />, document.getElementById('container')); Do I need to keep all my state into Redux? Should I ever use react internal state? It is up to developer decision. i.e, It is developer job to determine what kinds of state make up your application, and where each piece of state should live.. Below are the thumb rules (i.e, use what's in state if it's already there instead of re-requesting it)?-rendering is a new feature(React 16.8) order( <BrowserRouter>) which wraps specific child router components( <Route>). - You don't need to manually set history. The router module will take care history by wrapping routes with <BrowserRou syntax may have keys. The general use case. Does recommended to use}">< two> ); } } This can be solved by lifting up the value to parent state, class App extends React.Component { constructor(props) { super(props); this.state = { value: { something: 'something' }, }; }, ```javascript} />; } } return React.forwardRef((props, ref) => { return <LogProps {...props} forwardedRef={ref} />; }); } ``` Let's use this HOC to log all props that get passed to our “fancy button” component, ```javascript class FancyButton extends React.Component { focus() { // ... } // ... } export default logProps(FancyButton); ``` Now lets create a ref and pass it to FancyButton component. In this case, you can set focus to button element. ```javascript import FancyButton from '. auto binding? No. But you can try Hooks in a few components(or new components) without rewriting any existing code. Because there are no plans to remove classes in ReactJS. import React, { useState, useEffect } from 'react'; import axios from 'axios'; function App() { const [data, setData] = useState({ hits: [] }); useEffect(async () => { const result = await axios(''); setData(result.data); }, []); return ( <ul> {data.hits.map((item) => ( <li key={item.objectID}> <a href={item.url}>{item.title}</a> </li> ))} </ul> ); } export default App; Remember we provided an empty array as second argument to the effect hook to avoid activating it on component updates but only for the mounting of the component. i.e, It fetches only for component mount.? React includes a stable implementation of React Hooks in 16.8 release for below packages - React DOM - React DOM Server - React Test Renderer - React Shallow Renderer Why do we use array destructuring (square brackets notation) in useState? When we declare a state variable with useState, it returns a pair — an array with two items. The first item is the current value, and the second is a function that updates the value. Using [0] and [1] to access them is a bit confusing because they have a specific meaning. This is why we use array destructuring instead. For example, the array index access would look as follows: var userStateVariable = useState('userProfile'); // Returns an array pair var user = userStateVariable[0]; // Access first item var setUser = userStateVariable[1]; // Access second item Whereas with array destructuring the variables can be accessed as follows: const [user, setUser] = useState('userProfile');? Formik is a small react form library that helps you with the three major problems, - Getting values in and out of form state - Validation and error messages - Handling form submission What are typical middleware choices for handling asynchronous calls in Redux? Some of the popular middleware choices for handling asynchronous calls in Redux eco system are Redux Thunk, Redux Promise, Redux Saga. Do browsers understand JSX code? No, browsers can't understand JSX code. You need a transpiler to convert your JSX to regular Javascript that browsers can understand. The most widely used transpiler right now is Babel. Describe about data flow in react? React implements one-way reactive data flow using props which reduce boilerplate and is easier to understand than traditional two-way data binding.. What are the features of create react app? Below are the list of some of the features provided by create react app. - React, JSX, ES6, Typescript and Flow syntax support. - Autoprefixed CSS - CSS Reset/Normalize -? Below are the main differences between Redux and MobX,. What is the purpose of eslint plugin for hooks? The ESLint plugin enforces rules of Hooks to avoid bugs. It assumes that any function starting with ”use” and a capital letter right after it is a Hook. In particular, the rule enforces that, - Calls to Hooks are either inside a PascalCase function (assumed to be a component) or another useSomething function (assumed to be a custom Hook). - Hooks are called in the same order on every render. What is the difference between Imperative and Declarative in React? Imagine a simple UI component, such as a "Like" button. When you tap it, it turns blue if it was previously grey, and grey if it was previously blue. The imperative way of doing this would be: if (user.likes()) { if (hasBlue()) { removeBlue(); addGrey(); } else { removeGrey(); addBlue(); } } Basically, you have to check what is currently on the screen and handle all the changes necessary to redraw it with the current state, including undoing the changes from the previous state. You can imagine how complex this could be in a real-world scenario. In contrast, the declarative approach would be: if (this.state.liked) { return <blueLike />; } else { return <greyLike />; } Because the declarative approach separates concerns, this part of it only needs to handle how the UI should look in a sepecific state, and is therefore much simpler to understand. What are the benefits of using typescript with reactjs? Below are some of the benefits of using typescript with Reactjs, - It is possible to use latest JavaScript features - Use of interfaces for complex type definitions - IDEs such as VS Code was made for TypeScript - Avoid bugs with the ease of readability and Validation How do you make sure that user remains authenticated on page refresh while using Context API State Management? When a user logs in and reload, to persist the state generally we add the load user action in the useEffect hooks in the main App.js. While using Redux, loadUser action can be easily accessed. App.js import { loadUser } from '../actions/auth'; store.dispatch(loadUser()); - But while using Context API, to access context in App.js, wrap the AuthState in index.js so that App.js can access the auth context. Now whenever the page reloads, no matter what route you are on, the user will be authenticated as loadUser action will be triggered on each re-render. index.js import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import AuthState from './context/auth/AuthState'; ReactDOM.render( <React.StrictMode> <AuthState> <App /> </AuthState> </React.StrictMode>, document.getElementById('root'), ); App.js const authContext = useContext(AuthContext); const { loadUser } = authContext; useEffect(() => { loadUser(); }, []); loadUser const loadUser = async () => { const token = sessionStorage.getItem('token'); if (!token) { dispatch({ type: ERROR, }); } setAuthToken(token); try { const res = await axios('/api/auth'); dispatch({ type: USER_LOADED, payload: res.data.data, }); } catch (err) { console.error(err); } }; What are the benefits of new JSX transform? There are three major benefits of new JSX transform, - It is possible to use JSX without importing React packages - The compiled output might improve the bundle size in a small amount - The future improvements provides the flexibility to reduce the number of concepts to learn React. How does new JSX transform different from old transform? The new JSX transform doesn’t require React to be in scope. i.e, You don't need to import React package for simple scenarios. Let's take an example to look at the main differences between the old and the new transform, Old Transform: import React from 'react'; function App() { return <h1>Good morning!!</h1>; } Now JSX transform convert the above code into regular JavaScript as below, import React from 'react'; function App() { return React.createElement('h1', null, 'Good morning!!'); } New Transform: The new JSX transform doesn't require any React imports function App() { return <h1>Good morning!!</h1>; } Under the hood JSX transform compiles to below code import { jsx as _jsx } from 'react/jsx-runtime'; function App() { return _jsx('h1', { children: 'Good morning!!' }); } Note: You still need to import React to use Hooks. Discussion (32) Wow, what a resource. Thanks so much for putting this together. Perfect for interview prep and as a quick reference. Great job Mikhail! github.com/sudheerj/reactjs-interv... Thank you very much, Jon. I appreciate that 🙏 સરસ Omg, you made my 3,000+ word post on React interview questions (with answers) look short 😳 Our articles hugest longreads 😁 That’s why I’ve decided to create project with questions. Here it is: iq.js.org/ If you want, you can add your questions there too Great idea 💡 You're more than welcome to copy my questions and answers but please can you add a link to and credit me over at scrimba.com/articles/react-intervi... github.com/sudheerj/reactjs-interv... What is this? This is react question. i first found this question from github. Their explanation is better. you can read from there. . . . Holy cow! Mindblowing! super useful💥 Wow. That's a tremendous post Mikhail. Go treat yourself, you deserve it Awsome. Thankyou sir for this Great list of React questions! This would be great for beginners, or as a general React reference point. Nice my friend! :)
https://practicaldev-herokuapp-com.global.ssl.fastly.net/sakhnyuk/300-react-interview-questions-2ko4
CC-MAIN-2021-49
refinedweb
3,245
50.43
5.1 Life cycle of ASP.NET page The life cycle of the ASP.NET page specifies how the page is instantiated and processed to generate the specific output. There are different phases through which the page processing before rendering the output on web. The life cycle of the ASP.NET can be divided into two parts as follows: - Application Life cycle - Page Life cycle 1) Application Life cycle: In the application life cycle, the event is raised by the application. User must create a file Global.asax in the root directory of the application. The Global.asax file is derived from HttpApplication class. The HttpApplication class processes one request at a time. The events in the Global.asax file are automatically bind by the ASP.NET application. There are several Application methods of Application. The description of these methods and events are mentioned below: - Application_Start: The method is called only once during the life cycle of an application. The method is useful for performing tasks as loading data and initializing static values. The static data can be set only at the start of the application. - Application_Error: The method can be used to raise during any phase of the application life cycle. - Application_BeginRequest: The event is called when the exception is thrown. The event is called only when the first module raises an exception. - Application_EndRequest: The event is raised for every request in the application. It is used to clean up the resources in the application. - Init: It is called when all the modules for an application are created. - Dispose: It is called for destroying the resources of the application. The method can manually release the resources. - Application_End: The event is called once in the lifetime of the application. It is executed before the application is unloaded. 2) Page Life Cycle: The ASP.NET page when executed goes through a life cycle performing the processing steps. The life cycle of the ASP.NET page is mentioned below: - Page request: The page request occurs before the life cycle of the page executed. ASP.NET checks whether the page needs to be parsed or cached version to be sent to the user. - Start: The page properties Request and Response values are set in the Start phase of the page. IsPostBack and UICulture property are set in the Start method. - Initialization: In the Initialization phase, controls are available on the page. Every control has Unique ID property. - Load: During the load phase, the request is post back and control properties are loaded with information. - Rendering: The view state of the controls on the page is saved before rendering on the server. The page calls the Render method for every control. - Unload: The event is raised after the control is completely rendered. The Request and Response properties are unloaded and cleanup is performed. The life cycle of ASP.NET page is as below: - PreInit: The event is raised before the start stage of the page is completed and the initialization phase has started. - Init: The Init event is raised after all controls are initialized. It is used to read or initialize the properties of the control. - InitComplete: The event is raised after all initialization stage of the page is completed. It is used to make changes to view state before post back occurs. - PreLoad: The event is raised after the page loads view state for all controls. - Load: The OnLoad method is called on the Page object. It is repeated for the child control present on the page. - LoadComplete: The event is raised at the end of the event handling state. - PreRender: It is raised after the Page object has created all controls. The PreRender event is raised for all controls and every child control on the page. - SaveStateComplete: The event is raised after view state and control state are saved for the page. - Render: The event is used to write the control markup to send to the browser. - Unload: The event is raised for every control and for the page itself. - The example of the Page life cycle and output is shown below: namespace demo1 { public partial class WebForm3: System.Web.UI.Page { protected void Page.PreInit ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “Preint”; } protected void Page.Init ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “PageInit”; } protected void Page.InitComplete ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “PageInit”; } protected void Page.OnPreLoad ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “PreLoad”; } protected void Page.Load ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “Load”; } protected void Page.LoadComplete ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “LoadComplete”; } protected void Page.OnPreRender ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “OnPreRender”; } protected void Page.OnSaveStateComplete ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + ”SaveStateComplete; } protected void Page.UnLoad ( object sender, EventArgs e) { Lbl2.Text=Lbl2.Text + “<br/>” + “Unload”; } } } The output of the code is as shown below: 5.2 State Management of the Control When a new page is created and posted to the server, all the controls and information in the specific page is sent to the server. The information in the page is lost after the round trip of the page from the browser/client to the server. There are several states used for preserving the page data during the execution of the round trip. The state management feature provides the user to preserve the control state. The list of state management control is as mentioned below: - View State - Control State - Hidden Fields - Cookies - Query string - Application state - Session state - Profile Properties View State: The view state property is used to retain the values between multiple page requests. It is the default method of the page. The control and page properties are preserved and restored for the user whenever required. Every control is encoded and sent to the server in an hidden field as ‘_VIEWSTATE’. It serializes the data for every control on the web page. It is not secure to store sensitive data in the View state. The code in the View state can be easily de-serialized. The encryption of the code can be maintained on the server side to ensure the security. The View state can be enabled or disabled for the control or the page. To disable the View state of the control, set the ViewStateMode property of the control to disabled state. To disable the view state of the page, set the EnableViewState of the @Page directive to disabled. A sample code for adding the attribute to the Page and Control is as mentioned below: For Page Directive <%@ Page Language=”C#” EnableViewState=”True” ViewStateMode=Disabled” ….%> Code for Control <asp:TextBox tunat=”server” ViewStateMode=”Enabled” ….. /> 2. Control State: In the Control State, the data of the control is stored. The Control state property allows the user to persist property information of the control. The ViewState property is turned off at the page level in View State of the control. However in Control state, the ViewState property is not turned off. 3. Hidden Fields: The Hidden field control is used to store information that renders as an HTML hidden field on the server. It is used as storage for page information to be directly added to the page. The contents in the Hidden field can be easily modified by another user. Hence, sensitive information is avoided in the control. The content of the Hidden field are sent in the HTTP form collection. The hidden fields must be submitted using the HTTP POST method. The control holds a single value in the Value property. 4. Cookies: Cookies are used to store data in a text file or in the system memory for the browser session. It contains the information of the web application when the user visits the site. Cookies can be temporary or persistent. The cookies are saved on the users system and can be sent to the server through the request information. Cookies can be added using the Response object. The Response.Cookies collection is used or adding the cookie information. There are two ways to add cookies in the application. A sample code for adding cookies is mentioned below: Method 1: Response.Cookies(“userName”).Value=”Sam” Response.Cookies(“userName”).Expires = DateTime.Now.AddDays(2) Method 2: HttpCookie c1 = new HttpCookie ( “pagevisited”) c1.Value = DateTime.Now.ToString c1.Expires = DateTime.Now.AddDays(2) Response.Cookies.Add(c1) The Expires property informs the browser that the cookie will expire after the specified time in the parameter list. The expiration value cannot be retrieved back through the Request object. The browser applies limitations to the cookies to be stored on the system. Depending on the browser, the cookie limitations are applied. 5. Query String: The query string is the information appended at the end of the URL. An example of query string is as shown below: In the URL path mentioned above, the query string starts with a question mark. It contains two attribute/value pairs in the link. One of the attribute is item and other is for cost. It is easy to pass information from one page to another through the query string object. The sensitive data cannot be sent through the query string as it is easy for another user to change the data. The components mentioned below are server based state management controls. 6. Application State: The application state is used for storing information that is shared among users. Application state is stored in Application key/value dictionary. ASP.NET provides three events for initialization of Application variable. The details of the variables is mentioned below: - Application_Start: It is raised when the application starts. The application variables are places in this event. - Application_End: It is raised when the application shuts down. It is used for releasing resources from the application. - Application_Error: It is raised when an unhandled error occurs. The error logging is performed through this event. The advantages of using the Application state are as follows: - Simple implementation: Application state is user friendly, consistent with other .Net framework classes. - Application scope: Only one copy of the information is saved for the complete application developed by the user. The disadvantages of Application State are as mentioned below: - Resource requirements: Server variables are required by the Application state. The server performance gets affected and the scalability of the application is poor. - Limited durability of data: The Application state stored global data and it is volatile. The data can be affected if there are server crash, upgrade, or shutdown. A sample code to add and retrieve data is mentioned below: //Code to store information in application state lock ( this ) { Application [“Name”] = “John”; } //code sample to retrieve data lock ( this ) { String str1 = Application[“Name”].ToString(); } 7. Session State: The Session state is used for storing values that will be visible across all the pages. The values are stored in the memory of Session state till they are explicitly removed or the Session gets expired. The data life of values stored in the Session state is limited and specified for the particular session. The advantages of the Session state are as follows: - Extensibility: The session state can be extended by creating a session state provider. The data can be stored in the custom format depending on the storage mechanism implemented. - Cookieless support: Session state works with browsers that do not provide HTTP cookies. - Platform scalability: Session state can be used in multi computer and multi process configurations. - Data persistence: The data stored in the Session state can be persisted across multiple processes in the system. - Session specific events: The Session management events can be raised and used by the application. - Simple implementation: It is easy to use as the ASP developers find it similar to use. The disadvantage of the Session state is its Performance considerations. The session state variables are in memory till they are removed or replaced by the user. The performance of the server is affected. A sample code of the Session state is shown below: //Code to store information in Session state Session [ “Name” ] =”John”; //code sample to retrieve data string str1 = Session [ “Name” ]; 8. Profile Properties: Profile properties allows user to store specific data. The profile data is not lost even if the session expires. The data stored is persistent and associated with the user. The information can be easily managed without creating a new database. The advantages of Profile Properties are as follows: - Platform scalability: It can be used in multi computer and multi process configuration. It optimizes the scalability of the code. - Data persistence: The data is preserved through IIS restarts and process restarts. The data is stored in external mechanism. - Extensibility: User must configure a profile provider. The provider class stores the profile data. The disadvantages of Profile Properties are as follows: - Data maintenance: The data in profile properties needs to be maintained by the user. There are appropriate cleanup mechanisms provided by the profile properties to maintain data. - Performance considerations: They are slower than session state as the data is stored in memory and is persisted in the data store. - Additional configuration requirements: They require configuration for the use. The profile properties and profile provider must be configured by the user. The syntax of Profile properties is mentioned below: <profile> <properties> <add item = “item name” /> </properties> </profile> 3.3 Controls raising events Event are actions performed by the specific control in an application. Every ASP.NET control has an event associated with it. But when a user creates a control the event for the control needs to be explicitly defined. The steps for raising an event through the user control are as follows: 1) Drop a User Control into the .ascx page. Add the member variable to the container class by using the following code: protected MyControl MyControl1; where MyControl1 is the user control created by the user in the system. 2) Define an event in the control class of the application. public Event MyEvent as System.EventHandler; where MyEvent is the event created by the user. The event will perform the action depending on the control created by the user. 3) Raise the event in the function of the control class RaiseEvent MyEvent (Me, New EventArgs()) where user raises an event for the control created. 4) Create a delegate for the event specified by the user public delegate void delegate name( object sender, EventArgs e); here the delegate acts as a pointer for the respective event raised by the user. 5) The method and delegate signature defined must be the same. Wire up the event with the delegate defined in the application. protected MyControl1_MyEvent(object sender, System.EventHandler e) {} More details regarding the topic will be discussed in later chapters. 3.4 Event Handling in Web Forms Event handlers in ASP.NET take two parameters and return void data type. The syntax of the event in ASP.NET is as mentioned below: where first parameter is the object raising event and the second parameter is the event argument. There are events related to the page and control in ASP.NET. The list of the events is mentioned below: Control events in ASP.NET - Disposed: The event is raised when the control is released. - DataBinding: The event is raised when a control binds to the data source Page events in ASP.NET - Init: The event is raised when the controls on the page are initialized. - Load: The event is raised when the page is loaded in the system. - Error: The event is raised when an unhandled exception is thrown. - PreRender: The event is raised when the control is to be rendered. - Unload: The event is raised when the control is unloaded from the page. Default events in ASP.NET Every control in ASP.NET has an event associated with it. The default event can be added in the application by double clicking on the control added in the design view of the page. The list of controls and default events associated with them are as follows: Events that cause the form to post back immediately to the server are called postback events. The server needs to give immediate response to the user for the event. Events that are not posted back immediately to the server are called non postback events. By setting the AutoPostBack property to true the events can be posted immediately to the server. The example of checkbox control demonstrates the event handling in ASP.NET. The checkbox control raises the Check Changed event by double clicking the control. The source code of the control is shown below: <html xmlns=””> <head runat=”server”> <title></title> </head> <body> <form id=”form1” runat=”server”> <div> <asp:CheckBoxID=”CheckBox1” runat=”server” Text=”SQL” AutoPostBack=”true” oncheckedchanged=”CheckBox1_CheckedChanged” /> <br/> <asp:CheckBoxID=”CheckBox2” runat=”server” Text=”SQL” AutoPostBack=”true” oncheckedchanged=”CheckBox2_CheckedChanged” /> <br/> <asp:CheckBoxID=”CheckBox3” runat=”server” Text=”SQL” AutoPostBack=”true” oncheckedchanged=”CheckBox3_CheckedChanged” /> <br/> <asp:ListBox ID=”ListBox1” runat=”server” ></asp:ListIBox> </div> </form> </body> </html> In the code behind page, when the user selects value from the checkbox the value must be added to the List Box control. The code for the same is shown below: protected void CheckBox1_CheckedChanged( object sender, EventArgs e ) { if ( CheckBox1.Checked == true ) { ListBox1.Items.Add(CheckBox1.Text); } } protected void CheckBox2_CheckedChanged( object sender, EventArgs e ) { if ( CheckBox2.Checked == true ) { ListBox1.Items.Add(CheckBox2.Text); } } protected void CheckBox3_CheckedChanged( object sender, EventArgs e ) { if ( CheckBox3.Checked == true ) { ListBox1.Items.Add(CheckBox3.Text); } } The output of the code when executed on the server is shown below: Another example of event handling is explained considering calendar control. The Selection Changed event is raised for the Calendar control. The source code of the control is shown below: <html xmlns=”” > <head runat=”server”> <title></title> </head> <body> <form id=”form1” runat=”server”> <div> <asp:CalendarID=”Calendar1”runat=”server” onselectionchanged=”Calendar1_SelectionChanged” BackColor=”Aqua” BorderColor=”Red” > </asp:Calendar> <br/> <asp:TextBox ID=”TextBox1” runat=”server” ></asp:TextBox> </div> </form> </body> </html> The code behind file contains the code for entering the value in the textbox control after selecting it from the calendar control. protected void Calendar1_SelectionChanged( object sender, EventArgs e) { TextBox1.Text = “selected data”+Calendar1.SelectedDate; } The output of the code when executed by the system is shown below:
http://wideskills.com/aspnet/aspnet-architecture
CC-MAIN-2021-10
refinedweb
3,034
58.28
Advertising On 01/13/2017 06:34 AM, Martin von Zweigbergk via Mercurial-devel wrote: On Thu, Jan 12, 2017 at 9:24 PM, Matt Harbison <mharbiso...@gmail.com> wrote:# HG changeset patch # User Matt Harbison <matt_harbi...@yahoo.com> # Date 1483850135 18000 # Sat Jan 07 23:35:35 2017 -0500 # Node ID 2060486431053a99eafa4234aea139f6a31dc2d7 # Parent 29cbe16c5cccf600fae928df52dbd44171096a6f help: eliminate duplicate text for revset string patterns There's no reason to duplicate this so many times, and it's likely an instance will be missed if support for a new pattern is added and documented. The stringmatcher is mostly used by revsets, though it is also used for the 'tag' related templates, and namespace filtering in the journal extension. So maybe there's a better place to document it. `hg help patterns` seems inappropriate, because that is all file pattern matching. While here, indicate how to perform case insensitive regex searches. That series is pushed. Thanks. diff --git a/mercurial/help/revsets.txt b/mercurial/help/revsets.txt --- a/mercurial/help/revsets.txt +++ b/mercurial/help/revsets.txtThis file no longer exists. I merged it into revisions.txt very recently, so you should probably rebase this series on top of @ from the "committed" repo () and resend. Sorry. I've renamed the file in the patch and it applied like a charmed. Thank for the pointer.I've renamed the file in the patch and it applied like a charmed. Thank for the pointer. Cheers, -- Pierre-Yves David _______________________________________________ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org
https://www.mail-archive.com/mercurial-devel@mercurial-scm.org/msg05320.html
CC-MAIN-2017-04
refinedweb
254
50.23
If you need a collection of objects accessed by a key, and the key is one of the object’s properties, then you should use the KeyedCollection class instead of Dictionary. For example, you would use a KeyedCollection to store Employee objects accessed by the employee’s ID property. The KeyedCollection class is a hybrid between an IList and IDictionary. Like the IList, KeyedCollection is an indexed list of items. Like the IDictionary, KeyedCollection has a key associated with each item. But unlike dictionaries, KeyedCollection is not a collection of key/value pairs; rather, the item is the value and the key is embedded within the value. As a result, KeyedCollection provides O(1) indexed retrieval and keyed retrieval that approaches O(1), meaning that item lookup is very fast. The KeyedCollection class is defined in the in the System.Collections.ObjectModel namespace. KeyedCollection is an abstract base class that you must override and implement the GetKeyForItem method, which extracts the key from the item. Following is a simple console program that creates a collection of Employee objects accessed by the employee’s integer ID property: using System; using System.Collections.ObjectModel; namespace KeyedCollection { class Program { static void Main( string[] args ) { EmployeeCollection employees = new EmployeeCollection(); employees.Add( new Employee( 1, "Joe" ) ); employees.Add( new Employee( 2, "Jim" ) ); employees.Add( new Employee( 3, "Jane" ) ); if (employees.Contains( 3 )) { Employee emp = employees[3]; Console.WriteLine( "Employee ID={0}, Name={1}", emp.ID, emp.Name ); } Console.ReadLine(); } } class Employee { public Employee( int id, string name ) { this.ID = id; this.Name = name; } public readonly int ID; public string Name; } class EmployeeCollection : KeyedCollection<int,Employee> { protected override int GetKeyForItem( Employee item ) { return item.ID; } } } By default, KeyedCollection includes a lookup dictionary. When an item is added to a KeyedCollection, the item’s key is extracted and saved in the lookup dictionary for faster searches. You can override this behavior by specifying a “dictionary creation threshold” in the KeyedCollection constructor. If you specify a threshold greater than zero, the lookup dictionary is not created until the number of items reaches that threshold. If you specify –1 as the threshold, the lookup dictionary is never created. The default dictionary creation threshold is zero, meaning the dictionary is created when the first item is added. When the lookup dictionary is used, it copies the items into the dictionary, therefore it is better suited for reference types than value types due to boxing/unboxing overhead. For best efficiency, you may want to specify a dictionary creation threshold of 5-10. Keys in a KeyedCollection must be unique and cannot be null. Notice in the example code above, the Employee’s ID property is marked “readonly,” meaning that it is immutable and cannot be changed. Typically you do not want to modify your keys, otherwise the key in the item will get out of sync with the key in the KeyedCollection. However, if you must modify a key, be sure to call the ChangeItemKey method. Be careful when using the Contains method. For a KeyedCollection<TKey,TItem>, there is the Contains<TItem> method provided by the base Collection<T> class, and there is the Contains<TKey> method provided by the KeyedCollection class. The latter method is the correct one, meaning you should always check for the key when calling the Contains method. This is apparently by design, as stated in this Microsoft bug report. Hi: Nice article. While I’ve gotten a corresponding example to work based upon your example, I haven’t been able to get one to work where the collection key is itself a class (I’ve been experimenting with key class containing two longs). I’m fairly sure I need to override the indexer (public TItem this[ Tkey key ] {get;}) but I don’t see what needs to be put into the accessor for efficient access, other than some kind of for loop (which seemed like it would defeating the purpose of an efficient lookup). Could you point out what I’m missing? Thanks in advance. This really helped., thanks
https://www.csharp411.com/keyedcollection-dictionary-for-values-with-embedded-keys/
CC-MAIN-2021-43
refinedweb
674
55.84
Rails API to React/Redux with Hooks Heroes and Villains This post will walk through a quick build of a Ruby on Rails API and a React/Redux front end. On the front end, we will add Redux to it to enable a global state, which can be accessed by all components within the App, regardless of nesting level. Redux thunk middleware will be used to help make asynchronous network requests and React Hooks will be used to dispatch actions to update and retrieve data from the Redux global store. The Rails Back End This tutorial assumes that you have rails installed. Check this Getting Started with Rails guide if you are new to Rails. Create a new api with rails at the command line. Make the database postgresql and flip the api switch so that rails front end code related wont be generated (views). $ rails new hero_api — database=postgresql — api Create a user named, “hero_api”, to act as the user to connect to the database for this app. The database is also called hero_api in this case. Note password used for hero_api user here. $ sudo adduser hero_api Make hero_api user be a root user (optional): $ sudo usermod -aG sudo hero_api Impersonate the postgres user on your system and create the hero_api database and hero_api database user (not the same as the system user). $ su — postgres $ createuser hero_api $ createdb hero_api Now there is a database user called “hero_api” and a database called, “hero_api”. Next, provide the privileges to hero_api user within sql: postgres@computer:~$ psql postgres=# alter user hero_api with encrypted password '<password>'; postgres=# grant all privileges on database hero_api to hero_api; Now the user, “hero_api”, has full privileges on the database, “hero_api”. Confusing, I know. Naming the user and the database with the same name seems to be convention. Exit out of psql with ‘exit’, then $ exit to stop impersonating postgres. Next, edit config/database.yml to add credentials for the user, hero_api. Fill in the development areas to match the hero_api user above. development: adapter: postgresql encoding: unicode database: hero_api pool: 5 username: hero_api password: <password> Scaffold two models, one for Hero and one for Villain. In our little universe, a hero has many villains and a villain has only one hero. Well give our heros and villains a name and img_url (link to an image photo of them). If all goes well, the db:migrate will create Hero and Villain models. $ rails g scaffold Hero name:string img_url:string $ rails g scaffold Villain name:string img_url:string hero:references $ rake db:migrate Next, we will create some heroes and villains in our universe with the rails console. $ rails c > b = Hero.new > b. b. b.save > j = Villain.new > j. j. j.hero = b > j.save Don’t forget to set up the rack-cors middleware, so that API requests can come through easily. Add the following in /config/application.rb /config/application.rbmodule HeroApi ... class Application < Rails::Application config.middleware.insert_before 0, Rack::Cors do allow do origins ‘*’ resource ‘*’, :headers => :any, :methods => [:get, :patch, :delete, :options] end end end Now we have a REST API capable of CRUD operations on Heroes and Villains. Start up the service: $ RAILS_ENV=development rails s I went ahead and put the API up on Heroku, so it can be hit live. Here’s an example API call to get the hero with id = 1 So, the following routes are functional. Fire away and make some new heroes and villains in our universe. GET heros GET villains GET hero Get villain POST create hero POST create villian Want to spin up your own rails back end? The Github repository can be found at: The React/Redux Front End The plan is to use the React library for the front end. We’ll include Redux to act as our front end global state. Also, we’ll use functional components with React hooks to initiate requests to our API populate populate the global state with data received from the API. The component will display data from the populated Redux store. First off, start a totally new project in a new folder with create-react-app: $ npx create-react-app heros_fe $ cd heros_fe $ npm install Install the redux, react-redux, and redux thunk: $ npm install redux react-redux redux-thunk Redux will give our app the ability to have a global store or state that can be easily shared across components. Components can “select” from the Redux store or dispatch actions on it, which, when paired with a Reducer update the global state. Redux is useful for when an application becomes complex and many different parts of it needs to access and make updates to the global state. The Redux pattern also brings the asynchronous network calls to APIs to a single entry point in the code through actions and reducers. This makes network calls easier to maintain and less buggy. Redux is separate from React, which is why the react-redux package is also necessary. The redux-thunk middleware gives the ability for actions to be asynchronous, as is the case here when calling an API. From their github repo: “…the redux-thunk middleware extends the redux store’s abilities, and lets you write async logic that interacts with the store.” Setup and boilerplate Redux has a bit of boilerplate setup 😐, but once you get it going, it becomes more clear. In the /src folder create two sub-folders, actions and reducers: /src/actions /src/reducers Inside of the actions folder, create a file called index.js with the following 3 constants. /src/actions/index.js:export const FETCH_HEROS_REQUEST = 'FETCH_HEROS_REQUEST' export const FETCH_HEROS_SUCCESS = 'FETCH_HEROS_SUCCESS' export const FETCH_HEROS_FAILURE = 'FETCH_HEROS_FAILURE' This is the set of action types that will be used to fetch the heros (misspelling intentional) from the API in the following order: 1. make the request (FETCH_HEROS_REQUEST) 2. request succeeds (FETCH_HEROS_SUCCESS) 3. request hits an error (FETCH_HEROS_FAILURE) Think of actions like events that “reducers” respond to. So, let’s make the hero reducer. Create a heroReducer.js file next in /src/reducers/heroReducer.js. This is where the updates to the Redux global store are made, depending on the action.type. /src/reducers/heroReducer.js:import { FETCH_HEROS_REQUEST, FETCH_HEROS_SUCCESS, FETCH_HEROS_FAILURE } from “../actions/”const initialState = { heros: {}, isLoading: false }export default (state = initialState, action) => { switch(action.type) { case FETCH_HEROS_REQUEST: return { …state, isLoading: true } case FETCH_HEROS_SUCCESS: return { …state, isLoading: false, heros: action.payload } case FETCH_HEROS_FAILURE: return { …state, isLoading: false, error: action.payload } default: . Make the contents of this action to be the following: return state } } First, notice that in in heroReducer.js the three action types are referenced: FETCH_HEROS_REQUEST, FETCH_HEROS_SUCCESS, and FETCH_HEROS_FAILURE. When each of these action types occur, a portion global state will be updated. Second, a const object called initialState is created. This represents the initial state of heroReducer portion of the Redux global store when it is instantiated. Notice that the initial values for hero is {} (an empty object) and isLoading is set to false. Next, the default function switches its return value based on the action.type being passed. With each type, a different portion of the Redux heroReducer global state is is updated. For example, if a FETCH_HEROS_REQUEST is made, only the isLoading flag is switched to true in the global state, the rest of the state remains unchanged. This isLoading flag can be used to display a loading message or spinner to the user while the asynchronous communication is being made to the API. Accordingly, if FETCH_HEROS_SUCCESS is the action.type, the loading flag is set to false and the heros store value is updated with the payload that is sent from the action along with the call (all the heros). Finally, if an error occurs (FETCH_HEROS_FAILURE), the loading is set to false and the error property is populated with the error that came on the failed call. Now, create the following file in /src/actions/heroActions. This file contains the action creator functions with respect to heros. The fetchHeros function here dispatches the three action.types mentioned above when the fetchHeros is called: ed/src/actions/heroActions:import { FETCH_HEROS_REQUEST, FETCH_HEROS_SUCCESS, FETCH_HEROS_FAILURE } from './'export const fetchHeros = () => { return dispatch => { dispatch({ type: FETCH_HEROS_REQUEST })fetch(``, null) .then(res => { if(res.ok) { return res.json() } else { return Promise.reject(res.statusText) } }) .then((heros) => { return dispatch({ type: FETCH_HEROS_SUCCESS, payload: heros }) }) .catch((error) => { return dispatch({ type: FETCH_HEROS_FAILURE, payload: error }) }) } Notice that in the fetchHeros function the 3 actions are dispatched in turn… FETCH_HEROS_REQUEST …then FETCH_HEROS_SUCCESS if there is a successful call …then FETCH_HEROS_FAILURE if the call fails. Notice that there is no payload on FETCH_HEROS_REQUEST, but the payload is heros if the type is FETCH_HEROS_SUCCESS and the payload is the error if the the type is FETCH_HEROS_FAILURE. Next we have to do some more setup. Because the Redux store can be divided into many reducers, we need to combine them into a root reducer in /src/reducers/index.js /src/reducers/index.js import { combineReducers } from 'redux' import heroReducer from './heroReducer'const appReducer = combineReducers({ heroReducer })const rootReducer = (state, action) => { if (action.type === ‘CLEAR_DATA’) { state = undefined } return appReducer(state, action) }export default rootReducer In a complex app, there will be more reducers or portions of the store than just one like we have here. /src/reducers/index.js is the place where they all are combined in order to create the Redux global state. Finally, the rootReducer, the initalState, and the composed middlewares are used by the createStore function to create the store. Redux thunk is the middleware that allows for asynchronous requests. It uses a handy combineReducers function provided by Redux to combine different reducers and apply middlware. Here ‘redux-thunk’ middleware is applied when we combine all the reducers. /src/store.js:import { createStore, applyMiddleware, compose } from ‘redux’ import thunk from 'redux-thunk' import rootReducer from ‘./reducers’const initialState = {} const middleware = [thunk] const store = createStore( rootReducer, initialState, compose( applyMiddleware(…middleware), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__() ) )export default store Next, the app needs to be aware of Redux. We do this with the Provider from the react-redux package and wrap the whole <App/> in a Provider in /src/index.js, passing it the store, created above. /src/index.jsimport React from 'react' import ReactDOM from 'react-dom' import './index.css' import App from './App' import { Provider } from 'react-redux' import store from './store'ReactDOM.render( <React.StrictMode> <Provider store={ store }> <App /> </Provider> </React.StrictMode>, document.getElementById(‘root’)) Now, we can make a hero presentation component in /src/components. All this component does is render HTML with the hero’s name and img_url based on a required hero prop sent to it. /src/components/Hero.js:import React from 'react' import PropTypes from 'prop-types'const Hero = ({ hero }) => {return ( <div className=”hero”> { hero.name }<br/> <img src={ hero.img_url } width={100} /> </div> )}Hero.propTypes = { hero: PropTypes.object.isRequired }export default Hero Next, update App.js to the following: /src/App.jsimport React, { useEffect } from 'react' import { fetchHeros } from './actions/heroActions' import { useDispatch, useSelector } from 'react-redux' import Hero from './components/Hero'const App = () => { const dispatch = useDispatch() const heros = useSelector(state => state.heroReducer.heros) useEffect(() => { dispatch(fetchHeros()) }, []) const getHeros = () => { if(heros) { return heros.map((hero) => <Hero hero={ hero } />) } else { return "loading..." } } return ( <div className='App'> { getHeros() } </div> ) }export default App First, notice that the fetchHeros function is imported from heroActions. The useEffect hook is used to dispatch the fetchHeros function, which in turn dispatches a FETCH_HEROS_REQUEST action type and a FETCH_HEROS_SUCCESS or FETCH_HEROS_FAILURE depending on whether the request is successful or note. The useDispatch hook is imported from from react-redux to be able to dispatch(fetchHeros()) inside the useEffect callback. Similarly, the useSelector hook is used to assign a value from the Redux store to the const, heros. The useSelector hook returns a function that contains the current state of the Redux store. The heros const will be populated with the array of heros from the API when the FETCH_HEROS_SUCCESS action.type occurs. The array of heros from the payload of this action assigned to an array of heris then mapped to a collection of <Hero /> components and displayed within App.js. Here is our list of heros, from Postgres to Redux. The source for the front end can be found at:
https://will-carter.medium.com/reacting-redoing-learning-a643cf0a9966
CC-MAIN-2022-33
refinedweb
2,034
56.45
Any iOS device Would some Pythonista scholar provide a simple example of any type of "view" coded such it will stretch nicely to any iOS screen? iPad, iPhone 4, 5, 6+...... Also, in landscape modes.... I just want to understand the concept..... import ui mainview = ui.View() mainview.present() subview = ui.View(frame=mainview.bounds) mainview.add_subview(subview) subview.border_width = 5 subview.border_color = 'pink' subview.background_color = 'green' subview.flex = 'WH' Edit: Alternative suggested by @JonB below is useful because it formats the entire ui before presenting it to the user: import ui w, h = ui.get_screen_size() mainview = ui.View(frame=(0, 0, w, h)) subview = ui.View(frame=mainview.bounds) mainview.add_subview(subview) subview.border_width = 5 subview.border_color = 'pink' subview.background_color = 'green' subview.flex = 'WH' mainview.present() Orientation 'portrait-upside-down' seems to not work in Pythonista v1.6 Beta! The basic trick as ccc showed is to have your root/main view presented before you add any other subviews. That way, it gets sized to the fullScreen. Alternatively, set the frame size, add components, and set the flex properties, and then present. The tricky bit is getting everything flexing the way you want. Most likely, you will need to implement `layout(self)' inside a custom View, which would allow you to move components around depending on the new size. There are currently not many layout managers that make this easier (I started a flow layout, and a vbox/hBox layout here , but the inability to specify a preferred, minimum, and maximum frame size for a component makes good layout managers nearly impossible. This gives me an idea for an action menu script which takes the currently loaded View, and shows you what the currently loaded view would look like on different size devices. Can anyone with an iphone 5, iphone 6, iphone 6+, and/or iPad Air or retina tell me what you get for the following script, running in both landscape and portrait? The main question is whether the title bar is 64 px tall on all devices. import ui, time presentmodes=[('full_screen',True),('full_screen',False),('panel',True),('panel',False)] for m in presentmodes: v=ui.View() w=ui.WebView() v.add_subview(w) v.present(m[0],hide_title_bar=m[1]) orientation=w.eval_js('window.orientation') print m, orientation, v.frame time.sleep(1.0) v.close() time.sleep(1.0) time.sleep(1.0) print 'complete' JonB, iPhone 6+ Portrait: Landscape: Interesting -- so in landscape, the menu bar is only half as high on iphone? iPad Air 2 Landscape: <code>('full_screen', True) 90 (0.0, 0.0, 1024.0, 768.0)</code> <code>('full_screen', False) 90 (0.0, 64.0, 1024.0, 704.0)</code> <code>('panel', True) 90 (0.0, 0.0, 1024.0, 704.0)</code> <code>('panel', False) 90 (0.0, 0.0, 1024.0, 704.0)</code> <code>complete</code> iPad Air 2 Portrait: <code>('full_screen', True) 0 (0.0, 0.0, 768.0, 1024.0)</code> <code>('full_screen', False) 0 (0.0, 64.0, 768.0, 960.0)</code> <code>('panel', True) 0 (0.0, 0.0, 768.0, 960.0)</code> <code>('panel', False) 0 (0.0, 0.0, 768.0, 960.0)</code> <code>complete</code> - wradcliffe iPad 4 retina Landscape: ('full_screen', True) 90 (0.0, 0.0, 1024.0, 768.0) ('full_screen', False) 90 (0.0, 64.0, 1024.0, 704.0) ('panel', True) 90 (0.0, 0.0, 1024.0, 704.0) ('panel', False) 90 (0.0, 0.0, 1024.0, 704.0) complete iPad 4 retina Portrait: ('full_screen', True) 0 (0.0, 0.0, 768.0, 1024.0) ('full_screen', False) 0 (0.0, 64.0, 768.0, 960.0) ('panel', True) 0 (0.0, 0.0, 768.0, 960.0) ('panel', False) 0 (0.0, 0.0, 768.0, 960.0) complete @donnieh: The forums now support images?! There's always been a markdown image insertion button, but recently it stopped working. Wait, let me try: It worked! Pretty picture. First image that came up on Google Images with the search term "image" ;-)
https://forum.omz-software.com/topic/1618/any-ios-device/7
CC-MAIN-2021-49
refinedweb
675
60.72
Usage Boost.Bind offers a consistent syntax for both functions and function objects, and even for value semantics and pointer semantics. We'll start with some simple examples to get to grips with the usage of vanilla bindings, and then move on to functional composition through nested binds. One of the keys to understanding how to use bind is the concept of placeholders. Placeholders denote the arguments that are to be supplied to the resulting function object, and Boost.Bind supports up to nine such arguments. The placeholders are called _1, _2, _3, _4, and so on up to _9, and you use them in the places where you would ordinarily add the argument. As a first example, we shall define a function, nine_arguments, which is then called using a bind expression. #include <iostream> #include "boost/bind.hpp" void nine_arguments( int i1,int i2,int i3,int i4, int i5,int i6,int i7,int i8, int i9) { std::cout << i1 << i2 << i3 << i4 << i5 << i6 << i7 << i8 << i9 << '\n'; } int main() { int i1=1,i2=2,i3=3,i4=4,i5=5,i6=6,i7=7,i8=8,i9=9; (boost::bind(&nine_arguments,_9,_2,_1,_6,_3,_8,_4,_5,_7)) (i1,i2,i3,i4,i5,i6,i7,i8,i9); } In this example, you create an unnamed temporary binder and immediately invoke it by passing arguments to its function call operator. As you can see, the order of the placeholders is scrambled—this illustrates the reordering of arguments. Note also that placeholders can be used more than once in an expression. The output of this program is as follows. 921638457 This shows that the placeholders correspond to the argument with the placeholder's number—that is, _1 is substituted with the first argument, _2 with the second argument, and so on. Next, you'll see how to call member functions of a class. Calling a Member Function Let's take a look at calling member functions using bind. We'll start by doing something that also can be done with the Standard Library, in order to compare and contrast that solution with the one using Boost.Bind. When storing elements of some class type in Standard Library containers, a common need is to call a member function on some or all of these elements. This can be done in a loop, and is all-too-often implemented thusly, but there are better solutions. Consider the following simple class, status, which we'll use to show that the ease of use and power of Boost.Bind is indeed tremendous. class status { std::string name_; bool ok_; public: status(const std::string& name):name_(name),ok_(true) {} void break_it() { ok_=false; } bool is_broken() const { return ok_; } void report() const { std::cout << name_ << " is " << (ok_ ? "working nominally":"terribly broken") << '\n'; } }; If we store instances of this class in a vector, and we need to call the member function report, we might be tempted to do it as follows. std::vector<status> statuses; statuses.push_back(status("status 1")); statuses.push_back(status("status 2")); statuses.push_back(status("status 3")); statuses.push_back(status("status 4")); statuses[1].break_it(); statuses[2].break_it(); for (std::vector<status>::iterator it=statuses.begin(); it!=statuses.end();++it) { it->report(); } This loop does the job correctly, but it's verbose, inefficient (due to the multiple calls to statuses.end()), and not as clear as using the algorithm from the Standard Library that exists for exactly this purpose, for_each. To use for_each to replace the loop, we need to use an adaptor for calling the member function report on the vector elements. In this case, because the elements are stored by value, what we need is the adaptor mem_fun_ref. std::for_each( statuses.begin(), statuses.end(), std::mem_fun_ref(&status::report)); This is a correct and sound way to do it—it is quite terse, and there can be no doubt as to what the code is doing. The equivalent code for doing this using Boost.Bind follows. [1] std::for_each( statuses.begin(), statuses.end(), boost::bind(&status::report,_1)); This version is equally clear and understandable. This is the first real use of the aforementioned placeholders of the Bind library, and what we're telling both the compiler and the reader of our code is that _1 is to be substituted for an actual argument by the function invoking the binder. Although this code does save a few characters when typing, there is no big difference between the Standard Library mem_fun_ref and bind for this particular case, but let's reuse this example and change the container to hold pointers instead. std::vector<status*> p_statuses; p_statuses.push_back(new status("status 1")); p_statuses.push_back(new status("status 2")); p_statuses.push_back(new status("status 3")); p_statuses.push_back(new status("status 4")); p_statuses[1]->break_it(); p_statuses[2]->break_it(); We can still use both the Standard Library, but we can no longer use mem_fun_ref. We need help from the adaptor mem_fun, which is considered a bit of a misnomer, but again does the job that needs to be done. std::for_each( p_statuses.begin(), p_statuses.end(), std::mem_fun(&status::report)); Although this works too, the syntax has changed, even though we are trying to do something very similar. It would be nice if the syntax was identical to the first example, so that the focus is on what the code really does rather than how it does it. Using bind, we do not need to be explicit about the fact that we are dealing with elements that are pointers (this is already encoded in the type of the container, and redundant information of this kind is typically unnecessary for modern libraries). std::for_each( p_statuses.begin(), p_statuses.end(), boost::bind(&status::report,_1)); As you can see, this is exactly what we did in the previous example, which means that if we understood bind then, we should understand it now, too. Now that we have decided to switch to using pointers, we are faced with another problem, namely that of lifetime control. We must manually deallocate the elements of p_statuses, and that is both error prone and unnecessary. So, we may decide to start using smart pointers, and (again) change our code. std::vector<boost::shared_ptr<status> > s_statuses; s_statuses.push_back( boost::shared_ptr<status>(new status("status 1"))); s_statuses.push_back( boost::shared_ptr<status>(new status("status 2"))); s_statuses.push_back( boost::shared_ptr<status>(new status("status 3"))); s_statuses.push_back( boost::shared_ptr<status>(new status("status 4"))); s_statuses[1]->break_it(); s_statuses[2]->break_it(); Now, which adaptor from the Standard Library do we use? mem_fun and mem_fun_ref do not apply, because the smart pointer doesn't have a member function called report, and thus the following code fails to compile. std::for_each( s_statuses.begin(), s_statuses.end(), std::mem_fun(&status::report)); The fact of the matter is that we lucked out—the Standard Library cannot help us with this task. [2] Thus, we have to resort to the same type of loop that we wanted to get rid of—or use Boost.Bind, which doesn't complain at all, but delivers exactly what we want. std::for_each( s_statuses.begin(), s_statuses.end(), boost::bind(&status::report,_1)); Again, this example code is identical to the example before (apart from the different name of the container). The same syntax is used for binding, regardless of whether value semantics or pointer semantics apply, and even when using smart pointers. Sometimes, having a different syntax helps the understanding of the code, but in this case, it doesn't—the task at hand is to call a member function on elements of a container, nothing more and nothing less. The value of a consistent syntax should not be underestimated, because it helps both the person who is writing the code and all who later need to maintain the code (of course, we don't write code that actually needs maintenance, but for the sake of argument, let's pretend that we do). These examples have demonstrated a very basic and common use case where Boost.Bind excels. Even though the Standard Library does offer some basic tools that do the same thing, we have seen that Bind offers both the consistency of syntax and additional functionality that the Standard Library currently lacks. A Look Behind the Curtain After you start using Boost.Bind, it is inevitable; you will start to wonder how it actually works. It seems as magic when bind deduces the types of the arguments and return type, and what's the deal with the placeholders, anyway? We'll have a quick look on some of the mechanisms that drives such a beast. It helps to know a little about how bind works, especially when trying to decipher the wonderfully succinct and direct error messages the compiler emits at the slightest mistake. We will create a very simple binder that, at least in part, mimics the syntax of Boost.Bind. To avoid stretching this digression over several pages, we shall only support one type of binding, and that is for a member function taking a single argument. Moreover, we won't even get bogged down with the details of how to handle cv-qualification and its ilk; we'll just keep it simple. First of all, we need to be able to deduce the return type, the class type, and the argument type for the function that we are to bind. We do this with a function template. template <typename R, typename T, typename Arg> simple_bind_t<R,T,Arg> simple_bind( R (T::*fn)(Arg), const T& t, const placeholder&) { return simple_bind_t<R,T,Arg>(fn,t); } The preceding might seem a little intimidating at first, and by all rights it is because we have yet to define part of the machinery. However, the part to focus on here is where the type deduction takes place. You'll note that there are three template parameters to the function, R, T, and Arg. R is the return type, T is the class type, and Arg is the type of the (single) argument. These template parameters are what makes up the first argument to our function—that is, R (T::*f)(Arg). Thus, passing a member function with a single formal parameter to simple_bind permits the compiler to deduce R as the member function's return type, T as the member function's class, and Arg as the member function's argument type. simple_bind's return type is a function object that is parameterized on the same types as simple_bind, and whose constructor receives a pointer to the member function and an instance of the class (T). simple_bind simply ignores the placeholder (the last argument to the function), and the reason why I've included it in the first place is to simulate the syntax of Boost.Bind. In a better implementation of this concept, we would obviously need to make use of that argument, but now we allow ourselves the luxury of letting it pass into oblivion. The implementation of the function object is fairly straightforward. template <typename R,typename T, typename Arg> class simple_bind_t { typedef R (T::*fn)(Arg); fn fn_; T t_; public: simple_bind_t(fn f,const T& t):fn_(f),t_(t) {} R operator()(Arg& a) { return (t_.*fn_)(a); } }; As we saw in simple_bind's implementation, the constructor accepts two arguments: the first is the pointer to a member function and the second is a reference to const T that is copied and later used to invoke the function with a user-supplied argument. Finally, the function call operator returns R, the return type of the member function, and accepts an Arg argument, which is the type of the argument to be passed to the member function. The somewhat obscure syntax for invoking the member function is this: (t_.*fn_)(a); .* is the pointer-to-member operator, used when the first operand is of class T; there's also another pointer-to-member operator, ->*, which is used when the first operand is a pointer to T. What remains is to create a placeholder—that is, a variable that is used in place of the actual argument. We can create such a placeholder by using an unnamed namespace containing a variable of some type; let's call it placeholder: namespace { class placeholder {}; placeholder _1; } Let's create a simple class and a small application for testing this. class Test { public: void do_stuff(const std::vector<int>& v) { std::copy(v.begin(),v.end(), std::ostream_iterator<int>(std::cout," ")); } }; int main() { Test t; std::vector<int> vec; vec.push_back(42); simple_bind(&Test::do_stuff,t,_1)(vec); } When we instantiate the function simple_bind with the preceding arguments, the types are automatically deduced; R is void, T is Test, and Arg is a reference to const std::vector<int>. The function returns an instance of simple_bind_t<void,Test,Arg>, on which we immediately invoke the function call operator by passing the argument vec. Hopefully, simple_bind has given you an idea of how binders work. Now, it's time to get back to Boost.Bind! More on Placeholders and Arguments The first example demonstrated that bind supports up to nine arguments, but it will serve us well to look a bit more closely at how arguments and placeholders work. First of all, it's important to note that there is an important difference between free functions and member functions—when binding to a member function, the first argument to the bind expression must be an instance of the member function's class! The easiest way to think about this rule is that this explicit argument substitutes the implicit this that is passed to all non-static member functions. The diligent reader will note that, in effect, this means that for binders to member functions, only (sic!) eight arguments are supported, because the first will be used for the actual object. The following example defines a free function print_string and a class some_class with a member function print_string, soon to be used in bind expressions. #include <iostream> #include <string> #include "boost/bind.hpp" class some_class { public: typedef void result_type; void print_string(const std::string& s) const { std::cout << s << '\n'; } }; void print_string(const std::string s) { std::cout << s << '\n'; } int main() { (boost::bind(&print_string,_1))("Hello func!"); some_class sc; (boost::bind(&some_class::print_string,_1,_2)) (sc,"Hello member!"); } The first bind expression binds to the free function print_string. Because the function expects one argument, we need to use one placeholder (_1) to tell bind which of its arguments will be passed as the first argument of print_string. To invoke the resulting function object, we must pass the string argument to the function call operator. The argument is a const std::string&, so passing a string literal triggers invocation of std::string's converting constructor. (boost::bind(&print_string,_1))("Hello func!"); The second binder adapts a member function, print_string of some_class. The first argument to bind is a pointer to the member function. However, a pointer to a non-static member function isn't really a pointer. [3] We must have an object before we can invoke the function. That's why the bind expression must state that there are two arguments to the binder, both of which are to be supplied when invoking it. boost::bind(&some_class::print_string,_1,_2); To see why this makes sense, consider how the resulting function object can be used. We must pass to it both an instance of some_class and the argument to print_string. (boost::bind(&some_class::print_string,_1,_2))(sc,"Hello member!"); The first argument to the function call operator is this —that is, the instance of some_class. Note that the first argument can be a pointer (smart or raw) or a reference to an instance; bind is very accommodating. The second argument to the function call operator is the member function's one argument. In this case, we've "delayed" both arguments—that is, we defined the binder such that it expects to get both the object and the member function's argument via its function call operator. We didn't have to do it that way, however. For example, we could create a binder that invokes print_string on the same object each time it is invoked, like so: (boost::bind(&some_class::print_string,some_class(),_1)) ("Hello member!"); The resulting function object already contains an instance of some_class, so there's only need for one placeholder (_1) and one argument (a string) for the function call operator. Finally, we could also have created a so-called nullary function object by also binding the string, like so: (boost::bind(&some_class::print_string, some_class(),"Hello member!"))(); These examples clearly show the versatility of bind. It can be used to delay all, some, or none of the arguments required by the function it encapsulates. It can also handle reordering arguments any way you see fit; just order the placeholders according to your needs. Next, we'll see how to use bind to create sorting predicates on-the-fly. Dynamic Sorting Criteria When sorting the elements of a container, we sometimes need to create function objects that define the sorting criteria—we need to do so if we are missing relational operators, or if the existing relational operators do not define the sorting criteria we are interested in. We can sometimes use the comparison function objects from the Standard Library (std::greater, std::greater_equal, and so forth), but only use comparisons that already exist for the types—we cannot define new ones at the call site. We'll use a class called personal_info for the purpose of showing how Boost.Bind can help us in this quest. personal_info contains the first name, last name, and age, and it doesn't provide any comparison operators. The information is immutable upon creation, and can be retrieved using the member functions name, surname, and age. class personal_info { std::string name_; std::string surname_; unsigned int age_; public: personal_info( const std::string& n, const std::string& s, unsigned int age):name_(n),surname_(s),age_(age) {} std::string name() const { return name_; } std::string surname() const { return surname_; } unsigned int age() const { return age_; } }; We make the class OutputStreamable by supplying the following operator: std::ostream& operator<<( std::ostream& os,const personal_info& pi) { os << pi.name() << ' ' << pi.surname() << ' ' << pi.age() << '\n'; return os; } If we are to sort a container with elements of type personal_info, we need to supply a sorting predicate for it. Why would we omit the relational operators from personal_info in the first place? One reason is because there are several possible sorting options, and we cannot know which is appropriate for different users. Although we could also opt to provide different member functions for different sorting criteria, this would add the burden of having all relevant sorting criteria encoded in the class, which is not always possible. Fortunately, it is easy to create the predicate at the call site by using bind. Let's say that we need the sorting to be performed based on the age (available through the member function age). We could create a function object just for that purpose. class personal_info_age_less_than : public std::binary_function< personal_info,personal_info,bool> { public: bool operator()( const personal_info& p1,const personal_info& p2) { return p1.age()<p2.age(); } }; We've made the personal_info_age_less_than adaptable by publicly inheriting from binary_function. Deriving from binary_function provides the appropriate typedefs needed when using, for example, std::not2. Assuming a vector, vec, containing elements of type personal_info, we would use the function object like this: std::sort(vec.begin(),vec.end(),personal_info_age_less_than()); This works fine as long as the number of different comparisons is limited. However, there is a potential problem in that the logic is defined in a different place, which can make the code harder to understand. With a long and descriptive name such as the one we've chosen here, there shouldn't be a problem, but not all cases are so clear-cut, and there is a real chance that we'd need to supply a slew of function objects for greater than, less than or equal to, and so on. So, how can Boost.Bind help? Actually, it helps us out three times for this example. If we examine the problem at hand, we find that there are three things we need to do, the first being to bind a logical operation, such as std::less. This is easy, and gives us the first part of the code. boost::bind<bool>(std::less<unsigned int>(),_1,_2); Note that we are explicitly adding the return type by supplying the bool parameter to bind. This is sometimes necessary, both on broken compilers and in contexts where the return type cannot be deduced. If a function object contains a typedef, result_type, there is no need to explicitly name the return type. [4] Now, we have a function object that accepts two arguments, both of type unsigned int, but we can't use it just yet, because the elements have the type personal_info, and we need to extract the age from those elements and pass the age as arguments to std::less. Again, we can use bind to do that. boost::bind( std::less<unsigned int>(), boost::bind(&personal_info::age,_1), boost::bind(&personal_info::age,_2)); Here, we create two more binders. The first one calls personal_info::age with the main binder's function call operator's first argument (_1). The second one calls personal_info::age with the main binder's function call operator's second argument (_2). Because std::sort passes two personal_info objects to the main binder's function call operator, the result is to invoke personal_info::age on each of two personal_info objects from the vector being sorted. Finally, the main binder passes the ages returned by the two new, inner binders' function call operator to std::less. This is exactly what we need! The result of invoking this function object is the result of std::less, which means that we have a valid comparison function object easily used to sort a container of personal_info objects. Here's how it looks in action: std::vector<personal_info> vec; vec.push_back(personal_info("Little","John",30)); vec.push_back(personal_info("Friar", "Tuck",50)); vec.push_back(personal_info("Robin", "Hood",40)); std::sort( vec.begin(), vec.end(), boost::bind( std::less<unsigned int>(), boost::bind(&personal_info::age,_1), boost::bind(&personal_info::age,_2))); We could sort differently simply by binding to another member (variable or function) from personal_info—for example, the last name. std::sort( vec.begin(), vec.end(), boost::bind( std::less<std::string>(), boost::bind(&personal_info::surname,_1), boost::bind(&personal_info::surname,_2))); This is a great technique, because it offers an important property: simple functionality implemented at the call site. It makes the code easy to understand and maintain. Although it is technically possible to sort using binders based upon complex criteria, it is not wise. Adding more logic to the bind expressions quickly loses clarity and succinctness. Although it is sometimes tempting to do more in terms of binding, strive to write binders that are as clever as the people who must maintain it, but no more so. Functional Composition, Part I One problem that's often looking for a solution is to compose a function object out of other functions or function objects. Suppose that you need to test an int to see whether it is greater than 5 and less than, or equal to, 10. Using "regular" code, you would do something like this: if (i>5 && i<=10) { // Do something } When processing elements of a container, the preceding code only works if you put it in a separate function. When this is not desirable, using a nested bind can express the same thing (note that this is typically not possible using bind1st and bind2nd from the Standard Library). If we decompose the problem, we find that we need operations for logical and (std::logical_and), greater than (std::greater), and less than or equal to (std::less_equal). The logical and should look something like this: boost::bind(std::logical_and<bool>(),_1,_2); Then, we need another predicate that answers whether _1 is less than or equal to 10. boost::bind(std::greater<int>(),_1,5); Then, we need another predicate that answers whether _1 is less than or equal to 10. boost::bind(std::less_equal<int>(),_1,10); Finally, we need to logically and those two together, like so: boost::bind( std::logical_and<bool>(), boost::bind(std::greater<int>(),_1,5), boost::bind(std::less_equal<int>(),_1,10)); A nested bind such as this is relatively easy to understand, though it has postfix order. Still, one can almost read the code literally and determine the intent. Let's put this binder to the test in an example. std::vector<int> ints; ints.push_back(7); ints.push_back(4); ints.push_back(12); ints.push_back(10); int count=std::count_if( ints.begin(), ints.end(), boost::bind( std::logical_and<bool>(), boost::bind(std::greater<int>(),_1,5), boost::bind(std::less_equal<int>(),_1,10))); std::cout << count << '\n'; std::vector<int>::iterator int_it=std::find_if( ints.begin(), ints.end(), boost::bind(std::logical_and<bool>(), boost::bind(std::greater<int>(),_1,5), boost::bind(std::less_equal<int>(),_1,10))); if (int_it!=ints.end()) { std::cout << *int_it << '\n'; } It is important to carefully indent the code properly when using nested binds, because the code can quickly become hard to understand if one neglects sensible indentation. Consider the preceding clear code, and then look at the following obfuscated example. std::vector<int>::iterator int_it= std::find_if(ints.begin(),ints.end(), boost::bind<bool>( std::logical_and<bool>(), boost::bind<bool>(std::greater<int>(),_1,5), boost::bind<bool>(std::less_equal<int>(),_1,10))); This is a general problem with long lines, of course, but it becomes apparent when using constructs such as those described here, where long statements are the rule rather than the exception. So, please be nice to your fellow programmers by making sure that your lines wrap in a way that makes them easy to read. One of the hard-working reviewers for this book asked why, in the previous example, two equivalent binders were created, and if it wouldn't make more sense to create a binder object and use it two times. The answer is that because we can't know the exact type of the binder (it's implementation defined) that's created when we call bind, we have no way of declaring a variable for it. Also, the type typically is very complex, because its signature includes all of the type information that's been captured (and deduced automatically) in the function bind. However, it is possible to store the resulting function objects using other facilities—for example, those from Boost.Function. See "Library 11: Function 11" for details on how this is accomplished. The composition outlined here corresponds to a popular extension to the Standard Library, namely the function compose2 from the SGI STL, also known as compose_f_gx_hx in the (now deprecated) Boost.Compose library. Functional Composition, Part II Another useful functional composition is known as compose1 in SGI STL, and compose_f_gx in Boost.Compose. These functionals offer a way to call two functions with an argument, and have the result of the innermost function passed to the first function. An example sometimes says more than a thousand contrived words, so consider the scenario where you need to perform two arithmetic operations on container elements of floating point type. We first add 10% to the values, and then reduce the values with 10%; the example could also serve as a useful lesson to quite a few people working in the financial sector. std::list<double> values; values.push_back(10.0); values.push_back(100.0); values.push_back(1000.0); std::transform( values.begin(), values.end(), values.begin(), boost::bind( std::multiplies<double>(),0.90, boost::bind<double>( std::multiplies<double>(),_1,1.10))); std::copy( values.begin(), values.end(), std::ostream_iterator<double>(std::cout," ")); How do you know which of the nested binds will be called first? As you've probably already noticed, it is always the innermost bind that is evaluated first. This means that we could write the equivalent code somewhat differently. std::transform( values.begin(), values.end(), values.begin(), boost::bind<double>( std::multiplies<double>(), boost::bind<double>( std::multiplies<double>(),_1,1.10),0.90)); Here, we change the order of the arguments passed to the bind, tacking on the argument to the first bind last in the expression. Although I do not recommend this practice, it is useful for understanding how arguments are passed to bind functions. Value or Pointer Semantics in bind Expressions? When we pass an instance of some type to a bind expression, it is copied, unless we explicitly tell bind not to copy it. Depending on what we are doing, this can be of vital importance. To see what goes on behind our backs, we will create a tracer class that will tell us when it is default constructed, copy constructed, assigned to, and destructed. That way, we can easily see how different uses of bind affect the instances that we pass. Here is the tracer class in its entirety. class tracer { public: tracer() { std::cout << "tracer::tracer()\n"; } tracer(const tracer& other) { std::cout << "tracer::tracer(const tracer& other)\n"; } tracer& operator=(const tracer& other) { std::cout << "tracer& tracer::operator=(const tracer& other)\n"; return *this; } ~tracer() { std::cout << "tracer::~tracer()\n"; } void print(const std::string& s) const { std::cout << s << '\n'; } }; We put our tracer class to work with a regular bind expression like the one that follows. tracer t; boost::bind(&tracer::print,t,_1) (std::string("I'm called on a copy of t\n")); Running this code produces the following output, which clearly shows that there is copying involved. tracer::tracer() tracer::tracer(const tracer& other) tracer::tracer(const tracer& other) tracer::tracer(const tracer& other) tracer::~tracer() tracer::tracer(const tracer& other) tracer::~tracer() tracer::~tracer() I'm called on a copy of t tracer::~tracer() If we had been using objects where copying was expensive, we probably could not afford to use bind this way. There is an advantage to the copying, however. It means that the bind expression and its resulting binder are not dependent on the lifetime of the original object (t in this case), which is often the exact behavior desired. To avoid the copies, we must tell bind that we intend to pass it a reference that it is supposed to use rather than a value. We do this with boost::ref and boost::cref (for reference and reference to const, respectively), which are also part of the Boost.Bind library. Using boost::ref with our tracer class, the testing code now looks like this: tracer t; boost::bind(&tracer::print,boost::ref(t),_1)( std::string("I'm called directly on t\n")); Executing the code gives us this: tracer::tracer() I'm called directly on t tracer::~tracer That's exactly what's needed to avoid unnecessary copying. The bind expression uses the original instance, which means that there are no copies of the tracer object. Of course, it also means that the binder is now dependent upon the lifetime of the tracer instance. There's also another way of avoiding copies; just pass the argument by pointer rather than by value. tracer t; boost::bind(&tracer::print,&t,_1)( std::string("I'm called directly on t\n")); So, bind always copies. If you pass by value, the object is copied and that may be detrimental on performance or cause unwanted effects. To avoid copying the object, you can either use boost::ref/boost::cref or use pointer semantics. Virtual Functions Can Also Be Bound So far, we've seen how bind can work with non-member functions and non-virtual member functions, but it is, of course, also possible to bind a virtual member function. With Boost.Bind, you use virtual functions as you would non-virtual functions—that is, just bind to the virtual function in the base class that first declared the member function virtual. That makes the binder useful with all derived types. If you bind against a more derived type, you restrict the classes with which the binder can be used. [5] Consider the following classes named base and derived: class base { public: virtual void print() const { std::cout << "I am base.\n"; } virtual ~base() {} }; class derived : public base { public: void print() const { std::cout << "I am derived.\n"; } }; Using these classes, we can test the binding of a virtual function like so: derived d; base b; boost::bind(&base::print,_1)(b); boost::bind(&base::print,_1)(d); Running this code clearly shows that this works as one would hope and expect. I am base. I am derived. The fact that virtual functions are supported should come as no surprise to you, but now we've shown that it works just like other functions. On a related note, what would happen if you bind a member function that is later redefined by a derived class, or a virtual function that is public in the base class but private in the derived? Will things still work? If so, which behavior would you expect? Well, the behavior does not change whether you are using Boost.Bind or not. Thus, if you bind to a function that is redefined in another class—that is, it's not virtual and the derived class adds a member function with an identical signature—the version in the base class is called. If a function is hidden, the binder can still be invoked, because it explicitly accesses the function in the base class, which works even for hidden member functions. Finally, if the virtual function is declared public in the base class, but is private in a derived class, invoking the function on an instance of the derived class succeeds, because the access is through a base instance, where the member is public. Of course, such a case indicates a seriously flawed design. Binding to Member Variables There are many occasions when you need to bind data members rather than member functions. For example, when using std::map or std::multimap, the element type is std::pair<key const,data>, but the information you want to use is often not the key, but the data. Suppose you want to pass the data from each element in a map to a function that takes a single argument of the data type. You need to create a binder that forwards the second member of each element (of type std::pair) to the bound function. Here's code that illustrates how to do that: void print_string(const std::string& s) { std::cout << s << '\n'; } std::map<int,std::string> my_map; my_map[0]="Boost"; my_map[1]="Bind"; std::for_each( my_map.begin(), my_map.end(), boost::bind(&print_string, boost::bind( &std::map<int,std::string>::value_type::second,_1))); You can bind to a member variable just as you can with a member function, or a free function. It should be noted that to make the code easier to read (and write), it's a good idea to use short and convenient names. In the previous example, the use of a typedef for the std::map helps improve readability. typedef std::map<int,std::string> map_type; boost::bind(&map_type::value_type::second,_1))); Although the need to bind to member variables does not arise as often as for member functions, it is still very convenient to be able to do so. Users of SGI STL (and derivatives thereof) are probably familiar with the select1st and select2nd functions. They are used to select the first or the second member of std::pair, which is the same thing that we're doing in this example. Note that bind works with arbitrary types and arbitrary names, which is definitively a plus. To Bind or Not to Bind The great flexibility brought by the Boost.Bind library also offers a challenge for the programmer, because it is sometimes very tempting to use a binder, although a separate function object is warranted. Many tasks can and should be accomplished with the help of Bind, but it's an error to go too far—and the line is drawn where the code becomes hard to read, understand, and maintain. Unfortunately, the position of the line greatly depends on the programmers that share (by reading, maintaining, and extending) the code, as their experience must dictate what is acceptable and what is not. The advantage of using specialized function objects is that they can typically be made quite self-explanatory, and to provide the same clear message using binders is a challenge that we must diligently try to overcome. For example, if you need to create a nested bind that you have trouble understanding, chances are that you have gone too far. Let me explain this with code. #include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include "boost/bind.hpp" void print(std::ostream* os,int i) { (*os) << i << '\n'; } int main() { std::map<std::string,std::vector<int> > m; m["Strange?"].push_back(1); m["Strange?"].push_back(2); m["Strange?"].push_back(3); m["Weird?"].push_back(4); m["Weird?"].push_back(5); std::for_each(m.begin(),m.end(), boost::bind(&print,&std::cout, boost::bind(&std::vector<int>::size, boost::bind( &std::map<std::string, std::vector<int> >::value_type::second,_1)))); } What does the preceding code actually do? There are people who read code like this fluently, [6] but for many of us mortals, it takes some time to figure out what's going on. Yes, the binder calls the member function size on whatever exists as the pair member second (the std::map<std::string,std::vector<int> >::value_type). In cases like this, where the problem is simple yet complex to express using a binder, it often makes sense to create a small function object instead of a complex binder that some people will definitely have a hard time understanding. A simple function object that does the same thing could look something like this: class print_size { std::ostream& os_; typedef std::map<std::string,std::vector<int> > map_type; public: print_size(std::ostream& os):os_(os) {} void operator()( const map_type::value_type& x) const { os_ << x.second.size() << '\n'; } }; The great advantage in this case comes when we are using the function object, whose name is self-explanatory. std::for_each(m.begin(),m.end(),print_size(std::cout)); This (the source for the function object and the actual invocation) is to be compared with the version using a binder. std::for_each(m.begin(),m.end(), boost::bind(&print,&std::cout, boost::bind(&std::vector<int>::size, boost::bind( &std::map<std::string, std::vector<int> >::value_type::second,_1)))); Or, if we had been a bit more responsible and created terse typedefs for the vector and map: std::for_each(m.begin(),m.end(), boost::bind(&print,&std::cout, boost::bind(&vec_type::size, boost::bind(&map_type::value_type::second,_1)))); That's a bit easier to parse, but it's still a bit too much. Although there may be some good arguments for using the bind version, I think that the point is clear—binders are incredibly useful tools that should be used responsibly, where they add value. This is very, very common when using the Standard Library containers and algorithms. But when things get too complicated, do it the old fashioned way. Let Binders Handle State There are several options available to use when creating a function object like print_size. The version that we created in the previous section stored a reference to a std::ostream, and used that ostream to print the return value of size for the member second on the map_type::value_type argument. Here's the original print_size again: class print_size { std::ostream& os_; typedef std::map<std::string,std::vector<int> > map_type; public: print_size(std::ostream& os):os_(os) {} void operator()( const map_type::value_type& x) const { os_ << x.second.size() << '\n'; } }; An important observation for this class is that is has state, through the stored std::ostream. We could remove the state by adding the ostream as an argument to the function call operator. This would mean that the function object becomes stateless. class print_size { typedef std::map<std::string,std::vector<int> > map_type; public: typedef void result_type; result_type operator()(std::ostream& os, const map_type::value_type& x) const { os << x.second.size() << '\n'; } }; Note that this version of print_size is well behaved when used with bind, through the addition of the result_type typedef. This relieves users from having to explicitly state the return type of the function object when using bind. In this new version of print_size, users need to pass an ostream as an argument when invoking it. That's easy when using binders. Rewriting the example from the previous section with the new print_size gives us this: #include <iostream> #include <string> #include <map> #include <vector> #include <algorithm> #include "boost/bind.hpp" // Definition of print_size omitted int main() { typedef std::map<std::string,std::vector<int> > map_type; map_type m; m["Strange?"].push_back(1); m["Strange?"].push_back(2); m["Strange?"].push_back(3); m["Weird?"].push_back(4); m["Weird?"].push_back(5); std::for_each(m.begin(),m.end(), boost::bind(print_size(),boost::ref(std::cout),_1)); } The diligent reader might wonder why print_size isn't a free function now, because it doesn't carry state anymore. In fact, it can be void print_size(std::ostream& os, const std::map<std::string,std::vector<int> >::value_type& x) { os << x.second.size() << '\n'; } But there are more generalizations to consider. Our current version of print_size requires that the second argument to the function call operator be a reference to const std::map<std::string,std::vector<int> >, which isn't very general. We can do better, by parameterizing the function call operator on the type. This makes print_size usable with any argument that contains a public member called second, which in turn has a member function size. Here's the improved version: class print_size { public: typedef void result_type; template <typename Pair> result_type operator() (std::ostream& os,const Pair& x) const { os << x.second.size() << '\n'; } }; Usage is the same with this version as the previous, but it's much more flexible. This kind of generalization becomes more important than usual when creating function objects that can be used in bind expressions. Because the number of cases where the function objects can be used increase markedly, most any potential generalization is worthwhile. In that vein, there is one more change that we could make to further relax the requirements for types to be used with print_size. The current version of print_size requires that the second argument of the function call operator be a pair-like object—that is, an object with a member called second. If we decide to require only that the argument contain a member function size, the function object starts to really deserve its name. class print_size { public: typedef void result_type; template <typename T> void operator() (std::ostream& os,const T& x) const { os << x.size() << '\n'; } }; Of course, although print_size is now true to its name, we require more of the user for the use case that we've already considered. Usage now includes "manually" binding to map_type::value_type::second. std::for_each(m.begin(),m.end(), boost::bind(print_size(),boost::ref(std::cout), boost::bind(&map_type::value_type::second,_1))); Such are often the tradeoffs when using bind—generalizations can only take you so far before starting to interfere with usability. Had we taken things to an extreme, and removed even the requirement that there be a member function size, we'd complete the circle and be back where we started, with a bind expression that's just too complex for most programmers. std::for_each(m.begin(),m.end(), boost::bind(&print[7] ,&std::cout, boost::bind(&vec_type::size, boost::bind(&map_type::value_type::second,_1)))); A Boost.Bind and Boost.Function Teaser Although the material that we have covered in this chapter shouldn't leave you wanting for more, there is actually a very useful synergy between Boost.Bind and another library, Boost.Function, that provides still more functionality. We shall see more of the added value in "Library 11:Function 11," but I'd like to give you a hint of what's to come. As we've seen, there is no apparent way of storing our binders for later use—we only know that they are compatible function objects with some (unknown) signature. But, when using Boost.Function, storing functions for later invocation is exactly what the library does, and thanks to the compatibility with Boost.Bind, it's possible to assign binders to functions, saving them for later invocation. This is an enormously useful concept, which enables adaptation and promotes loose coupling.
http://www.informit.com/articles/article.aspx?p=412354&seqNum=4
CC-MAIN-2016-40
refinedweb
7,480
51.78
The Section 22.4, s> <!-- other beans here --> </bean> </beans> Section 22.4, “Controlling the ObjectNames for your beans”. JDK 5.0 Section 22.3.3, shouws. The following source level metadata types are available for use in Spring JMX: The following configuration parameters are available for use on these source-level metadata types: Section 22.4, “Controlling the ObjectNames for your beans”..metadata.Attributes"/> If you are using at least Java 5,, an even simpler syntax is supported by Spring's ' context' namespace.. Rather than defining an MBeanExporter bean, just provide this single element: . <context:mbean-export. For remote access, Spring JMX module offers two FactoryBean implementations inside the org.springframework.jmx.support package for creating both server- and client J2SE 5.0:9875"/> </bean>, Hessian, Burlap. Spring's JMX offering includes comprehensive support for JMX. This section contains links to further resources about JMX. The JMX homepage at Sun The JMX specification (JSR-000003) The JMX Remote API specification (JSR-000160) The MX4J homepage (an Open Source implementation of various JMX specs) Getting Started with JMX - an introductory article from Sun.
http://docs.spring.io/spring/docs/3.0.2.RELEASE/spring-framework-reference/html/jmx.html
CC-MAIN-2015-14
refinedweb
183
51.24
The power of network programming in .NET platform cannot be denied. Socket programming is the core of network programming in Windows and Linux, and today the .NET platform implements it in a powerful way. In this article, we will see the basics of socket programming in C#. To be precise, I have created a command client and a command server, to communicate between a remote server and up to. In socket-based network programming, you don't directly access the network interface device to send and receive packets. Instead, an intermediary connector is created to handle the programming interface to the network. Assume that a socket is a connector that connects your application to a network interface of your computer. For sending and receiving data to and from the network you should call the socket's methods. The 'System.Net.Sockets' namespace contains the classes that provide the actual .NET interface to the low-level Winsock APIs. In network programming, apart from which programming language to use there are some common concepts like the IP address and port. IP address is a unique identifier of a computer on a network and port is like a gate through which applications communicate with each other. In brief, when we want to communicate with a remote computer or a device over the network, we should know its IP address. Then, we must open a gate (Port) to that IP and then send and receive the required data. a connection-oriented socket, the TCP protocol is used to establish a session (connection) between two IP address endpoints. There is a fair amount of overhead involved with establishing the connection, but once it is established, the data can be reliably transferred between the devices. Connectionless sockets use the UDP protocol. Because of that no connection information is required to be sent between the network devices and it is often difficult to determine which device is acting as a "server", and which is acting as a "client". We will focus on the first type of socket programming in this article.
http://www.codeproject.com/Articles/12893/TCP-IP-Chat-Application-Using-C?fid=262673&df=90&mpp=10&sort=Position&spc=None&tid=4466548
CC-MAIN-2014-10
refinedweb
344
55.24
[ ] Kiran Kumar M R commented on HADOOP-11638: ------------------------------------------ bq. Does it mean we can never use ret = pthread_self(); for Solaris here just because Wine already used that? I think that's not the case, we can use. This will be the type of code you will end up to be compatible with multiple platforms even if wine reference was not there. > Linux-specific gettid() used in OpensslSecureRandom.c > ----------------------------------------------------- > > Key: HADOOP-11638 > URL: > Project: Hadoop Common > Issue Type: Bug > Components: native > Affects Versions: 2.6.0 > Reporter: Dmitry Sivachenko > Assignee: Kiran Kumar M R > Labels: freebsd > Attachments: HADOOP-11638-001.patch, HADOOP-11638-002.patch > > > In OpensslSecureRandom.c you use Linux-specific syscall gettid(): > static unsigned long pthreads_thread_id(void) > { > return (unsigned long)syscall(SYS_gettid); > } > Man page says: > gettid() is Linux-specific and should not be used in programs that are > intended to be portable. > This breaks hadoop-2.6.0 compilation on FreeBSD (may be on other OSes too). -- This message was sent by Atlassian JIRA (v6.3.4#6332)
http://mail-archives.apache.org/mod_mbox/hadoop-common-issues/201503.mbox/%3CJIRA.12777938.1424972465000.13272.1425582398590@Atlassian.JIRA%3E
CC-MAIN-2017-51
refinedweb
169
67.76
Dart artifacts are not built the same way in Fuchsia as they are on other platforms. Instead of relying on pub to manage dependencies, sources of third-party packages we depend on are checked into the tree under //third_party/dart-pkg. This is to ensure we use consistent versions of our dependencies across multiple builds. Likewise, no build output is placed in the source tree as everything goes under out/. That includes .packages files which are generated as part of the build based on a target's dependency. The Dart runner for Fuchsia does not monitor the FIDL channels opened by Dart programs and as a result does not end the program normally, but rather waits for the explict call to fuchsia.exit() to indicate the program should be ended. Note: Calling exit() from dart:io will result in an exception since components are not allowed to call this method since it would shutdown the dart_runner process. import 'package:fuchsia/fuchsia.dart' as fuchsia; void main(List<String> args) { print('Hello Dart!'); fuchsia.exit(23); } There are five gn targets for building Dart: dart_librarydefines a library that can be used by other Dart targets; dart_appdefines a Dart executable for Fuchsia; dart_tooldefines a Dart tool for the host; flutter_appdefines a Flutter application; dart_testdefines a group of test. See the definitions of each of these targets for how to use them. We use a layout very similar to the standard layout. my_package/ | |-- pubspec.yaml # Empty, used as a marker [mandatory] |-- BUILD.gn # Contains all targets |-- analysis_options.yaml # Analysis configuration [mandatory] |-- lib/ # dart_library contents |-- bin/ # dart_binary's (target) or dart_tool's (host) |-- test/ # dart_test contents
https://fuchsia.googlesource.com/fuchsia/+/3a2c9b130f545121abbc96f99745c50c560282db/docs/development/languages/dart/README.md
CC-MAIN-2021-49
refinedweb
272
54.32
Salt provides a mechanism for generating pillar data by calling external pillar interfaces. This document will describe an outline of an ext_pillar module. Salt expects to find your ext_pillar module in the same location where it looks for other python modules. If the extension_modules option in your Salt master configuration is set, Salt will look for a pillar directory under there and load all the modules it finds. Otherwise, it will look in your Python site-packages salt/pillar directory. The external pillars that are called when a minion refreshes its pillars is controlled by the ext_pillar option in the Salt master configuration. You can pass a single argument, a list of arguments or a dictionary of arguments to your pillar: ext_pillar: - example_a: some argument - example_b: - argumentA - argumentB - example_c: keyA: valueA keyB: valueB Import modules your external pillar module needs. You should first include generic modules that come with stock Python: import logging And then start logging. This is an idiomatic way of setting up logging in Salt: log = logging.getLogger(__name__) Finally, load modules that are specific to what you are doing. You should catch import errors and set a flag that the __virtual__ function can use later. try: import weird_thing EXAMPLE_A_LOADED = True except ImportError: EXAMPLE_A_LOADED = False If you define an __opts__ dictionary, it will be merged into the __opts__ dictionary handed to the ext_pillar function later. This is a good place to put default configuration items. The convention is to name things modulename.option. __opts__ = { 'example_a.someconfig': 137 } If you define an __init__ function, it will be called with the following signature: def __init__( __opts__ ): # Do init work here Note: The __init__ function is ran every time a particular minion causes the external pillar to be called, so don't put heavy initialization code here. The __init__ functionality is a side-effect of the Salt loader, so it may not be as useful in pillars as it is in other Salt items. If you define a __virtual__ function, you can control whether or not this module is visible. If it returns False then Salt ignores this module. If it returns a string, then that string will be how Salt identifies this external pillar in its ext_pillar configuration. If you're not renaming the module, simply return True in the __virtual__ function, which is the same as if this function did not exist, then, the name Salt's ext_pillar will use to identify this module is its conventional name in Python. This is useful to write modules that can be installed on all Salt masters, but will only be visible if a particular piece of software your module requires is installed. # This external pillar will be known as `example_a` def __virtual__(): if EXAMPLE_A_LOADED: return True return False # This external pillar will be known as `something_else` __virtualname__ = 'something_else' def __virtual__(): if EXAMPLE_A_LOADED: return __virtualname__ return False This is where the real work of an external pillar is done. If this module is active and has a function called ext_pillar, whenever a minion updates its pillar this function is called. How it is called depends on how it is configured in the Salt master configuration. The first argument is always the current pillar dictionary, this contains pillar items that have already been added, starting with the data from pillar_roots, and then from any already-ran external pillars. Using our example above: ext_pillar( id, pillar, 'some argument' ) # example_a ext_pillar( id, pillar, 'argumentA', 'argumentB' ) # example_b ext_pillar( id, pillar, keyA='valueA', keyB='valueB' ) # example_c In the example_a case, pillar will contain the items from the pillar_roots, in example_b pillar will contain that plus the items added by example_a, and in example_c pillar will contain that plus the items added by example_b. In all three cases, id will contain the ID of the minion making the pillar request. This function should return a dictionary, the contents of which are merged in with all of the other pillars and returned to the minion. Note: this function is called once for each minion that fetches its pillar data. def ext_pillar( minion_id, pillar, *args, **kwargs ): my_pillar = {'external_pillar': {}} my_pillar['external_pillar'] = get_external_pillar_dictionary() return my_pillar You can call pillar with the dictionary's top name to retrieve its data. From above example, 'external_pillar' is the top dictionary name. Therefore: salt-call '*' pillar.get external_pillar You shouldn't just add items to pillar and return that, since that will cause Salt to merge data that already exists. Rather, just return the items you are adding or changing. You could, however, use pillar in your module to make some decision based on pillar data that already exists. This function has access to some useful globals: A dictionary of mostly Salt configuration options. If you had an __opts__ dictionary defined in your module, those values will be included. A dictionary of Salt module functions, useful so you don't have to duplicate functions that already exist. E.g. __salt__['cmd.run']( 'ls -l' ) Note, runs on the master A dictionary of the grains of the minion making this pillar call. As an example, if you wanted to add external pillar via the cmd_json external pillar, add something like this to your master config: ext_pillar: - cmd_json: 'echo {\"arg\":\"value\"}'
https://docs.saltstack.com/en/latest/topics/development/modules/external_pillars.html
CC-MAIN-2019-35
refinedweb
864
50.16
Now that we’ve covered functions in some of their forms, we can look at functions with no names. Wait… Didn’t I say yesterday that functions are names for blocks of code? I did say that… Sorry! I lied. Somewhat. We can also have anonymous functions, which are useful in a small but important number of places. Today I want to tell you about anonymous functions: how to create them and how to use them. In the future (soon!) we’ll look into places where they can be very useful. This post is part of #100DaysOfPython, check out yesterday's post here if you haven't already. Or go to the index of all 100 days. Here’s a function, and its equivalent lambda function: def add_two(x, y): return x + y lambda x, y: x+y But… how do you call them? add_two(10, 5) # 15 (lambda x, y: x+y)(10, 5) # 15 Wait, that’s extremely unreadable, and very confusing! Yes, it is. Let’s talk more about how to use them in a moment… The structure of the lambda function is: - The lambdakeyword; - The arguments, separated by commas; - A colon ( :); - And what the function should return. This: lambda x, y: x+y Lambda functions only: - take inputs; and - return something. They cannot have multiple lines like normal functions. Something to remember: in any place where you can use a function, you can use a lambda function. And vice versa. It's just a matter of which one is more convenient. By default, always use normal functions. Let's look at situations where lambda functions can be very useful. First class functions Functions in Python can be “first class functions”. That means functions themselves can be arguments to other functions! Take this example: # This functions takes two arguments: # data, a dictionary; and # identify, a function. def who(data, identify): # Call the identify function with data return identify(data) def my_identifier_function(data): return data['name'] user = { 'name': 'Jose', 'surname': 'Salvatierra' } print(who(user, my_identifier_function)) # prints 'Jose' This is a very common way of using first class functions in Python. You have a function that does something, but it is extended by the functionality of another function you pass in. That way, you can decide what the who function is going to retrieve from the data. For this to make sense, assume you don’t have access to modifying the who function, because it is part of Python or it was written by someone else. Now, we could re-write that example more concisely using lambda functions: def who(data, identify): return identify(data) user = { 'name': 'Jose', 'surname': 'Salvatierra' } print(who(user, lambda x: x['name'])) # Remember, what happens there is this: # (lambda x: x['name'])(user) Instead of defining a function that needs a name and so forth, we can just create one right where it is used, that does exactly the same thing with less verbosity. Lambda functions are very useful when using first class functions. Higher order functions The identify function above was a first class function, because it was passed as an argument. The who function, which accepted and used a function as an argument, is called a higher order function. That’s just some lingo for you to know! Some programming languages don’t support first class and higher order functions, but as we’ll see, they can end up being quite handy!
https://blog.tecladocode.com/learn-python-day-12-lambda-functions-in-python/
CC-MAIN-2019-26
refinedweb
570
63.49
error #137:expression must be a modifiable lvalue A "lvalue" is something that shows up on the left half of an administrator. On the off chance that the administrator is =, at that point it's attempting to appoint the incentive on the privilege to some place in memory named by the thing on the left, so the thing on the left needs to indicate something with a spot in memory . For instance in the accompanying articulation, the variable Value is the lvalue all things considered on the left hand side of the announcement and is having its worth adjusted to be 24 Worth = 24; This mistake would be produced for the accompanying model as the if restrictive contains a task which endeavors to allocate the Value variable to the strict 24. Since 24 isn't a lvalue, the blunder is produced. #include "mbed.h" int principle() { int Value = 24; on the off chance that (24 = Value)/*** This line will create the blunder. printf("Value is equivalent to 24.\n"); } Additionally You may experience the accompanying message in the event that you move code to another form of the IAR C/C++ Compiler: Error[Pe137]: articulation must be a modifiable lvalue This message happens in light of the fact that a cast does not deliver a lvalue void f (void * ptr) *(long *)ptr = 0x11223344L; Step by step instructions to dispose of the blunder message: The most ideal way is presumably to revamp the sorts with the goal that the cast don't show up in any case, if conceivable. An option is to utilize an impermanent variable of the ideal kind Articulation must be a modifiable lvalue. C++ a, b, c, d, and e should be on the left half of the essential task administrators in the main picture. So: a = value_1 + value_6; b = value_2 - value_6; the issue here is that you are allocating to an articulation. 'lvalue' signifies "left worth", instead of 'rvalue', "right worth". 'value_1 + value_6' is an articulation that assesses as a 'rvalue'. You are basically saying '1 + 2 = a', which is distorted C (and C++). Maybe you intended to switch the left and right sides of '='?
https://kodlogs.com/index.php?qa=24725&qa_1=expression-must-be-a-modifiable-lvalue&show=24891
CC-MAIN-2019-51
refinedweb
359
54.56
Connecting to Microsoft SQL Server If you have a paid PythonAnywhere plan, and you have a Microsoft SQL Server database elsewhere on the Internet that you want to connect to (we don't host SQL Server ourselves) then you have two options in terms of Python packages to use. pymssql This is the easiest option. Just connect to it like this: host = "123.456.789.012" username = "yourusername" password = "yourpassword" database = "yourdatabasename" conn = pymssql.connect(host, username, password, database) cursor = conn.cursor() ...changing the host, username, password and database variables appropriately, of course. pyodbc This is much trickier to set up, so if you can use pymssql then we definitely recommend that option. But if you have a bunch of scripts that already use pyodbc and need them to work on PythonAnywhere, it is possible. The aim is to create a ODBC Data Source Name (DSN) called sqlserverdatasource that your pyodbc code will be able to use to connect to the database. To do this: Create a new file inside your home directory, called odbcinst.ini, and containing the following: ] host = YOUR_SQL_SERVER_IP_ADDRESS port = YOUR_SQL_SERVER_PORT tds version = 7.0 ...changing the YOUR_SQL_SERVER_IP_ADDRESSand YOUR_SQL_SERVER_PORTappropriately, of course. Create yet another file in your home directory, called odbc.ini, and put this in it: [sqlserverdatasource] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace = No Servername = sqlserver Finally, when you want to connect to the database from your Python code: import os import pyodbc os.environ["ODBCSYSINI"] = "/home/YOUR_PYTHONANYWHERE_USERNAME" conn = pyodbc.connect('DSN=sqlserverdatasource;Uid=YOUR_SQL_SERVER_USERID;Pwd=YOUR_SQL_SERVER_PASSWORD;Encrypt=yes;Connection Timeout=30;') ...again, changing YOUR_PYTHONANYWHERE_USERNAME, YOUR_SQL_SERVER_USERID, and YOUR_SQL_SERVER_PASSWORDappropriately. Once you've done that, it should all work fine! If you have more than one SQL server database to connect to If at a later stage you want to add more DSNs to be able to connect to other SQL Server instances, you need to add a new block to both .freetds.conf and to odbc.ini. For .freetds.conf, just add something identical to the code above, but change the sqlserver in square brackets at the start to something different (say, secondsqlserver, or perhaps something more descriptive), and, of course, change the host and port parameters appropriately. After that, .freetds.conf will look something like this: [sqlserver] host = YOUR_ORIGINAL_SQL_SERVER_IP_ADDRESS port = YOUR_ORIGINAL_SQL_SERVER_PORT tds version = 7.0 [secondsqlserver] host = YOUR_NEW_SQL_SERVER_IP_ADDRESS port = YOUR_NEW_SQL_SERVER_PORT tds version = 7.0 For odbc.ini, again, add something identical to the code above, but replace the sqlserverdatasource with secondsqlserverdatasource or something more descriptive, and then change the Servername to the name you used in .freetds.conf, eg. secondsqlserver. So you'll wind up with something like this: [sqlserverdatasource] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace = No Servername = sqlserver [secondsqlserverdatasource] Driver = FreeTDS Description = ODBC connection via FreeTDS Trace = No Servername = secondsqlserver Once you've done that, you should be able to connect to your second SQL Server database using the same pyodbc.connect, but changing the value assigned to the DSN to the one you put in square brackes in odbc.ini. For example: conn = pyodbc.connect('DSN=secondsqlserverdatasource;Uid=YOUR_SQL_SERVER_USERID;Pwd=YOUR_SQL_SERVER_PASSWORD;Encrypt=yes;Connection Timeout=30;')
https://help.pythonanywhere.com/pages/MSSQLServer
CC-MAIN-2017-09
refinedweb
516
53.92
What Are Signals? Django includes an internal "dispatcher" which provides two pieces of functionality: - Pieces of code which want to advertise what they're doing can use the dispatcher to send "signals" which contain information about what's happening. - Pieces of code which want to do something whenever a certain event happens can use the dispatcher to "listen" for particular signals, then execute the functions they want when those signals are sent out. The actual mechanism comes from a third-party library called PyDispatcher, which is bundled with Django and which lives at django.dispatch.dispatcher. function to send the signal. An example of this can be found in the save method of the base model class, django.db.models.Model; the file in which that class is defined imports the signals defined in the django.db.models module: from django.db.models import signals is the signal to be sent. - sender two; if a function which is listening for the signal is expecting certain information to be passed in as arguments, the dispatcher will ensure that the extra arguments to send are used. In this case the extra argument instance is self, which means it will be the object which was just saved. This means that functions which are listening for the post_save signal can, if they want to do something with the object that was just saved, specify that they take an argument named instance, and the dispatcher will pass it to them. To listen for a signal, first define a function that you want to execute when the signal is sent; if you know that the signal will be sent with extra arguments and you want to use those arguments, make sure your function accepts them. Then you need to do three things: - Import the signal object you'll be listening for. - Import the dispatcher. - Use the dispatcher's connect signal to tell the dispatcher you want to listen for something. A good example of this is found in Django's bundled "contenttypes" application, which creates and maintains a registry of all the installed models in your database. In order to do this, the contenttypes app defines a ContentType model, and it needs to know any time a new model is installed so it can create the appropriate ContentType object for that model. To do this, it includes a file called management.py; whenever manage.py syncdb is run, it loops through every application in the INSTALLED_APPS setting, and looks to see if any apps contain a module called management; if they do, manage.py imports them before installing any models, which means that any dispatcher connections listed in an app's management module will be set up before model installation happens. In its management.py file, the contenttypes app defines a function called create_contenttypes, which takes three arguments: app, created_models and verbosity. These correspond to the extra arguments manage.py will use with dispatcher.send when it sends the post_syncdb signal after installing each new application, and provide enough information to determine which models need to have new ContentType objects created (actually, just app and created_models would be enough; the extra argument, verbosity, is used by manage.py to indicate whether any listening functions should be "verbose" and echo output to the console, or be quiet and not echo any output. The management.py file also imports django.db.models.signals and django.dispatch.dispatcher; after the create_contenttypes function is defined, it sets up that function to listen for the post_syncdb signal: dispatcher.connect(create_contenttypes, signal=signals.post_syncdb) The first argument, create_contenttypes, is the name of the function to execute when the signal is sent out. The second argument, signal, is the signal to listen for. There is another optional argument, sender, which is not used in this example; sender can be used to narrow down exactly what will be listened for; when you specify sender, your function will only be executed when the object which sent the signal is the same as the object you specify as the sender argument. An example of this can be found in Django's authentication application: django.contrib.auth.management defines a function called create_superuser, and uses the dispatcher to connect to the post_syncdb signal -- but only when post_syncdb is being sent as a result of installing the auth application. To do this, the auth app's management.py file imports its own models: from django.contrib.auth import models as auth_app And then uses the sender argument to dispatcher.connect: dispatcher.connect(create_superuser, sender=auth_app, signal=signals.post_syncdb) is executed. In case you've ever wondered, that's how Django knows to prompt you to create a superuser whenever you install the auth app for the first time. The auth app also sets up another function -- create_permissions -- which doesn't specify sender in its call to dispatcher.connect, so it runs any time post_syncdb is sent. That's how the auth app creates the add, change and delete Permission objects for each application you install. List of signals built in to Django Django defines several sets of signals which are used internally, and which you can listen for in order to run your own custom code at specific moments. argument to the pre_init signal argument to the post_init signal would be the Poll object. pre_delete This is sent at the beginning of a model's delete method. Arguments sent with this signal: - sender -- the model class of the object which is about to be deleted. - instance -- the actual object which is about to be deleted. post_delete This is sent at the end of a model's delete method. Arguments sent with this signal: - sender -- the model class of the object which module of the application which was just installed. - app -- same as sender. - created_models -- a list of the model classes which were just installed. - verbosity -- indicates how much information manage.py is printing on screen. There are three possible values: 0 means no information, 1 means some information and 2 means all possible information. Functions which listen for this signal should adjust what they output to the screen based on the value of this argument. - interactive -- whether manage.py is running in "interactive" mode; this is a boolean and so is either True or False. If interactive is True, it's safe to prompt the user to input things on the command line (for example, the auth app only prompts to create a superuser when interactive is True); if interactive object which was rendered. - template -- same as sender. - context -- the Context with which the template was rendered..
https://code.djangoproject.com/wiki/Signals?version=15
CC-MAIN-2015-27
refinedweb
1,099
54.73
Finding leaks This article describes the various methods for tracking down GDI and User handle leaks. Unfortunately in Win2k/XP you cannot tell which kind of handles are out (windows 9x used to distinguish) - however I haven't usually needed to know this kind of information. If you open up task manager and add in the GDI/User handle column - the article discusses this - you should be able to observe when the handles spike in your application. Once you've narrowed down roughly where you are observing the spike, say hovering over a button keeps growing the number of GDI handles by 4 every time.... you can add in calls to GetGUIResources to divide and conquer the problem. Usually you'll find something IDisposable that wasnt disposed - like a pen or a brush or a string format object. I thought I'd share the class I use in some of my tests to ensure that my painting code doesn't leak. I run the painting code through once to make sure all the static SystemPens/Brushes are all cached in, then rerun it wrapping the painting code in a GDICounter object. private bool runonce = false;protected override OnPaint(PaintEventArgs e) { if (runonce) { using (new GDICounter()) { // the constructor snaps the current count of GDI objects by calling GetGUIResources base.OnPaint(e); } // the dispose method is called here and compares the current count to the last known number. } runonce = true; } namespace FindLeak{ using System; using System.Runtime.InteropServices; using System.Diagnostics; public class GDICounter : IDisposable { private const int GR_GDIOBJECTS = 0, GR_USEROBJECTS = 1; [DllImport("User32", ExactSpelling = true, CharSet = CharSet.Auto)] public static extern int GetGuiResources(IntPtr hProcess, int uiFlags); private int intialHandleCount; public GDICounter() { intialHandleCount = 0; intialHandleCount = GetGDIObjects(); } private int GetGDIObjects() { IntPtr processHandle = System.Diagnostics.Process.GetCurrentProcess().Handle; if (processHandle != IntPtr.Zero) { return (int)GetGuiResources(processHandle, GR_GDIOBJECTS); } return 0; } public void Dispose() { int currentHandleCount = GetGDIObjects(); if (intialHandleCount != currentHandleCount) { int change = currentHandleCount - intialHandleCount; if (change > 0) { Debug.Fail("Handle count changed by: " + change.ToString() + new StackTrace().ToString()); } } } } Once you've established there is a leak, you can divide and conquer by sprinkling in more calls to GetGUIResources until you've found your problem. Why is a leak bad? Wont the garbage collector get it? This is exactly what you dont want to have happen. System.Windows.Forms/System.Drawing keeps a close eye on the number of handles out, to make sure that carefree usage of Pens/Brushes/Controls etc is cleaned up before the operating system runs out of resources. Under the covers there are threshholds of handle counts that are appropriate for each handle type - if this is exceeded, a garbage collection is performed to clear out the controls/pens/brushes that have yet to be finalized. If the app is creating lots of pens and brushes and not disposing them, this collection could happen at a time that's not convenient - say in the midst of a paint. This can all be prevented by deterministically cleaning up these resources (via the Dispose method). More details on how, when, where, and why you should use dispose here.
http://blogs.msdn.com/b/jfoscoding/archive/2005/02/03/366430.aspx
CC-MAIN-2014-15
refinedweb
515
54.22
Containers about the motivation behind CDK8s please see the original launch blog post or CNCF Webinar. General Availability (i.e 1.0) Before we dive in, here is a quick recap of the main components comprising the CDK8s project: cdk8s-cli: Command line tool for initializing and synthesizing CDK8s projects. cdk8s: Core library that defines the building blocks of Kubernetes resources. cdk8s-plus: A simplified intent based API for interacting with Kubernetes resources. With this release, we are marking both the cdk8s-cli and cdk8s as 1.0. This means we will be complying fully with semantic versioning, and no breaking changes are expected in any of the following minor version releases. Note that cdk8s-plus still remains in beta as we gather more community feedback. In addition to the stability and compatibility support, this release comes with a couple more enhancements: Go GoLang has been by far the most requested language support for the CDK8s ever since launch. We are excited to announce that with GA, Go joins Java, Python, and TypeScript as an officially supported language. Go developers can now use CDK8s to define their Kubernetes resources programmatically and easily compose them with low level building blocks generated from the Kubernetes OpenAPI schema. To get started you’ll need Go and Node.js which you can most likely grab from your package manager. We’ll also need a Kubernetes cluster to deploy to. If you don’t currently have one, you can use kind, eksctl, or any other provider to create one. Next, install the CDK8s CLI by running the following. $ npm install -g cdk8s-cli Once the CLI is installed we can create a new directory and initialize a CDK8s app from the Go template. $ mkdir hello-cdk8s-go $ cd hello-cdk8s-go $ cdk8s init go-app Initializing a project from the go-app template Importing resources, this may take a few moments... ======================================================================================================== Your cdk8s Go project is ready! cat help Prints this message cdk8s synth Synthesize k8s manifests to dist/ cdk8s import Imports k8s API objects to "imports/k8s" Deploy: kubectl apply -f dist/ Now that your project has been created we can open up main.go in your favorite text editor. package main import ( "github.com/aws/constructs-go/constructs/v3" "github.com/aws/jsii-runtime-go" "github.com/cdk8s-team/cdk8s-core-go/cdk8s" ) type MyChartProps struct { cdk8s.ChartProps } func NewMyChart(scope constructs.Construct, id string, props *MyChartProps) cdk8s.Chart { var cprops cdk8s.ChartProps if props != nil { cprops = props.ChartProps } chart := cdk8s.NewChart(scope, jsii.String(id), &cprops) // define resources here return chart } func main() { app := cdk8s.NewApp(nil) NewMyChart(app, "hello-cdk8s-go", nil) app.Synth() } CDK8s has a few different concepts that we’ll be working with. Constructs are the basic building blocks that can be composed to build higher-level abstractions. ApiObjects are Constructs that represent a Kubernetes resource and Charts (not to be confused with Helm Charts) are containers for your Constructs that will output a Kubernetes manifest. The CDK8s CLI has automatically imported ApiObjects generated from the Kubernetes OpenAPI spec for us at imports/k8s/k8s.go. You can take a look at this file but don’t be intimidated by it’s size – it represents the entire Kubernetes API. Import the ApiObjects into your main.go file by adding example.com/hello-cdk8s-go/imports/k8s to the import section at the top. Note: you can change the module name from example.com to whatever you prefer at the top of the go.mod file. Now we can finish your first Chart! Replace the // define resources here line with the following code that defines a Kubernetes deployment for an Nginx web server image. labels := map[string]*string{"app": jsii.String("nginx")} podSpec := &k8s.PodSpec{ Containers: &[]*k8s.Container{ { Name: jsii.String("nginx"), Image: jsii.String("nginx:latest"), Ports: &[]*k8s.ContainerPort{{ContainerPort: jsii.Number(80)}}, }, }, } k8s.NewKubeDeployment(chart, jsii.String("nginx-deployment"), &k8s.KubeDeploymentProps{ Spec: &k8s.DeploymentSpec{ Selector: &k8s.LabelSelector{ MatchLabels: &labels, }, Template: &k8s.PodTemplateSpec{ Metadata: &k8s.ObjectMeta{ Labels: &labels, }, Spec: podSpec, }, }, }) With your ApiObjects in place it’s time to synth which will run your CDK8s app and write your Kubernetes manifest. $ cdk8s synth dist/hello-cdk8s-go.k8s.yaml If you open up dist/hello-cdk8s-go.k8s.yaml you’ll see the YAML that was generated from your plain old Go code. Pretty neat, right? apiVersion: apps/v1 kind: Deployment metadata: name: hello-cdk8s-go-nginx-deployment-c8413b4d spec: selector: matchLabels: app: nginx template: metadata: labels: app: nginx spec: containers: - image: nginx:latest name: nginx ports: - containerPort: 80 All that’s left is to apply your manifest to the cluster and test it out. $ kubectl apply -f dist/hello-cdk8s-go.k8s.yaml deployment.apps/hello-cdk8s-go-nginx-deployment-c8413b4d created POD_NAME=$(kubectl get pods -l app=nginx -o jsonpath='{.items[0].metadata.name}') kubectl port-forward $POD_NAME 8080:80 If you open in your browser you should be greeted with “Welcome to nginx!” confirming your success. CDK8s+ The low level CDK8s resources are powerful, but also still carry a significant cognitive load caused by the overwhelming set of properties and resources. To address this, we created CDK8s+, which provides a set of simplified intent based API’s built on top of the same low level resources we just used. For example, to achieve the same result we had before, but this time with the help of CDK8s+: import ( "github.com/cdk8s-team/cdk8s-plus-go/cdk8splus22" ) cdk8splus22.NewDeployment(app, jsii.String("nginx"), &cdk8splus22.DeploymentProps{ Containers: &[]*cdk8splus22.ContainerProps{ { Image: jsii.String("nginx:latest"), }, }, }) You can read more about CDK8s+ in our original launch blog post. One of the main goals for CDK8s+ is to reduce cognitive load, leaving very little room for making authoring mistakes. To achieve this, we decided to make CDK8s+ target a specific version of Kubernetes. This way, authors are not exposed to functionality that might not be available in the Kubernetes cluster they are operating. Prior to this launch, we only supported CDK8s+ API’s for Kubernetes version 1.17. This meant that we weren’t able to enhance the API’s with features that were added in higher versions. With this release, we introduce multiple CDK8s+ libraries, corresponding to the 3 latest versions of Kubernetes. For more information on CDK8s+ versioning and vending strategy, see CDK8s+ FAQ. CDK8s+ remains in beta while we collect community feedback. Please share yours! Next Steps We hope you give CDK8s a try. A great place to start is with the getting started guide and the examples in the repository. If you are interested in contributing or providing feedback please join the mailing list and attend one of our monthly community meetings.
https://aws.amazon.com/blogs/containers/announcing-the-general-availability-of-cdk8s-and-support-for-go/
CC-MAIN-2022-27
refinedweb
1,116
51.04
Documentation Download: Windows Macintosh Linux New in VPython 6 Recent developments VPython wiki User forum Contributed programs For developers Python web site HOW PYTHON IS DIFFERENT Bruce Sherwood, Fall 2006; revised Fall 2009 (For more formal comparisons, see Google) In many respects Python is like any other algorithmic programming language (C, Pascal, Java, etc.) and unlike, say, Lisp. There are a few features of Python that an experienced programmer doesn't expect because they are embedded in a seemingly familiar environment yet are quite different from most algorithmic languages. This document attempts to point out the most important ones. DYNAMIC TYPING When you say "z1 = Zork(cost=23)" you create a Zork object and stick a label on it, "z1". There is no need (and no way) to declare "z1" to be of type "Zork" before labeling this instance of the class "Zork" with the label "z1". If you now say "z2 = z1" you have not created any new object, you have merely stuck a second label "z2" on the existing Zork object. Note carefully that this does NOT create a second instance of the class "Zork". If you alter z1.cost it is just the same as altering z2.cost. Making a second, independent copy of an object is a fairly unusual thing to do in Python, but there exist special methods for doing this. If you now say "z1 = 3.7" the label "z1" no longer refers to the Zork object, and a reference counter on the Zork object is decremented. You can still refer to the object with expressions such as "z2.cost". If you then say "z2 = 28.7/3.4" there is no longer any way to refer to the Zork object. The Zork object reference count is decremented again, to zero, and the object is now marked as eligible to be deleted by the garbage collection routine, since there is no longer any way to refer to it. This label behavior only applies to objects that are "mutable" (can be changed; see next section). In contrast, if you say "a = b = 5" and then say "b = 2", "a" still has the value 5. Special case for VPython: Humanly visible objects such as boxes or spheres in a graphics scene have an extra reference count so that even if there are no labels on these objects, they are not deletable because a human viewer counts as a reference. To delete a visual object it is first necessary to set the visible attribute to False. MUTABLE AND IMMUTABLE An important Python structure is a list: mylist = [3, 'dog', 4.7, Zork(cost=23), box()]. The 'dog' in this list can be referred to as mylist[1], the elements being numbered starting with zero. If you say mylist[1] = 42 you've changed 'dog' to 42 in the list. The ability to change elements in a list means that lists are "mutable". A different list-like structure is a tuple: mytup = (3, 'dog', 4.7) is created using parens instead of square brackets. You can read an element, so mytup[1] refers to 'dog', but you cannot change an element. A tuple is "immutable". The only way to achieve the effect is something like this: mytup = (mytup[0], 42, mytup[2]), which creates a new tuple. Lists and tuples are examples of what are called "sequences" in Python. A third important kind of sequence is a dictionary, which is a container of elements with keywords, and you index in not by position but by keyword (as a string). "FOR" LOOPS A particularly delightful and powerful feature of Python is that you can loop over any sequence. Suppose for example you have created objects for the planets. You can loop over them like this: for planet in [Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto]: print planet.pos, planet.mass, planet.radius This could also be written like this: planets = [Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, Neptune, Pluto] for planet in planets: print planet.pos, planet.mass, planet.radius INTEGER DIVISION As in many languages including C, 3/4 normally evaluates as zero rather than 0.75. There is a slow migration path for Python eventually to treat 3/4 as 0.75 rather than zero. You can invoke this behavior now by making the following statement the first statement in the program: from __future__ import division Note carefully that there are TWO underlines before "future" and TWO underlines after "future". IDLE VS SHELL If you run Python directly, or operate in the "shell" window of IDLE, the editor that comes with Python, you can execute statements interactively. Many experienced programmers find this a useful mode. Some people much prefer to write whole programs, even small ones, because it is easier to revise and easier to understand what state of module import one is in. There are two features in IDLE that can be set in the Configure IDLE menu option (if not already set at install time) which make edit/compile/run/revise cycles almost as immediate as the shell window. One feature is to specify that whenever you press F5 to run, the current version of your file is automatically saved to disk ("autosave"; note that there is nearly infinite un-do available). The other is an option to specify that at startup IDLE should open an edit window rather than the shell window (you can always open a shell window later, and one is created when you run a program, because that's where text output goes). The first time you press F5 to run, you will be asked to specify where to save the file, but with autosave turned on you won't be asked again. The effect is that when you start IDLE you're ready to enter a program, and after the initial save, the programming cycle is extremely simple: just press F5 to save and run. One-touch testing. (As of Fall 2009 the VIDLE variant of IDLE lets you specify that you don't need to save the file even the first time. If you exit VIDLE without saving the file to a permanent location, you're invited to do the save. With this restoration of a feature that used to be present in IDLE, you can now write little test routines without the distraction of saving the file. It is expected that the standard IDLE distributed with future versions of Python will incorporate the recent improvements currently available in VIDLE.) For a more powerful interactive environment, you might be interested in ipython.
http://vpython.org/contents/experienced.html
CC-MAIN-2015-11
refinedweb
1,095
60.14
Hi there I forgot to post my workaround to get the whole things running: Because I had problems building the Development Tools (ARM-edition). I use w2000 + cygwin and the binutils-2.11.2, gcc-core-3.0.1, gcc-g++-3.0.1 and insight 5.0. So i found the problem in the winnt.h file located in the folder \cygwin\usr\include\w32api. In row 42 you must change the existing code to following: #ifndef void #define VOID void #ifndef char #define CHAR char #ifndef short #define SHORT short #ifndef long #define LONG long #endif #endif #endif #endif After that I could install all and now I even able to use Insight and build the libraries, but as described in other message I have errors building the tests. Question: Is my workaround suitable? Or will there occur any problems with it? ciao.. Patrick mail: pepperpino@web.de ICQ:57446087
https://sourceware.org/pipermail/ecos-discuss/2001-November/011575.html
CC-MAIN-2020-50
refinedweb
152
73.47
Results 1 to 4 of 4 Thread: Java connect to website - Join Date - Sep 2007 - 19 - Thanks - 0 - Thanked 0 Times in 0 Posts Java connect to website I am developing an application that can connect to a specific web site and use a file (i.e. xml file) to read information from. This file can then be updated and saved back to the web site. The only problem is that I don't know how to do this I know how to read an xml file with Java but I don't know how to first pull the file off the Internet or read it directly from the Internet. Then the other problem is how to update the file and save it back on the Internet. Any suggestions? Thanks for your help! Since you state that you already know how to parse through the XML, I'm just going to go ahead and give you some tips on how you can get to the website and pull down the data. In any case, this is how I've done it for some projects of mine. First off, you need to import two of the .net classes, specifically HttpURLConnection and URL. You then, want to create a URL to either the xml file or the webpage you are going to. Then you can use the HttpURLConnection to open the URL, set the request method as GET (since you're getting information from the server), perhaps include browser specific information to make it convinced you're not a bot, and then connect. Here is a quick snippet of code that I have no tested: Code: import java.net.HttpURLConnection; import java.net.URL; import java.io.BufferedReader; import java.io.InputStreamReader; import java.io.IOException; public class getXML { public static void main(String args[]) { try { URL ourURL = new URL(""); //Coding Forums RSS Feed HttpURLConnection huc = (HttpURLConnection)url.openConnection(); huc.setRequestMethod("GET"); huc.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; JVM)"); huc.setRequestProperty("Pragma", "no-cache"); huc.connect(); BufferedReader reader = new BufferedReader(new InputStreamReader(huc.getInputStream())); String line = null; while ((line = reader.readLine()) != null) { // Either do your parsing here, or append it to a StringBuffer for later use } catch(IOException ioe) { ioe.printStackTrace(); } catch(Exception e) { System.err.println("General Exception " + e); e.printStackTrace(); } } } } I actually learned this bit of code by looking at someone else's so I don't feel too bad about sharing it around. But, for more information I suggest you look at these things here: URL HttpURLConnection Probably the best source for URL stuff: Sun Tutorial on URL's NOTE: Interesting enough, the Sun tutorial comes up with a more smaller solution then what I came up with that might be easier to understand. So My suggestion is you read through that and use mine as a background. Last edited by Aradon; 11-19-2007 at 02:15 PM. Reason: Adding Note"To iterate is human, to recurse divine." -L. Peter Deutsch - Join Date - Sep 2007 - 19 - Thanks - 0 - Thanked 0 Times in 0 Posts Hello Aradon, Thanks your your reply! That was very helpful to get started with getting the information from the web site. Do you have any tips for the second part? I would like to make changes to the xml file and then save over (re-upload) the current xml file on the Internet. Can this be done? If you read through some more about the URL Tutorial on the sun site there is probably a shorter way to do this. However, the first solution to this problem that comes to mind is to recreate the xml file and upload it onto the webserver (assuming that this program is not running on the same server). To do this you would probably want to use an already written FTP Library, to which there are several out there. My personal favorite for using FTP and not worrying about counting bits / second is to use the Apache Commons one, specifically the FTPClient Class. You can find more information on that class, including implementation examples here: Commons Net"To iterate is human, to recurse divine." -L. Peter Deutsch AdSlot6
http://www.codingforums.com/java-and-jsp/128115-java-connect-website.html
CC-MAIN-2015-40
refinedweb
692
64.1
Home | Order Online | Downloads | Contact Us | Software Knowledgebase it | es | pt | fr | de | jp | kr | cn | ru | nl | gr Closing Files Files are closed using the fclose function. The syntax is as follows: fclose(in); Reading Files The feof function is used to test for the end of the file. The functions fgetc, fscanf, and fgets are used to read data from the file. The following example lists the contents of a file on the screen, using fgetc to read the file a character at a time. #include <stdio.h> int main() { FILE *in; int key; if ((in = fopen("tarun.txt", "r")) == NULL) { puts("Unable to open the file"); return 0; } while (!feof(in)) { key = fgetc(in); /* The last character read is the end of file marker so don't print it */ if (!feof(in)) putchar(key); } fclose(in); return 0; } The fscanf function can be used to read different data types from the file as in the following example, providing the data in the file is in the format of the format string used with fscanf. fscanf(in, "%d/%d/%d", &day, &month, &year); The fgets function is used to read a number of characters from a file. stdin is the standard input file stream, and the fgets function can be used to control
https://www.datadoctor.biz/data_recovery_programming_book_chapter5-page51.html
CC-MAIN-2019-22
refinedweb
215
76.45
How to add checkbox to GridView rows in C#? Want to add checkboxes to the rows in a data gridview? Learn in this article, how to add a checkbox in GridView. Also check out a sample code in C# for deleting multiple items selected through checkboxes in GridView. You must have seen many applications where the GridView provides controls like Checkboxes, Buttons, Textboxes etc. for user activities. This article focuses on how to add a checkbox to a GridView control and how to perform joint operations over a set of selected rows from the GridView, like deleting multiple rows selected by the user. GridView in Asp.Net is a data control which is used to display data in a tabular manner. Data GridView control are capable of displaying not only data but also some visual elements like checkbox, combobox, textbox, buttons etc. Here we will see how to add a checkbox to GridView. To add any visual control to a GridView we will have to use Styles or Templates. I would demonstrate the insertion of a CheckBox in a GridView through a small web application where we will bind the data from an SQL data table to a Gridview. We would add the checkbox to the GridView by using the Template field. After the GridView gets populated we would select multiple rows through the check boxes and delete all the selected rows together on a single click. First create a web application from Visual Studio as File>New>Project. Select Visual C#>Web then Asp.Net Empty web application. Now add a GridView control to your web application and bind this GridView control to the required data table by initializing a connection to the database. In order to create and use an SQL connection we would require to add the following namespaces in our program: using System.Data; using System.Data.SqlClient; Source code for Adding CheckBox to GridView As said earlier in order to insert checkboxes in the GridView control we would use the TemplateField as: <asp:GridView <Columns> <asp:BoundField <asp:BoundField <asp:BoundField <asp:BoundField <%-- Adding CheckBox to Grid View --%> <asp:TemplateField <ItemTemplate> <asp:CheckBox </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> C# code for adding CheckBox to a GridView Now in order to create connection, bind data from SQL data table to the GridView I used the following C# code: public partial class WebForm1 : System.Web.UI.Page { SqlConnection conn = new SqlConnection(); SqlCommand cmd = new SqlCommand(); SqlCommandBuilder cb = new SqlCommandBuilder(); SqlDataAdapter adp = new SqlDataAdapter(); DataSet ds = new DataSet(); DataRow dr; protected void Page_Load(object sender, EventArgs e) { conn.ConnectionString = "Connection string"; // Put actual conn string here cmd.Connection = conn; adp.SelectCommand = cmd; //Binding the Grid to the database table if (!IsPostBack) { cmd.CommandText = "select * from EmpDetails"; adp.Fill(ds, "st"); gvw_employees.DataSource = ds.Tables["st"]; gvw_employees.DataBind(); } } You will get the desired result now i.e CheckBox in GridView control . When this program is run something like what shown below is seen on the web page: C# code for deleting multiple selected rows from a GridView As an extention, I am here demonstrating another piece of C# code which would delete rows selected by the user using the checkbox provided in the GridView control. Here I will use the FindControl method to find the checked CheckBox controls in the container control i.e GridView. Below is the screenshot from the code page to illustrate the You can futher enhance this code by adding checkbox/link for Select All so as to select all the rows shown and performing a common action on them. GridView can also be used to fetch data from Excel files. Learn more on How to display data from Excel file in to a GridView its very useful thank u
https://www.dotnetspider.com/resources/44217-How-add-checkbox-GridView-rows-C.aspx
CC-MAIN-2020-40
refinedweb
626
54.32
Copy / Yanking that always works with vim and neovim Are you on macOS and having trouble copying in vim when using tmux? You may try to yank and paste, and be greeted with an error: E353: Nothing in register * Before we go ahead, let's check our tmux version: $ tmux -V tmux 2.6 and up If you can upgrade to 2.6 on macOS, you should be OK: Do a dance on OS X 10.10 and above to return tmux to the user namespace, allowing access to the clipboard. If you're a macOS user using Homebrew and have Mac OS X 10.10 or greater, you can upgrade your tmux via homebrew: $ brew upgrade tmux. tmux 2.5 and lower or Mac OS X < 10.10 In order to get the clipboard working with vim in tmux panes, you'll need tmux-MacOSX-pasteboard. To grab it via Homebrew: $ brew install reattach-to-user-namespace Add this to your ~/.zshrc or ~/.bashrc: if command -v reattach-to-user-namespace > /dev/null; then alias vim="reattach-to-user-namespace vim" alias nvim="reattach-to-user-namespace nvim" fi Another more automatic away, in your ~/.tmux.conf: set-option -g default-command "reattach-to-user-namespace -l zsh" It's required that you start tmux in a fresh server and a new terminal. save all your work, and then exit tmux with $ tmux kill-server.
https://devel.tech/snippets/n/8MHSy0zA/copy-yanking-that-always-works-with-vim-and-neov/
CC-MAIN-2021-43
refinedweb
236
72.66
Hi, I have created an xl sheet. Value of few cells are being calculated as per a formula. I am not getting the value of formula (cell.getFormula()) that I have set using cell.setFormula() method. e.g. Formula being set '=IW39’ formula of cell I am getting is '=A39’ Please let me know if I am making some mistake while setting the formula or there is smoe other problem? Thanks, Vimlesh Cell.getFormula() is not returning the value that has been set using cell.setFormula(String formula) Hi, Hi, Thanks for providing us details. Actually by default the formulas are set in Excel (97-2003) formats where we cannot provide reference to the columns (in the formula) greater than 256th (i.e. greater than IV column) column. We have logged your issue into our issue tracking system with an issue id: CELLSJAVA-14256. We will let you know when it figured out. Thank you. Thanks for quick reply. As per reply the formulas are set in Excel(97-2003) formats where we cannot provide reference to the columns (in the formula) greater than 256th (i.e. greater than IV column) column. But what about the reference ‘ABQ11’ and others? This column is also greater than 256. But it is being set properly. Thanks, Vimlesh Hi, Is there any workaround for this problem ? Can we have source code so that we can do something as this is creating a serious problem at our end for generating excel in 2007 format. Thanks. Hi, Yes, we found the issue and already logged into our issue tracking system with an issue id: CELLSJAVA-14256. We will try to provide the fix asap. "Is there any workaround for this problem ? Can we have source code so that we can do something as this is creating a serious problem at our end for generating excel in 2007 format." Well, I am afraid we cannot provide the source code as it is against our internal policies. Anyways, we appreciate your understanding, we will figure out your issue soon. Thank you. Hi, Can we have information by when would you be able to update us on the same? Thanks, Vimlesh Hi, We will check if we can provide you an eta for your issue. Thank you. Hi, After analyzing the feature we conclude it will take at least 2 months time to incorporate the feature in the product. There are two possible reasons for it: 1) It is a complex feature which would take some time to be implemented. 2) There are already some other important tasks (on hand) to be supported. Thanks for your understanding! Provide us some patch stuffs for this, we are losing lot of business for this feature. Its really urgent for me. Hi, OK, we have put your feature in our top priority list. We will try to provide the supported version in the start of next month now. Thank you. Hi, Can we have your contact number and reference number for this conversation? Thanks, Vimlesh Hi Vimlesh, I have afraid, you need to use forums or live chat only to contact us, we don’t provide telephonic technical support at the moment. Our forum support is fast enough that you can reply on it. If you have any problem/issue or need some help for anything, you can post us a query or live chat with us, we will help you instantaneously. For your case, as we have already told you we will try to provide the supported version (for your requirement) in the first half of next month. Thanks for your understanding! Hi Aspose support team, It’s mid-March and we are waiting for a fix. Hi, <?xml:namespace prefix = o We are working on your issue but I am afraid it is a complex issue and we cannot provide a fix in 1 ~ 2 day’s time. We will hopefully provide a fix for it in the next week. Thank you for understanding, Hi, As per your commitment to provide the fix for the same, we had planned our release date on Wednesday 24th March. For that we need the fix today or by tomorrow. Please provide the fix asap. Thanks, Hi, We have been waiting for the fix from your side as one more week is gone now. Our product release is getting impacted a lot due to delay in patch from your side. Please do provide a fix asap and do respond on it. Thanks, Hi, Hopefully, we will provide a fix tomorrow for your requirement. Thanks for being patient! Hi, Please try the attached version. <!–[if gte mso 10]> <![endif]–> we have supported setting formulas that refer to row/column/parameters count that exceeds Excel2003's limit. Note: To remove the limit of Excel2003 for row, column and parameters count, please set the file format of Workbook other than EXCEL97TO2003. Sample Code Segments: 1) Workbook workbook = new Workbook(); Worksheets worksheets = workbook.getWorksheets(); Worksheet worksheet = worksheets.getSheet(0); worksheet.getCells().getCell("B10").setFormula("=IW39"); System.out.println(worksheet.getCells().getCell("B10").getFormula()); 2) Workbook wb = new Workbook(); wb.setFileFormatType(FileFormatType.EXCEL2007); Cells cells = wb.getWorksheets().getSheet(0).getCells(); Cell cell = cells.getCell(0, 0); cell.setFormula("=IW39"); cell = cells.getCell(0, 1); cell.setFormula("=SUM(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,34,45,67,76,87,98,77,8,9,100)"); //... your code goes here. wb.save("d:\\files\\res.xlsx"); //or wb.save("res.xlsx", FileFormatType.EXCEL2007); The Workbook.save(String) and Workbook.save(InputStream) methods are different from now on. If the workbook's file format has been set (If the workbook is loaded from a template file, its file format would be the same as the template file's format. Or it can be set by Workbook.setFileFormatType(int) method), saving the workbook without specifying file format type will generate the resultant file with the Workbook's original file format. Thanks for your understanding and hopefully this fix would fulfill your requirement. <span style=“font-size: 9pt; font-family: “Tahoma”,“sans-serif”;”><o:p></o:p> The issues you have found earlier (filed as 14256) have been fixed in this update. This message was posted using Notification2Forum from Downloads module by aspose.notifier.
https://forum.aspose.com/t/cell-getformula-is-not-returning-the-value-that-has-been-set-using-cell-setformula-string-formula/140752
CC-MAIN-2022-21
refinedweb
1,065
67.35
Creating a NotifyingBlockingThreadPoolExecutor A Thread Pool is a useful tool for performing a collection of tasks in parallel. This becomes more and more relevant as CPUs introduce multi-core architectures that can benefit from parallelizing our programs. Java 5 introduced this framework as part of the new concurrency support, with the ThreadPoolExecutor class and other assisting classes. The ThreadPoolExecutor framework is powerful yet flexible enough, allowing user-specific configurations and providing relevant hooks and saturation strategies to deal with a full queue. To best follow this article, you may find it useful to open the ""> ThreadPoolExecutor Java API in a parallel tab. The Need for a Blocking Thread Pool Recently, my colleague Yaneeve Shekel had the need for a thread pool that would work on several tasks in parallel but would wait to add new tasks until a free thread was there to handle them. This is really not something bizarre: in fact, this need is quite common. Yaneeve needed it to analyze a huge directory with a very long list of files, where there was no point in piling on more and more FileAnalyzeTask instances. Other cases in which you'd need a thread pool that can wait to add new tasks: Doing some in-memory task on a long list of database records. You would not want to run and turn each record to a task in the ThreadPoolExecutorqueue while the threads are busy with some long operation on previous records, as doing this would exhaust your memory. The right way to do it is to query the database, run over the result set and create enough tasks for a fixed sized queue, and then wait until there is room in the queue. You can use a cursor to represent the result set, but even if you get back a dynamic result set, the database will not reply with the entire bulk of records; it will send you a limited amount of records and update your result set object while you run over it, forwarding to the next records of your result set, thus only forwarding through the result set. When the queue is ready for more tasks, it reads the next records from the database. Analyzing a long file with "independent lines": each line can be analyzed separately by a different thread. Again, there is no sense in reading the entire file into LineTaskobjects if there is no available thread to handle them. This scenario is in fact a true need ""> raised in a forum asking for a recommended solution. The problem is that ThreadPoolExecutor doesn't give you the required behavior -- blocking when the queue is full -- out of the box. A feature request was even submitted to the Java Bug database ( "">Bug Id 6648211, "Need for blocking ThreadPoolExecutor"), but it was put on "very low priority," as the user is supposedly able to quite easily implement this behavior. At a first glance it looks odd; you think that a ThreadPoolExecutor with a bounded BlockingQueue will give you exactly this behavior. But apparently it does not. In fact, by default it throws RejectedExecutionException if a task is submitted and the queue is full. This happens because ThreadPoolExecutor.execute(Runnable) does not call the blocking method BlockingQueue.put(...) when queuing a task, but rather the unblocking Queue.offer(...), with a timeout of 0, which means "try but do not wait.". And if the result is false (offer failed), it calls the saturation policy -- the assigned RejectExecutionHandler for this thread pool -- with the default handler throwing an exception. Though it seems that there is no real logic in this, it is in fact a design decision, allowing the user to react to the fact that a task is rejected rather than just deciding in the framework to wait or block. Suggested Solutions There are several ways to allow blocking on a full queue: We may implement our own BlockingThreadPoolExecutor and override the execute(...)method, so it will call the BlockingQueue.put(...)instead of BlockingQueue.offer(...). But this may not be so elegant as we interfere quite brutally in how execute()works (and we cannot call super.execute(...)since we do the queuing). There is the option to create a ThreadPoolExecutor with the CallerRunsPolicyreject strategy. This strategy, in the case of a full queue, sends the exceeding task to be executed by the thread that called execute()(the producer), thus killing two birds with one stone: the task is handled and the producer is busy in handling the task and not in overloading the queue with additional tasks. There are, however, two flaws in this strategy. First, the task is not handled in the order it was produced; this is usually not so problematic anyhow, as there is no real guarantee on the order of context switch between the worker threads that influences task progress and order. Second,. (The C++ "">ACE framework for example, implemented the Leader-Followers pattern. For more details on the Leader-Followers pattern, you can follow "">this presentation.) One can implement a simple "counting" ThreadPoolExecutorthat uses a Semaphore initialized to the bound that we want to set, decremented, by calling acquire()at execute(...), and increased back, by calling release()at the afterExecute()hook method, as well as in a catchat the end of execute(...)for the reject scenario. The semaphore is acting in this way as a block on the call to execute(...)and you can in fact use an unbounded BlockingQueuein this case. This solution was suggested by Brian Goetz in a ""> forum reply, and discussed also in his book ""> Java Concurrency in Practice, by Goetz et al., in listing 8.4. Here is how it will look: public class BlockingThreadPoolExecutor extends ThreadPoolExecutor { private Semaphore semaphore; public BlockingThreadPoolExecutor(..., int bound, ...) { super(...); this.semaphore = new Semaphore(bound); } @Override public void execute(Runnable task) { boolean acquired = false; do { try { semaphore.acquire(); acquired = true; } catch (InterruptedException e) { // wait forever! } } while(!acquired); try { super.execute(task); } catch(RuntimeException e) { // specifically, handle RejectedExecutionException semaphore.release(); throw e; } catch(Error e) { semaphore.release(); throw e; } } @Override protected void afterExecute(Runnable r, Throwable t) { semaphore.release(); } } This is a nice solution. A nice adaptation may be to use tryAcquire(timeout)as it is always a better practice to allow a timeout on blocking operations. But anyway, I personally don't like self-managing the blocking operation when the ThreadPoolExecutormay have its own bounded queue. It doesn't make sense for me. I prefer the following solution that uses the bounded queue blocking and the saturation policy. The fourth solution is to create a ThreadPoolExecutorwith a bounded queue and our own RejectExecutionHandlerthat will block on the queue waiting for it to be ready to take new tasks. We prefer to wait on the queue with a timeout and to notify the user if the timeout occurs, so that we will not wait forever in case of some problem in pulling the tasks from the queue. However, for most reasonable scenarios, the caller will not have to take any action when the queue is full, as the producer thread will just wait on the queue. I prefer this approach is it seems the most simple using the original design of ThreadPoolExecutor. Which brings us to this code (see the "#resources">Resources section to download it): public class BlockingThreadPoolExecutor extends ThreadPoolExecutor { public BlockingThreadPoolExecutor( int poolSize, int queueSize, long keepAliveTime, TimeUnit keepAliveTimeUnit, long maxBlockingTime, TimeUnit maxBlockingTimeUnit, Callable<Boolean> blockingTimeCallback) { super( poolSize, // Core size poolSize, // Max size keepAliveTime, keepAliveTimeUnit, new ArrayBlockingQueue<Runnable>( // to avoid redundant threads Math.max(poolSize, queueSize) ), // our own RejectExecutionHandler – see below new BlockThenRunPolicy( maxBlockingTime, maxBlockingTimeUnit, blockingTimeCallback ) ); super.allowCoreThreadTimeOut(true); } @Override public void setRejectedExecutionHandler (RejectedExecutionHandler h) { throw new unsupportedOperationException( "setRejectedExecutionHandler is not allowed on this class."); } // ... } This is our new blocking thread pool. But as you may see, the real thing is still missing and that is our own new RejectExecutionHandler. In the constructor we pass parameters to our super, ThreadPoolExecutor. We use the full version constructor since the most important parameter that we wish to pass to our base class is the RejectExecutionHandler, which is the last parameter. We create a new object of the type BlockThenRunPolicy, our own class (presented in a moment). The name of this saturation policy means exactly what it does: if a task is rejected due to saturation, block on the task submission in the producer thread context, and when there is enough capacity to take the task, accept it. We implement the BlockThenRunPolicy class as a private inner class inside our BlockingThreadPoolExecutor, as no one else should know it. // -------------------------------------------------- // Inner private class of BlockingThreadPoolExecutor // A reject policy that waits on the queue // -------------------------------------------------- private static class BlockThenRunPolicy implements RejectedExecutionHandler { private long blockTimeout; private TimeUnit blocTimeoutUnit; private Callable<Boolean> blockTimeoutCallback; // Straight-forward constructor public BlockThenRunPolicy(...){...} // -------------------------------------------------- @Override public void rejectedExecution( Runnable task, ThreadPoolExecutor executor) { BlockingQueue<Runnable> queue = executor.getQueue(); boolean taskSent = false; while (!taskSent) { if (executor.isShutdown()) { throw new RejectedExecutionException( "ThreadPoolExecutor has shutdown while attempting to offer a new task."); } try { // offer the task to the queue, for a blocking-timeout if (queue.offer(task, blockTimeout, blocTimeoutUnit)) { taskSent = true; } else { // task was not accepted - call the user's Callback Boolean result = null; try { result = blockTimeoutCallback.call(); } catch(Exception e) { // wrap the Callback exception and re-throw throw new RejectedExecutionException(e); } // check the Callback result if(result == false) { throw new RejectedExecutionException( "User decided to stop waiting for task insertion"); } else { // user decided to keep waiting (may log it) continue; } } } catch (InterruptedException e) { // we need to go back to the offer call... } } // end of while for InterruptedException } // end of method rejectExecution // -------------------------------------------------- } // end of inner private class BlockThenRunPolicy Note that we may get a timeout when waiting on the queue, on the call to queue.offer(...). It is always the right practice to use a timeout-enabled version of a blocking call, rather than any "wait-forever" version. This way it is easier to be aware of and troubleshoot cases of thread starvation and deadlocks. In this case, we do not log the event of getting the timeout, as we do not have a logger at hand. But still, this is a major event, especially if we set a long timeout that we do not expect to happen. This is why we ask the user to provide a callback so we can report the event and let the user decide whether to just log and keep waiting or stop the wait. Our solution preserves the default behavior of ThreadPoolExecutor, except for the saturation policy. Since we use inheritance, any setter or getter of the original ThreadPoolExecutor can be used, excluding the setRejectedExecutionHandler, which we forbid, throwing an exception if called. "">Prometheus, another open source approach to the blocking thread pool problem, used a wrapper solution as a straightforward approach (with the following "">API). However, the wrapper solution requires implementing all ExecutorService interface methods -- in order to be a common ExecutorService -- resulting with a quite cumbersome solution compared to our more organic extension. Almost Done We have a BlockingThreadPoolExecutor. But bear with me for a few more moments, as we are about to ask for more. Remember our problem. We have a huge directory filled with files and we wanted to block on the queue if it is full. But we need something more. When all files are sent to the queue, the producer thread knows it is done sending all the files, but it still needs to wait for the worker threads to finish. And we do not want to shut down the thread pool and wait for it to finish that way, as we are going to use it in a few moments again. What we need is a way to wait for the final tasks sent to the thread pool to complete. To do that we add a "synchronizer" object for the producer to wait on. The producer will wait on a new method we create, which we called await(), but there is an underlying condition inside that waits for a signal, and this is our Synchronizer. The thread pool signals the Synchronizer when it is idle; that is, all worker threads are idle. To have this info we simply count the number of currently working threads. We do not rely on the getActiveCount() method, as its contract and definition are not clear enough; we prefer to simply do it ourselves using an AtomicInteger to make sure that increment and decrement operations are done atomically, without a need to synchronize around ++ or --. Here we use the beforeExecute() and afterExecute() hook methods, but must take care of tasks that failed at the execute point, before assuming position in the queue, in which case decreasing the counter must be done. Our Synchronizer class manages the blocking wait on the await() method, by waiting on a Condition that is signaled only when there are no tasks in the queue. The resulting code is this: public class NotifyingThreadPoolExecutor extends ThreadPoolExecutor { private AtomicInteger tasksInProcess = new AtomicInteger(); // using our own private inner class, see below private Synchronizer synchronizer = new Synchronizer(); @Override public void execute(Runnable task) { // count a new task in process tasksInProcess.incrementAndGet(); try { super.execute(task); } catch(RuntimeException e) { // specifically, handle RejectedExecutionException tasksInProcess.decrementAndGet(); throw e; } catch(Error e) { tasksInProcess.decrementAndGet(); throw e; } } @Override protected void afterExecute(Runnable r, Throwable t) { super.afterExecute(r, t); // synchronizing on the pool (and all its threads) // we need the synchronization to avoid more than one signal // if two or more threads decrement almost together and come // to the if with 0 tasks together synchronized(this) { tasksInProcess.decrementAndGet(); if (tasksInProcess.intValue() == 0) { synchronizer.signalAll(); } } } public void await() throws InterruptedException { synchronizer.await(); } // (there is also an await with timeout, see the full source code) } We need now to provide the Synchronizer class that does the actual locking and synchronization work. We prefer to implement the Synchronizer class as a private inner class inside our NotifyingThreadPoolExecutor, as no one else should know it. //-------------------------------------------------------------- // Inner private class of NotifyingThreadPoolExecutor // for signaling when queue is idle //-------------------------------------------------------------- private class Synchronizer { private final Lock lock = new ReentrantLock(); private final Condition done = lock.newCondition(); private boolean isDone = false; // called from the containing class NotifyingThreadPoolExecutor private void signalAll() { lock.lock(); // MUST lock! try { isDone = true; done.signalAll(); } finally { lock.unlock(); // unlock even in case of an exception } } public void await() throws InterruptedException { lock.lock(); // MUST lock! try { while (!isDone) { // avoid signaling on 'spuriously' wake-up done.await(); } } finally { isDone = false; // for next call to await lock.unlock(); // unlock even in case of an exception } } // (there is also an await with timeout, see the full source code) } // end of private inner class Synchronizer //-------------------------------------------------------------- As we needed both the notifying and the blocking features together, we combined them both to a NotifyingBlockingThreadPoolExecutor, whose code and an example of use can be found in the example source code. Conclusions Occasionally there is a need to accomplish something that is not supported out of the box in a framework at hand. The first thought is usually: "it ought to be there, I must have missed something!" Then, after a while, after we search and investigate, we realize that the thing is indeed missing. At this point we are close to convincing ourselves that there is a reason for not having this ability, and we probably don't really need it. ("There must be a reason for not having it there. Who are we to argue?!") But the bravest of us would not compromise. Good frameworks are built to be extended, and so be it. In this article we presented the need we faced for a blocking thread pool. This need is not a whim; other people, as can be seen in the "#resources">resources list, already raised this need. It is a bit surprising that the Java API does not provide this ability, but as seen, there are couple of good extensions that can be implemented to support this need. While implementing this feature, we went through the difference between offer() and put() on a BlockingQueue, the Rejection Policy of the thread pool framework, the beforeExecute() and afterExecute() hook methods, and some other related java.concurrent players, such as Lock, Signals, and AtomicInteger. The implementation presented here, together with the sample code provided, may serve both as a good solution for the blocking thread pool need, as well as a reference for other related ThreadPoolExecutor extensions. Acknowledgments I would like to thank Yaneeve Shekel for bringing this problem to me and working with me on parts of the code presented here. Resources - Sample code for this article - ""> ThreadPoolExecutor: Java 6 API - Java "">Bug ID 6648211 on the lack of this required feature - IBM DeveloperWorks "" name="ref3">forum entry about this topic - ""> Java Concurrency in Practice by Brian Goetz et al. - "">Prometheus: An open source library with a straightforward approach for solving our need. The guide was empty when I last checked it, but you can download the code or view the API. I personally prefer our more organic extension. - On the "">Leader-Followers design pattern : see slides 16-18. - Another "">forum entry on the subject - Yet another ""> post requesting for this feature - And, yet ""> another forum discussion on the exact same subject - Login or register to post comments - Printer-friendly version - 23056 reads Very interesting post, however I wondered whether this code ... by gperrot - 2012-01-16 08:41 Very interesting post, however I wondered whether this code section could be simplified: boolean acquired = false; do { try { semaphore.acquire(); acquired = true; } catch (InterruptedException ie) { // wait forever! } by just using semaphore.acquireUninterruptibly()
https://today.java.net/pub/a/today/2008/10/23/creating-a-notifying-blocking-thread-pool-executor.html
CC-MAIN-2014-10
refinedweb
2,911
52.39
Class wrapping Exposing D classes to Python is easy! The heart of Pyd's class wrapping features is the wrap_class function template: void wrap_class(T, char[] classname = symbolnameof!(T), Params...) (); - T is the class being wrapped. - classname is the name of the class as it will appear in Python. It defaults to the name of the D class. If you are wrapping an instance of a class template, you will have to provide this explicitly. - Params is a series of struct types (defined below), which define the various members of the class. Calls to wrap_class must occur after calling module_init. To expose the constructors, methods, and properties of the class, you must pass wrap_class instantiations of these struct templates. struct Def(alias fn, char[] name = symbolnameof!(fn), fn_t = typeof(&fn)); - This wraps a method of the class. It functions very much like the deffunction used to wrap regular functions, with one very important difference: There is no support for default arguments. (This is a side-effect of the fact that you cannot call an alias of a method in D, and delegates do not understand default arguments.) struct StaticDef(alias fn, char[] name = symbolnameof!(fn), fn_t = typeof(&fn), uint MIN_ARGS = minArgs!(fn)); - This wraps a static member function of the class. It also functions exactly like the deffunction used to wrap regular functions, and even includes support for default arguments. struct Property(alias fn, char[] name = symbolnameof!(fn), bool RO = false); - This wraps a property. See the examples below for more details. - fn is the name of the property. propwill automatically attempt to wrap both the "get" and "set" forms of the property, unless RO is specified. - name is the name of the property as it will appear in Python. As with def, propwill attempt to derive this automatically. - RO specifies whether this is a read-only property. If true, it will only wrap the "get" form of the property. If false, it will wrap both the "get" and "set" forms. (This is a little hackish, and I will probably try to make this detection more automatic in the future. It also means it cannot support a property that only has a "set" form.) struct Init(C ...); - This allows you to expose the class's constructors to Python. If the class provides a zero-argument constructor, there is no need to specify it; it is always available. Each element of C should be a function type. Each function type should correspond to a constructor. (That is, the arguments to the function type should be the same as the arguments to the class constructor. The return type is ignored.) There is an additional limitation at this time: No two constructors may have the same number of arguments. Pyd will always attempt to call the first constructor with the right number of arguments. If you wish to support a constructor with default arguments, you must specify each possible constructor call as a different template argument to this function. The examples show a few uses of Init. struct Repr(alias fn); - This allows you to expose a member function of the class as the Python type's __repr__function. The member function must have the signature char[] function(). struct Iter(iter_t); - This allows the user to specify a different overload of opApply than the default. (The default is always the one that is lexically first.) The iter_t argument should be the type of the delegate that forms the argument to opApply. This might be e.g. int delegate(inout int). Don't forget the inoutmodifiers! (This is not available in Linux; see the note below on opApply wrapping.) struct AltIter(alias fn, char[] name = symbolnameof!(fn), iter_t = implementationDetail); - This wraps alternate iterator methods as Python methods that return iterator objects. The wrapped methods should have a signature like that of opApply. (In other words, they should be methods intended to be used with D's ability to iterate over delgates.) The iter_t argument should be the type of the delegate argument to the method. This will usually be derived automatically. (This is not available in Linux; see the note below on opApply wrapping.) If you ever wish to check whether a given class has been wrapped, Pyd helpfully registers all wrapped classes with the is_wrapped template, which is just a templated bool: template is_wrapped(T); If you have a class Foo, you can check whether it is wrapped by simply checking whether is_wrapped!(Foo) is true. It is important to note that this is not a const bool, it is a runtime check. Automatic operator overloading Pyd will automatically wrap most of D's operator overload functions with appropriate Python operator overloads. There are some caveats: - Pyd will only automatically wrap the lexically first opFunc defined for a given opFunc. (In the future, I may add a mechanism allowing a user to specifiy a specific overload of an opFunc.) - The usual rules for function wrapping apply: Only an opFunc whose return type and arguments are convertable may be wrapped. (The current implementation is pretty dumb: If the lexically first opFunc has an unconvertable return type or argument, the operator overload will still be wrapped, but won't work.) At the moment, only the following operator overloads are supported: opNeg, opPos, opCom, opAdd, opSub, opMul, opDiv, opMod, opAnd, opOr, opXor, opShl, opShr, opCat, opAddAssign, opSubAssign, opMulAssign, opDivAssign, opModAssign, opAndAssign, opOrAssign, opXorAssign, opShlAssign, opShrAssign, opCatAssign, opIn_r, opCmp, opCall, opApply, opIndex, opIndexAssign, opSlice, opSliceAssign Missing from this list are opUShr and opUShrAssign. Python does not have an unsigned right-shift operator, so these operator overloads are not supported. (You may still wrap them with a normal method using Def, of course.) Also missing from the list is opApplyReverse. This must be wrapped explicitly with AltIter. Also missing from the list is opAssign. Python has strict reference semantics for its objects, so overloading the assignment operator is not possible. You must explicitly wrap opAssign with a regular method. Additionally, if a class provides a length property, Pyd will automatically make it available via Python's built-in function len and the special __len__ method. You may still wrap it with Property or Def if you wish it to be available as a normal property or method. Notes on wrapped operators opApply - Pyd wraps D's iteration protocol with the help of Mikola Lysenko's StackThreads package. This package does not work in GDC, and so opApply wrapping is not available in Linux. See also the with_stoption offered by CeleriD. opSlice, opSliceAssign - Pyd only supports these overloads if both of their two indexes are implicitly convertable to type int. This is a limitation of the Python/C API. Note that this means the zero-argument form of opSlice (for allowing the "empty slice," e.g. foo[]) cannot be wrapped. (I may work around this in the future.) Because Pyd can only automatically wrap the lexically-first method in a class, it will fail to wrap opSlice and opSliceAssign if you define an empty form first. opCat, opCatAssign - Python does not have a dedicated array concatenation operator. The plus sign ( +) is reused for this purpose. Therefore, odd behavior may result with classes that define both opAdd/opAddAssignand one or both of these operators. (Consider yourself warned.) However, the Python/C API considers addition and concatenation distinct operations, and so both of these sets of operator overloads are supported. opIn_r - Python expects the inoperator to return a boolean value (it is a containment test). D convention is for into search for the value in the container, and to return a pointer to the found item, or nullif the item is not found. That said, D does not enforce any particular signature on the inoverload, while the Python/C API does. Pyd will check the boolean result of a call to opIn_r, and return that value to Python. Examples Suppose we have the following simple class: import std.stdio; class Foo { int m_i; this() { m_i = 0; } this(int j) { m_i = j; } this(int j, int k) { m_i = j + k; } int i() { return m_i; } void i(int j) { m_i = j; } void foo(char[] s) { writefln(s, m_i); } Foo opAdd(Foo rhs) { return new Foo(m_i + rhs.m_i); } } We would expose this class to Python by putting this code in PydMain after the call to module_init: // Call wrap_class wrap_class!( Foo, // Wrap the "foo" method Def!(Foo.foo), // Wrap the "i" property Property!(Foo.i), // Wrap the constructors. Init!(void function(int), void function(int, int)) ); Now we can use this type from within Python like any other type. >>> from testmodule import Foo >>> f = Foo() >>> f.i 0 >>> f.i = 20 >>> f.foo("Hello! i is ") Hello! i is 20 >>> f = Foo(10, 10) >>> f.i 20 >>> g = Foo(30) >>> g.i 30 >>> e = f + g >>> e.i 50 >>> # We can even subclass our D type >>> class MyFoo(Foo): ... def bar(self): ... print "Hey, i+3 is", self.i + 3 ... >>> h = MyFoo(3) >>> h.bar() Hey, i+3 is 6 >>>
http://pyd.dsource.org/class_wrapping.html
CC-MAIN-2014-15
refinedweb
1,495
66.74
This article about using xlwt to generate Excel in Python reminded me I needed to see exactly how to set column widths (the xlwt documentation doesn’t cover it). Let’s create a new Excel workbook and add a sheet: >>> import xlwt >>> book = xlwt.Workbook(encoding='utf-8') >>> sheet = book.add_sheet('sheeeeeet') We need to get a column in order to set its width. You do that by call col() on the sheet, passing the column’s index as the only argument (or row() for accessing rows): >>> sheet.col(0) # First column <xlwt.Column.Column object at 0x10b2a6190> >>> sheet.row(2) # Third row <xlwt.Row.Row object at 0x10b2a7050> The index is zero-based. You can fetch a column even if you have not written to any cell in that column (this applies equally to rows). Columns have a property for setting the width. The value is an integer specifying the size measured in 1/256 of the width of the character ‘0’ as it appears in the sheet’s default font. xlwt creates columns with a default width of 2962, roughly equivalent to 11 characters wide. >>> first_col = sheet.col(0) >>> first_col.width = 256 * 20 # 20 characters wide (-ish) >>> first_col.width 5120 For rows, the height is determined by the style applied to the row or any cell in the row. (In fact rows also have a property called height but it doesn’t do what you want.) To set the height of the row itself, create a new style with a font height: >>> tall_style = xlwt.easyxf('font:height 720;') # 36pt >>> first_row = sheet.row(0) >>> first_row.set_style(tall_style) Setting the style on the row does not change the style of the cells in that row. There is no obvious way to set a default width and height for all columns and rows. An instance of xlwt.Worksheet.Worksheet has properties for col_default_width and row_default_height but changing those does not actually change the defaults. The problem is that new columns are always created with an explicit width, while rows take their height from the style information. My first attempt at setting defaults set the width on every column and the height on every row. It works, but creates 65,536 unnecessary empty row objects. A slightly better approach is to set the width on every column and to set the font height on the default style record in the workbook: import itertools import xlwt book = xlwt.Workbook(encoding='utf-8') sheet = book.add_sheet('sheeeeeet') col_width = 256 * 20 # 20 characters wide try: for i in itertools.count(): sheet.col(i).width = col_width except ValueError: pass default_book_style = book.default_style default_book_style.font.height = 20 * 36 # 36pt book.save('example.xls') Here I used itertools.count() and wrapped the loop in a try block so I can forget exactly how many columns are permitted. When the loop tries to access a bad index it will throw ValueError and the loop will exit. You mustn’t replace the default style on an instance of xlwt.Workbook.Workbook, you have to update the property of the existing style (to ensure you are changing the first style record). Unfortunately there is no way to set a default column width (as of xlwt version 0.7.2) so the brute force method of setting every column will have to do – it isn’t so bad since there are only 256 columns. Talking of widths and heights, have you heard “Widths & Heights” by Magic Arm? Is good. about ‘(In fact rows also have a property called height but it doesn’t do what you want.)’ – it worked for me as in tutorial page 33 ‘By default, the height of a row is determined by the tallest font for that row and the height attribute of the row is ignored. If you want the height attribute to be used, the row’s height_mismatch attribute needs to be set to 1.’ example from my code: ws.row(rowindex).height_mismatch = 1 ws.row(rowindex).height = 1000 hope this helps :) Following up on eorg’s comment, I also found the height property of rows to work in the way you’d expect, contrary to what the blog post says. However, in my case, I didn’t even do anything with the height_mismatch attribute. Maybe in more recent versions of xlwt the height_mismatch attribute it set to 1 by default. Pretty! This was an extremely wonderful post. Thank you for supplying this info.| Thanks.
https://buxty.com/b/2011/10/widths-heights-with-xlwt-python/
CC-MAIN-2019-47
refinedweb
739
74.19
| -a[ll] | -c[olor] | -br[ief] | -j[son] | -p[retty] } OPTIONS - -V, -Version - Print the version of the ip utility and exit. - -h, -human, -human-readable - output statistics with human readable values followed by suffix. - . - -d, -details - Output more detailed information. - -l, -loops <COUNT> - Specify maximum number of loops the 'ip address flush' logic will attempt before giving up. The default is 10. Zero (0) means loop until all addresses are removed. - -f, -family <FAMILY> - Specifies the protocol family to use. The protocol family identifier can be one of inet, inet6, bridge, mpls. - -B - shortcut for -family bridge. - -M - shortcut for -family mpl. - -n, -netns <NETNS> - switches ip to the specified network namespace NETNS. Actually it just simplifies executing of: ip netns exec NETNS ip [ OPTIONS ] OBJECT { COMMAND | help } to ip -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help } - -a, -all - executes specified command over all objects, it depends if command supports this option. - -c[color][={always|auto|never} - Configure color output. If parameter is omitted or always, color output is enabled regardless of stdout state. If parameter is auto, stdout is checked to be a terminal before enabling color output. If parameter is never, color output is disabled. If specified multiple times, the last one takes precedence. This flag is ignored if -json is also given... - tcp_metrics/tcpmetrics - - manage TCP Metrics - token - - manage tokenized interface identifiers. - tunnel - - tunnel over IP. - tuntap - - manage TUN/TAP
https://jlk.fjfi.cvut.cz/arch/manpages/man/ip.8
CC-MAIN-2019-30
refinedweb
234
52.36
Or just use addition... #include <stdio.h> int main(int argc, char *argv[]) { float f; int x; int e = 0; Type: Posts; User: hamster_nz Or just use addition... #include <stdio.h> int main(int argc, char *argv[]) { float f; int x; int e = 0; But.... Why? I mean, it is possible, and I can do it, but why do you want to? And why the restriction on what elementary operators you can use? Here is using the "read" and "write" system calls directly. Note that this program needs no header files, as it is accessing the Linux system calls directly rather than using any library functions... To write an integer to a file int i; fwrite(&i,sizeof(i),1,f); To read an integer from a file Here's a state machine for traffic lights. It might give you ideas: #include <stdio.h> #include <unistd.h> enum State { state_all_stop, state_NS_go, state_NS_stopping, state_WE_go,... I don't usually support gambling, but in this case I bet you are asking us to do your homework for you. Which header file is DBL_MANT_DIG defined in? Ah, found it - float.h That is a pretty good solution. This isn't perfect and isn't portable, but how I would think about it. Note I haven't tested it on multiple platforms #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include... It's pretty inefficient, and I'm not so sure that "range == 0" is a good idea. If doing this, I would generate random bits for the memory holding the double, then explicitly mask and set the sign... It looks like you are not checking that you are correctly opening the output file dst = fopen(obuf, "w+"); You should check to see if dst is not NULL. Even just enabling warnings on your compiler will help... gcc -o main main.c -Wall -pedantic -O4 main.c: In function ‘main’: main.c:24:18: warning: implicit declaration of function ‘fatal’... ... just to be sure... Can you show where you open the file to read it? There is one more number between 1.0-DBL_EPSILON and 1.0: #include <float.h> #include <stdio.h> void printhex(void *x, size_t s) { for(size_t i = 0; i < s; i++) Me? I would most likely do what I did when I needed random numbers that were inside a sphere. Generate random numbers between -1 and 1 (inclusive), and if it s >= 1.0 or <= -1.0 then just loop and... So I've got this 10GB file of 'baseband' data. It's a 2-channel WAV file, but rather than left and right stereo it's what is called I+Q. It's called baseband because rather than a radio signal at... If it is an integer -1 < x < 1 then it doesn't leave many options.... The first thing I see is that >= 0should just be > 0. Currently I am working on decoding the telemetry of the Falcon 9 second stage. I've got a raw 10GB data file of the baseband signal, so am building on my DSP skills to convert it into the binary... One nice project would be a multithreaded prime number finder. It has quite a few interesting features... I reformatted your code's intentation void main (void) { //SET UP ANSEL = 0; //turn off all analog inputs ANSELH = 0; That code is completely unencumbered, so anybody can use it however you like. Pfease feel free to use it in a MIT Licensed project. Oh, I don't know about PNG files, but BMP files are pretty... With a seed of zero, after a while it gets stuck in a loop of repeating 35,246 values. If you are feeling idle, try this: static uint32_t my_rng(unsigned int x) { unsigned int b; b... I hope I haven't coded it wrong.... #include <stdio.h> #include <limits.h> #include <time.h> #define bitsof(x) (sizeof(x)*CHAR_BIT) Here's two writers, one reader. Expand as needed. #include <stdio.h> #include <string.h> #include <sys/types.h> #include <unistd.h> #include <errno.h>
https://cboard.cprogramming.com/search.php?s=6e8e89c3d99059f3f1de8426b77c28c8&searchid=6599251
CC-MAIN-2021-21
refinedweb
677
78.14
Hi,I am creating a custom control which will be used in a sharepoint page.I am trying to localize the content of that custom control in the code.I have added resx files to the class library, Myres.resx and Myres.de-DE.resx.I have build the class libary and placed the dll in GAC.I am trying to get the resource strings by using the Resource Manager.Here is the code: string strLanguageCode = Thread.CurrentThread.CurrentCulture.Name; Thread.CurrentThread.CurrentUICulture = new CultureInfo(strLanguageCode.ToString()); ResourceManager rm = new ResourceManager("MyRes", System.Reflection.Assembly.Load("MyRes")); result = rm.GetString(resourceKey); But I am unable to get the code work. And getting the following error. Could not find any resources appropriate for the specified culture or the neutral culture. Make sure \"xxxx.Resource.resources\" was correctly embedded or linked into assembly \"xxxx\" at compile time, or that all the satellite assemblies required are loadable and fully signed. What should be done to make localization to work with class library to be used in sharepoint custom webparts/custom controls. Thank in Advance, mswin I had just solve this issue. I had been troubled with it for so many days. My problem solving method below: please look at your codes below: ResourceManager rm = new ResourceManager("MyRes", System.Reflection.Assembly.Load("MyRes")); result = rm.GetString(resourceKey); And make sure that "MyRes" is the name combined with your namespace name and your resource name for example: your namespace is "W" and your resource name is "Y.resource", and now you must name your ResourceManager like this ResourceManager rm = new ResourceManager("W.Y", System.Reflection.Assembly); now the project will run as usual! I solve this error in this way ,and I hope my opinion will help you. Thank and best regards ----Kevin Wangyy Moderator Notes: 1. NEVER propose your own posts as answers. The "Propose as Answer" function is there for people to propose the good answers of other people. NOT for self-proposing. 2. Do not ask people to contact you by e-mail. Further questions and answers to this subject should be in the thread. NOT off-line. 3. Do not use Bold throughout most of your posts. Several lines of Bold, removed. Microsoft is conducting an online survey to understand your opinion of the Msdn Web site. If you choose to participate, the online survey will be presented to you when you leave the Msdn Web site. Would you like to participate?
https://social.msdn.microsoft.com/Forums/sharepoint/en-US/5da00cee-840d-4bd0-86dd-8d19a870527d/localized-webparts-and-custom-controls-could-not-find-any-resources-appropriate-for-the-specified?forum=sharepointdevelopmentlegacy
CC-MAIN-2017-47
refinedweb
411
60.82
This blog is about Integration Gateway (IGW) in SAP Mobile Platform 3.0 (SMP). The Integration Gateway component allows to expose backend data as an OData service. There’s support for some concrete data sources like JDBC, JPA, REST service, and for extending the capabilities it is possible to write custom code. This custom code is placed in a script file which can easily become very long. For example, when implementing $filter, $orderby, deltatoken, etc Another point is that often such manual coding is repeated in several scripts. For Example, in the REST data source, the tasks to convert the payload is very similar in the QUERY and in the READ operations, and is repeated in the response of CREATE, etc It would be nice to reuse the code instead of duplicating it. However, it is not possible to modularize the code to split the script file into several files or to add several Java classes to the OData implementation project that we create in the API toolkit for SAP Mobile Platform in Eclipse. You don’t need to try. But don’t you feel the wish – like me – to clean up the code, modularize it, use Java for more complex tasks? And also the wish to – wow – debug the code with normal Java debugger? Yes? So please go ahead and read how I solved it: – Move all the code into a separate OSGi bundle. – Deploy that bundle to SMP server – Reference this bundle from my OData implementation project. – Debug the bundle as a “Remote Java Application” In the present tutorial, I’m going to describe it in detail. As usual, we’ll keep our example as simple as possible. The source code can be found attached to this blog post. Note: this tutorial doesn’t represent the official documentation. It is just my personal way of working. In the first part, we’ll cover the OSGi bundle In the second part, we’ll write the OData service In the third part, we’ll debug the running Java code Finally, in the fourth part, we’ll use junit to test our API before publishing it Prerequisites - SAP Mobile Platform 3.0 (SMP) installation, SP level 09 or higher - Eclipse with SAP Mobile Platform Tools installed check this blog for help - Basic knowledge about SMP and Integration Gateway Check this blog for some introduction - Introduction to Custom Code data source Integration Gateway: Understanding CUSTOM CODE data source [1]: read operations, very simplified - OSGi knowledge is not required Overview Part I 1. Prepare SMP server 2. Prepare Eclipse 3. Create the OSGi bundle 3.1. Create Plug-In project 3.2. Implement DataProvider class 3.3. Implement Activator class 3.4. Deploy the bundle to SMP 3.5. Verify the deployed bundle 4. Create the OData service 4.1. Implement the QUERY operation 4.2. Adding $skip and $top capability 4.3. Implement the READ operation 5. Test the OData service 6. Debug the Java code 6.1. Start SMP server in debug mode 6.2. Connect from Eclipse to SMP 6.3. Debug the Java code in Eclipse 7. Summary 8. Links 9. Test the API automatically 9.1. Create test fragment 9.2. Create JUnit tests 9.3. Run the tests 9.4. Summary 1. Prepare SMP server Usually, the SMP server is installed and started as Windows service. During development, I prefer to start it from the command shell. Reason: I can quickly view console logs How to start the SMP server from console? Open command prompt. Navigate to the location where you’ve installed the SMP Step into the \Server directory Type go.bat (or simply go) and hit enter Then wait until you see the ready-message Don’t you feel happy – like me – whenever you see this message? 🙂 2. Prepare Eclipse When we create a bundle in Eclipse, then the dependencies are managed as dependencies to other bundles. Eclipse resolves the bundle-dependencies to those bundles that are installed inside Eclipse (and projects in workspace). This means, your bundle can only depend on bundles that are available in Eclipse. When writing bundles to be running inside Eclipse, this is fine. But when writing a bundle that is designed to run in a different environment, this is obviously not sufficient. Like In our case: We want to write a bundle that will afterwards run in SMP (which is also based on OSGi). It is possible to use the standard Eclipse IDE for creating that bundle and it will run fine in SMP BUT: our bundle has dependencies to bundles which run in SMP (not in Eclipse) So what we want is: compile against SMP. Eclipse supports that with the concept of “Target Platform”, which can be defined in Eclipse. I’ve explained that in detail in my SCN document Configure SMP as target platform The steps are: Open the Target Platform preference page at Window->Preferences->Plug-in Development->Target Platform Here you can see that as per default, our bundle would compile against the currently running Eclipse instance. What we now are going to do is to add the SMP server to this list and define it as the target against which we compile. Press “Add”. Select “Nothing” and press “Next”. Enter an arbitrary name for this target e.g. “SMP_local” Press “Add”. Choose “Installation”. “Browse” to the location of the locally installed SMP e.g. C:\SMP \server Note:. 3. Create the OSGi bundle What we want to achieve in this tutorial is to create an OData service that runs in SMP and that exposes data that is provided and managed by a separate OSGi bundle. We’re going to create this separate bundle in the current chapter. This bundle will represent the data model (note: this is not the OData model) and it will offer a simple API that can be called by other bundles in order to obtain the data. As such, it will act as “Data Provider”. It will also host all logic to manipulate the data and it will host helper methods that will be called from the OData service that we’ll create later. This Data-Provider-Bundle will be manually deployed to SMP Then we’ll create our OData project and there we’ll call the API of the Data-Provider-Bundle to get the data and expose it as OData service 3.1. Create Plug-In project Within Eclipse, open Java perspective via Window->Open Perspective->Java Create a new bundle project as follows: Choose File->New->Project->Plug-In Development->Plug-In Project Press Next and enter the details of the project: Enter the project name: com.example.dataprovider Select as Target Platform “an OSGi framework” and value “Equinox” Note: With this setting we specify that our bundle is not intended to run in Eclipse (which is based on OSGi as well), but in a different OSGi-environment. Our OSGi-environment is our SMP server and it is based on Equinox Equinox is an implementation of the OSGi specification. Since we aren’t using any special OSGi features, it actually doesn’t make much difference for us. Press Next and enter the details of the bundle Bundle-ID: com.example.dataprovider Version: 1.0.0 Bundle Name: Example Dataprovider Vendor: ExampleVendor Please make sure that you stick to this naming, because it will be used for the java packages as well and the package will be used by the OData service project. Press next and deselect the template creation Press Finish In the subsequent popup, choose “No” to not change to Plug-In Development perspective Result: The project is created and the editor of the MANIFEST.MF file is opened. Declare dependencies Before starting with the code, we need to declare the dependencies, otherwise our code won’t compile. In our code, we will be using API that is provided by Olingo, the OData library. This library is available as a bundle in the SMP server, so we can use it in our Data-Provider-Bundle. Furthermore, we’re using the library for custom code provided by the Integration Gateway framework. If not already open, open the manifest file via double-click on <project>/META-INF/MANIFEST.MF Open the “Dependencies” tab on the bottom of the editor. On the left pane, we can declare the bundles that we need. Click on “Add” Select the bundle olingo-odata2-api Press OK Repeat the steps for adding com.sap.gw.rt.camel.components.custom-development As usual, save the editor. Note: The description above declares a dependency to a bundle. Dependencies can as well be declared in a more fine-granular way with the concept of Import Package, where you explicitly declare which package you need. Declare Exports After adding the required dependencies of our bundle to other bundles, we have to declare that our bundle can be used by others. Remember: we’re creating the bundle because we want to use it from our OData service that we’ll be creating later. In order to expose our API, the corresponding concept is to “export packages” We switch to the “Runtime” tab in the bottom of the editor, press “Add” and choose the one and only package that our bundle contains. Don’t forget to save the editor. Finally, we can start writing some code What code? -> This code: We want to have sample data -> That code: We want to offer it via an API 3.2. Implement DataProvider class Create new Java class com.example.DataProvider Note: For the sake of simplicity, we don’t create new packages. If you do so, remember that you have to export it as well. What we want to achieve in this class is to – offer a public method that provides all products This method will be called from the OData service when the QUERY operation is executed e.g. – offer a public method that provides one single product for a given ID This method will be called from the OData service when the READ operation is executed e.g.(‘1’) – offer a public method that provides a list of the first n products This method will be called from the OData service when the QUERY operation is executed with $top e.g. – offer a public method that provides a list of the last n products This method will be called from the OData service when the QUERY operation is executed with $skip e.g. In our example the DataProvider class does not only provide the data, but as well handles the Message object. The sample code looks as follows: package com.example.dataprovider; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Locale; import java.util.Map; import org.apache.olingo.odata2.api.commons.HttpStatusCodes; import org.apache.olingo.odata2.api.exception.ODataApplicationException; import org.apache.olingo.odata2.api.uri.KeyPredicate; import org.apache.olingo.odata2.api.uri.UriInfo; import com.sap.gateway.ip.core.customdev.util.Message; public class DataProvider { // the Message object contains all context information private Message message; /* public API */ // constructor public DataProvider(Message message) { super(); this.message = message; } // QUERY operation public List<Map<String, String>> getAllProducts(){ List<Map<String, String>> productList = new ArrayList<Map<String, String>>(); // create some sample product entities as HashMaps for (int i = 1; i <= 5; i++) { String index = Integer.toString(i); Map<String, String> productMap = new HashMap<String, String>(); productMap.put("ID", index); productMap.put("Name", "ProductName" + index); productMap.put("Description", "Description" + index); productList.add(productMap); } return productList; } // READ operation public Map<String, String> getProduct(){ // check the URI for the ID of the requested product UriInfo uriInfo = (UriInfo) this.message.getHeaders().get("UriInfo"); List<KeyPredicate> keyPredicates = uriInfo.getKeyPredicates(); KeyPredicate keyPredicate = keyPredicates.get(0); // we know there's only 1 key prop String productID = keyPredicate.getLiteral(); // the value that is given in the URL return getProduct(productID); } public List<Map<String, String>> handleSkip(List<Map<String, String>> productList) throws ODataApplicationException{ UriInfo uriInfo = (UriInfo) this.message.getHeaders().get("UriInfo"); Integer skipOption = uriInfo.getSkip(); // if skipOption is null, then there's no $skip in the URI, so only do something if it is there if(skipOption != null){ int skipNumber = skipOption.intValue(); productList = this.applySkip(productList, skipNumber); } return productList; } public List<Map<String, String>> handleTop(List<Map<String, String>> productList) throws ODataApplicationException{ UriInfo uriInfo = (UriInfo) this.message.getHeaders().get("UriInfo"); Integer topOption = uriInfo.getTop(); if(topOption != null){ // if skipOption is null, then there's no $skip in the URI, so only do something if it is there int topNumber = topOption.intValue(); productList = this.applyTop(productList, topNumber); } return productList; } /* * Internal methods * */ // READ operation public Map<String, String> getProduct(String productID){ // find the requested product List<Map<String,String>> allProducts = getAllProducts(); for (Iterator<Map<String, String>> iterator = allProducts.iterator(); iterator.hasNext();) { Map<String, String> map = (Map<String, String>) iterator.next(); String idValue = map.get("ID"); if (idValue.equals(productID)){ return map; } } return null; } // $top private List<Map<String, String>> applyTop(List<Map<String,String>> allProducts, int topNumber) throws ODataApplicationException{ if(topNumber >= 0 && topNumber <= allProducts.size()){ return allProducts.subList(0, topNumber); }else{ throw new ODataApplicationException("Invalid value for $top", Locale.ROOT, HttpStatusCodes.BAD_REQUEST); } } // $skip private List<Map<String, String>> applySkip(List<Map<String,String>> allProducts, int skipNumber) throws ODataApplicationException{ if(skipNumber >= 0 && skipNumber <= allProducts.size()){ return allProducts.subList(skipNumber, allProducts.size()); }else{ throw new ODataApplicationException("Invalid value for $skip", Locale.ROOT, HttpStatusCodes.BAD_REQUEST); } } } 3.3. Implement Activator class I guess that you’ll feel like me, that it would be nice to test the bundle, after it is finalized and deployed to SMP. Such that we can be sure that our OData service will be able to safely make use of our DataProvider bundle. In order to test our bundle, we could write a second bundle. But it is easier to proceed as described below. After deploying our bundle to SMP, the OSGi runtime will immediately activate the bundle. When a bundle gets activated, the “start” method of the Activator class of the bundle gets invoked. When we created our bundle-project above, we specified that we want an Activator class to be generated (see the screenshot above). Now we can make use of it. We’ll add some dummy code to the “start” method, in order to call our DataProvider and write the result to the console. After deployment, we can check the console if the expected output is there. We can even change to the OSGi console and there we can manually stop the bundle, then start it again and each time we start it, we’ll see the same output (see section below) package com.example.dataprovider; import java.util.Iterator; import java.util.List; import java.util.Map; import org.osgi.framework.BundleActivator; import org.osgi.framework.BundleContext; public class Activator implements BundleActivator { private static BundleContext context; static BundleContext getContext() { return context; } public void start(BundleContext bundleContext) throws Exception { Activator.context = bundleContext; System.out.println("\n"); System.out.println("[EXAMPLE] Printing all Products: "); List<Map<String,String>> allProducts = new DataProvider(null).getAllProducts(); for (Iterator<Map<String, String>> iterator = allProducts.iterator(); iterator.hasNext();) { Map<String, String> map = (Map<String, String>) iterator.next(); System.out.println("ID: " + map.get("ID") + " - Name: " + map.get("Name") + " - Description: " + map.get("Description")); } } public void stop(BundleContext bundleContext) throws Exception { Activator.context = null; } } 3.4. Deploy the bundle to SMP Now that we’re done with the coding, we’re ready to deploy our bundle to SMP server. In the present tutorial, we’re doing it manually. Two steps have to be done: 1. Generate a bundle out of the current bundle-project 2. The final bundle jarfile has to be deployed to SMP First step: generate the bundle jar In order to build the project and generate a bundle, we’re using the export mechanism (advanced users use a build tool like maven) To export the project, we have to right-click on the project node in Eclipse, then choose Export-> Plug-in Development -> Deployable pluig-ins and fragments After pressing “Next”, we have to make sure that our project is selected, then enter the target directory, where our bundle will be generated at. After pressing “Finish”, a “plugins” folder containing a jar file is generated at the specified location. Second step: deploy a bundle to SMP There are several possible ways of deployment, we’re using the easiest one: copy the bundle to the pickup folder. Some background: The SMP server supports hot deployment, which means that the OSGi runtime will notice that you’ve copied a bundle into the pickup folder and it will include it in its OSGi runtime on the fly. The pickup folder is located at <installDir>\Server\pickup Note: This way of installing (hot deployment) is used rather for testing purpose. For productive environment, use the command line to really “install” the bundle into the OSGi container. For more information about OSGi and installation procedure, you may have a look at my OSGi Blogs: 3.5. Verify the deployed bundle Now that the bundle has been deployed, let’s quickly verify if everything’s ok. Open the folder \pickup\.state and check if the deployment has been successful. A file is created which contains some information about successful or erroneous deployment. In case of error, you should check the console (if you’ve started your SMP server via command prompt) and also check the SMP error log and the OSGi log Next, have a look at the OSGi console to check the state of the deployed bundle. For this purpose, we open a command shell. Then we connect to OSGi via the command telnet localhost 2401 After pressing enter, it will connect… Then the OSGi-console is ready and waiting for our commands: We can type the command lb dataprovider The command lb stands for “list bundle” and lists all bundles with the given name that are known to the OSGi runtime. The below screenshot shows that the bundle is found and that the status is “Active” The result of the command shows also the ID under which that the OSGi runtime has registered our bundle. We can now use this ID to display the details of our bundle. The command is bundle <ID> In our example, the command is the following bundle 645 The below screenshot displays the dependency and the export that we’ve declared in the previous section A bundle can be embedded into the OSGi environment without being activated (in such case, its status is “Resolved”) When the OSGi framework activates a bundle, the “Activator” class of this bundle is called and its “start” method gets invoked. In our bundle, we have added some log output to the “start” method, such that we can now go ahead and check if our “product” data has properly been created and displayed. We can see the log output in the console or in the SMP log file We can now change to the OSGi console and execute the commands as shown in below screenshot. Find and “stop” and “start” the bundle and see the same log output That’s it. We have created a bundle. We have added code to create and manage some sample data. We have also create a little test code. We have generated the bundle. We have deployed it to SMP. We have verified that it works. Next step: Create the OData service using SAP Mobile Platform Toolkit in Eclipse. Appendix How to find the right bundle? If you have the name of a package and want to know which bundle exposes it, then you can proceed as follows: Go to the OSGi console Type the command p followed by the name of the package After pressing enter, the result printed on the console gives the name and ID of the exposing bundle and also lists the using bundles
https://blogs.sap.com/2016/01/12/integration-gateway-modularizing-odata-project-1/
CC-MAIN-2017-43
refinedweb
3,309
56.35
Continue Reading Post by Stefan Wittmann 25 August 2016 Last comment 30 May 2017 Starting) Continue Reading Post by Andreas Dieckow 6 December 2016 Background Continue Reading Post by Benjamin Spead 25 August 2016 Last comment 6 October 2016. Continue Reading Post by Bill McCormick 25 August 2016 Last comment 14 December 2016 Windows 7 and some other Microsoft Operating Systems can shutdown too fast for large applications, such as a Cache instance with a large amount of data and changes, to close gracefully. Continue Reading Post by Stephen Wilson 23 September 2016 I'd like to make you aware of a trap I just fell into. Continue Reading Post by Robert Cemper 20 December Just got the new beta version of Docker, with depreciation warning of AUFS. It's so bad news when InterSystems does not support used by default storage driver overlay2. Recently I thought to play with Google Kubernetes Engine, and realized that I can't work with InterSystems products there due to incompatibility with Storage Driver. Maybe it's already time to think about support? Continue Reading Post by Dmitry Maslennikov 20 July 2018 Last answer 25 July 2018 Last comment 20 November 2018 InterSy Continue Reading Post by Andreas Dieckow 9 October 2018 Post has been edited for clarification: Both HP Open VMS versions (for Itanium and for Alpha) are discontinued for future InterSystems releases. Future product releases, beginning with the next major release after 2017.1, will no longer be offered for the following platforms: HP OpenVMS for Itanium HP OpenVMS for Alpha Products: Caché, Ensemble Expected Availability: next major release after 2017.1 Last comment 10 March 2017 Working. Continue Reading Post by Dmitry Maslennikov 17 September 2016 Last answer 19 October 2016 Last comment 9 November 2018 Atelier works with linux distributions? Last answer 14 June 2018 Last comment 14 June 2018> Continue Reading Post by Alexey Maslov 4 May 2018 Last comment 31 May 2018 As we've all heard 2016.2 draws near and brings the removal of system methods with it. There are two ways to make the code compatible with 2016.2: Continue Reading Post by Eduard Lebedyuk 26 September 2016 Last answer 29 April 2017 The class %Compiler.UDL.TextServices arrived in 2015.1, bringing us methods for exporting a class in UDL format (i.e. looking just like we're used to seeing it in Studio), and importing a UDL format definition back into a namespace. Some source control tools including our Deltanji are now able to use UDL format, resulting in diffs that are easier to understand. Continue Reading Post by John Murray 1 February 2017 Last comment 1 February 2017. Continue Reading Post by Andreas Dieckow 7 November 2016 Last comment 7 November 2016 Caché, Compatibility, JSON, JavaScript, CSS, HTML, ZEN Continue Reading Post by William França Silva 28 August 2018 Last answer 28 August 2018 Last comment 30 August 2018 Is there documentation in Portuguese? Last answer 14 June 2018 Is there compatibility with java language in the studio? Last comment 14 June 2018 Documentation (?...) states that it looks like: IRIS for Windows (x86-64) 2018.1 (Build 487U) Tue Dec 26 2017 22:47:10 EST Does it really true, or just a documentation typo? Continue Reading Post by Alexey Maslov 7 March 2018 Last answer 7 March 2018 Last comment 8 March 2018 I have one in my testing environment. According to, I should move to native Ubuntu build with 2017.2. So I downloaded Cache for UNIX (Ubuntu Server LTS for x86-64) 2017.2.1 and tried to update my existing 2015.1.4 installation. What I got was: Upgrade from lnxsusex64 platform is not allowed. Continue Reading Post by Alexey Maslov 6 March 2018 Last answer 6 March 2018 Last comment 6 March 2018 I. Continue Reading Post by Skip Hill 19 January 2018 Last answer 19 January 2018 CSP: Print All PDF Reports, Java Applet not Supported Anymore, How to Migrate to Java Web Start (JNLP) API, Beginner, Compatibility, CSP, HTML, Java, JavaScript, Object Data Model, Web Development, Web Services,. Continue Reading Post by Thomas Li 26 September 2017 Last answer 29 September 2017 Last comment 29 September 2017 Continue Reading Post by Coty Embry 19 August 2017 Last answer 20 August 2017 Last comment 21 August 2017. Continue Reading Post by Eric van Dijk 11 August 2017 Last answer 11 August 2017 Last comment 11 August 2017 The last version of Caché, Ensemble released for VSI OpenVMS is 2017.1. Unlike HP OpenVMS (Alpha and Itanium), VSI OpenVMS on Itanium continues to be supported. This means that critical corrections or changes required to support customer’s hardware purchases will all be based on 2017.1 or earlier versions. Related announcement: Continue Reading Post by Andreas Dieckow 27 April 2017 Starting sometime at the end of last week your posts like... and others have been receiving a number of spam comments. Continue Reading Post by Stephen Canzano 20 March 2017 Last comment 21 March 2017 Continue Reading Post by Mikko Laitamäki 15 November 2016 Last answer 15 November 2016 Hi - When upgrading a Health Connect deployment from 2014 to 2016 do I HAVE to recompile? or is the "just upgrading" enough? Continue Reading Post by Chip Gore 8 November 2016 Last answer 8 November 2016
https://community.intersystems.com/tags/compatibility?filter=most_votes
CC-MAIN-2019-30
refinedweb
888
59.64
On Sunday 01 December 2002 10:28 am, address@hidden wrote: > Yesterday I was coding a few little examples and in one of them, I > needed to connect two signals to the same handler. The signals were from > different events and I didn't know what to do for solving my problem. > Can you help me?, please. > > Code: > > public class MiBoton : QPushButton { > public MiBoton(string a,QWidget b,string c) : base(a,b,c) { > mousePressEvent += new MousePressEvent (controladorEventos); > closeEvent += new CloseEvent (controladorEventos); > } > public void controladorEventos (QEvent e) { > Console.WriteLine ("Pulsado"); > } > } Looking at QtSupport.cs, where event delegates are declared, shows why you're having the problem: Line 691> protected delegate void MousePressEvent (QMouseEvent e); The delegate is declared to take a QMouseEvent, but your controladorEventos takes a QEvent. You appear to want the same event handler to be called for both pressing a button and closing a dialog. However, the associate event structures are different. Pressing a button (and other mouse event) uses a QMouseEvent, which gives information specific to mouse actions, like the location of the mouse. Closing a dialog uses a QCloseEvent, which doesn't have information about mouse position and so forth. That is why they use different event structures. We could change the signature of the MousePressEvent to include a QEvent instead of QMouseEvent, but that is probably not a good idea because even handlers would then need to cast their QEvents to the appropriate type, increasing runtime overhead and making a compile-time check impossible. I'm not totally clear about what you're trying to do. Is it possible that what you really want to do would work betting using Qt signals and slots? Signals and slot style communication is usually used between widgets, whereas Qt events are usually thought of as communication between the window system and a widget.
https://lists.gnu.org/archive/html/dotgnu-general/2002-12/msg00128.html
CC-MAIN-2022-27
refinedweb
306
51.89
I've been working on a game in Processing and I came upon this problem: I'm trying to make a background with stars flying past and I have this class: public class Star { PVector position; float speed; void draw() { fill(255); ellipse(position.x, position.y, speed, speed); position.x -= speed; } public Star() { speed = random(5); position.set(width+speed,random(height)); } } ArrayList<Star> stars = new ArrayList<Star>(); if(random(12) < 1) { stars.add(new Star()); } position.set(width+speed,random(height)); Could not run the sketch (Target VM failed to initialize). For more information, read revisions.txt and Help ? Troubleshooting. By default, your position variable is null, meaning it doesn't point to an instance of PVector yet. You never initialize that variable (using the new keyword to create a new instance of PVector), so it's still null when you call position.set() in the Star constructor. That causes an error, since you can't call a function on a null variable. To fix this, just use the new keyword to create a new instance of PVector: public Star() { speed = random(5); position = new PVector(width+speed,random(height)); }
https://codedump.io/share/uQcOH56hohBp/1/processing-sketch-crashes-on-pvector-set
CC-MAIN-2017-13
refinedweb
192
59.09
. Throughout this series, you have been adding new links to your demo application to test out several features from Laravel Eloquent. You may have noticed that the main index page is getting longer each time you add a new link, since there is no limit to the number of links shown in the application. Although that won’t be an issue when you have a small number of database entries, in the long term that might result in longer loading times for your page, and a layout that is more difficult to read due to the amount of content spread in a single page. In this part of the series, you’ll learn how to limit the number of results in a Laravel Eloquent query with the limit() method, and how to paginate results with the simplePaginate() method. Limiting Query Results To get started, you’ll update your main application route ( /) to limit the number of links that are listed on your index page. Start by opening your web routes file in your code editor: routes/web.php Then, locate the main route definition: routes/web.php Route::get('/', function () { $links = Link::all()->sortDesc(); return view('index', [ 'links' => $links, 'lists' => LinkList::all() ]); }); The highlighted line shows the query that obtains all links currently in the database, through the Link model all() method. As explained in a previous part of this series, this method is inherited from the parent Model class, and returns a collection with all database records associated with that model. The sortDesc() method is used to sort the resulting collection in descending order. You’ll now change the highlighted line to use the database query sorting method orderBy(), which orders query results at the database level, instead of simply reordering the full set of rows that is returned as an Eloquent Collection via the all() method. You’ll also include a chained call to the limit() method in order to limit the query results. Finally, you’ll use the get() method to obtain the filtered resultset as an Eloquent Collection. Replace your main route with the following code. The change is highlighted for your convenience: routes/web.php Route::get('/', function () { $links = Link::orderBy('created_at', 'desc')->limit(4)->get(); return view('index', [ 'links' => $links, 'lists' => LinkList::all() ]); }); The updated code will now pull the latest 4 links added to the database, no matter at which list. Because all links are added to lists, visitors can still go to specific lists to see the full list of links. Next, you’ll learn how to paginate results to make sure all links are still accessible, even though they don’t load all at once on a single page. Paginating Query Results Your index page now limits the number of links that are listed, so that your page isn’t overloaded with content, and gets rendered in a shorter amount of time. While this solution works well in many cases, you’ll need to make sure visitors can still access older links that aren’t visible by default. The most effective way to do so is by implementing a pagination where users can navigate between multiple pages of results. Laravel Eloquent has native methods to facilitate implementing pagination on database query results. The paginate() and simplePaginate() methods take care of generating pagination links, handling HTTP parameters to identify which page is currently being requested, and querying the database with the correct limit and offset in order to obtain the expected set of results, depending on the number of records per page you want to list. You’ll now update the Eloquent queries in routes/web.php to use the simplePaginate() method, which generates a basic navigation with previous and next links. Unlike the paginate() method, simplePaginate() doesn’t show information about the total number of pages in a query result. Open the routes/web.php file in your code editor. Start by updating the / route, replacing the limit(4)->get() method call with the simplePaginate() method: routes/web.php ... Route::get('/', function () { $links = Link::orderBy('created_at', 'desc')->simplePaginate(4); return view('index', [ 'links' => $links, 'lists' => LinkList::all() ]); }); ... Next, locate the /{slug} route definition in the same file, and replace the get() method with the simplePaginate() method. This is how the code should look once you’re done: routes/web.php ... Route::get('/{slug}', function ($slug) { $list = LinkList::where('slug', $slug)->first(); if (!$list) { abort(404); } return view('index', [ 'list' => $list, 'links' => $list->links()->orderBy('created_at', 'desc')->simplePaginate(4), 'lists' => LinkList::all() ]); })->name('link-list'); ... This is how the finished routes/web.php file will look once you’re finished. The changes are highlighted for your convenience:::orderBy('created_at', 'desc')->simplePaginate(4); return view('index', [ 'links' => $links, 'lists' => LinkList::all() ]); }); Route::get('/{slug}', function ($slug) { $list = LinkList::where('slug', $slug)->first(); if (!$list) { abort(404); } return view('index', [ 'list' => $list, 'links' => $list->links()->orderBy('created_at', 'desc')->simplePaginate(4), 'lists' => LinkList::all() ]); })->name('link-list'); Save the file when you’re done. The database queries are now updated, but you still need to update your front end view to include code that will render the navigation bar. The resulting Eloquent collection obtained with simplePaginate() contains a method called links(), which can be called from the front end view to output the necessary HTML code that will render a navigation section based on a paginated Eloquent query. You can also use the links() method in a paginated Eloquent collection to access the inherent paginator object, which provides several helpful methods to obtain information about the content such as the current page and whether there are multiple pages of content or not. Open the resources/views/index.blade.php application view in your code editor: resources/views/index.blade.php Locate the end of the section tagged with the links class, which contains a foreach loop where links are rendered. Place the following piece of code after that section and before the final </div> tag on that page: resources/views/index.blade.php @if ($links->links()->paginator->hasPages()) <div class="mt-4 p-4 box has-text-centered"> {{ $links->links() }} </div> @endif This code checks for the existence of multiple pages of results by accessing the paginator object and calling the hasPages() method. When that method returns true, the page renders a new div element and calls the links() method to print the navigation links for the related Eloquent query. This is how the updated index.blade.php page will look like once you’re finished: }} ({{ $list->links()->count() }})<> @if ($links->links()->paginator->hasPages()) <div class="mt-4 p-4 box has-text-centered"> {{ $links->links() }} </div> @endif </div> </section> </body> </html> Save the file when you’re done updating it. If you go back to your browser window and reload the application page now, you’ll notice a new navigation bar whenever you have more than 4 links in the general listing or in any individual link list page. With a functional pagination in place, you can grow your content while making sure that older items are still accessible to users and search engines. In cases where you need only a fixed amount of results based on a certain criteria, where pagination is not necessary, you can use the limit() method to simplify your query and guarantee a limited result set. This tutorial is part of an ongoing weekly series about Laravel Eloquent. You can subscribe to the Laravel tag if you want to be notified when new tutorials are published.
https://www.xpresservers.com/2021/09/
CC-MAIN-2021-39
refinedweb
1,247
58.92
This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project. On Fri, Oct 14, 2011 at 5:00 PM, Pedro Alves <pedro@codesourcery.com> wrote: > On Friday 14 October 2011 15:40:49, Kevin Pouget wrote: > >> 2011-10-14 ?Kevin Pouget ?<kevin.pouget@st.com> >> >> ? ? ? * frame.c (frame_stop_reason_string): Rewrite using >> ? ? ? unwind_stop_reasons.def. >> ? ? ? * frame.h (enum unwind_stop_reason): Likewise. >> ? ? ? * python/py-frame.c (gdbpy_initialize_frames): Likewise. >> ? ? ? (gdbpy_frame_stop_reason_string): Use new enum unwind_stop_reason >> ? ? ? constants for bound-checking. >> ? ? ? * unwind_stop_reasons.def: New file. >> > > You're missing this change that was in my patch: > > Index: src/gdb/stack.c > =================================================================== > --- src.orig/gdb/stack.c ? ? ? ?2011-10-11 12:43:20.000000000 +0100 > +++ src/gdb/stack.c ? ? 2011-10-12 15:38:23.083658404 +0100 > @@ -1625,7 +1625,7 @@ backtrace_command_1 (char *count_exp, in > ? ? ? enum unwind_stop_reason reason; > > ? ? ? reason = get_frame_unwind_stop_reason (trailing); > - ? ? ?if (reason > UNWIND_FIRST_ERROR) > + ? ? ?if (reason >= UNWIND_FIRST_ERROR) > ? ? ? ?printf_filtered (_("Backtrace stopped: %s\n"), > ? ? ? ? ? ? ? ? ? ? ? ? frame_stop_reason_string (reason)); > ? ? } > > because before, UNWIND_FIRST_ERROR was not an alias, now it is. fixed > I notice only these two descriptions are capitalized: > >> +SET (UNWIND_NO_REASON, "No reason") > >> +SET (UNWIND_UNAVAILABLE, "Not enough registers or memory available to unwind further") > > (the latter my fault). ?Can you lowercase them too for consistency? fixed > Also, I believe as is, we lose gdb.FRAME_UNWIND_FIRST_ERROR? you're right, I've added it, as well as a description in the documentation: > @item gdb.FRAME_UNWIND_FIRST_ERROR > All the conditions after this alias are considered errors; > abnormal stack termination. Current value is gdb.FRAME_UNWIND_UNAVAILABLE. I'm not 100% convinced about the last part, but I feel like it would be important to know at read time (instead of run time) what is considered as an error and what isn't. Let me know if you want me to remove/rephrase it. Thanks, Kevin From f37e4adb86342a694ae32b8a8737dc1860d85f53 Mon Sep 17 00:00:00 2001 From: Kevin Pouget <kevin.pouget@st.com> Date: Mon, 17 Oct 2011 09:42:44 +0200 Subject: [PATCH] Move unwind reasons to an external .def file --- gdb/doc/gdb.texinfo | 4 ++ gdb/frame.c | 20 ++--------- gdb/frame.h | 51 +++++---------------------- gdb/python/py-frame.c | 21 ++++------- gdb/stack.c | 2 +- gdb/unwind_stop_reasons.def | 79 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 106 insertions(+), 71 deletions(-) create mode 100644 gdb/unwind_stop_reasons.def diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 0aa90eb..e6e060c 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -23445,6 +23445,10 @@ stack corruption. @item gdb.FRAME_UNWIND_NO_SAVED_PC The frame unwinder did not find any saved PC, but we needed one to unwind further. + +@item gdb.FRAME_UNWIND_FIRST_ERROR +All the conditions after this alias are considered errors; +abnormal stack termination. Current value is gdb.FRAME_UNWIND_UNAVAILABLE. @end table @end defun diff --git a/gdb/frame.c b/gdb/frame.c index 5824020..e5e442a 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2351,23 +2351,11 @@ frame_stop_reason_string (enum unwind_stop_reason reason) { switch (reason) { - case UNWIND_NULL_ID: - return _("unwinder did not report frame ID"); +#define SET(name, description) \ + case name: return _(description); +#include "unwind_stop_reasons.def" +#undef SET - case UNWIND_UNAVAILABLE: - return _("Not enough registers or memory available to unwind further"); - - case UNWIND_INNER_ID: - return _("previous frame inner to this frame (corrupt stack?)"); - - case UNWIND_SAME_ID: - return _("previous frame identical to this frame (corrupt stack?)"); - - case UNWIND_NO_SAVED_PC: - return _("frame did not save the PC"); - - case UNWIND_NO_REASON: - case UNWIND_FIRST_ERROR: default: internal_error (__FILE__, __LINE__, "Invalid frame stop reason"); diff --git a/gdb/frame.h b/gdb/frame.h index f5866bd..514393b 100644 --- a/gdb/frame.h +++ b/gdb/frame.h @@ -446,47 +446,16 @@ extern struct address_space *get_frame_address_space (struct frame_info *); enum unwind_stop_reason { - /* No particular reason; either we haven't tried unwinding yet, - or we didn't fail. */ - UNWIND. */ - UNWIND_NULL_ID, - - /* This frame is the outermost. */ - UNWIND_OUTERMOST, - - /* All the conditions after this point are considered errors; - abnormal stack termination. If a backtrace stops for one - of these reasons, we'll let the user know. This marker - is not a valid stop reason. */ - UNWIND_FIRST_ERROR, - - /* Can't unwind further, because that would require knowing the - values of registers or memory that haven't been collected. */ - UNWIND_UNAVAILABLE, - - /* This frame ID looks like it ought to belong to a NEXT frame, - but we got it for a PREV frame. Normally, this is a sign of - unwinder failure. It could also indicate stack corruption. */ - UNWIND_INNER_ID, - - /* This frame has the same ID as the previous one. That means - that unwinding further would almost certainly give us another - frame with exactly the same ID, so break the chain. Normally, - this is a sign of unwinder failure. It could also indicate - stack corruption. */ - UNWIND_SAME_ID, - - /* The frame unwinder didn't find any saved PC, but we needed - one to unwind further. */ - UNWIND_NO_SAVED_PC, +#define SET(name, description) name, +#define FIRST_ENTRY(name) UNWIND_FIRST = name, +#define LAST_ENTRY(name) UNWIND_LAST = name, +#define FIRST_ERROR(name) UNWIND_FIRST_ERROR = name, + +#include "unwind_stop_reasons.def" +#undef SET +#undef FIRST_ENTRY +#undef LAST_ENTRY +#undef FIRST_ERROR }; /* Return the reason why we can't unwind past this frame. */ diff --git a/gdb/python/py-frame.c b/gdb/python/py-frame.c index 75aa44e..4983c82 100644 --- a/gdb/python/py-frame.c +++ b/gdb/python/py-frame.c @@ -542,7 +542,7 @@ gdbpy_frame_stop_reason_string (PyObject *self, PyObject *args) if (!PyArg_ParseTuple (args, "i", &reason)) return NULL; - if (reason < 0 || reason > UNWIND_NO_SAVED_PC) + if (reason < UNWIND_FIRST || reason > UNWIND_LAST) { PyErr_SetString (PyExc_ValueError, _("Invalid frame stop reason.")); @@ -599,18 +599,13 @@ gdbpy_initialize_frames (void) PyModule_AddIntConstant (gdb_module, "SIGTRAMP_FRAME", SIGTRAMP_FRAME); PyModule_AddIntConstant (gdb_module, "ARCH_FRAME", ARCH_FRAME); PyModule_AddIntConstant (gdb_module, "SENTINEL_FRAME", SENTINEL_FRAME); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_NO_REASON", UNWIND_NO_REASON); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_NULL_ID", UNWIND_NULL_ID); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_FIRST_ERROR", UNWIND_FIRST_ERROR); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_INNER_ID", UNWIND_INNER_ID); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_SAME_ID", UNWIND_SAME_ID); - PyModule_AddIntConstant (gdb_module, - "FRAME_UNWIND_NO_SAVED_PC", UNWIND_NO_SAVED_PC); + +#define SET(name, description) \ + PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name); +#define FIRST_ERROR(name) \ + PyModule_AddIntConstant (gdb_module, "FRAME_"#name, name); +#include "../unwind_stop_reasons.def" +#undef SET Py_INCREF (&frame_object_type); PyModule_AddObject (gdb_module, "Frame", (PyObject *) &frame_object_type); diff --git a/gdb/stack.c b/gdb/stack.c index 953d3bd..003725a 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -1625,7 +1625,7 @@ backtrace_command_1 (char *count_exp, int show_locals, int from_tty) enum unwind_stop_reason reason; reason = get_frame_unwind_stop_reason (trailing); - if (reason > UNWIND_FIRST_ERROR) + if (reason >= UNWIND_FIRST_ERROR) printf_filtered (_("Backtrace stopped: %s\n"), frame_stop_reason_string (reason)); } diff --git a/gdb/unwind_stop_reasons.def b/gdb/unwind_stop_reasons.def new file mode 100644 index 0000000..3eca2b2 --- /dev/null +++ b/gdb/unwind_stop_reasons.def @@ -0,0 +1,79 @@ +/* Copyright 2011 <>. */ + +/* Reasons why frames could not be further unwound + SET (name, description) + + After this reason name, all reasons should be considered errors; + i.e.: abnormal stack termination. + FIRST_ERROR (name) + + First and Last reason defined + FIRST_ENTRY (name) + LAST_ENTRY (name) */ + +#ifdef SET +/* No particular reason; either we haven't tried unwinding yet, + or we didn't fail. */ +SET (UNWIND_NO_REASON, . */ +SET (UNWIND_NULL_ID, "unwinder did not report frame ID") + +/* This frame is the outermost. */ +SET (UNWIND_OUTERMOST, "outermost") + +/* Can't unwind further, because that would require knowing the + values of registers or memory that haven't been collected. */ +SET (UNWIND_UNAVAILABLE, "not enough registers or memory available to unwind further") + +/* This frame ID looks like it ought to belong to a NEXT frame, + but we got it for a PREV frame. Normally, this is a sign of + unwinder failure. It could also indicate stack corruption. */ +SET (UNWIND_INNER_ID, "previous frame inner to this frame (corrupt stack?)") + +/* This frame has the same ID as the previous one. That means + that unwinding further would almost certainly give us another + frame with exactly the same ID, so break the chain. Normally, + this is a sign of unwinder failure. It could also indicate + stack corruption. */ +SET (UNWIND_SAME_ID, "previous frame identical to this frame (corrupt stack?)") + +/* The frame unwinder didn't find any saved PC, but we needed + one to unwind further. */ +SET (UNWIND_NO_SAVED_PC, "frame did not save the PC") + +#endif /* SET */ + + +#ifdef FIRST_ERROR +FIRST_ERROR (UNWIND_UNAVAILABLE) +#endif + +#ifdef FIRST_ENTRY +FIRST_ENTRY (UNWIND_NO_REASON) +#endif + +#ifdef LAST_ENTRY +LAST_ENTRY (UNWIND_NO_SAVED_PC) +#endif -- 1.7.6.4
https://sourceware.org/legacy-ml/gdb-patches/2011-10/msg00456.html
CC-MAIN-2022-40
refinedweb
1,274
51.95
Getting AutoCAD block attributes from a .NET application It's been a hectic week, between one thing and another, and I don’t expect it to get better anytime soon: apart from anything else, my wife is due to give birth any day to our second child. We're both excited - and admittedly a little anxious - about it, and our 2 year-old seems to be feeding of that, which means none of us have ended getting much sleep of late. All good preparation, I suppose. :-) So I decided the path of least resistance for getting a blog entry out today was to look through some of the responses DevTech have sent out to ADN members recently, to find something that might be of interest to a wider audience. A lot of what we do ends up being very specific to individual situations, but we also get requests for code samples that prove to be of general interest (these latter topics are generally turned into DevNotes (technical solutions) and get posted to the ADN website). Over the busy months ahead I'm sure I'll end up feeding many of these through this blog. One response that caught my eye was this helpful little code sample, written by Varadan (a.k.a. Krishnan Varadarajan), a member of the DevTech team in India. It asks the user to select block references, and then goes through them, looking for any contained attributes, which it then dumps to the AutoCAD console: using Autodesk.AutoCAD; using Autodesk.AutoCAD.Runtime; using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; namespace MyApplication { public class DumpAttributes { [CommandMethod("LISTATT")] public void ListAttributes() { Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; Database db = HostApplicationServices.WorkingDatabase; Transaction tr = db.TransactionManager.StartTransaction(); // Start the transaction try { // Build a filter list so that only // block references are selected TypedValue[] filList = new TypedValue[1] { new TypedValue((int)DxfCode.Start, "INSERT") }; SelectionFilter filter = new SelectionFilter(filList); PromptSelectionOptions opts = new PromptSelectionOptions(); opts.MessageForAdding = "Select block references: "; PromptSelectionResult res = ed.GetSelection(opts, filter); // Do nothing if selection is unsuccessful if (res.Status != PromptStatus.OK) return; SelectionSet selSet = res.Value; ObjectId[] idArray = selSet.GetObjectIds(); foreach (ObjectId blkId in idArray) { BlockReference blkRef = (BlockReference)tr.GetObject(blkId, OpenMode.ForRead); BlockTableRecord btr = (BlockTableRecord)tr.GetObject( blkRef.BlockTableRecord, OpenMode.ForRead ); ed.WriteMessage( "\nBlock: " + btr.Name ); btr.Dispose(); AttributeCollection attCol = blkRef.AttributeCollection; foreach (ObjectId attId in attCol) { AttributeReference attRef = (AttributeReference)tr.GetObject(attId, OpenMode.ForRead); string str = ("\n Attribute Tag: " + attRef.Tag + "\n Attribute String: " + attRef.TextString ); ed.WriteMessage(str); } } tr.Commit(); } catch (Autodesk.AutoCAD.Runtime.Exception ex) { ed.WriteMessage(("Exception: " + ex.Message)); } finally { tr.Dispose(); } } } } Here's what happened when I ran it against the "Blocks and Tables - Imperial.dwg" sample drawing that ships with AutoCAD. On running the LISTATT command and selecting the title block on the right of the page, here's what was dumped out: Command: LISTATT Select block references: 1 found Select block references: Block: ARCHBDR-D Attribute Tag: NAME Attribute String: CORY B. Attribute Tag: NAME Attribute String: BOB M. Attribute Tag: DATE Attribute String: Attribute Tag: X"=X'-X" Attribute String: 1/4" =1' Attribute Tag: 0 Attribute String: 1 Attribute Tag: 0 Attribute String: 1 Attribute Tag: PROJECT Attribute String: ADDA Attribute Tag: TITLE Attribute String: FLOOR PLANS Attribute Tag: X Attribute String: Attribute Tag: X Attribute String: Attribute Tag: X Attribute String: Attribute Tag: X/XX/XX Attribute String: Attribute Tag: X/XX/XX Attribute String: Attribute Tag: X/XX/XX Attribute String: Attribute Tag: COMMENT Attribute String: Attribute Tag: COMMENT Attribute String: Attribute Tag: COMMENT Attribute String: Command: The try/finally in this example could be replaced with using (Transaction tr = db.TransactionManager.StartTransaction()). No difference in the generated IL code but more elegant and readable code. Posted by: Albert | September 20, 2006 at 05:56 PM Hi Kean Thanks for your code, do you have a vbnet simmilar example?. Does it list raster block references attribuites? Thanks again Posted by: Raul | September 27, 2006 at 08:11 PM Hi Raul, Sorry, no (and have my hands full on paternity leave right now). I generally use an automatic conversion tool such as the one mentioned in this previous entry: This tool simply uses a website convertor, such as at: This automatic conversion should get you a good deal of the way there... Regards, Kean Posted by: Kean | September 29, 2006 at 07:58 PM BTW - I don't know what you mean by "raster block references"... Regards, Kean Posted by: Kean | September 29, 2006 at 07:59 PM Thanks Kean for your tip and congrats for your newborn, I am a 2 little girls father (1 and 4 year old), so no hurry about technical stuff answers. I meant by "raster block references" the external references of the *.jpg or *.tif type. I was able to get the block id of files (.dwg ones) attached as external references, and then its attribuites like the file path. Well, hope you get some decent sleep and thanks again for your usefull blog, I have found some good code and history. Regards Posted by: Raul | October 12, 2006 at 01:44 AM Thanks for the code. Can you help me on the code for doing the oposite ie edit block attributes given a known objectid for the block. I have seach for the code seem to be struggling especially with the open.mode.write. Also can with resources can i learn autocad vb.net. Posted by: edmore | October 12, 2006 at 09:39 PM For Raul: Thanks! :-) Although conceptually similar to blocks, rasters are actually separate objects. You would need to change the above code to handle raster image and raster image definition objects: Autodesk.AutoCAD.DatabaseServices.RasterImage Autodesk.AutoCAD.DatabaseServices.RasterImageDef For Ed: Check out the resources listed on the AutoCAD Developer Center (). I'd suggest posting your problematic code to the AutoCAD .NET Discussion Group (). Regards, Kean Posted by: Kean | October 13, 2006 at 01:24 PM Hi Kean; Thanks for the hint, I found a sample to get raster image attributes, but unfortunately I have not found any sample to set raster image attributes like the filename. Well, I hope you find the time, maybe one of those sleepless nights ;-) to show us the way in this blog. Thanks again Raul Posted by: Raul | October 18, 2006 at 03:19 AM Hi Raul, Oh, you need to repath images? I haven't tried it, but you might try getting the RasterImageDef and setting the ActiveFilePath property. Regards, Kean Posted by: Kean | October 18, 2006 at 05:05 PM Hi Kean, Thanks for your fast reply. I coud not find the RasterImageDef.ActiveFilePath property although I tried to set rasterImageDef.SourceFileName and rasterImageDef.ActiveFileName, both throw an exception. Thanks Raul Posted by: Raul | October 19, 2006 at 01:46 AM Hi Raul, You probably don't have the object open for write... I'd suggest posting the code to the .NET Customization Discussion Group (). Regards, Kean Posted by: Kean | October 19, 2006 at 12:10 PM Hi Kean; I posted my code on the group you mentioned some days ago, see no answer yet, I changed all the read occurences of the object for OpenMode.ForWrite and still I do not see the ActiveFilePath property. Any help I will appreciate. Thanks Raul Posted by: Raul | October 20, 2006 at 09:45 AM Hi Kean I replied to you at I will appreciate if you review it. Thanks Raul Posted by: Raul | October 26, 2006 at 10:52 PM Reply posted... Kean Posted by: Kean | October 27, 2006 at 10:44 AM Hi Kean I did not have the opportunity to thanks for your last reply on It works fine now. I had to add a line imageAttributeDef.load since it did not load the raster reference by default. Also this repath operation works for the database of files that are not opened, I will investigate how to do it on open files. I noticed that AutoCAD 2007 adds a DWF external reference feature, I will also investigate how to repath those files. Again, thanks for your altruistic effort. Best wishes Raul Posted by: Raul | November 08, 2006 at 02:55 PM Hi Raul, Great - I'm glad you got it working. Regards, Kean Posted by: Kean | November 08, 2006 at 03:30 PM Hi Kean, hows parenthood suiting you? I have a question regarding 3rd party supplied blocks. Is there a way to modify the layers on an 3rd party issued block so it "works" in my drawings. I have hundreds to go through from dozens of suppliers and it just seems too much to open each and every block and send each part to the relevant layers in my drawings. Do you have any clues or ideas? Any help would be great. Thanks Posted by: Adie Porter | November 10, 2006 at 08:02 AM Hi Adie, Parenthood's treating me well, thanks (having 2 boys under 3 years old is a challenge, but luckily the youngest is still fairly easy to handle). I'd suggest checking out the CAD Standards implementation... aside from the STANDARDS command, take a look at LAYTRANS and also the Batch Standards Checker (a separate executable that can check across sets of files). You could always implement some custom code to go in and do this, but it's always worth seeing what standard functionality already exists. Regards, Kean Posted by: Kean | November 10, 2006 at 02:30 PM Hi Kean, Sorry about the delay getting back to you, Thanks for the info, i will be trawling through looking at these tips. Thanks Adie Posted by: Adie Porter | November 29, 2006 at 06:29 AM Hi Kean I´m using Autocad 2006 and .Net and I want to know how can i get the Id of one document (dwg) throw .net, and if i make a copy of the dwg file (document) when i open the copy it has the same Id of the original....? Posted by: Cynthia | April 02, 2007 at 06:52 AM Hi Cynthia, Which ID are you referring to? Do you mean the FingerprintGuid, or something else? A new FingerprintGuid does get assigned when you SaveAs, WBlock a new DWG, etc., but there's no way to control someone copying the file through Explorer etc. But then it sounds as though you want to maintain the same ID as the original (which FingerprintGuid mostly will not), so you may need to find another way to do this. Bear in mind that with this logic, nearly every DWG would end up referring to the template it was created from... Regards, Kean Posted by: Kean | April 02, 2007 at 08:45 AM Hi Kean, sorry, in my las comment i wasn´t clear. I´m going to explain what i want to do. I start Autocad 2006, and creat a new document or dwg. I set a name like Test.dwg and save it. Then i draw some lines, I know each line has an unique identifier assigned (id) in the draw or document, so i get throw .net each id of each line and save it in a external database with name and others properties i add. I close Autocad, i start again and open Test.dwg, y choose each line i draw before, and the unique identifier assigned (id) of the lines maintance the same value, but i can get the unique identifier assigned (id) of the document. I belive that autocad must assign an id for each document ( when i said document i mean dwg file), so i need to get unique identifier assigned (id) to the document and then relate it with the lines drawed. This way I could save and relate a document wich all objets drawed in it throw each id´s and save it in an external database like Acces. I want to know too if i make a file copy of the Test.dwg, what happend with the unique identifier assigned (id) of the document or dwg. And if there's no way to control someone copying the file through Explorer etc. What happend with the Id´s of the lines and other objects drawed in it. Thanks so much, and i´m happy to have the oportunity to ask you. Posted by: Cynthia | April 15, 2007 at 10:29 PM You can use the FingerprintGuid property the Database object, but this will remain the same across DWGs file copied via Explorer (for instance). AutoCAD is simply not involved in the copying of files at the OS-level. Most developers working on this type of problem would rely on the uniqueness of the file location on the system (using its path/URL/etc.). I assume you're using handles for object identifiers: these are maintained (and kept unique) for the drawing's lifetime, but are not guaranteed to be unique across DWGs. Posted by: Kean | April 16, 2007 at 09:45 AM Hi Kean, I am back again, hopping you are doing fine with your kids. After working doing programmatic .net repath work with different external references objects using AutoCAD 2008 I got few comments you may find useful. DWG external reference object: It accepts any kind of path convention, local i.e. c:\myxdwgref.dwg and network \\myserver\myxdwgref.dwg, relative local and url i.e. .\..\ and ./../ types, absolute url i.e. Raster image external reference (jpg, bmp, etc): It behaves as above but it changes any relative url path reference by its local counterpart i.e. RasterImageDef.SourceFileName = "./myxdwgref.dwg" It accepts the value but it changes to ".\myxdwgref.dwg" DWF and DGN underlay references: Works as DWG references, but it do not process absolute url references, i.e. when using the following, DwfDefinition.SourFileName = "" it takes the value but it does not load the myDwfXref.dwf as rasters and dwg objects do. It seems that dwg and raster external references are downloaded automatically. Well I just wanted to expose what I think there are some inconsistencies on several external references objects. I hope Autodesk will come with some fix in future releases. I will appreciate any comments you may have Best wishes Raul Posted by: Raul | May 09, 2007 at 04:04 PM Hi Raul, Thanks - we're all doing very well. :-) Some of the differences you've found are probably historical (the objects having been implemented at different times) and some are probably logical (the objects do behave differently). If there are product changes you would like to see happen, then I suggest submitting through ADN (if you're a member), or otherwise you can submit them via this form on the Autodesk website: Regards, Kean Posted by: Kean | May 10, 2007 at 03:13 PM
http://through-the-interface.typepad.com/through_the_interface/2006/09/getting_autocad.html
crawl-002
refinedweb
2,463
63.49
700/there-automate-drag-drop-functionality-selenium-webdriver You can implement the drag and drop functionality like this: WebElement element = driver.findElement(By.name("source")); WebElement target = driver.findElement(By.name("target")); (new Actions(driver)).dragAndDrop(element, target).perform(); Source: You can look at Selenium's documentation from above for further reference. This is the usage: from selenium import webdriver from ...READ MORE Hey Komal, to get the text of ...READ MORE Hello Dimple, the simplest way to handle ...READ MORE Hey Harsha, you can load an extension ...READ MORE The better way to handle this element ...READ MORE In order to use IE Driver you ...READ MORE For working with pages where you have ...READ MORE To Allow or Block the notification, access using Selenium and you have to ...READ MORE First, find an XPath which will return ...READ MORE Its pretty simple. Check out the below ...READ MORE OR Already have an account? Sign in.
https://www.edureka.co/community/700/there-automate-drag-drop-functionality-selenium-webdriver?show=702
CC-MAIN-2020-34
refinedweb
157
54.29
Hey guys, I have tried out the Razor view engine and have already found a keyscenario that doesn't seem to work with razor. Who is the best personto contact in regard to this?This is the scenario?I have the following class: public static class ListExtensions { public static IEnumerable<T> Each<T>(this IEnumerable<T> items, Action<T, ListProperties> action) { int i = 0; int length = items.Count(); foreach (var item in items) { var props = new ListProperties { Index = i, IsFirst = (i == 0), IsLast = (i == length - 1), IsEven = (i % 2 == 0), Count = length }; action(item, props); i++; } return items; } public class ListProperties { public int Index { get; set; } public bool IsFirst { get; set; } public bool IsLast { get; set; } public bool IsEven { get; set; } public int Count { get; set; } } } then in my view I want to be able to use it like I can in the webformsview engine like so.@Model.Ea View) |-------------------------------------------------------------------------------| | Hello,>}
http://www.dotnetspark.com/links/34909-bug-not-supported-scenario-razor.aspx
CC-MAIN-2017-51
refinedweb
151
56.39
Brightnets are Owner Free File Systems 502 elucido writes ." Their main wiki page discusses a bit of what this means and how it might work as well. I've been saying that we need this for many years now, if only because we all have 10 gigs free on our machines and if we could RAID the internet we'd need fewer hard drives. Not a Brightnet yet (Score:5, Funny) Re:Not a Brightnet yet (Score:4, Informative) It seems some moderators are not aware of the way some atheists use the term "bright"... Re:Not a Brightnet yet (Score:4, Funny) My network is still on the fence when it comes to the existence of God. Are there turtles on the fenceposts? Underneath, yes; it's turtles all the way down. Encryption (Score:5, Insightful) Isn't this just a sophisticated form of encryption, using a large, randomly generated key? If so, does it have any real advantages over conventional encryption? It seems that the disadvantage would be the need to have both the file (large) and the random data (large) instead of, conventionally, just the file (large) and key (small). Also, I can't be the only one who found the summary, uh, confusing?? Re:Encryption (Score:5, Informative) Re: (Score:3, Informative) Well the wiki is down so I can't look. I don't see how that's any help though. You have to store the data representing the relationship between the chunks somewhere too. Suppose instead of 128K chunks we use 1 bit chunks. We'll store all the 1s on one computer, all the 0s on another computer and the relationship between the data on a third computer. Where is the copyrighted data? Re:Encryption (Score:4, Interesting) I read all the wiki had to offer. I agree that this is a problem - I'm going to see if I can post to their complaint forum as well. Basically you have a URL that contains 4 pieces of information.. A file name (largely meaningless except to the end user), a file-size, and 3 30-Byte SHA-1 hashes, referred to here as a 3-tuple (represented in HEX). You search the local disk cache for file names that match each of the SHA-1 digests. For every digest file not found, search the local network for a match and download the block locally (this is the peer-to-peer part). You XOR the contents of the 3 blocks (which happen to be sized at 128K - no significance) to produce the decoded data. The first decoded block (provided from the URL) is a sequential-list of 90 byte 3-tuples (similar to the original URL). The contents of all of these 3-tuples are the desired data, except the last 3-tuple which is a chain to the next descriptor block. The file-size tells you when to stop obviously. The 'theory' is that highly randomized data should be randomly reused by completely unrelated data.. .mp3 and .txt files, for example. Moreover, there is 'no way to reconstruct' useful data w/o the 3-tuple AND the file-size. However, small files will have a high probability of SHA-1 collisions (and thus corrupted data - they only talk about virus corruption, but there's the more important inadvertant collsions which overwrite valid data - BackupPC resolves this by creating MD5;1 MD5;2 file-names). The large 128K should alleviate this, but also assures a low probability of block reuse. The problem I see is that data-blocks are not inherently random by default.. In order to be practically random, you'd have to take the recommended 1TB file-system, randomize it - produce approx 8 million SHA-1 digests, then for each real-data insert, delete in an LRU fashion. Otherwise, if you only had a hundred-thousand blocks - It would not be THAT difficult to grab the first 30 bytes of every block and XOR them with several of the most recently inserted blocks until you found something that matched an existing file-name. If matched, try the next 30B, etc. Now you have a starting point AND the appropriate 3-tuple. You're only missing the file-size.. But if it spits out music in one of like 5 codecs, you've got a winner. Shouldn't be able to do statistical analysis to find random-noise or invalid media format. Many files contain internal end-of-file signifiers (.zip, .gz for example). With 8 million records, that becomes hard(er) to do. But how long does it take to initialize that? Now with respect to the network, there's no need to actually store the file-descriptor block remotely, Thus for highly sensitive files, you can probably encrypt the descriptor block and keep it locally (sharing on a private trusted network). But for text-based files, you'd probably still be weary of having network stored timestamp ordered data-blocks - as the contents of the last 100 blocks could easily be determined, (text files are not as order sensitive as mp3s and zip files). The stated goal is purely open, freely shared, perfectly legal data-store... Which allows the occasionally masked sensitive data. Though the RIAA/MPAA would read it as, a front for illegal data. They say they have better bandwith than obscured P2P networks, since you can allow open download by the RIAA as well as your clients, and it's all meaningless w/o the starting points/blocks. You do have a 3x bandwidth over a pure HTTP/FTP download - as you have to download 3 blocks to XOR against each other to produce 1 block of data. They suggest that once you have a descriptor block you 'should download the tuples in random order to reduce pattern matching by ISPs' which furthers the notion that this is for illicit purpose. I'm highly suspicious that the SHA-1 digests produce useful collisions and provide you bandwidth reduction via your local disk-cache for the above comments. I'm also Not quite Encryption, not quite Good either (Score:3, Interesting) Maybe, maybe not. It sounds like somebody was thinking about removing duplicate data from file systems in a significant way. They appear to have gotten side tracked by this idea of avoiding responsibility for copyright infringement, but the original concept is interesting. At least what I hope was the original concept. Lets pretend I know the original concept, as I suspect I do, due to convergent thought processes. Essentially it is this, you get a large number of people to store chunks of indexed data and a Re:Encryption (Score:5, Insightful) Yes, but the assertion that this somehow circumvents copyright law is pretty ridiculous. The composite of the entire system allows one to store data in a retrievable fashion, just as the composite of a hard drive, magnetic head, source coding strategy, filesystem, and operating system allow one to store data in a retrievable fashion -- despite the fact that it is fragmented on the drive and source coded. The scope of the system may be different, but it accomplishes the same. Sharing the "recipe" for assembling the blocks is the same as sharing the original file. It's just a definition of terms. You could say that a compressed (.zip) version of a text file is really just a recipe for algorithmically creating the original text file. The zip version and the original are treated the same under copyright law, as far as I know. Re:Encryption (Score:5, Insightful) It' not a circumvention of every aspect of copyright, it's a system where you can't claim that every single intermediary had some part in any copyright violation. For example, I rip all my CDs and store them in this system (keeping the list of URLs needed to re-construct/retrieve the files to myself. Since only I can get the files back, I have not distributed anything WRT copyright. The various nodes can't know what the blocks I stored are. Should I give someone else my list of URLs, I have now distributed, so I have now violated copyright. The nodes storing those blocks still don't know what they are and have no means of re-constructing them, so have not infringed. Reductionism vs the law (Score:3, Interesting) Re: (Score:3, Interesting) So, then, since a (good) dictionary contains all of the words in a language, it is violating the copyright of each and every creative work done in that language? By your logic, it would seem so. I can recreate all of the works of Shakespear from a single Webster's Dictionary. Re:Encryption (Score:4, Insightful) This situation is perhaps similar to torrents. A torrent isn't the real data but does "refer" to it in a way similar to how the "key" in this filesystem refers to the actual pieces needed to reconstruct the file, even though those pieces aren't unique. One could even say that the "key" in this case is even closer to the real data than a torrent. Re:Encryption (Score:5, Insightful). Re:Encryption (Score:5, Interesting). Except that is probably bullshit to copyright lawyers There's a great explanation of why in this essay, What Colour are your Bits. It's actually about another system based on the same sort of ideas. [sooke.bc.ca]. Re:Encryption (Score:5, Insightful) Putting it a little more plainly: Patent concerns similarity (provenance is irrelevant). However, both are unethical and ineffective anachronisms long overdue for abolition. Let overpaid lawyers count the angels on a pinhead. It is not something computer scientists should concern themselves with, especially when litigation causes 99% of harm well before any judges get anywhere near investigating the provenance of bits - deciding which side of bread best provides inspiration as to the 'correct' judicial interpretation as to how bits should properly be constrained. Use the GPL. It's a legal device against litigation. Using BrightNets is a coder's sophistry, not a lawyer's. A coder may as well wonder why there's so much legal difference between copying an MP3 file and streaming it, when there's marginal technical difference. Conversely, lawyer's won't be fazed by significant technical differences if the end result is the same - they'll sue you first and leave the questions to judges in subsequent decades. You might as well create a distributed and co-operatively administered 'YouTube' host with anyone legally permitted to upload and download so long as the hosted works were only 'streamed' to the public and taken down upon request (DMCA). Lex Asinus Est. Re: (Score:3, Informative) However, both are unethical and ineffective anachronisms long overdue for abolition. [...] Use the GPL. It's a legal device against litigation. You do realize that the GPL is absolutely meaningless without copyright law, do you? Did you ever actually read the GPL? Re: (Score:3, Interesting) Of course. But then, without copyright there is absolutely no need for the GPL. I'm amused by this strange idea that if a society wished to provide its citizens with the right to free speech and free cultural exchange they'd first have to enact a law that would prohibit such freedom. Bear in mind that the GPL is a means to enjoy freedom, not a means to enjoy the operation of the GPL in a copyright encumbered society. Re:Encryption (Score:5, Insightful) But then, without copyright there is absolutely no need for the GPL. ... Bear in mind that the GPL is a means to enjoy freedom... I'm no expert on the GPL, but am I not correct in thinking that the GPL forces restrictions on developers in order to ensure freedoms for users? For example, the requirement that if I build and distribute something that uses GPL code, I must use the GPL on my code and distribute the source code with the binaries. Without copyright and the GPL, there is absolutely no way to force me to distribute my source code. I can take an open source project, add to it to create something new, hide the source code in a vault and distribute only the binary. You will be able to copy it freely, but good luck modifying it. You, the user of my software, have lost freedom because there is no GPL to force me to provide you with that freedom. Re: (Score:3, Interesting) The GPL obliges provision of source code because it operates in a copyright encumbered culture, and needs to persuade licensees used to the proprietary software development business model that there is no benefit to withholding source (their inculcated inclination). There is no need to oblige disclosure of source to derivatives in a culture used to operating without copyright. Looking at it another way, tell me why in a culture without copyright you'd have to enact a law that prohibited the distribution of bi Re:Encryption (Score:4, Insightful) However, there is no market for withheld or obfuscated source code in such a culture. Binaries cost nothing to make and could not be sold ... The GPL is about reproducing the culture that would result if copyright and patent were abolished, i.e. a free culture. Imagine we live in that world without copyright, and therefore a world without GPL. Oracle builds and sells an RDBMS. Anyone can copy and use it for free, since there is no copyright preventing that. However, Oracle wants to make money off of their RDBMS. So, they sell support services. Maybe they also offer custom development to tailor the RDBMS for your environment. In order to prevent competitors from providing those services, it makes sense for them to keep their source code hidden and only distribute the binaries. No-one's freedom is constrained if the source is withheld or obfuscated in a culture without copyright. According to RMS, withholding source limits user freedom. Therefore, users of GPL software have more freedom than users of Oracle RDBMS in the above example. Re: (Score:3, Insightful) As someone nicely said: "GPL takes away the freedom to take freedom away form others". Re: (Score:3, Interesting) You are endangering the public welfare because you are distributing something without any assurances that it is what you claim it is. But that only truly matters in any real sense if there's potential harm to those who use it. You don't like the ramifications. That's fine. Actually, I don't give a shit about the ramifications. This is all hypothetical, anyway. And I'm not the "retard" (as you so eloquently put it) who refuses to address the difference between a product that has safety concerns, such as toys, food, or medicine, and a product that does not, such as a Tetris clone, despite your own use of the phrase "endangering public welfare" with respect to that Tetris clone. All I can Re: (Score:3, Insightful) and you realize that without copyright law and software patents, the GPL is unnecessary? Re: (Score:3, Insightful) [...] lawyer's won't be fazed by significant technical differences if the end result is the same - they'll sue you first and leave the questions to judges in subsequent decades. The key to this is who the "you" that gets sued is. There are three classes of participant in this data transfer: uploader, downloader, and cloud member. It seems to me that this scheme makes the uploader and the downloader guilty, but difficult to catch (you'd need to catch them exchanging URLs), and the cloud members not guilty of anything. Cloud members would have no idea whether they were hosting (chunks of) copyrighted top 40 MP3s, legally redistributable freeware, communications between Burmese freedom Re: (Score:3, Interesting) People involved in file-sharing have already settled litigation out of court - even when they know they're entirely innocent. Guilt is immaterial if you want to avoid the penury of prosecution. The 'bad actors' who are sued are those the **AA wishes to make an example of to other 'bad actors' - the more naive and apparently unprosecutable the better. After all, file-sharing is a problem precisely because it's engaged in by kids and their apple pie making grannies. If it was only incorrigible pirates that did Re: (Score:3, Insightful) I didn't say "human rights", which, by the way, is also a human construct just as legal rights are, so if you're going to be a pedant please use accepted definitions instead of redefining them according to your own sociopolitical dogma. I imagine you frown upon the RIAA's use of the term "theft" to describe illegal music downloading... hmmm. Anyway, you're being blinded by the abuse of copyright. Do you really not see the public benefit of intellectual property? Do you not see how in the absence of those "p Re: (Score:3, Insightful) Human rights are legally protected, self-evident, natural rights. Copyright and patent are mercantile privileges, thus unnatural and unethical. Copyright infringement is the unauthorised copying of a work protected by copyright. Intellectual property theft is the unauthorised removal of someone's intellectual property from their private premises. Copyright is an unethical privilege and an ineffective anachronism and should be abolished. Patent similarly, especially as applied to software. Intellectual property Short version (Score:5, Insightful) What we have here is a technical solution to a legal problem. Every time a story pops up on Slashdot with a legal solution to a technical problem, we laugh at it. Well, the other way around doesn't work either, folks. Re: (Score:3, Funny) Exactly.... This is all petty semantics from a legal standpoint. When you're in civil court attempting to defend yourself, you can not argue about the law like you argue about DnD rules. Re:Short version (Score:5, Insightful) What we have here is a technical solution to a legal problem. Every time a story pops up on Slashdot with a legal solution to a technical problem, we laugh at it. Well, the other way around doesn't work either, folks. The law is all about technicalities. Whether it is prosecuting Al Capone for Tax Evasion or successfully defending yourself because of technicalities, finding technical solutions to legal problems is exactly how the Judicial system works.'re mixing up your problem spaces. (Score:5, Insightful) just mixed your namespaces. 1st: [Law solution (statutory)] tries to fix [Computer problem] 2nd: [Law solution (procedural)] tries to fix [Law problem] These aren't equivalent. A technical computer solution to a computer problem is fine, as is a technical legal solution to a legal problem. What's worthy of derision is using a law solution to a computer problem or using a computer solution to a law problem, and that's what this is. Claiming that you didn't violate someone's copyright because you copied their works without permission in a really nifty way is nonsense. Copyright law doesn't care if you independently produce exactly the same work as somebody; it's a strict liability tort -- "innocent" infringement is still infringement. The song "Happy Birthday" is under copyright. If I send you two emails, one that contains a numbered list of every word to "Happy Birthday" along with 1000 other words, in alphabetical order, and another email that contains the numbers of the words "Happy Birthday" in the order they appear in the song, the two together constitute a copyright violation. The same principle applies if I give the page- and line-numbers of a common dictionary, or any other referenced source, even if the referenced source was itself in the public domain. If two legally independent systems existed to transport this data each one would probably be immune from being prosecuted for "aiding and abetting" copyright violations, particularly if there were other legitimate uses, but a combined infrastructure which encouraged people to use it for copyright violations would be legally problematic. Let's put it another way: If I ran a legitimate service that operated this way, and I filtered out "re-assembly URLs" that appeared to be copyright violations, that would be legally defensible. If, independently of me, you took copyrighted data and put it on my system with bogus re-assembly instructions and labeled the data "random_numbers", and then sent the correct reassembly data through another mechanism, I would be legally off the hook, but if you were ever caught, you would not be. Legally, this is not much different than copyrighted data encrypted by a one-time pad. Either half can be considered the non-copyrighted pad, and proving which half is the pad and which half is derived from the original can be legally difficult or impossible, but together, it's the same as the original and anyone or any organization that says "I have a safe way for you to use my product to safely transmit both halves to circumvent copyright protection laws" is going to get hauled into court and lose. Anyone or any organization which, through gross negligence, allows such traffic and who could reasonably stop it without shutting down non-infringing uses, or which doesn't have a substantial amount of non-infringing use, is asking for a legally expensive court fight. He might win the fight but he will be financially bruised for it. If you are going to pull a stunt like this, make sure it's broken into enough organizational pieces that each piece is clearly legally defensible, and make sure both each piece and the overall technology enjoy substantial use by legal users. Also make sure there is no cheap way of segregating infringing from non-infringing use. Re:Encryption (Score:5, Insightful) It's not a form of encryption, the purpose is not to hide the data but to share representations. The basic idea is let's say that I have files/blocks A,B,C. Instead of storing them directly I will compute shares that merge the information into a new set of blocks. None of the new set of blocks will contain copyrighted info - or if it does then who will own it because there are competing copyright claims. To get file A back out I need to take a selection of the shares and xor them together. It's an interesting technical approach, but a classic FAIL. Geeks never understand the law, they assume that it is a mechanical system that can be gamed (well, because they're geeks). But no matter how the law it is written, it is interpreted by people. The first time that it was tried is court would be something like this: Pros: Could you explain to the court what you uploaded to Brightnet? .... .... .... in several parts. Def: It was a non-linear combination of the xor of Pros: Did you upload Britney Spears - Chart Slag.mp3? Def: No, that was never on my computer. Pros: Did you upload something that allowed the mp3 to be constructed exactly? Def: Yes Pros: Copyright infringment through unauthorised distribution, the prosecution rests. Def: WTF? Re:Encryption (Score:5, Insightful) The point that I was making was that the law operates on intent rather than action. If the sole purpose of your XOR of Britney and someone's holiday photos is to allow reconstruction of the mp3 then it is a defense that the court would see through. Re: (Score:2) On aside note, assuming computing power is no problem, wouldn't it be better to distribute multiple MD5 hashes of 128kb chunks of a given file. Then through brute force reassemble the file by solving for what the MD5 represents. Not only are you dr Psst. Copyright doesn't work like that! (Score:5, Insightful) Re:Psst. Copyright doesn't work like that! (Score:4, Interesting) Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) Hmmm... I don't think that's the objective, exactly. I didn't read TFA as saying "material distributed in this way is not subject to copyright" but rather "none of the bits we're moving are copyrighted - go pester the people doing the uploading" I also think there is a useful discussion to be had on the subject of numbers and the digital assets they may or not represent. If I zip up MS Office, for instance, I've turned it into a very long number. Is it reasonable to allow companies to claim ownership of such numbers? With the proper compression and/or encryption scheme, you could use any number (trivially in some cases) to represent a work over which you can claim copyright. Do we then let a corporation privatise the entire integer space? And if not, how do we distinguish between infringing and non-infringing uses of a large number? Re: (Score:2) how do we distinguish between infringing and non-infringing uses of a large number? $ sudo apt-get install common-sense && man common-sense Re:Psst. Copyright doesn't work like that! (Score:4, Insightful) The problem I have with that, is I that don't think those commands work in a court of law. Come to think of it, but I'm fairly they wouldn't work under Ubuntu either. (I wouldn't know about Debian) Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) In this case, though, the law has it right. No matter what you're doing to break up, encrypt, hash, randomize, or distribute files, if the end-goal is to end up with a representation of copyrighted material then you're still breaking the law. If you don't like the law, then go out there and do something about it. Trying to find a workaround for the law is just going to get the courts mad at you if you get caught. Information may want to be free, but right now it isn't (at least not the information that these kinds of things are being created for). Legitimize it, not strategize about how to avoid the problems that can come with it. Re: (Score:3, Funny) Wait, are you calling me a debian newbie, or a human-geek-slashdot newbie? Either way, I'm fairly sure the output would actually be more like: $ sudo apt-get install common-sense && man common-sense common-sense is a meta package The following NEW packages will be installed: RMS-logic RMS-common_sense RMS-IP_thoughts The following currently installed package(s) will be removed: human_society Do you want to continue [Y/n]? Re: (Score:2) This argument is futile. The law covers distribution of the information regardless of the format of the information, so one large number is legally indistinguishable from base64 or hex. If the copyrighted data can be recovered it's considered distribution - in some cases even if the key itself is not distributed with the encrypted data. I don't know if this new system exploits a loophole in the laws, but even if it does, that loophole will be closed. The new copyright laws appearing worldwide are practically Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) If the copyrighted data can be recovered it's considered distribution - in some cases even if the key itself is not distributed with the encrypted data. The issue is that any piece of random data can be turned into copyrighted data. With the right key, you can turn John Smith's holiday photo's into copyrighted MP3's. But you can't sue John Smith because someone uploaded a key that can turn his photo's in copyrighted data. OFF stores random blocks of data, which can be used by multiple files. It doesn't store any information in particular, just random blocks. Random blocks that can be used for anything. It is the URL that turnes those random blocks into something. Re: (Score:3, Insightful) It's just like piratebay.org, they don't host the data but in most countries what they are doing is considered illegal. Re: (Score:3, Informative) tho Mathematical sophistry does not trump the law. (Score:3, Insightful) those random blocks. It all depends on the URL, not on the Random Data. In other words, it's distributing liability for infringement to all the people holding the bits you use to assemble the file. Wow. That's great. No court is going to rule that centuries of legal tradition are meaningless before mathematical sophistry. The way you store the file is just as irrelevant to infringement as whether you've got music in MP3 format or AAC format. You may think it's mathematically clever, but the court's aren't going to be interested in the logic of the math as much as the social an Re:Psst. Copyright doesn't work like that! (Score:5, Funny) Re: (Score:3, Interesting) The thing is, with the right archiving algorithm, you could encrypt a given piece of data into any integer desired. For instance, XOR an MS Office zip against a tar file of the linux kernel. Take the output and go to the judge and ask for a Cease and Desist order, on the grounds that the kernel tar is in fact a representation of MS Office. You'd need to be a bit more subtle than that, but I expect you make a reasonably convincing s Re: (Score:3, Informative) As a rule, you don't copyright the exact data (i.e. the sequence of numbers representing a digital file). You copyright the actual tangible information. Attempting to abstract the law into mathematics is pointless. They are not compatible. That's not the point. The point is that if someone downloads blocks from me to be used for copyrighted material, I cannot know what it is used for. Maybe these block also encode legal stuff. Because the same block encodes multiple files, and because a request does not state what the data is gonna be used for, I (probably) cannot be holded responsable for sharing copyrighted material. No. Try think this through from the court's side. (Score:3, Insightful) I made a longer winded post about this here, [slashdot.org] but I'll summarize for you. That's not the point. The point is that if someone downloads blocks from me to be used for copyrighted material, I cannot know what it is used for. That's the problem. You have absolutely no way of knowing that you're not sharing infringing blocks, you have no way to prevent it, and yet you've still willingly installed and ran the software on your system. How are the courts going to preserve copyright law in the face of this technical challenge? Make no mistake, courts aren't going to just throw up their hands in the air and say, "Wow! Centuries of legal tradition and entire sect Re:Psst. Copyright doesn't work like that! (Score:4, Interesting) You copyright the actual tangible information. Attempting to abstract the law into mathematics is pointless. They are not compatible. You're dead right. What is interesting is that if you're "caught" with some of these random blocks on your disk, they're just random blocks of data. You can't decode them unless you have the key, hence there's no charge of copyright infringement. One problem with the proposal (which, by the way, is very obvious, and is how FreeNet and other systems work) is that their key length needs to be the same length as the data, because it's effectively a One Time Pad. If it's any shorter than the original data, then there will be a way to unencrypt the data without the key (proof by a simple counting argument). Rich. Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) Once I actually understood what on earth they are on about, it seems like an interesting idea with very little basis in reality. Their main claim seems to be a magic-wand approach to getting round copyright, as opposed to a particularly useful distributed filesystem: No data passing through the network can be considered copyrighted because the means by which it is represented is truly random Sure... So if I put in Brittany's latest album, then tell my friend to click on the url that 'reassembles' the 'truly random' data into, well, Brittany's latest album, then do you really think copyright has nothing to say? Breaking news! Photocopying books is TOTALLY LEGAL if you use yellow paper and/or put the book in the machine upside down! A correctly encrypted file also appears random. It does not mean it IS random, otherwise it would be, well, not very useful. Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) For some of us that isn't a problem, since we don't believe in IP anyway. Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) Re: (Score:3, Insightful) Who said im going to court? I adjust my activities to compensate which avoids that situation. Doesn't change my belief, or disregard. Re:Psst. Copyright doesn't work like that! (Score:4, Insightful) "Whether you believe in Allah is irrelevant to the Sharia law of the country of where you live. As a defense it won't hold up in the Religious court." There, fixed it for you. Since the evidence for existence of Allah is pretty much on the same level as that for the so-called "Intellectual Property" (i.e. the concept of 'ownership' of large integer numbers and the like) and the relationship between such belief and laws passed based on it is strikingly similar, the statement you made is pretty much equivalent to the one below: arbitrary bullshit based on whatever nonsense happens to deliver power and money to whatever "law makers" and their associates happen to be at the top at the time, logic, science and reason be damned. Re: (Score:3, Insightful) If all people were as pathetic as you, feudal lords and slavery would be the norm in all societies today. USA would not even exist, merely a colony ruled by the unchallengeable laws of the King of Britain, because as you so aptly said: "we have to pay some regard to the rules of that society whether they make sense to us or not". Luckily for us all, some of our ancestors took somewhat Re:Psst. Copyright doesn't work like that! (Score:5, Insightful) Re: (Score:2) Saddam didn't believe in the court's jurisdiction. Didn't do him any favours! Re: (Score:2) From the article: Re: (Score:2) Define "information" in terms not mathematically equivalent to binary data. If you manage this, that would mean that all the computing technology is in fact impossible (as computers would not be able to process information), that no music or moving images can be digitally stored and that "information" cannot be encoded in form of electrical impulses, among other things. What Re: (Score:3, Insightful) All of those are examples of binary data and mathematical manipulation of thereof. Picture can be represented, to an arbitrary degree of precision, as binary data. The operation of "cropping" is a mathematical transform on such. Repetition is a ma Data != Information (Score:5, Insightful) Incidentally, no data passing through the network can be considered copyrighted because the means by which it is represented is truly random. It's not the data that's protected by copyright, it's what the data represents. No matter how you mangle the data when storing it or transferring it from one location to another, the end result is the same. They're trying to use semantics and technical voodoo to get around copyright law. It won't work. Re:Data != Information (Score:5, Funny) Re:Data != Information (Score:5, Interesting) Re: (Score:3, Informative) The idea of a chunk that 'could' be used to represent part of a copyrighted work is specious. Using XOR encryption, a copy of Madonna's latest video 'could' just be my weekly shopping list, encrypted with a particular one-time pad. Anything could be anything, and therefore the concept of 'could be' is useless. Re:Data != Information (Score:5, Funny) Defense: I didn't do it. Prosecution: We found the body in your apartment, hidden under your bed. Defense: It is true that I placed a fast-moving bullet into the air adjacent to his chest, but if there happened to be any later consequences, those were not clearly visible from the location of the trigger. Jury: Hang him. So yeah, this is no legal defense. But perhaps it wasn't meant to be one. It seems like subterfuge, countersurveillance, and plausible deniability than anything else. But that plausibility won't hold up long, because the courts will soon say "If we find a bunch of random files on your drive, the burden is on *you* to prove that they aren't naughty bits." They'd make you extract the original content from the blocks, which hopefully haven't later disappeared off the internet, and if you couldn't do it then you'd be in hot water. Re: (Score:3) I thought it was innocent until proven guilty? You're thinking of the wrong century. A common mistake in these post 911 days. Re:Data != Information (Score:5, Insightful) Granted, you won't fool a (competent) computer scientist with that, but a jury could be confused, to say the least. Hans Reiser thought he could out-smart the jury. Look how well that worked for him. Neither judges nor juries like to feel like they're being played. You play a game like that, attempting to confuse them with technology that's over their heads, and you're not exactly going to win them over. The result of that kind of argument will likely be that they ignore the part that's confusing to them, and focus on the part that's simple to understand: you have the Indiana Jones movie on your hard drive, and that's a copyright violation. Simple. Re: (Score:3, Interesting) The result of that kind of argument will likely be that they ignore the part that's confusing to them, and focus on the part that's simple to understand: you have the Indiana Jones movie on your hard drive, and that's a copyright violation. Simple. "The big guy nobody likes (RIAA/MPAA) don't like this technology because they can't control it. They framed me while I was downloading Knoppix linux because they don't like this software." Big guy vs small guy. Easy to understand as well. Really, I think that could work. Freenet File System (Score:2) Or at least that is what it sounds like to me from the summary. The data would change from (Score:3, Interesting) to "encrypted copyrighted data" The first is merely infringement. The second is conspiracy to commit infringement, and you will have lost any chance of defending with "I didn't know it was copyrighted". Curiously enough things like this are exactly why "conspiracy to commit" crimes exist. Furthermore, unless I'm making a stupid mistake, it doesn't actually distribute the data, the key to find the data in the P2P net is the same length as the original data, in the random case, which buys you exactly ... nothing. You have to download the file twice. This thing does not evade copyright law, and it's inconvenient to boot. I don't think I'll be placing a second look. Re:The data would change from (Score:5, Informative) The cool thing is that the files really are random. They are simply numbers that can be combined to make a copyrighted file but don't have to be. In other words: (As stated on the wiki) you will infringe on copyright the second the random files are combined. But downloading and sharing the files is not a copyright infringement. Re:The data would change from (Score:4, Insightful) And how do you know which files to download? You know because from somewhere you got a key that told you WHICH files you need. The key is where this falls down. The key is an encrypted representation of the original. Trading the key is where the infringement occurs. Let's take a simple examples. There are 4 files in my "brightnet"- "00", "01", "10", "11". I name these files "a","b","c","d". Now I have my copyrighted string I want to trade. My string is 01101101001010. I need to generate the key for the brightnet, which is "bcdbacc". This tells me that I need to take file b, then file c, then file d... to reproduce the original. Now, you can argue that downloading file a, b, c, or d in itself isn't a violation. That may be true, but it misses the point. The point is that the brightnet is useless without my key file "bcdbacc." My key file is, in itself, an encryption of the original copyrighted string. Trading in the KEY is the problem, even if downloading the files I'll use to decrypt it isn't. All this does is let us generate multiple possible encryptions of the same file. And, with large enough brightnet blocks, each one can be shorter than the original. Which is cool for file traders--if there are multiple keys that encode the same file, now all of a sudden it's harder to catch me trading files--I can send the same file to 2 people using 2 different keys, so simply watching for a specific key won't catch me trading a particular file At best, this makes it easier to trade copyrighted files. But thinking there's no obvious copyright violation here is just silly. Re: (Score:3, Insightful) That's not immediately clear. The Pirate Bay's entire purpose is distributing "keys" that point to external resources where copyrighted data can be found. Similarly, a HTTP URL of a copyrighted file is a "key" that instructs your browser where it c Re: (Score:3, Insightful) Re: (Score:3, Informative) Actually the algorithm is not performing a search through truly random blocks, but rather generating new 'random"* blocks by combining old blocks with the copyrighted file. So the blocks AND they key are derivative works, meaning even users of this app who are just researching it become liable for copyright infringement if any of the users puts even a single copyrighted file on it. DESPITE not being able to read said file. The law does not specify what comes out, only what goes in. Copyrighted files go in - Re:The data would change from (Score:4, Insightful) The second is conspiracy to commit infringement, and you will have lost any chance of defending with "I didn't know it was copyrighted" Unless you don't know what is stored where. How is this different to Tahoe? (Score:3, Informative) From the Wiki (Score:5, Interesting) "A simple analogy is seen in that every number has an infinite number of representations (3+2=5, 2*2+1=5, 10-5=5, 10/2=5, etc). Even if the number (file) in question can be copyrighted under current legislation, it is practically impossible and unreasonable to state that every other representation of that particular number is copyrighted." Actually, no, it's not unreasonable or impractical. In fact, that's how it actually works. Star Wars is copyrighted as a DVD, Film, mpeg, script, live performance, song, interpretive dance, etc. ..right? Context matters. (Score:3, Insightful) You're quite right. Like it or not, copyright doesn't apply to bit-streams, but rather to particular instantiations of ideas (and derivatives thereof). No one can copyright a number. But in a particular context, a certain bit-stream can be considered protected by copyright. This whole "you can't copyright a number!" is a red herring. No one seriously claims that particular numbers are copyrighted. But in a certain context, a particular chunk of data (a number!) can be reasonably shown to be a copy (or derivat Metered Internet. (Score:2) Summary Misleading (Score:3, Insightful) From the main site: "It must be noted that up until the point of retrieval of content from the OFFSystem, storage and transfer of a so-called copyrighted file is completely legal. However, the act of re-assembling a file may be considered copyright infringment in some cases, and users should be aware of legislation regarding copyright law which applies to their jurisdiction before doing so." I think this analysis is flawed because it assumes that the instructions to construct a file are not a file, and that only when you have the end file have you copied the work. In fact, if the instructions contain all the information of a work, they are the work, in exactly the same way that any digital representation of a work is the work. "Y'onor, I didn't copy no files, look, this is just instructions to make the files" will not fly any more than "Y'onor, this isn't a music recording, it's ones and zeros." Insane lengths to go to (Score:4, Insightful) Look, I totally get how encryption and plausible deniabiltiy is great if you people are circulating dangerous information about government conspiracies, or organising the resistance in Burma or Zimbabwe, but lets face facts, this will be used to share torrents of Hollywood movies and top 40 albums. This is stupid. Either accept the fact that all the political posturing about free being a better business model is true, in which case, just go enjoy all the free music/software/games/movies out there, or admit its just smokescreens to justify getting Hollywood movies for free, whilst your entertainment is subsidised by everyone who paid to see that stuff, and thus allow it to be made. People seem to have this attitude that this kind of thing is cool because it lets you escape prosecution for copyright infringement. If copyright is such a fucked-up system, then why is it all the stuff people want to share is produced under that system? Surely all the cool movies/software/music/games is being produced under the free model right? Or could it be that the free model isn't viable, or popular with content producers, big and small... YANAL (Score:2) Doesn't matter to me. When I open up my hard drive with a hammer, I don't see any numbers anyway, so I don't see how that helps me. Seriously, though, if you think stopping at a particular layer of abstraction and then adding another layer of abstraction isn't what IP lawyers call a "derived work", then I don't think you understand IP well enough to make any claims at all. A lot of misinformation floating around... (Score:2, Informative) There's a lot of misinformation floating around here (RTFA please). Here's what happens: you want to upload a file. The program makes up a bunch of random numbers - really random numbers that have nothing to do with the original file. The original file is not consulted to make the random blocks - they could be pre-generated even. Also generated is a URL that has the instructions on how to get the original file back from the random blocks. Anyone that shares this part is going to be guilty of copyright inf Worrisome... (Score:5, Interesting) [offdev.org] : Trojan detected with avg free Another side to the safety issue. I'm hoping this is a false positive, as I like OFF * avg free v7.5.516 virus base 269.17.13/1208 finds o Trojan Generic9.AKLU in + offsystem.exe from OFFStystem-0.18.00-win-installer.exe from sourceforge January 3 2008 This is worrisome... Re:Worrisome... (Score:4, Informative) "Trojan Generic..." Yeah, right. That's not a trojan sig that the antivirus recognized, it's just a heuristic that tags possible malware. Only 3 out of 32 [virustotal.com] antivirus programs complain. The message "Suspicious Self Modifying File" indicates that it's probably just because they used an uncommon packer. OFFsystem sez [planetpeer.de]: Unclear on the concept. (Score:2) If there is one copy at the start, and two copies at the end, then a copy has been made. If one does not have the right to make the copy, said right being reserved by law to the owner of the copy right, one has broke copy right law. This is an obvious tool for infringing on the copyrights of other. If it were not, then there would be no reason to say They can't even hide behind "it has other uses", because of all the talk about cop What colour are your bits? (Score:3, Interesting) Reinventing the wheel (Score:4, Interesting) I love kids these days, always thinking they are clever. A long time ago a man wrote a book, he then made an index of all the words in the book and listed them in alphabetical order. He then re-copied the book as a reference to the index. Original: "I am the king of scotland" Index: AM,I,KING,OF,SCOTLAND Story: 2-1-3-4-5 Now this idea is nothing more then seeding a network with the index of data then to rebuild a particular file you pass is an index reference. They would simply bust people for passing the index reference. Ironical that old book became the foundation for modern day text compression schemes that used indexes and many of the key concepts that cryptography was born from. Clever kids, if it was still the 1500's and you were trying to smuggle banned books under the nose of the inqusition. They just burned people with the indexes just as if they had the books themselves. Honestly do they really thing that people are that stupid? If I use a pencil to stab someone I am going to jail just the same if I had used a knife. If someone is smuggling something across the border, but I don't know what, I am still an accomplice to some degree. Plausable deniability is a great idea but the moment one of those indexes lands on you PC your gonna get dinged for whatever the index points too. Sorry guys, the law doesn't work that way (Score:3, Insightful) IANAL, but my understanding of copyright law and law in general is that it is typically performance based. That means that If it is used and appears to have the purpose of distributing copyrighted material, no mathematical slight of hand in the middle changes the fact that copyrighted material is being moved. It may, however, offer some protection to the people operating the network, but anyone at the end points (providing/retrieving) is still likely to run into trouble. At the very least, it will be a costly argument to someone in court. If the system offered substantial benefits to non-infringing users (and was used that way) over traditional ways of transferring files, then maybe they are ok, but if it looks like a duck, walks like a duck and talks like a duck, it must be a duck. Long story short: Seek legal advice! Re: (Score:2) Re: (Score:2) Re: (Score:2) Re: (Score:3, Funny) Only if you zip it twice and shake your laptop (or wiggle your PC) during the process for randomizing some bits. Re: (Score:3, Insightful) If you want P2P, this is no better than BitTorrent - and at first glance not nearly as robust. If you're a seeder, it is "better" in the sense that (arguably) the chunks you're serving are not illegal to share. Let's say you're serving just one chunk - A. A on its own is useless, and very difficult to demonstrate as illegal. Other people are serving B, C, D, E, F. A XOR B is a chunk of project_gutenberg_king_james_bible.txt. A XOR C is a chunk of britney_spears_toxic.mp3. A XOR D is a chunk of terrorist_plans.pdf. A XOR E is a chunk of lolita_rape.avi. Just to mix it up a bit, E XOR F is a chunk of Re: (Score:3, Insightful) how is this junk different from encryption or plausible deniability file systems - distributed or localized? Congratulation to the moderators, for moderating +4 insightful a post which is a one line question titled "Big load of BS", written by someone who clearly did not RTFA.
http://hardware.slashdot.org/story/08/06/30/1214220/brightnets-are-owner-free-file-systems
CC-MAIN-2014-42
refinedweb
8,803
62.27
Check whether bitwise OR of N numbers is Even or Odd Given an array arr[] containing N numbers. The task is to check whether the bitwise-OR of the given N numbers is even or odd. Examples: Input : arr[] = { 2, 12, 20, 36, 38 } Output : Even Bit-wise OR Input : arr[] = { 3, 9, 12, 13, 15 } Output : Odd Bit-wise OR A Simple Solution is to first find the OR of the given N numbers, then check if this OR is even or odd. Time Complexity: O(N) A Better Solution is based on bit manipulation and Mathematical facts. - Bitwise OR of any two even numbers is an even number. - Bitwise OR of any two odd number is an odd number. - Bitwise OR of an even and an odd number is an odd number. Based on the above facts, it can be deduced that if at least one odd number is present in the array then the bitwise OR of whole array will be odd otherwise even. Below is the implementation of the above approach: C++ Java Python3 C# // C# implementation to check whether // bitwise OR of n numbers is even or odd using System; class GFG { // Function to check if bitwise OR // of n numbers is even or odd static bool check(int []arr, int n) { for (int i = 0; i < n; i++) { // if at least one odd number is // found, then the bitwise OR of // all numbers will be odd if (arr[i] % 2 == 1) { return true; } } // Bitwise OR is an odd number return false; } // Driver Code public static void Main() { int []arr = {3, 9, 12, 13, 15}; int n = arr.Length; if (check(arr, n)) { Console.WriteLine("Odd Bit-wise OR"); } else { Console.WriteLine("Even Bit-wise OR"); } } } // This code is contributed // by 29AjayKumar [tabby title="PHP"] Odd Bit-wise OR Time Complexity: O(N) in worst case. Recommended Posts: - or not - Check whether product of 'n' numbers is even or odd - Check if one of the numbers is one's complement of the other - Check whether the two numbers differ at one bit position, jit_t, 29AjayKumar
https://www.geeksforgeeks.org/check-whether-bitwise-or-of-n-numbers-is-even-or-odd/
CC-MAIN-2019-22
refinedweb
350
62.51
Hi, We're migrating from windows 2003 to 2008 32bits (not R2) and we facing problems sending mails from a winform app. I've setup a simple vbscript in order to test and a console app as well. everything goes well while seding emails using the vbsccript (CDO.message) but failed when using the console app (using the System.Net.Mail namespace) i run both as the same user account, targeting the same smtp server with the same credentials on the same smtp port. Any idea? What is the error message you get? Give more details. In mean time, you can check these links: -Jai The returned error is the following one: "Unable to connecet to remote server" "A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond" I've installed Windows Live Mail on the server and i configured the mail account. No mail can be sent either. i guessing there a configuration problem somewhere. All firewall settings seems ok since i'm able to sent mail using the vbscript. any help would be appreciated
https://social.msdn.microsoft.com/Forums/en-US/fbbd3df7-447c-4e5f-a4e4-d593e9662f10/systemnetmail-vs-cdomessage?forum=netfxnetcom
CC-MAIN-2021-10
refinedweb
194
64.1
NAME swi_add, swi_sched - register and schedule software interrupt handlers SYNOPSIS #include <sys/param.h> #include <sys/bus.h> #include <sys/interrupt.h> extern struct ithd *tty_ithd; extern struct ithd *clk_ithd; extern void *net_ih; extern void *softclock_ih; extern void *vm_ih; int swi_add(struct ithd **ithdp, const char *name, driver_intr_t handler, void *arg, int pri, enum intr_type flags, void **cookiep); void swi_sched(void *cookie, int flags); DESCRIPTION These functions are used to register and schedule software interrupt handlers. Software interrupt handlers are attached to a software interrupt thread, just as hardware interrupt handlers are attached to a hardware interrupt thread. Multiple handlers can be attached to the same thread. Software interrupt handlers can be used to queue up less critical processing inside of hardware interrupt handlers so that the work can be done at a later time. Software interrupt threads are different from other kernel threads in that they are treated as an interrupt thread. This means that time spent executing these threads is counted as interrupt time, and that they can be run via a lightweight context switch. The swi_add() function is used to register a new software interrupt handler. The ithdp argument is an optional pointer to a struct ithd pointer. If this argument points to an existing software interrupt thread, then this handler will be attached to that thread. Otherwise a new thread will be created, and if ithdp is not NULL, then the pointer at that address to will be modified to point to the newly created thread. The name argument is used to associate a name with a specific handler. This name is appended to the name of the software interrupt thread that this handler is attached to. The handler argument is the function that will be executed when the handler is scheduled to run. The arg parameter will be passed in as the only parameter to handler when the function is executed. The pri value specifies the priority of this interrupt handler relative to other software interrupt handlers. If an interrupt thread is created, then this value is used as the vector, and the flags argument is used to specify the attributes of a handler such as INTR_MPSAFE. The cookiep argument points to a void * cookie. This cookie will be set to a value that uniquely identifies this handler, and is used to schedule the handler for execution later on. The swi_sched() function is used to schedule an interrupt handler and its associated thread to run. The cookie argument specifies which software interrupt handler should be scheduled to run. The flags argument specifies how and when the handler should be run and is a mask of one or more of the following flags: SWI_DELAY Specifies that the kernel should mark the specified handler as needing to run, but the kernel should not schedule the software interrupt thread to run. Instead, handler will be executed the next time that the software interrupt thread runs after being scheduled by another event. Attaching a handler to the clock software interrupt thread and using this flag when scheduling a software interrupt handler can be used to implement the functionality performed by setdelayed() in earlier versions of FreeBSD. The tty_ithd and clk_ithd variables contain pointers to the software interrupt threads for the tty and clock software interrupts, respectively. tty_ithd is used to hang tty software interrupt handlers off of the same thread. clk_ithd is used to hang delayed handlers off of the clock software interrupt thread so that the functionality of setdelayed() can be obtained in conjunction with SWI_DELAY. The net_ih, softclock_ih, and vm_ih handler cookies are used to schedule software interrupt threads to run for the networking stack, clock interrupt, and VM subsystem respectively. RETURN VALUES The swi_add() function returns zero on success and non-zero on failure. ERRORS The swi_add() function will fail if: [EAGAIN] The system-imposed limit on the total number of processes under execution would be exceeded. The limit is given by the sysctl(3) MIB variable KERN_MAXPROC. [EINVAL] The flags argument specifies either INTR_ENTROPY or INTR_FAST. [EINVAL] The ithdp argument points to a hardware interrupt thread. [EINVAL] Either of the name or handler arguments are NULL. [EINVAL] The INTR_EXCL flag is specified and the interrupt thread pointed to by ithdp already has at least one handler, or the interrupt thread already has an exclusive handler. SEE ALSO ithread(9), taskqueue(9) HISTORY The swi_add() and swi_sched() functions first appeared in FreeBSD 5.0. They replaced the register_swi() function which appeared in FreeBSD 3.0 and the setsoft*(), and schedsoft*() functions which date back to at least 4.4BSD. BUGS Most of the global variables described in this manual page should not be global, or at the very least should not be declared in
http://manpages.ubuntu.com/manpages/karmic/man9/swi_sched.9freebsd.html
CC-MAIN-2014-10
refinedweb
788
60.85
std::ranges::copy_backward, std::ranges::copy_backward_result From cppreference.com 1) Copies the elements from the range, defined by [first, last), to another range [result - N, result), where N = ranges::distance(first, last). The elements are copied in reverse order (the last element is copied first), but their relative order is preserved. The behavior is undefined if resultis within (first, last]. In such a case std::ranges::copy can be used instead. 2) Same as (1), but uses ras the source range, as if using ranges::begin(r) as first, When copying overlapping ranges, ranges::copy is appropriate when copying to the left (beginning of the destination range is outside the source range) while ranges::copy_backward is appropriate when copying to the right (end of the destination range is outside the source range). [edit] Possible implementation [edit] Example Run this code #include <algorithm> #include <iostream> #include <ranges> #include <string_view> #include <vector> void print(std::string_view rem, std::ranges::forward_range auto const& r) { for (std::cout << rem << ": "; auto const& elem : r) std::cout << elem << ' '; std::cout << '\n'; } int main() { const auto src = {1, 2, 3, 4}; print("src", src); std::vector<int> dst (src.size() + 2); std::ranges::copy_backward(src, dst.end()); print("dst", dst); std::ranges::fill(dst, 0); const auto [in, out] = std::ranges::copy_backward(src.begin(), src.end() - 2, dst.end()); print("dst", dst); std::cout << "(in - src.begin) == " << std::distance(src.begin(), in) << '\n' << "(out - dst.begin) == " << std::distance(dst.begin(), out) << '\n'; } Output: src: 1 2 3 4 dst: 0 0 1 2 3 4 dst: 0 0 0 0 1 2 (in - src.begin) == 2 (out - dst.begin) == 4
https://en.cppreference.com/w/cpp/algorithm/ranges/copy_backward
CC-MAIN-2021-43
refinedweb
273
55.34
Comparing Files in Java Comparing Files in Java Take a look at how you can use memory mapping to easily compare files in Java in a performant, somewhat resilient manner. Join the DZone community and get the full member experience.Join For Free Get the Edge with a Professional Java IDE. 30-day free trial. the disk. Because this is a demo, the server and the client are running on the same machine and the file is copied from one directory to the exact same directory, but under a different name. The proof in the pudding is eating it: The files have to be compared. The file I wanted to copy was created to contain random bytes. Transferring only text information can sometimes leave tricky bugs lurking in the code. The random file was created using the simple Java class: package packt.java9.network.niodemo; import java.io.FileOutputStream; import java.io.IOException; import java.util.Random; public class SampleMaker { public static void main(String[] args) throws IOException { byte[] buffer = new byte[1024 * 1024 * 10]; try (FileOutputStream fos = new FileOutputStream("sample.txt")) { Random random = new Random(); for (int i = 0; i < 16; i++) { random.nextBytes(buffer); fos.write(buffer); } } } } Using IntelliJ, comparing files is fairly easy, but since the files are binary and large, this approach is not really optimal. I decided to write a short program that will not only signal that the files are different, but also where the difference is. The code is extremely simple: package packt.java9.network.niodemo; import java.io.BufferedInputStream; import java.io.FileInputStream; import java.io.IOException; public class SampleCompare { public static void main(String[] args) throws IOException { long start = System.nanoTime(); BufferedInputStream fis1 = new BufferedInputStream(new FileInputStream("sample.txt")); BufferedInputStream fis2 = new BufferedInputStream(new FileInputStream("sample-copy.txt")); int b1 = 0, b2 = 0, pos = 1; while (b1 != -1 && b2 != -1) { if (b1 != b2) { System.out.println("Files differ at position " + pos); } pos++; b1 = fis1.read(); b2 = fis2.read(); } if (b1 != b2) { System.out.println("Files have different length"); } else { System.out.println("Files are identical, you can delete one of them."); } fis1.close(); fis2.close(); long end = System.nanoTime(); System.out.print("Execution time: " + (end - start)/1000000 + "ms"); } } The running time comparing the two 160MB files is around 6 seconds on my SSD-equipped Mac Book — and it does not improve significantly if I specify a large, say 10MB, buffer as the second argument to the constructor of BufferedInputStream. (On the other hand, if we do not use the BufferedInputStream, then the time is approximately ten times more.) This is acceptable, but if I simply issue a diff sample.txt sample-copy.txt from the command line, then the response is significantly faster, and not 6 seconds. It can be many factors, like Java's startup time or code interpretation at the start of the while loop, until the JIT compiler thinks it is time to start to work. My hunch is, however, that the code spends most of the time reading the file into the memory. Reading the bytes to the buffer is a complex process. It involves the operating system, the device drivers, the JVM implementation, moving bytes from one place to the other, and finally, we only compare the bytes, nothing else. It can be done in a simpler way. We can ask the operating system to do it for us and skip most of the Java runtime activities, file buffers, and other glitters. We can ask the operating system to read the file to memory and then just fetch the bytes one by one from where they are. We do not need a buffer, which belongs to a Java object and consumes heap space. We can use memory-mapped files. After all, memory-mapped files use Java NIO, and that is exactly the topic of the part of the tutorial videos that are currently in the making. Memory-mapped files are read into the memory by the operating system and the bytes are available to the Java program. The memory is allocated by the operating system and it does not consume the heap memory. If the Java code modifies the content of the mapped memory, then the operating system writes the change to the disk in an optimized way when it thinks it is due. This, however, does not mean that the data is lost if the JVM crashes. When the Java code modifies the memory-mapped file memory, then it modifies memory that belongs to the operating system and is available (and is valid) after the JVM stops. There is no guarantee and 100% protection against power outages and hardware crashes, but that is a very low risk. If anyone is afraid of those, then the protection should be on the hardware level, which Java has nothing to do with anyway. With memory-mapped files, we can be sure that the data is saved into the disk with certainty — or at least a very high probability that can only be increased by failure tolerant hardware, clusters, uninterruptible power supplies, and so on. These are not Java's responsibility. If you really have to do something from Java to have the data written to disk, then you can call the MappedByteBuffer.force() method that asks the operating system to write the changes to the disk. Calling this too often and unnecessarily may hinder performance, though (simply because it writes the data to disk and returns only when the operating system says that the data was written.) Reading and writing data using memory-mapped files is usually much faster in the case of large files. To have the appropriate performance, the machine should have significant memory, otherwise, only part of the file is kept in memory, then the page faults increase. One of the good things is that if the same file is mapped into memory by two or more different processes, then the same memory area is used. That way, processes can even communicate with each other. The comparison application using memory-mapped files is the following:"); } } To memory map the files, we have to open them first using the RandomAccessFile class and ask for the channel from that object. The channel can be used to create a MappedByteBuffer, which is the representation of the memory area where the file content is loaded. The method map in the example maps the file in read-only mode — from the start of the file to the end of the file. We try to map the whole file. This works only if the file is not larger than 2GB. The start position is long but the size of the area to be mapped is limited by the size of an Integer. Generally this it… Oh yes, the running time comparing the 160MB random content files is around 1 sec. }}
https://dzone.com/articles/comparing-files-in-java
CC-MAIN-2018-30
refinedweb
1,139
64
This article explains the new features in Python 2.2.2, released on October 14, 2002. Python 2.2.2 is a bugfix release of Python 2.2, originally. The largest and most far-reaching changes in Python 2.2 are to Python’s model of objects and classes. The changes should be backward compatible, so it’s likely that your code will continue to run unchanged, but the changes provide some amazing new capabilities. Before beginning this, the longest and most complicated section of this article, I’ll provide an overview of the changes and offer some comments. A long time ago I wrote a Web page listing flaws in Python’s design. One of the most significant flaws was that it’s impossible to subclass Python types implemented in C. In particular, it’s not possible to subclass built-in types, so you can’t just subclass, say, lists in order to add a single useful method to them. The UserList module provides a class that supports all of the methods of lists and that can be subclassed further, but there’s lots of C code that expects a regular Python list and won’t accept a UserList instance. Python 2.2 fixes this, and in the process adds some exciting new capabilities. A brief summary: Some users have voiced concern about all these changes. Sure, they say, the new features are neat and lend themselves to all sorts of tricks that weren’t possible in previous versions of Python, but they also make the language more complicated. Some people have said that they’ve always recommended Python for its simplicity, and feel that its simplicity is being lost. Personally, I think there’s no need to worry. Many of the new features are quite esoteric, and you can write a lot of Python code without ever needed to be aware of them. Writing a simple class is no more difficult than it ever was, so you don’t need to bother learning or teaching them unless they’re actually needed. Some very complicated tasks that were previously only possible from C will now be possible in pure Python, and to my mind that’s all for the better. I’m not going to attempt to cover every single corner case and small change that were required to make the new features work. Instead this section will paint only the broad strokes. See section Related Links, “Related Links”, for further sources of information about Python 2.2’s new object model. First, you should know that Python 2.2 really has two kinds of classes: classic or old-style classes, and new-style classes. The old-style class model is exactly the same as the class model in earlier versions of Python. All the new features described in this section apply only to new-style classes. This divergence isn’t intended to last forever; eventually old-style classes will be dropped, possibly in Python 3.0. So how do you define a new-style class? You do it by subclassing an existing new-style class. Most of Python’s built-in types, such as integers, lists, dictionaries, and even files, are new-style classes now. A new-style class named object, the base class for all built-in types, has also been added so if no built-in type is suitable, you can just subclass object: class C(object): def __init__ (self): ... ... This means that class statements that don’t have any base classes are always classic classes in Python 2.2. (Actually you can also change this by setting a module-level variable named __metaclass__ — see PEP 253 for the details — but it’s easier to just subclass object.) The type objects for the built-in types are available as built-ins, named using a clever trick. Python has always had built-in functions named int(), float(), and str(). In 2.2, they aren’t functions any more, but type objects that behave as factories when called. >>> int <type 'int'> >>> int('123') 123 To make the set of types complete, new type objects such as dict() and file() have been added. Here’s a more interesting example, adding a lock() method to file objects: class LockableFile(file): def lock (self, operation, length=0, start=0, whence=0): import fcntl return fcntl.lockf(self.fileno(), operation, length, start, whence) The now-obsolete posixfile module contained a class that emulated all of a file object’s methods and also added a lock() method, but this class couldn’t be passed to internal functions that expected a built-in file, something which is possible with our new LockableFile. In previous versions of Python, there was no consistent way to discover what attributes and methods were supported by an object. There were some informal conventions, such as defining __members__ and __methods__ attributes that were lists of names, but often the author of an extension type or a class wouldn’t bother to define them. You could fall back on inspecting the __dict__ of an object, but when class inheritance or an arbitrary __getattr__() hook were in use this could still be inaccurate. The one big idea underlying the new class model is that an API for describing the attributes of an object using descriptors has been formalized. Descriptors specify the value of an attribute, stating whether it’s a method or a field. With the descriptor API, static methods and class methods become possible, as well as more exotic constructs. Attribute descriptors are objects that live inside class objects, and have a few attributes of their own: For example, when you write obj.x, the steps that Python actually performs are: descriptor = obj.__class__.x descriptor.__get__(obj) For methods, descriptor.__get__() returns a temporary object that’s callable, and wraps up the instance and the method to be called on it. This is also why static methods and class methods are now possible; they have descriptors that wrap up just the method, or the method and the class. As a brief explanation of these new kinds of methods, static methods aren’t passed the instance, and therefore resemble regular functions. Class methods are passed the class of the object, but not the object itself. Static and class methods are defined like this: class C(object): def f(arg1, arg2): ... f = staticmethod(f) def g(cls, arg1, arg2): ... g = classmethod(g) The staticmethod() function takes the function f(), and returns it wrapped up in a descriptor so it can be stored in the class object. You might expect there to be special syntax for creating such methods (def static f, defstatic f(), or something like that) but no such syntax has been defined yet; that’s been left for future versions of Python. More new features, such as slots and properties, are also implemented as new kinds of descriptors, and it’s not difficult to write a descriptor class that does something novel. For example, it would be possible to write a descriptor class that made it possible to write Eiffel-style preconditions and postconditions for a method. A class that used this feature might be defined like this: from eiffel import eiffelmethod class C(object): def f(self, arg1, arg2): # The actual function ... def pre_f(self): # Check preconditions ... def post_f(self): # Check postconditions ... f = eiffelmethod(f, pre_f, post_f) Note that a person using the new eiffelmethod() doesn’t have to understand anything about descriptors. This is why I think the new features don’t increase the basic complexity of the language. There will be a few wizards who need to know about it in order to write eiffelmethod() or the ZODB or whatever, but most users will just write code on top of the resulting libraries and ignore the implementation details. Multiple inheritance has also been made more useful through changing the rules under which names are resolved. Consider this set of classes (diagram taken from PEP 253 by Guido van Rossum): class A: ^ ^ def save(self): ... / \ / \ / \ / \ class B class C: ^ ^ def save(self): ... \ / \ / \ / \ / class D The lookup rule for classic classes is simple but not very smart; the base classes are searched depth-first, going from left to right. A reference to D.save() will search the classes D, B, and then A, where save() would be found and returned. C.save() would never be found at all. This is bad, because if C.) Following this rule, referring to D.save() will return C.save(), which is the behaviour we’re after. This lookup rule is the same as the one followed by Common Lisp. A new built-in function, super(), provides a way to get at a class’s superclasses without having to reimplement Python’s algorithm. The most commonly used form will be super(class, obj)(), which returns a bound superclass object (not the actual class object). This form will be used in methods to call a method in the superclass; for example, D‘s save() method would look like this: class D (B,C): def save (self): # Call superclass .save() super(D, self).save() # Save D's private information here ... super() can also return unbound superclass objects when called as super(class)() or super(class1, class2)(), but this probably won’t often be useful., and nothing about it has changed. As before, it will be called when an attempt is made to access obj.foo and no attribute named foo is found in the instance’s dictionary. New-style classes also support a new method, __getattribute__(attr_name)(). The difference between the two methods is that __getattribute__() is always called whenever any attribute is accessed, while the old __getattr__() is only called if foo isn’t found in the instance’s dictionary. However, Python 2.2’s support for properties will often be a simpler way to trap attribute references. Writing a __getattr__() method is complicated because to avoid recursion you can’t use regular attribute accesses inside them, and instead have to mess around with the contents of __dict__. __getattr__() methods also end up being called by Python when it checks for other methods such as __repr__() or __coerce__(), and so have to be written with this in mind. Finally, calling a function on every attribute access results in a sizable performance loss. property is a new built-in type that packages up three functions that get, set, or delete an attribute, and a docstring. For example, if you want to define a size attribute that’s computed, but also settable, you could write: class C(object): def get_size (self): result = ... computation ... return result def set_size (self, size): ... compute something based on the size and set internal state appropriately ... # Define a property. The 'delete this attribute' # method is defined as None, so the attribute # can't be deleted. size = property(get_size, set_size, None, "Storage size of this instance") That is certainly clearer and easier to write than a pair of __getattr__()/__setattr__() methods that check for the size attribute and handle it specially while retrieving all other attributes from the instance’s __dict__. Accesses to size are also the only ones which have to perform the work of calling a function, so references to other attributes run at their usual speed. Finally, it’s possible to constrain the list of attributes that can be referenced on an object using the new __slots__ class attribute. Python objects are usually very dynamic; at any time it’s possible to define a new attribute on an instance by just doing obj.new_attr. Generators. ‘slice index must be int’. Python 2.2 will shift values from short to long integers as required. The ‘L’ suffix is no longer needed to indicate a long integer literal, as now the compiler will choose the appropriate type. (Using the ‘L’. The. Python, Joonas Paalasma, Tim Peters, Jens Quade, Tom Reinhardt, Neil Schemenauer, Guido van Rossum, Greg Ward, Edward Welbourne.
http://www.wingware.com/psupport/python-manual/2.7/whatsnew/2.2.html
CC-MAIN-2015-35
refinedweb
1,986
62.48
If your application is using the Btree access method, and your application is repeatedly deleting then adding records to your database, then you might be able to reduce lock contention by turning off reverse Btree splits. As pages are emptied in a database, DB attempts to delete empty pages in order to keep the database as small as possible and minimize search time. Moreover, when a page in the database fills up, DB, of course, adds additional pages to make room for more data. Adding and deleting pages in the database requires that the writing thread lock the parent page. Consequently, as the number of pages in your database diminishes, your application will see increasingly more lock contention; the maximum level of concurrency in a database of two pages is far smaller than that in a database of 100 pages, because there are fewer pages that can be locked. Therefore, if you prevent the database from being reduced to a minimum number of pages, you can improve your application's concurrency throughput. Note, however, that you should do so only if your application tends to delete and then add the same data. If this is not the case, then preventing reverse Btree splits can harm your database search time. To turn off reverse Btree splits, provide the DB_REVSPLITOFF flag to the Db::set_flags() method. For example: #include "db_cxx.h" ... int main(void) { u_int32_t env_flags = DB_CREATE | // If the environment does not // exist, create it. DB_INIT_LOCK | // Initialize locking DB_INIT_LOG | // Initialize locking DB_INIT_MPOOL | // Initialize the cache DB_THREAD | // Free-thread the env handle DB_INIT_TXN; // Initialize transactions u_int32_t db_flags = DB_CREATE | DB_AUTO_COMMIT; Db *dbp = NULL; const char *file_name = "mydb.db"; std::string envHome("/export1/testEnv"); DbEnv myEnv(0); try { myEnv.open(envHome.c_str(), env_flags, 0); dbp = new Db(&myEnv, 0); // Turn off BTree reverse split. dbp=>set_flags(DB_REVSPLITOFF); dbp->open(dbp, // Pointer to the database NULL, // Txn pointer file_name, // File name NULL, // Logical db name DB_BTREE, // Database type (using btree) db_flags, // Open flags 0); // File mode. Using defaults } catch(DbException &e) { std::cerr << "Error opening database and environment: " << file_name << ", " << envHome << std::endl; std::cerr << e.what() << std::endl; } try { dbp->close(dbp, 0); myEnv.close(0); } catch(DbException &e) { std::cerr << "Error closing database and environment: " << file_name << ", " << envHome << std::endl; std::cerr << e.what() << std::endl; return (EXIT_FAILURE); } return (EXIT_SUCCESS); }
http://idlebox.net/2011/apidocs/db-5.2.28.zip/gsg_txn/CXX/reversesplit.html
CC-MAIN-2014-15
refinedweb
384
61.26
Defining CPT by a function instead of dictionary Currently, the lea.switch method requires the full CPT in the form of a dictionary. This CPT may be difficult to define if there are many entries or simply too large to fit in memory. As alternative, Lea provides the lea.cpt method that may factorize entries my means of boolean conditions on the influencing variables. However, lea.cpt only enables some kinds of factorization; also, the inference is usually slower than with lea.switch. We propose a new approach to lea.switch. Instead of passing an explicit CPT dictionary, we could pass a function that mimics the CPT lookup: such function receives a value from the influencing variable (possibly a tuple from a joint of several variables), it has then to return a probability distribution depending of its argument. The inference algorithm should be able to use this function without expanding the full CPT. The name of the new method could be switch_func. So, the construct my_cpt_dict = {...} my_lea_variable.switch(my_cpt_dict) could be replaced by def my_cpt_func(v): ... my_lea_variable.switch_func(my_cpt_func) The switch_func could then be useful to define noisy-or / noisy-max models. Add Slea class and lea.switch_func method (refs #47) → <<cset 3dc8bd46a50b>> This new feature is documented here on the wiki. I've just released Lea 3.1.0.beta.1, which includes this new feature. If something is wrong or improvable, it's still time to react.
https://bitbucket.org/piedenis/lea/issues/47/defining-cpt-by-a-function-instead-of
CC-MAIN-2019-18
refinedweb
239
59.09
Now that we have a lot of books in our library system, it would be great if we could quickly filter the books based on their category. HTML supplies a nifty builtin tag, called multi select, that will let us display a couple options. Our librarians can then select one category, or a couple of categories, and we’ll filter the books displayed on the page. This is going to require a number of additions to our existing app. We’ll create a new controller that returns a list of books in HTML that will be sent over the wire. We’ll have to setup a route to handle the search request. Since our stimulus controller will use the fetch api, and we’re sending filter parameters, it seemed like this action would work best as a POST end point. I’m going to work from my previous tutorial, which you can find on Github. Here’s our setup. Refactor the Books index action Our books_controller.rb now gets an extra list of data. This is leveraging the pluck operation, which only returns the values in a single column as an array. Then we use the ruby uniq method to give us all the unique values. These will appear in the select field as selectable values. class BooksController < ApplicationController def index @categories = Book.all.order(:category).pluck(:category).uniq @books = Book.all end end We will refactor our index.html.erb to include the book table as a reusable fragment, and the select tag. <h1>All Books</h1> <div data- <div class="left-col"> <h2>Filter categories:</h2> <select name="categories" multiple <%= @categories.each do |category| %> <option value="<%= category %>"><%= category.humanize %></option> <% end %> </select> </div> <div class="right-col" data- <%= render partial: 'book_list', locals: { books: @books} %> </div> </div> And our fragment, _book_list.html.erb: <table> <thead> <tr> <th>Title</th> <th>Author</th> <th>Publisher</th> <th>Category</th> </tr> </thead> <tbody> <% books.each do |book| %> <tr> <td><%= book.title %></td> <td><%= book.author %></td> <td><%= book.publisher %></td> <td><%= book.category %></td> </tr> <% end %> </tbody> </table> Add our new Books Filter Controller We’ll need to add the route for our new controller: Rails.application.routes.draw do resources :books post 'books_filter', action: :index, controller: 'books_filter' end And our new controller, books_filter_controller.rb: class BooksFilterController < ApplicationController def index @books = Book.where(category: params[:categories]).order(:category) end end And finally, the view that will be sent back to our Stimulus filter controller, books_filter/index.html.erb. It’s going to reuse the previous books_list.html.erb fragment, so that any changes we make to that one file will be propagated throughout our app. <%= render partial: 'books/book_list', locals: { books: @books} %> Using Stimulus to Wrap It All Together Let’s create our stimulus controller that will handle the selection changes, load the new filtered list of books, and change the pages html. import { Controller } from "stimulus" export default class extends Controller { static targets = [ "books" ] change(event) { fetch(this.data.get("url"), { method: 'POST', body: JSON.stringify( { categories: [...event.target.selectedOptions].map(option => option.value)}), credentials: "include", dataType: 'script', headers: { "X-CSRF-Token": getMetaValue("csrf-token"), "Content-Type": "application/json" }, }) .then(response => response.text()) .then(html => { this.booksTarget.innerHTML = html }) } } function getMetaValue(name) { const element = document.head.querySelector(`meta[name="${name}"]`) return element.getAttribute("content") } When the select element changes, our controller fetches data from a url we’ve set as a data attribute of the controller. We post the categories to our book_filter index action, which takes the tags, and returns our filtered table. The html table is replaced with the new data. Now you have a controller that retrieves data from an API and replaces html on your page. And it let’s you select multiple categories, so you can easily find your favorite scientific treatise and horror book. Want To Learn More? Try out some more of my Stimulus.js Tutorials. One Comment […] Stimulus.js Tutorial – Using multi select to pare down a large set of data […]
https://johnbeatty.co/2018/10/04/stimulus-js-tutorial-using-multi-select-to-pare-down-a-large-set-of-data/
CC-MAIN-2019-35
refinedweb
669
50.63
Joining data A join combines records from two or more tables in the database. A join – or a join statement – combines records from two or more tables in the database. This topic describes when to use joins and what you must consider when you use them. The LINQ layer supports the following four joins: Join, Self Join, Group Join, and Select Many. These four methods use subqueries that are evaluated as users page through data. Lucene.Net does not support these join methods natively, and Solr only supports certain aspects. Important You must try to avoid using these methods when you can. They are all bad for performance, both for processing time, amount of I/O, and for memory usage, and this is true for both Lucene and Solr. For example, you use a Join query with LINQ to join Contacts with the Engagement States they have been in. When users page through the data, the join or subquery is only executed for the first page. That is: given an ID, a subquery is run to look up another document via that ID. When you execute a Join query in LINQ, it effectively returns a union set of one or many documents. You must consider performance when you write LINQ queries, in the same way as when you write SQL queries with joins. You must also store and index your data properly. Sitecore does not support many-to-one or many-to-many queries in LINQ (for example, a Contact that stores multiple references to Engagement States and then joins those on the Engagement States documents). You can attach the “foreign-key” to the Engagement State, so that you can join using something like the ContactId instead: public class Contact { public string Name { get; set; } public Guid ContactId { get; set; } } public class EngagementState { public string Name { get; set; } public Guid ContactId { get; set; } public Guid Id { get; set; } } Given the classes above, and even though it results in duplication of data, this lets you join Contacts to Engagement States via the ContactId. The LINQ layer supports this, for example: var repo = this.CreateVisitors(); var repoPlans = this.GetStates(); var result = from t in repo join x in repoPlans on t.ContactId equals x.ContactId where x.Id == new Guid("E1B604F1-EE0E-408E-A344-869CC45D25D9") select t; You can test joins on large amounts of data in the LinqScratchPad.aspx, like this: using (var context = ContentSearchManager.GetIndex("sitecore_master_index").CreateSearchContext()) { using (var context2 = ContentSearchManager.GetIndex("sitecore_web_index").CreateSearchContext()) { return context.GetQueryable<SearchResultItem>().Join(context2.GetQueryable<SearchResultItem>() .Where(i => i.Name.StartsWith("S")), i => i.ItemId, o => o.ItemId, (o, i) => o).Take(10).ToList(); } } This opens two separate search contexts and then runs a join on them, based on the ItemId. In this example, this query checks which items where the name field starts with an S are in both the web and the master index, and then returns the results of the web index (outer). When you use the Solr provider, Self Join is the only join that runs a real Solr join. The other methods (such as Join and Group Join) use the enumeration technique that the Lucene.net provider uses: at enumeration time, subqueries are executed to get the other documents. You need to use a join in the LINQ layer when you have a document that contains a reference to another document. The reference is typically an ID reference. Sitecore does not flatten the objects it crawls. The crawler implementation has to tell Sitecore how to store data. The Join, Self Join, or Group Join methods run a subquery for the join to get another document and evaluate it based on the ID/Key. You must make sure that you store your data properly. You can prepare your data so that it is ready for joining, or you can prepare it for a completely join-free retrieval. Both approaches have advantages as well as disadvantages. Follow these rules to ensure that you solution scales well: Limit the amount of joins. Consider flattening data instead of using a join. This results in multivalued fields and potentially many columns. If you use a join, keep your paging of the data small – 10 or 20 items at a time. The reason is that if you have a query that takes 100 milliseconds to run, it could take 1.1 seconds to return the subqueries and the initial query. Only store or index what is 100% necessary (unless this has performance implications). For example, if you have the following two tables of data: When you use the Join method on the two lists on the Id field, the result is: If you use the Group Join method on the two lists on the Id field, the result is: If you use the Self Join method on the two lists on the Id field, the result is: If you use the Self Join method, you do not need to provide a resultSelector parameter. It is inferred that it returns the outer result. This is essentially the difference between an inner and outer join. Note When you run join queries, your inner or outer joins should have a filter that limits the results. Otherwise, the join queries will try to join on every single document in your index.
https://doc.sitecore.com/developers/90/sitecore-experience-management/en/joining-data.html
CC-MAIN-2019-04
refinedweb
882
72.36
Still cannot ssh or ping instances Hi all, i've configure my openstack install using the RDO quickstart (using Juno). Everything went very well, all service running, can utilize the Horizon GUI w/o issue. I've allowed openstack to create the default 'public' network of 172.24.4.x and spun up an instance using the CirrOS test image. I can login via console. I cannot ping or SSH-i've googled this for days w/o resolution though i see many others with similar issues. My ssh keys are good, my network config appears to be correct (ive actually blown out this machine and rebuilt from scratch after hosing up my network configs) but i'm still unable to talk to the vm's. What i dont understand is how the vm's talk to the host and on what network it should be on. My host is a physical box with a static IP in a lab (i dont have dhcp here, nor do i have other ip's available besides the single i've been assigned). How do i direct traffic through the bridge (br-ex) to my vm's and back? I can provide any info that will assist. This is on a CentOS7 fresh install. I'm wondering if one of my issues is the fact i dont have other IP's available in my host ip range...is that an issue? If so, how do i need to configure instance access to my host network? UPDATE: i've changed my iptables rules and i can now ssh using ip netns. any instance besides the cirros is prompting for a passphrase on the key (no passphrase). from the cirros image i still cannot ping out. we're getting there. **Let me update here-i have ssh working using ip netns (since i dont have any floating ips). But it only works by using my private key??? Thats completely backwards. anyone else seeing this? Can'you please share the rule yo added because i have the same problem, i can ping the gateway of my instance but note the instance (in the qrouter namespace ) @bbronstein did you get solution of this problem? I am facing same issue.
https://ask.openstack.org/en/question/61581/still-cannot-ssh-or-ping-instances/
CC-MAIN-2020-24
refinedweb
372
82.65
Solver for the inverse geodesic problem in Swift. The inverse geodesic problem must be solved to compute the distance between two points on an oblate spheroid, or ellipsoid in general. The generalization to ellipsoids, which are not oblate spheroids is not further considered here, hence the term ellipsoid will be used synonymous with oblate spheroid. The distance between two points is also known as the Vincenty distance. Here is an example to compute the distance between two points (the poles in this case) on the WGS 84 ellipsoid. import vincenty let d = try distance((lat: Double.pi / 2,lon: 0), (lat: -Double.pi / 2, lon: 0)) and that’s it. Implementation Details This is a simple implementation of Vincenty’s formulae. It is not the most accurate or most stable algorithm, however, easy to implement. There are more sophisticated implementations, see, e.g. geodesic. Convergence and Tolerance Convergence and the accuracy of the result can be controlled via two parameters. try distance((lat: 0,lon: 0), (lat: 0, lon: 0), tol: 1e-10, maxIter: 200) WGS 84 and other Ellipsoids By default the WGS 84 ellipsoid is employed, but different parameters can be specified, e.g. for the GRS 80 ellipsoid. try distance((lat: Double.pi / 2, lon: 0), (lat: -Double.pi / 2, lon: 0), ellipsoid (a: 6378137.0, f: 1/298.257222100882711)) Latest podspec { "name": "vincenty", "version": "1.0.2", "summary": "Compute vincenty distance in Swift", "description": "see.", "homepage": "", "license": { "type": "MIT" }, "authors": "Daniel Strobusch", "swift_version": "4.0", "platforms": { "ios": "11.0", "osx": "10.13" }, "source": { "git": "", "tag": "1.0.2" }, "source_files": [ "Sources", "Sources/**/*.swift" ], "exclude_files": ".travis.yml" } Wed, 11 Apr 2018 11:00:08 +0000
https://tryexcept.com/articles/cocoapod/vincenty
CC-MAIN-2019-51
refinedweb
277
61.73
Many. I've seen programs crash because they thought that functions like CharUpperBuff and MultiByteToWideChar stopped when they encountered a null. For example, somebody might write //.) The problem is that the length of one or both of the strings may not actually be ‘n’. If the strings are equal but shorter than n, the result will depend on the junk past the end of the strings. Interestingly, the documentation for CompareString does not say explicitly what will happen for nulls in the strings if you pass a non-negative length value. I assume it will treat the string as a buffer that can contain nulls. Then, the code should be: return CompareStringA(LOCALE_INVARIANT, NORM_IGNORECASE, s1, min(n, strlen(s1)), s2, min(n, strlen(s2))) – CSTR_EQUAL; with int min(int a, int b) { return (a < b) ? a : b; } Don’t go blindly looking for the NUL character, that will cause crashes too. (i.e. the strlen) Often, when you use methods that have a length parameter, you are dealing with strings that don’t have NUL termination (instead of using the length for substring extraction). For example, if you have ever used EXPAT, many of the strings coming from the notification routines are pointing directly to the parse buffer and don’t contain the terminating NUL, thus the supplied length parameter. I dealt with many a crashing program that assumed the strings were NUL terminated. Just curious, what does an uppercase NUL look like? :-) In ASCII, an uppercase NUL is represented as (NUL & ~0x20). @Ray No that is the upper case. Lower case looks like this: nul Upper case looks like this: NUL Don’t blame yourself for being confused. Failure to distinguish NUL from nul is the third most common programming fault after the fencepost error. -Wang-Lo;) Is it cheating if I answer? I did resist for just about the whole morning. :-) One could always shove an Æ or an æ in one of the strings and watch the fireworks…. [quote] // buggy code – see discussion void someFunction(char *pszFile) { CharUpperBuff(pszFile, MAX_PATH); … do something with pszFile … } [/quote] You’re kidding. No one who writes C code would ever write that. "You’re kidding. No one who writes C code would ever write that." Unfortunately, the world is oversupplied with programmers who regularly write code that no intelligent person in their right mind would write, and C has more than its share. Well, with the content of the rest of the article seems to be a hint. And a (very brief) look at an MSDN article on CompareString* turned up the following interesting phrase. "Normally, for case-insensitive comparison, this function maps the lowercase "i" to the uppercase "I", " So my first guess would be that CompareStringA, when handed the NORM_IGNORECASE flag calls CharUpperBuff or similar function.** So the broken example function, if 1) asked to compare strings of non-equal length, or 2) given a length in excess of the actual string size, would probably happily perform the data corruption described in this article. *I keep looking to find the one on CompareStringA; so this might all be wrong **And there is probably someplace I should know about that explicitly states exactly how this flag is handled. "You’re kidding. No one who writes C code would ever write that." If it can compile then it’s been done. NUL is an old shorthand for the ASCII character ‘
https://blogs.msdn.microsoft.com/oldnewthing/20070919-00/?p=25063
CC-MAIN-2016-30
refinedweb
569
70.53
NAME sync - commit buffer cache to disk SYNOPSIS #include <unistd.h> void sync(void); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): sync(): _BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED DESCRIPTION sync() first commits inodes to buffers, and then buffers to disk. ERRORS This function is always successful. CONFORMING TO SVr4, 4.3BSD, POSIX.1-2001. NOTES Since glibc 2.2.2 the Linux prototype is as listed above, following the various standards. In libc4, libc5, and glibc up to 2.2.1 it was "int sync(void)", and sync() always returned 0. BUGS According to the standard specification (e.g., POSIX.1-2001), sync() schedules the writes, but may return before the actual writing is done. However, since version 1.3.20 Linux does actually wait. (This still does not guarantee data integrity: modern disks have large caches.) SEE ALSO bdflush(2), fdatasync(2), fsync(2), sync(8), update(8) COLOPHON This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at.
http://manpages.ubuntu.com/manpages/oneiric/en/man2/sync.2.html
CC-MAIN-2015-22
refinedweb
179
61.53
hi guys, I'm fairly new to C++ and have struck my first problem. I am developing a simple program where I input a string and a float value, and they are written to a text file. It was working fine until I've put in my if and else statements to check the inputted string and float are of a correct value. here's my script: here's my error when compiling:here's my error when compiling:Code:#include <fstream> #include <string> #include <iostream> using namespace std ; // conflicting forces version int main() { string game = "Conflicting Forces"; float version; string stage; // enter stage cout << "Enter Conflicting Forces Version Stage" << endl; cin >> stage; if(stage == "Beta" || stage == "Alpha" || stage == "Live") { // enter version number cout << "Enter Conflicting Forces Version Number" << endl; cin >> version; if(version > 1.0 && version < 3.0) { cout << "Conflicting Forces is now version: " + stage + " " + version << endl; } else { cout << "Error: Not a valid version" << endl; } } else { cout << "Error: Not a valid stage" << endl; } ofstream writer("cf-version.txt"); if(!writer) { cout << "Error opening file for output" << endl; return -1; } else { writer << (game + " Version " + stage + version) << endl; writer.close(); } // stop window from closing after the print system("pause"); return 0 ; } Everytime I compile a file I always get this warning:Everytime I compile a file I always get this warning:cf-version.cpp: In function `int main()': cf-version.cpp:26: error: no match for 'operator+' in ' :basic_string<_CharT, _Traits, _Alloc>&, const _CharT*) aits = std::char_traits<char>, _Alloc = std::allocator< ) + version' cf-version.cpp:47: error: no match for 'operator+' in ' :basic_string<_CharT, _Traits, _Alloc>&, const std::bas , _Alloc>&) [with _CharT = char, _Traits = std::char_tr :allocator<char>](((const std::basic_string<char, std:: llocator<char> >&)((const std::basic_string<char, std:: llocator<char> >*)(&stage)))) + version' cf-version.cpp:54:2: warning: no newline at end of file however it doesn't appear to affect my program, is there a simple solution to get rid of this warning?however it doesn't appear to affect my program, is there a simple solution to get rid of this warning?cf-version.cpp:54:2: warning: no newline at end of file and what do I need to change to get rid of the rest of the errors? sorry for the not so well formatted error. I am compiling in command prompt using MinGW on Windows thanks for any help in advance Regards ACE
http://cboard.cprogramming.com/cplusplus-programming/103358-new-cplusplus-error-no-match-%60operator%60.html
CC-MAIN-2015-35
refinedweb
399
58.11
Follow @MS_SystemCenter See all of the top support solutions for our most common issues here. INTRODUCTION This article describes how to move the Site Database in Microsoft System Center Configuration Manager 2007 from a computer that is running Microsoft SQL Server 2005 to another drive on the same computer, or to another computer that is running SQL Server 2005. MORE INFORMATION In certain situations, you may have to move the Site Database from a computer that is running SQL Server 2005 to another drive, or to another computer that is running SQL Server 2005. For example, the following situations may require that you move the Site Database: SQL Server 2005 supports the following: For more information about these functionalities in SQL Server 2005, visit the following Microsoft Web site: PREREQUISITES Before you move the Site Database from a computer that is running SQL Server 2005 to another drive or another computer that is running SQL Server 2005, follow these steps: Note: You can stop all of these services using the Preinst.exe utility by running the following command without the quotes: "Preinst.exe /STOPSITE" Preinst.exe is included with Microsoft System Center Configuration Manager 2007 Server and is located in the following path: Drive:\Program Files\Microsoft Configuration Manager\bin\i386\00000409 (the last folder is dependent upon the language of the product, 00000409 is for the English version). Note: If you are running the SMS Provider and the Site Database on the same SQL 2005 Server, and you are moving the Site Database to a new server, you will also need to modify the SMS Provider Configuration in order to move it as well, For more information about moving the SMS Provider in Microsoft System Center Configuration Manager 2007, visit the following Microsoft Web site:. MOVING THE DATABASE To move the Site Database from a computer that is running SQL Server 2005 to another drive or another computer that is running SQL Server 2005, follow these steps: Step 1: Detach the database 1. On the computer that currently hosts the Site Database, click Start, point to Programs, point to Microsoft SQL Server 2005, and then click SQL Server Management Studio. 2. Click the appropriate values in the Server type list, in the Server name list, and in the Authentication list. Then, click Connect. 3. Expand the Databases folder, right-click the SMS_<DatabaseName> folder, point to Tasks, and then click Detach. Note that the Detach command is visible only if the following conditions are true: • You are a member of the sysadmin fixed server role. • The server to which you are connected is running SQL Server 2005. 4. Verify the status of the Site Database. Note that to successfully detach the Site Database, the status in the Databases to detach box in the Status column must read: "The database is ready to be detached." Optionally, you can update statistics before the detach operation. To do this, select the check box under the Update Statistics column in the Databases to detach box. 5. To close any existing connections in the Site Database, select the check box under the Drop Connections column in the Databases to detach box. 6. Click OK. The database node of the detached Site Database disappears from the Databases folder. 7. After the Site Database is detached, copy the SMS_<DatabaseName>.mdf file and the SMS_<DatabaseName>.ldf file to the drive and path you want to move it to, or to a folder on the computer to which you want to move the Site Database. Note: The following path is the default path of the SMS_<DatabaseName>.mdf file: Drive :\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data The following path is the default path of the SMS_<DatabaseName>.ldf file: Step 2: Attach the database 1. Click Start, point to Programs, point to Microsoft SQL Server 2005, and then click SQL Server Management Studio. 3. Right-click the Databases folder, and then click Attach. Note The Attach command is visible only if the following conditions are true: 4. In the Attach Databases dialog box, click Add to specify the database that you want to attach. 5. Locate and then click the SMS_<DatabaseName>.mdf file. Then, click OK. Note The following path is the default path of the SMS_<DatabaseName>.mdf file: Drive :\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data 6. On the View menu, click Refresh to view the database node of the attached Site Database. Note: If you moved the Site Database files to another drive on the same computer, then your move is complete, and you can start the following services: Step 3: Update the database server name If you moved the Site Database to another server, you need to run the Microsoft System Center Configuration Manager Setup Wizard on the Microsoft System Center Configuration Manager 2007 Server to modify the SQL Server configuration to specify the new SQL Server name. 1. Ensure the primary site server computer account has administrative privileges over the new site database server computer. 2. Close any open Configuration Manager console connections to the site server. 3. On the primary site server computer, use the hierarchy maintenance tool (Preinst.exe) to stop all site services with the following command: Preinst /stopsite. 4. On the primary site server computer, click Start, click All Programs, click Microsoft System Center, click Configuration Manager 2007, and click ConfigMgr Setup, or navigate to the .\bin\i386 directory of the Configuration Manager 2007 installation media and double-click Setup.exe. 5. Click Next on the Configuration Manager Setup Wizard Welcome page. 6. Click Perform site maintenance or reset this site on the Configuration Manager Setup Wizard Setup Options page. 7. Select Modify SQL Server configuration on the Configuration Manager Setup Wizard Site Maintenance page. 8. Enter the appropriate SQL Server name and instance (if applicable) for the new site database server as well as the site database name on the Configuration Manager Setup Wizard SQL Server Configuration page. 9. Configuration Manager Setup performs the SQL Server configuration process. 10. Restart the primary site server computer, and verify the site is functioning normally. Note: If you also need to move the Software Update Services Database (SUSDB) you will need to stop IIS Admin Service, and Update Services Service and follow Steps 1 and 2 above to detach, then move the SUSDB.MDF and SUSDB.LDF files, then attach the SUSDB.MDF, in the new drive location or on the new SQL Server 2005. Enjoy! Clifton Hughes | Senior Support Engineer – System Center First have a SCCM documentation (compile html file ) infront of you which comes with SDK installation. Open it. Then follow steps as follows : -System Center Configuration Manager Software Development Kit goto : Configuration Manager Console Extension goto:Configuration Manager Console Views goto:How to Create a Configuration Manager Console View In this page upto step 14 its okay.Then its says the following things. Create the Form View Class The following procedure creates the SmsFormViewBase derived class. To create a form view class * In ConfigMgrDialog.cs , add the following new class in the Microsoft.ConfigurationManagement.AdminConsole.ConfigMgrPropertySheet namespace: I was pretty surprised from where did the ConfigMgrDialog.cs came into picture. When i checked my project explorer there was no class with this name. I tried to search it in the whole documentation to see if the class has been created in some other document but it dosen't exit anywhere. I am totally stuck. Can anyone throw some light and tell me what is going on? Hi jchornbe, The steps are identical SQL 2005 to SQL 2008? I intend to move the SCCM SQL 2005 to 2008. Thanks for the help. Would this work for moving the database from sql 2005 to a SQL 2008/R2? Any chance of repeating the tutorial for moving the database between two SQL Server 2008 instances?
http://blogs.technet.com/b/configurationmgr/archive/2010/01/28/configmgr-2007-how-to-move-the-site-database.aspx
CC-MAIN-2014-52
refinedweb
1,312
53.41
05 January 2012 10:17 [Source: ICIS news] LONDON (ICIS)--An initial European January paraxylene (PX) contract has settled at €1,130/tonne ($1,468/tonne), an €80/tonne increase from the December contract price, a producer said on Thursday. "The increase follows Asian pricing and reflects the market situation here in ?xml:namespace> "Demand is stronger than the last month, but it is not clear whether this is because stocks are being refilled, or the economy is getting better." The producer said demand in The settlement was agreed on a free delivered (FD) northwest Europe (NWE) basis. ($1 = €0.77)
http://www.icis.com/Articles/2012/01/05/9520503/initial-europe-january-paraxylene-settles-up-by-80tonne.html
CC-MAIN-2014-15
refinedweb
101
56.59
Python 3 program to check if a year is a leap year or not : To check if a year is a leap year or not, we need to check if it is divisible by 4 or not. A year is a leap year if it is divisible by 4 and for century years if it also divisible by 400. Following is the algorithm we are using in the example program : Steps to check if a year is a leap year or not : - Check if it is divisible by 4. If not then it is not a leap year. - If divisible by 4, check if it is divisible by 100. If not, it is not a century year, so it is a leap year. - If divisible by 100, check if it is divisible by 400 or not. If yes it is a leap year, else not. So, a leap year should be divisible by 4, 100 and 400. Else, it is not a leap year. List of leap years from 1900 to 2020 are : 1904, 1908, 1912, 1916, 1920, 1924, 1928, 1932, 1936, 1940, 1944, 1948, 1952, 1956, 1960, 1964, 1968, 1972, 1976, 1980, 1984, 1988, 1992, 1996, 2000, 2004, 2008, 2012, 2016, 2020 . Note that if a year is exactly divisible by 4, it is a leap year. But century years or years that are completely divisible by 100 are leap year only if they are exactly divisible by 400. For example, the years 1600 and 2000 are leap years but the years 1700, 1800 and 1900 are not leap year. We will add all these conditions in our program below. You can verify the above years with the following example : Program : def printLeapYear(): print("Inpur Year is a Leap Year") def printNotLeapYear(): print("Inpur Year is not a Leap Year") input_year = int(input("Enter a Year : ")) if input_year % 4 == 0: if input_year % 100 == 0 : if input_year % 400 == 0 : printLeapYear() else : printNotLeapYear() else : printLeapYear() else : printNotLeapYear() The source code is available here. Sample Output : Enter a Year : 2000 Inpur Year is a Leap Year Enter a Year : 2001 Inpur Year is not a Leap Year Explanation : - We have two methods defined to print the message to the user. Instead of writing the same messages “Input year is a leap year” and_ “Input year is not a leap year”_ two times each in the program, we can put the print statements in two separate methods and use these methods in the program directly. - We are using the input() method to read the user input. This method returns the value in string format. We are wrapping this value with int() to convert it to an integer. This value or the user input year is stored in the inputyear_ variable. - Using a couple of_ if-else_ conditions, we are checking if the input year is a leap year or not. The first three if conditions are_ nested if conditions_ i.e. if the outer if condition is true, the inner if will run. Other else conditions are its respective else conditions. The last else condition is for the first if loop, second last else condition is for the second if loop and the third last is for the third else loop. - The first if condition is checking if the number is divisible by 4 or not. If yes, it moves inside the if condition, else it moves inside the_ last else condition_ and prints out that the year is not a leap year. - The second if checks if it is divisible by 100. If not, it is a leap year. If it is divisible by 100, the third if will check if it is also divisible by 400 or not. If yes, it is a leap year and else it is not. Similar tutorials : - Use any() function in python to check if anything inside a iterable is True - Four different methods to check if all items are similar in python list - Python tutorial to check if a user is eligible for voting or not - Python program to check if two strings are an anagram or not - Python program to check if an array is monotonic or not - Python program to check and create one directory
https://www.codevscolor.com/python-check-leap-year
CC-MAIN-2021-10
refinedweb
703
76.05
We're interested in using the f5 SDK (version: 3.0.18) to replace several cURL scripts that manage our LTM and GTM pools. One of the major draws here is that the SDK provides sufficient abstraction to work with the target API irrespective of iControl REST version (my cURL scripts need separate methods for v11 and v12 destinations): Between the 11.x and 12.x releases of BIG-IP, the REST endpoint for Pool changed from a Collection to an OrganizingCollection. The result is that breaking changes occurred in the API.... To stick with a consistent user experience, we decided to override the __new__ method to support both examples above. The SDK automatically detects which one to use based on the BIG-IP you are communicating with. () In practice, we haven't seen this autonegotiation. Using the SDK, we've still had to employ different code to list pool and members, eg, in v11 and v12: v11 code: from f5.bigip import ManagementRoot # This first block works in v11, but not v12. print ("Getting pools with v11 syntax...") mgmt = ManagementRoot('@option.GTM_Server@', '@option.F5_User@', '@option.F5_Password@') api_ver = mgmt.tmos_version pool_collection = mgmt.tm.gtm.pools.get_collection() pools = mgmt.tm.gtm.pools for pool in pool_collection: print ("Querying state of pool %s members...") % (pool.name) for member in pool.members_s.get_collection(): print ("Pool member name: %s") % (member.name) print ("Ratio: %d") % (member.ratio) Executing v11 code against a v12 API returns expected errors: Getting pools with v11 syntax... Traceback (most recent call last): <snip/> print ("Querying state of pool %s members...") % (pool.name) AttributeError: 'dict' object has no attribute 'name'` v12 code: from f5.bigip import ManagementRoot # This first block works in v12, but not v11. print ("Getting pools with v12 syntax...") mgmt = ManagementRoot('@option.GTM_Server@', '@option.F5_User@', '@option.F5_Password@') api_ver = mgmt.tmos_version pools = mgmt.tm.gtm.pools.a_s.get_collection() for pool in pools: print ("Querying state of pool %s members...") % (pool.name) for member in pool.members_s.get_collection(): print ("Pool member name: %s") % (member.name) print ("Ratio: %d") % (member.ratio) Executing v12 code against a v11 API returns expected errors: pools = mgmt.tm.gtm.pools.a_s.get_collection() File "/usr/local/lib/python2.7/site-packages/f5/bigip/mixins.py", line 102, in __getattr__ raise AttributeError(error_message) AttributeError: '<class 'f5.bigip.tm.gtm.pool.Pools'>' object has no attribute 'a_s' I'm not a Python programmer and will readily accept the likelihood that I'm just doing it wrong in code. Can we use the same code against different versions of the API using the SDK? Thanks. Hi @syncretism, this is honestly an area where I think we made it harder for the end user by sticking to the sdk design requirements of honoring the REST API endpoints. Because they changed so dramatically between v11 and v12, it's going to require using both methods to interact with the different TMOS versions. So for v11, it would be: mgmt_root.tm.gtm.pools.pool.create(name=....) and for v12 (for an a record): mgmt_root.tm.gtm.a_s.a.create(name=...) you can substitute the other methods as necessary. Hi, @Jason Rahm, Thanks very much for your prompt reply. Is it fair to say, then, that we need to code for v11 separately from v12? Effectively a "case" based on the API version (which is what I'm doing with cURL)? I just want to ensure I understand that when I'm evaluating the approaches. Thanks again! for now, yes. I'd like to propose a change to the sdk development team to make the sdk responsible for handling the v11/v12 cases on the behalf of those using the sdk. It shouldn't be this hard. You can track any progress against this issue on Github.
https://devcentral.f5.com/questions/handling-differences-in-v11-v12-in-python-sdk-for-icontrol-rest-61020
CC-MAIN-2019-13
refinedweb
624
60.11
If. Introduction to Clojure v2 A fun and gentle introduction to the Clojure language, functional programming, and data-drive programming, through the eyes of baking robot X5. 3 Functional Tools Learn these three tools -- map, filter, and reduce-- and you'll be well on your way to developing a functional mindset. If you come from a non-JVM language, you should brush up on the Java Virtual Machine. JVM Fundamentals for Clojure This course teaches you the hands-on, nitty gritty details of the JVM and Clojure/Java interop that you would pick up after many years of programming Java. It combines videos with reference sheets to give you easy access to the accumulated skills of years of experience. With this course, you won't have to worry about stack traces, JVM options, or the standard library again. In Clojure, collections are used extensively. This will go over some of the patterns Clojure programmers use with collections. Clojure Collections Clojure is based on collections, but how are they used? What are some patterns for making the most of them? This course introduces you to the workhorses of the Clojure programming language, the immutable collections. Scope refers to the rules which tell you which parts of your code can access which variables. . Clojure is designed to be developed using Repl-Driven Development. This is a workflow that interacts and modifies a live, running system. Repl-Driven Development in Clojure This course teaches the mindset, practices, and tools of Repl-Driven Development as practiced in Clojure. Recursion is the main way we build data structures iteratively. Recursion 101 What is recursion? How do you write recursive functions? Does it work with laziness? How is it different from a for loop? All of these questions are answered, and more, using simple, clear examples. You'll never have fear of recursion again. Clojure organizes code into namespaces, which are simply files with certain names. This course goes over how to declare a namespace and how to navigate namespaces at the REPL. Namespaces Namespace declarations can be complicated. They manage all of the dependencies of one namespace on another. There are a lot of options. In this course, we go over how to make best use of them. Leiningen is the powerful project tool that is used by most Clojure programs. It keeps track of dependencies, has a powerful plugin system, and will run your projects. Leiningen Leiningen is the de facto standard project tool in Clojure. This course gives an overview of lein commands, projects, templates, and dependencies. Web development in Clojure is based around the Ring system. This course explains all of the concepts you’ll need. Web Development in Clojure Web development in Clojure is just like everything else: you build up complex behavior from simple parts. This course builds a TODO list app from scratch, explaining the important concepts, and deploying it to a cloud service. Learn the built-in testing library called clojure.test so you can do unit testing in Clojure. Intro to clojure.test. Clojure is known for its powerful concurrency primitives. This course is a compendium of them. Dip in and out as you need something. . Learn some of the basic syntax of Clojure. This course includes function syntax and for-comprehension syntax. Clojure Syntax Learn the tricky corners of Clojure syntax, like for comprehensions and function definitions. Clojure’s sequences are lazy, meaning they don’t execute the elements until they are needed. This has important consequences, and you should learn those in this course. . A few projects done in an hour or less. Clojure in One Hour. Learn to read and write different data formats. Data Formats With so many data formats out there, it's good to see some example code for reading and writing different formats. I'm talking JSON, CSV, EDN, and more. This course explores how to read and write data formats using Clojure. This course shows how we can use Data to model interesting properties of our systems. .
https://purelyfunctional.tv/learning-paths/object-oriented-programmer/
CC-MAIN-2020-34
refinedweb
668
67.76
This project is no longer maintained. Gocialite is a Socialite inspired package to manage social oAuth authentication without problems. The idea was born when I discovered that Goth is not so flexible: I was using Revel and it was impossible to connect them properly. To install it, just run go get gopkg.in/danilopolani/gocialite.v1 and include it in your app: import "gopkg.in/danilopolani/gocialite.v1". Please see Contributing page to learn how to create new driver and test it. Note: Gocialite set some default scopes for the user profile, for example for Facebook it specify profile, email. When you use the following method, you don't have to rewrite them. Use the Scopes([]string) method of your Gocial instance. Example: gocial.Scopes([]string{"public_repo"}) Use the Driver(string) method of your Gocial instance. Example: gocial.Driver("facebook") The driver name will be the provider name in lowercase. Note: All Gocialite methods are chainable. Declare a "global" variable outside your main func: import ( ... ) var gocial = gocialite.NewDispatcher() func main() { Then create a route to use as redirect bridge, for example /auth/github. With this route, the user will be redirected to the provider oAuth login. In this case we use Gin Tonic as router. You have to specify the provider with the Driver() method. Then, with Scopes(), you can set a list of scopes as slice of strings. It's optional. Finally, with Redirect() you can obtain the redirect URL. In this method you have to pass three parameters: func main() { router := gin.Default() router.GET("/auth/github", redirectHandler) router.Run("127.0.0.1:9090") } // Redirect to correct oAuth URL func redirectHandler(c *gin.Context) { authURL, err := gocial.New(). Driver("github"). // Set provider Scopes([]string{"public_repo"}). // Set optional scope(s) Redirect( // "xxxxxxxxxxxxxx", // Client ID "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // Client Secret "", // Redirect URL ) // Check for errors (usually driver not valid) if err != nil { c.Writer.Write([]byte("Error: " + err.Error())) return } // Redirect with authURL c.Redirect(http.StatusFound, authURL) // Redirect with 302 HTTP code } Now create a callback handler route, where we'll receive the content from the provider. In order to validate the oAuth and retrieve the data, you have to invoke the Handle() method with two query parameters: state and code. In your URL, they will look like this:. The Handle() method returns the user info, the token and error if there's one or nil. If there are no errors, in the user variable you will find the logged in user information and in the token one, the token info (it's a oauth2.Token struct). The data of the user - which is a gocialite.User struct - are the following: Note that they can be empty. func main() { router := gin.Default() router.GET("/auth/github", redirectHandler) router.GET("/auth/github/callback", callbackHandler) router.Run("127.0.0.1:9090") } // Redirect to correct oAuth URL // Handle callback of provider func callbackHandler(c *gin.Context) { // Retrieve query params for code and state code := c.Query("code") state := c.Query("state") // Handle callback and check for errors user, token, err := gocial.Handle(state, code) if err != nil { c.Writer.Write([]byte("Error: " + err.Error())) return } // Print in terminal user information fmt.Printf("%#v", token) fmt.Printf("%#v", user) // If no errors, show provider name c.Writer.Write([]byte("Hi, " + user.FullName)) } Please take a look to multi provider example for a full working code with Gin Tonic and variable provider handler.
https://awesomeopensource.com/project/danilopolani/gocialite
CC-MAIN-2021-21
refinedweb
570
60.82
August 2007 - Introduction - Installing Python - Installing Dependencies - Installing the Google Data Library - Running Tests and Samples - Writing a "Hello World" Example - Conclusion - Appendix: Modifying the PYTHONPATH Introduction So you've decided to use the Google Data Python client library to write an application using one of the many Google Data services. Excellent choice! My aim with this short tutorial is to quickly get you started in using the client library to develop your application. You probably want to jump in and start creating your application right away. First though, you may need to configure your development environment and set up the tools you'll need to run the modules included in the client library. Follow the steps below and you'll be running code in no time. Installing Python If you're going to be developing with the Python client library, you'll need a working version of Python 2.2 or higher. Many operating systems come with a version of Python included, so you may be able to skip the installation step. To see which version of Python you have, run python -V in a command line terminal. (Note: the V is uppercase.) This should result in something like: Python 2.4.3 If you see version 2.2 or higher, then you can start installing dependencies. Otherwise, look below to find installation/upgrade instructions for your operating system. Installing Python on Windows There are quite a few implementations of Python to choose from in Windows, but for purposes of this guide, I'll be using the .msi installer found on python.org. - Begin by downloading the installer from the Python download page. - Run the installer - you can accept all the default settings - To see if your install is working as expected, open a command prompt and run python -V. Installing Python on Mac OS X The list of downloads on python.org has .dmg installers for the Mac users out there. Here are the steps to install one of them: - Navigate to - From this page, download the installer for the appropriate version of Mac OS X. Note: The Python installation page for Mac OS X 10.3.8 and below is different than newer versions of Mac OS X. To find your OS X version, choose About This Mac from the Apple menu in the top-left corner of your screen. - After the download finishes, double-click the new disk image file (ex. python-2.5-macosx.dmg) to mount it. If you're running Safari, this has already been done for you. - Open the mounted image and double-click the installer package inside. - Follow the installation instructions and read the information and license agreements as they're presented to you. Again, the default settings will work fine here. - Verify the installation by opening Terminal.app (in /Applications/Utilities) and running python -V. The installation's version should appear. Installing Python on Linux To install on Linux and other *nix style operating systems, I prefer to download the source code and compile it. However, you may be able to use your favorite package manager to install Python. (For example, on Ubuntu this can be as easy as running sudo apt-get install python on the command line.) To install from source, follow these steps: - Download the source tarball from the Python download page. - Once you've downloaded the package, unpack it using the command line. You can use the following tar zxvf Python-2.<Your version>.tgz - Next, you'll need to compile and install the source code for the Python interpreter. In the decompressed directory, run ./configureto generate a makefile. - Then, run make. This will create a working Python executable file in the local directory. If you don't have root permission or you just want to use Python from your home directory, you can stop here. You'll be able to run Python from this directory, so you might want to add it to your PATH environment variable. - I prefer to have Python installed in /usr/bin/where most Python scripts look for the interpreter. If you have root access, then run make installas root. This will install Python in the default location and it will be usable by everyone on your machine. - Check to see if your install is working as expected by opening a terminal and running python -V. Installing Dependencies Currently, the only external dependency is an XML library named ElementTree. If you are using Python version 2.5 or higher, you won't need to install ElementTree since it comes with the Python package. To see if ElementTree is already present on your system, do the following: - Run the Python interpreter. I usually do this by executing pythonon the command line. - Try importing the ElementTree module. If you are using Python 2.5 or higher, enter the following in the interpreter: from xml.etree import ElementTreeFor older versions, enter: from elementtree import ElementTree - If the import fails, then you will need to continue reading this section. If it works, then you can skip to Installing the Google Data library. - Download a version which is appropriate for your operating system. For example, if you are using Windows, download elementtree-1.2.6-20050316.win32.exe. For other operating systems, I recommend downloading a compressed version. - If you are using a .tar.gzor .zipversion of the library, first unpack, then install it by running ./setup.py install. Running ./setup.py install attempts to compile the library and place it in the system directory for your Python modules. If you do not have root access, you can install the modules in your home directory or an alternate location by running ./setup.py install --home=~. This will place the code in your home directory. There is another option which avoids installing altogether. Once you decompress the download, you will find a directory named elementtree. This directory contains the modules which you will need to import. When you call import from within Python, it looks for a module with the desired name in several places. The first place it looks is in the current directory, so if you are always running your code from one directory, you could just put the elementtree directory there. Python will also look at the directories listed in your PYTHONPATH environment variable. For instructions on editing your PYTHONPATH, see the Appendix at the end of this article. I recommend using ./setup.py install for elementtree. Installing the Google Data Library Download the Google Data Python library if you haven't done so. Look for the latest version on the Python project's downloads page. After downloading the library, unpack it using unzip or tar zxvf depending on the type of download you chose. Now you are ready to install the library modules so that they can be imported into Python. There are several ways you can do this: - If you have the ability to install packages for all users to access, you can run ./setup.py installfrom the unpacked archive's main directory. - If you want to install these modules for use in your home directory, you can run ./setup.py install --home=<your home directory>. In some cases, you want to avoid installing the modules altogether. To do that, modify your PYTHONPATHenvironment variable to include a directory which contains the gdataand atomdirectories for the Google Data Python client library. For instructions on modifying your PYTHONPATH, see the Appendix at the end of this article. - One final option that I'll mention, is copying the gdataand atomdirectories from the srcdirectory into whatever directory you are in when you execute python. Python will look in the current directory when you do an import, but I don't recommend this method unless you are creating something quick and simple. Once you've installed the Google Data library, you're ready to take the library for a test drive. Running Tests and Samples The Google Data Python client library distributions include some test cases which are used in the development of the library. They can also serve as a quick check to make sure that your dependencies and library installation are working. From the top level directory where you've unpacked your copy of the library, try running: ./tests/run_data_tests.py If this script runs correctly, you should see output on the command line like this: Running all tests in module gdata_test ....... ---------------------------------------------------------------------- Ran 7 tests in 0.025s OK Running all tests in module atom_test .......................................... ---------------------------------------------------------------------- Ran 42 tests in 0.016s OK ... If you did not see any errors as the tests execute, then you have probably set up your environment correctly. Congratulations! Now you can start running something more interesting. The distribution contains a samples directory which contains code which can provide a starting point for writing your application. If you'd like to try out a simple interactive sample, try running ./samples/docs/docs_example.py. The Google Documents List API sample will prompt you for the email address and password for your Google account. If you have any documents or spreadsheets in Google Documents, you can list them by entering 1 for your selected operation. (If you don't have any documents or spreadsheets, you'll get a 404 error.) Writing a "Hello World" Example Let's start with a simple example. Here's a short program to print a list of all of the documents in your Google Documents account: import gdata.docs.service # Create a client class which will make HTTP requests with Google Docs server. client = gdata.docs.service.DocsService() # Authenticate using your Google Docs email address and password. client.ClientLogin('jo@gmail.com', Either save the above code snippet as a file and run it, or paste the code into the Python interpreter to see the Google Data Python client library at work. Conclusion Now that you've installed and tested the Google Data Python client library, you're ready to start writing the next great application using: - Google Analytics - Blogger - Contacts - Google Calendar - Google Documents List - Google Apps Provisioning - Issue Tracker - Google Sites - Google Maps - Picasa Web Albums - Google Spreadsheets - Google Webmaster Tools API - YouTube As you continue to develop your application, you may hit a snag. If so, please check out the list of resources below: - Home page for the Python client library - Python client library downloads - Wiki pages for help using the Python client library - Python client library issue tracker for bugs and upcoming features - List of Google Data APIs If you happen to think of a great new feature for the library (or by chance find a bug), please enter it in the discussion group. We're always interested in your feedback! Happy coding :-) Appendix: Modifying the PYTHONPATH When you import a package or module in Python, the interpreter looks for the file in a series of locations including all of the directories listed in the PYTHONPATH environment variable. I often modify my PYTHONPATH to point to modules where I have copied the source code for a library I am using. This prevents the need to install a module each time it is modified because Python will load the module directly from directory which contains the modified source code. I recommend the PYTHONPATH approach if you are making changes to the client library code, or if you do not have admin rights on your system. By editing the PYTHONPATH, you can put the required modules anywhere you like. I modified my PYTHONPATH on a *nix and Mac OS X system by setting it in my .bashrc shell configuration file. If you are using the bash shell, you can set the variable by adding the following line to your ~/.bashrc file. export PYTHONPATH=$PYTHONPATH:/home/<my_username>/svn/gdata-python-client/src You can then apply these changes to your current shell session by executing source ~/.bashrc. For Windows XP, pull up the Environment Variables for your profile: Control Panel > System Properties > Advanced > Environment Variables. From there, you can either create or edit the PYTHONPATH variable and add the location of your local library copy.
https://developers.google.com/gdata/articles/python_client_lib
CC-MAIN-2016-40
refinedweb
2,008
64.41
Main TopicsBrowse All Topics Event Category: None Event ID: 0 Date: 11/12/2008 Time: 12:46:23 PM User: N/A Computer: Description: Service cannot be started. System.TypeInitializationE Hi, Lets say I have a text file. Always when I try to write to it with the following code, It erases what was already in it: // create a writer and open the file TextWriter tw = new... I am new at this and need help with what I hope is a simple question. I have a C# app that needs to insert records into an Oracle db. The code I have runs without error but does not actually insert a record. Here is my code so far. string... Greetings, Thank you for assisting me with this show stopper. Apparently I'm attempting to run an app with a 32-bit dll on a 64-bit .net 2.0 system (hosted server, I can't fall back to Win2003 32-bit) and when this 32 bit dll code is executed... Hi all; How to view messages for each point separately. points comes from the database dynamically (multiple points) My code (vb.net code behind) Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles... I do not know how to create a WCF client in code with CustomBinding that has readerQuotas changed to larger value... I have attached a code snippet to show what I am trying to do. When I try to build the project, it says that the readerQuotas... I have developed a site that uses both static ASP.net Textboxes and Dynamically created textboxes to hold dollar amounts. I have also created a javascript that allows the user to type in " 1+2+3..." and onBlur will add the totals together. ... The code snippet below calculates the timespan between two periods DateTime dtStart = DateTime.Parse(StartTime.T DateTime dtEnd = DateTime.Parse(EndTime.Tex TimeSpan ts = dtEnd.Subtract(dtStart); ... I have a .NET webservice that is called from a .NET webserver. If it takes more than 90 seconds for the webservice to return data, there is a timeout exception from System.web.services Where can I increase the timeout value to prevent this... I am getting the following error message in PB 9.0 It does not occur consistently, so it's difficult for me to debug and find out why it's happening. Powerbuilder Application Execution Error (R0002) Application Terminated. Error: Null... i have a infragistics ultragrid populated. I gave the cell click action as Row select. By default first row will we active and in blue color. But after selected any row the color should change to red. I tried giving activerow.backcolor ,...... What does this error mean, and how do I fix it? Error Message: The client disconnected. Method that Caused Exception: ThrowError Stack Trace: at System.Web.UI.ViewStateExc How to convert the object into byte array and send it through sockets in C#? The code given below does not work properly. I am making an Student object having two attributes name and rollno and then assign this Student object to an object... We are running Microsoft's CA Services on a Win 2003 box. How do we generate a request for a Code Signing certificate? We see the "Code Signing" template in the certificate templates and even extended it issue for 5 years as a default. But... Hi, I use the code below to display message to the pole display (customer display), but i don't know how to clear the display screen before new message is display. and how display the message from the beginning of the screen? Please help. ... Hello All, I'm looking into an issue with mscoree.dll and .NET 1.1 vs. 2.0. I have both .NET 1.1 and 2.0 on my system and now the .NET 1.1 mscoree.dll .NET is in the system32\URTemp directory and the .NET 2.0 mscoree.dll is in the system32... Thanks in advance for any assistance. Basically, I am trying to create a simple little application that will allow me to pick several Excel files (with the same schema) and then concatenate all these files into one large master Excel file (or... Hello, I have two DataGridViews both are filled based on BindingSources which are using stored procedure with different parameter values. Now I need to move rows from one DataGridView to other one. I know how to remove row from dataGridView... I have a form with 6 panels and 6 buttons. How can I display one panel and hide the others when I press a button, and then vice versa. Here is a sample of my code, but it does not work: Public Class FormShow Private fobjCurrentPanel As... How can I insert an if statement inside of a Sybase select statement. I am trying to do this from within Visual Studio. For example something like my code below. I need to populate the Infragistics UltraGrid. I am using the datasset. The stored procedure returns 2 columns month, year.For month it returns the 1,2..........or 12.I can't change the storedprocedure I am thinking of adding a column to the... Hello, My situation. I am using HTML-PDF dll to create dynamic pdfs. The HTML called by the pdf converter is protected with authorisation so only logged in users can view PDF's (eg invoices, quotes etc). My issue is when I need to send a... I have a .Net system service that requires calls to start and stop 2 other services. I want to run this service in a limited context, but still be able to control the other 2 services. I am using the ServiceProcess.ServiceCont I have a requirement in SSIS to connect to a remote ftp site, download all files to a local drive and then remove only the remote files that I've transferred. The file names will be different each time. I've got the attached code in a script... I have a DataColumn expression that yields a result with 10 decimal places, I need to round this to 2 decimal places. I've tried wrapping my expression with the Convert(expression, type) function, I've also tried DataColumn.Format("#.00") but... Hi guys.. I like to clear my DateTimePicker before the user "insert" the date I tried Me.DateTimePicker.CustomFo but i start vith the value is has from the designer I got this error when MapPoint crashed my system. Does anyone understand this? Please advise if you do. Thanks, newbieweb The machine wide Default Launch and Activation security descriptor is invalid. It contains Access Control... Greetings: I have a project that is distributed/published to the company via a file share. The certificate for the Visual Studio project recently expired and was replaced/updated in order to publish successfully. However, after the publish... Hi All, My app supposed to set an Owner and Administrator rights to remote directory. The App is running under domain Administrator account. When I login with this account I can do anything manually with the directory, but from the code: ... Does anyone know where I can find out all of the difference formatting codes for: DataGridView1.Columns(1).D I have seen examples of "c" & "d" & "C" & "C2" but have no idea what they mean. Hi, I want to develop an application in C# to access the remote computer like VNC, Remote Desktop Capture. I would like to know how to start to develop such type of application. Please give me some useful link or document or source code for... Hi, How do I check if a file is in use? F.ex. this code works perfectly if the file isn't open. If the file is open I get an error saying: "The process cannot access the file 'c:\\file.txt' because it is being used by another process."}... I need to discover the value of a property in a class by using reflection. I need to create a form with a property grid that dynamically binds to a class object of which could change as it will be based on a collection in another program. I... I am binding a collection of a class to a DataGridView using a BindingSource. The binding is working fine but I am unable filter the list. I am able to set the Filter on the BindingSource but the filter is not applied. I have done this... I am trying to do a SQL JOIN in C# but I can't seem to get the propper SQL statement. I have 2 tables: tblClient - ClientIndex, LastName, FirstName tblCase - ClientIndex, Worker I have 2 textboxes for searching - txtLastName and... Hi, I am new with Visual Studio .NET 2005 and I need some of your imput. I have created a small application using the wizard to create a data source and then clicking and draging the table in the dataset over my form (standard windows form) to... Hi, How do I check if a file exists, and if it does how do I delete the file? Thank you very much! :) I am looking for C# code to get the DPI settings of the display (usually it's 96) Thanks! Where can I find to download the visual studio 2003 trial version Thanks I have a GridView with many columns. Since this table is very wide, I'd like the two-word column headers to wrap. Visual Studio shows the headers wrapping, but browsers still show them all in a single line. Hi Vb.Net (Vs 2005) Is it possible to delete a specific column in a datatable I have a utility written using C# that - Makes HTTP requests Edits and saves the hosts file Repeats the above The problem is the changes to the hosts file are not being used by the new http requests being made by the application unless I... If I develop an application (e.g. in Visual Basic.NET) that writes to the Windows Application Event log, are there any accepted public ranges of Event ID numbers that I should use? I have a re-sizing panel in my application which I want to add a 'border' to in the form of a rounded rectangle. Drawing a standard rectangle seems easy using the following code: private void WorkflowTabView_Paint(obje i have a infragistics ultra combo box (databound) with 2 colomns A(ID) and B(NAME). I also have a ultra grid with some data .I have given the combo box as editor control to one of the colomns of the grid. So now the user can make selection from... Hi, I have a page with gridview where each row in gridview has the following columns: 1) Employee Description 2) Employee Number 3) Checkbox to multi select Once I multi select rows, I wish to perform action(say Suspend) on the selected... I have downloaded a sample asp.net app that uses a windows service. I am trying to install the windows service but get the error "cannot start service from command line or debugger" - the service has an exe file and I am just clicking that. Hello Dear Expert, I got this error in SQL Server 2005, when I tried to import data from Excel using import/export wizard. "Error 0xc00470fe: Data Flow Task: The product level is insufficient for component "Source - Sheet1$" (1)." ... C# file that has the following in its list of 'using' statements: using System.Data; using Microsoft.Office.Interop.E Building it gives me an ambiguous reference to type DataTable. Leaving off just the System.Data makes... I have written an application which programatically imports data from an Access database into a SQL Server database using DTS. The program runs correctly on my own computer but when I run it from a computer that does not have SQL Server... Hi there, In reporting services, I've got a multi-value variable called @location_id. When the report renders it gives me a drop down list with a list of checkboxes so I can set the location_id. How do I set initial the report so that all... How do you SetFocus in VB.NET? I have a VB.NET application that has a button on the main form called Merge. When Merge is clicked, there is a loop that reads image files from a directory and (hopefully) displays each image in a new form and... I have created three data tables by pulling data from an Oracle database. DT1, DT2, DT3. I have added these three tables to a data set, myDS. I have added relations between these three tables (See first part of attached code snippet). I then... The log file of one of the databases on my SQL SERVER 2000 has grown to over 123GB. I need to shrink it down and control it's growth. It's on a 250GB drive with only 15GB free. In SQL Server Enterprise Manager the database properties are... The VB.Net File Copy and Move commands are easy to use if you want to rename the files. Dim fFile1 As New FileInfo("C:\\abc1.txt") fFile1.CopyTo("C:\\abc2.tx Dim fFile1 As New FileInfo("C:\\abc1.txt") fFile1.MoveTo("C:\\abc3.tx I want to load my table into a datagridview. Here's what I have: I am receiving an HttpWebResponse with an Order Report as the Body. I am able to use streamreader with getresponsestream and read that into a string. The string displays as a... how do I delete row from datatable asp.net vb?... I have created a Windows service that interacts with an ORACLE database. For talking with the database I am using the latest version of ODP.NET. Now, I want to install the service on a client server. However, I do not want to install a... I have a file browser that will select an excel file. How do I import it into the application? Do I open and read each line, one at at time? Can someone post some code? Thanks Hi I need some help to get this code to work The function should switch between Dynamic and static IP modes hi (c# windows form) i have some rows in my datagrid i just want to move the selected rows up or down using the up down buttons(which i had in my form) can any one provide the sample code thank you Hello I have created a service which would allow the service to be installed automatically using the createservice() API. The code is as in the code snippet. I have manage to install the service automatically. The problem is, when i start... Exchange 2007. I've had a succession of problems getting OWA to work, my one is: Server Error in '/owa' Application. -------------------------- Runtime Error Description: An... Hi, I am creating a user control which should have a date picker. I have this code in asp.net page with content place holder and ajax and it works. but when i place it in user control, it doesnot work. I dont know whether content place holder is...... Please see the attachment. This will explain thing better. Basicaly, when the Back to Login Page button is selected, the application goes to a page with double login pages. I only need the login page showing once at the same time. The code... I need to turn the mute to off on Windows XP, using C# and suspect that I need to instantiate an object similar to AxWindowsMediaPlayer. Could someone please tell me what object in C#.NET I need to create for this and how to work with it?? ... I am trying to format a textbox when someone leaves to put it in a currency format. I am getting this error: cannot convert from 'string' to 'System.IFormatProvider' public string FormatMoney(string StringToFormat) { ... I am a beginner in this realm, so bear with me - I have to replace one third party control with another, and the selected replacement comes from Infragistics. The specific control I am looking to implement is the webhtmleditor.dll - it places it... I am opening up a Crstal Report through VB 2005. The report works exactly as it should except the enter parameter values dialog keeps popping up. I have no idea why this keeps happening . Here is my code Private Sub... Hi, I created a console application to load test my web service. I created 10 threads that I execute at the same time. Each web service thread queries a database with a query that takes 2-3min. When I start the 10 threads and wait for... I setup a new computer for my development. I re-installed VS2005 and the service pack. All Windows XP updates have been applied. I am now getting the following error when I try to send e-mail. A first chance exception of type... at CrystalDecisions.ReportApp at CrystalDecisions.CrystalRe at... Hi Im using VC#.NET 2.0 and AJAX Im trying to display an animated gif while Im uploading a file to my server. However the string "File1" in the (button3_click event below) is always null. This has something to do with using AJAX. If I... I'm new to this 'IEnumerable interface'. Can someone say a word or two about it as in contrast to the world before .NET ? Thanks! Which one of the following is a limitation resulting from a class that has an indexer property but does... I need to zoom and rotate images in C#. Can this be done with standard .NET library calls? If so, what do I need to use? I will be using JPG photos. I have a property DOB that is of type datetime newClient.Dob However I need to display the datetime as a date like 31/07/1955 But currently it displays 31/07/1955 00:00:00 How can I do this so it only displays 31/07/1955 ? Dear Experts: I want to setup and run an existing Visual Studio .Net 2003 project on a computer. The computer is not the one that was used to develop the project. I checked the references of the project in Solution Explorer, and found that... How do you move the focus to a cell (0,0) in a datagridview and enter edit mode, so the cursor is blinking and the user can type? Hi i am working on integration of our web application project with windows sharepoint server. all the documents which are uploaded through application needs to be copied on to the sharepoint server. i need to create folder on the... Hi, Please let me know How to unzip a zip file Using System.IO.Packaging . and reading a file inside the Zip file. Thanks I am attempting to make a SOAP call in c# and I am receiving the following error. System.InvalidCastExceptio We had some kind of update pushed out to our environment last night and our application took a pretty good hit. Got almost everything cleaned up but this last error is dug in. On our home page we have a SQL Reporting Services report but instead... I have created a shared folder as follows :- // create a directory Directory.CreateDirectory( // Create a ManagementClass object ManagementClass managementClass = new... Hello all, I have run into an interesting situation... I used to have my appConfig files local, but have recently moved the xml into a DB. The problem I am having is getting this xml string into a ConfigurationSection The code is... I am working on Infragistics ultraWinGrid in windows application.ultraWinGrid populated with the dataset. The ultraWinGrid has one column cmf.whenever the copydown button is clicked,we have to capture the last changed cell and cell value in that... How can I create a master page in webmatrix (framework 2.0) thanks in advance I need sample sourcecode to send files via POST method to a web form. The webform is .php, but I think that it is indistinct, right? I want to execute some code after form loads It's mean : Action 1 private void myForm_Load(object sender, EventArgs e) Action 2 myCode() How can I do it in C# ? Thanks I need to isolate access to my data access layer (DAL) from my user interface layer through a business logic layer (BLL). I love the way ADO.NET DataTables and DataRows work and need to leverage all the built-in binding that they do, so I want to... How can I get the attached "DATE_ENTERED" column to automatically display today's date (i.e. 01/30/2012) when adding a new record ? I need to read an image file from a blob column in MySql database into a byte array that can be used as an image source in a WinForm. I do not know the size of the blob. The code: { ... int id = 1; UInt32 FileSize; byte[]... I want to change one column in an Infragistics ultragrid to allow multiline entry (visual basic). When a user reaches the end of a certain ultragrid column, instead of the beginning of the text disappearing to the left, the data can wordwrap to... I am using the following autocomplete control: <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" TargetControlID="txtProjMa ServicePath="../Services/A ServiceMethod="SelectProje My C++ source code occupies the left half only of the code window in Visual Studio 2008. The font size is painfully small. I do NOT want to be forced to change screen resolution. Is there a way of changing the font size within the code window... I want to use emacs editor to write system verlog code, does anybody have the necessary code for .emacs file so that I see system verilog reserve words highlighted. At present there is no color to this file. JamesBurger 3,000 0 points yesterdayProfile TheLearnedOne 2,800 0 points yesterdayProfile kevp75 2,800 0 points yesterdayProfile SStory 2,800 0 points yesterdayProfile masterpass 2,800 0 points yesterdayProfile mroonal 2,800 0 points yesterdayProfile dtodd 2,000 0 points yesterdayProfile jonnidip 2,000 0 points yesterdayProfile bcdudley 1,000 0 points yesterdayProfile
http://www.experts-exchange.com/Programming/Editors_IDEs/.NET/Top_Solutions.html
crawl-003
refinedweb
3,692
66.74
RSS Aggregator Macro Table of contents Description A macro that aggregates RSS feeds in a single table. Usage {{/rssaggregator}} See also Jerome's Blog post on this macro. Result > - Support for HTTP Basic Authentication with URLs in the form:[email protected]/feed - Message when there is an error retrieving a feed - Preventing index out of bounds error when no items are read - Translation of example table titles to English v1.1 I replaced the line entries.keySet() as List).reverse()[0..20].each() with def mysize = entries.keySet().size() (entries.keySet() as List).reverse()[0..mysize-1].each() in order to prevent the "IndexOutOfBoundsException" in case there are less than 20 results to display.
https://extensions.xwiki.org/xwiki/bin/view/Extension/RSS%20Aggregator%20Macro
CC-MAIN-2021-43
refinedweb
114
50.73
Windows Defender Antivirus version 4.18.1908.7-0 suffers from a file extension spoofing vulnerability. bf4d6995971178b6b1ea80749698ee1f SEC Consult Vulnerability Lab Security Advisory < 20191211-0 > ======================================================================= title: File Extension Spoofing product: Windows Defender Antivirus vulnerable version: 4.18.1908.7-0 fixed version: Virus Definition Update of 2019/09/30 CVE number: - impact: High found: 2019-09-25 by: David Haintz (Office Vienna) SEC Consult Vulnerability Lab An integrated part of SEC Consult Europe | Asia | North America ======================================================================= Vendor description: ------------------- "Keep your PC safe with trusted antivirus protection built-in to Windows 10. Windows Defender Antivirus delivers comprehensive, ongoing and real-time protection against software threats like viruses, malware and spyware across Source: Business recommendation: ------------------------ Update to the latest version of the Windows Defender Antivirus definitions. Vulnerability overview/description: ----------------------------------- The vulnerability is based on the file extension spoofing method using the RTL unicode character to display a spoofed file extension. This method uses the LTR unicode character, that instructs the following text to be shown in left-to-right order. Lets assume [LTR] is the LTR unicode character, an attacker can use this unicode character to fool a user into believing that a file has a different extension. For example an attacker may name an executable file (.exe) 'spoofed-[LTR]gpj.exe', which would be displayed as 'spoofed-exe.jpg' on an LTR-based system. The most important point here is to have the extension you want to be shown in reverse order, since it will be shown right-to-left. Combined with the right file icon, an attacker can imitate an arbitrary file extension. Same goes for other extensions too, like 'xlsx' for a Microsoft Excel Sheet. During testing it happened that 'xlsx' was typed in the wrong order ('xslx' instead of 'xlsx' since reverse order) and Windows Defender Antivirus removed the test file while we tried to execute it. As a result, two files were created, with the exact same executable but with different fake extensions: 1. spoofed-[RTL]xslx.exe (displayed as 'spoofed-exe.xlsx') 2. spoofed-[RTL]xlsx.exe (displayed as 'spoofed-exe.xslx') The second one was deleted, while the first one could be executed without any problem. Therefore, other extensions related to Microsoft Office were tested as well, but it seems only the xlsx extension had a detection for it. While the security issue of spoofing the file extension by using the RTL unicode character (on RTL systems it is the same just with LTR) is widely known, it seems to be unknown that Microsoft already started to add detection mechanisms for this issue. But since it is not implemented for all extensions and it seems to be implemented in the wrong order, this feature is mostly unknown. Proof of concept: ----------------- For the proof of concept a file has to be renamed in Unicode mode using the Unicode character '202E' ('\u202E' in C), which stands for RTL. The sample code is written in C/C++ and uses the unicode API of Windows. A Python PoC has been made as well. C/C++: #include <Windows.h> int main(int argc, char** argv) { wchar_t opath[] = L"test.exe"; wchar_t npath_ok[] = L"spoofed-\u202Exslx.exe"; // String for filename 'spoofed-exe.xlsx' wchar_t npath_wrong[] = L"spoofed-\u202Exlsx.exe"; // String for filename 'spoofed-exe.xslx' // Copy 'test.exe' to file shown as 'spoofed-exe.xlsx' CopyFileW(opath, npath_ok, false); // Copy 'test.exe' to file shown as 'spoofed-exe.xslx' CopyFileW(opath, npath_wrong, false); } Python: from shutil import copyfile opath = "test.exe" npath_ok = "spoofed-\u202Exslx.exe" # String for filename 'spoofed-exe.xlsx' npath_wrong = "spoofed-\u202Exlsx.exe" # String for filename 'spoofed-exe.xslx' # Copy 'test.exe' to file shown as 'spoofed-exe.xlsx' copyfile(opath, npath_ok) # Copy 'test.exe' to file shown as 'spoofed-exe.xslx' copyfile(opath, npath_wrong) There will be two new files after the execution (as long as 'test.exe' exists) and the file shown as 'spoofed-exe.xslx' will be deleted while trying to execute (or earlier) as shown in figure 1. [ win-defender-ext-spoofing1.png ] Figure 1: File gets deleted by Windows Defender Antivirus. But the file shown as 'spoofed-exe.xlsx' will be executed without any problem. [ win-defender-ext-spoofing2.png ] Figure2: Test file is executed. Vulnerable / tested versions: ----------------------------- Windows Defender Antivirus has been tested in its latest version 4.18.1908.7-0, updated at 25th of September 2019. Vendor contact timeline: ------------------------ 2019-09-26: Providing vendor the advisory through secure@microsoft.com 2019-10-01: Microsoft answered that this is no vulnerability, but the virus definition database will be updated 2019-12-11: Public release of security advisory Solution: --------- The update of the virus definition database of the 30th of September provides a fix. Workaround: ----------- There is no workaround available. David Haintz / @2019
https://packetstormsecurity.com/files/155659/SA-20191211-0.txt
CC-MAIN-2020-16
refinedweb
790
50.73
Here is my current code. The question is exactly in the title. (I'm looking to be able to align my triangle correctly) def Triangle(height): if height % 2 == 0: print "Please enter a height that is odd" else: stringTriangle = "x" for x in range(height): print stringTriangle for x in range(1): stringTriangle+="xx" To make a string containing n spaces, use " "*n. To concatenate two strings a and b, use a + b. To learn about other things that can be done with strings, see Python 2: Built-in Types: str and Other Sequence Types. From there, you should be able to solve your homework problem by calculating how many spaces and how many asterisks you need in each line of the figure.
https://codedump.io/share/5V9svChhMcaV/1/is-it-possible-to-append-spaces-and-a-certain-amount-of-spaces-to-a-string
CC-MAIN-2017-51
refinedweb
124
76.86
go to bug id or search bugs for Description: ------------ Namespace support in SimpleXML is all screwy. In particular, you cannot add two differently-namespaced attributes to a SimpleXML node; the first one is lost. Reproduce code: --------------- $xml = new SimpleXMLElement('<root />'); $n = $xml->addChild("node", "value"); // still fails even if we set a NS here $n->addAttribute("a", "b"); // still fails even if we set a different NS here $n->addAttribute("c", "d", ""); print_r($xml->asXml()); Expected result: ---------------- <root xmlns:<node a="b" a:value</node></root> Actual result: -------------- <root><node xmlns="" a="b" c="d">value</node></root> Add a Patch Add a Pull Request Rob, could you take a look at it plz? It works just fine if you define your namespace beforehand. $xml = new SimpleXMLElement('<root xmlns:'); $n = $xml->addChild("node", "value"); $n->addAttribute("a", "b"); $n->addAttribute("c", "d", ""); print_r($xml->asXml()); I don't know, perhaps SimpleXML should raise a E_NOTICE on unknown namespace, but it's really a matter of good coding practice. Btw, jevon, I don't recommend saying that something is "screwy" when filing bug reports, it doesn't really motivate developpers of said software to look into them ^^; updated summary. The bug is that an unprefixed attribute is being allowed to be created with a namespace and a default namespace is being added to the parent element. This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at. Thank you for the report, and for helping us make PHP better. Note that all the examples here will now cause a warning due to trying to create invalid XML.
https://bugs.php.net/bug.php?id=43221
CC-MAIN-2017-34
refinedweb
285
58.72
09-18-2011 11:14 PM Hello all, I am planning on upgrading an application but it seems I forgot about the possibility of the structure of my class changing in the future by adding other objects to it. Is the best practice to just have place holders in a class? e.g. public class Settings implements Persistable{ int placeholder1; int placeholder2; int placeholder3; ... } How should I handle the change to the format in an upgrade, create a mirror of my old class, read it in the updated app, then save it in the new structure and save that? Solved! Go to Solution. 09-19-2011 04:01 AM 09-19-2011 07:13 PM 09-19-2011 09:45 PM - edited 09-20-2011 05:19 AM It is certainly the way I recommend. I particularly like Hashtable. 09-19-2011 09:47 PM 09-20-2011 04:18 AM Yes... One good thing that you can do... Use IntHashtable Instead of Hashtable and define all int keys whatever you want to put on that and put the value on IntHashTable. 09-20-2011 11:42 AM 09-20-2011 12:32 PM Using IntHashtable It is very simple process and it will handle all the scenario. Make a Class which will have all getter and setter of your specific. Define your public static final int keys to mape your data. Keep a object of intHashtable and initialy read it from Persistance if it is there then then assign else creat new and commit. Now in your getter and setter read the object from IntHashtable for that specified key if its not there then return the default value and in each setter put the value on the key in IntHashtable and commit it. Done
http://supportforums.blackberry.com/t5/Java-Development/Persitible-Structure-Change/m-p/1322219/highlight/true
CC-MAIN-2013-20
refinedweb
295
78.79