|
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid..
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
|
Hi,
Below is the code and the output. Not sure how the second destructor getting called. Can anyone explain?
class Test
{
public:
Test()
{
cout << "user defined default constructor is called\n";
}
~Test()
{
cout << "user defined default destructor is called\n";
}
};
void main()
{
std::vector<Test> someVector;
Test t;
someVector.emplace_back(t);
}
output:
user defined default constructor is called <-- i understand this one
user defined default destructor is called <-- i understand this one
user defined default destructor is called <--- who is this?
|
|
|
|
|
You've posted this in the C# forum, but it appears to be C++.
Despite the similar names and vaguely similar syntax, they are completely different languages.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
See vector Class | Microsoft Docs[^]. This method creates a new object in place, so there is a second destructor to call when the vector goes out of scope.
|
|
|
|
|
I am working on a project of calculating the overall performance of a processing machine called (OEE), I write a WPF software c # create a form to enter data and program the formula to self-output in textblock. recipe : OEE = A * P * Q
A = production time - total downtime = run time (A)
P = Theoretical Cycle time * run time = The theoretical output (P) compares with the actual Output with the ratio of%
but the theoretical cycle time is how much detail is the data taken on a 5-minute machine (but here I just need to enter the estimated direct value to simulate)
All of the above indicators are percentages and time converted to minutes for easy calculation. It sounds easy to tangle but can you help me a little bit please !!![enter image description here][1]
modified 3 days ago.
|
|
|
|
|
Member 14680372 wrote: It sounds easy to tangle but can you help me a little bit please Help you how? You have not explained what part of your code is the problem.
|
|
|
|
|
Your calculation is simple:
OEE = A * P * Q But ... P is A times a theoretical value and Q isn't defined at all ...
And we have no idea what part of this is giving you a problem!
This is not a good question - we cannot work out from that little what you are trying to do.
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. So you need to give us "proper" information, including the context that is obvious to you because we have no idea what the "missing context" is!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Working on a WPF app that hit's a Web API.On the server, I have this code in my BizObject:
public UserEntity Login(CredentialsEntity credentials)
{
var user = _repository.GetUser(credentials.UserName);
if (user != null)
{
if (Cryptology.CompareHashedString(user.Password, credentials.Password))
{
if (user.CanLogIn.HasValue && user.CanLogIn.Value)
{
return user;
}
}
}
return null;
}
While it works, the Password on the Credential object (credentials.Password) is in plain text. I know this isn't right, but I'm not sure of the correct way to do this?
What's the right way here?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
Make sure the web API is only available over HTTPS. That way, the transport takes care of encrypting the data in-flight for you.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I had a problem which I cannot solve for weeks and could not found any solution for it even I tried to look at NLayers but still not sure on how to do it. Can I ask that how can I read MPG Video into Naudio and control the left right channel? My customer does not want to change the video format to MP4, insist on using MPG file format for their KTV System.
Below is my snippet of codes
Im using Object as Player
<object id="Player" width="50" height="50" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" VIEWASTEXT>
<param name="SendPlayStateChangeEvents" value="true" />
<param name="autostart" value="true" />
<param name="URL" value="<%=mySrc %>"/>
<param name="enabled" value="True"/>
<param name="balance" value="0"/>
<%--<param name="currentPosition" value="<%=myFForRewind %>"/>--%>
<param name="enableContextMenu" value="True"/>
<param name="fullScreen" value="true"/>
<param name="mute" value="False"/>
<param name="playCount" value="1"/>
<param name="rate" value="1"/>
<param name="stretchToFit" value="false"/>
<param name="uiMode" value="none"/>
<param name="volume" value="<%=myVolume %>"/>
<!--[if !IE]>-->
<!--<![endif]-->
</object>
The Naudio Code as below:
protected void ImageButton7_Click(object sender, ImageClickEventArgs e)
{
Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "StartMeUp()", true);
player.player1 = new DirectSoundOut();
player.player1.Init(player.mono);
player.player1.Play();
}
|
|
|
|
|
Naudio says it handles "audio" files and makes no mention of "video" files.
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
|
|
|
|
|
Did you check the MPEG file to make sure it's has a stereo audio track, and not a mono audio track?
You could use an MPEG inspector that will give you the details of the file.
Member 13943087 wrote: player.player1.Init(player.mono);
Your code say to play mono, which will combine both tracks, or default to the left or right audio channel.
Mono is a single audio track,
Stereo is a left and right audio track.
Dolby is a 5 channel audio track.
Guess us old guys remember the mono days, and AM radio, FM was broadcasted in stereo.
NAudio/ConvertBetweenStereoAndMono.md at master · naudio/NAudio · GitHub
If it ain't broke don't fix it
Discover my world at jkirkerx.com
|
|
|
|
|
Hi all,
i draw a string diagonal on my Panel,
and draw this text with opacity option
get color for text like below:
PrintPageEventArgs pe;
int X = 0;
int Y = 0;
RectangleF rect2 = panel2.ClientRectangle;
float image_draw_wd = panel2.Width;
float image_draw_ht = panel2.Height;
Brush myBrush = new SolidBrush(Color.FromArgb(128, Color.Blue));
StringFormat stringFormat = new StringFormat();
stringFormat.Alignment = StringAlignment.Center;
stringFormat.FormatFlags = StringFormatFlags.LineLimit;
stringFormat.Trimming = StringTrimming.Word;
SizeF sz = pe.MeasureString(panel2.watermarkText, panel2.watermarkFont, (int)image_draw_wd, stringFormat);
double angle = 0;
double angleRadians = Math.Atan2(image_draw_ht, image_draw_wd);
angle = angleRadians * 180.0 / Math.PI;
pe.TranslateTransform((rect2.Location.X + rect2.Width / 2), (rect2.Location.Y + rect2.Height / 2));
pe.RotateTransform((float)angle + flip180Image);
pe.TranslateTransform(-(rect2.Location.X + rect2.Width / 2), -(rect2.Location.Y + rect2.Height / 2));
X = (int)(panel2.Width - sz.Width) / 2;
Y = (int)(panel2.Height - sz.Height) / 2;
RectangleF dr_rect = new RectangleF(new Point(X, Y, new Size(image_draw_wd , ((int)sz.Height) + extra_margin));
pe.DrawString(panel2.watermarkText, panel2.watermarkFont, myBrush, dr_rect, stringFormat);
but when i print it, the text not fully visible
if i draw it horizontally its working fine.
i cant understand where is the problem
please help me for this.
thanks alot
modified 30-Nov-19 2:28am.
|
|
|
|
|
Quote: when i print it, the text not fully visible
if i draw it horizontally its working fine.
This doesn't make any sense to us without the code you used to cause the problem: try generating a tiny bit of code that shows it working and not working, and post that for us so we can see exactly what you are doing. It you can explain what you mean by "not fully visible" that would help as well - does the left side work, but not the right, or the top but not the bottom, or every second character is gone, or what? We don't know, and it's probably relevant.
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!
|
|
|
|
|
Please check i update my question,
and please help now
|
|
|
|
|
That should crash: pe is null
PrintPageEventArgs pe;
...
SizeF sz = pe.MeasureString(panel2.watermarkText, panel2.watermarkFont, (int)image_draw_wd, stringFormat); You need to use the PrintPageEventArgs that is passed in as part of the PrintPage event or the metrics you use for MeasureString won't work anyway as they aren't relevant to the device context you are drawing on - even if you construct one somewhere and don't show it here.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
its not null its come from here
private void PrintDocument1_PrintPage(object sender, PrintPageEventArgs pe)
|
|
|
|
|
Thanks - I assumed it would, but when it's explicitly shown as a new declaration it needs to be confirmed.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
sorry to poor presentation
but please understand and help me
|
|
|
|
|
When you say "the text not fully visible" what exactly do you mean?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
is there any option to show the image how can i upload my drawing image to describe u better
|
|
|
|
|
No, because we get some idiots here who would post ... ummm ... objectional material
You wouldn't believe what tries to get through moderation ATM, and we can't moderate every post, there aren't enough of us volunteers to do that. And you don't have sufficient rep yet to store images here.
You could put it up on Dropbox / Google and provide a link?
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
actual design like this
Actual_Label.png - Google Drive[^]
and printed like this
Label_print.png - Google Drive[^]
but when i draw string horizontally its print like original
one more thing when i check its print preview its looks perfect,so why its not print ok
thats why i cant understand where is the problem
modified 30-Nov-19 4:20am.
|
|
|
|
|
OK - I'm trying to duplicate exactly what you have, but ... your code won't compile without errors and I don't want to fix them in case I "fix them wrong".
For example:
RectangleF dr_rect = new RectangleF(new Point(X, Y, new Size(image_draw_wd, ((int)sz.Height) + extra_margin));
Missing a close bracket (at a guess, after the "Point(X, Y" is where it goes).
PrintPageEventArgs doesn't contain methods MeasureString, TranslateTransform, and RotateTransform: PrintPageEventAgrs.Graphics does.
If that is copy'n'pasted from your app, then it's possible you are testing an older version of your source - in which case the display fault may no longer exist if you fix that code.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!
|
|
|
|