Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
J

Jordanwb

@Jordanwb
About
Posts
179
Topics
52
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • freeing pointers in pointer array causes SegFault [solved]
    J Jordanwb

    Okay thanks.

    ATL / WTL / STL data-structures

  • freeing pointers in pointer array causes SegFault [solved]
    J Jordanwb

    Thanks for replying. This is what's in my main() function:

    List *list = list_create();
    list_add (list, "Hello");
    list_dealloc (list);

    ATL / WTL / STL data-structures

  • freeing pointers in pointer array causes SegFault [solved]
    J Jordanwb

    Hello. I have the following code block:

    #include <stdlib.h>

    typedef struct List_s
    {
    int count;
    void **items;
    } List;

    List *list_create()
    {
    List *list = malloc (sizeof (List));
    list->count = 0;
    list->items = malloc (1 * sizeof (void *));

    return list;
    

    }

    void list_add (List *list, void *item)
    {
    list->items = realloc (list->items, (list->count + 1) * sizeof (void *));
    list->items[list->count] = item;
    list->count++;
    }

    void list_dealloc (List *list)
    {
    for (int i = 0; i < list->count; i++)
    {
    free (list->items[i]);
    }

    free (list->items);
    free (list);
    

    }

    When I pass a List to list_dealloc I get a segmentation fault on the line in the for loop. I can print the contents of items[i] just fine (in my test case it's the string "Hello"). I'm using gcc-4.5.1 on 64 bit Fedora 14 if that's anything useful.

    modified on Monday, February 28, 2011 12:57 PM

    ATL / WTL / STL data-structures

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    I had upgraded QuickBooks 2009 to 2010 edition for my dad. The conversion started off at taking four hours, then down t 2 and a half hours, down to twelve minutes then down to 3. The whole process took around 2 minutes.

    Java question csharp c++ java linux

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    It sortof makes sense. Java apps are capable of processing arguments, altough they're infrequently used on Windows. Another thing I forgot was that the first letter of a method is always lowercase. I had to rename Main (String[]) to main (String[]).

    Java question csharp c++ java linux

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    I added String[] args to the args of main () and it works.

    Java question csharp c++ java linux

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    This is the content of the manifest file:

    Main-Class:MainWindow

    Java question csharp c++ java linux

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    I used BlueJ to create the jar which I believe creates the manifest file for me.

    Java question csharp c++ java linux

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    jordanwb@jordanwb-laptop:/media/DEFB-0C36/PhpDesigner$ java -jar PhpDesigner.jar
    Exception in thread "main" java.lang.NoSuchMethodError: main

    The main method does exist in the startup class. :confused:

    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.util.*;

    public class MainWindow extends JFrame implements ActionListener
    {
    private JMenuBar main_menu;

    private JMenu file\_menu;
    private JMenuItem new\_project, open\_project, save\_project, save\_project\_as, quit;
    
    private JMenu objects\_menu;
    private JMenuItem add\_folder, add\_file, add\_class, add\_interface, add\_function, add\_parameter, add\_field;
    
    private JPanel php\_object\_manager;
    
    public MainWindow()
    {
        super ("PhpDesigner");
        
        this.setSize (800, 600);
        this.setDefaultCloseOperation(JFrame.EXIT\_ON\_CLOSE);
        
        /\* Set up main menu \*/
        /\* Set up file menu \*/
        this.new\_project = new JMenuItem("New Project", new ImageIcon ("./Images/document-new.png"));
        this.new\_project.addActionListener (this);
        
        this.open\_project = new JMenuItem("Open Project", new ImageIcon ("./Images/document-open.png"));
        this.open\_project.addActionListener (this);
        
        this.save\_project = new JMenuItem("Save Project", new ImageIcon ("./Images/document-save.png"));
        this.save\_project.addActionListener (this);
        
        this.save\_project\_as = new JMenuItem("Save Project As", new ImageIcon ("./Images/document-save-as.png"));
        this.save\_project\_as.addActionListener (this);
        
        this.quit = new JMenuItem("Quit", new ImageIcon ("./Images/system-log-out.png"));
        this.quit.addActionListener (this);
        
        this.file\_menu = new JMenu ("File");
        this.file\_menu.add (this.new\_project);
        this.file\_menu.addSeparator();
        this.file\_menu.add (this.open\_project);
        this.file\_menu.add (this.save\_project);
        this.file\_menu.add (this.save\_project\_as);
        this.file\_menu.addSeparator();
        this.file\_menu.add (this.quit);
        
        this.main\_menu = new JMenuBar ();
        this.main\_menu.add (this.file\_menu);
        
        this.getContentPane().add (this.main\_menu, BorderLayout.NORTH);
        /\* End of setting up file menu \*/
        /\* Set up Objects menu \*/
        
        this.add\_folder = new JMenuItem ("Add Folder");
        this.add\_file = new JMenuItem ("Add Fil
    
    Java question csharp c++ java linux

  • [Solved]Fatal Exception occured when running jar file [modified]
    J Jordanwb

    I'm writing a program using BlueJ. I created a jar file and set the Main class to the desired class. When I run the jar in Explorer I get an error window saying "Java Virtual Machine Launcher. Fatal Exception occured. Program will exit." I have a Main method which instantiates a class which extends JFrame. I wrapped that in a try-catch block to see if there was an error on my code. The message still appears. Is there a way to get a more verbose error? *Edit* Okay I ran it on my linux machine and this is the error:

    jordanwb@jordanwb-laptop:/media/DEFB-0C36/PhpDesigner$ java PhpDesigner.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: PhpDesigner/jar
    Caused by: java.lang.ClassNotFoundException: PhpDesigner.jar
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
    Could not find the main class: PhpDesigner.jar. Program will exit.

    So it can't fine the class, but how do I go about fixing that? Apparently the compiler and BlueJ can find the MainWindow class but the virtual machine can't.

    modified on Thursday, January 7, 2010 4:16 PM

    Java question csharp c++ java linux

  • Service does not start [modified]
    J Jordanwb

    Okay Thanks.

    C# sysadmin linux debugging workspace

  • Service does not start [modified]
    J Jordanwb

    I'll try writing to a file. *Edit* On Ubuntu 9.10 the output of Console.WriteLine, Console.Out.WriteLine and Console.Error.WriteLine goes to the user log. Why do I have to killall mono in order to stop the service? Why can't I just call mono-service2 ServiceTest.exe to stop it?

    modified on Tuesday, December 15, 2009 12:02 PM

    C# sysadmin linux debugging workspace

  • Service does not start [modified]
    J Jordanwb

    In my opening post I stated I was running Ubuntu 9.04

    C# sysadmin linux debugging workspace

  • Service does not start [modified]
    J Jordanwb

    I changed it to Console.Error.Writeline and I was able to see "Started Ok" and "Stopped Ok". I ran mono-service2 with the --no-daemon arg. I'll try it without. *Edit* I started it without the --no-daemon argument, there is no output, but mono does show up in the list of running processes. *Edit #2* There is no output in the user.log file coming from my "service". *Edit #3* Changing it from Console.Error to Console.Out made no change.

    modified on Monday, December 14, 2009 11:22 PM

    C# sysadmin linux debugging workspace

  • Service does not start [modified]
    J Jordanwb

    Still no output.

    C# sysadmin linux debugging workspace

  • Service does not start [modified]
    J Jordanwb

    This is my code:

    using System;
    using System.IO;
    using System.ServiceProcess;
    using System.ComponentModel;
    using System.Configuration;
    using System.Configuration.Install;

    namespace ServiceTest
    {
    public class MainClass : ServiceBase
    {
    public static void Main(string[] args)
    {
    ServiceBase.Run(new MainClass());
    }

        protected override void OnStart(string\[\] args)
        {
    		Console.WriteLine ("Started OK");
    		
    		base.OnStart (args);
    	}
    	
    	protected override void OnStop ()
    	{
    		Console.WriteLine ("Stoppeds OK");
    		
    		base.OnStop ();
    	}
    }
    
    \[RunInstaller(true)\]
    public class MainClassInstaller : Installer
    {
        public MainClassInstaller()
        {
            ServiceProcessInstaller process = new ServiceProcessInstaller();
    
            process.Account = ServiceAccount.LocalSystem;
    
            ServiceInstaller serviceAdmin = new ServiceInstaller();
    
            serviceAdmin.StartType = ServiceStartMode.Manual;
            serviceAdmin.ServiceName = "Service Test";
            serviceAdmin.DisplayName = "Service Test";
    
            Installers.Add(process);
            Installers.Add(serviceAdmin);
        }
    }
    

    }

    I'm writing a Server program in Monodevelop on Ubuntu 9.04, and I've got mono-service2 installed. When I try and run the exe via mono-service2 --debug ./ServiceTest.exe I don't get any output.

    modified on Monday, December 14, 2009 4:51 PM

    C# sysadmin linux debugging workspace

  • When to call base.Onstart
    J Jordanwb

    Sorry for not getting back sooner. In the OnStart method I'll be creating a couple of threads, a dozen or sockets and creating some objects but they won't depend on base.OnStart(). Let's say that something in my OnStart fails (file not found for example), how would I report that startup has failed and stop the startup of the service? Do I simply not call base.OnStart()?

    modified on Sunday, December 6, 2009 9:15 PM

    C# question

  • When to call base.Onstart
    J Jordanwb

    I have a class that inherits System.ServiceProcess.ServiceBase and is overriding the OnStart (string[] args) method. Where do I call base.OnStart(args)? At the beginning of the method or at the end?

    protected override void OnStart(string[] args)
    {
    // Do Stuff
    base.OnStart(args);
    }

    Or:

    protected override void OnStart(string[] args)
    {
    base.OnStart(args);
    // Do Stuff
    }

    C# question

  • Getting application config directory folder path
    J Jordanwb

    I'm working on a Service in C# that will be run on Windows and on Linux. On Linux you store app config in /etc, but on Windows XP it's "C:\Document and Settings\{USERNAME}\Local Settings\Application Data". How would I go about getting those file paths without having to worry about platform detection?

    C# csharp linux question

  • Storing memory address as hex in an xml file
    J Jordanwb

    I don't want to save the address to XML via C#, I want to read the address from the XML. Sorry I wasn't specific enough.

    C# csharp xml performance question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups