Is there any way to use OpenOffice's PyUNO without using the version of Python that comes with OpenOffice?
I mean, can I install a package (on Windows and CentOS) that uses the version of Python that's already on the server?
I'm trying to use OpenOffice in headless mode so that I can do document conversion with a script (ultimately on a hosted server running CentOS) but my development work is being done on Windows and occassionally the Mac). I'm having nothing but trouble getting this to work.
I am trying to prototype an indexing/search application which uses very volatile indexing data sources (forums, social networks etc), here are some of the performance requirements,
Very fast turn-around time (by this I mean that any new data (such as a new message on a forum) should be available in the search results very soon (less than a minute))
I need to discard old documents on a fairly regular basis to ensure that the search results are not dated.
Last but not least, the search application needs to be responsive. (latency on the order of 100 milliseconds, and should support at least 10 qps)
All of the requirements I have currently can be met w/o using Lucene (and that would let me satisfy all 1,2 and 3), but I am anticipating other requirements in the future (like search relevance etc) which Lucene makes easier to implement. However, since Lucene is designed for use cases far more complex than the one I'm currently working on, I'm having a hard time satisfying my performance requirements.
Here are some questions,
a. I read that the optimize() method in the IndexWriter class is expensive, and should not be used by applications that do frequent updates, what are the alternatives?
b. In order to do incremental updates, I need to keep committing new data, and also keep refreshing the index reader to make sure it has the new data available. These are going to affect 1 and 3 above. Should I try duplicate indices? What are some common approaches to solving this problem?
c. I know that Lucene provides a delete method, which lets you delete all documents that match a certain query, in my case, I need to delete all documents which are older than a certain age, now one option is to add a date field to every document and use that to delete documents later. Is it possible to do range queries on document ids (I can create my own id field since I think that the one created by lucene keeps changing) to delete documents? Is it any faster than comparing dates represented as strings?
I know these are very open questions, so I am not looking for a detailed answer, I will try to treat all of your answers as suggestions and use them to inform my design. Thanks! Please let me know if you need any other information.
In the Jquery example below, I would like to expand $(this) before it is cloned, so it includes everything contained in the parent class "comment". How do I do this? I've tried using ReplaceWith($(this).parent('.comment').clone()... and it does not work!
$(document).ready(
function(){
$('.forumthreadtitle').siblings().hide();
$('.forumthreadtitle').click( function() {
$('#first-post').replaceWith($(this).clone().attr('id','first-post'));
});
I make a call to the twitter API. 100 posts are retreived + a properties that tells me what the next page to call is. So I wait 5 sec. and call that next page, but the JSon results in the callback function is always null the second time... I think it's probably a JQuery problem...
Here's a complete sample HTML code :
<html>
<head>
<script type="text/javascript" src="./jquery-1.4.2.min.js"></script>
<script>
function test() {
var rqUrl = "http://search.twitter.com/search.json?q=%23apple+OR+%23ipad&rpp=100&callback=?"
callTwitterSearchApi(rqUrl);
}
function callTwitterSearchApi(tiwtterRequestUrl) {
debug("request to twitter : " + tiwtterRequestUrl);
// *** FIRST CALL WORKS GREAT... ***
$.getJSON(tiwtterRequestUrl, callTwitterSearchApi_callback);
}
function callTwitterSearchApi_callback(jsonPostsResults) {
debug("callback");
if (jsonPostsResults == null) {
debug("Why is jsonPostsResults null? If I copy paste the request inside a browser, I get something =(");
return;
}
if (jsonPostsResults.error != undefined && jsonPostsResults.error != "") {
debug("twitter api error");
}
var posts = new Array();
$(jsonPostsResults.results).each(function() {
posts.push(this);
});
debug("Number of posts : " + posts.length);
if (jsonPostsResults.next_page != undefined && jsonPostsResults.next_page.trim() != "") {
debug("calling next request in 5 sec...");
// *** WHEN COMMING BACK FROM THAT LINE, JSON RESULTS == NULL?! ****
setTimeout("callTwitterSearchApi(\"http://search.twitter.com/search.json" + jsonPostsResults.next_page + "\")", 5000);
}
}
function debug(message) {
document.getElementById('debug').innerHTML = message + "\n" + document.getElementById('debug').innerHTML;
}
</script>
</head>
<body>
<input type="button" onclick="test();" value="test" /><br />
<textarea id="debug" cols="80" rows="20"></textarea>
</body>
</html>
at line 18, at the second callback (back from the setTimeout), the parameter "jsonPostsResults" is always returned as null... I have no idea why. If I copy paste that 2nd request in a browser, it returns 100 results. Anybody had a problem like that with the Ajax JQuery functions when calling it with a setTimeout?
G'day guys, currently have almost finished writing a rails application that allows a CSV download of the database. This is generated when the index is first viewed.
Is there an easy way to insert a link to a helper that returns a CSV document? That is to say is it easy to insert links to helpers? This would make a lot of problems I've been having much easier
I recently played with MongoDB in Rails using Mongoid. I like the ability to define attributes for models within the model file (as opposed to in migrations):
class Person
include Mongoid::Document
field :name, :type => String
field :birthday, :type => Date
end
For projects that cannot use a schema-less database, does a similar feature exist? Any gems or plugins that generate schemas from a similar syntax would be greatly appreciated.
Thanks.
I already have pdf links set up. I am just looking to prepend Google's syntax in front of my current href using jQuery. i know the following doesn't work, but I feel I am close…?
jQuery(document).ready(function() {
jQuery("a[href$=.pdf]").attr("href", "http://docs.google.com/viewer?url=" + current.href);
});
Can anyway help, please?
I am trying to use your modified lighttpd server-status.
server-status mod is enabled and running, I am geting lighttpd status but I can not use yours
becouse I can not use port 80 again
($SERVER["socket"] == "192.168......:80" {
status.status-url = "/server-status"
server.document-root = "/var/www/status"
mimetype.assign = ( ".html" = "text/html" )
index-file.names = ( "pretty-status.html" )
}
this gives me an error on lighty restart saying port (= already in use.
Any help?
First let me state that I'm a jquery noob, so this may not make a lot of sense.
So I have a series of list items that expand to show a hidden div inside if the user mouses over a link inside the item (not the whole list item itself)
The problem is that if the users mouse leaves the link the li closes up again.
I need this to work in a way so that the li only closes if you mouse over a link in another li. (sorry this is kind of hard to put into words)
Heres my code.
$(document).ready(function(){
$(".home_upcoming_title").hoverIntent({
over: makeTall,
timeout: 500,
out: makeShort
});
}); // close document.ready
function makeTall(){$(this).parents("li").animate({"height":200},200);}
function makeShort(){$(this).parents("li").animate({"height":32},200);}
and the HTML
<li class="p1">
<ul class="home_upcoming_list2" id="fade">
<li class="home_upcoming_date">Sat.Sept.23rd.2010</li>
<li><a href="./." class="home_upcoming_title" >Event Title</a></li>
<li class="home_upcoming_city">Los Angeles</li>
<li class="home_upcoming_type">Festival</li>
<li class="home_upcoming_venue">Venue</li>
<li class="home_upcoming_age">18+</li>
<li><a href="./." title="Buy Tickets" class="home_upcoming_tix">Buy Tickets</a></li>
<li><a href="./." class="upcoming_info" title="View Details"></a></li>
</ul>
<div style="height:150px; background-color:#FF0000; display:block;" class="sl0w"></div>
</li>
so the link with the class "home_upcoming_title" expands li to show the div inside but when I mouse over the div itself the list closes. I also need it so only the class "home_upcoming_title" expands the div. but it needs to stay open until you mouse over another link with the same class.
sorry if that doesn't make much sense :)
I am creating a background color animation with jQuery and the color animation plugin
http://plugins.jquery.com/project/color
How do I have a function stay in a loop repeating itself each time it has finished running? I tried this but it did not work :
$(document).ready(function(){
function colorLoop(){
$("#window")
.animate({ backgroundColor: "orange" }, 11000)
.animate({ backgroundColor: "yellow" }, 1000)
.animate({ backgroundColor: "green" }, 1000)
.animate({ backgroundColor: "blue" }, 1000)
.animate({ backgroundColor: "indigo" }, 1000)
.animate({ backgroundColor: "violet" }, 1000)
.animate({ backgroundColor: "red" }, 1000, colorLoop);
};
});
Hi,
is it possible to trigger Parent's page load event from a popup.When i use javascript function window.parent.document.form.submit,this creates a postback.I want a function which creates "reload" for page because some of my functions work in the "if not postback" statement.
We have deployed a .net 4 asp.net site on IIS 6.0.
Default.aspx is configured as one of the default document.
When we access the site using the following url
http://testsite
We expect it to render
http://testsite/Default.aspx
But instead we get 404 Not found error. We did not had this issue when it was deployed on .Net 2.0. Only thing that has changed on the server is that we use .Net 4 instead of .Net 2.
In the document for the method notifyDataSetChanged of class BaseAdapter noted that "Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself. "
Supposed I changed the 3rd element in my string array (array data for the listview), what "any View reflecting the data set should refresh itself" means ? Does the 3rd view item in my list view be notified ?
Also, how is notifyDataSetChanged() and getView() concerned ?
Thanks in advance
I am attempting to convert Java code to Jython and am using the apache Log and LogFactory imports. I am attempting to emulate Foo.class in Jython The chunk of code is as follows:
in Java
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
public class MyClass {
private static final Log log = LogFactory.getLog(MyClass.class);
public MyClass(Document dom)
{ //code
}
How can I emulate this same behavior of MyClass.class in Jython/Python?
I'm trying to build a basic POP3 mail client in C/++, but I've run into a bit of an issue. Since you have to define the buffer size when building the program, but a message can be arbitrarily large, how do you, say, get the mail server to send it to you in parts? And if this isn't the correct means of solving the problem, what is?
And while I'm here, can anyone confirm for me that RFC 2822 is still the current document defining email layout?
Thanks
I need to match and replace some comments.
for example:
$test = "the url is http://www.google.com";// comment "<-- that quote needs to be matched
I want to match the comments outside of the quotes, and replace any "'s in the comments with "'s.
I have tried a number of patterns and different ways of running them but with no luck.
The regex will be run with javascript to match php "//" comments
UPDATE:
I took the regex from borkweb below and modified it. used a function from http://ejohn.org/blog/search-and-dont-replace/ and came up with this:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function t_replace(data){
var q = {}, ret = "";
data.replace(/(?:((["'\/]*(("[^"]*")|('[^']*'))?[\s]*)?[\/\/|#][^"|^']*))/g, function(value){
q[key] = value;
});
for ( var key in q ){
ret = q[key];
}
var text = data.split(ret);
var out = ret + text[1];
out = out.replace(/"/g,""");
out = out.replace(/'/g,"'");
return text[0] + out;
}
</script>
</head>
<body>
<script type="text/javascript">
document.write(t_replace("$test = \"the url is http://www.google.com\";// c'o\"mment \"\"\"<-- that quote needs to be matched")+"<br>");
document.write(t_replace("$test = 'the url is http://www.google.com';# c'o\"mment \"\"\"<-- that quote needs to be matched"));
</script>
</body>
</html>
it handles all the line comments outside of single or double quotes. Is there anyway I could optimize this function?
I am following the Zend Framework quickstart document and got stuck on the .htaccess rewrite rules. I am using this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
This works find when I access through HTTP, however, nothing is served when accessing through HTTPS. I am using a single directory for HTTP and HTTPS content.
I would not want to force HTTPS either.
How can I fix this?
I have been working on this program which inserts an XML file into a MYSQL database. I'm new to the whole .jar idea by inserting packages. Im having an issue with parse(), select(), and children(). Can someone inform me how I could fix this issue? Here is my stack trace and my program below:
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method select(String) is undefined for the type Document
The method children() is undefined for the type Element
The method children() is undefined for the type Element
The method children() is undefined for the type Element
The method children() is undefined for the type Element
at jdbc.parseXML.main(parseXML.java:28)
import java.io.*;
import java.sql.*;
import org.jsoup.Jsoup;
import org.w3c.dom.*;
import javax.xml.parsers.*;
public class parseXML{
public static void main(String xml) {
try{
BufferedReader br = new BufferedReader(new FileReader(new File("C:\\staff.xml")));
String line;
StringBuilder sb = new StringBuilder();
while((line=br.readLine())!= null){
sb.append(line.trim());
}
Document doc = Jsoup.parse(line);
StringBuilder queryBuilder;
StringBuilder columnNames;
StringBuilder values;
for (Element row : doc.select("row")) {
// Start the query
queryBuilder = new StringBuilder("insert into customer(");
columnNames = new StringBuilder();
values = new StringBuilder();
for (int x = 0; x < row.children().size(); x++) {
// Append the column name and it's value
columnNames.append(row.children().get(x).tagName());
values.append(row.children().get(x).text());
if (x != row.children().size() - 1) {
// If this is not the last item, append a comma
columnNames.append(",");
values.append(",");
}
else {
// Otherwise, add the closing paranthesis
columnNames.append(")");
values.append(")");
}
}
// Add the column names and values to the query
queryBuilder.append(columnNames);
queryBuilder.append(" values(");
queryBuilder.append(values);
// Print the query
System.out.println(queryBuilder);
}
}catch (Exception err) {
System.out.println(" " + err.getMessage ());
}
}
}
Given a PDF document, is it possible to generate a XSL-FO (FOP) template?
Obviously, this would be a one-time thing - the generated template would just be a starting point for creating a proper template that pulls in the appropriate data.
For me, the ideal tool for doing so would be a Java-based one and should be executable from the command line or through an ANT task. Failing that, it would be something that runs on Linux and MacOS X.
Hi,
I have a xml document holding a small data for my project where I want to convert my xml to an excel file (microsoft office excel 2003 and over)
How can I do this?
Kind Regards.
I want detailed explanations for bsd-socket options so that I can use them in the right manner. Can anybody please provide me some document or link from where I can refer?
Thanks,
Satinder Singh
[email protected]
how do i minify this. (mootools, but it probably looks similar in jQuery)
window.frames['buffer'].document.body.innerHTML
in mootools, this does not work:
$('buffer').$('body').get('html');
I am currently playing around with jqueries drag and drop, basically I currently have a div (.drag_check) that holds a checkbox, I have the drag and drop working but I want to alert out the checkbox's ID once the element is dropped, I assume I have to use child but all my attempts have returned 'undefined'. Below is my code,
$('.drag_check').draggable({
containment: 'document',
opacity:0.6,
revert: 'invalid',
helper: 'clone',
zIndex: 100
});
$("ul.searchPage").droppable({
drop:
function(e, ui) {
var param = $(ui.draggable).attr('class')
addlist(param)
alert(param)
}
})
I am trying to update a google map v3 with jQuery and at the moment it loads the map but when .preview is clicked the map scaled to the width and height and then goes grey.
$('.preview').click(function(){
var width = $('#width').val();
var height = $('#height').val();
$('#map').css({
'width':width,
'height':height
});
var mapElement = document.getElementById('map');
var updateOptions = {
zoom: 6
}
var map = new google.maps.Map(mapElement, updateOptions);
});