Category Archives: Stackoverflow

Rails 3.1: Jbuilder rendering empty views

Trying to use Jbuilder to create some JSON views for my app, but the views are coming out empty. Using the builder code in the console, however, works just fine. Controller code: @placements = Placement.all respond_to do |format| format.html format.json end Jbuilder view (index.json.builder): Jbuilder.encode do |json| json.array!(@placements) do |json,...

Which construct is better suited for this situation, an if-else or a switch?

Which construct is better suited for this situation, an if-else or a switch? - (id)hexEvaluator:(double)remainder { if(remainder == 0) {return [NSNumber numberWithInt:0];} else if(remainder == 1) {return [NSNumber numberWithInt:1];} else if(remainder == 2) {return [NSNumber numberWithInt:2];} else if(remainder == 3) {return [NSNumber numberWithInt:3];} else if(remainder == 4) {return [NSNumber numberWithInt:4];}...

Is there a (legal) way to capture the ENTIRE screen under iOS?

I’ve tried several techniques to capture a screenshot of an app from within that app. None of the techniques appear to capture the status bar — it ends up being black. There apparently was once a way to do this, but that interface is internal and Apple will not let...

Javascript Multiplayer Game – Server Side Validation.

I’m starting my hand at creating a multi-player game using HTML 5 / Javascript. I’m currently doing some prototypes on different ideas on how to stop people from cheating. Now I know I need to do everything server side and just have the client sending “actions”. My issue is I...

WCF self hosted gzip content without IIS

I’ve a self hosted wcf service (basichttpbinding) that communicate with an Android app it’s working ok. Now a new requirement to support gzip compression is added. I saw some examples and implemented them, but have no luck there: http://blogs.infragistics.com/blogs/anton_staykov/archive/2010/08/24/silverlight-wcf-service-compression-azure.aspx http://www.frenk.com/2009/12/gzip-compression-wcfsilverlight/ When I made a little test turning on the gzip...

how to avoid clear notifications when activity finishes

I am posting different notifications to the notification bar. All are having different id’s but the intent is targeting same activity. When I clicked on first notification the activity started and on clicking its finishing. When my activity getting finished all remaining notifications in the bar are disappearing. I want...

If Both Checkboxes flag false do?

I am getting frustrated with Google query’s on code so I’ll just ask all you experts. I have a <500 line program that lists files from clearcase in a tree now I want to click on them and check them in/out. The checkout part I can accomplish via command line...

jQuery UI not loading

My test div is below. If I put all of this into its own page, everything works perfectly. If it put it onto my final page, I get an error saying that datepicker() is undefined. How do I figure out what is causing jQuery UI to break? <div> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"...

mySQL hierarchical grouping sort

I have a schema that essentially looks like this: CREATE TABLE `data` ( `id` int(10) unsigned NOT NULL, `title` text, `type` tinyint(4), `parent` int(10) ) The type field is just an enum where 1 is a parent type, and 2 is a child type (in actuality there are many types,...

Windows CE Internet Explorer won’t load ocx control

I have an ocx control successfully registered on a Windows CE 6 device. I can see it registered correctly within the registry. I need that control to load within a webpage. Using IE I am navigating to http://localhost/test.htm using the local web server. The test page is below: <HTML> <HEAD>...

How can I find a previously unknown pattern in an array using PHP?

I have an array that has the following values: 1,1,3,5,1,1,3,5,1,1,3,5,1,1,3,5 You can easily look at this array and see that the pattern 1,1,3,5 repeats 4 times. How would I make PHP figure this out for me? Furthermore, my array may have more than one pattern that would need to be...

blogger via idHTTP : error 400 bad request

I’m trying to post to Blogger using idHTTP component, however, I’m getting “HTTP/1.0 400 Bad Request” error. procedure TForm1.Button1Click(Sender: TObject); var request,response,req : TStringlist; auth,blogid : string; begin blogid := '00000000000000000000000'; request := TStringList.Create; response := TStringList.Create; req := TStringList.Create; IdHTTP1.Request.Connection := 'Keep-Alive'; IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded'; IdSSLIOHandlerSocket1.SSLOptions.Method := sslvSSLv23; request.Clear();...

Visual realtime CSS specificity calculator?

I have seen some online css specificity calculators but you have to upload the css files and do some manual work for it to do its work. Is there a visual one like maybe a Firebug extension where when you click or hover over an element, it calculates it right...

Best way to further secure rails app from?

I am using rails 3.2 and devise 1.5.3. I added an admin attribute in my model as described in option 2 on the devise wiki How To: Add an Admin Role I added this in a post controller for force logins: before_filter :authenticate_user! I wrote some logic to hide the...

How to add a varchar field for a table already in use?

I’ve got a mysql database with a table (InnoDB) of Games: gamerooms id: bigint(20) unsigned not null auto_increment PRIMARY KEY (`id`) I’d like to start generating a UUID value for each row which I can share publicly, something like: gamerooms id | id_public | -------------------- 1 | abcde 2 |...