четвъртък, 30 декември 2010 г.

How to install android apps without market

Ok, I have a new phone SE X8, because my LG Arena is being repaired (hopefully). This one has Android OS. First - I struggled to update Android trough Wine and in the end, I needed to use my virtual windows to do so. And it was very annoying, because I needed to manually load the usb from the top menu of the machine. Very stupid. Anyway, now it's updated.
My next problem was how to install anything without a Google account. Of course, I have Gmail account, it's not the point. My problem is that I don't see ANY reason to connect my gmail account with my phone, since phones are easily lost or stolen and I really don't want my gmail account falling into wrong hands. Not that I have very sensitive information in it, I try to delete such stuff immediately. But still, this is my default email and I really don't want it jeopardized.
My other problem is that your license agreement with Android market involves agreement that Google has the right to REMOVE any application from YOUR phone that it finds bad for you. In any way. That's obviously wrong and I would never agree to this provided I have the choice.
Well, it turned out that I actually have that choice.
So to install apps without Market:
0. From your phone settings menu, choose "Applications" -> Unknown sources (allow apps which are not from Market) -> Allow. (source)
1. Find sites with apps you can download without barcodes or other Google shit. Good start is: androidfreeware.org and http://google-androids.ru or http://www.brothersoft.com/mobile and http://getandroidstuff.com/ 
2. Download whatever you like. Remember that those apps were not checked by the careful eye of Google, so do it with caution and check comments and so on to be sure the app is safe. And don't download anything connected with financial stuff.
3. Now that you have all the apps, you need an android file manager to install them on you phone. How to install it without market? Easily!
4. Connect your phone to Internet using wireless or gprs or 3g or whatever.
5. Open default browser, type one of the urls above and download a file manager. When the download is complete, click/tap over the file (in the download window) and it will ask you whether to install. Say YEAH and now you have a file manager.
6. Use your newly installed file manager to install all the other apps that you transfered to a folder on your phone using USB cable (or bluetooth).
7. You can avoid the use of computer if you're a fan of browsing trough your phone - simply connect to wireless (or cheap net) and browse trough those sites with your default browser. Download whatever you like and when the download is complete choose "install". And that's it.
Now you can download and install whatever you like without the annoying interference of Market. Just don't forget that apps on Market are generally safer than other sources. And if you "root" your phone, Google probably won't be able to remove your apps. But I really don't want to give my gmail account so I prefer to do it this way.
As to my X8, I actually like it, except for the lousy camera without flash, but otherwise, it's quite nice phone.

четвъртък, 23 декември 2010 г.

Script to find and replace text in multiples files

Ok, I wanted to find a way to edit multiple files (mostly html files) for my site, finding and replacing certain text in them. Here's my progress so far. Please, don't laugh at my efforts, I'm not a bash programmer, I know how to do basic stuff, but this is not my job, not even my hobby. So, if there is simpler and more obvious way - just let me know.
I used following resources: site 1 and site 2 to produce following script: 

#!/bin/bash
     for fl in *.txt; do
     mv $fl $fl.old
     sed "s/$1/$2/g" $fl.old > $fl
     rm -f $fl.old
     done

What it does is to look for a certain string $1 in all the txt files in the directory and to replace it with $2, where you start the script with
sh name.sh $1 $2
where you put the strings $1 and $2 in ' '.
It works beautifully and replaces the strings as it's supposed to. My major
problem with it is that the strings aren't supposed to include "/" in them. Which when you edit an html file is bad. If you want to use that character, you need to "escape" it with "\" meaning that '</div>' will have to become '<\/div>'. I wanted to make a script that will do that automatically, but so far without success. But still, you can easily replace a line with other one or two using this script. And that was the point so. Cheers.
P.S. For more useful info on "sed" look here.

неделя, 19 декември 2010 г.

How to use Alcatel One Touch X220L 3G modem in Linux

Thanks to the many and extremely unnerving problems with my Internet connection, we decided to get a 3G/HSPA USB modem, for backup. Of course, all the installation files are for Windows, so I had to Google for a solution. I found this Ubuntu HOWTO that helped me connect to Internet with the USB device.
Without getting in details, here's what I did:
Plug-in your device and type:
>$sudo lsusb
Look for a line looking like this:
>$Bus 001 Device 003: ID 1bbb:f000 T & A Mobile Phones

