Wednesday, September 24, 2014

Postgres related

Forgotten PostgreSQL Windows password

[database vs] schema

Log changes made by users:
Audit trigger 91plus
Note to self:
From experience with idempiere database on Postgres 9.4, the code need to be changed:
from "quote_ident(target_table::text)" to "target_table"
Related to that matter:
Define table and column names as arguments in a plpgsql function?
SQL injection in Postgres functions vs prepared queries
Unexpected behavior of dynamic SQL using regclass

Function to activate audit trigger on several tables at one (related to Audit trigger 91plus):
--- code start ---
CREATE OR REPLACE FUNCTION audit.mass_on(
    _schema_ character varying,
    _table_regexp_ character varying)
  RETURNS SETOF character varying AS
$BODY$
DECLARE
    result  VARCHAR := '';
BEGIN
    FOR result IN SELECT table_name FROM information_schema.tables
        WHERE table_schema = $1 AND table_name ~* $2 and table_type = 'BASE TABLE' ORDER BY table_name
    LOOP
perform audit.audit_table($1 || '.' || result);
        RETURN NEXT result;
    END LOOP;
    RETURN;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION audit.mass_on(character varying, character varying)
  OWNER TO postgres;
--- code finish ---
Sample usage:
select audit.mass_on('adempiere','_');

Function to de-activate audit trigger on several tables at one (related to Audit trigger 91plus):
--- code start ---
CREATE OR REPLACE FUNCTION audit.mass_off(
    _schema_ character varying,
    _table_regexp_ character varying)
  RETURNS SETOF character varying AS
$BODY$
DECLARE
    result  VARCHAR := '';
BEGIN
    FOR result IN SELECT table_name FROM information_schema.tables
        WHERE table_schema = $1 AND table_name ~* $2 and table_type = 'BASE TABLE' ORDER BY table_name
    LOOP
EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_row ON ' || $1 || '.' || result;
EXECUTE 'DROP TRIGGER IF EXISTS audit_trigger_stm ON ' || $1 || '.' || result;
        RETURN NEXT result;
    END LOOP;
    RETURN;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION audit.mass_off(character varying, character varying)
  OWNER TO postgres;
--- code finish ---
Sample usage:
select audit.mass_off('adempiere','pa_');

Function to search schema for specified table name (partial name supported, related to Audit trigger 91plus):
--- code start ---
CREATE OR REPLACE FUNCTION audit.list_tables(
    _schema_ character varying,
    _table_regexp_ character varying)
  RETURNS SETOF character varying AS
$BODY$
DECLARE
    result  VARCHAR := '';
BEGIN
    FOR result IN SELECT table_name FROM information_schema.tables
        WHERE table_schema = $1 AND table_name ~* $2 ORDER BY table_name
    LOOP
        RETURN NEXT result;
    END LOOP;
    RETURN;
END;
$BODY$
  LANGUAGE plpgsql VOLATILE
  COST 100
  ROWS 1000;
ALTER FUNCTION audit.list_tables(character varying, character varying)
  OWNER TO postgres;
--- code finsh ---
Sample usage:
select audit.list_tables('adempiere','ad_');

Debug PostgreSQL function using pgAdmin
picture

Re-add database from files on disk:
Recover postgreSQL databases from raw physical files

Physical location of database files:
Where does PostgreSQL store the database?

Database backup using SQL Dump
An important advantage of pg_dump over the other backup methods described later is that pg_dump's output can generally be re-loaded into newer versions of PostgreSQL, whereas file-level backups and continuous archiving are both extremely server-version-specific. pg_dump is also the only method that will work when transferring a database to a different machine architecture, such as going from a 32-bit to a 64-bit server

How do I specify a password to psql non-interactively?
Set the PGPASSWORD environment variable ... before calling psql


Tuesday, September 23, 2014

Eclipse related

Use existing workspace with newer version of Eclipse?
In theory, new versions of Eclipse should update your workspace and project files just fine. In practice, they can become corrupted. My new rule is to create a new workspace for every major version upgrade of Eclipse (maybe more often if you’re cautious). Then I copy those projects and import the copy. This ensures I have a backup plan should something go awry. You may need to reimport your project(s) if there’s a problem that won’t go away after an upgrade.
(from ECLIPSE “CANNOT BE RESOLVED TO A TYPE” ERROR)

How to find out if an installed Eclipse is 32 or 64 bit version?

