Navigation
Recent Posts
Archive
Oppression can only survive through silence
This is my technical blog covering SQL, PHP, XML, gadgets, software etc.
I was motivated to put it together so I wouldn't have to keep re-inventing things I've done before. If I post it here, rather than on a scrap of paper, I stand a chance of finding it again.
Tags:Batch Files
Hi guys,
Can you help me? I need a batch file that do copy certain file base on date in a folder, to another network drive.
thanks
adrinne
Tags:Batch FIles
The following macro will insert a footer giving the page numbers, file loaction and name, and the date and time on the active sheet.
Sub myfoot()
'Dim fullpath As String
'Dim sLeft As String
'Dim sRight As String
fullpath = ActiveWorkbook.FullName
Const sPAGE As String = "&P"
Const sPAGES As String = "&N"
Const sDATE As String = "&D"
Const sTIME As String = "&T"
sLeft = "Page " & sPAGE & " of " & sPAGES
sRight = sDATE & " " & sTIME
ActiveSheet.PageSetup.CenterFooter = fullpath
ActiveSheet.PageSetup.LeftFooter = sLeft
ActiveSheet.PageSetup.RightFooter = sRight
End Sub
In PHP $this is a special variable and can't be assigned.
An hour later wondering why my $this and $that tests weren't working!
Tags:PHP |Variables |Debug |testing
Call to undefined function mysql_connect() or have a php.ini file which doesn't seem to behave, i.e. the extension_dir seems to have a mind of its own so the MySQL extensions aren't loading?
I was having this problem on a new install of Apache 2.2.8, PHP 5.2.5, and MySQL 5.1.22 on Windows Vista Home Premium.
My first mistake downloading only the PHP installer. This does not include the extensions. Download the zip package and copy the extensions folder from it into your PHP directory. Edit php.ini, go to the dynamic extensions section and add the following
extension = php_mysqli.dll; extension = php_mysql.dll;
Make sure the extensions directory is set to the correct path. Reboot Apache...
I was still getting the same error - call to undefined function. I spent a few hours on google looking for the answer. This included copying php.ini, php_mysql.dll. php_mysqli.dll and libmysql.dll into and out of various directories including c:\windows and c:\windows\system 32. None of which worked.
Back to the drawing board. phpinfo records the extensions path as being c:\php5. There's the answer. There is no such folder and this isn't where extension_dir is pointed in php.ini? Why would it be picking up this directory?
As a shortcut I create the folder and copy the extensions into it. It still doesn't work. I edit php.ini and change the slashes on the extensions directory and try various symantics
Reboot Apache each time but it still doesn't work and the extension directory in phpinfo is still pointing at the spectral c:\php5. Where is it picking this up? I find a few forums suggesting it's a permissions problem. I disable all security settings, turn off User Account Control and open all access to php.ini. It doesn't make a difference, I still get the same message.
Back to basics. I open the Apache configuration file. It turns out the solution is a lot simpler. PHPIniDir in httpd.conf is incorrect. It's pointing to a folder which doesn't exist so windows has been using defaults to locate the files. Change the folder name to the correct path "C:\Program Files\PHP\" including the closing slash. Restart Apache. Eureka.
I'm not the first person to have this problem. I won't be the last, if you stumble on this post while you're having problems with an install concentrate on phpinfo, particularly the Loaded Configuration File and the extension_dir, and yes double check the settings on your web server.
Tags:PHP |Apache |MySQL |Vista |MySQL undefined function
If you're buying retail and go into any of the high street stores such as PC World, Comet, Currys, John Lewis, Dixons, Tesco all laptops on sale come pre-installed with Windows Vista. If you go online to Compaq, Toshiba, Sony, HP, Acer and the rest, you have no choice but to buy Windows Vista. In fact, all websites display the same message "Toshiba recommends Windows Vista", "HP recommends Windows Vista", "VAIO recommends Windows Vista", "Acer recommends Windows Vista" on and on ad nauseam.
With the consistent wording, these recommendations clearly originate from Microsoft rather than clinical engineering tests. Microsoft are heavily incentivising manufacturers to push Vista which has unbelievably been in development since 2001, consuming Microsoft people and money. Despite this, Vista, delivered three years late, doesn't perform any better than XP and needs some serious hardware just to run the graphical "Aero" interface such as 1GB of system memory and a 40GB hard drive capacity.
Business customers running Vista Business were thrown a life buoy, being quietly allowed to "downgrade" to XP. Retail customers, however, don't have the same licensing choice. If you have it, you're stuck with it. The main change in Vista is the unnecessary user interface and an improved search function as it tries to catch up with Google. Oh, and My Computer has been renamed Computer.
With Vista OS I am reminded of the Apple II being replaced with the Apple III in the early 1980s. The Apple III was designed by Marketeers and was the beginning of the end of Apples leading market position until it started to find itself again with the iPod. Vista has the look and feel of a development being led by Marketeers, it's not an operating system of choice.
So what is the alternative? As you can't seem to buy a laptop with XP you can return to Apple and the MAC OS (once it's not the "leopard" 10.5) or you can build your own with a Linux distribution such as Ubuntu, i.e. buy a Vista Laptop and uninstall the Vista OS. For the moment, my choice is not to buy.
Is it any wonder Vista is ranked number one by PC World as the biggest tech disappointment of 2007?
I've also posted this on really annoying shit dot com
Tags:Windows Vista |MAC OS |Linux
There are occasions when Excel might not add up properly, even though you still expect it to do so. Lets look at a very simple example to illustrate the case. You can reproduce this yourself as you read.
I have a small table of data, four columns wide. There are two row entries.

