How to make org-mobile work in android? - android

I want to view and edit my org-file in my Android phone, I synchronize files with Ubuntu one. I added such code in .emacs
(setq org-mobile-directory "~/Documents")
and I also set Org Mobile Directory as ~/Documents in Org Mobile Group. But I can't push any org-file to my phone. When I open an org-file in Emacs and C-c-x RET p, Emacs shows this message.
Please set 'org-direcory' to the directory where your org files live
I don't know why after I did such setting above Emacs still gave me this message.
All I can do in my phone is simply capture a new note, I input something and they can be synchronized with my PC under the ~/Ubuntu One/mobileorg.org. But I can't read what I load into my phone.
I read the web:synchronizing, I found I can't find those three files in my dirctory: checksum.dat, index.org and agendas.org.
What do I need to view org-files in my phone, and push org-files into my phone?

Where do you store your .org files, which you want to export to org-mobile? For example, i store mine in ~/labor and export file ~/labor/tasks.org, and also use OwnCloud WebDAV to synchronize with MobileOrg, so i have set:
(setq org-directory "~/labor")
(setq org-mobile-directory "~/dl/owncloud/mobileorg")
(setq org-agenda-files '("~/labor/tasks.org"))
(setq org-mobile-inbox-for-pull "~/labor/from-mobile.org")
As Pushing to MobileOrg says, pushing stages only the files listed in org-agenda-files or org-mobile-files and puts them in org-mobile-directory retaining the same structure, as it where in org-directory. As Pulling from MobileOrg says, org-mobile-inbox-for-pull is a file in org-directory, in which captured notes are pulled from the phone, which you will need to manually add wherever you want.
To setup:
Put a list of .org files, that you want to have on your phone, in org-agenda-files or org-mobile-files variables;
Set org-directory and org-mobile-directory - you've done that;
Setup MobileOrg on the phone with Ubuntu One directory;
Set org-mobile-inbox-for-pull to some file in org-directory
Your usual workflow will look like:
Execute org-mobile-push (C-c C-x RET p) in Emacs;
Synchronize the phone;
Do something in MobileOrg;
Synchronize the phone;
Execute org-mobile-pull (C-c C-x RET g) in Emacs;

Related

Run Powershell Command from Oracle Procedure

I need to print pdf documents to my network printer from my android studio application. I want to print the pdf as is with all images and formatting, however, the solutions I have found only allow for the extraction and printing of text from the pdf.
I have also seen solutions mentioning tools like Ghostscript etc which are supposed to convert the pdf to a postscript file, but these tools do not work with Android Studio or at-least I haven't figured out how to integrate them into my application. I cannot pay for tools like jPDFPrint which does exactly what I need.
I started thinking about a work around and came upon the idea of sending my pdf as a blob to my oracle database and invoke a power shell command from a procedure to print it to a specific printer.
I've created and tested the below command to print to my network printer from my PC which works great.
Start-Process -FilePath “c:\test.pdf” –Verb PrintTo '\\PrintServer\PrinterName' -PassThru | %{sleep 10;$_} | kill
Now I need help with the oracle part. Is it possible to invoke or run a powershell command from within oracle 12c and pass it the pdf blob as well as the printer name?
To extract the BLOB to a PDF.
Create you system folder, eg c:\printthis.
Then create the Oracle directory object mapped to this folder:
CREATE OR REPLACE DIRECTORY print_dir AS 'C:\print_this';
GRANT READ WRITE ON DIRECTORY print_dir TO PUBLIC;
This procedure to extract the BLOB to a file.
CREATE OR REPLACE PROCEDURE extract_pdf ( p_id IN VARCHAR2 ) AS
CURSOR c1 IS
SELECT doc_blob, doc_name
FROM doc_table
WHERE doc_id = p_id;
r1 c1%ROWTYPE;
v_size NUMBER( 5,0) := 32000;
v_len NUMBER(38,0);
v_buffer RAW(32000);
v_file UTL_FILE.FILE_TYPE;
BEGIN
OPEN c1;
FETCH c1 INTO r1;
v_file := UTL_FILE.FOPEN('PRINT_DIR', r1.doc_name, 'wb', 32760 );
v_start := 1;
v_len := DBMS_LOB.GETLENGTH( r.bbl_fic );
WHILE v_start <= v_len LOOP
DBMS_LOB.READ(
r.bbl_fic,
LEAST( v_len - v_start + 1, v_size ),
v_start,
v_buffer
);
UTL_FILE.PUT_RAW( v_file, v_buffer );
UTL_FILE.FFLUSH( v_file );
v_start := v_start + v_size;
END LOOP;
UTL_FILE.FCLOSE( v_file );
-- Write the CMD file
v_file := UTL_FILE.FOPEN('PRINT_DIR', r1.doc_name || '.bat', 'w' );
UTL_FILE.PUT_LINE( 'Start-Process -FilePath “c:\print_this\' || r1.doc_name || '” –Verb PrintTo '\\PrintServer\PrinterName' -PassThru | %{sleep 10;$_} | kill' );
UTL_FILE.CLOSE(v_file);
END;
/
A Windows At job that runs, polls the c:\print_this folder for files and runs the .bat command, then deletes it.
#ECHO OFF
setlocal enabledelayedexpansion
for %%f in (c:\print_this\*.bat) do (
echo "Name: %%f"
powershell %%f
del %%f
)
The question remains of how to stitch this together. Your Android app calls your procedure to store the PDF as a BLOB. It must also be able to call the procedure suggested above to extract the saved BLOB to a database server file, so this procedure to extract the ODF AND create the print bat script is called after the save BLOB.
The Task Scheduler job polls the directory for the bat scripts, runs them deletes them.
You cannot directly issue a command to the server host from within Oracle. You can use DBMS_SCHEDULER. In the above example, the job would take the doc_id as a parameter, and execute this via DBMS_SCHEDULER.RUN_JOB. I cant remember how to do this precisely, but I hope my other suggestion with the Task Scheduler in Windows is fruitful for you.
You can use the PL/SQL package DBMS_SCHEDULER procedure create_program, using the program_type=>'EXECUTABLE' to do what you want. Then you would have your process that sends the data to oracle create a job to invoke that program. The DBMS_SCHEDULER package is pretty complex so you'll probably need to hunt around for tutorials/tips; you may want to search https://asktom.oracle.com for starters.

What is the purpose of using double underscore ( __ ) before the start and after the end of an file name in c?

I'm studying the android kernel as a beginner. I can read the messages thrown from the macro ERROR() inside the function main() at system/core/init/init.c using dmesg command through adb. I observed that after calling the function open_devnull_stdio() inside main(), dmesg no longer displays the messages thrown by ERROR().
To find the reason, I started digging into the declaration of open_devnull_stdio() inside system/core/init/util.c and I found this line I can't understand
static const char *name = "/dev/__null__";
Actually there was no file named __null__ inside /dev/ in the device, but there was a file named null and I was able to grab it using adb pull and it was a 0 byte (empty) file.
So why is a file name wrapped with double underscore (__) ?
Here is the link for the util.c
There is no special purpose of using double underscore before the start, after the end or both in C. From the point of view of C the file name is just a string, the operating system is free to interpret in whatever way it chooses. From the point of view of Linux, the same applies. Underscores in file names are just characters. They are not treated differently from the letters b and t.
If I guessed right and I'm reading the same file as you (it might be a good idea to link to the source code you're reading) then it should be pretty obvious what the code does on the lines after the one you mentioned. The next lines are:
if (mknod(name, S_IFCHR | 0600, (1 << 8) | 3) == 0) {
fd = open(name, O_RDWR);
unlink(name);
Which creates the null device which is then opened and immediately deleted again.
I suspect this is done so that programs can run without access to the root filesystem and still be able to open the equivalent of /dev/null.
I don't know the answer but I have an idea:
The following page shows an "strace" output where /dev/__null__ is used:
https://gist.github.com/tetsu-koba/1522515
Under Linux device files have a 33-bit (?) number which identifies the device. (At least under old Linux versions) you could delete some file in /dev and you could restore it or even create it in another directory (!) when you know the 33-bit number! (So you can delete the device /dev/sda2 and create the device (not file!) /home/myuser/sda2 instead.)
The trace in the link above shows the following three lines:
mknod("/dev/__null__", S_IFCHR|0600, makedev(1, 3)) = 0
open("/dev/__null__", O_RDWR|O_LARGEFILE) = 3
unlink("/dev/__null__") = 0
These lines will create the device file /dev/__null__ (with the 33-bit number identifying /dev/null). Then it opens that file and then it removes the file again.
Maybe this is done because the tool shall be able to run both on Linux installations where the device file "/dev/null" is present (in this case the file should not be overwritten) and on installations where that file is missing (in this case a replacement file must be created using the known 33-bit number).
As other people have pointed out this just tells it's the "null device", not a regular file called "null". null is supposed to act like an information sink, not like a normal file where you dump your data to. Hope this helps.

cordova.file.* (all directories) are null

I'm working on Ionic mobile app development.
My requirement is to create client side logger to track issues in app. I used the methods mentioned in https://github.com/pbakondy/filelogger, and I could able to create the log file in both Android and iOS.
For the first time when I open the app, it creates the log file in cordova.file.dataDirectory, when I close and reopen the app in i*OS, I'm trying to read the content of the file which was created using the below
$fileLogger.getLogfile().then(function (loggerContent) {
var temp =loggerContent;
});
But the application says
{
"applicationDirectory":null,
"applicationStorageDirectory":null,
"dataDirectory":null,
"cacheDirectory":null,
"externalApplicationStorageDirectory":null,
"externalDataDirectory":null,
"externalCacheDirectory":null,
"externalRootDirectory":null,
"tempDirectory":null,
"syncedDataDirectory":null,
"documentsDirectory":null,
"sharedDirectory":null
}
So I couldn't able to find the file where i saved my logs.
Please help me resolve this issue or if you could recommend me a different method to get around this issue, that would be great!
Thanks for the answers
There is a check list here and should solve your problem :
1-Be sure that the cordova-file-plugin is installed and works in your test environment.
2-Be sure that the cordova.js file is refrenced by your html and before your code usage.
3-Be sure to call your codes after device_ready state :
check this
4-Call your function after a short delay (use setTimeOut in Javascirpt)
Ali's item 4 is very important:
I had a similiar problem on different platforms: cordova.file.dataDirectory was null.
I tracked cordova.file.dataDirectory over the lifecycle and it was first accessed by my Ionic 2 code BEFORE the device ready event was fired.
My "mistake": I wanted to load data during the constructor(!) of a service. Seems too early.

Android Read Result From MySQL

My code used to work, it does not work anymore, I tried troubleshooting and can't figure out why.
I have this piece of code in my PHP:
$android_id_01 = $_GET['pmysql_room_id'];
$android_id_02 = "";
$f = fopen("00_android_id_01.txt", "w");
fwrite($f, print_r($android_id_01, true));
fclose($f);
$f = fopen("00_android_id_02.txt", "w");
fwrite($f, print_r($android_id_02, true));
fclose($f);
For troubleshooting I created two android IDs ($android_id_01 and $android_id_02) which are both empty (The first one is From Android and the second one I created directly from PHP).
Now when I launch my Android device, the PHP file is executed from server side and both the text files are created empty and identical. Now my code only works when I use $android_id_02 and not $android_id_01 from the code below:
if ($android_id == '')
{
//my code
}
(Yes when I use either one of the $android_id_01 OR $android_id_02 I rename it to $android_id and comment out the other one)
My question is, although this was working yesterday, why does it work with $android_id_02 = ""; and not $android_id_01 = $_GET['pmysql_room_id']; even though they are both empty????
I don't know what changed from yesterday to today.
Ok after a bit of troubleshooting I found a solution, strange though.
On the server side "display_errors" under PHP settings must be turned off. Somehow having this on interferes with the json_encode sent back to android client. (even though my code is not generating any errors)

Where are all the shared libraries stored on android?

Where are all the shared libraries (.so) stored on Android? I was able to find the /system/lib directory but I'm sure there are more. Not being able to use the find command doesn't help either.
In the many AOSP and vendor images I have analyzed, I've observed a regular pattern of locations for shared libraries, as follows (some of these are only in newer versions):
system/app/<name>/lib/<arch>
system/priv-app/<name>/lib/<arch>
system/lib
system/lib64
system/vendor/lib
system/vendor/lib64
I've also occasionally seen non-standard locations, for example system/csc/common/system/lib64/ on a Samsung Edge running Android 5.1.1.
Your best bet in finding the location of all shared libraries on a particular device is to recursively search the entire device filesystem as root using find / -name \*.so. If there's no way for you to get find installed (via Busybox or the like), you might try extracting the system image, mounting it on a Linux system and running find over the mounted filesystem.
adb shell 'find / -iname "*.so" 2>/dev/null'
ran surprisingly fast.
Here's all the .so files on my emulator with API level 23. Note that these are implementation details of a device and are not guaranteed to stay the same at any time.
These are all under /system.
./app/LatinIME/lib/x86/libjni_latinime.so
./app/LegacyCamera/lib/x86/libjni_legacymosaic.so
./app/OpenWnn/lib/x86/libWnnEngDic.so
./app/OpenWnn/lib/x86/libWnnJpnDic.so
./app/OpenWnn/lib/x86/libwnndict.so
./app/PacProcessor/lib/x86/libjni_pacprocessor.so
./app/PicoTts/lib/x86/libttscompat.so
./app/PicoTts/lib/x86/libttspico.so
./app/PrintSpooler/lib/x86/libprintspooler_jni.so
./lib/egl/libEGL_emulation.so
./lib/egl/libGLES_android.so
./lib/egl/libGLESv1_CM_emulation.so
./lib/egl/libGLESv2_emulation.so
./lib/hw/audio.primary.goldfish.so
./lib/hw/audio_policy.default.so
./lib/hw/camera.goldfish.jpeg.so
./lib/hw/camera.goldfish.so
./lib/hw/camera.ranchu.jpeg.so
./lib/hw/camera.ranchu.so
./lib/hw/fingerprint.goldfish.so
./lib/hw/fingerprint.ranchu.so
./lib/hw/gps.goldfish.so
./lib/hw/gps.ranchu.so
./lib/hw/gralloc.default.so
./lib/hw/gralloc.goldfish.so
./lib/hw/gralloc.ranchu.so
./lib/hw/keystore.default.so
./lib/hw/lights.goldfish.so
./lib/hw/local_time.default.so
./lib/hw/power.goldfish.so
./lib/hw/sensors.goldfish.so
./lib/hw/sensors.ranchu.so
./lib/hw/vibrator.goldfish.so
./lib/interrupter.so
./lib/invoke_mock_media_player.so
./lib/libEGL.so
./lib/libETC1.so
./lib/libFFTEm.so
./lib/libGLES_trace.so
./lib/libGLESv1_CM.so
./lib/libGLESv1_enc.so
./lib/libGLESv2.so
./lib/libGLESv2_enc.so
./lib/libGLESv3.so
./lib/libLLVM.so
./lib/libOpenMAXAL.so
./lib/libOpenSLES.so
./lib/libOpenglSystemCommon.so
./lib/libRS.so
./lib/libRSCpuRef.so
./lib/libRSDriver.so
./lib/libRScpp.so
./lib/libWnnEngDic.so
./lib/libWnnJpnDic.so
./lib/lib_renderControl_enc.so
./lib/libandroid.so
./lib/libandroid_runtime.so
./lib/libandroid_servers.so
./lib/libandroidfw.so
./lib/libart-compiler.so
./lib/libart-disassembler.so
./lib/libart.so
./lib/libaudioeffect_jni.so
./lib/libaudioflinger.so
./lib/libaudiopolicyenginedefault.so
./lib/libaudiopolicymanager.so
./lib/libaudiopolicymanagerdefault.so
./lib/libaudiopolicyservice.so
./lib/libaudioresampler.so
./lib/libaudiospdif.so
./lib/libaudioutils.so
./lib/libbacktrace.so
./lib/libbacktrace_test.so
./lib/libbase.so
./lib/libbcc.so
./lib/libbcinfo.so
./lib/libbinder.so
./lib/libblas.so
./lib/libc++.so
./lib/libc.so
./lib/libc_malloc_debug_leak.so
./lib/libc_malloc_debug_qemu.so
./lib/libcamera_client.so
./lib/libcamera_metadata.so
./lib/libcameraservice.so
./lib/libcommon_time_client.so
./lib/libcompiler_rt.so
./lib/libcrypto.so
./lib/libcutils.so
./lib/libdefcontainer_jni.so
./lib/libdiskconfig.so
./lib/libdl.so
./lib/libdrmframework.so
./lib/libdrmframework_jni.so
./lib/libeffects.so
./lib/libexif.so
./lib/libexpat.so
./lib/libext2_blkid.so
./lib/libext2_com_err.so
./lib/libext2_e2p.so
./lib/libext2_profile.so
./lib/libext2_quota.so
./lib/libext2_uuid.so
./lib/libext2fs.so
./lib/libext4_utils.so
./lib/libf2fs_sparseblock.so
./lib/libfilterfw.so
./lib/libfilterpack_facedetect.so
./lib/libfilterpack_imageproc.so
./lib/libframesequence.so
./lib/libft2.so
./lib/libgabi++.so
./lib/libgatekeeper.so
./lib/libgiftranscode.so
./lib/libgui.so
./lib/libhardware.so
./lib/libhardware_legacy.so
./lib/libharfbuzz_ng.so
./lib/libhidcommand_jni.so
./lib/libhwui.so
./lib/libicui18n.so
./lib/libicuuc.so
./lib/libimg_utils.so
./lib/libinput.so
./lib/libinputflinger.so
./lib/libinputservice.so
./lib/libiperf.so
./lib/libiprouteutil.so
./lib/libjavacore.so
./lib/libjavacrypto.so
./lib/libjhead.so
./lib/libjhead_jni.so
./lib/libjni_latinime.so
./lib/libjni_legacymosaic.so
./lib/libjni_pacprocessor.so
./lib/libjnigraphics.so
./lib/libjpeg.so
./lib/libkeymaster1.so
./lib/libkeymaster_messages.so
./lib/libkeystore-engine.so
./lib/libkeystore_binder.so
./lib/liblog.so
./lib/liblogwrap.so
./lib/libm.so
./lib/libmdnssd.so
./lib/libmedia.so
./lib/libmedia_jni.so
./lib/libmedialogservice.so
./lib/libmediandk.so
./lib/libmediaplayerservice.so
./lib/libmediautils.so
./lib/libmemtrack.so
./lib/libminikin.so
./lib/libmtp.so
./lib/libnativebridge.so
./lib/libnativehelper.so
./lib/libnbaio.so
./lib/libnetd_client.so
./lib/libnetlink.so
./lib/libnetutils.so
./lib/libnfc_ndef.so
./lib/libnl.so
./lib/libopus.so
./lib/libpac.so
./lib/libpagemap.so
./lib/libpcre.so
./lib/libpdfium.so
./lib/libpixelflinger.so
./lib/libpng.so
./lib/libpower.so
./lib/libpowermanager.so
./lib/libprintspooler_jni.so
./lib/libprocessgroup.so
./lib/libprotobuf-cpp-lite.so
./lib/libradio.so
./lib/libradio_metadata.so
./lib/libradioservice.so
./lib/libreference-ril.so
./lib/libresourcemanagerservice.so
./lib/libril.so
./lib/librilutils.so
./lib/librs_jni.so
./lib/librtp_jni.so
./lib/libselinux.so
./lib/libsensorservice.so
./lib/libserviceutility.so
./lib/libsigchain.so
./lib/libskia.so
./lib/libsoftkeymaster.so
./lib/libsoftkeymasterdevice.so
./lib/libsonic.so
./lib/libsonivox.so
./lib/libsoundpool.so
./lib/libsoundtrigger.so
./lib/libsoundtriggerservice.so
./lib/libsparse.so
./lib/libspeexresampler.so
./lib/libsqlite.so
./lib/libsqlite_jni.so
./lib/libssl.so
./lib/libstagefright.so
./lib/libstagefright_amrnb_common.so
./lib/libstagefright_avc_common.so
./lib/libstagefright_enc_common.so
./lib/libstagefright_foundation.so
./lib/libstagefright_http_support.so
./lib/libstagefright_httplive.so
./lib/libstagefright_omx.so
./lib/libstagefright_soft_aacdec.so
./lib/libstagefright_soft_aacenc.so
./lib/libstagefright_soft_amrdec.so
./lib/libstagefright_soft_amrnbenc.so
./lib/libstagefright_soft_amrwbenc.so
./lib/libstagefright_soft_avcdec.so
./lib/libstagefright_soft_avcenc.so
./lib/libstagefright_soft_flacenc.so
./lib/libstagefright_soft_g711dec.so
./lib/libstagefright_soft_gsmdec.so
./lib/libstagefright_soft_hevcdec.so
./lib/libstagefright_soft_mp3dec.so
./lib/libstagefright_soft_mpeg2dec.so
./lib/libstagefright_soft_mpeg4dec.so
./lib/libstagefright_soft_mpeg4enc.so
./lib/libstagefright_soft_opusdec.so
./lib/libstagefright_soft_rawdec.so
./lib/libstagefright_soft_vorbisdec.so
./lib/libstagefright_soft_vpxdec.so
./lib/libstagefright_soft_vpxenc.so
./lib/libstagefright_wfd.so
./lib/libstagefright_yuv.so
./lib/libstdc++.so
./lib/libsurfaceflinger.so
./lib/libsurfaceflinger_ddmconnection.so
./lib/libsuspend.so
./lib/libsync.so
./lib/libsysutils.so
./lib/libtinyalsa.so
./lib/libttscompat.so
./lib/libttspico.so
./lib/libui.so
./lib/libunwind.so
./lib/libusbhost.so
./lib/libutils.so
./lib/libvixl.so
./lib/libvorbisidec.so
./lib/libwebrtc_audio_preprocessing.so
./lib/libwebviewchromium_loader.so
./lib/libwebviewchromium_plat_support.so
./lib/libwifi-service.so
./lib/libwilhelm.so
./lib/libwnndict.so
./lib/libz.so
./lib/soundfx/libaudiopreprocessing.so
./lib/soundfx/libbundlewrapper.so
./lib/soundfx/libdownmix.so
./lib/soundfx/libeffectproxy.so
./lib/soundfx/libldnhncr.so
./lib/soundfx/libreverbwrapper.so
./lib/soundfx/libvisualizer.so
./priv-app/DefaultContainerService/lib/x86/libdefcontainer_jni.so
./priv-app/Velvet/lib/x86/libcronet.so
./priv-app/Velvet/lib/x86/libgoogle_speech_jni.so
./priv-app/Velvet/lib/x86/libgoogle_speech_micro_jni.so
./priv-app/Velvet/lib/x86/libvcdecoder_jni.so
./vendor/lib/egl/libEGL_swiftshader.so
./vendor/lib/egl/libGLESv1_CM_swiftshader.so
./vendor/lib/egl/libGLESv2_swiftshader.so
./vendor/lib/libfrsdk.so
./vendor/lib/mediadrm/libdrmclearkeyplugin.so
./vendor/lib/mediadrm/libwvdrmengine.so

Categories

Resources