Posts

c - how to count cycles? -

i'm trying find find relative merits of 2 small functions in c. 1 adds loop, 1 adds explicit variables. functions irrelevant themselves, i'd teach me how count cycles compare algorithms. f1 take 10 cycles, while f2 take 8. that's kind of reasoning do. no performance measurements (e.g. gprof experiments) @ point, old instruction counting. is there way this? there tools? documentation? i'm writing c, compiling gcc on x86 architecture. http://icl.cs.utk.edu/papi/ papi_get_real_cyc(3) - return total number of cycles since arbitrary starting point

javascript - Is there a screencast/tutorial site for CoffeeScript? -

i'm new coffeescript, looking forward writing javascript code in more akin ruby. what 2-3 resources can recommended tutorials or screencasts , running coffeescript? [ update : have book coming out pragprog, coffeescript: accelerated javascript development . also, latest version of coffeescript 1.1.0, though introduced few changes; mainly, it's bugfix release.] the official documentation @ http://coffeescript.org up-to-date place you're going find. right now, latest release of coffeescript 1.0.1. there lot of changes in 1.0. orbit linked 2 other resources nice dated. tongue-in-cheek 7 reasons gonna hate it presentation way when assignment done using : instead of = . nettuts+ tutorial written when latest release 0.9.6 and, think , doesn't touch on that's changed since (such classes). so, might want go through nettuts+ tutorial, official docs, start reading real-world source code. see http://github.com/jashkenas/coffee-script/wiki/in-the-wild ...

.net - ASP.net & SQL 2008: What is the best way to store multiple values for lists when values are of varying amounts and not repeated throughout rows? -

i’m creating web app school using asp.net , sql 2008. have page users view course descriptions. part of course description include list of topics covered. topics different every course , there different amount of topics every course. data bind topics ordered list in repeater. need provide search functionality on web app. elegant , normalized way of storing topics in sql? want avoid writing vb or using client side scripting. i’ve considered: •entering values separated commas in field named topics. don’t want have programmatically separate values repeater , i’m not sure if elegant solution db. •using xml data type field named topics. think may not necessary , more complex needs be. •creating separate table each course pk , field named topics. don’t want have create tables! not trying lazy efficient! when designing databases helps work core objects/entities , see how relate each other. try , have normalized tables, never de-normalize until need to. in above exam...

Escaping Bash wildcards when executing python script from bash script? -

i've got bash script defines array of file globs containing * wildcards. the script executes python script passing each of these globs parameter. on command line can quote entire glob, , python happy it. in bash script, if quote globs, python's os.path.realpath seems confused quotes - passed in script itself. e.g. bash script: backup_paths=("/root/backups/db-dump-*" "/root/backups/*_backup.tar.bz2") path in "${backup_paths[@]}" /usr/local/bin/python2.7 /usr/local/bin/clean.py \'$path\' $max_files done python: os.path.realpath(path) # results in like: /usr/local/bin'/root/backups/db-dump-*' how can make them play together? thanks instead of \'$path\' , use "$path" . double-quotes allow contents of variable $path substituted, prevent wildcard expansion , ensure path passed single argument.

iphone - How do I set the click method on a TTButton? -

i'm using ttcatalog , creating ttbutton using following: ttbutton *button = [ttbutton buttonwithstyle:@"toolbarbutton:" title:@"click button"]; i tried adding target , action that, doesn't work. how use it? you missing "[". ttbutton *button = [ttbutton buttonwithstyle:@"toolbarbutton:" title:@"click button"]; [button setuserinteractionenabled:yes]; [button addtarget:self action:@selector(buttonpressed:event:) forcontrolevents:uicontroleventtouchupinside]; then set button properties, use target/action set event handler. (the ttbutton uievent subclass.) good luck!

asp.net mvc - What is the difference between Html.Label and Html.Display? -

what difference between html.label , html.display ? html.label() renders html markup <label /> can used model entity's attrubute. for eg, <%= html.label("full name", model.fullname) %> would render <label for="fullname">full name </label> html.display() on other hand renders html markup entire entity based on specified templates. eg. if have person entity multiple attributes, define template markup how render person , html.display() uses template render person objects across views. phil haack has excellent post on display templates.

UTF-8 encoding in Spring MVC, problem with FORMs -

i have in web.xml <filter> <filter-name>encoding-filter</filter-name> <filter-class> org.springframework.web.filter.characterencodingfilter </filter-class> <init-param> <param-name>encoding</param-name> <param-value>utf-8</param-value> </init-param> <init-param> <param-name>forceencoding</param-name> <param-value>true</param-value> </init-param> </filter> <filter-mapping> <filter-name>encoding-filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> and @ top of file.jsp have this: <%@ page pageencoding="utf-8" contenttype="text/html; charset=utf-8" %> in <head> this: <meta http-equiv="content-type" content="text/html; charset=utf-...