Posts

Showing posts from April, 2012

javascript - Info box similar to Google Image Search Results -

here factors borrow googles image search results: each item sits next each other , falls next row if cant fit in current row because of browser windows width. when 1 item clicked on, info box slides open directly below row of selected item, fills width of browser, indicator visible @ bottom of selected item. when info box opened, if browser width changed, items fall row can fill (top first) or fall row below. not affect 100% width of info box or position directly below row of selected item. i have implemented first bullet creating divs have display: inline-block i want solution thats html , css first, , javascript (jquery, ajax etc.) if necessary, dont using many html attributes except ones i'd need make work, id , class , src etc. use css whenever possible instead. if can stick html elements , style them css , ever remnants can't fulfilled css , html fulfilled javascript (or derivative jquery, ajax etc). an example of im @ far: <html> <head>

class - Are these java classes equivalent? -

given following 2 classes example1 , example2 , excluding performance characteristics, these 2 classes operate exact same way. is, regardless of how simple or complex either methoda or methodb or can be, result of running these 2 classes, under possible conditions (both internal , external), absolutely same ? example1 public class example1 { public static void main (string [] args) { try { // not compile since nextboolean() not static // boolean t = java.util.random.nextboolean(); // changed java.util.random r = new java.util.random(); boolean t = r.nextboolean(); if (t) { methoda(); methodb(); } } catch (throwable t) { t.printstacktrace(system.out); } } private static void methodb () { // code goes here } private static void methoda () { // c

iphone - Possible to embed PDF files and videos into an iOS app? -

as title indicates, want know how difficult create ios app in can include few of own movies , pdf files, , make them viewable app itself. i know ios has built in pdf viewer , movie player, want make sure can access them easily, , not have write own pdf viewer or of sort. thanks in advance help! edit: if so, pointers on how should go doing this? perhaps link tutorial or something? for viewing pdf files can use uiwebview or quicklook framework (see qlpreviewcontroller class details).

osx - How to switch to edit mode of vi on mac terminal -

i new mac, trying edit .gitignore file macbook terminal, type vi .gitignore it opens file not letting me switch edit mode. how vi switches mode on mac ? on mac can more correctly type vim (vi improved) instead :) same everywhere, i switches "insert" mode , esc switches command mode. a learning resource vim included in mac. type vimtutor , teach how use vim effectively. another editing option on mac nano command line text editor easier familiar textedit/notepad.

ruby on rails - Error Adding a Migration: `default_controller_and_action': missing :action (ArgumentError) -

i'm trying add following migration: rails g migration addconfirmabletousers confirmation_token:string confirmed_at:datetime confirmation_sent_at:datetime unconfirmed_email:string however, raised following error i'm unable troubleshoot: /users/tn/.rvm/gems/ruby-2.0.0-rc1@global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:179:in `default_controller_and_action': missing :action (argumenterror) /users/tn/.rvm/gems/ruby-2.0.0-rc1@global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:72:in `normalize_options!' /users/tn/.rvm/gems/ruby-2.0.0-rc1@global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:60:in `initialize' /users/tn/.rvm/gems/ruby-2.0.0-rc1@global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1308:in `new' /users/tn/.rvm/gems/ruby-2.0.0-rc1@global/gems/actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:1308:in `add_route' /users/tn/.rvm/gems/ruby-2.0.0-rc1@glob

c# - Adding a single row with a single column of one datagridview into another datagridview of multiple column -

Image
i have defined datagridview 5 columns , 1 column ..what want on click of button in datagridview columns, row single column of other datagridview pops up..is possible?..this screenshot of datagridview.. i want add datarow of datagridview 1 column..i know how handle cellevent want addition of datarow 1 column.. hope helps: private void dgv1_cellcontentclick(object sender, datagridviewcelleventargs e) { if (e.columnindex == 3) { int newrow = dgv2.rows.add(); dgv2.rows[newrow].cells[0].value = dgv1.rows[e.rowindex].cells["stringtext"].value; } } this should take value stringtext cell , place in first column of newly created row in second grid when button in cell 4 clicked in first grid. edit: private void dgv1_cellcontentclick(object sender, datagridviewcelleventargs e) { if (e.columnindex == 3) { dgv1.rows[e.rowindex].cells["stringtext"].value = dgv2.rows[{y}].cells[0].value;

sql - Calculate no of rows created on daily basis from a huge table in mysql -

i need calculate num of rows created on daily basis huge table in mysql. i'm using select count(1) table_name group date the query taking more 2000sec , counting. wondering if there's optimized query or way optimize query. if you're interested in items created on dates, calculate count @ end-of-day , store table. that lets run count query on smaller data set ( use date(now()) = date , drop group by ) then query new table when need data.

php - Paypal NVP Authentication Failure -

currently using php + curl test nvp setexpresscheckout paypal feature (sandbox mode) on xampp, no matter do, receive following error: error code 10002 : authentication/authorization failed. not have permission make api call. $nvp = array( 'method' => 'setexpresscheckout', 'version' => '98', 'user' => $user, 'pwd' => $pwd, 'signature' => $signature, 'returnurl' => $returnurl, 'cancelurl' => $cancelurl, 'paymentrequest_0_paymentaction' => 'sale', 'paymentrequest_0_amt' => '20.00', 'paymentrequest_0_currencycode' => $currency, 'reqconfirmshipping' => '0', 'noshipping' => '1', 'allownote' => '0', 'localecode' => 'us' 'l_paymentrequest_0_name0' = 'a product name'; 'l_paymentrequest_0_am

How can I Improve ping parameters to get consistent response vb.net -

i'm having issue inconsistent response on of ip's on network. getting success or failure randomly every time ping if ping windows command line successful every time... code i'm using ping follows: dim myping ping = new ping dim pingreply pingreply dim host string = "x.x.x.x" dim timeout = 1000 dim packetsize = 32 dim data string = "" dim integer = 1 packetsize data = string.concat(data, "a") next dim buffer() byte = encoding.ascii.getbytes(data) try pingreply = myping.send(host, timeout, buffer) if pingreply.status = ipstatus.success msgbox("success") else msgbox("failure") end if catch ex exception end try it might useful know accessing network through vpn doesn't explain why command line ping successful. is there way can adjust parameters consistent response? i'd avoid slowing down ping

asp.net - How to open aspx web pages on a pop up window -

i'm trying write code open .aspx (in shape of pop window) after clicking linkbutton on .aspx web page(using vb) protected sub linkbutton1_click(byval sender object, byval e system.eventargs) handles linkbutton1.click 'what code? end sub not sure how it, can't find popup control or similar. you can use clientscript.registerstartupscript in c# protected void button1_click(object sender, eventargs e) { string querystring = "test.aspx" ; string newwin ="window.open('" + querystring + "');"; clientscript.registerstartupscript(this.gettype(), "pop", newwin, true); } in vb protected sub button1_click(byval sender object, byval e eventargs) dim querystring string = "test.aspx" dim newwin string = "window.open('" & querystring & "');" clientscript.registerstartupscript(me.gettype(), "pop", newwin, true) end

Google apps spreadsheet parents folder ID -

Image
i have google spreadsheet keeping track of files , names inside folder spreadsheet is. have looked , can not find how location or id of sheet in ms cmd script "%~dp0". how in google apps spreadsheet script. function fnctnmenuupdategetlocation() { var ss = spreadsheetapp.getactivespreadsheet(); var ssid=ss.get.getid(); var file = docslist.getfilebyid(ssid); browser.msgbox(ssid); browser.msgbox(add); } https://docs.google.com/spreadsheet/ccc?key=0amsqn3n9km70dgwtltjxvvbzbmjhdme5ofpkbtvxele&usp=sharing ya, working in it live sheet from have how address of spreadsheet in google drive spread sheet having add folder/dir , file need since google docs not google drive how interface spreadsheet google drive both document service , drive service can report folder(s) spreadsheet in. here's function, updated show name of folder contains spreadsheet, using both services. function fnctnmenuupdategetlocation() { var ss = spreadsheetapp.

grouping - Maximum number of captured groups in perl regex -

given regex in perl, how find maximum number of captured groups in regex? know can use $1, $2 etc reference first, second etc captured groups. how find maximum number of such groups? captured groups, mean string matched regex in paranthesis. ex: if regex (a+)(b+)c+ string "abc" matches regex. , first captured group $1, second $2. amon hinted @ answer question when mentioned %+ hash. need @+ array: @+ this array holds offsets of ends of last successful submatches in active dynamic scope. $+[0] offset string of end of entire match. same value pos function returns when called on variable matched against. nth element of array holds offset of nth submatch, $+ 1 offset past $1 ends, $+[2] offset past $2 ends, , on. you can use $#+ determine how many subgroups in last successful match. see examples given @- variable. [ enphasis added ] $re = "(.)" x 500; $str = "a" x 500; $str =~ /$re/; print "num captures $#+"; # outpu

Is it possible to change the package name of an Android app on Google Play? -

i know whether technically possible, not whether easy or not, change actual package name of android app on google play. mean package name is, name show in url. please, can tell me why / not possible? thanks! from dianne hackborn: things cannot change: the obvious , visible of these “manifest package name,” unique name give application in androidmanifest.xml. name uses java-language-style naming convention, internet domain ownership helping avoid name collisions. example, since google owns domain “google.com”, manifest package names of of our applications should start “com.google.” it’s important developers follow convention in order avoid conflicts other developers. once publish application under manifest package name, unique identity of application forever more. switching different name results in entirely new application, 1 can’t installed update existing application. more on things cannot change here regarding question on url google play, package

c# - Creating a grab-bag (collection) of original references to objects -

i'm looking type/method of collection can add object group of objects, separately change attributes of object, , have changes reflected in object within collection. i've heard list<t> adds values reference, figured reference same object. in other words, assumed: list<string> valueslist = new list<string>(); string initialvalue = "alpha"; valueslist.add(initialvalue); initialvalue = "bravo"; bool incorrectassumption = (valueslist[0] == "bravo"); i had hoped 'valueslist' contain new value, "bravo." tried out , realized list copies reference, doesn't absorb it, valuelist still has "alpha" value. there ways use collection legitimate handful of objects contain? and in case helps see actual business need.... list<basewidget> widgets = new list<basewidget>(); derivedwidget specialwidget = new derivedwidget(); derivedwidget extraspecialwidget = new derivedwidget(); widgets.a

c# - How to enable variable from form into class Timer -

i have main form class here: public partial class main : form { public void button_click(object sender, eventargs e) { //here want call function runtime() schedulingtimer class // in oder run afunc() every second or interval } public void afunc() { message.show(textbox1.text); } } and have timer class: public class schedulingtimer { public static void runtime() { timer mytimer = new timer(); mytimer.elapsed += new elapsedeventhandler(displaytimeevent); mytimer.interval =10000 ; // 1000 ms 1 second mytimer.start(); } public static void displaytimeevent(object source, elapsedeventargs e) { //call function main have agrument textbox.text afunc();//or function variable sended main form } }

jQuery datepick pre select the year to show all months and days -

i have jquery datepicker changemonth: true, changeyear: true, numberofmonths: 1, dateformat: "dd-mm-yy", mindate: "-150y", maxdate: "-18y", yearrange: '1900:1995' which shows date range of min 18 years old default calendar blocks out days , months less 18 years. confusing customers don't realise if born in month after current 18 year restriction select year month day. my question is, there way preset year dropdown 1 year greater 18 months , days shown? so default selections jul 1995 default selections july 1994. thanks this default date 19 years today. (use defaultdate option) ( http://api.jqueryui.com/datepicker/#option-defaultdate ) $(function() { $("#txtdateofbirth").datepicker({ showon: "both", buttonimage: "img/iconography/date-picker-icon.png", buttonimageonly: true, changemonth: true, changeyear: true, numberofmonths: 1, da

c - Map variable-length string to int -

i can't figure out how write function takes following input , produces following output: in (int) | out (char *) 0 | "" 1 | "a" 2 | "b" 3 | "c" 4 | "aa" 5 | "ab" 6 | "ac" 7 | "ba" 8 | "bb" ... it not converting input ternary, there difference "a" , "aa" (whereas there no difference between 0 , 00 ). i have found correlation between length of string , input ( len = floor(log2(in + 1)) , when use a , b : in (int) | floor(log2(in + 1)) | out (char *) 0 | 0 | "" 1 | 1 | "a" 2 | 1 | "b" 3 | 2 | "aa" 4 | 2 | "ab" 5 | 2 | "ba" 6 | 2 | "bb" 7 | 3

c4 - object notifications other than touches* don't work -

i trying attach notifications other touchesbegan c4shape , getting nothing. have added c4shape , have tried add other notifications @ bottom of setup. problem notification ever gets called touchesbegan . i tried adding gestures la http://www.c4ios.com/examples/listenfor.php when touchesbegan notifications stop object. #import "c4workspace.h" @implementation c4workspace { c4shape * topthing; } -(void)setup { c4font * f = [c4font fontwithname:@"arialroundedmtbold" size:50.0f]; topthing = [c4shape shapefromstring:@"touch me" withfont:f]; [topthing setcenter:cgpointmake(self.canvas.center.x, self.canvas.height/6)]; [self.canvas addsubview:topthing]; [topthing setanimationduration:2.0]; [self listenfor:@"touchesbegan" fromobject:topthing andrunmethod:@"bangg:"]; [self listenfor:@"tapped" fromobject:topthing andrunmethod:@"bangg:"]; [self listenfor:@"longpress&q

sdl - How do you create a transparent window using dispmanx on Raspberry Pi? -

i'm working on slideshow app , using sdl 1.2 using custom dispmanx backend ( https://github.com/vanfanel/sdl12-kms-dispmanx ) pygame create overlays on top of omxplayer. it works , layers correctly, can't seem make transparent canvas in dispmanx without making objects transparent well. understanding pygame cannot handle , sdl handle transparency between dispmanx layers. my goal hardware accelerated transparent canvas size of screen above omxplayer can draw on. i suspect there must method other using alpha settings in vc_dispmanx_element_add this? xbmc uses dispmanx , can opaque overlays above omxplayer, must possible. i've looked @ vc_dispmanx_display_set_background, seems take rgb , not alpha. rather creating transparent window u take screenshot of window , use background. used pyscreenshot take image (though there other options) and os.environ['sdl_video_window_pos']="0,0" to make sure window in right spot every time, weakness wind

java - solr in javafx application instead of apache lucene -

i making search application using javafx . indexing , searching using apache lucene . in place of lucene can use apache solr . what benefits of apache solr on apache lucene. solr provides own indexing method or uses lucene index performing search. apache solr search platform runs on servlet containers (such jetty, tomcat) , uses apache lucene indexing, not same thing. you can think of solr more of product or ready use system , lucene engine/framework. if you're looking indexing within javafx application should stick apache lucene, if you're considering server-side approach searching , indexing solr interesting idea. you can check more info , comparisons on lucene , apache @ following pages: lucene vs solr http://lucene.apache.org/solr/ difference between solr , lucene

Multiple, specific, regex substitutions in Python -

what make specific substitions in given text. example, '<' should changed '[', '>' ']', , forth. similar solution given here: how can multiple substitutions using regex in python? , is import re def multiple_replace(dict, text): # create regular expression dictionary keys regex = re.compile("(%s)" % "|".join(map(re.escape, dict.keys()))) # each match, look-up corresponding value in dictionary return regex.sub(lambda mo: dict[mo.string[mo.start():mo.end()]], text) now, problem replace regex-matched patterns. example, want replace 'fo.+' 'foo' , 'ba[rz]*' 'bar'. removing map(re.escape in code helps, regex matches, receive key errors, because, example, 'barzzzzzz' match, , want replace, 'barzzzzzz' isn't key in dictionary, literal string 'ba[rz]*' is. how can modify function work? (on unrelated note, these 'foo' , 'bar' things come

flask - how do I modify a url that I pick at random in python -

i have app show images reddit. images come http://imgur.com/cuv9oau , when need make them http://i.imgur.com/cuv9oau.jpg . add (i) @ beginning , (.jpg) @ end. this function should need. expanded on @jh314's response , made code little less compact , checked url started http://imgur.com code cause issues other urls, google search included. replaces first instance, causes issues. def fiximgurlinks(url): if url.lower().startswith("http://imgur.com"): url = url.replace("http://imgur", "http://i.imgur",1) # replace first instance. if not url.endswith(".jpg"): url +=".jpg" return url u in ["http://imgur.com/cuv9oau","http://www.google.com/search?q=http://imgur"]: print fiximgurlinks(u) gives: >>> http://i.imgur.com/cuv9oau.jpg >>> http://www.google.com/search?q=http://imgur

ios - svn: working copy '.' locked - DHxlsReaderIOS -

i making app using dhxlsreaderios read .xls files. working fine. commited local git repository through xcode commit , believe remembered 'push' well. made bunch more changes code , tried run on ipad on simulator. got error: phasescriptexecution "run script" /users/me/library/developer/xcode/deriveddata/myapp-eykmkngoxcidwffthbwmmbnzenhp/build/intermediates/dhxlsreaderios.build/debug-iphoneos/dhxlsreaderios.build/script-deb78b6414bc793700845894.sh cd /users/me/documents/myap/dhlibxls-master /bin/sh -c /users/me/library/developer/xcode/deriveddata/myapp-eykmkngoxcidwffthbwmmbnzenhp/build/intermediates/dhxlsreaderios.build/debug-iphoneos/dhxlsreaderios.build/script-deb78b6414bc793700845894.sh svn: working copy '.' locked svn: run 'svn cleanup' remove locks (type 'svn cleanup' details) command /bin/sh failed exit code 1 i have been doing sorts or research since didn't know svn (i still sort understand). tried run svn cleanup g

php - <button> Same Button, Multiple Locations, Different Code -

i writing application in jqtouch, , using big red button <a href="#" class="redbutton">red</a> i using php dynamically build jqt page multiple divs. app server management console gets data mysql. idea use while loop make div each server returned in mysql query, , each div have delete server button(the big red button). have call dame bit of code because of whole dynamic page generating thing. wondering if there way have onclick function call button red know div button in calling function. there button in multiple divs call same code, have know server delete. suggestions? here full source code. <html> <link rel="stylesheet" href="jq_touch/themes/css/jqtouch.css" title="jqtouch"> <script src="jq_touch/src/lib/zepto.min.js" type="text/javascript" charset="utf-8"></script> <script src="jq_touch/src/jqtouch.min.js" type="text/javascr

is "function Pointer" in c++ similar in behavior with "delegate" in c#? -

i have small question. is function pointer in c++ similar in behavior delegate in c# ? yes, they're similar. but function pointer in c++ cannot point instance method of class, while delegate in c# can.

C++ Inheritance and Pthreads with Virtual Worker Functions -

i have class i'm trying implement abstract class maximize code reuse. however, major part of commonality between 2 derived classes lies in fact each has consumer , producer thread. i'm wondering if can have each static member function call virtual member function of underlying work. basically, following code allowed or doing super hacky, or compiler yell/scream @ me? // in abstractclass.h class abstractclass { // code here including constructors/destructors protected: virtual int worker() = 0; // derived class provides implementation private: static void* thread(void* args); }; // in abstractclass.cpp static void* abstractclass::thread(void* args) { abstractclass myobject = static_cast<abstractclass*>(args); myobject->worker(); } basically i'm wondering if derived class "worker" ever called way? note p_thread_create() called passing in thread() function. thanks try improve understanding of inheritance , virtual functions , how

gruntjs - How to run two grunt watch tasks simultaneously -

is possible run 2 watch tasks simultaneously? i understand can have number of tasks want inside watch settings , launch grunt watch , watch of them, this ... watch: { a: { files: "js/dev/**/*.coffee", tasks: ["coffee", "requirejs"] }, b: { files: "js/dev/**/*.coffee", tasks: ["coffee"] }, c: { files: "js/dev/**/*.html", tasks: ["copy"] } } ... ...but don't need this. want have different set of tasks development , production. can guess, difference between a (production) , b (development) minification , concatenation. don't need launch a , b tasks @ same time. first came idea grunt.registertask("prod", ["watch:a", "watch:c"]); grunt.registertask("dev", ["watch:b", "watch:c"]); but didn't work. first watch tasks working ( c never works). possible want?

c++ - ith order Selection in O(n) time -

from "introduction algorithms" trying implement code dividing n elements in n/5 groups, recursively finding median , recursively finding ith order statistics. here code bool istrue(int *a, int *b) { if((*a) < (*b)) swap(*a, *b); return *a < *b; } int select(int *a, int n ,int p) { int *b[(n / 5) + 2]; cout << (n / 5) + 2 << endl; int i, j; for(i = 1, j = 1; <= (n - 5); += 5, ++j) { sort(a + i, + + 5); b[j] = + + 2; } sort(a + i, + n + 1); b[j] = + + (n - i) / 2; sort(b + 1, b + (n / 5) + 2, istrue); } this far can go. trying find median of b , b[median] - a pivot. doesn't seems right. in book says recursively find median of medians.i can't catch that. help? edit: note in wiki didnt use recursion!

javascript - Capture words not followed by symbol -

i need capture (english) words except abbreviations pattern are: "_any-word-symbols-including-dash." (so there underscore in beginning , dot in end letters , dash in middle) i tried smthing this: /\b([a-za-z-^]+)\b[^\.]/g but seems don't understand how work negative matches. update: i need not match wrap words in tags: "a words _abbr-abrr. here" should get: <w>a</w> <w>some</w> <w>words</w> _abbr-abbr. <w>a</w> <w>here</w> so need use replace correct regex: test.replace(/correct regex/, '<w>$1</w>') negative lookahead (?!) . so can use: /\b([^_\s]\w*(?!\.))\b/g unfortunately, there no lookbehind in javascript , can't similar trick "not prefixed _ ". example: > = "a words _abbr. here" > a.replace(/\b([^_\s]\w*(?!\.))\b/g, "<w>$1</w>") "<w>a</w> <w>some</w> &l

sql server - SQL query for formatted output -

i want create sql query, , format output of query. my table looks this: time amount id imid --------------------------------- 1 2500 1 4 3 5000 1 4 5 10000 1 4 7 20000 1 4 1 2500 2 8 3 5000 2 8 5 10000 2 8 7 20000 2 8 i want output in following format:- id imid time1 time2 time3 time4 ---------------------------------- 1 4 1 3 5 7 2500 5000 10000 20000 2 8 1 3 5 7 2500 5000 10000 20000 i've tried: select sprofileid,imerchantid,'day1','day2','day3','day4',damount (select rm.sprofileid,rm.imerchantid,rc.idays,rc.damount tblrulebymerchant rm join tblalertrulecummulativedata rc on (rm.sprofileid=rc.sprofileid) ) d pivot (max(rm.sprofileid) rm.imerchantid in ('day1','day2','day3','day4')) piv i assumed time column value fixed ,

Visual C# (2010) Slow between Build Succeeded and run (Custom controls) -

since created extended controls in large application (wforms) vs started taking time (+30s) between succesful build , actual run of program. when build, or run program, there no problem. it's when debugging when debugging - closing application - start debugging again (without changes), timing normal. i believe tried every provided solution in stackoverflow: visual studio debugging/loading slow the "extended controls" like: class extendedcheckbox : system.windows.forms.checkbox { private short? softaddressp = null; private byte? bitnumberp = null; public short? softaddress { { return softaddressp; } set { softaddressp = value; } } public byte? bitnumber { { return bitnumberp; } set { bitnumberp = value; } } } i following output when debugging: 'diagnosev3.vshost.exe' (managed (v4.0.30319)): loaded 'c:\windows\microsoft.net\assembly\gac_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089

ios - Loading custom cell from nib does not finish on time -

i have uiview contains 2 uitableviews, toggled between using segmented control in navigation bar of uiview. the first table (ingredients) uses standard cells, , working fine. the second table (recipes) uses custom cell loaded nib. problem when app launched , recipes table last visible (from state preservation), when view appears cells presented using standard cells. if user cycles mentioned segmented control, appear intended upon return recipes table. the relevant parts of tableview:cellforrowatindexpath: in viewcontroller: // check displaying right table if (tableview == self.recipestable) { static nsstring *recipecellidentifier = @"recipecellidentifier"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:recipecellidentifier]; nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"recipecell" owner:self options:nil]; if(nib.count > 0) { cell = self.customcell; } else {

sql - Show results between :year field in Rails 3 -

i haved cars scaffold field year type string. im interesting select 2 years between 2 select_box , display cars between selected years. i started testing in console with: car.maximum(:year) and car.minimum(:year) but when starting testing with: car.where((self.maximum(:year))..(self.minimum(:year))) i lost head, suggestions welcome, thank you! the solution in model cars.rb add method: def self.year(fyear,tyear) result = order('new desc') result = where(:year => fyear..tyear) if fyear.present? && tyear.present? result end then in cars_controller.rb add index method: @cars = car.year(params[:fyear],params[:tyear]) finally, on view index.html.erb add form select 2 year fields: <%= form_for cars_path, :method => :get %> <label>mínimo</label> <%= select_tag :fyear, options_for_select(car.all.map &:year) %> <br /> <label>máximo</label> <%= select_tag :tyear, options_for_sel

Image Array for loop Bitmap Android -

how pass imageview array following code. code takes image array resize , put in linearlayout . currenly code take 1 image @ time. imageview array: private integer[] imgid = { r.drawable.pic1, r.drawable.pic2, r.drawable.pic3, }; bitmap bitmaporg = bitmapfactory.decoderesource(getresources(), imgid[5]); // taking 1 image int width = bitmaporg.getwidth(); int height = bitmaporg.getheight(); int newwidth = 200; int newheight = 200; // calculate scale - in case = 0.4f float scalewidth = ((float) newwidth) / width; float scaleheight = ((float) newheight) / height; // createa matrix manipulation matrix matrix = new matrix(); // resize bit map matrix.postscale(scalewidth, scaleheight); // rotate bitmap matrix.postrotate(0); // recreate new bitmap bitmap resizedbitmap = bitmap.crea

Building GUI Applications in PowerShell -

is there free equivalent sapien powershell studio build gui applications in powershell? ok, found solution: there free community edition of powershell studio called primalformsce. http://www.sapien.com/software/freetools#primalformsce you can build gui applications, export ps1, edit code... tool !

How should Perforce VCS roots be configured in TeamCity for large repositories? -

this question identical this one , related perforce instead of svn. in perforce have these branches: development\projecta\trunk development\projecta\release1 development\projecta\release2 in teamcity should there 3 separate vcs roots or 1 checkout rules specified each build? following advice of accepted answer in linked question changed our setup have single vcs root contain everything. performance dire initial checkout taking 45 minutes. the build configurations set checkout server side , have checkout rules such as: -:. +:development/projecta/trunk i'm worried setup isn't scalable. if 3 branches takes 45 minutes, few more releases , checkout time prohibitive. best practice setting perforce vcs roots large repositories in teamcity? after contacting jetbrains support, answer: the checkout rules not efficient perforce , server-side checkout, have separate issue performance problem, cannot tell id right now. right now, server side checkout, t

Cannot set a route in my Node.js Express.js application -

i have node.js application , using express.js framework well. dir structure following: myapp +-- node_modules +-- public +-- routes |-- index.js |-- mynewpage.js +-- views |-- index.ejs |-- mynewpage.ejs |-- app.js |-- package.json the app.js file this: 2 /** 3 * module dependencies. 4 */ 5 6 var express = require('express') 7 , routes = require('./routes') 9 , http = require('http') 10 , path = require('path'); 11 12 var app = express(); 13 14 // environments 15 app.set('port', process.env.port || 3000); 16 app.set('views', __dirname + '/views'); 17 app.set('view engine', 'ejs'); 18 app.use(express.favicon()); 19 app.use(express.logger('dev')); 20 app.use(express.bodyparser()); 21 app.use(express.methodoverride()); 22 app.use(express.cookieparser('your secret here')); 23 app.use(express.session()); 24

java - how can I create a new project without appcompat_v7 -

i unable why appcompat_v7 created automatically... finding irritating.. please rid off problem. tried create new project , found every newly created project. when creating new android project remove check in front of "create activity". doing this, eclipse not automatically import library project "appcompat_v7". manually have create main activity. careful imports use if have stuff fragment or actionbar . this useful. hope helps! :)

mvvmcross ios method binding (RIO) -

is there way achieve method binding in ios mvvmcross ? cannot see example of such binding in vids or tutorials... imagenavigationviewmodel : public void navigateleft() { if (!this.hasleftsisters.value) { return; } this.currentnodeindex--; this.update(); } imagenavigationview : private uibutton navigateleftbutton; ... var set = this.createbindingset<imagenavigationview, imagenavigationviewmodel>(); set.bind(this.navigateleftbutton).to(vm => vm.navigateleft); i have compile-time error since it's expecting object (icommand). i tried too: set.bind(this.navigateleftbutton).to("navigateleft"); and have runtime error: failed create target binding binding touchupinside navigateleft. i ended adding icommand view model, bit disappointing since "method bind" find in android. rio method binding available in ios it's demonstrated in https://www.youtube.com/watch?

asp.net - HTTP Error 404.0 - Not Found for viewer.js when publishing application on IIS -

i have tested application using viewer.js visual studio internal web server(iis express) , working fine.if instance try browse http://internallocalhost/viewer.js/index.html/# works fine when published application on iis getting 404 error @ address http://publishedsite/viewer.js/index.html/# it works fine if http://publishedsite/viewer.js/index.html of no use have concatenate url of pdf file like http://publishedsite/viewer.js/index.html/#http://publishedsite/mytest.pdf any particular settings required on iis? can't understand how iis express not able reproduce same error.

c# - Microsoft Expression studio wont show up in start menu after installing expression blend 4.0 -

i have installed expression blend through blendwpfsdk_en.msi. after installing not showing in start menu. have tried right click on xaml file still not showing up. m using visual studio 2010. missing something? please help in advance

highcharts: how insert a fix label on a chart -

i know if there method add fixed label on chart, example near line or on column histogram thank much cinzia you can use renderer allows add custom text.

how to store set of images in a dictionary, and retrieve it using python opencv -

i have dictionary, have taken images value , indexes key, have stored using zip function, , when trying retrieve it, not displaying images. have done is: pth = 'd:\6th sem\major project\code' resizedlist = dict() infile in glob.glob(os.path.join(path,'*.jpg')): imge = cv2.imread(infile) re_img = cv2.resize(imge,(256,256)) imedges = cv2.imwrite('{0:d}.jpg'.format(i),re_img) resizelist.append(imge) = + 1 resizelist_key = ordereddict(sorted(enumerate(resizelist),key=lambda x: x[0])).keys() i,infle in enumerate(glob.glob(os.path.join(pth,'*.jpg'))): img = cv2.imread(infle) my_key = str(i) resizedlist[my_key] = img # retreival code, result_list contains euclidean distance, , resultlist_key contains numbers res_lst_srt = {'val': result_list,'key':resultlist_key} res_lst_srt['val'], res_lst_srt['key'] = zip(*sorted(zip(res_lst_srt['val'], res_lst_srt['key']))) cv2.imshow

Excel: find 'a' or 'b' in a cell -

using 'find' formula in excel, possible find either 'a' or 'b' in cell (without using vba)? for ex; a1 = 'west 1' i tried find(or("1","2"),a1) threw error. you can use array formula returns first position of character list: =min(iferror(find({"1","2","3"},a1),"")) press ctrl + shift + enter evaluate it. it returns 0 if nothing found.

database - how to open sqlite3 db through javascript? -

i using https://github.com/kripken/sql.js plugin open sqlite db js <script> function print(text) { var element = document.getelementbyid('output'); element.innerhtml = text.replace(/\n/g, '<br>'); } var db = sql.open('fixtures/db/development.sqlite'); // run command in database function execute(commands) { try { var data = db.exec(commands.replace(/\n/g, '; ')); print(json.stringify(data, null, ' ')); print(data); } catch(e) { print(e); } } , getting error "sqlite exception: 26, file encrypted or not database". there problem opening sqlite file? grant web server access folder storing sqlite file. for example, if iis, grant user 'iis apppool\defaultapppool' modify access sqlite database file or containing folder. user doesn't show in user searches, if paste name , click 'check names' when granting privileges using windows explorer allow user selected. if

excel - VBA entering debugging when startup code is executed? -

i have code in: workbook_open() and misbehave. (i remove vba modules , import them, , "removed" modules stay long enough interfere importing...) how debug such code? you can debug worksheet_open placing stop command before first line of code, save , close workbook re-open , step through code using f8 .

asp.net - Grid view values are not binding when paginate -

in below code have grid when try paginate throws page index changing error tried fix issue.but when paginate not binding values.so me solve issue. <asp:gridview onpageindexchanging="grdsrchlst_pageindexchanging" id="grdsrchlst" runat="server" pagerstyle-mode="numericpages" pagesize="10" pagerstyle-visible="true" autogeneratecolumns="false" allowpaging="true"> </asp:gridview> code: protected void grdsrchlst_pageindexchanging(object sender, gridviewpageeventargs e) { grdsrchlst.pageindex = e.newpageindex; searchinformation(datatable dtsearch); //throws error ...i cant bind value when paginate } public void searchinformation(datatable dtsearch) { grdsrchlst.datasource = dtsearch; grdsrchlst.databind(); } try shown in article: http://www.c-sharpcorner.com/uploadfile/rohatash/gridview-paging-sample-in-asp-net/