Showing posts with label develop. Show all posts
Showing posts with label develop. Show all posts

March 23, 2013

[SOLVED] Fixed PHP Warning: Module 'apc' already loaded in Unknown on line 0

You are getting this message "[SOLVED] Fixed PHP Warning:  Module 'apc' already loaded in Unknown on line 0"

every time you execute the php in your console.

It means that you have already activated the apc.so extension.

You must check the second module activation.

Here you can find the apc.ini config file
$ locate apc.ini 
/etc/php5/conf.d/20-apc.ini
/etc/php5/mods-available/apc.ini

Now locate php.ini files and check them for uncommented "extension=apc.so" line
$ locate php.ini
/etc/php5/apache2/php.ini
/etc/php5/cgi/php.ini
/etc/php5/cli/php.ini

check files for uncommented "extension=apc.so"
$ cat /etc/php5/apache2/php.ini | grep apc.so
;extension=apc.so

Here you found it
$ cat /etc/php5/cli/php.ini | grep apc.so
extension=apc.so

 

Edit the file
 sudo vim /etc/php5/cli/php.ini

and add ";" before "extension=apc.so"

save it and you are done

 

Source: http://blog.ciuly.com/my-server/php-warning-module-apc-already-loaded-in-unknown-on-line-0/

 

 

 

August 3, 2012

[SOLVED]Connect Nexus 7 and/or Galaxy Nexus to ubuntu

You want to develop on your new shiny Nexus 7 and
adb devices

keeps giving you
???????? device

oprn your rules file
gksu gedit /etc/udev/rules.d/51-android.rules

probably you will see following line (if you already configured your Galaxy nexus) If not add it to the file, just in case
SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0666", OWNER="YOUR_USER_ID"

Now we should get the idVendor and idProduct from the Nexus 7. Connect it to your computer and
lsusb

you will see something like
Bus 001 Device 013: ID 18d1:4e42 Google Inc.

we need this two values

paste this string with proper values to 51-android.rules
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e42", MODE="0666", OWNER="YOUR_USER_ID"

Save the file. Do the
sudo service udev restart

Now run
adb devices

you should see your device
List of devices attached
015d172c98280c0b device

Happy developing

Source: http://govfate.iteye.com/blog/1608379

February 1, 2011

[SOLVED] SQLite Single quotes in the query expression

A string constant is formed by enclosing the string in single quotes ('). A single quote within the string can be encoded by putting two single quotes in a row - as in Pascal. C-style escapes using the backslash character are not supported because they are not standard SQL


 

Source: sqlite.org.

January 12, 2011

[SOLVED] Android: Handling gzipped content while downloading

On file download you can check the content type and if its gzipped - unzip it on the fly:

URLConnection connection = url.openConnection();
InputStream stream = connection.getInputStream();
if ("gzip".equals(connection.getContentEncoding())) {
stream = new GZIPInputStream(stream));
}


Source: stackoverflow.com

September 12, 2010

[SOLVED] Use github repository under windows with tortoisegit


Generate public and private ssh keys:

Just open "putty key generator" and generate (1) your key by moving your mouse on the surface.
Than wite some comment(2) and secure it with random passphrase (3).
Than save public and private key part on your file system.

Copy ssh-rsa key from "Public key for parsing into OpenSSH authorised_keys file:"- text field (you will need it for the next step)



Adding the key to your GitHub account:

Use this  tutorial http://help.github.com/msysgit-key-setup/

Use Pageant for auto authorisation:

If you dont want to put every time your ssh key password use Pageant. Just start it and add your private key



Get GitHub repository url:

Goto to desired project and copy git url from it:
For example: on http://github.com/stuttgart-gtug/help-me it will be "git@github.com:stuttgart-gtug/help-me.git"



Clone aka "Check Out" the repository:

Now create a folder on your PC and hit right mouse button on it - choose "Git Clone..."



In next dialog put the URL of git repository and choose path to your private github key you generated before.



Now push "OK" and enjoy the ride



Voilà ;)

July 17, 2010

[SOLVED]How customize/extend/ Spinner

You will need to take control over what goes into the ListView and
Spinner. I have not experimented with these techniques on Spinner, but
on ListView, you will need to override getView() (on ArrayAdapter) or
newView() and bindView() (on CursorAdapter).
Here is a free excerpt from one of my books that demonstrates the technique:

http://commonsware.com/Android/excerpt.pdf

In your case, you would use your Typeface object to update the font used
by the TextView widgets in your rows.

