Daily Archives

Articles indexed Friday April 23 2010

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

  • Problem Paging with Post Action in ASP.NET MVC

    - by Lukasz
    I have a page that takes a number of parameters on a form and posts them to an action. It returns a number of search results that need to be paged through. My pager uses ActionLink; <%= Html.ActionLink(i.ToString(), "Basic", new { page = (i - 1) })%> The results comeback as expected but when I click on page two it goes to the default Action, not the one marked with post. The form values do no get submitted again and the results that are shown for page two are the default results not filters with the parameters. I am not sure how to solve this problem? One way was to save the form values into the database on the post and reading them back on the default action but it seems overkill. Thank You!

    Read the article

  • In MS SQL Server, is there a way to "atomically" increment a column being used as a counter?

    - by Dan P
    Assuming a Read Committed Snapshot transaction isolation setting, is the following statement "atomic" in the sense that you won't ever "lose" a concurrent increment? update mytable set counter = counter + 1 I would assume that in the general case, where this update statement is part of a larger transaction, that it wouldn't be. For example, I think this scenario is possible: update the counter within transaction #1 do some other stuff in transaction #1 update the counter with transaction #2 commit transaction #2 commit transaction #1 In this situation, wouldn't the counter end up only being incremented by 1? Does it make a difference if that is the only statement in a transaction? How does a site like stackoverflow handle this for its question view counter? Or is the possibility of "losing" some increments just considered acceptable?

    Read the article

  • Summation using Lambda C# 3.0

    - by Newbie
    I have a small thing. public int GetSum(List<int> x) { foreach (int i in x) sum += i; return sum; } where x is a List of integers defined as List<int> l = new List<int>(); l.Add(4); l.Add(2); l.Add(5); l.Add(8); l.Add(6); and has been passed as GetSum(l) Is it possible to rewrite the above foreach loop using a lambda? Reason: I started looking into the lambda stuffs since yesterday and is interested to learn .. however simple it may be. Thanks.

    Read the article

  • AJAX call works on local machine, not on host

    - by superexsl
    hey everyone, What could potentially stop an AJAX call from working on the host server, when it works fine on the local host? I tried returning an error from the AJAX call, but all I get is 'undefined'. I don't think the actual page method is being called since no information is added in my log (and I've explicitly added a call). I can't reproduce the problem on my local machine, so does anyone know possible areas I should look into? Thanks

    Read the article

  • How do i use signtool.exe correctly in hudson running as a service?

    - by Tim
    I just purchased a code signing cert (MS authenticode) from THAWTE and have installed it apparently on my build machine. I am logged in as a user and when I open a cmd prompt I can sign EXEs using the cert with signtool.exe. Unfortunately this same command line does not work in the hudson process that is running on the machine. the error message I get is: SignTool Error: No certificates were found that met all the given criteria. I presume this is because the hudson service is running under a different account than the account that I ran signtool.exe from and from the account I used to get the cert from thawte. So, my question is: How do I fix this problem? I thought i was going to download a file from thawte, but instead it just used IE somehow to install the cert in the user's cache magically. I probably want to export (or whatever the correct term is) to a file that I can store/save or use on any other machine. How do i do that and how do I call signtool correctly with either the file or the cert from another user in the system/services account?

    Read the article

  • Verify mail server connection programmatically in ColdFusion

    - by Sergii
    I'm using custom SMTP servers and would like to verify the connection when user enters his own server credentials. Exactly the same type of check as Adobe CF and Railo allow to do when adding mail server. Sure, this does not guarantee that delivery will be working, but at least to check that entered server/username/pass are valid. I can see one tricky way: try to send the email with cfmail and check the mail log. But I believe that it can be done with more elegant. Is there any Java library available with standard ACF/Railo distro to help me? How would I use them? Examples are highly appreciated. Thanks in advance. EDIT: Please don't be confused with Java tag present. Solution needed in CFML. Though it can use some Java libraries, if applicable.

    Read the article

  • Self-requests appearing on an Apache SSL site

    - by Sam Minnée
    I have an SSL site running on Apache that seems to be recieving regular self-requests of some kind. Is this something that Apache is doing? What is the reason? (ip address) - - [23/Apr/2010:14:21:00 +1200] -:443 "GET /" 400 637 "-" "-" (-) 157 (ip address) - - [23/Apr/2010:14:21:03 +1200] -:443 "GET /" 400 637 "-" "-" (-) 160 (ip address) - - [23/Apr/2010:14:21:14 +1200] -:443 "GET /" 400 637 "-" "-" (-) 147 (ip address) - - [23/Apr/2010:14:21:15 +1200] -:443 "GET /" 400 637 "-" "-" (-) 128 (ip address) - - [23/Apr/2010:14:21:16 +1200] -:443 "GET /" 400 637 "-" "-" (-) 167 (ip address) - - [23/Apr/2010:14:21:17 +1200] -:443 "GET /" 400 637 "-" "-" (-) 141 (ip address) - - [23/Apr/2010:14:21:18 +1200] -:443 "GET /" 400 637 "-" "-" (-) 166 (ip address) - - [23/Apr/2010:14:21:20 +1200] -:443 "GET /" 400 637 "-" "-" (-) 168 (ip address) - - [23/Apr/2010:14:21:21 +1200] -:443 "GET /" 400 637 "-" "-" (-) 160 (ip address) - - [23/Apr/2010:14:21:31 +1200] -:443 "GET /" 400 637 "-" "-" (-) 177 (ip address) - - [23/Apr/2010:14:21:32 +1200] -:443 "GET /" 400 637 "-" "-" (-) 103 (ip address) - - [23/Apr/2010:14:21:38 +1200] -:443 "GET /" 400 637 "-" "-" (-) 157 (ip address) - - [23/Apr/2010:14:21:39 +1200] -:443 "GET /" 400 637 "-" "-" (-) 193 (ip address) - - [23/Apr/2010:14:21:40 +1200] -:443 "GET /" 400 637 "-" "-" (-) 168

    Read the article

  • Vim - Displaying Code Output in a New Window á la Textmate?

    - by Michael Density
    A few months back I switched from Textmate to Vim. Overall I really love Vim, but one of the things I miss from Textmate is using the ⌘R command to run Ruby code and having the results neatly pop up in a new, scrollable window. Obviously, Vim is capable of running Ruby code and displaying the output with :w !ruby. The only downside to this is that if the resulting output is too long I can't scroll through it. To combat this problem I tried modifying a :redir function from Vim Tips. It looks like this: function! TabNew(cmd) redir => message silent execute a:cmd redir END tabnew silent put=message set nomodified endfunction command! -nargs=+ -complete=command TabNew call TabNew(<q-args>) Now the output from Ruby is put into a new tab. However, I can't get it to pop up in a new, separate window. Changing tabnew to new just sends the output to a split in the same window. The other problem is that a visible ^M gets appended to the end of each line, so the output ends up looking like this, which is kind of bothersome: Hello World!^M So, is there any way to get the output into a separate window without the ^M appended to the end? Are there any plugins I should be trying to achieve this Textmate-like effect for code output?

    Read the article

  • How to Interview an "SEO Expert"

    I recently wrote this article for a potential customer of ours. He needed a list of simple questions he could use to interview so-called "search engine optimization (SEO) experts". He needed this list for a couple of reasons.

    Read the article

  • Per-User basis security with restful_authentication in Rails ?

    - by benoror
    Hi! I'm using restful_authentication plugin, but I would like to have per-user security, for example: class PostsController < ApplicationController # Login required before_filter :login_required, :except => [ :index, :show ] # Only the same user can create, edit and delete their own posts before_filter :only_by_same_user, :only => [ :create, :update, :destroy ] end Thanks!

    Read the article

  • Grails target folder doesn't appear to be on application's classpath

    - by Kobi
    I have a grails project with some additional java source files under src/java folder. When compiling/running the server, the files under that directory get compiled into the project's target folder, together with all other groovy/grails classes. So far so good. However, when I try to load one of the java source files (from src/java) using reflection (Class.forName to be exact), a ClassNotFoundException gets thrown. What is peculiar about the whole thing is that if I copy that same class from project's target/ folder into the following location (on windows): <myuser>\.grails\1.2.2\projects\<MyProjectName>\resources then no exception gets thrown and the corresponding class is loaded fine. This seems to indicate to me that the integrated grails server only looks at classes within the user's dynamically generated project folder, and not the actual project's target folder. Is my understanding correct? Is there a way to force grails to copy certain classfiles from target/ folder into the resources folder within the user dir? Is there a different way to load the classfiles using reflection? I was looking at using the grailsApplication's classloader but that didn't seem to work either. Any tips would be more than welcome. Thanks a lot in advance!

    Read the article

  • MVC Design Question

    - by 104286623826380127552
    On a MVC 2 website what I want to do is get a list of products / CategoryId. From that list, create a list of distinct CategoryId's. Then randomly pick a categoryId from the second list and use it to get all the products for that categoryId. I then want to store that CategoryId so that I don't display those products on the next run. I don't need any code examples to start. What I'm wondering is that I think I would put this code in a class in my model (Dll) and store the list of displayed CategoryId's in session. Is this a good solution or should I go another way? Thank you for you help

    Read the article

  • A couple PHP/MySQL questions...

    - by Jeff
    I am a college student taking a course in php and mysql progamming and my first question is about the "$variable" variables in the following code: <?php ob_start(); ?> <?php session_start(); if ($_SESSION['auth'] != "true") { header("Location: login.php"); exit; } $uid = $_SESSION['user']; $connection = mysql_connect("localhost", "username", "password"); mysql_select_db("username", $connection); $result = mysql_query ( "SELECT * FROM users where user_id = '$uid'", $connection); $num = mysql_numrows($result); $i=0; while ($i < $num) { $f1=mysql_result($result,$i,"firstname"); $f2=mysql_result($result,$i,"lastname"); ?> <html><body> <p> <td><center><font size = "18" face="Arial"><?php echo "Name: $f1 "; echo $f2; ?> </font></center></td> </p> </body></html> <?php $i++; } ?> <?php $result1 = mysql_query ( "SELECT * FROM phone where user_id = '$uid'", $connection); $num1 = mysql_numrows($result1); $j=0; while ($j < $num1) { $f3=mysql_result($result1,$j,"type"); $f4=mysql_result($result1,$j,"number"); ?> <html><body> <p> <br> <td><center><font size = "12" face="Arial"><?php echo "$f5: "; echo "($f3) "; echo "$f4 <br />"; ?> </font></center></td> </p> </body></html> <?php $j++; } ?> <?php $result2 = mysql_query ( "SELECT * FROM address where user_id = '$uid'", $connection); $num2 = mysql_numrows($result2); $h=0; while ($h < $num2) { $f6=mysql_result($result2,$h,"type"); $f7=mysql_result($result2,$h,"address"); $f8=mysql_result($result2,$h,"city"); $f9=mysql_result($result2,$h,"state"); $f10=mysql_result($result2,$h,"zip"); ?> <html><body> <p> <br> <td><center><font size = "12" face="Arial"><?php echo "$f10 Address: $f6, $f7, $f8 $f9"; ?></font></center></td> </p> </body></html> <?php $h++; } ?> <?php include 'navbar.php'; ob_end_flush(); ?> I just don't really understand the $variables at all. Are they user-generated or are they entities in the database? And how does the code know which $result is which? My second question is that, if this was someone else in my class's code and I wanted to modify it to make it my own and substitute my own variables, how would I go about doing that? Do the $variables need to be changed if they are not user-defined and if so, how? I apologize if these are dumb questions, but I am a beginner at this programming language. Thanks in advance for your help. -Jeff

    Read the article

  • Can you define a ResourceDictionary.MergedDictionary together with other (local) resources in <Wind

    - by Jeremy Holt
    I would like to refer to a MergedDictionary together with locally declared resources in my Windows.Resources. However, I'm getting this error: "All objects added to an IDictionary must have a Key attribute or some other type of key associated with them." Is it possible to mix local resources together with imported resources in the same Window.Resources? The XAML is: <Window.Resources> <CollectionViewSource x:Key="cvsData" Source="{Binding Path=Data}"> <CollectionViewSource.GroupDescriptions> <PropertyGroupDescription PropertyName="Country"/> </CollectionViewSource.GroupDescriptions> </CollectionViewSource> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary x:Name="images" Source="pack://application:,,,/CoreWpfControls;component/Images.xaml"/> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Window.Resources> Thanks Jeremy

    Read the article

  • WPF: Xaml, create an observable collection<object> in xaml in Dot Net 4.0

    - by Aran Mulholland
    the web site says you can in dot net 4.0 I cant seem to do it though, what assesmbly references and xmlns' do i need the following does not work xmlns:coll="clr-namespace:System.Collections.ObjectModel;assembly=mscorlib" <coll:ObservableCollection x:TypeArguments="x:Object"> <MenuItem Command="ApplicationCommands.Cut"/> <MenuItem Command="ApplicationCommands.Copy"/> <MenuItem Command="ApplicationCommands.Paste"/> </coll:ObservableCollection>

    Read the article

  • Escape characters during paste in vim

    - by Michael Anderson
    I copy stuff from output buffers into C++ code I'm working on in vim. Often this output gets stuck into strings. And it'd be nice to be able to escape all the control characters automatically rather than going back and hand editing the pasted fragment. As an example I might copy something like this: error in file "foo.dat" And need to put it into something like this std::string expected_error = "error in file \"foo.dat\"" I'm thinking it might be possible to apply a replace function to the body of the last paste using the start and end marks of the last paste, but I'm not sure how to make it fly.

    Read the article

  • GTK TextView automatically resizing

    - by endeavormac
    I'm messing around with GTK and glade for the first time, and I've run across a really annoying issue. When I enter text into a TextView, the TextView automatically resizes larger, pushing other widgets away. This is a really annoying behavior. I do not want my TextView changing size depending on the amount of text within it. Does anyone know what I can do to prevent the TextView from resizing based on its content?

    Read the article

  • Location of the object after scrolling in UIScrollView

    - by ludo
    Hi, I have a scrollView (width:320px height:100px) on my UIView, inside it I add 10 images with width:106.5px each. After that I use this function to have 3 different parts inside my scrollView, so everytime I scroll, an image will automatically be center. -(void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { [self returnToPosition:self.scrollView]; } -(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { [self returnToPosition:self.scrollView]; } -(void)returnToPosition:(UIScrollView *)scrollView { CGFloat itemWidth = 106.5f; CGFloat position = [self.scrollView contentOffset].x; CGFloat newPosition = 0.0f; CGFloat offSet = position / itemWidth; NSUInteger target = (NSUInteger)(offSet + 0.5f); newPosition = target * itemWidth; [self.scrollView setContentOffset:CGPointMake(newPosition, 0.0f) animated:YES]; } Here is my question, I want to be able to know which image will be in the middle position after the user scroll the View, because I want to display on my UIView a text, specific to that image. But I don't know how to do that. Some Ideas?

    Read the article

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