Search Results

Search found 16509 results on 661 pages for 'date range'.

Page 25/661 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • Creating a folder named after the current date and time

    - by lowerkey
    I'm trying to create a powershell script that creates a new folder with the current date (formatted as yyyy-MM-dd) as a name. Here's what I have so far: PS C:\Users\me\Desktop> powershell.exe -command "new-item ($(get-location) + (Get-Date).year + "-" + (Get-Date).month + "-" + (Get-Date).day) -type directo ry" Die Benennung "C:\Users\me\Desktop" wurde nicht als Name eines Cmdlet, ein er Funktion, einer Skriptdatei oder eines ausführbaren Programms erkannt. Überp rüfen Sie die Schreibweise des Namens, oder ob der Pfad korrekt ist (sofern ent halten), und wiederholen Sie den Vorgang. Bei Zeile:1 Zeichen:35 + new-item (C:\Users\me\Desktop <<<< + (Get-Date).year + - + (Get-Date). month + - + (Get-Date).day) -type directory + CategoryInfo : ObjectNotFound: (C:\Users\j.moore\Desktop:String ) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException

    Read the article

  • Looking up a value, depending on which set of dates another date falls between

    - by Ruffles
    Hello, and apologies if this is a duplicate - if you could point me in the direction of any existing answers, that would be great. I have a set of date ranges in Excel, each of which has some kind of label. e.g. LabelA 01/01/10 31/01/10 LabelB 01/02/10 28/02/10 LabelC 01/03/10 31/03/10 If I have another date, I would like to look up the label relating to the date range within which this date falls. e.g. For 15/02/10 I would like to return LabelB. I know that the date ranges will not overlap, although there could be a gap between the end date of one, and the start date of the next.

    Read the article

  • Math Looping Between Min and Max Using Mod?

    - by TheDarkIn1978
    i'm attempting to build a tiny (or perhaps not so tiny) formula that will contain numbers between a set min and max, but also loop these numbers so they are not clipped if they are outside of the range. so far, this is what i have. min1 = 10 max1 = 90 val1 = 92 //will make 12, which is what i want since it loops formula: min(max(min1,min(val1,max1)),mod(val1,max1)+min1) however, i'd like it to loop the other direction also, so that if val1 is 5, which is -5 outside of min1, it will become 85. another problem i'm running into is that max1 % max1 != max1 as i want it to, since the max is part of the range trying to be clear, here are some examples of desired output based on a range with looping min1 = 10 max1 = 90 ---------------------------------------------- val1 = 30 //within range: stays as 30 val1 = 90 //within range: stays as 90 val1 = -6 //below range: loops to becomes 84 val1 = 98 //above range: loops to becomes 18 i'd like not to resort to using a series of if/else statements, but one would be fine if it's absolutely required. is that even possible?

    Read the article

  • How to select li range and move them inside div [closed]

    - by user8012
    How can I select a range of li and move them inside div element. For example: <ul> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul> If the li is more than 6 create a column like this: <ul> <li> <div class="column1"> <ul> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul> </div> </li> <li> <div class="column2"> <ul> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> <li>test</li> </ul> </div> </li> </ul>

    Read the article

  • XSLT 1.0 grouping to reformat element defined by date into element defined by task

    - by Daniel
    Hi folks, I have a tricky XSLT transformation and I'd like your advise My xml is formatted as below: <Person> <name>John</name> <date>June12</date> <workTime taskID=1>34</workTime> <workTime taskID=2>12</workTime> </Person> <Person> <name>John</name> <date>June12</date> <workTime taskID=1>21</workTime> <workTime taskID=2>11</workTime> </Person> The output xml should be: <Person> <name>John</name> <taskID>1</taskID> <workTime> <date>June12</date> <time>34</time> </worTime> <workTime> <date>June13</date> <time>21</time> </worTime> </Person> <Person> <name>John</name> <taskID>2</taskID> <workTime> <date>June12</date> <time>12</time> </worTime> <workTime> <date>June13</date> <time>11</time> </worTime> </Person> Essentially, as an input, a "Person" object gathers all the task/workTime for a specific date. As an output, I want the "Person" object to gather the date/workTime for a specific task. I need to use XLST 1.0. I've been trying to use grouping with key but get very puzzled. Appreciate your help. Daniel

    Read the article

  • SQL – Contest to Get The Date – Win USD 50 Amazon Gift Cards and Cool Gift

    - by Pinal Dave
    If you are a regular reader of this blog – you will find no issue at all in resolving this puzzle. This contest is based on my experience with NuoDB. If you are not familiar with NuoDB, here are few pointers for you. Step by Step Guide to Download and Install NuoDB – Getting Started with NuoDB Quick Start with Admin Sections of NuoDB – Manage NuoDB Database Quick Start with Explorer Sections of NuoDB – Query NuoDB Database In today’s contest you have to answer following questions: Q 1: Precision of NOW() What is the precision of the NuoDB’s NOW() function, which returns current date time? Hint: Run following script on NuoDB Console Explorer section: SELECT NOW() AS CurrentTime FROM dual; Here is the image. I have masked the area where the time precision is displayed. Q 2: Executing Date and Time Script When I execute following script - SELECT 'today' AS Today, 'tomorrow' AS Tomorrow, 'yesterday' AS Yesterday FROM dual; I will get the following result:   NOW – What will be the answer when we execute following script? and WHY? SELECT CAST('today' AS DATE) AS Today, CAST('tomorrow' AS DATE) AS Tomorrow, CAST('yesterday'AS DATE) AS Yesterday FROM dual; HINT: Install NuoDB (it takes 90 seconds). Prizes: 2 Amazon Gifts 2 Limited Edition Hoodies (US resident only)   Rules: Please leave an answer in the comments section below. You must answer both the questions together in a single comment. US resident who wants to qualify to win NuoDB apparel please mention your country in the comment. You can resubmit your answer multiple times, the latest entry will be considered valid. Last day to participate in the puzzle is June 24, 2013. All valid answer will be kept hidden till June 24, 2013. The winner will be announced on June 25, 2013. Two Winners will get USD 25 worth Amazon Gift Card. (Total Value = 25 x 2 = 50 USD) The winner will be selected using a random algorithm from all the valid answers. Anybody with a valid email address can take part in the contest. Reference: Pinal Dave (http://blog.sqlauthority.com) Filed under: Big Data, PostADay, SQL, SQL Authority, SQL Puzzle, SQL Query, SQL Server, SQL Tips and Tricks, T SQL, Technology Tagged: NuoDB

    Read the article

  • How to parse date in different languages.

    - by xrx215
    Hi, with browser language french i have a string which has date in the format v = 13/01/2010 10:54:00. when i say Date.parse(v) i get the result as Date.parse(v) 1293897240000 Number with browser language german i have a string which has date int he format v = 13.01.2010 10:54:00 when i say Date.parse(v) i get the result as Date.parse(v) NaN Number can you please tell me how to parse date when it is in german language. Thanks

    Read the article

  • Checking a record is due based on the 'occuring' field

    - by andy
    I have records that have dates against them and an occurring field that contains none,yearly and monthly id status note date last_updated occurring 1 open --- 01/01/2011 01/02/2010 yearly 2 open --- 05/05/2011 03/05/2011 monthly 3 open --- 06/06/2011 05/06/2011 none Now I need to be able to check if a record is due (the date set has passed) which works perfect if occurring is set to none but I'm unsure of how to approach it when it's set to yearly or monthly (IE: This day in the year/month has passed) So with the above records, if I had a method on the record called due? providing the status is 'open' it needs to return true every year when it's passed that date if it's not been updated within the year yet. I apologise if this is confusing but it's melting my brain just trying to think of it, let alone put it into words.

    Read the article

  • Python, Matplotlib, subplot: How to set the axis range?

    - by someone
    How can I set the y axis range of the second subplot to e.g. [0,1000] ? The FFT plot of my data (a column in a text file) results in a (inf.?) spike so that the actual data is not visible. pylab.ylim([0,1000]) has no effect, unfortunately. This is the whole script: # based on http://www.swharden.com/blog/2009-01-21-signal-filtering-with-python/ import numpy, scipy, pylab, random xs = [] rawsignal = [] with open("test.dat", 'r') as f: for line in f: if line[0] != '#' and len(line) > 0: xs.append( int( line.split()[0] ) ) rawsignal.append( int( line.split()[1] ) ) h, w = 3, 1 pylab.figure(figsize=(12,9)) pylab.subplots_adjust(hspace=.7) pylab.subplot(h,w,1) pylab.title("Signal") pylab.plot(xs,rawsignal) pylab.subplot(h,w,2) pylab.title("FFT") fft = scipy.fft(rawsignal) #~ pylab.axis([None,None,0,1000]) pylab.ylim([0,1000]) pylab.plot(abs(fft)) pylab.savefig("SIG.png",dpi=200) pylab.show() Other improvements are also appreciated!

    Read the article

  • Set the background color for a fixed range of cells

    - by Count Boxer
    I have VBA code in an Excel spreadsheet. It is used to set the font and background color of a cell based on the value in that cell. I am doing it in VBA instead of "Conditional Formatting" because I have more than 3 conditions. The code is: Private Sub Worksheet_Change(ByVal Target As Range) Dim c As Range, d As Range, fc As Long, bc As Long, bf As Boolean Set d = Intersect(Range("A:K"), Target) If d Is Nothing Then Exit Sub For Each c In d If c >= Date And c <= Date + 5 Then fc = 2: fb = True: bc = 3 Else Select Case c Case "ABC" fc = 2: fb = True: bc = 5 Case 1, 3, 5, 7 fc = 2: fb = True: bc = 1 Case "D", "E", "F" fc = 2: fb = True: bc = 10 Case "1/1/2009" fc = 2: fb = True: bc = 45 Case "Long string" fc = 3: fb = True: bc = 1 Case Else fc = 1: fb = False: bc = xlNone End Select End If c.Font.ColorIndex = fc c.Font.Bold = fb c.Interior.ColorIndex = bc c.Range("A1:D1").Interior.ColorIndex = bc Next End Sub The problem is in the "c.Range" line. It always uses the current cell as "A" and then goes four cells to the right. I want it to start in the "real" cell "A" of the current row and go to the "real" cell "D" of the current row. Basically, I want a fixed range and not a dynamic one.

    Read the article

  • how do i set a value to a range using a function from module in excel vba?

    - by gadym
    hello all, i want to do a simple function in a module in excel vba, so i can use it as a custom function in excel. (i use excel 2003, or 2007 , it's doesnt matter) i create a function(!) in a new workbook and it's looks like this: Function a() Sheets(1).Range("A1").Value = 4 end function but when i try to use it on the sheet1 it's wont work! i tried many things. how can i make this work (with no workarounds, i want to use it as a custom function) ? please help. thanks, gadym

    Read the article

  • changing date in solaris machine.......

    - by RBA
    Hi, I am in process of updating the Solaris Machine's System Date and Time.... I am using the following command.... Loginned as root........ # date -u 062800002010 Mon Jun 28 00:00:00 GMT 2010 # date Sun Feb 28 05:30:02 IST 2010 As seen above,, when i fire the "date" command again.... the new updated date doesn't get reflected......... Please let me know on what could be the issue....... Thanks....

    Read the article

  • Upgrade to 12.04 results to empty Dash, no date & time either on the top panel

    - by Nicolas
    I've upgraded from Ubuntu netbook remix something to 12.04 LTS, and I've got two issues. (Got an Asus eeePc 32bits, Intel 945GME x86/MMX/SSE2 and Intel Atom CPU N270 @ 1.6Ghz x2) Nothing in the Dash. Only the "home" tab, other tabs are missing. No search results whatsoever. Missing elements in the system panel, privacy and date & time. No date & time on the right corner either. I've tried to reset unity with the terminal but the process was a whole mess full of errors. It did show date & time in the system panel (not on the top-right corner) while the process was going on in the terminal. But then it was such a mess (no more icons on the right corner amongst other things), and the process wouldn't complete, so I had to reboot the computer and get Unity as before, still no date & time and privacy.

    Read the article

  • Using the Java SE 8 Date Time API with JPA 2.1

    - by reza_rahman
    Most of you are hopefully aware of the new Date Time API included in Java SE 8. If you are not, you should check them out right now using the Java Tutorial Trail dedicated to the topic. It is a significantly leap forward in processing temporal data in Java. For those who already use Joda-Time the changes will look very familiar - very simplistically speaking the Java SE 8 feature is basically Joda-Time standardized. Quite naturally you will likely want to use the new Date Time APIs in your JPA domain model to better represent temporal data. The problem is that JPA 2.1 will not support the new API out of the box. So what are you to do? Fortunately you can make use of fairly simple JPA 2.1 Type Converters to use the Date Time API in your JPA domain classes. Steven Gertiser shows you how to do it in an extremely well written blog entry. Besides explaining the problem and the solution the entry is actually very good for getting a better understanding of JPA 2.1 Type Converters as well. I think such a set of converters may be a good fit for Apache DeltaSpike as a Java EE 7 extension? In case you are wondering about Java SE 8 support in the JPA specification itself, Nick Williams has already entered an excellent, well researched JIRA entry asking for such support in a future version of the JPA specification that's well worth looking at. Another possibility of course is for JPA providers to start supporting the Date Time API natively before anything is formalized in the specification. What do you think?

    Read the article

  • Comparing date range quarters sql server

    - by CR41G14
    I have a policies in a system PolRef Start End POL123 22/11/2012 23/12/2014 POL212 24/09/2012 23/10/2012 POL214 23/08/2012 29/09/2012 I am asking a user for a reporting date, the user enters 24/10/2012 this becomes @StartDate From this I derive what the quarter is by the month: set @currentMonth = Month(@StartDate) if @currentMonth = 1 or @currentMonth = 2 or @currentMonth = 3 begin set @startmonth = 1 set @endmonth = 3 end if @currentMonth = 4 or @currentMonth = 5 or @currentMonth = 6 begin set @startmonth = 4 set @endmonth = 6 end if @currentMonth = 7 or @currentMonth = 8 or @currentMonth = 9 begin set @startmonth = 7 set @endmonth = 9 end if @currentMonth = 10 or @currentMonth = 11 or @currentMonth = 12 begin set @startmonth = 10 set @endmonth = 12 end I then get a date range: @quarterStartDate = CAST(CAST(YEAR(@StartDate) AS varchar) + '-' + CAST(@startMonth AS varchar) + '-' + '01') AS Date) @quarterEndDate = CAST(CAST(YEAR(@EcdDate) AS varchar) + '-' + CAST(@endMonth AS varchar) + '-' + '31') AS Date) This will give me 01-10-2012 and 31-12-2012. Basically I need a script to only bring back the policies that are in this quarter. The policy doesn't have to span the entire quarter date range, just exist in the quarter date range. The results expected would be PolRef Start End POL123 22/11/2012 23/12/2014 POL212 24/09/2012 23/10/2012 Pol123 appears because it spans over the quarterly date range. Pol212 is there because it expires in that quarter date range. Pol214 does not appear because it neither spans, expires or starts in this quarter. Any help would be greatly appreciated

    Read the article

  • flex3 Format date without timezone

    - by Maurits de Boer
    I'm receiving a date from a server in milliseconds since 1-1-1970. I then use the DateFormatter to print the date to the screen. However, Flex adds timedifference and thus it displays a different time than what I got from the server. I've fixed this by changing the date before printing to screen. But I think that's a bad solution because the date object doesn't hold the correct date. Does anyone know how to use the dateFormatter to print the date, ignoring the timezone? this is how I did it: function getDateString(value:Date):String { var millisecondsPerMinute:int = 1000*60; var newDate:Date = new Date(value.time - (millisecondsPerMinute*value.timezoneOffset)); var dateFormatter:DateFormatter = new DateFormatter(); dateFormatter.formatString = "EEEE DD-MM-YYYY LL:MM AA"; return dateFormatter.format(newDate); }

    Read the article

  • NHibernate: how to do lookup a specific date

    - by Daoming Yang
    How I can lookup a specific date in Nhibernate? I'm currently using this to lookup one day's order. ICriteria criteria = SessionManager.CurrentSession.CreateCriteria(typeof(Order)) .Add(Expression.Between("DateCreated", date.Date.AddDays(-1), date.Date.AddDays(1))) .AddOrder(NHibernate.Criterion.Order.Desc("OrderID")); I tried the following code, but they did bring the data for me. Expression.Eq("DateCreated", date) Expression.Like("DateCreated", date) Note: The pass in date value will be like this 2010-04-03 00:00:00, The actual date value in the database will be like this 2010-03-13 11:17:16.000 Can anyone let me know how to do this? Many thanks.

    Read the article

  • NHibernate: how to do lookup a specific date in Nhibernate

    - by Daoming Yang
    How I can lookup a specific date in Nhibernate? I'm currently using this to lookup one day's order. ICriteria criteria = SessionManager.CurrentSession.CreateCriteria(typeof(Order)) .Add(Expression.Between("DateCreated", date.Date.AddDays(-1), date.Date.AddDays(1))) .AddOrder(NHibernate.Criterion.Order.Desc("OrderID")); I tried the following code, but they did bring the data for me. Expression.Eq("DateCreated", date) Expression.Like("DateCreated", date) Note: The pass in date value will be like this 2010-04-03 00:00:00, The actual date value in the database will be like this 2010-03-13 11:17:16.000 Can anyone let me know how to do this? Many thanks.

    Read the article

  • How can I randomly iterate through a large Range?

    - by void
    I would like to randomly iterate through a range. Each value will be visited only once and all values will eventually be visited. For example: class Array def shuffle ret = dup j = length i = 0 while j > 1 r = i + rand(j) ret[i], ret[r] = ret[r], ret[i] i += 1 j -= 1 end ret end end (0..9).to_a.shuffle.each{|x| f(x)} where f(x) is some function that operates on each value. A Fisher-Yates shuffle is used to efficiently provide random ordering. My problem is that shuffle needs to operate on an array, which is not cool because I am working with astronomically large numbers. Ruby will quickly consume a large amount of RAM trying to create a monstrous array. Imagine replacing (0..9) with (0..99**99). This is also why the following code will not work: tried = {} # store previous attempts bigint = 99**99 bigint.times { x = rand(bigint) redo if tried[x] tried[x] = true f(x) # some function } This code is very naive and quickly runs out of memory as tried obtains more entries. What sort of algorithm can accomplish what I am trying to do? [Edit1]: Why do I want to do this? I'm trying to exhaust the search space of a hash algorithm for a N-length input string looking for partial collisions. Each number I generate is equivalent to a unique input string, entropy and all. Basically, I'm "counting" using a custom alphabet. [Edit2]: This means that f(x) in the above examples is a method that generates a hash and compares it to a constant, target hash for partial collisions. I do not need to store the value of x after I call f(x) so memory should remain constant over time. [Edit3/4/5/6]: Further clarification/fixes.

    Read the article

  • VBA Range.Rows.Count giving unexpected results

    - by Jeffrey
    I have a Range variable that contains an address - $2:$2,$4:$205,$214:$214 - (3 groups of rows). I would like to get the count of all the rows in that range. However, range.Count gives me the count of all the cells (50,000~) and range.Rows.Count only return 1 - the count of all the rows in the first group. How do I get the count of all the rows Thanks

    Read the article

  • shell script to set time and date on ubuntu

    - by glapo
    my desktop CMOS battery is not working, therefore I have to set time and date each time my computer starts up. I want to create a shell script to automate the setting of date and time on my computer after each boot is complete. options that exist include: 1. buying a CMOS battery :- am considering this, but for the meantime a shell script will do. 2. using NTP to synchronize time and date with internet servers :- am not connected to the internet.

    Read the article

  • Browser sends http request with RANGE

    - by nute
    I have a local testing environment in a Fedora virtual machine. Strangely, resources (css and js files) don't seem to work. Looking at Firebug, I see that the browser sends the HTTP request with "Range bytes=0-". The server responds with either an empty 200OK or an empty 206 Partial Content. Here is an example: Response Headers Date Mon, 23 Nov 2009 23:33:26 GMT Server Apache/2.2.13 (Fedora) Last-Modified Thu, 19 Nov 2009 22:58:55 GMT Etag "18-3aec-478c14dbee138" Accept-Ranges bytes Content-Length 15084 Content-Range bytes 0-15083/15084 Connection close Content-Type text/css Request Headers Host fedora.test User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.5) Gecko/20091105 Fedora/3.5.5-1.fc11 Firefox/3.5.5 Accept text/css,*/*;q=0.1 Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive Referer http://fedora.test/pictures/ Cookie __utma=26341546.1613992749.1258504422.1258569125.1258752550.4; __utmz=26341546.1258504422.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); PHPSESSID=tqf8jfmc77qihe97rl4tmhq685 Range bytes=0- If-Range "18-3aec-478c14dbee138" I don't know if the browser is sending the wrong request, or if it's the server that is doing this. Request made to the outside (such as google analytics) are working fine. This is running in Fedora 11 in VirtualBox. Apache. PHP. The files are being served through the "shared folders" feature of VirtualBox (could it be related?). No error logs could help me.

    Read the article

  • How do i pass arbitary date format from C# to sql backend

    - by Jims
    I have a datetime field for the transaction date in the back end. So I am passing that date from front C#.net, in the below format: 2011-01-01 12:17:51.967 to do this I have written: presentation layer: string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); PropertyClass prp=new PropertyClass(); Prp.TransDate=Convert.ToDateTime(date); PropertyClass structure: Public class property { private DateTime transdate; public DateTime TransDate { get { return transdate; } set { transdate = value; } } } From DAL layer passing the TransactionDate like this: Cmd.Parameters.AddWithValue("@TranSactionDate”, SqlDbType.DateTime).value=propertyobj.TransDate; While debugging from presntation layer: string date = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff", CultureInfo.InvariantCulture); in this I am getting correct expected date format, but when debugs goes to this line Prp.TransDate=Convert.ToDateTime(date); again date format changing to 1/1/2011. But my backend sql datefield wants the date paramter 2011-01-01 12:17:51.967 in this format otherwise throwing exception invalid date format. Note: While passing date as string without converting to datetime getting exceptions like: System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM. at System.Data.SqlTypes.SqlDateTime.FromTimeSpan(TimeSpan value) at System.Data.SqlTypes.SqlDateTime.FromDateTime(DateTime value) at System.Data.SqlTypes.SqlDateTime..ctor(DateTime value) at System.Data.SqlClient.MetaType.FromDateTime(DateTime dateTime, Byte cb) at System.Data.SqlClient.TdsParser.WriteValue(Object value, MetaType type, Byte scale, Int32 actualLength, Int32 encodingByteSize, Int32 offset, TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.TdsExecuteRPC(_SqlRPC[] rpcArray, Int32 timeout, Boolean inSchema, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean isCommandProc)

    Read the article

  • Need to set cursor position to the end of a contentEditable div, issue with selection and range obje

    - by DavidR
    I'm forgetting about cross-browser compatibility for the moment, I just want this to work. What I'm doing is trying to modify a script (and you probably don't need to know this) located at typegreek.com The basic script is found here. Basically what it does is when you type in characters, it converts the character your are typing into greek characters and prints it onto the screen. What I'm trying to do is to get it to work on contentEditable div's (It only works for Textareas) My issue is with this one function: The user types a key, it get's converted to a greek key, and goes to a function, it gets sorted through some if's, and where it ends up is where I can add div support. Here is what I have so far, myField is the div, myValue is the greek character. //Get selection object... var userSelection if (window.getSelection) {userSelection = window.getSelection();} else if (document.selection) {userSelection = document.selection.createRange();} //Now get the cursor position information... var startPos = userSelection.anchorOffset; var endPos = userSelection.focusOffset; var cursorPos = endPos; //Needed later when reinserting the cursor... var rangeObj = userSelection.getRangeAt(0) var container = rangeObj.startContainer //Now take the content from pos 0 -> cursor, add in myValue, then insert everything after myValue to the end of the line. myField.textContent = myField.textContent.substring(0, startPos) + myValue + myField.textContent.substring(endPos, myField.textContent.length); //Now the issue is, this updates the string, and returns the cursor to the beginning of the div. //so that at the next keypress, the character is inserted into the beginning of the div. //So we need to reinsert the cursor where it was. //Re-evaluate the cursor position, taking into account the added character. var cursorPos = endPos + myValue.length; //Set the caracter position. rangeObj.setStart(container,cursorPos) Now, this works only as long as I don't type more than the size of the original text. Say I had 30 characters in the div before hand. If I type more than that 30, it adds character 31, but places the cursor back at 30. I can type character 32 at pos.31, then character 33 at pos.32, but if I try to put character 34 in, it adds the character, and sets the cursor back at 32. The issue is that the function for adding the new character screws up if cursorPos is greater than what is defined in the range. Any ideas?

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >