Posts

Showing posts from March, 2010

css - Can't fade out submenu, with jQuery -

this first question! certanly me on this. i´m working on horizontal menu: html: <div id="menu"> <ul> <li><a href="#">menu 1</a> <ul> <li><a href="#">submenu 1.1</a> <ul> <li><a href="#">submenu 1.1.1</a></li> </ul></li> <li><a href="#">submenu 1.2</a></li> <li><a href="#">submenu 1.3</a></li> </ul></li> <li><a href="#">menu 2</a> <ul> <li><a href="#">submenu 2.1</a> <ul> <li><a href="#">submenu 2.1.1</a></li> </ul></li> </ul></li> <li><a href="#">menu 3</a></li>

jquery - how to set slideToggle to work for more than one time -

i have nested ul tags , hide them can apply jquery slidetoggle effect them( want slide each element independently). when press each 'li' tag in first 'ul' second 'ul's become visible together. this how html code is: <div class="content"> <ul class="mainlist"> <li class="mainitem">list item</li> <ul class="sublist"> <li class="subitem">list item</li> <li class="subitem">list item</li> <li class="subitem">list item</li> <li class="subitem">list item</li> <li class="subitem">list item</li> </ul> <li class="mainitem">>list item</li> <ul cl

Find parent id of product in magento -

