Two Plus Two Publishing LLC Two Plus Two Publishing LLC
 

Go Back   Two Plus Two Poker Forums > Other Topics > Programming

Notices

Programming Discussions about computer programming

Reply
 
Thread Tools Display Modes
Old 04-03-2011, 08:20 PM   #91
Carpal \'Tunnel
 
kyleb's Avatar
 
Join Date: Sep 2004
Location: Seattle
Posts: 37,849
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
1) save the image in the database as a BLOB and get it from the DB like all other properties
This is the wrong solution to the problem 99.9% of the time.
kyleb is offline   Reply With Quote
Old 04-03-2011, 08:39 PM   #92
Carpal \'Tunnel
 
clowntable's Avatar
 
Join Date: Jun 2006
Location: 39, 46, 56, 59, 191
Posts: 39,730
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Yeah I've left it the way it was, not even going to store a reference to the location of the image in the DB. Maybe I'll add the path eventually because it feels a little odd to have all the info about the objects in one place except for media

I'll probably end up creating a config file in which you can specify where images belonging to certain domains should be stored and a project creation script that moves the stuff to the right places. The entire database with the attributes for the objects is already created from a script anyways

Thx for the input. My main reason for concidering BLOBing the image was that I read seome benchmarks and a (Firebase) database was actually faster than the filesystem for image access (and it makes at least a little sense to have everything related in one DB).
I'm pretty clueless when it comes to finetuning DBs and general DB performance
clowntable is offline   Reply With Quote
Old 04-04-2011, 12:03 AM   #93
Carpal \'Tunnel
 
Join Date: Aug 2004
Posts: 7,142
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

is it worth starting a TDD thread?

can anyone provide me with some good links/examples of implementing this? my program (StackAndTile) was born from ahk scripts, and my code and the language is sloppy. i would like to get some testing in so that i can be a bit more ambitious (read: wreckless) when fixing bugs and adding features, with the safety knowing that i can just click one button and if all the tests pass, then i can be sure my code works.

how does one add these tests on top of original code? i have started doing some refactoring of splitting large functions into smaller ones that i can test. however, the bulk of the program deals with moving poker tables around the screen, inside a big timer loop. this seems harder to test than simply passing a few parameters to a function. do i mock up fake poker tables and all that mess?
greg nice is offline   Reply With Quote
Old 04-04-2011, 02:37 AM   #94
rt1
adept
 
Join Date: Jun 2004
Location: just one rt
Posts: 1,099
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

look for a unit testing framework for whatever language you are using.

its best to break your program down into simple classes/functions and then isolate each of them for testing. aka unit testing.

and yup, you should have a test that mocks out fake poker windows and moves them around, and then confirms they moved the correct location. but thats later, first thing you need to do is breaking your code into small and testable pieces.
rt1 is offline   Reply With Quote
Old 04-04-2011, 09:34 AM   #95
Carpal \'Tunnel
 
Gullanian's Avatar
 
Join Date: Dec 2006
Location: London
Posts: 13,011
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

You shouldn't store images in databases, it's really slow, difficult to manage etc etc. If it's served a lot as well it's going to bottleneck the database and cause some performance issues. Store the locations to the files in a text field as supposed to binary data, it's a lot better practise.

If you want to protect your images from being served from particular locations you can write an image serving file and store the images in a filesystem location that is non public.

There are a few specialist circumstances when storing the data in the database would be preferential but we need more info on the system to help more.
Gullanian is offline   Reply With Quote
Old 04-04-2011, 09:44 AM   #96
Carpal \'Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 11,034
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by rt1 View Post
and yup, you should have a test that mocks out fake poker windows and moves them around, and then confirms they moved the correct location. but thats later, first thing you need to do is breaking your code into small and testable pieces.
If the code is already written as a big mess - you probably don't want to refactor before getting test coverage in place. Or at the very least, you'll want to do it at the same time. So pick a function to refactor, write tests for it, make small changes, run tests, and keep doing that until you get nice code that is also unit tested.

As for the fake poker windows - I wouldn't worry about that. Start by pulling out any logic and writing functions that implement that logic without needing to know about UI concerns. So for example if you have a function that moves some GUI element to some coordinate on the screen break that into two functions - one to calculate the new co-ordinates and one really generic function that just moves the element to those coordinates.

This allows you to easily test the logic without worrying about UI concerns.

Testing the UI itself can be a big pain and I think people often go overboard trying to automate it - which just ends up as a big headache.
jjshabado is offline   Reply With Quote
Old 04-04-2011, 10:40 AM   #97
Carpal \'Tunnel
 
tercet's Avatar
 
Join Date: Mar 2006
Location: thall
Posts: 6,400
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I have an issue similiar to clowntable in ASP.net / C#

I am trying to playing video from a database in binary format to an embedded windows media player built into my asp.net / c## website.

The issue now is that whenever I retrieve the video from the database it will open a new window for windows media player, and play the video. I've tried a bunch of stuff, with not much luck yet. Any tips?

I think it might have to do with my asp code in how I reference my handler page to pull certain videos from the db..

<param name="filename" value="~/viewVideos.aspx?binId="+<%MyFunction(); %>" />
tercet is offline   Reply With Quote
Old 04-04-2011, 10:48 AM   #98
Carpal \'Tunnel
 
gaming_mouse's Avatar
 
Join Date: Oct 2004
Location: taking notes on u (see profile)
Posts: 11,934
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by jjshabado View Post
If the code is already written as a big mess - you probably don't want to refactor before getting test coverage in place. Or at the very least, you'll want to do it at the same time. So pick a function to refactor, write tests for it, make small changes, run tests, and keep doing that until you get nice code that is also unit tested.

As for the fake poker windows - I wouldn't worry about that. Start by pulling out any logic and writing functions that implement that logic without needing to know about UI concerns. So for example if you have a function that moves some GUI element to some coordinate on the screen break that into two functions - one to calculate the new co-ordinates and one really generic function that just moves the element to those coordinates.

This allows you to easily test the logic without worrying about UI concerns.

Testing the UI itself can be a big pain and I think people often go overboard trying to automate it - which just ends up as a big headache.
good post. also, i just realized what your sn is referencing, it might be my favorite 2p2 sn.
gaming_mouse is offline   Reply With Quote
Old 04-04-2011, 10:57 AM   #99
Carpal \'Tunnel
 
Gullanian's Avatar
 
Join Date: Dec 2006
Location: London
Posts: 13,011
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by tercet View Post
I have an issue similiar to clowntable in ASP.net / C#

I am trying to playing video from a database in binary format to an embedded windows media player built into my asp.net / c## website.

The issue now is that whenever I retrieve the video from the database it will open a new window for windows media player, and play the video. I've tried a bunch of stuff, with not much luck yet. Any tips?

I think it might have to do with my asp code in how I reference my handler page to pull certain videos from the db..

<param name="filename" value="~/viewVideos.aspx?binId="+<%MyFunction(); %>" />
I really really wouldn't store the video in the database. Store it in an publicly inaccessible folder, then serve it from another file checking permissions etc. (Or if anyone can view it just stick it in a public location).

If you are having trouble playing the video, you probably will be wanting a flash video player, or an HTML5 one (less supported but future proofed). Browsers will behave very variably if you are directly embedding media onto a page.
Gullanian is offline   Reply With Quote
Old 04-04-2011, 12:14 PM   #100
Retired
 
Zurvan's Avatar
 
Join Date: Apr 2005
Location: On the front porch, yelling at kids
Posts: 32,269
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

It looks like I'm going for a job interview on Wednesday (yay)

The job is in Rails, which I have zero experience in. I don't even think I've ever looked at a line of Ruby code. They tracked me down & invited me, so I know they know I have no experience, but I'd like to take some knowledge in to the interview.

What should I read in the next day and a half to at least give me a primer in Ruby & Rails? I'll probably only have about 2 hours to sit down and read before then, most of that on the actual train ride, so let's keep it short
Zurvan is offline   Reply With Quote
Old 04-04-2011, 12:16 PM   #101
Carpal \'Tunnel
 
Gullanian's Avatar
 
Join Date: Dec 2006
Location: London
Posts: 13,011
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

I'd read stack overflow. There are tons of basic questions on there, the sort they would probably ask you.
Gullanian is offline   Reply With Quote
Old 04-04-2011, 01:25 PM   #102
Carpal \'Tunnel
 
jjshabado's Avatar
 
Join Date: Jul 2006
Posts: 11,034
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by gaming_mouse View Post
good post. also, i just realized what your sn is referencing, it might be my favorite 2p2 sn.
Hah thanks. Although I learned a little while ago that there was another 2+2er who had a similar name than mine that registered before me.
jjshabado is offline   Reply With Quote
Old 04-04-2011, 03:27 PM   #103
rt1
adept
 
Join Date: Jun 2004
Location: just one rt
Posts: 1,099
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Quote:
Originally Posted by Zurvan View Post
It looks like I'm going for a job interview on Wednesday (yay)

The job is in Rails, which I have zero experience in. I don't even think I've ever looked at a line of Ruby code. They tracked me down & invited me, so I know they know I have no experience, but I'd like to take some knowledge in to the interview.

What should I read in the next day and a half to at least give me a primer in Ruby & Rails? I'll probably only have about 2 hours to sit down and read before then, most of that on the actual train ride, so let's keep it short
http://railsforzombies.org/
rt1 is offline   Reply With Quote
Old 04-04-2011, 06:28 PM   #104
Carpal \'Tunnel
 
Gullanian's Avatar
 
Join Date: Dec 2006
Location: London
Posts: 13,011
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

ughhh just finished moving 80,000 forum posts from PHPBB3 over to an ASP forum, holy crap that was a pain in the ass, getting all the users to still be able to login (different login methods), different database structures, creating all the 301 redirects from old forum, I never want to do anything like that again.
Gullanian is offline   Reply With Quote
Old 04-04-2011, 08:47 PM   #105
Carpal \'Tunnel
 
clowntable's Avatar
 
Join Date: Jun 2006
Location: 39, 46, 56, 59, 191
Posts: 39,730
Re: ** UnhandledExceptionEventHandler :: OFFICIAL LC / CHATTER THREAD **

Zurvan:
http://www.ruby-lang.org/en/documentation/quickstart/

After that search for one of these "Rails in 5 minutes" videos on youtube. You'll get a pretty good understanding of how it works that way. Install Rails, repeat what they did in the video and look at the scaffolding code that's generated and play around with it a bit.

Browse the Ruby library a bit and you should be good to go. 1-2 days is plenty

Last edited by clowntable; 04-04-2011 at 08:59 PM.
clowntable is offline   Reply With Quote

Reply
      

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -4. The time now is 10:23 PM.


Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.
Copyright © 2008-2010, Two Plus Two Interactive