Daily Archives

Articles indexed Saturday March 27 2010

Page 10/84 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Regular Expression to validate a timestamp

    - by Mohit Nanda
    Hi, I need a regular expression to validate a timestamp of the format, using Javascript: YYYY/MM/DD HH:MI:SS I tried cooking up a few, but seems my regex skills fail to cover something or other. Please give me a reference or way to do it. P.S. : I mention regex, only as a suggestion. Im using Javascript and welcome any alternative.

    Read the article

  • Call named routes in CakePHP as the same way in Ruby on Rails

    - by Lucas Renan
    How can I call a route (in the view) in CakePHP as the same way in Rails? Ruby on Rails routes.rb map.my_route '/my-route', :controller => 'my_controller', :action => 'index' view link_to 'My Route Name', my_route_path CakePHP routes.php Router::connect('/my-route', array('controller' => 'my_controller', 'action' => 'index')); view $html->link('My Route Name', '/my-route'); But I think the Rails way is better, because I can make changes in the "url" and I don't need changes the code of the views.

    Read the article

  • WPF DataGrid ComboBox Column: Propagating Header Combobox throughout column...

    - by LostKaleb
    Hey there! Here's my question: I've got a Datagrid in WPF and I have a first column that is a DataGridComboBoxColumn. What I'd like to do is to have a header for that column also with a combobox: altering the header with propagate throughout the column. I can get this done visually, but when I submit the data, the list that is bound with the Datagrid does not carry the new combobox values. <dg:DataGridComboBoxColumn SelectedItemBinding="{Binding BIBStatus}" ItemsSource="{Binding Source={StaticResource typeStatus}}" Width="0.20*"> <dg:DataGridComboBoxColumn.HeaderTemplate> <DataTemplate> <StackPanel> <TextBlock Text="Built-In Bridge"/> <ComboBox SelectedItem="{Binding BIBStatus}" SelectionChanged="ComboBox_SelectionChanged" ItemsSource="{Binding Source={StaticResource typeStatus}}"/> </StackPanel> </DataTemplate> </dg:DataGridComboBoxColumn.HeaderTemplate> </dg:DataGridComboBoxColumn> In the ComboBox_SelectionChanged I have the following code: DataGridColumn comboCol = this.gridResults.Columns[0]; for (int i = 0; i < this.gridResults.Items.Count; i++) { ComboBox myCmBox = (comboCol.GetCellContent(this.gridResults.Items[i]) as ComboBox); myCmBox.SelectedValue = ((ComboBox)sender).SelectedValue; } When I submit the data, I submit the list that is DataContext to the Datagrid; if I change the value of the first column addressing a row at a time, i.e. clicking the cell with the combobox in each row, the values are propagated to the list in DataContext, however if I change the value of the first column by the header it does not. Can anyone tell me what I'm missing? I'm guessing it's the way I affect each row, but I've tried SelectedValue, SelectedItem and SelectedIndex... all to no avail. Thanks in advance...

    Read the article

  • ASP.NET Dynamically filtering data

    - by Jasper
    For a project I'm working on, we're looking for a way to dynamically add filters to a page which then control the dataoutput in, for instance, a grid. We want to add the filters dynamically because we want the customer to be able to change which properties can be filtered and what filtertype (textbox, dropdown, colourpicker, etc.) should be used. The filter should work as follows: - The customer links a filter to a certain property and specifies the filtertype (for this example: dropdown). - A user control which contains all the filter loads all filters specified - The filters load all values of the specified property as options. The first time the page loads; this would be the values of all items. - Now the user selects a value from one of the filters; the page reloads - Only items which have the specified filter value are retrieved, the user may specify one or more filters at the same time. - Once a user drills down by filtering, only filtervalues of the retrieved items should be used in the other filters. I have the following problems: - When I create the filters runtime, events are lost because the controls get recreated each postback. - I could place the filters in PreInit which should solve this, but then determining which controls should be loaded becomes a problem since loading all environment vars isn't finished yet - I don't know a good way of returning all the filter values to a central point from which I can make a good query. - The query has to be dynamic. I'm using linq which I want to make dynamic so I don't have to select everything everytime. How to make a dynamic select query based on a string stored in the database? - I have to select items based on the filtervalues and then adjust the rest of the filters to the already made selection. That kind of messes up the whole regular databinding sequence. Any help in one of the above would be great! PS: One thing I thought about was passing along filter values in the postback which would have to be recognizable. That way the server could use them for selection and then create the filters and autoselect the previously selected filtervalues. I'm not quite sure how to acheive this though...

    Read the article

  • (VB.NET + WPF) Drag + Drop (to allow user sorting) of stackpanel elements within a Scrollviewer?

    - by Matt H.
    I have good model (I think!) for how to allow a user to drag an element in a stackpanel and reposition it to another location within the stackpanel. However, my Stackpanel is placed within a ScrollViewer, like this (generalized): <ScrollViewer> <StackPanel> ....First item ....Second item ....Third item ....Etc. </StackPanel> <ScrollViewer> Here is the problem, I wish to simulate the functionality of programs like word, where if I am dragging selected content (or an object) outside the viewable area, the window will scroll in the direction of the mouse to see more places to drop my nifty little object. ...i.e. If I move the mouse to the top of my ScrollViewer while dragging a stackpanel's contents, I want the scrollviewer to slowly move up so I can see more locations to drop my content. Any suggestions? If you can help me solve this, you will be a godsend!

    Read the article

  • Why does PuTTYcyg display â instead of hyphen in man pages?

    - by gbacon
    I've been using PuTTYcyg as a Cygwin terminal, but it doesn't render dashes in manual pages correctly. For example, the top of man gcc looks like GCC(1) GNU GCC(1) NAME gcc â GNU project C and C++ compiler SYNOPSIS gcc [âc|âS|âE] [âstd=standard] [âg] [âpg] [âOlevel] [âWwarn...] [âpedantic] [âIdir...] [âLdir...] [âDmacro[=defn]...] [âUmacro] [âfoption...] [âmmachineâoption...] [âo outfile] infile... Changing fonts doesn't help. How can I fix this?

    Read the article

  • Using FFmpeg in c#?

    - by daniel
    So i know its a fairly big challenge but i want to write a basic movie player/converter in c# using the FFmpeg library. However the first obstacle i need to overcome is wrapping the FFmpeg library in c#. I downloaded ffmpeg but couldn't compile it on windows, so i downloaded a precompiled version for me. Ok awesome. Then i started looking for c# wrappers. I have looked around and have found a few wrappers such as SharpFFmpeg (http://sourceforge.net/projects/sharpffmpeg/) and ffmpeg-sharp (http://code.google.com/p/ffmpeg-sharp/). First of all i wanted to use ffmpeg-sharp as its LGPL and SharpFFmpeg is GPL. However it had quite a few compile errors. Turns out it was written for the mono compiler, i tried compiling it with mon but couldn't figure out how. I then started to manually fix the compiler errors myself, but came across a few scary ones and thought i'd better leave those alone. So i gave up on ffmpeg-sharp. Then i looked at SharpFFmpeg and it looks like what i want, all the functions P/Invoked for me. However its GPL? Both the AVCodec.cs and AVFormat.cs files look like ports of avcodec.c and avformat.c which i reckon i could port myself? Then not have to worry about licencing. But i wan't to get this right before i go ahead and start coding. Should I: Write my own c++ library for interacting with ffmpeg, then have my c# program talk to the c++ library in order to play/convert videos etc. OR Port avcodec.h and avformat.h (is that all i need?) to c# by using a whole lot of DllImports and write it entirely in c#? First of all consider that i'm not great at c++ as i rarely use it but i know enough to get around. The reason i'm thinking #1 might be the better option is that most FFmpeg tutorials are in c++ and i'd also have more control over memory management that if i was to do it in c#. What do you think? Also would you happen to have any usefull links (perhaps a tutorial) for using FFmpeg? EDIT: spelling mistakes

    Read the article

  • streaming XML serialization in .net

    - by Luca Martinetti
    Hello, I'm trying to serialize a very large IEnumerable<MyObject> using an XmlSerializer without keeping all the objects in memory. The IEnumerable<MyObject> is actually lazy.. I'm looking for a streaming solution that will: Take an object from the IEnumerable<MyObject> Serialize it to the underlying stream using the standard serialization (I don't want to handcraft the XML here!) Discard the in memory data and move to the next I'm trying with this code: using (var writer = new StreamWriter(filePath)) { var xmlSerializer = new XmlSerializer(typeof(MyObject)); foreach (var myObject in myObjectsIEnumerable) { xmlSerializer.Serialize(writer, myObject); } } but I'm getting multiple XML headers and I cannot specify a root tag <MyObjects> so my XML is invalid. Any idea? Thanks

    Read the article

  • Maven struts2 modular archetype failing to generate !

    - by Xinus
    I am trying to generate struts 2 modular archetype using maven but always getting error as archetype not present here is a full output : C:\Users\Administrator>mvn archetype:generate [INFO] Scanning for projects... [INFO] Searching repository for plugin with prefix: 'archetype'. [INFO] ------------------------------------------------------------------------ [INFO] Building Maven Default Project [INFO] task-segment: [archetype:generate] (aggregator-style) [INFO] ------------------------------------------------------------------------ [INFO] Preparing archetype:generate [INFO] No goals needed for project - skipping [INFO] Setting property: classpath.resource.loader.class => 'org.codehaus.plexus .velocity.ContextClassLoaderResourceLoader'. [INFO] Setting property: velocimacro.messages.on => 'false'. [INFO] Setting property: resource.loader => 'classpath'. [INFO] Setting property: resource.manager.logwhenfound => 'false'. [INFO] [archetype:generate {execution: default-cli}] [INFO] Generating project in Interactive mode [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven. archetypes:maven-archetype-quickstart:1.0) Choose archetype: 1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web applicati on with Hibernate, Spring and JSF) 2: internal -> appfuse-basic-spring (AppFuse archetype for creating a web applic ation with Hibernate, Spring and Spring MVC) 3: internal -> appfuse-basic-struts (AppFuse archetype for creating a web applic ation with Hibernate, Spring and Struts 2) 4: internal -> appfuse-basic-tapestry (AppFuse archetype for creating a web appl ication with Hibernate, Spring and Tapestry 4) 5: internal -> appfuse-core (AppFuse archetype for creating a jar application wi th Hibernate and Spring and XFire) 6: internal -> appfuse-modular-jsf (AppFuse archetype for creating a modular app lication with Hibernate, Spring and JSF) 7: internal -> appfuse-modular-spring (AppFuse archetype for creating a modular application with Hibernate, Spring and Spring MVC) 8: internal -> appfuse-modular-struts (AppFuse archetype for creating a modular application with Hibernate, Spring and Struts 2) 9: internal -> appfuse-modular-tapestry (AppFuse archetype for creating a modula r application with Hibernate, Spring and Tapestry 4) 10: internal -> maven-archetype-j2ee-simple (A simple J2EE Java application) 11: internal -> maven-archetype-marmalade-mojo (A Maven plugin development proje ct using marmalade) 12: internal -> maven-archetype-mojo (A Maven Java plugin development project) 13: internal -> maven-archetype-portlet (A simple portlet application) 14: internal -> maven-archetype-profiles () 15: internal -> maven-archetype-quickstart () 16: internal -> maven-archetype-site-simple (A simple site generation project) 17: internal -> maven-archetype-site (A more complex site project) 18: internal -> maven-archetype-webapp (A simple Java web application) 19: internal -> jini-service-archetype (Archetype for Jini service project creat ion) 20: internal -> softeu-archetype-seam (JSF+Facelets+Seam Archetype) 21: internal -> softeu-archetype-seam-simple (JSF+Facelets+Seam (no persistence) Archetype) 22: internal -> softeu-archetype-jsf (JSF+Facelets Archetype) 23: internal -> jpa-maven-archetype (JPA application) 24: internal -> spring-osgi-bundle-archetype (Spring-OSGi archetype) 25: internal -> confluence-plugin-archetype (Atlassian Confluence plugin archety pe) 26: internal -> jira-plugin-archetype (Atlassian JIRA plugin archetype) 27: internal -> maven-archetype-har (Hibernate Archive) 28: internal -> maven-archetype-sar (JBoss Service Archive) 29: internal -> wicket-archetype-quickstart (A simple Apache Wicket project) 30: internal -> scala-archetype-simple (A simple scala project) 31: internal -> lift-archetype-blank (A blank/empty liftweb project) 32: internal -> lift-archetype-basic (The basic (liftweb) project) 33: internal -> cocoon-22-archetype-block-plain ([http://cocoon.apache.org/2.2/m aven-plugins/]) 34: internal -> cocoon-22-archetype-block ([http://cocoon.apache.org/2.2/maven-p lugins/]) 35: internal -> cocoon-22-archetype-webapp ([http://cocoon.apache.org/2.2/maven- plugins/]) 36: internal -> myfaces-archetype-helloworld (A simple archetype using MyFaces) 37: internal -> myfaces-archetype-helloworld-facelets (A simple archetype using MyFaces and facelets) 38: internal -> myfaces-archetype-trinidad (A simple archetype using Myfaces and Trinidad) 39: internal -> myfaces-archetype-jsfcomponents (A simple archetype for create c ustom JSF components using MyFaces) 40: internal -> gmaven-archetype-basic (Groovy basic archetype) 41: internal -> gmaven-archetype-mojo (Groovy mojo archetype) Choose a number: (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/2 4/25/26/27/28/29/30/31/32/33/34/35/36/37/38/39/40/41) 15: : 8 [INFO] ------------------------------------------------------------------------ [ERROR] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] The defined artifact is not an archetype [INFO] ------------------------------------------------------------------------ [INFO] For more information, run Maven with the -e switch [INFO] ------------------------------------------------------------------------ [INFO] Total time: 3 seconds [INFO] Finished at: Sat Mar 27 08:22:38 IST 2010 [INFO] Final Memory: 8M/21M [INFO] ------------------------------------------------------------------------ C:\Users\Administrator> What can be the problem ?

    Read the article

  • Connecting XRAID to Sunfire via LSI FC card - Drives not showing up

    - by Matthew Watson
    Hi, I've got a Sunfire T1000 machine ( Solaris 10 10/09 s10s_u8wos_08a SPARC ) with a LSI7404EP-LC fibre channel card in it. This is plugged into an XRAID. The system seems to have picked up the card > /usr/platform/`uname -i `/sbin/prtdiag IO Location Type Slot Path Name Model ----------- ----- ---- --------------------------------------------- ------------------------- --------- MB/PCIE0 PCIE 0 /pci@780/fibre-channel fibre-channel MB/PCIE0 PCIE 0 /pci@780/fibre-channel fibre-channel MB/NET0 PCIE MB /pci@7c0/pci@0/network@4 network-pci14e4,1668 MB/NET1 PCIE MB /pci@7c0/pci@0/network@4,1 network-pci14e4,1668 MB/NET2 PCIX MB /pci@7c0/pci@0/pci@8/network@1 network-pci108e,1648 MB/NET3 PCIX MB /pci@7c0/pci@0/pci@8/network@1,1 network-pci108e,1648 MB/PCIX PCIX MB /pci@7c0/pci@0/pci@8/scsi@2 scsi-pci1000,50 LSI,1064 However it doesn't seem to be able to see the xraid attached to it, lsiutil only reports the onboard SAS controller. > /usr/local/bin/lsiutil ~ LSI Logic MPT Configuration Utility, Version 1.62, January 14, 2009 1 MPT Port found Port Name Chip Vendor/Type/Rev MPT Rev Firmware Rev IOC 1. mpt0 LSI Logic SAS1064 A3 105 010a0000 0 Select a device: [1-1 or 0 to quit] I've tried adding the configuration to /kernal/drv/sd.conf and /kernal/drv/ssd.conf as per this thread, however format still cannot see any drives on the xraid. I'm not sure where to go next. Any suggestions? From what I've read..this should pretty much just eb plug it in and they show up in format..

    Read the article

  • Linux: How do I remove bootchart from the boot process?

    - by java.is.for.desktop
    Hello, everyone! I have OpenSUSE 11.2. I removed bootchart and forgot to run mkinitrd. Now, right at the start of the boot process, I get boot/93-bootchart.sh: line 17: 462 Terminated stopinitrd 5 I Can't find any 93-bootchart.sh anywhere. Failsafe boot mode doesn't help. Earlier I got an error message about non existing /sbin/bootchartd, but I just copied /bin/cat to /sbin/bootchartd using a GParted boot disk. I tried to use chroot with an OpenSUSE boot disk, but mkinitrd can't find the root device, which is there actually (/dev/sda5). How can I make my system boot again? EDIT Ok, now I managed to re-install the bootchart rpm, using OpenSUSE boot disk and chmod. The system starts again. But that annoying bootchart is still there. I will not try again to remove it. First I will try to figure out, how to disable it during the boot process. Hopefully with your help ;)

    Read the article

  • Raw FTP SSL with C#

    - by Chuck
    Hi, I'm trying to understand how SSL works. In my wish to make a small FTP client which supports SSL I've run into some problems: TcpClient FtpConnection = new TcpClient(FtpServer, FtpPort); NetworkStream FtpStream = FtpConnection.GetStream(); StreamReader FtpReader = new StreamReader(FtpStream); FtpWriter = new StreamWriter(IrcStream); send_cmd("AUTH SSL"); send_cmd is just a FtpWriter.WriteLine(text); FtpWriter.Flush(); function. My "problem" is this: First I need to make a (non-ssl) connection to the FTP, then tell it to do a ssl connection (AUTH SSL), and I would guess I then need to make a new connection - something like: TcpClient client = new TcpClient(FtpServer, FtpPort); SslStream sslStream = new SslStream(client.GetStream(), false, new RemoteCertificateValidationCallback(ValidateServerCertificate), null); try { sslStream.AuthenticateAsClient("foobar"); } catch (AuthenticationException e) { MessageBox.Show("Authentication failed - closing the connection."); client.Close(); return; } Taken from msdn. I keep dying on handshake failed due to unexpected packet format (which I've tried googling, but all say it's because the author has connected to a wrong port), which I take as: The connection is not ssl until AUTH SSL is send to it. So my question is, how would i go about making this a "hybrid" connection so I can make an SSL connection to the server? Any help is greatly appreciated!

    Read the article

  • django-registration with paypal integration

    - by GrumpyCanuck
    I'm trying to figure out how to integrate django-registration with django-paypal. Being a Django n00b, I'm trying to figure out how to implement a flow like this: User signs up using django-registation with 'active' flag set to 0 After registering, send user to PayPal for a subscription When they come back from PayPal successfully, I want to set 'active' to 1 I've been looking at the django-registration documentation and don't quite understand how to use different backends or implement a flow the way I want. Any tips on how to accomplish this would be greatly appreciated. django-paypal won't be a problem for me as I've done PayPal integration before (in PHP for a self-published book about CakePHP).

    Read the article

  • Silverlight MouseLeftButtonDown event not firing

    - by Matt
    For the life of me, I can not get this to work. I can get MouseEnter, MouseLeave, and Click events to fire, but not MouseLeftButtonDown or MouseLeftButtonUp. Here's my XAML <UserControl x:Class="Dive.Map.MainPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" > <Canvas x:Name="LayoutRoot" MouseLeftButtonDown="LayoutRoot_MouseLeftButtonDown"> <Button x:Name="btnTest" Content="asdf" Background="Transparent" MouseLeftButtonDown="btnTest_MouseLeftButtonDown"></Button> </Canvas> </UserControl> And here's my code public partial class MainPage : UserControl { public MainPage() { InitializeComponent(); } private void btnTest_MouseLeftButtonDown( object sender, MouseButtonEventArgs e ) { btnTest.Content = DateTime.Now.ToString(); } private void LayoutRoot_MouseLeftButtonDown( object sender, MouseButtonEventArgs e ) { e.Handled = false; } } What am I doing wrong?

    Read the article

  • Weird behaviour of C++ destructors

    - by Vilx-
    #include <iostream> #include <vector> using namespace std; int main() { vector< vector<int> > dp(50000, vector<int>(4, -1)); cout << dp.size(); } This tiny program takes a split second to execute when simply run from the command line. But when run in a debugger, it takes over 8 seconds. Pausing the debugger reveals that it is in the middle of destroying all those vectors. WTF? Note - Visual Studio 2008 SP1, Core 2 Duo 6700 CPU with 2GB of RAM. Added: To clarify, no, I'm not confusing Debug and Release builds. These results are on one and the same .exe, without even any recompiling inbetween. In fact, switching between Debug and Release builds changes nothing.

    Read the article

  • Simplest way to handle and display errors in a Python Pylons controller without a helper class

    - by ensnare
    I have a class User() that throw exceptions when attributes are incorrectly set. I am currently passing the exceptions from the models through the controller to the templates by essentially catching exceptions two times for each variable. Is this a correct way of doing it? Is there a better (but still simple) way? I prefer not to use any third party error or form handlers due to the extensive database queries we already have in place in our classes. Furthermore, how can I "stop" the chain of processing in the class if one of the values is invalid? Is there like a "break" syntax or something? Thanks. >>> u = User() >>> u.name = 'Jason Mendez' >>> u.password = '1234' Traceback (most recent call last): File "<stdin>", line 1, in <module> File "topic/model/user.py", line 79, in password return self._password ValueError: Your password must be greater than 6 characters In my controller "register," I have: class RegisterController(BaseController): def index(self): if request.POST: c.errors = {} u = User() try: u.name = c.name = request.POST['name'] except ValueError, error: c.errors['name'] = error try: u.email = c.email = request.POST['email'] except ValueError, error: c.errors['email'] = error try: u.password = c.password = request.POST['password'] except ValueError, error: c.errors['password'] = error try: u.commit() except ValueError, error: pass return render('/register.mako')

    Read the article

  • Check how old an Oracle database is?

    - by Jamie
    Hi all, So, we have a mirror of a santized version of the production database. Is there anyway (that you know of) to find out how old the database is? i.e. when the database was put on the Oracle server. Thanks for any help!

    Read the article

  • How can I set a counter column value in MySQL?

    - by Jon Tackabury
    I have a table with a "SortID" column that is numbered using consecutive numbers. Whenever a row is deleted, it leaves a gap. Is there a way using pure SQL to update the rows with their row number? Something like this: UPDATE tbl SET SortID={rowindex} ORDER BY SortID (I realize this isn't valid SQL, that's why I'm asking for help) This should set the first row to #1, the second row to #2... etc. Is this possible using SQL? Please forgive the poorly worded question, I'm not really sure the best way to ask this. :)

    Read the article

  • Cannot login with PhpMyAdmin on Mac os x 10.6. Does anyone know a fix to this error message?

    - by Jannis
    Hi, I just reinstalled Mac Os X 10.6.2 and had to reinstall/update my MySQL server. I run phpMyAdmin inside my localhost and I used to be able to login without a hitch. Since the updated (latest version MySQL 5.1.45 & PMA 3.3.1) versions I only get the following error when trying to login with phpMyAdmin: phpMyAdmin - Error Cannot start session without errors, please check errors given in your PHP and/or webserver log file and configure your PHP installation properly. The only thing I noticed is that mcrypt cannot be loaded (this has always been the case, no idea what to do to install this..) but this has never been a problem before. If anyone know what to do here that would be really appreciated. Thanks for reading, Jannis PS: The MySQL server itself is running and I am able to login with as root user via the MySQL Administrator.app

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >