How to move a comment to another node in Drupal 8

Problem:
A customer of mine had two products on his website that where almost identical. He needed to combine the comments/reviews for both products on a separate page. So i created a new page called Reviews, containing the same comment field as the product page. But how to move comments from one node to another?

I could not find any information about how to achieve this through the Drupal 8 admin interface. So i found the best way was to make the change directly in the database.

Solution:

  1. Open phpMyAdmin
  2. In the comment_field_data table, look for the entity_id column. This column contains the node id of the node the comments are attached to. Change this number to the desired node id for each comment you want to move.
  3. Now go back to the new node and the comments should appear. If they don’t, try some of the following:
    • Clear the cache
    • Go to the edit screen of the node and save it (without editing anything)
    • Write a test comment on the node.
    • Make sure the comment field is not set to hidden in the field settings

Do you have any feedback or maybe even a better way to achieve this? Leave me a comment below:

Remove Paypal Express Checkout from Prestashop

In order to remove the PayPal Express Checkout button from the product and shopping cart pages in Prestashop 1.6, you need to remove the PayPal Modul from the correlating hooks.

Step 1:

Go to Modules > Positions:

Step 2:

Click  ‘All Modules‘, do a search for the PayPal Module and choose it from the search results:

Step 3:

Now you get a list of all hooks which the PayPal module is attached to. Scroll down the page and look for the displayFooterProduct hook, click on the arrow next to the PayPal modules ‘Edit‘ button. Then click on ‘Unhook‘.

Step 4:

Like in step 3, just this time remove the PayPal module from the displayFooterProduct hook.

The PayPal Express button should now be removed.

Do you know a better way? Let me know about it in the comments below:

How to clear the Firefox browser cache?

This tutorial is written for Mac users, but it should also apply for Windows users.

For clearing the cache in the Firefox browser, go to: Firefox > Preferences > Privacy & Security,  scroll to the Cached Web Content section and click the ‘Clear Cache‘ button.

Additionally, go to the Site Data section, here you also need to click the ‘Clear all data‘ button.

Now close the browser and open it again to start a new session.

This should clear the cache in most cases.

Firefox clearing the cache didn’t work? Browser still shows cached data?

If Firefox still shows you a cached website, try this additional step:

In the menu bar at the top, click on History > Clear Recent History…

A pop-up window will open where you can select how much of your history you want to clear. To be sure, you can select ‘Everything‘ in the time range field and click the ‘Clear now‘ button.

Note:  This clears all your browsing history. If you don’t want this, you could try first to delete todays files and see if this is enough.

Don’t forget to close and reopen the browser.

Now you should see the website you want in the uncached version.

How to use titanium search with tableviews and listviews

Titanium mobile has a build in search feature for iOS and Android devices. It is mostly used on tableViews or listViews. But how are the search methods and properties implemented for some of the common scenarios?

The input field

In any case we need a search bar input field. Here we have the following options:

  1.  The build-in Titanium.UI.SearchBar object for iOS and Android devices
  2. The build-in Titanium.UI.Android.SearchView object for Android devices
  3. A custom build search input field for added flexibility

searchBar (ios and android)

The searchBar is commonly used with table and list views, but can also be used independently (see searchText below). To create a searchBar use the Titanium.UI.createSearchBar method.
Simple example:

var searchBar = Titanium.UI.createSearchBar({
barColor:'#000',
showCancel:true,
height:43,
top:0,
})

android.searchView (android)

The android.searchView is similar to the searchBar above, but can be added to the action bar. See example implementation below:

// Use action bar search view
var search = Ti.UI.Android.createSearchView({
hintText: "Table Search"
});

win.activity.onCreateOptionsMenu = function(e) {
var menu = e.menu;
var menuItem = menu.add({
title: 'Table Search',
actionView : search,
icon: (Ti.Android.R.drawable.ic_menu_search ? Ti.Android.R.drawable.ic_menu_search : "my_search.png"),
showAsAction: Ti.Android.SHOW_AS_ACTION_IF_ROOM | Ti.Android.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW
});
};

Custom search bar

To get more flexibility in designing the search bar, we can use a normal Titanium text field and button to create our own search bar. For this we can use the Ti.UI.textField and Ti.UI.button objects and add them to the view.

Event Handling

The searchBar doesn’t really do anything by itself. We need to use event listeners to react when the searchBar is used.

Here are some examples:

//when text is added or changed in the searchBar we store the text in e.value
searchBar.addEventListener('change', function(e){
e.value;
});

//when the return key is hit, remove focus from our searchBar
searchBar.addEventListener('return', function(e){
searchBar.blur();
});

//when the cancel button is tapped, remove focus from our searchBar
searchBar.addEventListener('cancel', function(e){
searchBar.blur();
});

Connecting it to the views

A view needs to know which input field it should use to filter the results. For this we can use some build-in properties in both the tableView and the listView.

search (tableView)

The search property is used in tableViews, and tells us which searchbar input field should be used in conjunction with the tableView.

In the below example we assume that searchBar is the variable name for the actual searchBar implemented earlier.

