Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Wednesday, March 18, 2015

Google plugin for loona problems on MACOS

1) It contains GWT 2.6.0 - that is old (it looks there is option to install new version manually, and link than).

2) App created from scratch was able to start only in superdev mode, the page is just blank in other modes.

3) Debug breakpoints not work in superdev, that is only working option.

I use last chrome on MacOS that is only available option to use GWT plugin.

link:
http://www.gwtproject.org/articles/superdevmode.html

Update:
I switched back to Ubuntu form most coding tasks where it is possible, Mac is good for browsing, but not so convinient for programming as linux.




Sunday, June 22, 2008

CentOS x64: firefox java and flash plugin

Last solutions of problems with x64 that worked:



Flash:


just got it from there:
http://labs.adobe.com/downloads/flashplayer10.html

then in terminal:

$ tar -xf libflashplayer-10.0.22.87.linux-x86_64.so.tar.gz
$ sudo cp libflashplayer.so /usr/lib64/mozilla/plugins/


Restart firefox-64 bit;
Youtube is working. Google analytics is also working.

Below are the previous problem solutions that worked in different time


They are working from time to time. (see comments also for details).

Java:



Firefox requested for additional plugin and directed to java page for download. After that, downloaded 32-bit (not x64!) rpm of java from sun.

Warning: if following this guide check java versions,sun updates versions of java, so numbers could be different, and pathes,if such present in the command line.



chmod a+x jre-6u6-linux-i586-rpm.bin
./jre-6u6-linux-i586-rpm.bin


fix alternatives file. Set sun's:


[root@rtgCent Desktop]# /usr/sbin/alternatives --install /usr/bin/java java /usr/lib/jvm/jre-1.4.2-gcj/bin/java 1
[root@rtgCent Desktop]# /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jre1.6.0_06/bin/java 2
[root@rtgCent Desktop]# /usr/sbin/alternatives --config java

There are 2 programs which provide 'java'.

Selection Command
-----------------------------------------------
1 /usr/lib/jvm/jre-1.4.2-gcj/bin/java
*+ 2 /usr/java/jre1.6.0_06/bin/java

Enter to keep the current selection[+], or type selection number:

# ln -s /usr/java/jre1.6.0_06/plugin/i386/ns7/libjavaplugin_oji.so /usr/lib/mozilla/plugins/libjavaplugin_oji.so

[root@rtgCent Desktop]# vi /etc/profile.d/java.sh
export J2RE_HOME=/usr/java/jre1.6.0_06
export PATH=$J2RE_HOME/bin:$PATH

