Archive for the ‘advanced php programming’ Category

Problem with php program?

I had write a PHP script that will countdown the days, hours, and minutes until my next birthday. This script must work year round. I thought I had done this but my teacher informed me that what I wrote will not work between November 13 and December 31, November 13 being my birthday.

This is the code I submitted:

<?php

$a = getdate();

extract($a);

$bday = mktime(0, 0, 0, 11, 13, $year);

$today = time ();

$difference =($bday-$today);

$days =(int) ($difference/86400);

$hours =(int) ($difference % 86400 / 3600);

$minutes =(int) ($difference % 86400 % 3600 / 60);

echo "My birthday is in $days days, $hours hours, and $minutes minutes.";
?>

I’m not that good at programming, this is an elective, so feel free to call me a n00b. I feel like it’s really simple to fix but I have no clue as to what I’d need to do because I thought this was fine. Even pointing me in the right direction would help a bunch. Thanks in advance!

You have to take into account that once you’re past midnight on Nov. 13, $difference will start returning negative numbers because $today will be greater than $bday.

So if the current date is between Nov. 13 and Dec 31, you need to increment $year by 1 so that it starts counting to your *next* birthday.

PHP class help OO programming?

hey guys, I recently turned to OO php programming. And I’m having trouble with a class. It’s a simple class that I use to change the language on my website
[code]
<?php
class set_language
{
public $language = "nederlands";

public function get_language() { return $this->$language; }

public function __construct()
{}

public static function set_language($the_language)
{
$get_language = $the_language;
}

public static function set_language_nl()
{
self::set_language("nederlands");
?>
<script type="text/javascript">
history.back();
</script>
<?php
}

public static function set_language_en()
{
self::set_language("engels");
?>
<script type="text/javascript">
history.back();
</script>
<?php
}
}
$language_set = new set_language();
?>
[/code]
basically this works but it doesn’t set the language properly it runs the script so I know it goes through the whole thing it just doesn’t set the value. Could anyone point out what I’m doing wrong here? I’d greatly appreciate it. Thanks in advance

The problem is likely you are forcing the browser to reload , ie go back 1 in history, but you are not storing the new language in a manner that the browser can recall it. PHP does not store values between compiles without you forcing it to. Try using $_SESSION or cookies to store the new language so that the browser has a pointer to the new language. Without storing values in this manner, every time your server compiles your script all variables are cleared or resort to default.

session_start();
$_SESSION['lang'] = ‘English’;
Self::set_langauge(‘English’);

As a result every time you want to see what language is set you should refer to the session. Also don’t forget to set the default language in this manner.

Is programming in core PHP better than using a framework?

What are the advantages of programming a big website using core php? is it more reliable and stable than frameworks such as codeignitor or Cakephp? Or are the frameworks better to use than corephp for valueable or big and complex websites? Or does it simply not matter at all?

Thanks in advance

this question revolves around the whole convention over configuration mindset. If you want to accomplish more for your site in less time you could use a framework. However, if you want the satisfaction of creating something on your own you would want to build from the ground up. In my experience I have always programmed everything on my own simply because I enjoy the satisfaction that comes along with using my own scripts.

How do I change a PHP file back to PHP?

So I edited a php file with notepad, and unfortunately I forgot to un-check the "Always use this for these types of programs" thingys.
Advanced thanks :D

I don’t have english Windows, but lets have a try.

- Right click on the file
- select "open in application…"
- select the app you want to use and check the "always use this for these types of programs"

Ta-daa!

What other scripting languages is there besides php and asp?

I waould like to know all of the languages you could use to program advanced websites.

Server side: Ruby, Python, Cold Fusion (not too popular anymore), Perl.