var listView = Titanium.UI.createListView({
templates : {'plain' : plainTemplate },
defaultItemTemplate : 'plain',
search: searchBar
});

searchView (listView)

This is the equivalent to the ‘search’ property above, but is used for listViews, not for tableViews.

var listView = Titanium.UI.createListView({
templates : {'plain' : plainTemplate },
defaultItemTemplate : 'plain',
searchView: searchBar
});

searchText (listView)

This is a second way on how to implement search with a listView. Here we display the searchBar in the listView header, and not inside the listView itself. And we pass the search bar input value directly into the listViews searchText property.

For this to work we have to change the event listener so it updates the build-in searchText property in our listView:

searchBar.addEventListener('change', function(e){
listView.searchText = e.value;
});

Then we need to tell the listView to add the searchBar into the header of the view:

var tblTrees = Titanium.UI.createListView({
templates : {'plain' : plainTemplate },
defaultItemTemplate : 'plain',
sectionIndexTitles: indices,
headerView: searchBar
});

It is possible to show the search bar outside the listView all together. For this we need to remove the headerView: searchBar line above, and instead add the searchBar directly to the window.

win.add(searchBar);
win.add(listView);

This works because we pass the search terms directly to the searchText property, and so don’t rely on the listView knowing what search field the values come from. Don’t forget to add the ‘top’ property to the listView in order to move it down and make space for the newly added searchBar, otherwise the listView might cover the searchBar.

How To Register Your Apple Development Device

In order to test your app on your Apple device you need to register it in your developer program account. This video shows you how to register your Apple development device, using the UDID provided by iTunes.

Prerequisite: Get an Apple ID and register for the paid developer program.

Before my kids and I became regulars at the local swimming pool, the odor of public pool chlorine would always send me a chilling little reminder of the terror I used to feel during the obligatory swimming lessons of my school years. This fear permeated my life such that swimming lessons were always an ordeal for me. From tiny me in grade one clutching the edge of the pool, knuckles white, refusing to go into the water. To high school me, adept at avoiding pretty much every swimming lesson via every semi-plausible excuse I could think of.

Once, I gave the PE teacher a signed note from my mum saying I couldn’t do the lesson because I had a cold sore, which totally pissed her off. On and on she went. She said the word “fallacy” a lot. I held steadfast to the argument that my cold sore could get infected if I put my lip in the water. Now I get it. She probably meant that my cold sore excuse was total bollocks because there would be no chance of anything surviving in a pool with a 90:10 ratio of chlorine to water.

I guess I had a little bit of curiosity about swimming because casual visits to the pool in the summer – with no teacher around to try and make me do things I found too scary – gave me the opportunity to try things out at my own pace. I taught myself to sort of paddle, float on my back, and jump into the deep end.

And sometimes we do a thing that is totally out of synch with how we feel about something. At the swimming carnival in year seven, they were looking for someone to fill in for the backstroke race. For some reason, I wound up in the middle of all the haranguing. Something inside me clearly thought I was capable because when the house captains turned their attention on me and asked me if I could do backstroke, I said yes. Then it wasn’t much of a leap to get me to do it.

I’ll never forget standing on the starting block. I tried to talk to the girl next to me but she just ignored me. Then she jumped into the water and so I did too. I liked the way the deep water pushed me back up to the surface. Then the race started and we were off. I was backstroking my little heart out then suddenly my arms got really tired and I had to be pulled out of the water. My house didn’t win that day and neither did my dignity.

I think my motivation was a mixture of not wanting to let the others down and a feeling that I could do it even though I had never trained for backstroke – let alone any stroke – in my life. Nevertheless, I am proud of 13 year old me. I did something that was completely out of synch with my usual fear; I raced for my home team and for a few short seconds, I was a swimmer. I think that had someone, off the back of that incident, taken me under their wing and taught me how to swim, I would’ve taken to it. My reasoning being that even though I was scared of the water, I somehow also wanted to conquer it.

Fast forward a few decades and I am a regular patron of the local pool with my 4 year old son. Funnily enough, the pool we visit is the same as the one from my childhood, but that old familiar waft of chlorine no longer invokes in me that same old terror.

It’s a new beginning. I have left my young self behind and have taken on the responsibility of being a parent. And so I take my son’s hand and together, we explore the water. It takes time and dedication to do this. I’d much rather be warm and dry at home. But I don’t want my kids to suffer at the pool in the same way I did as a kid. Not out of fear of the unfamiliar or burdened by the gumption to stretch further but with no recourse to do so.

I watch but never interfere, letting my son be whilst being there for him. He has no teacher to contend with, no pressure to be this or that, and no-one else’s standards to live up to other than his own. And so these days, the pool is a FUN time!

Not that I want to live through my kids or make it their job to fix the frustrations of my childhood. Just that in this instance, I want that toxic fear of the swimming pool to end with me.

My son has no attachments to the smell of pool chlorine.

It is a new beginning.
best visa casinos

Add Honeypot to Simplenews subscription form block

