Search Comments and Ratings

go

   
Date File Comment by Comment Rating
19 Sep 2014 Evaluate Nelson-Siegel function (or fit one to a yield curve) Author: Dimitri Shvorob Vincent

thx in advance

24 Aug 2014 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob azizullah khan

it makes problem with me...Error occured
??? Java exception occurred:
java.lang.NoClassDefFoundError: org/fontbox/afm/AFMParser

at org.pdfbox.pdmodel.font.PDFont.getAFM(PDFont.java:350)

at org.pdfbox.pdmodel.font.PDFont.getAverageFontWidthFromAFMFile(PDFont.java:313)

at org.pdfbox.pdmodel.font.PDSimpleFont.getAverageFontWidth(PDSimpleFont.java:231)

at org.pdfbox.util.PDFStreamEngine.showString(PDFStreamEngine.java:276)

Error in ==> Untitled at 20
pdfstr = reader.getText(pdfdoc) %#ok

java.lang.Throwable: Warning: You did not close the PDF Document
at org.pdfbox.cos.COSDocument.finalize(COSDocument.java:418)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
at java.lang.ref.Finalizer.access$100(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
java.lang.Throwable: Warning: You did not close the PDF Document
at org.pdfbox.cos.COSDocument.finalize(COSDocument.java:418)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
at java.lang.ref.Finalizer.access$100(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)
java.lang.Throwable: Warning: You did not close the PDF Document
at org.pdfbox.cos.COSDocument.finalize(COSDocument.java:418)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
at java.lang.ref.Finalizer.access$100(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

Kindly fix it for me...thanks

10 Apr 2014 Evaluate Nelson-Siegel function (or fit one to a yield curve) Author: Dimitri Shvorob Tornike Mosiashvili

Hello, Could you please let me know how the nelsonsse and lsbetas work?

Thanks in advance.

23 Dec 2013 Import data from SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob John Adcox

Hi Eddie, I am getting the same error. Were you able to resolve this issue?

30 Oct 2013 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Holden

There is a really simple yet robust tool for extracting highlights and notes from your pdf-files available at: http://www.sumnotes.net . Not only it supports various advanced features like selective extraction or predictive extraction, but it also allows you to save extracted highlights into TXT or DOC files. All desktop browsers and operating systems are supported. We are in cloud, so no installation is needed. And yes, it is for free. Try it out.

17 Sep 2013 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Quan Wang

Nice work. It would be better if you can handle the java warnings. For example, you have "pdfdoc" variable defined for different tasks. You should use different variables. Also, you need to close the java object in your demo.

06 Jul 2013 Plot a univariate histogram (a little easier than with HIST) Author: Dimitri Shvorob Qiong Wu

relative frequencies using hist

23 May 2013 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Jud

This is a decent program, but if you are using Linux, there is a MUCH simpler way to accomplish the exact same thing.

Install the program "pdftotext", then use it inside of Matlab to convert a PDF to a text file. Then read in the text file. Here's how it might look:

inputPDF = 'test.pdf';
outputfile = 'output.txt';
cmd = ['pdftotext -raw ',inputPDF,' ',outputfile]
system(cmd);
fid = fopen(outputfile);
alltext = textscan(fid,'%s','Delimiter','\n');
fclose(fid);

23 May 2013 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Jud

20 May 2013 Order book simulation (a naive artificial stock market) Author: Dimitri Shvorob Mirko

my virusscanner alarmed me about a possible Virus in the pdf document and in a temp file creaded from the pdf.

Please check the pdf before you open it.

06 May 2013 Import data from SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Eddie

I'm getting a runtime error 91 in the xls macro about a block variable not having been set. It stops at the "SAS.Quit" line in the Sub SAS2Excel() module.

I'm no expert in VB (I think?), so does anyone know of a quick fix?

22 Apr 2013 Evaluate Nelson-Siegel function (or fit one to a yield curve) Author: Dimitri Shvorob Yirong Zhu

18 Feb 2013 Simulate a Cox-Ingersoll-Ross process (Exact algorithm) Author: Dimitri Shvorob XIN XU

09 Nov 2012 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Ergina

It worked fine for me, however how can I extract color information for the characters in pdf?

26 Oct 2011 Evaluate Nelson-Siegel function (or fit one to a yield curve) Author: Dimitri Shvorob aasifalimd

31 Aug 2011 Check your FEX author rank Display and record your FEX statistics Author: Dimitri Shvorob ted p teng

Haha, great stuff. This can also have other applications, e.g., keeping track of rankings from other websites!

23 Aug 2011 Visualize dynamic hedging (via an interactive GUI) Author: Dimitri Shvorob Ning

29 Jul 2011 Export data to SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Marco

Hello:
how many rows can be saved in one step? Does Excel constraint the process in any way?
MySQL-mediated data transfer would be preferable but I find it very slow to go from SAS to MySQL to Matlab to MySql, especially when I transfer large SAS tables to MySql (over a million rows). Is there a way to speed up the process? do you have any hints?
Thanks!!!

26 Jul 2011 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob mathworks2011

V Poor. Does not work.

The author even notes it does not work inside the m-file!

java.lang.Throwable: Warning: You did not close the PDF Document
at org.pdfbox.cos.COSDocument.finalize(COSDocument.java:418)
at java.lang.ref.Finalizer.invokeFinalizeMethod(Native Method)
at java.lang.ref.Finalizer.runFinalizer(Unknown Source)
at java.lang.ref.Finalizer.access$100(Unknown Source)
at java.lang.ref.Finalizer$FinalizerThread.run(Unknown Source)

03 Jun 2011 Winsorize data (using PRCTILE) Author: Dimitri Shvorob Roxana Iosif

Thanks a lot, works very well!

03 Jun 2011 Winsorize data (using PRCTILE) Author: Dimitri Shvorob Roxana Iosif

13 May 2011 Plot a 'grouped' univariate histogram (Subsample histograms, stacked) Author: Dimitri Shvorob Hemingway

Would have liked the option to include a legend. But otherwise very good. Thanks.

13 May 2011 Plot a 'grouped' univariate histogram (Subsample histograms, stacked) Author: Dimitri Shvorob Hemingway

29 Apr 2011 Evaluate Nelson-Siegel function (or fit one to a yield curve) Author: Dimitri Shvorob Qin

is there something wrong in the code?
I cannot run it.
function[f] = nelsonsse(tau)
[b,f] = lsbetas(tau); %#ok
end

function[b,varargout] = lsbetas(tau)
i = x(:)/tau;

is this part has some mistakes?

24 Apr 2011 Simulate a Cox-Ingersoll-Ross process (Exact algorithm) Author: Dimitri Shvorob Hans

Question and HELP: I would like to simulate one CIR process for m obligors in a credit portfolio n times. Assume m=1000 and n=10000 (a lot of simulations). Could it be possible to speed up your algo?

Many thanks

18 Jan 2011 Mean-variance portfolio optimization using GA and PATTERNSEARCH (A not-too-serious experiment / code sample) Author: Dimitri Shvorob Roji

18 Jan 2011 Mean-variance portfolio optimization using GA and PATTERNSEARCH (A not-too-serious experiment / code sample) Author: Dimitri Shvorob Roji

Amazing work Dimitri. However, I am running it on 2010a and the loop from line 123 takes hours. Really, I cannot see the results. And the elapsed time should not be more than 360 seconds. Have you got a clue of why is it? Best Regards, and thank you very much for your work in this file.

29 Dec 2010 The Twain Shall Meet: Facilitating Data Exchange between SAS and Matlab (via MySQL) Author: Dimitri Shvorob Zhou Dingrong

where can I download the mym.m file? I didn't find the file needed in processing. please help me. Thanks

17 Nov 2010 Merge matrices (in a SQL equijoin) Author: Dimitri Shvorob David Divad

Unfortunately this does not seem to work always well.

Consider:

A = [1 1; 1 2; 1 3; 1 4]
C = [1 8; 1 9]
joinmat(A,C,'inner') % does not give cartesian product -> joinmat only works with unique keys in at least one of the matrices

ans =

1 1 8
1 2 9
1 3 8
1 4 9
1 1 8
1 2 9
1 3 8
1 4 9

Does anybody know a good alternative to this? How can I join two matrices in MATLAB (without unique keys)?

03 Nov 2010 Merge matrices (in a SQL equijoin) Author: Dimitri Shvorob Jesse Blocher

Brilliant - this saved me a ton of time from either setting up mySQL or otherwise exporting out of Matlab elsewhere to do the join. Again, brilliant.

02 Nov 2010 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Brahim HAMADICHAREF

update to the most recent version 1.3.1 and then
error messages disappear when you use
pdfDoc.getDocument().close;

15 Jul 2010 Export data to SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Philip

I'm getting an error while attempting to use this function while saswrite attempts to use the .xls file.

Run-time error '91':

Object variable or With block variable not set.

This occurs while running the demo.

24 Jun 2010 Queue (A simple implementation) Author: Dimitri Shvorob Ahmed Gad

Hi,

1- It needed some improvements for pre-allocation before insertion.
2- Priority queue implementation using heaps is much more efficient than the current one.

I changed the implementation a bit to consider those two points. I'll post the code to you to change yours instead.

Hope it helps.

PQueue.m

classdef PQueue < Queue

% PQueue - strongly-typed Priority Queue collection
%
% Properties:
%
% Type (string)
% Comparator (function handle, @gt by default)
%
% Methods:
%
% PQueue(type)
% PQueue(type,comparator)
% display
% size
% isempty
% clear
% contains(obj)
% offer(obj)
% remove(obj)
% peek - returns [] if queue is empty
% poll - returns [] if queue is empty
% values - returns contents in a cell array
%
% Notes:
%
% Compatible classes must overload eq() for object-to-object comparisons
%
% Comparator must be defined in the class, or a base class: RedWidget and
% BlueWidget objects can be combined if a Widget comparator is defined
%
% Derived from Queue
%
% Example:
%
% q = PQueue('Widget',@gt)
%
% q.offer(RedWidget(1))
% q.offer(RedWidget(3))
% q.offer(RedWidget(2))
% q.offer(BlueWidget(2))
% q.offer(BlueWidget(2))
%
% q.size
% q.remove(RedWidget(2));
% q.size
% q.remove(BlueWidget(2));
% q.size
%
% q.peek
% q.poll
% q.size
%
% Author: dimitri.shvorob@gmail.com, 3/15/09
% Modified for heap implementation and pre-allocation by:
% a[DOT]mounir86@gmailDOTcom, 24/06/2010

properties (SetAccess = protected)
Comparator % function handle
end

methods

function[obj] = PQueue(type,varargin)
obj = obj@Queue(type);
if nargin > 1
obj.Comparator = varargin{1};
else
obj.Comparator = @gt;
end
end

function[obj] = offer(obj,e)

if length(e) > 1
throw(MException('PQueue:offerMultiple','??? Cannot offer multiple elements at once.'))
end
if ~isa(e,obj.Type)
throw(MException('PQueue:offerInvalidType','??? Invalid type.'))
end

obj.Elements{obj.lastInd+1} = e;
obj.lastInd = obj.lastInd + 1;
if(length(obj.Elements) == obj.lastInd)
obj.Elements = [obj.Elements obj.Elements];
end

currInd = obj.lastInd;
parentInd = floor(currInd / 2);
while(parentInd ~= 0)
if(obj.Comparator(obj.Elements{currInd},obj.Elements{parentInd}))
tempElement = obj.Elements{currInd};
obj.Elements{currInd} = obj.Elements{parentInd};
obj.Elements{parentInd} = tempElement;

currInd = parentInd;
parentInd = floor(currInd / 2);
else
break;
end
end
end

function[out] = poll(obj)

if obj.isempty
out = [];
return;
end

out = obj.Elements{1};

if(obj.size == 1)
obj.lastInd = obj.lastInd - 1;
return;
end

obj.Elements{1} = obj.Elements{obj.lastInd};
obj.lastInd = obj.lastInd - 1;

currInd = 1;
childInd = currInd * 2;

while(childInd <= obj.lastInd)

if(childInd + 1 > obj.lastInd)

if(~obj.Comparator(obj.Elements{currInd},obj.Elements{childInd}))

tempElement = obj.Elements{currInd};
obj.Elements{currInd} = obj.Elements{childInd};
obj.Elements{childInd} = tempElement;

currInd = childInd;
childInd = currInd * 2;
else
break;
end

elseif(obj.Comparator(obj.Elements{childInd + 1},obj.Elements{childInd}))

if(~obj.Comparator(obj.Elements{currInd},obj.Elements{childInd + 1}))

tempElement = obj.Elements{currInd};
obj.Elements{currInd} = obj.Elements{childInd + 1};
obj.Elements{childInd + 1} = tempElement;

currInd = childInd + 1;
childInd = currInd * 2;
else
break;
end

elseif(~obj.Comparator(obj.Elements{currInd},obj.Elements{childInd}))

tempElement = obj.Elements{currInd};
obj.Elements{currInd} = obj.Elements{childInd};
obj.Elements{childInd} = tempElement;

currInd = childInd;
childInd = currInd * 2;

else
break;
end
end
end

end

end

Queue.m

classdef Queue < handle

% Queue - strongly-typed Queue collection
%
% Properties:
%
% Type (string)
%
% Methods:
%
% Queue(type)
% display
% size
% isempty
% clear
% contains(obj)
% offer(obj)
% remove(obj)
% peek - returns [] if queue is empty
% poll - returns [] if queue is empty
% values - returns contents in a cell array
%
% Notes:
%
% Compatible classes must overload eq() for object-to-object comparisons.
%
% Example:
%
% q = Queue('Widget')
%
% q.offer(RedWidget(1))
% q.offer(RedWidget(3))
% q.offer(RedWidget(2))
% q.offer(BlueWidget(2))
% q.offer(BlueWidget(2))
%
% q.size
% q.remove(RedWidget(2));
% q.size
% q.remove(BlueWidget(2));
% q.size
%
% q.peek
% q.poll
% q.size
%
% Author: dimitri.shvorob@gmail.com, 3/15/09
% Modified for heap implementation and pre-allocation by:
% a[DOT]mounir86@gmailDOTcom, 24/06/2010

properties (GetAccess = protected, SetAccess = protected, Hidden = true)
Elements
lastInd
end

properties (SetAccess = protected)
Type
end

methods

function[obj] = Queue(type)
if ~ischar(type)
throw(MException('Queue:constructorInvalidType','??? ''type'' must be a valid class name.'))
end
obj.Elements = cell(1, 100);
obj.lastInd = 0;
obj.Type = type;
end

function disp(obj)
disp([class(obj) '<' obj.Type '> (head on top)'])
if ~obj.isempty
for i = 1:obj.lastInd
disp(obj.Elements{i})
end
else
disp([])
end
end

function[out] = size(obj)
out = obj.lastInd;
end

function[out] = values(obj)
out = obj.Elements{1:obj.lastInd};
end

function[out] = isempty(obj)
out = obj.size == 0;
end

function[obj] = clear(obj)
obj.Elements = {};
obj.lastInd = 0;
end

function[out] = contains(obj,e)
out = false;
for i = 1:obj.size
if e == obj.Elements{i}
out = true;
break
end
end
end

function[obj] = offer(obj,e)
if length(e) > 1
throw(MException('Queue:offerMultiple','??? Cannot offer multiple elements at once.'))
end
if ~isa(e,obj.Type)
throw(MException('Queue:offerInvalidType','??? Invalid type.'))
end
if isempty(obj.Elements)
obj.Elements = {e};
else
obj.Elements{obj.lastInd+1} = e;
obj.lastInd = obj.lastInd + 1;
if(length(obj.Elements) == obj.lastInd)
obj.Elements = [obj.Elements obj.Elements];
end

end
end

function[obj] = remove(obj,e)
if length(e) > 1
throw(MException('Queue:removeMultiple','??? Cannot remove multiple elements at once.'))
end
if ~isa(e,obj.Type)
throw(MException('Queue:removeInvalidType','??? Invalid type.'))
end
if ~isempty(obj.Elements)
k = [];
for i = 1:obj.size
if e == obj.Elements{i}
k = [k i]; %#ok
end
end
if ~isempty(k)
obj.Elements(k) = [];
obj.lastInd = obj.lastInd - length(k);
end
end
end

function[out] = peek(obj)
if ~obj.isempty
out = obj.Elements{1};
else
out = [];
end
end

function[out] = poll(obj)
if ~obj.isempty
out = obj.Elements{1};
obj.Elements(1) = [];
obj.lastInd = obj.lastInd - 1;
else
out = [];
end
end

end

end

23 Jun 2010 Queue (A simple implementation) Author: Dimitri Shvorob Ahmed Gad

Simple yet powerful. Thanks so much.

23 Jun 2010 Extract text from a PDF document (if you are lucky) Author: Dimitri Shvorob Jonatan Olofsson

Apparently, pdfbox creates two objects on instantiation and loading respectively. I got rid of the warning mentioned in the code by using "pdfdoc = org.apache.pdfbox.pdmodel.PDDocument.load(filename)" directly (also, .apache added since newer releases of pdfbox).

Also, after the pdfdoc variable is created (inside a try..catch), "pdfdoc.close()" must also be called.

04 May 2010 Access a MySQL database (with mym.m) Author: Dimitri Shvorob Dadi Gudmundsson

Overall I find this useful and good. Reason for less than perfect rating is:
1) These wrapper files tend to replace more detailed mym error messages with their own. Easy to fix.
2) For some datasets the s string created in TBWRITE line 79 ends in a comma and a space. This means that line 80 doesn't remove the comma at the end. This then gives an SQL error. Haven't figured out why some datasets do this, but not others. Pretty easy to fix.
Cheers
dadigu

01 May 2010 Simulate a Hawkes process (and visualize it) Author: Dimitri Shvorob Yijia Zhou

I've download several files of yours. They are very useful. Thank you. Do you work in the area of quantitative finance?

28 Apr 2010 Visualize payoffs of an option strategy (via an interactive GUI) Author: Dimitri Shvorob Robert Barrie

I meant to give this 5 - it is small but wonderfully neat and elegant... wonderful! Thanks (for all of your submissions)

16 Mar 2010 Access a MySQL database (with mym.m) Author: Dimitri Shvorob Howard Bussey

I'm trying to use a MySQL server that is on a non-standard port (not 3306) and mym doesn't connect. I can use the MySQL browser to see the databases that server manages, so I know the server is running and listening on the non-standard port. I also tried specifying port 3306 (standard) for a server with the standard configuration - that didn't connect either.

Has anyone else tried specifying a port in the connection string? Did it work for you?

02 Nov 2009 Scrolling display (price/volume chart) Author: Dimitri Shvorob James

28 Sep 2009 Export data to SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Alessandro Juri

28 Sep 2009 Import data from SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Alessandro Juri

SAS-Mtlab Converter found

05 Sep 2009 Export data to SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Dimitri Shvorob

Apparently, the two-star ranking stems from Alessandro not finding the XLS file. Does anybody else not see it? Please give me a shout.

05 Sep 2009 Import data from SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Dimitri Shvorob

Does anybody else not see the spreadsheet? Please give me a shout.

27 Aug 2009 Import data from SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Alessandro Juri

The file SAS-Matlab Converter.xls is not available for download

27 Aug 2009 Export data to SAS (via Excel; with SAS/ACCESS and ActiveX Automation Server) Author: Dimitri Shvorob Alessandro Juri

20 Jul 2009 Evaluate Nelson-Siegel function (or fit one to a yield curve) Author: Dimitri Shvorob rishad schaefer

Hello,
Great work...
Just a question: Do you know what scilab function ( used with wich parameters) could replace your fminbnd in order to get the fit.
I just can t get the propper algorithm on scilab...

22 May 2009 Queue (A simple implementation) Author: Dimitri Shvorob Andrea Tagliasacchi

Good choice for object oriented. However, if you want a generic priority queue which don't assume elements to be Matlab objects refer to my submission.

22 May 2009 Queue (A simple implementation) Author: Dimitri Shvorob Andrea Tagliasacchi

15 May 2009 Queue (A simple implementation) Author: Dimitri Shvorob Andrea Tagliasacchi

I wish you implemented a fast queue for matlab, not an object oriented one...

Contact us