Hit Ctrl+Alt+Del to open the Windows Task manager and switch to the processes tab, OR
Open eclipse.ini in the installation directory, and observe the 4th line

32-bit programs should be marked with *32

Running 32 bit applicayion on 64 bit Eclipse
Using a 32-bit JRE with a 64-bit eclipse:
Just include the 32bit JRE as an additional Java runtime in the configuration and use it for your project.
How?
...

Tuesday, September 16, 2014

"Net send" related

To send messages to all users currently open documents stored on server XYZ :
from Command prompt on XYZ, type : NEt SEND /USERS "message"
---

Could not send to ANY computer with error "message alias could not be found"

SOLUTION:
Messenger service is probably stopped
---

suddenly not working

SYMPTOM:
An error occured while sending a message to ...
A general network error occured
...NET HELPMSG 2136

SOLUTION:
Restart Messenger service
---

Free client (receive only): Winsent Innocenti
---

how to send multi-line message
Press CTRL+T after the last character of a line.
see How can I NET SEND a multi-line message? for alternative ways
---

Maximum allowed length of a broadcast message is 128 characters. Maximum allowed length of a personal message is 1600 characters.
source: NET SEND command reference
---

Wednesday, September 10, 2014

“Insufficient storage available” related

Fastest/easy way to move ALL apps back to [original] internal storage/memory prior to changing/formatting:
Multi-select \ Select all \ Move to phone (and/or Remove Link?)
NOTE:
Uninstalling Link2SD will NOT do the trick (see FAQ: What happens to my linked apps if I uninstall the Link2SD app?)

Free up /system storage
Q: Looking at the storage info within Link2SD I see that I only have 2% of my /system storage free
A:
removing system apps will NOT give you anymore user available space, but integrating updates of system app will, link2sd can [do] this now. Low "/system" storage should not give you any problems since items in there are pretty much static

Better not upgrade to KitKat if still want to use Link2SD
Note from Link2SD 3.5.2 version (click "View page source" on "Reviews" section):
KITKAT NOTICE In Android KitKat is not legally possible to write files to any location on external SD card. So the functionality of the app limits to internal storage on KitKat. If you have a rooted device you can try a fix: https://play.google.com/store/apps/details?id=nextapp.sdfix
*UPDATE Jan 8, 2015 Found this:
Unlock external SD Card writing for all apps in Android 4.4 KitKat
Comment by SonicX (search string "Link2SD") might be useful; never tried it though

Link2SD - missing apps after reboot
Posted on Nov 13, 2014:
The "Link Internal Data" option in the paid version seems to be the culprit. This is buggy and stopped using it after a few apps disappeared after using this option.
Another suggestion from this:
Start link2sd and click menu button>more>quickreboot and all the "missing apps" are going to be available again for all your needs!

Increase internal memory in Android Mobiles in easy steps

Is it safe to resize 2nd partition (ext2) used by Link2SD after some time?

seriously to say i wouldn't recommend to restore that ext partition.. As you are saying you want to restore your config of Link2sd.. Well to say it will not work cz the system links get disturbed due to removal of partition or modify..
well best to say i would recommend to take a backup of your ROM then partition the card..
Well to say i would recommend to you first switch off your phone.. Put it in card reader then partition it..
Restore the backup then see if it works.. I think you are on stock rom..

You can try this method:
1. Make a backup of your current ROM Using the recovery..
2. Switch off the phone then put it in card reader.. Re partition your card using card reader..
3. Then restore the backup..
See if this works..
source: Extend EXT2 partition without losing data
---


Link2SD: mount script created but link2sd.log says "No such file..." or "Device or resource busy"
(NOT TRIED YET) Problem with link2sd

Important topics from Link2SD FAQ
You need to use a non-FAT file system (ext2, ext3, ext4 or f2fs) on your second partition in order to link app's private data files. Because the FAT file system (FAT16, FAT32 or exFAT) does not support UNIX file ownership or permissions and will cause a security breakdown of app's private files. Link2SD Plus can move app's private data files if you have a non-FAT partition.
What is the difference between “Move To SD Card (Native to Android)" and “Create (Symbolic) Link” in Link2SD?
Click "Create Link":
..move and link applications to 2nd partition with Link2SD.
..You can see "Linked -> SD card" label for linked apps
click "Move to SD":
..app will be moved to first partition with native app2sd method of Android OS.
..You can see "on SD Card" label for those apps
What does it mean to freeze an app - what is the benefit of doing that?
 I see -Updated- label on some applications, what does it mean?

