Thursday, May 26, 2016

This was from the 90s, remember that guy in front of a tank in the Tiananmen Square ? Portugal at the time had Macau, I believe those troops have been send to there, with Chinese tanks running in the middle of the roads and the Portuguese army mostly acting like an UN army, which means only shooting in last case if your life is in danger, so if they wanted to stop a tank they would place themselves in front of it, but just in case the tank didn't stop they would then roll down the tank or to the side.

https://www.reddit.com/r/WTF/comments/334ml9/portuguese_army_training/

BASE SECRETA EM OVAR

Eu tive um vizinho que jurou várias vezes a mim que a Avó dele tinha trabalhado em instalações secretas na Base de Maceda/Ovar, numa espécie de base secreta subterrânea (para além da que existe e é visivel).

 que até o final da Guerra Fria havia uma base secreta em Ovar onde estavam escondidas armas nucleares da NATO.

 Também me lembro que se dizia que o Comando da NATO em Oeiras tinha um elevador que levava as pessoas para vários níveis abaixo de terra e que havia um cais subterraneo para submarinos em Oeiras.

 Já estive em Maceda, que me serviu de voos em alguns aparelhitos mais rústicos.

A menos que se tenha feito algum milagre de engenharia, constato:

solo arenoso;
nível freático elevado que exige cuidados suplementares na impermeabilização;
ambiente húmido salino.

A apróximação à base é feita através de florestas de pinheiros, na sombra, o que deve aumentar a sensação de "mistério".


Bem a titulo de curiosidade, sei que houve planos para a construção de uma base americana, durante a guerra fria, no cimo da serra da Cabreira em Vieira do Minho (Gerês)... ainda  hoje ha vestigios das obras então iniciadas. Alguem tem mais informações sobre esta materia? Esta zona ainda é nos nossos dia utilizado como area de treinos e fogo real para exercicios e preparação dos militares (nomeadamente do regimento cavalaria de Braga).

 http://www.forumdefesa.com/forum/index.php?topic=8525.0

SIS has intervened in Tecnia /Ferreira Court case in force of authorizations based on the assumption that Tecnia /Erdevel case is involving "state secrets." This is a "privilege" that is used rarely in US, and with prudence, because of the strong roots of civil rights; such a use in Portugal for a fraud in indirect offset, that is treated at the same level of terrorists's and suspected terrorists's renditions, is absolutely out of any state security logics.

 The level of civil actions by Erdevel Europa - LGT and the request for Tecnia's bankrupcy by a shell company based in Liechtenstein is problematic. The disappearance of papers from the trial, the silence of Ferreira's lawyers about it, the presentation of fake and counterfeited documents by Erdevel, Lovells, and VdA, Pocalyko's patent and embarrassing perjuries in Torres Vedras Court, the involvement of a legal company paid by the state (Rui Pena, Arnault: a partner is secretly :-) in the Defense Commission and the other Partner is a former Minister of Defense) are the clear signs the SIS was involved in court. SIS is responsible, that is, there is no evidence of corruption of the judge. SIS intervention is unjust, but "legal," that is authorized by the executive branch.  There is, however, a seriously illegal aspect of their intervention, that is, they should have claimed that it was no matter for civil/criminal courts, but a matter pertaining to the executive branch (PM, Defense minister, SIS, etc). Openly.

  The reason why they did not claim secrecy privilege in court, forcing the end of the public trial, is at least based on two points:

     1)  There is an economic issue at stake, money for the damages they have provoked or they have permitted to be done to Tecnia and to your family. Culpa in vigilando, at least: they knew about the offset and the pre-offset, since they authorized and certified it.

     2)  There is a problem to claim state secret privilege for an environmental indirect offset, even if it is connected with 300 mil euro Portuguese purchase from Styer / General Dynamics.

SIS is extremely strong within Portugal's borders, with several dissuasions methods for journalists and lawyers. I still wonder how you have been able to put up with their pressure so far. Maybe you are more Portuguese than Isabel, Rui Vicente and Antero Luis, that is, you are more stubborn.

