Posts

In Haskell, what is the reason for needing to convert from Data.Text.Internal? -

text.regex.tdfa.text 1 provides instances regexlike regex text using internal text types. can instances of classes data.text.lazy derived instances of data.text.internal ? how can improve code? import qualified data.text.lazy t import text.regex.tdfa import text.regex.base.context() import text.regex.base.regexlike() import text.regex.tdfa.text import data.function (on) (<?>) :: t.text -> t.text -> bool (<?>) = on (=~) t.tostrict i might missing something, seems have missed the module containing lazy text instances regex-tdfa classes . if that's what's happening, need change import text.regex.tdfa.text to import text.regex.tdfa.text.lazy note called text in module data.text.internal same called text in data.text -- i.e., it's "strict" text . lazy text type defined in different internal module (basically specialized list of strict texts.) it's not though these 2 ways of viewing same thing, if that's ...

android - How to get a DialogPreference to popup so that I can create a wizard-style UI? -

i have number of preferences need set , want guide user through flow popping individual preference dialogs (listpreference, edittextpreference etc.), 1 @ time can create wizard-style ui . as user fills in pref, closes , next 1 opens up. as far know, user has click on preference dialog popup. is there way programmatically ? you can use onitemclick perform click on preference item. get preference position preference order. int position = findpreference("language").getorder(); language preference key. then, onitemclick on preference item position. getpreferencescreen().onitemclick(null,null,position,0);

ruby on rails - Trouble Getting Twitter Gem To Work - Giving Undefined Method Errors -

i following along documentation twitter gem , trying results, getting following error: undefined method `sample' nil:nilclass i've put in config/initializers/twitter_credentials.rb (my keys , tokens filled in app) @client = twitter::streaming::client.new |config| config.consumer_key = "your_consumer_key" config.consumer_secret = "your_consumer_secret" config.access_token = "your_access_token" config.access_token_secret = "your_access_secret" end here bits controller: require 'twitter' class staticpagescontroller < applicationcontroller def home @tweets = array.new @client.sample |object| @tweets << object.text if object.is_a?(twitter::tweet) end end end this in view: <% @tweets |tweet| %> <%= tweet.text %> <% end %> and of course, in gemfile: gem 'twitter' why getting error? the problem was referencing using in...

Using Grails Transaction when saving two different domain object in one shot -

i have domain classes need updated @ same time, want use transaction in order allow changes both or neither. example : i have 2 different domain classes (user, , follow) user currentuser =.. user targetuser = .. follow followuser = .. targetuser.follower = targetuser.follower + 1 currentuser.follow = currentuser.follow + 1 targetuser.save(flush:true) currentuser.save(flush:true) followuser.save(flush:true) i want of happen or if 1 fails none of happen , gets rolled back. how can in grails ? saw domainobject.withtransaction, have 2 different domain, should nested ? the proper solution move transactional code service. documentation outlines how create , use services controllers. that's proper solution. however, that's not way. have seen there ability run code within transaction scope using withtransaction. example (directly documentation ): account.withtransaction { status -> def source = account.get(params.from) def dest = account.get(params...

javascript - jQuery .getJSON() URL Error -

this json data retrieved when use (method redacted) method: [{ "group_option": { "optionsid": "28", "menugroupid": "6", "group_options_name": "select 2 (2) sides :", "menu_group_option_information": null, "menu_group_option_min_selected": "0", "menu_group_option_max_selected": "2", "fdateadded": "2014-01-25 08:29:20", "group_option_items": [{ "item": { "optionitemid": "69", "menu_item_option_name": "mexican rice", "menu_item_option_additional_cost": null } }, { "item": { "optionitemid": "70", "menu_item_option_name": "refried beans", ...

pipeline - Unix tr command to convert lower case to upper AND upper to lower case -

so searching around , using command tr can convert lower case upper case , vice versa. there way both @ once? so: $ tr '[:upper:]' '[:lower:]' or $ tr a-z a-z will turn: "hello world abc" "hello world abc" but want do: "hello world abc" please help! =) this looking for: tr '[:upper:][:lower:]' '[:lower:][:upper:]'

c++ - Access QVector element index by its content -

i have qvector of qstrings , want remove element content, don't know how find index of it. know how can remove it? don't want iterate on , compare content value. my qvector declared follows: qvector <qstring> user_valid; and want remove content, example element value "marigold": user_valid.remove(user_valid.find("marigold"); thank in advance! ok, following if you: use qstringlist instead of qvector<qstring> has convenience methods can useful you; more common , hence comprehensive. spare 1 method call in case. just use removeone() and/or removeall() methods depending on exact scenario. therefore, writing this: qstringlist user_valid; user_valid << "marigold" << "cloud" << "sun" << "rain"; user_valid.removeone("marigold"); // user_valid: ["cloud", ,"sun", "rain"] if insist on using qvector<qstring> ...