Unofficial Programming Thread II

Post » Tue May 17, 2011 10:28 am

Don't forget transactions, ensuring the consistency of data, locking of rows etc. Writing a database is non trivial. Given time I am fairly sure I could write one that exceeded the performace of MySql, for my specific task. I don't have those months to put into it though.
User avatar
Angela Woods
 
Posts: 3336
Joined: Fri Feb 09, 2007 2:15 pm

Post » Tue May 17, 2011 3:25 pm

Don't forget transactions, atomicity, ..., locking of rows.

What, what and what?

I'm serious, I need to know what those three mean in order to know how difficult it would be to program.
User avatar
Alex [AK]
 
Posts: 3436
Joined: Fri Jun 15, 2007 10:01 pm

Post » Tue May 17, 2011 12:48 pm

What, what and what?

I'm serious, I need to know what those three mean in order to know how difficult it would be to program.

From Wikipedia:

A database transaction comprises a unit of work performed within a database management system (or similar system) against a database, and treated in a coherent and reliable way independent of other transactions. Transactions in a database environment have two main purposes:
* To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system failure, when execution stops (completely or partially) and many operations upon a database remain uncompleted, with unclear status.
* To provide isolation between programs accessing a database concurrently. Without isolation the program's outcomes are possibly erroneous.


Atomicity requires that database modifications must follow an "all or nothing" rule. Each transaction is said to be atomic. If one part of the transaction fails, the entire transaction fails and the database state is left unchanged. It is critical that the database management system maintain the atomic nature of transactions in spite of any application, DBMS (Database Management System), operating system or hardware failure.

See: http://en.wikipedia.org/wiki/ACID

Locking of rows: You can't have two separate processes, both with write access to the same row. Same sort of thing as the issues with multi threading.



As said. Non trivial.
User avatar
kyle pinchen
 
Posts: 3475
Joined: Thu May 17, 2007 9:01 pm

Post » Tue May 17, 2011 6:14 am

From Wikipedia:

A database transaction comprises a unit of work performed within a database management system (or similar system) against a database, and treated in a coherent and reliable way independent of other transactions. Transactions in a database environment have two main purposes:
* To provide reliable units of work that allow correct recovery from failures and keep a database consistent even in cases of system failure, when execution stops (completely or partially) and many operations upon a database remain uncompleted, with unclear status.
* To provide isolation between programs accessing a database concurrently. Without isolation the program's outcomes are possibly erroneous.


Atomicity requires that database modifications must follow an "all or nothing" rule. Each transaction is said to be atomic. If one part of the transaction fails, the entire transaction fails and the database state is left unchanged. It is critical that the database management system maintain the atomic nature of transactions in spite of any application, DBMS (Database Management System), operating system or hardware failure.

Locking of rows: You can't have two separate processes, both with write access to the same row. Same sort of thing as the issues with multi threading.

Okay, so... what exactly is the problem supposed to be? I must admit that I don't even know what this "database" is supposed to do. Is it supposed to work across a network (Internet), so the main program is a server with the database and other people use client programs to manipulate the database?
User avatar
Rodney C
 
Posts: 3520
Joined: Sat Aug 18, 2007 12:54 am

Post » Tue May 17, 2011 7:43 am

Okay, so... what exactly is the problem supposed to be? I must admit that I don't even know what this "database" is supposed to do. Is it supposed to work across a network (Internet), so the main program is a server with the database and other people use client programs to manipulate the database?

It will be a large database of mods, their download locations, and the current state of the parse process (there can be multiple concurrent parsers with a shared state). Clients can interact with this database. (Search it).

I already have something that does the same with about 40k mods. It just failed big time as I made a load of trivial mistakes. This is basically me writing the new version and trying to avoid the trivial mistakes I made (And no doubt making a whole load of other mistakes).
User avatar
Jodie Bardgett
 
Posts: 3491
Joined: Sat Jul 29, 2006 9:38 pm

Post » Tue May 17, 2011 4:13 am

It will be a large database of mods, their download locations, and the current state of the parse process (there can be multiple concurrent parsers with a shared state). Clients can interact with this database. (Search it).

Is it supposed to be able to provide services through web browsers (like on a web page)? Because if it is then that's a wholly different kind of headache...
User avatar
Del Arte
 
Posts: 3543
Joined: Tue Aug 01, 2006 8:40 pm

Post » Tue May 17, 2011 7:43 am

Is it supposed to be able to provide services through web browsers (like on a web page)? Because if it is then that's a wholly different kind of headache...

Yeah...
User avatar
DAVId MArtInez
 
