Wednesday, October 05th, 2011 | Author: Mr. A

I needed to sort through hash and I found out how from this
article: http://stackoverflow.com/questions/1227571/how-to-iterate-a-hash

hash.keys.sort.each do |key|
puts "#{key}—–"
hash[key].each { |val| puts val }
end
Sunday, June 05th, 2011 | Author: Mr. A

You can add the following link to your app to redirect users to the “Write A Review” section for your app:

http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewContentsUserReviews?id=353432042&pageNumber=0&sortOrdering=1&type=Purple+Software&mt=8

Just replace the id parameter of the url with your app’s id.

Source: http://stackoverflow.com/questions/4824569/is-it-possible-to-add-a-rate-this-app-link-to-my-app

Category: iPhone  | Leave a Comment
Friday, May 20th, 2011 | Author: Mr. A

I needed to create different threads for a foreach loop and found this great article: http://dotnet.dzone.com/articles/parallelizing-windows

var magicString = string.Empty;

var list = new List<string> {".NET", "Zone"};
Parallel.ForEach(list, oneString =>;
{
magicString += oneString;
});

Category: .Net, C#  | Leave a Comment
Wednesday, March 02nd, 2011 | Author: The E

I dont know whether to feel proud or disappointed about this one. For the past four years I have published my site from Visual Studios 2005 way over a thousand times because of updates or whatnot. Every time it would take anywhere from 10 to 15 minutes. Today I decided to do something about it…FOUR YEARS LATER! I found out that there is a property you can set in your web.config folder that will define the extensions you would like the compiler to ignore when building and publishing your site. My publishing is now taking a whopping 1 minute. I will stick the example that microsoft used, which ignores .doc, .psd, and .vsd files, as well as the source link.

<configuration>
  <system.web>
     <compilation>
      <buildProviders>
         <add extension=".doc"
          type="System.Web.Compilation.IgnoreFileBuildProvider" />
         <add extension=".psd"
          type="System.Web.Compilation.IgnoreFileBuildProvider" />
         <add extension=".vsd"
          type="System.Web.Compilation.IgnoreFileBuildProvider" />
      </buildProviders>
     </compilation>
   </system.web>
</configuration>

Source

Tuesday, March 01st, 2011 | Author: Mr. A
ActiveRecord::Base.logger = Logger.new(STDOUT)
Monday, February 21st, 2011 | Author: Mr. A

I need to retrieve some data from my DB but I have caching turned on in my rails app. After doing some research, I found that you can call uncached and it will ignore the cache.

Example:

def test_action
     ActiveRecord::Base.connection.uncached do
          job = Workflow.find(10911)
          job = Workflow.find(10911)
          job = Workflow.find(10911)
     render :xml => job.to_xml(:skip_types => true, :dasherize => false, :camelize => true)
     end
end
Thursday, January 27th, 2011 | Author: The E

This is a problem that was coming and going for me and every time I figured it out I was content and moved on with my life, but then it happened to me again months later and I forgot the solution, hence this post. What would happen was that when I pressed debug on an asp.net application the browser would pop up correctly but in visual studios the debugger would turn off, as if it was set to auto stop debug on start. Pretty much whenever this happens what you have to do is to make sure the web server and the browser that ran the application, in this case internet explorer are off. To make sure this is implemented I do it through the task manager.

Wednesday, January 26th, 2011 | Author: The E

So I needed to imitate the functionality of a hashtable in asp. I needed a number and name key/value pair so that I could loop through them and display them in a select box. Using an array wont work of course since you can only display one value, unless the index of the array is the second value (or first value, you know what I mean). Using the dictionary object allows you to pair two values together just like the good ole’ hashtable that our friendly neighborhood languages offer.

<%
dim d,a,b,i
set d=Server.CreateObject("Scripting.Dictionary")
d.Add "n","Norway"
d.Add "i","Italy"
d.Add "s","Sweden"

Response.Write("<p>Key values:</p>")
a=d.Keys
b=d.Items
for i=0 to d.Count-1
  Response.Write(a(i) & ", " & b(i))
  Response.Write("<br />")
next

set d=nothing
%>

Source

Category: ASP Legacy, VB  | Leave a Comment
Saturday, January 22nd, 2011 | Author: Mr. A

While trying to submit our iPad app Let’s Multiply. We found an easy way to capture screenshots of the iPad/iPhone Simulator. All you have to do if hit Control + Command + C. This will capture the screenshot and copy it to the clipboard, just paste and save the image in any image editor.
For the iPad, make sure that you you Scale the Simulator to 100% (It will capture the whole iPad screen even if the simulator screen doesn’t fit on your monitor)

Category: iPhone  | Leave a Comment
Saturday, January 15th, 2011 | Author: The E

I was declaring a stringstream object inside a switch case and I received this error. It turns out that the reason you can’t do this is because the scope is not declared within brackets, therefore, other cases might use the object, which is not allowed. So the solution is to add brackets to your case statement like so:

#include <sstream>
switch(someValue)
{
      case 1:
      {
            stringstream strStream;
            //some code
            break;
      }
      default:
            break;
}

Source

Category: C++ (cpp)  | Leave a Comment