In principle, you could do this via a wrapping adapter -- this would be
more reusable but a bit slower. I have an AdapterWrapper base class here:

http://github.com/commonsguy/cwac-adapter

and some projects that use it here:

http://github.com/commonsguy/cwac-endless
http://github.com/commonsguy/cwac-thumbnail


You also need to override getDropDownView().

Source: How to change the Typeface of ListView and Spinner - Android Beginners Google Groups.

July 7, 2010

[SOLVED] Edit SQLite database of your app from your PC

Very nice solution to browse and edit the SQLite database file of your app directly from your PC.

  1. Download

  2. Set right path in settings.ini

  3. start it


java -jar AndroidDBEditor.jar


Or you can create small batch file AndroidDBEditor.bat
@echo off
rem set current path
set CURRENT_PATH=%~dp0

rem replace slashes
set CURRENT_PATH=%CURRENT_PATH:\=/%

echo sqliteeditorpath=%CURRENT_PATH%sqlitebrowser.exe > settings.ini
rem start app
java -jar AndroidDBEditor.jar

Android DB Editor - troido.de its all about android.

May 2, 2010

[Solved] Android: Check if SD card is present



  1. public static boolean isSdPresent() {

  2. return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);

  3. }




Source: Android Snippets: Check if SD card is present.

August 17, 2009

[SOLVED]Eclipse and .svn Android AIDL Problem



Today after adding my android project to svn repository I got

syntax error    entries /src/.svn  line 1  Android AIDL Problem

After searching internet for solutions I installed subversion plug-in (did not helped) but this...

It is worked for me:

  • Delete your project from eclipse (not from disk).

  • "File"->"New.."->"Project"->"Android Project"

  • in "New Adroid Project"-Dialog selected "create project from existing source" (find your project on HDD)->"Finish"


my .classpath-file
<?xml version="1.0" encoding="UTF-8"?><classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
<classpathentry kind="output" path="bin"/></classpath>

June 23, 2009

Using a Horizontal Progress Bar in Android

"I was working on my Android downloader application yesterday, when I ran into a bit of a snag. I wanted to display a list of downloads (similar to the Firefox downloads window). Each item in the list should show the file name and a horizontal progress bar. I started to implement this, and several hours later stumbled upon the archaic solution. I wanted to share this, both to help anybody who may be trying to do something similar, and also to illustrate how the lack of good documentation is hurting aspiring Android developers.

I thought that I could put a ProgressBar instance in my xml, set it to be indeterminate, give it a max and a value, and be done. However, it wasn't nearly that easy. After a few hours of hunting on Google and the Android Groups, I stumbled upon the solution in an online preview of The Busy Coder's Guide to Android Development. In short, I had to set the following on my ProgressBar's XML:
style="?android:attr/progressBarStyleHorizontal"

WTF?

" http://bytecrafter.blogspot.com/2008/12/using-horizontal-progress-bar-in.html

to get horizontal progressbar just put

<ProgressBar
android:id="@+id/ProgressBar01"
android:indeterminateOnly="false"
android:progressDrawable="@android:drawable/progress_horizontal"
android:indeterminateDrawable="@android:drawable/progress_indeterminate_horizontal"
android:minHeight="20dip"
android:maxHeight="20dip" android:layout_width="fill_parent"></ProgressBar>


into your \res\layout\main.xml

May 6, 2009

I got an error saying "This client is too old to work with working copy '...' ". How can I fix it without upgrading Subversion?

"Sometimes the working copy metadata format changes incompatibly between minor releases. For example, say you have a working copy created with Subversion 1.4.4, but one day you decide to try out Subversion 1.5.0. Afterwards, you attempt to switch back to 1.4.4, but it doesn't work — it just gives the above error.

This is because 1.5.0 upgraded your working copy format to support some new features (in this case, changelists, the keep-local flag, and variable-depth directories). Although 1.4.4 doesn't know anything about these new features, it can at least recognize that the working copy format has been upgraded to something higher than it can handle.

