Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
Windows 32, Delphi XE5. Database from Component ACE: Absolute database.
Form Create Procedure worked ok upto few hours ago. Suddenly resulted in error:
Cannot open File"Error Code 3" Error message: Can not find the path specified. Error 30364.
I have read many discussion with the same or similar problem but none gave me a good hint to solve.
The Procedure code is:
Procedure TForm1.FormCreate(Sender: TObject);
begin
ABSDatabase1.DatabaseFilename:= ExtractFilePath(Application.ExeName)+'LibCat.ABS';
ABSDatabase1.Open;
// showmessage(ABSDatabase1.Databasefilename);
ABSTable1.TableName:='Cat';
ABSTable1.Open; // gives error
ABSTable1.Last;
GetAppVersionStr;
Form1.Caption:=Form1.Caption +': Books Catalogue, ver. ' + Versione;
end;
The database file is in the same folder as the Project exe file. Any path of the option file point to the same folder.
I cannot imagine what modication I did to get this error.
On a step by step debugging the Database opens regularly, but the open Table gives the error.
On Object Inspector for Database the FileName is specified as .\LibCat.abs
Solved.
It was really a silly reason:
I examined carefully the .dfm file and I found that on "Object Inspector" providing data to ABSDatabase1 I have written the name and put at the end of the string a carriage return and a new line. Of course these characters where not visible on ID, only on .dfm file.
I do not know why this additional keys caused the error, but as I cleared them the Form was regularly generated and the program run perfectly.
Hope this can be useful to someone else.
Related
We use a Delphi 10 programme that reads in an Access database. I do not deeply understand how it does it, except that I believe it uses units called DAO.pas and DAO_TLB.pas.
I recently upgraded from Office 2007 to Office 2016, and since then the Delphi programme is unable to read from the database; it gives the error:
Project MyProj.exe raised exception class EOleSysError with message 'Class not registered'.
I have tried to search to find how to fix this but am struggling because I don't really understand what's going on under the hood. I tried to install the Access 2016 type library, but that didn't seem to make any difference.
Extremely grateful for any help.
Thanks,
Tom
EDIT: DAO.pas is here. DAO_TLB.pas is where the error is triggered; the function which errors is:
class function CoDBEngine.Create: _DBEngine;
begin
Result := CreateComObject(CLASS_DBEngine) as _DBEngine;
end;
Where CLASS_DBEngine is a constant declared as:
CLASS_DBEngine: TGUID = '{CD7791B9-43FD-42C5-AE42-8DD2811F0419}';
I have also just noticed that, when the error occurs, if I click continue rather than break, a new error appears, saying:
Class not registered, ClassID: {CD7791B9-43FD-42C5-AE42-8DD2811F0419}
i.e. the ClassID is the CLASS_DBEngine constant.
This question already has an answer here:
SetThreadLocale for the entire Delphi application
(1 answer)
Closed 6 years ago.
My Delphi program does not retrieve the right characters. SetThreadLocale for the entire Delphi application is the context of my problem. I am using Firebird 1.5 charset NONE database which contains WIN1257 data. I am using Delphi 10 Seattle IBX componentes to retrieve data from this database. Usually I use my program on Windows with one of the Baltic locale for non-Unicode programs. But sometimes I need to run my program on Windows with Russian locale (WIN1251 characterset).
And I am stuck with the following problem: database varchar field contains character ā, which is retrieved in Delphi code (fieldname.asString) as \u0101 when the program is run with Baltic locale, but it is retrievied (fieldname.asString) as \u0432 when the program is run with Russian locale, but I need it to be displayed as \u0101 in Russian case as well.
I have tried to set all the connection parameters to TIBDatabase but failed to achieve my goal. So - now I have idea to do translation: I can detect that program is running under Russian locale and in that case I can apply special conversion function like MyConvert(fieldname.asString) to convert \u0432 into \u0101 and something like this for all the characters.
The question is - is there such conversion function available and how to use it? What is the algorithm that determines the bijection \u0432 <-> \u0101?
Migration to the unicode database is not my option.
Current question tries to solve the same core problem as SetThreadLocale for the entire Delphi application but with different approach. I have not managed to set thread locale for my application and therefore I decided to make character conversion and this question is - how to do it?
Added: https://en.wikipedia.org/wiki/Windows-1251 and https://en.wikipedia.org/wiki/Windows-1257 palettes show that a has E2 position and this position in both palettes have different, but known Unicode characters, so the mapping is known and there is no single formula how to express it, it should be done character by character basis.
The following function is the answer I sought:
function MyConversionFunction(AChar: Char): Char;
begin
case Ord(AChar) of
//A_
$045E: Result:=Char($00A2);
$0408: Result:=Char($00A3);
$00A4: Result:=Char($00A4);
$00A6: Result:=Char($00A6);
$00A7: Result:=Char($00A7);
$0401: Result:=Char($00D8);
$00A9: Result:=Char($00A9);
$0404: Result:=Char($0156);
$00AB: Result:=Char($00AB);
$00AC: Result:=Char($00AC);
$00AD: Result:=Char($00AD);
$00AE: Result:=Char($00AE);
$0407: Result:=Char($00C6);
//B_
$0406: Result:=Char($00B2);
$0456: Result:=Char($00B3);
$0491: Result:=Char($00B4);
$0451: Result:=Char($00F8);
$2116: Result:=Char($00B9);
$0454: Result:=Char($0157);
$0458: Result:=Char($00BC);
$0405: Result:=Char($00BD);
$0455: Result:=Char($00BE);
$0457: Result:=Char($00E6);
//C_
$0410: Result:=Char($0104);
$0411: Result:=Char($012E);
$0412: Result:=Char($0100);
$0413: Result:=Char($0106);
$0414: Result:=Char($00C4);
$0415: Result:=Char($00C5);
$0416: Result:=Char($0118);
$0417: Result:=Char($0112);
$0418: Result:=Char($010C);
$0419: Result:=Char($00C9);
$041A: Result:=Char($0179);
$041B: Result:=Char($0116);
$041C: Result:=Char($0122);
$041D: Result:=Char($0136);
$041E: Result:=Char($012A);
$041F: Result:=Char($013B);
//D_
$0420: Result:=Char($0160);
$0421: Result:=Char($0143);
$0422: Result:=Char($0145);
$0423: Result:=Char($00D3);
$0424: Result:=Char($014C);
$0425: Result:=Char($00D5);
$0426: Result:=Char($00D6);
$0427: Result:=Char($00D7);
$0428: Result:=Char($0172);
$0429: Result:=Char($0141);
$042A: Result:=Char($015A);
$042B: Result:=Char($016A);
$042C: Result:=Char($00DC);
$042D: Result:=Char($017B);
$042E: Result:=Char($017D);
$042F: Result:=Char($00DF);
//E_
$0430: Result:=Char($0105);
$0431: Result:=Char($012F);
$0432: Result:=Char($0101);
$0433: Result:=Char($0107);
$0434: Result:=Char($00E4);
$0435: Result:=Char($00E5);
$0436: Result:=Char($0119);
$0437: Result:=Char($0113);
$0438: Result:=Char($010D);
$0439: Result:=Char($00E9);
$043A: Result:=Char($017A);
$043B: Result:=Char($0117);
$043C: Result:=Char($0123);
$043D: Result:=Char($0137);
$043E: Result:=Char($012B);
$043F: Result:=Char($013C);
//F_
$0440: Result:=Char($0161);
$0441: Result:=Char($0144);
$0442: Result:=Char($0146);
$0443: Result:=Char($00F3);
$0444: Result:=Char($014D);
$0445: Result:=Char($00F5);
$0446: Result:=Char($00F6);
$0447: Result:=Char($00F7);
$0448: Result:=Char($0173);
$0449: Result:=Char($0142);
$044A: Result:=Char($015B);
$044B: Result:=Char($016B);
$044C: Result:=Char($00FC);
$044D: Result:=Char($017C);
$044E: Result:=Char($017E);
$044F: Result:=Char($02D9);
else Result:=AChar;
end;
end;
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
Scenario:
STEP 1:
STEP 2:
STEP 3:
Problem Summarized:
I started working with swift and its basic concepts.
First, I tried making an array ab with multiple different typed elements (not sure if it should be called an array). Then I tried to test an index value ab[2].
After testing an index value successfully, I made a dictionary dictAbc where I used different indices ab[4] ab[6] pointing to its keys. It introduced an error as mentioned in STEP 1.
I tried capping ab[2] into a print function as mentioned in STEP 2, it removed the error
Then I removed print method and made STEP 3 code same as STEP 1, it doesn't produce any error now.
Code:
import UIKit
var str = "Hello, playground"
var num: Float64 = 4.00000000000000000000000000
print("\(num)")
let a = "Hello"
let b = 12786
let c = a + String(b)
var ab = [1221, 123123, 123123,123123,"asdasd", "adasdasd", 1263781.123]
ab[2]
var dictAbc = ["hello":ab[4], "let":ab[6]]
dictAbc["let"]
Project Navigator Screenshot
Note: Xcode Version 7.0 (7A220)
Is something wrong with Playground compiler?
This is because of how a Playground works: it tries to evaluate every expression as soon as you've finished typing.
So when you type this quickly:
ab[1]
No errors, but if you take your time and pause with the cursor inside the brackets:
ab[]
you will indeed get the cannot subscript a value of type '[NSObject]' with an index of type '()' error, but this is only a temporary error message due to the "real-time" nature of the Playground.
If the error is still there after having typed the index number, then to make it disappear you just have to "wake up" the Playground by adding an empty line somewhere, adding a space after the expression, or adding other code, of course. The Playground will then re-evaluate everything and will remove the false error.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 9 years ago.
Questions concerning problems with code you've written must describe the specific problem — and include valid code to reproduce it — in the question itself. See SSCCE.org for guidance.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
I've created custom 404 error pages for my symfony application, but they don't seem to work. In dev I see :
This request has been forwarded to a 404 error page by the action "blabla".
But in prod, the page is just blank; I get a 500 error.
In the logs, the error is :
PHP Parse error: syntax error, unexpected T_PUBLIC in /var/www/myproject/apps/myapp/modules/default/actions/actions.class.php on line 7
default/actions/actions.class.php is the following :
<?php
/**
* Error page for page not found (404) error
*
*/
public function executeError404()
{
}
public function executeSecure()
{
}
?>
I followed this tutorial on symfony-check.org
I found the answer all by myself :D
I'd forgotten part of the file :
class defaultActions extends sfActions
{
public function executeError404() {}
}
I get this error the first time I build/compile a particular project after opening Delphi (D6 Pro). Subsequent builds do not give the error.
I have the same issue, it was fixed by replacing {$R *.dfm} directive in the problem unit (which was not found by Delphi during first compilation) by more specific clause {$R fMain.dfm}.
The error can be caused by an exception being raised in a design component on the form. If the component is running some initialisation code which raises an exception this error will be produced. This can be shown by adding
raise Exception.CreateFmt('Test', []);
into the code of the component. Note that in D6 Pro this does not produce 'Test' in the error message. The underlying exception message is not displayed.
This is probably caused by a control that raises an exception during its creation (when the form is loaded).
How I solved this (this case was specific for me, but a very similar solution may apply to you):
First I loaded the 'broken' unit into the IDE. It didn't caused an error until I pressed F12 to see the form. The error message raised by the IDE was not very helpful, but after changing the {$R *.dfm} to {$R MainForm.dfm}, the error message changed to something more specific. More exactly, in the error report, one line was of special interest:
{MyControls_XE.bpl} StrGrdBase.TBaseStrGrid.FixCursor (Line 569, "StrGrdBase.pas" + 9) + $8
I navigated to that line and I have seen that in some conditions I was trying to set focus on the second row, while the grid had only one row.
I also got the same error on Deplhi 2010, the problem was there was a component which has not been installed in IDE, when I changed the component to the one that exists it is worked as a charm.
I've found an additional reason for this behaviour: DFM files are rejected if a property is placed below any child objects owned by the main object. In other words, a TButton object should be defined below the last property of the TPanel object that the button is placed on. Tested with D2010, compiling with bcc32