Sony’s Game console embraces NFC


Sony released a minor update to its successful PS3 console today. And added a key feature to its gaming console – NFC support. To fully utilize the feature users will need an add-on – RC-S380 NFC reader/writer from Sony.

Not yet clear as of now, what will be the application of this feature in the console.

Update : It seems the NFC support is available only on consoles in Japan region.

References
Sony RC-S380 NFC Reader/Writer

Advertisements

Give me a QIF file from a CSV file


You will find here a simple script to convert a delimited CSV file to QIF format. This will come handy if you need to import your bank or credit card statement available in CSV format.

Note : This script is not customized to process investment transactions

The script is developed as a vbscript file. Your Windows desktop should be able to run this script on a command prompt.

The script expects your CSV file to be in a particular format. This is limited to how your columns are named and the delimiter used. The delimiter expected is semicolon. You can customize the script to use a different delimiter. The columns can be in any order. Captured below are the expectations on the column headings.

Colum Heading Notes
Date Transaction date
Payee Payee Name
Narration Memo or Narration about the transaction
Amount Transaction Amount
Cheque Ref Cheque Number. This field can be blank also.
CR_OR_DR The transaction is a credit or debit. If this field is not present in your CSV, you need to add the column and capture CR or DR for Credit or Debit respectively

Follow the below steps to get setup.

  • Copy the below lines beginning with REM Script Begins and save it to a file with extension .vbs . For eg : QifFromCsv.vbs
  • To make it easy for running the script copy the .vbs file to the same folder where your CSV file is located.
  • Make a copy of your csv file and name it input.csv .
  • Fire up the command prompt and run the following on the command prompt. I assume the script file is named QifFromCsv.vbs .

cscript QifFromCsv.vbs

  • The script creates a file named output.qif , which you can use to import into your Personal Finance application.


REM Script Begins
REM Feel free to Customize or alter the code
REM
REM Define the Titles expected in the CSV file. Alter the text between double quotes to match yours

Const cDateColTitle = "Date"
Const cPayeeColTitle = "Payee"
Const cNarrationColTitle = "Narration"
Const cAmountColTitle = "Amount"
Const cChequeColTitle = "Cheque Ref"
Const cCRDRColTitle = "CR_OR_DR"
REM
REM Define the delimiter used in the csv file. Change the text between double quotes to match yours

Const cDelimiter = ";"
Dim QIFCodesApplicable(10)
Dim FieldsRecognized(10)
Dim fso, f2, ts, ts2, line, records, linesRead
Const ForReading = 1, ForWriting = 2, ForAppending = 8
linesRead = 0

Set fso = CreateObject("Scripting.FileSystemObject")
Set tf1 = fso.OpenTextFile("input.csv", ForReading, false)
Set tf2 = fso.OpenTextFile("output.qif", ForWriting, true)
Do While Not tf1.AtEndOfStream
line = tf1.ReadLine
linesRead = linesRead + 1

REM Parse Header for applicable fields
if linesRead = 1 then
fieldsInHeader=Split(line,";")
if UBound(fieldsInHeader) = 0 then
Wscript.echo " "
Wscript.echo "Please verify whether the Delimiter used in your file is consistent "
Wscript.echo "and is " + cDelimiter
Wscript.echo "if consistent then try running the script by editing the line "
Wscript.echo "Const cDelimiter=""your delimiter"" "
Wscript.quit
end if

Wscript.echo "Parsing Header for Predefined Fields"
for i = 0 to UBound(fieldsInHeader)
select Case fieldsInHeader(i)
case "Date"
QIFCodesApplicable(i) ="D"
FieldsRecognized(i) = cDateColTitle
case "Payee"
QIFCodesApplicable(i) = "P"
FieldsRecognized(i) = cPayeeColTitle
case "Narration"
QIFCodesApplicable(i) = "M"
FieldsRecognized(i) = cNarrationColTitle
case "Amount"
QIFCodesApplicable(i)= "T"
FieldsRecognized(i) = cAmountColTitle
case "Cheque Ref"
QIFCodesApplicable(i) = "N"
FieldsRecognized(i) = cChequeColTitle
case "CR_OR_DR"
CR_DR_FieldNumber = i
FieldsRecognized(i) = cCRDRColTitle
end select
next
Wscript.echo "Found " + Cstr(Ubound(FieldsRecognized,1)) + " Predefined Fields"
tf2.WriteLine "!Type:Bank"
end if

if linesRead > 1 then
records=Split(line,";")
if UBound(records) = 0 then
Wscript.echo " "
Wscript.echo "Please verify whether the Delimiter used in your file is consistent "
Wscript.echo "and is " + cDelimiter
Wscript.echo "if consistent then try running the script by editing the line "
Wscript.echo "Const cDelimiter=""your delimiter"" "
Wscript.quit
end if
for i=0 to UBound(records)

REM
REM If the current field is amount field check whether its a debit or credit
if QIFCodesApplicable(i) = "T" then
if records(CR_DR_FieldNumber) = "CR" then
lQifLine=QIFCodesApplicable(i) + "-" + records(i)
else
lQifLine=QIFCodesApplicable(i) + records(i)
end if
else
lQifLine = QIFCodesApplicable(i) + records(i)
end if

if i <> CR_DR_FieldNumber then
tf2.WriteLine lQifLine
end if
next
end if

tf2.WriteLine "^"

Loop
tf1.Close
tf2.Close
Wscript.echo " "
Wscript.echo " Processed " +cStr(linesRead) + " transactions "
if (linesRead > 1 ) then
Wscript.echo " Output file is output.qif"
end if