Android development with Sony Z3 Compact
ballikayalar
sevgiinsani
I had a hard time seeing my Sony Z3 Compact Android in the list of Android devices.

Command for listing android devices: "adb devices".

The first thing to do is activating developer options. To do this, navigate to Settings->About phone and tap "Build number" 7 times. "Developer options" appear above "About phone" in the Settings view. This part is easy.

Then, activate USB debugging. To do this, navigate to Settings->Developer options, and check USB debugging. If you do this without PC Companion is installed in your PC, a driver named D5803 will be shown as not installed. So, install PC Companion.

I don't know why but a search for "PC Companion Sony Z3 Compact" brings irrelevant results. Because of this, search for "sony z3 computer tools". There should be a link to the download site of PC Companion.

Make sure that the phone is connected and in USB debugging mode before opening PC Companion. This will install D5803.

After this point, normally you should be able to see the phone listed as a device, but in my case, there was a not about the device being unauthorized. I closed and opened USB debugging and list the devices again. After this, I could be able to see the device normally.

Here is a nice guide to installing apk files using adb:

http://www.droidviews.com/install-apk-files-using-adb-commands/

Real AI
ballikayalar
sevgiinsani
I am fascinated by AI since I was a child. Maybe it began with R2D2 and C3PO.

For about 2 years now, I have been reading and working on AI related fields like machine learning and data mining. The new wave of my interest started with the Personal Assistant application that we developed in my previous company. It continued with the movie recommendation app that I build with two other friends.

Currently I am not working on such an area in my full-time job but I am working about it anyway. I don't see myself as an expert yet I want to learn more about real AI: AI that really understands like a human being. I may be wrong about it but for example extracting connections between things even in a short story is well beyond today's AI. I wonder if I will ever see a time where a program can analyze a novel in a similar fashion to for example Preston Jacobs.

There is an good article on The New Yorker about the subject: Why can't my computer understand me. It gives good examples of why today's approach to AI is nowhere near to lead us to real AI.

Eclipse, web projects, building for tc server on Eclipse and for regular Tomcat server
ballikayalar
sevgiinsani
I tend to forget the configuration required for building a Spring based web project for tc server on Eclipse and for regular Tomcat server because I don't do it frequently.

Here are the important points:
- Download Maven (m2eclipse), pivotal tc server, wtp (Jave EE Developer Tools, Java Web Developer Tools,
Web Developer Tools, XML Editors and Tools, XSL Developer Tools, m2e-wtp Maven Integration for WTP),
Spring Tool Suite (necessary ones, you can exclude Dashboard, tc server (previously installed), etc)

- Open Servers view (Views->Servers) and add the local Tomcat.

- If you import an existing Spring MVC Maven project, it may show an error as "HttpServletRequest cannot be resolved to a type" for jsp files.
 This is because the runtime for the web project is not set to the Tomcat installation where HttpServletRequest resides.
 Fix: Project Properties -> Targeted Runtimes -> select the installed Tomcat server.

- To produce the war file:
    You should add the the servlet-api dependency to pom.xml.
    The scope should be provided. Add it from the tomcat group, not maven's own.
  
       org.apache.tomcat
       servlet-api
       6.0.41
       provided
  


- To be able to use Apache Tomcat 8, change catalina.jar:
    org/apache/catalina/util/ServerInfo.properties file
    "http://stackoverflow.com/questions/17868232/how-to-use-tomcat-8-in-eclipse"
 and set installed facet to at least 2.5 in .settings/org.eclipse.wst.common.project.facet.core.xml.
 You can set to 3.0 for example.

    * Spring throws an exception when async support is not mentioned in web.xml (used in WebSocket apps):    workspace, an exception is thrown when the websocket using page is requested from the browser:
    "Async support must be enabled on a servlet and for all filters".

    To overcome, add "true" to all servlets and filters. web.xml version
    must be 3.0. It is explained here: http://docs.spring.io/spring/docs/current/spring-framework-reference/html/mvc.html -> Servlet 3 Async Config

- Folders after .war is generated:

   Folder and files after maven install
- Folders before .war is generated. It runs on tc server:
Folder and files for tc server

How to convert a project to a Maven (m2eclipse) Project
ballikayalar
sevgiinsani
If an existing project is a Maven project, it should be converted to a m2eclipse project to be able to use m2eclipse utilities. To do this, right-click on the project --> Configure --> Convert to Maven Project.

Only after this, Maven utilities (build, clean, install, etc) are displayed when right-clicked --> Run As is selected.

