Tuesday, April 24, 2018

Tip-Top Calculator = A PhoneGap and Progressive Web Apps project

Lately, I haven't had time to update my iOS and Android Apps.  As a hobbyist, self-taught programmer my full-time keeps me fairly busy as it is.  Enter web-apps - easily deployable, updateable with no need for app store approvals or developer accounts - the app works on any web browser, even in the car!  macOS, iOS, Android, Amazon tablet or Windows PC, it works across any mobile or internet based device.  Just about anywhere: chromeOS and Linux no problem.

Ionic's free creator app is a great place to start builidng a mobile framework.   You can create a free "app" at creator.ionic.io/    Apps are built using AngularJS and Javascript.   You can add a PHP server for backend. 

So here is the first little experiment - a Tipping Calculator with features to round the tip, total or split the check however many ways you need to.   I was able to create this easily in less than a few hours as the Vue.js framework shown in the Tutorial.   I also learned about firebase, which is a google product, where you can host a progressive web app for free.  You can find the app at :

TipTopCalc.com

Once you load it in iOS in Safari for example, hit the "up arrow" at the bottom of safari and scroll to find "Add to Home Screen".  This will create a nice little icon for the program and the web-"app" is installed.  For chrome browser, load the above URL, and then CTRL+SHIFT+I --> go to the applications tab in the new window that appears (you may have to scroll right) and "add to Homescreen" (it will prompt you if it's okay to "add to shelf", click "add".  Then in Chrome look for the "Apps" icon in the near top left of the browser.   Find the Tip-top calc app and right click it to Create shortcuts.

The nice thing is this will load on chrome, firefox, edge, safari desktop, iOS and android - a whole variety of platforms as a web-app!  In the past, this would have taken countless more hours to host across various platforms.

Here's a iOS screenshot* (using the chrome developer tools window emulator):



Add to Home Screen Using the "up arrow" in safari



 Several Options are available - Round the tip, or Tip Pre-tax and Tip Rate
 







Monday, April 23, 2018

Improve Wifi calling call clarity with this simple fix for your router

Are you having garbled calls on Wifi?  Wi-fi calling is a great feature if you have poor cell service.   You can enable it by going into settings on iPhones as shown HERE


But while it worked for me the call quality was awful.   At first I thought it was bandwidth issues or bufferbloat but nothing seemed to help until I came across this post

Seems SIP ALG can cause problems with wi-fi calling and VOIP applications as well as skype because its not well implemented on SOHO routers.  Here's how to disable it on a netgear router (probably similar for other brands or google it).

 Improve Wifi calling call clarity with this simple fix for your router.  It worked for me and now calls are amazingly clear!


Tuesday, September 27, 2016

Whocrashed finds the reason why your PC crashed

I bought a new HP AIO (all in one PC) and upgraded Windows 10 to the newest anniversary edition (1607).  My PC kept crashing with blue screens of death (BSOD) but it wasn't clear what was causing to crash.

I've used WhoCrashed before (several years ago on Windows 7 to identify a buggy Juno VPN driver) and once again it was quickly able to identify the buggy driver (in my case a buggy driver for Intel Wi-Fi causing the crash):

Crash dump file: 
This was probably caused by the following module: netwtw04.sys (Netwtw04+0x32DC2)
Bugcheck code: 0xD1 (0x8, 0x2, 0x0, 0xFFFFF80194C10E28)
Error: DRIVER_IRQL_NOT_LESS_OR_EQUAL
product: Intel® Wireless WiFi Link Adapter
company: Intel Corporation
description: Intel® Wireless WiFi Link Driver

Review of WhoCrashed (Lifehacker)


When it is done analyzing it gives you an explanation of each crash and at the very bottom conclusions on what to do.

I've updated a new driver....hopefully that solves this BSOD.  

Sunday, September 25, 2016

Lock screen on a damaged iPhone screen/digtizer - how to enter the pin

So, I droppped my phone shattering the screen and digitizer.  It no longer recognized touch input on the screen and the screen was dead.   The home button still worked.  This was an iPhone 6s.

I had to do some research on how to unlock my iphone after damaging my touch screen.  I was able to do it!  And then backup my iPhone saving all the pictures and content!

Here's how

1. Lightning to HDMI adapter - with this I was able to see my phone's lock screen (and later drawer after it was unlocked) - find it at staples or apple store or online (amazon).  This is a great little accessory to have as you can stream content from your phone to an HDMI PC anywhere on the go (travel etc).  I already had this part.


2. Lightning to USB adapter - Normally, these are used for cameras and other accessories but it can be used to hook up a USB keyboard (in my case I used a Costco logitech wireless keyboard from my PC - it worked fine (any wireless keyboard should do) - I inserted the Unifying keyboard USB part of the keyboard into the adapter and was able to type my unlock code on the logitech keyboard.  I ordered this part on amazon:

In my case, that's all I had to do - if you haven't previously synced your phone with your PC you may need to turn on voiceover in siri and/or use the keyboard shortcuts (Ctrl + Alt + Spacebar) to select Trust this computer when the prompt appears on the phone screen.   Instructions for that can be found here: https://discussions.apple.com/thread/5839619?tstart=0

in iTunes, backup the phone and choose encrypt backup to make sure all content is backed up!

UPDATE:  You can also turn on voiceover using Siri.  Then open the settings app using siri.  Then hookup your USB keyboard as above and use left and right arrows and follow along using another phone or iPad for the settings menu options.  I was able to navigate to iCloud settings (listen for the prompts from voiceover and follow the menu along on another iOS device) and then using Up + DOWN arrow (press simultaneously) to select and then move left right to toggle photo library backup on.



Lock screen on a damaged iPhone screen/digtizer - how to enter the pin

So, I droppped my phone shattering the screen and digitizer.  It no longer recognized touch input on the screen and the screen was dead.   The home button still worked.  This was an iPhone 6s.

I had to do some research on how to unlock my iphone after damaging my touch screen.  I was able to do it!  And then backup my iPhone saving all the pictures and content!

Here's how

1. Lightning to HDMI adapter - with this I was able to see my phone's lock screen (and later drawer after it was unlocked) - find it at staples or apple store or online (amazon).  This is a great little accessory to have as you can stream content from your phone to an HDMI PC anywhere on the go (travel etc).  I already had this part.


2. Lightning to USB adapter - Normally, these are used for cameras and other accessories but it can be used to hook up a USB keyboard (in my case I used a Costco logitech wireless keyboard from my PC - it worked fine (any wireless keyboard should do) - I inserted the Unifying keyboard USB part of the keyboard into the adapter and was able to type my unlock code on the logitech keyboard.  I ordered this part on amazon:

In my case, that's all I had to do - if you haven't previously synced your phone with your PC you may need to turn on voiceover in siri and/or use the keyboard shortcuts (Ctrl + Alt + Spacebar) to select Trust this computer when the prompt appears on the phone screen.   Instructions for that can be found here: https://discussions.apple.com/thread/5839619?tstart=0

in iTunes, backup the phone and choose encrypt backup to make sure all content is backed up!

in iTunes, backup the phone and choose encrypt backup to make sure all content is backed up!

UPDATE:  You can also turn on voiceover using Siri.  Then open the settings app using siri.  Then hookup your USB keyboard as above and use left and right arrows and follow along using another phone or iPad for the settings menu options.  I was able to navigate to iCloud settings and then using Up + down arrow to select and then move left right to toggle photo library backup on.



Lock screen on a damaged iPhone screen/digtizer - how to enter the pin

So, I droppped my phone shattering the screen and digitizer.  It no longer recognized touch input on the screen and the screen was dead.   The home button still worked.  This was an iPhone 6s.

I had to do some research on how to unlock my iphone after damaging my touch screen.  I was able to do it!  And then backup my iPhone saving all the pictures and content!

Here's how

1. Lightning to HDMI adapter - with this I was able to see my phone's lock screen (and later drawer after it was unlocked) - find it at staples or apple store or online (amazon).  This is a great little accessory to have as you can stream content from your phone to an HDMI PC anywhere on the go (travel etc).  I already had this part.


2. Lightning to USB adapter - Normally, these are used for cameras and other accessories but it can be used to hook up a USB keyboard (in my case I used a Costco logitech wireless keyboard from my PC - it worked fine (any wireless keyboard should do) - I inserted the Unifying keyboard USB part of the keyboard into the adapter and was able to type my unlock code on the logitech keyboard.  I ordered this part on amazon:

In my case, that's all I had to do - if you haven't previously synced your phone with your PC you may need to turn on voiceover in siri and/or use the keyboard shortcuts (Ctrl + Alt + Spacebar) to select Trust this computer when the prompt appears on the phone screen.   Instructions for that can be found here: https://discussions.apple.com/thread/5839619?tstart=0

in iTunes, backup the phone and choose encrypt backup to make sure all content is backed up!




Lock screen on a damaged iPhone screen/digtizer - how to enter the pin

So, I droppped my phone shattering the screen and digitizer.  It no longer recognized touch input on the screen and the screen was dead.   The home button still worked.  This was an iPhone 6s.

I had to do some research on how to unlock my iphone after damaging my touch screen.  I was able to do it!  And then backup my iPhone saving all the pictures and content!

Here's how

1. Lightning to HDMI adapter - with this I was able to see my phone's lock screen (and later drawer after it was unlocked) - find it at staples or apple store or online (amazon)

2. Lightning to USB adapter - used to hook up a USB keyboard (in my case a Costco logitech wireless keyboard worked fine (any wireless keyboard should do) - I inserted the Unifying keyboard USB part of the keyboard into the adapter and was able to type my unlock code on the logitech keyboard.  I ordered this part on amazon:

In my case, that's all I had to do - if you haven't previously synced your phone with your PC you may need to turn on voiceover in siri and/or use the keyboard shortcuts (Ctrl + Alt + Spacebar) to select Trust this computer when the prompt appears on the phone screen.   Instructions for that can be found here: https://discussions.apple.com/thread/5839619?tstart=0

in iTunes, backup the phone and choose encrypt backup to make sure all content is backed up!

UPDATE:  You can also turn on voiceover using Siri.  Then open the settings app using siri.  Then hookup your USB keyboard as above and use left and right arrows and follow along using another phone or iPad for the settings menu options.  I was able to navigate to iCloud settings and then using Up + down arrow to select and then move left right to toggle photo library backup on.






Monday, February 24, 2014

Find your Windows Experience Index scores in Windows 8.1

The Windows Experience Index benchmark tool is harder to find in Windows 8.1, but is still available if you know where to look. Read this article by Ed Rhee on CNET.

http://howto.cnet.com/8301-11310_39-57616440-285/find-your-windows-experience-index-scores-in-windows-8.1/

Saturday, September 7, 2013

Making the S4 look like stock android

I like the galaxy S4 - it's an awesome phone but I'm not a huge fan of touchwiz.

Use holo launcher HD or the suggestions in this thread below

http://techicated.com/make-samsung-galaxy-s4-almost-stock/

I use

Holo launcher HD
Camera JB+
Jellybean alarm clock

All from the app store for my stock look.

Saturday, October 27, 2012

How to get Windows Live Mail on Windows 8. Fix Windows Live error “The program can’t start because wldcore.dll / wldlog.dll is missing from your computer. Try reinstalling the program to fix problem”

Followed instructions from this site:

http://blog.meidianto.com/category/windows-live/

Except that my dll's were in program files x86 folder.

After long wait, at last Windows Live Essentials 2011 reaches its RTM. There are 2 installer versions we can use:

Online Installer
Offline Installer
Today I had chance to install it. Everything else went smooth but I got msnmgr.exe error when I was “first time” starting the Windows Live Messenger.

The error says The program can’t start because wldlog.dll is missing from your computer. Try reinstalling the program to fix problem.

The error message was only thrown once. But… after that every time I tried to login to Messenger it threw error 80040154. The solution link that leads to msxml3.dll fix didn’t help at all for this version nor reinstalling the Windows Live Messenger.

After long day of research, at last I got the solution. It seems the new Windows Live has grouped the wldcore.dll and wldlog.dll (used by Messenger, Contacts and Mail) to a folder c:\Program Files\Windows Live\Shared



Maybe because I did upgrade install it screwed up things.

The solution was simply copy paste those 2 files wldcore.dll and wldlog.dll from c:\Program Files\Windows Live\Shared to

c:\Program Files\Windows Live\Messenger
c:\Program Files\Windows Live\Contacts
c:\Program Files\Windows Live\Mail

Saturday, May 5, 2012

Windows 7 BSOD Solved DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1)

Solved a stubborn problem with BSOD's on my new windows 7 rig. DRIVER_IRQL_NOT_LESS_OR_EQUAL (d1). WhoCrashed couldn't pinpoint the issue beyond saying it was something with ntoskrnl.exe.

Then I found about windbg on this site: http://www.techrepublic.com/blog/window-on-windows/how-do-i-use-windbg-debugger-to-troubleshoot-a-blue-screen-of-death/1922

Installed it and per the instructions. Found the culprit was a Juniper Networks VPN Secure Acccess manager driver

Probably caused by : NEOFLTR_710_19525.SYS ( NEOFLTR_710_19525+c63d )


What an awesome tool! Juniper, pls fix this issue! (uninstalled now)

Saturday, January 28, 2012

Updating a Rooted EI22 Epic 4g to EL30

Was lookin for a way to update EI22 to EL30 on the Epic 4g on a rooted phone. Since I had the ACS CWM recovery already installed, I found this zip here that has a pre-rooted EL30 stock kernel HERE

Now in about phone I see it's running EL30. But the modem is still on EI22. No problem, they have another zip here --> HERE that allows you to update the modem firmware.

All done and cool! Thanks!

On a rooted phone, my fav app is :
Wifi tether - http://code.google.com/p/android-wifi-tether/
Quick Boot - android market

Saturday, December 3, 2011

rooting galaxy s epic 4g (1st generation) on gingerbread ei22

http://forums.androidcentral.com/epic-4g-rooting-roms-hacks/132495-rooting-ei22-gingerbread-instructions.html

Excellent writeup with step by step instructions found here at androidcentral.com

Friday, September 2, 2011

Ubuntu 10.04 LTS grub2 LVM boot problems after upgrade

So, an automatic update broke something with my Ubuntu 10.04 LTS installation. Grub2 drops to a grub_rescue> prompt with a complaint about grub_putchar not found. I've learned that my install is on a LVM logical partition making fixing this a real p.i.a.

Luckily I found a program that was able to get me going again (rather than a 2 week old backup)....its called super grub2 disk. Most awesome is that it has support for LVM's as per their wiki. I just created a boot disk and launched it. Selected the enable support for LVM option and then booted up fine from Detect any GRUB2 configuration file (grub.cfg) option

Once I was booted up I fixed the problem permanently by accident. I had a shell open and went to do a sudo apt-get purge and install after php in apache stopped working. It looks like grub2 hadn't finished installing and it brought up a screen of where it should installed. I ticked both options and let it finish. Got apache working after did:

sudo apt-get purge libapache2-mod-php5
sudo apt-get install libapache2-mod-php5

and restarted apache

Friday, April 1, 2011

Boycott Godaddy.com

Godaddy.com has been the domain name registrar of this site for many years.  However, when the CEO goes on a rampage and bragging about how he killed some elephant for entertainment (no real purpose), its time to change domain registrars (fortunately this site is NOT hosted on Godaddy servers).  

For more information and a gory video shot by this bigot check out the following links below:

http://www.mnn.com/earth-matters/animals/stories/godaddy-ceo-criticized-for-killing-an-elephant

http://digg.com/news/offbeat/godaddy_ceo_hunts_and_kills_elephant_posts_video_of_it_online#sort-desc

Needless to say, we are in the process already of transfer to 1&1.com where I've hosted other sites.  (.com domain transfers only $4.99!)

Sunday, August 29, 2010

Importing from b2evolution 1.9.3 to wordpress

There's several scripts out there to import from b2evo to wordpress.  I decided to go to wordpress since it is the major standard out there. 

B2evo 1.9.3 should have been updated.  If it's >=2.0 b2evo, then the usual scripts out there work well (see wordpress site).  The scripts from this site were designed for older <2.0 b2evo blogs: http://blog.realnitro.be/2007/02/21/convert-a-b2evolution-blog-to-wordpress/ seemed to "almost" work.  Except that I kept getting an error about categories.

So I created this modified script below that works.  Categories get lost, but to me that was a small price to pay (vs. using RSS to import manually which took forever).   One glitch, I had to add a field in wp_posts called post_category using phpmyadmin or something similar otherwise the script will crash (at least for me b2evo 1.9.3 -> wordpress).  If someone could perfect this further, that'd be great, but it's hard to spend too much time on a system you are about to abandon.

<?php
// Tom Everett - March 3, 2005
// WP "post_date" is now populated from B2 "post_issue_date"
// Post statuses are now migrated across
// Image URLs are now updated in posts, and made relative urls rather than absolute urls

// Jens "RealNitro" Geiregat - February 21, 2007
// Updated this script to convert a b2evolution 1.8.6 blog to WordPress 2.1
// It does not (yet?) copy post and category names (the ones used in urls),
// so you'll either have to update this script, add them manually, or
// just don't use them. (I added them manually using phpmyadmin.)
// For more info, check my blog at
// http://blog.realnitro.be/2007/02/21/convert-a-b2evolution-blog-to-wordpress/
// Source: http://ppleyard.org.uk/index.php?p=72
// Warning: use this script with care! If you enter the wrong data in
// the fields, you could overwrite an other WordPress blog!

$step = $_GET['step'];
if (!$step)
 $step = 0;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>WordPress &rsaquo; Import b2evolution Data</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style media="screen" type="text/css">
    <!--
 body {
  font-family: Georgia, "Times New Roman", Times, serif;
  margin-left: 15%;
  margin-right: 15%;
 }
 #logo {
  margin: 0;
  padding: 0;
  background-image: url(http://wordpress.org/images/logo.png);
  background-repeat: no-repeat;
  height: 60px;
  border-bottom: 4px solid #333;
 }
 #logo a {
  display: block;
  height: 60px;
 }
 #logo a span {
  display: none;
 }
 p, li {
  line-height: 140%;
 }
    -->
 </style>
</head>
<body>
<h1 id="logo"><a href="http://wordpress.org"><span>WordPress</span></a></h1>
<?php

switch($step) {
 case 0:
?>
<p>Welcome to the WordPress b2evolution import utility. Before getting started, we need some information on your b2evolution database.</p>
<form method="post" action="b2evo2wp.php?step=1">
  <p>Below you should enter your b2evolution database connection details. If you're not sure about these, contact your host. </p>
  <table>
    <tr>
      <th scope="row">Database Name</th>
      <td><input name="b2db" type="text" size="45" value="b2evolution" /></td>
      <td>The name of the database you have b2evolution installed in. </td>
    </tr>
    <tr>
      <th scope="row">User Name</th>
      <td><input name="b2usr" type="text" size="45" value="username" /></td>
      <td>Your MySQL username</td>
    </tr>
    <tr>
      <th scope="row">Password</th>
      <td><input name="b2pwd" type="password" size="45" value="password" /></td>
      <td>...and MySQL password.</td>
    </tr>
    <tr>
      <th scope="row">Database Host</th>
      <td><input name="b2host" type="text" size="45" value="localhost" /></td>
      <td>99% chance you won't need to change this value.</td>
    </tr>
    <tr>
      <th scope="row">B2 URL</th>
      <td><input name="b2url" type="text" size="45" value="www.sparky.com" /></td>
      <td>The URL Path to b2, such as "www.myblog.org".</td>
    </tr>
  </table>
  <input name="submit" type="submit" value="Submit" />
</form>
<?php
 break;
 
 case 1:
  $b2_db = $_POST['b2db'];
  $b2_usr = $_POST['b2usr'];
  $b2_pwd = $_POST['b2pwd'];
  $b2_host = $_POST['b2host'];
  $b2_url = $_POST['b2url'];

        // connect to the b2evo database
        $resB2=mysql_connect($b2_host,$b2_usr,$b2_pwd);
        if (!$resB2) {
            exit("Connection failed! host: $b2_host, user: $b2_usr, pass: $b2_pwd");
        }
        if (!mysql_select_db($b2_db,$resB2)) {
            exit("Couldn't select database: $b2_db");
        }
        // get all blogs
        $result=mysql_query('SELECT blog_ID,blog_name FROM evo_blogs',$resB2);
        if (!$result) {
            exit("No blogs returned from the b2evolution database!");
        }
?>
<p>Now select the b2evolution blog to import and provide information about your WordPress database.</p>
<form method="post" action="b2evo2wp.php?step=2">
  <table>
    <tr>
      <th scope="row">b2evolution Blog</th>
      <td>
        <select name="b2blog">
<?php
        while ($row = mysql_fetch_row($result)) {
?>
          <option value="<? echo $row[0] ?>" selected><? echo $row[1]?></option>
<?php
        }
?>
        </select>
      </td>
      <td>The name of the b2evo blog you want to import. </td>
    </tr>
    <tr>
      <th scope="row">Database Name</th>
      <td><input name="wpdb" type="text" size="45" value="wordpress" /></td>
      <td>The name of the database you have WordPress installed in. </td>
    </tr>
    <tr>
      <th scope="row">User Name</th>
      <td><input name="wpusr" type="text" size="45" value="username" /></td>
      <td>Your MySQL username</td>
    </tr>
    <tr>
      <th scope="row">Password</th>
      <td><input name="wppwd" type="password" size="45" value="password" /></td>
      <td>...and MySQL password.</td>
    </tr>
    <tr>
      <th scope="row">Database Host</th>
      <td><input name="wphost" type="text" size="45" value="localhost" /></td>
      <td>99% chance you won't need to change this value.</td>
    </tr>
    <tr>
      <th scope="row">Table Prefix</th>
      <td><input name="wppref" type="text" id="wppref" value="wp_" size="45" /></td>
      <td>If you run multiple WordPress installations in a single database, specify the correct prefix for the installation you want.</td>
    </tr>
  </table>
  <input name="b2db" type="hidden" id="b2db" value="<? echo $b2_db; ?>">
  <input name="b2usr" type="hidden" id="b2usr" value="<? echo $b2_usr; ?>">
  <input name="b2pwd" type="hidden" id="b2pwd" value="<? echo $b2_pwd; ?>">
  <input name="b2host" type="hidden" id="b2host" value="<? echo $b2_host; ?>">
  <input name="b2url" type="hidden" id="b2url" value="<? echo $b2_url; ?>">
  <input name="submit" type="submit" value="Submit" />
</form>
<?php
        mysql_close($resB2);
 break;
 
 case 2:
  $b2_db = $_POST['b2db'];
  $b2_usr = $_POST['b2usr'];
  $b2_pwd = $_POST['b2pwd'];
  $b2_host = $_POST['b2host'];
         $b2_blog = $_POST['b2blog'];
  $wp_db = $_POST['wpdb'];
  $wp_usr = $_POST['wpusr'];
  $wp_pwd = $_POST['wppwd'];
  $wp_host = $_POST['wphost'];
  $wp_pref = $_POST['wppref'];
  $b2_url = $_POST['b2url'];
       
 // connect to the b2evo database
        $resB2 = mysql_connect($b2_host,$b2_usr,$b2_pwd);
        if (!$resB2) {
            exit("Connection failed! host: $b2_host, user: $b2_usr, pass: $b2_pwd");
        }
        if (!mysql_select_db($b2_db,$resB2)) {
            exit("Couldn't select database: $b2_db");
        }           
        // connect to the WP database
        $resWP = mysql_connect($wp_host,$wp_usr,$wp_pwd,TRUE);
        if (!$resWP) {
            exit("Connection failed! host: $wp_host, user: $wp_usr, pass: $wp_pwd");
        }
        if (!mysql_select_db($wp_db,$resWP)) {
            exit("Couldn't select database: $wp_db");
        }
?>
<p>All right sparky, this is where the actual import takes place! Do you feel lucky today? :p</p>
<?php
        // setup arrays to store ID changes
        $arUser = array();
        $arCat = array();
  $arUser[1] = 1;

        // get the paths for image files
        $sql = "select option_value from wp_options where option_name='fileupload_url'";
        $result = mysql_query($sql,$resWP) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
        if ($result) {
            $row = mysql_fetch_array($result, MYSQL_ASSOC);           
            $filepath_wp = $row['option_value']."/";           
        }

        $filepath_b2 = "http://".$b2_url."/media/";

        echo "b2Evolution file path: ".$filepath_b2."<br>";
        echo "WordPress file path: ".$filepath_wp."<br><br>";

        // get authors for blog
        echo "Importing User records ... <BR />";
    $sql = "SELECT DISTINCT evo_users.* FROM evo_users INNER JOIN evo_blogusers " .
   "ON evo_users.user_ID = evo_blogusers.bloguser_user_ID WHERE " .
   "evo_blogusers.bloguser_blog_ID = ".$b2_blog." AND `user_login`<>'admin'";
        $result = mysql_query($sql,$resB2) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
        if ($result) {
            $cnt = 0;
            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                $sql = trim(str_replace("\n","","INSERT INTO `". $wp_pref ."users` ".
                    "(`user_login`,`user_pass`,`user_nicename`," .
                    "`user_email`,`user_url`,`user_registered`,`user_status`," .
     "`display_name`)" .
                    " VALUES ('".$row['user_login']."','".$row['user_pass']."','".$row['user_login']."','".$row['user_email'].      "','".$row['user_url']."','".$row['dateYMDhour']."','".$row['user_status']."','".
  $row['user_login']."');"));
                $q = mysql_query($sql, $resWP) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
                $id = mysql_insert_id($resWP);
                $arUser[$row['ID']] = $id;
                $cnt = $cnt + 1;
            }
            echo $cnt . " User record(s) imported! <BR />";
        } else {
            echo "No User records found!<BR />";
        }
        // get entries for blog
        echo "Importing Entry records ... <BR />";
        $sql = "SELECT DISTINCT evo_posts.* " .
 "FROM evo_posts " .
 "INNER JOIN evo_categories ON evo_posts.post_main_cat_ID = evo_categories.cat_ID " .
 "WHERE evo_categories.cat_blog_ID = " . $b2_blog;
        $result = mysql_query($sql,$resB2) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
        if ($result) {
            $cnt = 0;
            $cntCom = 0;
            $cntCat = 0;
            while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
                // author ID must be switched to new author ID
                $aid = $arUser[$row['post_author']];

                // category ID must be switched to new category ID
                $cid = $arCat[$row['post_category']];
    if (!$cid) {
     $cid = '1';
    }

                // status mapping
                $stat = $row['post_status'];
                if ($stat == 'published') {
                    $stat = 'publish';
                } else if ($stat == 'deprecated') {
                    $stat = 'publish';
                } else if ($stat == 'protected') {
                    $stat = 'private';
                } else if ($stat == 'private') {
                    $stat = 'private';
                } else if ($stat == 'draft') {
                    $stat = 'draft';
                }
  
  // WordPress needs two timestamps: local and GMT (I wonder why...)
  $local_date = $row['post_datecreated'];
  $gmt_date_timestamp = strtotime($local_date);
  $gmt_date = gmdate("Y-m-d G:i:s ", $gmt_date_timestamp);
  
  $local_modified = $row['post_datemodified'];
  $gmt_modified_timestamp = strtotime($local_modified);
  $gmt_modified = gmdate("Y-m-d G:i:s ", $gmt_modified_timestamp);

  // WordPress saves the comment count in each post record.
  $sql = "SELECT COUNT(comment_ID) AS comment_count FROM `evo_comments` WHERE `comment_post_ID` = " . $row['post_ID'];
         $comment_res = mysql_query($sql,$resB2) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
             $comment_row = mysql_fetch_array($comment_res, MYSQL_ASSOC);
  $comment_count = $comment_row['comment_count'];
 
                // update urls in the post content
                $post_content = $row['post_content'];
                $post_content = str_replace($filepath_b2, $filepath_wp, $post_content);

                $sql = trim(str_replace("\n","","INSERT INTO `". $wp_pref ."posts` ".
                    "(`post_author`,`post_content`,`post_title`,`post_category`,`post_status`,`post_date`,`post_date_gmt`,`post_modified`,`post_modified_gmt`,`comment_count`)" .
                    " VALUES ('".$aid."','".
                 mysql_escape_string($post_content)."','" .
                               mysql_escape_string($row['post_title'])."','".
          $cid."','".
          $stat."','".
          $local_date."','".
          $gmt_date."','".
          $local_modified."','".
          $gmt_modified."','".
          $comment_count."');"));
    echo "$sql <br />";
                $q = mysql_query($sql, $resWP) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
                $id = mysql_insert_id($resWP);
                $eid = $row['post_ID'];
                $cnt = $cnt + 1;

                // get comments for entry
                $sql = "SELECT evo_comments. * , evo_users.user_nickname, evo_users.user_url, evo_users.user_email " .
  "FROM evo_comments " .
  "LEFT JOIN evo_users ON evo_comments.comment_author_ID = evo_users.user_ID " .
  "WHERE evo_comments.comment_post_ID=" . $eid;
                $res = mysql_query($sql, $resB2) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
                if ($res) {
                    while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {

   // if the commentor was a user of the blog, nickname, email and url can be fetched
   // from user_nickname, user_email and user_site
   $checked_author = $row['comment_author'];
   $checked_url = $row['comment_author_url'];
   $checked_email = $row['comment_author_email'];
   if ($row['comment_author_ID'] != NULL) { // The author was a logged in user
       $checked_author = $row['user_nickname'];
       $checked_url = $row['user_url'];
       $checked_email = $row['user_email'];
   }

   // Wordpress needs two timestamps: local and GMT (I wonder why...)
   $local_time = $row['comment_date'];
   $gm_timestamp = strtotime($local_time);
   $gm_time = gmdate("Y-m-d G:i:s ", $gm_timestamp);

   // We need to translate the b2evo comment types to WordPress comment types
   // WordPress does not know linkback, so this script will map linkbacks to pingbacks
   $comment_type = $row['comment_type'];
   if ($comment_type == 'comment') {
       $comment_type = '';
   } else if ($comment_type == 'trackback') {
       // No need to change it
   } else if ($comment_type == 'linkback') {
       $comment_type = 'pingback';
   } else if ($comment_type == 'pingback') {
       // No need to change it
   } else { // This shouldn't happen.
       echo "Unknown comment type '" . $comment_type . "'! Defaulting to normal comment";
       $comment_type = '';
   }

                        $sql = trim(str_replace("\n","","INSERT INTO `". $wp_pref ."comments` ".
                            "(`comment_post_ID`,`comment_author`,`comment_author_email`," .
                            "`comment_author_url`,`comment_author_IP`,`comment_date`," .
                            "`comment_date_gmt`,`comment_content`,`comment_karma`, `comment_type`)" .
                            " VALUES ('".$id."','" . mysql_escape_string($checked_author) . "','" . mysql_escape_string($checked_email) .
                            "','" . mysql_escape_string($checked_url) . "','" . $row['comment_author_IP'] . "','" . $local_time .
                            "','" . $gm_time . "','" . mysql_escape_string($row['comment_content'])."','". $row['comment_karma'] ."','" . $comment_type ."');"));
                        $q = mysql_query($sql, $resWP) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
                        $cntCom = $cntCom + 1;
                    }
                }
                // get categories for entry
    $cntTmp = 0;
    $sql = "SELECT * FROM evo_postcats WHERE postcat_post_ID=" . $eid;
    $res = mysql_query($sql, $resB2) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
    if ($res) {
     while ($row = mysql_fetch_array($res, MYSQL_ASSOC)) {
      $cid = $arCat[$row['postcat_cat_ID']];
      $sql = trim(str_replace("\n","","INSERT INTO `". $wp_pref ."post2cat` ".
       "(`post_id`,`category_id`)" .
       " VALUES ('" . $id . "','" . $cid . "');"));
      //$q = mysql_query($sql, $resWP) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
      $cntCat = $cntCat + 1;
      $cntTmp = $cntTmp + 1;
     }
    }
    if ($cntTmp == 0) {
     // No categories defined in b2evo - put it in the default category
     $sql = trim(str_replace("\n","","INSERT INTO `". $wp_pref ."post2cat` ".
      "(`post_id`,`category_id`)" .
      " VALUES ('" . $id . "','1');"));
     //$q = mysql_query($sql, $resWP) or die("Invalid query: " . mysql_error() . "<BR /> SQL : " . $sql);
     $cntCat = $cntCat + 1;
    }
            }
            echo $cnt . " Entry record(s) imported! <BR />";
            echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $cntCom . "Comment record(s) imported! <BR />";
            echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" . $cntCat . "Entry Category record(s) imported! <BR />";
        } else {
            echo "No Entry records found!<BR />";
        }
        mysql_close($resB2);
        mysql_close($resWP);
        echo "That's all folks!";
 break;
}
?>
</body>
</html>

