Search Results

Search found 284 results on 12 pages for 'sergio leunissen'.

Page 9/12 | < Previous Page | 5 6 7 8 9 10 11 12  | Next Page >

  • Need some suggestions on my softwares architecture. [Code review]

    - by Sergio Tapia
    I'm making an open source C# library for other developers to use. My key concern is ease of use. This means using intuitive names, intuitive method usage and such. This is the first time I've done something with other people in mind, so I'm really concerned about the quality of the architecture. Plus, I wouldn't mind learning a thing or two. :) I have three classes: Downloader, Parser and Movie I was thinking that it would be best to only expose the Movie class of my library and have Downloader and Parser remain hidden from invocation. Ultimately, I see my library being used like this. using FreeIMDB; public void Test() { var MyMovie = Movie.FindMovie("The Matrix"); //Now MyMovie would have all it's fields set and ready for the big show. } Can you review how I'm planning this, and point out any wrong judgement calls I've made and where I could improve. Remember, my main concern is ease of use. Movie.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Drawing; namespace FreeIMDB { public class Movie { public Image Poster { get; set; } public string Title { get; set; } public DateTime ReleaseDate { get; set; } public string Rating { get; set; } public string Director { get; set; } public List<string> Writers { get; set; } public List<string> Genres { get; set; } public string Tagline { get; set; } public string Plot { get; set; } public List<string> Cast { get; set; } public string Runtime { get; set; } public string Country { get; set; } public string Language { get; set; } public Movie FindMovie(string Title) { Movie film = new Movie(); Parser parser = Parser.FromMovieTitle(Title); film.Poster = parser.Poster(); film.Title = parser.Title(); film.ReleaseDate = parser.ReleaseDate(); //And so an so forth. } public Movie FindKnownMovie(string ID) { Movie film = new Movie(); Parser parser = Parser.FromMovieID(ID); film.Poster = parser.Poster(); film.Title = parser.Title(); film.ReleaseDate = parser.ReleaseDate(); //And so an so forth. } } } Parser.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using HtmlAgilityPack; namespace FreeIMDB { /// <summary> /// Provides a simple, and intuitive way for searching for movies and actors on IMDB. /// </summary> class Parser { private Downloader downloader = new Downloader(); private HtmlDocument Page; #region "Page Loader Events" private Parser() { } public static Parser FromMovieTitle(string MovieTitle) { var newParser = new Parser(); newParser.Page = newParser.downloader.FindMovie(MovieTitle); return newParser; } public static Parser FromActorName(string ActorName) { var newParser = new Parser(); newParser.Page = newParser.downloader.FindActor(ActorName); return newParser; } public static Parser FromMovieID(string MovieID) { var newParser = new Parser(); newParser.Page = newParser.downloader.FindKnownMovie(MovieID); return newParser; } public static Parser FromActorID(string ActorID) { var newParser = new Parser(); newParser.Page = newParser.downloader.FindKnownActor(ActorID); return newParser; } #endregion #region "Page Parsing Methods" public string Poster() { //Logic to scrape the Poster URL from the Page element of this. return null; } public string Title() { return null; } public DateTime ReleaseDate() { return null; } #endregion } } ----------------------------------------------- Do you guys think I'm heading towards a good path, or am I setting myself up for a world of hurt later on? My original thought was to separate the downloading, the parsing and the actual populating to easily have an extensible library. Imagine if one day the website changed its HTML, I would then only have to modifiy the parsing class without touching the Downloader.cs or Movie.cs class. Thanks for reading and for helping!

    Read the article

  • Jquery load DIV inside another DIV at same page

    - by Sergio
    HTML: <div class="someclass" rel="first">text 1</div> <div class="someclass" rel="second">text 2</div></div></div> <div class="info_ly">here is some text</div> <div class="first" > the first DIV </div> <div class="second" > the second DIV </div> CSS: .first{ display:none} .second{ display:none} Jquery: $(".someclass").click(function() { $(".info_ly").html($(this).attr('rel')); }); I want to call and load the "rel" DIV inside "info_ly" DIV. With this Jquery code I get only text "first" or "second" inside "info_ly" DIV. How can I load the DIV with the class "first" or DIV with the class "second" inside "info_ly" DIV?

    Read the article

  • Nested joins hide table names

    - by Sergio
    Hi: I have three tables: Suppliers, Parts and Types. I need to join all of them while discriminating columns with the same name (say, "id") in the three tables. I would like to successfully run this query: CREATE VIEW Everything AS SELECT Suppliers.name as supplier, Parts.id, Parts.description, Types.typedesc as type FROM Suppliers JOIN (Parts JOIN Types ON Parts.type_id = Types.id) ON Suppliers.id = Parts.supplier_id; My DBMS (sqlite) complains that "there is not such a column (Parts.id)". I guess it forgets table names once the JOIN is done but then how can I refer to the column id that belongs to the table Parts?

    Read the article

  • Scale an image which is stored as a byte[] in Java

    - by Sergio del Amo
    I upload a file with a struts form. I have the image as a byte[] and I would like to scale it. FormFile file = (FormFile) dynaform.get("file"); byte[] fileData = file.getFileData(); fileData = scale(fileData,200,200); public byte[] scale(byte[] fileData, int width, int height) { // TODO } Anyone knows an easy function to do this? public byte[] scale(byte[] fileData, int width, int height) { ByteArrayInputStream in = new ByteArrayInputStream(fileData); try { BufferedImage img = ImageIO.read(in); if(height == 0) { height = (width * img.getHeight())/ img.getWidth(); } if(width == 0) { width = (height * img.getWidth())/ img.getHeight(); } Image scaledImage = img.getScaledInstance(width, height, Image.SCALE_SMOOTH); BufferedImage imageBuff = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); imageBuff.getGraphics().drawImage(scaledImage, 0, 0, new Color(0,0,0), null); ByteArrayOutputStream buffer = new ByteArrayOutputStream(); ImageIO.write(imageBuff, "jpg", buffer); return buffer.toByteArray(); } catch (IOException e) { throw new ApplicationException("IOException in scale"); } } If you run out of Java Heap Space in tomcat as I did, increase the heap space which is used by tomcat. In case you use the tomcat plugin for Eclipse, next should apply: In Eclipse, choose Window Preferences Tomcat JVM Settings Add the following to the JVM Parameters section -Xms256m -Xmx512m

    Read the article

  • Java Script in Rails 3.1 works only in certain parts. Any idea why?

    - by Sergio Nekora
    This might seem a bit weird, but since I am new in RoR and cannot find any similar questions I thought you might know. The situation is that JavaScript does not work throughout my whole site. For instance. For the sake of checking, I place a link with an alert function in the footer. It did not work at the beginning, it felt like the JS was disabled(but it wasn't). But eventually it worked. Now it works in most the pages but it does not work in one that there is also an 'autocomplete' field. Of course, this autocomplete field does not work either. That could lead you to think that there is something wrong with the autocomplete code. However this same code is working in the sidebar. Any ideas why? Could it have anything to do with the fact that one day my assets folder appeared empty? After installing the gmaps4rails gem I realized that all my Js and CSS files were gone from my assests folder. Ok, it might have happened long before and I just realized at that point. I don't really know. Here in the root you can see that the 'Hola sip' click at the button works. here it works However, here same link does not trigger the alert function. here it doesn't

    Read the article

  • Mysql count columns

    - by Sergio
    I have a table for image gallery with four columns like: foid | uid | pic1 | pic2 | pic3 | date | ----------------------------------------------- 104 | 5 | 1.jpg | 2.jpg | 3.jpg | 2010-01-01 105 | 14 | 8.jpg | | | 2009-04-08 106 | 48 | x.jpg | y.jpg | | 2010-08-09 Mysql query for the user's galleries looks like: SELECT * FROM foto WHERE uid = $id order by foid DESC The thing that I want to do is count the number of images (PIC1, PIC2, PIC3) in every of the listed galleries. What is the best way for doing that?

    Read the article

  • What is the best type to use for returning an image in my C# library project?

    - by Sergio Tapia
    I'm making a project that will scrap information about a movie and return all sorts of goodies. This will be a .dll that other developers will use in their projects. For example, if they want to set a pictureBox image to the movies poster, what would be the best way to handle my library returning the image? //Set the image to The Matrix poster. pictureBox1.Image = MyLibrary.GetPoster("The Matrix"); Should I return an Image? A Byte[] array?

    Read the article

  • Binding Listbox Items

    - by Sergio
    Hi, I have a user with it's roles, it's an entitycollection. I have a ListBox that has all possible roles, and I have them like checkboxes, but I want to bind the IsChecked property of each one to check if the user has the role. Something like IsChecked={Binding Roles.Contains}

    Read the article

  • Database design - How can I have a foreign key of the primary key in the same table?

    - by Sergio Tapia
    My database has to store all the available departments in my company. Some departments are sub-departments on another existing department. I've decided to solve this like this: Departments ID Description HeadOfDepartment ParentDepartment ParentDepartment can be null, indicating it is a root department. If it has a parent I'll act accordingly, my question is how can I code this in Microsoft SQL?

    Read the article

  • Where can an absolute beginner of Kohana PHP go to learn how to use it from the ground up?

    - by Sergio Tapia
    Hi guys! I have a month of free time and I've decided to launch my own website. It's going to be big and have dymanic content where different users with different roles can perform modifications to the site. Place comments, rate stores, list items, etc. This sound like a perfect opportunity for me to expand my horizons and learn a PHP Framework. I've used PHP bare bones before but nothing too complex. As of now, do you think Kohana is a mature framework to use? I've used Zend in the past for a course in Uni but it sucked horribly, I was new to the MVC model, but Zend had pretty much zero workable tutorials and guides for newbies. That's why I hated it. Where can I go to learn how to use Kohana from a retarded starting point? Thank you very much for your time.

    Read the article

  • How can I create a small relational database in MySQL?

    - by Sergio Tapia
    I need to make a small database in MySQL that has two tables. Clothes and ClotheType Clothes has: ID, Name, Color, Brand, Price, ClotheTypeID ClotheType has: ID, Description In Microsoft SQL it would be: create table Clothes( id int, primary key(id), name varchar(200), color varchar(200), brand varchar(200), price varchar(200), clothetypeid int, foreign key clothetypeid references ClotheType(id) ) I need this in MySQL.

    Read the article

  • How can I check if a user has written his username and password correctly?

    - by Sergio Tapia
    I'm using a Linq-to-SQL class called Scans.dbml. In that class I've dragged a table called Users (username, password, role) onto the graphic area and now I can access User object via a UserRepository class: using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Scanner.Classes { public class UserRepository { private ScansDataContext db = new ScansDataContext(); public User getUser(string username) { return db.Users.SingleOrDefault(x => x.username == username); } public bool exists(string username) { } } } Now in my Login form, I want to use this Linq-to-SQL goodness to do all the data related activities. UserRepository users = new UserRepository(); private void btnLogin_Click(object sender, EventArgs e) { loginToSystem(); } private void loginToSystem() { if (users.getUser(txtUsername.Text)) { } //If txtUsername exists && User.password == Salt(txtPassword) //then Show.MainForm() with User.accountType in constructor to set permissions. } I need help with verifying that a user exists && that that users.password is equal to SALT(txtpassword.text). Any guidance please?

    Read the article

  • Why is this variable declared as private and also readonly?

    - by Sergio Tapia
    In the following code: public class MovieRepository : IMovieRepository { private readonly IHtmlDownloader _downloader; public MovieRepository(IHtmlDownloader downloader) { _downloader = downloader; } public Movie FindMovieById(string id) { var idUri = ...build URI...; var html = _downloader.DownloadHtml(idUri); return ...parse ID HTML...; } public Movie FindMovieByTitle(string title) { var titleUri = ...build URI...; var html = _downloader.DownloadHtml(titleUri); return ...parse title HTML...; } } I asked for something to review my code, and someone suggested this approach. My question is why is the IHtmlDownloader variable readonly?

    Read the article

  • Problem with CSS DIV align

    - by Sergio
    If the doctype declaration is <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN"> what is the best way for horizontal alignment of the DIV's like these: <div id="outer"><div id="inner">Some text</div></div> The CSS is: #outer{ border-top:1px dotted #999; background-color: #F4F4F4; width:100%;} #inner{ width:500px;border:1px solid #F00; margin:auto;} The thing that I want to do is the inner DIV align at center (horizontally) inside the outer DIV. This CSS working fine if the doctype declaration is <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12  | Next Page >