Search Results

Search found 18244 results on 730 pages for 'controller action'.

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

  • Can I rebuild degraded RAID1 on a SAS 5 i controller with a larger mirror drive size?

    - by Kenny
    A drive failed on a Dell SAS 5i controller - see controller bios screengrab: http://imagebin.ca/view/SkZbszA.html The primary is a 160GB 10k sata drive. I added a 250GB 7k rpm drive in the hope that the array would rebuild onto this drive. This did not happen. (assuming that the controller would just operate at the speed of the slowest drive) The controller could see the new drive, but it didn't automatically rebuild the raid1 onto this drive. (my assumption is that it did not do this rebuild as the drive sizes are different). There was an option to add the new drive to the existing raid1 array - but when I tried this a message appeared stating that all data on the array would be lost. (I didn't get a screenshot of this message, I will later) Should the SAS 5i allow me to rebuild the array onto a larger drive? Is the option to add the drive to the array the right way to go? Many thanks!

    Read the article

  • Zend framework "invalid controller" error message

    - by stef
    When I load the homepage of a ZF site I get a message saying "Invalid controller specified (error)" where "error" seems to be the name of the controller. In my bootstrap.php I have the snippet below where I added the prints statement in the catch(): // Dispatch the request using the front controller. try { $frontController->dispatch(); } catch (Exception $exception) { print $exception; exit; exit($exception->getMessage()); } This prints out: exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in /www/common/ZendFramework/library16/Zend/Controller/Dispatcher/Standard.php:241 Stack trace: #0 /www/common/ZendFramework/library16/Zend/Controller/Front.php(934): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http)) #1 /www/site.com/htdocs/application/bootstrap.php(38): Zend_Controller_Front->dispatch() #2 /www/site.com/htdocs/public/index.php(16): require('/www/site....') #3 {main} Can anyone make sense out of what it going on? I have a hunch it has something to do with case sensitivity and the naming conventions of ZF. The initial "invalid controller" message comes from the snippet below print $request->getControllerName(); if (!$this->isDispatchable($request)) { $controller = $request->getControllerName(); if (!$this->getParam('useDefaultControllerAlways') && !empty($controller)) { require_once 'Zend/Controller/Dispatcher/Exception.php'; throw new Zend_Controller_Dispatcher_Exception('Invalid controller specified (' . $request->getControllerName() . ')'); } $className = $this->getDefaultControllerClass($request); } This all prints out "indexerrorInvalid controller specified (error)" so it looks like it's trying to load the index controller first, can not and then has a problem loading the error controller. Could it just be that the path to the controller files is wrong?

    Read the article

  • How to reference a Domain Controller out of the Local Network?

    - by Adrian
    We have multiple servers scattered over different hosting providers. For learning, experimenting and, ultimately, production purposes, I set one of them as a Domain Controller. That went well, most of our services are now authenticating via AD, which helps us a lot. What I want to do now is to simplify the authentication for the multiple servers, by making each of them look at the Domain Controller. This way, our Devs can log into (Remote Desktop) the multiple servers with the same credentials from AD. I know I have to configure each server to look at the Domain Controller. But when I try to add the Domain Controller to the Computer, it cannot find it, although the Domain Controller address is a valid, reachable internet sub-domain (as in "ad.ourcompany.com"). This is the detailed error message: Note: This information is intended for a network administrator. If you are not your network's administrator, notify the administrator that you received this information, which has been recorded in the file C:\Windows\debug\dcdiag.txt. The following error occurred when DNS was queried for the service location (SRV) resource record used to locate an Active Directory Domain Controller for domain ad.ourcompany.com: The error was: "DNS name does not exist." (error code 0x0000232B RCODE_NAME_ERROR) The query was for the SRV record for _ldap._tcp.dc._msdcs.ad.ourcompany.com Common causes of this error include the following: - The DNS SRV records required to locate a AD DC for the domain are not registered in DNS. These records are registered with a DNS server automatically when a AD DC is added to a domain. They are updated by the AD DC at set intervals. This computer is configured to use DNS servers with the following IP addresses: 109.188.207.9 109.188.207.10 - One or more of the following zones do not include delegation to its child zone: ad.ourcompany.com ourcompany.com com . (the root zone) For information about correcting this problem, click Help. What am I missing? I'm an experienced Dev, but a newbie Sysdamin experimenting with new stuff. Disclaimer All IP addresses and domains/subdomains were changed to preserve security. If by any chance you still can see private information, please let me know so that I can change it.

    Read the article

  • How to fire the action of a uibarbuttonitem programatically?

    - by Aruna Herath
    I have created an uibarbuttonitem dynamically and it works properly. I want to fire that uibarbutton item action(click) programatically for unit testing. Even though the code work properly when I log the action of the bar button item in the application code (not on testing code) it gives null. The code I have used is given below. NSLog(@"%@",NSStringFromSelector(barButton.action)); In the testing code I have created a bar button called logout and assign barbutton to that.To click the bar button item programatically I followed the following code. [logout.target performSelector:logout.action]; But it didn't work . I logged the action of logout button and it also gives null. NSLog(@"%@",logout.action); I want to know how to programatically click a uibarbutton item which created dynamically .

    Read the article

  • Cakephp 1.3 controller save() does not save data

    - by Thijs
    Hi all, I want to add a new user to the database, and do so by making them fill in a form and submitting this. All seems to work fine. Just before my save() call in the controller I return all data and all necessary data is there. It is valid(ated), since no errors are returned. But then nothing happens. I'm being returned to my form without any errors being shown. This is my 'save-line': if($this->Registratie->save($this->data)) { I'm not making use of any beforeSave() methods. Using debug($this->validationErrors); shows: app/controllers/registratie_controller.php (line 45) Which is the line of code from above. I've been going through my code over and over, but I'm clueless as to what the problem could be. Any help is greatly appreciated! Thanks in advance!

    Read the article

  • Setup a new domain controller over a temporary VPN, but now Windows delays startup?

    - by Kris Anderson
    I'm migrating servers from colo locations to Amazon's VPC EC2 instances. If anyone hasn't worked with Amazon VPC before, VPN is a pain in the arse! Anyways, I setup a new server that acts as the domain controller for our Amazon VPC. In order to migrate all the user accounts from our existing domain controllers I manually connected to our colo VPN using my user account on the new Amazon EC2 machine. I was able to join the domain and the new Amazon server became another domain controller on our network. So far so good. The problem I'm having is that when booting the EC2 domain controller (which is no longer connected to the VPN so it can't communicate with the existing controllers), it takes a good 6-8 minuted before I can remote into the server (instead of the 1-2 minutes it should take). Also, during this time most of the services we also run (like IIS) also give 404 errors until the 6-8 minutes have passed. It's almost like the domain controller is attempting to reach the other domain controllers first and after 6-8 minutes it falls back to the one located on the local machine? I don't think that's what's happening though, because Server 2008 R2 doesn't have primary and backup domain controllers. They're all equal as far as Windows is concerned. For my network adapter I have only one DNS listed, 127.0.0.1, so it should be looking up the local domain controller and not the other domain controllers it connected to over VPN when VPN was enabled. In the server logs I'm seeing these warnings pop up during a reboot: The winlogon notification subscriber is taking long time to handle the notification event (CreateSession). The winlogon notification subscriber took 409 second(s) to handle the notification event (CreateSession). Any ideas on what's happening here? I would try removing the existing domain controllers from the new Amazon EC2 machine, but I still need to connect over VPN a few times to migrate some data between the servers, and I don't want that change being reflected back to the other domain controllers in our colo locations.

    Read the article

  • Getting objc_msg send exception while release navigation controller and view controller in presentmo

    - by Rani
    Hi Guys, I'm getting exception in dealloc when I release navcontroller and viewcontroller of presentmodelviewcontrolelr the code that i wrote MasterViewController* viewController = [[MasterViewController alloc] init]; viewController.pathIsFrom = @"Home"; isBookMark=YES; viewController.isBookmark=isBookMark; UINavigationController *itemNavController = [[UINavigationController alloc] initWithRootViewController:viewController]; itemNavController.navigationBar.barStyle= UIBarStyleBlackOpaque; [self.navigationController presentModalViewController:itemNavController animated:YES]; [itemNavController release]; [viewController release]; can anyone help me. Thanks In advance.

    Read the article

  • Can I rebuild degraded RAID1 on a SAS 5 i controller with a larger mirror drive size?

    - by Kenny
    Hi, A drive failed on a Dell SAS 5i controller - see controller bios screengrab: http://imagebin.ca/view/SkZbszA.html The primary is a 160GB 10k sata drive. I added a 250GB 7k rpm drive in the hope that the array would rebuild onto this drive. This did not happen. (assuming that the controller would just operate at the speed of the slowest drive) The controller could see the new drive, but it didn't automatically rebuild the raid1 onto this drive. (my assumption is that it did not do this rebuild as the drive sizes are different). There was an option to add the new drive to the existing raid1 array - but when I tried this a message appeared stating that all data on the array would be lost. (I didn't get a screenshot of this message, I will later) Should the SAS 5i allow me to rebuild the array onto a larger drive? Is the option to add the drive to the array the right way to go? Many thanks!

    Read the article

  • How to access the parent view controller?

    - by tarnfeld
    I am using this code to push a view controller in ViewControllerA: DatePickerViewController *viewController = [[DatePickerViewController alloc] initWithNibName:@"DatePickerViewController" bundle:nil]; NSMutableArray *info = [[NSMutableArray alloc] initWithObjects:@"Exam Duration",nil]; [viewController setInfo:info]; [info release]; [self.navigationController pushViewController:viewController animated:YES]; [viewController release]; In the DatePickerViewController that is slid in, it has a text field. In ViewControllerA how can I get the value of this text field once the viewWillDisappear method is fired, it's to save data.

    Read the article

  • WiX: Extracting Binary-string in Custom Action yields string like "???good data"

    - by leiflundgren
    I just found a weird behaviour when attempting to extract a string from the Binary-table in the MSI. I have a file containing "Hello world", the data I get is "???Hello world". (Literary question mark.) Is this as intended? Will it always be exactly 3 characters in the beginning? Regards Leif Sample code: [CustomAction] public static ActionResult CustomAction2(Session session) { View v = session.Database.OpenView("SELECT `Name`,`Data` FROM `Binary`"); v.Execute(); Record r = v.Fetch(); int datalen = r.GetDataSize("Data"); System.IO.Stream strm = r.GetStream("Data"); byte[] rawData = new byte[datalen]; int res = strm.Read(rawData, 0, datalen); strm.Close(); String s = System.Text.Encoding.ASCII.GetString(rawData); // s == "???Hello World" return ActionResult.Success; }

    Read the article

  • grails date from params in controller

    - by nils petersohn
    y is it so hard to extract the date from the view via the params in a grails controller? i don't want to extract the date by hand like this: instance.dateX = parseDate(params["dateX_value"])//parseDate is from my helper class i just want to use instance.properties = params you know :) in the model the type is java.util.Date and in the params is all the information (dateX_month, dateX_day, ...) i searched on the net and found nothing on this :( i hoped that grails 1.3.0 could help but still the same thing. i can't and will not belief that extracting the date by hand is nessesary!

    Read the article

  • Proper design a Model-Controller in Cocoa?

    - by legege
    Hi, I'm trying to design a simple Cocoa application and I would like to have a clear and easy to understand software architecture. Of course, I'm using a basic MVC design and my question concerns the Model layer. For my application, the Model represents data fetched on the Internet with a XML-RPC API. I'm planning to use Core Data to represent a locally fetched version. How should the data be loaded initially? I'm reading the Cocoa Design Pattern book, and they talk about a Model-Controller that is centric to the Model. How would that be done? Thanks!

    Read the article

  • Handling Exceptions that happen in a asp.net MVC Controller Constructor

    - by Jason
    What's the best way to handle exceptions that happen from within a controller's constructor? All I can think of to do is use Application_OnError() or put a try/catch in my ControllerFactory. Neither of these solutions seem ideal. Application_OnError is to broad - I have some non-mvc content in the site that has its own error handling. Using a try/catch block seems kinda hacky. If I'm serving different content type -html/text/json/rss.... I would like to be able to handle the exception from within the action method instead of having to write all kinds of conditions to determine what kind of error message to serve. Am I missing something here, or has anyone else dealt with this?

    Read the article

  • Can you do a struts2 action redirect using POST instead of GET?

    - by Andy Pryor
    <action name="actionA" class="com.company.Someaction"> <result name="success" type="redirect-action"> <param name="actionName">OtherActionparam> <param name="paramA">${someParams}</param> <param name="paramB">${someParams}</param> <param name="aBoatLoadOfOtherParams">${aBoatLoadOfOtherParams}</param> </result> </action> In the above action map, I am redirecting from SomeAction to OtherAction. I am having issues, because unfortunately I need to pass a large amount of data between the two actions. IE7 will only allow GET requests to be like 2k, so its blowing up when I'm just over that limit when the response calls a get request to the other action. Is it possible for me to set this redirect, to end up with a POST being called to the other action?

    Read the article

  • jquery event handler- trigger function upon specific key and action

    - by Gal
    Background story: when a user selects a portion of text in a text field with her mouse (mark it up manually), and subsequently hits "alt" key, a certain function would trigger. My questions are: How can I trigger a function when a user hits a key (in her keyboard)? How can I preserve a portion of text selected, and use it as a parameter for that function? I've tried looking up online but haven't found any good answers, but i'd greatly appreciate links as well.

    Read the article

  • .NET - Retrieve attribute from controller context?

    - by ropstah
    I have a controller insert action: <AcceptVerbs(HttpVerbs.Post)> _ Function InsertObject(<Bind(Exclude:="Id")> <ModelBinder(GetType(CustomModelBinder))> ByVal object As SomeObject) As ActionResult End Function And i have a CustomModelBinder class with a BindModel implementation: Public Function BindModel( _ ByVal controllerContext As System.Web.Mvc.ControllerContext, _ ByVal bindingContext As System.Web.Mvc.ModelBindingContext) As Object Implements System.Web.Mvc.IModelBinder.BindModel For Each s In HttpContext.Current.Request.Form.Keys HttpContext.Current.Response.Write(s & ": " & HttpContext.Current.Request.Form(s) & "<br />") Next HttpContext.Current.Response.End() End Function As you can see I have a controllerContext and a ModelBindingContext available. How do I get the: <Bind(Exclude:="Id")> part inside the BindModel implementation?

    Read the article

  • WiFi is not detecting in compaq presario c700

    - by charan
    Hi I have a Compaq Presario c700 laptop,I just installed Ubuntu 10.04 in my laptop. My wireless networks are not showing in network manager. charan@charan-laptop:~$ lspci -nn 00:00.0 Host bridge [0600]: Intel Corporation Mobile PM965/GM965/GL960 Memory Controller Hub [8086:2a00] (rev 03) 00:02.0 VGA compatible controller [0300]: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller [8086:2a02] (rev 03) 00:02.1 Display controller [0380]: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller [8086:2a03] (rev 03) 00:1b.0 Audio device [0403]: Intel Corporation 82801H (ICH8 Family) HD Audio Controller [8086:284b] (rev 03) 00:1c.0 PCI bridge [0604]: Intel Corporation 82801H (ICH8 Family) PCI Express Port 1 [8086:283f] (rev 03) 00:1d.0 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #1 [8086:2830] (rev 03) 00:1d.1 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #2 [8086:2831] (rev 03) 00:1d.2 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB UHCI Controller #3 [8086:2832] (rev 03) 00:1d.7 USB Controller [0c03]: Intel Corporation 82801H (ICH8 Family) USB2 EHCI Controller #1 [8086:2836] (rev 03) 00:1e.0 PCI bridge [0604]: Intel Corporation 82801 Mobile PCI Bridge [8086:2448] (rev f3) 00:1f.0 ISA bridge [0601]: Intel Corporation 82801HEM (ICH8M) LPC Interface Controller [8086:2815] (rev 03) 00:1f.1 IDE interface [0101]: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) IDE Controller [8086:2850] (rev 03) 00:1f.2 SATA controller [0106]: Intel Corporation 82801HBM/HEM (ICH8M/ICH8M-E) SATA AHCI Controller [8086:2829] (rev 03) 00:1f.3 SMBus [0c05]: Intel Corporation 82801H (ICH8 Family) SMBus Controller [8086:283e] (rev 03) 01:00.0 Network controller [0280]: Broadcom Corporation BCM4311 802.11b/g WLAN [14e4:4311] (rev 02) 02:01.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ [10ec:8139] (rev 10)

    Read the article

  • Wireless drivers

    - by Kencer
    The results for my laptop are as below. How will i install wireless drivers and graphics? $ lspci 00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09) 00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09) 00:14.0 USB controller: Intel Corporation Panther Point USB xHCI Host Controller (rev 04) 00:16.0 Communication controller: Intel Corporation Panther Point MEI Controller #1 (rev 04) 00:1a.0 USB controller: Intel Corporation Panther Point USB Enhanced Host Controller #2 (rev 04) 00:1b.0 Audio device: Intel Corporation Panther Point High Definition Audio Controller (rev 04) 00:1c.0 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 1 (rev c4) 00:1c.1 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 2 (rev c4) 00:1c.3 PCI bridge: Intel Corporation Panther Point PCI Express Root Port 4 (rev c4) 00:1d.0 USB controller: Intel Corporation Panther Point USB Enhanced Host Controller #1 (rev 04) 00:1f.0 ISA bridge: Intel Corporation Panther Point LPC Controller (rev 04) 00:1f.2 SATA controller: Intel Corporation Panther Point 6 port SATA Controller [AHCI mode] (rev 04) 00:1f.3 SMBus: Intel Corporation Panther Point SMBus Controller (rev 04) 02:00.0 Network controller: Broadcom Corporation Device 4365 (rev 01) 03:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 07) $ sudo lshw -c network *-network UNCLAIMED description: Network controller product: Broadcom Corporation vendor: Broadcom Corporation physical id: 0 bus info: pci@0000:02:00.0 version: 01 width: 64 bits clock: 33MHz capabilities: pm msi pciexpress bus_master cap_list configuration: latency=0 resources: memory:f0500000-f0507fff *-network description: Ethernet interface product: RTL8111/8168B PCI Express Gigabit Ethernet controller vendor: Realtek Semiconductor Co., Ltd. physical id: 0 bus info: pci@0000:03:00.0 logical name: eth0 version: 07 serial: 3c:97:0e:85:c0:0d size: 100Mbit/s capacity: 1Gbit/s width: 64 bits clock: 33MHz capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=full firmware=rtl8168e-3_0.0.4 03/27/12 ip=172.16.96.36 latency=0 link=yes multicast=yes port=MII speed=100Mbit/s resources: irq:43 ioport:2000(size=256) memory:f0404000-f0404fff memory:f0400000-f0403fff $ rfkill list all 0: tpacpi_bluetooth_sw: Bluetooth Soft blocked: no Hard blocked: no

    Read the article

  • Binding in the view or the controller?

    - by da_b0uncer
    I've seen 2 different approaches with MVC on the web. One, like in ExtJS, is to bind the callbacks to the view via the controller. Finding every element on the view and adding the functionallity. The other, like in angular.js and in the lift-framework server-side, too, is to bind in the views and just write the functionallity in the controller. Which is better and cleaner? The ExtJS approach has dumb views and all the logic in the controller. Which seems clean to me. I had problems with global IDs for GUI-elements or relative navigation to GUI-elements in this approach. When I changed the view, the controller couldn't find the buttons anymore or I had multiple instances of one button with the same ID on a single application, because of the global ID. But I solved this with IDs that are only global in a view and can be on the application multiple times. So I could mess with the (dumb) views layout and design and the functionallity wouldn't break. The angular.js approach with the bindings in the view don't has the problem with global IDs. Also, the person who changes something in the view layout has to know the IDs anyway, so the controller can put the data at the right spot. So if I write <a ng-click="doThis()" /> for angular.js and implement doThis() or <a lid="buttonwhichdoesthis" /> for extjs and find the element with the local id and add doThis() as handler on the controller side, seems to be not so different. The only thing is, the second one has one more layer of indirection, which seems cleaner. The first one seems somehow to cost less effort.

    Read the article

  • Update Boolean attributes from another controller

    - by sidonstackoverflow
    I have Users controller and session controller . I want to update one user attribute from session controller . How can i do that ?? I am currently using rails 4.0 . Users controller: class UsersController < ApplicationController def show if Spec.find_by_user_id params[:id] @user = User.find(params[:id]) @spec = Spec.find_by_user_id params[:id] else if params[:id] == session[:id] redirect_to spec_edit_path(params[:id]) else redirect_to(community_index_path, {:notice => "Sorry there was an error"}) end end end def index end def new @user = User.new end def create @user = User.new(user_params) if @user.save flash[:success] = "Welcome buddy !" redirect_to @user else render 'new' end end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end end Sessions Controller : class SessionsController < ApplicationController def new end def create user = User.find_by(email: params[:session][:email]) if user && user.authenticate(params[:session][:password]) session[:user_id] = user.id User.update(user.status, 'true') redirect_to root_url, :notice => 'You successfully logged in ' else flash.now[:error] = 'Invalid email/password combination' # Not quite right! render 'new' end end def destroy session[:user_id] = nil redirect_to root_url, :notice => 'You successfully logged out ' end end In above code when User logged in i just want to update my boolean column status at users table from sessions controller , but i failed . I am thankful to whom would like to answer my question !

    Read the article

  • URL Rewrite – Protocol (http/https) in the Action

    - by OWScott
    IIS URL Rewrite supports server variables for pretty much every part of the URL and http header. However, there is one commonly used server variable that isn’t readily available.  That’s the protocol—HTTP or HTTPS. You can easily check if a page request uses HTTP or HTTPS, but that only works in the conditions part of the rule.  There isn’t a variable available to dynamically set the protocol in the action part of the rule.  What I wish is that there would be a variable like {HTTP_PROTOCOL} which would have a value of ‘HTTP’ or ‘HTTPS’.  There is a server variable called {HTTPS}, but the values of ‘on’ and ‘off’ aren’t practical in the action.  You can also use {SERVER_PORT} or {SERVER_PORT_SECURE}, but again, they aren’t useful in the action. Let me illustrate.  The following rule will redirect traffic for http(s)://localtest.me/ to http://www.localtest.me/. <rule name="Redirect to www"> <match url="(.*)" /> <conditions> <add input="{HTTP_HOST}" pattern="^localtest\.me$" /> </conditions> <action type="Redirect" url="http://www.localtest.me/{R:1}" /> </rule> The problem is that it forces the request to HTTP even if the original request was for HTTPS. Interestingly enough, I planned to blog about this topic this week when I noticed in my twitter feed yesterday that Jeff Graves, a former colleague of mine, just wrote an excellent blog post about this very topic.  He beat me to the punch by just a couple days.  However, I figured I would still write my blog post on this topic.  While his solution is a excellent one, I personally handle this another way most of the time.  Plus, it’s a commonly asked question that isn’t documented well enough on the web yet, so having another article on the web won’t hurt. I can think of four different ways to handle this, and depending on your situation you may lean towards any of the four.  Don’t let the choices overwhelm you though.  Let’s keep it simple, Option 1 is what I use most of the time, Option 2 is what Jeff proposed and is the safest option, and Option 3 and Option 4 need only be considered if you have a more unique situation.  All four options will work for most situations. Option 1 – CACHE_URL, single rule There is a server variable that has the protocol in it; {CACHE_URL}.  This server variable contains the entire URL string (e.g. http://www.localtest.me:80/info.aspx?id=5)  All we need to do is extract the HTTP or HTTPS and we’ll be set. This tends to be my preferred way to handle this situation. Indeed, Jeff did briefly mention this in his blog post: … you could use a condition on the CACHE_URL variable and a back reference in the rewritten URL. The problem there is that you then need to match all of the conditions which could be a problem if your rule depends on a logical “or” match for conditions. Thus the problem.  If you have multiple conditions set to “Match Any” rather than “Match All” then this option won’t work.  However, I find that 95% of all rules that I write use “Match All” and therefore, being the lazy administrator that I am I like this simple solution that only requires adding a single condition to a rule.  The caveat is that if you use “Match Any” then you must consider one of the next two options. Enough with the preamble.  Here’s how it works.  Add a condition that checks for {CACHE_URL} with a pattern of “^(.+)://” like so: How you have a back-reference to the part before the ://, which is our treasured HTTP or HTTPS.  In URL Rewrite 2.0 or greater you can check the “Track capture groups across conditions”, make that condition the first condition, and you have yourself a back-reference of {C:1}. The “Redirect to www” example with support for maintaining the protocol, will become: <rule name="Redirect to www" stopProcessing="true"> <match url="(.*)" /> <conditions trackAllCaptures="true"> <add input="{CACHE_URL}" pattern="^(.+)://" /> <add input="{HTTP_HOST}" pattern="^localtest\.me$" /> </conditions> <action type="Redirect" url="{C:1}://www.localtest.me/{R:1}" /> </rule> It’s not as easy as it would be if Microsoft gave us a built-in {HTTP_PROTOCOL} variable, but it’s pretty close. I also like this option since I often create rule examples for other people and this type of rule is portable since it’s self-contained within a single rule. Option 2 – Using a Rewrite Map For a safer rule that works for both “Match Any” and “Match All” situations, you can use the Rewrite Map solution that Jeff proposed.  It’s a perfectly good solution with the only drawback being the ever so slight extra effort to set it up since you need to create a rewrite map before you create the rule.  In other words, if you choose to use this as your sole method of handling the protocol, you’ll be safe. After you create a Rewrite Map called MapProtocol, you can use “{MapProtocol:{HTTPS}}” for the protocol within any rule action.  Following is an example using a Rewrite Map. <rewrite> <rules> <rule name="Redirect to www" stopProcessing="true"> <match url="(.*)" /> <conditions trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^localtest\.me$" /> </conditions> <action type="Redirect" url="{MapProtocol:{HTTPS}}://www.localtest.me/{R:1}" /> </rule> </rules> <rewriteMaps> <rewriteMap name="MapProtocol"> <add key="on" value="https" /> <add key="off" value="http" /> </rewriteMap> </rewriteMaps> </rewrite> Option 3 – CACHE_URL, Multi-rule If you have many rules that will use the protocol, you can create your own server variable which can be used in subsequent rules. This option is no easier to set up than Option 2 above, but you can use it if you prefer the easier to remember syntax of {HTTP_PROTOCOL} vs. {MapProtocol:{HTTPS}}. The potential issue with this rule is that if you don’t have access to the server level (e.g. in a shared environment) then you cannot set server variables without permission. First, create a rule and place it at the top of the set of rules.  You can create this at the server, site or subfolder level.  However, if you create it at the site or subfolder level then the HTTP_PROTOCOL server variable needs to be approved at the server level.  This can be achieved in IIS Manager by navigating to URL Rewrite at the server level, clicking on “View Server Variables” from the Actions pane, and added HTTP_PROTOCOL. If you create the rule at the server level then this step is not necessary.  Following is an example of the first rule to create the HTTP_PROTOCOL and then a rule that uses it.  The Create HTTP_PROTOCOL rule only needs to be created once on the server. <rule name="Create HTTP_PROTOCOL"> <match url=".*" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{CACHE_URL}" pattern="^(.+)://" /> </conditions> <serverVariables> <set name="HTTP_PROTOCOL" value="{C:1}" /> </serverVariables> <action type="None" /> </rule>   <rule name="Redirect to www" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^localtest\.me$" /> </conditions> <action type="Redirect" url="{HTTP_PROTOCOL}://www.localtest.me/{R:1}" /> </rule> Option 4 – Multi-rule Just to be complete I’ll include an example of how to achieve the same thing with multiple rules. I don’t see any reason to use it over the previous examples, but I’ll include an example anyway.  Note that it will only work with the “Match All” setting for the conditions. <rule name="Redirect to www - http" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^localtest\.me$" /> <add input="{HTTPS}" pattern="off" /> </conditions> <action type="Redirect" url="http://www.localtest.me/{R:1}" /> </rule> <rule name="Redirect to www - https" stopProcessing="true"> <match url="(.*)" /> <conditions logicalGrouping="MatchAll" trackAllCaptures="false"> <add input="{HTTP_HOST}" pattern="^localtest\.me$" /> <add input="{HTTPS}" pattern="on" /> </conditions> <action type="Redirect" url="https://www.localtest.me/{R:1}" /> </rule> Conclusion Above are four working examples of methods to call the protocol (HTTP or HTTPS) from the action of a URL Rewrite rule.  You can use whichever method you most prefer.  I’ve listed them in the order that I favor them, although I could see some people preferring Option 2 as their first choice.  In any of the cases, hopefully you can use this as a reference for when you need to use the protocol in the rule’s action when writing your URL Rewrite rules. Further information: Viewing all Server Variable for a site. URL Parts available to URL Rewrite Rules Further URL Rewrite articles

    Read the article

  • Separate Action from Assertion in Unit Tests

    - by DigitalMoss
    Setup Many years ago I took to a style of unit testing that I have come to like a lot. In short, it uses a base class to separate out the Arrangement, Action and Assertion of the test into separate method calls. You do this by defining method calls in [Setup]/[TestInitialize] that will be called before each test run. [Setup] public void Setup() { before_each(); //arrangement because(); //action } This base class usually includes the [TearDown] call as well for when you are using this setup for Integration tests. [TearDown] public void Cleanup() { after_each(); } This often breaks out into a structure where the test classes inherit from a series of Given classes that put together the setup (i.e. GivenFoo : GivenBar : WhenDoingBazz) with the Assertions being one line tests with a descriptive name of what they are covering [Test] public void ThenBuzzSouldBeTrue() { Assert.IsTrue(result.Buzz); } The Problem There are very few tests that wrap around a single action so you end up with lots of classes so recently I have taken to defining the action in a series of methods within the test class itself: [Test] public void ThenBuzzSouldBeTrue() { because_an_action_was_taken(); Assert.IsTrue(result.Buzz); } private void because_an_action_was_taken() { //perform action here } This results in several "action" methods within the test class but allows grouping of similar tests (i.e. class == WhenTestingDifferentWaysToSetBuzz) The Question Does someone else have a better way of separating out the three 'A's of testing? Readability of tests is important to me so I would prefer that, when a test fails, that the very naming structure of the tests communicate what has failed. If someone can read the Inheritance structure of the tests and have a good idea why the test might be failing then I feel it adds a lot of value to the tests (i.e. GivenClient : GivenUser : WhenModifyingUserPermissions : ThenReadAccessShouldBeTrue). I am aware of Acceptance Testing but this is more on a Unit (or series of units) level with boundary layers mocked. EDIT : My question is asking if there is an event or other method for executing a block of code before individual tests (something that could be applied to specific sets of tests without it being applied to all tests within a class like [Setup] currently does. Barring the existence of this event, which I am fairly certain doesn't exist, is there another method for accomplishing the same thing? Using [Setup] for every case presents a problem either way you go. Something like [Action("Category")] (a setup method that applied to specific tests within the class) would be nice but I can't find any way of doing this.

    Read the article

  • Passing JSON object from Controller to View(jsp)

    - by user752233
    I am trying to send JSON object to my view from controller but unable to send it. Please help me out! I am using following code public class SystemController extends AbstractController{ protected ModelAndView handleRequestInternal(HttpServletRequest request, HttpServletResponse response) throws Exception { ModelAndView mav = new ModelAndView("SystemInfo", "System", "S"); response.setContentType("application/json;charset=UTF-8"); response.setHeader("Cache-Control", "no-cache"); JSONObject jsonResult = new JSONObject(); jsonResult.put("JVMVendor", System.getProperty("java.vendor")); jsonResult.put("JVMVersion", System.getProperty("java.version")); jsonResult.put("JVMVendorURL", System.getProperty("java.vendor.url")); jsonResult.put("OSName", System.getProperty("os.name")); jsonResult.put("OSVersion", System.getProperty("os.version")); jsonResult.put("OSArchitectire", System.getProperty("os.arch")); response.getWriter().write(jsonResult.toString()); // response.getWriter().close(); return mav; // return modelandview object } } and in the view side I am using <script type="text/javascript"> Ext.onReady(function(response) { //Ext.MessageBox.alert('Hello', 'The DOM is ready!'); var showExistingScreen = function () { Ext.Ajax.request({ url : 'system.htm', method : 'POST', scope : this, success: function ( response ) { alert('1'); var existingValues = Ext.util.JSON.decode(response.responseText); alert('2'); } }); }; return showExistingScreen(); });

    Read the article

  • Cocoa - calling a VIEW method from the CONTROLLER

    - by eemerge
    Hello everyone, Got a little problem i asked about it before but maybe i didnt ask properly. I have a cocoa application, which amongst other things, must do the following task: - load some images from the disk, store them in an array and display them in a custom view. In the Interface Builder i have a CustomView and an OBJECT that points to TexturesController.h The custom view is a custom class, TextureBrowser. Below is the code for the controller and view: TexturesController #import <Cocoa/Cocoa.h> @class TextureBrowser; @interface TexturesController : NSObject { IBOutlet NSTextField *logWindow; IBOutlet TextureBrowser *textureView; NSMutableArray *textureList; } @property textureView; -(IBAction)loadTextures:(id)sender; -(IBAction)showTexturesInfo:(id)sender; @end TextureBrowser @interface TextureBrowser : NSView { NSMutableArray *textures; } @property NSMutableArray *textures; -(void)loadTextureList:(NSMutableArray *)source; @end These are just the headers. Now , what i need to do is: when loadTextures from the TexturesController is called, after i load the images i want to send this data to the view (TextureBrowser), for example, store it in the NSMutableArray *textures. I tried using the -(void)loadTextureList:(NSMutableArray*)source method from the view, but in the TextureController.m i get a warning : No -loadTextureList method found This is how i call the method : [textureView loadTextureList: textureList]; And even if i run it with the warning left there, the array in the view class doesnt get initialised. Maybe im missing something...maybe someone can give a simple example of what i need to do and how to do it (code). Thanks in advance.

    Read the article

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