save by :wq ; (or use gedit/mousepad/kate if don't like vi) restart firefox,
























check,if all working.

Flash


Solution 1:



For CentOS 5.2 firefox 64-bit works better with nsplugnwrapper from the box.
Just reinstall nsplugiwrapper to resolve initial problem with flash that can be.
However java not worked and I moved to 32-bit version of firefox.
Procedure below is related to ff 1.5 and CentOS 5.1, but it works for firefox 3 under centos 5.2 also

Solution 2:


To fix various errors with java and flash under CentOS x64 on my AMD-based home box, I've tried to use nspluginwrapper, manually installed java 64-bit from sun, also various versions of flash from Adobe by downloading rpm and manual install.

Finally problem was not completely solved after that, some issues were with flash, and I haven't got java working.

To solve I just decided to move on 32-bit version.

That way I just stopped Firefox, issued following

su -
[insert pwd]
yum list installed firefox jre
yum remove jre.x86_64
yum remove firefox.x86_64
yum install firefox.i386


and I got flash working without problems on google analytics.








Saturday, March 15, 2008

Logic operators: Lazyness C++, Perl, Java, Javascript, ksh

Examples demonstrating lazy evaluation for || and && in different languages presented.

Consider following c++ code:


Fun1() || Fun2() || Fun3();
Fun1() && Fun2() && Fun3();


In c++, they are executed, only if the result of overall execution depends from execution of function that was not yet executed. '&&' , '||' and ',' are only c++ operators, thats order is direct from left-to right.

In examples:

Java1.6:
/**
* @author rtg
*
*/
public final class main {
public static boolean fun1(){System.out.println("fun1"); return true;}
public static boolean fun2(){System.out.println("fun2"); return false;}
public static boolean fun3(){System.out.println("fun3"); return true;}
/**
* @param args
*/
public static void main (String[] args) {
boolean res;
System.out.println("|| test:");
res = fun1() || fun2() || fun3();
System.out.printf("res:%b\n",res);
System.out.println("&& test:");
res = fun1() && fun2() && fun3();
System.out.printf("res:%b",res);
}
}


Results are the same as for

Javascript in firefox 2 is lazy too:
example

Perl's operators are lazy too:

$ cat lazy_or.pl
#!/usr/bin/perl

sub fun1 {print "fun1\n"; return 1;};
sub fun2 {print "fun2\n"; return 0;};
sub fun3 {print "fun3\n"; return 1;};

sub main
{
print "or:\n";
print "res=" . (fun1() or fun2() or fun3()) . "\n";
print "and:\n";
print "res=" . (fun1() and fun2() and fun3()) . "\n";
print "&&:\n";
print "res=" . (fun1() && fun2() && fun3()) . "\n";
print "||:\n";
print "res=" . (fun1() || fun2() || fun3()) . "\n";
}

main();

rtg@kubic-roman:~$ perl lazy_or.pl
or:
fun1
res=1
and:
fun1
fun2
res=0
&&:
fun1
fun2
res=0
||:
fun1
res=1
rtg@kubic-roman:~$ perl -v

This is perl, v5.8.8 built for i486-linux-gnu-thread-multi


ksh example at the end is different in results from perl c++ and javascript.
After ksh testing I understand, why Java not accepts int's as booleans for the operator.

ksh interprets 0 as true and 1 as false, so it is the place were you have to be patient,
when swith to:

$ cat lazy.ksh
#!/usr/bin/ksh

fun1() {
echo "fun1"
return 1;
}

fun2() {
echo "fun2"
return 0;
}

fun3() {
echo "fun3"
return 1;
}

status(){
echo $?
}

fun1 || fun2 || fun3
status
fun1 && fun2 && fun3
status
rtg@kubic-roman:~$ ./lazy.ksh
fun1
fun2
0
fun1
1


Thats strange, that a lot of programmers in presented languages where very confident about non-laziness of the operators.
However, it is common for all presented languages, and it is no conceptual difference in these languages at the point described.

C++ example:
#include 

int fun1(){std::cout << "fun1\n"; return 1;}
int fun2(){std::cout << "fun2\n"; return 0;}
int fun3(){std::cout << "fun3\n"; return 1;}

int main()
{
int test_val;
std::cout << "\n || test:\n";
test_val = fun1() || fun2() || fun3();
std::cout << "result is:" << test_val << std::endl;
std::cout << "\n && test:\n";
test_val = fun1() && fun2() && fun3();
std::cout << "result is:" << test_val << std::endl;
}
result of code execution is:

|| test:
fun1
result is:1

&& test:
fun1
fun2
result is:0

Monday, February 25, 2008

Links: differences in syntax: Perl, tcl, Shell, C++, Python, Java, Javascript, Lisp

I have already mentioned in my post on comparing numbers and strings in shell, about problems of simultaneous use of different programming languages.

To conclude, having reference cards with description one language to another differences can be useful.

Listed is set of resources, intended for migration from one language to another.

Recommended (short,self-descriptive, useful):
languages comparison:
http://merd.sourceforge.net/pixel/language-study/syntax-across-languages/


Recommended, but not short:

Wikipedia page:
http://en.wikipedia.org/wiki/Comparison_of_programming_languages

Open directory listing for comparisons:
http://www.dmoz.org/Computers/Programming/Languages/Comparison_and_Review/

PLEAC - Programming Language Examples Alike Cookbook
Comparison of productivity of writing in different programming languages:
page.mi.fu-berlin.de/~prechelt/Biblio/jccpprtTR.pdf

Useful:
Java for c++ Programmers:
http://pages.cs.wisc.edu/~hasti/cs368/JavaTutorial/

http://triton.towson.edu/~mzimand/os/Lect2-java-tutorial.html
Lisp to javascript converter, descriptive.
http://javascript.crockford.com/little.html
Another one Lisp to Javascript converter written in javascript.( You can look into source to look into the code)
http://www.joeganley.com/code/jslisp.html

Comparison Python with Java, Lisp i.t.c.

http://wiki.python.org/moin/LanguageComparisons


Three scripting concurrents:
http://mjtsai.com/blog/2002/11/25/perl_vs_python_vs_ruby/

Accumulator generator in different languages:
http://www.paulgraham.com/accgen.html

Tcl vs. Python, with nice short examples

http://homepages.cwi.nl/~sjoerd/PythonVsTcl-old.html


This thread describes differences between bash and perl.
http://www.perlmonks.org/?node_id=661859

And at the end resource with language comparison in action (memory, speed, size).
http://shootout.alioth.debian.org/