Home
Clipboard to SQL
- Details
This simple little program takes something copied into the clipboard ( excel rows, MySQL Work bench Rows,etc.) and let you output them into SQL statements with some options.
- First Copy your stuff to the clipboard.
- Adjust your settings and create your SQL statement
- Click Process
- Click Copy Text Below to Clipboard
The SQL when you first load looks like this:
insert into [onPoint].[web].[calendar] (calender_id,title,location,start_time,end_time)values('1',!c0!,!c1!,!c2!,!c3!);
the !c0! , !C1!, etc.. are values that will be swapped with what shows up in the data grid after you click Pull from clipboard.
When you process for each row in the data grid you will have a row of your SQL with the swapped values in the bottom left text box.
Adobe Acrobat Pro DC Collate Reverse Order
- Details
If you ever scanned documents into a PDF and now you have two sets of PDFs; one with odd number pages and the other with even number page in reverse order and you want to make them merge into one PDF with the correct ordering then you will not be able to do this easily in Adobe DC unless you enable scripts.
First you will need to allow JavaScript to be ran in Adobe Acrobat Pro DC
Click Edit menu, then Preferences.
Left hand side click JavaScript
Check Enable Acrobat JavaScript
Check Enable menu items JavaScript execution privileges
Check Enable global object security policy
Close Adobe Acrobat Pro
In windows go to the folder: C:\Program Files (x86)\Adobe\Acrobat DC\Acrobat\Javascripts
and copy the attached file to that directory
or Copy the code below and save in a file called CollateAndOrder.js
app.addMenuItem({ cName: "Reverse", cParent: "Edit", cExec: "PPReversePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 }); app.addMenuItem({ cName: "Collate", cParent: "Edit", cExec: "trustedCollatePages();", cEnable: "event.rc = (event.target != null);", nPos: 0 }); function PPReversePages() { var t = app.thermometer; t.duration = this.numPages; t.begin(); for (i = this.numPages - 1; i >= 0; i--) { t.value = (i-this.numPages)*-1; this.movePage(i); t.text = 'Moving page ' + (i + 1); } t.end(); } trustedCollatePages = app.trustedFunction(function() { app.beginPriv(); var arRect = new Array(); arRect[0] = 0; arRect[1] = 0; arRect[2] = 0; arRect[3] = 0; var f = this.addField("txtFilename", "text", this.numPages - 1, arRect); f.delay = true; f.fileSelect = true; f.delay = false; f.browseForFileToSubmit(); if(f.value==null || f.value == ''){ app.alert("You didn't select a PDF file to collate with."); }else{ var fileExt = f.value.substr((~-f.value.lastIndexOf(".") >>> 0) + 2); if(fileExt.toLowerCase() != "pdf"){ app.alert("You must select a PDF file type."); }else{ var evenDocPath = f.value; var q = this.numPages; for (var i = 0;i < q; i++) { var j = i*2; this.insertPages(j, evenDocPath, i); } app.alert("Collate complete."); } } this.removeField("txtFilename"); app.endPriv(); })
You will first want to open the file you need to sort or reverse order.
Open the the PDF and go to the Edit menu and click Reverse. Make sure your pages are in the correct order and save.
Close that file and now open the PDF with the first page number. Click Collate and select the PDF with the other set of pages and click OK. Now save it. Done!
New vdir website shell script
- Details
This is a simple script to setup a vdir and folder for Apache on Ubuntu:
First make a template file for the Apache config
First:
nano /etc/apache2/sites-available/template.conf
<VirtualHost *:80>
ServerAdmin
ServerName newsite
ServerAlias newsite
DocumentRoot /var/www/newsite/public_html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
#save the above
Second:
nano createweb.sh
echo "Setting up website: $1"
sitename=$1
sudo mkdir /var/www/$1
sudo mkdir /var/www/$1/public_html
sudo chown -R ubuntu:ubuntu /var/www/$1/public_html
sudo cp /etc/apache2/sites-available/template.conf /etc/apache2/sites-available/$1.conf
sed -i "s/newsite/$sitename/g" /etc/apache2/sites-available/$sitename.conf
sudo a2ensite $sitename.conf
sudo chown -R www-data:www-data /var/www
sudo service apache2 restart
Third:
Now give accesss to run
chmod +x createweb.sh
Fourth:
Now test it:
./createweb.sh mylamesite.com
Office and error 80070005
- Details
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)).
If you need to give access for the web server to use office automation the easiest way is to just open dcom.
1. In DCOMCNFG, right click on the My Computer and select properties.
2. Choose the COM Securities tab
3. In Access Permissions, click "Edit Defaults" and add Network Service to it and give it "Allow local access" permission. Do the same for <Machine_name>\Users.
4. In launch and Activation Permissions, click "Edit Defaults" and add Network Service to it and give it "Local launch" and "Local Activation" permission. Do the same for <Machine_name>\Users
You may need to add IUSR and IIS_USRS depending on your configuration
Also, you have to install office on the web server for this to even work at all.
Installing just o2010pia will do nothing for you.
If you are creating office documents within a IIS website user file permissions is going to be crucial.
I recommend creating a local user account on the web server and running your application pool under that user.
You will also want to login as that user on the web server and open the office application you plan to automate. You might get the "enter your initial" box when first opening the application and this is what is happening during automation of an office document so it errors.
You get things like
Exception message: Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution
Page 4 of 40