|
true, true, Worth a shot. To get a frame a second it has to be ~300px * 150px viewport with reflections and ambient occlusion turned off. I don't know anything about handling hardware though. Currently it is all handled by c# .NET & GDI
|
|
|
|
|
It's tricky to write a software renderer that will be fast enough.
If you want direct pixel access, LockBits is indeed the answer. Depending on what your engine is producing, you may want to draw shapes instead (though if you are texture mapping and lighting, by pixel may be necessary).
|
|
|
|
|
My old engine used the graphics.DrawLine and the graphics.FillPolygon . This (even drawing a simple triangle) was much quicker than using a hand built pixel plotter using locked bits :/
My new engine has lighting and diffuse textures (working but slow at a frame per second with a few meshes on the screen)
Thanks
|
|
|
|
|
i have created a wcf service in 3.5 and trying to host it on 11s6. service was created on windows 7
when i host and browse for the service i get the error
"This collection already contains an address with scheme http. There can be at most one address per scheme in this collection"
i tried couple of things in web config but still getting the error
<serviceHostingEnvironment>
<baseAddressPrefixFilters>
<add prefix="http://localhost/"/>
</baseAddressPrefixFilters>
</serviceHostingEnvironment>
any idea how to get through this
|
|
|
|
|
Are you using multiple bindings in the service? If you use multiple bindings that use same protocol, it throws error.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
i am using basichttp binding
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHTTP" sendTimeout="00:10:00" closeTimeout="00:05:00" openTimeout="00:1:00" receiveTimeout="00:05:00"
allowCookies="true" bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard" maxBufferSize="2147483647"
maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647" messageEncoding="Text" textEncoding="utf-8"
useDefaultWebProxy="true" >
<readerQuotas maxDepth="2147483647" maxStringContentLength="2147483647" maxArrayLength="2147483647" maxBytesPerRead="2147483647"
maxNameTableCharCount="2147483647" />
<security mode="TransportWithMessageCredential">
<transport clientCredentialType="Ntlm" proxyCredentialType="None" />
<message clientCredentialType="UserName" algorithmSuite="Default" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service name="F2F.Service1" behaviorConfiguration="F2F.Service1Behavior">
<endpoint address="" binding="basicHttpBinding" contract="F2F.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="F2F.Service1Behavior">
<serviceMetadata httpGetEnabled="true"/>
<serviceDebug includeExceptionDetailInFaults="false"/>
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
|
|
|
|
|
I am working with WCF and Rest services, where i defined a UriTempalte with some http request, i know how to call this Request and Response functionality in ASp.Net, can i cal same Request, and get Response in Javascript/Jquery. I googled alot, please any one help me regarding this...
Thnks in Advance..
|
|
|
|
|
It's been a while, but it should be something like this I think.
var val1 = document.getElementById('clientid1').value;
var val2 = document.getElementById('clientid2').value;
var val3 = document.getElementById('clientid3').selectedIndex;
var val4 = document.getElementById('clientid4').options[index].innerHTML;
var val5 = document.getElementById('clientid5').innerHTML;
var datapropt = "{'val1':'" + val1 + "'";
datapropt += ", 'val2':'" + val2 + "'";
datapropt += ", 'val3':'" + val3 + "'";
datapropt += ", 'val4':'" + val4 + "'}";
$.ajax({
type: "POST",
url: "StaticWebMethods.asmx/TheWebMethodName",
data: datapropt,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (result) {
location.reload(true);
}
});
the function in the StaticWebMethods.asmxfile would look similar to this:
[WebMethod]
public static bool TheWebMethodName(int val1, string val2, string val3, string val4){
}
Hope this helps.
V.
|
|
|
|
|
I am looking to create a small application that I can load an xml or to connect to a DB and generate some controls on a User interface.
The xml or DB needs to store only 10 controls.
Best regards,
Yous
|
|
|
|
|
Uh huh... well that's easy enough, many ways to go about it. Are you just looking to experiment? Or do you have a real scenario?
|
|
|
|
|
I have a small scenario.
I 'd like to create/store in a XML or db some controls like textbox, listbox, combobox,... Défined by the Administrator.
When the user start the gui, the user interface will be generated from the xml or db.
After,The user Will fill the datas selected with the controls and after i need to generate an XML file or db with the content.
|
|
|
|
|
OK I am a newbie and I am wondering, why You would want to do it that way? Maybe use a stored procedure to populate the form from the data how could you control The layout?
If My question seem's silly Remember I am trying to learn all I can.
Thanks
Frazzle the name say's it all
|
|
|
|
|
bysystems wrote: create/store in a XML or db some controls like textbox, listbox, combobox
Do you mean store the contents of a listbox or combobox?
|
|
|
|
|
Hi, I am going to suggest that you break this problem down into stages:
1. figure out how to create an instance of a control directly from a structured string: for example: given:
"Control:TextBox, Name:TB1, DefaultText:Enter data here.,Location:'100 200', Size:'100,24', BackGroundColor:Color.Silver, ForeColor:Color.Black"
How do you parse that string, or some similar string, and dynamically create a TextBox Control with the appropriate properties.
Hint: use 'CreateInstance.'
2. Once you know how to dynamically create controls, then focus on how you add them to the user interface (simple).
3. Finally, when you are ready to save the controls, and their properties, and/or contents, out to a file, you have many options for serialization, such as: writing XML, writing JSON (see Mehdi Gholam's excellent JSON article here on CP), etc.
good luck, Bill
"In the River of Delights, Panic has not failed me." Jorge Luis Borges
modified on Tuesday, August 30, 2011 3:10 AM
|
|
|
|
|
To start with you need to consider carefully exactly what you (and the user) think that you are going to achieve by doing this.
For example if all you want is a 'list' of values then that it fairly simple.
If you think that you are going to create a system that encapsulates user defined layouts, multi-level hierarchies, complex controls, etc then it is unlikely to provide benefit. The reason for that is that by the time someone is competent at doing that then they are essentially replicating what a programmmer would be doing in the first place (with a great deal more complexity.)
So if the first.
1. Create a simple syntax that represents a limited set of controls. Like 'list', 'radio', 'text'.
2. For 'list'/'radio' there needs to be a way to provide values. Optionally for 'text' you might provide a regex.
3. Each item needs to be able to specify an xml element name.
4. You consume a block of these entities and create a dialog that lists each top to bottom. Obviously you create controls dynamically based on the definition from 1. Optional, only AFTER everything else works, make the controls distribute themselves such that the dialog is not just a top to bottom resource.
5. On Ok the element from 1 is used to create xml.
|
|
|
|
|
I have a C#.net 2008 desktop application that I would like to stop before the first desktop screen shows up. I want to stop this application from executing immediately if the user has not been granted access to the application after looking up what access they have been granted by the active directory.
I want to stop the application before the following statement is executed: Application.Run(new Mainform());
i would like to stop the application from running in program.cs.
The only options that are close to what I want to do are:
Application.ExitThread(); or Application.Exit();
However these statements run after the Application.Run(new Mainform()); statement is executed.
Thus my questions are:
1. Is there way to not display the first desktop screen? If so, what would be code be?
2. If that is not possible, what are my other options? Do I just display the desktop tabs and let the user select the tabs they want to work with? if the user does not have access to that tab, do i display a message saying 'no access' and redisplay the screen like it was before the user clicked on the tab? if so, can you show me some example code?
3. If my options do not work, what do you suggest and can you point me to a reference of some code I can use?
|
|
|
|
|
typically Application.Run(new Mainform()); is located inside a Main() method inside the Program.cs file. There is nothing special about either one of those, so you are allowed to edit the file, and insert statements in front of the Run(Form) call. I do license checking, or other overall go-nogo decisions, right there, and when the need arises I create a small Form and show it modally i.e. with ShowDialog(); then decide whether to continue or terminate, i.e. Application.Run(new Mainform()); then sits inside an if-block near the end of Main() .
Luc Pattyn [My Articles] Nil Volentibus Arduum
modified on Monday, August 29, 2011 6:34 PM
|
|
|
|
|
main()
{
if ( userhasaccess )
{
Application.Run ( ... ) ;
}
}
|
|
|
|
|
Something along these lines...
You'd need using statements for System.Threading and System.Security.Principal
[STAThread]
static void Main()
{
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
Thread.CurrentPrincipal = new WindowsPrincipal(WindowsIdentity.GetCurrent());
if (!Thread.CurrentPrincipal.IsInRole("SomeRoleToTest"))
{
}
else
{
Application.Run(new MainWindow());
}
}
So, check for required permissions - if they exist then allow the load sequence to continue. Otherwise, just have your code exit the Main routine and your program execution will end.
|
|
|
|
|
Does this code check permissions against the active directory?
|
|
|
|
|
The Windows Principle[^] object tests your windows group membership, it can be used both against local and remote group sources.
bool localResult = Thread.CurrentPrincipal.IsInRole("Administrators");
bool domainResult = Thread.CurrentPrincipal.IsInRole(@"SOMEDOMAIN\Domain Manager Group");
So yes, it's checking your group membership against active directory
[Edit]
I should add, the Thread.CurrentPrincipal check is only valid after you have set the CurrentPrincipal object, as demonstrated in the code block I've posted
http://wardyit.com/blog/michaelodeajones/archive/2008/07/29/why-is-thread-currentprincipal-identity-name-empty.aspx[^]
modified on Tuesday, August 30, 2011 10:05 AM
|
|
|
|
|
I have the following questions to ask about a C#.net 2008 desktop application that i want to modify by accessing the active directory values:
1. I am assuming the following code accesses the active directory and only keeps one active directory group value at a time. if not, can you tell me what is wrong with my assupmption.
a. The following code is the start call:
void InitBrowser()
{
CurrentUser = new TUser();
UserIs_Read = CurrentUser.HasTRole(TUser.TRole.Reader);
}
b. The following is the code it calls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Principal;
namespace T.Common
{
public class TUser
{
public enum TRole
{
User = 0,
Manager = 1,
Administrator = 2,
Reader =3
}
public WindowsIdentity Identity;
public WindowsPrincipal Principal;
string _Domain;
public string Domain
{
get { return _Domain; }
}
string _Username;
public string Username
{
get { return _Username; }
}
public TUser()
{
this.Identity = WindowsIdentity.GetCurrent();
string[] NameInfo = this.Identity.Name.Split('\\');
_Domain = NameInfo[0];
_Username = NameInfo[1];
}
public bool HasTUser(TRole Role)
{
switch (Role)
{
case TRole.Reader:
return IsInGroup("Reader");
case Reader.Manager:
return IsInGroup("Managers");
//break;
case EnrollTracRole.Administrator:
return IsInGroup("Administrators");
//break;
case EnrollTracRole.User:
return true;
//break;
default:
return false;
}
}
public bool IsInGroup(string GroupName)
{
if (this.Principal == null)
{
this.Principal = new WindowsPrincipal(this.Identity);
}
return this.Principal.IsInRole(GroupName);
}
2. Would I somehow benefit from the code below instead of using the code I listed above? (the code below is just a small part of the active directory logic I would be using) If so, can you tell me how the following code is better:
private String[] ADSearch(String ConnectionString, String filter, String field){
DirectoryEntry SearchRoot =
new DirectoryEntry(ConnectionString, _userName, _pwd);
DirectorySearcher searcher =
new DirectorySearcher (SearchRoot, filter);
{
SearchRoot,
Filter = filter,
PageSize = 100
};
seararcher.PropertiesToLoad.Clear();
searcher.PropertiesToLoad.Add(field);
try
{
using (SearchResultCollection results = searcher.FindAll())
{
List<string> r = new List<string>();
foreach (SearchResult searchResult in results)
{
var prop = searchResult.Properties[field];
for (int index = 0; index < prop.Count; index++)
r.Add(prop[index].ToString());
}
return r.Count > 0 ? r.ToArray() : new string[0];
}
}
catch (Exception ex)
{
throw new ProviderException("Unable to query Active Directory.", ex);
}
}
public bool ValidateUser(string username, string password)
{
bool result = false;
try
{
using (var context =
new PrincipalContext(ContextType.Machine,_domain, null, _userName, _pwd))
{
result = context.ValidateCredentials(username, password);
}
}
catch (Exception ex)
{
/ TODO: log exception
}
return result;
}
|
|
|
|
|
Please format your code snippets with the "code block" option.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I will do that the next time I enter any code. However, can you point me to a reference that shows me how to format the code so it is easier to read.
|
|
|
|
|
When you are entering a post, click the yellow-highlighted words right above the text box that say, "code block", then paste your code between the resultant tags.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|