Saturday, October 31, 2009

How to Create and Make Bootable Windows 7 ISO from EXE Plus Setup1.Box and Setup2.Box Files

Students and alumni can get Windows 7 Professional for only $29!



http://www.microsoft.com/student/discounts/theultimatesteal-us/default.aspx



Then to make a ISO DVD from the downloaded files, see this link



http://www.mydigitallife.info/2009/10/23/how-to-create-and-make-bootable-windows-7-iso-from-exe-plus-setup1-box-and-setup2-box-files/



BUT watch out for this issue - it worked for me after copying string below to notepad



For those having issues (particularly when already running Win7), make sure that the command you are copying and pasting has only plain text. To do that, open Notepad and paste – you will see rectangles where there are weird characters (which the dashes seem to be). Replace any of those dashes with just a plain text dash (-) and try again. It worked for me on Win 7 Ultimate Eval. Below is the output:



C:\Users\me>oscdimg.exe -bC:\expandedSetup\boot\etfsboot.com -u2 -h -m -lWIN7 C:\expandedSetup\ C:\Win7.iso



OSCDIMG 2.54 CD-ROM and DVD-ROM Premastering Utility
Copyright (C) Microsoft, 1993-2007. All rights reserved.
Licensed only for producing Microsoft authorized content.



Scanning source tree (500 files in 48 directories)
Scanning source tree complete (874 files in 201 directories)
Computing directory information complete
Image file is 2520809472 bytes
Writing 874 files in 201 directories to C:\Win7.iso
100% complete
Final image file is 2523011072 bytes
Done.
C:\Users\me>