Jump to content
xisto Community

Ahsaniqbalkmc

Members
  • Content Count

    800
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Ahsaniqbalkmc

  1. I am trying to get into the Object Oriented Programming (OOP) in the PHP. For this I have installed a local apache server to test my work and experiment with my scripting techniques. Until today everything was going fine and my learning speed was good. But I have come to face a problem to which I have no answer. I am trying to create a user class for a test project. The code of the user class is as follows: <?phprequire_once("database.php");class User {public $id;public $username;public $password;public $first_name;public $last_name;public static function find_all() { return self::find_by_sql("select * from users");}public static function find_by_id($id=0) { global $database; $result_array=self::find_by_sql("Select * from users where id={$id} limit 1"); if (!empty($result_array)) { return array_shift($result_array); } else { return FALSE; }}public function find_by_sql($sql="") { global $database; $result_set=$database->query($sql); $object_array=array(); while ($row=$database->fetch_array($result_set)) { $object_array[]=self::instantiate($row); } return $object_array;}public function full_name() { if (isset($this->first_name)&& isset($this->last_name)) { return $this->first_name." ".$this->lastname; } else { return ""; }}private static function instantiate($record) { $object=new self; $object->id=$record['id']; $object->username=$record['username']; $object->passwrod=$record['password']; $object->first_name=$record['first_name']; $object->last_name=$record['last_name']; return $object;}}?> As you can see in the code, I have created a User class with few attributes and methods. The code is clean and there is no problem in it. On the index page, I have the following code: $user=User::find_by_id(1);echo $user->full_name(); Theoretically, the code should return the full name of a user but instead when I run the code, I get the following error: ( ! ) Fatal error: Call to a member function full_name() on a non-object in C:\wamp\www\imagepro\public\index.php on line 8Call Stack# Time Memory Function Location1 0.0014 669408 {main}( ) ..\index.php:0 And I don't understand why I am getting this error. It says that I am making a call to an object function from a non-object. But as per the code in the instantiate method of the user class, the object should get automatically instantiated. I have spend more than an hour just to figure out any mistake in the code but I am unable to find it. So the last guess that is left with me is that there are some settings that I need to change in the php.ini file on my localhost. Any help from the experts is appreciated. Thanks in advance
  2. I have started to feel that my battery is reducing the backup time with each passing week. My laptop is about a year and half old and I think it is quite natural for my battery to start wearing at this point of time but just for my knowledge, I would like to know that what is the better way of using a laptop with AC power. I mean to say that What should I do when the battery is fully charged and I am still using the AC power. THe possible options would be: I should remove the battery from the laptop and continue working on AC power I shold remove the AC power (even if it is available) and start using the laptop on my battery until recharge is needed. I should leave the battery in and also keep the AC power plugged in and keep using my laptop this way. Let me discuss each of theshe options separately: The first option ("Removing the battery") is not really a valid option for me because the electricity is not reliable here and you won't know when the power fails. So in this case if remvoe the battery and a power failure occurs, I will lose all my unsaved data and there is likelihood of damaging my hard drive and other computer components. The second option ("I should remove the AC power") is quite valid for me but I don't like it. The reason is that sometimes you won't get the AC power for many hours at a time and if you have already removed the AC power the charge left on you battery is 50% and then a power failure occurs (which do occur all the time), then I won't have much battery backup left to work with and I would be left without any charge after and hour or so. The third option ("keep both battery and AC plugged in") is what I normally do. I have tried to research about using this method and I have become more confused than I was before. There are sites which would tell you that it is a good method and you won't damage your battery even if you keep it plugged in after it has charged completely, but you just have to make sure that the batter doesn't get heated up too much. Other sites would tell you that keeping the battery plugged in (while on AC power) after it has charged completely would damage your battery and you should either remove the battery or remove the AC power. It is very confusing and I am unable to find any authentic information on this subject. SO anyone, please share your views on this and tell me which method you use when you are working with your laptop. For those who might want to help, The laptop I use is HP DV6 3040us and the battery is Li-ion battery.
  3. Of course there are. The best in the competition is Bing and you might rightfully call it the Runner-up search engine. However, from my personal experience and the niche I mostly am related to (medical stuff), I think there is a huge difference between the performances of bing and google. Google is far ahead as about 90% of times it shows me what I need. I don't bother how it does it and what sort of indications it might use, but the point is that it gives me what I want to see. On the other hand, bing is at time even not usable for me as it fetches so much irrelevant results. So for me, google is the best search engine, however, the privacy thing and other grey stuff should be looked as well.
  4. What's about the amd vs intel thing as far as gaming is concerned. I have heard lots of people saying that in terms of games and multimedia, AMD have a certain edge over their intel counterparts but on the other hand, intel are much efficient. I don't get this. I personally use both intel and AMD CPUs. The discussion that AMDs produce a lot of heat is absolutely correct and that intels are much more efficient in terms of power usage is also quite true. Intels also run cooler. The thing I want you folks to think about is that more heat production means lesser performance. And when you perform heavy tasks, like running games, the amount of heat produces is very likely to affect the performace. So theoretically, intels (as they run cooler) should be better performers in terms of games as compared to AMDs (which run at a higher temperature).One additional thing you folks need to think about is that gaming is more dependant on GPU than the CPU. So no matter whether you have AMD or Intel, if you don't have a good GPU, you would never get a good performance out of your machine.But again, things might not be as simple and theoretical in practical life. As an example, I have AMD Nx380 triple core processor with Ati hd 4250 GPU (which I don't understand to be integrated or dedicated). My friend have intel core i3 second generation with hd 3000 graphics. Now theoretically, the intel system should perform better in terms of games (as both CPU and GPU are better and newer) but in contrast to this assumption, the AMD one runs better. (the comparison is for FIFA 12), which might have some specific issues with the hd 3000 graphics.)
  5. I don't do much work in javascript, as of now, but I remember that once I had to test something and I used the console in the firebug tool. It was quite easy to use and had some decent features associated with it. So I guess, you should give it a try
  6. I think this is the issue, why the other computer won't joint my homegroup. Can you please tell me how would I do this? I mean how would I tell my firewall the the connection is safe. I think I would also need to tell the firewall of the other computer that the connection is safe. SO how would I do this? Can you explain?
  7. Yesterday, I had the need to create a PC to PC connection to transfer some data from my PC to my friend's. I am quite used to creating these connections to transfer files. I use an ethernet croos link wire for this purpose and I have successfully done it in the past. But yesterday strange things happened that I didn't understand. First of all, let me tell how I do it so that anyone who would want to help me would find it easier to help.I go to the properties for the ethernet connection in both the computers and there I make changes to the "Internet Protocol Version 4 (TCP/IPv4)" properties. I change the "Obtain an IP address automatically" to "Use the following IP address" and the enter the following values in the first computerIP address: 192.168.1.1subnet mask: 255.255.255.0Default gateway: 192.168.1.2and the following in the second computer:Ip address: 192.168.1.2Subnet mask: 255.255.255.0Default gateway: 192.168.1.1And then I make sure that both computers have the same workgroup name and that's all. The connection starts and I can start sharing files between the two computers.But yesterday, when I did the same, I went through strange issues. First of all the setting didn't work at all. But when I reversed them, the name of the computers appeared. In my computer, the netwrok was "Home network" but in the other computer, instead of one network, two networks appeared. One of them was home and other was "unidentified". I didn't understand why two networks appeared on that pc. By the way, when I tried to see whether I can access the files on my personal computer from the second computer, I couldn't. Just the name of my computer showed and the connection to it couldn't be established. But when I tried to view the files of the other computer from my personal computer, I successfully did so.I don't understand where things went wrong.
  8. I am trying to get deeper into the PHP and improve my scripting skills so that I can develop better websites that are not mere static pieces of content but interactive applications as well. One problem I recently ran into was the need of simplifying the process of link building. In a normal website, each time you have to create a link to an internal page, you will have to type the relative or absolute address of that page. It is fine but I need to simplify the process.If you have edited a wikipedia article, you might know how they have simplified the process of link building to internal pages. Instead of typing <a href="http://forums.xisto.com/no_longer_exists/ Page</a>, all you have to do is to type [exmaple page] and the script automatically searches the database for the page title "example page" and creates a link to it. I am really impressed with this method and I think it can make my life as a webmaster pretty easier, as I am a bit lazy.I have some basic knowledge of php including how to interact with a mysql database. I also know the basics of object oriented programming and can use it to achieve simple tasks. All I need to know is where to start. An alternate way of knowing where to start might be to do a bit of googling on the subject and probably I would find useful information but I am trying to do it this way so that I can discuss my specifics here.
  9. I am using windows 7 for most of my work because I am comofortable using it. And I can troubleshoot most of the problems occurring. Another reason is that most of the applications and tools I use, work well on this operating system. I also use Ubuntu LInux for fun and to get into the Linux OS. I am planning to migrate to linux but first I need to familiarize myself with the environment and then make a final decision.
  10. Worpdress is a simple CMS that has can be used to achieve almost anything. It is globally supported and has a vast library of plugins that can be used to extend the platform to new skies. So with little effort, you would be able to find the right plugins for you and then shape your website the way you want it to be. So I would recommend that you check on wordpres.
  11. It would be very nice of you to do it for me. It would make my job easier but in addition to using the wordpress funcitons to fetch additional database queries, I also need to understand how it works and how to handle it. I am trying to get deep into the wordpress platform to make it customizable to the extent so that I can achieve anything that I think is suitable and good fro my website. And in my opinion, to be able to do so would take a lot of learning and understanding. It would also take a lot of practice but I am ready for it.
  12. The next natural question I would ask you folks is that what is the best method of cleaning and dust blowing a laptop. Should I use a vacuum cleaner or a blower? I have read somewhere that I can use a blower to blow the dust out of my laptop without even opening it. But I am a little hesitant to use this method because the blower I have access to generates a lot of pressure and I am afraid that it can most likely damage my laptop. However, I might be worrying a bit too much but my quesiton is: Is it a good method? What alternatives I have?
  13. From my little experience, I can tell that a website built on static pages is very hard to manage as compared to a database-driven website. Making changes to static website is a bit of a pain while database driven websites built on a healthy CMS offer easy customization. So, I think that even if the websites with static pages are faster, the increase in speed won't be worth the effort one has to put to maintain such a website. On the other hand, database driven websites are very easy to maintain and they offer the facility of concentrating your efforts to the content only. This is an extremely healthy indication for a website from both user-experience and SEO perspectives. And in the process if some speed is lost, I think it is worth it.However, if there are some mechanisme to make a certain CMS faster than the other, then those mechanisms should be followed because I believe that faster websites are getting much weight from the search engines in their ranking algorithms. This is especially true for niche websites that recieve a major portion of their traffic from search engines. Such website have to devise strategies to make search engines happy and increasing the website speed is a good strategy.If it is correct that there isn't any speed difference between wordpress and a simple CMS specifically made for a website, then I think no one should bother to create their own CMS as wordpress is a great system to work with. But I still don't understand it. I mean how is it possible that all the extra stuff in the wordpress that a website is not using, wouldn't cause any burden on resources and speed. @manuleka, please talk more about it.
  14. Wordpress is a great, easy to use, content management system that is equally beneficial for both beginners and experts. Beginners find it easy to use and get started with while at the same time it has many advanced features and customizations for pro users. The best thing about it is that it belongs to the open-source community. This means that you can use the code in whatever way you want without any limitation and you will have full access to the core of it thus modifications and customizations are not a problem.But my qestion is that for someone who just needs a simple website with no advanced features at all, is wordpress simple enough to not affect resources and speed. I haven't done much research on the speed of wordpress platform and how much resources it uses, but I am sure it would use more than a simple page with no complexities at all. So for a webmaster who just want such a simple website which has nothing but links, text and images, is wordpress a good solution. What if someone develops his own CMS specifcally for his own website. Some readers might thing that making a CMS would be a heck of a job but believe me it is not that difficult. You can easily create a very basic but completely functional CMS in a couple of hours at maximum (ofcourse, if you know how to do it and have learned all the languages and tools necessary).The advantage of this approach would be that you won't create any extra thing that would never be used in your website and this all would accumulate to be a considerable cut on resources that your website use. But here I am more concerned with the speed of the website than the resouces it use. Would your own custom made CMS that has no unnecessary features be faster than wordpress, which is built taking all types of customers in mind. Some of its features are almost always unnecessary for some webmasters and I suspect they can also reduce the website speed. So my guess is that a website built on a custom made CMS with no extra unneeded features with be faster than a similar website built on wordpress platform, but I might be wrong and that is why I started this topic.I really believe that if I create my own CMS, my site would be faster than the current one, which is based on wordpress platform. But one thing is keeping me from creating my own CMS and that is "SECURITY". Because wordpress is a global platform, and is used in all types of different industries, it can make no compromise on its security. And as a webmaster, I can make no compormise against my website's security so I have to stick to something that is more secure no matter if it is faster or not. But what if I am able to make my custome CMS secure enough. In that case, wouldn't it be a good thing to get a faster website, as everyone here would know that search engines have not started to give significant weight to faster websites. Most importantly, users like faster website and it leaves a good impression. The question, however, is that how to achieve a security level for my CMS that my work, when gets online, cannot be easily compromised. Can I trust my own work better than work of many professional developers who contribute to wordpress.And how much effort would it take to develop a reasonable security...
  15. I think the best thing for intel CPUs is that they are much more efficient than AMD. And this efficiency translates into a lot of things such as less heat generation, greater runing times on battery for laptops, and faster performance. No one can deny that intel are more efficient than AMD but what AMD has done brilliant is that they have reduced the performance and efficiency gap to such a low that you won't even notice it when doing normal stuff. Considering that, the significantly lower prices of amd cpus are unbueatable.
  16. For most sites that are built on a specific niche, autosurf traffic is not a good option. The reason I say is that the traffic is of the lowest quality one can imagine. No body even bothers to look at what's inside the website no matter how great a website is or how valuable stuff it contains. Furthermore, most monetization programs won't allow you to use autosurf as a source of traffic. For instance google adsense is completely against traffic obtained from this source and i think they are right about this. In simple words, I think trying to get autrosurf traffic is just a waste of time.
  17. For me, it is Google adsense. I have done some experiments (not much) with other advertising networks but none of them even neared what adsense is doing for me. I hear a lot of people complaining about adsense and google. Many people say Googel is cruel about their policy of fraud clicks and they may ban someone who is specifically targeted and click-bombed. Some people say google migh ban you without any good reason and others say there are better ads than what google adsense has to offer.For me none of these was true or may be I was lucky. It has been about two years of doing business with google and in that perior do time, all has gone well for me. Nothing bad ever happened. I remember in the beginning I had a few problems in confirming my address and identity but it was graciously solved and after that, I never had any problem. I have been receiving all my payments on time. Never faced a delay even on a single payment.A few months back, my webiste was attacked by some hacker and phishy links were produced on it. I was having my first prof MBBS annual exam during that time and didn't find the chance to check the email. My webhost (Xisto) sent me emails about the issue but as I didn't respond, they temporarily suspended my website. It was kept suspenned for about 3 days untile I sent a message to them about the details of the attack. The reason I told you the long story is to elaborate that this suspension affected my SEO alot but didn't affect my adsense CPC at all. My website has lost rankings for almost all the search terms and I am not receiving that many visitors that I used to receive before that attakc but the adsense CPC and CTR are steady. Though my final earnings are decreased because of decreased traffic but it has nothing to do with adsense.So the moral of this boring post I made is that for me, adsense has been the most reliable and the best program.
  18. The topic is quite old now but I think the matter discussed is still alive.SMS marketing (or I should say SMS spamming) is quite common in my country. And I think it is in its worst form. People collect mobile phone numbers from business cards, stolen sim cards and other gray sources and then just start pushing many messages to each of these number. As I said the spamming is in its worst form, so are its results. Very few people even bother to see what is inside these messaes after they recieve such messages from unknown numbers. The reason it is not stopping is because SMS messages are extremely cheap here. You can get 10,000 messages for 83 PKR (less than $1). And this offer is for prepaid customers. Post paid customers have even cheaper rates.And as these messages don't cost much, the spammers keep on spamming and even the small amount of results they obtain is a success for them.
  19. A few days back, I received an email from some person at moredigital.com. The email was about an offer to advertise on my site. The email looked auto-generated as there were no customizations specific for my case but more importantly, the email was not sent to the admin email address associated with the website. Instead it was sent to the email address through which the domain is registered. I think of it as a very unprofessional way of communication but I don't know if I am a bit too harsh...In the email, I was told that the company wants to put text based ads on my website and that they would pay me on annual basis. YES! they would pay me annually.. It is one strange thing I found in the email as I have never heard of a programme that pays on annual basis. In current ecosystem, a period of 12 months is a bit too long for good business. However, the nice part is that they would pay me in the beginning of the 12 months period and not at the end. This decreases the level of suspicion by a certain extent but still I am not in favor of long term agreements.Another important part was that I will have to put text based ad: A proper dofollow link on one of the pages of my website. For those who don't know much about this stuff: it is called selling links and it is strictly prohibited by the boss GOOGLE. Some people reading this might think why should I care so much about google? My answer to them is that I run adsense ads as the primary source of income on my website and I don't want to do anything that can risk my primary source of income.But still I replied to the detail asking more about what type of advertisement they are talking about and that they should provide me a sample so that I could undersand better. I also asked about what kind of payment should I be expecting and which payment processors they would use to transfer the money.In a timeframe of about one day, I got the reply form the email that had sent me the first one. In that email it was stated there are two ways of advertisement. First method is that I would create a new page on my website and they would provide me the all the content for the page. It was stated that the content would be according to the theme of the website and my opinions will be taken into consideration. The second method was that I would create a new page as well as content for it and they would only provide a URL link to be placed on that page. Here I would make sure that they approve the content of the page.Though they didn't say anything abou the link being nofollow or dofollow, but through the sample they provided, it was made clear to me that I will have to put a dofollow link on my website. I might have agreed even in this case, as a link to an external website which is related to the topic of the page is not against google's policy but the real thing was how much I was supposed to earn from that link.It was mentioned in the email that if I was to select the first option (content created by them), they would pay me an annual fee of $100 and if I was to select the second option (content created by me), they would pay me $130. This amount of money is way less than I expected. Maybe it is more than enough for this kind of advertisement but I don't have any experience with this form of advertisement and I feel that it is a bit too less for me to approve their proposal.I did some research on the internet about the company. The review about them were not good. Most of the places stated that they are not very honest about their payments and most people do not receive their payments at all. This research has further grayed out my opinions about the company and although I haven't made any reply to the email yet, I think it would be in a negative way.Have anyone of you done business with moredigital.com? If yes, what was it like?
  20. What about the drivers for various components on different computers? Do you have any solution for this?I haven't tried your way of creating a windows 7 USB but I have tried other ways (most of them didn't work for me) on my previous computer. On my current machines, I get this ugly message that tells me to remove all USB connected devices or the system won't boot. I guess my current lappy doesn't support USB boot. It is an HP DV6 3040us. I think I am getting off-topic now.Well the real question I wanted to ask was: Is there any solution for pre-installing the drivers on the USB OS. Suppose I have three different computers all requiring different drivers for the graphics adapter. Can I make some arrangement in the windows on USB where all three drivers are pre-installed and depending on the hardware, only the corresponding driver operates. I know this could potentially be a hard thing to achieve but it would have bothered many people so chances are that someone would have created a nice way to solve the issue.
  21. What about the windows backup wizard. I mean instead of going for other (free or commercial) backup applications, why won't someon use the solution that is generic to every windows (Windows7). If not anything else, at least it would cut the hassle of downloading/installing and/or buying new applications specifically for this purpose.I am quite an amatuer as far as backing up entire sysmte goes as I have never done it myself. The primary reason is that I don't have enough space available outside my system to backup all the 400+ gb data that I have within my system. Therefore I have configured the backup wizard to never perform automatic backups so that no valuable space is wasted on my computer's primary hard disk. But to overcome the danger of system failure, and then loosing my data, I have done one simple thing. I have classified my data into important and non-important. And I have placed all the important data on an 80 GB external hard disk. This is not the best solution but at least my important data is safe.Just in case someone is curious, the important data in my case is the one that I have created or that can not be easily found and downloaded. All other data is the non-important one and although it would be quite a trouble if I loose it but at least there is a solution to get it back.
  22. If this is the case then I think my problem is solved. I would try it and let you people know how things went for me.
  23. I used to use notepad to do all my html, css and php. But then I found that I could be more efficient just by making different things in different colors so I shifted to notepad ++ which doesn't do much more than coloring different things in different colors. After a while, when I started to do complex programming, I realized that I am making a lot of mistakes and that I am spending a huge amount of time trying to find and eliminate errors. I also realized that I was spending a huge amount of time and effort trying to not make mistakes. So I thought I would increase my efficiency significantly if I manage to find some application that can help me with syntax errors. For instance it just underlines statements that have syntax errors or propose the syntax of a function or statement before I actually contruct one. At that point I started a search online for good editors for languages like html, css and PHP. But my emphasis was on php. I already had the adobe dreamweaver but it was a bit too heavy for my taste. I wanted something lighter that would load quickly and perofrm faster.After doing quite a lot of research online, I decided to go fro aptana studio. It not only has brilliant mechanism to prevent syntax errors but also has a beautiful suggestion criteria. But above all, the thing I like the most about it is that instead of using arrow keys to move forward the automatically created closing tags, I can simply use the "tab" key to jump over. This was a huge time saver for me as I am much more comfortable with pressing tab key than the arrow keys and it does indeed save me a lot of time.So all those programmers who are still using notepad or notepad++, I would suggest you to shift to some advanced editor like aptana studio. It would definitely save you a lot of time and effort during programming complex codes and structures.
  24. What do you people think of "Microsoft Security Essentials". It is not included in the list so nobody can vote for it but my experience with it is absolutely awesome. I do have to connect a lot of USB sticks to my computer on daily basis and this means that the potential of getting infected is great. Before Microsoft security essentials, I used Avira free antivirus. It was also awesome but at times it became irritating with the ads and offers and upgrades and other stuff. And my personal experience with avira is that it is good as far as protection against viruses is concerned. Once you do get infected, it becomes useless. It has happened to me several times when I would be safe for many months but once I did get infection, I would have to format everything to get rid of the virus. I always used Avira when I was on windows xp but once I updated to windows 7, I shifted to the Microsoft security essentials.FIrst of all I didn't even know that an antivirus from microsoft's camp exists. It came to my knowledge by an accidednt but I tried it as soon as I came to know that it exists. And believe me I am extremely happy with how things have gone with Microsoft security essentials. It is not only good in protecting against infections but also performs brilliantly once you do get infected. I can say because it has happened to me once when my system got actually infected. But all I had to do was a complete scan and everything was clear. Before I used Microsoft security essentials, I had to renew my OS every 5, 6 months, formatting everything. But with microsoft security essentials installed, I am yet to renew my OS.
  25. Wordpress runs on apache and mysql. The databse connection capabilites of wordpress are not known to most of wordpress users. The reason is that every thing is sort of automated and a user almost never needs to know how wordpress connects to the database and how it fetches data.I have ran into a problem where I need to create additonal entries into the wordpress database (entries that are not created by wordpress automatically) and then fetch data from these entries from within wordpress. The plan is to include a short summary of some terms that would be displayed when these terms are clicked. When a user clicks on a word (included in the list of words in the database), a connection to database would be made and a query be executed whereby corresponding information would be fetched and displayed to the user. In theory this looks simple but there are few glitches that need to be resolved. The most important of these is the securtiy issue created by connecting to the databse through a method not approved by wordpress.For instance I can simply creat a connection by the following using "<?php mysql_connect(server, username, password)?>" and then use this connection to perfrom queries and fetch data. But this would not be the secure way as the password can then be viewed easily and then can be used for ill things. So I am looking for more secure ways of connecting to the database from within wordpress structure (I mean without having the need to go to custom made pages specifically created for this purpose).I did some search on this topic and found that there is a function called "wpdb()" that exists specifically for fetching data from the database from within wordpress. The problem is that I don't know how to use this methos and whether it is secure enough or not. That is why I have created this topic to get more information from experts out there.
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.