If you have "f000" part, then you need to install a program that will switch it to "0000".
1. Install usb_modeswitch. Sabayon Linux had it in Entropy, but you may need to download it.
2. Configure usb_modeswitch ( >$sudo nano /etc/usb_modeswitch.conf ) adding the lines:
########################################################
# Alcatel X220L

DefaultVendor=  0x1bbb
DefaultProduct= 0xf000

TargetVendor=   0x1bbb
TargetProduct=  0x0000

# only for reference
# MessageEndpoint=0x01

MessageContent="55534243123456788000000080000606f50402527000000000000000000000"
########################################################

Save and plug the device again.
3. >$sudo usb_modeswitch


4. Look at your syslog ($dmesg|tail), you should now see:
"..... Direct-Access USBModem MMC Storage 2.31 PQ: 0 ANSI: 2 "

5. Start the driver for the modem
>$sudo modprobe usbserial vendor=0x1bbb product=0x0000

In >$dmesg|tail you should now see:

Jul 11 10:24:16 eee-yard kernel: [  100.388222] usb 1-2: configuration #1 chosen from 1 choice
Jul 11 10:24:16 eee-yard kernel: [  100.390492] usbserial_generic 1-2:1.0: generic converter detected
Jul 11 10:24:16 eee-yard kernel: [  100.390658] usb 1-2: generic converter now attached to ttyUSB0
Jul 11 10:24:16 eee-yard kernel: [  100.390952] usbserial_generic 1-2:1.1: generic converter detected
Jul 11 10:24:16 eee-yard kernel: [  100.391068] usb 1-2: generic converter now attached to ttyUSB1
Jul 11 10:24:16 eee-yard kernel: [  100.394230] scsi4 : SCSI emulation for USB Mass Storage devices
Jul 11 10:24:16 eee-yard kernel: [  100.395689] usbserial_generic 1-2:1.3: generic converter detected
Jul 11 10:24:16 eee-yard kernel: [  100.395847] usb 1-2: generic converter now attached to ttyUSB2
Note the last number where your usb puts the modem, in my case, it was USB4.
To check it, just enter:
>$screen /dev/ttyUSB4

and at the prompt, ask the modem to identify itself typing:
>ATI
The answer should be:
>Manufacturer: TCT Mobile International Limited
Model: HSPA Data Card
Revision: C1111000
IMEI: 352079030611766
+GCAP: +CGSM,+DS,+ES


If you want to automate this, you can add the rules with >$sudo nano /etc/udev/rules.d/50-alcatel.rules adding

SUBSYSTEM=="usb", SYSFS{idProduct}=="f000", SYSFS{idVendor}=="1bbb", RUN+="/usr/sbin/usb_modeswitch"
SUBSYSTEM=="usb", SYSFS{idProduct}=="0000", SYSFS{idVendor}=="1bbb", RUN+="/sbin/modprobe usbserial vendor=0x1bbb product=0x0000"

Check where usb_modeswitch is, mine was in "/usr/sbin", but if it's not there, use the appropriate directory.

Connecting the modem with wvdial:

1- Remove the PIN of your SIM

2- >sudo wvdial

But first,
>$sudo gedit /etc/wvdial.conf - here is my file, which works with VIVACOM Bulgaria, for TIM Italy, check the source.

[Dialer Defaults]
Init1 = ATZ
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Init3 = AT+CGDCONT=1,"IP","internet.vivacom.bg"
Modem = /dev/ttyUSB4
Check Def Route = on
Phone = *99#
Username = VIVACOM
Password = VIVACOM
Modem Type = Analog Modem
Stupid Mode = 1
Baud = 460800
New PPPD = yes
ISDN = 0
AutoDNS = 1

You should change init3 and User and Password with those given by your providers.

Once you created the file, just run wvdial (or in my case, >$sudo wvdial...) and that's it. You'll receive some messages but after you see you DNS, everything is ready for browsing!
Enjoy!

сряда, 15 декември 2010 г.

HOWTO change your File Associations

Ok, since I installed Calibre, I have serious problem with files I opened with kwrite, which now Calibre decides to be eBooks and tries to open them and add them to its database. That's obviously extremely annoying when all you want is to open your text file and edit it.
With simple associations like text files, I dealt easily clicking with the right button the txt files and telling KDE that I want kwrite to be my default application. Same happened also for .tex files. So these are fixed.
I have serious problem with .job files and .mw files which sometimes KDE remembers to open with kwrite, but sometimes doesn't. So I needed to find where KDE(and Linux as a whole) stores its file associations and to change them. Here's what I found.
1.) /usr/share/applications/defaults.list
-- I didn't have that file, but you can see all of your .desktop files in the directory.
2.) /usr/share/applications/mimeinfo.cache
-- Here you can find all the file associations and this is the file you must edit.
3.) ~/.local/share/applications/mimeapps.list
-- Not complete list of the associations, you might want to check/edit that file too, just to make sure everything is correct.


