Click here to Skip to main content
14,920,477 members

Comments by raddevus (Top 49 by date)

raddevus 12-Apr-21 16:27pm View
   
Time-complexity would be O(n^2) because you iterate through n items once in the foreach loop and then once in the while loop.
The print part isn't really a part of the algorithm and should actually be removed into a separate function and shouldn't really be counted as an iteration through the items, since it is just for output.
raddevus 13-Feb-21 10:29am View
   
I've added new info to my original answer. Hope it helps. :)
raddevus 29-Jan-21 8:45am View
   
Try...
return null;
instead of the...
return View()
I think you may be pleasantly surprised. If this works, you can determine some way to return null when you want.
raddevus 23-Jan-21 15:12pm View
   
Did you set up the SMTP options (outgoing server) for the outgoing email?
--smtp-server=<host>
--smtp-server-port=<port>
see more at: https://git-scm.com/docs/git-send-email
raddevus 1-Jan-21 16:34pm View
   
I tried your code. It failed upon attempting to enter the two player names. I wanted to see it run so I altered the case 1 statement to include newGame() and the game started without a player 2 name anyways.
I played an entire game and I'm impressed with this example program in C. It's quite nice and amazing that it actually determines a winner.
Also... to save your data you should just save each value the user enters into a CSV (comma separated values) file.
raddevus 6-Nov-20 13:47pm View
   
Also, the value is an _attribute_ of the XML tag. I'm assuming you're attempting to get the value of the attribute which is named value.
The value of a tag would be something like <title>The Bering Sea: A Book About Sea Life </title> It's what is between the tags. An attribute value is different.
raddevus 26-Oct-20 10:06am View
   
Really great and interesting answer. Thanks
raddevus 26-Oct-20 10:05am View
   
I've often wondered about this also and this is a great question. Thanks for asking it here where there are people who can offer some answers. Really great. Thanks
raddevus 5-Oct-20 17:13pm View
   
Great points and resources. thanks
raddevus 31-Aug-20 15:12pm View
   
check out part 2 (added to my answer above) - what you're wanting to know how to do is set up the XMLHTTPRequest XHR so you can post to the controller, it was in part 2 of my articles: https://www.codeproject.com/Articles/5268710/NET-Core-Web-API-The-Least-You-Need-To-Know-Part-2
raddevus 8-Jul-20 14:32pm View
   
Post a snippet of your code that you have tried. You marked this as Java but I'm guessing (from the names of the controls) that it is actually Java on the Android application dev platform, right? Explaining how to pass values like this takes a longer explanation.
Mention all important details like that so the person with the correct expertise can help you. Here's a book, only $2.99 that will help you understand how to pass values in Android: https://amzn.to/3fd2TsC
raddevus 30-Apr-20 13:33pm View
   
create a specific span or div element with an id="yourId", then use query selector to select the item and add the style to the specific item.
Also, modern element selector is document.querySelector("#yourId") for single and document.querySelectorAll(".classItem") -- returns collection of elements (id selector can be used with querySelectorAll() also.
raddevus 27-Apr-20 16:40pm View
   
I understood that, but I've seen this occur when the control isn't properly "registered" to Visual Studio. I have had the problem in the past and adding it into the Toolbox has resolved it for me in the designer.
The process of doing that somehow "registers" the control and Visual Studio can render the control. Did you try it? Did you restart VSTudio? Did it not work?
raddevus 21-Feb-20 9:33am View
   
Yes, looks good. Now the month1 variable has scope that is larger than just the try block.
raddevus 20-Feb-20 17:36pm View
   
I think you are saying that you have a 1 to Many relationship from User to Quest.
1 user can have 1 to many quests.
In this case you can create a simple table that contains only two columns:
User_id, Quest_id

Then you simply put your data in there and use it for the join later.
User_id, Quest_id
1 , 1
1 , 3
1 , 4
1 , 5
2, 3
3, 1
3, 2

You see, some users have many quests(userid 1) and others (userid 2) only have 1.
raddevus 9-Dec-19 14:20pm View
   
This is interesting, because I tried it with a local extra spreadsheet file and it failed too. It is a security thing. You need to add a Module and then add your code to that module and you'll be able to run it.
Here's how you add a new module ---> https://i.stack.imgur.com/OTELN.png
I've actually solved this another time and you can see my answer (which displays that image) at StackOverflow: https://stackoverflow.com/questions/33741488/cannot-run-the-macro/42773999#42773999
My answer is NOT the official answer but has been upvoted more than the official. :)
This will get you to the solution. In the end, the problem is really because of newer security features of Excel -- it doesn't want other files to be opened unless the code is in the protected module area. Please let me know if that works.
raddevus 16-Aug-19 9:42am View
   
