| Welcome, Guest |
You have to register before you can post on our site.
|
| Online Users |
There are currently 762 online users. » 0 Member(s) | 759 Guest(s) Applebot, Bing, Google
|
| Latest Threads |
TIWjQDBGrid erratic behav...
Forum: IntraWeb General Discussion
Last Post: alex.trejo@tttnet.com.mx
7 hours ago
» Replies: 8
» Views: 1,589
|
Change Language DataTable
Forum: IntraWeb General Discussion
Last Post: Rigoberto Mercedes
08-19-2026, 03:21 PM
» Replies: 1
» Views: 64
|
How to terminate HTTP Thr...
Forum: Indy
Last Post: rlebeau
08-14-2026, 08:01 AM
» Replies: 5
» Views: 450
|
Looking for UI Design Tip...
Forum: Delphi General Discussion
Last Post: chrisjordon232
08-06-2026, 05:17 AM
» Replies: 0
» Views: 129
|
TIWjQDBGrid DateFormat
Forum: IntraWeb General Discussion
Last Post: brushbuny
08-05-2026, 03:31 AM
» Replies: 2
» Views: 1,514
|
Simply convert PeerIp to ...
Forum: Indy
Last Post: DidierMenant
08-04-2026, 03:50 PM
» Replies: 2
» Views: 292
|
New CGDevTools build is a...
Forum: CGDevTools
Last Post: lfeliz
08-04-2026, 12:03 AM
» Replies: 2
» Views: 1,449
|
IW 16.2.0 Missing librari...
Forum: IntraWeb General Discussion
Last Post: JuergenS
07-31-2026, 09:44 AM
» Replies: 6
» Views: 1,408
|
CSS file not reloading af...
Forum: IntraWeb General Discussion
Last Post: CharlieDunn
07-29-2026, 10:02 AM
» Replies: 3
» Views: 549
|
Datatables question
Forum: IntraWeb General Discussion
Last Post: Alexandre Machado
07-28-2026, 04:34 AM
» Replies: 2
» Views: 359
|
|
|
| TIWVideo |
|
Posted by: troberts - 07-21-2023, 09:46 PM - Forum: IntraWeb General Discussion
- Replies (10)
|
 |
Hi,
I have tried the new TIWVideo component in IW15 and got it working. I am wondering if it can support a live video stream (either rtsp or multi-part jpeg)?
Thanks,
Tim
|
|
|
| Intraweb caching JavaScript files (Priority support) |
|
Posted by: valmeras - 07-20-2023, 09:57 PM - Forum: IntraWeb General Discussion
- Replies (7)
|
 |
I am using Intraweb 15.3.10 with C++ Builder 10.2.3
I am using Bootstrap 5.3 templates with my Intraweb application.
The template loads some JavaScript files:
<script src="bootstrap-js/bootstrap.bundle.min.js"></script>
<script src="wysiwyg-editor/dist/js/wysiwyg.js"></script>
Both Js files are in the wwwroot and Templates folders. Unfortunately I noticed that even if the Js is modified, Intraweb is using an old version.
The changes I make in wysiwyg.js are not reflected in the Browser during the execution of the program. When running the browser is showing the code below for a click on a button:
content += '<div class="form-group form-group-sm">';
content += ' <div class="form-row">';
content += ' <label class="col-xs-12 col-sm-4">Class:</label>';
content += ' <div class="col-xs-12 col-sm-8">';
content += ' <input type="text" class="form-control" id="urlClass" placeholder="CSS class name..." />';
content += ' </div>';
content += ' </div>';
content += '</div>';
But the real code in the Js file is below:
content += '<div class="mb-3">';
content += ' <div class="row mb-3">';
content += ' <label class="col-12 col-sm-4">Tile:</label>';
content += ' <div class="col-12 col-sm-8">';
content += ' <input type="text" class="form-control" id="urlTile" placeholder="Title of link..." />';
content += ' </div>';
content += ' </div>';
content += '</div>';
So the 2 codes which are supposed to be from the Js file are different!!
It is not related to the browser because I cleared the cache and tried 2 different browsers.
So it is Intraweb which is caching the wrong version and using it ignoring the changes I am making!
In the browser, the Js version used is located at http://localhost:20300/wysiwyg-editor/dist/js/wysiwyg.js
I tried to relocate the application cachedir, TIWTemplateCache::Instance->ClearCache(). But nothing is resolving the issue!
So, where is Intraweb is getting this old and wrong version from?
|
|
|
| Refactoring old code |
|
Posted by: Alexandre Machado - 07-18-2023, 05:54 AM - Forum: IntraWeb General Discussion
- Replies (2)
|
 |
