Monday, May 14, 2012

Applescript editor not responding

I did the following script in order to identify itunes songs that doesn't have artwork. It's based on other script that I found in net.



tell application "iTunes"
repeat with a in every track of playlist "Library"
if not (exists (artwork 1 of a)) then
add (get location of a) to (playlist "noart")
end if
end repeat
end tell


It seems to be working, it compiles well, and because I can that it in event log windows:



tell application "iTunes"
count every track of playlist "Library"
--> 10684
exists artwork 1 of item 1 of every track of playlist "Library"
--> true
exists artwork 1 of item 2 of every track of playlist "Library"
--> true


But after 4 hundred tracks, it starts to run slowly, and applescript stops responding after one thousand tracks.



I thought that maybe I could be exhausting my mac memory, but in Activity Monitor, I can see that Applescript is consuming 100% CPU and less than 50MB of memory. I'm running macos 10.7.4 on a macbook pro (i7 with 4GB ram).



As you can see my itunes library has 10684 tracks. It's not a small library, but it's not a huge one.



Does anyone has any advice? Or a script to identify tracks without artwork?



TIA,



Bob





How i run cygwin using java program?

I have installed cygwin on window to start crawling. It work well.
Now i want to run cygwin and run a crawl program at starting of cygwin using java program code.



If you provide some code for it ,it will be great help for me.





Way to simulate class categorization in Java

Some programming languages have the feature of adding "Categories" to classes (for example Objective-C), this means, adding new functionality to a class without subclassing.



I really find it useful, but I can't imagine a way of simulating this feature in Java.



So the question is:



How would look an elegant pattern to simulate class categories in Java? What I'm really looking for is achieving the same effect rather of making it the same way.





combo box drop down is not working even after I changed the height in designer

I am trying to give a fix for a combo box drop down list, since its not listing down properly .Only one item is being shown in the list rest all you can see by using arrow keys. I increased the height in designer too, anyways that is not the issue, why because its listing down in some machines and the same version is not working on my machine. I used the DDX_Control to assign this control to a variable.
Do we need to consider any other things which can impact the drop down list??



environment : vs2008, windows 7





How to convert com.google.appengine.api.datastore.Entity to my Entity Object?

Why I get an casting error when I try to get some database object using com.google.appengine.api.datastore.Query



For example:
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Query q = new Query("User");



PreparedQuery pq = datastore.prepare(q);

for (Entity entity : pq.asIterable()) {
User myUser = (User)entity;
}




Halftone Images In Python

I am working on a project that requires me to separate out each color in a CYMK image and generate a halftone image that will be printed on a special halftone printer. The method used is analogues to silk screening in that the process is almost identical. Take a photo and break out each color channel. Then produce a screen for the half tone. Each color screen must have it's screen skewed by 15-45 (adjustable) degrees. Dot size and LPI must be calculated from user configurable values to achieve different effects. This process I am told is used in silk screening but I have been unable to locate any information that explains CYMK halftoning. I find plenty for reducing to a single color and generating new print style b/w halftone image.



I would guess that I need to: 1. split the file into it's color channels. 2. generate a monochrome halftone image for that channel. 3. Skew the resultant halftone image by the number of degrees * channel number. Does anyone know if this is the correct approach?



Does anyone know of any existing python code for this? Or of any good explanations for this process or algorithms?





Spring RMI: handleRemoteConnectFailure

I have a RMI client/server configuration created with Spring 3.0.



When client and server run on the same machine at the url:



  rmi://localhost:1099/myService


everything is ok. When I run the client on a different machine (server run now on 192.168.1.67) and the client "points" to:



  rmi://192.168.1.67:1099/myService 


I can see this error message from the client:



  org.spring...RmiClientInterceptor handlerRemoteConnectFailure. 
Could not connect to Rmi Service [rmi://192.1681.67:1099/myService]


The server is configured in this way:



    <bean id="myService" class="org.springframework.remoting.rmi.RmiServiceExporter">
<property name="service" ref="myService"/>
<property name="serviceInterface" value="org.myapp.MyService"/>
<property name="serviceName" value="myService"/>
<property name="alwaysCreateRegistry" value="true"/>
</bean>

<bean id="myService" class="org.myapp.MyServiceImpl" />


and the client:



    RmiProxyFactoryBean rpfb = new RmiProxyFactoryBean();
rpfb.setServiceInterface(MyService.class);
rpfb.setLookupStubOnStartup(true);
rpfb.setRefreshStubOnConnectFailure(true);
RMICustomClientSocketFactory socketFactory = new RMICustomClientSocketFactory();
socketFactory.setTimeout(5000);
rpfb.setRegistryClientSocketFactory(socketFactory);
rpfb.setServiceUrl(getRmiUrl(address, port));
rpfb.afterPropertiesSet();


I checked with a sniffer the port 1099 of the server, and when the client starts its process I can see some data "dispatched" on the server side:



 JRMI..K
...192.168.1.65..
..192.168.1.65....
P....w"..........................D.M...;.t..myService
Q....w.....e...7B+@5..s}.....5org.springframework.remoting.rmi.RmiInvocationHandlerpxr..java.lang.reflect.Proxy.'. ..C....L..ht.%Ljava/lang/reflect/InvocationHandler;pxpsr.-java.rmi.server.RemoteObjectInvocationHandler...........pxr..java.rmi.server.RemoteObject.a...a3....pxpw2.
UnicastRef..127.0.1.1..../.T~.X.....e...7B+@5...x
R
S
T...e...7B+@5..


My question is: Why if client & server run on the same machine, everything is ok but on different machines I get this problem? and how to fix it?



My Answer:



I run the server on windows and client on linux (ubuntu) and everything was ok.
When I run the server on linux and client on windows I get the problem.



My fix is running the server with: -Djava.rmi.server.hostname=192.168.1.67 on Linux.