Client side (runs on the browser): Javascript, and now, Dart (http://t.co/i84dnaqE), which is a scripting language that Google just put out three days ago. Dart is awesome! It’s intended to make advanced web applications easier and faster to program, and more maintainable.

please tell me what’s the difficulty level of each programming language?

i just wanna ask if can anyone please give me your difficulty rating based on programming language because im an advanced vb6 programmer. please tell me how do you rate the difficulty level of each language:

* C/C++
* Java
* ASP/ASP.NET
* PHP
* Phyton

C/C++ – Quite difficult
Java – Almost on the same level as C++ ?
ASP/ASP.NET – Never really worked with so I can’t tell for sure.
PHP – Easy, although setting an environment up can be troublesome
Python – Really easy, the fact that you need almost nothing to run and debug your code makes it so fast to develop on

Programming career change?

Hi, I’ve been doing php and mysql programming for 3 years and lately I’ve been playing around c/c++ programming in BSD. I’m still in the newbie level but I like it very much, it’s more challenging, besides those were my main languages back at uni.

My question are

- Is it a good call for php/mysql programmer make a career change to unix system development (c/c++)?

- I guess will have to start with junior position in c/c++. How much knowledge does a junior unix programmer have to have? Currently I’m working my way on Advanced Programming in Unix Env. I’m giving myself 8-12 months period to learn anything I need to know about unix.

Anyone out there who are in unix system development or programmers who have had career change, your feedback are most welcomed and appreciated…

Cheers

I did some Unix programming/scripting about 20 years ago. Mostly at a University.
It advanced into doing A LOT of coding on the Windows platform. Writing advanced Windows applications (including custom controls).
Now I find myself back developing/scriptiong in a Unix environment once again. This time on a real-time application, meaning the application needs to be designed to be very efficient so that there is very little waiting for information (an example of a real-time system would be an ATM … Automated Teller Machine, although that’s not what I’m working on).

Having the ability to switch seemlessly between the environments is very important to remove limits that some people have given to themselves by staying in one specific area.

PHP/MySQL is available on BSD, Windows, and *nix operating systems, so that skillset can and will be beneficial to you.

Good luck with your endeavor. I am sure it will benefit you in the years to come!

What do i choose?? CCNA or Any other Programming-Based course?

I’m doing my 5th yr. M.Sc.,Software Engineering (5yr. Integrated Course) in an Engineering College, Being an final yr. student, I like to study a Certification Course. I chosen CCNA and Advanced Testing…
Does these courses got any scope?? Else i like to choose my Programming side like .NET, PHP,blah…blah…

I think if you are doing any certification course apart from ccna is better for you because you are belongs to software field and ccna belongs to network field . if you are doing scjp or mcse is good for you and lots of company they ask scjp or mcse certification.

I am a fresher.I am working as a php programmer from two months and i am not interested in programming?

Now i got a opportunity as a manual tester and i prefer to to go for testing.i am interested in testing and i don’t know how the future will be testing please help me and i tell me hoe to earn good income as a tester in future with experience.

Thanks in advance for all answers…….

GO A HEAD WITH UR WISH CAN GET GREAT OPPORTUNITY IN THIS FIELD…

Damn Small Linux Text Processing

Damn Small Linux is an excellent tool for learning Linux commands and running the Linux operating system. But what if you don’t plan to be a computer nerd; can this software still be useful? The answer is a definite yes; you can make use of this tiny operating system whether or not you want to learn the sometimes gruesome details of operating systems. This article introduces the text editors that come with your free Damn Small Linux that runs on even obsolete Windows computers. You can use these applications to compose simple text or programs of any level of complexity.

Once you have downloaded and installed Damn Small Linux there are several equivalent ways of launching its text editors. You can click on the DSL button in the lower-left hand corner or on the Apps icon toward the top of the screen. Then open the Editors: there are four, Beaver, Nano, Notepad, and vi (actually vim). We will look at these editors in order plus an additional one.

Beaver is my choice for creating and editing the text files used in my Damn Small Linux tutorials. The name Beaver stands for Beaver is an Early AdVanced EditoR which is the kind of joke that many Linux and Unix people find funny. This editor is particularly useful for programming and web page editing. Beaver’s special features include color coding and the ability to convert text to Upper Case, Lower Case or to capitalize the first letter of every word. You can convert text among the following formats: Unix, DOS, and Mac. Programmers will be glad to know that Beaver formats code for the following programming languages: C/C++, HTML, Perl, JavaScript, PHP, and Bash. Unfortunately there is no Help function.

The nano program is especially used for email messages. It stems from the widely used Pico email program that is not available for some versions of Linux. I have not worked with nano but am told that many Linux and Unix people like it.

What the Damn Small Linux people call Notepad is actually another text processor that is similar to the DOS/Windows Notepad. I haven’t used it because Beaver is more powerful, and just about as easy to use.

The final application in this group is VIM, vi IMproved. The original vi was a very-widely used text editor for Unix and Linux systems. Today almost all Unix and Linux people work with other, more sophisticated text editors. When I teach Linux on systems other than Damn Small Linux I teach a reduced version of vi. This editor is cumbersome, but you make like the improved version. Damn Small Linux offers you a choice.

The Office folder includes Ted, a word processor which is compatible with Microsoft Word. Ted saves documents in RTF (rich text format) that can be read by Microsoft Word and other word processors including Open Office. Ted and Beaver belong to different worlds; you can’t take documents back and forth between these two applications.

Levi Reiss