Edit the files:
$ sudo gedit /usr/share/applications/defaults.list
or if you like me don't have the above file:
$ sudo gedit /usr/share/applications/mimeinfo.cache
and also
$ gedit ~/.local/share/applications/mimeapps.list
Find the place that interests you, in my case any mentioning of Calibre. Find those lines (with ctrl+f) and then reorder the applications:
For example:
text/plain=calibre-ebook-viewer.desktop;calibre-gui.desktop;writer.desktop;kde4-kwrite.desktop;
should become:
text/plain=writer.desktop;kde4-kwrite.desktop;calibre-ebook-viewer.desktop;calibre-gui.desktop;
Just make sure, the application you want to open that file type is the first in the row. If you want to add application that you don't see in the row, look for its name in " /usr/share/applications/" (it will be something.desktop) and write that name.
Do that on all the places where your application occur in the file or to all file types you want to reorder.
Save and exit. Don't forget that after each application in the row, you need to put semi-colon! And also in the end of each line!
"Step 4:
Final step, and yes it's easy :-). All you have to do now is make your changes final. I have yet to find another...simply just logout then back in to see the fantastic changes." (source)


Enjoy!

петък, 3 декември 2010 г.

How to enable tapping on Synaptic Touchpads

Today I discovered I cannot tap on my touchpad. Don't ask how come I didn't realist that earlier, I just didn't.
So, here's the solution as suggested by Sabayon Wiki. It's in Italian, for unknown reasons.
So, it turns out, you need to add few lines to /etc/X11/xorg.conf
Before you proceed, make a backup of xorg.conf, because we all know how easy it is to mess things up.
So
sudo cp xorg.conf xorg.conf.bck
sudo nano xorg.conf
After the end of your Device section, paste the following new section:

Section "InputDevice"
        Identifier "Synaptics Touchpad"
        Driver "synaptics"
        Option "AlwaysCore" "true" # send events to CorePointer
        #Option "Device" "/dev/input/mice"
        Option "Device" "/dev/psaux"
        Option "Protocol" "auto-dev"
        Option "SHMConfig" "false" # configurable at runtime? security risk
        Option "LeftEdge" "1700" # x coord left
        Option "RightEdge" "5300" # x coord right
        Option "TopEdge" "1700" # y coord top
        Option "BottomEdge" "4200" # y coord bottom
        Option "FingerLow" "25" # pressure below this level triggers release
        Option "FingerHigh" "30" # pressure above this level triggers touch
        Option "MaxTapTime" "180" # max time in ms for detecting tap
        Option "VertEdgeScroll" "true" # enable vertical scroll zone
        Option "HorizEdgeScroll" "true" # enable horizontal scroll zone
        Option "CornerCoasting" "true" # enable continuous scroll with finger in corner
        Option "CoastingSpeed" "0.30" # corner coasting speed
        Option "VertScrollDelta" "100" # edge-to-edge scroll distance of the vertical scroll
        Option "HorizScrollDelta" "100" # edge-to-edge scroll distance of the horizontal scroll
        Option "MinSpeed" "0.75" # speed factor for low pointer movement
        Option "MaxSpeed" "4.50" # maximum speed factor for fast pointer movement
        Option "AccelFactor" "0.0020" # acceleration factor for normal pointer movements
        Option "VertTwoFingerScroll" "true" # vertical scroll anywhere with two fingers
        Option "HorizTwoFingerScroll" "true" # horizontal scroll anywhere with two fingers
        Option "EmulateTwoFingerMinZ" "120" # this may vary between different machines
        Option "TapButton1" "1"
        Option "TapButton2" "2"
        Option "TapButton3" "3"
EndSection


Also, add in the section ServerLayout a line, so that it becomes:
Section "ServerLayout"
        ...
        ...
        InputDevice "Synaptics Touchpad" "SendCoreEvents"
EndSection


Save (ctrl+o) and exit (ctrl+x).
You'll need to restart xorg.conf in order for the changes to take effect. To do that use your favorite way to restart X or simply Reboot. If something's not working, just use your old xorg.conf. Also, take a look in the example xorg.conf in the source page to make sure that you pasted the lines on the right place.