我正在尝试为 android 创建一个 epub 阅读器,所以经过大量搜索后我找到了 skyepub library (SDK)。似乎它具有我想要的所有功能。
我按照站点中的提示进行操作,但是在运行代码后我得到了一个空白屏幕 和针对不同 api 的不同 logcat,我再次检查了代码并 agian 但我找不到是什么错了。
这是我的代码和 logcat,我们将不胜感激。
public void makeLayout()
{
String fileName = new String();
fileName = "AliceinWonderland.epub";
makeSetup(); //making directory in device and copy every thing to it
rv = new ReflowableControl(this); // rv is ReflowableControl. an epub class (view) for showing content
Bitmap pageCenter = BitmapFactory.decodeFile(getFilesDir().getAbsolutePath() + "/images/PagesCenter.png");
Bitmap pageStack = BitmapFactory.decodeFile(getFilesDir().getAbsolutePath() + "/images/PagesStack.png");
rv.setPagesStackImage(pageStack);
rv.setPagesCenterImage(pageCenter);
rv.setBaseDirectory(getFilesDir() + "/books");
rv.setBookName(fileName);
rv.setDoublePagedForLandscape(true);
rv.setFont("TimesRoman", 26);
rv.setLineSpacing(135);
rv.setHorizontalGapRatio(0.15);
rv.setVerticalGapRatio(0.1);
/*
* all listener class are implementation of default class in library with simple override method like
* public void onClick(int x,int y)
* {
* Log.w("EPub","Click Detected at"+x+":"+y);
* }
*/
rv.setHighlightListener(new HighlightDelegate());
rv.setPageMovedListener(new PageMovedDelegate());
rv.setSelectionListener(new SelectionDelegate());
rv.setPagingListener(new PagingDelegate());
rv.setSearchListener(new SearchDelegate());
rv.setStateListener(new StateDelegate());
rv.setClickListener(new ClickDelegate());
rv.setBookmarkListener(new BookmarkDelegate());
ContentHandler cl = new ContentHandler();
rv.setContentListener(cl);
rv.setStartPositionInBook(0.285714f);
rv.setNavigationAreaWidthRatio(0.4f);
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, RelativeLayout.LayoutParams.WRAP_CONTENT);
params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
params.width = LayoutParams.MATCH_PARENT;
params.height = LayoutParams.MATCH_PARENT;
rv.setLayoutParams(params);
ePubView = new RelativeLayout(this);
RelativeLayout.LayoutParams rlp = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, RelativeLayout.LayoutParams.MATCH_PARENT);
ePubView.setLayoutParams(rlp);
ePubView.addView(rv);
setContentView(ePubView);
}
public void makeSetup()
{
if (this.isSetup()) return;
if (!this.makeDirectory("scripts"))
{
debug("faild to make scripts directory");
}
if (!this.makeDirectory("images"))
{
debug("faild to make images directory");
}
if (!this.makeDirectory("covers"))
{
debug("faild to make images directory");
}
copyImageToDevice("PagesCenter.png");
copyImageToDevice("PagesStack.png");
if (!this.makeDirectory("downloads"))
{
debug("faild to make downloads directory");
}
if (!this.makeDirectory("books"))
{
debug("faild to make books directory");
}
if (!this.makeDirectory("books/fonts"))
{
debug("faild to make fonts directory");
}
copyBookToDevice("AliceinWonderland.epub");
copyFontToDevice("arial.ttf");
copyFontToDevice("simpo.ttf");
copyFontToDevice("tahoma.ttf");
copyFontToDevice("times.ttf");
SharedPreferences pref = this.getSharedPreferences("EPubTest",0);
SharedPreferences.Editor edit = pref.edit();
edit.putBoolean("isSetup", true);
edit.commit();
}
private boolean isSetup()
{
SharedPreferences pref = this.getSharedPreferences("EPubTest",0);
return pref.getBoolean("isSetup",false);
}
public boolean makeDirectory(String dirName)
{
boolean res;
String filePath = new String(this.getFilesDir().getAbsolutePath() + "/"+dirName);
debug(filePath);
File file = new File(filePath);
if (!file.exists()) {
res = file.mkdirs();
}else {
res = false;
}
return res;
}
public void copyImageToDevice(String fileName)
{
try
{
String path = this.getFilesDir().getAbsolutePath() + "/images/"+fileName;
File file = new File(path);
if (file.exists()) return;
InputStream localInputStream = this.getAssets().open("images/"+fileName);
FileOutputStream localFileOutputStream = new FileOutputStream(this.getFilesDir().getAbsolutePath() + "/images/"+fileName);
byte[] arrayOfByte = new byte[1024];
int offset;
while ((offset = localInputStream.read(arrayOfByte))>0)
{
localFileOutputStream.write(arrayOfByte, 0, offset);
}
localFileOutputStream.close();
localInputStream.close();
Log.d("EPub", fileName+" copied to phone");
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
Log.d("EPub", "failed to copy");
return;
}
}
public void copyBookToDevice(String fileName)
{
try
{
String path = this.getFilesDir().getAbsolutePath() + "/books/"+fileName;
File file = new File(path);
if (file.exists()) return;
InputStream localInputStream = this.getAssets().open("books/"+fileName);
FileOutputStream localFileOutputStream = new FileOutputStream(this.getFilesDir().getAbsolutePath() + "/books/"+fileName);
byte[] arrayOfByte = new byte[1024];
int offset;
while ((offset = localInputStream.read(arrayOfByte))>0)
{
localFileOutputStream.write(arrayOfByte, 0, offset);
}
localFileOutputStream.close();
localInputStream.close();
Log.d("EPub", fileName+" copied to phone");
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
Log.d("EPub", "failed to copy");
return;
}
}
public void copyFontToDevice(String fileName)
{
try
{
String path = this.getFilesDir().getAbsolutePath() + "/books/fonts/"+fileName;
File file = new File(path);
if (file.exists()) return;
InputStream localInputStream = this.getAssets().open("fonts/"+fileName);
FileOutputStream localFileOutputStream = new FileOutputStream(this.getFilesDir().getAbsolutePath() + "/books/fonts/"+fileName);
byte[] arrayOfByte = new byte[1024];
int offset;
while ((offset = localInputStream.read(arrayOfByte))>0)
{
localFileOutputStream.write(arrayOfByte, 0, offset);
}
localFileOutputStream.close();
localInputStream.close();
Log.d("epub", fileName+" copied to phone");
}
catch (IOException localIOException)
{
localIOException.printStackTrace();
Log.d("epub", "failed to copy");
return;
}
}
class ContentHandler implements ContentListener
{
public long getLength(String baseDirectory,String contentPath)
{
String path = baseDirectory + "/" + contentPath;
File file = new File(path);
if (file.exists())
{
return file.length();
}
else
{
return 0;
}
}
public boolean isExists(String baseDirectory,String contentPath)
{
String path = baseDirectory +"/"+ contentPath;
File file = new File(path);
boolean res = false;
Log.w("EPub",contentPath);
if (file.exists())
{
res = true;
}
else
{
res = false;
}
return res;
}
public long getLastModified(String baseDirectory,String contentPath)
{
String path = baseDirectory + "/" + contentPath;
File file = new File(path);
if (file.exists())
{
return file.lastModified();
}
else
{
return 0;
}
}
public InputStream getInputStream(String baseDirectory,String contentPath)
{
String path = baseDirectory + "/" + contentPath;
File file = new File(path);
try
{
FileInputStream fis = new FileInputStream(file);
return fis;
}
catch(Exception e)
{
return null;
}
}
}
android 2.3.5 的 logcat - HTC Chacha
01-26 08:40:04.180: I/System.out(4980): Absolute Path: /data/data/com.mehdok.epubtest/files
01-26 08:40:04.180: I/System.out(4980): File Dir: /data/data/com.mehdok.epubtest/files
01-26 08:40:04.180: D/EPub(4980): /data/data/com.mehdok.epubtest/files/scripts
01-26 08:40:04.180: D/EPub(4980): /data/data/com.mehdok.epubtest/files/images
01-26 08:40:04.190: D/EPub(4980): /data/data/com.mehdok.epubtest/files/covers
01-26 08:40:04.260: D/EPub(4980): PagesCenter.png copied to phone
01-26 08:40:04.270: D/EPub(4980): PagesStack.png copied to phone
01-26 08:40:04.270: D/EPub(4980): /data/data/com.mehdok.epubtest/files/downloads
01-26 08:40:04.270: D/EPub(4980): /data/data/com.mehdok.epubtest/files/books
01-26 08:40:04.330: D/EPub(4980): /data/data/com.mehdok.epubtest/files/books/fonts
01-26 08:40:04.520: D/EPub(4980): AliceinWonderland.epub copied to phone
01-26 08:40:04.520: D/szipinf(4980): Initializing inflate state
01-26 08:40:04.520: D/szipinf(4980): Initializing zlib to inflate
01-26 08:40:04.991: D/epub(4980): arial.ttf copied to phone
01-26 08:40:04.991: D/szipinf(4980): Initializing inflate state
01-26 08:40:04.991: D/szipinf(4980): Initializing zlib to inflate
01-26 08:40:05.071: D/epub(4980): simpo.ttf copied to phone
01-26 08:40:05.071: D/szipinf(4980): Initializing inflate state
01-26 08:40:05.111: D/szipinf(4980): Initializing zlib to inflate
01-26 08:40:05.321: D/epub(4980): tahoma.ttf copied to phone
01-26 08:40:05.321: D/szipinf(4980): Initializing inflate state
01-26 08:40:05.321: D/szipinf(4980): Initializing zlib to inflate
01-26 08:40:05.701: D/epub(4980): times.ttf copied to phone
01-26 08:40:05.821: I/dalvikvm(4980): Could not find method android.view.Display.getRealMetrics, referenced from method com.skytree.epub.br.getRawHeight
01-26 08:40:05.821: W/dalvikvm(4980): VFY: unable to resolve virtual method 4610: Landroid/view/Display;.getRealMetrics (Landroid/util/DisplayMetrics;)V
01-26 08:40:05.821: D/dalvikvm(4980): VFY: replacing opcode 0x6e at 0x001a
01-26 08:40:05.831: D/dalvikvm(4980): VFY: dead code 0x001d-0020 in Lcom/skytree/epub/br;.getRawHeight ()I
01-26 08:40:05.831: I/dalvikvm(4980): Could not find method android.view.Display.getRealMetrics, referenced from method com.skytree.epub.br.getRawWidth
01-26 08:40:05.831: W/dalvikvm(4980): VFY: unable to resolve virtual method 4610: Landroid/view/Display;.getRealMetrics (Landroid/util/DisplayMetrics;)V
01-26 08:40:05.831: D/dalvikvm(4980): VFY: replacing opcode 0x6e at 0x001a
01-26 08:40:05.831: D/dalvikvm(4980): VFY: dead code 0x001d-0020 in Lcom/skytree/epub/br;.getRawWidth ()I
01-26 08:40:05.911: D/Database(4980): dbopen(): path = /data/data/com.mehdok.epubtest/databases/webview.db, flag = 6, cannot stat file, errno: 2,message: No such file or directory
01-26 08:40:05.911: D/Database(4980): dbopen(): path = /data/data/com.mehdok.epubtest/databases/webview.db, mode: delete, disk free size: 26 M, handle: 0x267730
01-26 08:40:05.982: D/Database(4980): dbopen(): path = /data/data/com.mehdok.epubtest/databases/webviewCache.db, flag = 6, cannot stat file, errno: 2,message: No such file or directory
01-26 08:40:05.982: D/Database(4980): dbopen(): path = /data/data/com.mehdok.epubtest/databases/webviewCache.db, mode: delete, disk free size: 26 M, handle: 0x283068
01-26 08:40:06.072: D/qct(4980): [RequestQueue.ActivePool.ActivePool] >> Enable Shutdown = false
01-26 08:40:06.072: D/qct(4980): [IdleCache.IdleCache] >> IDLE_CACHE_MAX = 40
01-26 08:40:06.112: D/qct(4980): [PreConnectionManager.PreConnectionManager] >> TCP_PRE_CONNECT = false
01-26 08:40:06.172: D/skia(4980): htcFlashPlugin::htcFlashPlugin
01-26 08:40:06.172: D/qct(4980): [WebView.WebView] >> Enable Shutdown = false
01-26 08:40:06.182: D/skia(4980): htcFlashPlugin::htcFlashPlugin
01-26 08:40:06.182: D/qct(4980): [WebView.WebView] >> Enable Shutdown = false
01-26 08:40:06.192: D/skia(4980): htcFlashPlugin::htcFlashPlugin
01-26 08:40:06.192: D/qct(4980): [WebView.WebView] >> Enable Shutdown = false
01-26 08:40:06.262: D/dalvikvm(4980): GC_EXTERNAL_ALLOC freed 177K, 43% free 3156K/5447K, external 0K/0K, paused 51ms
01-26 08:40:06.262: D/qct(4980): [PreConnectionManager.PreConnectionManager] >> TCP_PRE_CONNECT = false
01-26 08:40:06.272: D/qct(4980): [PreConnectionManager.PreConnectionManager] >> TCP_PRE_CONNECT = false
01-26 08:40:06.322: D/dalvikvm(4980): GC_EXTERNAL_ALLOC freed 19K, 42% free 3173K/5447K, external 6K/512K, paused 45ms
01-26 08:40:06.442: D/ATRecorder(4980): com.htc.autotest.dlib.RecordEngine in loader dalvik.system.DexClassLoader@40540e00
01-26 08:40:06.692: D/libEGL(4980): loaded /system/lib/egl/libGLES_android.so
01-26 08:40:06.742: D/libEGL(4980): loaded /system/lib/egl/libEGL_adreno200.so
01-26 08:40:06.832: D/libEGL(4980): loaded /system/lib/egl/libGLESv1_CM_adreno200.so
01-26 08:40:06.832: D/libEGL(4980): loaded /system/lib/egl/libGLESv2_adreno200.so
01-26 08:40:06.872: E/Adreno200-ES20(4980): override1= 0xfffffffe, override2= 0xfff *
适用于 android 4.4 的 logcat - 模拟器
01-26 08:47:22.760: I/System.out(1183): Absolute Path: /data/data/com.mehdok.epubtest/files
01-26 08:47:22.760: I/System.out(1183): File Dir: /data/data/com.mehdok.epubtest/files
01-26 08:47:22.770: D/EPub(1183): /data/data/com.mehdok.epubtest/files/scripts
01-26 08:47:22.810: D/EPub(1183): /data/data/com.mehdok.epubtest/files/images
01-26 08:47:22.810: D/EPub(1183): /data/data/com.mehdok.epubtest/files/covers
01-26 08:47:22.900: D/EPub(1183): PagesCenter.png copied to phone
01-26 08:47:22.940: D/EPub(1183): PagesStack.png copied to phone
01-26 08:47:22.940: D/EPub(1183): /data/data/com.mehdok.epubtest/files/downloads
01-26 08:47:22.960: D/EPub(1183): /data/data/com.mehdok.epubtest/files/books
01-26 08:47:22.960: D/EPub(1183): /data/data/com.mehdok.epubtest/files/books/fonts
01-26 08:47:23.090: D/EPub(1183): AliceinWonderland.epub copied to phone
01-26 08:47:23.980: D/epub(1183): arial.ttf copied to phone
01-26 08:47:24.040: D/epub(1183): simpo.ttf copied to phone
01-26 08:47:24.320: D/epub(1183): tahoma.ttf copied to phone
01-26 08:47:24.670: D/epub(1183): times.ttf copied to phone
01-26 08:47:24.850: V/WebViewChromium(1183): Binding Chromium to the background looper Looper{b3d68530}
01-26 08:47:24.860: I/chromium(1183): [INFO:library_loader_hooks.cc(112)] Chromium logging enabled: level = 0, default verbosity = 0
01-26 08:47:24.870: I/BrowserProcessMain(1183): Initializing chromium process, renderers=0
01-26 08:47:25.010: W/chromium(1183): [WARNING:proxy_service.cc(888)] PAC support disabled because there is no system implementation
01-26 08:47:25.020: D/(1183): HostConnection::get() New Host Connection established 0xb7b15d98, tid 1183
01-26 08:47:26.200: D/dalvikvm(1183): GC_FOR_ALLOC freed 126K, 7% free 2893K/3104K, paused 49ms, total 51ms
01-26 08:47:26.210: I/dalvikvm-heap(1183): Grow heap (frag case) to 3.509MB for 635812-byte allocation
01-26 08:47:26.290: D/dalvikvm(1183): GC_FOR_ALLOC freed 1K, 6% free 3512K/3728K, paused 74ms, total 74ms
01-26 08:47:26.510: W/ContentSettingsAdapter(1183): setDefaultZoom not supported, zoom=FAR
01-26 08:47:26.560: W/ContentSettingsAdapter(1183): setDefaultZoom not supported, zoom=FAR
01-26 08:47:26.610: W/ContentSettingsAdapter(1183): setDefaultZoom not supported, zoom=FAR
01-26 08:47:26.820: D/dalvikvm(1183): GC_FOR_ALLOC freed 33K, 4% free 3605K/3728K, paused 33ms, total 34ms
01-26 08:47:26.830: I/dalvikvm-heap(1183): Grow heap (frag case) to 4.107MB for 532496-byte allocation
01-26 08:47:26.910: D/dalvikvm(1183): GC_FOR_ALLOC freed <1K, 3% free 4125K/4252K, paused 73ms, total 74ms
01-26 08:47:27.670: W/EGL_emulation(1183): eglSurfaceAttrib not implemented
01-26 08:47:27.680: D/OpenGLRenderer(1183): Enabling debug mode 0
01-26 08:47:27.970: D/(1183): HostConnection::get() New Host Connection established 0xb7b38c40, tid 1211
01-26 08:47:28.070: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:28.100: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:28.100: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:29.980: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:29.990: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:29.990: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:30.910: I/Choreographer(1183): Skipped 54 frames! The application may be doing too much work on its main thread.
01-26 08:47:30.910: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
01-26 08:47:30.910: W/AwContents(1183): nativeOnDraw failed; clearing to background color.
点击后退按钮后我得到了这个logcat
01-26 08:41:52.646: D/AndroidRuntime(4980): Shutting down VM
01-26 08:41:52.646: W/dalvikvm(4980): threadid=1: thread exiting with uncaught exception (group=0x400205a0)
01-26 08:41:52.666: E/AndroidRuntime(4980): FATAL EXCEPTION: main
01-26 08:41:52.666: E/AndroidRuntime(4980): java.lang.NullPointerException
01-26 08:41:52.666: E/AndroidRuntime(4980): at com.skytree.epub.ec.b(Unknown Source)
01-26 08:41:52.666: E/AndroidRuntime(4980): at com.skytree.epub.br.m(Unknown Source)
01-26 08:41:52.666: E/AndroidRuntime(4980): at com.skytree.epub.br.onDetachedFromWindow(Unknown Source)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.View.dispatchDetachedFromWindow(View.java:6235)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1250)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1248)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1248)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1248)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewGroup.dispatchDetachedFromWindow(ViewGroup.java:1248)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewRoot.dispatchDetachedFromWindow(ViewRoot.java:1862)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewRoot.doDie(ViewRoot.java:2940)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.ViewRoot.die(ViewRoot.java:2910)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.WindowManagerImpl.removeViewImmediate(WindowManagerImpl.java:254)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.view.Window$LocalWindowManager.removeViewImmediate(Window.java:445)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3182)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.app.ActivityThread.access$2100(ActivityThread.java:132)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1071)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.os.Handler.dispatchMessage(Handler.java:99)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.os.Looper.loop(Looper.java:150)
01-26 08:41:52.666: E/AndroidRuntime(4980): at android.app.ActivityThread.main(ActivityThread.java:4293)
01-26 08:41:52.666: E/AndroidRuntime(4980): at java.lang.reflect.Method.invokeNative(Native Method)
01-26 08:41:52.666: E/AndroidRuntime(4980): at java.lang.reflect.Method.invoke(Method.java:507)
01-26 08:41:52.666: E/AndroidRuntime(4980): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
01-26 08:41:52.666: E/AndroidRuntime(4980): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
01-26 08:41:52.666: E/AndroidRuntime(4980): at dalvik.system.NativeStart.main(Native Method)
最佳答案
您只需要将您的 epub 图书解压缩到您的基本目录(在您的例子中是/book/filename)。 您必须将 books 文件夹中的 epub 文件解压为 epub 文件名。
您可以在下面的链接中看到完整的演示
http://www.skytree21.com/cgi-bin/download.php?os=android&version=3.9.8&type=core_sample
在 Demo 中,在 LocalService 类中,您将获得解压缩文件的代码。 在这个演示中,他们从网上下载了 epub 文件,下载后首先将其移动到手机目录中的下载文件夹,然后将其解压缩到手机目录中的基本目录 books,然后 skyepub SDK 将通过设置 setBaseDirectory 直接获取其路径。
这是将 Assets 文件移动到下载文件夹到手机目录后解压缩文件的代码
public void unzipBook(String fileName) {
String targetDir = new String(getFilesDir().getAbsolutePath() + "/books/" + fileName);
targetDir = SkyUtility.removeExtention(targetDir);
String filePath = new String(getFilesDir().getAbsolutePath() + "/downloads");
Unzip unzip = new Unzip(fileName, filePath, targetDir);
unzip.addObserver(new UnzipHandler());
unzip.unzip();
}
class UnzipHandler implements Observer {
@Override
public void update(Observable observable, Object data) {
//Unzip completed
(new Handler()).postDelayed(new Runnable() {
public void run() {
}
},500);
}
}
在您的情况下,您只需获取您的 Assets 引用并解压缩它。您会成功的。
关于android epub 图书馆,skyepub,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21360383/
有没有人有一个很好的Ruby脚本来使用他们的API在Amazon上查找书籍(或其他产品)? 最佳答案 我一直在使用Amazon/ECS取得了巨大的成功。重要的一点是它不是GPL的(而Ruby/AWS似乎是),所以如果它对您的情况很重要,请小心。这是一个示例:require'amazon/ecs'#defaultoptions;willbecamelizedandconverted#toRESTrequestparameters.Amazon::Ecs.options={:aWS_access_key_id=>[youraccessk
我只是想通过向DOM添加脚本标记来加载GWT(GoogleWebToolkit)应用程序,但是因为GWT链接器使用document.write()我无法找到任何这样做的好方法。我在各种博客文章中发现了一些这样做的技巧,但它们似乎都无法使用最新版本的GWT。想到任何合理的非侵入性方法来执行此操作吗?澄清:在您的主机html页面中启动GWT应用程序的正常方法:当然,这会在页面加载后立即启动。我想稍后再做:functionstartapp(){varhead=document.getElementsByTagName('head');vars=document.createElement('
这个问题在这里已经有了答案:WhatisthispracticecalledinJavaScript?(7个答案)关闭8年前。Furthermore,variablescanbepassedintotheanonymouswrappertolocalizecommonlyaccessedglobalvariables,suchaswindow,document,andjQuery...varmodule=(function(window,document,$){//modulestuff})(window,document,jQuery);如果这些内容无论如何都可以在全局范围内访问,那
我想知道是否可以做类似this的事情使用Javascript。我认为这是一件很难实现的事情(只需尝试调整窗口大小),而且我不知道网络上是否有一些东西(虽然我没有找到任何东西)。 最佳答案 如果您能够将整本书的文本传递到页面,这很简单。简单待办事项列表(MVC)PHP:从db获取书籍并将其内容传递给view创建四个DIV首先到上一页操作左页第二个右页第三页第四到下一页Action这些DIV是浏览器窗口的100%高度,它们的宽度是:30px(page.width-60)/2(page.width-60)/230px并且通过Javascr
本课设系软件工程大二学生作,拙笔狂言,恭请斧正。开发工具:Eclipse2020-12,MicrosoftSQLserver2012程序语言:Java引言选题题目:图书管理系统选题背景:(1)图书室有各种图书,共一万多册。(2)每种图书都有书名、书号(ISBN)、一名或多名作者(译者)、出版社、定价和内容简介。(3)借书证记录有借阅者的姓名、所在单位、职业等。(4)凭借书证借书,每次最多能借8本书。借书期限最长为30天。需求功能:(1)图书基本情况的录入、修改、删除等基本操作。(2)实现借书功能。(3)实现还书功能。(4)实现对所有购进图书的分类查询和分类统计。(5)能够按书名、作者等分类查询
我有一个正在开发的JavaScript库。我已将它构建成许多文件,并使用模块方法来定义每个“模块”。varns=generateNamespace("me.mycompany.mypackage.MyFile");(function(ns,undefined){//somemodule}(ns));模块是使用命名空间函数动态命名的,这意味着就目前情况而言,自动完成几乎是不可能的(除非Eclipse可以运行我的代码并找出命名空间,否则VisualStudio可以!)。因此我打算为我的项目生成JSdoc,希望如果我将它包含到Eclipse中(以某种方式)Eclipse可以使用它来为我提供内
我想使用mocha(node.js测试框架,而不是ruby模拟库)作为库,而不是使用mocha可执行文件来运行我的测试。是否可以通过这种方式运行mocha测试?这些示例都只是调用mocha库,假设它们已经“需要”,并且mocha可执行文件提前完成所有“需要”,但我真的更愿意在我的脚本中明确地执行它们,这样我就可以简单地在我的脚本上设置+x并直接调用它。我可以做这样的事情吗?#!/usr/bin/envcoffeemocha=require'mocha'test=mocha.Testsuite=mocha.Suiteassert=require("chai").assertthing
我想将添加的作者与可以由jQuery添加的其他作者分开。当我添加一位作者时,我希望能够将该作者链接到他的书,例如,在我按下添加作者按钮后,我得到了另一位作者的表格,但在我的代码中,所有作者都在一个数组中,所有的书都在其他。不与作者及其书籍分离。我想通过邮寄方式发送:author1:{book1,book2,book3}author2:{book4,book5}author3:{book6,book7,book8,book9}这是我目前的代码:AddAuthorAddAuthorBooks$(document).ready(function(){varmax_fields=10;//ma
打包vpc_app/unit_test.go:import("github.com/my-org/my-library/http")...包github.com/my-org/my-library/http/http.go:packagehttp...文件结构:$treetree.├──glide.lock├──glide.yaml├──unit│ └──modules│ └──vpc│ └──vpc-app│ └──unit_test.go└──vendor└──github.com└──my-org└──my-library├──http│ └──http.go问题:当我
我需要安装KOHAILS在Windows7中,但事实证明它只能安装在Ubuntu上。谁能给我一些关于如何在Windows7上安装它的指南?非常感谢任何帮助。 最佳答案 Koha可以在任何基于Linux的系统上运行。在Debian或Ubuntu上安装和使用最简单,因为可用的软件包非常容易安装-手动安装可能既困难又耗时。Ubuntu指令在这里:http://wiki.koha-community.org/wiki/Koha_on_ubuntu_-_packages您可以使用VirtualBox软件(virtualbox.org)在Win