Daily Archives

Articles indexed Saturday June 12 2010

Page 1/74 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • javascript regular expression search a pattern A(xyz).

    - by Paul
    I need to find all substrings from a string that starting with a given string following with a left bracket and then any legal literal and then the right bracket. For example, a string is abcd(xyz)efcd(opq), I want to a function that returns "cd(xyz)" and "cd(opq)". I wrote a regular expression, but it returns only cd( and cd(...

    Read the article

  • What is the scope of CONTEXT_INFO in SQL Server?

    - by JasonS
    I am using CONTEXT_INFO to pass a username to a delete trigger for the purposes of an audit/history table. I'm trying to understand the scope of CONTEXT_INFO and if I am creating a potential race condition. Each of my database tables has a stored proc to handle deletes. The delete stored proc takes userId as an parameter, and sets CONTEXT_INFO to the userId. My delete trigger then grabs the CONTEXT_INFO and uses that to update an audit table that indicates who deleted the row(s). The question is, if two deletes sprocs from different users are executing at the same time, can CONTEXT_INFO set in one of the sprocs be consumed by the trigger fired by the other sproc? I've seen this article http://msdn.microsoft.com/en-us/library/ms189252.aspx but I'm not clear on the scope of sessions and batches in SQL Server which is key to the article being helpful! I'd post code, but short on time at the moment. I'll edit later if this isn't clear enough. Thanks in advance for any help.

    Read the article

  • high performance hibernate insert

    - by luke
    I am working on a latency sensitive part of an application, basically i will receive a network event transform the data and then insert all the data into the DB. After profiling i see that basically all my time is spent trying to save the data. here is the code private void insertAllData(Collection<Data> dataItems) { long start_time = System.currentTimeMillis(); long save_time = 0; long commit_time = 0; Transaction tx = null; try { Session s = HibernateSessionFactory.getSession(); s.setCacheMode(CacheMode.IGNORE); s.setFlushMode(FlushMode.NEVER); tx = s.beginTransaction(); for(Data data : dataItems) { s.saveOrUpdate(data); } save_time = System.currentTimeMillis(); tx.commit(); s.flush(); s.clear(); } catch(HibernateException ex) { if(tx != null) tx.rollback(); } commit_time = System.currentTimeMillis(); System.out.println("Save: " + (save_time - start_time)); System.out.println("Commit: " + (commit_time - save_time)); System.out.println(); } The size of the collection is always less than 20. here is the timing data that i see: Save: 27 Commit: 9 Save: 27 Commit: 9 Save: 26 Commit: 9 Save: 36 Commit: 9 Save: 44 Commit: 0 This is confusing to me. I figure that the save should be quick and all the time should be spent on commit. but clearly I'm wrong. I have also tried removing the transaction (its not really necessary) but i saw worse times... I have set hibernate.jdbc.batch_size=20... i need this operation to be as fast as possible, ideally there would only be one roundtrip to the database. How can i do this?

    Read the article

  • ASP.NET Convert to Web App question

    - by mattgcon
    The following web control will not convert for some reason (add designer and cs pages). I am getting a page directive is missing error What is wrong with the code that is causing it to not convert? <%@ Control Language="C#" AutoEventWireup="true" %> <%@ Register TagPrefix="ipam" TagName="tnavbar" src="~/controls/tnavbar.ascx" %> <script language="C#" runat="server"> string strCurrent = ""; string strDepth = ""; public string Current { get { return strCurrent; } set { strCurrent = value; } } public string Depth { get { return strDepth; } set { strDepth = value; } } void Page_Load(Object sender, EventArgs e) { idTnavbar.Current = strCurrent; idTnavbar.Item1Link = strDepth + idTnavbar.Item1Link; idTnavbar.Item2Link = strDepth + idTnavbar.Item2Link; idTnavbar.Item3Link = strDepth + idTnavbar.Item3Link; idTnavbar.Item4Link = strDepth + idTnavbar.Item4Link; idTnavbar.Item5Link = strDepth + idTnavbar.Item5Link; idTnavbar.Item6Link = strDepth + idTnavbar.Item6Link; idTnavbar.Item7Link = strDepth + idTnavbar.Item7Link; } </script> <ipam:tnavbar id="idTnavbar" Item1="2000 -- 2001" Item1Link="2000_--_2001.aspx" Item2="2001 -- 2002" Item2Link="2001_--_2002.aspx" Item3="2002 -- 2003" Item3Link="2002_--_2003.aspx" Item4="2003 -- 2004" Item4Link="2003_--_2004.aspx" Item5="2004 -- 2005" Item5Link="2004_--_2005.aspx" Item6="2005 -- 2006" Item6Link="2005_--_2006.aspx" Item7="2006 -- 2007" Item7Link="2006_--_2007.aspx" runat="server" /> Please help, if I can solve this issue many more pages will be fixed to.

    Read the article

  • One Linux server has two timer

    - by garconcn
    The time on one of our Linux box is very weird. Whenever I call date 3 times, the 4th call will give a wrong time(usually 1 hour later). I have setup cron to sync with ntp server. We have 20+ similar servers, only this one has this problem. Any idea? Thanks. Linux 2.6.18-6-686 #1 SMP Thu Aug 20 21:56:59 UTC 2009 i686 GNU/Linux :~# date Fri Jun 11 17:00:51 PDT 2010 :~# date Fri Jun 11 17:00:52 PDT 2010 :~# date Fri Jun 11 17:00:53 PDT 2010 :~# date Fri Jun 11 18:14:12 PDT 2010 :~# date Fri Jun 11 17:00:55 PDT 2010 :~# date Fri Jun 11 17:00:56 PDT 2010 :~# date Fri Jun 11 17:00:56 PDT 2010 :~# date Fri Jun 11 18:14:15 PDT 2010 :~# date Fri Jun 11 17:00:58 PDT 2010 :~# date Fri Jun 11 17:00:58 PDT 2010 :~# date Fri Jun 11 17:00:59 PDT 2010 :~# date Fri Jun 11 18:14:18 PDT 2010 :~# date Fri Jun 11 17:01:01 PDT 2010 :~# date Fri Jun 11 17:01:01 PDT 2010 :~# date Fri Jun 11 17:01:02 PDT 2010 :~# date Fri Jun 11 18:14:21 PDT 2010 :~# date Fri Jun 11 17:01:03 PDT 2010 :~# date Fri Jun 11 17:01:04 PDT 2010 :~# date Fri Jun 11 17:01:05 PDT 2010

    Read the article

  • Benefit for implementing OAuth

    - by zfranciscus
    Hi, I am just wondering from a webservice provider point of view what is the benefit of asking users to create an account or login using 3rd party web service provider e.g: Twitter or facebook. Wouldn't it be easier to ask the user to provide their twitter or facebook login and use that to pull the user's twitter or facebook data. I can understand the benefit of using From user point of view using OAuth provide security. It is safer to use OAuth than giving some one the internet our twitter or facebook login credential. But some how I can't figure out the benefit from the web service point of view. Thank you. Cheers

    Read the article

  • Clipping users cursor around the X button.

    - by Nowayz
    This should be simple, and I was hoping to do it in Delphi. The purpose of this is just supposed to be a joke. On a windows form application I don't want the user to be able to clip the X button on the main form. I want the cursor to either clip around the X button or just set it's position elsewhere.

    Read the article

  • Annotation to make available generic type

    - by mdma
    Given an generic interface like interface DomainObjectDAO<T> { T newInstance(); add(T t); remove(T t); T findById(int id); // etc... } I'd like to create a subinterface that specifies the type parameter: interface CustomerDAO extends DomainObjectDAO<Customer> { // customer-specific queries - incidental. } The implementation needs to know the actual template parameter type, but of course type erasure means isn't available at runtime. Is there some annotation that I could include to declare the interface type? Something like @GenericParameter(Customer.class) interface CustomerDAO extends DomainObjectDAO<Customer> { } The implementation could then fetch this annotation from the interface and use it as a substitute for runtime generic type access. Some background: This interface is implemented using JDK dynamic proxies as outlined here. The non-generic version of this interface has been working well, but it would be nicer to use generics and not have to create a subinterface for each domain object type. The actual type is needed at runtime to implement the newInstance method, amongst others.

    Read the article

  • ps forrest for session id

    - by azatoth
    Often I want to get a nice readout what process are running and their relationship; I usually by habit runs ps auxfww and eventual grep for the process in question. Having been thinking about the problem I tried to create an oneliner to get the process tree in ps ufww format for all processes which has the session id specified by arbitrary process name(s); ending up in following code: ps ufww --sid=$(ps -C apache2 -o sess --no-headers | sort | uniq | grep -v -E '^ +0$' | awk 'NR==1{x=$0;next}NF{x=x","$0};END{gsub(/[[:space:]]*/,"",x);print x}') giving for example following output: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 4157 0.0 0.1 41264 3120 ? Ss Jun11 0:00 /usr/sbin/apache2 -k start www-data 4329 0.0 0.0 41264 1976 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 4330 0.0 0.0 41264 2028 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 4331 0.0 0.0 41264 2028 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 4332 0.0 0.0 41264 2028 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 4333 0.0 0.0 41264 2032 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 6648 0.0 0.0 41264 1884 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 6654 0.0 0.0 41264 1884 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start www-data 6655 0.0 0.0 41264 1884 ? S Jun11 0:00 \_ /usr/sbin/apache2 -k start I do wonder now if anyone has an better idea to solve this issue? Are there anything out there that is easier to "oneline" and gives above or better information? For example I would actually want to have included all childs relative any parent. (uncertain if this should be on SF instead, but felt it was more like an programming question)

    Read the article

  • Help solving a error in openGL

    - by peiska
    Hi, I am making a group work in openGL, and when i try to open the file that my partner gave me i have this error: -------------- Build: Debug in CG --------------- Linking console executable: bin/Debug/CG ld: library not found for -lGL collect2: ld returned 1 exit status Process terminated with status 1 (0 minutes, 0 seconds) 0 errors, 0 warnings I've seen the same code working in his computer. Is it cause he is working in Windows? and i am working in MacOSX? I am using CodeBlocks IDE. Can anyone help me solving this?

    Read the article

  • Reachability sometimes fails, even when we do have an internet connection

    - by stoutyhk
    Hi I've searched but can't see a similar question. I've added a method to check for an internet connection per the Reachability example. It works most of the time, but when installed on the iPhone, it quite often fails even when I do have internet connectivity (only when on 3G/EDGE - WiFi is OK). Basically the code below returns NO. If I switch to another app, say Mail or Safari, and connect, then switch back to the app, then the code says the internet is reachable. Kinda seems like it needs a 'nudge'. Anyone seen this before? Any ideas? Many thanks James + (BOOL) doWeHaveInternetConnection{ BOOL success; // google should always be up right?! const char *host_name = [@"google.com" cStringUsingEncoding:NSASCIIStringEncoding]; SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(NULL, host_name); SCNetworkReachabilityFlags flags; success = SCNetworkReachabilityGetFlags(reachability, &flags); BOOL isAvailable = success && (flags & kSCNetworkFlagsReachable) && !(flags & kSCNetworkFlagsConnectionRequired); if (isAvailable) { NSLog(@"Google is reachable: %d", flags); }else{ NSLog(@"Google is unreachable"); } return isAvailable; }

    Read the article

  • C++ namespace alias and forward declaration

    - by Dave
    I am using a C++ third party library that places all of its classes in a versioned namespace, let's call it tplib_v44. They also define a generic namespace alias: namespace tplib = tplib_v44; If a forward-declare a member of the library in my own .h file using the generic namespace... namespace tplib { class SomeClassInTpLib; } ... I get compiler errors on the header in the third-party library (which is being included later in my .cpp implementation file): error C2386: 'tplib' : a symbol with this name already exists in the current scope If I use the version-specific namespace, then everything works fine, but then ... what's the point? What's the best way to deal with this?

    Read the article

  • rsync from OS X to Ubuntu failing for large (>15GB) files

    - by johnny_bgoode
    I'm trying to rsync a 15 GB file from my OSX box to a box running Ubuntu 10.04 server. rsync is transferring ~300-700Mb and then closing the connection with the following error: Read from remote host my.host.name: Connection reset by peer rsync: writefd_unbuffered failed to write 4 bytes [sender]: Broken pipe (32) rsync: connection unexpectedly closed (397214 bytes received so far) [sender] rsync error: unexplained error (code 255) at /SourceCache/rsync/rsync-40/rsync/io.c(452) [sender=2.6.9] The exact command I am executing is: rsync --progress --archive --inplace my.15GB.file.tgz my.host.name:~/ I am sure that there is enough free space on the Ubuntu box. Any ideas what could be causing the connection to drop?

    Read the article

  • Any way to change Phppgadmin view order of columns without changing underlying db

    - by nick
    Hey everyone, Is there any way to change the order of the columns phppgadmin views when browsing tables without having to change the underlying db? I have a few columns that I want seperated by heaps of unimportant ones and then a few more important ones at the end. The problem is that the important ones on the right are way of the screen so its hard to check visually if data has been inputed correctly. Cheers

    Read the article

  • Returned content type - Restlet

    - by DutrowLLC
    How do you set the content type in Restlet? In this case, I'd like to set the content type to ""text/xml". I have: public class SubResource extends ServerResource { @Get public Representation get(Representation representation){ setStatus(Status.SUCCESS_OK); StringRepresentation sr = new StringRepresentation(getSomeXml()); return sr; } } I'm unsure even if it is a value that is set in the Representation, or if it is set from the ServerResource class the same way that the return code is.

    Read the article

  • Selecting an option by it's value

    - by Ross
    I'm trying to run this jQuery selector: $("#label option[value=\"newLabel\"]") On the following code: <select name="label" id="label"> <option value="1" label="testLabel">testLabel</option> <option value="newLabel" label="New Label">New Label</option> </select> But the selector just won't find it - can anyone spot where I'm going wrong?

    Read the article

  • Possible to set monthCalendar to show current month and previous 2 months?

    - by John M
    In a WinForms (3.5) application there is form with a monthCalendar control. The calendar control has a calendarDimension of 3 columns by 1 row. This means that it currently shows June, July, August of 2010. Is it possible to have the calendar to show April, May, June of 2010 instead? My dataset doesn't have any future dates so the date selection will be for current or older dates.

    Read the article

  • spring security login pages?

    - by es11
    I have some confusion with how spring security works: In my application, I need to have a login page for users after which they are redirected back the page from where they came. I went through a few spring security tutorials and read some articles, and the examples work by securing a certain page on a site (managed by the <intercept url ..> tag). Then Spring security will generate a login page (or you can specify your own) in order to access the secured page. I am confused because I don't want to necessary secure a given page on my site: I want a login page for users to log into after which they have access to elevated features of the site (through spring security's authorization features). My question is: given what I described, what would be the strategy to create this login page which, after login, would grant the logged in user the appropriate authorities? The hack I thought of would be to create a simple JSP page who's only function is to redirect back to the previous page. Then I would use Spring Security to secure that JSP page. But it seems like there should be a better way of doing this... Thanks

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >