Open Side Menu Go to the Top
Register
Quick Questions & Answers Thread Quick Questions & Answers Thread

09-11-2009 , 10:56 PM
[IMG]HeadAsplode.jpg[/IMG]
Quick Questions & Answers Thread Quote
09-11-2009 , 11:03 PM
Quote:
Originally Posted by uofi2012
Hmm, no luck.

I have a print statement that prints an input prompt before that while loop, and it still prints the prompt before it prints the 2nd+ token.

EX:

$Type your input: one two three
one
$Type your input: two
$Type your input: three
$Type your input:

The italicized part is the only user input.

Thanks for your help!
Copy the whole of the code here.

Juk
Quick Questions & Answers Thread Quote
09-11-2009 , 11:12 PM
Code:
/* MAIN PROCEDURE SECTION */
int main(int argc, char **argv)
{
   int pid = 0; //process ID
   int count = 1;
   char input[SHELL_BUFFER_SIZE];
   char iForm[15];
   sprintf(iForm,"%%%ds",SHELL_BUFFER_SIZE);
   while(1){
      printf("Shell(pid=%%%d)%%%d} ",pid,count);

      scanf(iForm, input);
      if(strcmp(input, "") != 0)
         count++;

      char *pt = NULL;
      char temp[strlen(input)+1];
      strcpy(temp,input);
      pt = strtok(temp, " ");
      //tokArr is an array of char*, each a token
      char *tokArr[strlen(input)];
      int i = 0;
      while(pt != NULL){
printf("%s\n", pt);
         tokArr[i] = pt;
         pt = strtok(NULL, " ");
         i++;
      }


      //cd
      if(strcmp(tokArr[0],"cd") == 0){
         chdir(tokArr[1]);
      }

      //termination
      else if(strcmp(tokArr[0],"exit") == 0){
         exit(0);
      }

      else{
         pid = fork();
         if(pid < 0){
            perror("Fork Failed");
            return -1;
         }
         else if(pid == 0){
            execvp(tokArr[0], tokArr+1);
         }
         else{
            wait(NULL);
         }
      }
   }
} /* end main() */
Quick Questions &amp; Answers Thread Quote
09-11-2009 , 11:46 PM
The problem is that scanf() stops when it hits whitespace. So either change the scanf() call to:

Code:
fgets(input,SHELL_BUFFER_SIZE,stdin);
or use something different as the deliminator, eg:

Code:
pt = strtok(temp, ",");
. 
.
.
pt = strtok(NULL, ",");
Juk
Quick Questions &amp; Answers Thread Quote
09-12-2009 , 04:32 AM
It seems like it is parsing correctly now, but it broke my exit command.

Thanks for your help though.
Quick Questions &amp; Answers Thread Quote
09-12-2009 , 10:51 AM
Pretty simple question:

I play on pokerstars. I want a very simple AHK so I can hit something on my keyboard and it'll make me fold. I don't need the whole bet pot stuff, all I need is a AHK for a fold button. What program would best fit my needs?

Thanks
Quick Questions &amp; Answers Thread Quote
09-12-2009 , 05:15 PM
Guys,

Is there any way for me to have a different Pokerstars table theme for different limits? I have made two embarrasingly bad multitabling mistakes in the last two days where I massively overshoved because I am new to playing multiple limits.

Thanks for any help.

-Michael
Quick Questions &amp; Answers Thread Quote
09-12-2009 , 06:50 PM
I dont think there is an automated way, but you can use _dave_'s modmanager for quickly changing backgrounds or felt colors when you open the tables.

My stars themes all have the modmnanager included, but I have been real busy lately and only have 2 themes compiled and uploaded for stars. The vintage might work for you, until I get something a bit nicer uploaded.

http://www.fozzypokermods.com/vintageps.html

Use coupon code: 2p2modders to get $5 off, thereby making it free.
Quick Questions &amp; Answers Thread Quote
09-12-2009 , 07:43 PM
Ok, nevermind about the broken exit, fgets was just adding the \n at the end of the str.

Thanks for the help Juk!
Quick Questions &amp; Answers Thread Quote
09-12-2009 , 10:15 PM
Quote:
Originally Posted by uofi2012
Ok, nevermind about the broken exit, fgets was just adding the \n at the end of the str.

Thanks for the help Juk!
NP

Juk
Quick Questions &amp; Answers Thread Quote
09-13-2009 , 01:28 AM
Quote:
Originally Posted by Michael Davis
Guys,

Is there any way for me to have a different Pokerstars table theme for different limits? I have made two embarrasingly bad multitabling mistakes in the last two days where I massively overshoved because I am new to playing multiple limits.

Thanks for any help.

-Michael
you just have to apply a certain theme to one table only. every time you choose a theme the software asks if you want to have it on all tables or on the specific one
Quick Questions &amp; Answers Thread Quote
09-13-2009 , 01:55 AM
important (to me) CTH thread in case anyone here wants to offer input:

http://forumserver.twoplustwo.com/48...ptions-583471/

ty
Quick Questions &amp; Answers Thread Quote
09-13-2009 , 02:22 AM
Quote:
Originally Posted by jukofyork
NP

Juk
Bah I have more bugs:

Any way of knowing if there were additional characters input, or the total number of chars input, if they are greater than the param in fgets()?

I am supposed to print an error if they try to input a command longer than SHELL_BUFFER_SIZE.

I made another array to store the "history" (the previously input commands)
but for some reason the second realloc() call always fails, independent of my initial hsize. I put the excerpt below:

