Published questions

4 answers

Sort HaspMap on Values: Java

-2 points

I'm trying to sort a HashMap by values. I know that it might not be "good style", but it would save a lot of work, as I wouldn't have to rewrite lots of code if I could just get the HashMap sorted by value.

After lots of searching and trial and error cases I'm still stuck.

The HashMap itself is still unsorted.

 import java.util.* ;
public class H
{
    static HashMap first = new HashMap();
    static
    {
        first.put("20030120" , new Integer (56));
        first.put("20030118" , new Integer (19));
        first.put("20030125" , new Integer (25));

Read more »
Created by Anonymous 6 weeks 5 days ago
  Tags:
2 answers

Java Could not reserve enough space for object heap?

16 points

'm have installed java sdk 1.5 on a linux CentOS server. If I run java, I get this error:

Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.

How do I solve it?

Read more »
Created by Anonymous 12 weeks 2 days ago
  Tags:
2 answers

How do I enable .htaccess on Apache Server?

12 points

I want to use .htaccess file on my server which is a VPS that is running Apache. How do I enable .htaccess to work?

Read more »
Created by Anonymous 12 weeks 2 days ago
  Tags:
1 answers

Keep-alive in .htaccess

15 points

Hi,
Just found this very handy tool. Great stuff!

Run a test here http://www.webpagetest.org/result/100504_NQ/.

Apart from some obvious ones, it states that none of the files have a Keep Alive header. Afaik they do, and Firebug confirms this (see attached image for global.css; others are similar).

Any thoughts/ideas Huh

Read more »
Created by Anonymous 12 weeks 2 days ago
  Tags:
2 answers

Can I delete asp.net cookies in an iframe with php?

14 points

I am able to log into the asp.net iframe, but when I log out I get an asp.net error logging back in until I delete all session cookies in the browser (Firefox) - then, I get redirected to the login screen the first attempt but on the 2nd attempt I can log in.

Is there a way to emulate the Firefox "delete all session cookies" with PHP? I have tried managing the individual session cookies with PHP and also session_unset() and session_destroy() but I think the problems are:

1. cookies are set by the domain in the iframe, not the domain of the PHP page

Read more »
Created by Anonymous 12 weeks 3 days ago
  Tags:
2 answers

Does MySQL work with ASP.NET web applications?

5 points

Does MySQL work with ASP.NET web applications?
Yes, MS SQL 2005 (etc) is native to ASP.NET, but there are other reasons (such as swapping the front end to PHP and running on Linux) why MySQL maybe be a better choice.

Thanks for your views.

Read more »
Created by Anonymous 12 weeks 3 days ago
  Tags:
3 answers

Java - Error occurred during initialization of VM

13 points

Hi,

I just installed JDK1.5 on a linux machine and added it bin directory
to the path variable.

However, whenever i execute java, it give me the following error

yantra:/usr/java/jdk1.5.0_06/lib# java
Error occurred during initialization of VM
java/lang/NoClassDefFoundError: java/lang/Object

am i missing something. like classpath.. i think rt.jar is included in
classpath by default

please give me any clue

thanks

on ali

Read more »
Created by Anonymous 12 weeks 3 days ago
  Tags:
1 answers

How to configure mod_deflate?

8 points

Hi All,

I see in httpd.conf that mod_deflate is already enabled on my apache. But, how do I enable it so that my html pages are compressed?

Davy

Read more »
Created by Anonymous 12 weeks 3 days ago
  Tags:
1 answers

Mod_gzip not compiling

-2 points

Hi

I am compiling mod_gzip. I made the required change in Makefile accompanying mod_gzip and I am getting following error:

cc1: error: unrecognized command line option "-Wall,-O3,-fomit-frame-pointer,-pipe"

Can anyone help?

Read more »
Created by Anonymous 12 weeks 3 days ago
  Tags:
4 answers

mod_gzip build failing

7 points

Hello,

I just tried to rebuild Apache so I could enable mod_gzip. The build went fine apart from adding mod_gzip. This is the error:

Fetching http://httpupdate.cpanel.net/buildapache/1/mod_gzip-1.3.26.1a.tar.gz (0)....@74.200.65.162......connected......receiving...2%...5%...8%...11%...14%...17%...20%...23%...26%...29%...32%...35%...38%...41%...44%...47%...50%...53%...56%...59%...62%...65%...68%...71%...74%...77%...80%...83%...86%...89%...92%...95%...98%...100%......Done
Untarring mod_gzip....Done
 
make [@mod_gzip-1.3.26.1a]...(-j 8).... Done

Read more »
Created by Anonymous 12 weeks 3 days ago
  Tags:
2 answers

Anonymous user not able to "Add to Cart" products on Drupal Ubercart

12 points

I installed Ubercart on my existing drupal system and I can not add add products to cart. I can "add to cart" products when logged in. What could be the reason?

Tim

Read more »
Created by Anonymous 12 weeks 5 days ago
  Tags:
1 answers

Java RegEx to replace 2 spaces with 1

0 points

Hi,

I am looking for a quick way in Java to change the string:

" this is it "

to
"this is it"

I want to replace all multiple spaces with a single space. I also want all the spaces at the end and begining of the string to go away as well.

Read more »
Created by Anonymous 13 weeks 4 days ago
  Tags:
1 answers

Parsing Youtube in preg_replace in PHP?

10 points

Hi,

I am attempting to parse the video ID of a youtube URL using preg_match. I found a regular expression on this site that appears to work;

(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+

My PHP code is as follows:

<?php
<?
 
$subject "http://www.youtube.com/watch?v=z_AbfPXTKms&NR=1";

 
preg_match("(?<=v=)[a-zA-Z0-9-]+(?=&)|(?<=[0-9]/)[^&\n]+|(?<=v=)[^&\n]+"$subject$matches);

 print 
"<pre>";
 
print_r($matches);
 print 
"</pre>";

?>

Read more »
Created by Anonymous 13 weeks 4 days ago
  Tags:
1 answers

Settings for Drupal cacherouter with memcache

14 points

Following is a configuration to be put in drupal's settings.php on using drupal cacherouter with memcache:

$conf['cache_inc'] = './sites/all/modules/cacherouter/cacherouter.inc';
$conf['cacherouter'] = array(
'default' => array(
'engine' => 'memcache',
'server' => array('192.168.0.100:11211', '192.168.0.100:11212'),
'shared' => TRUE,
),
);

Read more »
Created by Anonymous 14 weeks 3 days ago
  Tags:
1 answers

How to display number of processors on a linux machine?

-3 points

Hi,
I am on a CentOS and I want to know number of processors my linux machine has. How do I do that?

Read more »
Created by Anonymous 15 weeks 3 days ago
  Tags:
0 answers

How to comment some part of the statement in Perl?

32 points

I comment out only part of a line in Perl. This means I have a statement like this:
if($somthing==0){#ok ok}

I would like to comment the last closing bracket without moving to next line. Is is possible?

Read more »
Created by Anonymous 16 weeks 1 day ago
  Tags:
1 answers

Top 10 Drupal themes

7 points

Hi All,

Do you know of some top notch drupal themes? Topnotch themes are expensive...i need free ones

Thanks
Priyanka

Read more »
Created by Anonymous 16 weeks 3 days ago
  Tags:
3 answers

How to control background processes from inside Drupal?

4 points

Is there any way to start/stop background processes from inside Drupal?
I'm currently writing a module that has to continuously monitor a socket connection for events coming from a remote server.I thought about using hook_cron(), but I'm afraid that the infinite (or continuous) loop of my event handler would tie out other modules that use hook_cron().Another alternative would be to use batch api, but do batch processes run in the background?

Thanks in advance,
Leo

Read more »
Created by Anonymous 16 weeks 3 days ago
  Tags:
1 answers

How to add CVS files recursively?

-7 points

I am using CVS to access and commit my files. How do I add my files recursively from the linux command shell into CVS?

Please help

Read more »
Created by Anonymous 16 weeks 4 days ago
  Tags:
0 answers

How to store extra information in Drupal $node?

6 points

Hi All,

In my drupal theming, I am stuck. I am using Drupal 6.

I have some extra data that I want to put in $node, so that I can show this data when theming the template file (node-contentype.tpl.php). I don't want to query mysql database in my template file?

Please help.

Read more »
Created by Anonymous 16 weeks 4 days ago
  Tags: