Xodiak
Posts
-
Call MVC controller method in SIlverlight with params -
Without O(n2)go through the array and use a dictonary where object is the array element (or some unique identifer for the items in your array) and int is the count of occurances. go through the array once and add items into the dictonary if it doesn't exist, or increment the count value (the dictonary is a hash so it will be really fast in finding the key/seeing if it exists). after going through the array once, iterate each KeyValuePair in the dictionary and look for any int values greater than 1. your complexity is about O(2n + 1).
-
Singleton Pattern [modified]the one thing that the Singleton pattern ensures as that only one instance of the object exists in your application at any given time. you have a private parameterless constructor that instanciates that object if it doesnt exist (lazy loaded) and thats it. you want to rethink your design if you are having to pass in a parameter to the constructor. Why not have a method inside the GestorBD class called ReadXML(string xmlString)/ReadXML(int method) to do the reading of the xml? Its difficlut to say what is correct without looking at the entire purpose of your class.
-
Best C# book?C# Cookbook would be a good book to look at, you wont have any problem with syntax and OOAD, so no point in getting a book that steps you through that (since you are a C++ programmer). The C# cookbook will get you into the .Net framework and show you how to apply it correctly for a number of realworld/complicated problems from simple server side console application to remoting, threads and webservices.
-
C# user control in VB6? is it possible?i was wondering if it was possible to make a c# user control and imbed/anchor it into a vb6 form. what im trying to do is transition an application to c# 2.0 (three tier appplication with composite application block as teh front end). I would like to use c# user controls (these can be reused in the CAB) and wrapp it with a com/interop wrapper and use that same control in vb6, but im not sure how to approach it. any ideas?
-
Evaluating a mathematical equation from a string [modified]Hey guys, i was just wondering if there is something static funcitn in the Math, or string library that can evaluate a mathematical function...something like the following String problem = "2+2"; Double answer = WonderfulFunction.Evaluate(problem); //wonderful function being the function im looking for... just was wondering if it exists...if not then ill just have to create it...i figured there something out there... Thanking yall in advance, -- modified at 16:33 Tuesday 27th June, 2006
-
Voice Capture/Recording with microphoneThanks, i took a look at this previously and downloaded it. The program didn't seem to demonstrate or do anything...not sure if im just too dumb to see it. any clarification of what this program does?
-
Voice Capture/Recording with microphonei was wondering if there is anything out there that will help me capture voice from my mic and save it as a wav file/data stream in c#? DirectSound a good place to start looking? SpeechSDK? all help is greatly appreciated...thanks guys
-
Multiple font types in richtextbox?thanks :-)
-
Multiple font types in richtextbox?Can the richtextbox control in c# support mulitple fonts?
For example: Hello, how are you? I'm fine, thank you I know you can set the entire rtb to be specific font but what about small pieces of text inside it? Can someone point me in the right direction? Thanks -
C# Stored Procsinteresting, how would you handle multiple variables returned(kinda like an output)?
-
C# Stored Procswhy not just do: Select @RC instead?
it will return a DataSet to c#...fill the DataSet using a sqladapter and then access the variable:
DataSet ds = new DataSet();
//Do stuff
int result = (int)ds.Tables[0].Row[0][0];hope that helps
-
extract URLs of Strings?regular expressions perhaps? you can do pattern matching to get the urls and such. im sure that there is a class out there that will download the actual source of a given webpage, you can then parse that source string to retrieve the href to jpg files. keep in mind that a lot of people are ussing CSS and there might not be any direct links in the source document, you might have to go to the CSS files to find jpg urls...hope thats what you were looking for.
-
Basic Design Questionjust use and enumeration, inheritance from a person object would be too much normalization...its very unlikely humanity will converge into anything other than a man or woman, so a simple enumeration would be perfect. You might consider not having a default constructor and instead have a consturcture that requires a gender initialization.
normailization is good, but there is always to much of a good thing... -
I know this noob but..if i were in your position, i would recommend starting with a bit of programming theory. I dont know how familiar you are with the Object Oriented Paradigm but i would definatley start on literature that is indepenedent of a programming language. The internet is GOLD for literature out there. Wikipedia.com has a lot about Object Oriented Analysis and Design, and Design Patterns. Here is my suggestion:
1. Learn Object Oriented Analysis and Design and what it all means (google it and read up on it at Wikipedia...there is so much out there and i hope you enjoy the theories presented)
2. Learn about design patterns: these are frequently reoccuring problems that show up in many programming projects (there are apporoximatly 30 or so patterns). This will provide a good base for solving problems.
3. Search of "best programming practices in C#", this will get you used to the language its, syntax and what is considered elegent coding.
4. Start learning the .Net framework (www.microsoft.com and F1), there are a lot of examples at microsoft.com, they have 30 examples that show some basic GUI interactions and many other basics that will prove to be useful
5. If you are rusty on looping, branching, function calling and some simple coding logic then start with console based projects. And play around with it.
The key to becoming a good programmer is to have a good understanding of software design. With a good base (steps 1-3), any programming language will come easy to you. If you just want to jump right in then i would check out the c# examples on Microsofts website. They will definately give you a big jump start into c#.
good luck -
.net 2.0 SqlDependencyim sorry to see that you're having this problem. i have a library class that does sql connections and returnes data sets, etc. you dont have to use the class but it might help to look at/implement the code and see if you get the same error. Hope this link leads you to a solution to your problem
http://www.codeproject.com/dotnet/COperationsSQL.asp
all sqlconnections, commands, data adapters, are encapsulated in this class making things a little bit easier when it comes to interfacing with a sql back end. best of luck -
Change Password MS Access Databasenot sure about this, but its probably not a good idea to use direct sql/access passwords for logging into a database.
a better approach might be to have a default login with public access. and then have a table with user names and password combination.
at the login screen, a query (using the default login) is done of that user table, and if a successful match is found then they are allowed to enter the application (with all queryies being run with the default access login).
changeing passwords would then be fairly simple, it would only be change to the table that holds all your users.
as far as tracking changes to rows, a unique session id can be created when a user logs in, and this ID can be used to track changes of data (like if someone decides to save somethign in the data base, the session id would be inserted with the row, and that session id would like to a user name)
not sure about best practices, but this approach seems resonable.
not sure about concurrency issues with access when it comes to using a single username and password to log into a database for multiple users.... -
Auto Update for my applicationi had to do something similar at my company...small company here's what i did. we have a networked server that everyone inhouse can access. the version number is located in the assembly of the app and i compare that to a data file located on the server (you can use streamreader to do that, or if you have a database back end that you can have the version information located inside of some table that you can query off of). you will need to make a deployment application (plenty of literature out there on that).
here's what i did:
-create deployment app (one of the projects that you can put in your solution) and compile: (.msi file is created)
-put msi file in shared server directory and resolve the directory path to some web address
-when the person logs into the app (im assuming through some login screen), a query is run to check the assembly version of the one on their computer as opposed to the most updated version
-if they require an update, this is what you do:
-implement the System.Net.WebClient class and download the msi off the server via the web address
-use the DownloadFile method of the webclient class
-save to a local directory (c:\temp perhaps...or somethign along those lines)
-execute the msi process using: System.Diagnostics.Process.Start("c:\TEMP\yourapp.msi")
-and then close your application: this.close() or something along those lines
-the installation should run as normal and then the user can start up the application again
-obvioulsy the version will be correct and this process wont happen again.
-read up on deployment applications, im sure you can do something manual like copy each executable manually over the web, but the msi makes it much easier...creats short cuts and everything.
only bad thing is that you're going to have to manually install the first version of this on each person's computer
best of luck -
IR Remote Control, Help....WM_APPCOMMANDfigured it out, there is a lparam property in the message structure that i have to interperet AFTER i catch on the wparam property of app_command....a long int get returned. simple switch statement and i got it all working. thanks for your help
-
IR Remote Control, Help....WM_APPCOMMANDAlright, I'm trying to integerate an IR remote control into one of my apps.
I used Spy++ to try to figure out what messages were being sent to the app. The WM_APPCOMMAND message is begin sent.
But this message is being sent for the every media key. i read somewhere that you ahve to use GET_APPCOMMAND_LPARAM(lparam) to get the unique media key but i dont know how to implement this in C#.
I am currently overloading the WndProc(ref Message m) even and attempting to do something when the message == WM_APPCOMMAND...but again i dont know how to differentiate between the different WM_APPCOMMAND's....
Play...Stop....Next Track....Previous Track....are all the same message...help guys. -- modified at 0:30 Thursday 22nd December, 2005