Search Results

Search found 33 results on 2 pages for 'prg'.

Page 1/2 | 1 2  | Next Page >

  • PRG Pattern and Sticky Forms

    - by Scott Christopherson
    I'm using the PRG pattern on a form of mine. I've never used this approach before and I'm trying to figure something out: Normally, I always just displayed the posted form again when there were validation errors and displayed POST values in the form (sticky form). However with the PRG pattern, the form is displayed after a redirect, so there aren't any POST values. So my question is, how can I implement the PRG pattern and still have sticky forms?

    Read the article

  • PRG in ASP.NET MVC but with object data transferred to the redirected action

    - by mare
    Following Post-Redirect-Get pattern as described in various spots but maybe in most detail here by Stephen Walter I want to use RedirectToAction but it does not accept a parameter for sending object to it. I can only send route values either as an object or as an RouteValueDictionary. So currently I send object ID and type and pull the object out of the datastore again in the action to which I redirected (like Results). // redirect to confirm view return RedirectToAction("ChangeSuccess", "Redirect", new { slug = tabgroup.Slug, contentType = tabgroup.ContentType }); But I would like to send an object there because I already have it in my updating controller action so I don't need to pull it out again. Is that possible somehow?

    Read the article

  • rewrite map (prg:) never finishes

    - by SooDesuNe
    using Apache and a prg type rewrite map. My map looks like: #!/usr/bin/perl $| = 1; # Turn off buffering while (<STDIN>) { print "someothersite.com"; } the rewrite rule declared in httpd.conf is: RewriteMap app_map prg:/file/path/test.pl RewriteRule (\/[\w]+)(\/[^\#\s]+)?$ http://${app_map:$1}$2 [P,L] And the log files show: init rewrite engine with requested uri /a/testlink.html applying pattern '(\/[\w]+)(\/[^\#\s]+)?$' to uri '/a/testlink.html' It appears like test.pl is never giving control back to apache, when the map is successfully found I expect to see this output in the log file: map lookup OK: map=app_map key=/a -> val=someothersite.com Why is my map not returning control back to apache?

    Read the article

  • Post/Redirect/Get Pattern and Sticky Forms

    - by Scott Christopherson
    I'm using the Post/Redirect/Get pattern on a form of mine. I've never used this approach before and I'm trying to figure something out: Normally, I always just displayed the posted form again when there were validation errors and displayed POST values in the form (sticky form). However with the PRG pattern, the form is displayed after a redirect, so there aren't any POST values. So my question is, how can I implement the PRG pattern and still have sticky forms?

    Read the article

  • PowerShell remove force

    - by mausch
    Trying to delete a directory recursively with rm -Force -Recurse somedirectory, I get several "The directory is not empty" errors. If I retry the same command, it succeeds. Example: PS I:\Documents and Settings\m\My Documents\prg\net> rm -Force -Recurse .\FileHelpers Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\FileHelpers.Tests\Data\RunTime\_svn: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (_svn:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\FileHelpers.Tests\Data\RunTime: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (RunTime:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\FileHelpers.Tests\Data: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (Data:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\FileHelpers.Tests: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (FileHelpers.Tests:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\Libs\nunit\_svn: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (_svn:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\Libs\nunit: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (nunit:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers\Libs: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (Libs:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand Remove-Item : Cannot remove item I:\Documents and Settings\m\My Documents\prg\net\FileHelpers: The directory is not empty. At line:1 char:3 + rm <<<< -Force -Recurse .\FileHelpers + CategoryInfo : WriteError: (I:\Documents an...net\FileHelpers:DirectoryInfo) [Remove-Item], IOException + FullyQualifiedErrorId : RemoveFileSystemItemIOError,Microsoft.PowerShell.Commands.RemoveItemCommand PS I:\Documents and Settings\m\My Documents\prg\net> rm -Force -Recurse .\FileHelpers PS I:\Documents and Settings\m\My Documents\prg\net> Of course, this doesn't happen always. Also, it doesn't happen only with _svn directories, and I don't have TortoiseSVN cache or anything like that so nothing is blocking the directory. Any ideas?

    Read the article

  • Increasing Java's heapspace in Tomcat startup script

    - by Ankur
    I want to increase my heap size when using Tomcat. I was told to add this line export CATALINA_OPTS=-Xms16m -Xmx256m; In to the startup.sh script - I did so (at the beginning) but got the error export: 24: -Xmx256m: bad variable name Where am I supposed to add it, am I doing something else wrong? <b>export CATALINA_OPTS=-Xms16m -Xmx256m;</b> # Better OS/400 detection: see Bugzilla 31132 os400=false darwin=false case "`uname`" in CYGWIN*) cygwin=true;; OS400*) os400=true;; Darwin*) darwin=true;; esac # resolve links - $0 may be a softlink PRG="$0" while [ -h "$PRG" ] ; do ls=`ls -ld "$PRG"` link=`expr "$ls" : '.*-> \(.*\)$'` if expr "$link" : '/.*' > /dev/null; then PRG="$link" else PRG=`dirname "$PRG"`/"$link" fi done PRGDIR=`dirname "$PRG"` EXECUTABLE=catalina.sh # Check that target executable exists if $os400; then # -x will Only work on the os400 if the files are: # 1. owned by the user # 2. owned by the PRIMARY group of the user # this will not work if the user belongs in secondary groups eval else if [ ! -x "$PRGDIR"/"$EXECUTABLE" ]; then echo "Cannot find $PRGDIR/$EXECUTABLE" echo "This file is needed to run this program" exit 1 fi fi exec "$PRGDIR"/"$EXECUTABLE" start "$@"

    Read the article

  • Crossthread exception and invokerequired solution doesn't change my control value

    - by Pilouk
    EDIT Solution : Here i'm setting my byref value in each object then i'm running a backgroundworker Private Sub TelechargeFichier() Dim DocManquant As Boolean = False Dim docName As String = "" Dim lg As String = "" Dim telechargementFini As Boolean = False lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1478") prgBar.Maximum = m_listeFichiers.Count For i As Integer = 0 To m_listeFichiers.Count - 1 m_listeFichiers(i).Set_ByRefLabel(lblMessage) m_listeFichiers(i).Set_ByRefPrgbar(prgBar) m_listeThreads.Add(New Thread(AddressOf m_listeFichiers(i).DownloadMe)) Next m_bgWorker = New BackgroundWorker m_bgWorker.WorkerReportsProgress = True AddHandler m_bgWorker.DoWork, AddressOf DownloadFiles m_bgWorker.RunWorkerAsync() ''Completed 'lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1383") 'Me.DialogResult = System.Windows.Forms.DialogResult.OK End Sub Here is my downloadFiles function : Note that each start will do the downloadMe function see below too Private Sub DownloadFiles(sender As Object, e As DoWorkEventArgs) For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Start() Next For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Join() Next End Sub I have multiple thread that each will download a ftp file. I would like that each file that have been completed will set a value to a progress bar and a label from my UI thread. For some reason invokerequired never change to false. Here is my little function that start all the thread Private Sub TelechargeFichier() Dim DocManquant As Boolean = False Dim docName As String = "" Dim lg As String = "" Dim telechargementFini As Boolean = False lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1478") prgBar.Maximum = m_listeFichiers.Count For i As Integer = 0 To m_listeFichiers.Count - 1 m_listeFichiers(i).Set_ByRefLabel(lblMessage) m_listeFichiers(i).Set_ByRefPrgbar(prgBar) m_listeThreads.Add(New Thread(AddressOf m_listeFichiers(i).DownloadMe)) Next For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Start() Next For i As Integer = 0 To m_listeThreads.Count - 1 m_listeThreads(i).Join() Next 'Completed lblMessage.Text = EasyDealChangeLanguage.Instance.GetStringFromResourceName("1383") Me.DialogResult = System.Windows.Forms.DialogResult.OK End Sub Here my property that hold the Byref control from the UI thread. This is in my object which content the addressof function that will download the file (DownloadMe) Public Sub Set_ByRefPrgbar(ByRef prgbar As ProgressBar) m_prgBar = prgbar End Sub Public Sub Set_ByRefLabel(ByRef lbl As EasyDeal.Controls.EasyDealLabel3D) m_lblMessage = lbl End Sub Here is the download function : Public Sub DownloadMe() Dim ftpReq As FtpWebRequest Dim ftpResp As FtpWebResponse = Nothing Dim streamInput As Stream Dim fileStreamOutput As FileStream Try ftpReq = CType(WebRequest.Create(EasyDeal.Controls.Common.FTP_CONNECTION & m_downloadFtpPath & m_filename), FtpWebRequest) ftpReq.Credentials = New NetworkCredential(FTP_USER, FTP_PASS) ftpReq.Method = WebRequestMethods.Ftp.DownloadFile ftpResp = ftpReq.GetResponse streamInput = ftpResp.GetResponseStream() fileStreamOutput = New FileStream(m_outputPath, FileMode.Create, FileAccess.ReadWrite) ReadWriteStream(streamInput, fileStreamOutput) Catch ex As Exception 'Au pire la fichier sera pas downloader Finally If ftpResp IsNot Nothing Then ftpResp.Close() End If Dim nomFichier As String = m_displaynameEN If EasyDealChangeLanguage.GetCurrentLanguageTypes = EasyDealChangeLanguage.EnumLanguageType.Francais Then nomFichier = m_displaynameFR End If If m_lblMessage IsNot Nothing Then EasyDealCommon.TH_SetControlText(m_lblMessage, String.Format(EasyDealChangeLanguage.Instance.GetStringFromResourceName("1479"), nomFichier)) End If If m_prgBar IsNot Nothing Then EasyDealCommon.TH_SetPrgValue(m_prgBar, 1) End If End Try End Sub Here is the crossthread invoke solution function : Public Sub TH_SetControlText(ByVal ctl As Control, ByVal text As String) If ctl.InvokeRequired Then ctl.BeginInvoke(New Action(Of Control, String)(AddressOf TH_SetControlText), ctl, text) Else ctl.Text = text End If End Sub Public Sub TH_SetPrgValue(ByVal prg As ProgressBar, ByVal value As Integer) If prg.InvokeRequired Then prg.BeginInvoke(New Action(Of ProgressBar, Integer)(AddressOf TH_SetPrgValue), prg, value) Else prg.Value += value End If End Sub The problem is the invokerequired never get to false it actually goes in to beginInvoke but never end in the Else section to set the value.

    Read the article

  • Get records in particular date range

    - by developer
    Hi All, I have a column in database that shows DateCreated. Now I want to filter records depending on the date range selected. Eg, Created within 60 days, created withing year, etc. I have a variable dateCreated that shows me what the user has selected as the range.i.e., whether it is Created within 60 days, created withing year. if (datecreated == "Created within 60 days") { DateTime CurrTime = DateTime.Now; if (prg.Subscriber.Username == CurrentUsername && prg.Program.DateCreated<=DateTime.Now - 60) { UserPrgList.Add(new ProgramSubscriptionViewModel(prg)); } } But the above code wont work..what would be the syntax to get the records within a particular range??

    Read the article

  • Dependency Property WPF Grid

    - by developer
    Hi All, I want to Bind the textblock text in WPF datagrid to a dependency property. Somehow, nothing gets displayed, but when I use the same textblock binding outside the grid, everything works fine. Below is my code, <Window.Resources> <Style x:Key="cellCenterAlign" TargetType="{x:Type toolkit:DataGridCell}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type toolkit:DataGridCell}"> <Grid Background="{TemplateBinding Background}"> <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center"/> </Grid> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="ColumnHeaderStyle" TargetType="{x:Type toolkit:DataGridColumnHeader}"> <Setter Property="VerticalContentAlignment" Value="Center" /> <Setter Property="HorizontalContentAlignment" Value="Center"/> </Style> <ObjectDataProvider MethodName="GetValues" ObjectType="{x:Type sys:Enum}" x:Key="RoleValues"> <ObjectDataProvider.MethodParameters> <x:Type TypeName="domain:SubscriptionRole"/> </ObjectDataProvider.MethodParameters> </ObjectDataProvider> <DataTemplate x:Key="myTemplate"> <StackPanel> <TextBlock Text="{Binding Path=OtherSubs}"/> </StackPanel> </DataTemplate> </Window.Resources> <Grid> <Grid.RowDefinitions> <RowDefinition Height="220"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <StackPanel Grid.Row="0"> <toolkit:DataGrid Name="definitionGrid" Margin="0,10,0,0" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" IsReadOnly="False" RowHeight="25" FontWeight="Normal" ItemsSource="{Binding programSubscription}" ColumnHeaderStyle="{DynamicResource ColumnHeaderStyle}" SelectionMode="Single" ScrollViewer.HorizontalScrollBarVisibility="Disabled" Width="450" ScrollViewer.VerticalScrollBarVisibility="Auto" Height="200"> <toolkit:DataGrid.Columns> <toolkit:DataGridTextColumn Header="Program" Width="80" Binding="{Binding Program.JobNum}" CellStyle="{StaticResource cellCenterAlign}" IsReadOnly="True"/> <toolkit:DataGridTemplateColumn Header="Role" Width="80" CellStyle="{StaticResource cellCenterAlign}"> <toolkit:DataGridTemplateColumn.CellTemplate> <DataTemplate> <ComboBox SelectedItem="{Binding Role}" ItemsSource="{Binding Source={StaticResource RoleValues}}" Width="70"> <ComboBox.Style> <Style> <Style.Triggers> <DataTrigger Binding="{Binding Path=Role}" Value="Owner"> <Setter Property="ComboBox.Focusable" Value="False"/> <Setter Property="ComboBox.IsEnabled" Value="False"/> <Setter Property="ComboBox.IsHitTestVisible" Value="False"/> </DataTrigger> </Style.Triggers> </Style> </ComboBox.Style> </ComboBox> </DataTemplate> </toolkit:DataGridTemplateColumn.CellTemplate> </toolkit:DataGridTemplateColumn> <toolkit:DataGridCheckBoxColumn Header="Email" Width="60" Binding="{Binding ReceivesEmail}" CellStyle="{StaticResource cellCenterAlign}"/> <!--<toolkit:DataGridTextColumn Header="Others" Width="220" Binding="{Binding programSubscription1.Subscriber.Username}" CellStyle="{StaticResource cellCenterAlign}" IsReadOnly="True"/>--> <toolkit:DataGridTemplateColumn Header="Others" Width="220" CellStyle="{StaticResource cellCenterAlign}" IsReadOnly="True"> <toolkit:DataGridTemplateColumn.CellTemplate> <DataTemplate> <TextBlock Text="{Binding Path=OtherSubs}"/> </DataTemplate> </toolkit:DataGridTemplateColumn.CellTemplate> </toolkit:DataGridTemplateColumn> </toolkit:DataGrid.Columns> </toolkit:DataGrid> <TextBlock Text="{Binding Path=OtherSubs}"/> </StackPanel> <Grid Grid.Row="1"> <Grid.ColumnDefinitions> <ColumnDefinition Width="200"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <StackPanel Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"> <CheckBox Content="Show Only Active Programs" IsChecked="True" Margin="0,0,8,0"/> </StackPanel> <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Grid.Column="1" HorizontalAlignment="Right"> <Button Content="Save" Height="23" Width="75" Margin="0,0,8,0" Click="Save_Click"/> <Button Content="Cancel" Height="23" Width="75" Margin="0,0,8,0" Click="Cancel_Click" /> </StackPanel> </Grid> </Grid> Code-Behind public partial class ProgramSubscriptions : Window { public static ObservableCollection programSubscription { get; set; } public string OtherSubs { get { return (string)GetValue(OtherSubsProperty); } set { SetValue(OtherSubsProperty, value); } } public static readonly DependencyProperty OtherSubsProperty = DependencyProperty.Register("OtherSubs", typeof(string), typeof(ProgramSubscriptions), new UIPropertyMetadata(string.Empty)); private string CurrentUsername = "test"; public ProgramSubscriptions() { InitializeComponent(); DataContext = this; LoadData(); } protected void LoadData() { programSubscription = new ObservableCollection<ProgramSubscriptionViewModel>(); if (res != null && res.TotalResults > 0) { List<ProgramSubscriptionViewModel> UserPrgList = new List<ProgramSubscriptionViewModel>(); //other.... List<ProgramSubscriptionViewModel> OtherPrgList = new List<ProgramSubscriptionViewModel>(); ArrayList myList = new ArrayList(); foreach (DomainObject obj in res.ResultSet) { ProgramSubscription prg = (ProgramSubscription)obj; if (prg.Subscriber.Username == CurrentUsername) { UserPrgList.Add(new ProgramSubscriptionViewModel(prg)); myList.Add(prg.Program.ID); } else OtherPrgList.Add(new ProgramSubscriptionViewModel(prg)); } for (int i = 0; i < UserPrgList.Count; i++) { ProgramSubscriptionViewModel item = UserPrgList[i]; programSubscription.Add(item); } //other.... for (int i = 0; i < OtherPrgList.Count; i++) { foreach (int y in myList) { ProgramSubscriptionViewModel otheritem = OtherPrgList[i]; if (y == otheritem.Program.ID) OtherSubs += otheritem.Subscriber.Username + ", "; } } } } } I posted the entire code. What exactly I want to do is in the datagridtemplatecolumn for others I want to display the usernames that are not in CurrentUsername, but they have the same program Id as the CurrentUsername. Please do let me know if there is another way that i can make this work, instead of using a dependencyproperty, althouht for testing I did put a textblock below datagrid, and it works perfectly fine.. Help!

    Read the article

  • PropertyChanged Event of ViewModel in ObservableCollection

    - by developer
    Hi All, I have a observable collection of viewmodel objects. How can I subscribe to the Property Changed event of each view model in my collection as they are created and track which ones have been changed, so that I can updated them to my database. //This is how I load my data public static ObservableCollection<ProgramViewModel> program { get; set; } program = new ObservableCollection<ProgramViewModel>(); foreach (DomainObject obj in res.ResultSet) { Program prg = (Program)obj; program.Add(new ProgramViewModel(prg)); }

    Read the article

  • ASP.NET mvc 2 Validation always shows errors on initial page load.

    - by gt124
    I've searched around a lot, and honed this problem down to this case: I'm using the PRG pattern, pragmatically I'm using the same DTO for my post/get actions. It looks like when I have the dto with the data annotation attributes in the get action parameter list, the validation is always displaying errors, every time on initial page load. In some cases this could be desired behavior if you put asterisks in the error message, but how do I get rid of it? Thanks in advance.

    Read the article

  • Apache RewriteRule with a RewriteMap variable substitution for the VAL argument to environment variable

    - by Eric
    I have an Apache server that serves up binary files to an application (not a browser). The application making the request wants the HTTP Content-MD5 header in HEX format. The default and only option within Apache is Base64. If I add "ContentDigest on" to my VirtualHost, I get this header in Base64. So I wrote a perl script, md5digesthex.pl, that gives me exactly what I want: MD5 in HEX format but I'm struggling with the RewriteRule to get my server to send the result. Here is my current Rewrite recipe: RewriteEngine on RewriteMap md5inhex prg:/www/download/md5digesthex.pl RewriteCond %{REQUEST_URI} ^/download/(.*) RewriteRule ^(.*) %{REQUEST_URI} [E=HASH:${md5inhex:$1}] Header set Content-MD5 "%{HASH}e" env=HASH The problem is that I can't seem to set the HASH environment variable based on the output of the md5inhex map function. It appears this behavior is not supported and I'm at a lost as to how to formulate this...

    Read the article

  • Reverse Proxy (mod_rewrite) and Rails (absolute paths)

    - by SooDesuNe
    I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy. The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action mod_proxy_html seems like the right idea, but it doesn't seem to be as dynamic as I would need, since the rules need to be hard coded into the config files. Is there a way to fix this server-side, so that the links will be routed correctly?

    Read the article

  • reverse_proxy (mod_rewrite) and rails

    - by SooDesuNe
    I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy. The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action Is there a way to fix this server-side, so that the links will be routed correctly?

    Read the article

  • Reverse Proxy (mod_rewrite) and Rails (absolute paths)

    - by SooDesuNe
    I have front end rails app, that reverse proxies to any of a number of backend rails apps depending on URL, for example http://www.my_host.com/app_one reverse proxies to http://www.remote_host_running_app_one.com such that a URL like http://www.my_host.com/app_one/users will display the contents of http://www.remote_host_running_app_one.com/users I have a large, and ever expanding number of backends, so they can not be explicitly listed anywhere other than a database. This is no problem for mod_rewrite using a prg:/ rewrite map reverse proxy. The question is, the urls returned by rails helpers have the form /controller/action making them absolute to the root. This is a problem for the page served by mod_rewrite because links on the proxied page appear as absolute to the domain. i.e.: http://www.my_host.com/app_one/controller/action has links that end up looking like /controller/action/ when they need to look like /app_one/controller/action mod_proxy_html seems like the right idea, but it doesn't seem to be as dynamic as I would need, since the rules need to be hard coded into the config files. Is there a way to fix this server-side, so that the links will be routed correctly?

    Read the article

  • Update the model on HttpPost and render the changes in the View

    - by Etienne Giust
    With MVC3, I came over that problem where I was rendering a view with an updated model at the end of an HttpPost and the changes to the model were never applied to the rendered view :   NOT working as expected ! [HttpPost]         public ActionResult Edit(JobModel editedJobModel)         {             // Update some model property             editedJobModel.IsActive = true;                          // The view will NOT be updated as expected             return View(editedJobModel);         }   This is the standard behavior. In MVC3, POSTing the model does not render the Html helpers again. In my example, a HiddenFor bound to the IsActive value will not have its value set to true after the view is rendered.   Are you stuck, then ?   Well, for one, you’re not supposed to do that: in an ideal world you are supposed to apply the Post/Redirect/Get pattern. You would redirect to a new GET after your POST performed its actions. That’s what I usually do, but sometimes, when maintaining code and implementing slight changes to a pre-existing and tested logic, one prefers to keep structural changes to a minimum.   If you really have to (but my advice is to try to implement the PRG pattern whenever possible), here is a solution to alter values of the model on a POST and have the MVC engine render it correctly :   Solution [HttpPost] public ActionResult Edit(JobModel editedJobModel) {     // NOT WORKING : Update some model property     //editedJobModel.IsActive = true;     //Force ModelState value for IsActive property     ModelState["IsActive"].Value = new ValueProviderResult(true, "True", null);          // The view will be updated as expected     return View(editedJobModel); }   As you can see, it is a “dirty” solution, as the name (as a  string) of the updated property is used as a key of the ModelState dictionary. Also, the use of ValueProviderResult is not that straightforward.   But hey, it works.

    Read the article

  • How to automate a build for a Visual FoxPro project?

    - by jpierson
    I'm interested in figuring out how to automate a build from Visual FoxPro similar to how we can build .NET projects from the command line using MSBuild. It seems that it is possible to pass command line arguments to VFP.exe which may include the ability to specify some initial startup prg that runs however it is unclear how well starting up the IDE will work from non-interactive accounts such as the Network Service on Windows which is likely where an automated build would run. Has anybody attempt this before or read about anybody attempting to script a VFP build like this? I would be grateful for any pointers that may lead me to a solution.

    Read the article

  • Django or Drupal, which one should I use that suits best my needs ?

    - by HJ-INCPP
    Hello, I want to learn and use Drupal or Django for the following: dynamic web sites, medium database, multi-level users, paypal integration, content managment, speed (developing), security I like MVC, ORM and object-oriented prg. Which is better to jump into ? Which one is more mature, powerful, understandable, object-oriented and easier to use by the time ? What about Python Spring ... Also, which of these 3 are better documented, are better for a cv and have more extensions? Known languages: php, java, mysql Thank you !

    Read the article

  • Start and shutdown tomcat via ssh

    - by bxshi
    Updated I find out that the path of jdk it using is wrong. eval: 1: /opt/Java/jdk1.6.0_25/jre/bin/java: not found the Java should be lower case java, how is that happen? When I run this script directly on server, it is just okay. I'm trying to start or shutdown tomcat via a remote client. On my server, I've got 3 different tomcat: tomcat1, tomcat2, and tomcat3. Firstly, I've tried to run tomcat_path/bin/shutdown.sh to stop it via ssh, and the command is ssh [email protected] "cd /home/jake/tomcat2/bin;exec bash ./shutdown.sh" both " and ' are tried, but do not work, the output is eval: 1: /opt/Java/jdk1.6.0_25/jre/bin/java: not found it seems that the shell script runs on my local client, because on server it has this file. Is there any way to run a shell script on remote server correctly? updated I've run ssh [email protected] "sh -x /home/jake/tomcat/bin/shutdown.sh > /home/jake/tomcat.log 2>&1" and the output in tomcat.log is : + PRG=/home/jake/tomcat/bin/shutdown.sh + [ -h /home/jake/tomcat/bin/shutdown.sh ] + dirname /home/jake/tomcat/bin/shutdown.sh + PRGDIR=/home/jake/tomcat/bin + EXECUTABLE=catalina.sh + [ ! -x /home/jake/tomcat/bin/catalina.sh ] + exec /home/jake/tomcat/bin/catalina.sh stop eval: 1: /opt/Java/jdk1.6.0_25/jre/bin/java: not found

    Read the article

  • MVCContrib ActionFilter PassParametersDuringRedirect still passes reference type in querystring

    - by redsquare
    I am attempting to use the PRG pattern in an asp.net mvc 2 rc application. I found that the MVCContrib project has a custom action filter that will auto persist the parameters in TempData In an action I have the following return this.RedirectToAction(c => c.Requested(accountAnalysis)); however this is adding a querystring param to the request e.g http://mysite.com/account/add?model=MyProject.Models.AccountAnalysisViewModel Can anyone explain how I can use the PassParametersDuringRedirect filter attribute from MVCContrib to not pass the ViewModel type in the querystring. I see a patch was issued to fix this however in the latest MvcContrib that supports MVC 2 RC it is commented out as follows public static RedirectToRouteResult RedirectToAction<T>(this Controller controller, Expression<Action<T>> action) where T : Controller { /*var body = action.Body as MethodCallExpression; AddParameterValuesFromExpressionToTempData(controller, body); var routeValues = Microsoft.Web.Mvc.Internal.ExpressionHelper.GetRouteValuesFromExpression(action); RemoveReferenceTypesFromRouteValues(routeValues); return new RedirectToRouteResult(routeValues);*/ return new RedirectToRouteResult<T>(action); } Any help much appreciated. Thanks

    Read the article

  • How do I encapsulate form/post/validation[/redirect] in ViewUserControl in ASP.Net MVC 2

    - by paul
    What I am trying to achieve: encapsulate a Login (or any) Form to be reused across site post to self when Login/validation fails, show original page with Validation Summary (some might argue to just post to Login Page and show Validation Summary there; if what I'm trying to achieve isn't possible, I will just go that route) when Login succeeds, redirect to /App/Home/Index also, want to: stick to PRG principles avoid ajax keep Login Form (UserController.Login()) as encapsulated as possible; avoid having to implement HomeController.Login() since the Login Form might appear elsewhere All but the redirect works. My approach thus far has been: Home/Index includes Login Form: <%Html.RenderAction("Login","User");%> User/Login ViewUserControl<UserLoginViewModel> includes: <%=Html.ValidationSummary("") % using(Html.BeginForm()){} includes hidden form field "userlogin"="1" public class UserController : BaseController { ... [AcceptPostWhenFieldExists(FieldName = "userlogin")] public ActionResult Login(UserLoginViewModel model, FormCollection form){ if (ModelState.IsValid) { if(checkUserCredentials()) { setUserCredentials() return this.RedirectToAction<Areas.App.Controllers.HomeController>(x = x.Index()); } else { return View(); } } ... } Works great when: ModelState or User Credentials fail -- return View() does yield to Home/Index and displays appropriate validation summary. (I have a Register Form on the same page, using the same structure. Each form's validation summary only shows when that form is submitted.) Fails when: ModelState and User Credentials valid -- RedirectToAction<>() gives following error: "Child actions are not allowed to perform redirect actions." It seems like in the Classic ASP days, this would've been solved with Response.Buffer=True. Is there an equivalent setting or workaround now? Btw, running: ASP.Net 4, MVC 2, VS 2010, Dev/Debugging Web Server I hope all of that makes sense. So, what are my options? Or where am I going wrong in my approach? tia!

    Read the article

  • how do I insert an hidden token in my form to prevent double posts? (PHP)

    - by jpjp
    I want to prevent users from accidentally posting a comment twice. I use the PRG (post redirect get) method, so that I insert the data on another page then redirect the user back to the page which shows the comment. This allows users to refresh as many times as they want. However this doesn't work when the user goes back and clicks submit again or when they click submit 100 times really fast. I don't want 100 of the same comments. I looked at related questions on SO and found that a token is best. But I am having trouble using it. //makerandomtoken(20) returns a random 20 length char. <form method="post" ... > <input type="text" id="comments" name="comments" class="commentbox" /><br/> <input type="hidden" name="_token" value="<?php echo $token=makerandomtoken(20); ?>" /> <input type="submit" value="submit" name="submit" /> </form> if (isset($_POST['submit']) && !empty($comments)) { $comments= mysqli_real_escape_string($dbc,trim($_POST['comments'])); //how do I make the if-statment to check if the token has been already set once? if ( ____________){ //don't insert comment because already clicked submit } else{ //insert the comment into the database } } So I have the token as a hidden value, but how do I use that to prevent multiple clicking of submit.

    Read the article

1 2  | Next Page >