|
|
I'm guessing he's associated with "PDF converter man" who has resurfaced at the same time. A total coincidence, I'm sure ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Compilers can do some kinds of optimizations, and even the first fortran compiler included that capability. Function calls mean a little performance hit, so inlining of functions is a possible optimization. The C# compiler can do that, and in case it misses such a possibility, you may use the AggressiveInlining attribute.
I'd like to know when the first compiler with function inlining capability was introduced, and how common it is nowadays beyond the .Net world.
Oh sanctissimi Wilhelmus, Theodorus, et Fredericus!
|
|
|
|
|
Pretty sure inlining is wide-spread, it has been around for decades before .net.
|
|
|
|
|
It was certainly in C++ in the early nineties - there are books from that period which describe it: The Advanced C++ Book, Skinner, M. T. (1992). Silicon Press. ISBN 978-0-929306-10-0.[^]
And I recall an inline keyword in my C compiler from the eighties, though it wasn;t added to the C spec until C99. I know that many compilers do inlining without being prompted (Java for example) but ... it depends on the module type and the function visibility to an extent. If the function is visible outside the module, it's harder to inline as it can't be called from an external app unless it exists as a "proper" function / method.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
By 1984 I was using a "globally optimising" Fortran Compiler at Perkin-Elmer (nee Interdata, later Concurrent). One of its tricks was function inlining fairly early in the compilation process, so redundant code could be stripped and register allocation done smarter.
It was fairly novel for its time and in its application space ("superminis"), but I'm pretty sure it wasn't the first.
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012
|
|
|
|
|
It started when "copy and paste" was invented.
It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it.
― Confucian Analects: Rules of Confucius about his food
|
|
|
|
|
Inlining is ages old, but in the old days, there were compilers / debuggers that couldn't handle it properly. If you wanted to step line by line through an inlined function, you had to turn off that feature while debugging. Maybe this applied only to a few compilers. I don't know if the limitation was in the compiler, the debugger or the debug format - it could be either.
There were other optimzing features that you had to turn off while debugging. E.g. an optimizer may detect that you are doing the same calculations twice, arguments being unchanged from the first to the second calculation. So it decides to rather store the first result in a register or temporary variable, and skip the second calculation. Now you set a breakpoint in the middle of second calculation (but not in the first) - but there is no code where the breakpoint can be inserted! It takes some juggling of instructions and breakpoint analysis to handle such situations.
A (true) story from the old days - not directly connected to optimization, but illustrating simlar issues:
This debugger could single step at the function call level (which was more useful than you think - I wish we had it in moder debuggers!), or at the source line level. There was a fatal crash in this 2000 lines(!) function when stepping call by call. When line-level stepping was enabled, the code worked perfectly fine. It took some effort to discover why, and it illustrates the issues when making a debugger:
In line mode, the debugger replaces the first instruction generated by each source line with at BPT instruction, saving the original instruction in its own buffer. When the BPT is reached, the original instruction is re-inserted into the code, the PC decremented to execute the same address again (this time with the original instruction rather than the BPT), the cpu is told to single step at the machine instruction level, and the BPT is re-inserted for the next time this point is reached.
As so often is the case: The culprit was a wild pointer, writing into code memory (the machine did not have separate spaces for code and data), overwriting an instruction. But in line mode, the debugger had a saved copy of the instruction, protected from the wild pointer. So the debugger replaced the destroyed instruction with the correct one; that is why the code didn't crash in line stepping mode.
|
|
|
|
|
Hi I have the following code:
public static string Decrypt(string encrypted)
{
byte[] encryptedbytes = Convert.FromBase64String(encrypted);
AesCryptoServiceProvider aes = new AesCryptoServiceProvider();
aes.BlockSize = 128;
aes.KeySize = 256;
aes.Key = System.Text.ASCIIEncoding.ASCII.GetBytes(Key);
aes.IV = System.Text.ASCIIEncoding.ASCII.GetBytes(IV);
aes.Padding = PaddingMode.PKCS7;
aes.Mode = CipherMode.CBC;
ICryptoTransform crypto = aes.CreateDecryptor(aes.Key, aes.IV);
byte[] secret = crypto.TransformFinalBlock(encryptedbytes, 0, encryptedbytes.Length);
crypto.Dispose();
return System.Text.ASCIIEncoding.ASCII.GetString(secret);
}
When it decrypts the first string decrypts fine but the second string gives the error "The input data is not a complete block" if the second string is in quick procession. Example decrypting a column on a datagridview, Searching online the error brings up forums where people say that padding is needed or that Dispose closes to early. However as you can see padding is set to PKCS7 and the call for dispose is as late as it can be. So I really don't understand why it is giving the error.
Thanks in advance for any help
modified 7-Jan-20 6:34am.
|
|
|
|
|
Setting the padding mode doesn't pad existing data - you need to start by getting the raw encrypted data (before it's translated to Base64 and feeding that into your decryptor.
If that works - and produces an output that is identical to the original input - then do the base 64 conversion each way and check that works. Then compare the Base64 strings against the string passed to your method.
If all of that is right, check the Key and IV byte values against those you used for encryption.
The debugger will give you all that - but we can't do any of that for you - we have no access to any of the information you are passing to the decryptor!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I have found the problem using debug and it was my own silly mistake.
I was using the code:
for(int i = 0; i < DataGridView1.Rows.Count; i++)
{
DataGridView1.Rows[i].Cells[1].Value = Decrypt(DataGridView1.Rows[0].Cells[1].Value.ToString());
}
As you can see each row was getting the value of the first row. So on the first row it was decrypting the string but on the second line it was trying to decrypt the first row that it had already decrypted. Hence the error.
I think I need a break that was quite embarrassing.
Thanks again for your help.
|
|
|
|
|
We all do it - I read what I meant to write all the damn time ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
|
|
Hey!
It would be great if you can share the document that is being fed to the ChatBot — the root cause for the "html" is not declared. It is hard to debug it this way, you can read the output of that request and share it here.
And never share the credential on the internet (your SO thread has the credential of your MVP-based profile), and avoid sharing the email address unless you want spam in your inbox.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
From the Error,
Still had one page of Login Page
|
|
|
|
|
Right, so it was at login attempt?
Consider using AD or something to delegate the authentication programmatically.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
any sample source code for AD login?
|
|
|
|
|
|
On Premise can use Azure AD?
|
|
|
|
|
|
On Premise AD and Azure AD had integrated. But how to retrieve the data from SharePoint?
from ChatBot?
|
|
|
|
|
The below code i found in some websites but it always return error
multicast_id":6719893729607364541,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
Code is:
WebRequest tRequest = WebRequest.Create("https:
tRequest.Method = "post";
tRequest.Headers.Add(string.Format("Authorization: key={0}", "Server key"));
tRequest.Headers.Add(string.Format("Sender: id={0}", "Sender Id"));
tRequest.ContentType = "application/json";
var payload = new
{
to = "//topics//news",
priority = "high",
content_available = true,
notification = new
{
body = "Test",
title = "Test",
badge = 1
},
data = new
{
key1 = "value1",
key2 = "value2"
}
};
string postbody = JsonConvert.SerializeObject(payload).ToString();
Byte[] byteArray = Encoding.UTF8.GetBytes(postbody);
tRequest.ContentLength = byteArray.Length;
using (Stream dataStream = tRequest.GetRequestStream())
{
dataStream.Write(byteArray, 0, byteArray.Length);
using (WebResponse tResponse = tRequest.GetResponse())
{
using (Stream dataStreamResponse = tResponse.GetResponseStream())
{
if (dataStreamResponse != null) using (StreamReader tReader = new StreamReader(dataStreamResponse))
{
String sResponseFromServer = tReader.ReadToEnd();
this.Label.Text = sResponseFromServer;
}
}
}
|
|
|
|
|
Quote: it always return error
What error?
Is there any message?
Where does the error occur?
What have you done to find out why?
What did the debugger show you was happening?
Remember that we can't see your screen, access your HDD, or read your mind - we only get exactly what you type to work with.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
This the error:
multicast_id":6719893729607364541,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"InvalidRegistration"}]}
Success 0
Failure 1
|
|
|
|