Search Results

Search found 17342 results on 694 pages for 'custom draw'.

Page 145/694 | < Previous Page | 141 142 143 144 145 146 147 148 149 150 151 152  | Next Page >

  • Ruby on Rails: custom instance creation failing at redirect

    - by Jack
    I am at an absolute loss as to what I am doing wrong with the following code. I am trying to implement a messaging system within my application, but want it to be handle different types of messages. In this case, I want to create a "request" message of ':message_type = 1'. Instead of using forms as I usually have, I want to make this instance the moment the link is clicked. Here is how I have it set up in the show erb file for "user": <%=link_to "Send friend request", :action=>"request", :controller => "messages", :id => @user.id %> and in the controller: def request @message = Message.new(:sender_id => current_user.id,:user_id => params[:id],:message_type => 1) if @message.save flash[:notice] = 'Message was successfully created.' redirect_to message_path(@message) else redirect_to message_path(@message) end end This results in the following error message: undefined method `rewrite' for nil:NilClass with the trace looking like c:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/whiny_nil.rb:52:in `method_missing' c:/ruby/lib/ruby/gems/1.8/gems/actionpack-2.3.5/lib/action_controller/base.rb:634:in `url_for' (eval):16:in `message_path' app/controllers/messages_controller.rb:11:in `request' I have used map.resources :messages in the routes.rb file, and done the appropriate :has_many and :belongs_to associations in the models of user and message.

    Read the article

  • wx_ref and custom wx_object's

    - by Iogann
    Hi! I am developing MDI application with help of wxErlang. I have a parent frame, implemented as wx_object: -module(main_frame). -export([new/0, init/1, handle_call/3, handle_event/2, terminate/2]). -behaviour(wx_object). .... And I have a child frame, implemented as wx_object too: module(child_frame). -export([new/2, init/1, handle_call/3, handle_event/2, terminate/2]). -export([save/1]). -behaviour(wx_object). % some public API method save(Frame) -> wx_object:call(Frame, save). .... I want to call save/1 for an active child frame from the parent frame. There is my code: ActiveChild = wxMDIParentFrame:getActiveChild(Frame), case wx:is_null(ActiveChild) of false - child_frame:save(ActiveChild); _ - ignore end This code fails because ActiveChild is #wx_ref{} with state=[], but wx_object:call/2 needs #wx_ref{} where state is set to the pid of the process which we call. What is the right method to do this? I thought only to store a list of all created child frames with its pids in the parent frame and search the pid in this list, but this is ugly.

    Read the article

  • C#: Custom assembly directory

    - by Svish
    Say we have an application which consists of one executable and 5 libraries. Regularly all of these will be contained in one directory and the libraries will be loaded from there. Is it possible to do so that I can have for example some of the libraries in one directory called Lib, and the rest in one called Lib2? So that the application directory would only contain the executable itself and the other assemblies would be contained in various logical directories. How can I do this? And I would like to know how to do the loading of the assemblies, but also how to make the building of the application put the assemblies in the right directory.

    Read the article

  • Is it possible to create custom methods in entity classes in linq to sql

    - by doekman
    I have a table Site in SQL with (amongst others) three properties idReviewer1, idReviewer2, idReviewer3. Now I would like to create a methods on the entity class of Site to check if a user is a reviewer: partial class Site { public bool IsReviewer(int idUser) { return idReviewer1 == idUser || idReviewer2 == idUser || idReviewer3 == idUser; } } and I use it like this: return from s in db.Sites where s.IsReviewer(user) select s; However, Linq to SQL doesn't know how to translate this to SQL. I get the following error message: Method 'Boolean IsReviewer(Int32)' has no supported translation to SQL. I'd rather not write this: return from s in db.Sites where idReviewer1 == idUser || idReviewer2 == idUser || idReviewer3 == idUser select s; Is there any way to put this functionality in one place, without resorting to SQL?

    Read the article

  • .Net Custom Components "disappear" after file save

    - by EatATaco
    I might have a hard time explaining this because I am at a total loss for what is happening so I am just looking for some guidance. I might be a bit wordy because I don't know exactly what is the relevant information. I am developing a GUI for a project that I am working on in using .Net (C#) Part of the interface mimics, exactly, what we do in another product. For consistency reasons, my boss wants me to make it look the same way. So I got the other software and basically copied and pasted the components into my new GUI. This required me to introduce a component library (the now defunct Graphics Server GSNet, so I can't go to them for help) so I could implement some simple graphs and temperature/pressure "widgets." The components show up fine, and when I compile, everything seems to work fine. However, at some point during my programming it just breaks. Sometimes the tab that these components are on starts throwing exceptions when I view the designer page (A missing method exception) so it won't display. Sometimes JUST those components from the GSNet library don't show up. Sometimes, if I try to run it, I get a not-instantiated exception on one of their lines of code in the designer code file. Sometimes I can't view the designer at all. No matter what I do I can't reverse it. Even if I undo what I just did it won't fix it. If it happens, I have to revert to a backup and start over again. So I started to backup pretty much every step. I compile it and it works. I comment out a line of code, save it, and then uncomment that same line of code (so I am working with the same exact code) and the components all disappear. It doesn't matter what line of code I actually comment out, as long as it is in the same project that these components are being used. I pretty much have to use the components. . . so does anyone have any suggestion or where I can look to debug this?

    Read the article

  • Javascript toggle using custom attributes

    - by Jacob
    Can't seem to get this to work for me, can anyone offer me some help? http://codepen.io/anon/pen/kABjC This should open and close a section of text based on click, it takes the ID # which is just a digit (1,2,3,4,etc) and using that id targets an id to open and close the section. Javascript $(document).ready(function(){ $('.classclick').click(function(){ $('#class'+$(this).Attr('data-id')+"show").show(400); }); }); HTML <div class="classes"> <?php foreach ($classes as $class): ?> <div class="class"> <div class="classclick" data-id="<?=$class['cid']?>"> <div class="class-title"> <?=$class['className']?> </div> <div class="class-intensity"> Intensity: <?=$class['classIntensity']?> </div> </div> <div class="class-show hidden" id="class<?=$class['cid']?>show"> <div class="class-inner-content"> <div class="two-thirds"> <?=$class['classDesc']?> </div> <div class="one-third"> Things To Know: asdfasd asdf afsdadfs fsda dfsa dfsadfsa </div> </div> </div> </div> <?php endforeach; ?> </div>

    Read the article

  • Send custom data when initializing java WebService over soap

    - by Mesni
    Hello. I have a question about sending additional data over soap to the functions. My webService function requests only one integer, for example an getDocumentPrivilage(DocumentID). In another WebService user registered and he got an unique ID, so the other application can see who he is. So on Service one he registers, gets id and it has to send it to the other webservice tor the privilage. Id dont wish to rewrite the function so that it gets the unique ID (like this getDocumentPrivilage(uniqID,DocumentID)) but, the wish is that i would be able to create a client that sends this data at the initialization or somehow as some sort of parameter behind the function. Is this possible?? I tried the ServiceLifecycle but cant see any setting i've given in. Im using WebSphere CE for the server and Jax-ws Creating the webapp in java. Thank you very much in advance. lp, Mesni

    Read the article

  • Unsure how to modify userDetailsService to allow for custom userDetails but keep datasource

    - by adam2510
    what i am trying to do is i'm following this http://www.theserverside.com/tip/-Spring-Security-Customizing-Your-User-and-Authorization-in website to attempt to customise the UserDetails so i can retrieve more fields regarding to the user... as far as implementing the UserDetails, where i am confused is the UserDetailsService at the moment i only have the code for the userDetailsService that is in the website linked above i'm just not sure on how to go about doing it

    Read the article

  • ASP.NET Custom Control - Default Template?

    - by Bob Fincheimer
    I know this is really picky, but can I have one template inside a user control: <uc:MyUserControl runat="server" ID="test"> <div><b>Test</b></div> <asp:PlaceHolder runat="server" id="pH" /> </uc:MyUserControl> Instead of what I have now which requires me to: <uc:MyUserControl runat="server" ID="test"> <Content> <div><b>Test</b></div> <asp:PlaceHolder runat="server" id="pH" /> </Content> </uc:MyUserControl> Basically I want my control to have only one ITemplate inside of it.

    Read the article

  • custom membership for dot net nuke

    - by Pius
    Hi!! i am new in dot net nuke.i just found that there is open id logging option in dot net nuke.And so i did need user to register afresh in my dnn application.This is because i have another mvc application which i would like to be the openid provider for my dnn application.and am totally confused on how to go about that? Again,is it possible to tamper with dnn membership such that i use aspnetsqlmembership? Your contributions will be highly appreciated. Thanks in advance..

    Read the article

  • Custom Rails Validation (Doesn't seem to be working)

    - by Karl Entwistle
    Hey guys ive got the following Model for Accounts require 'net/http' require 'uri' require 'date' class Account < ActiveRecord::Base validates_presence_of :username, :password, :on => :update validate :valid_expiry_date, :on => :update def valid_expiry_date reply = Net::HTTP.get URI.parse("http://api.rapidshare.com/cgi-bin/rsapi.cgi?sub=getaccountdetails_v1&type=prem&login=" + username + "&password=" + password) account = Time.at(reply[80..90].to_i) if (Time.now + 2419200) <= account return true else return false errors.add_to_base("Sorry this account isnt valid") end end end I know the code works in a ruby.rb file and will return true or false, however I seem to be having rather a lot of difficultly trying to translate this code into an actual validation, any help would be much appreciated. Thanks :) Its also defiantly at least connecting to the website as my firewall asked me if the Terminal was aloud to access it. At the moment not only is it displaying no errors its actually letting anything through and saving it.

    Read the article

  • Reverse engineering a custom data file

    - by kerchingo
    At my place of work we have a legacy document management system that for various reasons is now unsupported by the developers. I have been asked to look into extracting the documents contained in this system to eventually be imported into a new 3rd party system. From tracing and process monitoring I have determined that the document images (mainly tiff files) are stored in a number of 1.5GB files. These files seem to be read from a specific offset and then written to a tmp file that is then served via a web app to the client, and then deleted. I guess I am looking for suggestions as to how I can inspect these large files that contain the tiff images, and eventually extract and write them to individual files.

    Read the article

  • PHP custom function code optimization

    - by Alex
    Now comes the hard part. How do you optimize this function: function coin_matrix($test, $revs) { $coin = array(); for ($i = 0; $i < count($test); $i++) { foreach ($revs as $j => $rev) { foreach ($revs as $k => $rev) { if ($j != $k && $test[$i][$j] != null && $test[$i][$k] != null) { if(!isset($coin[$test[$i][$j]])) { $coin[$test[$i][$j]] = array(); } if(!isset($coin[$test[$i][$j]][$test[$i][$k]])) { $coin[$test[$i][$j]][$test[$i][$k]] = 0; } $coin[$test[$i][$j]][$test[$i][$k]] += 1 / ($some_var - 1); } } } } return $coin; } I'm not that good at this and if the arrays are large, it runs forever. The function is supposed to find all pairs of values from a two-dim array and sum them like this: $coin[$i][$j] += sum_of_pairs_in_array_row / [count(elements_of_row) - 1] Thanks a lot!

    Read the article

  • How to make custom tab using jquery?

    - by ALAN
    i have following html, i want to make simple tab using jquery <td style="border-color: black; border-style: solid; border-width: 1px 0 1px 1px;"> <div id="cont-1-1"> My first tab content </div> <div id="cont-2-1"> My second tab content </div> </td> <td style="width: 30px"> <div id="tab-box"> <div style="height: 121px;"><img src="/Images/Tab1.png" /></div> <div style="border-left: 1px solid Black;"><img src="/Images/Tab2.png" /></div> <div style="border-left: 1px solid Black; height: 40px;"></div> </div> </td> </td> Where Tab1.Png and Tab2.Png are my tab headers and div id :cont-1-1 and 2-1 are tab content, i don't want to use any jquery plug-in for this, just need something simple when i click on tab,,hide and show contents thanks

    Read the article

  • Getting access to a custom Master page from a user control

    - by Bernard
    Hi We have created a Master page that inherits off the asp.net Master class. We have also got ui controls that inherit off the standard asp.net ui control class. Our Master page has a public member variable. We need to be able to access that member variable from the ui controls that we use. However we can't seem to get at it? Is it our architecture that is wrong? Or the idea itself - user control getting acces to Master page variables?

    Read the article

  • Javascript/jQuery: Varying parameters on a custom function

    - by dclowd9901
    I'm writing a plugin that will allow parameters to 'set it up.' But I predict the user won't always want to set up every aspect of the function. function This_Function(a,b,c,d); For instance, maybe they'll only want to set up a and c, but not b and d (they'll just prefer to leave those as defaults). How do I write the function (or the parameters for that matter) so that the user can customize which functions they would prefer to pass? I have a feeling it involves parsing input, but I've seen many other functions with this capability. Thanks in advance for the help.

    Read the article

  • Custom bean instantiation logic in Spring MVC

    - by Michal Bachman
    I have a Spring MVC application trying to use a rich domain model, with the following mapping in the Controller class: @RequestMapping(value = "/entity", method = RequestMethod.POST) public String create(@Valid Entity entity, BindingResult result, ModelMap modelMap) { if (entity== null) throw new IllegalArgumentException("An entity is required"); if (result.hasErrors()) { modelMap.addAttribute("entity", entity); return "entity/create"; } entity.persist(); return "redirect:/entity/" + entity.getId(); } Before this method gets executed, Spring uses BeanUtils to instantiate a new Entity and populate its fields. It uses this: ... ReflectionUtils.makeAccessible(ctor); return ctor.newInstance(args); Here's the problem: My entities are Spring managed beans. The reason for this is to inject DAOs on them. Instead of calling new, I use EntityFactory.createEntity(). When they're retrieved from the database, I have an interceptor that overrides the public Object instantiate(String entityName, EntityMode entityMode, Serializable id) method and hooks the factories into that. So the last piece of the puzzle missing here is how to force Spring to use the factory rather than its own BeanUtils reflective approach? Any suggestions for a clean solution? Thanks very much in advance.

    Read the article

  • Image processing custom filter 7 by 7

    - by ladiesMan217
    Lets say I have a 7 by 7 neighborhood around a pixel that looks like this 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 and I wanna filter the above by replacing the pixel p by the average of those pixels whose value lie in the range -10<=p_value <=10. I am new to image processing and I think in this case p_value is 25 and around 25 that are many pixel values in that range but don't exactly know to construct a convolution filter out of it.

    Read the article

  • Custom Drupal Module not creating any tables

    - by Anthony
    Anything specific I need in the module file? Install File function module_install() { //lets create the school database $create_table_sql = "CREATE TABLE IF NOT EXISTS `table1` ( id int(11) NOT NULL, principal_name varchar(300) NOT NULL, school_name varchar(300) NOT NULL, address1 varchar(300) NOT NULL, address2 varchar(300) NOT NULL, city varchar(300) NOT NULL, computer_serial_no varchar(300) NOT NULL, state varchar(200) NOT NULL, uid int(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1"; db_query($create_table_sql); //lets create the student database $create_table_sql = "CREATE TABLE IF NOT EXISTS table2 ( id int(11) NOT NULL, principal_name varchar(300) NOT NULL, school_name varchar(300) NOT NULL, address1 varchar(300) NOT NULL, address2 varchar(300) NOT NULL, city varchar(300) NOT NULL, computer_serial_no varchar(300) NOT NULL, state varchar(200) NOT NULL, uid int(200) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1"; db_query($create_table_sql); } /** * _UNINSTALL hook * * This function is run to uninstall the module. * */ function module_uninstall() { // Delete the DB db_query("drop table table1"); db_query("drop table table2"); } Info File Just in Case ; $Id$ name = My Module description = This module deals with blah blah package = Somepackage core = 6.x version = "6.x-1.0" core = "6.x"

    Read the article

  • nhibernate activerecord lazy collection with custom query

    - by George Polevoy
    What i'm trying to accomplish, is having a temporal soft delete table. table Project(ID int) table ProjectActual(ProjectID int, IsActual bit, ActualAt datetime) Now is it possible to map a collection of actual projects, where project is actual when there is no record in ProjectActual.ProjectID = ID, or the last record sorted by ActualAt descending has IsActual set to 1 (true)?

    Read the article

  • How to create custom filenames in C?

    - by eSKay
    Please see this piece of code: #include<stdio.h> #include<string.h> #include<stdlib.h> int main() { int i = 0; FILE *fp; for(i = 0; i < 100; i++) { fp = fopen("/*what should go here??*/","w"); //I need to create files with names: file0.txt, file1.txt, file2.txt etc //i.e. file{i}.txt } }

    Read the article

  • How to use custom font with Webview

    - by user164542
    Now i want to display some unicode characters and i have used tag: something herer . But it seems that webview can not find the Arial font because i can only see UFO - Characters . Do i have to copy arial.ttf to somewhere or how can i use this true- type-font with webview? Thanks.

    Read the article

  • Custom authentication module inheriting IHttpModule issue.

    - by Chandan Khatwani
    LoginPage.aspx:- protected void Button1_Click(object sender, EventArgs e) { Context.Items["Username"] = txtUserId.Text; Context.Items["Password"] = txtPassword.Text; // FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, Context.Items["Username"].ToString(), DateTime.Now, DateTime.Now.AddMinutes(10), true, "users", FormsAuthentication.FormsCookiePath); // Encrypt the cookie using the machine key for secure transport string hash = FormsAuthentication.Encrypt(ticket); HttpCookie cookie = new HttpCookie( FormsAuthentication.FormsCookieName, // Name of auth cookie hash); // Hashed ticket // Set the cookie's expiration time to the tickets expiration time if (ticket.IsPersistent) cookie.Expires = ticket.Expiration; Response.Cookies.Add(cookie); Response.Redirect("Default.aspx"); } Global.asax file:- void Application_AuthenticateRequest(object sender, EventArgs e) { if (HttpContext.Current.User != null) { if (HttpContext.Current.User.Identity.IsAuthenticated) { if (HttpContext.Current.User.Identity is FormsIdentity) { FormsIdentity id = (FormsIdentity)HttpContext.Current.User.Identity; FormsAuthenticationTicket ticket = id.Ticket; // Get the stored user-data, in this case, our roles string userData = ticket.UserData; string[] roles = userData.Split(','); HttpContext.Current.User = new System.Security.Principal.GenericPrincipal(id, roles); Response.Write(HttpContext.Current.User.Identity.Name); Response.Redirect("Default.aspx"); } } } } I get the following error after signing in This webpage has a redirect loop. The webpage at http://localhost:1067/Default.aspx has resulted in too many redirects. Clearing your cookies for this site or allowing third-party cookies may fix the problem. If not, it is possibly a server configuration issue and not a problem with your computer.

    Read the article

< Previous Page | 141 142 143 144 145 146 147 148 149 150 151 152  | Next Page >