Why do Kernel threads run in process context?
I have recently learned that Linux kernel threads run in process context.
Why does it run them in process context?
Why does it not simply run in a traditional "thread"? (if that even makes
sense to ask)
Tuesday, 3 September 2013
Conflict of "addSelectionChangedListener" and "addDoubleClickListener" for TableViewer
Conflict of "addSelectionChangedListener" and "addDoubleClickListener" for
TableViewer
all related
With JFace TableViewer,I want to select some entry(e.g select a file) by
single-click, and do some other operations(e.g go into a directory) by
double-click.
Noticing addSelectionChangedListener() and addDoubleClickListener() via a
webpage: http://javafact.com/2010/08/07/example-tableviewer-events/ , I
add "SelectionChangedListener" and "DoubleClickListener" for my
TableViwer, and find out: Either of the two listeners can work, but they
can't work together - actually it's DoubleClickListener that can't work.
What's the problem? How I should implement listeners for single-click and
double-clicks? Any comments is appreciated.
Regards & Thanks from Sunzen
TableViewer
all related
With JFace TableViewer,I want to select some entry(e.g select a file) by
single-click, and do some other operations(e.g go into a directory) by
double-click.
Noticing addSelectionChangedListener() and addDoubleClickListener() via a
webpage: http://javafact.com/2010/08/07/example-tableviewer-events/ , I
add "SelectionChangedListener" and "DoubleClickListener" for my
TableViwer, and find out: Either of the two listeners can work, but they
can't work together - actually it's DoubleClickListener that can't work.
What's the problem? How I should implement listeners for single-click and
double-clicks? Any comments is appreciated.
Regards & Thanks from Sunzen
Sinatra with sessions using Rack::Session::Pool
Sinatra with sessions using Rack::Session::Pool
I am having a problem with Sinatra using Rack::Session::Pool for storing
session information. What I want to do is to 'post' some data by appending
information to the session hash using 'POST /dataset', and then retrieve
it by using 'GET /dataset' and returning the content of 'session' hash.
When I try to return the value though, the 'session' hash does not contain
the :message key
require 'sinatra/base'
class Trial < Sinatra::Base
use Rack::Session::Pool
post '/dataset' do
puts session.inspect
session[:message] = params[:data]
puts "message now: #{session[:message]}"
puts session.inspect
end
get '/dataset' do
puts "post message: #{session[:message]}"
puts session.inspect
session[:message]
end
end
Trial.run!
I know this looks trivial, but still I can't get it to work...
I am having a problem with Sinatra using Rack::Session::Pool for storing
session information. What I want to do is to 'post' some data by appending
information to the session hash using 'POST /dataset', and then retrieve
it by using 'GET /dataset' and returning the content of 'session' hash.
When I try to return the value though, the 'session' hash does not contain
the :message key
require 'sinatra/base'
class Trial < Sinatra::Base
use Rack::Session::Pool
post '/dataset' do
puts session.inspect
session[:message] = params[:data]
puts "message now: #{session[:message]}"
puts session.inspect
end
get '/dataset' do
puts "post message: #{session[:message]}"
puts session.inspect
session[:message]
end
end
Trial.run!
I know this looks trivial, but still I can't get it to work...
sample example for JCS
sample example for JCS
I am implementing JCS for the first time.
My requirement : I have one java class with a main method in which i am
storing some data in the cache.
I have second java class with a main method from which i am retrieving
from the disk cache which i had stored using the first java class.
Please note: 1. I want to use disk cache(Of JCS). 2. I want to retrieve
the data from different JVM. 3. When i run the first Java class main
method, i should store the data in the disk cache and when i run the
second java class main method, i want to retrieve the data from the cache
which is stored in the disk using the first java class main method.
I am implementing JCS for the first time.
My requirement : I have one java class with a main method in which i am
storing some data in the cache.
I have second java class with a main method from which i am retrieving
from the disk cache which i had stored using the first java class.
Please note: 1. I want to use disk cache(Of JCS). 2. I want to retrieve
the data from different JVM. 3. When i run the first Java class main
method, i should store the data in the disk cache and when i run the
second java class main method, i want to retrieve the data from the cache
which is stored in the disk using the first java class main method.
Universal Image Loader Base Image Downloader
Universal Image Loader Base Image Downloader
On my application I used universal image downloader BaseImageDownloader
class for syncronious loading contents of gallery.For the same content
from Imageloader.getInstance().loadImage asyncronious function it does not
gives any security exception and loads the image as it is ment to be but
when I try to download it syncroniously using BaseImageDownloader (Also
Imageloader.getInstance().loadImage() makes the same) i get this security
Exception
09-02 18:49:43.971: W/System.err(4244): java.lang.SecurityException:
Permission Denial: reading com.android.gallery3d.provider.GalleryProvider
uri
content://com.google.android.gallery3d.provider/picasa/item/5879964074642783474
from pid=4244, uid=10064 requires
com.google.android.gallery3d.permission.GALLERY_PROVIDER, or
grantUriPermission()
09-02 18:49:43.971: W/System.err(4244): at
android.os.Parcel.readException(Parcel.java:1425)
09-02 18:49:43.971: W/System.err(4244): at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
09-02 18:49:43.971: W/System.err(4244): at
android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:148)
09-02 18:49:43.971: W/System.err(4244): at
android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:617)
09-02 18:49:43.971: W/System.err(4244): at
android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:717)
09-02 18:49:44.011: W/System.err(4244): at
android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:614)
09-02 18:49:44.011: W/System.err(4244): at
android.content.ContentResolver.openInputStream(ContentResolver.java:449)
09-02 18:49:44.011: W/System.err(4244): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromContent(BaseImageDownloader.java:156)
09-02 18:49:44.011: W/System.err(4244): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:88)
09-02 18:49:44.011: W/System.err(4244): at
com.uploader.data.UploadImageData.decodeSampledBitmapFromStream(UploadImageData.java:80)
Also I searched the code and you do not take any permission for that on
configuration or somewhere else what will be the cause?
public static Bitmap decodeSampledBitmapFromStream(String path, int
reqWidth, int reqHeight) throws IOException {
BaseImageDownloader downloader = new
BaseImageDownloader(getApplicationContext());
InputStream stream = downloader.getStream(path, null);
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(stream, new Rect(-1,-1,-1,-1), options);
stream.close();
options.inSampleSize = calculateInSampleSize(options, reqWidth,
reqHeight);
options.inJustDecodeBounds = false;
stream = downloader.getStream(path, null);
Bitmap bitmap = BitmapFactory.decodeStream(stream, new
Rect(-1,-1,-1,-1), options);
stream.close();
return bitmap;
}
On my application I used universal image downloader BaseImageDownloader
class for syncronious loading contents of gallery.For the same content
from Imageloader.getInstance().loadImage asyncronious function it does not
gives any security exception and loads the image as it is ment to be but
when I try to download it syncroniously using BaseImageDownloader (Also
Imageloader.getInstance().loadImage() makes the same) i get this security
Exception
09-02 18:49:43.971: W/System.err(4244): java.lang.SecurityException:
Permission Denial: reading com.android.gallery3d.provider.GalleryProvider
uri
content://com.google.android.gallery3d.provider/picasa/item/5879964074642783474
from pid=4244, uid=10064 requires
com.google.android.gallery3d.permission.GALLERY_PROVIDER, or
grantUriPermission()
09-02 18:49:43.971: W/System.err(4244): at
android.os.Parcel.readException(Parcel.java:1425)
09-02 18:49:43.971: W/System.err(4244): at
android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:185)
09-02 18:49:43.971: W/System.err(4244): at
android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:148)
09-02 18:49:43.971: W/System.err(4244): at
android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:617)
09-02 18:49:43.971: W/System.err(4244): at
android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:717)
09-02 18:49:44.011: W/System.err(4244): at
android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:614)
09-02 18:49:44.011: W/System.err(4244): at
android.content.ContentResolver.openInputStream(ContentResolver.java:449)
09-02 18:49:44.011: W/System.err(4244): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStreamFromContent(BaseImageDownloader.java:156)
09-02 18:49:44.011: W/System.err(4244): at
com.nostra13.universalimageloader.core.download.BaseImageDownloader.getStream(BaseImageDownloader.java:88)
09-02 18:49:44.011: W/System.err(4244): at
com.uploader.data.UploadImageData.decodeSampledBitmapFromStream(UploadImageData.java:80)
Also I searched the code and you do not take any permission for that on
configuration or somewhere else what will be the cause?
public static Bitmap decodeSampledBitmapFromStream(String path, int
reqWidth, int reqHeight) throws IOException {
BaseImageDownloader downloader = new
BaseImageDownloader(getApplicationContext());
InputStream stream = downloader.getStream(path, null);
final BitmapFactory.Options options = new BitmapFactory.Options();
options.inJustDecodeBounds = true;
BitmapFactory.decodeStream(stream, new Rect(-1,-1,-1,-1), options);
stream.close();
options.inSampleSize = calculateInSampleSize(options, reqWidth,
reqHeight);
options.inJustDecodeBounds = false;
stream = downloader.getStream(path, null);
Bitmap bitmap = BitmapFactory.decodeStream(stream, new
Rect(-1,-1,-1,-1), options);
stream.close();
return bitmap;
}
Monday, 2 September 2013
PDF creation on Android
PDF creation on Android
im working on an Application for Android that lets you put data in a
database. (Standard Database Gui). But now comes the trickier part. I have
to convert this Data into a PDF and send it per E-Mail or to a printer.
I'd have loved to use PDFBOX from Apache but it seams that it is dependent
on AWT. I know this question has been has asked before, but that was quite
some time ago, maybe someone wrote a translation (Like JavaMail) or
someone is working on a fake AWT lib for Android, that would solve such
Problem.
Or even better, someone knows a better lib or a better format with lib (It
should be readable be multiplattform PCs, established and free, and i'd
like to avoid HTML, because my Boss told me that hed prefer something
else).
So, anyone have an idea?
im working on an Application for Android that lets you put data in a
database. (Standard Database Gui). But now comes the trickier part. I have
to convert this Data into a PDF and send it per E-Mail or to a printer.
I'd have loved to use PDFBOX from Apache but it seams that it is dependent
on AWT. I know this question has been has asked before, but that was quite
some time ago, maybe someone wrote a translation (Like JavaMail) or
someone is working on a fake AWT lib for Android, that would solve such
Problem.
Or even better, someone knows a better lib or a better format with lib (It
should be readable be multiplattform PCs, established and free, and i'd
like to avoid HTML, because my Boss told me that hed prefer something
else).
So, anyone have an idea?
Running Total Sum
Running Total Sum
im having a real headhache with this. Im trying to get a Running Total to
make a sum of certain items that correspond to a condition. I dont know
how to procede now
while {Movimientos.IVA} = 0 do Sum ({Movimientos.Importe}, {Movimientos.RFC})
it really makes the sum but it takes wrong values, because i have 2 items
that correspond to Movimientos.IVA = 0 and it doesnt sum them. It sums the
values that are different to 0. By the other hand this is my configuration
for Running Total:
on Evaulate i have use formula on Reset i have on group change: and my
group that is Movimientos.RFC what am i doing wrong?
im having a real headhache with this. Im trying to get a Running Total to
make a sum of certain items that correspond to a condition. I dont know
how to procede now
while {Movimientos.IVA} = 0 do Sum ({Movimientos.Importe}, {Movimientos.RFC})
it really makes the sum but it takes wrong values, because i have 2 items
that correspond to Movimientos.IVA = 0 and it doesnt sum them. It sums the
values that are different to 0. By the other hand this is my configuration
for Running Total:
on Evaulate i have use formula on Reset i have on group change: and my
group that is Movimientos.RFC what am i doing wrong?
Subscribe to:
Posts (Atom)