Posts

Featured post

c# - Usage of Server Side Controls in MVC Frame work -

i using asp.net 4.0 , mvc 2.0 web application. project requiremrnt have use server side control in application not possibl in noraml case. ideally want use adrotator control , datalist control. i saw few samples , references in codepleax mvc controllib howwver found less useful. can tell how utilize theese controls in asp.net application along mvc. note: please provide functionalities related adrotator , datalist controls not equivalent functionalities thanks in advace. mvc pages not use normal .net solution makes use of normal .net components impossible. a normal .net page use event driven solution call different methods service side mvc use actions , view completly different way handle things. also, mvc not use viewstate normal .net controlls require. found article discussing mixing of normal .net , mvc.

How can I fetch data from a website inside a C++ program -

i want write program in c++ helps manage hockey pool, , 1 of key things need read off schedule week ahead. hoping use nhl website. there way have program download html file given url, , parse that? suppose once have file downloaded, simple file i/o do, im not sure how download file. i use library providing http abstraction. for example: cpp-netlib #include <boost/network/protocol/http/client.hpp> #include <string> #include <iostream> int main() { boost::network::http::client client; boost::network::http::client::request request("http://www.example.com"); request << boost::network::header("connection", "close"); boost::network::http::client::response response = client.get(request); std::cout << body(response); } i not think can easier that on gnu/linux compile with: g++ -i. -i$boost_root -l$boost_root/stage/lib -lboost_system -pthread my_main.cpp qhttp example quite long, since ...

algorithm - 2-3 trees, data storage -

hello i'm trying understand how 2-3 trees work, understood concept keys, store data itself, in leaves, or in nodes 1 key (internal node), , 2 keys (internal node) also, in advance i'm no expert on tree structure first sentence wikipedia page on 2-3 trees seems answer question data stored: a 2-3 tree in computer science type of data structure, tree every node children (internal node) has either 2 children , 1 data element (2-nodes) or 3 children , 2 data elements (3-nodes). seems me store data in each node of tree. wiki page has link java applet demonstrating inserts . edit: after reading comment, , having sample code, i'm inclined think data , key (as calling it) same thing (as chowlett has mentioned in answer). looking @ sample code (they storing ints) create twothreenode class holds pointers data storing, ensuring data class has overloaded comparison operators allow them sorted. follow algorithm before. i found interesting article,...

parsing - Why does C++ not allow user-defined operators? -

i've been wondering quite time. there whole bunch of them , can overloaded, why not end , allow custom operators? think great addition. i've been told make language hard compile. makes me wonder, c++ cannot designed easy compilation anyway, undoable? of course, if use lr parser static table , grammar such e → t + e | t t → f * t | f f → id | '(' e ')' it wouldn't work. in prolog, parsed operator-precedence parser afaik, new operators can defined, language simpler. now, grammar rewritten accept identifiers in every place operator hard-coded grammar. what other solutions , parser schemes there , other things have influenced design decision? http://www2.research.att.com/~bs/bs_faq2.html#overload-operator the possibility has been considered several times, each time i/we decided problems outweighed benefits. it's not language-technical problem. when first considerd in 1983, knew how implemented. however, experience has been wh...

Nullable<T> for generic method in c#? -

how can write generic method can take nullable object use extension method. want add xelement parent element, if value used not null. e.g. public static xelement addoptionalelement<t>(this xelement parentelement, string childname, t childvalue){ ... code check if value null add element parent here if not null ... } if make addoptionalelement<t?>(...) compiler errors. if make addoptionalelement<nullable<t>>(...) compiler errors. is there way can acheive this? i know can make call method: parent.addoptionalelement<mytype?>(...) but way? public static xelement addoptionalelement<t>( xelement parentelement, string childname, t? childvalue) t : struct { // ... }

When I move a Wordpress custom option menu to the top level it stop saving input settings? -

this code adds menu in settings section of wordpress' administrator right add_options_page declared, custom menu appears inside settings i changed add_options_page add_menu_page in order bring menu top-level, stopped working (when click custom menu opens, can't save settings anymore). what's remaining code have change in order make work? thanks in advance! <?php add_action('admin_menu', 'create_theme_options_page'); add_action('admin_init', 'register_and_build_fields'); function create_theme_options_page() { add_options_page('theme options', 'theme options', 'administrator', __file__, 'options_page_fn'); } function register_and_build_fields() { register_setting('plugin_options', 'plugin_options', 'validate_setting'); add_settings_section('main_section', 'main settings', 'section_cb', __file__); add_settings_field('color_sch...

cocoa - NSWindow Content Border messing with CALayer's geometry -

i have nswindow 32px bottom content border. inside window's view, have 2 custom subviews. each of them layer backed, , i'm tracking mouse nstrackingarea. part of i'm doing mouseover effects coreanimation. not problem in general, noticed kind of strange , wondered if knows why happening. when setting trackingarea , mouseover method, hittest root layer , log layer's name can see if geometry of various sublayers hold water when resize window. internally, seem (and look) fine. visually, in right place, when move mouse, notice though mouse physically on layer, hittest returning whatever layer 32 px above it. however, if remove content border, works expect , correct layer returned. i need content border, have simple workaround involves offsetting hittest point 32px. works fine, seems weird presence of content border seems skewing co-ordinate system of these subviews. know why happening? nsevent returns mouse locations relative window's coordinate system,...

javascript - Rewriting one part of a URL into a link -

i trying 1 part of url insert another. url in address bar read domain.com/test.php?/12345 link in page must become domain.com/do/login/12345 (this end number change every user) (note can't change url domain.com/test.php?/12345 has been set site owner.) for urls above had remove http://www . part above new user can't submit more 1 link spam prevention. final script should include http://www . you able see need number @ end ie 12345 i'm not sure how achieve (javascript beginner). have far: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>path test</title> </head> <body> <script> // url eg http://www.domain.com/test.php?/12345 newurl = window.location.protocol +...