- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 4
- Posts with Upvotes
- 4
- Upvoting Members
- 4
- Downvotes Received
- 1
- Posts with Downvotes
- 1
- Downvoting Members
- 1
54 Posted Topics
I was testing this in prompt mode: import re def checkurl(url): check = re.match(r'^(:?https?://)?[^\/#?&]+\.[^\/#?&]+.*$',url) if check == None: print “NNOOOOOO!!!!” else: print “YESSSS!!!!!” checkurl("javascript:void(0);") checkurl("/account/general?ru=https%3a%2f%2fwww.bing.com%3a443%2fsearch%3fq%3dukraine%2bcrisis&FORM=SEFD") checkurl("/?FORM=Z9FD1") checkurl("http://choice.microsoft.com") I have no idea why this won't work. Ignore the regex its only supposed to weed out relative paths and fragments of strings. … | |
I'm using beautifulsoup to grab text from HTML files. Buts its not perfect: For example it seems to keep css and javascript code that was added haphazardly. My overall goal is to make a list of words and their frequency to compare and contrast html files to categorize them. Dealing … | |
Re: Couple things: 1. I can't figure out what you want to do exactly 2. arrays declared on the stack (i.e. like so: `int arr[50]`) HAS to have its length be a constant. So either a literal or a const variable. Instead use `malloc(sizeof(int))*(m*n)` or something similar. return it from a … | |
I wrote this test program to test the binary tree for a particular purpose. The intent is to make 2 new tree nodes with new data and destroy the data of the parent data, as its no longer needed (essentially its supposed to imitate "splitting" but my design calls for … | |
I need to apply some code changes to a source code file I don't have access to. I write code but rely on someone else to test it for me because my old computer has trouble with VMs. Most of the changes are fixing small syntax errors, but I think … | |
I'm writing a basic sudoku solver. I have a simple method that looks for squareas with only 1 possible number and fills them in before trying to solve the puzzle. the method look like this: def fillinones(sq): table = {1:1,2:2,4:3,8:4,16:5,32:6,64:7,128:8,256:9} for i in range(0,80): p=checkpossible(sq,i) print "p: ",p if p … | |
It seems like a simple, straightforward question, but I've been monkeying around for way too long trying to get a folder to execute simple folder action scripts to no avail. I know I have them attached, Folder Action Setup app indicates that Folder Actions are enabled, I went in and … | |
I am trying to make something similar to a symbolic link type setup for a folder. I have a folder on my desktop, place_on_server, and several folders that match up to folders on my linux server so place_on_server/tutorials would match up to /var/www/media/tutorials or place_on_server translates to /var/www/media Basically I … | |
From an exercise in a cocoa programming book I'm trying to make a to do list app that simply adds, removes and change the entries in the table. I have a lot of things wrong with it. relevant info: * add button: add entry with text from text field. If … | |
Re: I'll start off by saying I'm a complete noob to Obj-c/cocoa. So maybe I shouldn't even respond. And if this is nonsense I apologize. Why couldn't you make a c/obj-c object that handles the client connection on the phone, completely stand-alone, you make an instance of this object in your … | |
I'm having trouble with a binary tree algorithm. A test program I wrote calls for the top node to only be altered in another method outside main (A simple guessing/learning game scenario). I wrote a smaller test of that exercise here: #include <stdlib.h> #include <stdio.h> #include <time.h> struct binary { … | |
So, as an exercise I wanted to make a simple binary tree as practice before moving on to other, harder things. I tried to implement a binary tree in a simple guessing game scenario. I can't test it due to issues I'm having with taking in input. But I can't … | |
I'm going through an exercise in a mac programming in cocoa book, where there is a GUI and from a textfield I enter and to a list of strings displayed on a table. There are plenty of things that aren't working, the most confusing of which is I keep leaking … | |
I made a website in php4 that I want to swtich over for my database, I'm a linux newb, I just thought I would write a simple sed script to change the username and password used in mysql_connect: #!/bin/bash for f in * do sed 's/mysql_connect('localhost','user1','pass1')/mysql_connect('localhost','user2','pass2')/' <$f >$f done exit … | |
Re: 1. I don't believe you are allowed to embed other elements except <a> and <br /> in <p> tags. You can but it probably wouldn't look right. 2. to get 2 divs to appear on the "same line" usually you just float the elements. Try the following: `<p style="float:left;line-height:10px;">This string</p><div … | |
I decided the best way to learn css was to try to recreate pages of web sites. I chose youtube, because the layout seemed challenging but doable from a noobie perspective, and I get to watch youtube vids in the process. I am having trouble recreating the part under the … | |
I am creating a basic PM system for my website. I have just a basic table for a pm: mysql>describe PM; +--------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +--------------+--------------+------+-----+---------+----------------+ | PMID | mediumint(9) | NO | PRI | NULL | auto_increment | | … | |
My code technically works, as it registers the user, but it won't keep the user logged in. (yes, once a registration is successful, they should be logged into their new account). It should go right to the index page on success and have the user logged in. On failure it … ![]() | |
I'm not sure why I suck so bad at this. I was recommended by my prof to use date as opposed to timestamp. I'm starting to think going back to timestamp would be easier due to built in php functions I can use. so in my original addproduct.php form I … ![]() | |
A lot of code here. Basically I'm making an auction type site. This segment of code is for a user to upload a product: I'm pretty sure there isn't anything wrong with addproduct.php but for completeness I feel like I should post it. addproduct.php: <?php require_once('checklogin.php'); require_once('validate.php'); if(!isset($_SESSION['user'])) { //die("redirect"); … ![]() | |
My school has an apache/mysql server that we make and host websites from as projects. I am doing an ebay type site where people bid on a product until time runs out. Problem is I don't know how to trigger that the product should be delisted and the buyer and … | |
addproduct.php snippet (there are lots of other inputs, not sure if that matters): <form method="POST" action="add.php" enctype="multipart/form-data"> <p>Picture:<input type="file" id="pic_upload" name="pic" /> <input type="submit" /> </form> add.php: if(isset($_FILES["pic"])) { if($_FILES["pic"]["error"]==0) { $name = explode(".",basename($_FILES["pic"]["name"])); $target = realpath(dirname($_SERVER['PHP_SELF']))."/images/".$name[0].session_id().".".$name[1]; $temp = $name[0].session_id().".".$name[1]; if(!move_uploaded_file($_FILES["pic"]["tmp_name"],$target)) { add_error("Picture specified did not upload"); } $_POST['pic']=$temp; } … | |
This is based on advise given ina previous thread I posted awhile ago for protecting data. I tried the following: <?php function base_encode($text) { $size = strlen($text); $str=""; for($i=0;$i<$size;$i++) { $str=$str.slide_left(substr($text,0,1),4); $text=substr($text,-1); } return $str; } function base_decode($text) { $size = strlen($text); $str=""; for($i=0;$i<$size;$i++) { $str=$str.slide_right(substr($text,0,1),4); $text=substr($text,-1); } return $str; … | |
Hey guys its me again: Basically everything on this page, at least the parts I'm able to test, are working, problem is addproduct.php is supposed to print errors when error checking the form and repopulate the data fields with the previously submitted data. I'm doing this by populating $_SESSION. addproduct.php: … | |
I'm on the school server. So before I start I need to say I don't have a choice. I'm tired of reading post with nothing more than "Tell your administator to upgrade". I know. Stop. If I see it its getting flagged as spam. I don't really understand what about … ![]() | |
Re: I don't know C#, probably should stop right there but would this work better? const string exePath = "test-min.exe"; instead: string exePath = "test-min.exe "+textBox1.text; or "test-min.exe "+formatnums(textBox1.text); pinfo = procressStartInfo(exePath); I'm assuming youre running it on the command like as such:">test-min.exe 1 2 3 | |
Based off some stuff from my last thread I tried to write a search results page using maximum 3 parameters. I used a couple of function to try and get everything organized. One: sort_mysql_results has no defined parameters so I can put in as many parameters as needed. The code … | |
I am making a basic craigslist type website with a search function. There is a field where you can enter what you think the name of the product might be and my search function is supposed to find names of products that match. so for example a user can enter: … ![]() | |
Re: Usually when an ENUM structure is used its something like: enum months{"january" "febuary", etc... } the_month; "january" in this example, like in any other place in a program, is recognized as a constant char pointer or const char*. I don't see where YELLOW or BLUE are defined. When you create … | |
Re: should > "SELECT * FROM users WHERE username =$_POST[username]" be sprintf("SELECT * FROM users WHERE username = \"%s\"",$POST['username']); with proper escape thingys whatever? | |
I don't know jack about Visual Studio, and I'd like to keep it that way because I like doing stuff on the command line, I have my preferences. But my teacher uses it to compile and I'm curious what I did wrong because gcc didn't throw anything. So, code (Without … | |
code snippet: void checkcollision() { float x1 = tanks[0].x; float y1 = tanks[0].y; float x2 = tanks[1].x; float y2 = tanks[1].y; float dist = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2)); float dr = tanks[0].rad+tanks[1].rad; if(dist<dr); { printf("checkcollision read true\n"); printf("dist: %f, radius+radius: %f\n",dist,dr); goback(0); goback(1); } } output: checkcollision read true dist:363.159302, radius+radius:14.142136 … | |
Ok. As the title says I tried many times to simply write a program that rewrites a file to remove null characters. I confirmed with a hex editor that the file in question has tons on null characters, on average about 1 of every 2 characters in null. So my … | |
error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Its valid sql I checked I just don't understand what would cause that error. I also tried different statements and … | |
code: I am trying to debug the code, I can't understand why (or how) the same error is being thrown despite the if statements, dies, and different mysql_queries. I don't get it. <?php session_start(); $_SESSION['msg'] = ""; $con = mysql_connect('localhost','me','omglol'); if(!$con) { die("The connection to mysql server is not being … ![]() | |
Without getting into too much detail, I am using the school server for a website project, which doesn't have the php image libraries installed. So I need something else to use THAT I DO NOT HAVE TO INSTALL. I don't have sudo/admin privileges. I do have gcc/g++ so there's that. … | |
I'm a noob, I know very little about php. Anyway, my page won't load at all, browser says its redirecting in a way that is not loading. As the title suggests I think the issue is with one of the php files I include with require_once(). Let me just show … | |
I originally asked this question at cplusplus.com but got no responses. In my program I have the main player and enemy tanks. When using the shotgun weapon it works fine for the main player but it kills the bad guy when they use the weapon. I don't understand how this … | |
I don't really have an explanation and whoever thought that this new posting format was the way to go... idk what to say. I really don't like it. I can only post so much lines of code before something happens to the window and I can't scroll all the way … | |
Background: I'm attending a community college, I expect to graduate in a year with a degree in Information Systems, haven't decided what to do exactly, but I have an interest in networking and will be taking the ICND1 to get my CCNA from Cisco sometime soon hopefully. This however, is … | |
So, I'm using allegro game programming library. Before I move on to bigger and better things I wnat to get a handle on pointers. Specifically with things like structs, linked lists and maybe binary trees in the future. I posted a program that uses a linked list to keep tracks … | |
Background, I want to install allegro on the iMac 10.6.8 after my macbook crapped out. It didn't compilers installed whatsoever, so I had to find Xcode at a seedy 3rd party site because apple no longer supports Xcode for 10.6. It came as a binary, simple install didn't give me … | |
I was given this assignment: Create an html form. Include at least two text boxes, at least one of which must be numeric, a set of at least three radio buttons, a submit button and a reset button. Upload to your account. Make sure the permissions are correct. Name it … | |
I have a larger program that I want to write, but I can't complete it unless I get this down. I have an array, need to put in a string value to be read out. the program generates characters of data at a time, not as a whole string so … | |
I was supposed to write a program that reads and writes phone numbers of people to a file called phones.txt. The reading part works. The write part doesn't. I tried to use the cat command because I thought doing cat >> file.txt would simply append to a file. What it … | |
I haven't coded something this complex in C++ before and I haven't had time to really review. I'm making a game (well, foundations for a game anyway), with an external game library, Allegro. But I think the problems I'm having is more fundamental to C++ in general. Included is a … | |
Re: This is just like the Lonely Hearts scam of the early 1990s. This is considered a confidence trick and really there is no rational for the victim's behavior. It will continue unabated. @Frogboy: What's your point. Its not an excuse for the behavior | |
I tried this once before on my laptop 10.5.8 but I couldn't get that to work despite online help: [url]http://forums.macrumors.com/showthread.php?t=1233494[/url] everything I tried is detailed in that thread I decided I want to try this again, using the same method perhaps on the iMac 10.6.8 I was just wondering if … | |
A lot of problems here. I was to write a program that sorts an array. I had problems overwriting data in an array so I thought I could store the sorted array in another array. Basically it looks for the smallest value, stores it in the first spot, then finds … | |
OK I posted a similar question in macrumors, usually they help me out of jams but not this time. So I downloaded Windows 7 on bootcamp something or other I think 3.9. I have 10.5 on a macbook. So a few drivers didn't install properly. I think. So I don't … |
The End.