NathanFriend.co.uk

Developers notebook

Category: Programing (page 1 of 5)

Xcode Code signing fails, detritus not allowed

When running a build in Xcode results in the error ‘Code signing fails with error ‘resource fork, Finder information, or similar detritus not allowed’

Use xattr -cr /app_directory to fix

Source: https://developer.apple.com/library/content/qa/qa1940/_index.html

Join Ubuntu Mate 16.04 to an MS Active Directory Domain

Bash script to prepare an Ubuntu Mate 16.04 host for joining to a MS Active Directory Domain. https://github.com/nathanfriend/domain_join

Scan a network for MS SQL servers

nmap -p T:1433 -sV 192.168.1.2-254 -oG tcp_scan_results.txt

Source: https://www.mssqltips.com/sqlservertip/2753/using-nmap-to-scan-for-sql-servers-on-a-network/

Amazon ec2 CLI – Return instance public DNS by tag

aws ec2 describe-instances –output=json –filter Name=tag:{TAG NAME},Values=”{TAG VALUE}” –query “Reservations[].Instances[].PublicDnsName”

For example if you have some ec2 instances with a tag key “Name” and the value “Webserver Auto Scaling Group”

aws ec2 describe-instances –output=json –filter Name=tag:Name,Values=”Webserver Auto Scaling Group” –query “Reservations[].Instances[].PublicDnsName”

Run command after boot SuSE

Append a command to the end of file /etc/init.d/boot.local to be executed after booting.

echo “command” >> /etc/init.d/boot.local

Example: echo "/opt/zend/bin/zendctl.sh start" >> /etc/init.d/boot.local

Original source: http://workingbinary.com/2011/05/how-to-run-command-after-boot-on-opensuse/

MySQL Error Number: 1118 Row size too large (> 8126)

During testing of a web form I’m developing that has some lengthy input fields, I hit the upper size limit for the VARCHAR field type.  Looking for a suitable alternative I found.

TINYBLOB, TINYTEXT (255 Bytes)
BLOB, TEXT (64 Kilobytes)
MEDIUMBLOB, MEDIUMTEXT (16 Megabytes)
LONGBLOB, LONGTEXT (4 Gigabytes)

I went for TEXT which seemed more than big enough.  However when you have multiple large fields being submitted together MySQL may still error.  To overcome this.  Edit /etc/my.cnf under the [MySQL] section add :

innodb_file_per_table
innodb_file_format = Barracuda

Restart MySQL for the change to take effect /etc/init.d/mysql restart

Then update your table to use the compressed row format, setting the block size to 8.

ALTER TABLE appraisal
 ENGINE=InnoDB
 ROW_FORMAT=COMPRESSED 
 KEY_BLOCK_SIZE=8;

Sending e-mail from EC2 to SES in PHP

amazonGreat post from Saurabh Anand, really bailed me out.

http://sawrubh.tumblr.com/post/72307051846/sending-emails-using-amazon-ses-the-smtp-way

Concrete 5 Pretty URLs in OpenSuSe 13.1

Vi /etc/apache/http.conf

<Directory “/srv/www/htdocs/c5”>
Options +FollowSymLinks
AllowOverride all
Order deny,allow
Allow from all
RewriteEngine On
</Directory>

Orignal source

PHP MSSQL Open SuSe Warning: mssql_connect(): Unable to connect to server

Edit freetds.conf (uncomment and change version):

from

<code>[global]
        # TDS protocol version
;   tds version = 4.2</code>

to

<code>[global]
        # TDS protocol version
    tds version = 7.0</code>

and restart apache.

 

Source: http://stackoverflow.com/questions/13180746/mssql-connect-unable-to-connect-to-server-without-freetds-conf

Codeigniter populate dropdown from database

Controller

$data['city_list'] = $this->City_model->get_dropdown_list();
$this->load->view('my_view_file', $data); 

Model

function get_dropdown_list()
{
$this->db->from('city');
$this->db->order_by('name');
$result = $this->db->get();
$return = array();
if($result->num_rows() > 0) {
foreach($result->result_array() as $row) {
$return[$row['id']] = $row['name'];
}
}

        return $return;

}

View

<?php echo form_dropdown('city_id', $city_list, set_value('city_id', $city_id));

Orignal source: http://ellislab.com/forums/viewthread/166284/

 

 

Older posts

© 2017 NathanFriend.co.uk

Theme by Anders NorenUp ↑