Java.lang.ArithmeticException Error
Hi !
I also have the same matter, It's good , either in linux or in windows, with SUN JDK.
But in RedHat GNUClASS+jamvm, it's wrong as follow.what should I to do ?
Thank you !
genKeyPair failed: java.lang.ArithmeticException: negative exponent
java.lang.ArithmeticException: negative exponent
at java.math.BigInteger.pow(BigInteger.java:1001)
at gnu.java.security.key.dss.FIPS186.generateParameters(FIPS186.java:200)
at gnu.java.security.key.dss.DSSKeyPairGenerator.generate(DSSKeyPairGenerator.java:305)
at gnu.java.security.jce.sig.KeyPairGeneratorAdapter.generateKeyPair(KeyPairGeneratorAdapter.java:93)
at java.security.KeyPairGenerator.genKeyPair(KeyPairGenerator.java:289)
at cn.com.webinfo.security.RSA.generateKey(RSA.java:100)
at cn.com.webinfo.stest.MainRSA.main(MainRSA.java:23)
java.lang.NullPointerException
at cn.com.webinfo.security.RSA.generateKey(RSA.java:102)
at cn.com.webinfo.stest.MainRSA.main(MainRSA.java:23)
Generating private key is failure!
MainRSA.java:23 RSA.generateKey("001","prikeyRSA.dat", "pubkeyRSA.dat");
public static boolean generateKey(String id, String priFileName, String pubFileName) {
try {
KeyPairGenerator keygen = KeyPairGenerator.getInstance("RSA");
SecureRandom secrand = new SecureRandom();
secrand.setSeed(id.getBytes());
keygen.initialize(1024, secrand);
RSA.java:100 KeyPair keys = keygen.genKeyPair();
RSA.java:102 PrivateKey prikey = keys.getPrivate();
PublicKey pubkey = keys.getPublic();
.........
Java.lang.ArithmeticException Error
Hi everybody, i'm facing a strange error when i try to generate Key-Pair to be used for encryption purposes. I try to run the following code on Ubuntu:
KeyPairGenerator myPriPubKeys;
myPriPubKeys = KeyPairGenerator.getInstance("RSA");
SecureRandom myRandom = SecureRandom.getInstance("SHA1PRNG");
myPriPubKeys.initialize(1024, myRandom);
myKeyPair = myPriPubKeys.genKeyPair();
The error showing is:
genKeyPair failed: java.lang.ArithmeticException: negative exponent
java.lang.ArithmeticException: negative exponent
at java.math.BigInteger.pow(libgcj.so.81)
at gnu.java.security.key.dss.FIPS186.generateParameters(libgcj.so.81)
at gnu.java.security.key.dss.DSSKeyPairGenerator.generate(libgcj.so.81)
at gnu.java.security.jce.sig.KeyPairGeneratorAdapter.generateKeyPair(libgcj.so.81)
at java.security.KeyPairGenerator.genKeyPair(libgcj.so.81)
Can any one support.
BTW, i tried to run this code with window XP and it was working perfectly.
Thanks and waiting your replies.
Cu,
Ahmed Banihammad
Audio/Video Granulizer
the sequencer's cool but it's a pain to label since it's so squished. the bottom left numbers just show what steps you're viewing, since you can only view 16 steps at a time, and you select which 16 steps you're viewing with the thin, long hradio in the middle. click around that and you'll see which sets of steps you're editing (1-16, 17-32, 33-48, etc.) up to 256 steps total. in the middle bottom, that number is where you set how many steps you want - it defaults to 16. the bottom right is the tempo, and the box next to that is just a counter to show what step you're on when playing. the small size 4 hradio to the right isn't currently used, but that's there so you can switch between 3 other sequences in the same sequencer.
i really didn't clean that patch up enough - i just realized two of the inlets set the total number of steps... the leftmost inlet sets the bpms and the rightmost is a toggle for start/stop. also sometimes when you save a sequence that's last value is a nonzero, if you extend the sequence after that it'll fill the new steps in with that value instead of zeros.
ultimately it's pretty multipurpose, what i usually do is run the outlet into a [select 0] just to throw out the 0's (since maybe you want to sequence negative values sometimes). the explanation in the patch just tells how it works with that specific sampler - to sequence it it takes 0-7 to trigger the 8 different lookup points, and it wraps so you can send 8 as 0, 9 as 1, etc (i like to do it like that so i can still throw out the zero's and not have to scale the input over a value in the sampler).
i forget who it was but someone in #dataflow inspired this sequencer - i had started with a small 16 step sequecner, then just made it bigger until it was a huge 128 number box GUI lagfest... discussing ways around it someone suggested that you use a sort of switching system so you can only VIEW 16 steps at a time, but can shuffle around a larger sequence. ultimately it took a while to figure out how to set up but it was super rewarding, the thing is super handy and has save/load! buyakasha!
Problem compiling external on Windows
Great tutorial, very detailed!
Thanks for this addition..
Sorry for coming later on this subject but I'll try to add few lines about
compiling externals in Win without going through MSVC Express
edition (by the way: what are the limitations of the express edition
w.r.t. the full package?).
Even if MSVC offers an integrated environment for developing there
can be some good reasons for giving a try to the old-man "unix" way of
compiling, which in windows is best represented by MINGW32 and
cygwin. Both offers linux-like environments (i.e. command line tools)
for compiling and other shell tasks which, sometimes, in windows are
a pain in the ass.
There are at least three good reasons for giving a look at mingw:
- gives strong linux compatibility on external compilation
(almost same command lines arguments etc.) - there is the possibility to use makefiles in an almost straightforward way
(with minor modifications to linux makefiles). - no dependency on expensive MS programs (except for the
small, bug-free Operating System
I did this exercise by porting the E. Lyon "LyonPoutpourry" externals for win
(http://www.sarc.qub.ac.uk/~elyon/LyonSoftware/Pd/). Give a look at
the win source package: inside there is a makefile for darwin (MAC)
linux and win. I added the latter, and as you can see the modifications
are minor.
----------- 1. Prelude: compilation environment ------------------
First of all we have to set once for all the compilation environment.
Let's forget for the moment cygwin and concentrate on mingw32 (http://www.mingw.org/). The following is taken from (H.C. Steiner's wiki http://www.puredata.org/docs/developer/mingw)
Download the MinGW package installer and run it:
(http://prdownloads.sourceforge.net/mingw/MinGW-5.1.1.exe)
Choose the Candidate distribution. Install the defaults and add the g++ compiler, g77 compiler, and MinGW make or you can just download my MinGW install, MinGW-Pd.tar.bz2, and uncompress it so that its installed into C:\MinGW.
Then we need MSYS which is a shell (an interpreter of the commands, like a
colorful dos prompt
http://prdownloads.sourceforge.net/mingw/MSYS-1.0.10.exe
Now you will be using the MSYS shell that was installed from the MSYS installer. You can launch it from the Desktop shortcut or Start -> Programs -> MinGW -> MSYS -> msys
----------- 2. Allegro: compilation trial ------------------
a. open MSYS
b. at the prompt type:
cd c:
(or the drive you whish to go for the pd external compilation)
c. go to the external directory (note the backslashes instead of slashes !),
mine is external-compiling. Inside I have helloworld.c
cd alberto/backup/PureData_Archive/patches/AlbertoZ/external-compiling/
d. copy m_pd.h (from the PD distribution directory) into external-compiling
(or whatever is its name)
e. type:
gcc -c helloworld.c -o helloworld.o
f. type:
ld -export_dynamic -shared -o helloworld.dll helloworld.o c:/Programmi/pd039e
xt4/bin/pd.dll
(this is the linker step. note that I linked to a particular version of pd.dll - 0.39 extended test 4, so probably (I'm not sure about this) the external will
run on 0.39 only. Can someone confrm this?)
g. If everything was ok then you should have a helloworld.dll in your
directory. Move it on the extra folder of your pd distribution
(I assume that extra folder is in the pd predefined path) and make a
new patch with the helloworld object. Again, if everything is correct,
you should have a "Hello world!!" printed on the console.
----------- 3. Adagio: makefile ------------------
A makefile can be used for compilation. Even if a simple helloworld
application does not need it, complex programs may do.
The makefile.win is attached with this post. Modify it according to your
path in
Make sure you have
helloworld.c
m_pd.h
makefile.win
in your directory. Now type at MSYS prompt:
make -f makefile.win
This will automatically produce:
the object, the linker step (the dll) and will copy the helloworld.dll
in the extra folder of you pd distribution (overwriting the existing one .
----------- 4. Allegro con brio: conclusions ------------------
Why not give a try to the old-man compilation on Win?
----------- 5. Minuetto: greetings ------------------
I apologize if I said some crap somewhere, just let me know if it
doesn't work. Have fun!
Best regards,
Alberto
Just tried pd but....
> yes, probably. but now I'll try to run it on my Atari ST
Seriously try it if you get time one day. Oddly the Atari ST is still *THE* choice for some serious techno musicians. Why? The simplicity of how the UART is addressed and clocked gives it rock solid midi timing. It's something that seems to elude complex architectures even with the best preemptive scheduling, buffering etc. I've watched top producers take a midi file on floppy disk from their $5000 super Mac/PC systems to have it play back on an Atari for final mixdown. It's one of those analog vs digital type debacles where real experience of good ears trumps what "technically shouldn't be so". The ST lacks enough grunt for useful audio DSP, but as a midi processing hub or sequencer it could be an astonishingly powerful tool with pd if you can compile it.
>mhh... this is just a anthropomorphic vision of reality...
You got me.
>what I need to ask now is where I can find reference for all objects:
>I know that there's no menu of them and i have to type their name in those little boxes, but
>I need to know, at least, what objects I can create, typing their names, is it true?
Yeah that bothers me too. Even after using for it some time I forget the name of an atom and have to go looking for it. I often do something like "ls /usr/lib/pd/externs/ | grep pd_linux$ | less" to see if I actually have something. For windows likewise search the externals directory for .dll files
>so, I would like to have a list with the object identifier (for oscs, filters etc.), their
>details (kind of filters, slopes, ripples etc. for filters, as example ), their parameters (cutoff, Q, etc.)
>is there a documentation like this?
The help files are detailed, well written and easy to use. Once you know that such an object exists. Just right click any atom and select "help". Usually there's an example case.
Check these to find common atoms
http://puredata.hurleur.com/sujet-248-suggestions-noobs
http://ccrma.stanford.edu/courses/154/pd-reference.html
http://pure-data.sourceforge.net/documentation.php
>I know... but I still feel more confortable with a traditional language (C++, pascal), also
>for writing my personal VSTs (you know, for those weirdest things...) I think it's still easier to write "algorithms" with a textual language,
>without a graphical metaphore.
Raw code is not an expedient or practical way to make music. Having used Music(N), Csound, Nyquist (LISP/SCHEME), and all that stuff I can say this from the bottom of my heart after 15 years experience. Pd gives you two really important things from a software engineering point of view. It's modularity and clarity of interface in abstracting things just beats any C++ classes hands down for it's intended purpose - digital signal dataflows. Consequently you get better decoupling and better reuse. One of the few pitfalls for a trad programmer imho is that pd is very dirty on types, in a way it's one of the most badly typed languages I've ever experienced. Ironic for a tool called "pure data", but you get used to it's lovable idiosynchrocies vis lists, messages, numbers, arrays, symbols and generic "anys". Also it's scoping rules leave a lot to be desired, everythings global within one instance of the server unless you say $0- at the head of a name.
>But now I need to teach a course on "languages for electronic music" in classical, academic shool.
>they don't know DSP matchematics or something like,
>so I need to urgently search for use a more "abstract" instrument for doing the lessons...
You couldn't wish for a more appropriate tool. For non maths/physics students you can use the power of abstraction to build "black boxes" like synths, analysis tools and sequencers and then open them up later in the course. As Claude says, it takes about 9 months or more before you really take to PureData. Electronic music is BIG, really big, not as big as space but it's a discipline that just explodes in scope once you get into it. You can waste weeks writing externals in C, or designing a synth, or creating a composition method...you can get really lost on a random walk in d>2. The best way forward is to have a context and a goal. Teaching this course sounds like an excellent vehicle to focus your scope.
>Tried also Jmax but on Windows (required OS, because > 95% students use billgatesware ) is quite unstable
I would make it "unrequired". Put your foot down as course leader/tutor that Windows is unsuitable. In order of preference I would go with Mac, then Linux, then Win. If the students only have Windows then try Dyne:bolic ( http://dynebolic.org/ ), a minimal GNU/Linux distro that runs from a CD in RAM and comes preconfigured with PureData and a smorgasboard of other digital media tools. That said, I've seen it work really well on Windows. Once. I've no hard evidence to back this up, but I feel a disturbance in the force when Pd runs on Windows, as if a million threads cried out at once and were suddenly silenced. I don't think it likes heavily loaded machines and I guess 99% certain the reason it's unstable on Win is down to *other* things running. Hint: a music machine shouldn't double as an email server and GCHQ spyware centre. Start with a clean install and nothing else running and you may have better luck, but that will probably remain stable about as long as a schizophrenic Z-boson particle if you network it.
Drum Sequencer
good suggestions hardoff. i like the array and tabread idea. if you need a more friendly interface for programming and displaying the sequence, there are a couple tricks you can use. for setting the sequence, have a matrix of tick boxes with a sub patch (graph on parent option checked). connect each tick box to a message that writes data to the table. (this is why a graph-on-parent sub patch is nice--you don't have to worry about the wires getting in the way...). for displaying the sequence, you can have a looping tabread set up that interprets the sequence and changes the parameters of a matrix of small canvases that correspond to the tick boxes. there are ways to have it so you don't have to have a seperate programming/display interfaces, but these tend to be trickier because you have to make sure you don't run in to loops:
e.g.
[r tick1]
|
[x]
|
[send hihat1]
[r hihat1]
|
etc
|
this will result in a loop that may cause Pd to crash. i've learned my lesson about these crashes the hard way so i've tried to get in the habit of saving more often, especially when creating what could possibly result in an infinite loop.
another advantage of using arrays for sequencers is that you can keep lots of arrays around and save presets or whatever.
patch away!
-zac
Write table with 256 values coming from a number b
I'm guessing your patch receives the 256 values in a list?
You can extract the Nth element from a list with a message box like [ $N (
But for a list length 256 this could get tedious to patch. What I suggest is making a Java program to make the patch.
Make a patch to extract the right parts from the list for a short list, say length 4, perhaps with a [ t l l l l] connected up to [ $N M (, where M=N-1, each connected to [ unpack f f ( ==> [ tabwrite ] . If you create the message boxes last, it will be easier to write the program.
Then write a Java program to generate the patch you want. It's best if the patch generated is a complete abstraction, so you don't have to edit the output patch each time you edit the Java program (say if you want different length lists).
Here is an example of a Java program that I wrote to generate a patch with 256 number boxes in a 4x64 grid. It doesn't follow my guidelines for being a complete abstraction - I edited the patch afterwards to add more stuff, which will cause me problems next time I want a different sized grid....
----snip-----
public class NumberGrid4x64 {
public static void main(String args[]) {
System.out.println("#N canvas 403 0 525 1216 10;");
int count = 0;
System.out.println("#X obj 2 18 cnv 15 110 1136 empty \\$0-canvas-r \\$1 4 12 0 10 -225280 -90133 0;"); count++;
for(int y = 0; y < 64; y++) {
for(int x = 0; x < 4; x++) {
System.out.println("#X floatatom "+(7+26*x)+" "+(42+16*y+4*((int)(y/4))+4*((int)(y/16)))+" 3 0 0 0 - #0-"+y+"-"+x+"-r #0-"+y+"-"+x+"-s;"); count++;
}
}
int count0 = count;
for(int y = 0; y < 64; y++) {
for(int x = 0; x < 4; x++) {
System.out.println("#X obj "+(120+200*x)+" "+(42+16*y+4*((int)(y/4))+4*((int)(y/16)))+" r \\$0-"+y+"-"+x+"-s;"); count++;
System.out.println("#X msg "+(220+200*x)+" "+(42+16*y+4*((int)(y/4))+4*((int)(y/16)))+" "+y+" "+x+" \\$1;"); count++;
}
}
int count1 = count;
System.out.println("#X obj "+(500)+" "+(18)+" t a;");
for(int c = count0; c < count1; c = c + 2) {
System.out.println("#X connect "+(c)+" 0 "+(c+1)+" 0;");
System.out.println("#X connect "+(c+1)+" 0 "+count1+" 0;");
}
}
}
----snip----