Posts: 3410
Joined: Fri Aug 10, 2007 1:16 am

Post » Tue May 17, 2011 5:11 am

Anyways. With Veeno's suggestion to look at another way, I am using an index indicating a mods version at that location. Insertions are a lot slower, but on the plus side lookups are faster and the amount of code has been reduced. So overall probably a plus

But why oh why doesn't PHP have a stable sort <_<
User avatar
Nicole Coucopoulos
 
Posts: 3484
Joined: Fri Feb 23, 2007 4:09 am

Post » Tue May 17, 2011 8:37 am

But why oh why doesn't PHP have a stable sort <_<

Do it yourself? :hehe:


Yeah I see a pattern here as well...
User avatar
Soph
 
Posts: 3499
Joined: Fri Oct 13, 2006 8:24 am

Post » Tue May 17, 2011 5:00 am

Do it yourself? :hehe:


Yeah I see a pattern here as well...

Well, in this case it is probably the right answer. :D. I can't claim that Insertion Sort is hard to implement.
User avatar
Enie van Bied
 
Posts: 3350
Joined: Sun Apr 22, 2007 11:47 pm

Post » Tue May 17, 2011 6:17 am

I'm so bored. I just got into GUI programming and I want to make new programs all the time now. Any ideas?
User avatar
YO MAma
 
Posts: 3321
Joined: Thu Dec 21, 2006 8:24 am

Post » Mon May 16, 2011 11:27 pm

You could figure out what the issue was with that program we were working on. Otherwise I am working on a gradebook I could use help with if you wanted. Then again all my new projects use WPF and if I recall right you are running Linux and can't run them. Otherwise what you can do is just find small repetetive tasks you perform often and make a program to automate it.

WPF has been driving me crazy. I am having a tough time wrapping my head around data binding and I used a DataGrid for one of my programs and I can't figure out how to get the value of the third column. Getting a bit frustrated with it.
User avatar
Genevieve
 
Posts: 3424
Joined: Sun Aug 13, 2006 4:22 pm

Post » Tue May 17, 2011 1:10 pm

You could figure out what the issue was with that program we were working on. Otherwise I am working on a gradebook I could use help with if you wanted. Then again all my new projects use WPF and if I recall right you are running Linux and can't run them. Otherwise what you can do is just find small repetetive tasks you perform often and make a program to automate it.

WPF has been driving me crazy. I am having a tough time wrapping my head around data binding and I used a DataGrid for one of my programs and I can't figure out how to get the value of the third column. Getting a bit frustrated with it.

Well actually, I have been working on the mod installer. I attempted to get it to remove the presets keys from the registry. But I don't know if it works. And I finished the Output class.
User avatar
Luis Reyma
 
Posts: 3361
Joined: Fri Nov 02, 2007 11:10 am

Post » Tue May 17, 2011 1:05 am

Take Adderall.
User avatar
Haley Cooper
 
Posts: 3490
Joined: Wed Jun 14, 2006 11:30 am

Post » Tue May 17, 2011 8:29 am

Well actually, I have been working on the mod installer. I attempted to get it to remove the presets keys from the registry. But I don't know if it works. And I finished the Output class.

Removing should be rather simple. I am going to grab Subversion here real fast and perhaps give the program a look later tonight. I have class all day and tomorrow I will be buried in books for most of the day. I think this weekend I might have more of a chance to do some work on it though.

Does anyone know how to access a specific cell in a datagrid using WPF? I have my data bound to the various columns but I need to pull the data from columns two and three for every row (variable amount) for processing. I can't really seem to find anything on Google which is driving me nuts. I think I may end up just using a ListView but I need to ability to modify some of the data before processing.
User avatar
Tanya
 
Posts: 3358
Joined: Fri Feb 16, 2007 6:01 am

Post » Tue May 17, 2011 5:42 am

Do you guys think C++ is worth learning nowadays? I know a bit about object-oriented programming and have been learning C# for quite awhile. But will C++ still be "needed" or in-demand in the future with all these frameworks and runtimes (.NET) that automate programs?

So basically, should I continue learning C#, or start learning C++ and all its lower level features?
User avatar
MR.BIGG
 
Posts: 3373
Joined: Sat Sep 08, 2007 7:51 am

Post » Tue May 17, 2011 4:42 am

Do you guys think C++ is worth learning nowadays? I know a bit about object-oriented programming and have been learning C# for quite awhile. But will C++ still be "needed" or in-demand in the future with all these frameworks and runtimes (.NET) that automate programs?

So basically, should I continue learning C#, or start learning C++ and all its lower level features?

