I'm using Ubuntu 11.04. The update manager once found the new release 'oneiric', and still shows up this screen when I log on use ssh:
Welcome to Ubuntu 11.04 (GNU/Linux 2.6.38-14-generic x86_64)
* Documentation: https://help.ubuntu.com/
0 packages can be updated.
0 updates are security updates.
New release 'oneiric' available.
Run 'do-release-upgrade' to upgrade to it.
Last login: Wed Apr 25 16:22:48 2012 from ***
But I didn't upgrade then, and change my apt sources. And now I cannot upgrade to 'oneiric'. do-relase-upgrade shows:
$ sudo do-release-upgrade
Checking for a new ubuntu release
No new release found
$
And apt-get dist-upgrade shows:
$ sudo apt-get dist-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
$
I can successfully update all my packages.
File contents of source.list:
$ cat /etc/apt/sources.list
## See sources.list(5) for more information, especialy
# Remember that you can only use http, ftp or file URIs
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty main universe restricted multiverse
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty main universe restricted multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty-security universe main multiverse restricted
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty-security universe main multiverse restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty-updates universe main multiverse restricted
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty-updates universe main multiverse restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty-backports universe main multiverse restricted
deb-src http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ natty-backports universe main multiverse restricted
# deb http://ubuntu.dormforce.net/ubuntu/ lucid main universe restricted multiverse
# deb-src http://ubuntu.dormforce.net/ubuntu/ lucid main universe restricted multiverse
# deb http://ubuntu.dormforce.net/ubuntu/ lucid-security universe main multiverse restricted
# deb-src http://ubuntu.dormforce.net/ubuntu/ lucid-security universe main multiverse restricted
# deb http://ubuntu.dormforce.net/ubuntu/ lucid-updates universe main multiverse restricted
# deb-src http://ubuntu.dormforce.net/ubuntu/ lucid-updates universe main multiverse restricted
# CDROMs are managed through the apt-cdrom tool.
# deb http://archive.canonical.com lucid partner
# deb http://archive.canonical.com lucid-security partner
# deb http://archive.canonical.com lucid-updates partner
# deb-src http://archive.canonical.com lucid partner
# deb-src http://archive.canonical.com lucid-security partner
# deb-src http://archive.canonical.com lucid-updates partner
#medibuntu repo
# deb http://packages.medibuntu.org/ lucid free non-free
# deb-src http://packages.medibuntu.org/ lucid free non-free
# deb http://extras.ubuntu.com/ubuntu maverick main #Third party developers repository
deb http://mirrors.sohu.com/ubuntu/ natty main restricted multiverse universe
deb-src http://mirrors.sohu.com/ubuntu/ natty main universe restricted multiverse #Added by software-properties
deb http://security.ubuntu.com/ubuntu/ natty-security universe main multiverse restricted
deb-src http://mirrors.sohu.com/ubuntu/ natty-security universe main multiverse restricted
deb http://mirrors.sohu.com/ubuntu/ natty-updates universe main multiverse restricted
deb-src http://mirrors.sohu.com/ubuntu/ natty-updates universe main multiverse restricted
File contents of /etc/update-manager/meta-release:
$ cat /etc/update-manager/meta-release
# default location for the meta-release file
[METARELEASE]
URI = http://changelogs.ubuntu.com/meta-release
URI_LTS = http://changelogs.ubuntu.com/meta-release-lts
URI_UNSTABLE_POSTFIX = -development
URI_PROPOSED_POSTFIX = -proposed
What may be the problem of this?
How can I force Doxygen to show full include path?
What do I mean:
I have a class foo::bar::bee defined in bee.hpp in following directory structure:
foo
foo/bar
foo/bar/bee.hpp
Doxygen, when it documents foo::bar::bee class tells that you need to include <bee.hpp>, but for my software I need <foo/bar/bee.hpp>
How can I cause Doxygen to do this?
Notes:
FULL_PATH_NAMES is already set to default YES
I do not want to provide include header explicitly for each class, because there
too many of them. I want Doxygen to do this automatically.
Thanks.
Hi, I'm trying to create an image animation using Raphael JS.
I want the effect of a bee moving randomly across the page, I've got a working example but it's a bit "jittery", and I'm getting this warning in the console:
"Resource interpreted as image but transferred with MIME type text/html"
I'm not sure if the warning is causing the "jittery" movement or its just the way I approached it using maths.
If anyone has a better way to create the effect, or improvements please let me know.
I have a demo online here
and heres my javascript code:
function random(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function BEE(x, y, scale) {
this.x = x;
this.y = y;
this.s = scale;
this.paper = Raphael("head", 915, 250);
this.draw = function() {
this.paper.clear();
this.paper.image("bee.png", this.x, this.y, 159*this.s, 217*this.s);
}
this.update = function() {
var deg = random(-25, 25);
var newX = Math.cos(Raphael.rad(deg)) * 2;
var newY = Math.sin(Raphael.rad(deg)) * 2;
this.x += newX;
this.y += newY;
if( this.x > 915) {
this.x = 0;
}
if( this.y > 250 || this.y < 0 ) {
this.y = 125;
}
}
}
$(document).ready(function() {
var bee = new BEE(100, 150, 0.4);
var timer = setInterval(function(){
bee.draw();
bee.update();
}, 15);
}
Im really really a newbie in regexp and i cant figure out how to do that.
My goal is to have the RewriteRule to 'slice' the request url in 3 parts:
example.com/foo
#should return: index.php?a=foo&b=&c=
example.com/foo/bar
#should return: index.php?a=foo&b=bar&c=
example.com/foo/bar/baz
#should return: index.php?a=foo&b=bar&c=baz
example.com/foo/bar/baz/bee
#should return: index.php?a=foo&b=bar&c=baz/bee
example.com/foo/bar/baz/bee/apple
#should return: index.php?a=foo&b=bar&c=baz/bee/apple
example.com/foo/bar/baz/bee/apple/and/whatever/else/no/limit/in/those/extra/parameters
#should return: index.php?a=foo&b=bar&c=baz/bee/apple/and/whatever/else/no/limit/in/those/extra/parameters
In short, the first parameter in the url (foo) should be given to a, the second (bar) to b, and the rest of the string in c
I wroted this one
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(([a-z0-9/]))?(([a-z0-9/]+))?(([a-z0-9]+))(.*)$ index.php?a=$1&b=$2&c=$3 [L,QSA]
</IfModule>
but obviously doesnt work, and i dont even know if what i want is possible.
Any suggestion?
Im really really a newbie in regexp and I can’t figure out how to do that.
My goal is to have the RewriteRule to 'slice' the request URL path in 3 parts:
example.com/foo
#should return: index.php?a=foo&b=&c=
example.com/foo/bar
#should return: index.php?a=foo&b=bar&c=
example.com/foo/bar/baz
#should return: index.php?a=foo&b=bar&c=baz
example.com/foo/bar/baz/bee
#should return: index.php?a=foo&b=bar&c=baz/bee
example.com/foo/bar/baz/bee/apple
#should return: index.php?a=foo&b=bar&c=baz/bee/apple
example.com/foo/bar/baz/bee/apple/and/whatever/else/no/limit/in/those/extra/parameters
#should return: index.php?a=foo&b=bar&c=baz/bee/apple/and/whatever/else/no/limit/in/those/extra/parameters
In short, the first segment in the URL path (foo) should be given to a, the second segment (bar) to b, and the rest of the string in c
I wroted this one
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(([a-z0-9/]))?(([a-z0-9/]+))?(([a-z0-9]+))(.*)$ index.php?a=$1&b=$2&c=$3 [L,QSA]
</IfModule>
But obviously doesn’t work, and I don’t even know if what I want is possible.
Any suggestion?
EDIT:
After playing with coach manager, I got this one working too:
RewriteRule ^([^/]*)?/?([^/]*)?/?(.*)?$ index.php?a=$1&b=$2&c=$3 [L,QSA]
For this assignemnt, I think that I got it right, but when I submit it online, it doesn't list it as correct even though I checked with Eclipse.
The prompt:
Write a method isPalindrome that accepts an array of Strings as its argument and returns true if that array is a palindrome (if it reads the same forwards as backwards) and /false if not. For example, the array {"alpha", "beta", "gamma", "delta", "gamma", "beta", "alpha"} is a palindrome, so passing that array to your method would return true. Arrays with zero or one element are considered to be palindromes.
My code:
public static void main(String[] args) {
String[] input = new String[6]; //{"aay", "bee", "cee", "cee", "bee", "aay"} Should return true
input[0] = "aay";
input[1] = "bee";
input[2] = "cee";
input[3] = "cee";
input[4] = "bee";
input[5] = "aay";
System.out.println(isPalindrome(input));
}
public static boolean isPalindrome(String[] input) {
for (int i=0; i<input.length; i++) { // Checks each element
if (input[i] != input[input.length-1-i]){
return false; // If a single instance of non-symmetry
}
}
return true; // If symmetrical, only one element, or zero elements
}
As an example, {"aay", "bee", "cee", "cee", "bee", "aay"} returns true in Eclipse, but Practice-It! says it returns false. What is going on?
I used the following script to calculate AUC in R:
library(mgcv)
library(ROCR)
library(AUC)
data1=read.table("d:\\2005.txt", header=T)
GAM<-gam(tuna ~ s(chla)+s(sst)+s(ssha),family=binomial, data=data1)
gampred<- predict(GAM, type="response")
rp <- prediction(gampred, data1$tuna)
auc <- performance( rp, "auc")@y.values[[1]]
auc
roc <- performance( rp, "tpr", "fpr")
plot( roc )
But when I was running the script, the result is:
**rp <- prediction(gampred, data1$tuna)
Error in prediction(gampred, data1$tuna) :
Format of predictions is invalid.
>
> auc <- performance( rp, "auc")@y.values[[1]]
Error in performance(rp, "auc") : object 'rp' not found
> auc
function (x, min = 0, max = 1)
{
if (any(class(x) == "roc")) {
if (min != 0 || max != 1) {
x$fpr <- x$fpr[x$cutoffs >= min & x$cutoffs <= max]
x$tpr <- x$tpr[x$cutoffs >= min & x$cutoffs <= max]
}
ans <- 0
for (i in 2:length(x$fpr)) {
ans <- ans + 0.5 * abs(x$fpr[i] - x$fpr[i - 1]) *
(x$tpr[i] + x$tpr[i - 1])
}
}
else if (any(class(x) %in% c("accuracy", "sensitivity", "specificity"))) {
if (min != 0 || max != 1) {
x$cutoffs <- x$cutoffs[x$cutoffs >= min & x$cutoffs <=
max]
x$measure <- x$measure[x$cutoffs >= min & x$cutoffs <=
max]
}
ans <- 0
for (i in 2:(length(x$cutoffs))) {
ans <- ans + 0.5 * abs(x$cutoffs[i - 1] - x$cutoffs[i]) *
(x$measure[i] + x$measure[i - 1])
}
}
return(as.numeric(ans))
}
<bytecode: 0x03012f10>
<environment: namespace:AUC>
>
> roc <- performance( rp, "tpr", "fpr")
Error in performance(rp, "tpr", "fpr") : object 'rp' not found
> plot( roc )
Error in levels(labels) : argument "labels" is missing, with no default**
Can anybody help me to solve this problem?
Thank you in advance.
Guys, I have been surfing thru the web to find a way that I could use Multiple-Table-Inheritance in LINQ-To-SQL. But it looks like that it only supports single table inheritance which is not the best way to achieve inheritance in a ORM framework. I got to read that this will be addressed in next LINQ and Entity framework implementations. But how longer a stay we are talking about? In the meantime, if any of you guys have tried out a work-around implementation to achieve this, please let me know. And I thought of using my leisure time to come up with such an implementation so suggestions are welcome!
/Bumble Bee
Every time I open Windows Media Player it fails to detect my autoplaylists stored in <my music library dir>\Playlists. This appears to lead to sync problems since I (exclusively) use autoplaylists to sync music to my mobile. As WMP 11 fails to find the any sync autoplaylists it infuriatingly seems to decide that I want no music at all on my phone and proceeds to delete all my music off my phone.
I guess these are two seperate problems but it seems to me they are related. If anyone can shed any light on a fix, that would be much appreciated.
Many thanks
I built a TicTacToe game to learn the .Net MVC3 framework. The basic functionality works (display board, make a move, detect winning move etc.) What I'd like to do is make it a "real" application - well-architected and using the right technology at the right layer. For instance, I'm currently saving every move to the database via a service call, which feels klugey and may become a bottleneck if this was an MMO game.
How do you determine a good architecture (or right set of technologies) to use in a situation like this? I'd like to learn not just what to do, but why certain decisions are better than others.
I noticed a similar thread here but it just offered opinions without explaining WHY something would be better (e.g. why Node instead of MVC3, etc.)
"Information-technology is allowing the city's economy to speak to us in lots of different ways," Mr. Egan said. "We just need to find new ways of listening."
Source: "New Way to Read Economy" WSJ_ARTICLE April 8th, Carli Tuna, Blog by ARC's Steve Banker Apr 12, 2010
Alan Greenspan used cardboard box purchases and other 'source-commodity' indicators. The Carli Tuna WSJ article said that truck diesel fuel sales are a reliable indicator. What factor do you and your company use as future forward indicators? .. is it quotes, perhaps calls into the call center or sales activity? Is your business moving to the internet and your supply chain driven by your iStore? How do your distributors, retailers and supply chain partners provide the 'side-line' signals to you to either ramp up or contract production?
With competition being only one click away, organizations need to know with higher degrees of certainty, what the econmic 'tea-leaves' are telling us and how firms need to react with production and shipping forecasts. Firms using the latest forecasting and supply chain analytical (Bus.Intelligence) tools and technologies appear to be leading their markets
"Had we been aware of that data in 2008," Mr. Leamer said, "we would have made a different call."
.
Im not sure if this question is appropriate to go in here but after some hard effort in google I had no option but to post this here.
I'm in the process of doing some UIs for a touch screen, but not sure how the template should look like. e.g. how big the buttons/text/labels should be. If anyone has experience in doing s similar stuff, pls share some references you have.
thanks
BB
I'm having trouble with sprite animation in XNA that appears to be caused by a struct passed as a reference value. But I'm not using the ref keyword anywhere. I am, admittedly, a C# noob, so there may be some shallow bonehead error in here, but I can't see it.
I'm creating 10 ants or bees and animating them as they move across the screen. I have an array of animation structs, and each time I create an ant or bee, I send it the animation array value it requires (just [0] or [1] at this time). Deep inside the animation struct is a timer that is used to change frames. The ant/bee class stores the animation struct as a private variable.
What I'm seeing is that each ant or bee uses the same animation struct, the one I thought I was passing in and copying by value. So during Update(), when I advance the animation timer for each ant/bee, the next ant/bee has its animation timer advanced by that small amount. If there's 1 ant on screen, it animates properly. 2 ants, it runs twice as fast, and so on. Obviously, not what I want.
Here's an abridged version of the code. How is BerryPicking's ActorAnimationGroupData[] getting shared between the BerryCreatures?
class BerryPicking
{
private ActorAnimationGroupData[] animations;
private BerryCreature[] creatures;
private Dictionary<string, Texture2D> creatureTextures;
private const int maxCreatures = 5;
public BerryPickingExample()
{
this.creatures = new BerryCreature[maxCreatures];
this.creatureTextures = new Dictionary<string, Texture2D>();
}
public void LoadContent()
{
// Returns data from an XML file
Reader reader = new Reader();
animations = reader.LoadAnimations();
CreateCreatures();
}
// This is called from another function I'm not including because it's not relevant to the problem.
// In it, I remove any creature that passes outside the viewport by setting its creatures[] spot to null.
// Hence the if(creatures[i] == null) test is used to recreate "dead" creatures. Inelegant, I know.
private void CreateCreatures()
{
for (int i = 0; i < creatures.Length; i++)
{
if (creatures[i] == null)
{
// In reality, the name selection is randomized
creatures[i] = new BerryCreature("ant");
// Load content and texture (which I create elsewhere)
creatures[i].LoadContent(
FindAnimation(creatures[i].Name),
creatureTextures[creatures[i].Name]);
}
}
}
private ActorAnimationGroupData FindAnimation(string animationName)
{
int yourAnimation = -1;
for (int i = 0; i < animations.Length; i++)
{
if (animations[i].name == animationName)
{
yourAnimation = i;
break;
}
}
return animations[yourAnimation];
}
public void Update(GameTime gameTime)
{
for (int i = 0; i < creatures.Length; i++)
{
creatures[i].Update(gameTime);
}
}
}
class Reader
{
public ActorAnimationGroupData[] LoadAnimations()
{
ActorAnimationGroupData[] animationGroup;
XmlReader file = new XmlTextReader(filename);
// Do loading...
// Then later
file.Close();
return animationGroup;
}
}
class BerryCreature
{
private ActorAnimation animation;
private string name;
public BerryCreature(string name)
{
this.name = name;
}
public void LoadContent(ActorAnimationGroupData animationData, Texture2D sprite)
{
animation = new ActorAnimation(animationData);
animation.LoadContent(sprite);
}
public void Update(GameTime gameTime)
{
animation.Update(gameTime);
}
}
class ActorAnimation
{
private ActorAnimationGroupData animation;
public ActorAnimation(ActorAnimationGroupData animation)
{
this.animation = animation;
}
public void LoadContent(Texture2D sprite)
{
this.sprite = sprite;
}
public void Update(GameTime gameTime)
{
animation.Update(gameTime);
}
}
struct ActorAnimationGroupData
{
// There are lots of other members of this struct, but the timer is the only one I'm worried about.
// TimerData is another struct
private TimerData timer;
public ActorAnimationGroupData()
{
timer = new TimerData(2);
}
public void Update(GameTime gameTime)
{
timer.Update(gameTime);
}
}
struct TimerData
{
public float currentTime;
public float maxTime;
public TimerData(float maxTime)
{
this.currentTime = 0;
this.maxTime = maxTime;
}
public void Update(GameTime gameTime)
{
currentTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
if (currentTime >= maxTime)
{
currentTime = maxTime;
}
}
}
Recently we had an apache server which was responding very slowly due to SYN flooding. The workaround for this was to enable tcp_syncookies (net.ipv4.tcp_syncookies=1 in /etc/sysctl.conf).
I posted a question about this here if you want more background.
After enabling syncookies we started seeing the following message in /var/log/messages approximately every 60 seconds:
[84440.731929] possible SYN flooding on port 80. Sending cookies.
Vinko Vrsalovic informed me that this means the syn backlog is getting full, so I raised tcp_max_syn_backlog to 4096. At some point I also lowered tcp_synack_retries to 3 (down from the default of 5) by issuing sysctl -w net.ipv4.tcp_synack_retries=3. After doing this, the frequency seemed to drop, with the interval of the messages varying between roughly 60 and 180 seconds.
Next I issued sysctl -w net.ipv4.tcp_max_syn_backlog=65536, but am still getting the message in the log.
Throughout all this I've been watching the number of connections in SYN_RECV state (by running watch --interval=5 'netstat -tuna |grep "SYN_RECV"|wc -l'), and it never goes higher than about 240, much much lower than the size of the backlog. Yet I have a Red Hat server which hovers around 512 (limit on this server is the default of 1024).
Are there any other tcp settings which would limit the size of the backlog or am I barking up the wrong tree? Should the number of SYN_RECV connections in netstat -tuna correlate to the size of the backlog?
Update
As best I can tell I'm dealing with legitimate connections here, netstat -tuna|wc -l hovers around 5000. I've been researching this today and found this post from a last.fm employee, which has been rather useful.
I've also discovered that the tcp_max_syn_backlog has no effect when syncookies are enabled (as per this link)
So as a next step I set the following in sysctl.conf:
net.ipv4.tcp_syn_retries = 3
# default=5
net.ipv4.tcp_synack_retries = 3
# default=5
net.ipv4.tcp_max_syn_backlog = 65536
# default=1024
net.core.wmem_max = 8388608
# default=124928
net.core.rmem_max = 8388608
# default=131071
net.core.somaxconn = 512
# default = 128
net.core.optmem_max = 81920
# default = 20480
I then setup my response time test, ran sysctl -p and disabled syncookies by sysctl -w net.ipv4.tcp_syncookies=0.
After doing this the number of connections in the SYN_RECV state still remained around 220-250, but connections were starting to delay again. Once I noticed these delays I re-enabled syncookies and the delays stopped.
I believe what I was seeing was still an improvement from the initial state, however some requests were still delayed which is much worse than having syncookies enabled. So it looks like I'm stuck with them enabled until we can get some more servers online to cope with the load. Even then, I'm not sure I see a valid reason to disable them again as they're only sent (apparently) when the server's buffers get full.
But the syn backlog doesn't appear to be full with only ~250 connections in the SYN_RECV state! Is it possible that the SYN flooding message is a red herring and it's something other than the syn_backlog that's filling up?
If anyone has any other tuning options I haven't tried yet I'd be more than happy to try them out, but I'm starting to wonder if the syn_backlog setting isn't being applied properly for some reason.
Hi there
I'm exploring Dynamics CRM 4 and when I search a record
for example, a contact, ex. Abcd, Dynamics is searching by Abcd*,
including, by default, the WildCard in the end.
Is there any way to also include the Wild Card, by default, in the beggining?
Ex. Abcd -- Abcd
I'm looking for a java equivalent to this php call:
hash_hmac('sha1', "test", "secret")
I tried this, using java.crypto.Mac, but the two do not agree:
String mykey = "secret";
String test = "test";
try {
Mac mac = Mac.getInstance("HmacSHA1");
SecretKeySpec secret = new SecretKeySpec(mykey.getBytes(),"HmacSHA1");
mac.init(secret);
byte[] digest = mac.doFinal(test.getBytes());
String enc = new String(digest);
System.out.println(enc);
} catch (Exception e) {
System.out.println(e.getMessage());
}
The outputs with key = "secret" and test = "test" do not seem to match.
is it possible to solve conflicts on client side with sync services for ado.net?
for example, with Client Insert Server Insert, updating client's table id (on client side) , tks
I'm writing a Wordpress MU plugin, it includes a link with each post and I want to use ajax to call one of the plugin functions when the user clicks on this link, and then dynamically update the link-text with output from that function.
I'm stuck with the ajax query. I've got this complicated, clearly hack-ish, way to do it, but it is not quite working. What is the 'correct' or 'wordpress' way to include ajax functionality in a plugin?
(My current hack code is below. When I click the generate link I don't get the same output I get in the wp page as when I go directly to sample-ajax.php in my browser.)
I've got my code[1] set up as follows:
mu-plugins/sample.php:
<?php
/*
Plugin Name: Sample Plugin
*/
if (!class_exists("SamplePlugin")) {
class SamplePlugin {
function SamplePlugin() {}
function addHeaderCode() {
echo '<link type="text/css" rel="stylesheet" href="'.get_bloginfo('wpurl').
'/wp-content/mu-plugins/sample/sample.css" />\n';
wp_enqueue_script('sample-ajax', get_bloginfo('wpurl') .
'/wp-content/mu-plugins/sample/sample-ajax.js.php',
array('jquery'), '1.0');
}
// adds the link to post content.
function addLink($content = '') {
$content .= "<span class='foobar clicked'><a href='#'>click</a></span>";
return $content;
}
function doAjax() { //
echo "<a href='#'>AJAX!</a>";
}
}
}
if (class_exists("SamplePlugin")) {
$sample_plugin = new SamplePlugin();
}
if (isset($sample_plugin)) {
add_action('wp_head',array(&$sample_plugin,'addHeaderCode'),1);
add_filter('the_content', array(&$sample_plugin, 'addLink'));
}
mu-plugins/sample/sample-ajax.js.php:
<?php
if (!function_exists('add_action')) {
require_once("../../../wp-config.php");
}
?>
jQuery(document).ready(function(){
jQuery(".foobar").bind("click", function() {
var aref = this;
jQuery(this).toggleClass('clicked');
jQuery.ajax({
url: "http://mysite/wp-content/mu-plugins/sample/sample-ajax.php",
success: function(value) {
jQuery(aref).html(value);
}
});
});
});
mu-plugins/sample/sample-ajax.php:
<?php
if (!function_exists('add_action')) {
require_once("../../../wp-config.php");
}
if (isset($sample_plugin)) {
$sample_plugin->doAjax();
} else {
echo "unset";
}
?>
[1] Note: The following tutorial got me this far, but I'm stumped at this point.
http://www.devlounge.net/articles/using-ajax-with-your-wordpress-plugin
I need to display on my page a list of records pulled from a table. Ajax works fine (I query the database and put all the data inside a on the main page) but if I have lots of records (say 500+) it will hang until data is fully loaded, THEN it will be sent back to the page and correctly displayed.
I would like to be able to display the records on the page while getting them, instead of being forced to wait until completion. I am trying with flush(); inside the remote (ajax) page but it still waits until full data is loaded.
This is what I currently have inside the ajax page:
At the very beginning:
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
ob_implicit_flush(1);
Then whenever I have a echo call:
ob_flush();
Now if I load the ajax page alone... it will list the records while reading them from the database. But if I call the same page via Ajax, it will hang and send all the data at once.
Any idea?
This is the function I use to get the ajax content ('id' is the target , 'url' refers to the ajax page that runs the database query to list the records):
function ajax(id,url) {
xmlhttp=new XMLHttpRequest();
xmlhttp.open("GET",url,false);
xmlhttp.send(null);
document.getElementById(id).innerHTML = parseScript(xmlhttp.responseText);
}
Basically what I want to do is display an email using javascript to bring the parts together and form a complete email address that cannot be visible by email harvesters.
I would like to take an email address eg [email protected] and break it to:
$variable1 = "info";
$variable2 = "thiscompany.com";
All this done in PHP.
Regards,
JB
Sometime i will encounter this error after multiple access of my web application
I am using Sun Application Server Platform Edition 8.2
What is the reason for encountering this error and how to resolve it.
Hi,
I have been developing web applications for a while now. My applications have been fairing poorly in search engine results because of the dynamic links that my websites generate.
I admire the way some developers do their mod_rewrite to produce something like:
http://www.mycompany.com/accommodation/europe/ to run a substitute of "index.php?category_id=2&country=23"
How can I achieve that in my urls?
Warm regards,
JB