An IntraWeb user asked me some help to refactor an old IW application that he is maintaining, written by someone else. I asked him permission to publish parts of the code because I find it valuable to learn a thing or two.
This is the original code (with some variable name changes so it can't be back traced):
Code: function CreateSelectHtml(var idComboBox, key, year, enabled, action: String):String;
var
html: WideString;
qryList: TFDQuery;
begin
Result := '';
qryList := TFDQuery.Create(Nil);
qryList.Connection := Controller.ConexaoEscola;
try
qryList.close;
qryList.sql.Clear;
qryList.SQL.Add(' Select distinct ');
qryList.SQL.Add(' A.grade ');
qryList.SQL.Add(' , A.code ');
qryList.SQL.Add(' , A.description');
qryList.SQL.Add(' FROM ESCW019 A ');
qryList.SQL.Add(' WHERE A.year = :year');
qryList.ParamByName('year').AsString := year;
qryList.Open;
html := '';
html := html + '<select class="comboselect2" id="'+idComboBox+'" style="width:100%" '+enabled+' onchange='+action+'>' + SLineBreak;
if key = '' then
html := html + ' <option value="" selected="selected">Select</option>' + SLineBreak
else
html := html + ' <option value="" >Select</option>' + SLineBreak;
qryList.First;
while not qryList.Eof do
begin
if (key <> '') and (qryList.FieldByName('code').AsString = key) then
html := html + ' <option value="'+qryList.FieldByName('code').AsString+'" selected="selected">'+qryList.FieldByName('desc').AsString+'</option> ' + SLineBreak
else
html := html + ' <option value="'+qryList.FieldByName('code').AsString+'">'+qryList.FieldByName('desc').AsString+'</option> ' + SLineBreak;
qryList.Next;
end;
html := html + '</select> ' + SLineBreak;
qryList.Close;
Result := html;
finally
qryList.Free;
end;
end;
He asked me what I would consider to change in code like this.
Here's my code review rant list 
1- There is no reason to use WideStrings. WideString should be used in COM and when calling Windows API directly. Other than that, no reason.
2- Setting the SQL: Each time qryList.SQL.Add() is called, a whole bunch of methods and events are triggered. Some events may even trigger Database requests (we never know). Don't do this. Set the SQL at once using a single Add() or, what I do, qryList.SQL.Text := 'bla bla bla'
3- String concatenation in a loop: Always a bad idea. You can get better performance using something like our TStrBuilder (declared in unit IW.Common.StrBuilder)
4- Using FieldByName() inside a tight loop. FieldByName performance has improved but it won't ever be as efficient as having the field reference to use directly. Use FieldByName() 1 time to get the field reference and then use it inside the loop.
5 - DataSet loop: As a rule of thumb, use DataSet.DisableControls..DataSet.EnableControls when looping a DataSet. You possibly don't know the implementation details of the DataSet. In this case you don't know if DisableControls will improve the performance or not. It does make a big difference in ADO DataSets, for instance.
6- One query field is not used at all
7 - Several statements have no reason to exist. Query.Close before destroying it, SQL.Clear just after creating the query, and various others.
Tomorrow I'll publish the code I wrote to replace this, keeping the same functionality and method signature.
|
|
|
|