Posts

Showing posts from July, 2010

ant - Cannot find package org.junit when compiling java file in command prompt -

whenever run java file in command prompt, keep getting errors saying: error: package org.junit not exist import static org.junit.assert.*; this gives errors on symbols "@test". here's java file code: package org.example.antbook.junit; //import required junit4 classes: import static org.junit.assert.*; import org.junit.test; public class simpletest { @test public void testsomething() { asserttrue("multiplication???", 4 == (2 * 2)); } } i believe importing junit-4.10.jar have imported, may missing something. there solution this? you need put "junit.jar" on classpath when compile , when run class. please refer manual entries java , javac commands, , page on setting classpath . if building command line using ant, need make sure "build.xml" sets compilation classpath correctly. you need add import statements import junit 4 annotations use. need address "package org.junit not ex

php - max winning and losing streaks (code optimization) -

i made code calculating max winning & losing streaks on array of values. can head around doing in 1 foreach loop. i'm using 2 loops follow : public function calculatestreaks() { $max_win_streak = 0; $_win_streak = 0; $max_loss_streak = 0; $_loss_streak = 0; foreach($this->all_trades_pnl $value){ if($value >= 0) { $_win_streak++; if($_win_streak > $max_win_streak){ $max_win_streak = $_win_streak; } } else { $_win_streak = 0; } } foreach($this->all_trades_pnl $value){ if($value < 0) { $_loss_streak++; if($_loss_streak > $max_loss_streak) { $max_loss_streak = $_loss_streak; } } else { $_loss_streak = 0; } } return array('win_streak' => $max_win_streak, 'loss_streak' => $max_loss_streak); } it works seems far optimized, ideas code better ? lot in advance, reg

python - Clear a list in a function each time it's run -

i'm kind of new programming. i'm trying write algorithm in python gives prime factors of number: factors=[] def factor(n): in range(2,n+1): if n%i==0: factors.append(i) factor(int(n/i)) break return factors it works, whenever run 'factor' function again, appends populated 'factors' list - how can list clear each time function 'factor' run? declare local variable inside function. in code you're modifying global variable factors every time call factor() . def factor(n, factors=none): factors = [] if factors none else factors in range(2, n + 1): if n%i==0 , not in factors: #checks duplicates factors.append(i) factor(int(n / i),factors) #pass factors list in recurive call break return factors factor(20) #returns [2, 5]

php - HTML5 - Ajax - unexpected behavior i don't understand -

edit better explain issue is: i have div page 1 content. page 1 has button changes content of div page 2. page 2 has button changes content of div page 1. issue: if page 1 loaded first, button nothing. if page 2 loaded first, button changes content page 1. , button on page 1 works (does not if page 1 loaded before page 2! issue!). ive been trying develop trainingtool math. failing right @ beginning seems, since don't see reason following behavior. question: why work if load pages in wrong order first? page here: mathtrainer page code @ bottom of posting. what trying: i have selectionpage loaded div, div populated php-include. when hitting button want content of div change actuall training-tool. "question" - "option1" - "option2"... ect. along button go selection via same method. this change handled via "onclick" submit-button , calling function in js. namely: $("#trainercontent").load('trainerab

javascript - Send Request to PHP file only when input reaches X characters -

i using java script code data sql. want send request php file when input field has 15 characters. used onkeyup="if(this.value.length>14)" didn't work. can 1 please modify java script code.. please change html this: <input type="text" name="name" maxlength="15" id="name" onkeyup="check_length(this)" /> and add function javascript: function check_length(thisobject){ if(thisobject.value.length>14){ajaxfunction(thisobject.value)} } edit: this happens when define functions in head part , call them, when document not yet initialized. move script part, initialization happens , try out. i place sample code (save in blank html file , test it): <input type="text" name="name" maxlength="15" id="name" onkeyup="check_length(this)" /> <script> function check_length(thisobject){ if(thisobject.value.length>14){aja

php - Getting last 5 post titles from WordPress and it's thumbnail -

