So I decided to make this web application that a user could create a legal form in Microsoft Word (docx) format, and since my web site is in PHP, and I wanted to learn PHP better. Just a few issues:
1) PHP can't make a Word - .docx document easily. Sure, you can do your bits and bytes and try to decode the entire format. Docx is just an archive, and you can zip up the components, but then you can't get your compression ratio right, and Word tells you the document is malformed when your browser calls it and blah-blah fricken blah.
OK, so I figure, Java has libraries to do this, and do it easily. So I'll just make a Java program that will take the form data from the PHP generated form and make the docx. No problem at all, did this in a few hours with no knowledge of the java library that I used (docx4j).
OK, so I jar up the program, make a properties file for paths and so forth, and deploy said jar to the Apache server on a windows system where I'm developing. Now, all I gotta do, is call the Java program from the php.
Calling a java program from php over the host operating system is about as easy as calling the international space station from a tin can with a string on it. To make it worse, I have to deploy on a Linux system making whatever Windows solution I come up with totally worthless. Now I find out about JavaBridge, which my zend php server tells me that it doesn't like, or home made solutions by changing the apache configuration settings which blows up apache and blah blah fricken blah.
OK, then it came to me. Talking to java over the operating system, isn't the only way to talk to java. You can talk to java through the file system. How? Just add a java listener to your java program, leave a marker on the file system from php...a text file with the docx's id number which I had already set up. Have the java listener make the docx, have the php sleep until it sees it. Bada bing bada bang...we have our solution. I wrote the listener in under an hour from scatch. Clean up by deleting the files with a sweep utility after generation. Works faster that any other way too.
While downloading a skin for rainmeter, I picked up a nasty little trojan called GorrillaPrice. First off, don't go to this page if you are trying to get BlueVision for Rainmeter:
DO NOT DOWNLOAD ANYTHING FROM THIS PAGE!
Because if you use the link there, BLAM! Trojan! No more internet. The idiot that set up the trojan was trying to set it up so all web transmissions go through a proxy that sets up in your internet connection settings. He screwed that up, so when you try and surf the web and click on a link Chrome tries to download to the page instead of navigating to it.
I read all kinds of crazyness about how to fix this, some people wiped their OS and reloaded it. After a few times trying to reset the connection settings on my Windows 7 x64 box, I figured out the Trojan wasn't going away quietly.
After digging around on my hardrive for a while, I discovered two files
And another one newly added by the trojan at the same time. I deleted them both, reset my internet connection to not use the proxy anymore, and that's it. Everything started working again. That's it. No need to download a thousand adware removal tools, no need to reload the whole damn computer. That's all you need to do.
Wiring up a hunter ceiling fan to a remoter receiver can be a painful mess. I found all kinds of confusing guides on how to do it. Here are some clarifying instructions.
The box in my ceiling has a white wire, a black wire, a red wire, and a green for ground. The black is hot, the red is hot when the wall switch is in the on position, and the white is neutral.
The remoter receiver has black and white wires in, black ,white, and blue out.
The hunter ceiling fan has two black, one white, and one green. All part of the harassment package my friend.
Ok, we're going to wire up the whole fan to the switch on the wall.
1) Pull the circuit breaker to the fan so you don't shock yourself and die. Dying is bad, and you might go to hell. If you're an enemy of the United States, go ahead and leave it on.
2) Cap off the black wire from the ceiling. We're not going to use that.
3) Connect the green wire from the ceiling, to the green wire from the fan. This is your ground. You'll know if you didn't connect it right, because if a bulb blows out under the fan all the lights in the house will go out.
4) Connect the red wire from the ceiling into the black wire into the fan remote receiver. This is the hot wire from the wall switch.
5) Connect the white from ceiling to white into fan remote receiver.
6) White out from remote receiver into white into fan.
7) Blue out from remote receiver into black wire with white stripe. This is the hot into fan light.
8) Black out from remote receiver into black into fan. This is the fan hot.
Button up the fan, circuit breaker on, fan wall switch on, remote swith on, and hopefully you got it.
Dim c As Chart
ws_count = ThisWorkbook.Worksheets.Count
For i = 1 To ws_count
Set ws = ThisWorkbook.worksheets(i)
For j = 1 to ws.ChartObjects(j).Chart
Set c= ws.ChartObjects(j).Chart
c.ChartTitle.Text= Replace(c.ChartTitle.Text, "OldStuff", "NewStuff")
There is probably a better way to do this..if you know of one please tell me. This way looks pretty clunky to me:
Here's some macro code to put a list of values from a SAS table into a bunch of variables:
%LET CURRENT_TABLE_DATE = 'APR2009';
SELECT DISTINCT TABLE_DATE INTO :TABLE_DATE1-:TABLE_DATE100
%DO I=1 %TO 100;
%PUT &I &&TABLE_DATE&I &CURR_TABLE_DATE;
I've seen a lot of ugly ways to count the number of words in a comma separated list, most of them involve an overly complicated macro. There is an easier way. Just add a field to your table, then you want to use the LENGTH function to count your comma separated list, and the LENGTH and COMPRESS function to count the string with your commas removed. This will give you the number of words in the list:
list_count = length(comma_list)-length(compress(comma_list,","));
Here's a little batch file utility to get your installed programs from your Windows 7 registry. This was adapted from an online script that doesn't work on Win 7:
C:\Windows\System32\reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
This needs to be all on one line in the batch file, with a space between export and HKEY... my editor broke it into two lines.
Every once in a while you need to go beyond the Excel feature that screens out duplicate records and single out records with a duplicate field, that contain data you want to get rid of.
Here's an Excel VBA Macro that does that. This one works for a sheet called "singletons" so you're going to have to change "singletons" to "sheet1" or whatever your sheet is called.
If Sheets("singletons").Cells(i,2) = Sheets("singletons").Cells(i-2,2) then
This also starts at row 100679, so you'll need to change that to your last row. The program works from the bottom up, which is the way it has to be. So make sure that the row and data you want to keep is sorted so the good record is the first one, and all the bad records are below that. This Macro checks the data in the B or second column, so you'll probably need to change that too:
USE AT YOUR OWN RISK. BACK YOUR DATA UP!!!!
Here's the whole macro:
For i = 100679 To 2 Step -1
If Sheets("singletons").Cells(i, 2) = Sheets("singletons").Cells(i - 1, 2) Then
For the last two days I've been looking at options for making a Flash website readable on mobile devices paying particular attention to iOS devices. We all know how much Apple loves Adobe Flash. Apple is not real fond of developers in general actually, but they really hate Flash developers.
So I looked for the easy way out, of course. Solution number 1 was to use Adobe Flash CS5 and develop in Flash lite. I still can't get it to work with the iPhone, but it did work on Android and Rim devices which are the other two I'm shooting for. Not great, but a partial solution. PARTIAL PASS
Next, I tried Swiffy by Google, where you can upload an swf file via web page, and it will create an html5 solution for you. Except in my case where it FAILED. Tried several different versions of swf, all of which FAILED.
Next I tried Recool Video Converter which not only FAILED but crashed. Two for one. I tried it on both my Win 64 boxes. When I moved it over to my XP box it did make a video, but the quality was suspect and unusable. FAIL.