User Profile

Collapse

Profile Sidebar

Collapse
kidko
kidko
Last Activity: Jul 27 '09, 11:35 PM
Joined: Apr 7 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • kidko
    started a topic Regexp to filter style from HTML
    in PHP

    Regexp to filter style from HTML

    I'm trying to strip out the "style" attribute from a bit of user input. If the user input is $input, why wouldn't the following, given
    Code:
    <tag style="blah" href="site">Content</tag>
    leave me with
    Code:
    <tag href="site">Content</tag>
    It doesn't take out anything at all!

    Code:
    $strip_regexp = array('/(.*)style=\".*\"(.*)/', '/(.*)style=\'.*\'(.*)/');
    ...
    See more | Go to post

  • kidko
    replied to Regarding a project in Linux.....
    Shell scripts are like batch files on Windows, but more powerful. Anything that can be done from the command line (including the examples you listed: grep-ing something, ls, ps) can be automated in a shell script. They can include loops to go through code multiple times/until a condition is met, branching statements (IFs, CASEs, and so on), and again, anything that can be executed from the command line....
    See more | Go to post

    Leave a comment:


  • kidko
    started a topic Killing Bash Script Child Processes

    Killing Bash Script Child Processes

    I've written a Zenity frontend for ffmpeg using a Bash script. However, if the user hits "cancel" in the progress dialog (incurring the --auto-kill option), the bash script is killed. Unfortunately, ffmpeg keeps running. How would one kill ffmpeg from within the script?

    In case it's needed, here is the line that calls both ffmpeg and Zenity:
    [php]ffmpeg -i "${vid}" -f mp4 -vcodec mpeg4 -qmax 7 -acodec aac...
    See more | Go to post

  • kidko
    replied to Image does not move to set location
    Sure.

    http://kidkonia.com/projects/cheddar.html...
    See more | Go to post

    Leave a comment:


  • kidko
    replied to Image does not move to set location
    Revised it to this (complete with style.top/style.left), but without progress... it still doesn't seem to work.
    Code:
    	var numofscats = (Math.floor(5*Math.random())) + 3; // 3-8 weapons in-game
    	for (var i = 0; i < numofscats; i++) {
    		var weaponindex = (Math.floor(numofweapons*Math.random()));
    		var weaponx = (Math.floor(map_l*Math.random()))+map_x;
    		var weapony = (Math.floor(map_h*Math.random()))+map_y;
    ...
    See more | Go to post

    Leave a comment:


  • kidko
    started a topic Image does not move to set location

    Image does not move to set location

    I'm just trying to move a few images around a page... The images already exist, and the following function simply assigns them an ID and sets their offsetTop/offsetLeft attributes. This works for other images, but these refuse to cooperate. The alert halfway in is an attempt to find the problem, but it always returns the right values. Once the function finishes, however, they're always totally off, and just line up horizontally at the top-left corner...
    See more | Go to post

  • Well, thanks guys! I removed the var before weapons[i], and that didn't fix it. After a bit more messing around, though, I tried this and it works fine now:
    [code=Javascript]
    for (var i = 0; i <= numofweapons; i++) {
    var wname = cheddar.create_ weaponNames(); // Name

    // Damage, Accuracy, Ammo, & Fire Rate
    weapclass = Math.floor(6*Ma th.random()); // Weapon class, 0-1 being light, 2-4 medium, 5...
    See more | Go to post

    Leave a comment:


  • kidko
    started a topic Defined Array Members List As "Undefined"

    Defined Array Members List As "Undefined"

    I'm writing a small game in Javascript (using just PNGs for graphics and DOM manipulation to move them), and most of the content is procedurally generated. This includes all of the weapons involved, and this is where the problem lies. The problem lies somewhere in here, I believe:
    [code=javascript]function Weapon(weaponNa me, weaponDamage, weaponAccuracy, weaponAmmo, weaponRate, weaponClip) {
    /* === Weapon Structure ===
    * weapon.nm...
    See more | Go to post

  • kidko
    replied to C String Comparison
    in C
    So it was comparing memory addresses? Definitely not what I'm looking for. But why use str(n)cpy? Doesn't that copy the string (or n letters of it), while what I want is a comparison?


    Aha. Exactly what I needed.

    Thanks, everybody, for the feedback/help....
    See more | Go to post

    Leave a comment:


  • kidko
    started a topic C String Comparison
    in C

    C String Comparison

    I'm trying to write a function that reads keystrokes using the NCURSES library's "getstr(str )" function (where "str" is a C-style string, and it modifies the value of it directly). However, my code does not ever cause the program to exit, and even when typing exactly the word "quit," no backspace or anything, it gives me the "Unknown command" message. I'm writing in C++ using the G++ compiler on Kubuntu Linux...
    See more | Go to post

  • I can't believe I didn't catch that. It works fine now.

    Thank you!...
    See more | Go to post

    Leave a comment:


  • Sorry to double post, but it won't let me edit any more.

    I recompiled after changing all 0x00s to 0s, 0x01s to 1s, etc., and again included -g -O0 in my g++ flags. When I ran it through gdb, it isolated the segfault at the same point. What's wrong with this code? (Snipped to what I think plays a part):
    [code="cpp"]
    namespace mapgen {

    const int MAXX = 80; // Change to change map sizes
    ...
    See more | Go to post

    Leave a comment:


  • GDB helped a lot. It located the segfault: mapgen.h: 127 (newline) map[i][j] = 0x00;

    So, is my code trying to reference the memory at 0x00? And if it is, I should be using decimal for symbols instead of hex?...
    See more | Go to post

    Leave a comment:


  • kidko
    started a topic Roguelike dungeon generator segfaults, compiles fine
    in C

    Roguelike dungeon generator segfaults, compiles fine

    Hi, I'm in the process of writing a roguelike (ex Nethack). It's not big, but should still be playable. I've gotten to level generation, and am basically just 'carving' the rooms out of a blank slate.

    The entire floor starts off as an array of rock (0x00), with passable rooms/hallways being open space (0x01). Basically, mapgen::createM ap() generates a room and hallway MAXROOMS times. It makes sure that nothing overlaps or goes out...
    See more | Go to post

  • kidko
    replied to Function Compile Error
    in C
    Structs... I totally forgot about those, I think they'll work very well. Thank you very much for your help in answering my question!...
    See more | Go to post

    Leave a comment:


  • kidko
    replied to Function Compile Error
    in C
    The error message points to the last line, return initiative;.

    How would I return the contents of the array itself, if in my main.cpp I had something like
    Code:
    int initiativelist[(MAXUNITS-1)][2]; // MAXUNITS is declared outside of all functions in functions.h
    initiativelist = initcreate();
    Should I change my code to something resembling this:
    Code:
    // MAIN.CPP
    int *initiativelist[(MAXUNITS-1)][2]; // MAXUNITS
    ...
    See more | Go to post

    Leave a comment:


  • kidko
    started a topic Function Compile Error
    in C

    Function Compile Error

    Hi... I'm working on a small, text-based game, compiling under Kubuntu 6.10 (Edgy Eft) with G++ 4.1.2. Up until I added this function (and its corresponding call in main.cpp), it would compile correctly. Could anybody tell me why I'm getting the error "functions.h:16 3: error: invalid conversion from ‘int (*)[1]’ to ‘int'"?

    Code:
    int initcreate() {
    	int initiative[(MAXUNITS-1)][1];
    	int unitcount = 0;
    	for (int
    ...
    See more | Go to post
No activity results to display
Show More
Working...