i'm creating news slider , looks this < ___________ #slidecontent _______________> <#slidemenu> ┌────────────────────────────────────────────┬────────────┐ │ │<1st title> │ │ ├────────────┤ │ (thumbnail of hovered title (1st)) │ 2nd title │ │ ├────────────┤ │ (\___/) │ 3rd title │ │ (=’.'=) ├────────────┤ │ (")_(") │ 4th title │ │ ├────────────┤ │ │ 5th title │ └────────────────────────────────────────────┴────────────┘ < > means hovered bunny article's thumbnail of hovered title. :) and here code of it. <div id="slideshow"> <div id="slidecontent"> <?php ???get th

ruby on rails - Active admin custom filter with active record relations -

here problem: i have 3 models: taxons class taxon < activerecord::base has_and_belongs_to_many :categories, :uniq => true categories class category < activerecord::base has_and_belongs_to_many :taxons, :uniq => true has_many :products and products class product < activerecord::base belongs_to :category in active admin, have add custom filter searching products taxons. if have idea, how todo it, gratefull help. p.s. have nested set in taxons, if that's important

javascript - img src doesn't work when I use local files -

i've had problems getting rain effekt on canvas. after searching on google found this <script type="text/javascript"> var ctx; var imgbg; var imgdrops; var x = 0; var y = 0; var noofdrops = 50; var fallingdrops = []; function setup() { var canvas = document.getelementbyid('canvasregn'); if (canvas.getcontext) { ctx = canvas.getcontext('2d'); imgbg = new image(); imgbg.src = "http://lorempixel.com/600/600/sports/"; setinterval(draw, 36); (var = 0; < noofdrops; i++) { var fallingdr = new object(); fallingdr["image"] = new image(); fallingdr.image.src = "http://lorempixel.com/10/10/sports/"; fallingdr["x"] = math.random() * 600; fallingdr["y"] = math.random() * 5; fallingdr["speed"] = 3 + math.random() * 5; fallingdrops.push(fallingdr); } } } function draw()

php - search using 3 options with hidden input type do not work -

i have search page allow user search other members using 3 types governorate district village and using 1 form , 1 button 3 types 3 different hidden values but problem system not make action when select governorate so can me ???? code: <?php //**********search locationn***************************************// if(isset($_post['listbyq'])) { //********************by governorate**************************************// if($_post['listbyq']=="by_gov") { $bygov = $_post['governorate']; $sql = mysql_query("select user_id,first_name, last_name, birth_date, registered_date, governorate_name members u inner join governorate g on u.governorate = g.governorate_id governorate = '$bygov'")or die(mysql_error("error: querying governorate")); $num_row = mysql_num_rows($sql); if($num_row > 0 ) { while($row

jquery - Some strings are being displayed outside the <a> tag? -

so making jquery plugin gets headlines working fine, when try , output results on html page of headlines being displayed outside tag supposed inside? html: <div class="news"></div> jquery: $(el).append('<li class=' + options.listclassname + '>' + '<a href=' + link[1] + '>' + e.title + '</a></li>') and when load webpage here how displayed when 'inspect element' <div class="news"> <li class="item"> <a href="http://example.com/link/to/article.html"></a>article headline </li> <li class="item"> <a href="http://example.com/link/to/article.html">article headline</a> </li> <li class="item"> <a href="http://example.com/link/to/article.html">article headline</a> </li> <li class="ite

playframework 2.1 - Place Play Framework 2.1 database evolutions in sub project? -

i have play framework 2.1 application, , database code located in sub project — in case want support more 1 kind of backend in future, e.g. file based database or cassandra. currently, however, database relational database , i'd use play's database evolutions mechanism. don't know how, or if possible, place evolutions script in sub project (where belong), rather in main project. — if place them in sup project, play apparently ignores them. question: can place evolutions script in sub project, , how do it? edit october 2015: use flywaydb instead of play's built-in evolutions, since year or so. heartily recommend flywaydb. can evolutions in sub projects flywaydb in way want, , need write code starts evolutions yourself. /edit this i've tried far: create sub project, ./modules/evolutions-test/ in sub project, create evolutions script: ./modules/evolutions-test/conf/evolutions/default/1.sql don't configure database connection info in sub

What is the mistake in converting a byte array to bitmap in android? (the byte array is sent from a c/c++ server, android beeing the client) -

i'm developing android app sends it's accelerometer , gravity sensor data c/c++ server uses opengl library make 3d shape rotate on screen. want send android device "snapshots" opengl screen. on c/c++ (server side ) : //declarations struct params { unsigned char pic[4*256*256]; // 4 because of gl_rgba format char* msg; }; params p; // reading content of screen glreadpixels(0, 0, 256, 256, gl_rgba, gl_unsigned_byte, p.pic); //sending data send(sconnect,(char*)p.pic,4*256*256,0); on android (client side) i'm trying read byte array , converting bitmap. //declarations socket = new socket("192.168.1.101", 1234); dataoutputstream = new dataoutputstream(socket.getoutputstream()); private byte image[]= new byte[4 * 256 * 256 ]; private int intimage[] = new int[4 * 256 * 256]; //read data sent server datainputstream.readfully(image, 0, 256 * 256 * 4); // //transform byte array int array // i'm doing byte & 0xff convert

PHP - Image resizing class in wordpress -

i have created function resizing wordpress image based on http://www.hashbangcode.com/blog/create-images-thumbnails-and-cache-them-php-287.html but getting error: fatal error: cannot redeclare class image_resize but have not called class befor. here function function resize_image($thumb_id){ //check thumbnail cache if not create $attachment = wp_get_attachment_image_src($thumb_id, 'large'); $image_url = pathinfo($attachment[0]); if (file_exists(get_template_directory().'/images/thumbs/' . $image_url['basename'])) { // 2592000 = 30 days if ( time() - filemtime(get_template_directory().'/images/thumbs/'.$image_url['basename']) > 2592000 ) { unlink(get_template_directory().'/images/thumbs/'.$image_url['basename']); } } if (!file_exists(get_template_directory().'/images/thumbs/' . $image_url['basename'])) { include(get_template_directory().

echo - In vim, how do I redirect the output of a vimscript function? -

i have vimscript function function! env() redir => s sil! exe "norm!:ec$\<c-a>'\<c-b>\<right>\<right>\<del>'\<cr>" redir end return split(s) endfunction this function obtained question: how list environment variables in vim? when :call env() don't see output, :echo env() displays output names of environment variables. i'd rather copy , paste output somehow. know :redir . doesn't work: :redir @a :echo env() :redir end "ap instead, blank line pasted. i have tried many combinations of :redir command (to registers and/or files) , variations on call env() without success. because output generated calling function? thought might because function returns list, :echo string(env()) isn't captured :redir either. edit: modified solution used answer below. function! env() redir => s sil! exe "norm!:ec$\<c-a>'\<c-b>\<right>\<r

jquery - How to handle user generated form with multiple levels of tabs and modules in PHP? -

Image
so have interface users build own display. allows them add jquery tabs 1st , 2nd level. , on 2nd level, can add in modules text box , image box. here screenshot of interface so screenshot can see 1st level of tabs can have number of tabs , 2nd level. , 2nd level have modules. i can't wrap ahead around how can handle form in php. how can save , spit out when needed? how guys handle this? thanks... nice interface. should do: the database structure: store tabs hierarchical in: {tabid}|{parentid}|{tabname} store text , images in: {id}|{tabid}|{content}|{type} the html structure: build 1 form , put tab structure in it. maybe take at: http://twitter.github.io/bootstrap/javascript.html#tabs example: <form method="post" action="savetabbedinterface"> <ul class="nav nav-tabs" id="mytab"> <li class="active"><a href="#home">home</a></li>

ruby on rails - String is .blank? but neither empty nor whitespace -

i'm trying use squish method reduce multiple white spaces in string single white spaces. however, have string mutliple spaces not reduced. when check string[space_position].blank? returns true, neither empty, nor == ' ' . what cause behavior? not sure if relevant, string comes mongodb , saved there locomotive cms. the 3 spaces: [32,160,32] ascii 160 non breaking space found in html, , apparently not recognized squish space. try replace before: string.gsub(160.chr, ' ').squish

vb.net - Saving to text, receiving error message -

