Language:
switch to room list switch to menu My folders
Go to page: First ... 91 92 93 94 [95] 96 97 98 99 ... Last
[#] Fri Dec 21 2012 07:20:29 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


So, I suppose, I'm looking for advice. Some of you (IG in particular) have a lot of experience writing daemons for posix. I have a lot of experience writing NT services. I'd like to merge these two expertises into a single code set that can work for both OSes.

Later, I'll post the code I currently have for creating an NT service. This code is a lightly modified version of code I found on Dr Dobbs. The modifications were intended to make it easier to create an NT service (derive a class and call a macro).

[#] Fri Dec 21 2012 09:01:51 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

we do something like this:


#ifdef __WIN32__

#ifdef WINNT_SERVICE

int PASCAL
WinMain (HINSTANCE ThisInstance, HINSTANCE hPrevInstance, char *lpCmdLine,
     int nCmdShow)
{

the_real_main();
    return (0);
}

#else /* WIN32 Console Server */

int PASCAL
WinMain (HINSTANCE ThisInstance, HINSTANCE hPrevInstance, char *lpCmdLine,
     int nCmdShow)
{
    return the_real_main(...);
}

#endif

#else /* UNIX */

int
main (int argc, char* argv[])
{
    return the_real_main (argc, argv);
}

#endif

 

I guess that doesn't exactly all those hooks for windows services...

 

heres a signal handler from citserver:

static RETSIGTYPE signal_cleanup(int signum) {
    syslog(LOG_DEBUG, "Caught signal %d; shutting down.", signum);
    exit_signal = signum;
    server_shutting_down = 1;
}

 

maybe winelib already has something to offer for you that fulfills much of your needs?



[#] Fri Dec 21 2012 11:44:25 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I have attached my ntservice.h file.

This is actually a refinement from what I normally use at my job, in that it's a single header... I usually have much of the functions in a separate .cpp file that I pull in as an include.

Hopefully, this gives you an idea of where I'm going, at least in C++.



ntservice.h (text/plain, 19573 bytes) [View| Download]
[#] Fri Dec 21 2012 12:52:21 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


Good luck... migrations can take significant time.

[#] Fri Dec 21 2012 22:56:25 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Yeah... the approach I want to take involves slowly converting the code to work on both operating systems instead of being exclusive to Windows, then have some additional stuff built specific to Linux that addresses some of the OS-centric stuff that we want to 'simplify' for users (e.g. setting up networking, serial connections for certain applications, etc).  This effort alone could take a good while, especially when I still have to write code for new products and features, too.

It could take me a very long time to accomplish this, especially since I rely rather heavily on DirectShow for streaming audio/video.  I'll have to learn how to approach things the same way that VLC does for that stuff... and hope that the codecs in Linux are at least as good as the ones we use now.

I also have to navigate the whole licensing thing, since we don't want to release too much of our code to the public, out of concern for competition.  Personally, I don't think this ought to be as much of a concern (since this kind of technology doesn't really make a tremendous amount of money), but habits die hard sometimes.

In the end, I hope it's possible.  But if I wind up generating some interesting code that other folks could use in the process, then we're all the better for me trying.



[#] Tue Dec 25 2012 16:54:18 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

The POSIX service startup/shutdown stuff is significantly less complex than it is on Windows. The downside is that it uses shell scripts, so there's more futzing around during the installation process.

Even among unix-like systems there'd be some use for an abstraction layer, to smooth over the difference between classic SysV init vs. Upstart vs. whatever Apple uses.

It sounds like the logical place for this to go would be a system where you provide a program that "does something" and then you let the system handle the dirty work of starting it up and shutting it down.

Wasn't your former employer owned by InstallShield? If so there could be some legal hurdles...

[#] Wed Dec 26 2012 11:26:25 EST from fleeb @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I doubt there would be any legal problems... the code I used is based strongly off something written in an article in Dr. Dobbs.  I've only very lightly tweaked it to make it easier to use.

Even so, the code was written for use with the captioning company, not WinINSTALL (never did work with Installshield).  And even when I worked on WinINSTALL, we left VERITAS before they merged with Symantec, so I never wrote code that made it into Symantec's corporation.  I just wound up with some Symatec stock due to the stock I had in VERITAS.

Okay, well, I suppose I should write a first pass at a class for posix-based systems, and perhaps find out what doesn't work if people complain about stuff.  I should also read about how Boost figures out various environments, so I can make it so you include one header regardless of what operating system you're using.

Aaand, I guess, I should see if I have a linux VM somewhere as well, for testing.



[#] Sat Jan 05 2013 13:51:05 EST from zooer @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Having a problem I can't figure out. That thing called Google was of no
help. I created a script but I can't get it to execute without typing
".sh" after the file name.

The files are in the bin directory in my home directory.
The permissions for that director allows executable programs.
I have another script in that directory that runs using the
filename without the ".sh" at the end.
"#!/bin/bash" is at the begining of both files.
"#!/bin/sh" caused some error in the "sendpic" script and didn't
solve the problem of allowing helen to execute without the ".sh"
Here is the directory and screen output.

-rwxr-xr-x 1 zooer zooer 97 Jan 5 09:05 helen.sh
-rwxr-xr-x 1 zooer zooer 6.7K Jan 5 09:09 sendpic.sh
drwxr-xr-x 2 zooer zooer 4.0K Jan 5 09:12 .
zooer@zooer-Linux12:~/bin$ helen
helen: command not found
zooer@zooer-Linux12:~/bin$ helen.sh (executes as it should)

zooer@Wzooer-Linux12:~/bin$
zooer@zooer-Linux12:~/bin$ sendpic (executes as it should)
/home/zooer/Pictures/webcam/front-cam.jpg: 67.86 kB 6.67 kB/s

I am not sure what I have to do to get helen to execute without the .sh
at the end. I am sure it is something simple. Can you help? I will
buy someone something from the TacoBell dollar menu.

[#] Sat Jan 05 2013 15:56:24 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

remember, you're in unix here. filenames are what they are.

if you insist to call it blabla.sh, you have to call it as blabla.sh

if you want to call it blabbla, either name it that way or symlink it.

everything in your PATH environment variable is used to search for filenames.



[#] Sat Jan 05 2013 17:13:38 EST from zooer @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

So why does one "blabla" work without the ".sh" but "yackity" does not work without the ".sh"?

[#] Sat Jan 05 2013 18:45:24 EST from the_mgt @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

 

Sat Jan 05 2013 23:13:38 CET from zooer @ Uncensored
So why does one "blabla" work without the ".sh" but "yackity" does not work without the ".sh"?
you probably have a false positive. yackity also lives in /usr/bin or /usr/local/bin or anywhere in $PATH is my suggestion. what does "which blabla" say?

 



[#] Sat Jan 05 2013 19:26:47 EST from zooer @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Both files are in the same directory, my bin directory, which is in my path statement.

This is a new install so it shouldn't be in /usr/bin.

[#] Sat Jan 05 2013 21:29:14 EST from LoanShark @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]


the important question is not "why doesn't helen execute" but "why does sendpic execute".

helen should not execute
sendpic should not execute.

maybe you created a bash alias that you forgot about?

[#] Sun Jan 06 2013 00:23:42 EST from ax25 @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Where in the path statment, before or after the home bin location?

echo $PATH

Location matters.  First found is first run.

Remember, if you want to run a command under Unix (without descrepancy), you might want to say run from the current location i.e.:

./script



[#] Sun Jan 06 2013 09:46:16 EST from zooer @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

maybe you created a bash alias that you forgot about?


BINGO! Thank you.

This system is a new install which I did around Christmas, I have a text file list of changes and
adjustments I want to make on new installs, that alias is not in that list. I must have cut and
pasted it from one of the other distros in my multi-boot system.

I knew did something to call the file (Two years ago) but couldn't remember what it was. Something so
simple it was silly. It is all coming back.

Thank you.

[#] Mon Jan 14 2013 23:29:04 EST from IGnatius T Foobar @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

The easier way would be to simply omit the '.sh' from the filename in the first place. Make it executable, put it in your search path, and include '#!/bin/bash'
on the first line for good measure.

[#] Wed Jan 16 2013 11:25:29 EST from zooer @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

Yes I thought about eliminating the ".sh" but I like file extensions.

[#] Fri Feb 01 2013 09:58:42 EST from dothebart @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

using the c-pre processor to generate html:

http://www.cs.tut.fi/~jkorpela/html/cpre.html

.oO(???)



[#] Fri Feb 01 2013 12:49:33 EST from zooer @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

What do you question about it?

[#] Fri Feb 01 2013 15:30:11 EST from Spell Binder @ Uncensored

[Reply] [ReplyQuoted] [Headers] [Print]

I've been doing some light reading on programming techniques and patterns recently, and came across something that made me go, "I wonder..."

The visitor pattern: http://en.wikipedia.org/wiki/Visitor_pattern

From the description given, it seems to me that the visitor pattern is, in functional programming terminology, equivalent to doing a map on a container type. Though map in most functional languages seems more geared towards list objects, there's no reason it can't be defined for a non-list type. In that sense, both map and the visitor pattern will traverse an arbitrary structure, applying some function/method along the way.

Does this sound reasonable to anyone else, or am I just sufferring from empanada withdrawal?
Pattern Binder

Go to page: First ... 91 92 93 94 [95] 96 97 98 99 ... Last