Code:
int hsize = 20;
   char **hist = malloc(hsize * sizeof(char*));
   int j = 0;

   while(1){
      printf("Shell(pid=%%%d)%%%d} ",pid,count);

      fgets(input, SHELL_BUFFER_SIZE, stdin);
      if(strcmp(input, "") != 0)
         count++;

      char *pt = NULL;
      char temp[strlen(input)];
      strncpy(temp,input,strlen(input)-1);
      temp[strlen(input)-1] = '\0';

      if(j < hsize){
         hist[j] = malloc((strlen(temp)+1) * sizeof(char));
         strcpy(hist[j],temp);
         j++;
      }
      else{//double size of hist arr
         hsize*=2;
         void *error = realloc(hist, hsize);
         if(!error){
            printf("ERROR: realloc() fail.");
            exit(1);
         }
         hist[j] = malloc((strlen(temp)+1) * sizeof(char));
         strcpy(hist[j],temp);
         j++;
      }

Also, did my usage of fork() wait() and execvp() look ok in my other post?
I havent used system calls much.

Sorry for buggin you so much, it is just that this is due monday and I have a bunch of other homework, including preparing a 20 presentation on the ethics of computers and gambling, otherwise I would figure this stuff on my own, just I am pressed for time right now.

Thanks again.

Last edited by uofi2012; 09-13-2009 at 02:37 AM.
Quick Questions &amp; Answers Thread Quote
09-13-2009 , 09:06 AM
Quote:
Originally Posted by uofi2012
Any way of knowing if there were additional characters input, or the total number of chars input, if they are greater than the param in fgets()?

I am supposed to print an error if they try to input a command longer than SHELL_BUFFER_SIZE.
Code:
char input[SHELL_BUFFER_SIZE+2];
.
.
.
fgets(input, SHELL_BUFFER_SIZE+2, stdin);
if(strlen(input)>0 && input[strlen(input)-1]=='\n')
    input[strlen(input)-1]='\0';
if (strlen(input)>SHELL_BUFFER_SIZE)
    // ERROR... To many characters read.
Quote:
I made another array to store the "history" (the previously input commands)
but for some reason the second realloc() call always fails, independent of my initial hsize. I put the excerpt below:
I think it's just realloc() sometimes can be a bit quirky on some compilers. Try just doing what realloc() does using a second temporary array and free() / malloc() to do the same work and I think it will fix your problem.

Quote:
Also, did my usage of fork() wait() and execvp() look ok in my other post?
Without copying and running the code I can't say (I've got to go out this afternoon and haven't time atm). Post again tonight if you are still having problems and I'll try and take a look then.

Juk
Quick Questions &amp; Answers Thread Quote
09-13-2009 , 07:00 PM
Quote:
Originally Posted by jukofyork
You'll prolly get better answers asking this in the CTH forum, but here's what I use (all free):

Firewall: ZoneAlarm.

Anti-virus program: AVG Anti-Virus.
fwiw, the current CTH 'consensus' (and what I use as a result) is:

Firewall: Comodo
Virus: Avira
Quick Questions &amp; Answers Thread Quote
09-13-2009 , 08:26 PM
Hi, I have a quick question, looking for a quick answer. I play on stars, and I am most comftorable playing at 10NL, so what I want is to always see the stack sizes as if it was 10NL, even if i play at 25NL, or a tourney, i want 1 bb to be 10 cent. Is this possible?
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 07:49 AM
Is there an AHK script that will automatically buy me in to a cash table without me having to click empty seat on pokerstars?
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 09:02 PM
once HEM and PT3 dbs start to get big, is more than 4 GB of RAM going to help or is just hard drive speed and processor that impacts performance?

assume I'm running 3 sites (up to 9 tables maybe more), a couple browsers, HEM/PT3 (maybe both), Pidgin, PlaceMint, AHK for BetPot, Notepad++ w/ some huge (100,000+ line) files, Notepad
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 09:06 PM
Quote:
Originally Posted by a nonymous
once HEM and PT3 dbs start to get big, is more than 4 GB of RAM going to help or is just hard drive speed and processor that impacts performance?

assume I'm running 3 sites (up to 9 tables maybe more), a couple browsers, HEM/PT3 (maybe both), Pidgin, PlaceMint, AHK for BetPot, Notepad++ w/ some huge (100,000+ line) files, Notepad
Drive speed, drive speed, drive speed, and a little bit of CPU/RAM.

If you want optimal performance:

2 x SSD's in RAID0 for OS and important apps.

2 x SSD's in RAID0 for Postgresql database (\data directory of postgresql 8.4, and run stackbuilder/enterprise tuning wizard)

1 x HUDGE standard 7,200 rpm for your hand archives, and personal data, music, etc.

Check out this thread for some real good info.

http://www.holdemmanager.net/forum/s...6326#post86326
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 09:27 PM
Required reading for SSD infos: http://www.anandtech.com/printarticle.aspx?i=3631

Last edited by _dave_; 09-14-2009 at 10:02 PM. Reason: lol reading your linked thread I see Patvs is linking anandtech all over.. good man :)
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 09:33 PM
Quote:
Some of the latest 7200 RPM harddisks are really fast: they are the Western Digital Caviar Black, Samsung Spinpoint F1 and Samsung Spinpoint F3. All of them are ALMOST as fast as a VelociRaptor. (note: even the eco 5400 RPM Samsung Spinpoint F2 approaches this speed)
I don't get this, but the guy obv knows more than I do. can anyone confirm that I should get of these:

http://www.newegg.com/Product/Produc...82E16822152181

http://www.newegg.com/Product/Produc...82E16822152098

http://www.newegg.com/Product/Produc...82E16822136320

http://www.newegg.com/Product/Produc...82E16822152117

instead of this:

http://www.newegg.com/Product/Produc...82E16822136322

and, if so, which one should I get?

when my dbs get big, I'll look at my needs and get a new system w/ 2 SSDs and a regular drive for data. at this point, everything is pretty fast, and I would rather evaluate my needs when I get to that point and pick everything out after researching thoroughly. I need to order a new drive tonight so I can get a stable system back up and running
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 09:39 PM
also, fozzy, is that a no to the ever wanting more than 4 GB for my future needs? say I have the recommended 2 SSDs+data drive, and money isn't really an issue (not that RAM is expensive anyway). is more than 4 just never going to help for what I'm doing?

