Search Results

Search found 141 results on 6 pages for 'nik'.

Page 4/6 | < Previous Page | 1 2 3 4 5 6  | Next Page >

  • a question about rails general practice with REST, json, and ajax

    - by Nik
    Hi all, I have this question concerning REST I think: I have read a few rest tutorials and the feeling I get from them is that each action in a restful controller tends to be lean and almost single purpose: "Index gives off a collection of a model show gives off one model edit/new a prep place for changing/create a model update/create changes and makes new model deletes removes one model" After reading all these tutorials, rest seems to be to be a means to create an interface for a model, much like active resource type of thing. the mantra seems to be "controller provides data and data only and is also pretty convention over configuration, so expect projects_path to return a bunch of projects" I can understand that, and I like the cleanliness. But here's when I run into some trouble in reality in applying these guidelines: say three models, Project with attrib title, User with attrib name, and Location with attrib address. Say in views/users/index.html.erb, I want to use Ajax to fetch and display a project in a div#project_display when the user clicks on a project element, I know that I can use views/projects/show.js.rjs like this: page.replace_html 'project_display' "#{@project.name}" where in the projects_controller.rb def show @project = Project.find(params[:id]) repsond_to do |format| format.js and other formats... end end I have no problem in doing that for a couple of years now. BUT doesn't that mean that my JS response for the project#show action is LOCkED to present data to div#project_display element and show only whatever I that rjs template says it should show? That's very limiting and doesn't sound very "interface" like. I have never used JSON before or much XML, so I thought, maybe the JS response should send back raw stuff, like JSON and somehow the page on which the ajax request was called has the instruction on what do to with these raw data. That sounds a lot more flexible, doesn't it? Because look back at that exmpale, what if in the views/locations/index.html.erb, I want to do the exact same thing except I want to put the response in div#project_goes_here and the response should be #{project.name} I know this is a trivial change but that's the point: the RJS only allows one template at a time. So I think the JSON route is the way to go, but how does the already loaded page, the one that the ajax call came from, know when or how to "look forward" to incoming data? I read that PrototypeJS has this template thing, I wouldn't mind using it with JSON, but if you can demonstrate this or other means for displaying received-from-ajax data, I am all attention. Thank You

    Read the article

  • Jquery fade and swap an element when clicked which will also relate to an accordian menu

    - by Nik
    You will notice when you click posture 1 the description drops down and images appear on the right. Now when you click posture 2 or posture 3 the images and description change as they should. What I need to do now is - If posture 1 has been clicked and then posture 2 is clicked the posture 1 menu needs to close so that there is only one posture description visible at one time. If I could also make it so that if the current open posture item is clicked so that it closes and there are no open posture descriptions that there also no images displayed on the right. Finally is there a way to make sure only one set of animation images is running, because just say the user goes through all 26 options and they continue to run in the background it may get sluggish (thanks to Nick Craver for bringing that up). At this stage only posture 1, 2 and 3 are available. Ok finally some code - //Description drop-down boxes $(document).ready(function(){ //Hide (Collapse) the toggle containers on load $(".toggle_container").hide(); //Switch the "Open" and "Close" state per click $("h5.trigger").toggle(function(){ $(this).addClass("active"); }, function () { $(this).removeClass("active"); }); //Slide up and down on click $("h5.trigger").click(function(){ $(this).next(".toggle_container").slideToggle("slow"); }); }); //Images on the right fade in and out thanks to aSeptik $(document).ready(function(){ $('#section_Q_01,#section_Q_02,#section_Q_03').hide(); $(function() { $('h5.trigger a').click( function(e) { e.preventDefault(); var trigger_id = $(this).parent().attr('id'); //get id Q_## $('.current').removeClass('current').hide(); //add a class for easy access & hide $('#section_' + trigger_id).addClass('current').fadeIn(5000); //show clicked one }); }); }); //Fading pics $(document).ready(function(){ $('.pics').cycle({ fx: 'fade', speed: 2500 }); }); Description boxes - <h5 class="trigger" id="Q_01" ><a href="#">Posture 1 : Standing Deep Breathing :</a></h5> <div class="toggle_container" > <div class="block"> <span class="sc">Pranayama Series</span> <p class="bold">Benefits:</p> </div> </div> <h5 class="trigger" id="Q_02" ><a href="#">Posture 2 : Half Moon Pose With Hands To Feet Pose :</a></h5> <div class="toggle_container"> <div class="block"> <span class="sc">Ardha Chandrasana with Pada-Hastasana</span> <p class="bold">Benefits:</p> </div> </div> <h5 class="trigger" id="Q_03" ><a href="#">Posture 3 : Awkward Pose :</a></h5> <div class="toggle_container"> <div class="block"> <span class="sc">Utkatasana</span> <p class="bold">Benefits:</p> </div> </div> and the images on the right - <div id="section_Q_01" class="01"> <div class="pics"> <img src="../images/multi/poses/pose1/Pranayama._01.jpg"/> <img src="../images/multi/poses/pose1/Pranayama._02.jpg"/> <img src="../images/multi/poses/pose1/Pranayama._03.jpg"/> </div> </div> <div id="section_Q_02" class="02"> <div class="pics"> <img src="../images/multi/poses/pose2/Half_Moon_Pose_04.jpg" /> <img src="../images/multi/poses/pose2/Backward_Bending_05.jpg" /> <img src="../images/multi/poses/pose2/Hands_to_Feet_Pose_06.jpg" /> </div> </div> <div id="section_Q_03" class="03"> <div class="pics"> <img src="../images/multi/poses/pose3/Awkward_01.jpg" /> <img src="../images/multi/poses/pose3/Awkward_02.jpg" /> <img src="../images/multi/poses/pose3/Awkward_03.jpg" /> </div> </div> It would be a bonus if images faded out when another element is clicked... but not a big deal. Thanks for having a look

    Read the article

  • Webapp: safetly update a shared List/Map in the AppContext

    - by al nik
    I've Lists and Maps in my WebAppContext. Most of the time these are only read by multiple Threads but sometimes there's the need to update or add some data. I'm wondering what's the best way to do this without incurring in a ConcurrentModificationException. I think that using CopyOnWriteArrayList I can achieve what I want in terms of - I do not have to sync on every read operation- I can safety update the list while other threads are reading it. Is this the best solution? What about Maps?

    Read the article

  • Active User Tracking, PHP Sessions

    - by Nik
    Alright, I'm trying to work on a function for active user counting in an AJAX based application. I want to express the below SQL Query in correct syntax but I'm not sure how to write it. The desired SQL Query is below: SELECT count(*) FROM active WHERE timestamp > time() - 1800 AND nick=(a string that doesn't contain [AFK]) Now, I do understand that time() - 1800 can be assigned to a variable, but how is timestamp > variable and nick that doesn't contain a string written in SQL?

    Read the article

  • unusual ternary operation

    - by nik
    Hi, I was asked to perform this operation of ternary operator use: $test='one'; echo $test == 'one' ? 'one' : $test == 'two' ? 'two' : 'three'; Which prints two (checked using php). I am still not sure about the logic for this. Please, can anybody tell me the logic for this.

    Read the article

  • localtime_r supposed to be thread safe, but causing errors in Valgrind DRD

    - by Nik
    I searched google as much as I could but I couldn't find any good answers to this. localtime_r is supposed to be a thread-safe function for getting the system time. However, when checking my application with Valgrind --tool=drd, it consistantly tells me that there is a data race condition on this function. Are the common search results lying to me, or am I just missing something? It doesn't seem efficient to surround each localtime_r call with a mutex, especially if it is supposed to by thread safe in the first place. here is how i'm using it: timeval handlerTime; gettimeofday(&handlerTime,NULL); tm handlerTm; localtime_r(&handlerTime.tv_sec,&handlerTm); Any ideas?

    Read the article

  • acl9 and devise don't seem to work well together

    - by Nik
    I have a user model which is access controlled by ACL9 in userscontroller: ACL9 related stuff before_filter :load_user, :only = [:show] access_control do allow :owner, :of = :user, :to = [:show] end def load_user user = User.find(params[:id]) end in ApplicaitonController I have a rescue_from 'Acl9::AccessDenied', :with = :access_denied def access_denied authenticate_user! # a method from Devise end it is no problem to type in url for sign in page http://localhost:3000/users/sign_in but it is a problem when for example I type in the user page first, which I am to expect to be redirected to sign in page automatically thru the logic above http://localhost:3000/users/1 #= infinite redirect hell. it tries to redirect back to users/1 again(!?) instead of directing to users/sign_in Does anyone have an opinion as to what might be going wrong? Thanks!

    Read the article

  • AJAX Issue, Works in all browsers except IE

    - by Nik
    Alright, this code works in Chrome and FF, but not IE (which is to be expected). Does anyone see anything wrong with this code that would render it useless in IE? var waittime=400; chatmsg = document.getElementById("chatmsg"); room = document.getElementById("roomid").value; sessid = document.getElementById("sessid").value; chatmsg.focus() document.getElementById("chatwindow").innerHTML = "loading..."; document.getElementById("userwindow").innerHTML = "Loading User List..."; var xmlhttp = false; var xmlhttp2 = false; var xmlhttp3 = false; function ajax_read() { if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); if(xmlhttp.overrideMimeType){ xmlhttp.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState==4) { document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; setTimeout("ajax_read()", waittime); } } xmlhttp.open('GET','methods.php?method=r&room=' + room +'',true); xmlhttp.send(null); } function user_read() { if(window.XMLHttpRequest){ xmlhttp3=new XMLHttpRequest(); if(xmlhttp3.overrideMimeType){ xmlhttp3.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp3=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp3=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp3) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp3.onreadystatechange = function() { if (xmlhttp3.readyState==4) { document.getElementById("userwindow").innerHTML = xmlhttp3.responseText; setTimeout("user_read()", 10000); } } xmlhttp3.open('GET','methods.php?method=u&room=' + room +'',true); xmlhttp3.send(null); } function ajax_write(url){ if(window.XMLHttpRequest){ xmlhttp2=new XMLHttpRequest(); if(xmlhttp2.overrideMimeType){ xmlhttp2.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp2) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp2.open('GET',url,true); xmlhttp2.send(null); } function submit_msg(){ nick = document.getElementById("chatnick").value; msg = document.getElementById("chatmsg").value; document.getElementById("chatmsg").value = ""; ajax_write("methods.php?method=w&m=" + msg + "&n=" + nick + "&room=" + room + "&sessid=" + sessid + ""); } function keyup(arg1) { if (arg1 == 13) submit_msg(); } var intUpdate = setTimeout("ajax_read()", waittime); var intUpdate = setTimeout("user_read()", 0);

    Read the article

  • MySQL & PHP Use of Undefined Constant

    - by Nik
    Alright, PHP is throwing this error (only in the logs): Error PHP Notice: Use of undefined constant department - assumed 'department' (line 5) PHP Notice: Use of undefined constant name - assumed 'name' (line 6) PHP Notice: Use of undefined constant email - assumed 'email' (line 7) PHP Notice: Use of undefined constant message - assumed 'message' (line 8) Lines 4-7 $department = mysql_real_escape_string($_POST[department]); $name = mysql_real_escape_string($_POST[name]); $email = mysql_real_escape_string($_POST[email]); $message = mysql_real_escape_string($_POST[message]); I think it has something to do with defining constants before defining them (how is this possible).

    Read the article

  • Can't figure out where race condition is occuring

    - by Nik
    I'm using Valgrind --tool=drd to check my application that uses Boost::thread. Basically, the application populates a set of "Book" values with "Kehai" values based on inputs through a socket connection. On a seperate thread, a user can connect and get the books send to them. Its fairly simple, so i figured using a boost::mutex::scoped_lock on the location that serializes the book and the location that clears out the book data should be suffice to prevent any race conditions. Here is the code: void Book::clear() { boost::mutex::scoped_lock lock(dataMutex); for(int i =NUM_KEHAI-1; i >= 0; --i) { bid[i].clear(); ask[i].clear(); } } int Book::copyChangedKehaiToString(char* dst) const { boost::mutex::scoped_lock lock(dataMutex); sprintf(dst, "%-4s%-13s",market.c_str(),meigara.c_str()); int loc = 17; for(int i = 0; i < Book::NUM_KEHAI; ++i) { if(ask[i].changed > 0) { sprintf(dst+loc,"A%i%-21s%-21s%-21s%-8s%-4s",i,ask[i].price.c_str(),ask[i].volume.c_str(),ask[i].number.c_str(),ask[i].postTime.c_str(),ask[i].status.c_str()); loc += 77; } } for(int i = 0; i < Book::NUM_KEHAI; ++i) { if(bid[i].changed > 0) { sprintf(dst+loc,"B%i%-21s%-21s%-21s%-8s%-4s",i,bid[i].price.c_str(),bid[i].volume.c_str(),bid[i].number.c_str(),bid[i].postTime.c_str(),bid[i].status.c_str()); loc += 77; } } return loc; } The clear() function and the copyChangedKehaiToString() function are called in the datagetting thread and data sending thread,respectively. Also, as a note, the class Book: struct Book { private: Book(const Book&); Book& operator=(const Book&); public: static const int NUM_KEHAI=10; struct Kehai; friend struct Book::Kehai; struct Kehai { private: Kehai& operator=(const Kehai&); public: std::string price; std::string volume; std::string number; std::string postTime; std::string status; int changed; Kehai(); void copyFrom(const Kehai& other); Kehai(const Kehai& other); inline void clear() { price.assign(""); volume.assign(""); number.assign(""); postTime.assign(""); status.assign(""); changed = -1; } }; std::vector<Kehai> bid; std::vector<Kehai> ask; tm recTime; mutable boost::mutex dataMutex; Book(); void clear(); int copyChangedKehaiToString(char * dst) const; }; When using valgrind --tool=drd, i get race condition errors such as the one below: ==26330== Conflicting store by thread 1 at 0x0658fbb0 size 4 ==26330== at 0x653AE68: std::string::_M_mutate(unsigned int, unsigned int, unsigned int) (in /usr/lib/libstdc++.so.6.0.8) ==26330== by 0x653AFC9: std::string::_M_replace_safe(unsigned int, unsigned int, char const*, unsigned int) (in /usr/lib/libstdc++.so.6.0.8) ==26330== by 0x653B064: std::string::assign(char const*, unsigned int) (in /usr/lib/libstdc++.so.6.0.8) ==26330== by 0x653B134: std::string::assign(char const*) (in /usr/lib/libstdc++.so.6.0.8) ==26330== by 0x8055D64: Book::Kehai::clear() (Book.h:50) ==26330== by 0x8094A29: Book::clear() (Book.cpp:78) ==26330== by 0x808537E: RealKernel::start() (RealKernel.cpp:86) ==26330== by 0x804D15A: main (main.cpp:164) ==26330== Allocation context: BSS section of /usr/lib/libstdc++.so.6.0.8 ==26330== Other segment start (thread 2) ==26330== at 0x400BB59: pthread_mutex_unlock (drd_pthread_intercepts.c:633) ==26330== by 0xC59565: pthread_mutex_unlock (in /lib/libc-2.5.so) ==26330== by 0x805477C: boost::mutex::unlock() (mutex.hpp:56) ==26330== by 0x80547C9: boost::unique_lock<boost::mutex>::~unique_lock() (locks.hpp:340) ==26330== by 0x80949BA: Book::copyChangedKehaiToString(char*) const (Book.cpp:134) ==26330== by 0x80937EE: BookSerializer::serializeBook(Book const&, std::string const&) (BookSerializer.cpp:41) ==26330== by 0x8092D05: BookSnapshotManager::getSnaphotDataList() (BookSnapshotManager.cpp:72) ==26330== by 0x8088179: SnapshotServer::getDataList() (SnapshotServer.cpp:246) ==26330== by 0x808870F: SnapshotServer::run() (SnapshotServer.cpp:183) ==26330== by 0x808BAF5: boost::_mfi::mf0<void, RealThread>::operator()(RealThread*) const (mem_fn_template.hpp:49) ==26330== by 0x808BB4D: void boost::_bi::list1<boost::_bi::value<RealThread*> >::operator()<boost::_mfi::mf0<void, RealThread>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, RealThread>&, boost::_bi::list0&, int) (bind.hpp:253) ==26330== by 0x808BB90: boost::_bi::bind_t<void, boost::_mfi::mf0<void, RealThread>, boost::_bi::list1<boost::_bi::value<RealThread*> > >::operator()() (bind_template.hpp:20) ==26330== Other segment end (thread 2) ==26330== at 0x400B62A: pthread_mutex_lock (drd_pthread_intercepts.c:580) ==26330== by 0xC59535: pthread_mutex_lock (in /lib/libc-2.5.so) ==26330== by 0x80546B8: boost::mutex::lock() (mutex.hpp:51) ==26330== by 0x805473B: boost::unique_lock<boost::mutex>::lock() (locks.hpp:349) ==26330== by 0x8054769: boost::unique_lock<boost::mutex>::unique_lock(boost::mutex&) (locks.hpp:227) ==26330== by 0x8094711: Book::copyChangedKehaiToString(char*) const (Book.cpp:113) ==26330== by 0x80937EE: BookSerializer::serializeBook(Book const&, std::string const&) (BookSerializer.cpp:41) ==26330== by 0x808870F: SnapshotServer::run() (SnapshotServer.cpp:183) ==26330== by 0x808BAF5: boost::_mfi::mf0<void, RealThread>::operator()(RealThread*) const (mem_fn_template.hpp:49) ==26330== by 0x808BB4D: void boost::_bi::list1<boost::_bi::value<RealThread*> >::operator()<boost::_mfi::mf0<void, RealThread>, boost::_bi::list0>(boost::_bi::type<void>, boost::_mfi::mf0<void, RealThread>&, boost::_bi::list0&, int) (bind.hpp:253) For the life of me, i can't figure out where the race condition is. As far as I can tell, clearing the kehai is done only after having taken the mutex, and the same holds true with copying it to a string. Does anyone have any ideas what could be causing this, or where I should look? Thank you kindly.

    Read the article

  • How should I re-raise a Delphi exception after logging it?

    - by Nik
    Do you know a way to trap, log, and re-raise exception in Delphi code? A simple example: procedure TForm3.Button1Click(Sender: TObject); begin try raise Exception.Create('Bum'); except on E: Exception do begin MyHandleException(E); end; end; end; procedure TForm3.MyHandleException(AException: Exception); begin ShowMessage(AException.Message); LogThis(AException.Message); // raise AException; - this will access violate end; So I need to re-raise it in the except block but I was wondering if there is a better way to write my own method to handle and (on specific conditions) to re-raise exceptions.

    Read the article

  • Scoping Issue with PHP Arrays

    - by Nik
    I'm trying to solve this problem where I have a unique array of values within a specific range. Take this scenario: Generate a fixed value array (90) with unique entries. If you find a duplicate, remove, reindex, and fill the void. I'm running into the problem that conditional statements do not allow you to interact with an array outside of it's scope. I'm aware of array_unique but it doesn't refill those gaps, just makes them. How do I refill those gaps?

    Read the article

  • Problem with onMouseOut event with select box options (IE)

    - by nik
    Hello All, The problem I am facing with below code is that whenever I try to select any option from the select box, the mouseout event executed (in IE, Mozilla doing gr8) and option disappear. How can one get over this bug. <select name="ed" id="ed" dir="ltr" style="width:200px;overflow:hidden;" onMouseOver="this.style.width='auto'" onMouseOut="this.style.width='200px';"> <option value="1" selected="selected">click here</option> <option value="1">Samuel Jackson</option> <option value="2">David Nalog</option> <option value="3">This one is a real real big name</option> </select>

    Read the article

  • Best way to perform authentication on every request

    - by Nik
    Hello. In my asp.net mvc 2 app, I'm wondering about the best way to implement this: For every incoming request I need to perform custom authorization before allowing the file to be served. (This is based on headers and contents of the querystring. If you're familiar with how Amazon S3 does rest authentication - exactly that). I'd like to do this in the most perfomant way possible, which probably means as light a touch as possible, with IIS doing as much of the actual work as possible. The service will need to handle GET requests, as well as writing new files coming in via POST/PUT requests. The requests are for an abitrary file, so it could be: GET http://storage.foo.com/bla/egg/foo18/something.bin POST http://storage.foo.com/else.txt Right now I've half implemented it using an IHttpHandler which handles all routes (with routes.RouteExistingFiles = true), but not sure if that's the best, or if I should be hooking into the lifecycle somewhere else? Many thanks for any pointers. (IIS7)

    Read the article

  • Dual AJAX Requests at different times

    - by Nik
    Alright, I'm trying to make an AJAX Chat system that polls the chat database every 400ms. That part is working, the part of which isn't is the Active User List. When I try to combine the two requests, the first two requests are made, then the whole thing snowballs and the usually timed (12 second) Active User List request starts updating every 1ms and the first request NEVER happens again. Displayed is the entire AJAX code for both requests: var waittime=400;chatmsg=document.getElementById("chatmsg"); room = document.getElementById("roomid").value; chatmsg.focus() document.getElementById("chatwindow").innerHTML = "loading..."; document.getElementById("userwindow").innerHTML = "Loading User List..."; var xmlhttp = false; var xmlhttp2 = false; var xmlhttp3 = false; function ajax_read(url) { if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); if(xmlhttp.overrideMimeType){ xmlhttp.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState==4) { document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; setTimeout("ajax_read('methods.php?method=r&room=" + room +"')", waittime); } } xmlhttp.open('GET',url,true); xmlhttp.send(null); } function user_read(url) { if(window.XMLHttpRequest){ xmlhttp3=new XMLHttpRequest(); if(xmlhttp3.overrideMimeType){ xmlhttp3.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp3=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp3=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp3) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp3.onreadystatechange = function() { if (xmlhttp3.readyState==4) { document.getElementById("userwindow").innerHTML = xmlhttp3.responseText; setTimeout("ajax_read('methods.php?method=u&room=" + room +"')", 12000); } } xmlhttp3.open('GET',url,true); xmlhttp3.send(null); } function ajax_write(url){ if(window.XMLHttpRequest){ xmlhttp2=new XMLHttpRequest(); if(xmlhttp2.overrideMimeType){ xmlhttp2.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp2) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp2.open('GET',url,true); xmlhttp2.send(null); } function submit_msg(){ nick = document.getElementById("chatnick").value; msg = document.getElementById("chatmsg").value; document.getElementById("chatmsg").value = ""; ajax_write("methods.php?method=w&m=" + msg + "&n=" + nick + "&room=" + room + ""); } function keyup(arg1) { if (arg1 == 13) submit_msg(); } var intUpdate = setTimeout("ajax_read('methods.php')", waittime); var intUpdate = setTimeout("user_read('methods.php')", waittime);

    Read the article

  • Problem indexing files in Solr on Ubuntu

    - by nik
    Hi, What I want to do is index some documents in Solr and know how it works. I have installed Solr and Tomcat and can see Solr Admin UI at localhost:8080/ solr/ admin/ Now, I want to add some documents to the index, may I know how to proceed further? I find very less documentation on Internet regarding this. In the tutorial http://lucene.apache.org/solr/tutorial.html#Indexing+Data they asked to run java -jar post.jar solr.xml monitor.xml command but after running that I get connection refused error as it is jetty. After installing jetty I tried telnet: I get "Connection refused" error I am not able to understand what the problem is.

    Read the article

  • can rails send data to browser chunk by chunk?

    - by Nik
    Hello all, I have a very large dataset (100,000) to be display, but any browser I tried that on including chrome 5 dev, it make them choke for dozens of seconds (win7 64bit, 4gb, 256gb ssd, c2duo 2.4ghertz). I did a little experiment by some_controller.rb def show @data = (1..100000).to_a end show.html.erb <% @data.each do |d| % <%= d.to_s % <% end% as simple as that it chokes the browsers. I know browsers were never built for this, so I thought to let the data come in chunk by chunk, I guess 2000 per chunk is reasonable, but I wouldn't want to make 50 requests each time this view is called, any ideas? It doesn't have to be chunk by chunk if it can be sent all at once. Best,

    Read the article

  • rails large amount of data in single insert activerecord gave out

    - by Nik
    So I have I think around 36,000 just to be safe, a number I wouldn't think was too large for a modern sql database like mysql. Each record has just two attributes. So I do: so I collected them into one single insert statement sql = "INSERT INTO tasks (attrib_a, attrib_b) VALUES (c1,d1),(c2,d2),(c3,d3)...(c36000,d36000);" ActiveRecord::Base.connection.execute sql from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/abstract_adapter.rb:219:in `log' from C:/Ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connection_adapters/mysql_adapter.rb:323:in `execute_without_analyzer from c:/r/projects/vendor/plugins/rails-footnotes/lib/rails-footnotes/notes/queries_note.rb:130:in `execute' from C:/Ruby/lib/ruby/1.8/benchmark.rb:308:in `realtime' from c:/r/projects/vendor/plugins/rails-footnotes/lib/rails-footnotes/notes/queries_note.rb:130:in `execute' from (irb):53 from C:/Ruby/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/active_support/vendor/tzinfo-0.3.12/tzinfo/time_or_datetime.rb:242 I don't know if the above info is enough, please do ask for anything that I didn't provide here. So any idea what this is about? THANK YOU!!!!

    Read the article

  • How do i set Savepoints for Linq to SQL and use "NO" ExecuteCommand ?

    - by nik
    TransactionScope TransactionABC = new TransactionScope(); try { context.Connection.Open(); { context.ExecuteCommand("insert into test (test) values (1)") context.SubmitChanges(); context.ExecuteCommand("savepoint test"); context.ExecuteCommand("insert into test (test) values (2)") context.SubmitChanges(); context.ExecuteCommand("rollback to test"); } TransactionABC.Complete(); TransactionABC.Dispose(); } catch (Exception ec) { MessageBox.Show(" ", ec.Message); } finally { context.Connection.Close(); } It works, but only with ExecuteCommand. I want to use a function, because i can't see what happens in the savepoint !

    Read the article

  • Fastest Linux IDE with Find&Replace

    - by Nik
    I'm looking for a fast IDE for Linux that has Find&Replace. I'm currently using Geany and I've tried NetBeans, and Aptana doesn't have a PHP plugin for 2.0. I prefer one that has a sense of projects. Does anyone have any suggestions?

    Read the article

  • ILNumerics multiply complex with matrix<double>

    - by nik
    I m looking at ILNumerics to translate some matlab code into c#. How would I multiply a complex and a double? Simplified description: In Matlab: A=[1 2 3] i*A*A' Returns a complex number. How would I do the same in ILNumerics: ILArray<double> A = ILMath.array(1.0, 2.0, 3.0); complex B = complex.i * ILMath.multiply(A,A.T); Throws the error: Operator '*' cannot be applied to operands of type 'ILNumerics.complex' and 'ILNumerics.ILRetArray<double>' Update This works: double C = 14.0; complex D = complex.i * C; But shouldnt: ILMath.multiply(A,A.T) also return 14.0?

    Read the article

  • ruby subclass filter

    - by Nik
    Hey! Maybe I am getting the idea of a subclass wrong, but I have a Person model and it has an attrib called "age" so Person.first.age #=> '20' Now I want to have a model that's basically persons 55 or older so I know I can have a class like this: class Senior < Person end But how can I "pre-filter" the Senior class so that every object belonging to that class has age = 55? Senior.first.age #=> 56 Thanks!

    Read the article

  • Where to put code snippets in Rails?

    - by Nik
    Hello all, I have this code snippets that generates a signature for POSTs. The detail of it is not important, but what I want to know is: since it is not a model-related chunk of code, it really can be use anywhere: in controllers, in models, in view helpers; even in views. So I am unsure where and, even bigger of a problem, how to activate the use of it once I place it in some location. Is it what those "require" statements are all about? That you can acquire some functionality through a "require" statement in the current file you are working on? Just so that we have an example to talk about, say, I have a little snippet of code that does cubing: def cube_it(num) num**3 end I know that I will be using it in various places across the application, so where should I put it? and when I do need to use it, how can I "summon" it? Thank You

    Read the article

< Previous Page | 1 2 3 4 5 6  | Next Page >