Daily Archives

Articles indexed Friday May 7 2010

Page 1/110 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • How to track humans, but not spiders?

    - by johnnietheblack
    I am writing a nice little PHP/MySQL/JS ad system for my site - charging by impression. Therefore, my clients would like to be sure that they aren't paying for impressions caused by robots / spiders / etc. Is there a decently effective way to decipher between human and robot, without doing something obstructive like a captcha, or requesting "no index" or something? Basically, is there some sort of "name tag" that legit spiders have on so that my site knows their presence, therefore letting me react accordingly? And, if there isn't...how do ad companies like Google defend against this?

    Read the article

  • Optional one-to-one mapping in Hibernate

    - by hibernate
    How do I create an optional one-to-one mapping in the hibernate hbm file? For example, suppose that I have a User and a last_visited_page table. The user may or may not have a last_visited page. Here is my current one-to-one mapping in the hbm file: User Class: <one-to-one name="lastVisitedPage" class="LastVisitedPage" cascade="save-update"> LastVisitedPage Class: <one-to-one name="user" class="user" constrained="true" /> The above example does not allow the creation of a user who does not have a last visited page. A freshly created user has not visited any pages yet. How do I change the hbm mapping to make the userPrefs mapping optional?

    Read the article

  • Subdomains on Windows Azure

    - by John
    Hi, I've got a Windows Azure project I'm working on. It has two web roles - one is a public-facing site, and the second is an administration site for my customer to make changes to the database etc. I had expected to be able to use a subdomain for each role - so for example have mysite.com and admin.mysite.com (obviously CNAME-mapped to the .cloudapp.net DNS name). However it looks like Azure doesn't do this, and instead has one subdomain (mysite.com) with different ports for each web role. So, for example, I would have mysite.com:80 for the main public site, and mysite.com:8080 for the administration. Is this correct? Is there no way I can have subdomains for particular web roles? Thanks in advance John

    Read the article

  • How to "bubble" a Controls features when place in a custom UserControl

    - by Ted
    I'll try to explain what Im after. I dont know the technical term for it, so here goes: Example 1: If I place a LisView on a Form and add som columns I am able, in Design-Time, to click-and-drag the columns to resize them. Example 2: Now, I place a ListView in a UserControl and name it "MyCustomListView" (and perhaps add some method to enhance it somehow). If I know place the "MyCustomListView" on a Form I am unable to click-and-drag the column headers to resize them in Design-Time. Is there any way to easily make that happen? Some form of "pass the click-and-drag event to the underlying control and let that control do its magic". Im not really looking to recode, just pass on the mouseclick (or whatever it is) and let the, in this case, ListView react as it did in the first example above. Regards

    Read the article

  • How do I make Master/Detail subreports in ReportBuilder come out right?

    - by Mason Wheeler
    I've got a report in ReportBuilder that's supposed to report on two objects. I didn't create this report, and I can't ask the person who did about how it works. Before running the report, we have some code that goes through, finds all the properties on the objects, and loads them into a memory dataset that looks like this: OBJECT_ID: TStringField PROP_NAME: TStringField PROP_VALUE: TStringField The report engine then creates a line on the report for each property in this dataset. This is implemented in a sub-report, whose parent only contains an OBJECT_ID, which is a human-readable name. Everything was going great until we had to display a "comment" of arbitrary size in the report. I made a second sub-report with a TMemoField so it could hold the text, and set the report up in the report designer. What I expect when I run the report is something that looks like this: HEADER Object 1 properties Object 1 comment Object 2 properties Object 2 comment I've managed to get just about everything but that. I used the MasterDataPipeline and MasterFieldLinks properties of the sub-report's pipelines to try to link the OBJECT_IDs of the sub-reports to the OBJECT_ID of the header, and that's the closest I've managed to come, but now what I see is: HEADER Object 1 properties Object 1 comment Object 2 comment The "Object 2 properties" section is nowhere to be seen, even though I've manually verified that the data is making it into the dataset correctly. This is driving me nuts. Any ReportBuilder gurus out there know what's going on and now to fix it?

    Read the article

  • Check if a String is a double or an int?

    - by user69514
    I have a string for a Date in the form mm/dd, and I need to check if either the month or day was entered as a double public Date(String dateStr){ int slash = 0; //check slash is present try{ slash = dateStr.indexOf('/'); }catch(StringIndexOutOfBoundsException e){ error = "Invalid date format: " + dateStr; } //check if month is a number try{ month = Integer.parseInt(dateStr.substring(0, slash)); //day = Integer.parseInt(dateStr.substring(slash + 1, dateStr.length())); } catch(NumberFormatException e){ System.out.println("Invalid format for input string: " + dateStr.substring(0, slash)); } //check if day is a number try{ day = Integer.parseInt(dateStr.substring(slash + 1, dateStr.length())); } catch(NumberFormatException e){ System.out.println("Invalid format for input string: " + dateStr.substring(slash + 1, dateStr.length())); } //check if month was entered as a double }

    Read the article

  • Text mining with PHP

    - by garyc40
    Hi, I'm doing a project for a college class I'm taking. I'm using PHP to build a simple web app that classify tweets as "positive" (or happy) and "negative" (or sad) based on a set of dictionaries. The algorithm I'm thinking of right now is Naive Bayes classifier or decision tree. However, I can't find any PHP library that helps me do some serious language processing. Python has NLTK (http://www.nltk.org). Is there anything like that for PHP? I'm planning to use WEKA as the back end of the web app (by calling Weka in command line from within PHP), but it doesn't seem that efficient. Do you have any idea what I should use for this project? Or should I just switch to Python? Thanks

    Read the article

  • Is Flash/Actionscript any safer than Javascript for persistent online game?

    - by Sean Madigan
    I'm finding lately how unsecure Javascript is when programming a game (I'm trying to do a turn based RPG and currently the battle calculations are done through Javascript which any player can cheat with of course giving themselves as much XP as they want), so I'm wondering if I were to move my battle screen to flash if this would be any more secure, or is there just as easy of a way to cheat this?

    Read the article

  • How do I save an Android application's state?

    - by Bernard
    I've been playing around with the Android SDK, and I am a little unclear on saving an applications state. So given this minor re-tooling of the 'Hello, Android' example: package com.android.hello; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTextView = new TextView(this); if (savedInstanceState == null) { mTextView.setText("Welcome to HelloAndroid!"); } else { mTextView.setText("Welcome back."); } setContentView(mTextView); } private TextView mTextView = null; } I thought that might be all one needed to do for the simplest case, but it always gives me the first message, no matter how I navigate away from the app. I'm sure it's probably something simple like overriding onPause or something like that, but I've been poking away in the docs for 30 minutes or so and haven't found anything obvious, so would appreciate any help. Cue me looking a fool in three, two, one... Thanks.

    Read the article

  • Best UI development framework on windows?

    - by TG
    I have been developing UI in Win32/MFC, but developing cool UI in Win32/MFC is very difficult and time consuming. Please note, I always want my code to be platform independent, So I prefer programming back-end (Business logic) in C++. Which is the best framework for developing cool UI on windows platform? I heard of quite a few, like Qt, Flex, Delphi. What is your thoughts (Pros and Cons) on these UI development frameworks. Which one do you recommend ?

    Read the article

  • Using named_scopes on the join model of a has_many :through

    - by uberllama
    Hi folks. I've been beating my head against the wall on something that on the surface should be very simple. Lets say I have the following simplified models: user.rb has_many :memberships has_many :groups, :through => :memberships membership.rb belongs_to :group belongs_to :user STATUS_CODES = {:admin => 1, :member => 2, :invited => 3} named_scope :active, :conditions => {:status => [[STATUS_CODES[:admin], STATUS_CODES[:member]]} group.rb has_many :memberships has_many :users, :through => :memberships Simple, right? So what I want to do is get a collection of all the groups a user is active in, using the existing named scope on the join model. Something along the lines of User.find(1).groups.active. Obviously this doesn't work. But as it stands, I need to do something like User.find(1).membrships.active.all(:include => :group) which returns a collection of memberships plus groups. I don't want that. I know I can add another has_many on the User model with conditions that duplicate the :active named_scope on the Membership model, but that's gross. has_many :active_groups, :through => :memberships, :source => :group, :conditions => ... So my question: is there a way of using intermediary named scopes when traversing directly between models? Many thanks.

    Read the article

  • Scaling a CBitmap - what am I doing wrong?

    - by Smashery
    I've written the following code, which attempts to take a 32x32 bitmap (loaded through MFC's Resource system) and turn it into a 16x16 bitmap, so they can be used as the big and small CImageLists for a CListCtrl. However, when I open the CListCtrl, all the icons are black (in both small and large view). Before I started playing with resizing, everything worked perfectly in Large View. What am I doing wrong? // Create the CImageLists if (!m_imageListL.Create(32,32,ILC_COLOR24, 1, 1)) { throw std::exception("Failed to create CImageList"); } if (!m_imageListS.Create(16,16,ILC_COLOR24, 1, 1)) { throw std::exception("Failed to create CImageList"); } // Fill the CImageLists with items loaded from ResourceIDs int i = 0; for (std::vector<UINT>::iterator it = vec.begin(); it != vec.end(); it++, i++) { CBitmap* bmpBig = new CBitmap(); bmpBig->LoadBitmap(*it); CDC bigDC; bigDC.CreateCompatibleDC(m_itemList.GetDC()); bigDC.SelectObject(bmpBig); CBitmap* bmpSmall = new CBitmap(); bmpSmall->CreateBitmap(16, 16, 1, 24, 0); CDC smallDC; smallDC.CreateCompatibleDC(&bigDC); smallDC.SelectObject(bmpSmall); smallDC.StretchBlt(0, 0, 32, 32, &bigDC, 0, 0, 16, 16, SRCCOPY); m_imageListL.Add(bmpBig, RGB(0,0,0)); m_imageListS.Add(bmpSmall, RGB(0,0,0)); } m_itemList.SetImageList(&m_imageListS, LVSIL_SMALL); m_itemList.SetImageList(&m_imageListL, LVSIL_NORMAL);

    Read the article

  • Russian-to-English Parallel Word Corpus?

    - by Cygorger
    Hi: I am looking for a simple Russian to English word corpus. It can be as simple as a csv that lists a russian word in the first column and the equivalent English word in the second. Any ideas where I can find such a thing? Does the NLTK toolkit have something like this? Thanks

    Read the article

  • Mysql Algorithm for Determining Closest Colour Match

    - by buggedcom
    I'm attempting to create a true mosaic application. At the moment I have one mosaic image, ie the one the mosaic is based on and about 4000 images from my iPhoto library that act as the image library. I have already done my research and analysed the mosaic image. I've converted it into 64x64 slices each of 8 pixels. I've calculated the average colour for each slice and assertain the r, g, b and brightness (Luminance (perceived option 1) = (0.299*R + 0.587*G + 0.114*B)) value. I have done the same for each of the image library photos. The mosaic slices table looks like so. slice_id, slice_image_id, slice_slice_id, slice_image_column, slice_image_row, slice_colour_hex, slice_rgb_red, slice_rgb_blue, slice_rgb_green, slice_rgb_brightness The image library table looks like so. upload_id, upload_file, upload_colour_hex, upload_rgb_red, upload_rgb_green, upload_rgb_blue, upload_rgb_brightness So basically I'm reading the image slices from the slices table into PHP and then pulling out the appropriate images from the library table based on the colour hexs. My trouble is that I've been on this too long and probably had too many energy drinks so am not concentrating properly, I can't figure out the way to pick out the nearest colour neighbor if the appropriate hex code doesn't exist. Any ideas on the perfect query? NB: I know pulling out the slices one by one is not ideal however the mosaic is only rebuilt periodically so a sudden burst in the mysql load doesn't really bother me, however if there us a way to pull the images out all at once that would also be a massive bonus.

    Read the article

  • XAMPP - Apache service stops running after few seconds.

    - by Fábio Antunes
    Hello I have this big problem with my Xampp server, for some reason the Apache service stops running after a few seconds it as been started, and i have no idea what the problem is, and the error logs don't say much about the problem. [Fri May 07 01:09:32 2010] [notice] Digest: generating secret for digest authentication ... [Fri May 07 01:09:32 2010] [notice] Digest: done [Fri May 07 01:09:33 2010] [notice] Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1 mod_apreq2-20090110/2.7.1 mod_perl/2.0.4 Perl/v5.10.1 configured -- resuming normal operations [Fri May 07 01:09:33 2010] [notice] Server built: Nov 11 2009 14:29:03 [Fri May 07 01:09:33 2010] [crit] (22)Invalid argument: Parent: Failed to create the child process. [Fri May 07 01:09:33 2010] [crit] (OS 6)O identificador é inválido. : master_main: create child process failed. Exiting. [Fri May 07 01:09:33 2010] [notice] Parent: Forcing termination of child process 36 identificador é inválido (pt_PT) = identifier is invalid. Note: No other applications is using the Apache port. I have done some changes to the httpd.conf file but, it as worked well for allot of time. Added some virtual hosts. Enabled xdebug. As this happen to anyone, that could tell me whats the problem? Thanks for your time.

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >