Daily Archives

Articles indexed Saturday May 15 2010

Page 25/78 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • Initialisation of Objects Syntax question

    - by Brock Woolf
    When I initialise a struct in C (Node is the struct): struct Node { /* Non-Relevant code */ }; This works: Node *rootNode = new Node(); but so does this: Node *rootNode = new Node; Is there a difference, and what is the difference between using () or not using the brackets? Just off memory, I think the same applies above for C++ object initialisations. What is happening here?

    Read the article

  • Class lookup structure array in C++

    - by wyatt
    I'm trying to create a structure array which links input strings to classes as follows: struct {string command; CommandPath cPath;} cPathLookup[] = { {"set an alarm", AlarmCommandPath}, {"send an email", EmailCommandPath}, {"", NULL} }; which will be used as follows: CommandPath *cPath = NULL; string input; getline(cin, input); for(int i = 0; cPathLookup[i] != ""; i++) { if(cPathLookup[i].command == input) cPath = new cPathLookup[i].cPath; } Obviously, this code is meaningless, but I think my intention is apparent - depending on input, I'd like cPath to be initialized as either a new AlarmCommandPath or a new EmailCommandPath. I could handle it with a function returning an instance depending on input, but a whole sequence of ifs just seems inelegant. I should also note that, in case it's not apparent and important, that AlarmCommandPath and EmailCommandPath are derived from CommandPath, and CommandPath is an abstract class. Thanks for any help you can offer. EDIT: I just noticed that, in spite of CommandPath being abstract, I have a declaration: CommandPath *cPath = NULL; in working code. Why does that compile?

    Read the article

  • C# - Is it possible to start my project with a class instead of a form?

    - by Irro
    I want my project to be started through an class instead of a form, is there any way to do this? Or to be more precise is there any good way to make sure that the first class, except Program, that is started isn't a form-class. I tried to change to my class in Program.main() but it looks like Application.run() needs a ApplicationContext. I guess that I could change the Program-class to start another class and let that class start the form with Application.run() but I think that it will cause a lot of problem since I don't want the same form to be started first each time and Application.run() have to be used at least once and at most once. So I think it will be hard to keep track of if Application.run() has been used or not. Another question that might be even more important; Is this a good way to do things in .net? The reason I want to do so is because I want to create some sort of MVC project where the class I want to start with is the controller and all forms I'll use will be views.

    Read the article

  • excel change 4 rows / 48 col to 48 rows / 4 col

    - by GoodOlPete
    Hi, I've selected 4 database records of 48 fields into excel as below: FirstName LastName Age Address1 ....................... Andy smith 23 53 high st billy ball 43 23 the avenue charles brown 76 rose cottage dave green 43 station rd I want to display them as firstname andy billy charles dave lastname smith ball brown green age 23 43 76 43 address1.............................. Can anyone suggest how to do this?

    Read the article

  • wordpress backend: retrict post tags to site tags only

    - by Richard
    In the post screen, I want to remove the option of multi-authors being able to 'free tag' their posts. In other words, only allow tags that have been preset in the admin tags section.(these tags are of course visible in the tag cloud in posts screen) The concept is to prevent authors introducing random tags in their posts, leading to duplication and confusion.

    Read the article

  • Classic ASP, ASP.NET, IFrames and response.redirect issue....

    - by Abdullah Ahmed
    A client has an asp page with an iframe. The Iframe loads an asp.net page inside the asp classic page. The ASP.NET page is responsible for connecting to a webservice, displaying some data, and then when the user clicks a button it does a response.redirect another classic asp page. Since the asp.net page is in an iframe, the asp page loads inside the iframe when ideally it should be taking over the entire page. I have tried putting javascript in the final asp page to break out of iframes but it does not seem to fire. I tried doing onClientCLick() on the asp.net page and making it break out of the iframe using the following javascript top.location = self.location.href But since that sets the location it seems to refresh the page , breaks out of the iframe but does not fire the serverside onclick event which would then perform the backend calculations and do response.redirect. Any ideas on how I can make sure that the final asp page does not appear inside the iframe and breaks out of it ?

    Read the article

  • How to release a "PopUp" view"?

    - by david
    I have this class that shows a popup. I do a alloc-init on it and it comes up. DarkVader* darkPopUp = [[DarkVader alloc] init:theButton helpMessage:[theButton.titleLabel.text intValue] isADay:NO offset:0]; It shows itself and if the user presses Ok it disappears. When do I release this? I could do a [self release] in the class when the OK button is pressed. Is this correct? If I do this the Analyzer says it has a retain count of +1 and gets leaked in the calling function. If I release it just after the alloc-init the Analyzer says it has a retain count of +0 and i should not release it. DLog(@"DarkVader retain count: %i", [darkPopUp retainCount]); says it has a retain count of 2. I'm confused. In short my question is: How do I release an object that gets initialized does some work and ends but no one is there to release it in the calling function.

    Read the article

  • Forms authentication: disable redirect to the login page

    - by codeka
    I have an application that uses ASP.NET Forms Authentication. For the most part, it's working great, but I'm trying to add support for a simple API via an .ashx file. I want the ashx file to have optional authentication (i.e. if you don't supply an Authentication header, then it just works anonymously). But, depending on what you do, I want to require authentication under certain conditions. I thought it would be a simple matter of responding with status code 401 if the required authentication was not supplied, but it seems like the Forms Authentcation module is intercepting that and responding with a redirect to the login page instead. What I mean is, if my ProcessRequest method looks like this: public void ProcessRequest(HttpContext context) { Response.StatusCode = 401; Response.StatusDescription = "Authentication required"; } Then instead of getting a 401 error code on the client, like I expect, I'm actually getting a 302 redirect to the login page. For nornal HTTP traffic, I can see how that would be useful, but for my API page, I want the 401 to go through unmodified so that the client-side caller can respond to it programmatically instead. Is there any way to do that?

    Read the article

  • Overriding Page class constructor in ASP.NET code-behind file -- when is it called?

    - by CSharp Noob
    If I override the System.Web.UI.Page constructor, as shown, when does DoSomething() get called in terms of the page lifecycle? I can't seem to find this documented anywhere. namespace NameSpace1 { public partial class MyClass : System.Web.UI.Page { public MyClass() { DoSomething(); } protected void Page_Load(object sender, EventArgs e) { } } } For reference, here is the ASP.NET Page Lifecycle Overview: http://msdn.microsoft.com/en-us/library/ms178472.aspx Turns out the best answer was right in the MSDN article. I just had to look carefully at the diagram.

    Read the article

  • Detect NativeDragDrop to Trash or RecycleBin

    - by colder
    I will let user remove item from List with a cool method. Drag an item in adobe air List control and then drop it to Trash(OSX) or Recycle Bin(Win). The trash accept move drag action only. So I think I must set dragMoveEnable=true. When I drag an item to Recycle Bin on Windows. It show accept effect(alpha mask) and Air remove that object from List's dataProvider. So I can find which one is disappear. But when I drag to Trash on MacOSX. It show effect too. But Air do nothing for List. Maybe this is a bug. How can I avoid it? Are there any way to detect where dropped by user?

    Read the article

  • Problem with Postgres FOR LOOP

    - by user341831
    Hi all, Ich have a problem in postgres function: CREATE OR REPLACE FUNCTION linkedRepoObjects(id bigint) RETURNS int AS $$ DECLARE catNumber int DEFAULT 0; DECLARE cat RECORD; BEGIN WITH RECURSIVE children(categoryid,category_fk) AS ( SELECT categoryid, category_fk FROM b2m.category_tab WHERE categoryid = 1 UNION ALL SELECT c1.categoryid,c1.category_fk FROM b2m.category_tab c1, children WHERE children.categoryid = c1.category_fk ) FOR cat IN SELECT * FROM children LOOP IF EXISTS (SELECT 1 FROM b2m.repoobject_tab WHERE category_fk = cat.categoryid) THEN catNumber = catNumber +1 END IF; END LOOP; RETURN catNumber; END; $$ LANGUAGE 'plpgsql'; I've got error: FEHLER: Syntaxfehler bei »FOR« LINE 1: ...dren WHERE children.categoryid = c1.category_fk ) FOR $2 I... I'm a newbee in Postgres. Please help. Thanx in advance

    Read the article

  • How can I read a binary string in C#?

    - by Sergey
    There is a php script which sends a binary string to the client application: $binary_string = pack('i',count($result_matrix)); foreach ($result_matrix as $row) { foreach ($row as $cell) { $binary_string .= pack('d',$cell); } } echo $binary_string; Silverlight application receives $binary_string via POST protocol. How can I parse this binary string? Or maybe there is a better way to send matrix from PHP to Silverlight?

    Read the article

  • Random freezes with Magix Music Maker 16

    - by NoCanDo
    Howdy, I'm experiencing random freezes in Magix Music Maker 16 on my Win7 platform. I'm running the app in admin mode btw. The freezes quite often occur after I load my compiled song and try to listen to different soundloops OR just seemingly randomly. Anyone know a solution?

    Read the article

  • Validation of WPF User Input using MVVM and Entity Framework 4.0

    - by Emad
    I am building a WPF 4.0 Application using MVVM. The Model is generated using Entity Framework 4.0. I am using Data binding on the WPF to bind the user input to model properties. What is the easiest way to validate user input ? I prefer an approach where I can set the validation rules on the Model rather than on the WPF itself. How can this be done? Any samples are appreciated.

    Read the article

  • is it possible to load a shared library on a shared memory?

    - by quimm2003
    I have a server and a client written in C. I try to load a shared library in the server and then pass library function pointers to the client. This way I can change the library without have to compile the client. Because of every process has its own separate memory space, I wonder if it is possible to load a shared library on a shared memory, pass the function pointers and map the shared memory on the client and then make the client execute the code of the library loaded by the server.

    Read the article

  • Returning a 1x1 .gif as a response in Rails

    - by Avishai
    Hi, I'm building a Rails app that does conversion tracking on outside sites. I'd like to allow users to paste an image tag in their conversion pages (like AdWords), and whenever that image is requested, a conversion registers in my app. respond_to do |format| if @conversion.save flash[:notice] = 'Conversion was successfully created.' format.html { redirect_to(@conversion) } format.xml { render :xml => @conversion, :status => :created, :location => @conversion } format.js { render :json => @conversion, :status => :created } format.gif { head :status => :ok } else format.html { render :action => "new" } format.xml { render :xml => @conversion.errors, :status => :unprocessable_entity } end end This way, the browser gets a non-existent .gif image. Is there a better way to do this?

    Read the article

  • CompareValidator date format

    - by ashtame
    Hi, I have an ajax calendar control that I specified the date format to be yyyy-MM-dd. Is it possible to have the comparevalidator validate that type of date sepcifically and have it fail for everything else? right now it seems to only take dd-MM-yyyy. Thanks.

    Read the article

  • How to include a dynamic page contents into a template ?

    - by Ankit
    Hi All, I have to include a dynamic page content into my template, Say I have a left panel which gets the data dynamically through a view. Now, I have to include this left panel into all my pages but I do not want to duplicate the code for all the pages. Is there any way, I can write a single script and include it in all my templates to display the left panel in all my pages? Thanks in advance.

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >