1,076,483 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?

Posts by DimaYasny

Hi All,

I am trying to start writing a wiki-ish CMS I've been contemplating for a while now.

the content will include pics, html content, and should be stored in a database (the current pick is postgres)

A few questions for the more experienced folk 'round here:
1. how do I plan such a database - is there a ready-made data type for a webpage, or do I need to build a table for every component (e.g. pictures). Is there a ready template for such a thing?
2. Python web frameworks - which would be best suited for this? Django is something I'm reading about right now, but there are pylons and turbogears as well
3. The postgres connector - which one is the more popular and the better maintained one? I'm using psycopg right now, but this early in the process, it's easy to switch to another package, if this one is suboptimal.

Any opinions and tips appreciated. I really want to get this project right, so when I open it up, I won't need to blush :)

Thanks,
D.

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

What you need is an CAS server in the DMZ, exposing the needed ports

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

RHEV has already been adopted by several major players, including IBM. So this is old news, the "new" news is the recent RH summit, and the GA release of RHEV 2.2

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

With today's computers, there is no problem to run windows in a virtual machine on top of linux. all the distributions include libvirt+virt-manager nowadays, and there's no restriction to install virtualbox or something similar

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

When you get a "Blue Screen of Death" (BSOD) error and your PC WON'T boot, Microsoft has NO CLUE what causes it other than remove your hd cable and re-seat it (Come on man, is THAT the best they can come up with for a solution??? AND it's THEIR operating system???)

This is totally wrong. 1st of all, BSOD's can be troubleshooted, they usually relate to drivers and hardware issues
second, install CD's and repair partitions are everywhere, especially on brandname PC's and servers.

If your hard drive is still working, you should NEVER have to RE-FORMAT your drive and even if you had to as a last resort, you HAVE the installation CD to be able to.

Reinstalling desktop versions of windows is normal practice at least once every year. This is due to the way windows registry works, getting cluttered up at some point or other.

This sort of thing (selling computers WITHOUT installation CD's) ought to be illegal because it causes so much frustration and it just shouldn't be like this.

As I said - all preinstalled systems have a way to get back to the original state. If you don't know how to use it, that doesn't mean it doesn't exist.

I had my PC custom built with TWO hard drives, a 120 GB for my operating system and the other drive, a 320 GB ONLY for my data/applications so in the event I have an operating system problem, 1) my data isn't affected and 2) I can SIMPLY "repair my operating system" and get on with life.

Have you heard of partitioning? While having separate drives isn't a bad idea, it is not the only and ultimate solution.

I strongly suggest getting your next PC that way, besides you WON'T get ALL the other pre-installed "bloatware" that you DON'T NEED and REDICULOUSLY SLOWS DOWN your PC. Your new PC will run lean and FAST!

Have to agree here - I usually reinstall my own new systems myself, to get a clean OS. Usually also to get rid of windows and run Linux, but that's besides the point

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

thanks guys, we've solved it after some extra poking around :)

should have a couple of other questions tomorrow though, if you don't mind

and I'll attach the .ui file next time

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

Hi guys,

We're writing a GUI based on PyQt, and we're running into an issue when using different resolutions.
Problem is, we can't find how to get the GUI elements to automatically resize when the window is resized, or when the GUI is running on a larger resolution than the one the GUI was originally developed in

I'm using Qt-designer to create the .ui files, if that helps

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

Thanks nezachem, I do feel that the fuctions aren't exactly set up the best possible way, and I'll add the leading "/" checking as well.


//the girl doesn't want me to give her a one line solution - something like

ls -s myshell /bin/sh

:)

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

Thanks Nezachem! I have changed quite a lot in the code, and now it does work, with a few exceptions unhandled (like segfaults when getting a permission denied), but those were not mentioned in the assignment anyway.

My main problem was with line 6, where I changed char *com[] to char* com[50], and that started working. I still have no idea why, this being far from my area of expertise, but the girl says she knows why, and that's good enough for me :)

strtok() was a requirement for this assignment, as well as execv(), can't do much about it.

I'm going to dwel on the man pages for wait() now, posting the current working version, in case you have the time to have a look and suggest improvements

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<errno.h>
#define n 50;
#define str [n];
#define str_eq(s1,s2)  (!strcmp ((s1),(s2)))
void get_path(char *);
char *get_line(char *line, int size);


char *get_line(char *line, int size)
{
   if ( fgets(line, size, stdin) )
   {
      char *newline = strchr(line, '\n'); // check for trailing '\n' 
      if ( newline )
      {
         *newline =  '\0'; // overwrite the '\n' with a terminating null 
      }
   }
   return line;
}

void get_path(char cmd[50])
{
    char command[50] = {0} ; //full command with path included
    char *tempcmd = NULL;
    char *commandptr = NULL;
    char *result = NULL; //path iterator
	char* com[50]; //command with args, no path
	char *arg = NULL; //list of arguments, path and command excluded
	char delims[] = ":"; //path iteration delimiter
	char delims1[] = " "; //
	char * path; //variable to hold the full path delimited by ':'
	int status; //process flow control
	int argcount = 0; //argumetn counter, where 0 is the command
    int pid;   
    char *cmd1; //just the command, no args or path
   
    tempcmd=cmd; //assign to temp variable, so strtok doesn't ruin cmd
    path=getenv("PATH");
    if (path != NULL)
        printf("%s \n", path);
    else exit(1);    
	
    arg = strtok( tempcmd, delims1 ); 
    com[0] = arg; //place the command into com[0]
    cmd1=arg;
    while( arg )
    {
	  argcount++;
	  arg = strtok(NULL,delims1);
	  com[argcount] = arg;
	}
	argcount++;
	com[argcount]=NULL; //last value in args should be NULL
    
    result = strtok( path, delims ); 
    while( result ) 
    {
       strcpy(command, "");
       strcat(command, result);
       strcat(command, "/");
       strcat(command,cmd1);
       commandptr=command;
    
       if (( pid = fork()) == 0 ) 
        {
            printf("Executing Command: %s \t ", command);
            execv(commandptr, com);
            if (! strerror(errno) == "No such file or directory")
            {
                printf("\n\t %s\n", strerror(errno)); //print Error 
                exit(1);    
            }    
            
        }
        else 
		{
           wait(&status);
           printf("2"); 
           if (status != 0)
                printf ("3");

        }   
        printf("\n------------------------------\n");
        result = strtok( NULL, delims ); 
    } 
}

