Daily Archives

Articles indexed Friday April 23 2010

Page 20/115 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • Remove All Nodes with (nodeName = "script") from a Document Fragment *before placing it in dom*

    - by Matrym
    My goal is to remove all <[script] nodes from a document fragment (leaving the rest of the fragment intact) before inserting the fragment into the dom. My fragment is created by and looks something like this: range = document.createRange(); range.selectNode(document.getElementsByTagName("body").item(0)); documentFragment = range.cloneContents(); sasDom.insertBefore(documentFragment, credit); document.body.appendChild(documentFragment); I got good range walker suggestions in a separate post, but realized I asked the wrong question. I got an answer about ranges, but what I meant to ask about was a document fragment (or perhaps there's a way to set a range of the fragment? hrmmm). The walker provided was: function actOnElementsInRange(range, func) { function isContainedInRange(el, range) { var elRange = range.cloneRange(); elRange.selectNode(el); return range.compareBoundaryPoints(Range.START_TO_START, elRange) <= 0 && range.compareBoundaryPoints(Range.END_TO_END, elRange) >= 0; } var rangeStartElement = range.startContainer; if (rangeStartElement.nodeType == 3) { rangeStartElement = rangeStartElement.parentNode; } var rangeEndElement = range.endContainer; if (rangeEndElement.nodeType == 3) { rangeEndElement = rangeEndElement.parentNode; } var isInRange = function(el) { return (el === rangeStartElement || el === rangeEndElement || isContainedInRange(el, range)) ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP; }; var container = range.commonAncestorContainer; if (container.nodeType != 1) { container = container.parentNode; } var walker = document.createTreeWalker(document, NodeFilter.SHOW_ELEMENT, isInRange, false); while (walker.nextNode()) { func(walker.currentNode); } } actOnElementsInRange(range, function(el) { el.removeAttribute("id"); }); That walker code is lifted from: http://stackoverflow.com/questions/2690122/remove-all-id-attributes-from-nodes-in-a-range-of-fragment PLEASE No libraries (ie jQuery). I want to do this the raw way. Thanks in advance for your help

    Read the article

  • In using Samsung acclerometer

    - by cheesebunz
    Hi everyone , i have this sample code i want to use. I'm not sure where to place it. I'm using Visual studio 2008 , windows mobile 6 sdk. I wish to test the accelerometer but i'm not sure where i should code it. The start is e.g. form1. Do i create new existing item new program.cs a new C# file and do this(as of below)? #include "smiAccelerometer.h" SmiAccelerometerVector accel; // get the acceleration vector containing X, Y, Z components if (SmiAccelerometerGetVector(&accel) == SMI_SUCCESS) { // Successfully got acceleration. // Use accel.x, accel.y and accel.z in your application } else { // failed to get the acceleration }

    Read the article

  • TableView SwipeGesture

    - by venkat
    hi every one.i am using TableView having edit button to delete a row.when i swipe in the row it shows a default "Delete" button. But i dont need it.The Content of the cell must be deleted by means of edit button not by default one.how to disable that "Swipe to Delete" Button.

    Read the article

  • Problems saving a photo to a file

    - by Peter vdL
    Man, I am still not able to save a picture when I send an intent asking for a photo to be taken. Here's what I am doing: Make a URI representing the pathname android.content.Context c = getApplicationContext(); String fname = c.getFilesDir().getAbsolutePath()+"/parked.jpg"; java.io.File file = new java.io.File( fname ); Uri fileUri = Uri.fromFile(file); Create the Intent (don't forget the pkg name!) and start the activity private static int TAKE_PICTURE = 22; Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE ); intent.putExtra("com.droidstogo.boom1." + MediaStore.EXTRA_OUTPUT, fileUri); startActivityForResult( intent, TAKE_PICTURE ); The camera activity starts, and I can take a picture, and approve it. My onActivityResult() then gets called. But my file doesn't get written. The URI is: file:///data/data/com.droidstogo.boom1/files/parked.jpg I can create thumbnail OK (by not putting the extra into the Intent), and can write that file OK, and later read it back). Can anyone see what simple mistake I am making? Nothing obvious shows up in the logcat - the camera is clearly taking the picture. Thanks, Peter

    Read the article

  • Loops in ada and the implementation

    - by maddy
    HI all, Below is a piece of code shown and doubts are regarding the implementation of loops C := character'last; I := 1; K : loop Done := C = character'first; Count2 := I; Exit K when Done; C := character'pred(c); I := I + 1; end loop K; Can anyone please tell me what does 'K' stands for.I guess its not a variable.How does 'K' control the execution of the loop? Thanks Maddy

    Read the article

  • how to do android image animation

    - by user270811
    hi, i am trying to get a simple image animation going. i want to make it looks as if the helicopter's propeller blades are turning. i have 3 images for the helicopter, and i am showing one of these images depending on the animation progress. the problem is that all three images end up overlapping each other as opposed to just one image showing up at one time, thereby creating the animation. this is what i did so far, i even tried to clear canvas by doing this canvas.drawColor(Color.BLACK), but that would clear out the whole canvas, which is not what i want. this is what i have: 1) in the View class: static class Helicopter { private long mLastUpdate; private long mProgress = 0; private final float mX; private final float mY; private final Bitmap mHelicopter1; private final Bitmap mHelicopter2; private final Bitmap mHelicopter3; private final float mRadius; Helicopter(long mLastUpdate, float mX, float mY, Bitmap helicopter1, Bitmap helicopter2, Bitmap helicopter3) { this.mLastUpdate = mLastUpdate; this.mX = mX; this.mY = mY; this.mHelicopter1 = helicopter1; this.mHelicopter2 = helicopter2; this.mHelicopter3 = helicopter3; mRadius = ((float) mHelicopter1.getWidth()) / 2f; } public void update(long now) { mProgress += (now - mLastUpdate); if(mProgress >= 400L) { mProgress = 0; } mLastUpdate = now; } public void setNow(long now) { mLastUpdate = now; } public void draw(Canvas canvas, Paint paint) { if (mProgress < 150L) { canvas.drawBitmap(mHelicopter1, mX - mRadius, mY - mRadius, paint); } else if (mProgress < 300L) { canvas.drawBitmap(mHelicopter2, mX - mRadius, mY - mRadius, paint); } else if(mProgress < 400L) { canvas.drawBitmap(mHelicopter3, mX - mRadius, mY - mRadius, paint); } } public boolean done() { return mProgress > 700L; } } private ArrayList<Helicopter> mHelicopters = new ArrayList<Helicopter>(); 2) this is being called in the run() of a thread: private void doDraw(Canvas canvas) { final long now = SystemClock.elapsedRealtime(); canvas.save(); for (int i = 0; i < mHelicopters.size(); i++) { final Helicopter explosion = mHelicopters.get(i); explosion.update(now); } for (int i = 0; i < mHelicopters.size(); i++) { final Helicopter explosion = mHelicopters.get(i); explosion.draw(canvas, mPaint); } canvas.restore(); } can someone help me? i have looked at a lot of the examples on the web on animation, they seem to always involve text, but not images. thanks.

    Read the article

  • slow interactive response time

    - by ndhert
    VMWare ESXi4 with 2 VM's (FreeBSD-amd64). When doing a reboot on one of the VM's, the reboot is done in normal speed, but after that, the interactive response time on the other gets very slow: pressing return at the command prompt, takes serveral seconds to be exectuted. SSH-ing to the VM machine takes a long time before you are logged in. Only after 20 minutes or so, the situation is normalized. What's the reason and how to remedy?

    Read the article

  • 404 not found error for virtual host

    - by qubit
    Hello, In my /etc/apache2/sites-enabled, i have a file site2.com.conf, which defines a virtual host as follows : <VirtualHost *:80> ServerAdmin hostmaster@wharfage ServerName site2.com ServerAlias www.site2.com site2.com DirectoryIndex index.html index.htm index.php DocumentRoot /var/www LogLevel debug ErrorLog /var/log/apache2/site2_error.log CustomLog /var/log/apache2/site2_access.log combined ServerSignature Off <Location /> Options -Indexes </Location> Alias /favicon.ico /srv/site2/static/favicon.ico Alias /static /srv/site2/static # Alias /media /usr/local/lib/python2.5/site-packages/django/contrib/admin/media Alias /admin/media /var/lib/python-support/python2.5/django/contrib/admin/media WSGIScriptAlias / /srv/site2/wsgi/django.wsgi WSGIDaemonProcess site2 user=samj group=samj processes=1 threads=10 WSGIProcessGroup site2 </VirtualHost> I do the following to enable the site : 1) In /etc/apache2/sites-enabled, i run the command a2ensite site2.com.conf 2) I then get a message site successfully enabled, and then i run the command /etc/init.d/apache2 reload. But, if i navigate to www.site2.com, i get 404 not found. I do have an index.html in /var/www (permissions:777 and ownership www-data:www-data), and i have also verified that a symlink was created for site2.com.conf in /etc/apache2/sites-enabled. Any way to fix this ? Thank you.

    Read the article

  • HOw to restart ssh on ubuntu

    - by Mirage
    I want to restart ssh or sshd but i get this qqqq@Matrix-Server:/$ sudo /etc/init.d/ssh stop sudo: /etc/init.d/ssh: command not found qqqq@Matrix-Server:/$ DO i need to install ssh or sshd or it comes with ubuntu

    Read the article

  • How can i sort dictionary ?

    - by Ankit
    i have a dictionary.Inside the dictionary there is an array.i want to sort the dictionary and display it's value in acceding order so please any one help me how can i get sorted data?

    Read the article

  • problem in accessing the path involving pagination using display tag

    - by sarah
    Hi All, I am using display tag for pagiantion and display of the data in table format the code is like <display:column title="Select" style="width: 90px;"> <input type="checkbox" name="optionSelected" value="<c:out value='${userList.loginName}'/>"/> </display:column> <display:column property="loginName" sortable="false" title="UserName" paramId="loginName" style="width: 150px; text-align:center" href="./editUser.do?method=editUser"/> the pagesize is one it will display one in a page and eidt page will be dispaly on click of login name,but when i go to the second page i get an error saying /views/editUser path not found.How exactly should i define the path ? the struts-config is like <!-- action for edit user --> <action path="/editUser" name="editUserForm" type="com.actions.UserManagementAction" parameter="method" input="/EditUser.jsp" scope="request"> <forward name="success" path="/views/EditUser.jsp" /> <forward name="failure" path="/views/failure.jsp" /> </action> Pleas tell me how should i define the access path for display tag as on click of edit link the first page works but not the second edit

    Read the article

  • PowerShell and interactive external programs

    - by CC
    Hi all I'm attempting to write a PowerShell script that, among other things, runs two external programs, harvesting the output of one and providing it to the other. The problem is that the second program is interactive and asks for: - a password - an option (1, 2, or 3) - an option (Y or N) - output of external program 1 Note also that this is on XP with PowerShell v1 and .net v2.0 (no I can't upgrade) Any ideas how I would do this? CC

    Read the article

  • How do i render and detect a line of sight?

    - by acidzombie24
    If you look at the top right you'll see on a radar an enemy unit line of sight. I was wondering what is the most efficient or easiest way (little code, fairly accurate. doesnt need to be perfect) to detect if something is in your line of sight? I may or may not need to render it (i likely wont). I dont know the formula nor used any math libs/namespaces in C#

    Read the article

  • Trying to build automatic audio-conferencing capability into a WebApp

    - by Keller
    Hey all, I'm working with a team of relatively novice programmers, and we are trying to create a site that will have audio-conferencing capabilities such that whenever someone visits the page, they will immediately have audio-conferencing capabilities with everyone else on the page (5 people max). Can anyone point us in a general direction? Should we be looking into building a custom app, leveraging audio conferencing software, or trying to mimic a webex program? Would Adobe Stratus be useful in getting this kind of functionality? Does anyone have any ideas about how we would design something like this on a macro level? Sorry for the noobish question, but any guidance would be deeply appreciated. Thanks, Keller

    Read the article

  • multi-core processing in R on windows XP - via doMC and foreach

    - by Jan
    Hi guys, I'm posting this question to ask for advice on how to optimize the use of multiple processors from R on a Windows XP machine. At the moment I'm creating 4 scripts (each script with e.g. for (i in 1:100) and (i in 101:200), etc) which I run in 4 different R sessions at the same time. This seems to use all the available cpu. I however would like to do this a bit more efficient. One solution could be to use the "doMC" and the "foreach" package but this is not possible in R on a Windows machine. e.g. library("foreach") library("strucchange") library("doMC") # would this be possible on a windows machine? registerDoMC(2) # for a computer with two cores (processors) ## Nile data with one breakpoint: the annual flows drop in 1898 ## because the first Ashwan dam was built data("Nile") plot(Nile) ## F statistics indicate one breakpoint fs.nile <- Fstats(Nile ~ 1) plot(fs.nile) breakpoints(fs.nile) # , hpc = "foreach" --> It would be great to test this. lines(breakpoints(fs.nile)) Any solutions or advice? Thanks, Jan

    Read the article

  • Query Results Not Expected

    - by E-Madd
    I've been a CF developer for 15 years and I've never run into anything this strange or frustrating. I've pulled my hair out for hours, googled, abstracted, simplified, prayed and done it all in reverse. Can you help me? A cffunction takes one string argument and from that string I build an array of "phrases" to run a query with, attempting to match a location name in my database. For example, the string "the republic of boulder" would produce the array: ["the","republic","of","boulder","the republic","the republic of","the republic of boulder","republic of","republic of boulder","of boulder"]. Another cffunction uses the aforementioned cffunction and runs a cfquery. A query based on the previously given example would be... select locationid, locationname, locationaliasname from vwLocationsWithAlias where LocationName in ('the','the republic','the republic of','republic','republic of','republic of boulder','of','of boulder','boulder') or LocationAliasName in ('the','the republic','the republic of','republic','republic of','republic of boulder','of','of boulder','boulder') This returns 2 records... locationid - locationname - locationalias 99 - 'Boulder' - 'the republic' 68 - 'Boulder' - NULL This is good. Works fine and dandy. HOWEVER... if the string is changed to "the republic", resulting in the phrases array ["the","republic","the republic"] which is then used to produce the query... select locationid, locationname, locationaliasname from vwLocationsWithAlias where LocationName in ('the','the republic','republic') or LocationAliasName in ('the','the republic','republic') This returns 0 records. Say what?! OK, just to make sure I'm not involuntarily HIGH I run that very same query in my SQL console against the same database in the cf datasource. 1 RECORD! locationid - locationname - locationalias 99 - 'Boulder' - 'the republic' I can even hard-code that sql within the same cffunction and get that one result, but never from the dynamically generated SQL. I can get my location phrases from another cffunction of a different name that returns hard-coded array values and those work, but never if the array is dynamically built. I've tried removing cfqueryparams, triple-checking my datatypes, datasource setups, etc., etc., etc. NO DICE WTF!? Is this an obscure bug? Am I losing my mind? I've tried everything I can think of and others (including Ray Camden) can think of. ColdFusion 8 (with all the latest hotfixes) SQL Server 2005 (with all the greatest service packs) Windows 2003 Server (with all the latest updates, service packs and nightly MS voodoo)

    Read the article

  • query regarding fixing the page size

    - by sukhada
    -- <f:subview id="header"> <tiles:insert definition="page.header" flush="false"/> </f:subview> <!-- </h:panelGroup>--> <h:panelGroup id="topMenu" > <tiles:insert definition="page.topMenu" flush="false"/> </h:panelGroup> <h:panelGroup id="pageContext"> <f:subview id="body"> <tiles:insert attribute="body" flush="false"/> </f:subview> </h:panelGroup> <f:facet name="footer"> <f:subview id="footer"> <tiles:insert definition="page.footer" flush="false"/> </f:subview> </f:facet> </h:panelGrid> this is structure or layout of page in tiles but m loading another page the it disturbing the layout the layout so how can i fix the page size?

    Read the article

  • Which server would you purchase? IBM x3550 or Dell R610?

    - by Harry
    I'm in the market for a single unit rack mounted server with a strong upgrade pathway. The two servers on the top of my wish list are: IBM x3550 M2 Express Followed by Dell R610 Ultimately I want to have a Dual Quad Xeon (2 Ghz+) server with loads of RAM for a top notch DB server. The database is likely to keep growing indefinitly so a snappy Raid 5 array of Harddrives will be essential. Which would you purchase?

    Read the article

  • Adding menus in WindowActivate Event

    - by Sathish
    I am designing a Shared Add-in for Excel in Csharp and now i am adding the custom menu in OnStartupComplete event but now i want this to be moved to WindowActivate event. I have added the event but it is not firing. Please help me

    Read the article

  • Is garbage collection supported for iPhone applications?

    - by Mustafa
    Does the iPhone support garbage collection? If it does, then what are the alternate ways to perform the operations that are performaed using +alloc and -init combination: NSXMLParser *xmlParser = [[NSXMLParser alloc] initWithData:xmlData]; UIImage *originalImage = [[UIImage alloc] initWithData:data]; detailViewController = [[[DetailViewController alloc] initWithNibName:@"DetailView bundle:[NSBundle mainBundle]] autorelease]; ... and other commands. Thank you in advance for any help or direction that you can provide.

    Read the article

  • Timer Service in ejb 3.1 - schedule calling timeout problem

    - by Greg
    Hi Guys, I have created simple example with @Singleton, @Schedule and @Timeout annotations to try if they would solve my problem. The scenario is this: EJB calls 'check' function every 5 secconds, and if certain conditions are met it will create single action timer that would invoke some long running process in asynchronous fashion. (it's sort of queue implementation type of thing). It then continues to check, but as long as long running process is there it won't start another one. Below is the code I came up with, but this solution does not work, because it looks like asynchronous call I'm making is in fact blocking my @Schedule method. @Singleton @Startup public class GenerationQueue { private Logger logger = Logger.getLogger(GenerationQueue.class.getName()); private List<String> queue = new ArrayList<String>(); private boolean available = true; @Resource TimerService timerService; @Schedule(persistent=true, minute="*", second="*/5", hour="*") public void checkQueueState() { logger.log(Level.INFO,"Queue state check: "+available+" size: "+queue.size()+", "+new Date()); if (available) { timerService.createSingleActionTimer(new Date(), new TimerConfig(null, false)); } } @Timeout private void generateReport(Timer timer) { logger.info("!!--timeout invoked here "+new Date()); available = false; try { Thread.sleep(1000*60*2); // something that lasts for a bit } catch (Exception e) {} available = true; logger.info("New report generation complete"); } What am I missing here or should I try different aproach? Any ideas most welcome :) Testing with Glassfish 3.0.1 latest build - forgot to mention

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >