Jump to content

ckrudelux

Members
  • Posts

    565
  • Joined

  • Last visited

Posts posted by ckrudelux

  1. Thanks!As I wrote some times, the php manual is too complicated for a beginner like me!
    I thought so too in the beginning but just look at the examples supplied on the page. If you have a function you don't know what it does just write php.net/functionnameexample:php.net/printf
  2. Have dug further and it is something to do with the way the file is created. I am using Notepad - if I "save as" and rename, the new copy works fine in both IE9 and Chrome. Running a hex compare using Beyond Compare says they are both identical - but one works and the other doesn't? I can't see a way to spot what encoding the file is in - but if I save as utf-8 the file is different (first 3 bytes) - so I assume all versions I have created are ANSI encoded as that seems to be the default. However that doesn't explain why the original file will not load correctly and the new one does - maybe I just got unlucky but I don't like not understanding... Is UTF-8 a requirement for HTML?
    It could be what IE doesn't allow files which are local to the computer too be reached. So putting them on a server would probably solve the problem.
  3. hello, i am having a little problem, is there a way to make the background transparent but not the text? i know how to make the background transparent but the text gets transparented also "the text gets transparent also <-- doesnt make sense to me, but i hope you get what im saying" anyway how do i avoid making the text transparent but end up making the background transparent only?
    You could use rgba
    background: rgba(0,0,0,0.5);

  4. Would be wonderful if someone know how MS Access works I got some problems with open form with a filter.So far I only created a button and in the wizard I you could chose to filter from the current table row in the form to what rows to display in the new form. Does not work I get all results anyway.. What struck me as hard in this program is what everything is wizards.. so I have no idea how to change things manually. I have done some searches but end up with wizards what doesn't do the job. If I could chose I would just do this with mysql and php.. but not an option for this task.

  5. What doesn't tell us more then your first post. Could you be more specific on what you need help with? Continuing on my guess from before: Then making a from in HTML you have a action attribute action should be pointing at searchform.phpThe data from the form is collected in the searchform.php with the $_GET and $_POST variables. Where the index key is the name of the input field in your html. example:
    <input type="text" name="searchquery" />

    $_GET['searchquery']

  6. When do you use searchform.php?
    Based on the file name you chose, I would guess you want to use it then getting specific data from the database based on the query given from the search box. But really if you don't know what you want to do with the file you created why create it at all?
  7. I guess this is a matter of taste but I would say that this makes the code harder to read. Using the {} makes it better but still messy.

    $mainNameLine = "$username $maidenname $lastname";

    Why? Well then you start mixing other content in this string the variables gets harder to find by using the concatenate you make a clear mark on there data is located. Example:

    "Hello $username nice to see you again, you have $numMessages messages in you inbox latest one from $from do you want to view it?"

    "Hello ". $username ." nice to see you again, you have ". $numMessages ." messages in you inbox latest one from ". $from ." do you want to view it?"

    In the case of the this particular operation you are right in that your use case is more readable but in longer more complected once I prefer the one I used like the one in the example.

  8. To start with you can't use end of line like this.

    $mainNameLine = $username; $maidenname; $lastname;

    Should be like this.
    $mainNameLine = $username . $maidenname . $lastname;

    Also you maybe want some space between them?

    $mainNameLine = $username ." ". $maidenname ." ". $lastname;

    This is how you could add everything to one variable:

    //If firstname is not null set firstname else set usernameif($firstname)$mainNameLine = $firstname;else$mainNameLine = $username; //If maidenname is not null add maidennameif($maidenname)$mainNameLine .= " ".$maidenname; //If lastname is not null add lastnameif($lastname)$mainNameLine .= " ".$lastname; //If firstname is not null add usernameif($firstname)$mainNameLine .= " (".$username.")";

    " .= " adds to the current value while " = " set the value.

  9. C++ has libraries(classes you can use) but you have to include them for whichever task you want to perform in your program. For example: #include <string> You will have access to the 'string' class, its methods and properties to perform string manipulations. Example: string str = "Hello"; cout << "The length of str is " << str.length() << " characters.\n" // outputs: The length of str is 5 characters. By including, you tell the compiler what to work with. What I noticed about C++, it's very strict. The compiler needs to have/know everything about what you're doing in the program. Unlike other languages like PHP where we don't have to do an include for string manipulation for example, it's already built in. If we didn't include the string class above though, the compiler would of gave an error even though the 'string' type/class is part of C++(meaning it part of it's 'library'), but for each program we make, we have to include it.
    Yes I know it's strict which one of the reasons I'm starting to like it more then php... I like the idea to predefine type like int, char, string and array to my functions and variables.
    yes they are part of standard libary. even when you use cout or cin its also defined in iostream for standard lib you probably dont need to anything to compiler. when you use file names in include directive of preporocseor<> will look into in default include directory eg #include <iostream.h>" " will look into current directory of where it being included if not found fall back to default directory eg include "iostream.h". if you want to set any arbitrary directory for look-up you have to set the include path in compiler
    So how do I get the list of the standard libraries?
  10. in php context i am not sure what is your question actually.how can we help you? c++ has not libary for every work as you can see in php. you have to write your own or have to use third party libary. java comes with a large libary for most of common task.which comes as package with class highercy. java has the manual where you can find easily. if you are familiar with c/c++ it will be easier to adapt other languages
    It wasn't a direct question this was more like multiple statements of thoughts and I appreciate the answer you gave. So a question to your answer, in c++ the includes you do in the beginning are to libraries? but as you said is that something I need to add to the compiler and the include just points to which components I used in the script?
  11. I don't think any of us are in any real capacity to know what the best path for your professional advancement should be. Where I work, I'm expected to be able to code (i.e. problem solve) in a few different languages as well as be able to learn/adapt to other ones if and when they are needed. Although I am probably best at Javascript and PHP, I've taken a lot of time to know some of the general theory behind programming in general; like OOP, DRY, TDD, etc because the theory generally applies across the board. I do this because I like to program; I like the challenge and I like to learn new things. Being proficient in one or two languages is OK, most people are. But you have to flexible and adaptive. I think that most employers expect that these days.
    I don't want you to tell me what I should do it's just what I'm trying to get an idea of what it would be like. Some times I think I just put too much pressure on my self thinking I need too know more before I can get out there. I guess I'm looking for some indication what I have the skills to do this kind of work. I know I have to look into TDD. I have write and read about c++ and java which both are quite easy to understand except I get stuck at what libraries I should include or not include and why (it's like magic). I have a project coming up where I'm going to write a site for a company what delivers educations on human communication styles. They have an old page already and haven't had the time or the money to update it (quite dead atm) so I have quite a lot of room to maneuver since time isn't much of a concern. Might put it up here as a blog build, could be fun for the members on this forum and I maybe learn something. I just have something to do before I can start the project. Sounds like a plan at least in some direction :)
  12. It is not limited to user login in general any possible type of aribatary problem solving
    User log in was an example, I just have second thoughts about what I should do with my programming skills. Like what I'm heading for if I started working with it or if I should do something else?
  13. Please have a look at my json data to see what I want to do:
    [	{		"weID": "-126555895",		"size_h": "700",		"size_w": "494",		"images": [			{				"imgID": "1535689403",				"imgName": "1321865407"			}		],		"text": [			{				"txtID": "-1892792786",				"txtText": "4.99"			},			{				"txtID": "1583276033",				"txtText": "$"			}		]	}, // i cant seem to loop through my data to get more results looking like this:{		"weID": "3444555435",		"size_h": "500",		"size_w": "294",		"images": [			{				"imgID": "-454646555",				"imgName": "77774433"			},			{				"imgID": "1535689403",				"imgName": "1321865407"			}		],		"text": [			{				"txtID": "15834443333",				"txtText": "more text"			}		]	}] 

    //my PHP code: $back = mysql_query("SELECT weID, size_h, size_w  FROM wb WHERE weID=-126555895");$images = mysql_query("SELECT imgID, imgName  FROM wi WHERE weID=-126555895");$text= mysql_query("SELECT  txtID, txtText FROM wt WHERE weID=-126555895"); //all my above SQL statements have weID in common, how can I link them together, to show all my results rather then one "-126555895"??  $model = array(); 	while($e = mysql_fetch_assoc($back)){	  		$model['weID'] = $e['weID'];		$model['size_h'] = $e['size_h'];		$model['size_w'] = $e['size_w'];  while($h = mysql_fetch_assoc($images)) {		$model['images'][] = array( 						'imgID' => $h['imgID'],						'imgName' => $h['imgName']		); while($f = mysql_fetch_assoc($text)){   $model['text'][] = array( 						'txtID' => $f['txtID'],						'txtText' => $f['txtText']		);};	};}; echo json_encode ($model); mysql_close($con);

    I need it to loop through so it can display all the records in

    From what I can tell you have nested your loops this will result in an error. They need to be separated for it to work.
  14. Spelling is over rated:I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdgnieg The phaonmneal pweor of the hmuan mnid. Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer inwaht oredr the ltteers in a wrod are, the olny iprmoatnt tihng is taht the frist and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it wouthit a porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.Amzanig huh?yaeh and I awlyas thought slpeling was ipmorantt!
    This was so fun I wrote a script for it I know it's not the best script in the world but does the job :)
    <form method="post" action="">	<textarea name="message"></textarea>	<input type="submit" value="Generate" /></form><?php	if(isset($_POST['message'])){		$message = htmlspecialchars($_POST['message']);				$newMessage = "";		$splitSpace = explode(" ", $message);		foreach($splitSpace as $key => $value){			$lenght = strlen($value) - 1;			if($lenght > 3){				$last = substr($value, $lenght);				if($last == "," or 				$last == "." or 				$last == ":" or 				$last == ";" or				$last == "'" or				$last == "!" or 				$last == "%" or 				$last == "?" or 				$last == "}" or 				$last == ")" or 				$last == "]" or 				$last == '"'){										$first = substr($value, 0,1);					if($first == "'" or					$first == '"' or					$first == "(" or					$first == "{" or					$first == "["){					}										$word = substr($value, 1, $lenght-1);										$first = $first.substr($word, 0,1);					$lenght = strlen($word) - 1;					$last = substr($word, $lenght).$last;					$word = substr($word, 1, $lenght-1);					$newWord = "";										while($word != ""){						$lenght = strlen($word) - 1;						$num = rand(0, $lenght);												$newWord = $newWord.substr($word, $num, 1);						$word = substr_replace($word, "", $num, 1);					}										$newWord = $first.$newWord.$last;									}else{					$first = substr($value, 0,1);					$lenght = strlen($value) - 1;					$last = substr($value, $lenght);					$word = substr($value, 1, $lenght-1);					$newWord = "";										while($word != ""){						$lenght = strlen($word) - 1;						$num = rand(0, $lenght);												$newWord = $newWord.substr($word, $num, 1);						$word = substr_replace($word, "", $num, 1);					}										$newWord = $first.$newWord.$last;				}			}else{				$newWord = $value;			}			$newMessage = $newMessage.$newWord." ";		}				echo $newMessage;	}?>

×
×
  • Create New...