A nice blog post about consumption provoking lifestyle
ballikayalar
sevgiinsani
http://www.raptitude.com/2010/07/your-lifestyle-has-already-been-designed/

Installing python modules to Windows 8 (64-bit)
ballikayalar
sevgiinsani
Windows installers for modules may need a registry entry of python. Python installer does not create it automatically. Create a registry entry as explained in this site: http://tech.valgog.com/2010/01/after-installing-64-bit-windows-7-at.html

Even if my python version was for 64-bit, I changed the registry as it is changed for 32-bit version, i.e. not under Wow6432Node. It worked for numpy.

I am copying it in case link dies:
#
# script to register Python 2.0 or later for use with win32all
# and other extensions that require Python registry settings
#
# written by Joakim Loew for Secret Labs AB / PythonWare
#
# source:
#
# modified by Valentine Gogichashvili as described in http://www.mail-archive.com/distutils-sig@python.org/msg10512.html
import sys
from _winreg import *
# tweak as necessary
version = sys.version[:3]
installpath = sys.prefix
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
installpath, installpath, installpath
)
def RegisterPy():
try:
  reg = OpenKey(HKEY_CURRENT_USER, regpath)
except EnvironmentError as e:
  try:
      reg = CreateKey(HKEY_CURRENT_USER, regpath)
      SetValue(reg, installkey, REG_SZ, installpath)
      SetValue(reg, pythonkey, REG_SZ, pythonpath)
      CloseKey(reg)
  except:
      print "*** Unable to register!"
      return
  print "--- Python", version, "is now registered!"
  return
if (QueryValue(reg, installkey) == installpath and
  QueryValue(reg, pythonkey) == pythonpath):
  CloseKey(reg)
  print "=== Python", version, "is already registered!"
  return
CloseKey(reg)
print "*** Unable to register!"
print "*** You probably have another Python installation!"
if __name__ == "__main__":
RegisterPy()
or just inject the following REG file into your registry if you are using python 2.6 installed in C:\Python26 directory

1
2
3
4
5
6
7
8
9
10
11
12
13
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Python]
[HKEY_CURRENT_USER\Software\Python\Pythoncore]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6]
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\InstallPath]
@="C:\\Python26"
[HKEY_CURRENT_USER\Software\Python\Pythoncore\2.6\PythonPath]
@="C:\\Python26;C:\\Python26\\Lib\\;C:\\Python26\\DLLs\\"

I changed the version to my python version and used the second method.

Injecting registry entry is simple. Just save the lines to a text file with .reg extension and double-click it.

The worst mistake in the history of the human race
ballikayalar
sevgiinsani
http://www.ditext.com/diamond/mistake.html
http://www.nytimes.com/2013/10/23/opinion/bittman-now-this-is-natural-food.html?_r=0&adxnnl=1&ref=opinion&adxnnlx=1382525110-00zAc3VYZs6Qnh1g8dJNyA

which command equivalent in Windows
ballikayalar
sevgiinsani
WMIC /OUTPUT:C:\ProcessList.txt PROCESS get Caption,Commandline,Processid

Open C:\ProcessList.txt. It should contain the command-line parameters etc.

Serendipity vs safety
ballikayalar
sevgiinsani
A good article about loss of chance element in life by Frank Bruni of NY Times:

http://www.nytimes.com/2013/09/03/opinion/bruni-traveling-without-seeing.html?ref=frankbruni&_r=0



Opening google maps in AVD and a few basic commands
ballikayalar
sevgiinsani
First, we need to have an AVD created with Google APIs.

It is done from Android SDK Manager.Install an SDK that suits with Google APIs.

You can either create a new AVD with our new SDK or edit an existing one and set the SDK to the version (target) to Google APIs - API Level .

Then you may need to install the files com.android.vending_2.2.6.apk and com.google.android.gms-1.apk.

I installed thos apks to an AVD which did not have Google APIs. The Google Maps app did not appear. Later, I changed the target as explained above. Google Maps appeared after the change. So, I am not sure whether Maps is installed by default.

Install command is: adb install com.android.vending-1.apk

Here is a tutorial for developing an app that uses maps: http://www.javacodegeeks.com/2011/02/android-google-maps-tutorial.html

Not related to the issue above, I wanted give some basic commands to work with AVDs.

android list targets
monitor: opens DDMS tool
emulator -avd htc_desire_s (or “emulator -avd -partition-size 500 -no-audio -no-boot-anim)
adb -s shell: serial number is the code given when "adb devices" is run. For this to run the AVD, that AVD should be started using emulator command.
adb devices: shows the serial numbers of the currently running emulators or connected real android devices.

?

Log in