Posts

ruby on rails - Check if attribute contains 2 letters in RSpec -

what right way test if field contains 2 letter string rspec ? following old example guess worked in rails 2. creates new address instance, sets invalid value on it, , trigger valid? on instance , checks if errors report wrong. 'requires state of length 2' subject = address.new subject.state = 'cal' should_not be_valid subject.errors.on(:state).should_not be_nil end now, rails 3 doesn't have errors.on, tried subject.errors[:state].should_not be_nil but problem here errors[:attribute] empty array instead of nil . you can still subject.errors[:state].should_not be_empty

android - Not able to solve import on com.google.appengine.tools.cloudstorage.GcsFilename Eclipse -

i trying serve blob , take objects gcs , serve . in servlet need import: import com.google.appengine.tools.cloudstorage.gcsfileoptions; import com.google.appengine.tools.cloudstorage.gcsfilename i have downloaded cloud storage api link: https://code.google.com/p/google-api-java-client/wiki/apis#cloud_storage_api but somehow not able compile servlet. missing here!!..can please tell me steps on how add library in web application in eclipse? code need compile: private gcsfilename getfilename(httpservletrequest req) { string[] splits = req.getrequesturi().split("/", 4); if (!splits[0].equals("") || !splits[1].equals("gcs")) { throw new illegalargumentexception("the url not formed expected. " + "expecting /gcs/<bucket>/<object>"); } return new gcsfilename(splits[2], splits[3]); } the import not ...

asp.net - how to map a checkbox to update the database after submit. -

i need use session datatable email value @email , base dropdownlist. protected void page_load(object sender, eventargs e) { dropdownlist1.datasource = (datatable)session["dt"]; dropdownlist1.datavaluefield = "base"; dropdownlist1.datatextfield = "base"; dropdownlist1.databind(); } string str; protected void submit_click(object sender, eventargs e) { if (checkbox9.checked == true) { str = str + checkbox9.text + "x"; } } sqlconnection con = new sqlconnection(...); string sql = "update inquiry2 set question1 = @str email = @email , base = @base;"; con.open(); sqlcommand cmd = new sqlcommand(sql, con); cmd.parameters.addwithvalue("@email", session.dt.email); cmd.parameters.addwithvalue("@str", str); cmd.parameters.addwithvalue("@base", dropdownlist1.base); } } ...

grails - I want to provide a link to return the previous page on a 404 -

i have errorcontroller handles various application errors such 404, 500, etc. in these actions, render appropriate error pages. able provide link on these error pages takes user page prior receiving error. i've tried getting http_referer header null. request.forwarduri gives me current request causing error. suggestions? class errorcontroller { def notfound() { def backtopage = getpreviouspage // here render view: '404', mode: [backtopage: backtopage] } } you can use history.back() method . <script> function goback() { window.history.back() } </script> <input type="button" value="back" onclick="goback()">

actionscript 3 - Flash complied with Flex SDK very big file size -

i had simple flash video player compiling using adobe flash builder , compiling using flex sdk 4.6 . flash filesize 20kb when compling fb . 280kb . know adds swc files swf build , have disabled debug etc instructions provided here http://livedocs.adobe.com/flex/3/html/help.html?content=performance_06.html . possible somehow convert fla components without using mxml ? here mxml code <?xml version="1.0" encoding="utf-8"?> <mx:application backgroundcolor="#000000" xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:mx="library://ns.adobe.com/flex/mx" layout="absolute" minwidth="320" minheight="240" creationcomplete="initapp()"> <fx:script> public function initapp():void{ var p = new video_player(uic); } </fx:script> <mx:uicomponent id="uic" /> </mx:applicatio...

javascript - Style new Chrome's alert window -

Image
is possible style new chrome alert boxes, added in version 29? run javascript in chrome's console: alert("this new") i ask because new window looks more dialog. it displays tooltip coordinates while being dragged. no, cannot style dialog boxes (including newly designed one). use js/html modal if need style popup instead.

mongodb - Directory For C# Library Download -

i trying set mongodb c# plugin on computer. use visual studio 2010 code. should extracted zip file moved to? in folder use development or specific file path type of library? use nuget package manager download mongodb c# driver. placed under packages folder @ solution root directory. how use nuget: either manage nuget packages... option in context menu of project references search driver online. or type install-package mongocsharpdriver in package manager console (located under tools > library package manager ). download latest stable version of driver solution , add assembly reference project.