here code. $storeid = mage::app()->getstore()->getid(); $session = mage::getsingleton('checkout/session'); foreach($session->getquote()->getallitems() $item) {//how find parent id here} at above mentioned comment want access parent id of particular product. please .. try below code, may you if($item->gettypeid() == "simple"){ $parentids = mage::getmodel('catalog/product_type_grouped')->getparentidsbychild($item->getid()); // check grouped product if(!$parentids) $parentids = mage::getmodel('catalog/product_type_configurable')->getparentidsbychild($item->getid()); //check config product }

javascript - Active or Focus Effect on HTML< Ul> tag -

here sample ul tag: <ul style="list-style-type:none; padding:5px ; border:solid 1px #666666;"> <li>i wating </li> <li>i wating </li> <li>i wating </li> <li>i wating </li> <li>i wating </li> is there way css or javascript set ul border different color when clicked or active ? , when click in different place effect gone . trying make , search not result came out . js fiddle demo: http://jsfiddle.net/saifrahu28/yff6p/ no problem if there jquery solution . building off of fangels answer.... you wouldn't want hard code list style, otherwise have use !important in css. change tabindex ul , add class it. when has focus, change ul:focus item. html <ul tabindex="1" class="thislist" > <li>i wating </li> <li>i wating </li> <li>i wating </li> <li>i wating </li> <li>i wa

html - SASS extend/share/inherit specific properties from parent to child or vice versa -

is possible extend/share selected/specific properties child parent e.g. without creating variable? .main-container { padding: 20px; margin: 20px; ul { padding:$parentpadding(); margin: 0; } } or vice versa in case, .main-container { ul { rendered .main-container ul { , once parent element ul .main-container can achieve want using purely css solution: inherit ul{ padding: inherit; //will inherit padding value of parent element }

Mysql do not select duplicated values, conditional -

i looking way run simple select statement. have table has 3 columns: id , title , active , active column represents boolean value. 1. foo false 2. foo false 3. foo true 4. bar false 5. bar false 6. aaa false 7. ccc false 8. ccc true i want return following: 4. bar false 5. aaa false this show titles have single active value (this looking for, correct?), , min id title. select min(id) id, title, active yourtable group title having min(active) = max(active)

ruby on rails: controller can't access newly added record -

i'm quite new ror. @ first used sqlite3 database migrated mysql. worked fine application until added record database. i can update new records using "irb" console. have function in controller called python script updates record. here's function: # /dd_bots/update # param name, att def update obj = object.all obj = obj.select{ |o| o.name == params[:name] } obj[0].update_attribute(:att, params[:att]) head :ok end however function doesn't update newly added records returning error: nomethoderror (undefined method update_attribute' nil:nilclass) obviously record doesn't seem found... do have clue why happening? firstly, don't call model object : have disastrous consequences, object base class practically every object in ruby. secondly, update_attribute being called on first element of obj , array. error if array contains no elements, i.e. if there no objects name same name parameter being passed controller. you can

.net - Use C library in C++ -

i have c library header file. want make wrapper in c++ in order use in .net. when include library, compiler reports syntax errors regarding variable types (dword, lpcstr, etc...). in short, thinks library in c++ instead of c. i tried extern "c"{ #include "c_lib.h" } but no success. using visual studio 2010, maybe changes project settings should done. any appreciated. regards. you need include <windows.h> , think you're doing wrong. don't need create c++ wrapper use library .net. can dllimport c functions need call, directly in c#. using dllimport attribute

Manually bootstrapping AngularJS and then getting the module -

generally, i'd following , there ng-app in html: var myapp = angular.module("myapp", []); myapp.controller("attributectrl", function ($scope) { $scope.master = { name: "some name" }; }); however, need manually bootstrap angular because i'm using in part of app loaded via jquery's $.load() . if following: main.js - page want use angular on being pulled in $("#form").load(contextpath + url, params, function() { angular.bootstrap($("#angularapp")); }); and page being pulled in has it's own javascript: function attributectrl($scope) { $scope.master = { name: "some name"}; } this works, however, ideally, i'd controllers scoped @ module level. modified above code so main.js $("#form").load(contextpath + url, params, function() { angular.bootstrap($("#angularapp", ["myapp"])); }); and then... var app = angular.module("myapp&

Adding Multiple Login Pages in Jasperserver -

i want add multiple login pages single jasperserver. have customize code , added login1.jsp , login2.jsp in moudles/login/ folder. have added following code in \jasperserver-war\src\main\webapp\web-inf\jasperserver-servlet.xml bean id="urlhandlermapping" class="org.springframework.beans.factory.config.propertiesfactorybean"> <property name="properties"> <props> <prop key="/fileview/**">jsfileviewcontr</prop> <!-- anonymous pages --> <prop key="/login1.html">jscommcontr</prop> <prop key="/login.html">jscommcontr</prop> <prop key="/logout.html">jscommcontr</prop> and <!-- js mac method name resolver --> <bean id="paramresolver" class="org.springframework.web.servlet.mvc.multiaction.propertiesmethodnameresolver"> <pro

debugging - Is it possible to analyze windows message queue from a crash dump? -

my application once crashed because of windows message queue limit exceeded. bug hard reproduce. how analyze windows message queue contents crash dump? a user-mode dump file not contain message queue contents. can obtain kernel dump, though, if option. livekd can generate kernel dump without requiring rebooting system in debug mode , attaching real kernel debugger.

validation - How to validate an AngularJS directive that contains selects? -

i created directive made 2 selects, loads options 2 json file: http://plnkr.co/edit/7kk66c?p=preview as can see works fine, put directive form, , check validity. more specific directive valid if user selected option both selects (just both have been marked required). found fields of tutorial how set validy of directive contains input text, nothing check on selects...how that? have @ templatedir.html on this plunker solution. you need to: add <form></form> wrapper name="..." attribute. add ng-model="..." attribute each of <select></select> tags. add ng-required="true" each of <select></select> tags. you can check whether or not form in valid state using formname.$invalid . the ng-model tells angular bind values of inputs variable name specify in model , ng-required tells angular 2 inputs must completed. i'm assuming purpose of <form></form> obvious. :)

What's the difference between ItemTemplate and ItemContainerStyle in a WPF ListBox? -

in wpf listbox , i'm confused these 2 notions: itemtemplate , itemcontainerstyle can explain me more? the itemtemplate styling how content of data item appears. use bind data fields, format display strings, , forth. determines how data presented. the itemcontainerstyle styling container of data item. in list box, listboxitem. styling here affects things selection behavior or background color. determines style , ux of display. the msdn page itemcontainerstyle, linked above, has pretty example showing differences: <!--use itemtemplate set datatemplate define visualization of data objects. datatemplate specifies each data object appears proriity , taskname on top of silver ellipse.--> <itemscontrol.itemtemplate> <datatemplate> <datatemplate.resources> <style targettype="textblock"> <setter property="fontsize" value="18"/> <setter prope

css3 - Is there a way to make CSS animation work diagonally? -

i have made css animation animate text give shine effect it. effect works horizontal. wondering there way change direction of animation make realistic diagonal shine? here current code: h1 { font-family: 'bebasregular', sans-serif; font-size: 150px; padding-bottom: 100px; padding-top: 50px; background: #e9ab17 -webkit-gradient(linear, left top, right top, from(#e8a917), to(#f4b011), color-stop(0.5, #fff)) 0 0 no-repeat; -webkit-background-size: 155px; color: rgba(255, 255, 255, 0.1); -webkit-background-clip: text; -webkit-animation-name: shine; -webkit-animation-duration: 5s; -webkit-animation-iteration-count: infinite; } @-webkit-keyframes shine { 0% { background-position: top left; } 28%,100% { background-position: top right; } } you can change top bottom in ending position: @-webkit-keyframes shine { 0% { background-position: top left; } 28%,100% { background-position: bottom right; } } however, effect little noticeable. reason block element, , ext

sorting - MATLAB assign rank to values in a matrix in ascending/descending order -

i have 60x6 matrix x column 1 index , columns 2 6 data particular index. i'd assign ranks each value in data columns, such columns 2 though 5 ranked in descending order (highest value ranked 1, lowest value ranked 60) , column 6 ranked in descending order (lowest value ranked 1, highest ranked 60), row order maintained according the index (column 1). rank ties assigned rank equal average of positions in ascending order of values. i've looked through number of suggestions ( here , here , here ) , tried own version: [~,z1] = sort(x(:,2),'descend'); [~,z2] = sort(x(:,3),'descend'); [~,z3] = sort(x(:,4),'descend'); [~,z4] = sort(x(:,5),'descend'); [~,z5] = sort(x(:,6)); but none seem work way want them to. for x = 1 0.9503 0.5646 0.3785 0.5468 -0.0161 2 0.9430 0.5728 0.3320 0.6693 -0.0161 3 0.5305 0.2719 0.1545 0.3480 0.0042 4 0.8588 0.5816 0.

php - FormData sends files but $_FILE is empty -

i have no idea why keep getting empty $_files global array when print out. ive been looking on can't see going wrong. because of have shown of code. if use button reaches server fine , works out. if use drag , drop no files on server? idea why? when print array array(0). i found 1 problem while loop fixed still no files tho. incase people wondering if post action correct. url rewritten using mod_rewrite. displays correct php pages assuming the pages reached. mod_rewrite affect uploading of files. don't think so...? <!doctype html> <html> <head> <title>music upload</title> <style> #zone { height:300px; width:500px; border:1px solid black; } </style> </head> <body> <div id="zone"> <legend>drop

php - Looping through an array for strings and putting the found strings into another array -

im trying loop through $files array and: find occurrences of "some-string". for every "some-string" occurrence found, need add array. (ie. $some_strings). finally able call $some_string array outside of loop manipulation(ie. count(), $some_string[1]) foreach($files $key=>$value) { if(strstr($value,'some-string')){ $some_strings = array(); $some_strings = $files[$key]; unset($files[$key]); } elseif (strstr($value,'php')) { unset($files[$key]); } } every things seems work fine until try count($some_strings). returns 1 value when know there atleast 10 values. doing wrong? try this $some_strings = array(); foreach($files $key=>$value) { if(strstr($value,'some-string')){ $some_strings[] = $files[$key]; unset($files[$key]); } elseif (strstr($value, 'php')) { unset($files[$key]); } } //now can use $some_strings here without problem

Is it possible to get partial response using PHP cURL? -

here code $url = "partial_response.php"; $sac_curl = curl_init(); curl_setopt($sac_curl, curlopt_httpget, true); curl_setopt($sac_curl, curlopt_url, $url); curl_setopt($sac_curl, curlopt_returntransfer, true); curl_setopt($sac_curl, curlopt_header, false); curl_setopt($sac_curl, curlopt_timeout, 11); $resp = curl_exec($sac_curl); curl_close($sac_curl); echo $resp; partial_response.php header( 'content-type: text/html; charset=utf-8' ); echo 'job waiting ...<br />'; for( $i = 0 ; $i &#60; 10 ; $i++ ) { echo $i . '<br/>'; flush(); ob_flush(); sleep(1); } echo 'end ...<br/>'; from code trying partial response partial_response.php. want is, need curl return me "job waiting.." alone instead of waiting partial_response.php complete loop , return entire data. when reduce curlopt_timeout below 11 dont response @ all. kindly clarify doubt. in advance. i later realized curl not want, used

ARToolkit libraries missing -

so i've attempted set artoolkit win7 64-bit computer. i'm using "microsoft visual studio express 2012 windows desktop". i followed these instructions: 1. unpack artoolkit zip convenient location. location referred below {artoolkit}. 2. unpack dsvideolib zip {artoolkit}. make sure directory named "dsvl". 3. copy files dsvl.dll , dsvld.dll {artoolkit}\dsvl\bin {artoolkit}\bin. 4. install glut dll windows system32 folder, , library , headers vs platform sdk folders. 5. run script {artoolkit}\configure.win32.bat create include/ar/config.h. 6. open artoolkit.sln file (vs.net) or artoolkit.dsw file (vs6). 7. build toolkit. the vrml renderering library , example (libarvrml & simplevrml) optional builds: 1. unpack openvrml zip {artoolkit}. 2. copy js32.dll {artoolkit}\openvrml\bin {artoolkit}\bin. 3.enable libarvrml , simplevrml projects in vs configuration manager , build. but @ step 7, when try build toolkit, error saying "unable start pro

ode - Matlab - Odeset - Odeplot -

i use odeplot stepwise result instead of plotting result afterwards. i've tried write can't work appreciate help. %parameters s = 1; q = 1; w = 0.1610; y0 = [30 1 30]; % initial values tspan = [0 10]; % time 0<t<10 plot=odeset('outputfcn','odeplot'); [t, y] = ode45(@(t,y) concentration(t, y, s, q, w), plot, tspan, y0); you need specify output function via ode options argument: options = odeset('outputfcn', @odeplot); [t, y] = ode45(@(t,y)concentration(t, y, s, q, w), tspan, y0, options); of course can make own custom output function. type edit odeplot see required (much simpler functions possible). check out odephas2 , odephas3 .

api - HTTP request with C & curl -

#include <stdio.h> #include <curl/curl.h> int main(void) { curl *curl; curlcode res; curl_global_init(curl_global_all); curl = curl_easy_init(); if(curl) { curl_easy_setopt(curl, curlopt_url, "http://api.adf.ly/api.php?"); curl_easy_setopt(curl, curlopt_postfields, "key=6xxxx&uid=41xxxxx&advert_type=int\ &domain=adf.ly&url=http://somewebsite.com/2"); res = curl_easy_perform(curl); if(res != curle_ok) fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res)); curl_easy_cleanup(curl); } curl_global_cleanup(); return 0; } i trying create short link above api adf.ly above code doesn't add new adf.ly links please note, key , user id correct, blanked them out also there way copy output html request?

regex - Visual Studio 2012- Find and Replace - backreferences -

i have xml file , want replace every time value seconds milliseconds. for instance, replace time="250" time="250000" . i tried using following find: time="([0-9]*)" replace: time="$1000" however, not seem work - replaces time="250" time="$1000" . way can around ? the problem replace isn't $1 , $1000 . visual studio doesn't know don't want include 3 0's in backreference. you can use {} around backreference tell visual studio use. replace: time="${1}000" obligatory note visual studio 2010 , older used different regular expression syntax, valid visual studio 2012 (and presumably newer versions).

Using Rails & Devise with Ember.js -

this question based on tutorial http://say26.com/using-rails-devise-with-ember-js . i don't know if i'm making silly mistake or if data-binding not working correctly. when login, don't user's name - defaults "guest" every time. please see gist includes files associated: https://gist.github.com/amaanr/5577152 i running rails 4, ruby 2, ember-rails gem, , devise gem. thanks help! have tried //= require_tree ./initializers you need make sure include initializer folder in rails asset pipeline.

plot - MatLab - Automated plotting of differently sized segments of a text file -

i have text file 2 columns containing space-delimited numeric data. data divided segments, each of them contains variable number of rows , beginning of next segment indicated single row of nan (so data below comprised of 4 segments): 5.1 [space] 0.0 9.2 [space] 1.4 3.7 [space] 0.6 ... [space] ... ... [space] ... ... [space] ... nan [space] nan 9.7 [space] 6.3 1.4 [space] 1.0 ... [space] ... ... [space] ... nan [space] nan 8.7 [space] 0.0 5.1 [space] 7.4 3.7 [space] 2.6 ... [space] ... nan [space] nan 1.7 [space] 8.4 ... [space] ... and forth... now i'd generate plot displaying curve each data segment in file (by plotting each segments 1st column against 2nd column). know how if the number of rows in each segment same , the number of segments known. how can done efficiently when there's variable segment size , unknown number of segments? i generated random data similar file. text file 1 described can loa

c# - Setting read-only property from a method -

i have simple problem, i'm stuck newbie. my setgrade method takes float parameter , return char , set value grade property. i'm not doing correctly. public class student { private char grade; public char grade { { return grade; } } public char setgrade(float score) { char mgrade; if(score >= 90.0) { return mgrade = 'a'; } return mgrade = 'f'; } } there numerous problems code might not think are. first off, public wrong; c# requires public . second, use of local mgrade strange , unnecessary, interestingly enough not wrong ; legal assignment , return in 1 step that. in case not need to; return 'a'; without local assignment. third, method misnamed because it not set grade property . if intend set grade should void returning: public void setgrade(float score) { if(score >= 90.0) { this.grade = 'a'; } this.grade = 'f'; } if

html - What is wrong here? Twitter timeline in bottom corner? -

i'm building website twitter timeline (widget) sat in bottom right hand corner. (just heads up, first website , not best @ coding). i want sit next little youtube widget. or isn't there way of doing this? source of problem (if website above not working wait couple of minutes , retry) remove <div style="clear: both"></div> after <div id="youtube">... also, in css: #twitter{ float: left; margin: 0; padding: 10px 10px 10px 50px; /*or whatever padding want give */ }

c++ - Undefined reference error at class instantiation -

this main.cpp . program starts here , have problem: i 2 errors: undefined reference `bankcontroller::bankcontroller(transactionrepository )* @ line 23 and undefined reference `transactionfilerepository::transactionfilerepository(std::string) @ line 19 for both of them, type c/c++ problem, resource main.cpp #include "bankgui.h" #include "controller/bankcontroller.h" #include "repository/transactionfilerepository.h" #include "repository/transactionmemoryrepository.h" #include "repository/transactionrepository.h" #include <qtgui> #include <qapplication> #include <string> #include <iostream> using namespace std; int main(int argc, char *argv[]){ string path = "datastorage/database.txt"; //instantiate main data repository transactionrepository* maindatabase; maindatabase = new transactionfilerepository(path); // <-- error here //instantiate main controller bankcontroller

sql server - "Write Conflict" error appears in single user database -

running ms access 2010 front end under citrix against sql server 2008r2 backend. i've got form that's been working quite time. code behind 1 button has started generating 'write conflict' error. happened few days ago, , after several hours pouring on unchanged code (confirmed online text comparison tool), , having programmer here on it, solution grab production version of front end , start reapplying changes. it's been running great 2 days, , error happened again. changing code, on different form. need go through processes on form in order test other form. here code generating write conflict: private sub btnstart_click() dim auditid string dim userstatus string dim submitpeerrev boolean dim prpercent single dim examineraudits integer dim reviewaudits integer dim rs dao.recordset dim username string dim sqlstring string on error goto error_handler userstatus = funuserlookup("status", raw:=true) 'get percentage/whole number

c# - regular expression to extract google places result -

i writing windows phone application utilizing google places autocomplete api. results being returned follows : northern caribbean university, mandeville, manchester parish, jamaica spanish town, saint catherine parish, jamaica new harbour village,old harbour, saint catherine parish, jamaica is there way me before parish part i.e before "manchester parish" or "saint catherine parish" using regular expression or something. algorithm split string array. split on , loop through array. return items until find entry containing parish, stop processing or split array here. ( item containing parish matches ^.*[pp]arish.*$ ) convert have string again if desired -- or -- if want capture portion before parish item , done use positive lookahead this: .*(?=,[^,]*[pp]arish) fiddle fiddle has more explicit capture group if need , examples shown

How do I check "Use Mobile Data" setting in iOS? -

i can't find answer anywhere... not in apple docs. in ios there mobile data (on/off) option under settings>general>mobile data. is possible app check whether option has been set on or off? or reflected in results of network , reachability calls? (reporting no network?) you can check if user connected wifi, mobile network or 3g network via reachability can not open settings via app.

.net - waking up a thread from sleep in response to an event c# -

lets suppose have 3 threads a, b , c a starts b whereas c independent thread no relation either or b. calls b work , sleeps waiting signal b or c wakeup , start doing work again. how can cross thread event handling achieved in c# ? use manualresetevent or autoresetevent (based on particular semantics desire; without more info it's hard more appropriate). create appropriate event object , share 3 threads. have thread a wait on event. either b or c can set event wake thread a .

WebMatrix 3 intellisense and publishing -

does webmatrix 3 support intellisense css libs add or customer css file create? me doesn't work. nice have intellisense when using twitter bootstrap instance. i cannot figure out why when publish selects files i've changed of time seems publish everything. why happen? thanks i had problems publish don't recommend using publish feature in webmatrix. recommend copy directly this; right click app directory in iis , select "remove" copy , paste entire project directory local machine iis inetpub/wwroot directory. within iis7 right click directory , select "convert application". works every time.

Error android.support.v4.app.Fragment$InstantiationException: Unable to instantiate fragment com.google.android.gms.maps.MapFragment -

i following tutorial using google maps api v2 .i facing error error logs 05-15 00:08:18.415: e/androidruntime(4547): fatal exception: main 05-15 00:08:18.415: e/androidruntime(4547): java.lang.runtimeexception: unable start activity componentinfo{org.rtesh.onemore/org.rtesh.onemore.mainactivity}: android.view.inflateexception: binary xml file line #7: error inflating class fragment 05-15 00:08:18.415: e/androidruntime(4547): @ android.app.activitythread.performlaunchactivity(activitythread.java:1830) 05-15 00:08:18.415: e/androidruntime(4547): @ android.app.activitythread.handlelaunchactivity(activitythread.java:1851) 05-15 00:08:18.415: e/androidruntime(4547): @ android.app.activitythread.access$1500(activitythread.java:132) 05-15 00:08:18.415: e/androidruntime(4547): @ android.app.activitythread$h.handlemessage(activitythread.java:1038) 05-15 00:08:18.415: e/androidruntime(4547): @ android.os.handler.dispatchmessage(handler.java:99) 05-15 00:08:18.415: e/a

How can I run my java program in a timed loop? -

i trying program run every 5 minutes. can tell me how achieve this? i'm new java, here's have far. program prints processes text file , calls text file display data. nice have run every 5 minutes. import java.io.*; import java.util.stringtokenizer; public class getprocesses { private string getprocesslistdata() { process p; runtime runtime; string process = null; try { system.out.println("allow me hack system , see have open..."); //this let access windows in order make program possible runtime = runtime.getruntime(); p = runtime.exec("tasklist"); inputstream inputstream = p.getinputstream(); inputstreamreader inputstreamreader = new inputstreamreader(inputstream); bufferedreader bufferedreader = new bufferedreader(inputstreamreader); string line = bufferedreader.readline(); process = "&"; while (line != null) { line = bufferedreader.readline(); process += line + "&"; } //as learned in class, h

python 2.7 - import httplib2 works in mac terminal but not IDLE shell -

i'm having great problems getting python site package httplib2 work in idle. i'm using mac osx 10.8.3 , python 2.7. used following installation steps install httplib2 macports: 1. $sudo port install py27-httplib2 i checked installed using: 2. $port contents py27-httplib2 which returned whole pile of files in following directory (i'm showing first three): /opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/httplib2-0.8-py2.7.egg-info /opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/httplib2/__init__.py /opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/httplib2/__init__.pyc then added following lines .bash_profile file thus: $echo "export pythonpath=\"/opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7/site-packages/httplib2:$pythonpath\"">>.bash_profile $source .bash_profile i checked paths had i

python - Get all "grand"-Children of a given Model -

im trying learn python/django @ moment , came across following problem. let's have 3 models: model category(models.model) name = models.charfield(max_length64) model subcategory(models.model) category = models.foreignkey(category) name = models.charfield(max_length64) model animal(models.model) subcategory = models.foreignkey(subcategory) name = models.charfield(max_length64) now, example, if searches category, want have animals in of subcategories of given main category. ( hope not complicated) so question efficient way this? thanks in advance! you can query like: animals = animal.objects.filter(subcategory__category__id=category_id) or, if have access category object, animals = animal.objects.filter(subcategory__category=category) please note model object definition class <classname> , not model <classname> example: model animal should class animal

email - jenkins svn mail to committer after post-commit and revert commit -

i trying setup jenkins , svn project. jenkins , svn running already. have post-commit hook starts build everytime new commit comes in. jenkins secured jenkins own user directory , enabled registrations. have activated matrix-based security . have following scenario: whenever developer commits, post-commit script called , build+tests starts. whenever build fails developer did commit shall receive email informations why commit failed. commit should reverted in repo. reverting thingy have installed revert plugin , activated project. seems not working, because nothing happened repo after did test-commit lead build fail. maybe miss jenkins+svn configuration? know revertig commits not best practice, have valid build in repo test/demo. post-commot file looks this: #!/bin/bash repos="$1" rev="$2" uuid=`svnlook uuid $repos` /usr/bin/wget \ --http-user="user" \ --http-passwd="psswd" \ --header "content-type:text/plain;charset

jstl - JSF 2.0 Iterate over a Map of Collection -

i new community. using jsf 2.0 having web-app version 2.5. running application in tomcat 6 server. i want show messages stored in string property messagedesc present in bean usermessagebean.java. data structure map(integer, list(usermessagebean)) . i unable iterate on map show messages. i trying use c:foreach display message string failed so. thanks support in advance.

Php - replace question mark sign -

is possible replace php tags custom? smarty library can assign values , render them instead of: <?php echo $name; ?> you can assign value in business logic , in template say {name} i'd make own function/class/library when write { in index.tpl, browser think < ?php echo .. can point me somewhere? replace {variable} regexps , eval-it here simple template engine, similar idea i mean, better use existing templates engines, latte , twig or smarty . not necessary reinventing wheel :)

android - Keep a part of edittext uneditable -

in app have couple of checkboxes, when checked combine first part of edittext. in same edittext allow user append text, while disallowing delete built text. this how looks [this part build checkbox combination, , can change in real time][this part user defined] now there way not allow user modify first part of edittext, still allow app change text? you can create textwatcher object , add edittext. in textwatcher, can store constant text information in instance variable. then, can fill in ontextchanged() , aftertextchanged() methods create type of behavior looking for. for example, can check cursor position (using edittext.getselected()) see if user tried change of text shouldn't changed-- if do, have code handle case. i know isn't best answer, don't yet have privilege make comment. hope helps!

qt - QMainWindow::showMaximized() Doesn't Update Size -

i'm trying create qmainwindow encapsulate qgraphicsview i'm putting in it. want start out maximized, this: qmainwindow *mainwindow = new qmainwindow(); mainwindow->setwindowstate(qt::windowmaximized); mainwindow->show(); qdebug() << mainwindow->size(); which says maximized window 200x100, incorrect. am missing sort of update function? don't why wouldn't update size. i've tried using showmaximized() same result. edit my end-goal use qmainwindow container qgraphicsview containing qgraphicsscene. on top of this, want have qwebview @ 50% width , 100% height, centered on everything. so, need width , height in order coordinates , sizes correct. well, effect of setwindowstate() not immediate, gets executed asynchronously. when window state changes, widget receives changeevent(), should reimplement or resizeevent() width() , height() after maximization takes place.

Can I filter Jira Issues that were created via a mail handler? -

i'm hoping create report return of issues created via mail handler have set up. i thought trying use "reporter=" in jql, works in cases when user isn't in our system (we've set createuser=false). i'm running 5.2.5, not-ondemand. you work around having mail handler add unique tag each issue creates, , filter on tag.

javascript - Prepend absolute URL path in Backbone.sync for an API on another server -

my backbone app communicates api exists on server. backbone.sync generate relative urls default. simplest way prepend absolute server path following: myapp.base_url = "https://api.someothersite.com" class myapp.model extends backbone.model urlroot: "#{myapp.base_url}/my_app_url" however, i'd rather not isn't dry. thought try following overriding backbone.sync : do (backbone) -> base_url = 'https://api.someothersite.com' basesync = backbone.sync backbone.sync = (method, model, options) -> url = _.result(model, 'url') options.url = "#{base_url}/#{url}" if url && !options.url basesync method, model, options however, problematic other parts of code options object gets passed around on place. *(explanation interested @ bottom) is there recommended clean , dry way prepend server path front of urls generated backbone.sync ? *if model being synced instance of backbone.collection

wpf - TwoWay binding a table to a datagrid which has a ComboBox column and bind to another table? -

Image
twoway binding table datagrid has combobox column , bind table? i have datagrid twoway bind table accounts. whenever update button clicked, i'll update data adapter, updates table. works fine. now, in table accounts, there column called locationcode. value of locationcode comes table locations. so, when user makes changes locationcode in datagrid, user should able choose locationcode list of values in table locations. means in datagrid, locationcode column should combobox column datacontent table locations. is there way in datagrid, shows value of table accounts, when user click locations cell, show combobox, user can choose combobox. once value updated, if update data adapter, update table accounts automatically (twoway binding)? here i'm doing now: <datagrid autogeneratecolumns="false" name="dgactloc" grid.row="0" isreadonly="false" fontweight="bold" padding="5" margin="5" itemssource="

unix - Bash script to compare/search two directories using file list as variable -

i trying write bash script allow me grab names of files on dir1 example, , use each file name search string in find command, , run find command on dir2. then, output search results text file. so, example, when runs will: get files in dir1: file1.txt file2.txt file3.txt file4.txt find files in dir2 "file1" in name file1 exists in dir2 "file1-extrafile.txt" write result text file repeat using "file2" search string. how can this? diff me? for loop? try this: for f in /dir1/*; n=$(basename "$f") ls -1 /dir2/*${n%.*}*.${n##*.} done > result.txt

sql insert value from another table with original nulls but not unmatched entries -

ok. hard 1 explain, replacing type of foreign key in database. need update values in table references it. fine , good, , nice , easy do. i'm inserting stuff temporary table replace original table, insert query isn't @ difficult, it's select values from. however, want keep entries original reference null. not hard, use left inner join that. we're not done yet: don't want entries there no match in second table. i've been dinking around 2 hours now, , no closer figuring out moon. let me give example data set: ____________________________ | inventory || customer | |============||============| | id cust || id name | |------------||------------| | 1 || 1 | | 2 b || 2 b | | 3 e || 3 c | | 4 null || 4 d | |____________||____________| let's database used use customer.name field primary key, , need change standard int identity(1,1) not null id. i've added field no issues in customer t

How can I use node-gyp to run C++ code with node.js -

node-gyp cross-platform command-line tool written in node.js compiling native addon modules node.js. trying node program run c++ i've written. node-gyp seems make process easier in example , able run doing node-gyp configure followed node-gyp build , running node test.js i'm still having trouble understanding how set binding.cc , binding.gyp files. know whats going on or know of guides/documentation? addons documentation page , node-addon-examples linked page should start. watch this slides on basics of binary modules (it uses older node-waf build tool though)

Using PowerShell 3 to connect to MySQL DB -

i've been scouring internet guides on how this, , seem tell me i'm doing already. i'm trying connect mysql database , retrieve name database based on parameter pass. problem i've been unable connect database based on guides i've seen far. here's 1 of ways i've tried: $connectionstring = "server=mysql.collegename.edu;uid=sconsdoc;pwd=password;database=namedatabase;" try { $connection = new-object mysql.data.mysqlclient.mysqlconnection $connection.connectionstring = $connectionstring $connection.open() } catch { write-host "error : unable run query : $query 'n$error[0]" } { $connection.close() } i following error: error : unable run query : 'nexception calling "open" "0" argument(s): "unable connect of specified mysql hosts." exception calling "open" "0" argument(s): "unable connect of specified mysql hosts." exception calling "open&

html - CSS Dropdown menu display block -

i've been trying create dropdown menu. want when hover on anchor tag displays it. know can't use display:block when not part of block, don't know how. please, me! thanks! display: block not work. here html , css: <!doctype html> <!--[if ie 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt ie 8]><!--> <html class="no-js" lang="en" > <!--<![endif]--> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>motrium - home</title> <script src="js/vendor/custom.modernizr.js"></script> <link rel="stylesheet" href="css/james222.css" type="text/css"> </head> <body style="background-color: #c1c1c1;"> <div class="wrapper"> <div class="fo