Search Results

Search found 14993 results on 600 pages for 'anonymous the great'.

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

  • Scope of variables inside anonymous functions in C#

    - by Vinod
    I have a doubt in scope of varibles inside anonymous functions in C#. Consider the program below: delegate void OtherDel(int x); public static void Main() { OtherDel del2; { int y = 4; del2 = delegate { Console.WriteLine("{0}", y);//Is y out of scope }; } del2(); } My VS2008 IDE gives the following errors: [Practice is a class inside namespace Practice] 1.error CS1643: Not all code paths return a value in anonymous method of type 'Practice.Practice.OtherDel' 2.error CS1593: Delegate 'OtherDel' does not take '0' arguments. It is told in a book: Illustrated C# 2008(Page 373) that the int variable y is inside the scope of del2 definition. Then why these errors.

    Read the article

  • php Set a anonymous function in an instance

    - by geekay
    I am just starting out with PHP, and I am wondering if there is a way to add an anonymous function to a class instance. For instance, lets say... class A{ public B; } $c = new A(); //This is where I am getting a little confused... //The following wont work $c->B = function(){echo('HelloWorld');}; $c->B(); What I am hoping to do is reuse the same spit of code in a great number of different applications, and make it so that I can just 'swap-out' and replace functions in specific instances. I am using php5.3 (so anonymous functions should work, just not in the way that I am using them). Thanks so very much for your time!! -GK

    Read the article

  • Turn on anonymous access in SharePoint2010 Site collection

    - by ybbest
    In this post, I would like to show you how to turn on anonymous access in SharePoint2010 Site collection using SharePoint Web UI. If you would like to achieve the same thing using PowerShell you can check this blog post here. 1. You need to go to Central AdminàManage Web Applications 2. Click Authentication provider 3. Click Default and Enable anonymous access 4. Go to your site collection and click on Site actions then click Site Permissions 5. Click on Anonymous Access 6. Select the Entire Web site and click OK. 7 Navigate to your site collection and boom you are all set for the anonymous access for your SharePoint site collection.

    Read the article

  • Creating an anonymous site in SharePoint 2010

    - by shehan
    Here’s how: Open up the Central Administration site and click on “Manage Web Applications” under the “Application Management” section From the ribbon click on “New” (Note: if its an existing web app, then click on “Extend”) Fill in the fields with appropriate values. Under “Security Configurations” make sure to select “Yes” for “Allow Anonymous” Click OK Once the web application has been created, a site collection would need to be created. Navigate to “Application Management” –> “Create Site Collection” Fill in the fields with the appropriate values and create the site collection Next sign into the newly created site collection as the Site Collection Administrator. From the “Site Actions” menu, select “Site Permissions” In the permissions page that loads, click on the Anonymous Access button appearing on the ribbon. A modal dialog would popup. Select the appropriate option and click OK. If you selected “Entire Web Site” its advisable to restart the browser to test anonymous access Technorati Tags: SharePoint 2010,anonymous,site collection,web application

    Read the article

  • Anonymous Live OS, l'OS qui ne vient PAS des Anonymous : la déclinaison d'Ubuntu apparue avant-hier reste pleine de mystères

    Anonymous Live OS, l'OS qui ne vient PAS des Anonymous La déclinaison d'Ubuntu apparue hier est pleine de mystères, voire de Trojans La nouvelle a fait le tour du Web en quelques minutes. Mais elle n'avait pas été vérifiée. Et a priori, elle ne risque pas de l'être. L'histoire commence avec la découverte sur SourceForge d'une distribution baptisée Anonymous OS Live. Déclinée de Ubuntu 11.10, le système y était décrit par ses auteurs comme « pédagogique » et/ou destiné à vérifier la sécurité des sites. Des auteurs qui n'ont pas été identifiés (normal pour des membres du mouvement), mais il n'en fallait pas plus pour que l'arrivée d'un OS estampillé Anonymous se propage. Prob...

    Read the article

  • Becoming A Great Developer

    - by Lee Brandt
    Image via Wikipedia I’ve been doing the whole programming thing for awhile and reading and watching some of the best in the business. I have come to notice that the really great developers do a few things that (I think) makes them great. Now don’t get me wrong, I am not saying that I am one of these few. I still struggle with doing some of the things that makes one great at development. Coincidently, many of these things also make you a better person period. Believe That Guidance Is Better Than Answers This is one I have no problem with. I prefer guidance any time I am learning from another developer. Answers may get you going, but guidance will leave you stranded. At some point, you will come across a problem that can only be solved by thinking for yourself and this is where that guidance will really come in handy. You can use that guidance and extrapolate whatever technology to salve that problem (if it’s the right tool for solving that problem). The problem is, lots of developers simply want someone to tell them, “Do this, then this, then set that, and write this.” Favor thinking and learn the guidance of doing X and don’t ask someone to show you how to do X, if that makes sense. Read, Read and Read If you don’t like reading, you’re probably NOT going to make it into the Great Developer group. Great developers read books, they read magazines and they read code. Open source playgrounds like SourceForge, CodePlex and GitHub, have made it extremely easy to download code from developers you admire and see how they do stuff. Chances are, if you read their blog too, they’ll even explain WHY they did what they did (see “Guidance” above). MSDN and Code Magazine have not only code samples, but explanations of how to use certain technologies and sometimes even when NOT to use that same technology. Books are also out on just about every topic. I still favor the less technology centric books. For instance, I generally don’t buy books like, “Getting Started with Jiminy Jappets”. I look for titles like, “How To Write More Effective Code” (again, see guidance). The Addison-Wesley Signature Series is a great example of these types of books. They teach technology-agnostic concepts. Head First Design Patterns is another great guidance book. It teaches the "Gang Of Four" Design Patterns in a very easy-to-understand, picture-heavy way (I LIKE pictures). Hang Your Balls Out There Even though the advice came from a 3rd-shift Kinko’s attendant, doesn’t mean it’s not sound advice. Write some code and put it out for others to read, criticize and castigate you for. Understand that there are some real jerks out there who are absolute geniuses. Don’t be afraid to get some great advice wrapped in some really nasty language. Try to take what’s good about it and leave what’s not. I have a tough time with this myself. I don’t really have any code out there that is available for review (other than my demo code). It takes some guts to do, but in the end, there is no substitute for getting a community of developers to critique your code and give you ways to improve. Get Involved Speaking of community, the local and online user groups and discussion forums are a great place to hear about technologies and techniques you might never come across otherwise. Mostly because you might not know to look. But, once you sit down with a bunch of other developers and start discussing what you’re interested in, you may open up a whole new perspective on it. Don’t just go to the UG meetings and watch the presentations either, get out there and talk, socialize. I realize geeks weren’t meant to necessarily be social creatures, but if you’re amongst other geeks, it’s much easier. I’ve learned more in the last 3-4 years that I have been involved in the community that I did in my previous 8 years of coding without it. Socializing works, even if socialism doesn’t. Continuous Improvement Lean proponents might call this “Kaizen”, but I call it progress. We all know, especially in the technology realm, if you’re not moving ahead, you’re falling behind. It may seem like drinking from a fire hose, but step back and pick out the technologies that speak to you. The ones that may you’re little heart go pitter-patter. Concentrate on those. If you’re still overloaded, pick the best of the best. Just know that if you’re not looking at the code you wrote last week or at least last year with some embarrassment, you’re probably stagnating. That’s about all I can say about that, cause I am all out of clichés to throw at it. :0) Write Code Great painters paint, great writers write, and great developers write code. The most sure-fire way to improve your coding ability is to continue writing code. Don’t just write code that your work throws on you, pick that technology you love or are curious to know more about and walk through some blog demo examples. Take the language you use everyday and try to get it to do something crazy. Who knows, you might create the next Google search algorithm! All in all, being a great developer is about finding yourself in all this code. If it is just a job to you, you will probably never be one of the “Great Developers”, but you’re probably okay with that. If, on the other hand, you do aspire to greatness, get out there and GET it. No one’s going hand it to you.

    Read the article

  • 10 steps to enable &lsquo;Anonymous Access&rsquo; for your SharePoint 2010 site

    - by KunaalKapoor
    What’s Anonymous Access? Anonymous access to your SharePoint site enables all visitors to view your SharePoint site anonymously without having to log in. With this blog I’d like to go through an easy step wise procedure to enable/set up anonymous access. Before you actually enable anonymous access on the site, you’ll have to change some settings at the web app level. So let’s start with that: Prerequisite(s): 1. A hosted SharePoint 2010 farm/server. 2. An existing SharePoint site. I just thought I’d mention the above pre-reqs, since the steps mentioned below would’nt be valid or a different type of a site. Step 1: In Central Administration, under Application Management, click on the Manage web applications. Step 2: Now select the site you want to enable anonymous access and click on the Authentication Providers icon. Step 3: On the modal window click on the Default zone. Step 4: Now under the Edit Authentication section, check Enable anonymous access and click Save. This is basically to make the Anonymous Access authentication mechanism available at the web app level @ IIS. Now, web application will allow anonymous access to be set. 5. Going back to Web Application Management click on the Anonymous Policy icon. Step 6: Also before we proceed any further, under the Anonymous Access Restrictions (@ web app mgmt.) select your Zone and set the Permissions to None – No policy and click Save. Step 7:  Now lets navigate to your top level site collection for the web application. Click the Site Actions > Site Settings. Under Users and Permissions click Site permissions. Step 8: Under Users and Permissions, click on Site Permissions. Step 9: Under the Edit tab, click on Anonymous Access. Step 10: Choose whether you want Anonymous users to have access to the entire Web site or to lists and libraries only, and then click on OK. You should now be able to see the view as below under your permissions Also keep in mind: If you are trying to access the site from a browser within the domain, then you’ll need to change some browser settings to see the after affects. Normally this is because the browsers (Internet Explorer) is set to log in automatically to intranet zone only , not sure if you have explicitly changed the zones and added it to trusted sites. If this is from a box within your domain please try to access the site by temporarily changing the Internet Explorer setting to Anonymous Logon on the zone that the site is added example "Intranet" and try . You will find the same settings by clicking on Tools > Internet Options > Security Tab.

    Read the article

  • How to break WinDbg in an anonymous method?

    - by Richard Berg
    Title kinda says it all. The usual SOS command !bpmd doesn't do a lot of good without a name. Some ideas I had: dump every method, then use !bpmd -md when you find the corresponding MethodDesc not practical in real world usage, from what I can tell. Even if I wrote a macro to limit the dump to anonymous types/methods, there's no obvious way to tell them apart. use Reflector to dump the MSIL name doesn't help when dealing with dynamic assemblies and/or Reflection.Emit. Visual Studio's inability to read local vars inside such scenarios is the whole reason I turned to Windbg in the first place... set the breakpoint in VS, wait for it to hit, then change to Windbg using the noninvasive trick attempting to detach from VS causes it to hang (along with the app). I think this is due to the fact that the managed debugger is a "soft" debugger via thread injection instead of a standard "hard" debugger. Or maybe it's just a VS bug specific to Silverlight (would hardly be the first I've encountered). set a breakpoint on some other location known to call into the anonymous method, then single-step your way in my backup plan, though I'd rather not resort to it if this Q&A reveals a better way

    Read the article

  • Anonymous union definition/declaration in a macro GNU vs VS2008

    - by Alan_m
    I am attempting to alter an IAR specific header file for a lpc2138 so it can compile with Visual Studio 2008 (to enable compatible unit testing). My problem involves converting register definitions to be hardware independent (not at a memory address) The "IAR-safe macro" is: #define __IO_REG32_BIT(NAME, ADDRESS, ATTRIBUTE, BIT_STRUCT) \ volatile __no_init ATTRIBUTE union \ { \ unsigned long NAME; \ BIT_STRUCT NAME ## _bit; \ } @ ADDRESS //declaration //(where __gpio0_bits is a structure that names //each of the 32 bits as P0_0, P0_1, etc) __IO_REG32_BIT(IO0PIN,0xE0028000,__READ_WRITE,__gpio0_bits); //usage IO0PIN = 0x0xAA55AA55; IO0PIN_bit.P0_5 = 0; This is my comparable "hardware independent" code: #define __IO_REG32_BIT(NAME, BIT_STRUCT)\ volatile union \ { \ unsigned long NAME; \ BIT_STRUCT NAME##_bit; \ } NAME; //declaration __IO_REG32_BIT(IO0PIN,__gpio0_bits); //usage IO0PIN.IO0PIN = 0xAA55AA55; IO0PIN.IO0PIN_bit.P0_5 = 1; This compiles and works but quite obviously my "hardware independent" usage does not match the "IAR-safe" usage. How do I alter my macro so I can use IO0PIN the same way I do in IAR? I feel this is a simple anonymous union matter but multiple attempts and variants have proven unsuccessful. Maybe the IAR GNU compiler supports anonymous unions and vs2008 does not. Thank you.

    Read the article

  • Linq - How to collect Anonymous Type as Result for a Function

    - by GibboK
    I use c# 4 asp.net and EF 4. I'm precompiling a query, the result should be a collection of Anonymous Type. At the moment I use this code. public static readonly Func<CmsConnectionStringEntityDataModel, string, dynamic> queryContentsList = CompiledQuery.Compile<CmsConnectionStringEntityDataModel, string, dynamic> ( (ctx, TypeContent) => ctx.CmsContents.Where(c => c.TypeContent == TypeContent & c.IsPublished == true & c.IsDeleted == false) .Select(cnt => new { cnt.Title, cnt.TitleUrl, cnt.ContentId, cnt.TypeContent, cnt.Summary } ) .OrderByDescending(c => c.ContentId)); I suspect the RETURN for the FUNCTION Dynamic does not work properly and I get this error Sequence contains more than one element enter code here. I suppose I need to return for my function a Collection of Anonymous Types... Do you have any idea how to do it? What I'm doing wrong? Please post a sample of code thanks! Update: public class ConcTypeContents { public string Title { get; set; } public string TitleUrl { get; set; } public int ContentId { get; set; } public string TypeContent { get; set; } public string Summary { get; set; } } public static readonly Func<CmsConnectionStringEntityDataModel, string, ConcTypeContents> queryContentsList = CompiledQuery.Compile<CmsConnectionStringEntityDataModel, string, ConcTypeContents>( (ctx, TypeContent) => ctx.CmsContents.Where(c => c.TypeContent == TypeContent & c.IsPublished == true & c.IsDeleted == false) .Select(cnt => new ConcTypeContents { cnt.Title, cnt.TitleUrl, cnt.ContentId, cnt.TypeContent, cnt.Summary }).OrderByDescending(c => c.ContentId));

    Read the article

  • Javascript Anonymous Functions and Global Variables

    - by Jonathan Swift
    I thought I would try and be clever and create a Wait function of my own (I realise there are other ways to do this). So I wrote: var interval_id; var countdowntimer = 0; function Wait(wait_interval) { countdowntimer = wait_interval; interval_id = setInterval(function() { --countdowntimer <=0 ? clearInterval(interval_id) : null; }, 1000); do {} while (countdowntimer >= 0); } // Wait a bit: 5 secs Wait(5); This all works, except for the infinite looping. Upon inspection, if I take the While loop out, the anonymous function is entered 5 times, as expected. So clearly the global variable countdowntimer is decremented. However, if I check the value of countdowntimer, in the While loop, it never goes down. This is despite the fact that the anonymous function is being called whilst in the While loop! Clearly, somehow, there are two values of countdowntimer floating around, but why?

    Read the article

  • Why can't c# use inline anonymous lambdas or delegates?

    - by Samuel Meacham
    I hope I worded the title of my question appropriately. In c# I can use lambdas (as delegates), or the older delegate syntax to do this: Func<string> fnHello = () => "hello"; Console.WriteLine(fnHello()); Func<string> fnHello2 = delegate() { return "hello 2"; }; Console.WriteLine(fnHello2()); So why can't I "inline" the lambda or the delegate body, and avoid capturing it in a named variable (making it anonymous)? // Inline anonymous lambda not allowed Console.WriteLine( (() => "hello inline lambda")() ); // Inline anonymous delegate not allowed Console.WriteLine( (delegate() { return "hello inline delegate"; })() ); An example that works in javascript (just for comparison) is: alert( (function(){ return "hello inline anonymous function from javascript"; })() ); Which produces the expected alert box. UPDATE: It seems you can have an inline anonymous lambda in C#, if you cast appropriately, but the amount of ()'s starts to make it unruly. // Inline anonymous lambda with appropriate cast IS allowed Console.WriteLine( ((Func<string>)(() => "hello inline anonymous lambda"))() ); Perhaps the compiler can't infer the sig of the anonymous delegate to know which Console.WriteLine() you're trying to call? Does anyone know why this specific cast is required?

    Read the article

  • Accessing C# Anonymous Type Objects

    - by Ali Kazmi
    Hi, How do i access objects of an anonymous type outside the scope where its declared? for e.g. void FuncB() { var obj = FuncA(); Console.WriteLine(obj.Name); } ??? FuncA() { var a = (from e in DB.Entities where e.Id == 1 select new {Id = e.Id, Name = e.Name}).FirstOrDefault(); return a; }

    Read the article

  • Overload Anonymous Functions

    - by Nissan Fan
    Still wrapping my head around Delegates and I'm curious: Is it possible to overload anonymous functions? Such that: delegate void Output(string x, int y); Supports: Output show = (x, y) => Console.WriteLine("{0}: {1}", x.ToString(), y.ToString()); And: delegate void Output(string x, string y); Allowing: show( "ABC", "EFG" ); And: show( "ABC", 123 );

    Read the article

  • Anonymous class implementing interface

    - by Flo
    I have the following code inside a method: var list = new[] { new { Name = "Red", IsSelected = true }, new { Name = "Green", IsSelected = false }, new { Name = "Blue", IsSelected = false }, }; I would like to call a function that requires a list of elements with each element implementing an interface (ISelectable). I know how this is done with normal classes, but in this case I am only trying to fill in some demo data. Is it possible to create an anonymous class implementing an interface? like this: new { Name = "Red", IsSelected = true } : ISelectable

    Read the article

  • How To Test if a Type is Anonymous?

    - by DaveDev
    Hi Guys I have the following method which serialises an object to a HTML tag. I only want to do this though if the type isn't Anonymous. private void MergeTypeDataToTag(object typeData) { if (typeData != null) { Type elementType = typeData.GetType(); if (/* elementType != AnonymousType */) { _tag.Attributes.Add("class", elementType.Name); } // do some more stuff } } Can somebody show me how to achieve this? Thanks Dave

    Read the article

  • Arguments to JavaScript Anonymous Function

    - by Phonethics
    for (var i = 0; i < somearray.length; i++) { myclass.foo({'arg1':somearray[i][0]}, function() { console.log(somearray[i][0]); }); } How do I pass somearray or one of its indexes into the anonymous function ? somearray is already in the global scope, but I still get somearray[i] is undefined

    Read the article

  • Closure vs Anonymous function (difference?)

    - by Maxim Gershkovich
    Hi, I have been unable to find a definition that clearly explains the differences between a closure and an anonymous function. Most references I have seen clearly specify that they are distinct "things" yet I can't seem to get my head around why. Could someone please simplify it for me? What are the specific differences between these two language features? Which one is more appropriate in what scenarios?

    Read the article

  • VB.NET 2008 - Anonymous Function

    - by James Brauman
    Hi, On Form Load I populate a menu with all possible colors so they user can pick a color. However when they pick a color the forecolor of my label is not changed. Private Sub MainForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' When the form loads, we want to populate the color menu item with all the possible colors that we could change the label to. For Each currentColor As KnownColor In [Enum].GetValues(GetType(KnownColor)) ' Declare the knowColor again - we must do this to be able to do anonymous delegates in VB.NET Dim actualCurrentColor As KnownColor = currentColor ' Get the name for this color Dim colorName As String = [Enum].GetName(GetType(KnownColor), actualCurrentColor) ' Create a new menu item for this color Dim newMenuItem As ToolStripMenuItem = New ToolStripMenuItem(colorName) ' Add a handler to this menu item so when it is clicked, we change the heading color AddHandler newMenuItem.Click, Function(s As System.Object, events As System.EventArgs) (HeadingLabel.ForeColor = Color.FromKnownColor(actualCurrentColor)) ' Add the menu item to the colors menu ColorToolStripMenuItem.DropDownItems.Add(newMenuItem) Next End Sub What am I doing wrong? Thanks

    Read the article

  • C# Anonymous method variable scope problem with IEnumerable<T>

    - by PaN1C_Showt1Me
    Hi. I'm trying to iterate through all components and for those who implements ISupportsOpen allow to open a project. The problem is when the anonymous method is called, then the component variable is always the same element (as coming from the outer scope from IEnumerable) foreach (ISupportsOpen component in something.Site.Container.Components.OfType<ISupportsOpen>()) { MyClass m = new MyClass(); m.Called += new EventHandler(delegate(object sender, EventArgs e) { if (component.CanOpenProject(..)) component.OpenProject(..); }); itemsList.Add(m); } How should it be solved, please?

    Read the article

  • detachEvent not working with named anonymous functions

    - by Polshgiant
    I ran into a problem in IE8 today (Note that I only need to support IE) that I can't seem to explain: detachEvent wouldn't work when using a named anonymous function handler. document.getElementById('iframeid').attachEvent("onreadystatechange", function onIframeReadyStateChange() { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", onIframeReadyStateChange); // code here was running every time my iframe's readyState // changed to "complete" instead of only the first time }); I eventually figured out that changing onIframeReadyStateChange to use arguments.callee (which I normally avoid) instead solved the issue: document.getElementById('iframeid').attachEvent("onreadystatechange", function () { if (event.srcElement.readyState != "complete") { return; } event.srcElement.detachEvent("onreadystatechange", arguments.callee); // code here now runs only once no matter how many times the // iframe's readyState changes to "complete" }); What gives?! Shouldn't the first snippet work fine?

    Read the article

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