Very good points. Was attempting to provide basic "test" solution with string concatenation.
raddevus 7-Aug-19 15:44pm View
   
Oh, also, I see that it looks as if WPF doesn't implement NotifyIcon according to this: https://stackoverflow.com/questions/17674761/can-i-use-notifyicon-in-wpf
But there is a project here on CP that may work you thru it: https://www.codeproject.com/Articles/36468/WPF-NotifyIcon
raddevus 7-Aug-19 15:42pm View
   
I know that there is no requirement under WinForms and using NotifyIcon so it is probably the same under WPF. Here's an example I just fired up and got running in LINQPad (Linqpad.net) and it displayed the notifyicon in the tray even though I'm not an admin on my machine : https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.notifyicon.-ctor?view=netframework-4.8#System_Windows_Forms_NotifyIcon__ctor
raddevus 23-Jul-19 8:25am View
   
I have waited so long to be a hero, but I knew I'd make it one day. :D Glad it helped.
raddevus 21-Jul-19 18:26pm View
   
What is on line 138 of Cusinfo.aspx.cs?
C:\Users\Zeeyana\source\repos\Money Changer\Money Changer\Cusinfo.aspx.cs:138

That is the thing that the runtime thinks is null.
raddevus 1-Jul-19 13:13pm View
   
Check out the selected answer on this SO: https://stackoverflow.com/questions/6328713/urls-with-slash-in-parameter
raddevus 1-Jul-19 11:14am View
   
I don't believe UrlEncode will work here, since it won't encode the slash (/). if you open your browser tools F12 and type the following in the console you'll see you get the same string (non-encoded): encodeURI("B0015/A") // javascript's version of url encode.
I tried the other one also and it does the same -- does not encode the slash:
Console.WriteLine(Uri.EscapeUriString("B0015/A"));
If you want to try base64 encoding as javascript you can try:
btoa("B0015/A") // in console
raddevus 20-Jun-19 15:42pm View
   
Send it in as a querystring variable, then extract it.
build your URL that you will submit:
www.yourthing.com/thing/?divCount=195

<?php
echo $_GET['divCount']; //Output: 195
?>



Your next question will be: HOw do I post the URL?
Check out this --> https://stackoverflow.com/questions/5647461/how-do-i-send-a-post-request-with-php
raddevus 22-Apr-19 15:37pm View
   
Yeah, since it's a winform app try using just the DataSource, DisplayMember and ValueMember properties on that clientDropDown and then it may work -- depending upon a number of other things. it can be a bit tricky getting it just right.
raddevus 22-Apr-19 14:22pm View
   
Yes, I think that is the cause. I don't have a lot of info to help you fix that though.
Is this a WPF app? I thought it was WinForms.
If it is WPF there is a very good explanation here at CP about this databinding like you are attempting: https://www.codeproject.com/Articles/671544/Understanding-SelectedValue-SelectedValuePath-Sele

it's short and may help.
raddevus 22-Apr-19 13:24pm View
   
Since it works with the hard-coded ID value (a known integer) then the problem is probably with how the value is being retrieved from the droplist. Have you set DisplayMember and ValueMember of the droplist (combobox, or whatever that is) properly?
For example of what I mean see:
https://stackoverflow.com/questions/9521980/combobox-valuemember-and-displaymember
raddevus 22-Apr-19 11:42am View
   
