Mentor's blog

Windows: environment variables Java

Usually we define the environment variables for Java in this way: JAVA_HOME-> C:\Program Files\Java\jdkx.x.x_xx Path-> C:\Program Files\Java\jdkx.x.x_xx\bin but the best way to define the environment variables for java is the following: JAVA_HOME-> C:\Program Files\Java\jdkx.x.x_xx Path-> %JAVA_HOME%\bin

Windows: batch to simultaneously uninstall multiple KB updates

In Windows to list the installed updates we can use these commands and to uninstal simultaneously multiple updates we can use the batch suggested here : @echo off for /f %%i in ('type c:\list.txt') do ( echo "Uninstalling KB%%i" wusa /uninstall /kb:%%i /quiet /norestart ) echo "Uninstallations Complete." echo.echo "Rebooting..." echo. shutdown /r In the file list.txt we have to indicate only the...

Boost'cache lifetime ignored in Drupal 7: how to solve the problem

Sometime in Drupal 7 the Boost 's cache is flushed during the cron without respecting the Boost maximum cache lifetime setting, this happens when the cron is running and there is an attempt to re-run it, something goes wrong and the Boos'ts cache is flushed. To solve this problem i made that the Boost's hook_cron is executed for last using the function hook_module_implements_alter : function...

Signal lost after selecting USA Band in menu *#*#4636#*#*: how to solve the problem

In some android phone we can access at the advanced menu *#*#4636#*#* in which we can change some baseband settings including the radio band. In some case after selecting the USA Band in this menu the signal goes down, we lose every network connection, and we can't do nothing to restore the network. In this case the only real solution is to re-flash the radio through fastboot, this is the command...

Drupal 7: how to get the body of a node

If in Drupal 7 we have to use the content of the body of a node as variable then we can get it through php, everything is really simple, we only have to give attention if the site uses only one language or if it is a multilanguage site. If the site use only one language we can get the body of a node in this way: $body = $node->body['und'][0]['value']; If the site is a multilanguage site we can...

Drupal 7: how to get absolute path url or path alias url of a node

In Drupal 7 we can access to a node through its absolute path url or through its path alias. In some case it is really useful get these urls and as usually in drupal we can do this in a lot of ways, here there are some examples. Code to get absolute url: global $base_url; $nodeurl = $base_url . '/' . current_path(); $nodeurl = url('node/'. $node->nid); Code to get path alias url: $nodeurl =...

Drupal 7: how to detect when a node or a comment is changed from unpublished to published or vice versa

In Drupal 7 we don't have a simple way to detect when a node or a comment switches from published to unpublished or vice versa but we can detect these actions with some php code. Node publishing: isset($node->original->status) && $node->original->status == 0 && $node->status == 1 Node unpublishing: isset($node->original->status) && $node->original-...

Drupal 7: how to enable\disable comment of old nodes

In Drupal 7 we can set the comments in three ways: Hidden: No comments are allowed, and past comments are hidden. Closed: No comments are allowed, but any past comments remain visible. Open: Any future content of this type is open to new comments. We can change in any moment the default comments' settings for any content type but the new choice will be valid only for the new nodes and not for the...

Android: how to manually set the network via terminal

If we want manually set the network in Android, for example 2G or 3G, then we can use a simple command via the terminal or via adb. For the Motorola Stock Rom we can use this command: am broadcast -a com.android.phone.CHANGE_NETWORK_MODE --ei networkMode *VALUE* For the AOSP Rom we can use this command: am broadcast -a com.android.internal.telephony.MODIFY_NETWORK_MODE --ei networkMode *VALUE*...

Linux: show apt history

At the moment the Linux distribution that I'm using is Debian, the packages manager that I'm usually to use in it is the apt and the simplest way to check apt-history is to use the bash script apt-history . With apt-history we can check the list of packages installed, removed or upgraded with apt. As we can see the last update of the script has been wrote the 26/02/2005 but it is correctly...

Pages

Subscribe to RSS - Mentor's blog