The illegality is that they are acting in this way because they want you to pay for other civil servants's mistakes in the evaluation of Pocalyko / Erdevel Europa indirect offset fraud, for the lack of supervision by CPC and Pedro Catarino, etc.

These are not unfortunate events, acts of God, or effects of the global economic crisis:  Erdevel Europa is a planned fraud, still stealing money from Portugal's taxpayers (not only from you and your family).
This also implies personal responsibility by some civil servants and your rights to claim state compensation for what happened in the Erdevel Europa / LGT fraud.
 The Erdevel Europa Ponzi Pocalyko frauds are  more and more  a nightmare for Portuguese and  also several European Politicians.
The problem in fact  was  easy to solve,  like the Belgians  did. But  it became  a terrible mess in Portugal, where  Pocalyko and his Offset Gang decided  that  it would  be possible to convince  Judges, Prosecutors,  Lawyers,  Ministers,  and  so many others, that   I was  the "escape got" for  the  whole  ponzi Pocalyko frauds.
The case is  now entering  into the  most intense fight: in one  side, the  Judicial system ignoring all the evidences of the  Pocalyko frauds, on  another  side all the politicians  "whistler to the side", as  if they  have nothing to do with the case.
An example: the insolvency classification of Tecnia, if  continues with  the same  mistakes ( if not to say a  real bad  comment about  the  Judge), may  represent an illegal emission of  up to 15 million  euro CPC certificates  in favor to Steyr/ General Dynamics?  Or to say  the same : the Portuguese State  will lose 15 million euro offsets. Just with a  " manipulated "   insolvency classification obtained  over a criminal abuse of the  law and  justice to  obtain  a fraudulent  insolvency of  Tecnia.
This is just  an example.
The  big problem  started in 2003:
in 2003 somebody  in political / state authorities authorized in Portugal, Belgium, Italy and Germany  a clandestine ( thus illegal ) indirect offset, assembled  by Michael Pocalyko.
why was  this  illegal and  clandestine  offset  authorized ?
The answer to this question is  well known by SIS, for sure.
So, they  just need  to  solve the  scandal,   as  it urges.
The  very  next weeks, we  will be  looking into  the authorities and  observing their behavior: we  ask the State authorities  to produce  a clear  and  public  statement about  the case. Citizens  have  the right to be  informed and  to  know what  the State  have to say about the  Ponzi Pocalyko offset frauds  against  Portugal, Belgium, Italy, Germany and Saudi Arabia.
If they  keep hiding the case, as  they have  been doing until now, then   we   will be sure  about  the  case.

why not change the mobile chargers and laptop baterries from security clearance personnel while they're out ??? and plug in on a new replacing one, with an wifi regulator access microcontroller

Over the past year, the ESP8266 has been a growing star among IoT or WiFi-related projects. It’s an extremely cost-effective WiFi module, that – with a little extra effort – can be programmed just like any microcontroller. Unfortunately, the ESP8266 has mostly only been available in a tiny, modular form, which, with limited I/O and a funky pin-out, can be difficult to build a project around.
ESP8266 WiFi Module

Saturday, May 21, 2016

Let's say thanks to Deek !!! first you can not digitalized a bank note on photoshop...they deny it!! so here's how to it you digitalize withAdobe Imageready and click the photoshop link and save as psd file and then open again in photoshop: thanks Deek, really ne et!

 http://cons.wonderhowto.com/how-to/print-counterfeit-money-1462/ 

FOR THE WATER MARK LAQUEAR BASE 

 
http://moabpaper.com/desert-varnish-spray/

FOR THE 20 EUROS PRINTING, THE COLOUR INK:

http://www.gouletpens.com/diamine-majestic-blue-80ml-bottled-fountain-pen-ink/p/D7056

Saturday, May 14, 2016

IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

