What's new?
works, ideas and so much more.
Rails Pre-Compile issues with SASS 3.1.5

If you want to pre-compile assets in rails 3.1.4 using
|
1 |
RAILS_ENV=production bundle exec rake assets:precompile --trace |
you may find yourself seeing the following error
|
1 2 |
rake aborted!
stack level too deep |
This is caused by SASS v. 3.1.4+ unfortunately, so just downgrade by changing it in your Gemfile.
The issue is discussed at https://github.com/rails/sass-rails/issues/78
Rails Asset Pipeline Production Pre-Compile

If in your production Ruby on Rails app you get the following error
|
1 |
ActionView::Template::Error (favicon.ico isn't precompiled): |
You need to either pre-compile the assets using
|
1 |
bundle exec rake assets:precompile |
Or set runtime compilation of assets (not recommended) by setting config/environments/production.rb to
|
1 |
config.assets.enabled = true |
Capistrano Deploy: no tty present and no askpass program specified

Capistrano is the popular deployment script for Ruby on Rails applications.
To setup the project on the server [creating shared folders, logs etc.] you should first run
|
1 |
cap setup:deploy |
But you may run into the following error
|
1 2 3 4 |
*** [err :: domain.com] sudo
*** [err :: domain.com] :
*** [err :: domain.com] no tty present and no askpass program specified
*** [err :: domain.com] |
This is because capistrano tries to run the commands using sudo, which you most likely won’t need.
Add the following in your config/deploy.rb file to turn off sudo
|
1 |
:use_sudo, false |
Edmonton Software & Mobile Development

We have been bouncing around various types of projects over the years, touching technologies from Rails to Perl to Python to .NET and much more. Recently, though, mobile and web application hybrids have been in hot demand, and the technologies choices required for this can be overwhelming.
The rule of thumb used at Serene is 1. Effectiveness, 2. Pricing, and 3. Simplicity, not necessarily in that order.
The technology has to be effective. At the same time, it has to be simple [#3], and cost the client the least amount possible, without sacrificing effectiveness.
For example, do you use native code or something like PhoneGap [http://phonegap.com]? The latter gives you access to multiple devices [it is cross-platform], and can be easier to modify since it uses HTML5 instead of Objective-C for the post part. At the same time, not everything is possible in it.
Or, do you use asp.net vs. Rails for a web application? ASP.NET is more expensive to implement, but it does play fairly well in the enterprise! Maybe Rails is not the best idea even if it’s “Cool” [see "coolness" is not part of our process... till the end!
]
Choosing the right technology is very important when it comes to building your product. If you pick the wrong one, you are in for a world of pain [we have experienced this!].
iOS Disable Scrolling in Webpage [UIWebView]

For the application mentioned in the last blog post [iPad disable zooming], we also had to disable scrolling at certain points very briefly and re-enable it. [dont ask
]
This was done by going to the UIScrollView subviews and disabling bouncing and the indicators.
|
1 2 3 4 5 6 7 |
for (id subview in self.myWebView.subviews) {
if ([[subview class] isSubclassOfClass: [UIScrollView class]]) {
((UIScrollView *)subview).bounces = NO;
((UIScrollView *)subview).showsVerticalScrollIndicator = NO;
((UIScrollView *)subview).showsHorizontalScrollIndicator = NO;
}
} |
iPad UIWebView [Webpage] Disable Zooming

Recently we had to disable the zooming for an iPad application.
This is rather simple in the HTML loaded by UIWebView:
|
1 |
<meta name = "viewport" content = "user-scalable = no"> |
Apache CouchDB Bind Address to allow external access

We had a couchDB instance going on our EC2 server, but despite opening all ports ’5984′ on AWS and Windows Firewall, it was not accessible externally.
This is because the default bind address is set to 127.0.0.1.
You can change this by going to the Futon interface [:5984/_utils] and clicking on “Configuration” on the right, then setting the bind address to 0.0.0.0
Using PHP & Curl to call WCF Web Service

Recently we had to call a WCF Web Service that takes XML via PHP.
The simple way to do this is using CURL. (Note you have to have PHP-Curl installed) Here is the sample code.
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$request = 'http://yourip/query';
$session = curl_init($request);
curl_setopt ($session, CURLOPT_POST, true);
curl_setopt ($session, CURLOPT_POSTFIELDS,
"<xml1>
<xml2>value</xml2
</xml1>"
);
curl_setopt($session, CURLOPT_HEADER, 'Content-type: text/xml');
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($session);
curl_close($session); |
Greystripe SDK 3.2.0 Change from UUID to Device Id

Greystripe released their SDK version 3.2.0 which uses the hashed device MAC Address instead of the UUID to verify devices.
To get this hashed Device ID, you can log the following for your Simulator or attached phone:
|
1 2 |
NSString *deviceID = [GSAdEngine hashedDeviceIdentifier];
NSLog(@"GSAdEngine is on device ID %@",deviceID); |
If you can’t do that, then the best way is to get the MAC address and hashing it online
1. Download this helper app:
http://itunes.apple.com/us/
2. Then enter the MAC address into this website to get the Hash:
http://sha1-hash-online.
Migrating SQL Server Databases

One of the simplest needs in SQL Server is moving databases.
Use the backup/restore feature to accomplish this in SQL Server Management Studio
1. Right click on the database you want to move [or copy] and select Backup. Choose the location to dump the *.bak file to.
2. In your new database, right click on the server and choose “Restore”. Name your database, and choose the *.bak file to restore from.
Usually it will import it without glitches, but occasionally you may need to dig deeper to solve issues. A common issue is trying to import a newer DB version into an older one. In this case, life won’t be as simple…


