Author: GoldKeeperSnr

  • Configure Microsoft Live Writer to work with Drupal

    Hey! I’ve managed to configure Microsoft Live Writer to work with my Drupal install (see this URL).

    I had a minor issue configuring Microsoft Live Writer, where I couldn’t login as my non-administration user. Initially, I worked that that returning the edit privilege in Drupal “Authenticated Users” made it work. Since then I had a more detailed look at this issue. It seems that rights to the Blog API needed to be granted. After that, I managed to restrict the rest of the rights to more or less where they were before.

    So, now I might actually start using Live Writer… it’s much easier to blog this way (yes, I like to do things the easy way were ever possible).

  • Locally persist Bering changes

    Locally persist Bering changes

    So I decided to add an user wolagent and put the script into his home directory. The question is how to backup this user.  Simply using the ‘s’ – command from the Bering 3.x – menu doesn’t backup the user and his homedir. In short, there seemed to be no way to persist this Bering change locally.

    So how can I do that?
    Add your stuff to /var/lib/lrpkg/local.local

  • eBusiness Autoconfig Customisation

    Why customise?

    Autoconfig Customisation has the potential to make life much easier for an Oracle Applications DBA.

    In short, it enables the creation of controlled templates that can make all of the things that have to be done after running autoconfig go away.

    For example, generally after you run adautocfg.sh you then have to remember to comment out the mobile setting in the jserv files, otherwise the java server doesn’t start up. Wouldn’t it be nice to change the template so that it know that these should be commented out already? Well, with autoconfig customisation you can!

    There are a couple of different approaches to this, the simplest involves just changing the template. The second involves adding a customisation value to the context file and then modifying the template to use that value.

    Before we start

    Before anything else is done, we must validate that the current configuration is good.
    To do this run the following command (because of the profile we use, it is in our path):

    adchkcfg.sh contextfile=$CONTEXT_FILE appspass=

    The output of this is as follows:

    The log file for this session is located at: /home/aicprj04/ICPRJ04/appl/admin/I
    CPRJ04_ictap41/log/07211026/adconfig.log

    AutoConfig is running in test mode and building diffs...

    AutoConfig will consider the custom templates if present.
            Using APPL_TOP location     : /home/aicprj04/ICPRJ04/appl
            Classpath                   : /home/aicprj04/ICPRJ04/comn/java/jdk1.6.0_
    02/jre/lib/rt.jar:/home/aicprj04/ICPRJ04/comn/java/jdk1.6.0_02/lib/dt.jar:/home/
    aicprj04/ICPRJ04/comn/java/jdk1.6.0_02/lib/tools.jar:/home/aicprj04/ICPRJ04/comn
    /java/appsborg2.zip:/home/aicprj04/ICPRJ04/comn/java

            Using Context file          : /home/aicprj04/ICPRJ04/appl/admin/ICPRJ04_ictap41/out/07211026/ICPRJ04_ictap41.xml

    Context Value Management will now update the test Context file

            Updating test Context file...COMPLETED

            [ Test mode ]
            No uploading of Context File and its templates to database.

    Testing templates from all of the product tops...
            Testing AD_TOP........COMPLETED
            Testing FND_TOP.......COMPLETED
            ...
            Testing CSD_TOP.......COMPLETED
            Testing IGC_TOP.......COMPLETED

    Differences text report is located at: /home/aicprj04/ICPRJ04/appl/admin/ICPRJ04_ictap41/out/07211026/cfgcheck.txt
     
            Generating Profile Option differences report...COMPLETED
            Generating File System differences report......COMPLETED
    Differences html report is located at: /home/aicprj04/ICPRJ04/appl/admin/ICPRJ04_ictap41/out/07211026/cfgcheck.html

    Differences Zip report is located at: /home/aicprj04/ICPRJ04/appl/admin/ICPRJ04_ictap41/out/07211026/ADXcfgcheck.zip

    AutoConfig completed successfully.

    There are a couple of outputs, but I find the most useful output is the zip file. I generally copy this over and extract it out, then use a web browser to view the set of html pages. These explain what differences there are between what you have and what should be there. Ideally there should be no differences.

    ADX Config Report is here.

    The real benefit of this, is that you can look at the differences very easily and decide if they are important or not. Once the differences have been reviewed, and you are satisfied that the autoconfig baseline is correct, then we can move on to performing the customisation.

    Customise a template

    This is the simplest type of customisation as there is not additional variables.
    You might follow this approach if there was a need to add a comment permanently to a file (for example to add entries to url_fw.conf).

    To do this find the file that is needs to be changed and run the following:

    adtmpreport.sh contextfile=$CONTEXT_FILE target=

    The output will be like the following:

    #########################################################################
              Generating Report .....                                       
    #########################################################################
    For details check log file: /home/aicprj01/ICPRJ01/appl/admin/ICPRJ01_ictap37/log/07211256.log

    The important detail is in the log file:

    =================================================================
    Starting Utility to Report on Templates and their  Targets  at Mon Jul 21 12:58:36 BST 2008
    Using ATTemplateReport.java version 115.7
      

    [ INFO_REPORT ]

    [FND_TOP]
    TEMPLATE FILE   : /home/aicprj01/ICPRJ01/appl/fnd/11.5.0/admin/template/url_fw.conf
    TARGET FILE     : /home/aicprj01/ICPRJ01/comn/conf/ICPRJ01_ictap37/iAS/Apache/Apache/conf/url_fw.conf

    This indicates that if an addition needs to be made to the file urlfw.conf, then the template file is in $FND_TOP/admin/template and is called url_fw.conf

    Apparently, not all templates can be customised. If there is the word LOCK in the application driver file, then it is not customisable.
    So, in the above case, we should look for LOCK in $FND_TOP/admin/driver/fndtmpl.drv

    If the file is customisable, then the following steps need to be done:

    1. Move to the directory that contains the source template, and make a directory called custom.
      For example:
      cd $FND_TOP/admin/template
      mkdir custom
    2. Copy the template into here, and then make the change to it.
    3. Then you should verify the customisation using the command adchkcfg.sh command.
    4. Finally, run autoconfig to make the template properly.

    Adding a context variable

    Again, determine what the template that is going to be added as above. Then using Oracle Application Manager, add a new custom entry in the context file.

    Then create a custom template exactly as above. When making your changes, refer to the new context value. For example to allow for controlling of mobile entries using context values I added the following to jserv_ux_ias1022.conf:

    %c_DisableMobile%ApJServGroupMount /mobile              balance://OACoreGroup/mobile

    The %c_DisableMobile% is the custom value.

    Again, validate that the file is going to work right, and then run autoconfig to make the change.

    Final Note

    This is all based on Metalink Note 270519.1

  • Update Tripwire policy

    It’s pretty simple really.

    Just run this:

    sudo twadmin -m p > twpol.txt

  • Update Tripwire

    OK, only waited a few months before adding this!

    I’d recommend not doing this as root, as if you do, the root directory modification time will change as you modify twpol.txt. Also twpol.txt will change as you modify it.

    All of this means you’ll have to run 1-3 before you can run 4. And tripwire takes ages to run. Besides you should be using sudo anyway (you are right?!).

    1. Validate current policy

    sudo tripwire -m c

    2. Find the latest tripwire log

    sudo ls -lt /var/lib/tripwire/report/*.twr | head -1

    3. Use that to update the database

    sudo tripwire -m u -r <above file>

    4. Then update policy

    sudo tripwire -m p twpol.txt

    You should see this:

    Parsing policy file: twpol.txt
    Please enter your local passphrase:
    Please enter your site passphrase:
    ========
    Policy Update: Processing section Unix File System.
    ========
    Step 1: Gathering information for the new policy.
    The object: \"/lib/init/rw\" is on a different file system...ignoring.
    The object: \"/dev/.static/dev\" is on a different file system...ignoring.
    The object: \"/dev/pts\" is on a different file system...ignoring.
    The object: \"/dev/shm\" is on a different file system...ignoring.
    The object: \"/proc/bus/usb\" is on a different file system...ignoring.
    ========
    Step 2: Updating the database with new objects.
    ========
    Step 3: Pruning unneeded objects from the database.
    Wrote policy file: /etc/tripwire/tw.pol
    Wrote database file: /var/lib/tripwire/web-proxy.twd

    5. After the policy is accepted you need to run steps 1-3
    This is because if you don\’t and want to make further changes you\’ll see stuff like this:

    ========
    Policy Update: Processing section Unix File System.
    ========
    Step 1: Gathering information for the new policy.
    The object: \"/lib/init/rw\" is on a different file system...ignoring.
    The object: \"/dev/.static/dev\" is on a different file system...ignoring.
    The object: \"/dev/pts\" is on a different file system...ignoring.
    The object: \"/dev/shm\" is on a different file system...ignoring.
    The object: \"/proc/bus/usb\" is on a different file system...ignoring.
    ### Error: Policy Update Added Object.
    ### An object has been added since the database was last updated.
    ### Object name: /etc/tripwire/tw.pol.bak
    ### Error: Policy Update Changed Object.
    ### An object has been changed since the database was last updated.
    ### Object name: Conflicting properties for object /etc/tripwire
    ### > Size
    ### > Modify Time
    ### Error: Policy Update Changed Object.
    ### An object has been changed since the database was last updated.
    ### Object name: Conflicting properties for object /etc/tripwire/tw.pol
    ### > Modify Time ### > CRC32
    ### > MD5
    ========
    Step 2: Updating the database with new objects.
    ========
    Step 3: Pruning unneeded objects from the database. Policy update failed; policy and database files were not altered.

    This is because tripwire hasn\’t capture changes caused by the policy change.

    This might also be useful (I login as a normal user to do administration, so I want to do all of these sudo\’d). This script allows me to run a report, and then use that generated report to update the database.

    I call the script update_tripwire.bash

    #!/bin/bash
    sudo tripwire -m c
    sudo tripwire -m u -r $(/bin/ls -t /var/lib/tripwire/report/*.twr | head -1)

  • Configure Tripwire on Debian

    I have finally gotten around to configure the Tripwire setup on my Debian installation, after having it bleat at me for the last 3 years! I found details on http://articles.techrepublic.com.com/5100-10877_11-6034353.html which pointed me in the correct direction. My installation is Debian based, so it fitted the “no twinstall.sh” case shown most closely.

    I have had to tweak what the linked article says, slightly to make it work. I have also included the output that I saw, so you should know that you are in the correct place when you run the command (my principle is that sample output gives you the warm feeling that things are going well).

    First we should generate the site key:
    twadmin --generate-keys -S site.key
    (When selecting a passphrase, keep in mind that good passphrases typically have upper and lower case letters, digits and punctuation marks, and are at least 8 characters in length.)
    Enter the site keyfile passphrase:
    Verify the site keyfile passphrase:
    Generating key (this may take several minutes)...
    Key generation complete.

    Then generated the local key:
    twadmin --generate-keys -L ${HOSTNAME}-local.key
    (When selecting a passphrase, keep in mind that good passphrases typically have upper and lower case letters, digits and punctuation marks, and are at least 8 characters in length.)
    Enter the local keyfile passphrase:
    Verify the local keyfile passphrase:
    Generating key (this may take several minutes)...
    Key generation complete.

    Then had to edit the config template, before generating the configuration file:
    twadmin --create-cfgfile --cfgfile tw.cfg --site-keyfile site.key twcfg.txt
    Please enter your site passphrase:
    Wrote configuration file: /etc/tripwire/tw.cfg

    Then generated the policy file:
    twadmin --create-polfile --cfgfile tw.cfg --site-keyfile site.key twpol.txt
    Please enter your site passphrase:
    Wrote policy file: /etc/tripwire/tw.pol

    Set file permissions:
    chown root:root site.key $HOSTNAME-local.key tw.cfg tw.pol
    chmod 600 site.key $HOSTNAME-local.key tw.cfg tw.pol

    Finally, initialized the database:
    tripwire --init
    Please enter your local passphrase:
    Parsing policy file: /etc/tripwire/tw.pol
    Generating the database...
    *** Processing Unix File System ***
    ### Warning: File system error.
    ### Filename: /var/lib/tripwire/.twd
    ### No such file or directory
    ### Continuing... Wrote database file: /var/lib/tripwire/.twd
    The database was successfully generated.

    Then deleted the source file: rm twcfg.txt twpol.txt

    Haven’t run it for very long, so might update this if I have problems.

  • Compile an SRPM

    Download SRPM into a directory of choice. Generally files out to go into:

    /usr/src/redhat/SRPMS

    Then run:

    rpm --rebuild <file>-<version>.src.rpm

    This will then build the new RPM. Everything will then happen automatically, and the newly built RPMs will go here:

    /usr/src/redhat/RPM/<cpu-type>

    If the configuration file needs to be changed then run:

    rpm -i <file>-<version>.src.rpm

    The spec file will be extracted to:

    /usr/src/redhat/SPEC

    Generally it would be called:

    <file>-<version>.spec

    Changes can now be made to the spec file. Once the changes are complete the RPM needs to be made using it:

    rpm -bb --clean --rmsource <file>-<version>.spec

    If the build goes ok, the file will end up in the normal location:

    /usr/src/redhat/RPM/<cpu-type>

    Building a Kernel RPM (build UP and SMP Kernels)

    rpmbuild --target i386 --with up --with smp --without BOOT --without debug <spec file>
  • Testing MathJax

    Writing maths works as in LaTeX. Use dollar signs to enclose inline math, e.g. \(x^2\) \(x^2\) \(x^2\) $$x^2$$

    \(
    \begin{align}
    E &= mc^2 \\
    m &= \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}}
    \end{align}
    \)

    \(\int_{-\infty}^\infty e^{-\pi x^2}\,\mathrm{d}x=1\label{a}\tag{1}\)

    \ref{a}
  • This is a reasonably complete sample of using MathJax.

    Sample has been taken form here:
    https://groups.drupal.org/node/1263

    MathJax documentation is here:
    http://docs.mathjax.org/en/latest/

    Wonder how much of this works:
    https://yutsumura.com/mathjax-in-wordpress/

    Writing maths works as in LaTeX. Use dollar signs to enclose inline math, e.g. \(x^2\).

    Examples for paragraph math are \(x^2 \) and \(x^2\) (both variants are equivalent).

    There is also a display-style inline math environment, compare \(\sum_{k=1}^\infty \frac{1}{k}\) and \(!\sum_{k=1}^\infty \frac{1}{k}\).

    To make a dollar sign, you have to type \$ as in LaTeX!
    Using just $ doesn’t work.
    Latex: \(\$ \)
    and
    Latex: \($ \)

    Arbitrary LaTeX code can be rendered as in this example:
    Let $x^2$ be a natural number. 

    There are also more elaborate environments to write math – they support auto-numbering, referencing and more. These environments are <equation> and <equations>. They both support the same attributes.

    E.g. rendering an equation with a different resolution:
    <equation>e^{i \cdot \pi} = -1<equation>.

    To give the equation automatically a number, you have to give it an id:
    e^{i \cdot \pi} = -1.

    You now can produce a link to that equation by typing \\ref{euler}, or even better (\\ref{euler}).

    You can also give it a name instead of a number:
    e^{i \cdot \pi} = -1.

    An example for the <equations> environment is given by:
    \(
    \int \ln(x) \;dx
    &= \int 1 \cdot \ln(x) \;dx \
    &= x \cdot \ln(x) – \int x \cdot \frac{1}{x} \;dx \
    &= x \cdot \ln(x) – x
    \)

    The spaces on the left are optional.

    To prohibit some text from being processed by DruTeX, you can use <code> and <notex>:
    e.g. $x^2$
    or
    $x^2$
    Humm… doesn\’t work!

    \(\left(\int_{-\infty}^\infty e^{-x^2}\ dx\right)^2\ =\ \pi (\ref{test}) \)

    Extra bit

    \(e^{ \pm i\theta } = \cos \theta \pm i\sin \theta\)

  • Using drush with drupal

    Using drush has been remarkably simple.

    I downloaded it as instructed on their site, and it almost works straight away. It was annoying to keep having to tell drush the site to use with the -l flag though, so I have configured it for my needs.

    I did this by making a .drush directory, and copying the example aliases.drush.php and drushrc.php in. I then amended drushrc.php to refer to my site and install directory.

    Having done that I have then began to use it.

    I think being able to update the core using:

     drush up drupal 

    to be very cool!

    Similarly I can check the module status using:

     drush ups 

    Individual modules can be done using:

     drush up <module>

    And then I can download modules using (make sure you are in the right place!):

     drush dl <module>

    And then enable and disable modules using:

     drush <en|dis> <module> 

    In short, I really like drush!