Daily Archives

Articles indexed Saturday May 15 2010

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

  • RegEXP Javascript URL matching

    - by Blondie
    I have this so far: chrome.tabs.getSelected(null, function(tab) { var title = tab.title; var btn = '<a href="' + tab.url + '" onclick="save(\'' + title + '\');"> ' + title + '</a>'; if(RegExp('/http:\/\/www.mydomain.com\/version.php/i') == true) { document.getElementById('link').innerHTML = '<p>' + btn + '</p>'; } }); Basically it should match the domain within this: http://www.mydomain.com/version.php?* Anything that matches that even when it includes something like version.php?ver=1, etc When I used the code above of mine, it doesn't display anything, but when I remove the if statement, it's fine but it shows on other pages which it shouldn't only on the matched URL.

    Read the article

  • How To Create An ASP.NET Designer Host

    - by Zuhaib
    I have been asked to build an application where I can drag and drop few WebControls onto the WebPage designer surface. So far I have read some articles on .NET Framework Design-Time architecture, like, MSDN Article: Hosting WinForms Designers, Developer Function Article etc. But I can't a find a way to host WebForms designer. The only open source implementation that I could find was Mono Develop ASP.NET Visual Designer. But in mono they have used GTK# & Gecko etc to host the designer. I can't find a way to do the same using WinForms. Please suggest me what should I do. Give me some pointers. Should I go ahead and implement it using GTK# and Gecko? PS: My requirement is not very huge. I need just a way to drag and drop simple web controls and save the page.

    Read the article

  • SSIS how to split a single record in to two different records?

    - by Dr. Zim
    I have a Product record that has multiple "zoned" prices, one for each store that sells the product. ProductID int Name string PriceA money PriceB money PriceC money In SQL Server Integration Services, I need to split this in to multiple records: ProductID int Version string // A, B, or C Price money // PriceA if A, PriceB if B, etc. This would be within a Data Flow, I presume as a Transformation between Excel source and OLE DB destination. (Assuming OLE DB is a good destination for MS SQL server).

    Read the article

  • Facebook Graph API - authorization types?

    - by Alex Cook
    I'm struggling with the new Facebook Graph API, perhaps someone here can help. Here is what I want to do: provide a ‘login w/ FB’ button, throw to /authorize, get a code, throw to /access_token, get an access_token, and be able to hit https://graph.facebook.com/me for info about the user. When I try to use type=client_cred in the /authorize call, I get an access_token that lets me hit URLs with userIDs or names, but not /me. I receive an error stating I need a valid token. If I can't hit /me, how do I figure out who the current user is? What exactly should I use in the type param if I want a website to access a users data? I've seen posts with type=web_server, etc, but I can't seem to find a sure fire way to do, what I think, is pretty simple... Thanks ahead of time for any help thats provided...

    Read the article

  • Making ehcache read-write for test code and read-only for production code

    - by Rick
    I would like to annotate many of my Hibernate entities that contain reference data and/or configuration data with @Cache(usage = CacheConcurrencyStrategy.READ_ONLY) However, my JUnit tests are setting up and tearing down some of this reference/configuration data using the Hibernate entities. Is there a recommended way of having entities be read-write during test setup and teardown but read-only for production code? Two of my immediate thoughts for non-ideal workarounds are: Using NONSTRICT_READ_WRITE, but I am not sure what the hidden downsides are. Creating subclassed entities in my test code to override the read-only cache annotation. Any recommendations on the cleanest way to handle this? (Note: Project uses maven.)

    Read the article

  • How effective can this Tagging solution be?

    - by Pablo
    Im working on an image sharing site and want to implement tagging for the images. I've read Questions #20856 and #2504150 I have few concerns with the approach on the questions above. First of all it looks easy to link an image to a tag. However getting images by tag relation is not as easy. Not easy because you will have to get the image-to-tag relation from one table and then make a big query with a bunch of OR statements( one OR for every image). Before i even research the tagging topic i started testing the following method: This tables as examples: Table: Image Columns: ItemID, Title, Tags Table: Tag Columns: TagID, Name The Tags column in the Image table takes a string with multiple tagID from the Tag table enclosed by dashes(-). For example: -65-25-105- Links an image with the TagID 65,25 and 105. With this method i find it easier to get images by tag as i can get the TagID with one query and get all the images with another simple query like: SELECT * FROM Image WHERE Tags LIKE %-65-% So if i use this method for tagging, How effective this is? Is querying by LIKE %-65-% a slow process? What problems can i face in the future?

    Read the article

  • So I want to separate my Program Files from the hard disk with the other system files. What is the b

    - by grg-n-sox
    So I am running Windows 7 as my only OS. I have two hard drives on my computer. The first one is a 74GB Western Digital 10K RPM Raptor. The second one is a 1TB Seagate Barracuda (couldn't remember if it was a 7200.12 or some other decimal after the 7200). The OS in installed to the Raptor and I am just using the Barracuda for storage. With this setup, in case you couldn't guess already, the Raptor fills up quick and I am constantly having to maintain file locations. And although it is nice to have that quicker boot time and program loading, the time spent maintaining the drive makes me waste more time overall. So I am looking for a way to try to keep it clear while still keeping up system loading speeds. A performance hit on games and such is easily acceptable and as long as I can guarantee a 5GB space on the Raptor, I can always just temporarily move the disc image there. So I am figuring that having games installed like Boarderlands and Mass Effect, as well as having large files such as linux distro DVD disc images in My Documents, I probably should be moving my personal files and Program Files directories to the Barracuda. I currently have folders on the Barracuda for this, but this means routinely copying files over and I can't really do anything with the Program Files folder that already exists. The best I can do is remember to designate the install directory of any program installation to the alternative install directory, which I can't seem to get to ever work right with Steam. With that in mind, is there a way that is not too drastic to let me just change some folders and system settings once and everything works fine afterwards for my setup? I have considered just reinstalling Windows 7 to the Barracuda but that would defeat the purpose of the Raptor except for running disc images off of. I am also heard a bit about being able to use symlinks to fix this, but I have also heard that symlinks in Windows are not necessarily the same and not as well supported on Windows. An example a friend mentioned was something about how if you have a symlink in Windows on a small hard drive to a large hard drive and the contents the symlink points to is larger than the small hard drive's capacity, then Windows will think the smaller hard drive is full. So is there a fix/workaround that will let me use symlinks across hard drives without the issues or is there a better solution I am not being told about, not mentioning, or not thinking of?

    Read the article

  • Javascript regex URL matching

    - by Blondie
    I have this so far: chrome.tabs.getSelected(null, function(tab) { var title = tab.title; var btn = '<a href="' + tab.url + '" onclick="save(\'' + title + '\');"> ' + title + '</a>'; if(tab.url.match('/http:\/\/www.mydomain.com\/version.php/i')) { document.getElementById('link').innerHTML = '<p>' + btn + '</p>'; } }); Basically it should match the domain within this: http://www.mydomain.com/version.php?* Anything that matches that even when it includes something like version.php?ver=1, etc When I used the code above of mine, it doesn't display anything, but when I remove the if statement, it's fine but it shows on other pages which it shouldn't only on the matched URL.

    Read the article

  • document.write issue

    - by Dhana
    I inherited a piece of code that uses document.write to insert a certain div when the code is encountered. Unfortunately, this code is causing issues in IE where the code fails. Is there a way around this to insert a div on the page without it? I can't make a big change since this code is currently used by many clients(it's like google adsense kind of thing). Is there an alternative to document.write - I don't have a way to capture a div on the page since it's something plugged in by anyone.

    Read the article

  • Flex Flash Action Script Form Events

    - by peiklk
    Doing some development in Flash Builder 4 using Action Script 3.0. I'm trying to have some code run each time the form is displayed. The form is not always recreated, but sometimes hidden and reused. Visual Basic used to have an Activate event that does similar to what I want. I tried Render, but that fires every time the form changes (via click, text-edit, etc.) We tried the FlexEvent.ADD, but it only fires when the form is first created, same as creation_complete. Is there a good resource that shows the form "life cycle" and all the events and when they are fired and in what order? TIA! NOTE: I'm trying to get our forms to close when the ESC is pressed.

    Read the article

  • Survey on logging classes / frameworks / writers

    - by ts
    I am curious what writers (handlers, loggers) are you using. Text file and db its quite obvious, but what are other possibilities ? Firephp maybe (as in Zend_Log), mail, jabber, url ? Is anyone using syslog() or error_log() ? Are you using streams (especially custom ones) ? Are you using custom error levels or you limit yourself to predefined values? Are you logging common php errors / warning / notices? And last question - is there anything new in the town, worth consideration, apart of Zend_Log ? Or are you using your homebrew class?

    Read the article

  • Scroll Position in a Table Body

    - by Craig Walker
    I want to implement infinite scrolling (with an AJAX-based loader) in an HTML table body. My HTML looks something like this: <table> <thead> <tr><th>Column</th></tr> </thead> <tbody> <tr><td>Row 1</td></tr> <tr><td>Row 2</td></tr> </tbody> </table> I get a scroll bar on the <tbody> like so: tbody { height:10em; /* Otherwise the tbody expands to fit all rows */ overflow:auto; } To be able to do anything when the user scrolls to the bottom, I need to be able to get the scroll position of the <tbody>. In all of the (jQuery) infinite scroll implementations I've seen (such as this one), they subtract the content height from the container height and compare it to the .scrollTop() value. Unfortunately this may not work with <tbody>, which is both the viewport and the container for the scrolled content. $("tbody").height() returns the viewable (ie: "shrunken") size, but I don't know how I can get the full (viewable + hidden) size of the table body. (FWIW, $("tbody").scrollTop() returns a "large" number when scrolled to the bottom, exactly as I would expect it to). Is there any way to accomplish this?

    Read the article

  • filling array gradually with data from user

    - by neville
    I'm trying to fill an array with words inputted by user. Each word must be one letter longer than previous and one letter shorter than next one. Their length is equal to table row index, counting from 2. Words will finally create a one sided pyramid, like : A AB ABC ABCD Scanner sc = new Scanner(System.in); System.out.println("Give the height of array: "); String[] words = new String[height]; for(int i=2; i<height+2; i++){ System.out.println("Give word with "+i+" letters."); words[i-2] = sc.next(); while( words[i-2].length()>i-2 || words[i-2].length()<words[i-3].length() ){ words[i-2] = sc.next(); } } Currently the while loop doesn't influence scanner at all :/

    Read the article

  • ASP.NET Adrotator Control Repeating For Length of Entire Page

    - by rofly
    Hello! I'm making a website that requires ads being repeated down the length of a page with dynamic length. I want the ads to be displayed down the entire length of the page, but I won't know that length until after the data has been displayed. Is there built in functionality for this in .NET? If not, does anyone see any workarounds I could employ to do this for me? Thanks!

    Read the article

  • Prevent full table scan for query with multiple where clauses

    - by Dave Jarvis
    A while ago I posted a message about optimizing a query in MySQL. I have since ported the data and query to PostgreSQL, but now PostgreSQL has the same problem. The solution in MySQL was to force the optimizer to not optimize using STRAIGHT_JOIN. PostgreSQL offers no such option. Here is the explain: Here is the query: SELECT avg(d.amount) AS amount, y.year FROM station s, station_district sd, year_ref y, month_ref m, daily d LEFT JOIN city c ON c.id = 10663 WHERE -- Find all the stations within a specific unit radius ... -- 6371.009 * SQRT( POW(RADIANS(c.latitude_decimal - s.latitude_decimal), 2) + (COS(RADIANS(c.latitude_decimal + s.latitude_decimal) / 2) * POW(RADIANS(c.longitude_decimal - s.longitude_decimal), 2)) ) <= 50 AND -- Ignore stations outside the given elevations -- s.elevation BETWEEN 0 AND 2000 AND sd.id = s.station_district_id AND -- Gather all known years for that station ... -- y.station_district_id = sd.id AND -- The data before 1900 is shaky; insufficient after 2009. -- y.year BETWEEN 1980 AND 2000 AND -- Filtered by all known months ... -- m.year_ref_id = y.id AND m.month = 12 AND -- Whittled down by category ... -- m.category_id = '001' AND -- Into the valid daily climate data. -- m.id = d.month_ref_id AND d.daily_flag_id <> 'M' GROUP BY y.year It appears as though PostgreSQL is looking at the DAILY table first, which is simply not the right way to go about this query as there are nearly 300 million rows. How do I force PostgreSQL to start at the CITY table? Thank you!

    Read the article

  • How to execute PHP code from within javascript escape/unescape ?

    - by Karthik
    <Script Language='Javascript'> <!-- document.write(unescape('<?php if ( ! defined('PROJECTNAME')) exit(''); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> </body> </html> ')); //--> </Script> I did not copy paste the whole code. There is more PHP code within the javascript. How to make the browser understand that the php code is php and not treat it as a part of a html code?

    Read the article

  • program not working as expected!

    - by wilson88
    Can anyone just help spot why my program is not returning the expected output.related to my previous question.Am passing a vector by refrence, I want to see whats in the container before I copy them to another loaction.if u remove comments on loadRage, u will see bids are generated by the trader. #include <iostream> #include <vector> #include <string> #include <algorithm> #include <cstdlib> #include <iomanip> using namespace std; const int NUMSELLER = 1; const int NUMBUYER = 1; const int NUMBIDS = 20; const int MINQUANTITY = 1; const int MAXQUANTITY = 30; const int MINPRICE =100; const int MAXPRICE = 150; int s=0; int trdId; // Bid, simple container for values struct Bid { int bidId, trdId, qty, price; char type; // for sort and find. bool operator<(const Bid &other) const { return price < other.price; } bool operator==(int bidId) const { return this->bidId == bidId; } }; // alias to the list, make type consistent typedef vector<Bid> BidList; // this class generates bids! class Trader { private: int nextBidId; public: Trader(); Bid getNextBid(); Bid getNextBid(char type); // generate a number of bids void loadRange(BidList &, int size); void loadRange(BidList &, char type, int size); void setVector(); }; Trader::Trader() : nextBidId(1) {} #define RAND_RANGE(min, max) ((rand() % (max-min+1)) + min) Bid Trader::getNextBid() { char type = RAND_RANGE('A','B'); return getNextBid(type); } Bid Trader::getNextBid(char type) { for(int i = 0; i < NUMSELLER+NUMBUYER; i++) { // int trdId = RAND_RANGE(1,9); if (s<10){trdId=0;type='A';} else {trdId=1;type='B';} s++; int qty = RAND_RANGE(MINQUANTITY, MAXQUANTITY); int price = RAND_RANGE(MINPRICE, MAXPRICE); Bid bid = {nextBidId++, trdId, qty, price, type}; return bid; } } //void Trader::loadRange(BidList &list, int size) { // for (int i=0; i<size; i++) { list.push_back(getNextBid()); } //} // //void Trader::loadRange(BidList &list, char type, int size) { // for (int i=0; i<size; i++) { list.push_back(getNextBid(type)); } //} //---------------------------AUCTIONEER------------------------------------------- class Auctioneer { vector<Auctioneer> List; Trader trader; vector<Bid> list; public: Auctioneer(){}; void accept_bids(const BidList& bid); }; typedef vector<Auctioneer*> bidlist; void Auctioneer::accept_bids(const BidList& bid){ BidList list; //copy (BidList.begin(),BidList.end(),list); } //all the happy display commands void show(const Bid &bid) { cout << "\tBid\t(" << setw(3) << bid.bidId << "\t " << setw(3) << bid.trdId << "\t " << setw(3) << bid.type <<"\t " << setw(3) << bid.qty <<"\t " << setw(3) << bid.price <<")\t\n " ; } void show(const BidList &list) { cout << "\t\tBidID | TradID | Type | Qty | Price \n\n"; for(BidList::const_iterator itr=list.begin(); itr != list.end(); ++itr) { //cout <<"\t\t"; show(*itr); cout << endl; } cout << endl; } //search now checks for failure void show(const char *msg, const BidList &list) { cout << msg << endl; show(list); } void searchTest(BidList &list, int bidId) { cout << "Searching for Bid " << bidId << endl; BidList::const_iterator itr = find(list.begin(), list.end(), bidId); if (itr==list.end()) { cout << "Bid not found."; } else { cout << "Bid has been found. Its : "; show(*itr); } cout << endl; } //comparator function for price: returns true when x belongs before y bool compareBidList(Bid one, Bid two) { if (one.type == 'A' && two.type == 'B') return (one.price < two.price); return false; } void sort(BidList &bidlist) { sort(bidlist.begin(), bidlist.end(), compareBidList); } int main(int argc, char **argv) { Trader trader; BidList bidlist; Auctioneer auctioneer; //bidlist list; auctioneer.accept_bids(bidlist); //trader.loadRange(bidlist, NUMBIDS); show("Bids before sort:", bidlist); sort(bidlist); show("Bids after sort:", bidlist); system("pause"); return 0; }

    Read the article

  • iPhone SDK - Accessing other Application Folders

    - by Kevin
    Hello everyone, I know that you can access your own application files using NSDocumentDirectory and such, but can you do that on other applications. For example, if I wanted the Documents of another application, would it be possible to get that information? From the iPhone OS Library as directed here. Sincerely, Kevin

    Read the article

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