/** An actor that slices the input bits and output a consecutive subset
 of the input bits.

 Copyright (c) 1998-2010 The Regents of the University of California.
 All rights reserved.
 Permission is hereby granted, without written agreement and without
 license or royalty fees, to use, copy, modify, and distribute this
 software and its documentation for any purpose, provided that the above
 copyright notice and the following two paragraphs appear in all copies
 of this software.

 IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY
 FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
 ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
 THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF
 SUCH DAMAGE.

 THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
 INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE
 PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF
 CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES,
 ENHANCEMENTS, OR MODIFICATIONS.

 PT_COPYRIGHT_VERSION_2
 COPYRIGHTENDKEY

 */
package ptolemy.actor.lib.vhdl;

import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;

import ptolemy.actor.TypedIOPort;
import ptolemy.data.FixToken;
import ptolemy.data.IntToken;
import ptolemy.data.StringToken;
import ptolemy.data.expr.Parameter;
import ptolemy.data.expr.StringParameter;
import ptolemy.data.type.BaseType;
import ptolemy.kernel.CompositeEntity;
import ptolemy.kernel.util.IllegalActionException;
import ptolemy.kernel.util.NameDuplicationException;
import ptolemy.math.FixPoint;
import ptolemy.math.FixPointQuantization;
import ptolemy.math.Overflow;
import ptolemy.math.Precision;
import ptolemy.math.Rounding;

///////////////////////////////////////////////////////////////////
//// Slice

/**
 Produce an output token on each firing with a FixPoint value that is
 equal to the slicing of the bits of the input token value. The bit width of
 the output token value is determined by taking the difference of parameters
 start and end. The width parameter specifies the bit width of the input
 value. The output FixPoint value is unsigned, and all its bits are integer
 bits. The input can have any scalar type.

 @author Man-Kit Leung
 @version $Id: Slice.java 57040 2010-01-27 20:52:32Z cxh $
 @since Ptolemy II 6.0
 @Pt.ProposedRating Red (mankit)
 @Pt.AcceptedRating Red (mankit)
 */
public class Slice extends FixTransformer {
    /** Construct an actor with the given container and name.
     *  @param container The container.
     *  @param name The name of this actor.
     *  @exception IllegalActionException If the actor cannot be contained
     *   by the proposed container.
     *  @exception NameDuplicationException If the container already has an
     *   actor with this name.
     */
    public Slice(CompositeEntity container, String name)
            throws NameDuplicationException, IllegalActionException {
        super(container, name);

        input = new TypedIOPort(this, "input", true, false);
        input.setMultiport(true);
        input.setTypeEquals(BaseType.FIX);

        start = new Parameter(this, "start");
        end = new Parameter(this, "end");
        lsb = new StringParameter(this, "lsb");
        lsb.setExpression("LSB");
        lsb.addChoice("LSB");
        lsb.addChoice("MSB");
    }

    ///////////////////////////////////////////////////////////////////
    ////                     ports and parameters                  ////

    /**
     * The input port.
     */
    public TypedIOPort input;

    /**
     * The start index for the portion of the bits to be sliced.
     */
    public Parameter start;

    /**
     * The end index for the portion of the bits to be sliced.
     */
    public Parameter end;

    /**
     * Whether start and end index assumes LSB or MSB representation.
     */
    public Parameter lsb;

    ///////////////////////////////////////////////////////////////////
    ////                         public methods                    ////