i'm trying save contents of listview box following code dim w io.streamwriter private sub button6_click_1(byval sender system.object, byval e system.eventargs) handles button6.click dim integer w = new io.streamwriter("c:\" & "sname" & ".txt") = 0 listview1.items.count - 1 w.writeline(listview1.items(i)) next w.close() end sub when try , run app showing code saying : access path 'c:\sname.txt' denied. any appreciated. under windows vista, 7, 8 root path c: protected uac , accessible in write admin users; must run program admin or use path (e.g. asking or %temp%).

Not able to search Spanish word with accent in solr -

i have install solr 3.5 search words(spanish words) enseñé étnico castaño después with ascent ñ,é etc. but solr not search such words index. have used <!-- spanish --> <fieldtype name="text_es" class="solr.textfield" positionincrementgap="100"> <analyzer> <tokenizer class="solr.standardtokenizerfactory"/> <filter class="solr.lowercasefilterfactory"/> <filter class="solr.stopfilterfactory" ignorecase="true" words="lang/stopwords_es.txt" format="snowball" enablepositionincrements="true"/> <filter class="solr.spanishlightstemfilterfactory"/> <!-- more aggressive: <filter class="solr.snowballporterfilterfactory" language="spanish"/> --> </analyzer> </fieldtype> like : <field name="name" type="text_es"

javascript - JS reg ex for month date -

i'm using simple indx uses js regex. %date% variable same regex (((j(anuary|uly|une))|february|(m(arch|ay))|(a(pril|ugust))|((sept|nov|dec)ember)|october)| (jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))[.,]{0,1}[\s]{0,1}[0-9]{1,2}[.,]{0,1}[\s]{0,1}(19|20|)\d\d| (0[1-9]|[12][0-9]|3[01]|[1-9])(th|rd|st|nd){0,1}[\s]{0,1}(day\s){0,1}(of\s){0,1}(((j(anuary|uly|une))|february| (m(arch|ay))|(a(pril|ugust))|((sept|nov|dec)ember)|october)|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))[.,]{0,2} [\s]{0,1}(19|20|)\d\d| (0[1-9]|1[012]|[1-9])[- /.](0[1-9]|[12][0-9]|3[01]|[1-9])[- /.](19|20|)\d\d|(0[1-9]| [12][0-9]|3[01]|[1-9])[- /.](0[1-9]|1[012]|[1-9])[- /.](19|20|)\d\d|(19|20|)\d\d[- /.](0[1-9]|1[012]|[1-9])[- /.](0[1-9]|[12][0-9]|3[01]|[1-9]) but doesn't work. need have capture dates in numbers or numbers , month name have far, can't seem figure out how capture 5 may 2012 for nummeric dates (0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|

r - Find rows in dataframe with maximum values grouped by values in another column -

i solve problem in r without using sql. how can select rows max(column value), distinct column in sql? sure, use sqldf it, there must cool apply method in r it, too? setup data first read in data: lines <- "id home datetime player resource 1 10 04/03/2009 john 399 2 11 04/03/2009 juliet 244 5 12 04/03/2009 borat 555 3 10 03/03/2009 john 300 4 11 03/03/2009 juliet 200 6 12 03/03/2009 borat 500 7 13 24/12/2008 borat 600 8 13 01/01/2009 borat 700 " df <- read.table(text = lines, header = true) df$datetime <- as.date(df$datetime, format = "%d/%m/%y") 1) base - by there many ways process using various packages here show base solution first: > do.call("rbind", by(df, df$home, function(x) x[which.max(x$datetime), ])) id home datetime player resource 10 1 10 2009-03-04 john 399 11 2 11 2009-03-04 juliet 244 12 5 12 2009-03-04 borat 555

sql server - Use conditional computed column in SQL query -

Image
i have 2 tables viz. #exported_data , user_details. #exported_data: (user_id, user_name, status, office_id, dept_id, service_id, allocation) user_details: (user_id, office_id, dept_id, service_id, serviceallocation) in #exported_data table, status can inactive or active. in user_details table, allocation can between 0 , 1. user_details table transaction table , #exported_data table temporary table hold records need inserted transaction table based on criteria. i have query: insert user_details (user_id, office_id, dept_id, service_id, serviceallocation) select user_id, office_id, dept_id, service_id, allocation #exported_data ed not exists (select office_id, dept_id, service_id user_details ud ud.user_id = ed.user_id) in above query, in place of allocation, have insert allocation value based on conditions. conditions are: if status of user in #exported_data inactive make allocation 0, else (1) allocation of user #exported_data (2) sum(a