I actually didn't ask cause anything is slow right now. I'm trying to decide between Vista 64 and XP 32 for long-term purposes (see CTH thread I have going)
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 10:17 PM
Quote:
Quote:
Some of the latest 7200 RPM harddisks are really fast: they are the Western Digital Caviar Black, Samsung Spinpoint F1 and Samsung Spinpoint F3. All of them are ALMOST as fast as a VelociRaptor. (note: even the eco 5400 RPM Samsung Spinpoint F2 approaches this speed)
I don't get this, but the guy obv knows more than I do. can anyone confirm that I should get of these:
Simple explanation attempt When a Velociraptor came out, it spins faster than other consumer HDD (10K rpm Vs. 7.2K), this is how it managed faster performance - more bits pass under the drive heads in the same time = faster data transfer. As time has gone by, "normal" HDD have increased capacity greatly, giving us 1TB disks for cheap etc. This is done primarily by "packing the bits tighter" - increasing density of the platters. With the increased density, a slower spinning disk is now able to throw a similar number of bits under the drive heads in the same time as a faster spinning but less dense 10K drive, so the raptor's once large performance lead is negated, and it's expensive price unwarranted. It does spin fast though, so it is still no doubt more expensive to make than a "normal" 7.2K part. As you've seen from browsing around however, 10K isn't actually too notable - 15K drives have been around a while - just they are reserved for the rich folk in the enterprise sector some of these disks are monsters!

I wouldn't consider a velociraptor at that price, the $50 samsung F3 looks tempting to me (i only clicked the first link), and leaves plenty money to put towards an SSD (Intel X-25 G2-V?) in the future.


Oh and moar RAM is always good. Postgresql loves the RAM. An SSD negates this quite a lot however (time penalty for going to disk still severe, but much much reduced).

XP or Vista x64 I dunno... Probably wouldn't even be a question if you didn't have a vista key already? I'm gonna keep rocking XP myself until I can tolerate it no longer, then splurge on win7 x64 with stupid amounts of RAM or ubuntu... I've yet to try Win7 but by all accounts it is very good.
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 10:26 PM
Quote:
Originally Posted by fozzy71
2 x SSD's in RAID0 for ...
What is the purpose of RAID0 on SSD?
Quick Questions &amp; Answers Thread Quote
09-14-2009 , 10:39 PM
Quote:
Originally Posted by _dave_
Oh and moar RAM is always good. Postgresql loves the RAM. An SSD negates this quite a lot however (time penalty for going to disk still severe, but much much reduced).

XP or Vista x64 I dunno... Probably wouldn't even be a question if you didn't have a vista key already? I'm gonna keep rocking XP myself until I can tolerate it no longer, then splurge on win7 x64 with stupid amounts of RAM or ubuntu... I've yet to try Win7 but by all accounts it is very good.
Vista key isn't the issue at all. I don't care about the cost of XP, seems so minor that it shouldn't impact the decision at all. I've lost well over $1000 due to my recent stability issues

reason it's a question is because my understanding is that XP64 has driver issues so it's probably better to stick w/ XP32... which can't address more RAM... which I might want in the future

if it makes sense to switch to Vista64 in the near future anyway, then I figured it would be easier to continue to use it now. but if the logical time for me to switch to Vista64 or Win7 64 is likely much further off, then I would go w/ XP32 for now since the general consensus seems to be that I'm looking at a more stable/reliable OS. I guess since you're suggesting that I wouldn't even consider Vista64 if I didn't already have a key, you agree?

I haven't really been keeping up w/ Win7 at all, and I have yet to try it. is it more stable/reliable? that's really my only concern right now. I want to run the programs I'm running w/o losing thousands in timeouts and time spent dealing w/ issues

Vista64 seemed to actually be a pretty stable OS for the first ~6 months I used it, but maybe I was just lucky

Last edited by a nonymous; 09-14-2009 at 10:40 PM. Reason: tyvm for HD explanation
Quick Questions &amp; Answers Thread Quote

      
m