void main()
{
	char cmd[50];
	char leave[]="leave";

  	while (!str_eq(cmd,leave))
  	{
		printf("Enter command: ");
        get_line(cmd, sizeof cmd);   
		if (!str_eq(cmd,leave))  
			get_path(cmd);
  	}
	
    printf("bye\n");
}
DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

Thanks, but the article uses execve, which is not an option for me in this case.

I was just looking for an explanation for line 46, 52 and 54 in my code

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

Hi all,

I'm helping my girl out with her hw, (/me not knowing C at all, but someone has to help, right?)
I am supposed to read user input, and then try to execute a given command plus the arguments in every given $PATH.

I managed it all, but I get puzzled by the execv function, which I am supposed to be using, it doesn't produce any stdio, and I can't seem to find a way to make it work

a basic command

execv ("/bin/touch", "/tmp/test123", NULL);

doesn't do anything, neither do I see an exit code.
How do I use it?

Here's what I've got so far:

void get_path_exec(char cmd[50])
{
    char command[50] = {0} ; //full command with path included
    char *tempcmd = NULL;
    char *result = NULL; //path iterator
    char *com[] = {0}; //command with args, no path
    char *arg = NULL; //list of arguments, path and command excluded
    char delims[] = ":"; //path iteration delimiter
    char delims1[] = " "; //
    char * path; //variable to hold the full path delimited by ':'
    int pid, status; //process flow control
    int argcount = 0; //argumetn counter, where 0 is the command
   
    tempcmd=cmd; //assign to temp variable, so strtok doesn't ruin cmd
    path=getenv("PATH");
    if (path != NULL)
        printf("Path is %s \n", path);
    else exit(1);    
	
    arg = strtok( tempcmd, delims1 ); 
    com[0] = arg; //place the command into com[0]
    while( arg )
    {
	  argcount++;
	  arg = strtok(NULL,delims1);
	  com[argcount] = arg;
	  printf("arg is %s \n", arg);
	}
	argcount++;
	com[argcount]=NULL; //last value in args should be NULL, right?

    result = strtok( path, delims ); 
    while( result ) 
    {
       strcpy(command, "");
       strcat(command, result);
       strcat(command, "/");
       strcat(command,cmd);
       strcat(command,"\0"); //gather all parts of full path'd command - path, "/" and cmdname
//       printf("full command: %s \n\n", command);
       
       if (( pid = fork()) == 0 ) //create a new process
        {
            execv(command, com);
//below is a point I don't get
            printf("Something happened here, but what? %s \n Status is %d \n\n", result, status);
            exit(1);
        }
        else 
		{
           wait(&status);
           printf("Something else happened here %s \n Status after wait is %d", command, status);
           if (status != 0)
                printf("And something happened again? \n");
        }   
        result = strtok( NULL, delims );
    } 
}

The entire pid-fork-&status structure is just too vague for me, can anyone explain what happens on every step of the way?

Using execl, by the way, worked for me, but I have to use execv.


Thanks

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

the server also requires a static IP address

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

windows XP is not a server level OS, more so, it is not supported by server vendors on their server hardware.
You can always get a simple desktop PC for that, but I wouldn't use a hoe PC as a serious production server

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

well then, you have to take your chances with the not so well tested software.

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

There are bugs everywhere, where there is software actively developed :) if you want an OS with a small amount of bugs on your desktop, stick to RHEL Desktop edition. No bleeding edge software, but it works nicely.

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

fedora 11s installer is crap. Crashes all the time during partitioning, generally bricking windows in the process. fedora is so buggy.

worked for me every time I ran it - on lg, hp, dell, lenovo laptops, different desktops and quite a few VMs...

what am I doing wrong? ;)

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

...and better enterprise grade hardware support makes it better for companies

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

MS ran hotmail on FreeBSD between 1996 and 2003. Worked fine for them.

MS isn't much of an example where OSS comes in

Yahoo also (still) run on FreeBSD as do big names like Sony, the Apache foundation and Netcraft.

they are also using qmail, which is deprecated everywhere.

I agree that it indeed an excellent choice for servers.

it used to be before kernel 2.6 for linux came along. but Linux is nowadays much farther ahead than BSD.

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

I know you asked for a linux OS but why not FreeBSD? I'm setting up my own server and i was adviced to use it as an excellent choice for my purpose.

ever considered why freebsd is not widespread in corporate server setups?

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1

Thisara asked for a free Linux so RHEL can't be suggested. Maybe CentOS (it's a Red Hat rebuilt) could be a good choice or Debian stable as suggested by ryuslash. Ubuntu server is based on Debian and could be a valid solution. My suggestion is to install the distribution that you are most familiar with.

Who said you can't get RHEL for free? support and RHN cost money, Linux is free

DimaYasny
Posting Virtuoso
Team Colleague
1,777 posts since Jan 2007
Reputation Points: 183
Solved Threads: 89
Skill Endorsements: 1
 
© 2013 DaniWeb® LLC
Page rendered in 0.1391 seconds using 2.68MB