Search Results

Search found 28223 results on 1129 pages for 'view controller'.

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

  • JSF 2 Content Controller (pull in content based on URI)

    - by gerges
    Hey All, I'm new to JSF and am trying to make a content controller. Basically whenever someone makes a request to www.myapp.com/external/** I'd like to forward to a controller that pulls external content into a page template and spits it out to the user. I was able to achive this pretty easily in Spring 3, but I'm a little confused on where to start with JSF. I feel like I'd need to create a custom servlet to handle /external/**? But what would the class of this servlet be? What would it consist of? Any help is appreciated!

    Read the article

  • Codeigniter Controller function in a view [closed]

    - by Y2ok
    I'm using CodeIgniter and I have two controllers: Index controller that loads the website view Personal panel controller that will do all login, registration and personal panel functions. (Functions are loaded from models.) The problem is that I don't have any clue how to insert that controller in a view file or in the other controller file so that it would load when I press submit button for a form or if the session's loggedin is with value true.

    Read the article

  • Invoke modal view controller from UIWebView weblink

    - by JD
    Hey folks I was wondering if anyone can tip me on a painless way of invoking a modal view controller from a web link in a UIWebView. Is it possible to do this? I want the modal view controller to still be a part of the app as opposed to closing the main app and using a helper application instead. Any help would be greatly appreciated.

    Read the article

  • Why is my view controllers view not quadratic?

    - by mystify
    I created an UIViewController subclass, and figured out that the default implementation of -loadView in UIViewController will ignore my frame size settings in a strange way. To simplify it and to make sure it's really not the fault of my code, I did a clean test with a plain instance of UIViewController directly, rather than making a subclass. The result is the same. I try to make an exactly quadratic view of 320 x 320, but the view appears like 320 x 200. iPhone OS 3.0, please check this out: UIViewController *ts = [[UIViewController alloc] initWithNibName:nil bundle:nil]; ts.view.frame = CGRectMake(0.0f, 0.0f, 320.0f, 320.0f); ts.view.backgroundColor = [UIColor cyanColor]; [self.view addSubview:ts.view]; like you can see, I do this: 1) Create a UIViewController instance 2) Set the frame of the view to a quadratic dimension of 320 x 320 3) Give it a color, so I can see it 4) Added it as a subview. Now the part, that's even more strange: When I make my own implementation of -loadView, i.e. if I put this code in there like this: - (void)loadView { UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 320.0f)]; v.backgroundColor = [UIColor cyanColor]; self.view = v; [v release]; } then it looks right. Now lets think about that: In the first example, I do pretty much exactly the same, just that I let UIViewController create the view on it's own, and then take it over in order to change it's frame. Right? So why do I get this strange error? Right now I see no other way of messing around like that to correct this wrong behavior. I did not activate anything like clipsToBounds and there's no other code touching this.

    Read the article

  • Command View EVA Login Problem

    - by ngadimin
    I'm using Command View EVA version 9.01 on a Windows Storage Server 2003 R2. And all of a sudden I can't log in to the command view, it always say incorrect username or password, I haven't done any change on the password nor the system. Is there any way I can fix this?

    Read the article

  • Filtering SNMP View

    - by Arie K
    We have several network interfaces in a machine. How to configure SNMP view to limit which interfaces could be shown to public community? We're using Ubuntu Server and default SNMPD from the repository. We have successfully limit the SNMPD agent to show only interfaces tree using this configuration: view system included .iso.org.dod.internet.mgmt.mib-2.interfaces

    Read the article

  • Microsoft Word changing document view on scroll

    - by hrickards
    I have a friend who is trying to view a Word document, consisting of a large table (nothing to do with me), that was fine until today. Whenever they scroll down past a certain limit, the content on the page is replicated once and after that the table cells are blank. The view also switches to Normal· They think that the document was last opened in OpenOffice (version 3.3.0, which opens the document fine now), could this cause it? Its Word 2000. What can we do?

    Read the article

  • Windows 7 Windows Explorer jumpy tree view

    - by P a u l
    Is there any way to get Windows Explorer tree view in Windows 7 to stop jumping? I think they really messed up this design. Click a node to expand a deeper level and it instantly scrolls the tree vertically to a new location. This is not a good feature since my eye completely loses the node it was focused on and I have to hunt for where I was. I want the tree view to remain fixed where it is unless I scroll it myself.

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Testing a scoped find in a Rails controller with RSpec

    - by Joseph DelCioppio
    I've got a controller called SolutionsController whose index action is different depending on the value of params[:user_id]. If its nil, then it simply displays all of the solutions on my site, but if its not nil, then it displays all of the solutions for the given user id. Here it is: def index if(params[:user_id]) @solutions = @user.solutions.find(:all) else @solutions = Solution.find(:all) end end and @user is determined like this: private def load_user if(params[:user_id ]) @user = User.find(params[:user_id]) end end I've got an Rspec test to test the index action if the user is nil: describe "GET index" do context "when user_id is nil" do it "should find all of the solutions" do Solution.should_receive(:find).with(:all).and_return(@solutions) get :index end end end however, can someone tell me how I write a similar test for the other half of my controller, when the user id isn't nil? Something like: describe "GET index" do context "when user_id isn't nil" do before(:each) do @user = Factory.create(:user) @solutions = 7.times{Factory.build(:solution, :user => @user)} @user.stub!(:solutions).and_return(@solutions) end it "should find all of the solutions owned by a user" do @user.should_receive(:solutions).and_return(@solutions) get :index, :user_id => @user.id end end end But that doesn't work. Can someone help me out? Joe

    Read the article

  • Getting values from the html to the controller

    - by tina
    Hi, I'm trying to access the values a user introduces in a table from my controller. This table is NOT part of the model, and the view source code is something like: <table id="tableSeriales" summary="Seriales" class="servicesT" cellspacing="0" style="width: 100%"> <tr> <td class="servHd">Seriales</td> </tr> <tr id="t0"> <td class="servBodL"> <input id="0" type="text" value="1234" onkeypress = "return handleKeyPress(event, this.id);"/> <input id="1" type="text" value="578" onkeypress = "return handleKeyPress(event, this.id);"/> . . . </td> </tr> </table> How can I get those values (1234, 578) from the controller? Receiving a formcollection doesn't work since it does not get the table... Thank you.

    Read the article

  • Spring Controller redirect to another page

    - by user1386375
    Hey I got the following problem. This is the content of the jspx file: function postSMTH() { $.ajax({ type: "POST", url: document.getElementById("urltxt").value, data: parameters, }); } <input type="hidden" value="${pageContext.request.contextPath}/foo/foo2/foodat" name="urltxt" id="urltxt"/> <div class="foodat"><a href="javascript:postSMTH();"><spring:message code="foo_foo2_foodat_text" text="FOODAT"/></a></div> So if I push the submit button, the postSMTH function is called and the ajax object is paste to the Controller which look like this: @Controller @RequestMapping(value="/foo") public class FooController { .............. @RequestMapping(value="/foo2", method=RequestMethod.POST) public String homePOST(HttpServletRequest request) { ........ } @RequestMapping(value="/foo2", method=RequestMethod.GET) public String homeGET(HttpServletRequest request) { ........ } @RequestMapping(value="/foo2/foodat", method=RequestMethod.POST) public String doTHAT(HttpServletRequest request) { // check authorization Map fooMap = request.getParameterMap(); // do something in the Database, depending on the paramMap return "redirect:/foo/foo1"; } } Everything is working fine regarding the Database, but the Problem is, that the redirect at the end DOESN'T work. It just stays at the page foo2. I'm new to Spring, maybe its a little mistake somewhere. I just cant make it out by myself. Would be nice if someone would have some hint. Thanks

    Read the article

  • Computer won't reboot without waiting for a while

    - by Benjamin
    I've got an unusual problem with my computer. When ever I reboot my computer it won't boot, I get a few beeps from the BIOS and nothing else, however if I wait for a few minuets the computer will boot perfectly. I tried to count the beeps and I get around 7-9 of them; the first two are noticeably closer together than the rest. [Edit: I'm now reasonably confident it's 1 long followed by 8 short beeps. That would be a display related issue: http://www.bioscentral.com/beepcodes/amibeep.htm] My BIOS is American Megatrends Inc and version P1.80, the Motherboard is an ASRock X58 Extreme (both according to dmidecode) Here's an output from LSPCI, I'm not sure what else might be useful but I can provide whatever's asked. 00:00.0 Host bridge: Intel Corporation 5520/5500/X58 I/O Hub to ESI Port (rev 13) 00:01.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 1 (rev 13) 00:03.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 3 (rev 13) 00:07.0 PCI bridge: Intel Corporation 5520/5500/X58 I/O Hub PCI Express Root Port 7 (rev 13) 00:14.0 PIC: Intel Corporation 5520/5500/X58 I/O Hub System Management Registers (rev 13) 00:14.1 PIC: Intel Corporation 5520/5500/X58 I/O Hub GPIO and Scratch Pad Registers (rev 13) 00:14.2 PIC: Intel Corporation 5520/5500/X58 I/O Hub Control Status and RAS Registers (rev 13) 00:14.3 PIC: Intel Corporation 5520/5500/X58 I/O Hub Throttle Registers (rev 13) 00:1a.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #4 00:1a.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #5 00:1a.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #6 00:1a.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #2 00:1b.0 Audio device: Intel Corporation 82801JI (ICH10 Family) HD Audio Controller 00:1c.0 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 1 00:1c.1 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Port 2 00:1c.5 PCI bridge: Intel Corporation 82801JI (ICH10 Family) PCI Express Root Port 6 00:1d.0 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #1 00:1d.1 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #2 00:1d.2 USB controller: Intel Corporation 82801JI (ICH10 Family) USB UHCI Controller #3 00:1d.7 USB controller: Intel Corporation 82801JI (ICH10 Family) USB2 EHCI Controller #1 00:1e.0 PCI bridge: Intel Corporation 82801 PCI Bridge (rev 90) 00:1f.0 ISA bridge: Intel Corporation 82801JIR (ICH10R) LPC Interface Controller 00:1f.2 SATA controller: Intel Corporation 82801JI (ICH10 Family) SATA AHCI Controller 00:1f.3 SMBus: Intel Corporation 82801JI (ICH10 Family) SMBus Controller 01:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller (rev 03) 02:00.0 FireWire (IEEE 1394): VIA Technologies, Inc. VT6315 Series Firewire Controller 02:00.1 IDE interface: VIA Technologies, Inc. VT6415 PATA IDE Host Controller (rev a0) 03:00.0 SATA controller: JMicron Technology Corp. JMB360 AHCI Controller (rev 02) 05:00.0 VGA compatible controller: nVidia Corporation GT200b [GeForce GTX 285] (rev a1) ff:00.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture Generic Non-Core Registers (rev 05) ff:00.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QuickPath Architecture System Address Decoder (rev 05) ff:02.0 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Link 0 (rev 05) ff:02.1 Host bridge: Intel Corporation Xeon 5500/Core i7 QPI Physical 0 (rev 05) ff:03.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller (rev 05) ff:03.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Target Address Decoder (rev 05) ff:03.4 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Test Registers (rev 05) ff:04.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Control Registers (rev 05) ff:04.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Address Registers (rev 05) ff:04.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Rank Registers (rev 05) ff:04.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 0 Thermal Control Registers (rev 05) ff:05.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Control Registers (rev 05) ff:05.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Address Registers (rev 05) ff:05.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Rank Registers (rev 05) ff:05.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 1 Thermal Control Registers (rev 05) ff:06.0 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Control Registers (rev 05) ff:06.1 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Address Registers (rev 05) ff:06.2 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Rank Registers (rev 05) ff:06.3 Host bridge: Intel Corporation Xeon 5500/Core i7 Integrated Memory Controller Channel 2 Thermal Control Registers (rev 05) Update: ok I installed lm-sensors and here's the output. coretemp-isa-0000 Adapter: ISA adapter Core 0: +58.0°C (high = +80.0°C, crit = +100.0°C) Core 1: +59.0°C (high = +80.0°C, crit = +100.0°C) Core 2: +58.0°C (high = +80.0°C, crit = +100.0°C) Core 3: +57.0°C (high = +80.0°C, crit = +100.0°C) it8720-isa-0a10 Adapter: ISA adapter in0: +0.93 V (min = +0.00 V, max = +4.08 V) in1: +0.06 V (min = +0.00 V, max = +4.08 V) in2: +3.25 V (min = +0.00 V, max = +4.08 V) +5V: +2.91 V (min = +0.00 V, max = +4.08 V) in4: +3.04 V (min = +0.00 V, max = +4.08 V) in5: +2.94 V (min = +0.00 V, max = +4.08 V) in6: +2.14 V (min = +0.00 V, max = +4.08 V) 5VSB: +2.96 V (min = +0.00 V, max = +4.08 V) Vbat: +3.28 V fan1: 1869 RPM (min = 0 RPM) fan2: 0 RPM (min = 0 RPM) fan3: 0 RPM (min = 0 RPM) fan4: 1106 RPM (min = -1 RPM) fan5: 225000 RPM (min = -1 RPM) temp1: +39.0°C (low = +0.0°C, high = +127.0°C) sensor = thermistor temp2: +56.0°C (low = +0.0°C, high = +127.0°C) sensor = thermistor temp3: +127.0°C (low = +0.0°C, high = +127.0°C) sensor = thermistor cpu0_vid: +1.650 V intrusion0: ALARM If it helps here's the summery from sensors-detect Driver `it87': * ISA bus, address 0xa10 Chip `ITE IT8720F Super IO Sensors' (confidence: 9) Driver `adt7475': * Bus `NVIDIA i2c adapter 3 at 5:00.0' Busdriver `nvidia', I2C address 0x2e Chip `Analog Devices ADT7473' (confidence: 5) Driver `coretemp': * Chip `Intel digital thermal sensor' (confidence: 9)

    Read the article

  • ASP.NET MVC: How to Display custom object properties in View page

    - by Shyju
    I am trying to add ASP.NET MVC features(Especially Routing) to my already existing ASP.NET Web application.I added a Controlled and View (an asp.net page) .Now i want to know how can i display the details of object of my custom class( Ex : User) in the view ? Can assign the object in ViewData collection and render it in the view ? Hows that ? I already have a Datalayer (in ADO.NET) which is running for the the current ASP.NET web app.So i want to use that. I tried this in my controller public ActionResult Index() { BusinessObject.User objUser = new BusinessObject.User(); objUser.EmailId = "[email protected]"; objUser.ProfileTitle = "Web developer with 6 yrs expereince"; ViewData["objUser"] = objUser; ViewData["Message"] = "This is ASP.NET MVC!"; return View(); } How can i use this in the view page to display the user details ? Thanks in advance

    Read the article

  • Is it bad idea to extend Zend_View and register like front controller plugin

    - by user564325
    I just ask, is it bad idea to extend Zend_View and register like Front Controller plugin after router is ready, because i need, $request to get active module name to show Zend_View where are my templates ? public function routeShutdown(Zend_Controller_Request_Abstract $request){ $view = new View($config, $request); $viewHelper = new Zend_Controller_Action_Helper_ViewRenderer($view); Zend_Controller_Action_HelperBroker::addHelper($viewHelper); } And after that i get $request-getModuleName(); and make the my ScriptPaths I have tried this method $viewHelper->setViewScriptPathSpec(':controller/:action.:suffix') But can't work.

    Read the article

  • django/python: is one view that handles two sibling models a good idea?

    - by clime
    I am using django multi-table inheritance: Video and Image are models derived from Media. I have implemented two views: video_list and image_list, which are just proxies to media_list. media_list returns images or videos (based on input parameter model) for a certain object, which can be of type Event, Member, or Crag. The view alters its behaviour based on input parameter action (better name would be mode), which can be of value "edit" or "view". The problem is that I need to ask whether the input parameter model contains Video or Image in media_list so that I can do the right thing. Similar condition is also in helper method media_edit_list that is called from the view. I don't particularly like it but the only alternative I can think of is to have separate (but almost the same) logic for video_list and image_list and then probably also separate helper methods for videos and images: video_edit_list, image_edit_list, video_view_list, image_view_list. So four functions instead of just two. That I like even less because the video functions would be very similar to the respective image functions. What do you recommend? Here is extract of relevant parts: http://pastebin.com/07t4bdza. I'll also paste the code here: #urls url(r'^media/images/(?P<rel_model_tag>(event|member|crag))/(?P<rel_object_id>\d+)/(?P<action>(view|edit))/$', views.image_list, name='image-list') url(r'^media/videos/(?P<rel_model_tag>(event|member|crag))/(?P<rel_object_id>\d+)/(?P<action>(view|edit))/$', views.video_list, name='video-list') #views def image_list(request, rel_model_tag, rel_object_id, mode): return media_list(request, Image, rel_model_tag, rel_object_id, mode) def video_list(request, rel_model_tag, rel_object_id, mode): return media_list(request, Video, rel_model_tag, rel_object_id, mode) def media_list(request, model, rel_model_tag, rel_object_id, mode): rel_model = tag_to_model(rel_model_tag) rel_object = get_object_or_404(rel_model, pk=rel_object_id) if model == Image: star_media = rel_object.star_image else: star_media = rel_object.star_video filter_params = {} if rel_model == Event: filter_params['event'] = rel_object_id elif rel_model == Member: filter_params['members'] = rel_object_id elif rel_model == Crag: filter_params['crag'] = rel_object_id media_list = model.objects.filter(~Q(id=star_media.id)).filter(**filter_params).order_by('date_added').all() context = { 'media_list': media_list, 'star_media': star_media, } if mode == 'edit': return media_edit_list(request, model, rel_model_tag, rel_object_id, context) return media_view_list(request, model, rel_model_tag, rel_object_id, context) def media_view_list(request, model, rel_model_tag, rel_object_id, context): if request.is_ajax(): context['base_template'] = 'boxes/base-lite.html' return render(request, 'media/list-items.html', context) def media_edit_list(request, model, rel_model_tag, rel_object_id, context): if model == Image: get_media_edit_record = get_image_edit_record else: get_media_edit_record = get_video_edit_record media_list = [get_media_edit_record(media, rel_model_tag, rel_object_id) for media in context['media_list']] if context['star_media']: star_media = get_media_edit_record(context['star_media'], rel_model_tag, rel_object_id) else: star_media = None json = simplejson.dumps({ 'star_media': star_media, 'media_list': media_list, }) return HttpResponse(json, content_type=json_response_mimetype(request)) def get_image_edit_record(image, rel_model_tag, rel_object_id): record = { 'url': image.image.url, 'name': image.title or image.filename, 'type': mimetypes.guess_type(image.image.path)[0] or 'image/png', 'thumbnailUrl': image.thumbnail_2.url, 'size': image.image.size, 'id': image.id, 'media_id': image.media_ptr.id, 'starUrl':reverse('image-star', kwargs={'image_id': image.id, 'rel_model_tag': rel_model_tag, 'rel_object_id': rel_object_id}), } return record def get_video_edit_record(video, rel_model_tag, rel_object_id): record = { 'url': video.embed_url, 'name': video.title or video.url, 'type': None, 'thumbnailUrl': video.thumbnail_2.url, 'size': None, 'id': video.id, 'media_id': video.media_ptr.id, 'starUrl': reverse('video-star', kwargs={'video_id': video.id, 'rel_model_tag': rel_model_tag, 'rel_object_id': rel_object_id}), } return record # models class Media(models.Model, WebModel): title = models.CharField('title', max_length=128, default='', db_index=True, blank=True) event = models.ForeignKey(Event, null=True, default=None, blank=True) crag = models.ForeignKey(Crag, null=True, default=None, blank=True) members = models.ManyToManyField(Member, blank=True) added_by = models.ForeignKey(Member, related_name='added_images') date_added = models.DateTimeField('date added', auto_now_add=True, null=True, default=None, editable=False) class Image(Media): image = ProcessedImageField(upload_to='uploads', processors=[ResizeToFit(width=1024, height=1024, upscale=False)], format='JPEG', options={'quality': 75}) thumbnail_1 = ImageSpecField(source='image', processors=[SmartResize(width=178, height=134)], format='JPEG', options={'quality': 75}) thumbnail_2 = ImageSpecField(source='image', #processors=[SmartResize(width=256, height=192)], processors=[ResizeToFit(height=164)], format='JPEG', options={'quality': 75}) class Video(Media): url = models.URLField('url', max_length=256, default='') embed_url = models.URLField('embed url', max_length=256, default='', blank=True) author = models.CharField('author', max_length=64, default='', blank=True) thumbnail = ProcessedImageField(upload_to='uploads', processors=[ResizeToFit(width=1024, height=1024, upscale=False)], format='JPEG', options={'quality': 75}, null=True, default=None, blank=True) thumbnail_1 = ImageSpecField(source='thumbnail', processors=[SmartResize(width=178, height=134)], format='JPEG', options={'quality': 75}) thumbnail_2 = ImageSpecField(source='thumbnail', #processors=[SmartResize(width=256, height=192)], processors=[ResizeToFit(height=164)], format='JPEG', options={'quality': 75}) class Crag(models.Model, WebModel): name = models.CharField('name', max_length=64, default='', db_index=True) normalized_name = models.CharField('normalized name', max_length=64, default='', editable=False) type = models.IntegerField('crag type', null=True, default=None, choices=crag_types) description = models.TextField('description', default='', blank=True) country = models.ForeignKey('country', null=True, default=None) #TODO: make this not null when db enables it latitude = models.FloatField('latitude', null=True, default=None) longitude = models.FloatField('longitude', null=True, default=None) location_index = FixedCharField('location index', length=24, default='', editable=False, db_index=True) # handled by db, used for marker clustering added_by = models.ForeignKey('member', null=True, default=None) #route_count = models.IntegerField('route count', null=True, default=None, editable=False) date_created = models.DateTimeField('date created', auto_now_add=True, null=True, default=None, editable=False) last_modified = models.DateTimeField('last modified', auto_now=True, null=True, default=None, editable=False) star_image = models.ForeignKey('Image', null=True, default=None, related_name='star_crags', on_delete=models.SET_NULL) star_video = models.ForeignKey('Video', null=True, default=None, related_name='star_crags', on_delete=models.SET_NULL)

    Read the article

  • ASP.NET MVC 2 UpdateModel() is not updating values in memory or database

    - by campbelt
    Hello, I am new to MVC, and so am working through the NerdDinner tutorial, here. In particular, I'm running into problems with the use of the UpdateModel method, which is explained in the part five of that tutorial. The problem is, when I try to edit the value of a dinner object using the UpdateModel method, the values do not get updated, and no exceptions are thrown. Oddly, I am not having any trouble with the Create or Delete features that are illustrated in the tutorial. Only the update feature isn't working. Below, I have included the Controller code that I am using, as well as the view markup, which is contained in both an aspx View file and an ascx Partial View file. Here is the code inside my Controller, called DinnerController.cs: // // GET: /Dinners/Edit/2 [Authorize] public ActionResult Edit(int id) { Dinner dinner = dinnerRepository.GetDinner(id); return View(new DinnerFormViewModel(dinner)); } // // POST: /Dinners/Edit/2 [AcceptVerbs(HttpVerbs.Post), Authorize] public ActionResult Edit(int id, FormCollection formValues) { Dinner dinner = dinnerRepository.GetDinner(id); try { UpdateModel(dinner); var x = ViewData.GetModelStateErrors(); // <-- to catch other ModelState errors dinnerRepository.Save(); return RedirectToAction("Details", new { id = dinner.DinnerID }); } catch { ModelState.AddRuleViolations(dinner.GetRuleViolations()); return View(new DinnerFormViewModel(dinner)); } } The line with the comment "to catch other ModelState errors" was added after reading a possible solution from another StackOverflow thread, here: http://stackoverflow.com/questions/1461283/asp-net-mvc-updatemodel-not-updating-but-not-throwing-error Unfortunately, that solution didn't help me. Here is the corresponding markup in my Dinners/Edit.aspx View: <asp:Content ID="Main" ContentPlaceHolderID="MainContent" runat="server"> <h2>Edit Dinner</h2> <% Html.RenderPartial("DinnerForm"); %> </asp:Content> Here is the corresponding markup in my DinnerForm.ascx Partial View. This Partial View file is also used by the Create feature, which is working fine: <%=Html.ValidationSummary("Please correct the errors and try again.") %> <% using (Html.BeginForm()) { %> <fieldset> <p> <label for="Title">Dinner Title:</label> <%=Html.TextBoxFor(model => Model.Dinner.Title)%> <%=Html.ValidationMessage("Title", "*") %> </p> <p> <label for="EventDate">EventDate:</label> <%=Html.TextBoxFor(model => Model.Dinner.EventDate, new { value = String.Format("{0:g}", Model.Dinner.EventDate) })%> <%=Html.ValidationMessage("EventDate", "*") %> </p> <p> <label for="Description">Description:</label> <%=Html.TextBoxFor(model => Model.Dinner.Description)%> <%=Html.ValidationMessage("Description", "*")%> </p> <p> <label for="Address">Address:</label> <%=Html.TextBoxFor(model => Model.Dinner.Address)%> <%=Html.ValidationMessage("Address", "*") %> </p> <p> <label for="Country">Country:</label> <%=Html.DropDownListFor(model => Model.Dinner.Country, Model.Countries)%> <%=Html.ValidationMessage("Country", "*") %> </p> <p> <label for="ContactPhone">ContactPhone #:</label> <%=Html.TextBoxFor(model => Model.Dinner.ContactPhone)%> <%=Html.ValidationMessage("ContactPhone", "*") %> </p> <p> <label for="Latitude">Latitude:</label> <%=Html.TextBoxFor(model => Model.Dinner.Latitude)%> <%=Html.ValidationMessage("Latitude", "*") %> </p> <p> <label for="Longitude">Longitude:</label> <%=Html.TextBoxFor(model => Model.Dinner.Longitude)%> <%=Html.ValidationMessage("Longitude", "*") %> </p> <p> <input type="submit" value="Save"/> </p> </fieldset> <% } %> In any case, I've been hitting away at this for hours, and I'm out of ideas. So, I'm hoping someone here can help nudge me in the right direction, in order to figure out what I'm doing wrong.

    Read the article

  • return a js file from asp.net mvc controller

    - by Erwin
    Hi all fellow programmer I'd like to have a separate js file for each MVC set I have in my application /Controllers/ -TestController.cs /Models/ /Views/ /Test/ -Index.aspx -script.js And I'd like to include the js in the Index.aspx by <script type="text/javascript" src="<%=UriHelper.GetBaseUrl()%>/Test/Js"></script> Or to put it easier, when I call http://localhost/Test/Js in the browser, it will show me the script.js file How to write the Action in the Controller? I know that this must be done with return File method, but I haven't successfully create the method :(

    Read the article

  • WEBrick::HTTPStatus::LengthRequired error when accessing create method in controller

    - by Chris Bisignani
    I have a very simple controller set up: class LibrariesController < ApplicationController ... def create @user.libraries << Library.new(params) @user.save render :json => "success!" end ... end Basically, whenever I try to access the create method of LibrariesController using HTTParty.post I get a WEBrick::HTTPStatus::LengthRequired error on the server. The method is not even being accessed! Here is the stack trace (this is the full output server side - notice that the controller isn't even being accessed): [2010-04-16 00:35:39] ERROR WEBrick::HTTPStatus::LengthRequired [2010-04-16 00:35:39] ERROR HTTPRequest#fixup: WEBrick::HTTPStatus::LengthRequired occured. [2010-04-16 00:35:39] ERROR NoMethodError: private method `gsub!' called for #<Class:0x2362160> /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/htmlutils.rb:17:in `escape' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/httpresponse.rb:232:in `set_error' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/httpserver.rb:70:in `run' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/gems/1.8/gems/rack-1.0.1/lib/rack/handler/webrick.rb:14:in `run' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/commands/server.rb:111 /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /usr/local/Cellar/ruby_187/1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require' script/server:3 I'm running rails 2.3.5 and ruby 1.8.7. Any help would be greatly appreciated. Let me know if you need more details.

    Read the article

  • refresh table view iphone

    - by Florent
    Hi all !! So i've set a table view, i have set a system which set if the row have been already selected, i set checkmarck acessory for a row which have been seen, i write the row in a plist to an int value. It work good but only when i restart the app or reload the table view in my navigation controller. I mean when i select a row it pushes a view controller, then when i go back to the table view checkmark disappear and we do not know if the row have already been selected only when the app restart. So is there a way to refresh the table view ? ? in the view will appear for example ? ? thanks to all !!!!

    Read the article

  • Unit testing a controller method?

    - by Stefan Kendall
    I have a controller method like such: def search = { def query = params.query ... render results as JSON } How do I unit test this? Specifically, how do I call search to set params.query, and how do I test the results of the method render? Is there a way to mock the render method, perhaps?

    Read the article

  • Redirecting to another controller in Rails

    - by Vitaly
    Hi, I'm trying to redirect from one controller to another in Rails and I am getting this error: undefined method `call' for nil:NilClass The code is pretty simple (in def create method): @blog_post_comment = BlogPostComment.new(params[:blog_post_comment]) respond_to do |format| if @blog_post_comment.save flash[:notice] = 'Comment was successfully created.' redirect_to(@blog_post_comment.blog_post) else render :action => "new" end end Save goes ok, the value gets into the database. How can I work around the redirect fail?

    Read the article

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