Daily Archives

Articles indexed Sunday April 25 2010

Page 7/72 | < Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >

  • Javascript undefined behavior with string.replace

    - by epochwolf
    I've been messing around with string.replace and I noticed something very odd with Webkit and Firebug's javascript consoles. I can repeat this behavior in a blank browser window. (Look at the first and last lines) >>> "/literature?page=".replace(/page=/i, "page=2") "/literature?page=" >>> "/literature?page=".replace("page=", "page=2") "/literature?page=2" >>> "/literature?page=".replace(/page=/, "page=2") "/literature?page=2" >>> "/literature?page=".replace(/page=/i, "page=2") "/literature?page=2" Just so nobody thinks I mistyped something, here are screenshots. Firebug (3.0.14) Webkit (Latest nightly as of this post's creation.)

    Read the article

  • vi script problem on autocmd

    - by schemacs
    I want to create a template for all my python scripts using this autocmd bufnewfile *.py so ~/.vim/templates/python_skeleton.txt the content of python_sekleton.txt is as simple as this: #!/usr/bin/python # -*- coding: utf-8 -*- print 'Hello World' but vi give error message when i start to edit a new python script: line 2: E488: Trailing characters: # -*- coding: utf-8 -*- line 4: E488: Trailing characters: print 'Hello World' it seems '#' is not escaped,and anyone can work it out?thanks i advance

    Read the article

  • Asterisk TDM Out Channel Not Recording

    - by Benny
    I am trying to use the monitor command to record a TDM extension, but only the in chnnnel is being recorded. The out channel is 44 bytes and obviously no audio within. However, when monitoring a SIP or IAX phone, no problems exist. Is there some configuration I'm missing for distinguishing between TDM and SIP/IAX for recording? Thanks in advance!

    Read the article

  • Google App Engine: Unit testing concurrent access to memcache

    - by Phuong Nguyen de ManCity fan
    Would you guys show me a way to simulating concurrent access to memcache on Google App Engine? I'm trying with LocalServiceTestHelpers and threads but don't have any luck. Every time I try to access Memcache within a thread, then I get this error: ApiProxy$CallNotFoundException: The API package 'memcache' or call 'Increment()' was not found I guess that the testing library of GAE SDK tried to mimic the real environment and thus setup the environment for only one thread (the thread that running the test) which cannot be seen by other thread. Here is a piece of code that can reproduce the problem package org.seamoo.cache.memcacheImpl; import org.testng.Assert; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import com.google.appengine.api.memcache.MemcacheService; import com.google.appengine.api.memcache.MemcacheServiceFactory; import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig; import com.google.appengine.tools.development.testing.LocalServiceTestHelper; public class MemcacheTest { LocalServiceTestHelper helper; public MemcacheTest() { LocalMemcacheServiceTestConfig memcacheConfig = new LocalMemcacheServiceTestConfig(); helper = new LocalServiceTestHelper(memcacheConfig); } /** * */ @BeforeMethod public void setUp() { helper.setUp(); } /** * @see LocalServiceTest#tearDown() */ @AfterMethod public void tearDown() { helper.tearDown(); } @Test public void memcacheConcurrentAccess() throws InterruptedException { final MemcacheService service = MemcacheServiceFactory.getMemcacheService(); Runnable runner = new Runnable() { @Override public void run() { // TODO Auto-generated method stub service.increment("test-key", 1L, 1L); try { Thread.sleep(200L); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } service.increment("test-key", 1L, 1L); } }; Thread t1 = new Thread(runner); Thread t2 = new Thread(runner); t1.start(); t2.start(); while (t1.isAlive()) { Thread.sleep(100L); } Assert.assertEquals((Long) (service.get("test-key")), new Long(4L)); } }

    Read the article

  • Slow (to none) performance on SQL 2005 after attaching SQL 2000 database

    - by ploft
    Issue: Using the detach/attach SQL database from a SQL 2000 SP4 instance to a much beefier SQL 2005 SP2 server. Run reindex, reorganize and update statistics a couple of times, but without any success. Queries on SQL 2000 took about 1-2 sec. to complete, now the same queries take 2-3 min on the SQL 2005 (and even 2008 - tested it there also). Have looked at the execution plans and the overall percent matches or are alike on each server.

    Read the article

  • WPF in an MMC snapin

    - by Jason Hocker
    Can someone provide some sample code for using WPF in a custom MMC snapin? I'm new to WPF, and I've understood the samples for writing MMC snapins, but I do not understand how to choose WPF instead of Winforms.

    Read the article

  • How can I restart yum?

    - by Rob
    on my server, yum is using a LOT of system resources. My friend suggested to kill -9 it, but I want to know I'll be able to restart it first. Preferably without rebooting the whole server. However, I'd also like some alternatives, I'd rather know WHY yum is taking up all these resources. I'm fairly new to running servers, so I'd appreciate any help.

    Read the article

  • Haskell Parse Paragraph and em element with Parsec

    - by Tincho
    I'm using Text.ParserCombinators.Parsec and Text.XHtml to parse an input like this: this is the beginning of the paragraph --this is an emphasized text-- and this is the end\n And my output should be: <p>this is the beginning of the paragraph <em>this is an emphasized text</em> and this is the end\n</p> This code parses and returns an emphasized element em = do{ ;count 2 (char '-') ; ;s <- manyTill anyChar (count 2 (char '-')) ;return (emphasize << s) } But I don't know how to get the paragraphs with emphasized items Any ideas? Thanks!!

    Read the article

  • Taking ownership of trustedinstaller files?

    - by P a u l
    vista32-sp1: I am unable to delete some files on my system that were installed with 'special permissions' by 'trustedinstaller'. I find the usual help suggestion to use 'takeown' is not working, all I get is access denied. I refuse to believe there isn't some way to delete these files, or that microsoft has finally acheived their perfect security filesystem. This is NOT a case of a file being locked by a process. If this is all it was, I could solve this by myself. I know there are some recommended unlocking programs and they might do some sort of file system trick, but I would like to know what my possible direct actions might be. If a 3rd party program can 'unlock' a file, I want to know the mechanism. But like I said 'takeown' at the command line is not working for this.

    Read the article

  • What is the best project setup in this situation?

    - by Tong Wang
    The presentation tier will contain 2 web modules (serving different purposes and based on different technologies), the middle tier will be Spring beans without EJBs and the persistence tier will be JPA on Hibernate. I am wondering what would be the best project setup in this case. The IDE I am planning to use is MyEclipse 8.5. Thanks.

    Read the article

  • Java runs out of memory, even though I give it plenty!

    - by spitzanator
    Hey, folks. So, I'm running a java server (specifically Winstone: http://winstone.sourceforge.net/ ) Like this: java -server -Xmx12288M -jar /usr/share/java/winstone-0.9.10.jar --useSavedSessions=false --webappsDir=/var/servlets --commonLibFolder=/usr/share/java This has worked fine in the past, but now it needs to load a bunch more stuff into memory than it has before. The odd part is that, according to 'top', it has 15.0g of VIRT(ual memory) and it's RES(ident set) is 8.4g. Once it hits 8.4g, the CPU hangs at 100% (even though it's loading from disk), and eventually, I get Java's OutOfMemoryError. Presumably, the CPU hanging at 100% is Java doing garbage collection. So, my question is, what gives? I gave it 12 gigs of memory! And it's only using 8.2 gigs before it throws in the towel. What am I doing wrong? Oh, and I'm using java version "1.6.0_07" Java(TM) SE Runtime Environment (build 1.6.0_07-b06) Java HotSpot(TM) 64-Bit Server VM (build 10.0-b23, mixed mode) on Linux. Thanks, Matt

    Read the article

  • HDD Producing high pithched beep noise

    - by POTHEN
    Recently I had an upgrade on one of my PC I added a 512Mb Nvidia Graphic card and 500GB seagate 7200Rpm HDD, Now the new HDD is producing a high pitched squeek/beep i cant really tell and on reboot my XP sector 63 gets corrupted, so I get reboot error. I gave the HDD for replacement but the replaced one too makes the noice, yet the HDD does not produce sound on my gaming rig.

    Read the article

  • Toolbox for Computer Hardware

    - by Chuy77
    I have a lot of computer hardware (hard drives, cables, etc.) and I need a better way to organize. Could anyone recommend a toolbox intended for this sort of thing, or some other good method for storage? I have a two drawer wide file that I currently use, with large plastic bags. It works okay, but I need a better system. Thanks for any advice.

    Read the article

  • Is the javaScript not part of the DOM?

    - by DKinzer
    Why is it that scripts can still function even after the code used to create them is removed from the DOM? I ran into a situation where I wanted to prevent a broken script from running (@see my post). In my attempt to come up with a solution I wrote an extension with the following line (just to see what would happen). //doc is passed here because this script is running as a firefox extension outside //of the document context. $('script', doc).remove(); I assumed that this would remove all the scripts from the DOM, which it did, and that therefore no scripts would run on the page, which is not the case. I would love to know more about what's behind this behavior.

    Read the article

  • How to preload local javascript everytime a new tab or page is opened?

    - by Klerk
    I would like to autoload a local javascript file, everytime a new page/tab is opened in a browser. I tried the bookmarklet approach, but it gets tiresome as the button needs to be pressed everytime a new page/tab is opened. Chrome extensions also seem to work along the same lines (where you have to press an icon to run the js). Googling for javascript and preload seems to return everything except what I am looking for. Is there a browser indepent way of autoloading (no user action required) a local js file? If not, any browser specific info to do this would be appreciated (even if they mean reducing security by turning off required options). Thanks!

    Read the article

  • Why doesn't ifstream read to the end?

    - by user146780
    I'm making a notepad-like program. To get the text from a file I read each character into the buffer by doing while (!file.EOF()) { mystr += file.get(); } however if I load in an exe it stops after MZ but Notepad reads the whole exe. I set my ifstream to binary mode but still no luck. What am I doing wrong? Thanks

    Read the article

  • CustomValidatation control that fire on multiple control events

    - by George
    I am trying to create a UserControl that is a composite control for entering Dates. It involves 2 drop down controls (one for month and one for day) and a text box for year. It also has a CustomValidation control that I would like the user of the UserControl to be able to set the ClientValidationFunction property and have it triggered whenever the value in any of the 3 date part controls changes. To hook up each of the 3 controls to the validation control, I use teh AJAX ValidatorHookupControlID method. If I hard code the following code directly in my aspx page that houses the usercontrol, my Client Validation Function is successfulluy called when any of the 3 date part control values are changed: <script type="text/javascript"> //<![CDATA[ debugger; alert('hooking up'); ValidatorHookupControlID("ctl00_phPageContent_dtmPassportExpirationDate_txtYear", document.all("ctl00_phPageContent_dtmPassportExpirationDate_CustomValidator1")); ValidatorHookupControlID("ctl00_phPageContent_dtmPassportExpirationDate_ddlDate", document.all("ctl00_phPageContent_dtmPassportExpirationDate_CustomValidator1")); ValidatorHookupControlID("ctl00_phPageContent_dtmPassportExpirationDate_ddlMonth", document.all("ctl00_phPageContent_dtmPassportExpirationDate_CustomValidator1")); //]]> However, I would like my usercontrol to emit this Javascript, so I added the following Code. Public Property ClientValidationFunction() As String Get Return CustomValidator1.ClientValidationFunction End Get Set(ByVal value As String) CustomValidator1.ClientValidationFunction = value End Set End Property Public Property EnableClientScript() As Boolean Get Return CustomValidator1.EnableClientScript End Get Set(ByVal value As Boolean) CustomValidator1.EnableClientScript = value End Set End Property Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender If Me.ClientValidationFunction.Trim <> "" AndAlso Me.EnableClientScript Then RegisterValidationScript() End If End Sub Private Sub RegisterValidationScript() Dim Key As String = Me.ClientID & "_ClientValidate" If Not Page.ClientScript.IsClientScriptBlockRegistered(Key) Then Page.ClientScript.RegisterClientScriptBlock(GetType(String), Key, GetJavascript, True) End If End Sub Private Function GetJavascript() As String Dim Out As String = "" Const Quote As String = Chr(34) Out &= "debugger;" & vbCrLf Out &= "ValidatorHookupControlID(" & Quote & txtYear.ClientID & Quote & ", document.all(" & Quote & CustomValidator1.ClientID & Quote & "));" & vbCrLf Out &= "ValidatorHookupControlID(" & Quote & ddlDate.ClientID & Quote & ", document.all(" & Quote & CustomValidator1.ClientID & Quote & "));" & vbCrLf Out &= "ValidatorHookupControlID(" & Quote & ddlMonth.ClientID & Quote & ", document.all(" & Quote & CustomValidator1.ClientID & Quote & "));" & vbCrLf Return Out End Function Unfortunately, when the ValidatorHookupControlID method is called, the second parameter (the one that locates the validation control) always evaluates to null and the method fails. ValidatorHookupControlID("ctl00_phPageContent_DateSelector21_txtYear", document.all("ctl00_phPageContent_DateSelector21_CustomValidator1")); Can you tell me how to correct this error?

    Read the article

  • Hibernate configuration files not found by Axis2

    - by DanJo519
    I am writing a web service to be deployed on Tomcat using Axis2. I am using Hibernate3 to persist data between the web service and a MySQL database. When running the application through by IDE, the method I am exposing through Axis2 works as intended, however when I deploy the .aar to Tomcat, I receive a SOAP Error claiming that hibernate.cfg.xml cannot be found. However, inside the .aar, I clearly see that all the configuration file and all the mapping files are included. I have determined a workaround: If I place the resulting files from the Netbeans build/class folder into the axis2/WEB-INF/class folder, then the application works as expected. My question, then, is is there a better way to deploy my application so that Axis2 will pick up the configuration and mapping files through the deployed .aar without my manually having to copy the contents of the build/class folder into the axis2/WEB-INF/class folder?

    Read the article

< Previous Page | 3 4 5 6 7 8 9 10 11 12 13 14  | Next Page >