Daily Archives

Articles indexed Thursday April 12 2012

Page 13/18 | < Previous Page | 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Ruby on Rails - where to write business logic while processing a request? (newbie)

    - by Genadinik
    I am learning Ruby on Rails. I made a simple link like this: <%= link_to "Alex Link", alexes_path(@alex) %> then I routed it in routes.rb like this: resources :alexes get "home/index" then I am a bit unclear, but I think it goes to this part of the controller: def index #@alexes = Alex.all respond_to do |format| format.html # index.html.erb format.json { render json: @alexes } end end Am I correct that it goes to this part of the controller? Then nothing much happens and it goes to the next page which is index.html.rb under views\alexes So what I am wondering is - if I needed to do some business logic, would I write that in the controller snippet? Where inside the snippet? An example would be nice to take a look. Also, I would like to connect to a MongoDb database. Would I also write that in the middle of the controller? Thanks!

    Read the article

  • Analysis and Design for Functional Programming

    - by edalorzo
    How do you deal with analysis and design phases when you plan to develop a system using a functional programming language like Haskell? My background is in imperative/object-oriented programming languages, and therefore, I am used to use case analysis and the use of UML to document the design of program. But the thing is that UML is inherently related to the object-oriented way of doing software. And I am intrigued about what would be the best way to develop documentation and define software designs for a system that is going to be developed using functional programming. Would you still use use case analysis or perhaps structured analysis and design instead? How do software architects define the high-level design of the system so that developers follow it? What do you show to you clients or to new developers when you are supposed to present a design of the solution? How do you document a picture of the whole thing without having first to write it all? Is there anything comparable to UML in the functional world?

    Read the article

  • php not redirecting

    - by NSchulze
    I'm trying to write the logout of a website. When I do this I want the page to redirect to the login page. I think I'm doing it the correct way, but can't get the right result. Could you guys point me in the right direction? Relevant Code: <button onclick="logout()">Logout</button> function logout() { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.location=xmlhttp.responseText; } } xmlhttp.open("GET","logout.php",true); xmlhttp.send(); } <?php session_destroy(); header("Location:http://localhost:8888/loginns.html"); mysql_close($con); ?> Thanks!

    Read the article

  • Javascript: variable scope & the evils of globals

    - by Nick
    I'm trying to be good, I really am, but I can't see how to do it :) Any advice on how to not use a global here would be greatly appreciated. Let's call the global G. Function A Builds G by AJAX Function B Uses G Function C Calls B Called by numerous event handlers attached to DOM elements (type 1) Function D Calls B Called by numerous event handlers attached to DOM elements (type 2) I can't see how I can get around using a global here. The DOM elements (types 1 & 2) are created in other functions (E&F) which are unconnected with A. I don't want to add G to each event handler (because it's large and there's lots of these event handlers), and doing so would require the same kind of solution as I'm seeking here (i.e., getting G to E&F). The global G, BTW, is an array that is necessary to build other elements as they, in turn, are built by AJAX. I'm not convinced that a singleton is real solution, either. Thanks.

    Read the article

  • Grails - Where to store properties related to domains

    - by GalmWing
    This is something I have been struggling about for some time now. The thing is: I have many (20 or so) static arrays of values. I say static because that is how I'm actually storing them, as static arrays inside some domains. For example, if I have a list of known websites, I do: class Website { ... static websites = ["web1", "web2" ...] } But I do this just while developing, because I can easily change the arrays if needed, but what I'm going to do when the application is ready for deployment? In my project it is very probable that, at some point, these arrays of values change. I've been researching on that matter, one can store application properties inside an external .properties file, but it will be impossible to store an array, even futile, because if some array gets an additional value, the application can't recognize it until the name of the new property is added where needed. Another approach is to store this information in the database, but for some reason it seems like a waste to add 20 or more tables that will have just two rows, an id and a name. And the last option, as far as I know, would be an XML, but I'm not very experienced with those. It seems groovy has a way of creating and reading XML files relatively easy, but I don't know how difficult would be to modify an XML whose layout is predefined in the application. Needless to say that storing them in the config.groovy is not an option since any change will require to recompile. I haven't come across some "standard" (maybe a best practice?) way of dealing with these. So the questions is: Where to store these arrays?

    Read the article

  • When compiling programs to run inside a VM, what should march and mtune be set to?

    - by Russ
    With VMs being slave to whatever the host machine is providing, what compiler flags should be provided to gcc? I would normally think that -march=native would be what you would use when compiling for a dedicated box, but the fine detail that -march=native is going to as indicated in this article makes me extremely wary of using it. So... what to set -march and -mtune to inside a VM? For a specific example... My specific case right now is compiling python (and more) in a linux guest inside a KVM-based "cloud" host that I have no real control over the host hardware (aside from 'simple' stuff like CPU GHz m CPU count, and available RAM). Currently, cpuinfo tells me I've got an "AMD Opteron(tm) Processor 6176" but I honestly don't know (yet) if that is reliable and whether the guest can get moved around to different architectures on me to meet the host's infrastructure shuffling needs (sounds hairy/unlikely). All I can really guarantee is my OS, which is a 64-bit linux kernel where uname -m yields x86_64.

    Read the article

  • JavaScript - Loop over all a tags, add an onclick to each one

    - by tripRev
    I've got a list of links that point to images, and a js function that takes a URL (of an image) and puts that image on the page when the function is called. I was originally adding an inline onlick="showPic(this.getAttribute('href'))" to each a, but I want to separate out the inline js. Here's my func for adding an onclick to each a tag when the page loads: function prepareLinks(){ var links = document.getElementsByTagName('a'); for(var i=0; i<links.length; i++){ var thisLink = links[i]; var source = thisLink.getAttribute('href'); if(thisLink.getAttribute('class') == 'imgLink'){ thisLink.onclick = function(){ showPic(source); return false; } } } } function showPic(source){ var placeholder = document.getElementById('placeholder'); placeholder.setAttribute('src',source); } window.onload = prepareLinks(); ...but every time showPic is called, the source var is the href of the last image. How can I make each link have the correct onclick?

    Read the article

  • JQuery DataTables link item

    - by rogcg
    I'm trying to link the items from a specific column, but each one will be linked for a different id from the json string. Unfortunately I can't find a way to do this using the API (I know there is a lot of ways to do that without using the API ), but I'm looking for a way to link a item from a column (each one with a link for a specific id). So here is my code, I use getJSON to get the JSON from the server, and I load the data from this JSON to the table like this: $.getJSON("/method/from/server/", function(data) { var total = 0; $("#table_body").empty(); var oTable = $('#mytable').dataTable( { "sPaginationType" : "full_numbers", "aaSorting": [[ 0, "asc" ]] }); oTable.fnClearTable(); $.each(data, function(i, item) { oTable.fnAddData( [ item.contact_name, item.contact_email ] ); }); }); What I want to do, is for each row, link the contact_name to its id, which is also in the JSON, and can be accessed inside this $.each loop by using item.contact_id. Is there a way to do this using DataTables API, if yes, could you explain me and provide a good resource that will help me with this? Thanks.

    Read the article

  • How to get id vertex from name vertex in R and Igraph?

    - by user1310873
    I have a graph with names from 1 to 10 library(igraph) library(Cairo) g<- graph(c(0,1,0,4,0,9,1,7,1,9,2,9,2,3,2,5,3,6,3,9,4,5,4,8,5,8,6,7,6,8,7,8),n=10,dir=FALSE) V(g)$name<-c(1:10) V(g)$label<-V(g)$name coords <- c(0,0,13.0000,0,5.9982,5.9991,7.9973,7.0009,-1.0008,11.9999,0.9993,11.0002,7.9989,13.0009,10.9989,14.0009,5.9989,14.0009,7.0000,4.0000) coords <- matrix(coords, 10,2,byrow=T) plot(g,layout=coords) listMn<-neighborhood(g,1,0:9) I'd like to do this but in opposite way m1<-V(g)[listMn[[7]]]$name the above instructions gets, 7 4 8 9 how to get listMn[[7]]=6 3 7 8 from names 7 4 8 9?

    Read the article

  • Capturing stdout from an imported module in wxpython and sending it to a textctrl, without blocking the GUI

    - by splafe
    There are alot of very similar questions to this but I can't find one that applies specifically to what I'm trying to do. I have a simulation (written in SimPy) that I'm writing a GUI for, the main output of the simulation is text - to the console from 'print' statements. Now, I thought the simplest way would be to create a seperate module GUI.py, and import my simulation program into it: import osi_model I want all the print statements to be captured by the GUI and appear inside a Textctrl, which there's countless examples of on here, along these lines: class MyFrame(wx.Frame): def __init__(self, *args, **kwds): <general frame initialisation stuff..> redir=RedirectText(self.txtCtrl_1) sys.stdout=redir class RedirectText: def __init__(self,aWxTextCtrl): self.out=aWxTextCtrl def write(self,string): self.out.WriteText(string) I am also starting my simulation from a 'Go' button: def go_btn_click(self, event): print 'GO' self.RT = threading.Thread(target=osi_model.RunThis()) self.RT.start() This all works fine, and the output from the simulation module is captured by the TextCtrl, except the GUI locks up and becomes unresponsive - I still need it to be accessible (at the very minimum to have a 'Stop' button). I'm not sure if this is a botched attempt at creating a new thread that I've done here, but I assume a new thread will be needed at some stage in this process. People suggest using wx.CallAfter, but I'm not sure how to go about this considering the imported module doesn't know about wx, and also I can't realistically go through the entire simulation architecture and change all the print statements to wx.CallAfter, and any attempt to capture the shell from inside the imported simulation program leads to the program crashing. Does anybody have any ideas about how I can best achieve this? So all I really need is for all console text to be captured by a TextCtrl while the GUI remains responsive, and all text is solely coming from an imported module. (Also, secondary question regarding a Stop button - is it bad form to just kill the simulation thread?). Thanks, Duncan

    Read the article

  • Choosing right control for list of items

    - by prostynick
    I am new to WPF and MVVM. In my ViewModel I have collection of items, for example: class Item { string Title {get; set;} string Description {get; set;} } I would like to create a view, so at the beginning I would have: Title1 Title2 Title3 If user click on one of title it will expand to show description, eg: Title1 Description1 Title2 Title3 If user click on other title, there will be two expanded items: Title1 Description1 Title2 Description2 Title3 This is probably very similar to Expander control and maybe I could use it, but I am doing it other way, to learn something new. What control should I use for this purpose? Should that be ItemsControl or maybe ListBox? I imagine, that if I use ItemsControl, I should probably extend my Item class to have something like bool IsExpanded and bind UI item visibility to that value. But maybe I could use ListBox and somehow bind UI item visibility to... Yeah, to what? :) How could I do such a simple thing?

    Read the article

  • Replace this Hex chars from string in PHP

    - by Guillermo
    I'm generating an XML from data that comes from database (and some JSON feeds). I'm having some problems with some texts that contains some hex chars that are breaking my XML. For example, see this screenshot of the error I get from Chrome: I identified the hex characters that are giving me problems (I believe they're called control characters). And these are: 0x03 0x05 0x16 0x0E How can I replace those characters with PHP before printing them on my XML output? Thanks!

    Read the article

  • How can I change the TreeView Icon into a folder icon?

    - by KDP
    I'm trying to change the icon of my TreeView in a folder icon. Also when it collapses it needs to have an opened folder icon. My treeview has databound items in it and the code is: <TreeView x:Name="TreeViewCategories" Grid.Row="0" Grid.Column="1" Height="610" HorizontalAlignment="Left" Margin="29,111,0,0" VerticalAlignment="Top" Width="315" BorderThickness="0" Background="Transparent" > <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding Items}"> <TextBlock FontSize="20" Text="{Binding Name}" PreviewMouseDown="TextBlock_PreviewMouseDown"/> </HierarchicalDataTemplate> </TreeView.ItemTemplate> </TreeView> Also this is how I fill the treeview with items from XML (It's a snipped out of alot of code: private void LoadHospitalXML() { try { FileStream fs = new FileStream("ConfigOrgHospital.xml", FileMode.Open, FileAccess.Read); var xml = XmlReader.Create(fs); rootElement = ConvertHospitalData(xml); this.TreeViewCategories.ItemsSource = null; List<HospitalWrapper> li = new List<HospitalWrapper>(); var hosp = rootElement.Items.FirstOrDefault(); if (hosp != null) { foreach (var i in hosp.Hospital) { li.AddIfNotNull(CreateHospList(i)); } } this.TreeViewCategories.ItemsSource = li; } catch (Exception e) { MessageBox.Show(e.Message); } } private HospitalWrapper CreateHospList(object obj) { var newItem = new HospitalWrapper(); newItem.Context = obj; //Hospital Names// if (obj is HospitalDataHospitalsHospital) { var hosp = (HospitalDataHospitalsHospital)obj; //newItem.Title = "Hospitals"; newItem.Name = hosp.DefaultName; var tmp = new HospitalWrapper(); tmp.Name = "Sites"; tmp.IsTitle = true; if (hosp.Sites != null) foreach (var i in hosp.Sites) { tmp.Items.AddIfNotNull(CreateHospList(i)); } newItem.Items.Add(tmp); tmp = new HospitalWrapper(); tmp.Name = "Specialties"; tmp.IsTitle = true; if (hosp.Deps != null) foreach (var j in hosp.Deps) { tmp.Items.AddIfNotNull(CreateHospList(j)); } newItem.Items.Add(tmp); } }

    Read the article

  • How to see what objects lie in which generation in YourKit?

    - by prams
    I am using YourKit (11.0) to try to profile my j2ee app. The app uses java 6 and running on 64-bit linux (centos). I was told that YourKit possibly tells us which objects exist in which generation (eden, old, etc) at any given point of time. On a side note, I am trying to chase a problem where memory usage keeps increasing until a major collection happens (every 4 hrs) and I am suspicious about few particular objects, so I am interested to know where those objects lie at different times. Fortunately I know lot of memory is being consumed in one particular area of code (so other objects are possibly directly being put into the old gen), but don't exactly know how much of that memory is being put into eden space, how much is being collected by the minor collections, etc. Thanks.

    Read the article

  • Multicast delegates in c#

    - by Jalpesh P. Vadgama
    In yesterday’s post We learn about Delegates and how we can use delegates in C#. In today’s blog post we are going to learn about Multicast delegates. What is Multicast Delegates? As we all know we can assign methods as object to delegate and later on we can call that method with the help delegates. We can also assign more then methods to delegates that is called Multicast delegates. It’s provide functionality to execute more then method at a time. It’s maintain delegates as invocation list (linked list). Let’s understands that via a example. We are going to use yesterday’s example and then we will extend that code multicast delegates. Following code I have written to demonstrate the multicast delegates. using System; namespace Delegates { class Program { public delegate void CalculateNumber(int a, int b); static void Main(string[] args) { int a = 5; int b = 5; CalculateNumber addNumber = new CalculateNumber(AddNumber); CalculateNumber multiplyNumber = new CalculateNumber(MultiplyNumber); CalculateNumber multiCast = (CalculateNumber)Delegate.Combine (addNumber, multiplyNumber); multiCast.Invoke(a,b); Console.ReadLine(); } public static void AddNumber(int a, int b) { Console.WriteLine("Adding Number"); Console.WriteLine(5 + 6); } public static void MultiplyNumber(int a, int b) { Console.WriteLine("Multiply Number"); Console.WriteLine(5 + 6); } } } As you can see in the above code I have created two method one for adding two numbers and another for multiply two number. After that I have created two same CalculateNumber delegates addNumber and multiplyNumber then I have create a multicast delegates multiCast with combining two delegates. Now I want to call this both method so I have used Invoke method to call this delegates. As now our code is let’s run the application. Following is a output as expected. As you can we can execute multiple methods with multicast delegates the only thing you need to take care is that we need to type for both delegates. That’s it. Hope you like it. Stay tuned for more.. Till then happy programming.

    Read the article

  • How to bind a XPO Data Source to an ASPxGridView control

    - by nikolaosk
    I have been involved with an ASP.Net project recently and I have implemented it using the awesome DevExpress ASP.Net controls. In this post I will show you how to bind an XPODataSource control to an ASPxGridView control. If you want to implement this example you need to download the trial version of these controls unless you are a licensed holder of DevExpress products. We will need a database to work with. I will use AdventureWorks2008R2 . You can download it here . We will need an instance of SQL...(read more)

    Read the article

  • Old School Wizardry Tip: Batch File Comments

    - by jkauffman
    Johnny, the Endangered Keyboard-Driven Windows User Some of my proudest, obscure Windows tricks are losing their relevance. I know I’m not alone. Keyboard shortcuts are going the way of the dodo. I used to induce fearful awe by slapping Ctrl+Shift+Esc in front of the lowly, pedestrian Windows users. No windows key on the keyboard? No problem: Ctrl+Esc. No menu key on the keyboard: Shift+F10. I am also firmly planted in the habit of closing windows with the Alt+Space menu (Alt+Space, C); and I harbor a brooding, slow=growing list of programs that fail to support this correctly (that means you, Paint.NET). Every time a new version of windows comes out, the support for some of these minor time-saving habits get pared out. Will I complain publicly? Nope, I know my old ways should be axed to conserve precious design energy. In fact, I disapprove of fierce un-intuitiveness for the sake of alleged productivity. Like vim, for example. If you approach a program after being away for 5 years, having to recall encyclopedic knowledge is a flaw. The RTFM disciples have lost. Anyway, some of the items in my arsenal of goofy time-saving tricks are still relevant today. I wanted to draw attention to one that’s stood the test of time. Remember Batch Files? Yes, it’s true, batch files are fading faster than the world of print. But they're not dead yet. I still run into some situations where I opt to use batch files. They are still relevant for build processes, or just various development workflow tools. Sure, there’s powershell, but there’s that stupid Set-ExecutionPolicy speed bump standing in your way; can you really spare the time to A) hunt down that setting on all machines affected and/or B) make futile efforts to convince your coworkers/boss that the hassle was worth it? When possible, I prefer the batch file wild card. And whenever I return to batch files, I end up researching some of the unintuitive aspects such as parameters, quote handling, and ERRORLEVEL. But I never have to remember to use “REM” for comment lines, because there’s a cleaner way to do them! Double Colon For Eye-Friendly Comments Here is a very simple batch file, with pretty much minimal content: @ECHO OFF SETLOCAL REM This is a comment ECHO This batch file doesn’t do much If you code on a daily basis, this may be more suitable to your eyes: @ECHO OFF SETLOCAL :: This is a comment ECHO This batch file doesn’t do much Works great! I imagine I find it preferable due to the similarity to comments in other situations: // or ;  or # I’ve often make visual pseudo-line breaks in my code, and this colon-based syntax works wonders: @ECHO OFF SETLOCAL :: Do stuff ECHO Doing Stuff :::::::::::::::::::::::::::: :: Do more stuff ECHO This batch file doesn’t do much Not only is it more readable, but there’s a slight performance benefit. The batch file engine sees this as an invalid line label and immediately reads the following line. Use that fact to your advantage if this trick leads you into heated nerd debate. Two Pitfalls to Avoid Be aware of that there are a couple situations where this hack will fail you. It most likely won’t be a problem unless you’re getting really sophisticated with your batch files. Pitfall #1: Inline comments @ECHO OFF SETLOCAL IF EXIST C:\SomeFile.txt GOTO END ::This will fail :END Unfortunately, this fails. You can only have whitespace to the left of your comments. Pitfall #2: Code Blocks @ECHO OFF SETLOCAL IF EXIST C:\SomeFile.txt (         :: This will fail         ECHO HELLO ) Code blocks, such as if statements and for loops, cannot contain these comments. This is ultimately due to the fact that entire code blocks are processed as a single line. I originally learned this from Rob van der Woude’s site. He goes into more depth about the behavior of the pitfalls as well, if you are interested in further details. I hope this trick earns you serious geek rep!

    Read the article

  • Commit Review Questions

    - by Wes McClure
    Note: in this article when I refer to a commit, I mean the commit you plan to share with the rest of the team, if you have local commits that you plan to amend/combine, I am referring to the final result. In time you will find these easier to do as you develop, however, all of these are valuable before checking in!  The pre commit review is a nice time to polish what might have been several hours of intense work, during which these things were the last things on your mind!  If you are concerned about losing your work in the process of responding to these questions, first do a check-in and amend it as you go (assuming you are using a tool such as git that supports this), rolling the result into one nice commit for everyone else.  Did you review your commit, change by change, with a diff utility? If not, this is a list of reasons why you might want to start! Did you test your changes? If the test is valuable to be automated, is it? If it’s a manual testing scenario, did you at least try the basics manually? Are the additions/changes formatted consistently with the rest of the project? Lots of automated tools can help here, don’t try to manually format the code, that’s a waste of time and as a human you will fail repeatedly. Are these consistent: tabs versus spaces, indentation, spacing, braces, line breaks, etc Resharper is a great example of a tool that can automate this for you (.net) Are naming conventions respected? Did you accidently use abbreviations, unless you have a good reason to use them? Does capitalization match the conventions in the project/language? Are files partitioned? Sometimes we add new code in existing files in a pinch, it’s a good idea to split these out if they don’t belong ie: are new classes defined in new files, if this is something your project values? Is there commented out code? If you are removing an existing feature, get rid of it, that is why we have VCS If it’s not done yet, then why are you checking it in? Perhaps a stash commit (git)? Did you leave debug or unnecessary changes? Do you understand all of the changes? http://geekswithblogs.net/wesm/archive/2012/04/11/programming-doesnrsquot-have-to-be-magic.aspx Are there spelling mistakes? Including your commit message! Is your commit message concise? Is there follow up work? Are there tasks you didn’t write down that you need to follow up with? Are readability or reorganization changes needed? This might be amended into the final commit, or it might be future work that needs added to the backlog. Are there other things your team values that you should review?

    Read the article

  • Using a SQL Prompt snippet with template parameters

    - by SQLDev
    As part of my product management role I regularly attend trade shows and man the Red Gate booth in the vendor exhibition hall. Amongst other things this involves giving product demos to customers. Our latest demo involves SQL Source Control and SQL Test in a continuous integration environment. In order to demonstrate quite how easy it is to set up our tools from scratch we start the demo by creating an entirely new database to link to source control, using an individual database name for each conference attendee. In SQL Server Management Studio this can be done either by selecting New Database from the Object Explorer or by executing “CREATE DATABASE DemoDB_John” in a query window. We recently extended the demo to include SQL Test. This uses an open source SQL Server unit testing framework called tSQLt (www.tsqlt.org), which has a CLR object that requires EXTERNAL_ACCESS to be set as follows: ALTER DATABASE DemoDB_John SET TRUSTWORTHY ON This isn’t hard to do, but if you’re giving demo after demo, this two-step process soon becomes tedious. This is where SQL Prompt snippets come into their own. I can create a snippet named create_demo_db for this following: CREATE DATABASE DemoDB_John GO USE DemoDB_John GO ALTER DATABASE DemoDB_John SET TRUSTWORTHY ON Now I just have to type the first few characters of the snippet name, select the snippet from SQL Prompt’s candidate list, and execute the code. Simple! The problem is that this can only work once due to the hard-coded database name. Luckily I can leverage a nice feature in SQL Server Management Studio called Template Parameters. If I modify my snippet to be: CREATE DATABASE <DBName,, DemoDB_> GO USE <DBName,, DemoDB_> GO ALTER DATABASE <DBName,, DemoDB_> SET TRUSTWORTHY ON Once I’ve invoked the snippet, I can press Ctrl-Shift-M, which calls up the Specify Values for Template Parameters dialog, where I can type in my database name just once. Now you can click OK and run the query. Easy. Ideally I’d like for SQL Prompt to auto-invoke the Template Parameter dialog for all snippets where it detects the angled bracket syntax, but typing in the keyboard shortcut is a small price to pay for the time savings.

    Read the article

  • Turning off the Visual Studio &ldquo;Attach to process&rdquo; security warning&hellip;

    - by Shawn Cicoria
    When you’re urnning under x64 you have to affect 1 addition spot in the registry to disable this warning – which clearly should only be done by folks that know what they’re doing. NOTE: affecting the registry can be harmful – do so at your own risk. Windows Registry Editor Version 5.00 Windows Registry Editor Version 5.00 [HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\10.0\Debugger] "DisableAttachSecurityWarning"=dword:00000001 [HKEY_CURRENT_USER\Software\Wow6432Node\Microsoft\VisualStudio\10.0\Debugger] "DisableAttachSecurityWarning"=dword:00000001

    Read the article

  • Creating SharePoint sites from xml using Powershell

    - by Norgean
    It is frequently useful to create / delete web applications in a development environment. If you need to create a structure, this can quickly become tedious. Enter Powershell, xml and recursive functions. Create the structure in xml. Something like: <Sites>     <Site Name="Test 1" Url="Test1" />     <Site Name="Test 2" Url="Test2" >         <Site Name="Test 2 1" Url="Test21" >             <Site Name="Test 2 1 1" Url="Test211" />             <Site Name="Test 2 1 2" Url="Test212" />         </Site>     </Site>     <Site Name="Test 3" Url="Test3" >         <Site Name="Test 3 1" Url="Test31" />         <Site Name="Test 3 2" Url="Test32" />         <Site Name="Test 3 3" Url="Test33" >             <Site Name="Test 3 3 1" Url="Test331" />             <Site Name="Test 3 3 2" Url="Test332" />         </Site>         <Site Name="Test 3 4" Url="Test34" />     </Site> </Sites> Read this structure in Powershell, and recursively create the sites. Oh, and have cool progress dialogs, too. $snap = Get-PSSnapin | Where-Object { $_.Name -eq "Microsoft.SharePoint.Powershell" } if ($snap -eq $null) {     Add-PSSnapin "Microsoft.SharePoint.Powershell" } function CreateSites($baseUrl, $sites, [int]$progressid) {     $sitecount = $sites.ChildNodes.Count     $counter = 0     foreach ($site in $sites.Site)     {         Write-Progress -ID $progressid -Activity "Creating sites" -status "Creating $($site.Name)" -percentComplete ($counter / $sitecount*100)         $counter = $counter + 1         Write-Host "Creating $($site.Name) $($baseUrl)/$($site.Url)"         New-SPWeb -Url "$($baseUrl)/$($site.Url)" -AddToQuickLaunch:$false -AddToTopNav:$false -Confirm:$false -Name "$($site.Name)" -Template "STS#0" -UseParentTopNav:$true         if ($site.ChildNodes.Count -gt 0)         {             CreateSites "$($baseUrl)/$($site.Url)" $site ($progressid +1)         }         Write-Progress -ID $progressid -Activity "Creating sites" -status "Creating $($site.Name)" -Completed     } } # read an xml file $xml = [xml](Get-Content "C:\Projects\Powershell\sites.xml") $xml.PreserveWhitespace = $false CreateSites "http://$($env:computername)" $xml.Sites 1 Easy! Sensible real life implementations will also include templateid in the xml, will check for existence of a site before creating it, etc.

    Read the article

  • optimizing a windows server 2003 storage capacity

    - by Hosni
    I have got a windows server 2003 with partitioned Hard drive 10Go and 80Go, and i want to improve the storage capacity as the little partition 10Go is almost full. So i have got choice between partition the hard drive to equal parts, or set up a new hard drive with better storage capacity.knowing that the server has to be on service as soon as possible. Which one may be the better solution that takes less time and less risks?

    Read the article

  • Supervisor sentry-web exit status 1

    - by rockingskier
    I'm having problems getting Sentry (https://www.getsentry.com - not enough rep for a link) running as a service using supervisor. I can run Sentry in the command line and view it correctly in the browser but when it comes to supervisor I am completely in the dark. I shall try and give all the details I can Initial user warning By no means a server admin, just playing/learning in VirtualBox. Literally only just discovered supervisor from reading the Sentry documentation so I may well be making some obvious mistakes here. The setup: Ubuntu server 11.10 (fresh install, VirtualBox) virtualenv with Sentry and its dependencies. supervisor Instructions followed Supervisor with vanilla ini file Sentry/supervisor instructions My supervisor ini (Sentry section) [program:sentry-web] directory=/root/.virtualenvs/sentry/ command= start http /root/.virtualenvs/sentry/bin/sentry autostart=true autorestart=true redirect_stderr=true OK so here we go: When I run supervisord -n I get the following messages rather than a nice web interface to play with. 2012-04-12 23:48:09,024 CRIT Supervisor running as root (no user in config file) 2012-04-12 23:48:09,097 INFO RPC interface 'supervisor' initialized 2012-04-12 23:48:09,099 CRIT Server 'unix_http_server' running without any HTTP authentication checking 2012-04-12 23:48:09,100 INFO supervisord started with pid 17813 2012-04-12 23:48:10,126 INFO spawned: 'sentry-web' with pid 17816 2012-04-12 23:48:10,169 INFO exited: sentry-web (exit status 1; not expected) 2012-04-12 23:48:11,199 INFO spawned: 'sentry-web' with pid 17817 2012-04-12 23:48:11,238 INFO exited: sentry-web (exit status 1; not expected) 2012-04-12 23:48:13,269 INFO spawned: 'sentry-web' with pid 17818 2012-04-12 23:48:13,309 INFO exited: sentry-web (exit status 1; not expected) 2012-04-12 23:48:16,343 INFO spawned: 'sentry-web' with pid 17819 2012-04-12 23:48:16,389 INFO exited: sentry-web (exit status 1; not expected) 2012-04-12 23:48:17,394 INFO gave up: sentry-web entered FATAL state, too many start retries too quickly CRIT Supervisor running as root (no user in config file) suggests a big problem, probably shouldn't be running this as root? CRIT Server 'unix_http_server' running without any HTTP authentication checking Surely authentication is optional? INFO exited: sentry-web (exit status 1; not expected) *sad face* here. Google hasn't been much help yet. Anyway, that is it as far as I know. If anyone can help me that would be greatly appreciated. Thanks in advance.

    Read the article

  • What does this IIS memory dump mean? (reserved memory)

    - by Jesse
    My w3wp's are recycling every 60 seconds after using too much virtual memory. I ran the IIS Debug Diagnostic Tool to capture a memory dump before the worker process recycled; the most interesting part seems to be this: Virtual Allocation Summary Reserved memory 4.88 GBytes Committed memory 328.27 MBytes Mapped memory 17.36 MBytes Reserved block count 524 blocks Committed block count 1082 blocks Mapped block count 43 blocks So that 4.88 GBytes of reserved memory seems really big. But neither the DotNetMemoryAnalysis or the regular Memory Pressure Analyzer seems to tell me where that 4.88 GB went. How can I find out?

    Read the article

  • Monitoring Dell/HP Servers Running ESXi (Free)

    - by Untalented
    What are you all doing to monitor ESXi servers that run the free edition? With the lack of SNMP support, it seems fairly limited to me. What'd I'd like to be able to do is get some type of alert when a drive or other hardware fails. I've seen a few articles on getting OpenManage installed on an ESXi box (to rebuild an array), but it seems to be quite a pain as well. Even if I get OpenManage working, I won't have alerts without SNMP. Any comments, input, or guidance would be greatly appreciated.

    Read the article

< Previous Page | 9 10 11 12 13 14 15 16 17 18  | Next Page >