manipulation

How should I add multiple identical elements to a div with jQuery

I need to add multiple empty divs to a container element using jQuery. At the moment I am generating a string containing the empty html using a loop divstr = '<div></div><div></div>...<div></div>'; and then injecting that into my container: $('#container').html(divstr); Is there a more elegant way to insert multiple, identical ele...

Image stretching and resizing

I have a picture that I need to resize to a specific dimension and then move one of the corner to a place higher than before so the image is not rectangular anymore but some kind of polygon. Is there a library that could help me with this kind of image manipulation or does someone knows the name of this operation? This is for a .NET app...

Ruby and FasterCSV: converting uneven rows to columns

I have a CSV data file with rows that may have lots of columns 500+ and some with a lot less. I need to transpose it so that each row becomes a column in the output file. The problem is that the rows in the original file may not all have the same number of columns so when I try the transpose method of array I get an `transpose': elemen...

Change an element's onfocus handler with Javascript?

Hello, I have a form that has default values describing what should go into the field (replacing a label). When the user focuses a field this function is called: function clear_input(element) { element.value = ""; element.onfocus = null; } The onfocus is set to null so that if the user puts something in the field and decides ...

jquery .html does not work with script

Hi all, my Code is like $("#leaderBoard").html("<script2 language=\"javascript2\"> document.write('<scr'+'ipt language=\"javascript21.1\">alert(1)</scri'+'pt>'); </script2>".replace(/script2/gi, "script")); ie8 not wirking at all. FF3 is exucuting but page gets blank and seems loading not ending. someone has a clue? i want to let pa...

Best way to change pagination of existing PDF

Hi all, We have a PDF that is generated as A5 landscape pages. With that, we need to do a PDF with A4 portrait page format, by putting 2 pages of the source PDF on top of each other on each page of the result PDF. Do you know a good library that could do that kind of PDF manipulations ? This should happen server side from an ASP.NET w...

easy way to add 1 month to a time_t in C/C++

I have some code that uses the Oracle function add_months to increment a Date by X number of months. I now need to re-implement the same logic in a C / C++ function. For reasons I don't want/need to go into I can't simply issue a query to oracle to get the new date. Does anyone know of a simple and reliable way of adding X number of m...

C++ IsFloat function

Does anybody know of a convenient means of determining if a string value "qualifies" as a floating-point number. BOOL IsFloat( string MyString ) { ... etc ... return ... // TRUE if float; FALSE otherwise } Thanks in anticipation. ...

Shell script for adjusting image size

Is there a way to adjust all image sizes in a directory? If I set the max size to 800x600 it will make larger ones smaller and leave smaller ones at their original size. Has anyone got a solution for that? Any help would really be appreciated! ...

replacing regex in java string

I have this java string: String bla = "<my:string>invalid_content</my:string>"; How can I replace the "invalid_content" piece? I know I should use something like this: bla.replaceAll(regex,"new_content"); in order to have: "<my:string>new_content</my:string>"; but I can't discover how to create the correct regex help please :)...

C/C++ optimize data structures, array of arrays or just array

Working with a program that uses 16bytes 4v4 one byte matrices : unsigned char matrix[4][4]; and a few 256bytes 16v16 one byte matrices: unsigned char bigMatrix[16][16]; Very often due to data manipulation I am forced to loop column wise in the program making cache misses. Will the performance improve if I use an array instead, i....

jQuery: Creating a DOM Element on the fly, but fading it in?

I'm having a problem creating a DOM element, appending it to another element, and having it fade into place. Obviously, this doesnt seem to work: $('<div/>').html('hello').appendTo('#parentDiv').fadeIn(); So, what is the proper way? ...

How to set the mouse position under X11 (linux desktop)?

I'm wondering how to set the mouse cursor position under X11? Is it possible at all and if, where do I have to look for appropriate functions? X window system, KDE/Gnome/...? ...

PDF document manipulation

I have several PDFs with the following properties: Each PDF contains a variable number of "documents" with differing number of pages. Each page in a "document" has text such as "Page 3 of 26". I want to be able to automatically identify the first and last page of each "document" within a PDF (Note: this is not the same as the first an...

C++ custom stream manipulator that changes next item on stream

In C++, to print a number in hexadecimal you do this: int num = 10; std::cout << std::hex << num; // => 'a' I know I can create a manipulator that just adds stuff to the stream like so: std::ostream& windows_feed(std::ostream& out) { out << "\r\n"; return out; } std::cout << "Hello" << windows_feed; // => "Hello\r\n" Howev...

Inverting Image Transparency in ASP.net

I am trying to build a page that will allow me to take an input image and generate a mask from it. The input would be an indexed PNG with a transparent background. The resultant image would be be black where the original was transparent and transparent wherever the original image was opaque. I've done some very basic image manipulatio...

how to convert data efficiently in DataTable in ADO.Net

Hello everyone, I am using ADO.Net + C# + VSTS 2008 + SQL Server 2005. I bind an ADO.Net DataTable to a real database table, and then bind the DataTable to a grid view on ASP.Net page. My question is, if I want to do some data manipulation work (very simple, like add some prefix to some character data type rows, multiple integer data ty...

Why does this only work in Firefox?

I've created a self-contained example to find out why this is only working in Firefox: var ul = jQuery('<ul></ul>'); jQuery(selector).children().each(function() { var li = jQuery('<li></li>'); var label = '<label for="' + this.id + '">' + this.name + '</label>'; li.append(label); li.append(this); ul.append(li); }); Any...

Mathematical Equation Manipulation in python

Hi, Actually I want to develop a GUI app which displays a given mathematical equation. And when you click upon a particular variable in the equation to signify that it is the unknown variable ie., to be calculated. The equation transforms itself to evaluate the required unknown variable. for eg: a = (b+c*d)/e Let us suppose that ...

Setting an XSLT variable as a javascript variable?

How would I grab an XSLT variable and use it to set a javascript variable? I'm working on a bit of AJAX and in order to make it work to the fullest I would like to be able to grab XSLT variables and use those to set the default values of some javascript variables that I'll then be manipulating with jQuery. ...