“Insufficient Storage Available” even there is lot of free space in device memory
Dial *#9900# (for Samsung only?)
see rhlee's answer for how to do the same thing if you get the "invalid MMI" error when you try this on a rooted, modded phone.
Basically, Delete dumpstate/logcat in SysDump clears out the log files in /data/log. But you can also do this manually without SysDump
...

Increase Internal Storage of Micromax A110 and any MTK Device

'Insufficient Storage Available' is one of Android's greatest annoyances. Here's how to fix it.
You can get a big-picture look at what is using up your internal and external space by installing DiskUsage, a free app that visualizes what's sitting around in storage.
Self experience: Cache of Download Manager

“Insufficient storage available”. Ok, but where?

Related
--------
[GUIDE] [FAT32] [EXT4] [SWAP] [2.3+] How to Partition your Android MicroSD Card

Tuesday, September 9, 2014

List all characters for certain pinyin

Xiaoma
Use "Search by pinyin" on the left pane

Click on pinyin and link to characters will appear on top of the page

Related
--------
Tips: How to Use Google Pinyin Chinese Input Method
Download link:
Link 1
Link 2
To show/hide google pinyin toolbar: press ‘Alt’ + ‘Shift’

Wednesday, September 3, 2014

Hunt for tablet with 10" display and minimum of 4GB RAM

Xiaomi Mi Pad 4 Plus Phablet Review MAR 8, 2019
What Works for Mi Pad 4 Plus
   Sleek design
   10.1-inch Full HD IPS-LCD screen
   Fingerprint sensor
   Impressive battery performance
Where Xiaomi Mi Pad 4 Plus fails
   Subpar speakers
   Lack of Google Play Store

The Google Play Store is missing from the tablet but it can be installed from the Mi App Store with ease.
The brightness, contrast, and color reproduction are good enough to support usage in indoor settings as well as outdoors as long as you are using it in the shadows without straining the eyes. The screen does get quite dark in direct sunlight. For those who prefer customized color and contrast settings, there is plenty of room adjust the setting to one’s personal liking.

Tablet Xiaomi Mi Pad 4 Plus 4/64 GB 10.1 inch - Garansi 1 Tahun - Hitam Rp 4.300.000

GSMArena review/opinions/discussion

Kaskus
Q: Dapat Rom abal abal. Mipad jalan tetapi sering system crash notif. Miui version ndak muncul. Tidak ada developer option. Bootloader device unlock tetapi jika dicek dg pc ternyata lock.
Sudah semua cara sy ikuti untuk unlock bootloader munculnya token salah. Langsung coba flashrom pakai twrp gagal, recovery img tidak terdeteksi, padahal sudah matikan pengenalan info device di windows. Memakai cara miflash tool gagal mengenali.
Adakah petunjuk cara selain test point? Trims
A: Kalau gak mau ribet sih tinggal test point aja gan. Tapi sebelum flashing, Pastikan akun mi ente adalah yg "authorized account"

Ga ada global stable resmi gan, ROM resmi cuma official China aja. Ane pake ROM official China OK ko, ga ada masalah. Tapi sekarang pake Xiaomi EU lebih mantap lagi, ga ada aplikasi China bawaan, semuanya lancarrrrrrr jaya.
---

htcmania
Q: Today I received the Xiaomi MiPad 4 purchased on Aliexpress with the multilanguage room and the Bootloader unlocked, I was going to enter the room xiaomi.eu but getting into settings and going to the installed version I put that is the MIUI BY XIAOMI .EU 10.3 Stable. MIUI 10.3.1.0 (odjcnfi) Android version 8.1.0
This means that it already comes with that room and that I do not have to do anything anymore?
A: It seems that you have the Xiaomi.eu ROM , it remains to be seen if they have installed it by means of the recovery, or they have only booted in recovery to flash the ROM and then continue the tablet with the original recovery of MIUI.
Turn off the tablet and turn it on in the recovery mode. Vol + and power button, when you turn on the tablet you release the power button but continue pressing vol + until you access the recovery. That's when you'll have to check which recovery starts, original, or the TWRP.
If you do not have TWRP, you should install it to continue using the Xiaomi.eu ROM correctly .

Monday, September 1, 2014

Unsolved cases

How to configure Windows Firewall to allow EXPLORER.EXE's outbound connection to LAN but not to Internet