Qt signal slot connection - QNetworkAccessManager -

im new in qt , im trying understand following signal-slot connection: m_networkmanager = new qnetworkaccessmanager(this); qnetworkreply *reply = m_networkmanager->get(request); connect(reply, signal(finished()),this, slot(onrequestcompleted())); why connect "finished" signal after get-request?...what happened, if network connection in line-2 faster executed before slot connection (line-3) made? i know, code work. want understand how possible :) it's not possible finished() signal emit because haven't yielded event loop yet. if somehow request got sent , came back, code still executing , continue execute until you've yielded event loop. reply object ever chance anything, such parsing response , emitting corresponding signal.

objective c - Can I modify a variable via it's name as a string? -

this question has answer here: access objective-c object string name or variable 3 answers is there way me modify variable string containing it's name? something this: int example = 1; nsstring *foo = @"example"; foo.value++ at point, example equal 2. you can't local variables that. can instance variables using kvc .

android - AnimationEnd is triggered on all View at once -

i have application 3 image buttons (based on custom image button) image button has animation end listened, once first image button completes animation, instances of custom images buttons trigger animationend method. here's code: import java.util.concurrent.callable; import android.content.context; import android.util.attributeset; import android.widget.imagebutton; class myimagebutton extends imagebutton{ protected callable<void> animend = null; public void setonanimationendlistener(callable<void> animend1) { this.animend = animend1; } public myimagebutton(context context) { super(context); // todo auto-generated constructor stub } public myimagebutton(context context, attributeset attrs) { super(context, attrs); // todo auto-generated constructor stub } public myimagebutton(context context, attributeset attrs, int defstyle) { super(context, attrs, defstyle); // todo a

Chrome extension: create window and disallow moving it -

i know how use chrome api create small window located in center of screen. is there way prevent moving window? i suspect not, it's outside scope of chrome , controlled os itself.

c# - Why inserting into the table not working? -

i wonder why piece of code not working? sqlcommand comand = new sqlcommand(); //string myconnectionstring = "data source=.\sqlexpress;initial catalog=try;integrated security=true;pooling=false"; sqlconnection conn = new sqlconnection(@"server=.\sqlexpress;attachdbfilename=|datadirectory|\mydatabase.mdf;integrated security=true;user instance=true"); comand.connection = conn; conn.open(); comand.commandtext = "insert tableproduct (productid,productname) values ('1','m')"; comand.executenonquery(); conn.close(); the whole user instance , attachdbfilename= approach flawed - @ best! when running app in visual studio, copying around .mdf file (from app_data directory output directory - typically .\bin\debug - app runs) , most likely , insert works fine - you're looking @ wrong .mdf file in end! if want stick approach, try putting breakpoint on myconnection.close() call - , inspect .mdf file sql server mgmt studio ex

java - JavaFX: get BufferedImage from path -

coming awt/swing, i've started experimenting bit javafx last few days. realized used in thousands lines of codes can done in few hundred. one problem came across is, however, following: i'm trying develop small painting app user can choose brush size , color strokes. strokes user makes, use javafx class path , add these paths group (which added pane ) - automagically - painted. want store resulting image jpg , try raster paths in bufferedimage. however, found no functions in api me that. i tried use canvas , graphicscontext , did not help. how raster javafx path s list on image? take snapshot of group javafx image. use swingfxutils convert javafx image snapshot buffered image. use imageio convert buffered image jpeg, png, etc

python - Which C++ libraries should I use for a large parallel computing number-crunching project exploiting third-party applications -

