Posts

Showing posts from February, 2011

python - Second stylesheet in child template / Overriding style sheets -

i have website i'm putting python , django. have template html page, speakers.html , extends base.html . base.html has stylesheet base.css . speakers.html displaying base.css styling should be, problem want speakers.html have additional styling stylesheet, speakers.css . i've been trying figure out speaker.css doesn't seem applied, infact i've noticed in cmd output file speaker.css isn't being loaded @ all. i tried putting in block, code see below.. had repeat {% load static %} rid of error expecting endblock doesn't seem have made difference. base.html <!doctype html> <html lang="en"> <head> <title>base.html</title> {% load static %} <link rel="stylesheet" type="text/css" href="{% static "css/base.css" %}" /> {% block additionalcss %}{% endblock %} </head> <body> ...ect speakers.html <!-- extending works --> {% ex...

Pythonic way of rewrite Java code in Python -

i have write library in python written in java before. coming java background python giving me little difficult time. stuck choosing right pythonic way of doing something.. so, java code like: import java.util.collection; public abstract class myenumbaseclass { protected int value; protected string description = null; protected myenumbaseclass(int ivalue, string idescription) { value = ivalue; description = idescription; } public int getvalue() { return value; } public string getdescription() { return description; } protected static myenumbaseclass getenum(collection<myenumbaseclass> iter, int value) { (myenumbaseclass enumobj : iter) { if (enumobj.getvalue() == value) { return enumobj; } } return null; } } import java.util.arraylist; import java.util.collection; public class myenumclass ext...

r - ggplot column chart - order of colours in brewer object has no effect -

i trying change colours on ggplot column chart. after googling, thought following code work: require(ggplot2) require(rcolorbrewer) state <- c(rep("nswtc",5), rep("tcv",5), rep("qtc",5), rep("watc",5), rep("safa",5), rep("other",5)) year <- rep(c("11-12","12-13","13-14","14-15","15-16"),6) ##some random data funding.programme <- abs(rnorm(30)) df <- data.frame(state, year, funding.programme) ##this line makes graph in order inputted it, rather alphabetical df$state <- factor(df$state, levels=unique(df$state)) ##ugly coloured bars <- ggplot(df) + aes(x=year ,y=funding.programme, fill=year) + geom_bar(stat='identity') + facet_grid(facets=~state) + scale_y_continuous('gross issuance requirements') ##nicely coloured blues <- brewer.pal(5, "blues") blues <- ...

asp.net - Access Virtual Directory in Another Web Application -

i have 2 web application projects (project , project b) in same solution. i want able to: through project a, save file somewhere in directory of project b. whenever use server.mappath etc, resolves virtual directory of project a, not of b. from reading, believe should able type url of project b directly save method. however, neither project deployed @ moment. besides, want leverage fact on same solution. tia! but if you're saving file , don't want access virtual directory ; want actual (physical) directory . means request.mappath way go; can use overload cross-app mapping set true . string pathtoappb = request.mappath("/appbvirtualpath", request.applicationpath, true); you still have know virtual path application b deployed to, though; , can't test locally unless deploy local iis.

Your way to write simple comments -

how guys write comments on simple code use yourself? i write javascript , php code, , can't feel found nice way write comments. if have short line of code, this: x = dothis(getsomevaluefromsomewhere()); // short line of code which seems nice think, doesnt works when line gets little longer or on multiple lines, // dont since it's not clear if describes line 1, or lines. alongervariablename = (getsomevaluefromsomewhere() == "this want") ? "true value" : "false value"; x = dothis(alongervariablename); so, how do it? (* * blocks of comments serve important documentation * e.g descriptions of functions. *) maybe reformatted as (* blocks of comments thet serve important documentation * e.g descriptions of functions. *) and // short inline comments do. don't forget ctrl-/ friend ;-)

javascript - Wordpress site won't load in IE 8.0 -

i'm not hardcore web developer enjoy customizing wordpress themes fit needs. put small website mom who's running local office. used wordsmith anvil theme (http://wordpress.org/extend/themes/wordsmith-anvil).. the site loads nicely in chrome , firefox. however, when comes ie 8.0, won't load (when hover cursor on page, can still click on links , whatnot page appears blank- white). or load after couple refreshes. same applies 5 pages on website. i checked theme developer's website , read thru replies ppl had similar issues. suggested replacing line of code: $(document).ready(function() { with jquery(document).ready(function($) { in 3 .js files.. however, still didn't resolve issue i'm having. ideas else might causing it? appreciate responses. thank you! ps. when disable scripts in ie, page load fine.

sql - Aggregating rows when selecting distinct rows with "bad" data -

the title bit vague, let me tell want , show what's wrong data. i need sum cell values (sizes) of unique rows in table. data sort-of "bad". working mapi , message size returned mapi can differ non-deterministically same message content. i have 2 similar tables/tasks: messages , attachments. it's easier deal attachments, since sha1 hash correlates attachment size. attachment data looks (tab-delimited, excel-ready): hash size 0x0015a93fffb1726e6647f94f47f4998ac699a455 97 0x0015a93fffb1726e6647f94f47f4998ac699a455 97 0x0020ce1810b56cc17f6cfd0a0b6121592825f7e5 85 0x0086077dd1e4af6a38014ab505105b05f8f5311e 62 0x0086077dd1e4af6a38014ab505105b05f8f5311e 62 0x00a6510eedb20a27b00b23416cf755715647a351 85 0x011c9258a0e16e25662e8f3bee8a1462c175c117 87777 0x011c9258a0e16e25662e8f3bee8a1462c175c117 87777 0x011c9258a0e16e25662e8f3bee8a1462c175c117 87777 0x011c9258a0e16e25662e8f3bee8a1462c175c117 87777 0x011c9258a0e16e25662e8f3bee8a1462c175c117 87777 0x011c9258a0e16e25662e8...

excel - Search for value in column that matches another column AND a date? -

Image
i have data stored in 3 columns of excel column a: serial number column b: date column c: value (e.g. cost) i need value (column c) associated particular serial number (column a) , date (column b). so example, in screenshot below, if want value associated serial number (t455) , date (dec 13, 2010), value should 8. the method can come computationally inefficient, because go through cells each time value. is there method, example, limit search area given serial number? for example, if looking value serial number t455, how can limit code search date in rows (6-13) , find corresponding value in column c, rather searching whole table? sub findvalue() dim s string dim d date dim v integer s = t455 d = dec 13, 2010 = 1 range("a1").end(xldown).row if range("a" & i) = s , range("b" & i) < date - 7 , range("b" & i) < date + 7 ' way search date range rather specific date v = range("c" & i).valu...

bash - Test file existence with exit status from gnu-find -

when test -e file not flexible enough, tend use following bash idiom check existence of file: if [ -n "$(find ${find_args} -print -quit)" ] ; echo "pass" else echo "fail" fi but since interested in boolean value, there ${find_args} let me instead: if find ${find_args} ; ... i'd no. man find ... find exits status 0 if files processed successfully, greater 0 if errors occur. deliberately broad description, if return value non-zero, should not rely on correctness of results of find. testing output fine find. isn't "bash idiom". if that's not enough , have bash available can use extglobs , possibly globstar file matching tests [[ . find should used complex recursive file matching, or actual searching files, , other things can't done bash features.

python - How to store torrent links in a database? -

i have python list in spider containing magnet torrent list. how store list/magnet torrent in database fields ? code : class myspider(basespider): name = "myspider" allowed_domains = ["thepiratebay.se"] base_url = "http://www.thepiratebay.se/search/%s/" start_urls = [] def __init__(self, *args, **kwargs): movies = movie.objects.all() movie in movies: self.start_urls.append(self.base_url % movie.name) super(myspider, self).__init__(*args, **kwargs) def parse(self, response): self.log('hi, item page! %s' % response.url) hxs = htmlxpathselector(response) items = hxs.select('//table/tr/td[contains(@class, "detname")]') item = items item_name = hxs.select('//a[@class="detlink"]/text()').extract()[1] print item_name #list containing movie names torrent_link = hxs.select('//a[@title=...

php - PDOException' with message 'SQLSTATE[08004] [1040] Too many connections -

i've got error in php file. error says 'pdoexception' message 'sqlstate[08004] [1040] many connections'. have looked around , people says should change max_connections on mysql server. did that, doesn't work. thanks in advance! you should use non-persistent connections. details in php manual

How to resize two subviews based on priorities using Cocoa Autolayout? -

i playing autolayout in cocoa , things not clear me. i have 2 views on window. width of each view 1/2 width of parent window. | | | | | | | view1 | view2 | | | | | | | if resize window want view2 resize first. | | | | | | | view1 |view2| | | | | | | when view2 reaches minimal size want view1 resized minimal size. | | | | | | |view1|view2| | | | | | | how can that? the layout seems bit unspecified. when view2 start shrinking instead of matching view1's size? assuming views should same size until view1 reaches soft minimum. @ point, view2 resizes until reaches minimum, , view1 resizes until reaches minimum. we can have behavior adding priorities contraints. in order of importance have: view1 , view2 >= minimum view1 >= view1softminimum view1 == view2 contraint 1 mu...

regex - How to match a minimal pattern ending at the end of input in JavaScript? -

this follow-up previous question i find minimal sequence of characters of length > n , starts @ word boundary , ends @ end of input. for example: n = 5, input = "aaa bbb cccc dd" result = "cccc dd" i tried \b.{5,}?$ matches whole input rather minimal part. what regex suggest? the problem time isn't greediness, it's eagerness. regexes naturally try find earliest possible match, , getting them find last 1 can tricky. easiest way 1 @arcadien demonstrated: use .* gobble whole string, use backtracking find match on rebound. i have questions requirements, though. \b can match beginning or end of word, if (for example) n=5 , string ends "foo1 bar2" , result " bar2" (notice leading space). want match starts @ end of word, or should drop space or beginning of "foo1" ? also, words consist entirely of word characters? if there non-word characters, \b able match in more surprising places. for ...

Kill An Application in Android -

i have created service creates timmer task active every 5 seconds. check running processes , have list of applications's packages don't want run. so, when match them , found uncessary application running launch activity called "killapplication" , pass package killed. not killing required package. please me out. public class killapplication extends activity { private dbadapter db; private context _context; string nameofprocess = "com.android.email"; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); _context = this; if (getintent().hasextra("application")) { nameofprocess = getintent().getstringextra("application"); } log.d("process passed", nameofprocess); activitymanager manager = (activitymanager) _context...

Android sdk won't allow download api 8 and 10 -

Image
the android sdk won't allow me install api8 , api10 because there isn't option down load sdk platform. there ways fix this? thanks. try in sdk manager packages->reload uninstall sdk add/remove programs. delete .android directory in users directory. reinstall sdk scratch.

jquery - Header, main, footer stretch to fill page -

i have following kind of html: <header></header> <div id='main'></div> <footer></footer> where preferably positioned relatively. header , footer have known height. i'd main div to, default, fill entire page, header @ top of page , footer @ bottom of page. help? using jquery: $(function() { var height = $(window).height() - ($("header").outerheight() + $("footer").outerheight()); $("#main").css("min-height",height+"px"); }); what did set main div height browser viewport height , subtracted height of header , footer. i hope helps :)

SQL Select statement - The thing i am querying for has a single quotation mark -

hi new stackoverflow , sql. not sure how phrase title google not helpful. i doing simple select query: select * department departmentname = "controller's office" i return results has departmentname of "controller's office". name has single quotation must not removed(because boss said so). using single quotation marks not work. , returns error: invalid column name 'controller's office'. how can query works? if doing complicated please explain because new thanks! most variants of sql (you don't specify using) let escape single quotes using another single quote: select * department departmentname = 'controller''s office' double quotes (in of variants of sql know) used delimit identifiers (column , table names) contain characters not otherwise valid in identifier's name.

performance - Efficient use of SQL GROUP BY, SUM, COUNT -

i have table of products sales may follows: product | amount | ptype | pdate p1 | 1.00 | sale | 01/01 p1 | 2.00 | base | 01/02 p2 | 1.50 | sale | 02/03 p3 | 5.25 | base | 10/10 and build table shows 1 product per row, sum of amounts, if product unique show type else show type 'var', if product unique show date else show date null. result follows: product | total | ptype | pdate p1 | 3.00 | var | (null) p2 | 1.50 | sale | 02/03 p3 | 5.25 | base | 10/10 i accomplishing result need doing following: select distinct product ,(select sum(amount) t b group b.product having a.product = b.product ) total ,(select case when count(*) = 1 a.ptype else 'var' end t b group b.product having a.product = b.product) ptype ,(select case when count(*) = 1 a.pdate else null end t b group b.product having a.product = b.product) pdate t but kno...

How to select checkboxes in cakephp and sending email -

i created page using cakephp , have checkboxes every field (the page contains list of patients , every patients have checkbox). want select few patients , send email selected patients. here question how link selected patients email tab. it helpfull if can give elaborated answer. thank all. you can use following code: <?php echo $this->form->input('user.patient_email_ids][', array('multiple' => 'checkbox', 'options' => $checkbox_list));?> and $checkbox_list array variable should contain values following: $checkbox_list = array( [abc@def.com] => patient1, [ghi@jkl.com] => patient2 ); and can pass $this->request->data['user']['patient_email_ids'] mail component in $to(list of recipients) variable.

php - jquery CONTAINS:text -

as seen in code below: in header part called <input type="text" size="30" onkeyup="filter(this.value)" /> -- function filter(a){ if (a.length > 0) {$("tr").hide(); $("tr:contains('"+a+"')").show();} else {$("tr").show(); } } i have list of items in table format wherein there 3 td, item code, item desc, item type i have input box filter out table matching text inputted in textboxt match in item code only, not in whole tr. how search in hide whole if doesnt match search? filter table 1 being typed. html table generated sql select http://jsfiddle.net/zs4tz/ try following: $("td:contains("+ +")").parent('tr').show(); or $('td').filter(function() { return $.trim( $(this).text() ) == a; }).parent('tr').show();

vb.net - display datatable text -

i have data table many rows , columns. how can display value (text) in row 1 column 1 message box? i able display row count, can't seem figure out how display actual contents of cells. i'm using vs2012, , coding in vb try, messagebox.show(datatabelname.rows(1)(1))

gis - How to store room shape data in Rails? -

i'm writing rails app needs store shape data representing floor plans of public spaces. spaces churches , concert halls. many shapes simple ("fans" or "shoeboxes") more complex (e.g. like this ). i'm new rails , totally new gis applications. (is gis problem? i'm not sure.) can suggest sort of data type should use store information in database? should room shapes stored polygons? or there more appropriate data type, such 1 can more accurately represent curved surfaces found in some venues ? this not efficient way might start out defining models such as: class path has_many :nodes end class node attr_accessible :x, :y, :next_id belongs_to :next, class_name: 'node' has_one :arc_extension end class arcextension attr_accessible :radius, :x1, :y1, :x2, :y2 belongs_to :node end a path collection of nodes. each node store coordinates of point on path along id of next node in path. if want node represent b...

vb.net - How do I update an entity in EF across multiple ASP.NET requests without retrieving it again? -

sounds easy, right? here's scenario... private dbquery new reefentities protected sub page_load(byval sender object, byval e system.eventargs) handles me.load if not page.ispostback currentcoral = (from c in dbquery.corals c.coralid = intcoralid).firstordefault txtcommonname.text = currentcoral.commonname end if end sub protected sub btnsave_click(byval sender object, byval e system.eventargs) handles btnsave.click 'how access coral page load update it? currentcoral.commonname = strname dbquery.savechanges() end sub i don't want re-query result, want update query page load , save changes, right? how access original object update it? http stateless protocol , result, every request make server needs rebuild object graph unless persist somewhere. there many ways persist data across web "session". in asp.net can store data in cookies, server side session, viewstate, form variables, , more. first detach current...

php - Two seemingly identical queries returning different results when using count (pagination) -

i running 2 queries database pagination reasons. such, each query identical. count(*) query not returning number of results non-count query is. i'm baffled why case. queries below. select p.host_id, p.rating_support, p.rating_tech, max(p.rating_overall) rating_overall, p.publish_rating, h.name, prices.price, prices.term_duration plans p inner join hosts h on h.id = p.host_id inner join (select plan_id, price, term_duration prices price > 0 , price < 50 , term_duration = 1) prices on prices.plan_id = p.id p.published = 1 , h.published = 1 group p.host_id order rating_overall desc limit 0, 12 select count(*) count plans p inner join hosts h on h.id = p.host_id inner join (select plan_id, price, term_duration prices price > 0 , price < 50 , term_duration = 1) prices on prices.plan_id = p.id p.published = 1 , h.published = 1 group p.host_id i'm not expert @ mysql. besides count not providing correct number of results, non-count query works perfectly. any ligh...

django.contrib.comments and multiple comment forms -

i followed guide @ https://docs.djangoproject.com/en/dev/ref/contrib/comments/custom/ set comment form on news entries current django app. now, need have comment form different fields type of object in part of site. how should accomplised considering i've overridden contact form already? that's question; django seem pretty insistent use same comment form everywhere. can write single form shows different fields based on object it's instantiated with. try writing init method along lines of this: class customcommentform(commentform): custom_field = forms.charfield(max_length=100) def __init__(self, *args, **kwargs): super(customcommentform, self).__init__(*args, **kwargs) # check what's in kwargs['initial'], , insert fields if needed this: if ...: self.fields['optional_field'] = forms.charfield(max_length=100)

How to plot family tree in R -

Image
i've been searching around how plot family tree couldn't find reproduce. i've been looking in hadley's book ggplot same thing. i want plot family tree having source dataframe similar this: dput(head(familytree)) structure( list( id = 1:6, cnp = c("11", na, "22", na, na, "33"), last_name = c("b", "b", "b", na, na, "m"), last_name_alyas = c(na, na, na, na, na, "m"), middle_name = c("c", na, na, na, na, na), first_name = c("me", "p", "a", na, na, "s"), first_name_alyas = c(na, na, na, na, na, "f"), maiden_name = c(na, na, "m", na, na, na), id_father = c(2l, 4l, 6l, na, na, 8l), id_mother = c(3l, 5l, 7l, na, na, 9l), birth_date = c("1986-01-01", "1963-01-01", "1964-01-01", na, na, "1936-01-01"), birth_place = c("ci...

number formatting - How to store exponential values (1.3e12) and normal values(1.3) in the same matrix in matlab? -

i have file consisting of values ranging 0.1 1.3e12. have been trying store in same array not working. can help? the numbers 0.1 , 1.3e12 both stored in floating point data type. double type default storing either of these in matlab. answer yes can store them in same matrix. what actually referring way numbers formatted viewing. please have @ documentation format

.net - DataContext Scope Best-Practice -

when using linq-to-sql, visual studio creates datacontext class you. i'm wondering when instantiate context, in 1 of projects used 1 datacontext instanse 300 crud commands (whole project) , worked little problem managed solve later, , in recent project have created instance of per crud command, here's question, best way use datacontext? 1 per command or 1 per project? or maybe 1 per transaction (that thinks idea too)? , there difference in speed , performance each way? when keep open short waste performance because instantiating datacontext not free. cheap measurable. shows in profiles. when keep open long problems too: objects start accumulate in it you can't use in multiple threads or multiple transactions @ same time anyway if 1 of submitchanges fails logical reason, context dead because same error appear forever, no matter how retry here rules should never without deep understanding: have 1 datacontext multiple http-requests/wcf-calls have dat...

java - Delay between two lines of code - Graphics -

i'm trying make simon game . mid way in programing game got problem. want program read queue values had been in game , turn flash colors in right order (i chose turn them gray , on second later normal) , problem. if @ method play() see comment wrote there. how do that? this code: import java.awt.color; import java.awt.font; import java.awt.graphics; import java.awt.event.actionevent; import java.awt.event.actionlistener; import java.awt.event.mouseevent; import java.awt.event.mouselistener; import java.awt.geom.arc2d; import java.util.date; import javax.swing.jpanel; import javax.swing.timer; import unit4.collectionslib.queue; public class window extends jpanel implements mouselistener , actionlistener{ queue <integer>data = new queue<integer> (); queue <integer>temp = new queue<integer> (); int random; timer prestart; int prestartcount; color [] colors = {color.red,color.blue,color.yellow,color.green}; public win...

c++ - Compiler memory consumption with template libraries (boost + Eigen) -

i writing template algorithm makes use of boost::accumulators , eigen linear algebra library. while compiling, visual studio compiler (cl.exe), memory consumption peaks @ on 2.5gb of ram, , pc (windows 7 32 bit 3gb virtual address space) becomes unresponsive (for quite long time: ~1 minute). binary files (.obj) 10-20mb these compilation units. my questions (not directed towards these specific libraries) is normal behavior code heavily uses templates? is there can done reduce memory demands , compile time? if there no solution problem, why isn't addressed people design programming language? more people understand c++, more use templates, , generate hard-to compile code, , bloated binaries. if there no solution problem, why isn't addressed people design programming language? because there no solution, full stop . the problem talking has nothing c++. it's artefact c- old "translation unit". fixing problem require re-doing compilation mo...

google apps script - EventGuest getName() method not working -

i started coding google apps script. i tried write simple program pull in events calendar , email guests in these events. i have run 2 problems: the getname() method returns guest's email address , not name, though name defined in google contacts. (also, if no name defined, according documentation, return null). i can't seem use getcalendarsbyname method. getcalendarbyid working correctly, getcalendarsbyname method doesn't return calendar wanted. i've tried getownedcalendarsbyname, doesn't work either. would appreciate anyone. update @ 7/1 3.30pm : @serge insas, second problem has been solved. however, first problem remains. here's code: function myfunction() { var calendar = calendarapp.getcalendarsbyname('test calendar'); logger.log(calendar[0].getname()); var today = new date(); // today's date logger.log(today.tolocalestring()); var enddate = new date(); enddate.setdate(today.getdate() +7); // set next...

java - Strange IP addresses in tomcat -

this question has answer here: how remote address of client in servlet? 8 answers some have in generic class. public static string getrequestip (httpservletrequest request){ string ipaddr = request.getheader("x-forwarded-for"); if (ipaddr == null)ipaddr = request.getremoteaddr(); return ipaddr; } for every request call method , in moment insert record in mysql database. in cases works , can see record every request valid ip address in right field. ip should there this. "unknown, 93.186.30.120" or "10.0.1.169, 186.38.84.3" apache @ front listening @ port 80 , used proxy tomcat listens @ port 8081. router config not allow pass conection come port other 80. help? in advance. the format x-forwarded-for http header is: x-forwarded-for: client, proxy1, proxy2, ... thus unknown, 93.186.30.120 means request coming p...

security - What methods are there for hacking my own PHP login form? Is it secure enough? -

in nutshell, have test server/website uploaded folder called "private" php scripts. flow of program follows: login -> search item number -> display item image --> logout or search again. in future item pages display large amount of database information each specific item, time being displays image. link test website below: http://testserver574.hostei.com/private/login.html my main question security , vulnerabilities. login.html page has form posts information php script called "processlogin.php", redirects login page wrong credentials. username , password hardcoded script time being. other adding ssl (secure socket layer), secure "enough"? how hard coding username , password processlogin.php insecure when users can't read php code? the username , password isn't hard guess if want try :p if real username , password, how can login such hacked display images? ps: username , password same, i'm wondering if can hack login wi...

c++ - How to execute an application that's injected in a process -

i want execute application (executable ending .exe extension ) injected in process on windows. how do that? use createremotethread . win32 api starts thread in process.

java - GC collects referenced object after return from scope -

i have question how gc works in java. consider following code: class c1 { arraylist<int> mylist = new arraylist<int>(); public void setlist(arraylist<int> l) { mylist = l; } } func(c1 c) { arraylist<int> l1 = new arraylist<int>(); l1.add(1); c.setlist(l1); } main() { c1 c = new c1(); func(c); ... } my question is: gc releases 'l1' after func() returns or not? no, doesn't, because there's root reference (stack variable c ) has strong reference ( mylist ), new arraylist . after main() returns, c1 , arraylist collectible, because root reference disappears.

Why is rotateY (flip) css3 animation flickering in Chrome? -

i have made jsfiddle: http://jsfiddle.net/grezzo/jr2lu/ when hit key on keyboard, picture flips around show text, during flip animation flickers (particularly text flickers) when viewed in chrome. (note using -prefix-free js library don't have prefix browser specific css properties.) why flickering , how can stop it? update: flicker noticable on chrome 20.0.1132.47 m running on xp, , whatever latest version os x 10.7.4 lion (i'm not near mac right check) well, little weird. removing background-color .card , works ok: http://jsfiddle.net/jr2lu/3/ seems styling .card issue, don't see div.

jsp - Spring MVC and tiles -- how to set non-boolean "true/false" to checkbox -

i have web application end table has column called type , column called value . type indicates components type (textfield, combobox, checkbox..etc), value actual value of component, both columns varchar2. the challenge is, when type combobox , value of component either true or false in string. , have no privilege modify database attribute. then when put checkbox on front end: <field:checkbox field="enableediting.setting" id="systemsetting_${formsettings.enableediting.name}" z="user-managed"/> i following exception: attribute 'value' required when binding non-boolean values even make value attribute in checkbox.tagx , <field:checkbox field="enableediting.setting" id="systemsetting_${formsettings.enableediting.name}" value="${formsettings.enableediting.setting}" z="user-managed"/> i still have same exception. it seems if field not boolean type, there no way make checkbo...

javascript - ExtJS 4 code assist in Aptana 3 -

i started using extjs 4 framework generating chart report in web app development project. looking up-to-date code assist extjs 4 release me typing. tried long find one, looks of them out-of-date. if using extjs 4 code assist in aptana (or other ide). please give me hand. thanks! great! find thread answers question. download extjs4.1.beta-v0.1.sdocml can add code hinting extjs 4 aptana project. there lot instructions adding spket plugin eclipse/aptana extjs support. never works me...not sure if used , worked out. update : using webstorm extjs 4 development now, has extjs support. js files included in project can identified in webstorm , code hinting listed.

c++ - Linking libavformat in Visual Studio 2010 -

i'm attempting build video-reading code around libavformat. after getting compiled dlls , .lib files here , go build code, , linker can't find of libavformat symbols though i've linked in provided .lib files. inspecting libavformat.lib dumpbin -headers reveals exports desired functions underscore prefix. example, while want call avformat_open_input , .lib file gives _avformat_open_input . why this, , why can't link precompiled dlls? you need following tasks use libav msvc++ . first goto zeranoe download shared version, copy .dll files bin folder , paste them in output directory exe generated. download developer version, copy .lib files lib folder , paste them main c++ file located (e.g. folder-1\folder-2 folder-1 has .sln file have put .lib files in folder-2 ) from developer version downloaded in step 2 copy directories include folder , paste them in folder-2 (see details folder-2 in step 2) download inttypes.h , stdint.h , sav...

PostScript Path Combine -

i have begun learning postscript in order produce graphics latex , have no idea how combine path stroke affect outer border of drawn shape. code follows: /black { 0 0 0 1 setcmykcolor } def /gold { 0.02 0.17 0.72 0.05 setcmykcolor } def newpath % center 1/2w , 1/2h /cx { 1200 2.0 div } def % center-x /cy { 600 2.0 div } def % center-y /r { 600 9.0 div 4 mul 2.0 div } def % star's radius cx r 0 cos mul add cy r 0 sin mul add moveto cx r 144 cos mul add cy r 144 sin mul add lineto cx r 288 cos mul add cy r 288 sin mul add lineto cx r 72 cos mul add cy r 72 sin mul add lineto cx r 216 cos mul add cy r 216 sin mul add lineto closepath gsave gold fill grestore 1 setlinewidth black stroke when stroke drawn, lines crossing shape drawn. know if there way have outer border of shape stricken , not inner lines. rather not have calculate lines forming star intersect, i.e. keep 5 lines instead of getting 10 smaller ones. ...

android - Set ProgressBar height -

the question seems stupid i'm not able define height of progressbar . neither in code nor xml file. layout_height property seems act margin one, , original size more smaller want. have found nothing on subject i'm quite confuse. answer here don't works me. , targeting api 15. has solution or explanation ? it stupid mistake. had paste sample code : <progressbar android:id="@+id/status_progress" style="?android:attr/progressbarstylehorizontal" android:layout_width="wrap_content" android:layout_height="wrap_content"/> however style attribute override others... to obtain "basic" horizontal progressbar have set attributes: <progressbar android:id="@+id/pb" android:layout_width="wrap_content" android:layout_height="wrap_content" android:progressdrawable="@android:drawable/progress_horizontal" android:inde...

Git: Fork GitHub Repo into different Repo -

original question this git repository have @ moment, on github here : master railstut i'm looking @ customising cloudhead's toto rails backend within project. the methodology can think of fork project, put within branch of noto repository: master railstut toto the reason want because repo, each branch different method of me trying working backend blog. reason want branches , not different repositories each attempt keep contained , neat. so... there way without downloading cloudhead's repo, unzipping working directory , committing it? googling hasn't helped, because i'm searching wrong commands (mainly fork , branch/checkout , clone ) questions clarify welcome! updates 2012-07-03 @ 1053 aest bonus points if can still make pull requests bug fixes or updates. though, sounds little pointless, given i'm customising , not patching, forks intended? you can add remote name cloudhead. use git remote add cloudhead git@gi...

vba - Excel date format issue (00/01/1990) -

i trying replace 0's(actually in date format =00/01/1990) n.a so have recorded macro. checked macro in different file, not working correctly. if click f2 each cell try re run macro working fine. other ways skip keep pressing f2 each range (thousand of ranges there) .. ex if a1,b1,a2 , b2 have 00/01/1900 when run below macro not working .. tried press f2 each cell again re run macro ..then working code : range("a1").select range(selection, selection.end(xldown)).select range(selection, selection.end(xltoright)).select selection.replace what:="00/01/1900", replacement:="n/a", lookat:=xlpart _ , searchorder:=xlbyrows, matchcase:=false, searchformat:=false, _ replaceformat:=false range("aw1").select if trying replace in entire worksheet can use instead of defining range everytime sub sample() sheets("sheet1") .cells.replace what:="00/01/1900", replacement:="n/a", lookat:...

asp.net - Get GridViewRow by DataKeyValue -

can gridviewrow given gridview datakey value? i know can loop through rows , row, need know if there shortcut way find row. for example, can find row if have rowindex. there similar way find row given gridview datakey value. any regarding highly appreciated. in advance. you can this string str = gvlisting.datakeys[rowindex].values["yourdatakeyname"].tostring();

math - Algorithm for finding if set of numbers can add up to X, with constrained histogram -

(motivation: consider problem have select sports team population of available players. each player has skill level proportional salary expectation, , want total of skill/salary level match total salary cap.) i need write following function: bool possibleassignment(int n, int m, int t, vector<int> h); the input constraints are: 0 < n <= 50 0 < m <= 50 0 < t <= 2500 h.size() == n + 1 forall i , 0 <= h[i] <= m possibleassign returns true iff array x of m ints can assigned following 3 constraints: forall i , 0 <= x[i] <= n forall v , number of elements of x value v <= h[v] the sum of x t by algorithm or method can implement possibleassign? this problem seems reduceable subset sum problem , or better known variant: knapsack problem , np-hard, there no known polynomial solution it. however, seems t small enough, , luckily, there pseudo polynomial solution problem using dp. because problem similar knapsack pr...

winforms - Datagridview excessive memory usage -

i have unbound datagridview 175 columns , 50,000 rows, populated doubles. according calculations, equates memory usage of 175*50000*8 bytes = 70 mb. however, task manager says grid using 1.2 gb of memory - 17x overhead! can explain why it's consuming memory? from msdn article on scaling datagridview ( http://msdn.microsoft.com/en-us/library/ha5xt0d9.aspx ) don't think i'm doing flagrantly wrong. i'm not setting styles or contextmenustrips individual cells. no modifications other populating cell values , setting format strings on column level. i understand virtual mode or shared rows might decrease memory consumption, given above calculations, don't think should necessary. 17x overhead doesn't sound right me. keep in mind each cell of datagridview holds datagridviewcell instance, containing 33 properties . it's more overhead double value.

How to grab a string using boost::regex in C++? -

example string: std::string sentence = "hello {bobby}, hows {johns}?." i want able grab inside curly braces using boost::regex, or guidance appreciated. the string can contain {bobby|john|cindy} or {bobby||cindy} or {{bobby}} in it'll {bobby}. i'm trying figure out regex that. thanks. the overall approach , code example described here . the regex need seems be: ([^{}]*\{([^{}]*)\})+ this regex not match @ unless string uses correctly paired, non-nested braces. if matches, can use regex_iterator process every second subgroups in each match.

math - How can I simply check if a set of n numbers are all different? -

i have n integers , need quick logic test see different, , don't want compare every combination find match...any ideas on nice , elegant approach? i don't care programming language idea in, can convert! you don't have check every combination commutivity , transitivity; can go down list , check each entry against each entry comes after it . example: bool areelementsunique( int[] arr ) { for( int i=0; i<arr.length-1; i++ ) { for( int j=i+1; j<arr.length; j++ ) { if( arr[i] == arr[j] ) return false; } } return true; } note inner loop doesn't start beginning, next element ( i+1 ).

css - How to vertically align text inside div without using inline-height -

in following example trying align text in middle vertically & horizontally. for reason doesn't come correctly tried few example also http://jsfiddle.net/kayen/jbnbg/ here can css & result: http://jsfiddle.net/surendravsingh/amcnz/31/ remove height .boxcaption . .boxcaption{ float: left; position: absolute; background: #000; width: 100%; text-align:center; /*add this*/ padding:5px 0 0 0; /*add this*/ opacity: .6; /* ie 5-7 */ filter: progid:dximagetransform.microsoft.alpha(opacity=60); /* ie 8 */ -ms-filter: "progid:dximagetransform.microsoft.alpha(opacity=60)"; }

windows phone 7 - How to navigate to a login page instead of MainPage -

i'm in sticky position. have published app , have been receiving crash reports. of invalidoperationexception . 19 frames in stacktrace shows internal functions , hence im not able figure out function raised it. lot of debugging, think invalidoperation exception caused way redirect navigation login page. the basic operation this. if user has set password, navigates password page else mainpage. code follows app() { // usual code rootframe.navigating += new navigatingcanceleventhandler(rootframe_navigating); } void rootframe_navigating(object sender, navigatingcanceleventargs e) { if (e.uri.tostring().contains("/rootpage.xaml") != true) return; cyclemanager pcycman = cyclemanager.instance; e.cancel = true; rootframe.dispatcher.begininvoke(delegate { if (pcycman.getpasswordenabled()) rootframe.navigate(new uri("/passwordpage.xaml", urikind.relative)); else ...

iphone - UIScrollview subviews show incorrect frames when enumerated -

hi guys have issue cannot head around. i have broken down issue own project , can still reproduce it. i have scrollview 30 uibutton layed out. (for example) if enumerate on the subview , log frames, odd 1 have frame wasnt expected this occurs once view has been drawn on screen e.g viewdidload [self.scrollview.subviews enumerateobjectsusingblock:^(id obj, nsuinteger idx, bool *stop) { uibutton* view = (uibutton*)obj; nslog(@"%@",nsstringfromcgrect(view.frame)); }]; log: 2012-07-04 15:46:02.939 bug scroller[2182:707] {{29, 647}, {72, 37}} 2012-07-04 15:46:02.946 bug scroller[2182:707] {{119, 647}, {72, 37}} 2012-07-04 15:46:02.950 bug scroller[2182:707] {{219, 647}, {72, 37}} 2012-07-04 15:46:02.954 bug scroller[2182:707] {{313, 453}, {7, 7}} as can see bottom log shows completly incorrect frame origins , size. oddly ever size of view seem size of 7. this appear reproducable not visible on screen ...

print array with JavaScript -

i need print two-dimensional array etc: var myarray = [ [0,1,2,0], [0,1,2,0] [0,1,2,0] [0,1,2,0] [0,1,2,0] [0,1,2,0] ]; and make output appear how array is: etc alert(myarray); will display: var myarray = [ [0,1,2,0], [0,1,2,0] [0,1,2,0] [0,1,2,0] [0,1,2,0] [0,1,2,0] ]; you may try this: json.stringify(myarray,null,'\t')

c# - Sharepoint modal dialog from anotother dialog -

when user clicks on button there appears sharepoint modal dialog. popup shows user confirmation message. working. now want following: when users clicks on yes button, first popup closes , , new modal dialog opens. is possible? , how? or can resize dialog dynamicly when he's open? here methods open dialogs: function openpopup() { var options = sp.ui.$create_dialogoptions(); options.url = "popup.aspx"; options.width = 230; options.height = 235; options.title = ""; options.dialogreturnvaluecallback = function.createdelegate(null, closecallbacknew); sp.ui.modaldialog.showmodaldialog(options); } function opensecondpopup() { var options = sp.ui.$create_dialogoptions(); options.url = "popup2.aspx"; options.width = 630; options.height = 235; options.title = ""; options.dialogreturnvaluecallback = function.createdelegate(null, closecallbacknew); sp.ui.modaldialog.showmodaldialog(op...

matplotlib - Drawing upon openstreetmap in python -

what want generate static image (e.g. png) using python , using openstreetmap tiles background. mathplotlib , basemap i'm looking for. problem being able use osm tiles background. i'm not pleased approach suggested in http://stevendkay.wordpress.com/2010/02/24/plotting-points-on-an-openstreetmap-export/ the closest found in answer using r, , not python plotting points data.frame using openstreetmap did miss obvious , easy solution? thanks help edit : questions suggests many tools, none seems match needs how can display osm tiles using python? you overlooked "export" tab @ osm website, capable of generating static image dimensions , map extents want. have @ http://wiki.openstreetmap.org/wiki/export please advised generating static images resource-intensive process, , osm sysadmins frown upon if large number of requests or abuse feature. unfortunately means you'll have find solution if you're trying lots of images. by way, data you...

c# - Printing simple and duplex in Crystal Reports -

i have c# 2010 application uses crystal reports vs2010. my client has pretty awkward request. wants print invoice client. wants whole invoice printed on 1 side of page, wants payment information appear on backside of last page. so basically, wants whole report printed single-sided, except last page, wants printed double-sided (duplex). is there way using cr , c#? know turn page , print payment options manually, that's not helpful. need able in same report. you may able accomplish hackery. try starting creating dummy section , making section start on new page or set new page after if not on last record. payment information put in report summary , start on new page. page, blank page, page, blank page, page, summary. the dummy section have 'new page before' , 'new page after' set not onlastrecord . report summary section should have 'new page before' set true .

php - Why is CIUnit needed in order to use PHPUnit with CodeIgniter? -

we've decided use phpunit (with jenkins) in our next project. we're considering different php frameworks, 1 of codeigniter. see a lot of people use my ciunit "bridge" phpunit , codeigniter. there little no explanation in online documentation. why needed? other frameworks don't seem need "cool bridge" this. reasons: codeigniter's components tightly coupled. need big basic parts running (the loader, router, cfg object) before can use other pieces. codeigniter not designed run cli. has great deal of bootstrapping code in index.php front-controller, , assumes web server environment. you not absolutely require ciunit unit-test ci. have something . in case, wrote alternative front controller index.php loads minimum necessary ci superobject. require_once @ top of test files, , $this->ci =& get_instance() in setup() methods. if being absolutely pure unit-tester, however, should destroying , re-creating ci object af...

android - Listening for ACTION_SCREEN_OFF -

i'm trying start service runs in background listening action_screen_off , when finds action_screen_off , starts activity. i read somewhere need create broadcastreceiver because putting in manifest xml doesn't work. have no idea started after searching. you cannot declare action_screen_on , action_screen_off in androidmanifest.xml . allowed catch them while activity running. here's example. the broadcastreceiver : public class screenreceiver extends broadcastreceiver { public static boolean wasscreenon = true; @override public void onreceive(final context context, final intent intent) { if (intent.getaction().equals(intent.action_screen_off)) { // whatever need here wasscreenon = false; } else if (intent.getaction().equals(intent.action_screen_on)) { // , whatever need here wasscreenon = true; } } } the activity : public class exampleactivity extends activi...