Search Results

Search found 37 results on 2 pages for 'donut'.

Page 1/2 | 1 2  | Next Page >

  • Advanced donut caching: using dynamically loaded controls

    - by DigiMortal
    Yesterday I solved one caching problem with local community portal. I enabled output cache on SharePoint Server 2007 to make site faster. Although caching works fine I needed to do some additional work because there are some controls that show different content to different users. In this example I will show you how to use “donut caching” with user controls – powerful way to drive some content around cache. About donut caching Donut caching means that although you are caching your content you have some holes in it so you can still affect the output that goes to user. By example you can cache front page on your site and still show welcome message that contains correct user name. To get better idea about donut caching I suggest you to read ScottGu posting Tip/Trick: Implement "Donut Caching" with the ASP.NET 2.0 Output Cache Substitution Feature. Basically donut caching uses ASP.NET substitution control. In output this control is replaced by string you return from static method bound to substitution control. Again, take a look at ScottGu blog posting I referred above. Problem If you look at Scott’s example it is pretty plain and easy by its output. All it does is it writes out current user name as string. Here are examples of my login area for anonymous and authenticated users:    It is clear that outputting mark-up for these views as string is pretty lame to implement in code at string level. Every little change in design will end up with new version of controls library because some parts of design “live” there. Solution: using user controls I worked out easy solution to my problem. I used cache substitution and user controls together. I have three user controls: LogInControl – this is the proxy control that checks which “real” control to load. AnonymousLogInControl – template and logic for anonymous users login area. AuthenticatedLogInControl – template and logic for authenticated users login area. This is the control we render for each user separately because it contains user name and user profile fill percent. Anonymous control is not very interesting because it is only about keeping mark-up in separate file. Interesting parts are LogInControl and AuthenticatedLogInControl. Creating proxy control The first thing was to create control that has substitution area where “real” control is loaded. This proxy control should also be available to decide which control to load. The definition of control is very primitive. <%@ Control EnableViewState="false" Inherits="MyPortal.Profiles.LogInControl" %> <asp:Substitution runat="server" MethodName="ShowLogInBox" /> But code is a little bit tricky. Based on current user instance we decide which login control to load. Then we create page instance and load our control through it. When control is loaded we will call DataBind() method. In this method we evaluate all fields in loaded control (it was best choice as Load and other events will not be fired). Take a look at the code. public static string ShowLogInBox(HttpContext context) {     var user = SPContext.Current.Web.CurrentUser;     string controlName;       if (user != null)         controlName = "AuthenticatedLogInControl.ascx";     else         controlName = "AnonymousLogInControl.ascx";       var path = "~/_controltemplates/" + controlName;     var output = new StringBuilder(10000);       using(var page = new Page())     using(var ctl = page.LoadControl(path))     using(var writer = new StringWriter(output))     using(var htmlWriter = new HtmlTextWriter(writer))     {         ctl.DataBind();         ctl.RenderControl(htmlWriter);     }     return output.ToString(); } When control is bound to data we ask to render it its contents to StringBuilder. Now we have the output of control as string and we can return it from our method. Of course, notice how correct I am with resources disposing. :) The method that returns contents for substitution control is static method that has no connection with control instance because hen page is read from cache there are no instances of controls available. Conclusion As you saw it was not very hard to use donut caching with user controls. Instead of writing mark-up of controls to static method that is bound to substitution control we can still use our user controls.

    Read the article

  • ASP .NET - Substitution and page output (donut) caching - How to pass custom argument to HttpRespons

    - by zzare
    I would like to use substitution feature of donut caching. public static string GetTime(HttpContext context) { return DateTime.Now.ToString("T"); } ... The cached time is: <%= DateTime.Now.ToString("T") %> <hr /> The substitution time is: <% Response.WriteSubstitution(GetTime); %> ...But I would like to pass additional parameter to callback function beside HttpContext. so the question is: How to pass additional argument to GetTime callback? for instance, something like this: public static string GetTime(HttpContext context, int newArgument) { // i'd like to get sth from DB by newArgument // return data depending on the db values // ... this example is too simple for my usage if (newArgument == 1) return ""; else return DateTime.Now.ToString("T"); }

    Read the article

  • How do I 'donut cache' in ASP.NET MVC for something more than a date

    - by Simon_Weaver
    All the examples for donut caching I've seen are just like this : <%= Html.Substitute( c => DateTime.Now.ToString() )%> Thats fine if I just want the date, but what other options are there? I know there is a delegate 'MvcSubstitutionCallback' which has the following signature : public delegate string MvcSubstitutionCallback(HttpContextBase httpContext); but RenderAction and RenderPartial returns void so i cant just return them from the delegate method. How can I effectively use this callback for more complex situations. I've looked at both of Phil Haacked's articles here and here, but neither seems to do exactly what I want.

    Read the article

  • ASP:NET :Problem in DoNut Caching

    - by Shyju
    I have an ASP.NET page where i am trying to do some output caching.But ran into a problem. My ASPX page has <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MYProject._Default" %> <%@ OutputCache Duration="600" VaryByParam="None" %> <%@ Register TagPrefix="MYProjectUC" TagName="PageHeader" Src="~/Lib/UserControls/PageHeader.ascx" %> <%@ Register TagPrefix="MYProjectUC" TagName="PageFooter" Src="~/Lib/UserControls/PageFooter.ascx" %> and i have used the User control called "PageHeader" in the aspx page. In PageHeader.ascx, i have an asp.net substitution control, where i want to show some links based on the logged in user. <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="PageHeader.ascx.cs" Inherits="MyProject.Lib.UserControls.PageHeader1" %> <div class="headerRow"> <div class="headerLogo"> <a href="Default.aspx"><img src="Lib/Images/header.gif" alt=""></a> </div> <div id="divHeaderMenu" runat="server"> <asp:Substitution ID="subLinks" runat="server" MethodName="GetUserProfileHeaderLinks" /> </div> </div><!--headerRow--> In my ascx.cs file,i have a static method which will return a string based on whether the used logged in or not using session public static string GetUserProfileHeaderLinks(HttpContext context) { string strHeaderLinks = string.Empty; // check session and return string return strHeaderLinks; } But Still the page shows the same content for both logged in user and Guest user. My objective is to to have the Page being cached except the content inside the substitution control. Any idea how to achieve this ? Thanks in advance

    Read the article

  • How to draw a 3D donut chart in OpenGL?

    - by paulbeesley
    I would like to draw a chart in OpenGL similar to the donut graph at the bottom-right of this example. I have experience with drawing 2D charts such as the main chart in the example but what confuses me about the one I want to draw is the correct type of primitive to use when drawing the 3D chart. I have considered using GL_QUAD_STRIP and GL_POLYGON but neither seem quite right for the task. Where should I begin? I will be using JOGL with Java to draw the chart, if that helps at all. Also, I don't necessarily need to extrude certain slices of the chart as shown in the example.

    Read the article

  • What are the basics (best practices, etc) of writing a good Flash application?

    - by donut
    I've been tasked with writing a Flash application for facilitating a Fantasy Football draft pick. Normally, my choice would be to write this application in JavaScript. Unfortunately, it will require the use of sockets and since we don't have enough experience with Web Socket JS to be sure it would work in this situation I need to learn Flash. Currently, I'm most proficient in JavaScript/HTML/CSS/PHP/MySQL and have never really used Flash in a meaningful way. As best as I can I want to start this project off "the right way". So, what are good to know best practices and/or references/resources that will teach my the right way of doing things in Flash?

    Read the article

  • image analysis question for matlab

    - by raekwon
    Hi, I asked a similar question but wasn't quite clear before. I am trying to put a blue or an orange or some other colored circle (more like a donut) around a feature in an image so that I can track it. It should be more like a donut so that I can still view the image... Anyway, I have a multidimensional array and then extract 2D submatrices out of it and plot each one using imagesc(subarray). For all the subarrays there are multiple features that I've located and want to track. Is it possible in Matlab to put a donut/circle around them to do that? How would you do that?

    Read the article

  • With Bluetooth keyboard, Bluetooth mouse movement is jerky on Macbook Pro

    - by donut
    I have a Macbook Pro 2,2 from early 2007. I've been using a Targus Bluetooth Laser Mouse for Mac for over a year now and its been wonderful (except for the optical scroll). Tracking has been as smooth as butter. Then someone game me an old Apple Wireless (Bluetooth) Keyboard. When both are connected, the keyboard seems to work just fine but the mouse's tracking is jerky and mouse clicks are occasionally missed. Using the trackpad on my laptop is still smooth and silk. Any ideas of fixing this or do I need a wired keyboard? I'm running Mac OS X 10.5.8

    Read the article

  • Inexpensive, simple screen recording application for mac

    - by donut
    I am more and more consistently running into the need to create screencasts (record my screen) for clients to show them how to use programs or websites. Up until now I've been using Jing and it's been wonderful. But I would like something that can give me something less annoying than a .swf. A .mov or, best of all, something that plays without fuss on Mac and Windows. Also, the 5-minute limit is annoying, but not show stopping. Basically, I'd like to be able to actually give them the file on a CD or something instead of relying on whatever host I use staying up for eternity. To sum up, here's what I require: Record a portion or all of the screen. Records audio from mic while recording screen. Exports files easily playable on Mac and Windows (requiring Quicktime is okay, but not ideal) Will work on Mac OS 10.5+ Allows recording videos of at least 5 minutes. Text in recorded videos is easily readable when exported. Bonuses points for: Records videos greater than 5 minutes Exported videos will work in Windows Media player without any fuss. I haven't upgraded to Snow Leopard yet but I know it has some screen recording stuff built in but I don't know if it would be sufficient or not. The reason I say, "simple" is because most of the applications I've seen do much more than I need (I mean, Jing is nearly perfect for my needs) and cost more than I would like to spend.

    Read the article

  • Ungrounded laptop (Macbook Pro) buzzes in headphones, weird feeling when fingers brush lightly

    - by donut
    I've got a nearly 3-year-old MacBook Pro 15" 2.16GHz (MacBookPro2,2). When I have am not using the extended, grounded adapter for the power supply, just using the simple, two-prong plug I can hear a buzzing when I use very sensitive earbuds. This goes away if I touch a metal part of the laptop. Also, I can feel a weird, fuzzy feeling when I brush the metal parts of the laptop lightly with my fingers/skin. Somewhat similar to feeling of a touching hair or a balloon that's charged with static electricity. But I'm not getting sparks or anything. And if I'm touching a metal part of my laptop solidly (not just brushing it) and then I touch someone else's skin I can feel the same effect and so can my victim. I've noticed similar effects with an ungrounded electric blanket. But with that the buzzing can be easily heard without headphones. Is this a defect, normal, or something else? And what exactly is happening?

    Read the article

  • Spaces suddenly stops responding to mouse button activation

    - by donut
    I'm running Mac OS Leopard and using a Targus Bluetooth Laser Mouse and just recently on two different computers the mouse buttons stop being able to control Spaces. They work fine for activating Exposé but Spaces will not response to any mouse buttons. Keyboard and hotspot activations work fine. For over a year it has been working fine. Just made a clean install of OS X and still have the problem. Restarting fixes it, but it invariable returns if I use the computer for a while. Seems to happen after activating Spaces.

    Read the article

  • Snippets in Vim not working

    - by donut
    I've been trying to get snippets to work with Vim (specifically, MacVim). I have tried both snippetsEmu and snipMate (preferred). Other plugins are working fine. I have been able to get snippetsEmu to temporarily work via A Byte of Vim's note to run :runtime! ftplugin/python_snippets.vim if they aren't working, except the author doesn't mention why they may not be working or what kind of permanent solutions are available. So, basically when I type for<tab> in a PHP file it just puts a tab after 'for' instead of expanding into the snippet. I'm new to Vim and can't seem to figure this out. The only main difference that these two plugins (snippetsEmu and snipMate) have compared to other plugins is that they use the ~/.vim/after directory. But knowing that hasn't helped me any. What I have seen some people suggest is to make sure the following is in your .vimrc file, but this has not helped: set nocompatible filetype on filetype plugin on

    Read the article

  • $PATH in Vim doesn't match Terminal

    - by donut
    I'm using MacVim and when I don't launch it from the Terminal (mvim) its $PATH does not include what I have set in my .bash_profile. It only seems to have the default values, /usr/bin:/bin:/usr/sbin:/sbin. I'm running OS X 10.5.8. Even if I could set it manually in my .vimrc that would be okay, though I would prefer it to pull from the same place as Terminal. I've tried following what one site suggested, adding let $PATH += /blah/foo:/bar/etc to no avail. Edit/Solution: See my answer below. MacVim has an option to fix this.

    Read the article

  • Macbook cannot see specific wireless network after being connected to it for a while

    - by donut
    Okay, so there's a single wireless network that my laptop has troubles with. My Macbook Pro used to be fine with it until it changed to using channel 13 (or 11?). Since then, after being connected to it for a while it disappears from my laptop's view. Other networks are showing up fine and other computers (including several Macs) have no troubles connecting to this network. If I clear my system cache using Onyx and then restart (sometimes a couple times) my laptop can see and connect to it again. But it seems that if I disconnect and try reconnecting I have to clear my cache again. One thing to note is that if I put my computer to sleep while connected to this network it has no problems reconnecting on wake up. I've got a 15" Macbook Pro 2,2 with Leopard 10.5.8.

    Read the article

  • How can I stop Pages from bolding/italicizing ordered list item numbers/letters?

    - by donut
    I'm writing a long, technical document that uses a lot of ordered lists in Pages '09. Often when I bold or italicize the first bit of text I type for a list item it Pages applies the same styling to the letter or number of that list item. It's been doing this for the first 13 pages I've written and now I've found out that I need to undo that. Is there any place to change this behavior or easily fix existing list item numbers/letters that are styled? The only way I've found is to select the whole list item (all of its content) and removing teh styling (un-bolding and un-italicizing) and then going back in and re-applying my stylings to its content. Definitely not ideal.

    Read the article

  • Sending a Tuple object over WCF?

    - by Donut
    Is the System.Tuple class supported by WCF's Data Contract Serializer (i.e., can I pass Tuple objects to WCF calls and/or receive them as part or all of the result)? I found this page, but not the clear, definitive "you can send and receive Tuples with WCF" answer I was hoping for. I'm guessing that you can, as long as all of the types within the Tuple itself are supported by the Data Contract Serializer -- can anyone provide me with a more definitive answer? Thanks.

    Read the article

  • Reading component parameters and setting defaults

    - by donut
    I'm pulling my hair on this because it should be simple, but can't get it to do the right thing. What's the best practice way of doing the following I've created a custom component that extends <s:Label> so now the Label has additional properties color2 color3 value which can be called like this and are used in the skin. <s:CustomLabel text="Some text" color2="0x939202" color3="0x999999" value="4.5" /> If I don't supply these parameters, I'd like some defaults to be set. So far I've had some success, but it doesn't work 100% of the time, which leads me to think that I'm not following best practices when setting those defaults. I do it now like this: [Bindable] private var myColor2:uint = 0x000000; [Bindable] private var myColor3:uint = 0x000000; [Bindable] private var myValue:Number = 10.0; then in the init function, I do a variation of this to set the default myValue = hostComponent.value; myValue = (hostComponent.value) ? hostComponent.value : 4.5; Sometimes it works, sometimes it doesn't, depending on the type of variable I'm trying to set. I eventually decided to read them as Strings then convert them to the desired type, but it seems that this also works half the time.

    Read the article

  • Reset View in Visual Studio 2008?

    - by Donut
    For some reason, the layout and sizes of various panels in my copy of Visual Studio 2008 has gone all wonky -- for example, the Error and Output windows appear in the same tab group as my code, and their position doesn't persist if I attempt to manually move them where I want them to go. Is there some sort of way to reset all panels to their default state?

    Read the article

  • Request.IsAuthenticated problem with Cache in ASP.NET

    - by Julien
    Hello guys or girls..! I'm new in ASP.NET and I have a problem... When I want to cache I View or an Action like this : <%@ Page title="" language="C#" masterpagefile="~/Views/Shared/MemberHome.Master" inherits="System.Web.Mvc.ViewPage<IndexViewData>" %> <%@ OutputCache duration="400" varybyparam="divId;regionId;page" %> I know that it cache all data in my page ... But in my page I have a condition like this : <% if(Request.IsAuthenticated) { %> <a href="/fr/Advertiser/Search"><img src="/content/images/v_2/bot.jpg" alt="Entreprises liées à vos passions" title="Entreprises liées à vos passions" /></a> <% } else { %> <a href="/fr/Advertiser/OpenSearch"><img src="/content/images/v_2/bot.jpg" alt="Entreprises liées à vos passions" title="Entreprises liées à vos passions" /></a> <% } %> I dont want to cache this variable : Request.IsAuthenticated ... because some result depend of this condition ... I try the donut caching by scottgu's but it return (I think) just some text not a bool ... http://weblogs.asp.net/scottgu/archive/2006/11/28/tip-trick-implement-donut-caching-with-the-asp-net-2-0-output-cache-substitution-feature.aspx Now I'm tired to try anything that come to my mind .. can you help me pleaseee! :) Julien.

    Read the article

  • Crosshairs in Java

    - by typoknig
    I am making a game that needs a crosshair. I have been playing with the java.awt.cursor class and that is easy enough, but the problem is that I do not want the crosshairs to be able to leave the window I create for my game, so I tried this instead: private void drawCrossHair(Graphics g){ Ellipse2D ellipse = new Ellipse2D.Float(); ellipse.setFrame(crossHair.x, crossHair.y, 36, 36); Color yellow = new Color (0xEDFF62); g.setColor(yellow); g.fillOval(crossHair.x, crossHair.y, 40, 40); g.setClip(ellipse); g.clip(ellipse); Basically I am trying to remove the "ellipse" from "g" leaving only a small ring behind. The problem here is that "g.clip(ellipse);" gives me an error. My objective with this code is to create a circle with a transparent center, like a donut. Once the donut is created I will add some small points on the inside of it so it looks more like crosshairs. One thing that may or may not be an issue is that I plan on moving the crosshairs with a joystick, not a mouse... I do not know if that will limit my options for what kind of object my crosshairs can be.

    Read the article

  • Modifying platform/frameworks/base package

    - by tareqHs
    Hi, I'm planning to modify some bits in the platform/frameworks/base project in Android Donut r2. The modifications are very small and go into java packages android.graphics and android.text (the API isn't affected). What jar libraries do I have to copy from the recompiled platform? the modifications are small and I don't want to replace the whole system.. I'm trying to replace specific jar libraries. Thank you

    Read the article

1 2  | Next Page >