It's difficult to determine what is going on. But I do have two suggestions (maybe you've already tried them?).
1) replace the SelectedValue with a hard-coded value (possibly one you know is valid) and try running.
change => { "@ClientId", ClientDropDown.SelectedValue }
to => { "@ClientId", 5 }

2) Run in debug mode step into LoadDateDropDown and press F11 on each line (step into) to determine exactly where the code is failing.
raddevus 8-Apr-19 13:59pm View
   
Fantastic! I was just reading this and I googled for a solution and the answer at https://stackoverflow.com/questions/3159213/how-do-i-create-a-simple-web-server-using-wcf-without-the-servicehost-class is really great. You can run that example in LINQPad.net (https://www.linqpad.net) with the following using statements:
System.Runtime.Serialization, System.ServiceModel.Channels, System.ServiceModel, System.ServiceModel.Web
raddevus 31-Jan-19 14:56pm View
   
If you successfully create a separate thread it will not be allowed to write to the UI since the UI-thread (main thread) is managing that work too. In most instances if you get it to do so your app will crash. However, I believe you are saying you are attempting to do a delegate for that exact reason.
Unfortunately, you're probably not going to find a lot about it in VB.NET resources, but here is a fantastic write-up that should help you understand these concepts better: http://www.albahari.com/threading/ -- This is the original author of C# In A Nutshell O'Reilly book. It'll help you get through the challenges if you ignore that it is C# centric.
raddevus 25-Jan-19 13:25pm View
   
You get a full column of blue because it iterates through every row in the datagridview and sets it blue : dgvSODetail.Rows[i].Cells[3].Style.BackColor = Color.Blue

Rows[i].Cells[3] is every row since i changes.
raddevus 19-Nov-18 18:14pm View
   
sizeof(List) returns the number of bytes the entire list takes in memory.
sizeof(List[0]) returns the number of bytes one element take in memory.
If Int is Int32 then each one takes 4 bytes.
So if you have 4 elements in your list then sizeof(List) returns 16 bytes.
And, of course, sizeof(List[0]) returns 4.
16 / 4 = 4
so while i < 4 (0 - 3) the for loop will execute.
raddevus 10-Oct-18 15:00pm View
   
It's no problem. Thanks. :)
raddevus 10-Oct-18 13:45pm View
   
Wait. Was I down-voted for answering an old question or because my answer was bad? Inquiring minds want to know. Actually, I don't really care, just hoping these comments are posting to your email. hahahhaaaaaa!!! Lighten up, Francis.
raddevus 10-Oct-18 13:30pm View
   
Haha! "A good answer never grows old".* ~Confucious
Actually, right after I submitted the answer I was like, "wait, when was that question asked?" and I noticed how old it was.
The question bubbled up on the right side of the questions page and I answered it before I noticed that it was old.
I often do lame stuff so I figured leave this additional lame thing in the history record. :)

*Totally fabricated quote, but it sounds good here. :)
raddevus 9-Oct-18 14:23pm View
   
Okay, easy enough, I updated the script -- updated my entry to show the code. You can go to the jsbin and see the final code. You'll need to make sure you close the tab you had it previously loaded on and then open the link in a new tab in your browser to insure a refresh.
raddevus 9-Oct-18 14:11pm View
   
i updated it with the addt'l code. Tried to get it done before comment but was late. :)
raddevus 9-Oct-18 14:09pm View
   
Deleted
i updated it with the addt'l code. Tried to get it done before comment but was late. :)
raddevus 12-Jul-18 8:24am View
   
But the question was about PHP, so... :) Which from my understanding is a version of the Java ASCII Unicode standard library. xD
raddevus 1-Jun-18 14:59pm View
   
You definitely got me. Haha :)
raddevus 1-Jun-18 14:58pm View
   