The Drupal Honeypot module (https://drupal.org/project/honeypot) works well out of the box for comments and web forms in nodes.

In my case i needed to add the Honeypot spam filter to a Simplenews (https://drupal.org/project/simplenews) newsletter subscription form, which resides inside a block in the sidebar of most pages.

The problem here was that if the time restriction feature is active, the Honeypot module disables the cache on pages where it is used (which is on most pages). I could have disabled this feature all together, but it is just another layer of protection that i didn’t want to loose.

So the way to get around this is to target a specific form and add or alter the Honeypot feature specifically. This is done by creating a custom module.

Step by step

Create a folder in the module section (sites/all/modules), and give it the name of your module. Example: overwrite_simplenews

Add two files to the folder.

  1. overwrite_simplenews.info
  2. overwrite_simplenews.module

The .info file should contain something like this (change as required):

name = Overwrite Simplenews
description = Customization
package = Mail
core = 7.x

The .module file should contain something like this (change as required):

/* Add Honeypot to simplenews subscription form */

function kleinermann_form_alter(&$form, &$form_state, $form_id){
	if ($form_id == 'REPLACE_WITH_FORM_ID') {
		honeypot_add_form_protection($form, $form_state, array('honeypot'));
	}
}

You need to replace REPLACE_WITH_FORM_ID with the ID of the form you want to target. To find the form ID, you can check your page source in the browser with Firebug, or if the theme doesn’t output this information, you can use the Devel module. After activation of the Devel module, put this inside your module to output the form ID:

function kleinermann_form_alter(&$form, &$form_state, $form_id){
   dsm ($form);
   dsm ($form_id);
}

For more details check out this great video by Peter Yaworski: https://www.torontowebsitedeveloper.com/drupal-video-tutorials/drupal-6-simplenews-subscription-block-override-tutorial-1-2

If you check the form now in the source of your browser output you should find that there is an extra hidden field in your subscription form, named as specified in the Honeypot settings page.

How to customise and restore the Microsoft Word menu on Mac

If you need to make changes to the menu on Word you can rightclick onto the Toolbar and choose ‘Customise Toolbars and Menus…’

Remove, add or reorder menu items in the small menu on the top of the screen.

word-menu-2

Restore the original menu by clicking the reset button. Make sure you have highlighted the menu you want to reset before you push the button.

word-menu-3

How to Talk to a CentOS server via Command Line

Here are a few commands that I found helpful when I learned to use the command line to connect to the server.

Connect

To connect to the server, type the following line into your command line tool. I’m on a Mac and use the terminal:

ssh username@ip

username is the name of a user that has ssh permission, example: root. ip is the ip of the domain you want to connect to, example: 321.130.21.12

you will then be asked for a password for the user, which you need to provide.

Getting around

To manoeuvre to the right directory, you can use some of the following commands:

  • ls (list files and folders in the current directory)
  • cd (change directory)
    cd .. (change to parent directory)
    cd folder/folder1/folder2/ (go to a directory directly by typing the exact location)
  • use the ~ symbol to get back to the home directory. Example: cd ~

Doing things with files

You can manipulate files and folders by using the following commands.

cp
The cp command makes a copy of a file for you. For example, cp file foo makes an exact copy of the file whose name you entered and names the copy foo, but the first file will still exist with its original name. After you use mv, the original file no longer exists, but after you use cp, that file stays and a new copy is made.

mv
The mv command moves a file to a different location or renames a file. Examples are as follows: mv file foo renames the original file to foo. mv foo ~/Desktop moves the file foo to your desktop directory but does not rename it. You must specify a new filename to rename a file.

rm
Use this command to remove or delete a file in your directory. It does not work on directories that contain files.

mkdir
The mkdir command allows you to create directories. For example, mkdir music creates a music directory.

chmod
The chmod command changes the permissions on the files listed.
Permissions are based on a fairly simple model. You can set permissions for user, group, and world, and you can set whether each can read, write, and/or execute the file. For example, if a file had permission to allow everybody to read but only the user could write, the permissions would read rwxr–r–. To add or remove a permission, you append a + or a – in front of the specific permission. For example, to add the capability for the group to edit in the previous example, you could type chmod g+x file.

Example:

chmod 764 pics.html

owner group other
777 = rwxrwxrwx
755 = rwxr-xr-x
744 = rwxr–r–
644 = rw-r–r–

chown
The chown command allows the user to change the user and group ownerships of a file. For example, chown john file changes the ownership of the file to John.

How do I permanently delete my Facebook account?

I was quite surprised at how many hoops I had to jump through to permanently delete my Facebook account.

If you use the deactivation link from within your account preferences, the account is only deactivated and can be reactivated  at a later stage if you change your mind.

However, if you want to permanently delete your Facebook account, there doesn’t seem to be any way of doing so from within your account preferences.

I had to resort to searching for an external url via Google.

If you want to get off Facebook permanently, log into your account and use the following link:

https://www.facebook.com/help/delete_account

x


Angebot anfordern

Ich melde mich innerhalb von 24 Stunden zurück.