Tuesday, January 5, 2016

TODO:

Read these later:

http://stackoverflow.com/questions/17436678/manytomany-relationships-with-doctrines-querybuilder-and-symfony2

http://stackoverflow.com/questions/5197710/symfony-generator-forms-doctrine-and-mn-relationships

http://stackoverflow.com/questions/15977529/symfony2-doctrine-and-forms-persisting-the-data-of-both-sides-of-a-1-relat


Add commentary regarding my problem.

Monday, January 4, 2016

Symfony2, Doctrine ORM intermediate complexity transitive relationships


I am not sure how to explain this exactly, but I'll give it my best shot. If anything is unclear, please ask.

In my simplified concept, I have a database where security officers can file reports. Logs are an entity, they have as foreign keys the Client (also an entity), and the Site (entity as well) which the LOG is referring to. However in the ERD, I have the relationship as follows: Many (or none) LOG refer to a (or none) CLIENT, a CLIENT has many (or none) SITE. Or visually in Crows foot notation as such:


Ignore the USERS entity and corresponding relationship for the moment. We are only concerned with the LOG, CLIENT, and SITE entities and cardinalities.


Within Doctrine, my relationships are modeled as follows:

Log.php

/** * @ORM\ManyToOne(targetEntity="GuardShack\ClientBundle\Entity\Site", fetch="EAGER") * @ORM\JoinColumn(referencedColumnName="id", nullable=true) */private $site;
/** * @ORM\ManyToOne(targetEntity="GuardShack\ClientBundle\Entity\Client", fetch="EAGER") * @ORM\JoinColumn(referencedColumnName="id", nullable=true) */private $client;

Site.php
/** * @ORM\ManyToOne(targetEntity="GuardShack\ClientBundle\Entity\Client", fetch="EAGER") * @ORM\JoinColumn(referencedColumnName="id", nullable=true) */private $client;


This feels redundant, and is admittedly slightly different from my ERD.



The desired behavior is to have the create new Log form have drop down selects for client name and site name. When the client name is selected this limits the options in the site drop down select box to only those sites that are owned by that client.

Any "How Tos" for this sort of thing? I know this isn't ground breaking or anything, but I am just having a hiccup with it.



Maybe a better ERD:




Sunday, January 3, 2016

Symfony2 and Doctrine issues...



Symfony2 issues...



Here is what happens when I try to run the command to generate entities for this




However it works fine for other php classes:



Here is the code in question that I am trying to generate entities from:
Any ideas?

Log.php
<?php
namespace GuardShack\ReportBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use GuardShack\UserBundle\Entity\User;
use GuardShack\ClientBundle\Entity\Site;
use GuardShack\ClientBundle\Entity\Client;
/**
 * Log
 *
 * @ORM\Table(name="gs_log")
 * @ORM\Entity(repositoryClass="GuardShack\ReportBundle\Entity\LogRepository")
 */
class Log
{
    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;
    /**
     * @var string
     *
     * @ORM\Column(name="title", type="string", length=255)
     */
    private $title;
    /**
     * @var string
     *
     * @ORM\Column(name="body", type="string", length=255)
     */
    private $body;
    /**
     * @var \DateTime
     *
     * @ORM\Column(name="dtg", type="datetime")
     */
    private $dtg;
    /**
     * @ORM\ManyToOne(targetEntity="GuardShack\UserBundle\Entity\User", fetch="EAGER")
     * @ORM\JoinColumn(referencedColumnName="id", nullable=false)
     */
    private $author;
    /**
     * @ORM\ManyToOne(targetEntity="GuardShack\ClientBundle\Entity\Site", fetch="EAGER")
     * @ORM\JoinColumn(referencedColumnName="id", nullable=true)
     */
    private $site;
    /**
     * @ORM\ManyToOne(targetEntity="GuardShack\ClientBundle\Entity\Client", fetch="EAGER")
     * @ORM\JoinColumn(referencedColumnName="id", nullable=true)
     */
    private $client;
    /**
     * @ORM\ManyToOne(targetEntity="GuardShack\ReportBundle\Entity\Type", fetch="EAGER")
     * @ORM\JoinColumn(referencedColumnName="id", nullable=true)
     */
    private $type;
    /**
     * Get id
     *
     * @return integer
     */
    public function getId()
    {
        return $this->id;
    }
    /**
     * Set title
     *
     * @param string $title
     *
     * @return Log
     */
    public function setTitle($title)
    {
        $this->title = $title;
        return $this;
    }
    /**
     * Get title
     *
     * @return string
     */
    public function getTitle()
    {
        return $this->title;
    }
    /**
     * Set body
     *
     * @param string $body
     *
     * @return Log
     */
    public function setBody($body)
    {
        $this->body = $body;
        return $this;
    }
    /**
     * Get body
     *
     * @return string
     */
    public function getBody()
    {
        return $this->body;
    }
    /**
     * Set dtg
     *
     * @param \DateTime $dtg
     *
     * @return Log
     */
    public function setDtg($dtg)
    {
        $this->dtg = $dtg;
        return $this;
    }
    /**
     * Get dtg
     *
     * @return \DateTime
     */
    public function getDtg()
    {
        return $this->dtg;
    }
    /**
     * @return User
     */
    public function getAuthor()
    {
        return $this->author;
    }
    /**
     * @param User $author
     */
    public function setAuthor(User $author)
    {
        $this->author = $author;
    }
}