Deleted
oh, no sorry, I meant the technology. I totally understand that others do not necessarily speak English as their first language. I wish I could read/write/understand another language well enough to ask tech questions in that language. THe original question just sounded interesting to me because of the encryption of an image. Nothing more. Thanks
raddevus 1-Jun-18 14:58pm View
   
oh, no sorry, I meant the technology. I totally understand that others do not necessarily speak English as their first language. I wish I could read/write/understand another language well enough to ask tech questions in that language. THe original question just sounded interesting to me because of the encryption of an image. Nothing more. Thanks
raddevus 1-Jun-18 12:48pm View
   
I was actually finding humor in the original question because it was basically a jumble of sentences. I'm still not sure what the original question was.
Zipping with a password sounds good.
raddevus 31-May-18 18:33pm View
   
But if I get your password will it still be secure? Will image still be encrypted? Sounds like a single point of failure to me.



Please, please, please know that everything I've just said it meant as comic relief. Also, please note that if you cannot understand this humor, it is only because you haven't applied the proper decryption algorithm. Try ROT-13 first and other super-secure algos first. :D
raddevus 25-Feb-18 16:39pm View
   
That is interesting and could be because mine is the same program running multiple times --- meaning the random value is seeded the same every time it is run. I will add the loop to mine just to see what it does.

Mine is also compiled with g++ under Debian but since this is all standard library stuff that shouldn't matter.

EDIT
Yep that's it. I added the for loop to call rand() ten times and I get pseudo-random list of values.
2 1 2 2 2 2 1 1 2 2
However, every time I run it I get that same list of 10 values, of course.

And, of course if I add the call to srand() then every time I run the program I get a more random list of 10 values.

Here's my final code:

#include <stdlib.h>
#include <iostream>
using namespace std;
int main(){
srand(time(NULL));
int random_number = (rand() % 2) + 1;
for (int i = 0; i< 10;i++){
cout << random_number << " " ;
random_number = (rand()%2)+1;
}
cout << endl;

}
raddevus 25-Feb-18 12:53pm View
   
I just compiled that and ran it about 10 times and I got 2 every time.
I put the program in a shell script and called it a number of times and still got 2 every time.
Does the rand() call need to be seeded first or something?
Just curious

Here's my code
#include <stdlib.h>
#include <iostream>
using namespace std;
int main(){
int random_number = (rand() % 2) + 1;
cout << random_number <<endl;
}

EDIT
I added the following line of code before the call to rand() and it seems to generate 1 as the output now too.
srand(time(NULL));
raddevus 6-Dec-17 15:26pm View
   
I know. I thought the same thing. Funny, right? :)
raddevus 19-Dec-16 16:22pm View
   
I just tried that, but unfortunately, that doesn't quite get it. In this case you cannot break on JavaScript lines (no debug available). I do have a web.config that sets debug mode to be true and in the Studio editor I've set a breakpoint and Studio looks as if it will hit the breakpoint (it's red in the UI) but it never does. Also, obviously, in this case the web.config is basically ignored because the ASP.NET engine isn't really running since my app is just html, js, css.
Also, as an FYI I did add all files successfully to the empty project and Studio recognizes them all.

Also, I'm not sure how to get the JS minification to run outside of the call that an MVC project makes in the global.asax, so I don't get minification either.

Also, @RyanDev, did you down-vote the question? That doesn't seem very helpful of you, if you did.

Later after my last comment and attempting to discuss...Another down-vote without explanation. It's too bad you guys couldn't actually create a real community of discussion. It's too bad CP allows this behavior.
I am open to discussion and changing my question.
Good luck.

Edit 3
Yes, I'm going to keep editing this and responding to your down-votes, because it is fun. You trolls are so dim-witted. I think it is fantastically hilarious. Keep 'em coming bro.
When you down-vote a question on the community, you are actually down-voting yourself and the community.
And you live in that community. Hilarious.
raddevus 28-Apr-16 10:59am View
   
Reason for my vote of 5 \n Interesting tip and interesting thinking to get to the result. Thanks for sharing.