Search Results

Search found 121 results on 5 pages for 'damon armstrong'.

Page 1/5 | 1 2 3 4 5  | Next Page >

  • BASH Script to Check if a number is Armstrong or Not

    - by atif089
    Hi, I was writing a script to check if a number is Armstrong or not. This is my Code echo "Enter Number" read num sum=0 item=$num while [ $item -ne 0 ] do rem='expr $item % 10' cube='expr $rem \* $rem \* $rem' sum='expr $sum + $cube' item='expr $item / 10' done if [ $sum -eq $num ] then echo "$num is an Amstrong Number" else echo "$num is not an Amstrong Number" fi After I run this script, $ ./arm.sh I always get this error ./arm.sh: line 5: [: too many arguments ./arm.sh: line 12: [: too many arguments I am on cygwin.

    Read the article

  • Linux : le Kernel a un bug "Lance Armstrong" dans son système de fichiers Ext4 qui entraine corruption et pertes de données

    Kernel Linux : le bug "Lance Armstrong" dans le système de fichiers Ext4 entraine la perte de données Theodore Ts'o, un développeur du noyau Linux vient de publier des détails sur un bug grave dans le noyau Linux. Le bug a été découvert par un utilisateur lors d'une mise à jour du noyau de la version 3.6.1 vers la version 3.6.3, qui a entrainé la corruption et la perte de ses données. Le problème a été qualifié - avec une marque d'humour - de « bug Lance Armstrong » par Theodore Ts'o, en référence au célèbre cycliste déchu pour dopage, du fait du passage de tous les tests de débogage, pourtant il...

    Read the article

  • XSL - Unknown Error in FF media:content/@url

    - by danit
    I keep getting "Unknow Error occurred" when i try this in my XSLT: <table class="TEDtalks"> <xsl:for-each select="/rss/channel/item"> <tr> <td><xsl:value-of select="title"/></td> <td> <xsl:value-of select="media:content/@url" /> </td> </tr> </xsl:for-each> </table> The XML <rss> <channel> <item> <title>TEDTalks : Karen Armstrong: Let's revive the Golden Rule - Karen Armstrong (2009)</title> <itunes:author>Karen Armstrong</itunes:author> <description>Weeks from the Charter for Compassion launch, Karen Armstrong looks at religion's role in the 21st century: Will its dogmas divide us? Or will it unite us for common good? She reviews the catalysts that can drive the world's faiths to rediscover the Golden Rule.&lt;img src="http://feeds.feedburner.com/~r/TEDTalks_video/~4/th6FBgvV22o" height="1" width="1"/&gt;</description> <itunes:subtitle>Karen Armstrong: Let's revive the Golden Rule</itunes:subtitle> <itunes:summary><![CDATA[Weeks from the Charter for Compassion launch, Karen Armstrong looks at religion's role in the 21st century: Will its dogmas divide us? Or will it unite us for common good? She reviews the catalysts that can drive the world's faiths to rediscover the Golden Rule.]]></itunes:summary> <link>http://feedproxy.google.com/~r/TEDTalks_video/~3/th6FBgvV22o/647</link> <guid isPermaLink="false">http://video.ted.com/talks/podcast/KarenArmstrong_2009G.mp4</guid> <pubDate>Tue, 29 Sep 2009 12:46:00 -0500</pubDate> <category>Higher Education</category> <itunes:explicit>no</itunes:explicit> <itunes:duration>00:09:54</itunes:duration> <itunes:keywords>TED</itunes:keywords> <media:content url="http://feedproxy.google.com/~r/TEDTalks_video/~5/XT8k_DqlzGc/KarenArmstrong_2009G.mp4" fileSize="33726021" type="video/mp4" />

    Read the article

  • Fixing NativeHR 0×80070002 Error When Retracting or Deploying SharePoint Apps from Visual Studio

    - by Damon Armstrong
    Sometimes when App deployment fails from Visual Studio you will get the following error when trying to retract or redeploy the app: <nativehr>0×80070002</nativehr><nativestack></nativestack> There seems to be some issue with the information in the content database.  To fix the problem I just deleted all of the information from the App tables in the content database.  We only have one app in testing at a time so this worked fine for me.  Doing this in a production environment or if you have multiple apps installed is not recommended, so if you are in either of those scenarios you will probably have to dig into those tables to find the offending entries.  You may also have to remove some of the App principal entries from the App Service Application database as well (I’ll try to update this post if we find that to be true).   I’m going to post the SQL to do the full deletion, but be careful when running this: DO NOT RUN THIS IN A PRODUCTION ENVIRONMENT: DELETE FROM [dbo].[AppDatabaseMetadata] DELETE FROM [dbo].[AppInstallationProperty] DELETE FROM [dbo].[AppInstallations] DELETE FROM [dbo].[AppJobs] DELETE FROM [dbo].[AppLifecycleErrors] DELETE FROM [dbo].[AppPackages] DELETE FROM [dbo].[AppPrincipalPerms] DELETE FROM [dbo].[AppPrincipals] DELETE FROM [dbo].[AppResources] DELETE FROM [dbo].[AppRuntimeIcons] DELETE FROM [dbo].[AppRuntimeMetadata] DELETE FROM [dbo].[AppRuntimeSubstitutionDictionary] DELETE FROM [dbo].[AppSourceInfo] DELETE FROM [dbo].[AppSubscriptionCosts] DELETE FROM [dbo].[AppTaskDependencies]

    Read the article

  • SharePoint, HTTP Modules, and Page Validation

    - by Damon Armstrong
    Sometimes I really believe that SharePoint actively thwarts my attempts to get it to do what I want.  First you look at something and say, wow, that should work.  Then you realize it doesn’t.  Then you have an epiphany and see a workaround.  And when you almost have that work around working… well then SharePoint says no again.  Then it’s off on another whirl-wind adventure to find a work around for the workaround.  I had one of those issues today, but I think I finally got past the last roadblock. So, I was writing an HTTP module as a workaround for another problem.  Everything looked like it was working great because I had been slowly adding code into the HTTP module bit by bit in a prototyping effort.  Finally I put in the last bit of code in place… and I started to get an error: “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.” This is not an uncommon error – it normally occurs when you are updating an item on a GET request and you have not marked the web containing the item with AllowUnsafeUpdates.  One issue, however, is that I wasn’t updating anything in my code.  I was, however, getting an SPWeb object so I decided to set the AllowUnsafeUpdates property on it to true for good measure. Once that was in place, I ran it again… “The security validation for this page is invalid. Click Back in your Web browser, refresh the page, and try your operation again.” WTF?!?!  I really expected that setting the AllowUnsafeUpdates property on the SPWeb would fix the issue, but clearly that was not the case.  I have had occasion to disassemble some SharePoint code with .NET Reflector in the past, and one of the things SharePoint abuses a bit more than it should is the HttpContext.  One way to avoid this abuse is to clear out the HttpContext while your code runs and then set it back once you are done.  I tried this next, and everything worked out just like I had expected.  So, if you are building an HTTP Module for SharePoint and some code that you are running ends up giving you a security validation error, remember to try running that code with AllowUnsafeUpdates turned on and try running the code with the HttpContext nulled out (just remember to set it back after your code runs or else you’ll really jack things up).

    Read the article

  • SQL Query for Determining SharePoint ACL Sizes

    - by Damon Armstrong
    When a SharePoint Access Control List (ACL) size exceeds more than 64kb for a particular URL, the contents under that URL become unsearchable due to limitations in the SharePoint search engine.  The error most often seen is The Parameter is Incorrect which really helps to pinpoint the problem (its difficult to convey extreme sarcasm here, please note that it is intended).  Exceeding this limit is not unheard of – it can happen when users brute force security into working by continually overriding inherited permissions and assigning user-level access to securable objects. Once you have this issue, determining where you need to focus to fix the problem can be difficult.  Fortunately, there is a query that you can run on a content database that can help identify the issue: SELECT [SiteId],      MIN([ScopeUrl]) AS URL,      SUM(DATALENGTH([Acl]))/1024 as AclSizeKB,      COUNT(*) AS AclEntries FROM [Perms] (NOLOCK) GROUP BY siteid ORDER BY AclSizeKB DESC This query results in a list of ACL sizes and entry counts on a site-by-site basis.  You can also remove grouping to see a more granular breakdown: SELECT [ScopeUrl] AS URL,       SUM(DATALENGTH([Acl]))/1024 as AclSizeKB,      COUNT(*) AS AclEntries FROM [Perms] (NOLOCK) GROUP BY ScopeUrl ORDER BY AclSizeKB DESC

    Read the article

  • Setting the Default Wiki Page in a SharePoint Wiki Library

    - by Damon Armstrong
    I’ve seen a number of blog posts about setting the default homepage in a wiki library, and most of them offer ways of accomplishing this task through PowerShell or through SharePoint designer.  Although I have become an ever increasing fan of PowerShell, I still prefer to stay away from it unless I’m trying to do something fairly complicated or I need a script that I can run over and over again.  If all you need to do is set the default homepage in a wiki library, there is an easier way! First, navigate to the wiki page you want to use as the default homepage.  Then click the Page tab in the ribbon.  In the Page Actions group there is a button called Make Homepage.  Click it.  A confirmation displays informing you that you are about to change the homepage.  Click OK and you will have a new homepage for your wiki library.  No PowerShell required.

    Read the article

  • Exporting PowerPoint Slides with Specific Heights and Widths

    - by Damon Armstrong
    I found myself in need of exporting PowerPoint slides from a presentation and was fairly excited when I found that you could save them off in standard image formats. The problem is that Microsoft conveniently exports all images with a resolution of 960 x 720 pixels, which is not the resolution I wanted.  You can, however, specify the resolution if you are willing to put a macro into your project: Sub ExportSlides()   For i = 1 To ActiveWindow.Selection.SlideRange.Count     Dim fileName As String     If (i < 10) Then       fileName = "C:\PowerPoint Export\Slide" & i & ".png"     Else       fileName = "C:\PowerPoint Export\Slide0" & i & ".png"     End If     ActiveWindow.Selection.SlideRange(i).Export fileName, "PNG", 1280, 720   Next End Sub When you call the Export method you can specify the file type as well as the dimensions to use when creating the image.  If the macro approach is not your thing, then you can also modify the default settings through the registry: http://support.microsoft.com/kb/827745

    Read the article

  • Showing All Pages in a SharePoint Wiki Library

    - by Damon Armstrong
    Opening a SharePoint wiki takes you to the wiki homepage, which is what most users want and expect.  Administrators, on the other hand, will occasionally need to see a full list of wiki pages in the wiki library.  Getting to this view is really easy, but you have to know where to look. The problem is that when viewing a wiki page SharePoint conveniently removes the Library tab from the ribbon, and the Library tab houses the controls you normally use to switch views.  Many an admin has been frustrated by the fact that they cannot get to this functionality.  A bit more searching, however, reveals that the Page tab in the ribbon contains a button in the Page Library group called View All Pages.  As the name suggests, clicking this button displays a document library style view all the pages in the wiki.  It also makes the Library tab available to switch views and gives administrators access to all of the standard Library tab functionality.

    Read the article

  • Microsoft Access as a Weapon of War

    - by Damon Armstrong
    A while ago (probably a decade ago, actually) I saw a report on a tracking system maintained by a U.S. Army artillery control unit.  This system was capable of maintaining a bearing on various units in the field to help avoid friendly fire.  I consider the U.S. Army to be the most technologically advanced fighting force on Earth, but to my terror I saw something on the title bar of an application displayed on a laptop behind one of the soldiers they were interviewing: Tracking.mdb Oh yes.  Microsoft Office Suite had made it onto the battlefield.  My hope is that it was just running as a front-end for a more proficient database (no offense Access people), or that the soldier was tracking something else like KP duty or fantasy football scores.  But I could also see the corporate equivalent of a pointy-haired boss walking into a cube and asking someone who had piddled with Access to build a database for HR forms.  Except this pointy-haired boss would have been a general, the cube would have been a tank, and the HR forms would have been targets that, if something went amiss, would have been hit by a 500lb artillery round. Hope that solider could write a good query

    Read the article

  • Building a List of All SharePoint Timer Jobs Programmatically in C#

    - by Damon Armstrong
    One of the most frustrating things about SharePoint is that the difficulty in figuring something out is inversely proportional to the simplicity of what you are trying to accomplish.  Case in point, yesterday I wanted to get a list of all the timer jobs in SharePoint.  Having never done this nor having any idea of exactly how to do this right off the top of my head, I inquired to Google.  I like to think my Google-fu is fair to good, so I normally find exactly what I’m looking for in the first hit.  But on the topic of listing all SharePoint timer jobs all it came up with a PowerShell script command (Get-SPTimerJob) and nothing more. Refined search after refined search continued to turn up nothing. So apparently I am the only person on the planet who needs to get a list of the timer jobs in C#.  In case you are the second person on the planet who needs to do this, the code to do so follows: SPSecurity.RunWithElevatedPrivileges(() => {    var timerJobs = new List();    foreach (var job in SPAdministrationWebApplication.Local.JobDefinitions)    {       timerJobs.Add(job);    }    foreach (SPService curService in SPFarm.Local.Services)    {       foreach (var job in curService.JobDefinitions)       {          timerJobs.Add(job);       }     } }); For reference, you have the two for loops because the Central Admin web application doesn’t end up being in the SPFarm.Local.Services group, so you have to get it manually from the SPAdministrationWebApplication.Local reference.

    Read the article

  • How to Enable SideLoading in a SharePoint Site

    - by Damon Armstrong
    I was trying to deploy a SharePoint App for the first time and ran into an error about SideLoading not being enabled on the site. The solution is fairly simple – you just have enable the Developer feature on the site.  Unfortunately, it’s a hidden feature so you have to do it through PowerShell.  While searching the internet for the command to enable the feature I kept running into really long scripts that seemed overly complicated.  Fortunately, Jeff (a friend at work) sent me this snippet that is very concise and does the job: Enable-SPFeature e374875e-06b6-11e0-b0fa-57f5dfd72085 –url http://yoursharepointbox/site/ Obviously, you will need to update the URL to match your environment!

    Read the article

  • Optionally Running SPSecurity.RunWithElevatedPrivileges with Delgates

    - by Damon Armstrong
    I was writing some SharePoint code today where I needed to give people the option of running some code with elevated permission.  When you run code in an elevated fashion it normally looks like this: SPSecurity.RunWithElevatedPrivileges(()=> {     //Code to run }); It wasn’t a lot of code so I was initially inclined to do something horrible like this: public void SomeMethod(bool runElevated) {     if(runElevated)     {         SPSecurity.RunWithElevatedPrivileges(()=>         {             //Code to run         });     }     else     {         //Copy of code to run     } } Easy enough, but I did not want to draw the ire of my coworkers for employing the CTRL+C CTRL+V design pattern.  Extracting the code into a whole new method would have been overkill because it was a pretty brief piece of code.  But then I thought, hey, wait, I’m basically just running a delegate, so why not define the delegate once and run it either in an elevated context or stand alone, which resulted in this version which I think is much cleaner because the code is only defined once and it didn’t require a bunch of extra lines of code to define a method: public void SomeMethod(bool runElevated) {     var code = new SPSecurity.CodeToRunElevated(()=>     {         //Code to run     });     if(runElevated)     {         SPSecurity.RunWithElevatedPermissions(code);         }     else     {         Code();     } }

    Read the article

  • Browser Item Caching and URLs

    - by Damon Armstrong
    Ultimately you want the browser to cache things like Flash components, Silverlight XAP files, and images to avoid users having to download them each time they hit a page.  But during development it’s very useful to NOT have things cached so you are always looking at the most up-to-date file.  You can always turn off caching on your browser, but if you use your browser for daily browsing then its not the greatest option.  To avoid caching we would always just slap a randomly generated GUID to the back of the URL of any items we didn’t want to cache (e.g. http://someserver.com/images/image.png?15f073f5-45fc-47b2-993b-fbaa781b926d).  It worked well, but you had to remember to remove the random GUID when it went to production. However, on a GimmalSoft project we recently implemented someone showed me a better way that didn’t need to be removed from production code – just slap the last modified date of the file on the end of the URL (or something generated from the modification date).  This was kind of genius approach because it gives you the best of both world.  If you modify the file, the browser goes out and gets the newest version.  If you don’t modify the file, it has the cached copy.  Very helpful!  The only down side is that you do have to read the modification date from the file, which does technically take some time.

    Read the article

  • Attempting my first fortran 95 program, to solve quadratic eqn. Getting weird errors.

    - by Damon
    So, I'm attempting my first program in Fortran, trying to solve quadratic eqn. I have double and triple checked my code and don't see anything wrong. I keep getting "Invalid character in name at (1)" and "Unclassifiable statement at (1)" at various locations. Any help would be greatly appreciated... ! This program solves quadratic equations ! of the form ax^2 + bx + c = 0. ! Record: ! Name: Date: Notes: ! Damon Robles 4/3/10 Original Code PROGRAM quad_solv IMPLICIT NONE ! Variables REAL :: a, b, c REAL :: discrim, root1, root2, COMPLEX :: comp1, comp2 CHARACTER(len=1) :: correct ! Prompt user for coefficients. WRITE(*,*) "This program solves quadratic equations " WRITE(*,*) "of the form ax^2 + bx + c = 0. " WRITE(*,*) "Please enter the coefficients a, b, and " WRITE(*,*) "c, separated by commas:" READ(*,*) a, b, c WRITE(*,*) "Is this correct: a = ", a, " b = ", b WRITE(*,*) " c = ", c, " [Y/N]? " READ(*,*) correct IF correct = N STOP IF correct = Y THEN ! Definition discrim = b**2 - 4*a*c ! Calculations IF discrim > 0 THEN root1 = (-b + sqrt(discrim))/(2*a) root2 = (-b - sqrt(discrim))/(2*a) WRITE(*,*) "This equation has two real roots. " WRITE(*,*) "x1 = ", root1 WRITE(*,*) "x2 = ", root2 IF discrim = 0 THEN root1 = -b/(2*a) WRITE(*,*) "This equation has a double root. " WRITE(*,*) "x1 = ", root1 IF discrim < 0 THEN comp1 = (-b + sqrt(discrim))/(2*a) comp2 = (-b - sqrt(discrim))/(2*a) WRITE(*,*) "x1 = ", comp1 WRITE(*,*) "x2 = ", comp2 PROGRAM END quad_solv Thanks in advance!

    Read the article

  • Debugging JuniperSetupClientInstaller.exe Problems

    - by Damon
    I recently moved from Windows 7 to Windows 2008 server so I can run SharePoint on my physical machine and not through a VPC, so I've been trying to get everything re-installed on my system.  As part of that process, I tried re-establishing a connection back to one of client's corporate networks and their system prompted me to run JuniperSetupClientInstaller.exe.  Normally this runs, finishes, and you can connect to the VPN no problem.  This time, however, it failed.  Unfortunately, there were no error messages to let me know why - it just didn't work. I've had success running application in "compatability mode" so I gave that a shot - same problem.  But during the installation I noticed that JuniperSetupClientInstaller.exe unpacks a number of files into a directory (you can see the exact location in the details of the installer) and then runs a DIFFERENT application - JuniperSetupClient.exe.  If you navigate to that directory, you will see a text file named JuniperSetupClient.log that contains information about the setup process. In my case, I installed a SharePoint site on Port 3333 - which the Juniper software needs to communicate with the VPN.  There was a nice message in the log file saying the VPN software could not bind to port 3333 which quickly alerted me to the issue, and moving the site off that port number fixed the issue.  However, it would have been nice to had an error message of sorts because I spent a chunk of time futilely researching compatibility issues. 

    Read the article

  • Resolving the Access is Denied Error in VSeWSS Deployments

    - by Damon
    Visual Studio Extensions for Windows SharePoint Services 1.3 (VSeWSS 1.3) tends to make my life easier unless I'm typing out the words that make up the VSeWSS acronym - really, what a mouthful.  But one of the problems that I routinely encounter are error messages when trying to deploy solutions.  These normally look something like the following: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) I tried a variety of steps to resolve this issue: Recycling the application pool Restarting IIS Closing Visual Studio Not detaching from the debugger until a request was fully completed Logging off and logging back into Windows etc. Nothing actually worked.  Some of these resolution attempts seemed to help keep the problem from happening quite as frequently, but I still have no idea what EXACTLY causes the problem and it would rear its ugly head from time to time.  Unfortunately, the only resolution I found that seemed to work was to reboot the machine . which is a crappy resolution. Finally sick enough of the problem to spend some time on it, I went on a search and tried to figure out if anyone else was having this issue.  People seem to suggest that turning off the Indexing Service on your machine helps resolve this problem.  I tried turning it off but I kept having issues.  Which was depressing.  Fortunately, I stumbled upon the resolution when I was looking through the services list.  If you encounter the issue, all you have to do is reset the World Wide Web Publishing Service.  I've had a 100% success rate so far with this approach.  I'm not sure if having the Indexing Service is part of the solution, but I've kept it disabled for the time being because I'm really sick of having to reboot my machine to deal with that error message. If you do VSeWSS development, you may also want to check out this blog post: VSeWSS 1.3 - Getting around the "Unable to load one or more of the requested types" Error

    Read the article

  • SharePoint and COMException (0x80004005): Cannot complete this action

    - by Damon
    I ran into a small issue today working on a deployment.  We were moving a custom ASP.NET control from my development environment into a SharePoint layout page on a staging environment .  I was expecting some minor issues to arise since I had developed the control in an ASP.NET website project, but after getting everything moved over we got an obscure COMException error the that looked like this: Cannot complete this action. Please try again. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Cannot complete this action. [COMException (0x80004005): Cannot complete this action. .Lengthy stack trace goes here. Everything in the custom control was built using managed code, so we weren't sure why a COMException would suddenly appear. The control made use of an ITemplate to define its UI, so there was a lot of markup and binding code inside the template. As such, we started taking chunks of the template out of the layout page and eventually the error went away.  It was being caused by a section of code where we were calling a custom utility method inside some binding code: <%# WebUtility.FormatDecimal(.) %> Solution: It turns out that we were missing an Assembly and Import directive at the top of the page to let the page know where to find this method.  After adding these to the page, the error went away and everything worked great.  So a COMException (0x80004005) Cannot complete this action error is just SharePoint's friendly way of letting you know you're missing an assembly or imports reference.

    Read the article

  • What do you think are the biggest software development issues, in small to medium businesses?

    - by Ron-Damon
    Hi, I own a small software development company that developes Web software to other small and medium companies in Chile. The business process is very complex and it is hard to stablish where to put the efforts to make our company better, more efficient, and give better solutions. I'm also a TI master's degree student and i'm making a paper about this subject, so any help would be great to help my company and my paper. I have considered 3 areas for the problems: 1) Software development problems 2) Web development problems 3) Small and Medium companies problems I don't know about you, but at least this "business formula" in Chile has not received very much support but it is getting better, but today my company is far from being self-sufficient. UPDATE: Thanks guys for your support so far, i'm updating because i have somewhat enough information so i decided to go deeper within the subjects, wish i would like you to consider for your next answers/commentaries on the subject: 1) Software development problems (3) 1.1 Incomplete problem picture 1.2 Useless delivered software 1.3 Unrealistic or inadequate schedule 2) Web development problems (3) 2.1 Apparently non-viable implementation 2.2 Unefficient module construction design 2.3 Reduced result system inter-operability 3) Small and Medium companies problems (3) 3.1 Very specific, but narrowed requerired system characteristics 3.2 Developed system is not used 3.3 Positivist demand for activities in project execution There are only 3 problems for category, to deliberately keep a thiner scope. Also, i have considered that it would have been apropiated to separate the third clasification on two, but won't be doing it just now: 3) Small and Medium software developement providers problems 4) Small and Medium software developement clients problems In that case, i think i would have made the scope of the problem wider and it is not what i want to do now, until at least i'm very trough with the other two clasifications. What you think?

    Read the article

  • Avoiding Flicker with JQuery Tabs

    - by Damon
    I am a huge fan of JQuery because it seems like every time I want to do something it has a plugin that already does it.  Adding a tabbed interface to a web page was always quite an annoyance, but JQuery UI offers a pretty descent tabs solution (click here to see it).  If you read through the documentation, you'll find that you can create a tabbed interface by calling the tabs() method on an element containing an unordered list.  The only problem that I've experienced with the method is that on slower machines you can see the unordered list render out in its original state before being updated into the final tabbed interface.  A quick way to fix that issues is to set the CSS display property of the element to none, then call the show() method directly after calling the tabs() method.  This keeps the element completely hidden while JQuery sets up the tabs interface and eliminates the flicker. <SCRIPT type="text/javascript">      $(function()      {           $("#tabs").tabs();           $("#tabs").show();      }); </SCRIPT> <div id="tabs" style="display:none;">     <ul>         <li><a href="#tabs-1">First Tab</a></li>         <li><a href="#tabs-2">Second Tab</a></li>         <li><a href="#tabs-3">Third Tab</a></li>     </ul>     ... </div>

    Read the article

  • Creating an ITemplate from a String

    - by Damon
    I do a lot of work with control templates, and one of the pieces of functionality that I've always wanted is the ability to build a ITemplate from a string.  Throughout the years, the topic has come up from time to time, and I never really found anything about how to do it. though I have run across a number of postings from people who are also wanting the same capability.  As I was messing around with things the other day, I stumbled on how to make it work and I feel really foolish for not figuring it out sooner. ITemplate is an interface that exposes a single method named InstantiateIn.  I've been searching for years for some magical .NET framework component that would take a string and convert it into an ITemplate, when all along I could just build my own.  Here's the code: /// <summary> ///   Allows string-based ITempalte implementations /// </summary> public class StringTemplate : ITemplate {     #region Constructor(s)     ////////////////////////////////////////////////////////////////////////////////////////////     /// <summary>     ///   Constructor     /// </summary>     /// <param name="template">String based version of the control template.</param>     public StringTemplate(string template)     {         Template = template;     }     /// <summary>     ///   Constructor     /// </summary>     /// <param name="template">String based version of the control template.</param>     /// <param name="copyToContainer">True to copy intermediate container contents to the instantiation container, False to leave the intermediate container in place.</param>     public StringTemplate(string template, bool copyToContainer)     {         Template = template;         CopyToContainer = copyToContainer;     }     ////////////////////////////////////////////////////////////////////////////////////////////     #endregion     #region Properties     ////////////////////////////////////////////////////////////////////////////////////////////     /// <summary>     ///   String based template     /// </summary>     public string Template     {         get;         set;     }     /// <summary>     ///   When a StringTemplate is instantiated it is created inside an intermediate control     ///   due to limitations of the .NET Framework.  Specifying True for the CopyToContainer     ///   property copies all the controls from the intermediate container into instantiation     ///   container passed to the InstantiateIn method.     /// </summary>     public bool CopyToContainer     {         get;         set;     }     ////////////////////////////////////////////////////////////////////////////////////////////     #endregion     #region ITemplate Members     ////////////////////////////////////////////////////////////////////////////////////////////     /// <summary>     ///   Creates the template in the specified control.     /// </summary>     /// <param name="container">Control in which to make the template</param>     public void InstantiateIn(Control container)     {         Control tempContainer = container.Page.ParseControl(Template);         if (CopyToContainer)         {             for (int i = tempContainer.Controls.Count - 1; i >= 0; i--)             {                 Control tempControl = tempContainer.Controls[i];                 tempContainer.Controls.RemoveAt(i);                 container.Controls.AddAt(0, tempControl);             }                         }         else         {             container.Controls.Add(tempContainer);         }     }     ////////////////////////////////////////////////////////////////////////////////////////////     #endregion } //class Converting a string into a user control is fairly easy using the ParseControl method from a Page object.  Fortunately, the container passed into the InstantiateIn method has a Page property.  One caveat, however, is that the Page property only has a reference to a Page if the container is located ON the page.  If you run into this problem, you may have to find a creative way to get the Page reference (you can add it to the constructor, store it in the request context, etc).  Another issue that I ran into is that the ParseControl creates a new control, parses the string template, places any controls defined in the template onto the new control it created, and returns that new control with the template on it.  You cannot pass in your own container. Adding this directly to the container provided as a parameter in the InstantiateIn means that you end up with an additional "level" in the control hierarchy.  To avoid this, I added code in that removes each control from the intermediate container and places it into the actual container.  I am not, however, sure about the performance penalty associated with moving a bunch of control from one place to another, nor am I completely sure if doing such a move completely screws something up if you have a code behind, etc.  It seems to work when it's just a template, but my testing was ever-so-slightly shy of thorough when it comes to other crazy scenarios.  As a catch-all, I added a Boolean property called CopyToContainer that allows you to turn the copying on or off depending on your desires and needs. Technorati Tags: .NET,ASP.NET,ITemplate,Development,C#,Custom Controls,Server Controls

    Read the article

  • Exposing an MVC Application Through SharePoint

    - by Damon
    Below you will find my presentation slides and demo files for my SharePoint TechFest 2010 presentation on Exposing an MVC Application through SharePoint.  One of the points I forgot to mention goes back to the performance and licensing benefits of this approach.  If you have a SharePoint box that is completely slammed, you can put the MVC application on a separate web server and essentially offload the application processing to another server.  In terms of licensing, you can leave SharePoint off that new server and just access SharePoint data via web services from the box.  This makes it a lot cheaper if you have MOSS - but if you're just running WSS then it may not have as many cost benefits.  Remember, programming against the web services is not always the easiest thing, so you have to weight the cost/benefit ratio when making such a determination.

    Read the article

  • SharePoint Web Part Constructor Fires Twice When Adding it to the Page (and has a different security

    - by Damon
    We had some exciting times debugging an interesting issue with SharePoint 2007 Web Parts.  We had some code in staging that had been running just fine for weeks and had not been touched or changed in about the same amount of time.  However, when we tried to move the web part into a different staging environment, the part started throwing a security exception when we tried to add it to a page.  After a bit of debugging, we determined that the web part was throwing the exception while trying to access the SPGroups property on the SharePoint site.  This was pretty strange because we were logged in as an admin and the code was working perfectly fine before.  During the debugging process, however, we found out that the web part constructor was being fired twice.  On one request, the security context did not seem to have everything it needed in order to run.  On the other request, the security context was populated with the user context with the user making the request (like it normally is).  Moving the security code outside of the constructor seems to have fixed the issue. Why the discrepancy between the two staging environments?  Turns out we deployed the part originally, then deployed an update with the security code.  Since the part was never "added" to the page after the code updates were made (we just deployed a new assembly to make the updates), we never saw the problem.  It seems as though the constructor fires twice when you are adding the web part to the page, and when you run the web part from the web part gallery.  My only thought on why this would occur is that SharePoint is instantiating an instance to get some information from it - which is odd because you would think that would happen with reflection without requiring a new object.  Anyway, the work around is to just not put anything security related inside the constructor, or to do a good job accounting for the possibility of the security context not being present if you are adding the item to the page. Technorati Tags: SharePoint,.NET,Microsoft,ASP.NET

    Read the article

  • Thoughts on C# Extension Methods

    - by Damon
    I'm not a huge fan of extension methods.  When they first came out, I remember seeing a method on an object that was fairly useful, but when I went to use it another piece of code that method wasn't available.  Turns out it was an extension method and I hadn't included the appropriate assembly and imports statement in my code to use it.  I remember being a bit confused at first about how the heck that could happen (hey, extension methods were new, cut me some slack) and it took a bit of time to track down exactly what it was that I needed to include to get that method back.  I just imagined a new developer trying to figure out why a method was missing and fruitlessly searching on MSDN for a method that didn't exist and it just didn't sit well with me. I am of the opinion that if you have an object, then you shouldn't have to include additional assemblies to get additional instance level methods out of that object.  That opinion applies to namespaces as well - I do not like it when the contents of a namespace are split out into multiple assemblies.  I prefer to have static utility classes instead of extension methods to keep things nicely packaged into a cohesive unit.  It also makes it abundantly clear where utility methods are used in code.  I will concede, however, that it can make code a bit more verbose and lengthy.  There is always a trade-off. Some people harp on extension methods because it breaks the tenants of object oriented development and allows you to add methods to sealed classes.  Whatever.  Extension methods are just utility methods that you can tack onto an object after the fact.  Extension methods do not give you any more access to an object than the developer of that object allows, so I say that those who cry OO foul on extension methods really don't have much of an argument on which to stand.  In fact, I have to concede that my dislike of them is really more about style than anything of great substance. One interesting thing that I found regarding extension methods is that you can call them on null objects. Take a look at this extension method: namespace ExtensionMethods {   public static class StringUtility   {     public static int WordCount(this string str)     {       if(str == null) return 0;       return str.Split(new char[] { ' ', '.', '?' },         StringSplitOptions.RemoveEmptyEntries).Length;     }   }   } Notice that the extension method checks to see if the incoming string parameter is null.  I was worried that the runtime would perform a check on the object instance to make sure it was not null before calling an extension method, but that is apparently not the case.  So, if you call the following code it runs just fine. string s = null; int words = s.WordCount(); I am a big fan of things working, but this seems to go against everything I've come to know about instance level methods.  However, an extension method is really a static method masquerading as an instance-level method, so I suppose it would be far more frustrating if it failed since there is really no reason it shouldn't succeed. Although I'm not a fan of extension methods, I will say that if you ever find yourself at an impasse with a die-hard fan of either the utility class or extension method approach, then there is a common ground.  Extension methods are defined in static classes, and you call them from those static classes as well as directly from the objects they extend.  So if you build your utility classes using extension methods, then you can have it your way and they can have it theirs. 

    Read the article

  • VB Myth - Case Insensitivity is Awesome!

    - by Damon
    I was reading Andy Brown's article 10 Reasons Why Visual Basic is Better than C# and the first claim is that VB is superior because of case insensitivity.  I think the reasons he outlines are basically as follows: Your fingers get tired finding the shift key (e.g. typing PascalCase and camelCase members) You are much more likely to make mistakes while typing names When you accidentally leave caps lock on, it really matters These three arguments culminate in the conclusion: "It doesn't matter if you disagree with everything else in this article: case-sensitivity alone is sufficient reason to ditch C#!" Righto.  I've been using Visual Basic since version 5.0, I wrote a book about ASP.NET in Visual Basic, so I want everyone to know I'm definitely not a VB.NET hater.  I had to converted to C# because it was the language of preference at the places I've worked, so I'm used to both languages.  I love me some case sensitivity.  So first, let's debunk the claims. First, your fingers do not get tired of finding the shift key unless you are writing code in notepad and compiling everything on the command line.  Visual Studio pretty much takes away the need to use the shift key at all. For the most part, any programmer worth a damn doesn't have to type more than about 3-5 characters of any variable or method name before IntelliSense kicks in to help.  VB or C#, if you are not using the tab key for autocomplete then you are typing too much anyway, regardless of whether the shift key is involved or not.  Also, you've got to be a pretty hard-core candy ass if you're complaining at the end of the day that your little fingers are hurting from hitting the shift key. Second, I cannot logically refute the fact that if there are more stringent rules about case sensitivity it will lead to more mistakes.  As such, know that you will be more prone to mistakes in C#.  However, lets talk about the magnitude of the problem.  If you are using IntelliSense then you have auto-correction built in so you probably won't have much of a problem in the first place.  If you manage to bypass IntelliSense and type something wrong you normally are immediately presented with a red-squiggly to let you know something is amiss.  Normally, a person would look at the problem, figure out what the heck went wrong, and then avoid that problem again in the future.  Granted, I have met people who seem to lack this capability, but their problem is deeper than a decision between VB.NET and C#.  So let's make sure that we're all on the same page about this problem.  If you have two teams of developers, one that uses VB.NET and one that uses C#, do not expect to see the VB.NET team drinking beer at the end of the project in festive revelry while the C# team is crying over what the hell to do because their code is riddled with case-sensitivity problems that nobody can resolve. Lastly, if you leave your caps lock key on, turn it off.  Really, what kind of ass-hat would write an entire VB.NET application ENTIRELY IN CAPS?  I happen to be a fan of case sensitivity because it encourages precision and uniformity.  The last thing I need is a code base that looks like it was ransacked by LeEt HacKors wHo Can uSe wHateVer cASe tHey wanT.  I mean really, if you saw someone write this: PuBLIc Sub MyMethod . End Sub And upon asking them why BL was upper case, they responded "Oh, I accidentally hit the shift key there.  Fortunately for me VB.NET is a case insensitive language so I saved a couple of keystrokes by leaving it in there."  Or if you saw: PUBLIC SUB ANOTHERMETHOD . END SUB And the response to why it was uppercased was "Yeah, I accidentally had caps locks on, fortunately for me VB.NET doesn't care.  Really dodged a bullet there, glad I wasn't using C#."  Would you not think that a bit ridiculous?  If you want to convince C# developers that C# sucks, go for it.  But the case insensitivity argument is crap.

    Read the article

1 2 3 4 5  | Next Page >