1.5.0 upgraded the working copy for a good reason: it realizes that 1.4.4 does not know about these new features, and that if 1.4.4 were to meddle with the working copy metadata now, important information might be lost, possibly causing corruption (see issue #2961, for example).

But this automatic upgrade behavior can be annoying, if you just want to try out a new release of Subversion without installing it permanently. For this reason, we distribute a script that can downgrade working copies when doing so is safe:

http://svn.collab.net/repos/svn/trunk/tools/client-side/change-svn-wc-format.py

Run that script with the "--help" option to see how to use it. As future versions of Subversion are released, we will try to keep this FAQ entry up-to-date with potential downgrade scenarios and their implications." subversion.tigris.org

March 16, 2009

How To Install Firebug In Browsers Other Than Firefox

"Firebug Lite makes it possible to put Firebug into any web browser! You should be able to use it with Internet Explorer, Opera, Safari, Chrome, and any other browser that supports JavaScript. Firebug Lite is written in JavaScript, so you can include it on a webpage with the following code:



Or even better you can use this bookmarklet:

Firebug Lite" makeuseof.com

March 12, 2009

Learn CSS Positioning in Ten Steps

"This tutorial examines the different layout properties available in CSS: position:static, position:relative, position:absolute, and float." barelyfitz.com

January 12, 2009

Useful XUL links

  • Eclipse Plugin http://eclipsexul.sourceforge.net/update-site
  • Firefox Plugins
  • Extension Developer http://ted.mielczarek.org/code/mozilla/extensiondev/ https://addons.mozilla.org/en-US/firefox/addon/7434
  • Chrome List http://www.gijsk.com/mozilla/chromelist/ https://addons.mozilla.org/en-US/firefox/addon/4453

December 30, 2008

MySQL migration: MyISAM to InnoDB

"Change TYPE=ISAM to TYPE=INNODB

The second step is to edit the db1.sql dump file with a text editor and change the table type to InnoDB. Make of copy of the dump file before you edit it in case you need to restore it later. Here is a sample table definition:

CREATE TABLE audience_def (
AUDIENCE_NO int(10) unsigned NOT NULL auto_increment,
DESCRIPTION varchar(150) default NULL,
STATUS varchar(10) default NULL,
PRIMARY KEY (AUDIENCE_NO)
) TYPE=ISAM;

For each table definition in the dump file, change the TYPE=ISAM to TYPE=INNODB. If your database is very large, the dump file may be too large to fit in your text editor. If so, you can use a batch editor like sed to make the changes." linux.com

October 29, 2008

SOLVED: tortoise(svn) + putty(ssh) + pageant = no password input needed

"Lets do this step by step:

- login to your server
- type: ssh-keygen -b 1024 -t dsa -N passphrase -f mykey
- change "passphrase" to a secret keyword only you know
- type: ls -l mykey*

We just created a SSH2 DSA key with 1024 bit keyphrase. You will see two files. One named "mykey" and one named "mykey.pub". As you might guess, the .pub file is the public key file, the other is the private one. Next create a user on the server with a home directory:

- type: useradd -m myuser

You will have a directory under /home with the name "myuser", create a new directory in "myuser" called ".ssh":

- type: cd /home/myuser
- type: mkdir .ssh

Then go to the directory where you created your keys and copy the public key to the .ssh userfolder with the following command:

- type: cp mykey.pub /home/myuser/.ssh/authorized_keys

or if you already have some keys in place

- type: cat mykey.pub >> /home/myuser/.ssh/authorized_keys

Please pay attention to the filename, it really must be "authorized_keys". In some old OpenSSH implementations, it was "authorized_keys2". Now download the private key file to your client computer. Remember, the file was "mykey"

------------------------------------------------------------
SSH key generation and connection check (client)
------------------------------------------------------------
Grab the tools we need for doing SSH on windows on this site:
http://www.chiark.greenend.org.uk/~sgtatham/putty/

Just go to the download section and get "Putty", "Plink", "Pageant" and "Puttygen"

In order to use the private key we get from the server, we have to convert it to a putty format. This is because the private key file format is not specified by some standard body. To do this we simple open "puttygen" and open the "conversions" menu and chose "Import Key". Then browse to your file "mykey" which you got from the server enter your provided passphrase upon creation of the key. Finally click "Save private key" and save the file as "mykey.PPK" somewhere on disk.

Now we are ready to use this key for the first time to test the connection. In order to do this, we open the program "putty" and create a new session like this:

Session->HostName: Hostname or IP Adress of your server
Session->Protocol: SSH
Session->Saved Sessions: MyConnection
SSH->Prefered SSH Protocol version: 2
SSH->Auth->Private Key file for auth: $PATH$\mykey.PKK (replace $PATH$ with real path to the mykey.PKK file)

Then go back to Session tab and hit "save" button. You will see "MyConnection" in the list of available connections." tortoisesvn.net