15,898,588 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by navyjax2 (Top 13 by date)
navyjax2
2-Sep-21 16:45pm
View
"Product.GetProduct()" calls a function in the Product controller called "GetProduct()" that you would need to build that returns a model of the Product table to "product" from the database, given a productID that is passed in.
navyjax2
18-Oct-17 19:01pm
View
Oh, never mind. I had to run the Command Prompt as an Administrator to see it.
navyjax2
18-Oct-17 18:56pm
View
I don't think this command is accurate at all. If I look in Control Panel > Administrative Tools > Local Security Policy, then look under Security Settings > Local Policies > User Rights Assignment, the "Impersonate a client after authentication", which would be the Description value for SeImpersonatePrivilege, has the local Administrators group there, and my domain account is in the Administrators group, but I do not see that privilege listed for me (I see only what you have posted, above). I have been able to run code to impersonate users. So something's amiss.
navyjax2
16-Oct-17 15:03pm
View
That will only write a file that's 1 KB or less. Needs a "while" loop, like Solution 2.
navyjax2
14-Dec-16 11:26am
View
@Mehdi and others, And I know I'm late to the party, but I think I need to remind my fellow developers that saying things like "use intellisense more" won't always help someone. I think he saw in there how he couldn't use Tick, or he wouldn't've posted the question. That doesn't mean you automatically, by osmosis or derivation, can somehow automatically know what selection in the intellisense is the actual, correct event. When I saw "Elapsed" the first time, I thought it was a way to set that the Timer had reached its interval, manually, not as a way to make it actually do its work that it would normally do with each interval, like Tick does. Don't assume everyone thinks like or knows as much or can deduce as well as you can. Yes, he could've gone to MSDN to look up what he had, but it doesn't always register that something should be "it" and there are usually a ton of different properties and events to work with, and searching on MSDN could always yield to you the wrong Timer for your project, since they have 3 of them (System.Windows.Forms, System.Threading, System.Timers).
navyjax2
14-Dec-16 11:06am
View
I rated this a "1" since it severely over-complicates things. You don't need delegates and invoke statements, and the Invoke syntax, with its "new Action" this, and its " => { }" that is very complicated and abstract. It is not needed for such a simple action that can be called directly, as the original poster was doing. And none of that fancy stuff had a bit to do with Timers, except for showing how you can add a delegate as a Timer event handler - which might've been too advanced considering it's not the norm. Normally we just call a function and have it do the work. Not showing the normal way things are done makes the beginner's job harder, since then all the guys reading this post begin using delegates, while all the guys out of college are using ElapsedEventHandler and don't have a clue what's going on...
navyjax2
14-Dec-16 10:59am
View
Would, if any of the answers actually could help someone. Saying "add .Start()" or "Timer does not have Tick events" doesn't answer the question. If I were coming on Timers for the first time, I wouldn't know what the hell was going on without an example, and since Google led me here, it seemed an example was a better way to convey what was needed than a bunch of "do this" or "don't do that" statements that these questions seem to get by lazy answerers. And one of the top-rated answers (#6), with its delegates and Invoke statements, severely overly complicates this question.
navyjax2
15-Jun-16 16:38pm
View
Also, btw, if the other method you are calling is not set up as static, you can't reference it with intellisense in any method that IS static. Another thing I hate about this stuff. I don't think that had anything to do with my issue, though -- placed all my code in a new folder called "AppCode" (instead of "App_Code") and everything worked fine.
navyjax2
15-Jun-16 16:35pm
View
Found that this issue manifests if using an App_Code folder and are calling one method in a class in that folder from another method, in another class, in that folder. Both classes were in the same namespace, had the Build Action = Compile, "using" statements included the namespace in both classes. When I created a regular folder and called it something other than a reserved ASP .NET folder name (i.e. I labeled it "AppCode" instead of "App_Code"), I didn't have the issue anymore. This was after downgrading the target framework from 4.5.2, when I didn't have any issues, to 4.0 - in case that's why it's being fussy.
navyjax2
14-Jun-16 11:57am
View
Then when you go to use "pi": "Member 'pi.MyMethod() cannot be accessed with an instance reference; qualify it with a type name instead". Then, so you do string myString = pi.MyMethod(); -- but then get The type 'MyNamespace.PersonalInfo' in 'PATH\PersonalInfo.cs' conflicts with the imported type 'PersonalInfo.MyMethod' in 'path\MyProject.dll'.
navyjax2
9-Jun-12 0:08am
View
It didn't do the link code right above. It should be:
link = '<a href="'+val+'" target="blank">'+txt+'</a>';
navyjax2
9-Jun-12 0:06am
View
irm box, ex. after DOM load event or similar, call this:*/
var myConfirmBox = new confirmBox('myConfirmBoxName');
myConfirmBox.title = 'the title i want to use';
myConfirmBox.body = 'the text body I want to show';
myConfirmBox.addOption('Yes',"http://www.codeproject.com");
myConfirmBox.addOption('No',"http://www.facebook.com");
</script>
</head>
<body>
navyjax2
9-Jun-12 0:05am
View
This could have been a good solution except it's riddled with errors...
1. Get rid of all things to do with visibility. It's easier to control it (and less buggy) with display:none or display:inline, whether it's CSS, JavaScript, or jQuery.
2. Get rid of this.domElement and replace it with just "document" (no quotes). Doing this.domElement the way you have it is like doing document.getElementById(_id).getElementsByTagName and you don't do it that way - you go after the element directly, either by tag name or ID, not both.
3. Wherever you have "options" you need "this." in front of it.
4. You didn't declare the variables "txt", "val", or "link".
5. Need to replace the "o" in "onclick" - it has the one with the 2 dots above it and that's something else entirely and not recognized by Javascript.
6. myConfirmbox needs to be "myConfirmBox" or "myconfirmBox", throughout. Javascript is case-sensitive.
7. myConfirmbox.text needs to be myConfirmbox.body. Text is undefined.
8. In .setContent, where you have title and body, it needs to be this.title and this.body.
9. The link HTML is wrong. I redid it to just:
link = '
'+txt+'
';
Otherwise the href value will append onto your current URL and it won't redirect right. You also need "http://" in front, not just start it with "www" in the addOptions.
10. "visible = !visible" can go away.
11. In the loop, this.options.length needs to not have parens on it, and the i++ does not get a semi-colon. var i needs to start at 0, not 2.
12. Remove or comment out "delete/article/321/", it serves no purpose
13. Remove "destination" from the open function. You're not passing anything into this function.
I spent an hour just debugging all of this because it's probably the only solution that would let someone be able to actually show a box with "Yes" and "No" cross-browser and it seems very customizable on the surface, though I had issues getting a border around it. Here is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>MessageBox</title>
<style type="text/css">
.confbox
{
width:300px;
height:300px;
z-index:999;
position:absolute;
top:30%;
left:30%; !adjust the top and left values in the js to better position the box
border:1px solid black;
}
</style>
<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var confirmBox = function(_id)
{
this.id = _id;
this.title = 'My dialog';
this.text = 'Set this value to set the body text';
this.options = new Array();
this.addOption = function(txt,val)
{
var o = [txt,val];
this.options.push(o);
}
this.setContent = function(title,body)
{
var link = "";
var txt = "";
var val = "";
document.getElementsByTagName('span')[0].innerHTML = '';
document.getElementsByTagName('h3')[0].innerHTML = this.title;
document.getElementsByTagName('p')[0].innerHTML = this.body;
for (var i=0; i<this.options.length;i++)
{
txt = this.options[i][0]; //text to show
val = this.options[i][1]; //action to perform. how you handle or process this depends how complex you want to get! callbacks etc... it's up to you.
link = '
'+txt+'
';
document.getElementsByTagName('span')[0].innerHTML += link + ' ';
}
}
this.open = function()
{
this.setContent();
if (this.visible)
{
//Add a function here to UNlock the underlying webpage
//Add a function here to center the box
$('#myConfirmBox').attr('style', 'border:none');
$('#myConfirmBox').attr('style', 'display:none');
} else {
//Add a function here to LOCK the underlying webpage
$('#myConfirmBox').attr('style', 'border:2px solid black');
$('#myConfirmBox').attr('style', 'display:inline');
$('this').css('background-color','lightblue');
}
}
}
/*and when you are ready to attach the script to the conf
Show More