Monday, September 4, 2017

Getting ADB Working for SPH-M840

Had a SPH-M840 Galaxy Ring Virgin Mobile 3G Android version 4.1.2, attempting to install apps from Android Studio failed to detect device.

Installed SAMSUNG_USB_Driver_for_Mobile_Phones.exe (see https://androidforums.com/threads/usb-drivers.537433/ for link)
and also Kies3Setup.exe (install Kies) when the first didn't work, i.e. wasn't found when trying to update driver via Windows 7 Device Manager per https://developer.android.com/studio/run/oem-usb.html#Drivers. Kies failed to detect it either.

Sometime after however, SAMSUNG Android Phone and SAMSUNG Android ADB Interface appeared in the Device Manager, and I was able to run app and install apk on the phone.

Saturday, August 19, 2017

Setting oracle user password to same password

Followed this blog: http://www.dbas-oracle.com/2013/04/Keep-Same-Password-for-Oracle-User-when-Expiry-Time-Reached.html

First off caveat emptor regarding disabling Oracle security features by following the steps in this and the referenced blog.

On Windows Server 2008, hit Windows button and enter sqlp, then enter.
SQL> connect / as sysdba
SQL>select username, profile from dba_users where username = 'SOMEUSERNAME';
USERNAME ----...---PROFILE
------------------------------------
SOMEUSERNAME....DEFAULT
SQL>alter profile DEFAULT limit password_verify_function null;
Profile altered.
SQL>alter user someusername identified by somepassword;
User altered.
After this user should be able to log in using the same password without the ORA-28002 error.

Saturday, July 22, 2017

Replacing ROM on Ally LG VS740

Needed to put a new rom to get at least Android 2.3.4 so I can deploy apps via Android Studio; also to fix annoying issue with Car Home being triggered by faulty wire connection somewhere...

Followed https://forum.xda-developers.com/showthread.php?t=2330806

Performed the following steps (do at your own risk):

Wait for a couple hours or more for phone to cool down.
download VPT-Gingerbread-for-LG-Ally-RC1.zip and put on sd card, insert card in phone
download platform-tools-latest-windows.zip
C:\Tools\android\platform-tools-latest-windows\platform-tools>adb version
Android Debug Bridge version 1.0.39
Revision 3db08f2c6889-android
Installed as C:\Tools\android\platform-tools-latest-windows\platform-tools\adb.e
xe
setttings > applications > development > USB debugging enable
C:\Tools\android\platform-tools-latest-windows\platform-tools>adb devices
List of devices attached
A00000218BE8A4  device
C:\Tools\android\platform-tools-latest-windows\platform-tools>adb install Ginger
Break-v1.20.apk
Open Ginger Break, and root device
C:\Tools\android\platform-tools-latest-windows\platform-tools>adb install root-c
hecker-5-0-5-en-android.apk
open root check and verify root access
C:\Tools\android\platform-tools-latest-windows\platform-tools>adb install com.ko
ushikdutta.rommanager-5.5.3.7-5537-minAPI8.apk
Recovery Set up
Clockwork mod recovery
select LG Ally
Flash ClockworkMod Recovery
Reboot into recovery
down volume button and select backup and restore
press OK button on popout keypad
press OK for backup
hit back button (top left button of slide-out keyboard) until you reach first menu
select wipe data
install zip from sd card
choose zip from sd card
select VPT-Gingerbread-for-LG-Ally-RC1.zip
confirm
select reboot system
did follow up steps here, but still having problems with system trying to run car home
powered down, and copied some more roms to the sd card
hold down Volumn down, Send (button to left of home), menu, and end (power button) until LG shows then
release to get ClockworkMod Recovery v2.5.07 menu
wipe user data
wipe cache partition (didn't do this the first time around. was it needed?)
then as before choose a zip rom to install
choose VPT-Gingerbread-for-LG-Ally-Beta.zip
reboot
so the car home problem seems to have gone away, must have been due either to the stripped down beta or to the dalvik cache wipe, that fixed it. See https://android.stackexchange.com/questions/179585/ally-phone-voice-search-problem/179594#179594
so went into rom manager and reboot into recovery then reinstalled the above RC1 rom.
So far so good, no system crashing yet, again in the Viewpoint Technologies RC1 rom, from overheating causing the car home to try to start, so it must have been the cache causing that.

Sunday, April 9, 2017

Testing WTC EJB via other WL Instance

Picking up from http://awgjournal.blogspot.com/2017/04/testing-wtc-endpoint.html where I successfully set up the samples to connect from a local Tuxedo to the TOLOWER ejb service, I now wanted to unit test the ToLower EJB via another WebLogic instance as described at https://community.oracle.com/thread/817839?db=5 This is so that I can test using a Java client as opposed to a C++ Tuxedo client.

I made a copy of C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpapp as C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpappwl2wl

Then went in and made changes:

1) change files to point the ToLower remote service rather than the ToUpper
2) change paths to point to a different instance -- a WebLogic 11G instance instead of the 12C instance that's hosting the ToLower service.
3) remove references to Tuxedo since this client app will not use it

The diffs are at https://gist.github.com/awgtek/fa6241219b085799574cf3d4f80ea3e9

I changed to and ran
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpappwl2wl>setExamplesEnv.cmd
> ant ejb
I needed to install the EJB jar from the console because autodeploy didn't pick it up from C:\Oracle\Middleware\user_projects\domains\base_domain\autodeploy.
> ant compile.client

Then I set up the WTC access points. I had already started the WL 11G server from eclipse. I loaded http://localhost:7003/console/ created a new WTC Server. Created a local access point: Access Point Name: LocalAccessPoint-0  Access Point ID: TDOM3 network address: //192.168.56.1:5671
created a remote access point: Access Point: RemoteAccessPoint-0  Access Point ID: TDOM2  Local access Point: LocalAccessPoint-0  network Address: //192.168.56.1:5678 (which is the TDOM2 acess point configured on the 12C server).
Created an Imported resource: TOLOWER  Local access Point: LocalAccessPoint-0  Remote Access Point List: RemoteAccessPoint-0 (remote name: blank)

Then on the WebLogic 12C server localhost:7001/console, I added another remote access point: Access Point: RemoteAccessPoint-0  Access Point ID: TDOM3 local access point: MyLclAccessPt  network address: //192.168.56.1:5671  (192.168.56.1 is a localhost virtual IP)
Then I added the TDOM3 local access point name of the other server as a user just as I had added the TDOM1 Tuxedo domain name as a user under Security Realms, Users and Groups, assigning it the administrators group.

back in the command prompt:
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\exampl
es\wtc\atmi\simpappwl2wl>ant simpapp
Buildfile: build.xml

simpapp:

run_client:
     [java]
     [java] Beginning statefulSession.Client...
     [java]
     [java] Creating Toupper
     [java]
     [java] converting HelloWorld
     [java] converted to: helloworld
     [java]
     [java] End statefulSession.Client...
     [java]

BUILD SUCCESSFUL
Total time: 4 seconds

And Eclipse outputted in the console:
tolower called, converting HelloWorld
About to call tpcall
tpcall successfull!



Saturday, April 8, 2017

Testing WTC Endpoint

Following samples in https://docs.oracle.com/middleware/1212/wls/WTCCF/samples.htm#WTCCF300 to gain an understanding of what's required.
Downloaded wtc_90.jar and extracted wtc folder to C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples
(note: needed to quickstart again to install the samples to wlserver. Should have selected "with samples" when initially installing WebLogic).

Started weblogic 12.2.1.1 via eclipse (with Oracle WebLogic Server Tools but could have also used oepe eclipse download from Oracle) server config with domain home set to C:\Oracle\12c\Middleware\Oracle_Home\user_projects\domains\wl_server.
Downloaded Tuxedo and updated C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp\setenv.cmd to be:
set TUXDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010
rem set WSNADDR=<address of the server; only if this is a workstation client>
set APPDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp
set PATH=%TUXDIR%\bin;%APPDIR%;%PATH%
set TUXCONFIG=%APPDIR%\tuxconfig
Opened command window to C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\samples\atmi\simpapp\. 
Ran setenv.cmd.
change to and ran  C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\setExamplesEnv.cmd
changed to C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv

ran ant. got error: C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv\build.xml:6: java.lang.IllegalArgumentException: Malformed \uxxxx encoding.
Updated C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples.properties replacing \ with / for properties examples.home.dir and examples.domain.dir.

ran ant got error:
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\examples\wtc\atmi\simpserv\build.xml:129: Problem: failed to create task or type wlappc
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.

Inserted a task def above the appc target - at line 124:
  <property name="wls_root" value="C:/Oracle/12c/Middleware/Oracle_Home" />
  <property name="wls_home" value="${wls_root}/wlserver" />
  <path id="wls.classpath">
    <fileset dir="${wls_home}/modules">
      <include name="*.jar"/>
    </fileset>
  </path>

<taskdef name="wlappc" classpathref="wls.classpath" classname="weblogic.ant.taskdefs.j2ee.Appc"/>

Ran ant.
This time it got pas the deploy task and failed at the buildclient.
opened http://localhost:7001/console/ and clicked deployments. There were four pages of sample deploymets. Went to last page and verified that wtc_tolower was deployed.
The fail messages was:
compile.client:
     [copy] Copying 4 files to C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010\sampl
es\wtc\simpserv
     [exec] 'cl' is not recognized as an internal or external command,
     [exec] operable program or batch file.
     [exec] NLS:4: Cannot open message catalog TUXNT_CAT, set 1, num 77; check T
UXDIR=C:\Oracle\Tux\Middleware\tuxedo11gR1_VS2010, LANG=English_United States.12
52

BUILD FAILED
C:\Oracle\12c\Middleware\Oracle_Home\wlserver\samples\server\examples\src\exampl
es\wtc\atmi\simpserv\build.xml:153: exec returned: 1

Installed Visual Studio 2007 Community selecting C++ options, then ran "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64

Ran ant. Build Successful.
in simpserv, modified both CreateWTCResources.py and DeleteWTCResources.py to have:
servermb=getMBean("Servers/AdminServer")
where "AdminServer" is what's matched in the Targets dropdown for WTC Servers.
changed the port from 1234 to 5679 in build-run.xml
Then ran ant wtcmbeans
Verified the WTC Servers and TDOM1 user was created.

At this point I installed a new Tuxedo and updated its setenv.bat.
copied the dom1config.template to C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\dom2config and modified it setting:
DMTLOGDEV="C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\tlog"
...and
TDOM1 NWADDR="//192.168.56.1:5679"
TDOM2 NWADDR="//192.168.56.1:5678"
copied simpserv\tuxfiles\ubbdomain.template to  C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\ubbmydomain and modified:
replaced "@HOST@" with the hostname of my machine with it being uppercase!
updated vars:
        APPDIR       = "C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp"
        TUXCONFIG    = "C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp\tuxconfig"
        TUXDIR       = "C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015"

copied tolower.c from tuxfiles to  C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp

opened a Developer Command Prompt for VS 2017 and changed to  C:\Oracle\12c\Middleware\OracleHome2\tuxedo12.2.2.0.0_VS2015\samples\atmi\simpapp
ran:
setenv.cmd
"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x86_amd64
tmloadcf -y ubbmydomain
dmloadcf -y dom2config
buildclient -f tolower.c o tolower
tmboot -y
verified that port 5679 was opened and listening now in tcpview
ran
tolower.exe ALLSMALL
got back "Returned string is: allsmall"




Saturday, April 2, 2016

API query for stock quote

stripped down to select columns: https://query.yahooapis.com/v1/public/yql?q=select Bid,Symbol from yahoo.finance.quotes where symbol in ("GLD,VTI")&format=json&env=store://datatables.org/alltableswithkeys&callback=

Other columns are Ask, Volume, or * to get all columns.

Sample ways to query with JAX-RS and GSON: http://www.skbh.in/restful-webservices/consuming-restful-web-services-with-the-jersey-client-api/

Tuesday, March 29, 2016

AWS EC2, RoR, ruby...

Created an Ubuntu EC2 instance, then followed https://gorails.com/setup/ubuntu/14.04 to install and setup ruby on rails.
Also, https://www.digitalocean.com/community/tutorials/how-to-setup-ruby-on-rails-with-postgres
for the postgres setup:
in config/database.yml set:
production:
  <<: *default
  database: myrailsapp_production
  username: <linux user account here, also create user with same user name in postgres db for "create role" command>
  password: <db password from "create role" command>

Added a security group "custom tcp rule" to permit port 3000 inbound. Wasn't getting a response from ruby on rails after running 'rails server'. netstat -tulpn showed it was listening on 127.0.0.1. To make listen on all ports followed https://fullstacknotes.com/make-rails-4-2-listen-to-all-interface/ , i.e. do instead: rails server -b 0.0.0.0

should try this later.

Sunday, March 6, 2016

Hadoop, Avro experimentation

Followed http://hadooptutorial.info/avro-mapreduce-word-count-example/  but caution: I need to set the javac CLASSPATH instead to
export CLASSPATH="$HADOOP_HOME/share/hadoop/tools/lib/*"
export CLASSPATH="$HADOOP_HOME/share/hadoop/mapreduce/*:$CLASSPATH"

when I used the jar command it failed at first. This post helped to get it into alternatives: http://johnglotzer.blogspot.in/2012/09/alternatives-install-gets-stuck-failed.html

Used hadoop fs -put command to put the test.txt file onto the hadoop filesystem per http://hortonworks.com/hadoop-tutorial/using-commandline-manage-files-hdfs/

when running the MapReduceAvroWordCount application get errors similar to as described http://stackoverflow.com/questions/20586920/hadoop-connecting-to-resourcemanager-failed 
Added yarn.resourcemanager.address per answer.
jps command (see http://stackoverflow.com/questions/11738070/hadoop-cannot-use-jps-command) says hadoop services appear to be running.

this time didn't get same error, but job seems stuck.

issue stop-all.sh and modifying hadoop config files to match single-node installation.
tests under single-node Testing section gave same error as before: INFO ipc.Client: Retrying connect to server: 0.0.0.0/0.0.0.0:8032.
Reinstalling to local user dir per alexjf blog.
Still attempts to connect to 0.0.0.0/0.0.0.0:8032
Reinstall Fedora, and set static ip address, Install JdK per http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
tried tests got error this time
Attempt to disable ipv6 using http://www.itsprite.com/linuxhow-to-disable-ipv6-networking-on-redhatcentosfedoraubuntu-linux-system/ but resulted in OS instability. Forced reboot.
could not login.
try reinstall OS.
install jdk, enable ssh. Tried enabling passwordless ssh per http://allthingshadoop.com/2010/04/20/hadoop-cluster-setup-ssh-key-authentication/
but would not work.
tried the hadoop installation and test from alexjf blog. It failed the test, pulling up the url, shows memory limit exceeded as cause of failure.
removed all settings from yarn-site.xml and stopped restarted using $HADOOP_PREFIX/sbin/stop-yarn.sh stop-dfs.sh start etc. but got seeming infinite running.
used https://coderwall.com/p/a5kbtw/installing-apache-hadoop-on-linux first set of instructions to enable passwordless ssh.
restart hadoop services and didn't ask for password this time. test still fails. 
modified command set --num_containers 1 --master_memory 512 and says completed successfully.

Trying on a Mac now per http://amodernstory.com/2014/09/23/installing-hadoop-on-mac-osx-yosemite/ works.

Back on Fedora setup; retried MapReduceAvroWordCount and it worked. Next try writing schema based on Java class: https://gist.github.com/QwertyManiac/4724582. How to convert schema to json representation (avsc file?) and use that instead of java class?



Monday, January 18, 2016

Setting up Authentication

Had an opendj installed on a Debian64 machine, just needed to reset the password for cn=Directory Manager
Followed http://allidm.com/blog/2012/09/change-password-for-directory-manager-in-forgerock-opendj/ just make sure when you copy into vi you ensure to delete the trailing white space heh.
Then I could run /opt/opendj/bin/status and enter the credentials successfully.
Tested connecting with Ldap admin using cn=Directory Manager
Connected. To set a user password under ou=Users, right click set Password, chose plain text and enter the password. Right click user again and select "copy dn to clipboard." Open another instance of the LDAP Admin tool, new connection, enter the IP and paste the dn of the user, enter the password, and verify with test connection.

In Java project create test class to connect following http://www.codejava.net/coding/connecting-to-ldap-server-using-jndi-in-java
Test same using and verify connected using dn and "simple" for the java.naming.security.authentication.


Installed MySQL and created a database and user on the Debian Wheezy VM per https://www.rackspace.com/knowledge_center/article/installing-mysql-server-on-debian

Following http://people.cis.ksu.edu/~hankley/d764/tut07/Nigusse_Spring.pdf now to populate a user info object from session. Get right maven dependencies from http://www.mkyong.com/spring/maven-spring-jdbc-example/ and http://examples.javacodegeeks.com/enterprise-java/spring/jdbc/spring-jdbctemplate-example/
Modify my.cnf to set bind-address to static ip. then /etc/init.d/mysql restart



Wednesday, December 30, 2015

SharePoint Emails

Send email per https://www.collaboris.com/blogs/collaboris-blog/mark-jones/2012/11/06/code-sample-how-to-programmatically-send-an-email-in-sharepoint#.VoH5A_krLak or using straight smtpclient per http://sharepoint.stackexchange.com/questions/98192/issue-when-setting-from-in-the-sputility-sendemail. In the end used this: http://www.sharepointbriefing.com/spcode/article.php/3840566/How-To-Send-Email-with-SPUtility.htm slightly modified:

        private static Boolean SendEmail(SPWeb web, string email, string subject, string body)
        {
            try
            {
                bool flag = false;
                SPSecurity.RunWithElevatedPrivileges(
                  delegate ()
                  {
                              flag = SPUtility.SendEmail(web, true, true,
                                             email,
                                             subject,
                                             body);
                  });
                return flag;
            }
            catch (System.Exception exp)
            {
                // Do some error logging
                return false;
            }
        }


SharePoint 2013 List Item Receiver Test and Deploy

Create a test list item event receiver per http://onceinawhilescribble.blogspot.com/2013/05/creating-simple-event-receiver-in.html
hit F5 or debug it to be sure it works as expected.
Deployment:
Right-click project node in Solution Explorer and choose publish.
Follow http://jaxsharepoint.blogspot.com/2013/06/deploying-wsp-to-sharepoint-2013.html and http://sharepoint.stackexchange.com/questions/140592/create-wsp-package-in-visual-studio-2013
to deploy the WSP to local server.


PS C:\Users\user1\Documents> add-spsolution "C:\Users\user1\Documents\SharePointProject1.wsp"

Name                           SolutionId                           Deployed
----                           ----------                           --------
sharepointproject1.wsp         51fbac1e-e23f-4dc4-a8c7-a9190577b206 False


PS C:\Users\user1\Documents> install-spsolution -identity "sharepointproject1.wsp" -gacdeployment
PS C:\Users\user1\Documents>

Verify sharepointproject1.wsp shows as deployed in http://myserver/_admin/Solutions.aspx
Get GUID of new feature, using this method http://iamprogrammerdotnet.blogspot.com/2012/03/enabledisable-feature-sharepoint-2010.html
or rename .wsp to .cab, extract the Feature.xml and copy the guid from the id attribute of the Feature element. Then enable the feature:
PS C:\Users\user1\Documents> enable-spfeature -identity "046347fa-aa0b-4a29-846e-eff84970a4fb" -url http://myserver/sites/teamsitecol1/

Verify it's activated in http://myserver/sites/teamsitecol1/_layouts/15/ManageFeatures.aspx and that it still works by creating new item in DocumentLog when adding item to target list.

In Visual Studio make small change to output that gets added to new list item. Do a "publish" as before. Then update the solution:
PS C:\Users\user1\Documents> update-spsolution -identity "sharepointproject1.wsp" -gacdeployment -literalpath "C:\Users\user1\Documents\sharepointproject1.wsp"
Repeat test and make sure new change is reflected.

Noticed I needed to rename the feature so that it uses a non-default name as shown in http://myserver/sites/teamsitecol1/_layouts/15/ManageFeatures.aspx

In Visual Studio, expand the feature and open the xml file; add an attribute called "Title" e.g. Title="My Feature" to the Feature element.

Then disable the feature in http://myserver/sites/teamsitecol1/_layouts/15/ManageFeatures.aspx and retract the existing solution from the SharePoint 2013 Management Shell:
uninstall-spsolution -identity "sharepointproject1.wsp"
remove-spsolution -identity "sharepointproject1.wsp" -force -confirm:$false

Then redploy as before.

Monday, December 28, 2015

SharePoint Outgoing Email to Exchange

Setting up SharePoint 2013 single-server farm to connect to Exchange 2016.

After installing prerequisites in a new Windows Server 2012 R2 (and installing all available windows updates after installation failed first time) per https://technet.microsoft.com/EN-US/library/bb125224(v=exchg.160).aspx run Setup.exe per https://technet.microsoft.com/EN-US/library/bb124778(v=exchg.160).aspx

Needed to run setup.exe a few times due to failures connecting to the domain controller, each time it would pick up where it left off.

After a final reboot, open Exchange Management Shell from all apps.
To get the autodiscover.xml do:
Get-ClientAccessService | fl AutoDiscoverServiceInternalUri
for OWA and ECP check the servers / virtual directories tab in Exchange Administrative Center from all apps AKA 'ecp'
In ECP you can also add mail boxes from the recipients tab.

Found out the frequent disconnects to the server could be fixed by changing the connection on the DC to wired from wireless.
Trying to figure out why outlook wouldn't connect. Tried https://myfqdnexchange/Autodiscover/Autodiscover.xml but got an error about "Could not load file or assembly ‘Microsoft.Exchange.Security'"
Taking a cue from https://exchangeranger.wordpress.com/2015/06/12/exchange-2013-cu8-application-event-warning-1310-microsoft-exchange-security-assembly/ copied SharedWebConfig.config from C:\Program Files\Microsoft\Exchange Server\V15\FrontEnd\HttpProxy to C:\Program Files\Microsoft\Exchange Server\V15\ClientAccess
Then it gave me a 600 error which is actually indicative that everything is working! And sure enough, able to auto connect through Outlook (after deleting the corrupted profile from previous attempts from control panel, mail).
Note: I was able to connect from Outlook 2016. I added a host file entry with autodiscover.mydomain.com x.x.x.x but I'm not sure if that was necessary. Regardless I couldn't connect from Outlook 2013 (coudn't find server). But I was able to connect to owa via https://servername.mydomain.com/owa.


Then followed: http://sharepointgeorge.com/2010/configuring-outgoing-email-sharepoint-2010/
For the receiver connector selected "Frontend Transport" instead of Hub Transport because I heard on https://www.youtube.com/watch?v=73UBX_oJfgk that the latter is buggy.
For the CA Outgoing E-mail settings part, following https://alinimer.wordpress.com/2014/09/25/configure-outgoing-e-mail-for-sharepoint-20102013-to-using-office-365-or-gmail-relay/ instead, i.e. will relay through local SMTP server service (which is set in Services to start automatically), this is in case I wish to ditch Exchange and go with gmail in the future. For outbound security part, I will leave anonymous for now to connect to Exchange. So for Outbound Connections leave at port 25 (Exchange). For smart host, entered the FQDN of the Exchange server. For SMTP E-mail setting in IIS part, checked "Use localhost" box instead of entering the FQDN of the local server.

Set up an email address for a test user: Application Management, Manage Service Applications, User Profile Service Application, Manage User Profiles and add the test user's exchange email as the Work email property. Had to wait around 1/2 hour before it would show up as the test user's email under "Send me alerts by:" in the tasks list "New Alert" screen. Thought about enabling AD synchronization but it looked to complicated and outside of scope of this lab. Verified alert was sent to test user upon test user creating alert and task created. Couldn't do the "Send e-mail when ownership is assigned" test because apparently that feature was removed from SharePoint 2013, see http://sharepoint.stackexchange.com/questions/65056/send-email-when-ownership-is-assigned-due-date-functionality.

Followed https://technet.microsoft.com/en-us/library/jj657457(v=exchg.160).aspx to allow sending to non-exchange email addresses associated with user profiles in SharePoint.

Thursday, December 17, 2015

Spring Test plus Mockito

Testing a @RestController running in Spring Boot that calls a service and returns a file stream. To unit test it relied on Spring Test plus Mockito almost exactly as described here http://webcache.googleusercontent.com/search?q=cache:qcBgvzvFo7AJ:www.luckyryan.com/2013/08/24/unit-test-controllers-spring-mvc-test/+&cd=2&hl=en&ct=clnk&gl=us original page works now: http://www.luckyryan.com/2013/08/24/unit-test-controllers-spring-mvc-test/

The method under test returns a wrapped inputstream as shown here: http://stackoverflow.com/a/26537519/2066936
Mocked inputstream as shown here: http://stackoverflow.com/a/6371858

Sunday, October 4, 2015

SharePoint API Research

Seeing whether SharePoint 2013 supports creating related entries by doing the following from the OData 2 spec:
Alternatively a client can create and Link an Entry to a related Entry by leveraging the addressing scheme if the server supports addressing related items. For example, if a server implements the OData URI conventions described in [OData-URI], the address …/Categories(10)/Products points at all the products in the specified category. When a POST request is issued against that products collection (instead of the top-level products collection) the server will create the new product Entry and automatically Link it to the parent category. Clients may combine this method and the previous one to create an Entry that is related to another one implicitly through the relationship implied in the URL, and related to other Entries by explicitly-specified Links in the request body.
http://www.odata.org/documentation/odata-version-2-0/operations/

Thursday, June 25, 2015

Tomcat on OpenShift

Basically needed a testing/learning environment for Spring because doing Spring on JBoss is too cumbersome for me.

Followed a combination of:
https://blog.openshift.com/free-apache-tomcat-hosting-in-the-cloud-for-java-applications-its-called-openshift/
https://blog.openshift.com/how-to-run-apache-tomcat-8-on-openshift/
Did for Tomcat 7. The latter describes the correct env var to use: OPENSHIFT_DIY_IP

Added a user to tomcat-users.xml per the first link so that I could access the manager app. Uploaded a test war (taken from http://www.michael-thomas.com/tech/apache/tomcat/tutorial_firststeps_tomcat/) and verified the application loads.

Friday, March 13, 2015

Grizzly scanning JAX-RS Providers?

Spent half a day troubleshooting issue where Jersey serialization was not working; evidently my RuntimeTypeAdapterFactory that was supposed to be registered as a GSON adapter -- through the following registration path: RuntimeTypeAdapterFactory --> javax.ws.rs.ext.MessageBodyWriter<Object> --> org.glassfish.jersey.client.ClientConfig --> org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory -- wasn't evidently since breakpoints in the MessageBodyWriter weren't getting hit. I was working in Eclipse and had set the project as a higher order dependency via both the project "Order and Export" and the run configuration classpath. Still SOME MessageBodyWriter was registered since I saw its log4j debug output. The funny thing is that the breakpoint in my development MessageBodyWriter was getting hit in the constructor, but not the writeTo method. So that tells me both classes -- the old one and the new one (in a different package) were getting loaded into the classpath and mine was definitely getting created and registered per the above registration path. Could the issue be due to caching? No. Tried clean project, restart Eclipse, etc. Then I started fiddling with the registration path, inserting a test writer from another package. This time that test writer produced writeTo output. But switching back to my desired dev version did not "reset" any cache whether Grizzly or Jersey if there is such a thing. I did not see my dev version getting hit. Then I deleted the test version AND moved the dev version of the MessageBodyWriter to the same project as the Grizzly server and that did the trick. This was inherited code and I started looking at it for clues as to the explanation. Being new to Jersey and JAX-RS I hadn't noticed that one of the annotations on the MessageBodyWriter was @javax.ws.rs.ext.Provider. A quick google search for GSON Jersey integration took me to the following blog http://eclipsesource.com/blogs/2012/11/02/integrating-gson-into-a-jax-rs-based-application/ where it explains that the server scans for @Providers to use. Sure enough, removing the @Provider annotation on the test MessageBodyWriter caused it to not replace my target MessageBodyWriter. So evidently Grizzly tries to behave like a JEE container and scans like one or perhaps it's just following spec (but if it were, then it should have at least produced a warning I believe). Either way, moral of the story is, if you are registring a provider with Grizzly manually via some programmatic registration path such as the one above, DO NOT annotate the providers with @Provider or else you won't know which one is actually being used to do the serialization at runtime!

Monday, October 27, 2014

Eclipse Cougaar Windows

Got "Hello World Demo" working on Win.

Following tutorial: http://cougaar.org/wp/documentation/tutorials/helloworlddemo/
Source: http://cougaar.org/build/ and http://sourceforge.net/projects/cougaar/

In run configuration set Main class to:
org.cougaar.bootstrap.Bootstrapper

Gotchas are: command line is: C:\Work\hello\run>cougaar -v %COUGAAR_SOCIETY_PATH%/configs/HelloWorldSociety.xml SingleNodeRuntime.xml
Note, misnamed 'hello' xml file.
To get running in Eclipse (without using the mentioned cougaar IDE) use the following Run configuration arguments: -Dorg.cougaar.society.xsl.param.template=single_node -Dorg.cougaar.core.logging.config.filename=logging.props -Dorg.cougaar.bootstrap.application=org.cougaar.core.node.Node -Dorg.cougaar.society.file=C:\Work\hello/configs/HelloWorldSociety.xml -Dorg.cougaar.runtime.file=SingleNodeRuntime.xml -Dorg.cougaar.node.name=Node1 -Dorg.cougaar.runtime.path=${env_var:COUGAAR_RUNTIME_PATH} -Dorg.cougaar.society.path=${env_var:COUGAAR_SOCIETY_PATH} -Dorg.cougaar.install.path=${env_var:COUGAAR_INSTALL_PATH} -Xbootclasspath/p:${env_var:COUGAAR_INSTALL_PATH}/lib/javaiopatch.jar -Dorg.cougaar.core.node.InitializationComponent=XML -Djava.class.path=${env_var:COUGAAR_INSTALL_PATH}/lib/bootstrap.jar

Note use of "env_var" -- these are OS environment variables not to be confused with those set in Eclipse Environment tab (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=170789)

Working directory per instructions is set to ${workspace_loc:hello/run}

Monday, September 22, 2014

FactoryBean Woes

Be careful with org.springframework.beans.factory.FactoryBean. I created a couple of them and used them with something like <bean id="mybean" class="pkg.myfactory" />
Everything seemed to work fine. Then as soon as I added a third and fourth, everything went haywire and started getting no end to circular dependency errors. So I had to switch to plain vanilla "factory-bean" beans in xml and everything was fine then!

Friday, August 29, 2014

Researching Hibernate for Queries

How to perform unions and/or one-to-one joins with multiple intermediate tables? Looks like there are no easy solutions. Best may be using SQL or creating numerous hibernate mappings for a legacy database.

Read:
http://hibernate-samples.blogspot.com/2011/10/one-to-one-association-using-join-table.html
 https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Web_Server/1.0/html/Hibernate_Core_Reference_Guide/assoc-bidirectional-join-121.html
 example of multiple intermediate join tables?
 named query: http://stackoverflow.com/questions/8399379/hibernate-named-query-join-3-tables
 with sql: http://jumpingbean.co.za/blogs/mark/hibernate
 http://stackoverflow.com/questions/18257757/how-to-execute-query-with-union-in-hibernate

Wednesday, July 9, 2014

Bit shift operators

Experimentation in Java Snippet Runner to learn about bit shift operator and binary operators based on http://stackoverflow.com/questions/2534116/how-to-convert-get-rgbx-y-integer-pixel-to-colorr-g-b-a-in-java. >>> shifts all bits to the right with the bits falling off the right and zero filling from the left (as opposed to >> which fills from left based on sign (in this case 1 ... 0xAABBCCDD = -1430532899).


int argb = 0xAABBCCDD;
int r = (argb)&0xFF;
int g = (argb>>8)&0xFF;
int b = (argb>>16)&0xFF;
int a = (argb>>24)&0xFF;
int r_ = (argb)&0xFF;
int g_ = (argb>>8)&0xFF;
int b_ = (argb>>16)&0xFF;
int a_ = (argb>>24)&0xFF;
int r_1 = (argb)&0xFFFFFFFF;
int g_1 = (argb>>8)&0xFFFFFFFF;
int b_1 = (argb>>16)&0xFFFFFFFF;
int a_1 = (argb>>24)&0xFFFFFFFF;
System.out.println(Integer.toBinaryString(argb));
System.out.println(r + " red " + Integer.toBinaryString(r_) + "\n" + Integer.toBinaryString(r_1));
System.out.println(g + " green " + Integer.toBinaryString(g_) + "\n" + Integer.toBinaryString(g_1));
System.out.println(b + " blue " + Integer.toBinaryString(b_) + "\n" + Integer.toBinaryString(b_1));
System.out.println(a + " alpha " + Integer.toBinaryString(a_) + "\n" + Integer.toBinaryString(a_1));
System.out.println("righters");
System.out.println((argb>>8));
System.out.println((argb>>16));
System.out.println((argb>>24));

System.out.println(argb +"color methods");
   java.awt.Color c = new java.awt.Color(argb, true);
    System.out.println("red " + c.getRed());
    System.out.println("green " + c.getGreen());
    System.out.println("blue " + c.getBlue());
    System.out.println("alpha "  + c.getAlpha());

10101010101110111100110011011101
221 red 11011101
10101010101110111100110011011101
204 green 11001100
11111111101010101011101111001100
187 blue 10111011
11111111111111111010101010111011
170 alpha 10101010
11111111111111111111111110101010
righters
-5588020
-21829
-86
-1430532899color methods
red 187
green 204
blue 221
alpha 170

OK