introduction i want request lot of advice on new programming project going start on own. going precise in accomplish , in basic requirements are. therefore going long question. please bear me. i going split question 5 sections: real-world problem simulation problem requirements , preferences additional information list of advice requests 1. real-world problem skyscrapers , large bridges suffer dynamic wind loading. means, when designed incorrectly can collapse due wind-induced vibrations (this happened in 1940: http://www.youtube.com/watch?v=3mclp9qmcgs ). design such structures correctly, efficient number-crunching software required analysis , simulation. 2. simulation problem there exists multitude of software capable of either simulating fluid flows or structural mechanics. many have been developed on 30 years , proven , mature technologies. writing multi-physical program capable of simulating both fluid flows , structural mechanics simultaneously scratch, th

winapi - How to handle the message-only window to get the messages from the console window? -

i'm trying know when console window has moved created new message-only window messages of console don't know if working because message apparently never being received. #define winver 0x0501 #include <windows.h> #include <iostream> wndproc glpfnconsolewindow; // new using namespace std; lresult apientry mainwndproc(hwnd hwnd, uint umsg, wparam wparam, lparam lparam) { switch (umsg) { case wm_size: cout<<"window moved"<<endl; break; case wm_destroy: postquitmessage(0); break; default: // new return callwindowproc(glpfnconsolewindow, hwnd, umsg, wparam, lparam); //return defwindowproc(hwnd, umsg, wparam, lparam); } } int winapi winmain(hinstance hinstance, hinstance hprevinstance, lpstr lpcmdline, int ncmdshow) { hwnd hwnd; msg msg; const char lpcszclassname[] = "messageclass"; wndclassex windowclassex; // == ne

java - Getting error: "non static method cannot be referenced from a static context" while calling function from main -

this question has answer here: “non-static method cannot referenced static context” error [duplicate] 4 answers i have function private arraylist<letters> getlettersinfo(string input) { arraylist<letters> al = new arraylist<letters>(); (char c : alphabet.tochararray()) { letters l = new letters(); l.setletter(character.tostring(c)); int count = countoccurrences(input, c); l.setcount(count); l.setfrequency(count/28); al.add(l); } return al; } then try in main: arraylist<letters> al = new arraylist<letters>(); al = getlettersinfo(plaintext); for(letters l : al) { system.out.print("letter: " + l.getletter() + ", " + "count: " + l.getcount() + ", "

delphi - Error "Record, object or class type required" when using a wrapper type of an array -

i have got 2 arapper types easy handling /returning of one-dimensional arrays, , want write method convert 1 (a 2d-float-vector class 2d-int-point class). wrote simple one, throws errors don´t understand. unit uutil; interface uses uvector2f, types, sysutils; type vector2farraywrapper = array of vector2f; pointarraywrapper = array of tpoint; implementation function topointarray(vw : vector2farraywrapper) : pointarraywrapper; var pw : pointarraywrapper; i,x,y : integer; begin setlength(pw, vw.length); := 0 vw.high begin x := round(vw[i].getx()); y := round(vw[i].gety()); vw[i] := tpoint(x,y); end; result := pw; end; end. these errors get: [error] uutil.pas(20): record, object or class type required [error] uutil.pas(21): record, object or class type required [error] uutil.pas(25): ')' expected ',' found [error] uutil.pas(27): declaration expe

Opencart: Change page ID path -

i'm trying make site more seo friendly , i'm noticing whenever go product through either tag or different page (2,3,4 etc) adds url. for example: www.domain.com/guardian-survival-kit/culinary-can-of-preparedness-seeds.html?page=2 i remove ?page=2 path opencart 1.5.4 any appreciated. you manually edit code each pre-product controller file (such search pages etc) or use this modification make of product url's consistent throughout installation. example, think page you're getting off in product search page, open /catalog/controller/product/search.php find code 'href' => $this->url->link('product/product', $url . '&product_id=' . $result['product_id']) and change to 'href' => $this->url->link('product/product', 'product_id=' . $result['product_id']) then save. sure make backup file before attempting change. remove additional parameters url

java - How to draw continuous charts with gwt-visualization -

i'm using gwt-visualization display google charts . works fine except can't set continuous x-axis column chart. understanding, need define first column of chart not string - end discrete x-axis. here's do: datatable datatable = datatable.create(); datatable.addrows(rawdata.getnumberofrows()); datatable.addcolumn(date, "time interval"); (category category : rawdata.getcategories()) { datatable.addcolumn(number, category.getname()); } int row = 0; (date month : rawdata.getmonths()) { datatable.setvalue(row++, 0, month); } // set other data categories is there wrong i'm doing? or java library not support this? this issue has been solved on google groups asgallant (a true hero of google visualization support): asgallant's comment: that sounds wrong chart package getting loaded. can post javascript produced code (open in browser, view source, , copy here)? skirsch's response: ah well, great hint. load &quo

html - Class inside class for jquery -

i want fade-in text using jquery. i've set up, doesn't seem work. perhaps can me problem? have: .nav ul li { opacity: 0; padding: 0px 50px; transition: opacity 2s ease-in; /* , more transitions other browsers */ } .nav ul li.fade { opacity: 1; /* problem here: class inside of class */ } jquery: $('ul.nav li').addclass('fade'); i hope can me out. not know fix problem. i've looked solutions, not think fix problem. in advance. edit: got example website , going try out. edit 2: fiddle : <title>title</title> <body> <div id='container'> <div id='navleft' class='nav'> <ul> <li>link1</li> <li>link2</li> </ul> </div> <div id='logo'> <img src='images/logo.png' alt='logo' /> </div> <div id='navright' class='nav'>

powershell - Passing parameters to method in MvcScaffolders -

i passing values first 2 parameters of t4scaffolding.scaffolder. not work excepted. this powershell script file. lets give name test.ps1 [t4scaffolding.scaffolder(description = "enter description of service here")][cmdletbinding()] param( [string]$classname, [string]$project, [string]$codelanguage, [string[]]$templatefolders, [switch]$force = $false ) write-host "class name " $classname write-host "project name is" $project then run on package manager console following pm> scaffold test member consoleapplication1.domain it prints me classname correctly project name 1 selected on nuget package manager console not 1 give. class name member project name consoleapplication1.scaffolder but excepted result is class name member project name consoleapplication1.domain now problem how pass classname , project parameter ? takes classname parameter ignoring second one. edited also tried 1 did not work either

javascript - mozrepl: go to the context of the browser window when entering in a new opened window -

my problem can not ascend browser window context after creating , entering new window using mozrepl, how it? ubugnu@spin-foam:~$ telnet localhost 4242 | tee -a .repl_log trying 127.0.0.1... connected localhost. escape character '^]'. welcome mozrepl. - if stuck @ "...>" prompt, enter semicolon (;) @ beginning of line force evaluation. - if errors after every character type, see http://github.com/bard/mozrepl/wikis/troubleshooting (short version: stop using microsoft telnet, use netcat or putty instead) current working context: chrome://browser/content/browser.xul current input mode: syntax repl> repl.print(document.getelementbyid('toolbar-menubar')) [object xulelement] repl> win = open() [object window] - {window: {...}, document: {...}, external: {...}, getinterface: function() {...}, console: {...}, sidebar: {...}, performance: {...}, ...} repl> repl.enter(win) [object window] - {window: {...}, document: {...}, installtrigger: {...},

django - Python 2 and 3 metaclass compatibility when kwargs are used -

i making metaclass customize __new__ method customize how new class created according provided values in kwargs . makes more sense in example: class foometa(type): def __new__(cls, name, bases, kwargs): # kwargs... # example: if 'foo' in kwargs: kwargs.update({ 'fooattr': 'foovalue' }) return super(foometa, cls).__new__(cls, name, bases, kwargs) my problem how can make compatible both python 2 , 3. six great compatibility library not solve problem. use as: class fooclass(six.with_metaclass(foometa, foobase)): pass this not work because 6 creates new base class using given metaclass. below six's code ( link ) (as of 1.3): def with_metaclass(meta, base=object): return meta("newbase", (base,), {}) as result, __new__ method called without kwargs hence "breaking" function. question how can accomplish behavior want without breaking compatibil

collision - Is there a way in pygame to detect if a rect is fully inside a mask? -

is there way in pygame detect if rect inside mask? i know there rect in rect collision , collidepoint (point in rect collision) there way detect if rect inside mask? thanks i don't believe there function supplied pygame that. challenging, because of "shapeless" possibilities of mask. 1 possibility might work first list of bounding rects of mask (a list of rects "contain" of points of mask) , check if rect inside of these rects: bounding_rects = mask.get_bounding_rects() b_rect in bounding_rects: if b_rect.contains(test_rect): print "rect inside mask" of course solution, if rect inside mask, not inside 1 particular bounding rect, test fail. here's idea of how might handle that, tradeoff of little bit of lost precision: bounding_rects = mask.get_bounding_rects() mask_rect = bounding_rects[0].unionall(bounding_rects) if mask_rect.contains(test_rect): print "rect inside mask" this solution unions of

html - DOMPDF not working -

i trying take html textarea , convert pdf. donwnloaded dompdf https://github.com/dompdf/dompdf , wrote code below. when click submit error: "internal server error". (my webhost doesn't tell me line it's one) (the name of file test2.php) <?php if (isset($_post['submit'])) { $content = $_post['content']; if (empty($content)){ $error = 'write something'; } else { include_once( 'dompdf/dompdf_config.inc.php' ); $dompdf = new dompdf(); $dompdf->load_html($content); $dompdf->render(); $dompdf->stream('example.pdf'); } } ?> <!doctype html> <head> </head> <body> <?php if(isset($error)){ echo $error; } ?> <form method="post" action="test2.php"> <textarea name="content" id="content">hello world</textarea><br> <input type="submit" name="submit" value='submit'> &

jquery - flickr gallery loading pictures from specified tag -

hey have flickr gallery , load pictures div 'gallery' 2 first pictures specified tag defined in 'data-category' should load div. i have html: <div data-category="clouds" class="gallery"></div> <div data-category="mount" class="gallery"></div> js: $('.gallery').each(function(index) { var datacategory = $(this).attr('data-category'); (function() { var flickerapi = "http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?"; $.getjson(flickerapi, { tags : datacategory, tagmode : "any", format : "json" }).done(function(data) { $.each(data.items, function(i, item) { var sourcesquare = (item.media.m).replace("_m.jpg", "_s.jpg"); $("<img/>").attr("src", sourcesquare).appen

css - img class tags not being recognized in firefox -

so i'm running social network site, in i've installed plugins , modules allow users edit fan pages having own css editor ( style box ) social engine. i had main menu had images links referenced via html src vs css i.e <img src=""> vs .div { code } in order allow users alter layout via css created classes each image overwritten. for stumbled across article ( don't have link ) on stackoverflow bringing how change image using css lead me <img class=""/> , using .customtag { content:url("http://pathtoimage"); } in order modify it. it shows great in chrome , ie, in firefox not registering , see text + description alt="" tags. i've been searching few hours unable find exact match this. i'm posting here see if lead me in correct direction. i've tried declaring !doctype using <style> vs <style type="text/css"> while using css validator shows other areas, nothing related cur

php - Execute query inside a while loop.. MySQli -

i'm trying update current database plain text passwords hashes passwords using crypt() .. i'm trying without users having change passwords (this instable approach) code so: $query = $database->prepare("select id,username,password userlist"); $query->execute(); $query->bind_result($id,$username,$password); while ($query->fetch()){ $hashed = $framework->hash_password($password); $secondary_query = $database->prepare("update userlist set password=?, salt=? id=?"); $secondary_query->bind_param('ssi', $hashed['password'],$hashed['salt'],$id); $secondary_query->execute(); $secondary_query->close(); } $query->close(); i'm getting error: fatal error: call member function bind_param() on non-object in c:\inetpub\www\adminchangetextpass.php on line 24 now. know column names 100% match aswell database names. know variables correctly set. debugging deb

javascript - Nested objects referring to each other? -

suppose have this: network = { post: function(t) { console.log(t); } protocol: { init: function() { /* network.post("init") */ } } } the commented part, how allow network.protocol.init function call network.post through sort of relative link? how can network.protocol find networks variables? thanks. :) this limitation of object literal syntax; can't it. your best option reference network via property on protocol object, , add after declaring object via object literal syntax; network = { post: function(t) { console.log(t); } protocol: { init: function() { this.network.post("init") } } } network.protocol.network = network; ... works because existance of network property deferred until execution of init itself.