|
Thank you
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
I replied a couple of times on the post you provided
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
|
|
|
|
|
The variable names and string in your example suggest you are trying to encrypt a password. That is almost always the wrong thing to do.
If you're trying to write an authentication system, you should be storing a salted hash of the users' passwords, using a unique salt per record, and multiple iterations of a cryptographically-secure one-way hash. There is no way to "decrypt" the password; instead, you use the stored salt and repeat the hashing operation on the entered password, then compare it to the stored hash.
Secure Password Authentication Explained Simply[^]
Salted Password Hashing - Doing it Right[^]
If instead you're trying to store passwords or access keys for third-party systems, where you actually need to retrieve the original password, then you need to consider how you're going to store the encryption keys securely; how you're going to rotate them to minimize the impact if one is leaked; any many other complex issues. For example, you seem to be using a fixed IV for every value you encrypt, which is not secure.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I have three windows form say form1 ,form2 and pin form.In form1 user have to input some values.There is save button in this page .By clicking on save button Pin form is opened in that we have enter the correct pin and by clicking on submit button form2 get opened.In Form2 the values that user entered in the form1 is displayed in the old values column.
And then the user go back to form1 and modify the values and click save button to come to form2. That modified values are displayed in new values column.
The problem is that when second time i modify the values in form1 and click save to go to form2,there i am getting old values of form1 but I want both old values and new values
|
|
|
|
|
Well, there's a problem in your secret code that you didn't show.
It's not entirely clear what you mean by "old values" and "new values", so I'm just going to say this. It sounds like you're not updating the new values in the form when Form2 returns. It seems you're like ignoring them, or you're using controls to store values instead of a data model, and/or you're binding controls to the wrong properties in your model.
In all cases, without seeing the code, it's impossible for anyone to tell you what you're doing wrong.
|
|
|
|
|
OK, that's not too bad if you handle it right.
Add a property to Form2 to take the value. In the property setter, set the old values column.
Then go to Form1 and open the PIN form using ShowDialog - that means that Form1 will be "frozen" until the user closes the PIN form.
Now create an instance of Form2 and store it in a class level variable. Handle the Form2.FormClosed event, and clear that variable to null in the handler.
Display Forms2 using the Show method.
In the Save button handler, check the variable: if it is null, do nothing.
Otherwise, use the property to set the new value(s).
Sounds complicated, but it's pretty simple when you get your head around it.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Hi
I wrote the below simple code to merge two video files, it's working. But I wanna track the merging task percentage (or something that shows the progress), so I could show it using a progress bar. How to track the progress? Thanks.
textBox_taskMsg.Text = "Task is being performed.. This may take some time.";
string[] files = { textBox_Source1.Text, textBox_Source2.Text };
string output = textBox_Source1.Text + "_merged.mp4";
var conversion = await FFmpeg.Conversions.FromSnippet.Concatenate(output, files);
await conversion.Start();
textBox_taskMsg.Text = "Merge Complete.";
|
|
|
|
|
The only way to find that out is to go back to where you got the package from, and either ask there or read the documentation. But ... if you are using ffmpeg in a separate process, it's very unlikely that progress reporting is going to be possible: ffmpeg isn't a "windows aware" app, it's a console app and those don't generally report anything except to a console screen. And while you can pipe the console app progress to a stream you can read that requires getting the process itself, and providing extra command line instructions when the process is started. Since you are using a wrapper API, it would be entirely up to what that wrapper provides, and I'm not familiar with that one.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
You can use the 'OnProgress' event - ffmpeg Documentation[^]
To add a progress tracker using a percentage, add the following to your code -
textBox_taskMsg.Text = "Task is being performed.. This may take some time.";
string[] files = { textBox_Source1.Text, textBox_Source2.Text };
string output = textBox_Source1.Text + "_merged.mp4";
var conversion = await FFmpeg.Conversions.FromSnippet.Concatenate(output, files)
.OnProgress += (sender, args) =>
{
double progressPercentage = args.Percent;
textBox_taskMsg.Text = $"Merging... {progressPercentage:F2}% complete";
};
await conversion.Start();
textBox_taskMsg.Text = "Merge Complete.";
|
|
|
|
|
Hi.
I tried to merge two videos into one using Splicer library. When I ran the code (below), the code got non-responsive, so after awhile I stopped the code from executing. The resulting file (which was created by the code while it has became non-responsive) was over 11GB. I'm not sure how to fix that. Could anyone guide me please? Thanks.
--------
string[] filepaths = new string[10];
filepaths.SetValue(textBox_Source1.Text, 0);
filepaths.SetValue(textBox_Source2.Text, 1);
MergeVideos(filepaths, filepaths[0] + "_merged");
------
using (ITimeline timeline = new DefaultTimeline())
{
IGroup group = timeline.AddVideoGroup(32, 720, 576);
var firstClip = group.AddTrack().AddVideo(videoPaths[0]);
var secondClip = group.AddTrack().AddVideo(videoPaths[1], firstClip.Duration );
using (AviFileRenderer renderer = new AviFileRenderer(timeline, outputFilePath))
{
renderer.Render();
}
}
modified 6-Mar-24 0:33am.
|
|
|
|
|
The only person who's going to be able to "guide you" on this is the person(s) who wrote the Splicer library.
As far as I can tell, there is no documentation on it that survives anywhere and the project on GitHub hasn't been touched in the last 6 years.
It appears to be abandoned.
|
|
|
|
|
To add to what Dave has said, if you are recoding videos in order to join them together (and unless they have the same resolution, same frame rate, same codecs, and a very similar bit rate that is exactly what you have to do to get a working file) then it's going to take some significant time - we are talking hours here for 4K videos, even on a powerful machine, using well optimised software. The partial file size of 11GB isn;t that surprising in the context of the bitrate you appear to be requesting: is that "32" generating a 32K bitrate? If so, then the file size is going to be pretty huge and will take a long time to process.
Grab a free copy of XMedia Recode[^] (it's one of the tools I use for such jobs) and see how long it takes and the resulting video file size.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thanks.
The two files I'm trying to merge are around 30MB each. I'm actually not that familiar with working videos in C#, just playing around and testing here. Anyways, a video merger like Wondershare would take less than 5 mins to do it, and the resulting video would be less than 100MB. I'm not sure how to properly do that.
|
|
|
|
|
Check the bitrate on the result file from wondershare (windows explorer will show you that) and use VLC to check the codecs the result file contains - H265 for example is a lot more compact than H264 for example, but not everything can read it.
But as Dave said, that one would appear to be abandoned - and that may be because it was never finished, or had bugs, or ... you never know.
You know you can splice files directly using FFMPEG as an external process? Concatenate – FFmpeg[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have this block of code
try
{
_clientContext = new ClientContext(baseUrl);
_clientContext.Credentials = new SharePointOnlineCredentials(userName, Password.GetSecureString(password));
_clientContext.Load(_clientContext.Web, w => w.ServerRelativeUrl);
_clientContext.ExecuteQuery();
}
catch (Exception e)
{
throw;
}
The code stops for about 20-25 seconds on the ExecuteQuery line. If I paste the URL into a browser it loads quicly, so I know that's not the problem. No error is thrown. It's just really slow.
All subsequent calls to the server after that are ok. It's on this first calls that is really slow.
Can anyone shed some light on this? I'm not really sure how to debug this.
In theory, theory and practice are the same. But in practice, they never are.”
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
modified 2-Mar-24 19:34pm.
|
|
|
|
|
Use Fiddler[^] to check the traffic you are sending out on the first call. My suspicion is that the slow first call is because it's trying to hit the msoid endpoints, which don't exist so you are waiting for the connections to time out. The next call knows that these don't exist so it avoids them.
The fix is to change your hosts file to set these connections to your loopback address so that fails straightaway. Fiddler will identify what these domains are for you.
|
|
|
|
|
--When crystal reports is used to create HTML the output is poorly formatted.
--The same report will create a nice looking RTF file.
--I have tried all the options I can find, but the resulting HTML is too poor to be used in email unless the report rpt only produces very simple text output. Poor results if formatting uses underlining or tables.
Can you suggest an approach?
Dim htmlOpts As HTMLFormatOptions = ExportOptions.CreateHTMLFormatOptions()
htmlOpts.HTMLBaseFolderName = Path.GetTempPath()
htmlOpts.HTMLFileName = ReportFileName + randomPartOfFileName + "Html"
htmlOpts.HTMLHasPageNavigator = False
htmlOpts.HTMLEnableSeparatedPages = False
Dim exportOpts As ExportOptions = New ExportOptions()
exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML40 << creates really bad html
exportOpts.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.HTML32 << creates readable but poorly formatted in gmail or outlook
exportOpts.ExportDestinationType = ExportDestinationType.DiskFile
exportOpts.FormatOptions = htmlOpts
exportOpts.ExportDestinationOptions = diskopts
oReport.Export(exportOpts)
|
|
|
|
|
PhilMcGahan wrote: create HTML the output is poorly formatted.
No idea what that means.
If you open the html in a browser does it work? Then Crystal Reports did what is supposed to.
If you mean you open the html output in a normal editor and it is not 'pretty' then that is a you problem not a Crystal Reports problem.
You can fix it by finding a different application which runs from the command line and does a pretty print on html. Then add that to your report construction process.
|
|
|
|
|
With respect. If SAP created a calculator product that only worked with single digits would you suggest there is some thing wrong with the number 11.
SAP Crystal Reports creates usable HTML if the RPT file does not underline text or contains tables.
I am asking if anyone has experience taking a Crystal RPT and saving the output as html.
|
|
|
|
|
PhilMcGahan wrote: you suggest there is some thing wrong with the number 11.
Your original post did not suggest that it did not work. All you said was "is poorly formatted"
You might want to do the following
1. Explain in detail what the exact problem is.
2. Provide an small example that demonstrates the problem.
3. If you post code to this site then use code tags.
PhilMcGahan wrote: I am asking if anyone has experience taking a Crystal RPT and saving the output as html.
Googling suggests many people have.
Far as I can recall I only used it for Word and CSV. The Word output was fairly complex. It did require work arounds. But I did that 20 years ago. And the work around was due to memory constraints.
|
|
|
|
|
Solution:
To get perfect HTML out of Crystal Reports, out put your report to PDF, then use nuget package SautinSoft.pdfFocus to convert the pdf to HTML. I have tried many ways, this way works.
Public Shared Function ConvertPDftoHtml(pdfFile As String) As String
Dim htmlFileOut As String = pdfFile.ToLower().Replace(".pdf", ".html")
If File.Exists(htmlFileOut) Then
File.Delete(htmlFileOut)
End If
Try
Dim f As PdfFocus = New SautinSoft.PdfFocus()
f.OpenPdf(pdfFile)
If f.PageCount > 0 Then
Dim iResult As Int32 = f.ToHtml(htmlFileOut)
End If
f = Nothing
Catch ex As Exception
File.WriteAllText(htmlFileOut, $"ConvertPDftoHtml() Reports: {ex.ToString}")
End Try
Return htmlFileOut
|
|
|
|
|
I'm glad you were able to figure out a solution.
Just as an aside, that looks like VB, not C#. You posted in the wrong forum.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
NB: That is a commercial product, starting at $599 per developer.
Given the eight year break in messages, and the recent flurry of very similar messages, I'm starting to suspect your account has been taken over by a spammer.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The code below will load an rdl report from a datasource and save it as PDF. But only PDF.
If I choose any other format it errors with
System.ArgumentOutOfRangeException
HResult=0x80131502
Message=Specified argument was out of the range of valid values.
Parameter name: format
Source=Microsoft.ReportViewer.WebForms
...
at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]&
--- I would welcome a suggestion. Code as follows
Private Sub SaveReportAsHtml(rdcFile As String, outputfolderRoot As String)
'rdcFile = = "Report001ByPhil"
'outputfolderRoot = = "C:\temp"
Dim localReport As New LocalReport()
localReport.ReportPath = rdcFile
Dim ds As DataSet = FillADataSetWithSampleData()
Dim reportDataSource As New ReportDataSource("DataSet1", ds.Tables("table1"))
localReport.DataSources.Add(reportDataSource)
Dim mimeType As String
Dim encoding As String
Dim extension As String
Dim streamIds() As String
Dim warnings() As Microsoft.Reporting.WebForms.Warning
Dim outputFormat As String = "MHTML" 'does not work
outputFormat = "HTML3.2" 'does not work
outputFormat = "HTML4.0" 'does not work
outputFormat = "HTMLOWC" 'does not work
outputFormat = "PDF" 'works
Dim bytes As Byte() = localReport.Render(outputFormat, Nothing, mimeType, encoding, extension, streamIds, warnings)
Dim outputPath As String = Path.Combine(outputfolderRoot, "SSRS_output")
outputPath = outputPath + "." + outputFormat
DeleteFile(outputPath)
Using fs As New FileStream(outputPath, FileMode.Create)
fs.Write(bytes, 0, bytes.Length)
End Using
End Sub
|
|
|
|
|
Google
visual basic "LocalReport" render "Specified argument was out of the range of valid values."
From that and this very site
https://www.codeproject.com/Questions/1130614/How-to-render-localreport-to-HTML-using-csharp
It says you can't do what you are attempting. I did not verify the answer.
|
|
|
|
|