Reference to self:
1. Activate vhosts in XAMPP by going to http.conf and check if
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
is present (if commented out, uncomment it)
2. Set up http-vhosts.conf (usually inside "extra" folder) with below sample (change server admin, name and directories to the appropriate values)
NameVirtualHost *:80
<virtualhost>
ServerAdmin admin@server.com
DocumentRoot "D:\Dev\Sites\FolderOfSite"
ServerName site.localhost.com
ErrorLog "logs/site-localhost-com-error.log"
CustomLog "logs/site-localhost-com-access.log" common
<directory ev="" ites="" olderofsite="" public="">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</directory>
</virtualhost>
3. Change hosts file in Windows (usually c:\windows\system32\drivers\etc)
...
127.0.0.1 site.localhost.com
Pedro Magueija
Friday, September 23, 2016
Tuesday, April 19, 2016
Run Laravel Migrate on shared hosting
Hello everyone,
Had a project where we were using Laravel to build a small website. Turns out it is hosted on "shared hosting" without SSH to run command line commands to use Migrations or Seed.
After some research on the web, I found you can run the console commands from within routes. But this means having a route that could potential screw up the site.
But since it was possible I put together a tiny script that setup the console and runs the commands:
Now all that is needed it so upload the install.php script into the public folder, call it with www.my-site-url.com/install.php, and after it is finish delete it.
It's very important that the file is deleted after finishing.
You can find here how to configure Laravel on shared hosting. It's for version 4 but still applies to version 5.
Had a project where we were using Laravel to build a small website. Turns out it is hosted on "shared hosting" without SSH to run command line commands to use Migrations or Seed.
After some research on the web, I found you can run the console commands from within routes. But this means having a route that could potential screw up the site.
But since it was possible I put together a tiny script that setup the console and runs the commands:
Now all that is needed it so upload the install.php script into the public folder, call it with www.my-site-url.com/install.php, and after it is finish delete it.
It's very important that the file is deleted after finishing.
You can find here how to configure Laravel on shared hosting. It's for version 4 but still applies to version 5.
Tuesday, April 12, 2016
How to add a Local Nuget package source to Visual Studio 2015
I was dabbling with Nuget, creating some packages and at a certain point I needed to add as a dependency on of my very own, unreleased (meaning unpublished at Nuget.org) packages.
Almost by accident I stumbled upon a solution, and since I haven't really blogged much here it is and hopefully it'll help others:
Go to Tools > Options, on the left side explorer Find Nuget Package Manager and expand it.
Next select the Package Sources.
In the right side panel,
press the "add" button (1),
give it a descriptive name (2),
search for the directory that contain the packages (3),
press Update (4)
After that you should be able to install packages present on that directory.
This allows you to create packages and test how they work, without having to upload them to Nuget.org straight away.
Have fun.
Almost by accident I stumbled upon a solution, and since I haven't really blogged much here it is and hopefully it'll help others:
Go to Tools > Options, on the left side explorer Find Nuget Package Manager and expand it.
Next select the Package Sources.
In the right side panel,
press the "add" button (1),
give it a descriptive name (2),
search for the directory that contain the packages (3),
press Update (4)
After that you should be able to install packages present on that directory.
This allows you to create packages and test how they work, without having to upload them to Nuget.org straight away.
Have fun.
Wednesday, April 3, 2013
Evolution calendar reset
This is mostly a reminder on how to do it, but maybe other people might find it useful.
I had a problem after changing my default Google Calendar (this was another adventure) my calendar in Evolution kept failing sync with timeout.
Tried to simply right-click and delete, but it would again fail with timeout.
So, first backup (just to be sure), and shut evolution down.
Then I went into the $HOME/.local/share/evolution/calendar/system and deleted all entries on that directory.
Then launched gconf-editor and under apps->evolution->calendar there is an entry named sources.
Double click will take you to the another window where you can find which of the xml entries is the one from Google (usually it is the last one).
Delete all tag relating to your calendars. In the end should look like this:
<?xml version="1.0"?>
<group uid="xxxxxxxxxx.xxxx.x@machine-name" name="Google" base_uri="google://" readonly="no"></group>
Then just relaunched evolution. Everything is default now. Just reconfigure the Google Calendars and re-sync.
Best regards,
Pedro Magueija
I had a problem after changing my default Google Calendar (this was another adventure) my calendar in Evolution kept failing sync with timeout.
Tried to simply right-click and delete, but it would again fail with timeout.
So, first backup (just to be sure), and shut evolution down.
Then I went into the $HOME/.local/share/evolution/calendar/system and deleted all entries on that directory.
Then launched gconf-editor and under apps->evolution->calendar there is an entry named sources.
Double click will take you to the another window where you can find which of the xml entries is the one from Google (usually it is the last one).
Delete all tag relating to your calendars. In the end should look like this:
<?xml version="1.0"?>
<group uid="xxxxxxxxxx.xxxx.x@machine-name" name="Google" base_uri="google://" readonly="no"></group>
Then just relaunched evolution. Everything is default now. Just reconfigure the Google Calendars and re-sync.
Best regards,
Pedro Magueija
Thursday, February 14, 2013
Create a evolved signature copy/paste
Hi everyone,
I again searched for the ability to attach a signature in SCN posts. But after reading this thread I decided to come up with a way to quickly add a signature to a post.
For simple signature (just text) it takes just a key combination to add a signature. Here's how:
1) You'll need a clipboard manager named Ditto.
2) Install (during installation check to have Ditto start on system startup) and open it.
3) Create a simple text file with your signature and copy that text.
4) Left click the Ditto icon on the taskbar (where the windows clock is).
5) Check that your text appears on the list and right-click.
6) Select the Properties on the context menu.
7) Check the Never Auto Delete.
8) Check the Hotkey available globally.
9) Define the Hot Key.
That's it. Now in your post (once you are finished) just press the key combination that you defined.
This also works for HTML, but you'll need to use the Advanced Editor, and Insert Raw HTML. This allows more elaborate signatures.
Best regards,
Pedro Magueija
Wednesday, December 5, 2012
SAP B1 Forms Session
Forms Session
One of the
difficulties when dealing with SAP B1 is the “stateless”
condition that object have between events fired on the UI.
If one creates
a class that handles the events for a given form then just creating a
simple static variable would solve the “stateless” problem, but
when you wish to have more then one instance of the form then this
approach does not work.
To work around
this I came up with the class below, which uses the FormUID (the
unique identifier of the form) to identify the object that belongs to
it. Meaning that you create your object and store it by using the
FormUID as the key.
When an event
gets fired you simply ask the FormsSession object to return you the
object stored for the FormUID. This takes care of both problems, the
“stateless” condition and the single class object.
One thing not
to forget is to remove the object from the Session when the form
closes (or like I intent to do, improve this class to auto-register
to the close event and remove the stored object automatically).
public
class
FormsSession<T>
where
T : class,
new()
{
private
static
Dictionary<string,
T> _container = new
Dictionary<string,
T>();
public
void
Add(string
FormUID, T FormObject)
{
if
(_container.ContainsKey(FormUID))
_container[FormUID]
= FormObject;
else
_container.Add(FormUID,
FormObject);
}
public
T Get(string
FormUID)
{
if
(!_container.ContainsKey(FormUID))
_container.Add(FormUID,
new
T());
return
_container[FormUID];
}
public
void
Remove(string
FormUID)
{
if
(_container.ContainsKey(FormUID))
_container.Remove(FormUID);
}
}
Multiple specific selection in SAP B1 ChooseFromList
I recently had the need to create a
selection type that would allow selection of specific values
(multiple ones) from a ChooseFromList. The basic case of single
selection and range selection also had to be supported.
As an example, consider the
ChooseFromList from Items. I needed to be able to select A1, A3, A5 –
A10.
The selection would look like A1,
A3, A5, A6, A7, A8, A9, A10. In other words A2, A4 would be ignored
as they were not on the selection.
To achieve this, the multiple
selection on the ChooseFromList object was activated to be able to
select multiple values. But, the EditText which “contains” the
ChooseFromList can only contain one object and it was linked with a
UserDataSource (which allows only one value to be saved). In order to
save the multiple selected values a DataTable was added to the form’s
data source collection.
<DataTables>
<DataTable
Uid="DT_0">
<Columns/>
</DataTable>
</DataTables>
Once the DataTable was added the
ChooseFromList event could now be used to save the selected values
into this DataTable.
if
(cflEvent.SelectedObjects != null
&& cflEvent.SelectedObjects.Rows.Count == 1)
{
oItem.TextStyle
= (int)BoTextStyle.ts_PLAIN_FONT;
string
SelectedValue =
cflEvent.SelectedObjects.GetValue(e.ChooseFromListAlias, 0) as
string;
d.ValueEx
= SelectedValue;
}
else
if(cflEvent.SelectedObjects
!= null
&& cflEvent.SelectedObjects.Rows.Count > 1)
{
oItem.TextStyle
= (int)BoTextStyle.ts_BOLD;
string
SelectedValue =
cflEvent.SelectedObjects.GetValue(e.ChooseFromListAlias, 0) as
string;
d.ValueEx
= SelectedValue;
selection.CopyFrom(cflEvent.SelectedObjects);
}
Some care had to be taken in order
to clear the DataTable every time the selection on this particular
ChooseFromList was changed.
For this, a simple XPath expression
is evaluated to check the current ChooseFromList allows for multiple
selections. If so, then it clears the DataTable before saving the new
selection.
DataTable
selection = oForm.DataSources.DataTables.Item("DT_0");
XPathDocument
doc = new
XPathDocument(new
StringReader(oForm.GetAsXML()));
XPathNavigator
nav = doc.CreateNavigator();
string
xpath =
string.Format("//ChooseFromList[@UniqueID='{0}']/@MultiSelection",
e.ChooseFromListUID);
XPathNodeIterator
iter = nav.Select(xpath);
iter.MoveNext();
if
(iter.Current.Value == "1")
selection.Clear();
After adding the values to the
DataTable the user is given a hint that multiple values are selected
by making the text on the EditText bold. Also if a user double clicks
the text on the EditText a small Grid displays the selected objects.
Subscribe to:
Posts (Atom)