    /** Output a consecutive subset of the input bits.
     *  If there is no input, then produce no output.
     *  @exception IllegalActionException If there is no director.
     */
    public void fire() throws IllegalActionException {
        super.fire();
        if (input.hasToken(0)) {
            FixToken in = (FixToken) input.get(0);
            int widthValue = in.fixValue().getPrecision().getNumberOfBits();
            int startValue = ((IntToken) start.getToken()).intValue();
            int endValue = ((IntToken) end.getToken()).intValue() + 1;
            boolean lsbValue = ((StringToken) lsb.getToken()).stringValue()
                    .equals("LSB");

            int newStartValue = (lsbValue) ? widthValue - endValue : startValue;
            int newEndValue = (lsbValue) ? widthValue - startValue : endValue;
            int shiftBits = (lsbValue) ? startValue : widthValue - endValue;

            char[] mask = new char[widthValue];
            Arrays.fill(mask, '0');
            Arrays.fill(mask, newStartValue, newEndValue, '1');

            BigDecimal value = new BigDecimal(in.fixValue().getUnscaledValue()
                    .and(new BigInteger(new String(mask), 2)).shiftRight(
                            shiftBits));
            Precision precision = new Precision(
                    ((Parameter) getAttribute("outputPrecision"))
                            .getExpression());
            if ((newEndValue - newStartValue) != precision.getNumberOfBits()) {
                throw new IllegalActionException(this, "Bit width of "
                        + (newEndValue - newStartValue)
                        + " is not equal to precision " + precision);
            }

            Overflow overflow = Overflow
                    .getName(((Parameter) getAttribute("outputOverflow"))
                            .getExpression().toLowerCase());

            Rounding rounding = Rounding
                    .getName(((Parameter) getAttribute("outputRounding"))
                            .getExpression().toLowerCase());

            FixPoint result = new FixPoint(value, new FixPointQuantization(
                    precision, overflow, rounding));

            sendOutput(output, 0, new FixToken(result));
        }
    }
}

BOOST SIEMENS

OPCHANDLE hClient;
    FILETIME ftTimeStamp;
    WORD wQuality;
    WORD wReserved;
    VARIANT vDataValue;

http://msdn.microsoft.com/en-us/library/ms220948(v=vs.80).aspx
http://vld.codeplex.com/downloads/get/342350
http://stackoverflow.com/questions/395123/raii-and-smart-pointers-in-c
http://www.microsoft.com/en-us/download/details.aspx?id=20028 
http://www.cplusplus.com/forum/general/8070/ 


#define _CRTDBG_MAP_ALLOC
#include 
#include  

//LEAKS
 _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );

$IpValue=[EDITA1]$Devices=[EDITA2]$Target=[TARGETDIR]


1) Create AgentConfigurationEx, then call "thread" 
2) thread reads all the configurations, spawns OPC clients per configuration
3) call Agent.main()



 # ResetAtMidnight determines whether service is reset at midnite
 ResetAtMidnight=false
 
 #User=.,auduser,SUNRISE

 Language=English

 # Synchronous read of data, if so how ofen (ServerRate) in ms 
 ServerRate = 1000
 QueryServerPeriod=5000
 AutoReconnectMaxAttempts=0 



 for(int i=0; i< _machines.size(); i++)
 {
  if(_machines[i]->IsConnected() )
  {
   try
   {
    // static boost::mutex _alarm_mutex; - declare as static in shared class...
    //boost::mutex::scoped_lock  lock(_alarm_mutex);
    _machines[i]->_CriticalSection.Lock();
    _machines[i]->ExportValues();
    _machines[i]->_CriticalSection.Unlock();

   }
   catch(...)
   {
    GLogger << INFO << "MtcOpcAdapter::gatherDeviceData() exception "  << std::endl;
   }
  }
 }
 /*
  Threading to allow service to behave properly at startup/shutdown
 */
 CWorkerThread<> _workerthread;
 CWorkerThread<> _enderthread;
 struct CStartThread : public IWorkerThreadClient
 {
  CStartThread()
  { 
   _hEvent.Attach(CreateEvent(NULL, TRUE, FALSE, NULL)); 
  }
  HRESULT Execute(DWORD_PTR dwParam, HANDLE hObject);
  HRESULT CloseHandle(HANDLE){ return S_OK; }
  CHandle _hEvent;
 } _StartThread;

 struct CEndThread : public IWorkerThreadClient
 {
  CEndThread()
  { 
   _hEvent.Attach(CreateEvent(NULL, TRUE, FALSE, NULL)); 
  }
  HRESULT Execute(DWORD_PTR dwParam, HANDLE hObject);
  HRESULT CloseHandle(HANDLE){ return S_OK; }
  CHandle _hEvent;
 } _EndThread;
 
 // OPC Specific threading to allow bad opc servers to reset
 CWorkerThread<> _resetthread;
 struct CResetThread : public IWorkerThreadClient
 {
  HRESULT Execute(DWORD_PTR dwParam, HANDLE hObject);
  HRESULT CloseHandle(HANDLE){ ::CloseHandle(_hTimer); return S_OK; }
  HANDLE _hTimer;
 } _ResetThread;
