truncate

mysql - limit entrys and truncate new entries

Hi I was wondering if there was a simple solution in mysql to truncate mysql entries. i.e. if i want only a maximum of 100 entries in one table if a new entry is submitted, (101st entry) then it would delete lets say the last entry ( ordered by a time stamp ) and insert the new one (still only having 100 entries). Any help much apprec...

RubyRails: Mixing Sanitize and Truncate can be a dirty thing..

So stand alone I get what I need. But I want to truncate it, my dynamic text comes out with dirty text globbered with Microsoft Word garbage. An Example : ≪! [If Gte Mso 9]>≪Xml> ≪Br /> ≪O:Office Document Settings> ≪Br /> ≪O:Allow Png/> ≪Br /> ≪/O:Off... So how do I get the best of both worlds? Is there a s...

How to truncate an html text and still maintain the format, in PHP

I have text with minimal tags like 'a','b','i' etc inside it. Now i want to truncate the text to 100 chars and still want to maintian the formatting. I don;t want to strip the tags off from the text. Is it possible? how can it be done. ...

Very slow TRUNCATE accompanied with "Server seems busy" on httpd log

I have this very simple table with only 35 rows on 5 simple columns (primary key on id auto increment, title (varchar), a bool, and 2 datetime). As we work in team, we import data from Google Docs, rephrase it as a SQL to do a TRUNCATE->LOCK TABLE WRITE->INSERT INTO (multiple lines)->UNLOCK TABLE at once. On other bigger, more complicate...

How can I truncate data to fit into a field using SQL*Loader? (ORA-12899)

Using Oracle SQL*Loader, I am trying to load a column that was a variable length string (lob) in another database into a varchar2(4000) column in Oracle. We have strings much longer than 4000 characters, but everyone has agreed that these strings can and should be truncated in the migration (we've looked at the data that goes beyond 400...

Internet explorer 7 and 8 truncating website content

Hello All, I've spent a few days with this problem and I can't seem to find a solution anywhere and it's driving me nuts. I created a web page that loads all of it's content dynamically and for some reason the content gets truncated in IE 7 and 8. It works fine in firefox and opera though. The content is larger than the size of the wi...

groovy truncate and round

How to truncate string in groovy I used : def c = truncate("abscd adfa dasfds ghisgirs fsdfgf", 10) but getting error . thanks in advance . ...

Pros & Cons of TRUNCATE vs DELETE FROM

Hey everyone, Could someone give me a quick overview of the pros and cons of using the following two statements: TRUNCATE TABLE dbo.MyTable vs DELETE FROM dbo.MyTable It seems like they both do the same thing when all is said and done; but are there must be differences between the two. Thanks again! ...

Truncate file ('w') not working for a chat application

Hello, I've made a chat application for a website. Everything is working fine, however, I am trying to make a situation where when the user clicks 'logout', the chat box system will show to other users that the specific user has indeed logged out of the room, and then it will proceed to clear all old messages on the user's screen who ha...

How to debug differences in postgresql TRUNCATE times?

postgres 8.3 / Ubuntu Karmic / 32-bit (in virtualbox): duration: 76.534 ms statement: truncate audit.users cascade duration: 0.952 ms statement: delete from audit.users postgres 8.4 / Ubuntu lucid / 64-bit (native, on the machine hosting the karmic virtualbox): duration: 1469.271 ms statement: truncate audit.users cascade ...

Regex Pop Quiz Question of the Day

Suppose I want to turn this : http://en.wikipedia.org/wiki/Anarchy into this : en.wikipedia.org or even better, this : wikipedia.org Is this even possible in regex? ...

How do I truncate a file X bytes from the end?

Lets say there is a file which is 150 bytes long and I want to truncate the last 16 (or any number) of it from the end... Is there any other way to do it than re writing the complete file? UPDATE: The SetLength should do the thing, but unfortunately NotSupportedException is thrown using (FileStream fsFinalWrite = new FileStream(File...

Truncate e-mail text string at the @ portion in C#

I have a situation in ASP.NET C# wherein for example I have the email address [email protected] but I need to have the @gmail.com portion removed for all email input. Please help. Thanks :) ...

Is "VARCHAR(255) CHARACTER SET utf8" 255 bytes or 255 characters.

I've declared a field in my INNODB/MySQL table as VARCHAR(255) CHARACTER SET utf8 NOT NULL however when inserting my data is truncated at 255 bytes not characters. This might chop the trailing two bite code point i*emphasized text*n two leaving an invalid character. Any ideas what I might be doing wrong EDIT: A sample session is l...

Tables truncated with AbcPdf

Hello everyone, I'm using the AbcPdf library to transform an aspx page to a pdf object. I have achieved my goal, but I have a problem. The data in the aspx page is a set of Tables, and they are dynamic, I mean, it can be 2 tables, or 30 or whatever. I have achieved that when the number of tables is bigger than one page, the library crea...

how to inject a string in an html fragment

I would like to insert a read more html bit at a certain position in an html fragment - say after the 10th word. I will then, via javacript, hide the text after the "read more" and only show it on click. The javascript part is ok. As to the php part... It seemed simple at first - but the problem is that tags mess up the word count and...

jQuery/JavaScript: Why does this freeze?

I'm trying to implement a requirement that requires I set a maximum line length for the contents of a div element. But when I open the page in Firefox, I get an error about a "long-running script" and am asked to Continue, Debug, or Stop Script. I don't understand why this is happening. This is my code: <html> <head> <sc...

Is it better to delete or declare new temp tables for SQL Stored Procedures?

I have a stored procedure with a few steps. Two of the steps require the use of a DECLARE TABLE but I do not require these tables at the same time. The tables both have 2 BIGINT columns and may have up to 100 rows. Is it better practice to declare the two tables or to DELETE and re-use one? EDIT: If you're interested, this is a follow...

Appending output to a file at the same time truncating it to N lines

Hello all, I'm trying to find a simple way to append/write to a log, while at the same time keeping it the log trimmed to a reasonable size. I would prefer to not just append files forever, and then have to have a clean up log script. I can't wrap my head around how I would accomplish this gracefully without using some second file as a ...

How to truncate a join table in rails?

To truncate an ActiveRecord table, I can do Category.destroy_all or Post.destroy_all How does one go about truncating a categories_post table? ...