Sunday, 16 December 2007
|
| HashMap vs. TreeMap Avinash Lakshman 20:07:28 |
| | Hi All
I need to store about a million key/value pairs. Which is more memory efficient HashMap or TreeMap? With the HashMap it looks like the resizing happens to be exponential but that is not the case with TreeMap i.e sometimes I may have 64,000 keys but the internal table allocated with the HashMap is at nearly double the value. I do not care about access times i.e I need a sparse HashMap. How can I acheive this? Can I think of the TreeMap as a poor man's sparse HashMap? Are there any other implementations I could look at? Please advice.
Thanks Avinash
_________________________________________________________________ Get the power of Windows + Web with the new Windows Live. http://www.windowslive.com?ocid=TXT_TAGHM_Wave2_powerofwindows_122007 =================================== This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 4 answer | Add comment |
Friday, 14 December 2007
|
| Question about memory size and performance Carfield Yim 21:40:57 |
| | According to this paper - http://www.cs.umass.edu/~emery/pubs/gcvsmalloc.pdf , it claim that :
"If their applications will be deployed on systems with at least three times as much RAM as needed, then garbage collection should provide reasonable performance. However, if the deployed systems will have less RAM, or if their applications will have to compete with other processes for memory, then practitioners should expect garbage collection to exact a substantial performance cost."
Just wonder if anybody have comment about this claim? Say my applicatioon typical requirement 1024m heap size to run. My computer need to have 3072m to have reasonable performance???
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 14 answers | Add comment |
Wednesday, 12 December 2007
|
| Writing Japanese in PDF file Sumeet Palkar 13:07:27 |
| | Stuck with a wierd problem..... Actually all Japanese problems are wierd as u know... I am able to display the Japanese charatcers in the PDF file when using Japanese Regional Settings on Windows OS. But this Japanese text appears only when the Text is selected on the PDF file.
When Changed to English Regional Settings, the Japanese text is not written correctly in the PDF file.
I am using iText along with itextAsian.jar. JDK version is 1.4.2
Does anyone have a clue how to write into the PDF using Japanese in English Locale? Regards Sumeet Palkar
|
| | 2 answer | Add comment |
Sunday, 9 December 2007
|
| Function call overhead Avinash Lakshman 01:57:19 |
| | I am seeing this wierd problem. When I do the following I see the time taken is around 170 ms.
public static void main(String[] args) throws Throwable { Random random = new Random(); byte[] bytes = new byte[64*1024*1024]; random.nextBytes(bytes); int pos = 0; int count = bytes.length; long start2 = System.currentTimeMillis(); while ( true ) { int value = (pos < count) ? (bytes[pos] & 0xff) : -1; ++pos; if ( value == -1 ) break; } System.out.println("TIME TAKEN : " + (System.currentTimeMillis() - start2)); }
Now I do the following I see the time taken is 516 ms:
class MyClass { private byte[] buf = new byte[0]; private int pos; private int count;
public final int read() { if (pos < count) { return ( buf[pos++] & 0xFF ); } else return -1; } }
public void main(String[] args) { MyClass myClass = new MyClass(bytes); int read = 0; long start = System.currentTimeMillis(); while ( true ) { read = myClass.read(); if ( read == -1 ) break; } System.out.println("TIME TAKEN : " + (System.currentTimeMillis() - start)); }
What is going on?
Thanks A
_________________________________________________________________ Your smile counts. The more smiles you share, the more we donate. Join in. www.windowslive.com/smile?ocid=TXT_TAGLM_Wave2_oprsmilewlhmtagline =================================== This list is hosted by DevelopMentor® http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 4 answer | Add comment |
Saturday, 8 December 2007
|
| Include Files Jeff Wilhelm 18:40:27 |
| | I made the mistake of using the extension .inc as opposed to .php for my include files, which means that the they can be viewed as text. If I'd named them PHP they would never be sent without being executed, which means that nobody would be able to see my code and passwords and all that. So, I simply want to add .inc to the list of extensions that PHP will execute... how would I go about doing this... I'm guessing I'd add a line to my httpd.conf file or something... but what is the correct syntax?
-Jeff
|
| | 21 answer | Add comment |
Friday, 7 December 2007
|
| PHP cross referencer DL Neil 11:51:26 |
| | Is anyone aware if such a debugging/documentation tool exists?
What is/do I mean by a "cross referencer"? A tool which will list all of the variables (and function names ?and include files) used within a program/script, together with the line number(s) where they are mentioned - hopefully differentiating where the value is referenced from where it is updated, etc. Such is handy for debugging, picking up upper/lower case naming inconsistencies, etc.
Please advise, =dn
|
| | Add comment |
Wednesday, 5 December 2007
|
| Class<T> question Mitchell Gart 20:56:07 |
| | I am trying to get rid of some compiler warnings in our code. We have a method:
public static Logger getLogger(Class c) { return new Log4jLogger(c.getName()); }
and the compiler produces this warning:
Class is a raw type. References to generic type Class<T> should be parameterized
It is because Class is a generic type but I don't quite understand how I would change the declaration of the method, and the calls to the method, to make it parameterized and get rid of the warning. Can somebody explain this a little bit? Thanks.
- Mitch Gart
=================================== This list is hosted by DevelopMentor http://www.develop.com
View archives and manage your subscription(s) at http://discuss.develop.com
|
| | 10 answers | Add comment |
|
| checkdnsrr problems... Papagelis Athanasios 14:22:37 |
| | Hi to all,
I'm using the checkdnsrr function to check for dns entries of specific hosts. But no matter how hard I try I cannot get it work. Should I have a local DNS server on my machine in order for this function to operate???
I'm using windows 2000 with IIS/5
S.
|
| | 1 answer | Add comment |
Tuesday, 4 December 2007
|
| Dreamtime at phptemplates.org Frank Joerdens 20:35:26 |
| | Does anyone know what's become of Tim Zickus' Dreamtime project at http://www.phptemplates.org? According to his white papers, it looks like something that would fit a site that I'll be building soon like a glove. I February he announced a closed alpha relly soon, to be followed by a public beta. The last update on his site is from May. Has this great idea lost its momentum and disappeared altogether?
/Frank
-- frank joerdens
joerdens new media urbanstr. 116 10967 berlin germany
e: frank@joerdens.de m: +49 (0)179 5174091 f: +49 (0)30 7864046 h: http://www.joerdens.de
pgp public key: http://www.joerdens.de/pgp/frank_joerdens.asc
|
| | Add comment |
Wednesday, 28 November 2007
|
| Re: xdoclet-user digest, Vol 1 #2089 - 4 msgs Shantanu Sen 12:36:24 |
| | I am trying to test a session bean to be deployed on WebSphere 6.0 AS. I tried using the WebSphereDoclet tag and it generated two websphere specific deployment artifacts:ibm-ejb-jar-bnd.xmi and ibm-ejb-jar-ext.xmi.
The ejbJar elemenet in the *ext.xmi file is as follows: <ejbJar href="META-INF/ejb-jar.xml#ejb-jar_1"/>
When I tried deploying this, the WAS6.0 deployer emitted a warning in the log file:
4/8/05 12:33:04:328 PDT] 00000029 ArchiveDeploy W ADMA0091E: The resource META-INF/ibm-ejb-jar-ext.xmi that is defined in URI META-INF/ibm-ejb-jar-ext.xmi for module testejb.jar is not valid. The resource has a cross reference META-INF/ejb-jar.xml#ejb-jar_1 that cannot be resolved.
Any idea what may be the issue here?
Thanks, Shantanu Sen
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
|
| | 1 answer | Add comment |
Tuesday, 27 November 2007
|
| PHP & MySQL problems, updating database.. Hawk 15:44:32 |
| | Having a problem with this, I have a working login that supports multiple users, and I'm trying to make it possible for the users to change their own settings etc, but I get killed when trying to send the data to the MySQL database. To connect I use mysql_connect($host,$user,$pswd) and mysql_select_db($db)
the retrieving data from the form works since I belive, since it showed up when I added a print "$the vars " but I don't know how to save it to the database..
I might be missing some line or maybe it's just because I'm a newbie or something.. ;D anyway.. I use something similiar to this $query = "UPDATE users SET email='$email'"; // and so on.. $result = mysql_query($query) or die ("blabla");
I don't get any error lines or anything, the only thing that shows is the "blabla" thing.
I also tried INSERT INTO in the query but that didn't make any difference
if anyone could tell me what I'm doing wrong I would be happy.. "the best way to learn is to ask people that know"
Hawk
|
| | 4 answer | Add comment |
|
| PdfPTable' row height Guest 12:27:17 |
| | I am trying to get PdfPTable's row height, so I used getRowHeight(index) method. But if the cell has a big chunk of content like 800 characters, it returns huge number and it should not. Let's say the content is displayed in 12 lines so height should be about 100 but it returns 319. How can I use the method correctly?
------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf
|
| | 5 answers | Add comment |
|
| [JBoss Portal] - Re: JBoss Forums - Categories and Forums by Role? Unibrew 09:42:22 |
| | Hello Vince
http://wiki.jboss.org/wiki/Wiki.jsp?page=ForumsPortletInPortal22DevelopementStatus It is not possible to limit specific categories and/or forums by role yet. There are however plans to add this feature .
Cheers ---------------------------- Ryszard Kozmik JBoss Forums Lead
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3929082#3929082
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3929082
------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
|
| | 2 answer | Add comment |
Monday, 26 November 2007
|
| [JBoss jBPM] - JBPM Designer giving
NullPointerException Javajosh 06:26:54 |
| | Hello,
I am attempting to evaluate jBPM 3.1 and running into an issue installing the Designer into Eclipse.
The first problem was that the starter kit installation instructions assume that I will be installing Elclipse for the first time. This assumption was false in my case (and I suspect in most cases). To work around this, I read:
jbpm-starters-kit-3.1.1/jbpm-designer/jbpm-gpd-feature/readme.html
and copied the 'features' and 'plugins' directories into my eclipse installation. Upon starting Eclipse, I was able to create a new Process Project, as expected. However when I right-click on a process definition and select "Open With->jBPM Graphical Process Designer" I recieve an "Unsupported Content Type" dialog, and a message "Unable to create this part due to an internal error. Reason for the failure: An unexpected error was thrown." The editor allows me to see the NullPointerException. Here is the file I tried this on:
${myproject}/processes/simple/processdefinition.xml
Obviously my workaround is not sufficient. Can someone please provide instructions on installing Designer into an already-installed Eclipse?
Thank you.
Stack trace and Eclipse configuration follows.
Here is the full stack trace:
java.lang.NullPointerException at org.jbpm.ui.editor.DesignerContentProvider.addProcessDiagramDimension(Unknown Source) at org.jbpm.ui.editor.DesignerContentProvider.addGraphicalInfo(Unknown Source) at org.jbpm.ui.editor.DesignerContentProvider.addGraphicalInfo(Unknown Source) at org.jbpm.ui.editor.DesignerContentProvider.addGraphicalInfo(Unknown Source) at org.jbpm.ui.editor.DesignerGraphicalEditorPage.initInput(Unknown Source) at org.jbpm.ui.editor.DesignerGraphicalEditorPage.init(Unknown Source) at org.eclipse.ui.part.MultiPageEditorPart.addPage(MultiPageEditorPart.java:152) at org.jbpm.ui.editor.DesignerEditor.addGraphPage(Unknown Source) at org.jbpm.ui.editor.DesignerEditor.createPages(Unknown Source) at org.eclipse.ui.part.MultiPageEditorPart.createPartControl(MultiPageEditorPart.java:241) at org.eclipse.ui.internal.EditorReference.createPartHelper(EditorReference.java:609) at org.eclipse.ui.internal.EditorReference.createPart(EditorReference.java:384) at org.eclipse.ui.internal.WorkbenchPartReference.getPart(WorkbenchPartReference.java:552) at org.eclipse.ui.internal.PartPane.setVisible(PartPane.java:283) at org.eclipse.ui.internal.presentations.PresentablePart.setVisible(PresentablePart.java:126) at org.eclipse.ui.internal.presentations.util.PresentablePartFolder.select(PresentablePartFolder.java:269) at org.eclipse.ui.internal.presentations.util.LeftToRightTabOrder.select(LeftToRightTabOrder.java:65) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation.selectPart(TabbedStackPresentation.java:391) at org.eclipse.ui.internal.PartStack.refreshPresentationSelection(PartStack.java:1102) at org.eclipse.ui.internal.PartStack.setSelection(PartStack.java:1051) at org.eclipse.ui.internal.PartStack.showPart(PartStack.java:1256) at org.eclipse.ui.internal.PartStack.add(PartStack.java:442) at org.eclipse.ui.internal.EditorStack.add(EditorStack.java:109) at org.eclipse.ui.internal.EditorSashContainer.addEditor(EditorSashContainer.java:60) at org.eclipse.ui.internal.EditorAreaHelper.addToLayout(EditorAreaHelper.java:212) at org.eclipse.ui.internal.EditorAreaHelper.addEditor(EditorAreaHelper.java:202) at org.eclipse.ui.internal.EditorManager.createEditorTab(EditorManager.java:758) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor(EditorManager.java:665) at org.eclipse.ui.internal.EditorManager.openEditor(EditorManager.java:628) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditorBatched(WorkbenchPage.java:2360) at org.eclipse.ui.internal.WorkbenchPage.busyOpenEditor(WorkbenchPage.java:2295) at org.eclipse.ui.internal.WorkbenchPage.access$9(WorkbenchPage.java:2287) at org.eclipse.ui.internal.WorkbenchPage$9.run(WorkbenchPage.java:2273) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:69) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:2268) at org.eclipse.ui.actions.OpenWithMenu.openEditor(OpenWithMenu.java:279) at org.eclipse.ui.actions.OpenWithMenu.access$0(OpenWithMenu.java:271) at org.eclipse.ui.actions.OpenWithMenu$2.handleEvent(OpenWithMenu.java:178) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:843) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3125) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2758) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1699) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1663) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:367) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:226) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:376) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:163) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:334) at org.eclipse.core.launcher.Main.basicRun(Main.java:278) at org.eclipse.core.launcher.Main.run(Main.java:973) at org.eclipse.core.launcher.Main.main(Main.java:948)
Here is my Eclipse configuration:
*** Date: Thu Jun 01 21:09:13 PDT 2006
*** Platform Details:
*** System properties: awt.toolkit=sun.awt.windows.WToolkit eclipse.application=org.eclipse.ui.ide.workbench eclipse.buildId=M20060118-1600 eclipse.commands=-os win32 -ws win32 -arch x86 -launcher C:\bin\eclipse\eclipse.exe -name Eclipse -showsplash 600 -exitdata 930_68 -vm C:\WINDOWS\system32\javaw.exe eclipse.product=org.eclipse.sdk.ide eclipse.startTime=1149217878125 eclipse.vm=C:\WINDOWS\system32\javaw.exe eclipse.vmargs=-Xms40m -Xmx256m -jar C:\bin\eclipse\startup.jar eof=eof file.encoding=Cp1252 file.encoding.pkg=sun.io file.separator=\ java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment java.awt.printerjob=sun.awt.windows.WPrinterJob java.class.path=C:\bin\eclipse\startup.jar java.class.version=49.0 java.endorsed.dirs=C:\Program Files\Java\jre1.5.0_06\lib\endorsed java.ext.dirs=C:\Program Files\Java\jre1.5.0_06\lib\ext java.home=C:\Program Files\Java\jre1.5.0_06 java.io.tmpdir=C:\DOCUME~1\Josh\LOCALS~1\Temp\ java.library.path=C:\WINDOWS\system32;.;C:\WINDOWS\system32;C:\WINDOWS;C:\Program Files\ThinkPad\Utilities;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\Wireless\Bin\;C:\Program Files\ATI Technologies\ATI Control Panel;C:\WINDOWS\Downloaded Program Files;C:\IBMTOOLS\Python22;C:\Program Files\PC-Doctor for Windows\services;C:\Program Files\QuickTime\QTSystem\;C:\bin\Sun\AppServer\bin;C:\Program Files\CVSNT\ java.runtime.name=Java(TM) 2 Runtime Environment, Standard Edition java.runtime.version=1.5.0_06-b05 java.specification.name=Java Platform API Specification java.specification.vendor=Sun Microsystems Inc. java.specification.version=1.5 java.vendor=Sun Microsystems Inc. java.vendor.url=http://java.sun.com/ java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport.cgi java.version=1.5.0_06 java.vm.info=mixed mode, sharing java.vm.name=Java HotSpot(TM) Client VM java.vm.specification.name=Java Virtual Machine Specification java.vm.specification.vendor=Sun Microsystems Inc. java.vm.specification.version=1.0 java.vm.vendor=Sun Microsystems Inc. java.vm.version=1.5.0_06-b05 line.separator=
org.osgi.framework.bootdelegation=* org.osgi.framework.executionenvironment=J2SE-1.5 org.osgi.framework.language=en org.osgi.framework.os.name=WindowsXP org.osgi.framework.os.version=5.1 org.osgi.framework.processor=x86 org.osgi.framework.system.packages=javax.accessibility,java | |