tag:blogger.com,1999:blog-52360638731195457102024-03-27T20:10:53.590-07:00GKproggyWelcome! Blog will feature random programming examples written in Java, C++, Assembly language, or some random stuff I worked on.Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-5236063873119545710.post-20812576289906695782017-01-09T22:25:00.005-08:002017-01-09T22:25:54.814-08:00Privacy Policy - GKproggy Video Poker<p>Effective date: January 9, 2017</p>
<p>Welcome to GKproggy Video Poker ("GKproggy Video Poker", "We"). GKproggy Video Poker was designed to protect yourself and your property.
<ul>
<li>Our Privacy Policy explains how we collect, use, and protect information in relation to our mobile application in connection with GKproggy Video Poker, and your choices about the use of your information.</li>
<li>By using GKproggy Video Poker you understand and agree that GKproggy Video Poker is a fantasy poker card game.</li>
</ul>
</p>
<p><b>1. INFORMATION WE COLLECT</b></p>
<p>If using Google Play Game Services through GKproggy Video Poker, analytics are collected by Google in-regards to usage of access keys generated for GKproggy Video Poker by Google. GKproggy Video Poker does not collect any personal information.</p>
<p><b>Log file information:</b></p>
<p>Google Play collects information for any exceptions generated by GKproggy Video Poker. Logs are provided via Google Play portal and shows device information, android version, and exception logs.</p>
<p><b>2. HOW WE USE YOUR INFORMATION</b></p>
<p>Anonymous information/analytics gathered by Google Play Game Services is used to improve stability of GKproggy Video Poker. We do not collect any personal information.</p>
<p><b>3. SHARING OF YOUR INFORMATION</b></p>
<p>We do not share any data with any third party.</p>
<p><b>4. HOW WE STORE YOUR INFORMATION</b></p>
<p>GKproggy Video Poker does not store any private information. Analytics collected by Google is not stored by GKproggy Video Poker.</p>
<p><b>5. YOUR CHOICES ABOUT YOUR INFORMATION</b></p>
<p>If you do not agree with anonymous analytics/information collected by Google services in the use of GKproggy Video Poker, you agree to uninstall GKproggy Video Poker from the device.</p>
<p><b>6. CHILDREN'S PRIVACY</b></p>
<p>GKproggy Video Poker does not knowingly collect or solicit any information from anyone under the age of 13 or knowingly allow such persons to use GKproggy Video Poker. GKproggy Video Poker is not directed at children under the age of 13.</p>
<p><b>7. HOW TO CONTACT US</b></p>
<p>If you have any questions about this Privacy Policy, please email us to apps@gkproggy.com</p>
<p><b>8. CHANGES TO OUR PRIVACY POLICY</b></p>
<p>We may modify or update this Privacy Policy from time to time, so please review it periodically. Your continued use of GKproggy Video Poker after any modification to this Privacy Policy will constitute your acceptance of such modification.</p>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com433tag:blogger.com,1999:blog-5236063873119545710.post-81237156392458834792017-01-09T22:08:00.003-08:002017-01-09T22:26:33.178-08:00Privacy Policy - ReCam<p>Effective date: January 9, 2017</p>
<p>Welcome to ReCam ("GKproggy", "ReCam", "We"). ReCam was designed to protect yourself and your property.
<ul>
<li>Our Privacy Policy explains how we collect, use, and protect information in relation to our mobile application in connection with ReCam, and your choices about the use of your information.</li>
<li>By using ReCam you understand and agree that ReCam is not meant to be used to invade anyone's privacy or to be used for any other nefarious purposes.</li>
</ul>
</p>
<p><b>1. INFORMATION WE COLLECT</b></p>
<p>If using Google Drive or YouTube to upload video or audio collected by ReCam, the content is made private under the user account selected when configuring recording job. Analytics are collected by Google Drive and YouTube in-regards to usage of access keys generated for ReCam by Google. ReCam does not collect any personal information.</p>
<p><b>Log file information:</b></p>
<p>Google Play collects information for any exceptions generated by ReCam. Logs are provided via Google Play portal and shows device information, android version, and exception logs.</p>
<p><b>2. HOW WE USE YOUR INFORMATION</b></p>
<p>Anonymous information/analytics gathered by Google Play, Google Drive, and YouTube is used to improve stability of ReCam. We do not collect any personal information.</p>
<p><b>3. SHARING OF YOUR INFORMATION</b></p>
<p>We do not share any data with any third party.</p>
<p><b>4. HOW WE STORE YOUR INFORMATION</b></p>
<p>ReCam only stores configuration for recording job on device in the shared preferences of mobile device in use. No personal information is stored on mobile device using ReCam. Analytics collected by Google is not stored by ReCam.</p>
<p><b>5. YOUR CHOICES ABOUT YOUR INFORMATION</b></p>
<p>If you do not agree with anonymous analytics/information collected by Google services in the use ReCam, you agree to uninstall ReCam from the device.</p>
<p><b>6. CHILDREN'S PRIVACY</b></p>
<p>ReCam does not knowingly collect or solicit any information from anyone under the age of 13 or knowingly allow such persons to use ReCam. ReCam is not directed at children under the age of 13.</p>
<p><b>7. HOW TO CONTACT US</b></p>
<p>If you have any questions about this Privacy Policy, please email us to apps@gkproggy.com</p>
<p><b>8. CHANGES TO OUR PRIVACY POLICY</b></p>
<p>We may modify or update this Privacy Policy from time to time, so please review it periodically. Your continued use of ReCam after any modification to this Privacy Policy will constitute your acceptance of such modification.</p>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.comtag:blogger.com,1999:blog-5236063873119545710.post-54415327334279396212016-06-18T02:50:00.000-07:002016-06-18T02:50:25.422-07:00ReCam 1.8 is out!<h3>Many great optimization and new features!</h3>
It has been a while since my last update, but it brings me great pleasure to release this update<br />
Release Notes:
<br />
<ul>
<li>File path of saved files now appear on in ReCam's File Browser</li>
<li>Updated UI problems with Android Marshmallow.</li>
<li>Fixed issue with scheduling on Android Marshmallow when device is asleep (Power saving mode).</li>
<li>Share Option available to content. (Long press on files on the ReCam file browser view and select share)</li>
<li>Storage Location for saving to YouTube and Google Drive. <b>Google Play Services needs to be installed from Google Play Store in order to get Option.</b></li>
</ul>
<div class="separator" style="clear: both; text-align: center;"><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7SK_4HBWpb3DjnTY8qdAJV7wCVfkxPgJceO5BBxP_gR6ku82Cuc__qUe_CwACLVWAf5CZcGVgKmatwK_jzaXibu_v6M61ieBhvko9BwWoz0vun81D3IMjimhO2WwavhoqwABw6ZlvE8PK/s320/Screenshot_20160617-235624.png" /></a></div>
<p>It is easy to automatically upload videos after recording. Just select the option YouTube or Google Drive under the storage location, pick the account, and content will be uploaded when recording is finished. Once upload is done, the file is removed from device, this way you keep precious free space. All the content is private on initial upload to either services. To make public, just log into YouTube or Google Drive and set the content up for public viewing. FYI, on initial setup of YouTube or Google Drive, Google will confirm permissions with you to allow ReCam to upload on your behalf.</p>
<p>Happy Recording!</p>
<p align=center>Download on Google Play!</p>
<table width=100%>
<tr>
<th>
Free (10 sec. Recording limit):
</th>
<th>
Premium:
</th>
</tr>
<tr>
<td>
<div class="separator" style="clear: both; text-align: center;"><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam_free" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://2.bp.blogspot.com/cA9VambiyZ5EiiFT3hEb7zBf3iMGhXGa4l1vAlyuZNV9WurEvZ8bOke5GqdBgIX4O0w=w300-rw" width="200" height="200"/></a></div>
</td>
<td>
<div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-OaPwL9IOBxJJZBakLPmmVC4NVpJOwacpa3HFNyW8nvDQFuKhr2-Kd-LCEin0vtXkEM=w300-rw" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://4.bp.blogspot.com/-OaPwL9IOBxJJZBakLPmmVC4NVpJOwacpa3HFNyW8nvDQFuKhr2-Kd-LCEin0vtXkEM=w300-rw" width="200" height="200"/></a></div>
</td>
</tr>
</table>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com18tag:blogger.com,1999:blog-5236063873119545710.post-36782278131558486942015-05-14T19:24:00.003-07:002015-05-14T19:26:12.935-07:00ReCam Updated!<p>ReCam has been updated with the new feature to Record on Demand! Spy lovers rejoice! Just pull out your phone and hit start recording. Once the recording begins, you can continue to use your phone incognito ;). You can also place the device on the table or in some hidden location. What you record is all up to you. Very good for keeping an eye on your property and surroundings.</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam_free" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/8wEqMCLpuiQO5KiHE5sLM9dVAjHGFjmLxSmNfotGBDB5-ds_k4q_AEzyipTmqh01Qko=h900-rw" /></a></div>
<p>In addition, UI has been improved.</p>
<div class="separator" style="clear: both; text-align: center;"><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://1.bp.blogspot.com/YJIvK_sGGSdewdwNzomCh2keXbE93EnfIanosdmWiMnR09Hl1ky_RKwTVl1Waa3hlA=h900-rw" /></a></div>
<p><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam_free">Check it out on Google Play!</a></p>
<p><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam">Pro Version also Available!</a></p>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-51514580436851419822015-03-02T01:38:00.000-08:002015-03-02T01:44:22.562-08:00ReCam v1.0 Released!<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc5bYbFolMZljyl4TXybetVL9IHUIsoz1o5z2lsbQK8lmYCBbjpBryAuplHqLTEqKjPzMvHysvECVldsqLeW9uP-Y3uOKQ_vkpYXZJWDne6VdQMk2gIPTXOp8-kQ1Wk1B_5gDJlzQB0f_t/s1600/poster_revised.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgc5bYbFolMZljyl4TXybetVL9IHUIsoz1o5z2lsbQK8lmYCBbjpBryAuplHqLTEqKjPzMvHysvECVldsqLeW9uP-Y3uOKQ_vkpYXZJWDne6VdQMk2gIPTXOp8-kQ1Wk1B_5gDJlzQB0f_t/s400/poster_revised.jpg" /></a></div><p>Ever wanted to use your phone or tablet to record Video or Audio at a certain time for a few seconds or minutes without you pressing camera and record? ReCam is there to help. ReCam gives you the ability to use your mobile or tablet as an automated recording device. You can set various schedules with varying duration. Recording jobs will run in the background which means you can still use your device even if a recording is in progress. You can schedule recordings to execute once or repeat every day or week.</p><p>Install the free Demo version now available at on Google Play: <div class="separator" style="clear: both; text-align: center;"><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam_free" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/cA9VambiyZ5EiiFT3hEb7zBf3iMGhXGa4l1vAlyuZNV9WurEvZ8bOke5GqdBgIX4O0w=w300-rw" /></a></div><div class="separator" style="clear: both; text-align: center;"><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam_free" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/NqnEGeqVDUcM-dQPg9ggtA-SzCR4tGTYo_dAOmB058oXukq_MCB5XLpaa8oc9PWZN4OF=h900-rw" /></a></div></p><p><a href="https://play.google.com/store/apps/details?id=com.gkproggy.recam">The full-version is also available on Google Play</a></p>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com2tag:blogger.com,1999:blog-5236063873119545710.post-40129925936996913092014-10-22T17:27:00.001-07:002014-10-22T17:27:47.694-07:00Java - Get IndexOf String of an Exact Word<p>Been a while since I posted but I thought this would be a good little piece of code to give you the index of an exact word in a large string. I found the need in this because I was parsing command-line output.</p>
<pre class="brush: java">
Pattern pattern = Pattern.compile("\\bbe\\b");
Matcher matcher = pattern.matcher("Today is a good day because I will be going to the park.");
if(!matcher.find())
{
return -1;
}
int index = matcher.start();
</pre>
<p>The result will ensure not to give you the index of 'be' in because and actually give you the exact 'be' in the String. If not found, return -1. Hope this helps!</p>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-46487294047771152772014-02-20T00:29:00.001-08:002014-02-20T00:30:47.226-08:00PDF to SVG - Java<p>I have been working with SVG formats recently. Mainly, trying to find a decent swing component for creating and modifying SVGs. As a result of such escapade, I decided to write a PDF to SVG converter. Now, I haven't fully tested it, but with the PDFs I have tried, it converted successfully.</p>
<p>The libraries I used were <a href="http://xmlgraphics.apache.org/batik/">Batik 1.7</a> and <a href="http://mvnrepository.com/artifact/org.swinglabs/pdf-renderer/1.0.5">PDF-Renderer v1.0.5</a></p>
<p>Here is My Main</p>
<pre class="brush: java">
public class ConversionMain
{
public ConversionMain()
{
File pdf = new File("ss12.pdf");
PDFUtility.PDF_TO_SVG(pdf);
}
public static void main(String[] args)
{
new ConversionMain();
}
}
</pre>
<p>Here is my PDFUtility function for taking PDF, reading it and then converting to SVG</p>
<pre class="brush: java">
public class PDFUtility
{
public static void PDF_TO_SVG(File pdfFile)
{
try
{
RandomAccessFile raf = new RandomAccessFile(pdfFile, "r");
FileChannel channel = raf.getChannel();
ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
PDFFile pdf = new PDFFile(buf);
DOMImplementation domImp = GenericDOMImplementation.getDOMImplementation();
for (int i = 1; i <= pdf.getNumPages(); i++)
{
PDFPage page = pdf.getPage(i);
// image dimensions
int width = (int) page.getWidth(); //Can be changed to whatever you like
int height = (int) page.getHeight();
Rectangle rect = new Rectangle(0, 0, (int) page.getBBox().getWidth(), (int) page.getBBox().getHeight());
Image image = page.getImage(width, height, rect, null, true, true);
String svgNS = "http://www.w3.org/2000/svg";
Document document = domImp.createDocument(svgNS, "svg", null);
SVGGraphics2D svgGenerator = new SVGGraphics2D(document);
Graphics graphics = svgGenerator.create();
graphics.drawImage(image, 0, 0, null);
boolean userCSS = true;
FileOutputStream fos = new FileOutputStream(new File("Page " + i + ".svg"));
Writer out = new OutputStreamWriter(fos);
svgGenerator.stream(out, userCSS);
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
</pre>
<p>Try it out and let me know what you think</p>
<p>Thanks!</p>Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com4tag:blogger.com,1999:blog-5236063873119545710.post-47920807118396278732013-10-26T20:16:00.002-07:002013-10-26T20:16:58.468-07:00wgetSo a few days ago I was browsing a site<br />
<br />
<a href="http://www.speedbicycles.ch/showBike.php?enr=442">http://www.speedbicycles.ch/showBike.php?enr=442</a><br />
<br />
and I wanted to download the images, but there are like 72 of them and I don't want to right click each one and save them. So I was thinking since I could use wget, but I don't want to download the whole site. I just want the pictures of this sweet looking bike! So I took a look at the URL for the images and sure enough they are all using a simple naming scheme (e.g. speed_001.jpg). So what immediately comes to mind is a bash script with a for loop calling wget to download all the images for me (because you know as programmers we are lazy).<br />
<pre class="brush: bash">#!/bin/bash
NUM=72
for ((i=1; i<=NUM; i++)) {
if [ $i -lt 10 ]
then
ADD="http://www.speedbicycles.ch/bikes/442/bigPic/speed_00${i}.jpg"
wget ${ADD}
else
ADD="http://www.speedbicycles.ch/bikes/442/bigPic/speed_0${i}.jpg"
wget ${ADD}
fi
}
</pre>
<br />
I'm not saying that this is the only way to do this, it's just what came to mind when faced with the problem.
Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-30698655648210737362013-09-19T12:17:00.000-07:002013-09-19T12:22:06.713-07:00Getting Alt Text from IMG tags in HTML using Pattern Regex - JavaI was given the task to retrieve alt= from an img tag inside an html string. Here is an example:<br />
<br />
<br />
<pre class="brush: html">
<div class="rc_release_list_item_picture">
<a href="/release/fatboy-slim-and-riva-starr/21683/eat-sleep-rave-repeat/"><img width="87" height="87" border="0" src="http://n.image.weareone.fm/news/_newsgrafiken/2013/_releases/lames/24-07-2013--fatboy-slim-and-riva-starr-eat-sleep-rave-repeat_s.png" alt="Fatboy Slim and Riva Starr - Eat, Sleep, Rave, Repeat" title="Fatboy Slim and Riva Starr - Eat, Sleep, Rave, Repeat" /></a>
</div>
</pre>
<br />
<br />
I used the Pattern and Matcher Class provided by the java.util package. The following is a sample of quick main I built to achieve my task:
<br />
<br />
<pre class="brush: java">
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* User: GKproggy
*/
public class Main
{
private static String testStrings = "<div class=\"rc_release_list_item_picture\">\n" +
" <a href=\"/release/fatboy-slim-and-riva-starr/21683/eat-sleep-rave-repeat/\"><img width=\"87\" height=\"87\" border=\"0\" src=\"http://n.image.weareone.fm/news/_newsgrafiken/2013/_releases/lames/24-07-2013--fatboy-slim-and-riva-starr-eat-sleep-rave-repeat_s.png\" alt=\"Fatboy Slim and Riva Starr - Eat, Sleep, Rave, Repeat\" title=\"Fatboy Slim and Riva Starr - Eat, Sleep, Rave, Repeat\" /></a>\n" +
"</div>";
public static void main(String[] args)
{
String regexPattern = "<img[^>]*alt=[\"]*([\\w\\s-.:\\/,]+)[\"]*[^>]*/>";
Pattern p = Pattern.compile(regexPattern);
Matcher m = p.matcher(testStrings);
if(m.find())
{
System.out.println(m.group(1));
}
}
}
</pre>
<br />
<br />
Hope this was a quick help to get an idea how to use regex to retrieve info you want from raw HTML.Gkproggyhttp://www.blogger.com/profile/08173358614689649477noreply@blogger.com1tag:blogger.com,1999:blog-5236063873119545710.post-88196049476903248752013-07-30T22:08:00.001-07:002013-07-30T22:08:27.362-07:00GKproggy Video Poker 2.0 is out on Google PlayThe new version of 2.0 features:<div>
<ul>
<li>Custom bet option to enter any amount. </li>
<li>Google Play Game Services is available for you to play and unlock achievements as well as post your tournament score to show off your winnings on the leader board. <a href="http://goo.gl/CLlS5h">Check it out on Google Play</a></li>
</ul>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/k9cVFsSciHJPz6dBhzmba5-qYE1u4A0ySqQRB28HybXpgyEwR_rifzid4snqpiv6Hyk=w300-rw" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://3.bp.blogspot.com/k9cVFsSciHJPz6dBhzmba5-qYE1u4A0ySqQRB28HybXpgyEwR_rifzid4snqpiv6Hyk=w300-rw" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://1.bp.blogspot.com/N3yKfF7xmuZ9-ooSfByoQnYqhFq2XBhT6S89f9t-Eb3aWV_R6aFkoA9d5Fo1h_BrKas=h900-rw" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="200" src="http://1.bp.blogspot.com/N3yKfF7xmuZ9-ooSfByoQnYqhFq2XBhT6S89f9t-Eb3aWV_R6aFkoA9d5Fo1h_BrKas=h900-rw" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div>
<br /></div>
</div>
Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com10tag:blogger.com,1999:blog-5236063873119545710.post-65891605620842204292013-02-18T19:34:00.000-08:002013-02-18T19:34:19.847-08:00XNA Visual Studio 2010 Direct3d Issue - SolvedI was trying to run some code in Visual Studio 2010 using XNA framework, but I was required to run using HiDef profile. Running my code in Refresh profile was not working due to some buffer indices issue. Here is a screenshot of error I was seeing after building project and trying to debug when setting profile to HiDef:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXS4OhuFvT9s6UatYqhtczyzsnRt8X2HmDsYcGqK7d5HKd6RWeDJAbAAAYDoZYQauYtuMEQBeyQeDOoqkFALN4sa7mOApADRxZU3aTdiIYCUkuGbk-gYmlWAwzG704vOWKIJH_dykuBgk/s1600/screenvs2010.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="206" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXS4OhuFvT9s6UatYqhtczyzsnRt8X2HmDsYcGqK7d5HKd6RWeDJAbAAAYDoZYQauYtuMEQBeyQeDOoqkFALN4sa7mOApADRxZU3aTdiIYCUkuGbk-gYmlWAwzG704vOWKIJH_dykuBgk/s320/screenvs2010.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
I looked all over the internet for error, "No suitable graphics card found. Could not find a Direct3D device that supports the XNA Framework HiDef profile...." I kept finding suggestion to change project property to refresh, but this was not good enough. </div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Solution:</div>
<div class="separator" style="clear: both; text-align: left;">
Here is how I solved my issue. I was trying to build from a laptop (ASUS) which has two graphic cards, Intel and Nvidia. Turns out something is up with Intel graphics drivers and when you run Visual Studio 2010 it throws the problem above. When I tried to run VS2010 by right clicking on desktop application on icon and choosing "Run with graphics processor" -> "High performance NVIDIA processor", my project compiled using HiDef profile.</div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhruq7gOTMvLEwBbKB8jsgCdGv31WGW8ggtS4LDDuBnu0AD4RpuTARYywame_bZn0eW7HpSE3K9xt4P-hgznX8CqnmZQ3I8361mFM8Hayh5c6kaRdsKDxy-AtqMAZFeUK_7Yh_RoX68_Ns/s1600/screenvs20121.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="50" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhruq7gOTMvLEwBbKB8jsgCdGv31WGW8ggtS4LDDuBnu0AD4RpuTARYywame_bZn0eW7HpSE3K9xt4P-hgznX8CqnmZQ3I8361mFM8Hayh5c6kaRdsKDxy-AtqMAZFeUK_7Yh_RoX68_Ns/s320/screenvs20121.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: left;">
Hope this helps you guys looking to run HiDef profile.</div>
<br />Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-83547897697910573712013-01-26T21:54:00.000-08:002013-01-26T21:58:12.167-08:00Draw Text on Canvas with Font Size Independent of Screen Resolution - AndroidI will show how to draw text with a font size independent of screen resolution on to a canvas.<br />
First we need to create an XML and place it in res/values. Call the file myFontSize. The following is the content of the file<br />
<pre class="brush: xml">
<?xml version="1.0" encoding="utf-8"?>
<resources>
<dimen name="myFontSize">20sp</dimen>
</resources>
</pre>
Here is a sample use and how to implement.<br />
<pre class="brush: java">import android.app.Activity;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
public class MainActivity extends Activity
{
Paint paint;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
paint = new Paint();
View test = new TestView(this);
setContentView(test);
}
public class TestView extends View
{
public TestView(Context context)
{
super(context);
setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
}
@Override
protected void onDraw(Canvas canvas)
{
int size = getResources().getDimensionPixelSize(R.dimen.myFontSize);
paint.setColor(Color.BLACK);
paint.setTextSize(size);
canvas.drawText("HELLOOOOOOOOOOOOOO!", 0, size, paint);
super.onDraw(canvas);
}
}
}
</pre>
The magic happens on the call to getResources().getDimensionPixelSize(..). This function grabs your set font size (in this case 20sp) and returns it as an appropriate size to give to your paint. Paint is the attributes which will tell the canvas what to do to the provided text.
<br />
<br />
You should see the following on different resolutions<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNULuLVOQ6fnlR-MVbLJ1YwkkWvZ6foIQbRog5E_-lZkqJBCplgKb9RVoFTlQMD_R96tykEvMMXp-yVu4PD_W8GlJEgcxK5w05233GRAiAsQjqw6uRhbin7A_OIZekrlzzgNbsymuGMKY/s1600/pixelsample.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjNULuLVOQ6fnlR-MVbLJ1YwkkWvZ6foIQbRog5E_-lZkqJBCplgKb9RVoFTlQMD_R96tykEvMMXp-yVu4PD_W8GlJEgcxK5w05233GRAiAsQjqw6uRhbin7A_OIZekrlzzgNbsymuGMKY/s320/pixelsample.png" width="294" /></a></div>
<br />
<br />Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com1tag:blogger.com,1999:blog-5236063873119545710.post-66179424165808849892012-09-24T23:13:00.002-07:002012-09-24T23:13:10.705-07:00Mount System folder of an Android device to force push APK or force remove APKThere is a way to install an apk by doing <span style="font-family: Courier New, Courier, monospace;">adb install <the name of your apk></span>.<span style="font-family: inherit;"> The problem is sometimes when you do this, you get permission denied or failed to install and there can be various reasons for that. If you want to manipulate the System folder yourself, we need to have root access on your Android device and then we need to mount /System.</span><br />
<span style="font-family: inherit;"><br /></span>
<br />
<ol>
<li>Set your phone to USB debugging and then plug USB</li>
<p></p>
<li>Bring up command line in Windows</li>
<p></p>
<li>Go to directory of android sdk -> platform tools (if you set your environmental variables then skip this, if you type 'adb devices' and you get an error, then you haven't)</li>
<p></p>
<li>type <span style="font-family: Courier New, Courier, monospace;">adb shell</span></li>
<p></p>
<li><span style="font-family: inherit;">You should see a prompt change to $</span></li>
<p></p>
<li><span style="font-family: inherit;">Type </span><span style="font-family: Courier New, Courier, monospace;">su</span><span style="font-family: inherit;"> and hit enter. You should now see a prompt #</span></li>
<p></p>
<li>Type <span style="font-family: Courier New, Courier, monospace;">mount</span><span style="font-family: inherit;">. You should see a list of items you can mount. On that list look for and item that says '/dev/block/<something> /system ...... <something> can be anything, just find one which resembles this.</span></li>
<p></p>
<li><span style="font-family: inherit;">Once you found it, type </span><span style="font-family: Courier New, Courier, monospace;">mount -o remount,rw /dev/block/<something> /system</span></li>
</ol>
<p>Now the folder should be mounted. We can now navigate to the device to system/app. type <span style="font-family: Courier New, Courier, monospace;">cd system/app</span> and now we can remove any apks and push anything we want.</p>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com1tag:blogger.com,1999:blog-5236063873119545710.post-48113300255968151232012-08-28T03:06:00.000-07:002012-09-24T22:47:51.496-07:00Adding Environmental Paths in Ubuntu Linux<p>I decided to work on some Android development project on Ubuntu. I had to switch because a library I was trying to use had to be built with the Android NDK. (Windows really took a dump on me when I tried to use Cygwin). Since this was my first install of Android and Java on my linux machine, I had to setup the PATHS in order for me to use them in terminal. Here is how to add them</p>
<pre class="brush: shell">
#open your terminal and type
nano ~/.bashrc
#Add to the top of file: (remember you have to tell linux where the sdk directory is)
#for me, I had my SDK in the home/username directory represented by ~.
export PATH=${PATH}:~/android-sdk-linux/tools
export PATH=${PATH}:~/android-sdk-linux/platform-tools
#press ctrl + X, then Y to confirm and ENTER to exit
#More than likely, you will need to restart
#When you open terminal, you should be able to
#type 'android' without quotations and it should bring up SDK manager</pre>
Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-24345353924066093762012-06-19T13:19:00.000-07:002012-06-19T13:19:28.390-07:00GKproggy RSS News Reader - Now on Amazon App Store<p>Hi guys, application now available for the Kindle Fire. Check it out:
<a href="http://www.amazon.com/GKproggy-RSS-Reader/dp/B008CIYQJ8/ref=sr_1_1?s=mobile-apps&ie=UTF8&qid=1340136869&sr=1-1&keywords=gkproggy" imageanchor="1" style="margin-left:1em; margin-right:1em"><img border="0" height="300" width="300" src="http://ecx.images-amazon.com/images/I/71StBuceC0L._SL500_AA300_.png" /></a>
<p>
<a href="http://www.amazon.com/GKproggy-RSS-Reader/dp/B008CIYQJ8/ref=sr_1_1?s=mobile-apps&ie=UTF8&qid=1340136869&sr=1-1&keywords=gkproggy">Amazon Link</a></p>
<p>Thanks!</p>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com1tag:blogger.com,1999:blog-5236063873119545710.post-18225937005944905802012-06-05T17:39:00.000-07:002012-06-05T17:39:26.295-07:00RSS News Reader Application Now Available @ Google Play<p>Hey everyone, I have released a new application I worked on my free time on Google Play. The application is a simple RSS news reader. Check it out: <a href="https://play.google.com/store/apps/details?id=com.gkproggy.gkproggynews">Google Play Link</a> </p>
<table align="center">
<tr>
<td>
<a href="https://play.google.com/store/apps/details?id=com.gkproggy.gkproggynews"><img border="0" height="230" width="138"" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEix17VNSvfDsSur41NsHcASRj_giI-SCqfyLbqufSo9nJjF-hdfCbTCVw6qJB3YXvnuJnwFFKNqY2fQCRDphXKNJO9-PXF315z2umaFv52er8JMe320W0Ewn26Ub1xwZpPejf6LHG6tteA/s320/pic1.jpg" /></a>
</td>
<td>
<a href="https://play.google.com/store/apps/details?id=com.gkproggy.gkproggynews"><img border="0" height="230" width="138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiDbslEG1sfeBs0_BpPmgRtAllLyHTRkvAPmESed8vo_iHC28I9xbCOH8DiQmQGmV-oFPiaXcjlYxnv2bqi9hsTSyxlHLKkX4uEOLZ1P609smuOzPVBF81RjrIz9Ajtl9_IRsL5zdHLkXA/s320/pic2.jpg" /></a>
</td>
<td>
<a href="https://play.google.com/store/apps/details?id=com.gkproggy.gkproggynews"><img border="0" height="230" width="138" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjIExm606hb2NffewIQiR73ajUeFKRVnPBD57B4ErRaFyGj16Gj101ih2oqt36y3vlFRYalGj7woWMa7eWGuq2YCWIM51BzARdC2ztuOhPgJRzG-wqlGKC56oxnnt3cyp_TZmbRq65qMnw/s320/pic3.jpg" /></a>
</td>
</tr>
</table>
<p>Thanks</p>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-82165449647099456422012-05-05T03:16:00.001-07:002012-05-07T09:00:03.190-07:00Android - Switch Tabs in TabHost within a Listview by Swipes using GestureDetector<p>Implementing a tabhost is a great way to add functionality to your app. Sadly, tabhost forces the user to click on the tabs to switch between screens. But thankfully we are programmers and can make our programs do what we want them to do. In this tutorial, Ill show you how to implement a GestureDetector to handle the left and right swipes from user to switch between tabs. Lets start with our XML layout of the main window:
<p>main.xml
<pre class="brush: xml">
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:padding="5dp" >
<com.daish.viewtest.TestListView
android:id="@+id/custom_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</FrameLayout>
</LinearLayout>
</TabHost>
</pre>
<p>Next we have our main activity. I created a method called switchTabs(boolean direction) to tell tabhost which direction to switch tabs. I also implemented a listener on tabchanged. Once a tab is changed, the listener is fired and I then change the content on listview.
<pre class="brush: java">
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
import android.widget.TabHost.OnTabChangeListener;
public class ViewTestActivity extends TabActivity
{
private TestListView testListView = null;
private TabHost tabHost = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
spec = tabHost.newTabSpec("Tab 1 Tag").setIndicator("Tab 1")
.setContent(R.id.custom_list);
tabHost.addTab(spec);
testListView = (TestListView) findViewById(R.id.custom_list);
spec = tabHost.newTabSpec("Tab 2 Tag").setIndicator("Tab 2")
.setContent(R.id.custom_list);
tabHost.addTab(spec);
//Done to make list update itself on a tab change
tabHost.setOnTabChangedListener(new TabChangeListener());
tabHost.setCurrentTab(1);
}
public void switchTabs(boolean direction)
{
if (direction) // true = move left
{
if (tabHost.getCurrentTab() == 0)
tabHost.setCurrentTab(tabHost.getTabWidget().getTabCount() - 1);
else
tabHost.setCurrentTab(tabHost.getCurrentTab() - 1);
}
else
// move right
{
if (tabHost.getCurrentTab() != (tabHost.getTabWidget().getTabCount() - 1))
tabHost.setCurrentTab(tabHost.getCurrentTab() + 1);
else
tabHost.setCurrentTab(0);
}
}
private class TabChangeListener implements OnTabChangeListener
{
@Override
public void onTabChanged(String tabId)
{
testListView.init(tabHost.getCurrentTab());
}
}
}
</pre>
<IFRAME SRC="http://ad.doubleclick.net/adi/N7433.148119.BLOGGEREN/B6533661.115;sz=300x250;ord=[timestamp]?;lid=41000000026530730;pid=60768;usg=AFHzDLsyw5HDL8duArEmBN3-Zhq1mylq-w;adurl=http%253A%252F%252Fwww.abt.com%252Fproduct%252F60768%252FSamsung-GT-P3113TSYXAR.html;pubid=540115;price=%24249.97;title=Samsung+8GB+Galaxy+Tab+2+Wi-Fi+Tablet+-+GT-P3113TSYXAR;merc=Abt+Electronics+%26+Appliances;imgsrc=http%3A%2F%2Fcontent.abt.com%2Fmedia%2Fimages%2Fproducts%2FBDP_Images%2Fbig_GTP3113TSYXAR.jpg;width=86;height=135" WIDTH=300 HEIGHT=250 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'></IFRAME>
<p>Next we have the heart of the content; the listview. The goal is to allow the user to swipe left and right and our program would switch tabs. Although, we have to make sure we did not remove the functionality of clicking on an item and scrolling up and down on list. On my first attempt, I made an @Override onTouchEvent(MotionEvent event) and I tried to handle the swipes. The problem my implementation had was if the user swiped, the item on the next tab would automatically click after user lifted their finger. As such, I had to find an alternative. This is where GestureDetector came in. This class gave me the ability to analyze the touch event. I kept the original @Override onTouchEvent(MotionEvent event), except I passed the event to the GestureDetector and let the class handle the left and right swipes. If the GestureDetector analysis of the touch event appeared to be anything other than left or right swipes, let ListView handle it (ex. scroll up and down as well as clicks). The result was the functionality I was looking for.
<pre class="brush: java">
import android.app.AlertDialog;
import android.content.Context;
import android.util.AttributeSet;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
import android.view.GestureDetector.OnGestureListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class TestListView extends ListView
{
Context context;
private ArrayAdapter<String> test;
String[] testItems = {"Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary"};
String[] anotherTestItems = {"Homer", "Leslie", "Gary","Beaver","Homer", "Leslie", "Gary","Beaver","Homer", "Leslie", "Gary","Beaver","Homer", "Leslie", "Gary","Beaver"};
//If built programmatically
public TestListView(Context context)
{
super(context);
this.context = context;
}
//This example uses this method since being built from XML
public TestListView(Context context, AttributeSet attrs)
{
super(context, attrs);
this.context = context;
}
//Build from XML layout
public TestListView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
this.context = context;
}
public void init(int i)
{
if(i == 0)
test = new ArrayAdapter<String>(getContext(),R.layout.row, R.id.label , testItems);
else
test = new ArrayAdapter<String>(getContext(),R.layout.row, R.id.label , anotherTestItems);
setAdapter(test);
setOnItemClickListener(new ListSelection());
}
//GestureDetector used to for analyze touch even from user
private GestureDetector gesture = new GestureDetector(new GestureListener());
//Method is called when ListView detects an onTouchEvent
@Override
public boolean onTouchEvent(MotionEvent event)
{//Sends event to GestureDetector to see if we can use event
boolean result = gesture.onTouchEvent(event);
//if result is true, then we need to handle event, not listview
//false means listview can handle event to pass it on
if(result)
return result;
return super.onTouchEvent(event);
}
private float startX= 0;
private float endX = 0;
//Class which will analyze touch event and determine what user did
private class GestureListener implements OnGestureListener
{
@Override
public boolean onDown(MotionEvent e)
{
return false;
}
@Override
public void onShowPress(MotionEvent e)
{
}
@Override
public boolean onSingleTapUp(MotionEvent e)
{
return false;
}
@Override
public boolean onScroll(MotionEvent e1, MotionEvent e2,
float distanceX, float distanceY)
{
return false;
}
@Override
public void onLongPress(MotionEvent e)
{
}
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,
float velocityY)
{
float x = velocityX < 0 ? -1*velocityX : velocityX;
float y = velocityY < 0 ? -1*velocityY : velocityY;
if(x > y)
{
System.out.println("Moving" + " " + (startX - endX));
startX = e1.getX();
endX = e2.getX();
if ((startX - endX) < -120)
{
((ViewTestActivity) context).switchTabs(true);
}
else if ((startX - endX) > 120)
{
((ViewTestActivity) context).switchTabs(false);
}
return true;
}
return false;
}
}
private class ListSelection implements OnItemClickListener
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage("You pressed item #" + (position+1));
builder.setPositiveButton("OK", null);
builder.show();
}
}
}
</pre>
<p>Hope this was helpful. Enjoy!
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkwOaGtVjbitty32aNKfH14PHoOvtOfG_R64PSS_aVRX2OLyb8S2ulmHKw3iH7sR1_C4Yq6O5PXm5H79VeRSZqBSkByYekbsBNJM-Vwn7nH6LaFrV7yVbGk0HRLi7KmJ9GWUP1cuxf7ag/s1600/TabHostGestureDetector.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="251" width="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkwOaGtVjbitty32aNKfH14PHoOvtOfG_R64PSS_aVRX2OLyb8S2ulmHKw3iH7sR1_C4Yq6O5PXm5H79VeRSZqBSkByYekbsBNJM-Vwn7nH6LaFrV7yVbGk0HRLi7KmJ9GWUP1cuxf7ag/s320/TabHostGestureDetector.png" /></a></div>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com2tag:blogger.com,1999:blog-5236063873119545710.post-55051702554154456392012-05-03T01:24:00.000-07:002012-05-07T08:59:58.316-07:00Android - Creating a Tabhost with ListView and Button under ListView<p>I decided this was worthy of a post since I had a hard time figuring this out. Android has a cool TabActivity which allow us to add tabs to our application. Of course we have to declare an XML file for our main window which includes all the containers and widgets needed to create UI:</p>
<p>Main.xml</p>
<p><pre class="brush:xml">
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="5dp" >
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="4"
android:padding="5dp" >
<com.daish.viewtest.TestListView
android:id="@+id/custom_list"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_weight="0"
android:padding="5dp" >
<Button
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="BUTTON UNDER LISTVIEW!" />
</FrameLayout>
</LinearLayout>
</TabHost>
</pre>
<p>The XML layout includes a tabwidget, listview, and a button. The trick here is <b>android:layout_weight=""</b> which indicates which widget will take up portions of the screen. I also added a button which took up another portion. When it comes down to FrameLayouts, you have to indicate the weight to determine how much of the screen it will take up or else some widgets will appear to float infront of another, which is the nature of a framelayout. The problem is Tabhost needs to have a Framelayout for its content of the tabs and this was a way I found to add button. Linear Layout and Relative layout did not work for me. If someone has a better way, please feel free to share.
<p> Here is my Main Activity Class:
<p><pre class="brush:java">
import android.app.TabActivity;
import android.os.Bundle;
import android.widget.TabHost;
public class ViewTestActivity extends TabActivity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
TabHost tabHost = getTabHost(); // The activity TabHost
TabHost.TabSpec spec; // Resusable TabSpec for each tab
//tab creation
spec = tabHost.newTabSpec("Tab 1 Tag").setIndicator("Tab 1").setContent(R.id.custom_list);
tabHost.addTab(spec);
spec = tabHost.newTabSpec("Tab 2 Tag").setIndicator("Tab 2").setContent(R.id.custom_list);
tabHost.addTab(spec);
tabHost.setCurrentTab(1);
}
}
</pre>
<p>Here is the Class which extends ListView:
<p><pre class="brush:java">
import android.app.AlertDialog;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class TestListView extends ListView
{
private ArrayAdapter<String> test;
String[] testItems = {"Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary","Larry", "John", "Gary"};
//If built programmatically
public TestListView(Context context)
{
super(context);
init();
}
//This example uses this method since being built from XML
public TestListView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
//Build from XML layout
public TestListView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init();
}
public void init()
{
test = new ArrayAdapter<String>(getContext(),R.layout.row, R.id.label , testItems);
setAdapter(test);
setOnItemClickListener(new ListSelection());
}
private class ListSelection implements OnItemClickListener
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage("You pressed item #" + (position+1));
builder.setPositiveButton("OK", null);
builder.show();
}
}
}
</pre>
<IFRAME SRC="http://ad.doubleclick.net/adi/N7433.148119.BLOGGEREN/B6533661.126;sz=300x250;ord=[timestamp]?;lid=41000000026530730;pid=60768;usg=AFHzDLsyw5HDL8duArEmBN3-Zhq1mylq-w;adurl=http%253A%252F%252Fwww.abt.com%252Fproduct%252F60768%252FSamsung-GT-P3113TSYXAR.html;pubid=540115;price=%24249.97;title=Samsung+8GB+Galaxy+Tab+2+Wi-Fi+Tablet+-+GT-P3113TSYXAR;merc=Abt+Electronics+%26+Appliances;imgsrc=http%3A%2F%2Fcontent.abt.com%2Fmedia%2Fimages%2Fproducts%2FBDP_Images%2Fbig_GTP3113TSYXAR.jpg;width=86;height=135" WIDTH=300 HEIGHT=250 MARGINWIDTH=0 MARGINHEIGHT=0 HSPACE=0 VSPACE=0 FRAMEBORDER=0 SCROLLING=no BORDERCOLOR='#000000'></IFRAME>
<p>Here is the result of code above. Enjoy!</p>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG6jumyAaVR-wmWSY6nonWe3wmRTWrNldEsiXgFk5-NZu-e5c-QrGE5KQ6K2d6x3wmQFQEazVEZJ5JWEdLkNnqjDN6eAnl_Qd9SJIHAIRQGAxv9CH5BV_a6h3SDuAQiWwlJZmpIeQbOGk/s1600/tabhostsample.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="320" width="215" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjG6jumyAaVR-wmWSY6nonWe3wmRTWrNldEsiXgFk5-NZu-e5c-QrGE5KQ6K2d6x3wmQFQEazVEZJ5JWEdLkNnqjDN6eAnl_Qd9SJIHAIRQGAxv9CH5BV_a6h3SDuAQiWwlJZmpIeQbOGk/s320/tabhostsample.png" /></a></div>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com13tag:blogger.com,1999:blog-5236063873119545710.post-34232795374663775052012-01-11T03:27:00.001-08:002012-03-01T00:02:25.851-08:00Android - Extending ListView and Instantiate with XML and AlertDialogs for itemSelectWas doing a bit of coding and decided to demonstrate a way to create your own class which extends ListView. I wanted to manage specific code in regards to this listview and didnt want the code to be all over the place. Anywho, here is the source of a quick ListView showing names.<br />
<br />
<p>When you click on the items an AlertDialog box appears indicating what you clicked on.<br />
</p><br />
<p>NOTE: the XML files below should go in res/layout folder of your project.<br />
</p><br />
<p>Main.xml Make sure to make change to package name!<br />
</p><br />
<pre class="brush:xml"><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<com.daish.viewtest.TestListView
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
</LinearLayout></pre><br />
<p>row.xml This layout defines how each row is going to look like. This has a picture and name<br />
</p><br />
<pre class="brush:xml"><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal" >
<ImageView
android:id="@+id/icon"
android:layout_width="22dp"
android:layout_height="22dp"
android:layout_marginLeft="4dp"
android:layout_marginRight="10dp"
android:layout_marginTop="4dp"
android:src="@drawable/ic_launcher" >
</ImageView>
<TextView
android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="20dp" >
</TextView>
</LinearLayout></pre><br />
<p>MainActivity (beginning of program)<br />
</p><br />
<pre class="brush:java">import android.app.Activity;
import android.os.Bundle;
public class ViewTestActivity extends Activity
{
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
}
}</pre><br />
<p>TestListView Class extending ListView<br />
</p><br />
<pre class="brush:java">package com.daish.viewtest;
import android.app.AlertDialog;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
public class TestListView extends ListView
{
private ArrayAdapter<String> test;
String[] testItems = {"Larry", "John", "Gary"};
//If built programmatically
public TestListView(Context context)
{
super(context);
init();
}
//This example uses this method since being built from XML
public TestListView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
//Build from XML layout
public TestListView(Context context, AttributeSet attrs, int defStyle)
{
super(context, attrs, defStyle);
init();
}
public void init()
{
test = new ArrayAdapter<String>(getContext(),R.layout.row, R.id.label , testItems);
setAdapter(test);
setOnItemClickListener(new ListSelection());
}
private class ListSelection implements OnItemClickListener
{
@Override
public void onItemClick(AdapterView<?> parent, View view, int position,
long id)
{
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
builder.setMessage("You pressed item #" + (position+1));
builder.setPositiveButton("OK", null);
builder.show();
}
}
}
</pre><br />
<p>The code above should give you this:<br />
</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidI3kgg3e77mgrYDSQbf7Y_EBYhE3wpcyc8ayW2JmEx2lgakpWUozlZnAb_rtZdQhbudfEkmWPl9ExOkMeReA9022uqPqCdzib4eINDcb8qCImc_nHtuwA5Fo9MNW8n78CBTMQoz7K0e8/s1600/ListViewScreenShot.png" imageanchor="1" style="clear:left; float:left;margin-right:1em; margin-bottom:1em"><img border="0" height="320" width="213" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidI3kgg3e77mgrYDSQbf7Y_EBYhE3wpcyc8ayW2JmEx2lgakpWUozlZnAb_rtZdQhbudfEkmWPl9ExOkMeReA9022uqPqCdzib4eINDcb8qCImc_nHtuwA5Fo9MNW8n78CBTMQoz7K0e8/s320/ListViewScreenShot.png" /></a></div>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-45828783066427583052012-01-06T12:33:00.000-08:002012-01-06T15:56:31.560-08:00Recovering Cisco IP Phone 7940 / 7960<p>These Cisco IP phones are a pain to setup. I was given the task to setup 6 Cisco IP phones. Out of the batch 2 did not boot up to the point where we could access the settings. On the Cisco 7940 we received TFTP timeout o / A and just remained there. The other was a Cisco 7960 and gave an error Application Protocol Invalid. I was able to recover the phones by doing the following:<br />
<br />
<p>CAUTION: The instructions configure phone to work as SIP Phones not Skinny SCCP. <br />
<br />
<p>You will need the following:<br />
<ol><li>TFTpd32 <a href="http://tftpd32.jounin.net/">http://tftpd32.jounin.net/</a></li>
<li>Cisco IP Phone firmware (I used P0S3-8-12-00) <a href="http://radiotwenterand.nl/~graver/cisco/SIP-7960/P0S3-8-12-00.zip">http://radiotwenterand.nl/~graver/cisco/SIP-7960/P0S3-8-12-00.zip</a></li>
<li>Cisco IP Phone configuration files <a href="http://www.minded.ca/default/wp-content/uploads/2009/12/Cisco-Config-Files.zip">http://www.minded.ca/default/wp-content/uploads/2009/12/Cisco-Config-Files.zip</a>. If you do not know how to setup config files, check out the site <a href="http://www.minded.ca/2009-12-16/configure-cisco-ip-phones-with-asterisk/">http://www.minded.ca/2009-12-16/configure-cisco-ip-phones-with-asterisk/</a></li>
<li>Switch</li>
<li>Computer</li>
</ol><br />
<p>Instructions:<br />
<ol><li>Download TFTpd32 at <a href="http://tftpd32.jounin.net/">http://tftpd32.jounin.net/</a> and firmware and configuration files.</li>
<li>Grab a computer and install TFTpd32. Unzip firmware and configuration files to a folder. To be safe, setup configuration files to have SIP[Phone MAC Address].cnf and SEP[Phone MAC Address].cnf.xml (Check website above if you don't know how to setup configs)</li>
<li>Disconnect computer from network and plug into switch (Switch should only have computer and phone. Leave Cisco Phone powered off while you setup TFTpd32)</li>
<li>Set the computer IP address to 192.168.1.1 MASK 255.255.255.0. Bring up TFTpd32 and go to settings. <br />
<ul><li>Under Global Tab, only enable TFTP Server and DHCP Server.</li>
<li>Click on TFTP tab. Set Base Directory to the location of the folder where Cisco IP firmware and configuration files are. Set TFTP security to none.</li>
<li>Click on DHCP tab and set IP pool starting address to 192.168.1.2. Set pool to 5 or something like that. Default router put 192.168.1.1 mask 255.255.255.0 Additional option 66 in small box and ip 192.168.1.1 in the box next to it. Uncheck Ping Address before assignation and Persistant leases.</li>
</ul><li>Hit OK and Restart TFTpd32.</li><br />
<br />
<br />
<li>While your TFTP is running, power on the Cisco IP phone. If all goes well, TFTpd32 will log the connection and show the files it requests.</li><br />
<br />
<br />
<li>The phones will show upgrading firmware.</li><br />
<br />
<br />
<li>Phones should now boot up completely once installation is complete.</li><br />
<br />
<br />
</ol>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com33tag:blogger.com,1999:blog-5236063873119545710.post-64401473023441899012011-12-17T12:51:00.000-08:002011-12-17T17:23:06.713-08:00Automatically Shutdown Windows 7 / XP through Command PromptThere have been many times where I wish a program would shutdown my computer once it has completed its processes. Unfortunately, some programs do not have this option. The following command which is executed in the command prompt will allow you shutdown windows with also the possibility to restart the OS. <br />
<br />
If the following code is copied into your command prompt, it will shutdown the computer at 6:30pm
<pre class="brush:java">
at 18:30 shutdown -s
</pre>
To confirm task has been added, just type "at" in the command prompt, and you will see the scheduled tasks.
If you would like to remove the job type:
<pre class="brush:java">
at [id] /delete
//[id] = replace with the ID number to delete
</pre>
To restart windows, just add -r command. A prompt can also be given to give notification of upcoming shutdown by adding -c. The command can also be generated to work on certain days of the week. Ex:
<pre class="brush:java">
at 18:30 /every:T,Th,F shutdown -s -r -c "Computer is going to restart!"
</pre>
The code above says the computer will restart at 6:30pm every Tuesday through Friday and give the message indicating pc is restarting. Hope this helped!
IMPORTANT: If this command is being issued through windows 7, please ensure you run command prompt as Administrator or else you will get "Access Denied".
<br />Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com0tag:blogger.com,1999:blog-5236063873119545710.post-13225349979708423212011-02-02T22:59:00.000-08:002011-12-17T12:21:12.741-08:00Netflix IPad App Instant Play Issue - Solved!<u><b>Issue:</b></u><br />
I had an issue with playing movies on the Netflix App on the Ipad. I was able to access the site fine, but when it came to playing the movie, it would attempt to load then re-direct me back to movie list. I attempted to fix issues by opening port 80 and 443, reset Netflix App through settings on the Ipad, reset the Ipad's network settings, and restarted Ipad. None of these methods worked. What I did realize was the issue started to happen once I got a new router (Linksys E3000). I then found out about DNSMasq which is some type of DNS forwarder etc. (For more information, here is <a href="http://en.wikipedia.org/wiki/Dnsmasq">Wiki</a>) Turns out, my router has this feature enabled by default when I installed DD-WRT. Then I found my problem.<br />
<br />
<u><b>Solution:</b></u><br />
Basically, if your router has DNSMasq enabled, it will show your router as the DNS server on the Ipad when you connect. Netflix does not like this. Once you change the DNS address, it should work. You can use either Level3's DNS address 4.2.2.2 or Google's 8.8.8.8. I just went ahead and found out what my ISP's DNS address was and used it.<br />
<br />
Some Screenshots showing you where to change DNS address:<br />
1) Go to Settings and you'll see the following:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIE-0b__2QENuzwojAEjarSoLBiGkGfSDTe1PQ72bFEAVRh8KybqQJDTuCxDMakETdkLLhGkHygzzXmicn3j-O9UzATYjcG0mATJpmdfrksdzzQYIXBhH6QHvnKtI8Wxk0oDAJvp57FVg/s1600/iPadSettings.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgIE-0b__2QENuzwojAEjarSoLBiGkGfSDTe1PQ72bFEAVRh8KybqQJDTuCxDMakETdkLLhGkHygzzXmicn3j-O9UzATYjcG0mATJpmdfrksdzzQYIXBhH6QHvnKtI8Wxk0oDAJvp57FVg/s320/iPadSettings.png" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
2) Click on Wifi and you will see a list of Wireless connections around you. Find your network SSID (name) and click on the blue arrow:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilwD7ixaazEvfX-u9VwweizCOmBdQPDgLOdhIN_F8TXnKvjm1nOzQEEzVO0NNeuNPcvp0dCc0I_Qm0PZp8Yp5rBxuQnGXB1lLJF-5rE1rFpz87LTBjJr54E9yM_nyknO48ZxQqsM36I0w/s1600/iPadSettings2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilwD7ixaazEvfX-u9VwweizCOmBdQPDgLOdhIN_F8TXnKvjm1nOzQEEzVO0NNeuNPcvp0dCc0I_Qm0PZp8Yp5rBxuQnGXB1lLJF-5rE1rFpz87LTBjJr54E9yM_nyknO48ZxQqsM36I0w/s320/iPadSettings2.png" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="" style="clear: both; text-align: left;">
<br /></div>
<div class="" style="clear: both; text-align: left;">
3) You'll then see the following. Just tap on DNS and change to either your ISP's DNS server or use Level3's 4.2.2.2 or Google's 8.8.8.8.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQpMHhQ_-RKUuVx4I-2zDZJa75-GQ1mR8Zx-ED7Qjsl2BKb7wJOTNVPkNn3Y490Nn3dX46anffd3WwpyX2hpUaYkmUjpKHH0qwWqEhRI4aDZtx5pVOUCjQzRdVwY9hH1jmVf8wgQYNqYE/s1600/iPadSettings3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiQpMHhQ_-RKUuVx4I-2zDZJa75-GQ1mR8Zx-ED7Qjsl2BKb7wJOTNVPkNn3Y490Nn3dX46anffd3WwpyX2hpUaYkmUjpKHH0qwWqEhRI4aDZtx5pVOUCjQzRdVwY9hH1jmVf8wgQYNqYE/s320/iPadSettings3.png" width="240" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Now try to Play a movie and it should work.<br />
<br />
Hope this helped you guys out! Enjoy<br />
Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com9tag:blogger.com,1999:blog-5236063873119545710.post-78324552150068398402010-08-15T03:37:00.000-07:002011-12-17T12:20:31.934-08:00Android Five Card Poker GameDuring this past summer I have been learning Java along with the Android OS (double whammy). From both experiences, including GUI programming (only worked with command line proggies), I have coded a five card poker game. I originally made this game as a final for my class but coded in C++ along with PDCurses for graphics. It's nothing amazing; was just a productive project until Starcraft 2 came along :).<br />
<div><br />
</div><div>Screenshots:</div><div class="separator" style="clear: both; text-align: center;"></div><div><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="http://img.photobucket.com/albums/v67/Greatkiller/poker1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://img.photobucket.com/albums/v67/Greatkiller/poker1.jpg" /></a></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://img.photobucket.com/albums/v67/Greatkiller/poker2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://img.photobucket.com/albums/v67/Greatkiller/poker2.jpg" /></a><a href="http://img.photobucket.com/albums/v67/Greatkiller/poker3.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://img.photobucket.com/albums/v67/Greatkiller/poker3.jpg" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: left;">Download:</div><div class="separator" style="clear: both; text-align: left;"><a href="http://www.megaupload.com/?d=HKUA4ODY">CLICK HERE</a></div>Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com38tag:blogger.com,1999:blog-5236063873119545710.post-89626477643147425952010-08-13T00:50:00.000-07:002010-08-13T00:52:43.828-07:00Welcome to GKproggy!Thanks for being one of the first to visit. The blog will be used to show my algorithms for random programs written in C++, Java, or even Assembly. I hope this blog will help some of you. I'm not an expert in Java or C++, but I hope to become one some day. Hope you guys enjoy what will soon come.Ismaelhttp://www.blogger.com/profile/08059447665785677272noreply@blogger.com1