Thursday, September 26, 2013

How to force a browser refresh

Generally speaking, ALT-F5 will do a non-cached refresh, while F5, CTRL-R, and Refresh button will do a cached refresh. That is, the browser will not retrieve the latest information from the server, unless you perform a ALT-F5.

Firefox

  1. 1
    Press and Hold Alt (while Clicking Refresh in the TOOLBAR)

  2. 2
    Tools => Options => Advanced => Network => Offline Storage => Clear Now


Internet Explorer

  1. 1
    Press and Hold Ctrl-F5 (CTRL-R does a Cached Refresh)

  2. 2
    Press and Hold Ctrl (while Clicking Refresh in the TOOLBAR)

  3. 3
    Tools => Internet Options => General => Browser History => Delete


Netscape Navigator

  1. 1
    Press and Hold Ctrl-F5

  2. 2
    Press and Hold Ctrl-(while Clicking Refresh in the TOOLBAR)


Opera

  1. 1
    Press F5

  2. 2
    Press and Hold Shift-(while Clicking Refresh in the TOOLBAR)

  3. 3
    Tools => Preferences => Advanced => History => Empty Now


Apple Safari

  1. 1
    Press and Hold Ctrl-F5

  2. 2
    Press and Hold Ctrl-(while Clicking Refresh in the TOOLBAR)

  3. 3
    Press and Hold Ctrl-Alt-E or ( Edit => Empty Cache )


Google Chrome

  1. 1
    Press and Hold Ctrl-F5

  2. 2
    Press and Hold Ctrl-(while Clicking Refresh in the TOOLBAR)

  3. 3
    WRENCH => Tools => Clear Browsing data => Select Options, then "Clear Browsing data"

Sunday, August 18, 2013

How to add an RSS Feed to your Blogger Blog, 5 easy steps.

Thought this might help a couple folks:


Step 1. Acquire the URL to the feed that you would like to add.
In this case, I just brought up the context menu and clicked "Copy link address"

Step 2.  Go to your account dashboard and click "Layout"
Step 3. Click "Add a Gadget"
This will bring up a new window. If you don't see it, look for it behind your other windows.
Step 4. Scroll down and click "Feed"

Still with me? :-)

Step 5. Add the Feed URL to the dialog box. Click "Continue".

If you copied it to your clipboard, you can just "Ctrl-v" and paste it right in.
Easy peezy!







Sunday, August 11, 2013

For those of your who code PHP, please see the enclosed link.

There is far too much disinformation running around out there on the Intertoobs about which way to code PHP. Best practices are seemingly in conflict from source to source, or just missing altogether.

To solve that, check this out:

http://www.phptherightway.com/

Do it!

Thursday, April 4, 2013

"Help, I've been blacklisted/greylisted on Drupal.org!" - Here is some insight into this problem.

When attempting to access drupal.org, some users have reported seeing something about "http:BL" had greylisted them.

What is http:BL?
Http:BL is a way for website administrators to take advantage of the data generated by Project Honey Pot and keep malicious or suspicious IPs off their websites. The service works by publishing DNS records for IPs we have seen conducting suspicious or malicious behavior online. Website administrators can then use this data in order to restrict access to their web servers for these IPs.
 
The fact that you have been greylisted or blacklisted means that "Project Honeypot" has determined that your IP has been connected with questionable activity. According to Project Honeypot:

"Project Honey Pot is the first and only distributed system for identifying spammers and the spambots they use to scrape addresses from your website. Using the Project Honey Pot system you can install addresses that are custom-tagged to the time and IP address of a visitor to your site. If one of these addresses begins receiving email we not only can tell that the messages are spam, but also the exact moment when the address was harvested and the IP address that gathered it."

 You can contact site administrators to get your IP address "whitelisted", this allows your IP to connect to their servers once again. In the case of Drupal use http://drupal.org/httpbl/whitelist  The delay between submitting the request to become whitelisted and it actually happening will increase each subsequent time you get greylisted. Additionally ask for support in the IRC channel #drupal-infrastructure. Even if you can't access IRC directly for whatever reason you can access it easily using http://webchat.freenode.net/
Of course you could also use a proxy, something like www.hidemyass.com 

In any case, I would run a full scan on your system to make sure you don't have any malware/etc running that could be carrying out spam or DDOS activities from your computer. This will result in your IP being greylisted again.