Popular just now

ad1

Problem connecting to SQL Server from Linux with Cpanel hosting [SOLVED]

I was having trouble getting a Centos VPS to connect to SQL Server via tcpip. After fighting with FreeTds configurations for a week I finally figured out it was a networking problem. Connecting from my PC was ok but connections timed out when connecting between the shared hosts ip addresses.

Drupal 7: Create Forms in a Single Function

I really do not like using Drupals stucture for creating HTML forms automatically. It's too complicated to create and debug. I took the time out in a project to find an easier way. Here's the code for having the form print out directly when the method is called:


Apple is Building the World's Largest Wind Turbine and Altenator?

Apple's new Campus 2 design is missing a few things. The inner ring should be levitated on a bed of permanent magnets for earthquake safety. The outer rings should rotate with the outer surface shaped as fins with coils underneath. This would make it the worlds largest VAWT (vertical axis wind turbine) and electric generator.

Drupal 7 Views: Getting User and Node Reference ID from row using PHP

Drupal views is my default system for creating sites where an administrator or webmaster can configure a website after it has been developed. Unfortunately the community has misled many into believing that anything can be done using Views, Rules and a handful of popular modules without coding. This is definitively not true! And even if you can code it is a dangerous road to walk.

So here's my latest gripe. Connecting User and Node References, counting references and displaying the right information.
If you try to get the node id or user id from a reference it is not available in the $row variable as it should be. Ask the programmer why because I have no idea what this variable is good for otherwise. The output from it is:

stdClass Object
(
    [field_tutor] => 18
    [field_school] => 7
    [field_school_year] => 18
    [field_student] => 18
    [field_tutor_1] => 18
    [php] => 
)

Referenced field values are the node id of the parent and not the value that actually connects the information to the node or user content. The information is available though in the $data variable.

print $data->_field_data['nid']['entity']->field_student['und'][0]['nid']; // note nid not "value"
print $data->_field_data['nid']['entity']->field_tutor['und'][0]['uid']; // note uid not "value"

This took me about three days of hunting and frustration (along with a good portion of trial and error) and cost me a deadline. So posting it here might save you the same because there is no straight forward answer about this even from the Fields API creator or the Views team.

Webmin installation of Apache and MySQL randomly stop on CentOS

One of the things that I do rarely is creating and configuring a Linux OS and web server for a client. Especially a Virtual Private Server. In the print business most servers are Microsoft Windows machines and I typically find myself doing a lot of these. But a few weeks ago a friend wanted a tester for his new VPS hosting service and I volunteered. But many things that I never encountered before had to be fixed.

Update PHP to the latest version in Centos VPS

When you use a server image to create a VPS not everything is the latest or best version. So here's the steps for updating PHP to the latest release, which at this time is versio 5.4. While you could this manually adding in the repositories available from the community is easier to maintain.

wget http://dl.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
rpm -Uvh remi-release-5*.rpm epel-release-5*.rpm


EPEL
Extra Packages for Enterprise Linux (EPEL) is a
volunteer-based community effort from the Fedora project to create a repository of high-quality add-on packages for Red Hat Enterprise (RHEL) and its compatible spin-offs such as CentOS or Scientific Linux. Fedora is the upstream of RHEL and add-on packages for EPEL are sourced from the Fedora repository primarily and built against RHEL.



REMI
This is a repository created by Remi Collet with the aim to give support for old Fedora releases to allow them to install recent software, also it gives you the ability to have your CentOS/RHEL systems with the latest software available in the net.

Update PHP to the latest one in the repository



yum --enablerepo=remi update php php-*
/etc/init.d/httpd restart

CentOS Apache installation not responding

I always forget that in a raw CentOS server install the ip table needs to be configured to allow http calls on port 80 and port 10000 if you want to use Webmin. If you don't do this then the web server will not respond to browser calls because it can't.

Rules created with the iptables command are stored in memory. If the system is restarted before saving the iptables rule set, all rules are lost. For netfilter rules to persist through system reboot, they need to be saved.

# iptables -I INPUT 5 -m tcp -p tcp --dport 80 -j ACCEPT
# iptables -I INPUT 5 -m tcp -p tcp --dport 10000 -j ACCEPT
# sudo service iptables save
# service iptables restart