I want a summary of the data in the table. Specifically I am after a sum of column C where the code in column A is A, and I want the sum of column D where the code in column B is B. In both cases this should give me a result of 200 or -200.
The respective formulae to summarise by A code are =SUMIF(A:C,F2,C:C) and =SUMIF(B:D,F2,D:D). The respective formulae to summarise by B code are =SUMIF(A:C,F3,C:C) and =SUMIF(B:D,F3,D:D).
The results given....

As you can see, Excel incorrectly returns a value of -200 against the B code in the summary of column C. Did you get the same result? This is a very simplistic example to illustrate the need to validate any report or analysis performed with Excel before publishing.
Of course, how you organise your data is also relevant. If the table were instead organised as follows

the correct result is returned.

Tags:Excel |SUMIF |validate results |errors
In Snagit 8.2.0 there does not seem to be any way to capture a tools type drop down menu. When you get the menu ready and click back to Snagit, Snagit becomes the active window. Of course, this means the menu on the screen you want to capture is automatically closed and you can't get an open image of it.

In order to do so you have to add in an extra step. Get your menu ready, press the PrtSc button. Open Microsoft Paint or similar and paste the result, using Ctrl V or the edit menu. If you use a photo package your screen shot quality won't degrade as it will if you copy directly into Word.
At this point you can click the capture button in Snagit and select the menu region as in the example above.
Snagit is a very nifty screen capture program from TechSmith, very good for creating documents quickly, or for editing, annotating or sharing your screen shots. It's priced at $39.95 for a single user licence.

Tags:SnagIt |Screen Capture |Techsmith
The search function in Excel allows you to search for a text string occurrence within another text string.
Use to identify all rows where, for example, a description field, contains a certain word. Perhaps you are looking for every row which contains the word "VAT".
=SEARCH("VAT",A1,1)
where column A contains the description field.
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Novation of lease | 3 | FALSE | Matching String | |
| 2 | Some other text | #VALUE | TRUE | ||
| 3 |
If the string is not found the #VALUE error is returned. If the string is found you are given the starting position it occurs. In the above example, the word "VAT" starts at the third character.
To tidy up the results you can use the ISERR function to determine whether or not the error will occur. i.e. FALSE means the text is found, TRUE means it isn't.
=ISERR(SEARCH("VAT",A1,1))
Then use the IF function for a final tidy up. If the ISERR function is TRUE don't return anything, otherwise display "Matching String" in the cell.
=IF(ISERR(SEARCH("VAT",A1,1))=TRUE,"","Matching String")
Use the SEARCH function with caution. In this example I was searching for the word VAT. This letter sequence is contained in other words, such as Novation, which may not be quite what you were you looking for in your results. If you are running the function over a large dataset you might not pick up this logical error.
Tags:SEARCH |ISERR |IF |Excel |Logic Error
The following macro copies an Excel sheet to a custom template. All you need do is set the template path to your own or a network drive. This is really only a snippet to demonstrate the concept but is a complete macro nonetheless. I've used it within a more complex process to generate invoices from a data file, then copy each invoice to a separate file to email out as an attachment. This was a temporary solution during the lead up to a billing system change for a Telecoms client.
I've used this to get around not being able to copy headers and footers in Excel and to avoid copying common drawing objects such as a logo and text boxes. By having these set in the template I didn't need to copy them each time the process looped.
Sub copy_ActiveSheet()
Dim wb As Workbook
Dim source As Range
Dim dest As Workbook
'Enter the path to your template file
Const TemplatePath As String = "C:mark.xlt"
Set source = Nothing
On Error Resume Next
Set source = Cells.SpecialCells(xlCellTypeVisible)
On Error GoTo 0
Application.ScreenUpdating = False
Set dest = Workbooks.Add(TemplatePath)
source.Copy
With dest.Sheets(1)
.Cells(1).PasteSpecial xlPasteValues, , False, False
.Cells(1).PasteSpecial xlPasteFormats, , False, False
.Cells(1).Select
Application.CutCopyMode = False
End With
Tags:Excel |Macro |Drawing objects |headers |footers
Previous 12 3 4 Next »© Eriginal Ltd 2011, all rights reserved