Search Results

Search found 45013 results on 1801 pages for 'example'.

Page 24/1801 | < Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >

  • is this a simple monad example?

    - by zcaudate
    This is my attempt to grok monadic functions after watching http://channel9.msdn.com/Shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads. h uses bind to compose together two arbitrary functions f and g. What is the unit operator in this case? ;; f :: int - [str] ;; g :: str = [keyword] ;; bind :: [str] - (str - [keyword]) - [keyword] ;; h :: int - [keyword] (defn f [v] (map str (range v))) (defn g [s] (map keyword (repeat 4 s))) (defn bind [l f] (flatten (map f l))) (f 8) ;; = (0 1 2 3 4 5 6 7) (g "s") ;; = (:s :s :s :s) (defn h [v] (bind (f v) g)) (h 9) ;; = (:0 :0 :0 :0 :1 :1 :1 :1 :2 :2 :2 :2 :3 :3 :3 :3 :4 :4 :4 :4 :5 :5 :5 :5)

    Read the article

  • System.Threading.Timer example to run and display seconds until you click a button

    - by Roy
    Hi, I am having some issues creating an asp.net page using C# When you first click a button it starts the display of seconds via a label control. When you click the button again the seconds stop. Currently my code behind looks like this: System.Threading.Timer Timer; bool endProcess = false; int i = 0; protected void Page_Load(object sender, EventArgs e) { Timer = new System.Threading.Timer(TimerCallback, null, 10, 10); } private void TimerCallback(object state) { Label1.Text = i.ToString(); i++; if (endProcess == true) { Timer.Dispose(); return; } } public void Button1_Click(object sender, System.EventArgs e) { endProcess = true; }

    Read the article

  • C++: Reference and Pointer question (example regarding OpenGL)

    - by Jay
    I would like to load textures, and then have them be used by multiple objects. Would this work? class Sprite { GLuint* mTextures; // do I need this to also be a reference? Sprite( GLuint* textures ) // do I need this to also be a reference? { mTextures = textures; } void Draw( textureNumber ) { glBindTexture( GL_TEXTURE_2D, mTextures[ textureNumber ] ); // drawing code } }; // normally these variables would be inputed, but I did this for simplicity. const int NUMBER_OF_TEXTURES = 40; const int WHICH_TEXTURE = 10; void main() { std::vector<GLuint> the_textures; the_textures.resize( NUMBER_OF_TEXTURES ); glGenTextures( NUMBER_OF_TEXTURES, &the_textures[0] ); // texture loading code Sprite the_sprite( &the_textures[0] ); the_sprite.Draw( WHICH_TEXTURE ); } And is there a different way I should do this, even if it would work? Thanks.

    Read the article

  • need help ,php class and xml save load edit example.p

    - by jef
    http://www.sendspace.com/file/2zlfgn I have the php files i been trying to get them to save to xml. I have tried $product1=array(); $product1['id'] = new product( "19990","modrl","maf","purpose","war"); only the ID writes to xml. since model,maf etc are sub-elements is there a different way to create the objectarray?

    Read the article

  • Sequence diagram example

    - by Pamela
    The use case to model is the register of a new appointment. The user logins in the system as a patient (role). To make an appointment shoudl enter medical specialty and date. System shoudl look for the doctors availables for that specialty on that date. From the results patient should choose one and then system save the appointment. At the end user shoudl receive an email with the information of the appointment. The classes that I have in my model are: User PAtient Doctor Appointment DoctorShcedule and some more but I think these ones will be involve. I have this initial sequnce diagram: I have problem to set the return messages and also with the email step. Thanks

    Read the article

  • Good concurrency example of Java vs. Clojure

    - by Michiel Borkent
    Clojure is said to be a language that makes multi-thread programming easier. From the Clojure.org website: Clojure simplifies multi-threaded programming in several ways. Now I'm looking for a non-trivial problem solved in Java and in Clojure so I can compare/contrast their simplicity. Anyone?

    Read the article

  • TDD Example for Business Apps

    - by Jimmo
    I understand the general idea about unit testing and have used it in scenarios where complex interactions were happening in a system, but I still have a question about all of those principles coming together. We are cautioned about not testing the framework, or the database. Good UI design does not lend itself to non-human testing. UI interaction in general is excluded in MVC frameworks. In many apps what is left?. 37signals talks about extensive unit testing, but in an app like Basecamp or Backpack, what exactly are the types of things being tested through appropriate unit tests? What would 100% code coverage mean in that scenario?

    Read the article

  • Simple matrix example using C++ template class

    - by skyeagle
    I am trying to write a trivial Matrix class, using C++ templates in an attempt to brush up my C++, and also to explain something to a fellow coder. This is what I have som far: template class<T> class Matrix { public: Matrix(const unsigned int rows, const unsigned int cols); Matrix(const Matrix& m); Matrix& operator=(const Matrix& m); ~Matrix(); unsigned int getNumRows() const; unsigned int getNumCols() const; template <class T> T getCellValue(unsigned int row, unsigned col) const; template <class T> void setCellValue(unsigned int row, unsigned col, T value) const; private: // Note: intentionally NOT using smart pointers here ... T * m_values; }; template<class T> inline T Matrix::getCellValue(unsigned int row, unsigned col) const { } template<class T> inline void Matrix::setCellValue(unsigned int row, unsigned col, T value) { } I'm stuck on the ctor, since I need to allocate a new[] T, it seems like it needs to be a template method - however, I'm not sure I have come accross a templated ctor before. How can I implemnt the ctor?

    Read the article

  • C++ pointers on example

    - by terence6
    I have a sample code : #include <iostream> #include <conio.h> using namespace std; int main () { int firstvalue = 5, secondvalue = 15; int * p1, * p2; p1 = &firstvalue; p2 = &secondvalue; cout << "1.p1: " << p1 << ", p2: " << p2 << endl; cout << "1.*p1: " << *p1 << ", *p2: " << *p2 << endl; *p1 = 10; cout << "2.p1: " << p1 << ", p2: " << p2 << endl; cout << "2.*p1: " << *p1 << ", *p2: " << *p2 << endl; *p2 = *p1; cout << "3.p1: " << p1 << ", p2: " << p2 << endl; cout << "3.*p1: " << *p1 << ", *p2: " << *p2 << endl; p1 = p2; cout << "4.p1: " << p1 << ", p2: " << p2 << endl; cout << "4.*p1: " << *p1 << ", *p2: " << *p2 << endl; *p1 = 20; cout << "5.p1: " << p1 << ", p2: " << p2 << endl; cout << "5.*p1: " << *p1 << ", *p2: " << *p2 << endl; cout << "firstvalue is " << firstvalue << endl; cout << "secondvalue is " << secondvalue << endl; cout << "firstvalue is " << &firstvalue << endl; cout << "secondvalue is " << &secondvalue << endl; getch(); return 0; } And here's the output : 1.p1: 0041FB40, p2: 0041FB34 1.*p1: 5, *p2: 15 2.p1: 0041FB40, p2: 0041FB34 2.*p1: 10, *p2: 15 3.p1: 0041FB40, p2: 0041FB34 3.*p1: 10, *p2: 10 4.p1: 0041FB34, p2: 0041FB34 4.*p1: 10, *p2: 10 5.p1: 0041FB34, p2: 0041FB34 5.*p1: 20, *p2: 20 firstvalue is 10 secondvalue is 20 firstvalue is 0041FB40 secondvalue is 0041FB34 What is copied in the line "p1 = p2" ? Does p1 become reference to p2 or does it work in different way ?

    Read the article

  • CSS - Best way to do a border like this (with link to a website as example)

    - by markzzz
    Hi to everybody. I need to do a border for my website that looks like this one. The only way I know is to split the website with 9 div, such : 1 2 3 4 5 6 7 8 9 and create 8 images, respectively: top-left (on 1) top central (on 2) top-right (on 3) left (on 4) right (on 6) bottom-left (on 7) bottom-center (on 8) bottom-right (on 9) The div 5 is attempt as main. But the whole strategy looks not so well-formed. Any tips? Thanks

    Read the article

  • Unable to Use Simple JSOUP Example To Parse Website Table Data

    - by OhNoItsAnOverflow
    I'm attempting to extract the following data from a table via Android / JSOUP however I'm having a bit of trouble nailing down the process. I think I'm getting close to being able to do this using the code I've provided below - but for some reason I still cannot get my textview to display any of the table data. P.S. Live URL's can be provided if necessary. SOURCE: public class MainActivity extends Activity { TextView tv; final String URL = "http://exampleurl.com"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); tv = (TextView) findViewById(R.id.TextView01); new MyTask().execute(URL); } private class MyTask extends AsyncTask<String, Void, String> { ProgressDialog prog; String title = ""; @Override protected void onPreExecute() { prog = new ProgressDialog(MainActivity.this); prog.setMessage("Loading...."); prog.show(); } @Override protected String doInBackground(String... params) { try { Document doc = Jsoup.connect(params[0]).get(); Element tableElement = doc.getElementsByClass("datagrid") .first(); title = doc.title(); } catch (IOException e) { e.printStackTrace(); } return title; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); prog.dismiss(); tv.setText(result); } } } TABLE: <table class="datagrid"> <tbody><tr> <th>Item No.</th> <th>Name</th> <th>Sex</th> <th>Location</th> </tr> <tr> <td><a href="redirector.cfm?ID=a33660a3-aae0-45e3-9703-d59d77717836&amp;page=1&amp;&amp;lname=&amp;fname=" title="501207593">501207593&nbsp;</a></td> <td>USER1</td> <td>M&nbsp;</td> <td>Unknown</td> </tr> <tr> <td><a href="redirector.cfm?ID=edf524da-8598-450f-9373-da87db8d6c84&amp;page=1&amp;&amp;lname=&amp;fname=" title="501302750">501302750&nbsp;</a></td> <td>USER2</td> <td>M&nbsp;</td> <td>Unknown</td> </tr> <tr> <td><a href="redirector.cfm?ID=a78abeea-7651-4ac1-bba2-0dcb272c8b77&amp;page=1&amp;&amp;lname=&amp;fname=" title="531201804">531201804&nbsp;</a></td> <td>USER3</td> <td>M&nbsp;</td> <td>Unknown</td> </tr> </tbody></table>

    Read the article

  • Example of moving from MySQL to NoSQL?

    - by OverTheRainbow
    Hello, For a Facebook-like site, ie. which is write-intensive and delivers user-customized pages, I'd like to build a prototype to investigate whether the document-centric NoSQL architecture would be a good alternative to sharding and reduce the load on the single master (+ multiple slaves) that we currently use and is the bottleneck. Does someone know of a good article that would give actual, simple examples of going from a relational layout in MySQL to a NoSQL layout? Thank you.

    Read the article

  • iphone scrolling ticker example?

    - by tbacos
    I'm looking at adding a user comment ticker to my iPhone/iPad polling app (Show of Hands). The comments would obviously need to be pulled from a central web source - either a database or perhaps even simple flat files. The ticker would also need to support basic controls (speed, pause, etc.) Can anyone that had tried doing something like this point me to your work and/or pass along any implemetation ideas? Thanks! -tony

    Read the article

  • Getting all pdf files from a domain (for example *.adomain.com)

    - by Zack
    I need to download all pdf files from a certain domain. There are about 6000 pdf on that domain and most of them don't have an html link (either they have removed the link or they never put one in the first place). I know there are about 6000 files because I'm googling: filetype:pdf site:*.adomain.com However, Google lists only the first 1000 results. I believe there are two ways to achieve this: a) Use Google. However, how I can get all 6000 results from Google? Maybe a scraper? (tried scroogle, no luck) b) Skip Google and search directly on domain for pdf files. How do I do that when most them are not linked?

    Read the article

  • JSP + View bean complete example

    - by jihedamine
    I found this interesting tutorial that explains the concept of view bean with some code snippets http://www.ibm.com/developerworks/ibm/library/i-extreme5/, but I'd like to view a complete (simple) web application in a real world scenario using plain JSP and view beans (not using struts, spring or jsf framework). Thanks for pointing me to such a resource.

    Read the article

  • Real life example fo Floating Point error

    - by Rob
    Is there any examples of a company that was burned by floating point data that caused a rounding issue? We're implementing a new system and all the monetary values are stored in floats. I think if i can show actual examples of why this has failed it'll have more weight than the theory of why the values can't be stored properly.

    Read the article

< Previous Page | 20 21 22 23 24 25 26 27 28 29 30 31  | Next Page >