Search Results

Search found 5810 results on 233 pages for 'staff of geeks'.

Page 12/233 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • .net runtime type casting when using reflection

    - by Mike
    I have need to cast a generic list of a concrete type to a generic list of an interface that the concrete types implement. This interface list is a property on an object and I am assigning the value using reflection. I only know the value at runtime. Below is a simple code example of what I am trying to accomplish: public void EmployeeTest() { IList<Employee> initialStaff = new List<Employee> { new Employee("John Smith"), new Employee("Jane Doe") }; Company testCompany = new Company("Acme Inc"); //testCompany.Staff = initialStaff; PropertyInfo staffProperty = testCompany.GetType().GetProperty("Staff"); staffProperty.SetValue(testCompany, (staffProperty.PropertyType)initialStaff, null); } Classes are defined like so: public class Company { private string _name; public string Name { get { return _name; } set { _name = value; } } private IList<IEmployee> _staff; public IList<IEmployee> Staff { get { return _staff; } set { _staff = value; } } public Company(string name) { _name = name; } } public class Employee : IEmployee { private string _name; public string Name { get { return _name; } set { _name = value; } } public Employee(string name) { _name = name; } } public interface IEmployee { string Name { get; set; } } Any thoughts? I am using .NET 4.0. Would the new covariant or contravariant features help? Thanks in advance.

    Read the article

  • Help with Hashmaps in Java

    - by Crystal
    I'm not sure how I use get() to get my information. Looking at my book, they pass the key to get(). I thought that get() returns the object associated with that key looking at the documentation. But I must be doing something wrong here.... Any thoughts? import java.util.*; public class OrganizeThis { /** Add a person to the organizer @param p A person object */ public void add(Person p) { staff.put(p, p.getEmail()); System.out.println("Person " + p + "added"); } /** * Find the person stored in the organizer with the email address. * Note, each person will have a unique email address. * * @param email The person email address you are looking for. * */ public Person findByEmail(String email) { Person aPerson = staff.get(email); return aPerson; } private Map<Person, String> staff = new HashMap<Person, String>(); public static void main(String[] args) { OrganizeThis testObj = new OrganizeThis(); Person person1 = new Person("J", "W", "111-222-3333", "[email protected]"); testObj.add(person1); System.out.println(testObj.findByEmail("[email protected]")); } }

    Read the article

  • Simple encryption - Sum of Hashes in C

    - by Dogbert
    I am attempting to demonstrate a simple proof of concept with respect to a vulnerability in a piece of code in a game written in C. Let's say that we want to validate a character login. The login is handled by the user choosing n items, (let's just assume n=5 for now) from a graphical menu. The items are all medieval themed: eg: _______________________________ | | | | | Bow | Sword | Staff | |-----------|-----------|-------| | Shield | Potion | Gold | |___________|___________|_______| The user must click on each item, then choose a number for each item. The validation algorithm then does the following: Determines which items were selected Drops each string to lowercase (ie: Bow becomes bow, etc) Calculates a simple string hash for each string (ie: `bow = b=2, o=15, w=23, sum = (2+15+23=40) Multiplies the hash by the value the user selected for the corresponding item; This new value is called the key Sums together the keys for each of the selected items; this is the final validation hash IMPORTANT: The validator will accept this hash, along with non-zero multiples of it (ie: if the final hash equals 1111, then 2222, 3333, 8888, etc are also valid). So, for example, let's say I select: Bow (1) Sword (2) Staff (10) Shield (1) Potion (6) The algorithm drops each of these strings to lowercase, calculates their string hashes, multiplies that hash by the number selected for each string, then sums these keys together. eg: Final_Validation_Hash = 1*HASH(Bow) + 2*HASH(Sword) + 10*HASH(Staff) + 1*HASH(Shield) + 6*HASH(Potion) By application of Euler's Method, I plan to demonstrate that these hashes are not unique, and want to devise a simple application to prove it. in my case, for 5 items, I would essentially be trying to calculate: (B)(y) = (A_1)(x_1) + (A_2)(x_2) + (A_3)(x_3) + (A_4)(x_4) + (A_5)(x_5) Where: B is arbitrary A_j are the selected coefficients/values for each string/category x_j are the hash values for each string/category y is the final validation hash (eg: 1111 above) B,y,A_j,x_j are all discrete-valued, positive, and non-zero (ie: natural numbers) Can someone either assist me in solving this problem or point me to a similar example (ie: code, worked out equations, etc)? I just need to solve the final step (ie: (B)(Y) = ...). Thank you all in advance.

    Read the article

  • PHP check http referer for form submitted by AJAX, secure?

    - by Michael Mao
    Hi all: This is the first time I am working for a front-end project that requires server-side authentication for AJAX requests. I've encountered problems like I cannot make a call of session_start as the beginning line of the "destination page", cuz that would get me a PHP Warning : Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\xampp\htdocs\comic\app\ajaxInsert Book.php:1) in C:\xampp\htdocs\comic\app\common.php on line 10 I reckon this means I have to figure out a way other than checking PHP session variables to authenticate the "caller" of this PHP script, and this is my approach : I have a "protected" PHP page, which must be used as the "container" of my javascript that posts the form through jQuery $.ajax(); method In my "receiver" PHP script, what I've got is: <?php define(BOOKS_TABLE, "books"); define(APPROOT, "/comic/"); define(CORRECT_REFERER, "/protected/staff/addBook.php"); function isRefererCorrect() { // the following line evaluates the relative path for the referer uri, // Say, $_SERVER['HTTP_REFERER'] returns "http://localhost/comic/protected/staff/addBook.php" // Then the part we concern is just this "/protected/staff/addBook.php" $referer = substr($_SERVER['HTTP_REFERER'], 6 + strrpos($_SERVER['HTTP_REFERER'], APPROOT)); return (strnatcmp(CORRECT_REFERER, $referer) == 0) ? true : false; } //http://stackoverflow.com/questions/267546/correct-http-header-for-json-file header('Content-type: application/json charset=UTF-8'); header('Cache-Control: no-cache, must-revalidate'); echo json_encode(array ( "feedback"=>"ok", "info"=>isRefererCorrect() )); ?> My code works, but I wonder is there any security risks in this approach? Can someone manipulate the post request so that he can pretend that the caller javascript is from the "protected" page? Many thanks to any hints or suggestions.

    Read the article

  • What is the proper way to set my drawable directories to support the new Dell Streak without losing support for older devices?

    - by emmby
    This seems to be a widespread problem. I have the following drawable directories: drwxr-xr-x 18 mike staff 612 Feb 4 17:28 drawable/ drwxr-xr-x 51 mike staff 1734 Feb 4 17:32 drawable-nodpi/ drwxr-xr-x 44 mike staff 1496 Feb 4 17:30 drawable-normal-mdpi/ My xml drawable resources are in drawable. My resources intended for the large-mdpi (Dell Streak) and normal-hdpi (Droid, Nexus, Incredible, etc.) are all in drawable-nodpi. My resources for normal-mdpi (older phones like the G1) are in drawable-normal-mdpi. Unfortunately, the normal-hdpi phones like the Droid are pulling their resources from drawable-normal-mdpi instead of from drawable-nodpi. This is likely because of the rules in How Android Finds the Best-matching Resource. So the question is, how do I provide support for large-mdpi devices like the Streak along with normal-hdpi devices like the Droid, as well as normal-mdpi devices like the G1? The simplest solution would probably be to make two copies of my large resources, one in normal-hdpi for the droid and one in large-mdpi for the streak, but i'd like to avoid duplicating all of these resources. Update Per Mayra's suggestion, I could make an alias for every resource. However, there are a lot of resources I'd have to make aliases for, which would make maintenance a nightmare going forward, so I'm hoping for another solution.

    Read the article

  • iBatis how to solve a more complex N+1 problem

    - by Alvin
    I have a database that is similar to the following: create table Store(storeId) create table Staff(storeId_fk, staff_id, staffName) create table Item(storeId_fk, itme_id, itemName) The Store table is large. And I have create the following java bean public class Store { List<Staff> myStaff List<Item> myItem .... } public class Staff { ... } public class Item { ... } My question is how can I use iBatis's result map to EFFICIENTLY map from the tables to the java object? I tried: <resultMap id="storemap" class="my.example.Store"> <result property="myStaff" resultMap="staffMap"/> <result property="myItem" result="itemMap"/> </resultMap> (other maps omitted) But it's way too slow since the Store table is VERY VERY large. I tried to follow the example in Clinton's developer guide for the N+1 solution, but I cannot warp my mind around how to use the "groupBy" for an object with 2 list... Any help is appreciated!

    Read the article

  • Do I have to implement Add/Delete methods in my NHibernate entities ?

    - by Lisa
    This is a sample from the Fluent NHibernate website: Compared to the Entitiy Framework I have ADD methods in my POCO in this code sample using NHibernate. With the EF I did context.Add or context.AddObject etc... the context had the methods to put one entity into the others entity collection! Do I really have to implement Add/Delete/Update methods (I do not mean the real database CRUD operations!) in a NHibernate entity ? public class Store { public virtual int Id { get; private set; } public virtual string Name { get; set; } public virtual IList<Product> Products { get; set; } public virtual IList<Employee> Staff { get; set; } public Store() { Products = new List<Product>(); Staff = new List<Employee>(); } public virtual void AddProduct(Product product) { product.StoresStockedIn.Add(this); Products.Add(product); } public virtual void AddEmployee(Employee employee) { employee.Store = this; Staff.Add(employee); } }

    Read the article

  • Multiple ID's in database

    - by eric
    I have a database that contains a few tables such as person, staff, member, and supporter. The person table contains information about every staff, member, and supporter. The information it contains is name,address,email, and telephone. I also created an id that is the primary key. My issue is that I also have an primary key ID for staff, member, and supporter. For instance, in the person table is John with id 1. He is a supporter so in the supporter table is pID(for person id)to reference back to John with all his information and ID(for supporter ID). pID references to the person table and every person has an ID incremented by 1 starting at 1. supporter ID is for every supporter and also starts at 1 and is incremented by 1. Is it possible to have in the supporter table pID = 1 and supporter ID = 1? Another person may have a pID = 26 and supporter ID = 5. Or will supporter ID have to be different than the pID and be something like "sup"? So you would have pID = 1 and supporter ID = sup1 or pID = 26 and supporter ID = sup5

    Read the article

  • Duplicate information from sql result

    - by puddleJumper
    I looked in about 18 other posts on here an most people are asking how to delete the records not just hide them. So my problem: I have a database with staff members who are associated with locations. Many of the staff members are associated with more than one location. What I want to do is to only display the first location listed in the mysql result and skip over the others. I have the sql query linking the tables together and it works aside from it showing the same information for those staff members that are in those other locations multiple times so example would be like this: This is the sql statement I have currently SELECT staff_tbl.staffID, staff_tbl.firstName, staff_tbl.middleInitial, staff_tbl.lastName, location_tbl.locationID, location_tbl.staffID, officelocations_tbl.locationID, officelocations_tbl.officeName, staff_title_tbl.title_ID, staff_title_tbl.staff_ID, titles_tbl.titleID, titles_tbl.titleName FROM staff_tbl INNER JOIN location_tbl ON location_tbl.staffID = staff_tbl.staffID INNER JOIN officelocations_tbl ON location_tbl.locationID = officelocations_tbl.locationID INNER JOIN staff_title_tbl ON staff_title_tbl.staff_ID = staff_tbl.staffID INNER JOIN titles_tbl ON staff_title_tbl.title_ID = titles_tbl.titleID and my php is <?php do { ?> <tr> <td><?php echo $row_rs_Staff_Info['firstName']; ?>&nbsp; <?php echo $row_rs_Staff_Info['lastName']; ?></td> <td><?php echo $row_rs_Staff_Info['titleName']; ?>&nbsp; </td> <td><?php echo $row_rs_Staff_Info['officeName']; ?>&nbsp; </td> </tr> <?php } while ($row_mysqlResult = mysql_fetch_assoc($rs_mysqlResult)); ?> What I would like to know is there a way using php to select only the first entry listed for each person and display that and just skip over the other two. I was thinking it could be done by possibly adding the staffID's to an array and if they are in there to skip over the next one listed in the staff_title_tbl but wasn't quite sure how to write it that way. Any help would be great thank you in advance.

    Read the article

  • What if Google’s ‘Project Glass’ Ran on Windows? [Funny Video]

    - by Asian Angel
    The tech sphere has been abuzz lately about Google’s new ‘Project Glass’, but what would happen if it ran on Windows? You can view the original ‘Project Glass’ video below… Windows Project Glass: One day too… [via Geeks are Sexy] How to Stress Test the Hard Drives in Your PC or Server How To Customize Your Android Lock Screen with WidgetLocker The Best Free Portable Apps for Your Flash Drive Toolkit

    Read the article

  • Mario Goes Insane, Engages in Reign of Terror Throughout Mario Land [Video]

    - by Asian Angel
    Mario finally loses it and begins a reign of unholy terror throughout Mario Land. Will anyone be able to stop much less escape this new nightmare version of everyone’s favorite plumber? Note: Video contains some language that may be considered inappropriate. Mario Goes Berserk [via Geeks are Sexy] How to Stress Test the Hard Drives in Your PC or Server How To Customize Your Android Lock Screen with WidgetLocker The Best Free Portable Apps for Your Flash Drive Toolkit

    Read the article

  • Potentially The World’s Filthiest PC [Video]

    - by Jason Fitzpatrick
    We’re confident we’ve seen some dusty PC cases in our day, but nothing we’ve ever cleaned produced the sheer volume of smoke-bomb like dust this neglected tower spews out. That noise you hear, about 1:15 into the video, is the sound of the compressor motor kicking back on to top off the pressure tank: behold, a PC so filthy the compressor cleaning it out needs to take a break! [via Geeks Are Sexy] HTG Explains: Why Linux Doesn’t Need Defragmenting How to Convert News Feeds to Ebooks with Calibre How To Customize Your Wallpaper with Google Image Searches, RSS Feeds, and More

    Read the article

  • How to keep up to date with Programming Blogs Aggregators

    - by landal79
    Last week I read a great post of Jeff Atwood Keeping Up and "Just In Time" Learning that speaks about how to keep update. The blog post reports Kathy Sierra list, the first item 'Find the best aggregators' has captured my attention. I'm used to look at DZone, IMHO a good aggregator. DZone has voting and tagging. Or recently I discovered Java Code Geeks. Are there any other good programming blog post aggregator?

    Read the article

  • Ray Bradbury’s Predictions about Future Technology that have been Fulfilled

    - by Asian Angel
    Ray Bradbury wrote about many wonderful items of technology in his stories of the future, but you may be surprised to see just how many of them have become reality. Note: Visit the blog post linked below to see the full-size version of the chart. Ray Bradbury Predictions Fulfilled [via Geeks are Sexy] HTG Explains: What Is Windows RT and What Does It Mean To Me? HTG Explains: How Windows 8′s Secure Boot Feature Works & What It Means for Linux Hack Your Kindle for Easy Font Customization

    Read the article

  • Why the Cave Troll in the ‘Mines of Moria’ was So Angry [Humorous LOTR Video]

    - by Asian Angel
    Did you ever wonder why the cave troll the Fellowship of the Ring met in the Mines of Moria was so angry? It all comes down to a certain Hobbit’s carelessness! LEGO The Cranky Cavetroll [via Geeks are Sexy] HTG Explains: What is the Windows Page File and Should You Disable It? How To Get a Better Wireless Signal and Reduce Wireless Network Interference How To Troubleshoot Internet Connection Problems

    Read the article

  • The Battle of Helm’s Deep in LEGO [Video]

    - by Jason Fitzpatrick
    Not only is this an impressive rendering of the Lord of the Ring’s series Battle of Helm’s Deep, but the animator threw in some great cameos and jokes along the way. LEGO The Battle of Helm’s Deep [via Geeks Are Sexy] Our Geek Trivia App for Windows 8 is Now Available Everywhere How To Boot Your Android Phone or Tablet Into Safe Mode HTG Explains: Does Your Android Phone Need an Antivirus?

    Read the article

  • Awesome Serenity (Firefly) – My Little Pony Movie Trailer Mashup [Video]

    - by Asian Angel
    Recently we featured an awesome Watchmen – My Little Pony mashup and today we are back with another great movie trailer mixer. This latest mashup video from BronyVids once again features the ever popular ponies and the movie trailer from the 2005 movie Serenity. Just for fun here is the original Serenity trailer that the video above is based on. My Little Serenity [via Geeks are Sexy] Serenity (2005) Trailer 1080p HD [YouTube] How To Encrypt Your Cloud-Based Drive with BoxcryptorHTG Explains: Photography with Film-Based CamerasHow to Clean Your Dirty Smartphone (Without Breaking Something)

    Read the article

  • F# in 90 Seconds

    - by Ben Griswold
    I mentioned in a previous post that we’ve started a languages club at the office.  In an effort to decide which language we will first concentrate on, I volunteered to give the rundown on F#.  Rather than providing a summary here, I’ve provided my slide deck for your viewing enjoyment.  There’s nothing special here outside of a some pretty cool characters from The 56 Geeks Project by Scott Johnson and collection of information from my prior functional programming presentations.   Download F# in 90 Seconds

    Read the article

  • Game Boy Generates Music In An Unexpected Way [Video]

    - by Jason Fitzpatrick
    When we saw a link about a Game Boy generated melody we assumed it was a chip-tune track generated by the Game Boy’s sound processor. We were pleasantly surprised to see the Game Boy itself was the instrument. [via Geeks Are Sexy] Reader Request: How To Repair Blurry Photos HTG Explains: What Can You Find in an Email Header? The How-To Geek Guide to Getting Started with TrueCrypt

    Read the article

  • Did You Know Gaming Delves into the Mario Universe [Video]

    - by Jason Fitzpatrick
    If you thought you knew everything there was to know about the Mario franchise, prepare to be surprised by the odd and expansive trivia dug up by Did You Know Gaming. Who knew you could learn so much about a game by picking through the game code for odds and ends? If you enjoyed the above video, make sure to check out Part II here. [via Geeks Are Sexy] 7 Ways To Free Up Hard Disk Space On Windows HTG Explains: How System Restore Works in Windows HTG Explains: How Antivirus Software Works

    Read the article

  • How Big Is a Billion? [Video]

    - by Jason Fitzpatrick
    A billion is a billion except, when it isn’t. Depending on where and when you were raised and educated, the world “billion” is some magnitudes different–read on to see the difference between a billion in long and short number systems. [via Geeks Are Sexy] Here’s How to Download Windows 8 Release Preview Right Now HTG Explains: Why Linux Doesn’t Need Defragmenting How to Convert News Feeds to Ebooks with Calibre

    Read the article

  • Game of Thrones Theme Played on Eight Floppy Drives [Video]

    - by Asian Angel
    YouTube user MrSolidSnake745 has put together a fun (and awesome) rendition of the ‘Game of Thrones’ theme using eight floppy drives. Game Of Thrones Theme on eight floppy drives [via Geeks are Sexy] HTG Explains: What The Windows Event Viewer Is and How You Can Use It HTG Explains: How Windows Uses The Task Scheduler for System Tasks HTG Explains: Why Do Hard Drives Show the Wrong Capacity in Windows?

    Read the article

  • The Glitch [Video]

    - by Asian Angel
    Things are fine in Video Game Land until one day when a soldier encounters an unusual phenomena…his weapon is partially buried in the pavement and undergoing extreme shifting movements. Can Mario and friends save Video Game Land from the Malevolent Glitch or is it game over for everyone?! The Glitch [via Geeks are Sexy] How to Access Your Router If You Forget the Password Secure Yourself by Using Two-Step Verification on These 16 Web Services How to Fix a Stuck Pixel on an LCD Monitor

    Read the article

  • Crime Fighting goes Galactic with CSI: Gallifrey [Video]

    - by Asian Angel
    What do you get when your favorite crime-fighting organization meets Doctor Who? CSI: Gallifrey! CSI: Gallifrey (with one-liner) [via Geeks are Sexy] How to Make the Kindle Fire Silk Browser *Actually* Fast! Amazon’s New Kindle Fire Tablet: the How-To Geek Review HTG Explains: How Hackers Take Over Web Sites with SQL Injection / DDoS

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >