URL and Link repository

Tuesday, December 5, 2017

Inserting Dates and Times from Visual Basic Web Form to MySQL Database

Not pretty but it resolves that invalid string error.

ASP code / mark up:
<asp:TextBox> TextMode='Date' ID='StartDateBox' runat='server'</asp:TextBox>
<asp:TextBox> TextMode='Time' ID='StartTimeBox'runat='server'</asp:TextBox>
Visual Basic server code:
Dim sTime As DateTime = Convert.ToDateTime(StartTimeBox.Text.toString) 
Dim insertstring as String='INSERT INTO [sometable] (Start_Date, Start_Time) values (@sd, @st)'
Dim mySqlcmnd = New MySqlCommand(insertstring, [your db connection])
mySqlcmnd.Parameters.AddWithValue('sd', StartDateBox.Text)
' 24 hour format
mySqlcmnd.Parameters.AddWithValue('st', sTime.ToString("HH:mm"))
Dim rowCnt as Integer = mySqlcmnd.ExecuteNonQuery

Sunday, November 5, 2017

Android to PHP Calendar Week View

I need to display a week of data between the Sunday and Saturday that surround a given date.


SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
//current date on mobile
String formattedDate = df.format(Calendar.getInstance().getTime());
//format the get
String url = HOME_PAGE+"/mobile/getsessions.php?sessDate="+formattedDate";


$sessDate=mysqli_real_escape_string($dbconn, $sessDate);

//Get the day number out of 7 days
$weekdaynum = date('w', strtotime($sessDate));
// the following will handle what happens when a date falls on Sunday or Saturday.
// I DO NOT want to slide a week out in either direction
switch ($weekdaynum) {
case 0: // sunday
$startAtSun = strtotime('this sunday', strtotime($sessDate));
$endAtSat = strtotime('this saturday', strtotime($sessDate));
case 6: // saturday
$startAtSun = strtotime('last sunday', strtotime($sessDate));
$endAtSat = strtotime('this saturday', strtotime($sessDate));
default: // all other days
$startAtSun = strtotime('last sunday', strtotime($sessDate));
$endAtSat = strtotime('this saturday', strtotime($sessDate));

$format = 'Y-m-d';
$week_start = date($format, $startAtSun);
$week_end = date($format, $endAtSat);

Thursday, November 2, 2017

Android Program for Making a Week View

To follow up on the previous post, now that I have a PHP/MySQL program ready to send proprietary calendar data to the Android app, I need a week view to receive each appointment. The work done on this GitHub code is tremendous and is a good start. https://github.com/AnilMH/Android-WeekView-Demo.
To be continued...

Tuesday, October 31, 2017

PHP Get Start of Current Week

I need to get the start and end date for the week of the current date.

$day = date('w');
$week_start = date('Y-m-d', strtotime('-'.$day.' days'));
$week_end = date('Y-m-d', strtotime('+'.(6-$day).' days'));

Saturday, September 23, 2017

Asus Zenfone Laser 2 - Lost Root Access

See about 3 posts ago. Anyhoos - This is where I have the files that I used to restore root: Google Drive. Of course, I used these files after resetting the device to factory.

Wednesday, September 20, 2017

ASUS_Z00MD Android Moving Apps to SD card

This device is also known as the Asus Zenfone Laser 2 with 6 inch screen.

Moving Apps to the SD Card.

  • First, you must have a very fast SD card
  • Second, you must enable USB debugging and attach device to your PC.
  • Third, open command line and type "adb shell"
  • Fourth, type "sm list-disks"
  • Fifth, note the partition, which in my case was "disk:179,64"
  • Lastly, type "sm partition disk:179,64 private"

  • Now find an app that moves apps to the SD card.

    Good luck.

    Tuesday, September 19, 2017

    Android APK uloaded to Google Play Supports 0 devices

    Recently uploaded a new APK for W.A.R. II only to discover that it now supports exactly 0 devices. This even after I installed the APK on my own devices running Marshmallow and Nougat.
    After e-mailing Google Support who did not identify anything specific in the manifest, I decided to add

    <uses-feature android:name="android.hardware.camera" android:required="true" /> <uses-feature android:name="android.hardware.location.gps" /> <uses-feature android:name="android.hardware.location.network" />
    and remove android:required = true from
    <uses-feature android:glEsVersion="0x00020000" />
    Now the W.A.R. app supports 11268 devices.

    Wednesday, August 23, 2017

    Root the Asus ZenFone Laser 2 KE600KL

    I recently acquired the Asus Zenfone 2 from Amazon, because I crave a 6 inch screen.
    Now I need to root the device in order to run Kali Linux. I also want to root, because I am a control freak.
    Here are the steps assuming you already have ADB and Fastboot installed on your PC.
  • Download to your PC the right TeamWin Recovery Program aka TWRP
  • Rename the download to recovery.img and move it into the same folder as the adb.exe and fastboot.exe
  • Download the SuperSU zip file to the microSD card that will be inserted into your Asus Zenfone
  • Connect Asus Zenfone to your PC via USB
  • Open a command line from within the directory that contains adb.exe, fastboot.exe and recovery.img
  • Type: "adb devices" to verify that the Asus Zenfone is indeed connected
  • Type: "adb reboot bootloader"
  • Type: "fastboot devices" to verify that the Asus Zenfone is indeed in Fastboot mode
  • Type: "fastboot flash recovery recovery.img"
  • Type: "fastboot boot recovery.img"
  • Use the TWRP menu interface on the Asus Zenfone to [Install Zip] the SuperSU file on the microSD card.
  • Done.
    For kicks you may also want to visit the Asus support site for additional software tools.

    Wednesday, July 19, 2017

    Malicious PHP code

    I found the following inserted to the far right of some of my PHP scripts behind SpiderOnFire.

    Wednesday, July 12, 2017

    Android Fragment Not Replacing Main Activity on Marshmallow

    I am writing a calendar app that will listen for clicks on dates and drive the remainder of the app's functions by date and user.

    The reason I am posting this is that my fragments replaced the main activity okay on a Lollipop device, but not on Marshmallow

    After many hours of frustration, I happened to tilt the Marshmallow phone just enough to have the external light source reveal that the fragment was indeed present on the main activity, but BEHIND IT. This was not readily detected because the backgrounds are the same color and size while the main activity layout was 100% opaque. It was my elevation shadow that showed another layer beneath the main activity

    Shazam!!! This fixed that problem:

  • When I build the fragment, I also specify calendar.setVisibility(View.GONE); , where calendar is the CalendarView in the XML layout.
  • This may not be proper form, but I don't care as I must push on and build the server application to the mobile. Meanwhile, here are some screen shots of the actual source code that I built and compiled directly on a Samsung Tablet with AIDE.

    Aha...the all important build.gradle file

    Saturday, July 8, 2017

    Amazon Web Services Story - AWS, EC2 and the WIMP

    Here are the steps that I took to create an AWS EC2 running Windows IIS, MySQL, PHP (WIMP), .NET, ASP, Visual Studio.

    I started by reading the AWS documentation.

    Get AWS account and create and Windows Server Instance - Already plenty of on-line documentation.

    Connect to the instance through Remote Desktop.

    Click the Windows Start icon and locate Server Manager Dashboard to install Windows IIS. - Also plenty of documentation on-line.

    This is what you should see as you run through the process:

    This is where web files go.

    Open a browser from inside the
    Remote Desktop Connection
    and type localhost in the address bar.

    Now in order to download and install programs from the internet, you will
    need to turn off Internet Enhanced Security.

    Finally, you can download the Microsoft Web Platform
    installer and go to town. (Remember to turn Internet Enhanced Security back on.)

    One last thing ...You may need to play around with HTTP and port 80 and other such nuances.


    Saturday, July 1, 2017

    Problem with Android Lollipop ( 5.1.1) Action Bar and Tool Bar

    PROBLEM: Hamburger icon in the ActionBar/ToolBar is not clickable, but a swipe from the left displays the drawer layout with menu items.
    RESOLUTION: Use the CORRECT constructor for ActionBarDrawerToggle:
    ActionBarDrawerToggle (Activity activity, 
    DrawerLayout drawerLayout,
    Toolbar toolbar, ◄ - THIS IS THE KEY. Previously missing.
    int openDrawerContentDescRes,
    int closeDrawerContentDescRes)
    The main activity should extend AppCompatActivity.
    and create an instance of android.support.v7.widget.Toolbar
    There are plenty of full code examples online but remember to setSupportActionBar(toolbar); and that is it!
    Here is what my build.gradle looks like:
    android {
    compileSdkVersion 21
    buildToolsVersion "21.1.0"
    minSdkVersion 11
    targetSdkVersion 21

    Thursday, June 29, 2017

    Samsung SM-T280 FRP - Factory Reset Protection Lock - Fix

    Since Office Depot, SquareTrade and Samsung could not help with a Samsung Galaxy Tab A suddenly freezing on the logo screen with a "Custom Binary Blocked by FRP lock", I had to take matters into my own hands.
    First, the only thing that I changed in the last 6 months of use was the addition of another Google Account and perhaps OEM lock was checked/unchecked?
    Regardless, the aforementioned companies should know how to do this:
  • Visit True Android
  • Download Odin
  • Download firmware for Samsung Galaxy A Tab

  • Now I can resume on the fly development using AIDE

    Forgot to mention that I will once again root following XDA so that I can remove bloatware and view the LogCat on the device.

    Tuesday, June 27, 2017

    Data Forge Exchange - DFX

    Sorry I've been away hawking my services as an EXTRACT, TRANSLATE and LOAD consultant at http://dfx.dataforge1.com.
    So far, two clients:
    1. One in the garment industry where they required an API to pull data off an order site and manipulate reports locally.
    2. The other is an Autism Therapy agency that requires a custom appointment calendar with GPS, clock in, clock out and signature.

    Wednesday, March 8, 2017

    Kali Linux USB for Windows 10.

  • Download a Kali Linux ISO image from here.
  • Download the Win32 Imager from here.
  • Follow these instructions.
  • Sometime a flash drive appears to have less space than it physically has. If this be the case, then you can recover its full capacity by following these instructions.
  • Monday, March 6, 2017

    Burning ISO Image to PC from a Physical Disk

    Not having to insert game CDs into the CD drive is a good reason to do this. I recently used BurnAware's "Copy to ISO" function.
    Once you have the ISO (CD/DVD image) on your hard drive, you can use a virtual drive from Elaborate Bytes to mount the image.

    Currently I am making ISO disk images of the following games:
    Halo 2
    Assassin's Creed

    Tuesday, February 28, 2017

    Back to Unbricking a Kindle Fire HD 6

    I am unable to get past a flashing wallpaper screen after disabling system apps that I should NOT have disabled. STUPID!

    Since I am quite fond of the 6 inch screen Android device, I am determined to get past this, but the ADB devices command reveals:
    C:\Users\thinkpad>adb devices
    List of devices attached
    008808075227056M unauthorized


    http://www.mediafire.com/file/q4co2pz2iibt734/adbfastboot.zip http://www.androidauthority.com/how-to-unbrick-your-amazon-kindle-fire-46412/ http://www.dominantwire.com/2012/11/how-to-install-adb-and-fastboot-on.html Copied contents of adbfastboot folder into existing and overwriting adb folder. System environment variables set to execute adb After I get:
    C:\Users\thinkpad>adb devices adb server is out of date. killing... * daemon started successfully * List of devices attached 008808075227056M offline http://www.droidextra.net/install-adb-drivers-for-any-android-device/

    After a long absence from the above nonsense, I simply followed the instructions at Imma Wake on YouTube

    Root the Samsung Tab A 7.0

    One must enable Developer Options by tapping 7 times on the Build Number.
  • Download the APK from KingRoot
  • Connect tablet to PC via USB cable
  • Copy the downloaded APK file to Download folder on tablet
  • Tap the APK file on the tablet
  • Good Luck
  • If the above did not work at all, then try Kingo Root.

    http://forum.xda-developers.com/showthread.php?t=2684210 http://linuxcommand.org/lts0070.php http://adbshell.com/commands/adb-shell-cp Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\adb>adb devices adb server is out of date. killing... * daemon started successfully * List of devices attached 310092303ce76300 device C:\adb>adb version Android Debug Bridge version 1.0.31 C:\adb> apt-get install android-tools-adb android-tools-fastboot

    Monday, February 6, 2017

    Saturday, January 7, 2017

    Testing Firebase Cloud Messaging

    After putting all the pieces together from resources on the internet like SimplifiedCoding, I am unable to consistently send messages to the app through the Firebase Console notification feature. The message is not always displayed on the device but appears to have been sent through Firebase.

    Maybe this is the problem, maybe not.

    "FCM usually delivers messages immediately after they are sent. However, this might not always be possible. For example, if the platform is Android, the device could be turned off, offline, or otherwise unavailable. FCM might intentionally delay messages to prevent an app from consuming excessive resources and negatively affecting battery life. When this happens, FCM stores the message and delivers it as soon as it's feasible. While this is fine in most cases, there are some apps for which a late message might as well never be delivered. For example, if the message is an incoming call or video chat notification, it is meaningful only for a short period of time before the call is terminated. Or if the message is an invitation to an event, it is useless if received after the event has ended. You can use the time_to_live parameter, supported in both HTTP and XMPP requests, to specify the maximum lifespan of a message. The value of this parameter must be a duration from 0 to 2,419,200 seconds, and it corresponds to the maximum period of time for which FCM stores and attempts to deliver the message. Requests that don't contain this field default to the maximum period of four weeks. Here are some possible uses for this feature: Video chat incoming calls Expiring invitation events Calendar events Another advantage of specifying the lifespan of a message is that FCM never throttles messages with a time_to_live (TTL) value of 0 seconds. In other words, FCM guarantees best effort for messages that must be delivered "now or never." Keep in mind that a time_to_live value of 0 means messages that can't be delivered immediately are discarded. However, because such messages are never stored, this provides the best latency for sending notification messages."