Jump to content

Jirajha

Member
  • Posts

    21
  • Joined

  • Last visited

Awards

This user doesn't have any awards

1 Follower

About Jirajha

  • Birthday Aug 31, 1994

Profile Information

  • Gender
    Male
  • Location
    Germany

System

  • CPU
    Intel i7-3930k
  • Motherboard
    ASUS Sabertooth X79
  • RAM
    4x4 GB Corsair Vengeance 1600
  • GPU
    MSI GTX 680 TwinFrozr II
  1. ^This. There's far more to programming than just being the scriptmonkey and writing code. Yes, you might be done with a combination of HTML/CSS & JavaScript for front-end work, SQL and at least one of [Java/Python/Go/JavaScript/C#] for BackEnd work and at least one of the forementioned for the middleware (Web- / Applicationserver), but that's only the language itself you have to express the logic in. That logic is almost universally the same for every language - but you need to know it and how it is implemented in and affected by the language itself. When it comes to that I'd even argue that you do not really know HTML / CSS until you also know a language to manipulate it at runtime - like JavaScript - and thatfor can apply common patterns, practices and principles to your HTML / CSS, which in most cases isn't powerful enough to do that on it's own. Think of the languages more of a medium you express solutions in rather than your go-to solution itself.
  2. While there are some limitations to that method, you are entirely able to call C++ functions/methods from C# via p/Invoke and marshalling the results. This article should get you going from there, while PINVOKE.NET has a nice Visual Studio PlugIn for OS functions. However you might want to have a look at Open Hardware Monitor which is a C#-written Desktop application doing exactly you need to do. Maybe have a look at that one.
  3. To address your other questions: 1. To download a file and save it to the user's desktop you could use: string url = "https://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif"; string savePath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), url.Split('/').Last()); using(var wc = new WebClient()) { wc.DownloadFile(url, savePath); } You can specify the savePath to whatever you want / need ofc. If you want to keep it as byte[] in memory you could simply use: string url = "https://www.google.com/logos/doodles/2015/googles-new-logo-5078286822539264.3-hp2x.gif"; byte[] imageData; using (var wc = new WebClient()) { imageData = wc.DownloadData(url); } Keep in mind to wrap the WebClient or the actual call in a try/catch block in case it can't connect to given ressource. 2. Accessing data from Multiple Forms can be achieved in many ways. The easiest would be to declare the variables as properties and give each Form a property of type Form in wich a reference to the other form is stored. public class Form1 : Form { private Form _otherForm; public Form1() { // ... } public Form OtherForm { get { return _otherForm; } set { if(_otherForm == value) return; _otherForm = value; } } } public class Form2 : Form { private Form _otherForm; public Form2() { // ... } public Form OtherForm { get { return _otherForm; } set { if(_otherForm == value) return; _otherForm = value; } } } public class Program { public static void Main(string[] args) { Form1 f1 = new Form1(); Form2 f2 = new Form2(); f1.OtherForm = f2; f2.OtherForm = f1; // ... } } This will let each Form know about the other one and they can access each others Properties. It can and most likely will create a huge mess when we start talkin' about more than one Thread running at the same time, so I strongly reccommend against that. The more elegant solution is a thread-safe collection to store the data like it is described here or use cross-thread invokation, both of wich are relatively complex topics. I reccommend starting out with a thread-safe collection of some kind when it comes to access to the data itself.
  4. A little bit of misunderstanding here. One Gigabyte is defined as an SI-Unit of 1 * 10^9 bytes for a total of 8,000,000,000 bytes. The same goes for other SI-Units such as Kilo, Mega, Peta, Milli, Micro, Nano. A Millisecond is not defined as 1 / 2^10 seconds, it is defined as 1 / 10^3. Same goes for Kilogram. A Kilogram is not 1 * 2^10 grams, it's 1 * 10^3 = 1000 grams. So a classical HDD that is defined as 8TB has a nominal storage capacity of 8 * 10^12 (8,000,000,000,000) Bytes and not 8 * 2^40 (8,796,093,022,208) Bytes. And when I bought my last drive the manufacturer clearly stated that aswell. So no shame to the manufacturers on my end. When talking about powers of 2 for electrical capacity, you are generally talking about IEC-norms and not SI-units. There are no Kilobytes in the IEC-standards. There is Kibibyte ( 1 * 2^10 = 1024 Bytes). There is / was originally no Megabyte based on 1 * 2^20 (1,048,576) Bytes. That is Mebibytes. Or in other words: Mebi = Mega-[bit-based]. Then came JEDEC and this is where the chaos starts. They published a semiconductor-standard wich allowed for calling the 2-based Kibi a 10-based Kilo. The 2-based Mebi a 10-based Mega. And so on and so forth. To put it very very bold, the reasoning behind it is basically: When talking about semiconductors, or electronics in general for that matter, the "around 1000" units conversion rate in the bit/byte area of things is 1024. So it should be clear to anyone working in that area that when talking about kilo, you mean 1024 and not 1000, since everything is based on a power of 2. It just makes the numbers rounder and easier in everyday-life. Especially for customers, since they don't have to get a calculator out everytime they hear the Kibi instead of Kilo. They simply don't have to learn a new unit. Windows (and other OS's for that matter) is calculating the available space based on powers of 2. They do however show a unit based on powers of 1000. And while my 2 TB Drive here has 2,000,396,742,656 Bytes (so, slightly over 2TB even), Windows is actually showing it as 1.81 TB total where it should show 1.81TiB, since we are not talking about a Semiconductor-based storage with a classical HDD. And the same goes for my SSD I use for the OS and Visual Studio btw.: The 128GB it is supposed to have is fulfilled (with 128,033,222,656 > 128 * 10^9 Bytes) in the SI-Standard, Windows again however is only showing 119GB whilst calculating 119GiB. And this ladies and gentlemen is why JEDEC has failed with its goal to by creating that confusion in the first place.
  5. Assuming you are running Windows, there is a relatively easily possible way to realize what you want. You are looking for a Low Level Hook (*hint hint*). If you want to code something like that for yourself, one approach would be the following: 1. Register your application within the Windows Kernel (kernel32.dll) and 2. subscribe to ANY keypress (or KeyDown / KeyUp)-Event triggered by the user (user32.dll). This really is the least hacky way of detecting input while your application does not have focus. 3. Keep a list of All keys you want to fetch within your programs 4. If the key pressed is one you want to watch 5. Tell windows you did handle the event and it does not need to care about it. There is an excellent CodeProject-Article I have used in the past to "modify" my keyboard media keys (Volume Up/Down) to only regulate Spotify and not Windows in total. Be aware of the following though: You are essentially registering a keylogger to your OS. A typical AV-Program will usually not be very keen of stuff like that. And secondly: There is no way to directly detect key-combinations (like ctrl+c | ctrl+v). The way to go here would be to capture both KeyDown events in a certain order and then detecting keyup for both in no particular order after that without another keyup or keydown event. Good luck!
  6. Sweet, a chance for a new Keyboard! I'm still using a Microsoft Sidewinder X4 of wich the stippled plastic palmrest is very uncomfortable. I'd love to take that one to work to replace the standard Lenovo one and use the Excalibur at home. Always wanted a mechanical keyboard and only had one borrowed from a friend for a week until we had all the parts to build him his PC.
  7. Saying C# is too hard to start with is like saying Java is too hard to beginn with. And that's what's mostly used besides Python to introduce programming at schools and universities (at least for the universities of people I've spoken to). The syntax (grammar) of C# is about the same as Java, only a bit more 'eased' even to increase production speed of programms. It does take out some unneccesary steps you have to make in Java however. To completely start programming, python is probably one of the best programming languages. It lets you focus on the code logic and teaches you how to "think of abstraction". How to break things down into variables, control structures, comparisons and loops. However, don't be afraid of C#, it's not as bad and the more you know the easier it will get. There's probably a solution to the problem you are working on mostly buildt into it. Or at least most bigger key components.
  8. It would probably be best to show some of the code you are using / have a problem with. In this case, Int32.Parse(string s) expects a string to get handed in. What is the object type of the response you are getting? Maybe casting it to a (string)result// OR(int)result , running a result.ToString()// ORresult[0].ToString() Method or in case of a DataTable iterating over each line first might do the trick. There might be a myMySqlDataReader.GetInt32(); Method aswell.
  9. Since the best way to learn is by trying it: Copy everything from your program from the bin folder to another one and remove one file after another. If it doesn't start it was probably needed. If you have a Windows based Server somewhere you might want to have a look at WebDeployment.
  10. What do you mean exactly? Do you mean how to build it into a .exe file? You can Build it in the Build menu. Then head over to your project folder and have a look into your binaries folder "/bin/"
  11. Uhm I guess what you are looking for is an Array or a List<T> . Think of it like a box. Rather than storing each value in a named variable on it's own you could store every picposition in a series of values wich are accessible via an indexer. That way you can access it via an Index in square Brackets. Example with using List<T> (spoken: List Of T(ype)): Dim myPicPositions As New List(Of myPicPositionType)()myPicPositions.Add(picPosition1)myPicPositions.Add(picPosition2)' etc... 'Dim myVar as IntegermyVar = 42picPlayer.Image = picPosition(myVar - 1).Image I am pretty certain that indexing in VB starts with 0 instead of 1 aswell, that's why ther's the -1 part. If I am wrong about that one, just use your myVar directly.
  12. If you want to make a game within 7 weeks and have no experience in programming and/or gamedesign whatsoever, I'd give any of those choices except the 3rd one 8-10 in difficulty. My recommendation would be to go for a 2D game using the Canvas Engine or the already mentioned construct 2 eingine. The Unity features are good and all but without any experience it can be quite hard and confusing in the beginning. And you don't really need 95% of them, esp. for a 0.5 - 2min demo.
  13. If you are completely new to programming or have little experience I would advise against C++. While it is nice and might be able to teach you every little detail there is about programming and yes, it is probably the most powerful language out there, you are forced to learn very much before you are actually able to do little things. Currently there are two kinda default languages I know of to learn at schools and universities: Java and Python. While I consider Java to be decently obsolete, some people will advise learning that for the easy to read and understand Syntax ( = code grammar) aswell as platform independency. Wich is certainly true. Python gets you more to stick to conventions (things you should always do unless unavoidable even though there are other solutions) and to focus more on what is actually happening. Wich again, is certainly true. You cannot use them in Unity however. The main languages for Unity are JavaScript and C#. JavaScript however has downfalls in performance and usability. Frameworks (libraries that have prefactored and ready-to-use code) are usually designed for use in web applications and the whole thing is strictly interpreted (simplified: realtime translation from language into machine code). I know there are ways around it but that's why I would reccommend against that aswell when it comes to desktop applications. The thing left is what I would have reccommended you regardless of Unity: C#. In a nutshell, C# is C++ with a Java Syntax. It is almost as powerful as C++ in most desktop scenarios if you leave out high-performance applications like CAD-Software, etc. However, it is as easy to read and learn as Java and the underlying framework ( .NET) is probably one of the most powerful ones for a day-to-day use on the market that will allow you to focus on doing things, rather than on how to do things. If you really want platform independency, you can use MONO, wich is a platform independent and open source .NET implementation. Unity uses this aswell for its C# implementation. It is also possible to develop Web Applications with HTML/CSS and C# or iOS/Android Apps with the help of Xamarin. And compared to Java, C# has an official standard.
  14. Think of a modular design: You have a module that's responsible for stocks, one that is for item- and product data, one that does the connection to ebay, one for amazon etc. Each module consists of it's own data structures. Each module also has it's own frontend (a form or in your case: a webpage), or a page within the frontend to be precise. So each module typically has a table that just stores its own permissions for a user or a role. user (user_id, user_name)role (role_id, role_name)user_role (id, user_id, role_id)role_generalPermissions(rgp_role_id, rgp_canInvoice, ...)role_StockPermissions(rsp_role_id, rsp_canAccessStockPage, rsp_canModifyStockPage, rsp_canTransferStock, ...) Another thing I have seen would be something like: user (user_id, user_name)role (role_id, role_name)user_role (id, user_id, role_id)role_permissions (rp_role_id, rp_permissionName, rp_permissionValue) Storing each thing they are allowed to do in a new row. Like: rp_role_id | rp_permissionName | rp_permissionValue1 CanAccessStuff true1 CanModifyStuff false2 CanAccessStuff true2 CanAccessStuff true
  15. This is probably the easiest to handle. Some eCommerce Systems also handle logins OS-based if they are used internally. Especially if they are Windows-based since most decently sized companies are supposed to have a domain controller setup (if they use windows clientbased aswell). In this case, you just keep a table that's storing wich user can have access to which form they can access and/or use. -edit: Or wich group of users can use certain forms. In case of Window's Active Directory the keyword to look for would be LDAP. In case of a Linux-based environment you might want to look for a PHP package called PAM. NTLM integration for an Apache Webserver could be an option aswell.
×