Search Results

Search found 1059 results on 43 pages for 'jon purdy'.

Page 30/43 | < Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >

  • How do you lock down & secure files stored on server in ASP.NET?

    - by Jon
    How do I go about securing files that are stored on the server? We have an ASP.NET app which generates PDFs. These are not stored in the wwwroot folder but in another folder i.e. C:\inetpub\data. This provides more security but maybe not enough. The ASP.NET/IIS process will need write access to this folder so it generate the PDFs there. Once the pdf is generated, it can be viewed using an ASP.NET form called viewpdf.aspx with the file to be viewed add to the query string like so viewpdf.aspx?FILE=mynewfile.pdf. This is loaded from a gridview. The full path to C:\inetpub\data is resolved and loaded in the Page_load event of the viewer page. Now I'm wondering how to secure this. Anybody could just view the file. Not by entering in the URL, as it won't been seen by IIS (its not in wwwroot), but could change the querystring in the viewpdf page. How do I stop anybody hacking this?

    Read the article

  • Find all html characters in drop-down option text and replace them via jQuery

    - by Jon Harding
    I have a dropdown menu that pulls in text from a database column. The database column can include HTML mark-up. In the drop-down I obviously don't need that in the text. I am working on some jquery and it partially accomplished what I'm looking for. However, it seems to only be replacing the first instance of each character $('select option').each(function() { this.text = this.text.replace('&nbsp;', ' '); this.text = this.text.replace('<div>', '' ); this.text = this.text.replace('</div>', '' ); }); Here is the HTML for the drop-down: <select name="ctl00$SubPageBody$ClassList" id="ctl00_SubPageBody_ClassList"> <option value="196">Four Week Series: July 19, 2012, 11:00am-12:00pm&<div>July 26, 2012, 11:00am-12:00pm&nbsp;</div><div>August 2, 2012, 11:00am-12:00pm</div><div>August 9, 2012, 11:00am-12:00pm</div></option> </select>

    Read the article

  • JPA returning null for deleted items from a set

    - by Jon
    This may be related to my question from a few days ago, but I'm not even sure how to explain this part. (It's an entirely different parent-child relationship.) In my interface, I have a set of attributes (Attribute) and valid values (ValidValue) for each one in a one-to-many relationship. In the Spring MVC frontend, I have a page for an administrator to edit these values. Once it's submitted, if any of these fields (as <input> tags) are blank, I remove the ValidValue object like so: Set<ValidValue> existingValues = new HashSet<ValidValue>(attribute.getValidValues()); Set<ValidValue> finalValues = new HashSet<ValidValue>(); for(ValidValue validValue : attribute.getValidValues()) { if(!validValue.getValue().isEmpty()) { finalValues.add(validValue); } } existingValues.removeAll(finalValues); for(ValidValue removedValue : existingValues) { getApplicationDataService().removeValidValue(removedValue); } attribute.setValidValues(finalValues); getApplicationDataService().modifyAttribute(attribute); The problem is that while the database is updated appropriately, the next time I query for the Attribute objects, they're returned with an extra entry in their ValidValue set -- a null, and thus, the next time I iterate through the values to display, it shows an extra blank value in the middle. I've confirmed that this happens at the point of a merge or find, at the point of "Execute query ReadObjectQuery(entity.Attribute). Here's the code I'm using to modify the database (in the ApplicationDataService): public void modifyAttribute(Attribute attribute) { getJpaTemplate().merge(attribute); } public void removeValidValue(ValidValue removedValue) { ValidValue merged = getJpaTemplate().merge(removedValue); getJpaTemplate().remove(merged); } Here are the relevant parts of the entity classes: Entity @Table(name = "attribute") public class Attribute { @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "attribute") private Set<ValidValue> validValues = new HashSet<ValidValue>(0); } @Entity @Table(name = "valid_value") public class ValidValue { @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "attr_id", nullable = false) private Attribute attribute; }

    Read the article

  • In CQRS (event-sourced), do you need a global sequence counter in the event store?

    - by Jon M
    In trying to get my head around CQRS (and DDD in general) I have come across situations when two events occur on different aggregates but the order of them has domain meaning. If so then they could happen so close together that a timestamp (as used by the sample implementations I have seen) cannot differentiate them, meaning the event store doesn't contain a 'complete' representation of the domain as there is ambiguity over the order in which events occurred. As an example, the domain could fire a CustomerCreatedEvent which applies to the Customer aggregate, and then a CustomerAssignedToAgent event on the Agent aggregate. The CustomerAssignedToAgent event doesn't make sense if it occurs before the CustomerCreatedEvent, but typically both of these might be fired as a result of one operation which makes it likely that the timestamps would effectively be the same. So am I just modelling things badly? Should there ever be a situation where the sequence of events across different aggregates is important? Or should you keep a global sequence number on your event store, so that you can identify the exact sequence in which events occurred?

    Read the article

  • Why is FubuMVC new()ing up my view model in PartialForEach?

    - by Jon M
    I'm getting started with FubuMVC and I have a simple Customer - Order relationship I'm trying to display using nested partials. My domain objects are as follows: public class Customer { private readonly IList<Order> orders = new List<Order>(); public string Name { get; set; } public IEnumerable<Order> Orders { get { return orders; } } public void AddOrder(Order order) { orders.Add(order); } } public class Order { public string Reference { get; set; } } I have the following controller classes: public class CustomersController { public IndexViewModel Index(IndexInputModel inputModel) { var customer1 = new Customer { Name = "John Smith" }; customer1.AddOrder(new Order { Reference = "ABC123" }); return new IndexViewModel { Customers = new[] { customer1 } }; } } public class IndexInputModel { } public class IndexViewModel { public IEnumerable<Customer> Customers { get; set; } } public class IndexView : FubuPage<IndexViewModel> { } public class CustomerPartial : FubuControl<Customer> { } public class OrderPartial : FubuControl<Order> { } IndexView.aspx: (standard html stuff trimmed) <div> <%= this.PartialForEach(x => x.Customers).Using<CustomerPartial>() %> </div> CustomerPartial.ascx: <%@ Control Language="C#" Inherits="FubuDemo.Controllers.Customers.CustomerPartial" %> <div> Customer Name: <%= this.DisplayFor(x => x.Name) %> <br /> Orders: (<%= Model.Orders.Count() %>) <br /> <%= this.PartialForEach(x => x.Orders) %> </div> OrderPartial.ascx: <%@ Control Language="C#" Inherits="FubuDemo.Controllers.Customers.OrderPartial" %> <div> Order <br /> Ref: <%= this.DisplayFor(x => x.Reference) %> </div> When I view Customers/Index, I see the following: Customers Customer Name: John Smith Orders: (1) It seems that in CustomerPartial.ascx, doing Model.Orders.Count() correctly picks up that 1 order exists. However PartialForEach(x = x.Orders) does not, as nothing is rendered for the order. If I set a breakpoint on the Order constructor, I see that it initially gets called by the Index method on CustomersController, but then it gets called by FubuMVC.Core.Models.StandardModelBinder.Bind, so it is getting re-instantiated by FubuMVC and losing the content of the Orders collection. This isn't quite what I'd expect, I would think that PartialForEach would just pass the domain object directly into the partial. Am I missing the point somewhere? What is the 'correct' way to achieve this kind of result in Fubu?

    Read the article

  • Using rails plugin auto_complete

    - by Jon
    Hi, i am using the rails plugin auto_complete http://github.com/rails/auto_complete. I have followed the examples, and its all working well, but with one small problem. After submitting an auto completed text field, and then hitting the back button, the text field does not retain the previously selected value. Does anyone have a solution please? thanks

    Read the article

  • Using jQuery to auto-populate a form field from another form field

    - by Jon
    Has anyone used jquery to take data from one form field and put it into another? I'm trying to create a form that when one text input is filled out a second is auto-populated with the first letter of the word that is in the first text input. I'm thinking I can limit the second text input to one character to help get the desired result, but I'm not having luck getting jquery to get the second text input and auto-populate once the first is entered. Here is the code I'm using: <script type="text/javascript"> jQuery(document).ready(function($) { $('#textBox1').keyup(function(){ if($.trim($('#textBox2').val()) == '') $('#textBox2').val($(this).val().substring(0, 1); }); }); </script> Also, do I need to have any in the text input fields of the form other than matching "textBox1" id/names? Any suggestions?

    Read the article

  • What's the best Linux backup solution?

    - by Jon Bright
    We have a four Linux boxes (all running Debian or Ubuntu) on our office network. None of these boxes are especially critical and they're all using RAID. To date, I've therefore been doing backups of the boxes by having a cron job upload tarballs containing the contents of /etc, MySQL dumps and other such changing, non-packaged data to a box at our geographically separate hosting centre. I've realised, however that the tarballs are sufficient to rebuild from, but it's certainly not a painless process to do so (I recently tried this out as part of a hardware upgrade of one of the boxes) long-term, the process isn't sustainable. Each of the boxes is currently producing a tarball of a couple of hundred MB each day, 99% of which is the same as the previous day partly due to the size issue, the backup process requires more manual intervention than I want (to find whatever 5GB file is inflating the size of the tarball and kill it) again due to the size issue, I'm leaving stuff out which it would be nice to include - the contents of users' home directories, for example. There's almost nothing of value there that isn't in source control (and these aren't our main dev boxes), but it would be nice to keep them anyway. there must be a better way So, my question is, how should I be doing this properly? The requirements are: needs to be an offsite backup (one of the main things I'm doing here is protecting against fire/whatever) should require as little manual intervention as possible (I'm lazy, and box-herding isn't my main job) should continue to scale with a couple more boxes, slightly more data, etc. preferably free/open source (cost isn't the issue, but especially for backups, openness seems like a good thing) an option to produce some kind of DVD/Blu-Ray/whatever backup from time to time wouldn't be bad My first thought was that this kind of incremental backup was what tar was created for - create a tar file once each month, add incrementally to it. rsync results to remote box. But others probably have better suggestions.

    Read the article

  • Disable Primary Key and Re-Enable After SQL Bulk Insert

    - by Jon
    I am about to run a massive data insert into my DB. I have managed to work out how to enable and rebuild non-clustered indexes on my tables but I also want to disable/enable primary keys. You can't disable the clustered index for the primary key as the table is inaccessible when that is done and my attempt to do a ALTER TABLE for constraints does not work as I think that is only for foreign keys. Do you know of a way to Disable the Primary Key and Re-Enable After SQL Bulk Insert. NOTE: This is over numerous tables and so I don't know the exact primary key specifications eg/name etc

    Read the article

  • How can I use multiple PHP header content types on the same page? is this possible?

    - by Jon
    Is it possible to use multiple header types in one document? For example: header("Content-type: image/jpeg"); header('Content-Type: text/html; charset=utf-8'); returns the whole page as text/html... while header('Content-Type: text/html; charset=utf-8'); header("Content-type: image/jpeg"); Returns the whole page as an image.... How can I use both types of content on the same page? I'm using ob_start() at the top and ob_end_flush() at the beginning.

    Read the article

  • Unexpected space between DIV elements

    - by jon
    my code for the php page displaying the divs <?php session_start(); require_once("classlib/mainspace.php"); if (isset($_SESSION['username'])==FALSE) { header("location:login.php"); } $user = new User($_SESSION['username']); ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style/style.css" /> <title>SimpleTask - Home</title> </head> <body> <div id="main"> <div id="menu"> <div id="items"> <ul> <li><a href="home.php">home</a></li> <li>&bull;</li> <li><a href="projects.php">my projects</a></li> <li>&bull;</li> <li><a href="comments.php">my comments</a></li> </ul> </div> <div id="user"> <p>Welcome, <?php echo $user->GetRealName(); ?><br/><a href="editprofile.php">edit profile</a> &bull; <a href="logout.php">logout</a></p> </div> </div> <div id="content"> <h1>HOME</h1> </div> <div id="footer"> <p>footer text goes here here here here</p> </div> </div> </body> </html> and you can find my CSS here http://tasker.efficaxdevelopment.com/style/style.css and to view the live page go here http://tasker.efficaxdevelopment.com/login.php username:admin password:password

    Read the article

  • StreamReader not working as expected

    - by Jon Preece
    Hi, I have written a simple utility that loops through all C# files in my project and updates the copyright text at the top. For example, a file may look like this; //Copyright My Company, © 2009-2010 The program should update the text to look like this; //Copyright My Company, © 2009-2010 However, the code I have written results in this; //Copyright My Company, � 2009-2011 Here is the code I am using; public bool ModifyFile(string filePath, List<string> targetText, string replacementText) { if (!File.Exists(filePath)) return false; if (targetText == null || targetText.Count == 0) return false; if (string.IsNullOrEmpty(replacementText)) return false; string modifiedFileContent = string.Empty; bool hasContentChanged = false; //Read in the file content using (StreamReader reader = File.OpenText(filePath)) { string file = reader.ReadToEnd(); //Replace any target text with the replacement text foreach (string text in targetText) modifiedFileContent = file.Replace(text, replacementText); if (!file.Equals(modifiedFileContent)) hasContentChanged = true; } //If we haven't modified the file, dont bother saving it if (!hasContentChanged) return false; //Write the modifications back to the file using (StreamWriter writer = new StreamWriter(filePath)) { writer.Write(modifiedFileContent); } return true; } Any help/suggestions are appreciated. Thanks!

    Read the article

  • Storing Object Types in Variable then Initializing

    - by Jon Mattingly
    Is there a way in Objective-C to store an object/class in a variable to be passed to alloc/init somewhere else? For example: UIViewController = foo foo *bar = [[foo alloc] init] I'm trying to create a system to dynamically create navigation buttons in a separate class based on the current view controller. I can pass 'self' to the method, but the variable that results does not allow me to alloc/init. I could always import the .h file directly, but ideally I would like to make reusing the code as simple as possible. Maybe I'm going about this the wrong way?

    Read the article

  • What's the simplest way to make a scrollable list of controls with labels?

    - by Jon Cage
    Using C++/CLI and Windows Forms, I'm trying to make a simple scrollable list of labelled text controls as a way of displaying some data fields. I'm having trouble making a TableLayoutPanel scrollable - every combination of properties I've tried seems to result in some really peculiar side effects. So I have two questions: Is this the best way to do it. If it is a reasonable approach, what magic combination of settings should I apply to the table layout panel to make it play ball?

    Read the article

  • Undocumented feature of Dictionary?

    - by Jon
    Dictionary<string, int> testdic = new Dictionary<string, int>(); testdic.Add("cat", 1); testdic.Add("dog", 2); testdic.Add("rat", 3); testdic.Remove("cat"); testdic.Add("bob", 4); Fill the dictionary and then remove the first element. Then add a new element. Bob then appears at position 1 instead of at the end, therefore it seems to remember removed entries and re-uses that memory space? Is this documented anywhere because I can't see it on MSDN and has caused me a day of grief because I assumed it would just keep adding to the end.

    Read the article

  • How do you convert bytes of bitmap into x, y location of pixels?

    - by Jon
    I have a win32 program that creates a bitmap screenshot. I am trying to figure out the x and y coordinates of the bmBits. Below is the code I have so far: UINT32 nScreenX = GetSystemMetrics(SM_CXSCREEN); UINT32 nScreenY = GetSystemMetrics(SM_CYSCREEN); HDC hdc = GetDC(NULL); HDC hdcScreen = CreateCompatibleDC(hdc); HBITMAP hbmpScreen = CreateDIBSection( hdcDesk, ( BITMAPINFO* )&bitmapInfo.bmiHeader,DIB_RGB_COLORS, &bitmapDataPtr, NULL, 0 ); SelectObject(hdcScreen, hbmpScreen); BitBlt(hdcScreen, 0, 0, nScreenX , nScreenY , hdc, 0, 0, SRCCOPY); ReleaseDC(NULL, hdc); BITMAP bmpScreen; GetObject(hbmpScreen, sizeof(bmpScreen), &bmpScreen); DWORD *pScreenPixels = (DWORD*)bmpScreen.bmBits, UINT32 x = 0; UINT32 y = 0; UINT32 nCntPixels = nScreenX * nScreenY; for(int n = 0; n < nCntPixels; n++) { x = n % nScreenX; y = n / nScreenX; //do stuff with the x and y vals } The code seem correct to me but, when I use this code the x and y values appear to be off. Where does the first pixel of bmBits start? When x and y are both 0. Is that the top left, bottom left, bottom right or top right? Thanks.

    Read the article

  • Hidden Features of Google Guice

    - by Jon
    Google Guice provides some great dependency injection features. I came across the @Nullable feature recently which allows you to mark constructor arguments as optional (permitting null) since Guice does not permit these by default: e.g. public Person(String firstName, String lastName, @Nullable Phone phone) { this.firstName = checkNotNull(firstName, "firstName"); this.lastName = checkNotNull(lastName, "lastName"); this.phone = phone; } http://code.google.com/p/google-guice/wiki/UseNullable What are the other useful features of Guice (particularly the less obvious ones) that people use?

    Read the article

  • Why aren't variables declared in "try" in scope in "catch" or "finally"?

    - by Jon Schneider
    In C# and in Java (and possibly other languages as well), variables declared in a "try" block are not in scope in the corresponding "catch" or "finally" blocks. For example, the following code does not compile: try { String s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" here instead } In this code, a compile-time error occurs on the reference to s in the catch block, because s is only in scope in the try block. (In Java, the compile error is "s cannot be resolved"; in C#, it's "The name 's' does not exist in the current context".) The general solution to this issue seems to be to instead declare variables just before the try block, instead of within the try block: String s; try { s = "test"; // (more code...) } catch { Console.Out.WriteLine(s); //Java fans: think "System.out.println" here instead } However, at least to me, (1) this feels like a clunky solution, and (2) it results in the variables having a larger scope than the programmer intended (the entire remainder of the method, instead of only in the context of the try-catch-finally). My question is, what were/are the rationale(s) behind this language design decision (in Java, in C#, and/or in any other applicable languages)?

    Read the article

  • mySQL Inconsistent Performance

    - by Jon Hatfield
    Hi, I'm running a mySQL query that joins various tables of 500,000+ rows. Sometimes it takes a second, other times around 15 seconds! This is on my local machine. I have experienced similarly varied times before on other intensive queries, does anyone know why this is? Thanks

    Read the article

  • .Net - interop assemblies taking 15 seconds to load when being referenced in a function

    - by Jon
    This is a C# console application. I have a function that does something like this: static void foo() { Application powerpointApp; Presentation presentation = null; powerpointApp = new Microsoft.Office.Interop.PowerPoint.ApplicationClass(); } That's all it does. When it is called there is a fifteen second delay before the function gets hit. I added something like this: static void MyAssemblyLoadEventHandler(object sender, AssemblyLoadEventArgs args) { Console.WriteLine(DateTime.Now.ToString() + " ASSEMBLY LOADED: " + args.LoadedAssembly.FullName); Console.WriteLine(); } This gets fired telling me that my interop assemblies have been loaded about 10 milliseconds before my foo function gets hit. What can I do about this? The program needs to call this function (and eventually do something else) once and then exit so I need for these assemblies to be cached or something. Ideas?

    Read the article

  • Using MySQL variables in a query

    - by Jon Tackabury
    I am trying to use this MySQL query: SET @a:=0; UPDATE tbl SET sortId=@a:=@a+1 ORDER BY sortId; Unfortunately I get this error: "Parameter '@a' must be defined" Is it possible to batch commands into 1 query like this, or do I need to create a stored procedure for this?

    Read the article

< Previous Page | 26 27 28 29 30 31 32 33 34 35 36 37  | Next Page >