Continue c# and when you need some c++ functions just import them into c# ;)
User avatar
SEXY QUEEN
 
Posts: 3417
Joined: Mon Aug 13, 2007 7:54 pm

Post » Tue May 17, 2011 9:09 am

Do you guys think C++ is worth learning nowadays? I know a bit about object-oriented programming and have been learning C# for quite awhile. But will C++ still be "needed" or in-demand in the future with all these frameworks and runtimes (.NET) that automate programs?

So basically, should I continue learning C#, or start learning C++ and all its lower level features?


It depends what you are using it for. C++ will always be useful when high performance is necessary as the programmer has much better control over it than the likes of Java or C#.
User avatar
Emma louise Wendelk
 
Posts: 3385
Joined: Sat Dec 09, 2006 9:31 pm

Post » Tue May 17, 2011 2:20 pm

Do you guys think C++ is worth learning nowadays?

A silly question. Of course it is.

To be honest though, you should probably wait until http://en.wikipedia.org/wiki/C%2B%2B0x is finalised and made the new standard.
User avatar
kelly thomson
 
Posts: 3380
Joined: Thu Jun 22, 2006 12:18 pm

Post » Tue May 17, 2011 7:15 am

Do you guys think C++ is worth learning nowadays? I know a bit about object-oriented programming and have been learning C# for quite awhile. But will C++ still be "needed" or in-demand in the future with all these frameworks and runtimes (.NET) that automate programs?

Even if you learn C++ and never use it, you will still probably find it useful.

For example, given the knowlege that strings are immuable in Java this would make any C++ or C programmer horrified (The C programmer would probably shoot you)
String s   = "Hello World ";String tmp = "";for (int i = 0; i < times; i++) {    tmp += s;}
Understanding how things work at a lower level is almost always useful.


Having said that. C++ isn't a great language from a design standpoint. I still hope D overtakes C++. Not that it will happen any time soon but I can hope.


To be honest though, you should probably wait until C++0x is finalised and made the new standard.

To be honest though, someone new to C++ isn't going to need much of C++0x and in any case, most compilers support the majority of the latest C++0x draft. :shrug:


Plus, if the compiler doesn't support it, you should just implement it yourself ;)





Aaaand in other news. http://www.informit.com/store/product.aspx?isbn=0201038048&ns=21559&WT.mc_id=2011-01-20_NL_InformITPromotionshttp://www.informit.com/store/product.aspx?isbn=0201038048&ns=21559&WT.mc_id=2011-01-20_NL_InformITPromotions
User avatar
Kay O'Hara
 
Posts: 3366
Joined: Sun Jan 14, 2007 8:04 pm

Post » Mon May 16, 2011 11:53 pm

So I'll be learning C++ along with advancing C#. How similar are the two? Besides the name of course.
User avatar
teeny
 
Posts: 3423
Joined: Sun Feb 25, 2007 1:51 am

Post » Tue May 17, 2011 12:31 pm

ugh, I'm having some trouble with a website I'm working on.

Basically I need to load specific content from another website into an iframe on my site. I've been messing around with jquery and ajax for an hour and I haven't made any progress. <_<

Any suggestions on how to do that?


to be more specific, I need to scraqe the contents of a
element from another html file and place them in an iframe.
User avatar
Bereket Fekadu
 
Posts: 3421
Joined: Thu Jul 12, 2007 10:41 pm

Post » Tue May 17, 2011 7:10 am

ugh, I'm having some trouble with a website I'm working on.

Basically I need to load specific content from another website into an iframe on my site. I've been messing around with jquery and ajax for an hour and I haven't made any progress. <_<

Any suggestions on how to do that?


to be more specific, I need to scraqe the contents of a
element from another html file and place them in an iframe.

So this site isn't part of yours? Just one from the internet?
User avatar
Phoenix Draven
 
Posts: 3443
Joined: Thu Jun 29, 2006 3:50 am

Post » Tue May 17, 2011 4:07 am

So this site isn't part of yours? Just one from the internet?

Yes.

and no I'm not stealing from the website. I checked.
User avatar
NAkeshIa BENNETT
 
Posts: 3519
Joined: Fri Jun 16, 2006 12:23 pm

Post » Tue May 17, 2011 3:22 pm

to be more specific, I need to scraqe the contents of a
element from another html file and place them in an iframe.

Unfortunately you can't do this on the client side due to the http://en.wikipedia.org/wiki/Same_origin_policy. I would suggest making a simple passthrough proxy on your server side and going through it.
User avatar
Eliza Potter
 
Posts: 3481
Joined: Mon Mar 05, 2007 3:20 am

PreviousNext

Return to Othor Games