truncate

Slow Update after Truncate

I've got a relatively simple update statement: update sv_konginfo ki set AnzDarl = 1 where kong_nr in ( select kong_nr from sv_darlehen group by kong_nr having count (*) = 1); which runs okay on its own (about 1 second for about 150.000 records). However, if I truncate the table and then re-insert the records: trun...

Mysql 5.1.42 alter table auto_increment = 0 doesn't work, truncate does

For my automated acceptance tests, I want inserts to start with id=1. I achieved this on one PC (XP 32bit, mysql 5.1.something) with (after deleting all rows from the table), "alter table tableName auto_increment = 0". I'm now setting up a new PC (Windows 7 64bit, mysql 5.1.42), and this command seems to have no effect. I can see in the...

Truncate text in RadGrid column

Hi, using Telerik RadGrid* in a LINQ context, with ASP.NET/C#, how to truncate text to a maximum length when displaying in columns? By maximum, I mean if original string's length is shorter than the specified maximum length, no errors will raise. I have seen many examples of this on the net, but it seems that the Container.DataItem use...

How do I indicate long text into a smaller fixed column with CSS?

Hi there, how do I fit long text into fixed with column where I have place for only line of text? I would need to shorten the text to fixed width (lets say to 100px) and I would like to add dots "..." at where string gets cut. Something like this for example: My string is "Some really long string that I need to fit in there" and output...

How to empty a SQL database?

Hello, I'm searching for a simple way to delete all data from a database and keep the structure (table, relationship, etc...). I using postgreSQL but I think, if there a command to do that, it's not specific to postgres. Thanks, Damien ...

What is the equivalent effect to Truncating a table, when the table is referenced by a foreign-key

Straight out of the MSDN docs for Sql Server 2005: You cannot use TRUNCATE TABLE on tables that: Are referenced by a FOREIGN KEY constraint. Participate in an indexed view. Are published by using transactional replication or merge replication. I want the effect of a TRUNCATE (specifically the fact that it resets IDENTITY ...

Server is truncating output

I'm running Cherokee on a Linux server, and I have a simple script like this: $(function() { $('#avatars, #Avatar').hide(); $('shoo').change(function() { $('#avatars, #Avatar').hide(); }); }); But I keep getting Javascript parse errors. The reason is because if I access the script from my browser, it is truncated. The output is s...

jQuery text truncation (read more style)

Hi There, My question is very similar to "http://stackoverflow.com/questions/2104653/trim-text-to-340-chars" but in jQuery. It sounded very straight forward but when I searched around I couldn't find any reference for it. Ok, I have a div $('#content') I want to trim the text to 'x' amount of characters lets say '600' BUT I don't want ...

Partially truncating a stream (fstream or ofstream) in C++

Hi, I am trying to partially truncate (or shorten) an existing file, using fstream. I have tried writing an EOF character, but this seems to do nothing. Any help would be appreciated... ...

Truncate the beginning of a log file in .NET

I have an VB.NET app that writes the status to a log file in text format. Over time, the file is getting large and I wanted to know if there is an efficient way to truncate the beginning of the file. To make things easier, I am looking to specify a file size (say 2-3 mb) and I am writing the log using a StreamWriter: Using strm As N...

URL getting truncated at 255 characters

I have a JavaScript widget which communicates with my Rails app by creating tags in the DOM. Every once in a while, I see a malformed request in my server logs, where the URL is truncated at 255 characters: http://myapplication.example/mycontroller/1/myaction?hostname=www.mycustomer.example&request[param_a]=3&request[param_b]=1...

Truncating a table referenced by a foreign key

Hey, We have two tables in a SQL Server 2005 database, A and B.There is a service which truncates table A every day. Recently, a foreign key constraint was added to table B, referencing table A. As a result, it isn't possible truncating table A anymore, even if table B is empty. Is there any workaround to get the same result as truncat...

Jquery recursive selector

Hi There, I have whole bunch of <div class="productlistname"><a href="#">The Text!</a></div>. What I want to do go through all .productlistname and truncate the text and replace the current text with the truncated version. Here is what I have so far: $(".productlistname a").html($(".productlistname a").html().substring(0,10)); This ...

Postgres: Reduce varchar size and truncate

I currently have a Postgres 8.4 database that contains a varchar(10000) column. I'd like to change this into a varchar(255) and truncate any data that happens to be too long. How can I do this? ...

java converting int to short

Hi I am calculating 16 bit checksum on my data which i need to send to server where it has to recalculate and match with the provided checksum. Checksum value that i am getting is in int but i have only 2 bytes for sending the value.So i am casting int to short while calling shortToBytes method. This works fine till checksum value is le...

html truncator in java

Is there any utility (or sample source code) that truncates HTML (for preview) in Java? I want to do the truncation on the server and not on the client. I'm using HTMLUnit to parse HTML. UPDATE: I want to be able to preview the HTML, so the truncator would maintain the HTML structure while stripping out the elements after the desired o...

MATLAB - Delete elements of binary files without loading entire file

This may be a stupid question, but Google and MATLAB documentation have failed me. I have a rather large binary file (>10 GB) that I need to open and delete the last forty million bytes or so. Is there a way to do this without reading the entire file to memory in chunks and printing it out to a new file? It took 6 hours to generate the f...

In MIPS Assembly, how do I truncate to two decimal places if I have a floating point value X.YZDEF in a floating point register?

If I have a value in an "f" register in MIPS, how do I truncate this down to X.YZ from X.YZDEF? Supposedly, you must convert from the float to two ints and display those... How is this done? ...

New NSData with range of old NSData maintaining bytes.

I have a fairly large NSData (or NSMutableData if necessary) object which I want to take a small chunk out of and leave the rest. Since I'm working with large amounts of NSData bytes, I don't want to make a big copy, but instead just truncate the existing bytes. Basically: NSData *source: < a few bytes I want to discard > + < big chunk...

How do I... truncate string in an array

In a ruby on rails app, I build an array of Project Names and project id values, but want to truncate the length of the names. Current code is: names = active_projects.collect {|proj| [proj.name, proj.id]} I have tried to add a truncate function to the block, but am getting undefined method for class error. Thanks in advance - I jus...