TODO:

1) SHDR Tags to finish:

1. uuid
2. manufacturer
3. station
4. serialNumber

0x80041008 WBEM_E_INVALID_PARAMETER

his is what I did in my vbs script to open a firewall exception for the service. I couldn't use the standard interactive pop-up for a service (that asks for permission to open the firewall), since it doesn't have a UI.

set oShell  = CreateObject("WScript.shell")
oShell.run "cmd /C netsh advfirewall firewall add rule program=""C:\Program Files (x86)\foo\bar\prog.exe"" name=""my-service"" dir=in action=allow"  
I added this vbs script to the "Commit" CustomAction of the Setup&Deployment Project, leaving the properties as defaults.

To debug problems with the vbs stage, I ran the msi from DOS using

msiexec /i mysetup.msi /L* install.log
Note that I originally used "Wscript.CreateObject" but that failed. This worked.

UINT result = 0;
TCHAR szQuery[] = "SELECT DefaultDir FROM Directory";
PMSIHANDLE hDB = NULL;
PMSIHANDLE hView = NULL;
PMSIHANDLE hRecord = NULL;
hDB = MsiGetActiveDatabase( hModule );
result = MsiDatabaseOpenView( hDB, szQuery, &hView );
result = MsiViewExecute( hView, hRecord );
while (MsiViewFetch( hView, &hRecord ) == ERROR_SUCCESS)
{
TCHAR szCurDir[MAX_PATH] = {0};
DWORD dwDirLen = MAX_PATH;
if (MsiRecordGetString( hRecord, 1, szCurDir, &dwDirLen) != ERROR_SUCCESS )
break; // fail. break out of the while loop.
// Do something. This sample code just pops up a message box. 
MsiMessageBox(hModule, szCurDir, MB_OK);
} 


2) Connecting to the Siemens 840D to receive shutdown notifications.
#import "IregieSvr.dll"

 CComPtr server;
 
 OutputDebugString("Connecting to Siemens 840D Regie Server");
 CComVariant v1=hwndMainFrame;
 CComVariant v2;
 ::ShowWindow(hwndMainFrame, SW_MINIMIZE);
 ::ShowWindow(hwndMainFrame, SW_SHOW);
 if(FAILED(hr=server.CoCreateInstance(__uuidof(RegieSvr), NULL, CLSCTX_SERVER)))
  throw CString (_T("CoCreateInstance Siemens 830D RegieSvr FAILED"));
 if(FAILED(hr=server->InitSvr(v1,v2)))
  throw CString (_T("InitSvr(v1,v2) FAILED"));
 if(FAILED(hr=server->InitCompleteEx()))
  throw CString (_T("InitCompleteEx FAILED"));

  std::string ipaddr="127.0.0.1,127.0.0.2";
  std::string devices="M1,M3";

  std::string contents; 
  ReadFile(::ExeDirectory()+"AgentShdr.ini", contents);

  ReplacePattern(contents, "ServerMachineName", "\n", "ServerMachineName=" + ipaddr + "\n");
  ReplacePattern(contents, "MTConnectDevice", "\n", "MTConnectDevice=" + devices + "\n");

  std::vector ips=TrimmedTokenize(ipaddr,",");
  std::vector devs=TrimmedTokenize(devices,",");
  if(ips.size() != devs.size())
   ::MessageBox(NULL, "Mismatched # ips and devices", "Error", MB_OK);
  std::string tagsection="SIEMENS";
  for(int i=1; i< ips.size(); i++)
  {
   tagsection+=",SIEMENS";
  }
  ReplacePattern(contents, "OpcTags", "\n", "OpcTags=" + tagsection + "\n");
  WriteFile(::ExeDirectory()+"AgentShdr1.ini",contents);