Daily Archives

Articles indexed Monday May 3 2010

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

  • ASP.NET MVC 2 matches correct area route but generates URL to the first registered area instead.

    - by Sandor Drieënhuizen
    I'm working on a S#arpArchitecture 1.5 project, which uses ASP.NET MVC 2. I've been trying to get areas to work properly but I ran into a problem: The ASP.NET MVC 2 routing engine matches the correct route to my area but then it generates an URL that belongs to the first registered area instead. Here's my request URL: /Framework/Authentication/LogOn?ReturnUrl=%2fDefault.aspx I'm using the Route Tester from Phil Haack and it shows: Matched Route: Framework/{controller}/{action}/{id} Generated URL: /Data/Authentication/LogOn?ReturnUrl=%2FDefault.aspx using the route "Data/{controller}/{action}/{id}" That's clearly wrong, the URL should point to the Framework area, not the Data area. This is how I register my routes, nothing special there IMO. private static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); AreaRegistration.RegisterAllAreas(); routes.MapRoute( "default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); } The area registration classes all look like this. Again, nothing special. public class FrameworkAreaRegistration : AreaRegistration { public override string AreaName { get { return "Framework"; } } public override void RegisterArea(AreaRegistrationContext context) { context.MapRoute( "Framework_default", "Framework/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = UrlParameter.Optional }); } }

    Read the article

  • How can I do something ~after~ an event has fired in C#?

    - by Siracuse
    I'm using the following project to handle global keyboard and mouse hooking in my C# application. This project is basically a wrapper around the Win API call SetWindowsHookEx using either the WH_MOUSE_LL or WH_KEYBOARD_LL constants. It also manages certain state and generally makes this kind of hooking pretty pain free. I'm using this for a mouse gesture recognition software I'm working on. Basically, I have it setup so it detects when a global hotkey is pressed down (say CTRL), then the user moves the mouse in the shape of a pre-defined gesture and then releases global hotkey. The event for the KeyDown is processed and tells my program to start recording the mouse locations until it receives the KeyUp event. This is working fine and it allows an easy way for users to enter a mouse-gesture mode. Once the KeyUp event fires and it detects the appropriate gesture, it is suppose to send certain keystrokes to the active window that the user has defined for that particular gesture they just drew. I'm using the SendKeys.Send/SendWait methods to send output to the current window. My problem is this: When the user releases their global hotkey (say CTRL), it fires the KeyUp event. My program takes its recorded mouse points and detects the relevant gesture and attempts to send the correct input via SendKeys. However, because all of this is in the KeyUp event, that global hotkey hasn't finished being processed. So, for example if I defined a gesture to send the key "A" when it is detected, and my global hotkey is CTRL, when it is detected SendKeys will send "A" but while CTRL is still "down". So, instead of just sending A, I'm getting CTRL-A. So, in this example, instead of physically sending the single character "A" it is selecting-all via the CTRL-A shortcut. Even though the user has released the CTRL (global hotkey), it is still being considered down by the system. Once my KeyUp event fires, how can I have my program wait some period of time or for some event so I can be sure that the global hotkey is truly no longer being registered by the system, and only then sending the correct input via SendKeys?

    Read the article

  • Server 2008 slow home page load in Internet Explorer

    - by Chris
    I have a problem with Internet Explorer for all users. On startup the home page takes around 20-30 seconds to load. This includes servers such as the Domain Controller and Terminal Server. However once the home page has loaded all pages from then on run fine. If you close and then reopen Internet Explorer the same thing happens. Any suggestions?

    Read the article

  • Web-design / UI advice

    - by Damian
    I'm working on a website on a Fmylife style. Now the homepage is the page showing the list of the latest posts. But I think there is a problem with that: The most "interesting" page is the one showing the top posts of the last days, but that page has very few visits compared to the main page. I suppose that's only because the main page is the "default" one. So, I've been thinking of making a home page that shows no posts (only one at the top of the page) but 4 big buttons showing the visitors what are the options to browse the content. But I'm also afraid that most users will not click any option and leave the site having seen no posts. So I don't know what to do. Obviously I have no idea of what will be good from a usability/efficiency point of view. Maybe a mix of the two options will be the best, but I don't know how to mix them. Any advice or idea will be greatly appreciated. The current home page looks like this: http://soquestion.latest.secretsapp.appspot.com/latest The new home page would look like this: http://soquestion.latest.secretsapp.appspot.com/

    Read the article

  • General Purpose Language to build a compiler for

    - by Brownie
    Inspired by Eric Sink's interview on the stackoverflow podcast I would like to build a full compiler in my spare time for the learning experience. My initial thought was to build a C compiler but I'm not sure whether it would take too much time. I am wondering if there is a smaller general purpose language that would be more appropriate to implement as a first compiler effort? Or is a C implementation doable on a reasonable timescale (200 hrs)? It is my intention to target the CLR.

    Read the article

  • rspec needs to be installed in base app

    - by Ryan Lanciaux
    I am having trouble building a gem. When I run rake it gives the the following error message: You need to install rspec in your base app I'm not completely certain what I should be doing to fix this. I have double checked that rspec is, in fact installed. Any help would be appreciated.

    Read the article

  • Is it OK to set "Cache-Control: public" when sending “304 Not Modified” for images stored in the dat

    - by Emilien
    After asking a question about sending “304 Not Modified” for images stored in the in the Google App Engine datastore, I now have a question about Cache-Control. My app now sends Last-Modified and Etag, but by default GAE alsto sends Cache-Control: no-cache. According to this page: The “no-cache” directive, according to the RFC, tells the browser that it should revalidate with the server before serving the page from the cache. [...] In practice, IE and Firefox have started treating the no-cache directive as if it instructs the browser not to even cache the page. As I DO want browsers to cache the image, I've added the following line to my code: self.response.headers['Cache-Control'] = "public" According to the same page as before: The “cache-control: public” directive [...] tells the browser and proxies [...] that the page may be cached. This is good for non-sensitive pages, as caching improves performance. The question is if this could be harmful to the application in some way? Would it be best to send Cache-Control: must-revalidate to "force" the browser to revalidate (I suppose that is the behavior that was originally the reason behind sending Cache-Control: no-cache) This directive insists that the browser must revalidate the page against the server before serving it from cache. Note that it implicitly lets the browser cache the page.

    Read the article

  • How to download media content on demand and reuse from browser cache in silverlight

    - by Andrew
    Hi. I have a problem with simple silverlight app, this app has a couple of buttons, each button sets mediaelement source to a short mp3 file and plays it, my problem is that when i press the same button second time it re-downloads mp3 file again but i think it shouldn't, instead it should use a copy of browser cached mp3 file that was downloaded when a button was pressed for the first time. I'm using sl4 and links in mediaelement are just simple uri's, i need to make it working in this way that when some mp3 was downloaded it will be cached on the client browser and further click on button will use a cached version of file instead of downloading it again and wasting my bandwidth. Any ideas ?

    Read the article

  • What is the purpose of both target API and minSDK

    - by Scott Ferguson
    Can somebody explain to me the difference between the project target and the minimum SDK? I want my app to run on Donut devices, and the APK I built with a target of 7 worked just fine. When I set an explicit minimum SDK in the Android manifest of 4 (1.6) the compiler bitched at me that the target exceeded the minimum. I reset the target to 4 only to see what would happen, and now I've got compiler errors. An example is the START_NOT_STICKY constant in android.app.Service. It doesn't exist in API level 4, but does exist in API level 7. This is also the case with Service.onStartCommand(). In API level 7 you need to explicity override this method, whereas in API level 4 you don't. So why does the app work in 1.6 despite all this? How could 1.6 know how to use SERVICE_NOT_STICKY when the associated API level doesn't know about it?

    Read the article

  • Why doesn't @contenteditable work on the iPhone?

    - by plutext
    Safari HTML Reference: Supported Attributes says: contenteditable If true, the element can be edited on the fly; if false, it cannot. Availability Available in Safari 1.2 and later. Available in iPhone OS 1.0 and later. However, on my iPhone, I can't get it to work. Anyone have success with this? You can try it with this document (admittedly not pure html, but that document works in desktop Safari, and Chrome and Firefox 3). I haven't been able to get even the simplest html document to be editable in mobile Safari.

    Read the article

  • What is JDBC's Connection.isClosed() good for, and why is Snaq DBPool misbehaving on close?

    - by Uri
    I have the following code in Java: if(!conn.isClosed()) { conn.close(); } Instead of working, I am awarded with: java.sql.SQLException: Connection already closed My connection object is a Snaq.db.CacheConnection I checked the JavaDocs for isClosed, and they state that: This method generally cannot be called to determine whether a connection to a database is valid or invalid. A typical client can determine that a connection is invalid by catching any exceptions that might be thrown when an operation is attempted. So my questions are: 1) What good is JDBC's isClosed() anyway? Since when do we use Exceptions in Java to check for validity? 2) What is the correct pattern to close a database? Should I just close and swallow exceptions? 3) Any idea why would SnaqDB be closing the connection? (My backend is a Postgres 8.3)

    Read the article

  • Problem with first Windows 7 gadget getting javascript to run

    - by norlando02
    For my first windows gadget I'm trying to make one that displays the current time and date. The code below is what I have, but I can't figure out why the javascript is not running. Any ideas? <html> <head> http-equiv="Content-Type" content="text/html; charset=Unicode" /> <title>Clock</title> <style type="text/css"> body { width: 130px; height: 60px; margin: 1 1 1 2; } body { font-family: Segoe UI, Arial; font-size: 11px; font-weight: bold; white-space: nowrap; } </style> <script type="text/javascript"> var background; var interval; var connection_id; var timeZone; var now; function load() { try { interval = 1000; connection_id = 0; timeZone = System.Time.currentTimeZone; update(); } catch(e){} } function update() { try { now = new Date(Date.parse(System.Time.getLocalTime(timeZone))); curDate.innerHTML = now.format('M jS, Y'); curTime.innerHTML = now.format('h:i:s A'); clearTimeout(connection_id); connection_id = setTimeout("update()", interval); } catch(e) {} </script> </head> <body onload="load()"> <div id="curDate"> </div> <div id="curTime"> </div> </body> </html>

    Read the article

  • Simplest language to make an interpreter for

    - by None
    I want to make an interpreter of a very simple language for practice. When I say simple I don't mean easy to use, I mean simple. Brainf**k is a good example of a language I want. I already have made a brainf**k interpreter in python (which is the language I would be using to write the interpreter). I would appreciate any suggestions of simple languages. Note: I don't want to make a compiler! I want to make an interpreter.

    Read the article

  • display image and script for a set period of time

    - by Ryan Max
    This is very similar to a question I asked the other day but my page code has become significantly more complicated and I need to revisit it. I've been using the following code: $('#myLink').click(function() { $('#myImg').attr('src', 'newImg.jpg'); setTimeout(function() { $('#myImg').attr('src', 'oldImg.jpg'); }, 15000); }); To replace an image for a set period of time (15 seconds) when the link is clicked, then after 15 seconds, revert to the original image. However now, I'd like to run a snippet of javascript as well when the link is clicked (in addition to replacing the image), and only when the link is clicked (it's related to the 15 second image) and then have the js code disappear as well after the 15 seconds...however I'm not sure how to have jquery send js code into the page...Basically I just want jQuery to "echo" this code onto the page underneath the 15 second while I am there, but I don't know how jquery formats this "echo". Does this question make sense?

    Read the article

  • Easy code-golf challenges

    - by chibineku
    I am interested in trying a few code-golf problems, but of a fairly easy level as I'm only a year old in terms of programming. Simple things, but that will make me think. I am comfortable in JavaScript and PHP at the moment.

    Read the article

  • Using html5 localstorage to retrieve data from server, to allow editing of and appending to data sou

    - by Adam
    So, I'm creating a standard user-data collection form that will be used by standard web browsers, as well as the iPhone and iPad. The app will allow users to create new records, as well as edit and delete existing records. I've gotten the gist of using html5's 'localstorage' to create a client-side data source and am looking for direction for getting existing data from a server into a client-side data source, and then being able to edit or delete that data, or to append a new record to the existing data. Finally, being able to save the updated data back to the server. It sounds like a lot, I know. But I've been pouring through html5 tuts and can't seem to find exactly what I'm looking for.

    Read the article

  • Is it possible to lightbox many images but only show one image to activate them?

    - by Obay
    Hi, I'm using Lightbox to display photos. So If I have two categories of photos, "work" and "vacation", I would do... <a href="images/image-1.jpg" rel="lightbox[work]">image #1</a> <a href="images/image-2.jpg" rel="lightbox[work]">image #2</a> <a href="images/image-3.jpg" rel="lightbox[work]">image #3</a> <a href="images/image-4.jpg" rel="lightbox[vacation]">image #4</a> <a href="images/image-5.jpg" rel="lightbox[vacation]">image #5</a> <a href="images/image-6.jpg" rel="lightbox[vacation]">image #6</a> This displays 6 images, and when I click one of them, it starts the Lightbox. However, I'd like to be able to display only two images initially (one for 'work', one for 'vacation'), but when one of them is clicked, it behaves like the first example, e.g. display all photos in that category through Lightbox. Is this possible? If so, how? Any help is very much appreciated! :) Thanks

    Read the article

  • I need to take an array of three lines in a text file and sort them base on the first line in Java.

    - by Cory
    I need to take an array of three lines in a text file and sort them base on the first line in Java. I also need to manipulate this as well and then print to screen. I have a test file that is formatted like this: 10 Michael Jackson 12 Richard Woolsey I need to input this from a text file and then rearrange it based on the number associated with the name. At that point, I need to use a random number generator and assign a variable based on the random number to each name. Then I need to print to screen the variable I added and the name in a different format. Here is an example of the output: 12: Woolsey, Richard Variable assigned 10: Jackson, Michael Other variable assigned I highly appreciate any help. I ask because I do not really know how to input the three lines as one variable and then manipulate later on in the program. Thanks, Cory

    Read the article

  • Drawing using accelerometer

    - by user331053
    Hi.. I'm trying to do a project that is basically a remake of the already posted apps on the AppStore namely movosity and air paint. Can anybody give me an idea as to what approach should I take? Thanks in advance

    Read the article

  • How to create a smooth CATransition effect

    - by Futur
    The CATransition what i have implemented works really fine but not smooth, i could see the previous uiview screens during the transition, I am just doing this, CATransition *animation = [CATransition animation]; [animation setDuration:0.1]; [animation setType:kCATransitionPush]; [animation setSubtype:kCATransitionFromRight]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [[objView layer] addAnimation:animation forKey:@"SwitchToView"]; For moving forward and for moving back wards, CATransition *animation = [CATransition animation]; [animation setDuration:0.1]; [animation setType:kCATransitionPush]; [animation setSubtype:kCATransitionFromLeft]; [animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]]; [[objRemovableView layer] addAnimation:animation forKey:@"SwitchToView"]; The effect of sliding is not smooth, is there any other way we can do this which works very smooth? Please help

    Read the article

  • iTextSharp: How to position and wrap long text?

    - by aximili
    The PDF I can produce at the moment: I want the text to fill up the space in the lower left. How can I do that? Thanks! This is my code: private static void CreatePdf4(string pdfFilename, string heading, string text, string[] photos, string emoticon) { Document document = new Document(PageSize.A4.Rotate(), 26, 36, 0, 0); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(pdfFilename, FileMode.Create)); document.Open(); // Heading Paragraph pHeading = new Paragraph(new Chunk(heading, FontFactory.GetFont(FontFactory.HELVETICA, 54, Font.NORMAL))); document.Add(pHeading); // Photo 1 Image img1 = Image.GetInstance(HttpContext.Current.Server.MapPath("/uploads/photos/" + photos[0])); img1.ScaleAbsolute(350, 261); img1.SetAbsolutePosition(46, 220); img1.Alignment = Image.TEXTWRAP; document.Add(img1); // Photo 2 Image img2 = Image.GetInstance(HttpContext.Current.Server.MapPath("/uploads/photos/" + photos[1])); img2.ScaleAbsolute(350, 261); img2.SetAbsolutePosition(438, 220); img2.Alignment = Image.TEXTWRAP; document.Add(img2); // Text //Paragraph pText = new Paragraph(new Chunk(text, FontFactory.GetFont(FontFactory.HELVETICA, 18, Font.NORMAL))); //pText.SpacingBefore = 30; //pText.IndentationLeft = 20; //pText.IndentationRight = 366; //document.Add(pText); PdfContentByte cb = writer.DirectContent; cb.BeginText(); cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, false), 18); cb.SetTextMatrix(46, 175); cb.ShowText(text); cb.EndText(); // Photo 3 Image img3 = Image.GetInstance(HttpContext.Current.Server.MapPath("/uploads/photos/" + photos[2])); img3.ScaleAbsolute(113, 153); img3.SetAbsolutePosition(556, 38); document.Add(img3); // Emoticon Image imgEmo = Image.GetInstance(HttpContext.Current.Server.MapPath("/Content/images/" + emoticon)); imgEmo.ScaleToFit(80, 80); imgEmo.SetAbsolutePosition(692, 70); document.Add(imgEmo); document.Close(); }

    Read the article

  • Qt 4.6 OpenGL GLSL

    - by Zeke
    I'm trying to find like NeHe's tutorials for Qt that are all in GLSL. Because lets face it, OpenGL in the old days are dead and Shaders are the only way now. And with Qt-4.6 they introduced the QMatrix4x4, QVector3, and the Shader classes. But I cannot find any tutorials for this. All the ones I do find, all use crappy SDL and/or GLUT (Which are just plain useless).

    Read the article

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