Zulfi Khan

Ranch Hand
+ Follow
since Jun 05, 2016
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
1
Total given
57
Given in last 30 days
5
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Zulfi Khan

Hi,
I have a variable  opr_CntList. It contains two things: opcode strings and their integer count. For 'and" I used '-'. Please tell me what is the good replacement for '_'.

Zulfi.
3 days ago
Hi Mr. Ritchie- Thanks for your guidance.

opr_CntList means operation code and their Count List. I used '_' for 'and' please guide me how to create a variable name for 'operation code and their count List.

Right now I would use the same names otherwise it would be difficult to compare with my original code:

Hi Mr. Carey Brown:

God blesses you. Your solution worked.

Zulfi.


4 days ago
Hi,
Following is my code:



I am getting following exception:

Exception in thread "main" java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
at java.base/java.util.Objects.checkIndex(Objects.java:372)
at java.base/java.util.ArrayList.set(ArrayList.java:473)
at com.mycompany.fileread_opcode.Main.main(Main.java:114)
Command execution failed.
org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1)
   at org.apache.commons.exec.DefaultExecutor.executeInternal (DefaultExecutor.java:404)
   at org.apache.commons.exec.DefaultExecutor.execute (DefaultExecutor.java:166)
   at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:982)
   at org.codehaus.mojo.exec.ExecMojo.executeCommandLine (ExecMojo.java:929)
   at org.codehaus.mojo.exec.ExecMojo.execute (ExecMojo.java:457)
   at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
   at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
   at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
   at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
   at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
   at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
   at org.apache.maven.cli.MavenCli.execute (MavenCli.java:957)
   at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:289)
   at org.apache.maven.cli.MavenCli.main (MavenCli.java:193)
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
   at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
   at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
   at java.lang.reflect.Method.invoke (Method.java:566)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
   at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
   at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
   at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
------------------------------------------------------------------------
BUILD FAILURE


I want to store both integer and string objects in my arraylist of objects:

Somebody please guide me.

Zulfi.
5 days ago
Hi,
I am trying to count the frequency of each string stored in the array List. My arraylist contains the following strings:

PUSH ADD ADD ADD AND AND AND AND AND CALL CALLDATACOPY CALLDATALOAD
CALLDATALOAD CALLDATALOAD CALLDATASIZE CALLDATASIZE CALLER
CALLVALUE  DIV  DIV DIV


I found the frequency function at:
frequency function:

public static int frequency(Collection<?> c, Object o)

but I can’t understand how to use it. I have written the following code:



Somebody please guide me.

Zulfi.
1 week ago
Hi Cambell Ritchie,
<
But why are you storing opcodes as plain Strings? Why not create an Opcode class with private constructors and nested classes that extend Opcode, and create instances via a factory method?
[edit][addition]Alternative to using nested classes: Put Opcode in its own package and give the subclasses package‑private access.
>
Good idea. This is possible.

But there are two problems, first is that it would take time, secondly I may deviate from my objective. I want to run my program on several files to get the opcodes and then do further processing.

I would give some time to both of your ideas.

Zulfi.
2 weeks ago
Hi,
Thanks for your response.

Sorry, I did not provide an example.

I put the declared array in comments:

String[] OpcodeArr = new String[];//Err[/b]

but you are saying that I have to provide the size. I dont know the size. I thought I have to invoke the constructor for each element of the array. Example of my combined  alphabetical and hexadecimal strings is:

"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4 CALLDATASIZE LT PUSH2 0x36 JUMPI PUSH1 0x0 CALLDATALOAD PUSH1 0xE0 SHR DUP1 PUSH


My complete program:


The output of the program is:

"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP and so on.....
Opcode opr list
"opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0 DUP1 REVERT JUMPDEST POP PUSH1 0x4  and so on
"opcodes": "PUSH1 PUSH1 MSTORE CALLVALUE DUP1 ISZERO PUSH2 JUMPI PUSH1 DUP1 REVERT JUMPDEST POP PUSH1 CALLDATASIZE LT PUSH2 JUMPI PUSH1 and so on


2 weeks ago
Hi,
I have a string that consists of both hex and alphabetical words. I can separate them, but I am having a problem in storing back the alphabetical words in an string array:

For example, below is my string, currently stored in opcodeOprList, which is of type string, read from a file, and the data is shown below:
opcodeOprList = "opcodes": "PUSH1 0x80 PUSH1 0x40 MSTORE CALLVALUE DUP1 ISZERO PUSH2 0x10 JUMPI PUSH1 0x0

Now I want to store the alphabetical words in the array of string:


I am getting problem in dealing with OpcodeArr[], I have commented the error part. Somebody please guide me. The array is that the string array i.e. OpcodeArr is not initialized.

Zulfi.
2 weeks ago
Hi,
Your solution worked. The complete program is:



Thanks.

Zulfi.
3 weeks ago
Hi,

Thanks Mark,

Following is my program related to filing



I am running the above program on Ubuntu 18.04 using Netbeans 12.2. My project name is: "fileWrite". It is a Mavern, Java Application project. It is not writing anything in the file abc.txt:


