manipulation

Php, date manipulation?

Hi, I am new to php. And I would like to know some of the date manipulation things in php. // Get Current date $date = date("Y-m-d"); What if I want to subtract current date and a specific date, lets say "today - 2008-06-26"? Q1: How to do date math manipulation (add, minus, multply etc) in php? Q2: If today, a subscriber subscrib...

Using Set::extract in CakePHP

I have a query to get all the compatible phones in a specific country, and in my controller I'm using Set::extract to reduce the untidy result array to just an array of product names. $results = $this->Country->compatiblePhones($country); $compatiblePhones = Set::extract('/p/product_name',$results); $this->set('compatiblePho...

Change URL parameters with jQuery?

I have this URL: site.fwx?position=1&archiveid=5000&columns=5&rows=20&sorting=ModifiedTimeAsc what I need is to be able to change the 'rows' url param value to something i specify, lets say 10. And if the 'rows' doesn't exist, I need to add it to the end of the url and add the value i've already specified (10). Anyone know the easiest ...

jQuery Examples – Horizontal Accordion - Table instead of Un-ordered Lists - UPDATED

Ok I got it working for anyone who needs this :) [Original Statement/Question] Here is and example of what I'm trying to do (But on click not hover): The Example JavaScript: <script type="text/javascript"> $(document).ready(function(){ // Get original font size var originalFontSize = $('html').css('font-size'); ...

Manipulation of stage elements

I need a library that help me to create an image editor in Adobe Flex, anybody know about someone??? or what do you suggest to me?? I have a site where people can create your own backgrounds for their desktops, they select the background, they can write something over the backgorund, upload their images and put into the stage, something...

How do i replace accents (german) in .NET

Hi Friends, I need to replace accents in the string to their english equivalents for example ä = ae ö = oe Ö = Oe ü = ue I know to strip of them from string but i was unaware about replacement. Please let me know if you have some suggestions. I am coding in C# ...

Improving Python list slicing

I've wondered why extend/append methods of Python don't return a reference to result list. To build string of all combination of list with last element, I would like to write simple: for i in range(l, 0, -1): yield " ".join(src[0:i-1].append(src[-1])) But I've got: TypeError. Instead following code with intermediate variable is us...

C# - Xml manipulation using XmlDocument

In C#, how do I replace a node in an xml with another node using XmlDocument. For E.g, consider the following xml file. <Products> <Product ProdID="1"> <Data>abc</Data> </Product> <Product ProdID="2"> <Data>def</Data> </Product> </Products> Let us say I need to replace <Product ProdID="2"> <Data>def</Data> <...

Simple way to handle time in C#?

My current approach is something like DateTime startHour = new DateTime(1900,1,1,12,25,43); DateTime endHour = new DateTime(1900,1,1,13,45,32); // I need to, say, know if a complete DateTime instance // is later than startHour plus 15 minutes DateTime now = DateTime.Now(); startHour = startHour.addMinutes(15); if (now.CompareTo(new...

Image border manipulation in C#

I have a need to resize pictures on a website I'm making for my company. The pictures must be a very specific size, and if the proportions are not correct I must be able to pad the image with a border to make it 'fit'. I'm not sure what the best way to approach this problem is. My knee-jerk was to simply add Rectangles to the image on...

change key of mp3 song with java

I know there are a few posts about various media frameworks out there, but I am looking for something a little more specific. I would love to be able to take an mp3 and transpose it to a new key. Any suggestions? ...

Please wait modal overlay before waiting for a function with a heavy workload without setTimeout()?

This is a simplified example, to make sure that there are no asynchronous fading/animation functions involved. I want, that the background is red when the function with the heavy workload works and turns to black, when it is ready. What actually happens is, that most times the background will turn directly to black, after the function i...

Transform string into image with JQuery

Another JQuery question for you guys. Say I have a url of an image in my web page surrounded by square brackets. [http://www.example.com/picture.jpg] How could I, with JQuery transform that string like so... [http://www.example.com/picture.jpg] into... <img src="http://www.example.com/picture.jpg" /> ? ...

How to add dropdown in excel sheet programmatically????

Hi to All, I am using the ExcelPackage dll to creating the excel from the .net application. I want to add drop down list in one of column of Excel sheet. How to add it???? Also I want to do some formatting changes to the cell values. Please reply ......... Regards, Girish ...

F#: Remove the first N characters from a string?

I'm trying to write some code to remove the first N characters in a string. I could have done this in an imperative manner already, but I would like to see it done in the spirit of functional programming. Being new to F# and functional programming, I'm having some trouble... ...

C++ string manipulation / input

This is for homework! But I need help anyway. The assignment is to input a sentence then output the number of words, and the number of occurrences of each letter. The output must have the letters in alphabetical order. So far, I've been able to count the number of words and get all the letters to lower case so that I'll be able to keep c...

How to check if a position in a string is empty in c#

Hi, I have strings with space seperated values and I would like to pick up from a certain index to another and save it in a variable. The strings are as follows: John Doe Villa Grazia 323334I I managed to store the id card (3rd column) by using: if (line.length > 39) { idCard = line.Substring(39, 46); } Howev...

PHP Array Combinations

Hi Guys, Im using the accepted answer in this question. As I have the same requirements, I need to get all combinations of an array of variable length with a variable number of elements. However I also need it to produce all combinations which don't use all the elements of the array, but are in order. If that makes sense? So if this is ...

How to split strings on carriage return with C#?

Hi, I have an ASP.NET page with a multiline textbox called txbUserName. Then I paste into the textbox 3 names and they are vertically aligned: Jason Ammy Karen I want to be able to somehow take the names and split them into separate strings whenever i detect the carriage return or the new line. i am thinking that an array might be t...

Use JQuery to wrap multiple sets of elements in a Div

I'm working on a dropdown menu and need to mutate the existing html markup with JQuery to make it fit the design. Here is a simplified example: Wrap all "ul's" that contain more than one "li" in a div (in the same div, NOT one div for each UL). <ul> <li>foo</li> </ul> <ul> <li>foo</li> <li>foo</li> </ul> <ul> <li>foo</l...