zulfi@lc2530hz:~$ cat abc.txt
zulfi@lc2530hz:~$ pwd
/home/zulfi
zulfi@lc2530hz:~$



I have also attached the project image.

Zulfi.

4 weeks ago
Hi,
Thank God that my netbeans problem has been solved. Mailing list turned out to be useful:  users@netbeans.apache.org

First they asked me to run the remove command:
sudo apt remove netbeans

I ran it using again using some switch, the previous command showed me and then I typed "netbeans" just for the sake of curiosity and and version 12.2 started downloading. Then I used the following link for executing the program:

https://netbeans.apache.org/kb/docs/java/quickstart.html

God blesses you.

Zulfi.
4 weeks ago
hi Campbell Ritchie-I installed the netbeans 10.0 long time ago but I installed Netbeans 11.0 only two days ago using the snap package:
sudo snap install netbeans --classic

But it won't work until I delete the version 10.0.

I tried to delete version 10.0 but it also requires lot of head scratching so I can't succeed. However, I have found a mailing list for Netbeans but right now I just find that the people are sending questions to Netbeans but no answers. Anyway I would send my question there. If you have any solution please reply.

God blesses you.

Zulfi.
1 month ago
Hi Tim Holloway,
I am still getting the same problem. I did the following:
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk
zulfi@lc2530hz:~$ echo $JAVA_HOME
/usr/lib/jvm/java-11-openjdk


But still I can't run.

I found the following link:
https://askubuntu.com/questions/1196172/netbeans-doesnt-work-in-18-04

It says to install Netbeans 11 classics, I installed it but it is executing Netbeans 10. I have to delete Netbeans 10 from my Ubuntu 18.04 machine.

Somebody please guide me.

Zulfi.
1 month ago
Hi,

Campbell Ritchie: As you said, I did the following:


openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment (build 11.0.10+9-Ubuntu-0ubuntu1.18.04)
OpenJDK 64-Bit Server VM (build 11.0.10+9-Ubuntu-0ubuntu1.18.04, mixed mode, sharing)

javac 11.0.10

Now I found the location where java is stored: i.e. /usr/lib/jvm
It contains:

default-java               java-11-openjdk-amd64     java-8-openjdk-amd64
java-1.11.0-openjdk-amd64  java-1.8.0-openjdk-amd64  openjdk-11

Now the NetBeans product version says:
Java: 11.0.10; OpenJDK 64-Bit Server VM 11.0.10+9-Ubuntu-0ubuntu1.18.04
I checked openjdk-11 folder:

src.zip
zulfi@lc2530hz:/usr/lib/jvm/openjdk-11$

Then I checked /usr/lib/jvm/java-11-openjdk-amd64 folder:

bin  conf  docs  include  jmods  legal  lib  man  release

So I decided to use /usr/lib/jvm/java-11-openjdk-amd64 as the path for JAVA_HOME

/usr/bin/java




But still I am getting the same error.





Tim Holloway: Thanks. This is not a built in project. I am running Netbeans for the first time on ubuntu 18.04 so I am getting java.lang problem. Netbeans is not able to recognize the "String" class.

Zulfi.
1 month ago
Hi,
I got following as a result of echo:

$ echo $PATH
/home/zulfi/.nvm/versions/node/v10.23.3/bin:/usr/local/cuda-10.1/bin:/home/zulfi/.local/bin:/opt/QtSDK/Desktop/Qt/473/gcc/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/zulfi/Downloads/omnetpp-5.5.1/bin


Sorry I can't find anything related to java, but when I did:
$ whereis java
java: /usr/bin/java /usr/share/java /usr/share/man/man1/java.1.gz


:/usr/bin$ ls j*
jaotc      javac    jcat      jdeprscan  jhat       jimage  jls   jpeg_extract  jrunscript  json_pp  junit
jar        javadoc  jcmd      jdeps      jhindexer  jinfo   jmap  jpegtopnm     js          jstack
jarsigner  javah    jconsole  jexec      jhsdb      jjs     jmod  jpgicc        jsadebugd   jstat
java       javap    jdb       jfr        jhsearch   jlink   join  jps           jshell      jstatd

Somebody please guide me how to solve the classpath problem in NetBeans?

Zulfi.
1 month ago
Hi,
I have written a simple program on NetBeans in Ununtu 18.04:



The version details of Netbeans are:

Product Version: Apache NetBeans IDE 10.0 (Build 20190203-debian-10.0)
Java: 11.0.10; OpenJDK 64-Bit Server VM 11.0.10+9-Ubuntu-0ubuntu1.18.04
Runtime: OpenJDK Runtime Environment 11.0.10+9-Ubuntu-0ubuntu1.18.04
System: Linux version 4.15.0-135-generic running on amd64; UTF-8; en_US (nb)
User directory: /home/zulfi/.netbeans/10.0
Cache directory: /home/zulfi/.cache/netbeans/10.0



I am getting classpath problem,

"Cant access java.lang
Unable to find package java.lang in classath

I dont know how to set classpath on Ubuntu:



I have attached the image:


Somebody please guide me.

Zulfi.



1 month ago