Posts

Showing posts from June, 2013

Pass Textbox Data To A Javascript Array Using Angular -

what simplest way type in textbox, ng-click button , send text textbox array? i've put question marks show know code goes, i'm not sure what. here's code: my html looks this: <input class="textbox" style="width: 320px; color:black; margin-bottom:20px" type="text"/> <input class="button" style="width:100px" ng-click="addworkflow(?,?); toggleshow('addworkflow')" type="submit" value="add"> this js array want typed text go to, "name" , "description" objects. $scope.addworkflow = function(?, ?) { var workflow = { id: 0, name: ?, description: ?, lens: "", focus: "", aperture: "" } $scope.workflows.push(workflow); }; well try this: $scope.addworkflow = function(newworkflow) { var workflow = { id: 0, name:"this want text text box appear.",

html - Javascript .className not working -

i'm trying use bit of js change class of links referring current url. seems work halfway, .classname bit won't work. if use a[i].innerhtml = 'activelink' example, change innerhtml . firebug reports no errors. window.onload = activatecurrentlink; function activatecurrentlink(){ var = document.getelementsbytagname("a"); for(var i=0;i<a.length;i++) if(a[i].href == window.location.href.split("#")[0]) a[i].classname += 'activelink'; } i have admit copypasta, js knowledge very, limited. help? you forget space symbol necessary when adding additional class element a[i].classname += ' activelink';

html - Bootstrap CSS Calendar align months -

i hope there easy fix this. on full screen want 2 months show in colum, on smaller devices shifts 1 column (i using .col-md-6 this), 3 rows total showing 6 months. works if each div same size. issue arrises when there month less "blocks of days" see here: https://www.dropbox.com/s/1rrryqzzppql858/months.png?dl=0 is there sort of vertical-align css can used in bootstrap fix this??? here code: <?php $date = date_create("2015-01-01"); $date_end = date_create("2015-07-01"); while ($date < $date_end):?> <div class="col-md-6 month_border"> <?php echo "<h2>".date_format($date,'f')."<small>".date_format($date,'y')."</small></h2>"; ?> <div class="row"> <?php //date_format($date,'w') day o

angularjs - Regex with ng-if -

<div class="row" ng-if="mytest.item.mypassword != mytest.item.confirmpassword"> <div class="col-md-12"> <p class="red-color"> password must between 4 , 8 digits long , include @ least 1 numeric digit , passwords must match! </p> </div> </div> i need show above message when "mypassword != confirmpassword" , regex '/^(?=.*\d).{4,8}$/' not fulfilled password field.how can use regex ng-if ? highly appreciated. on view: ng-if="isvalid()" in controller: $scope.isvalid = function(){ return mytest.item.mypassword == mytest.item.confirmpassword && yourregexp.test(mytest.item.mypassword); }

python - Parsing a html file using BeautifulSoup -

i have html file: <html> <head></head> <body> text1 text2 <a href="xycl7q.html"> text3 </a> </body> </html> i want collect separately text1,text2 , text3. text3 have no problems, not able capture text1-2; doing this: urllib import urlopen bs4 import beautifulsoup url = 'myurl'; html = urlopen(url).read() soup = beautifulsoup(html) soup.body.get_text() i texts (first problem since text3 again) not separated since text1-2 might contain spaces...for instance, if text1 "hello world" , text2 "foo bar", @ end want list of 2 strings: results = ['hello world', 'foo bar'] how can that? thank answers... the text want first child node of "body". can pull out , strip off crud >>> bs4 import beautifulsoup bs >>> soup=bs("""<html> ... <head></he

oracle - Getting the percentage in sql query -

i need find percentage of assistants working specified professors total number of professors. so far i've made sql order list of assistants working specified professors, when try divide number gives me error. this wrote: select count(*) professoren p, assistenten a.boss = p.persnr , p.name in ('sokrates', 'russel', 'augustinus'); i tried this, gives me error: select count(*)/(select count(*) assistenten) professoren p, assistenten a.boss = p.persnr , p.name in ('sokrates', 'russel', 'augustinus'); use explicit join syntax , 1 approach use cross join , total count , value can used percentage. select count(*)/t.totalcount professoren p join assistenten a.boss = p.persnr , p.name in ('sokrates', 'russel', 'augustinus') cross join ( select count(*) totalcount assistenten ) t

python - read in one row of csv file (based on input if i can) with DictReader, then format and write to new file -

i'm trying read in csv file many rows , columns; print 1 row, in particular format, text file, , hashing on values. far, have been able read in file, parse thru using dictreader, find row want using if statement , print keys , values. cannot figure out how format format want in end ( key = value \n), , cannot figure how write file (much less in format want) using value of 'row' obtained below. i've been trying days , make little progress cannot work. here got work (with detail left out of results): >>>import csv open("c:\path_to_script\filename_brief.csv") infh: reader = csv.dictreader(infh) row in reader: if row['alias'] == 'y4k': print(row) result-output {'full_name': 'jack flash', 'phone_no': '555 555-1212', 'alias': 'y4k'} i'd ask user input alias , use determine row print. i've done ton of research new-ish python asking help! i'

android - Overloaded Generics in Java -

is there way in java, c#? public interface basefragmentpresenter<t> { void init(t view); } public interface basefragmentpresenter<t,v> { void init(t view, v relativeview); } i'm not sure you're trying accomplish, looks want call 2 different interface methods, each named init , , each passed view(s) of sub-type. suit needs? public interface basefragmentpresenter { void init(view view); void init(view view, view relativeview); } using view allow pass in view of type.

machine learning - Defining an (initial) set of Haar Like Features -

when comes cascade classifiers (using haar features) read methods adaboosting used select 'best' features detection. works if there initial set of features begin boosting. given 24x24 pixel image there 162,336 possible haar features. might wrong here, don't think libraries opencv test against of these features. so question how initial features selected or how generated? there guideline initial number of features? and if 162,336 features used initially. how generated? i presume, you're familiar viola/jones' original work on topic. you start manually choosing feature type (e.g. rectangle a). gives mask can train weak classifiers. in order avoid moving mask pixel pixel , retraining (which take huge amounts of time , not better accuracy), can specify how feature moves in x , y direction per trained weak classifier. size of jumps depend on data size. goal have mask able move in , out of detected object. size of feature can variable. after you'

Position DIV elements horizontally (CSS & HTML) -

i have been trying create 6 button navigation system using images. each image 159x159px (though, may change). page width 1024, allowing 10px gaps between images. issue comes when try position images horiztonally , have div on each of them, code follows: .strand-container { /* colour strands container */ background-color: #333; /* size of strands container */ width: 1024px; height: 179px; /* position strands container */ margin: auto; } .strand-container img { /* size of strands */ width: 159px; height: 159px; /* space boxes */ padding-top: 10px; padding-left: 10px; float: left; /* layer position */ z-index: 1; } .strand-container ul,li { /* hide bullet points */ list-style: none; /* position */ margin: 0px; padding: 0px; } .strand-text { width: 159px; height: 159px; position: absolute; background-color: #000; text-align: center; margin: 10px; } .strand-text hr { width: 80%; } .strand-text:hove

How to preserve line endings in Ruby on Windows? -

i running ruby 1.9.3 on windows. when run following snippet of code text = file.read(path) file.write(path, text) i exact same file when file has cr+lf line endings. when run on file lf line endings, changes cr+lf line endings. how can read , write file using ruby on windows such line endings preserved, whether cr+lf or lf? ruby, along perl , python, aware of os code running on, , automatically set line-endings should be. if read, write, text file, settings kick in, , you'll see file change are. if need have file unchanged, add b flag open statement, like: file.open('path', 'wb') |fo| fo.write(text) end for more information, see " io open mode ".

Rails 4.1, Guard 2.10, and Minitest 5.4.1 -- RuntimeError & Rails::Generators::TestCase -

i'm trying set guard minitest in new rails 4 project. updated gemfile following: group :development gem 'guard' gem 'guard-minitest' end and ran bundle exec guard init minitest . i've got pretty simple test so: require 'test_helper' describe classtobetested describe "#initialize" "should return classtobetested object" obj = classtobetested.new obj.must_be_kind_of classtobetested end end end the class being tested in app/services/class_to_be_tested.rb . when run bundle exec guard -n f following: 11:35:43 - info - guard::minitest 2.3.2 running, minitest::unit 5.4.1! 11:35:43 - info - running: tests run options: --seed 36837 # running: e finished in 0.005190s, 192.6728 runs/s, 0.0000 assertions/s. 1) error: classtobetested::#initialize#test_0001_should return classtobetested object: runtimeerror: need configure rails::generators::testcase destination root. 1 runs, 0 assertions, 0 fa

java - Trying to learn generics, is there a way to see if one generic object is bigger or smaller then another? -

i thought nice use generics write quick sort. i'm learning generics, , seems can test whether 1 generic value equal another. there way see if 1 greater another? wrote simple isbig method follows public boolean isbigger( t b) { if (b>x) // error message here return true; return false; } public static <t extends comparable<? super t>> boolean isbigger(t x, t y) { return x != null && (y == null || x.compareto(y) > 0); } public static <t> boolean isbigger(t x, t y, comparator<? super t> cmp) { return cmp.compare(x, y) > 0; }

Node.js restarting every minute on OpsWorks amazon? -

i use opsworks on aws amazon. have set node.js app on , when deploy works should, main script (server.js) being restarted every minute. code looks like: var database = require('./database'); var config = require('./config.json')['development']; console.log('started'); process.on('uncaughtexception', function(err) { console.log(err); }); foo(); function foo() { // code settimeout(foo, 2000); } why printed out "started" every minute? opsworks checks health of app every minute , restarts health check (http get) fails. fact restarted every minute suggests health check failing. make sure app listens port 80. the application must listen on port 80 (for http requests) or port 443 (for https requests). if still have issues, make sure app meets conditions laid out in doc: deploying node.js apps

Does Perl support internet? -

i try write in perl script down loading file website. script must automatically down load @ night. perl support internet? use perl 5 centos , gedit. use file::fetch; $url = 'http://domain.tld/path'; $ff = file::fetch->new(uri => $url); $file = $ff->fetch() or die $ff->error; print "check $file\n"; put in script , crontab ...

c# - Set session variable from SqlDataSource -

i trying set session variable return of sqldatasource . able set value label/textbox/hidden field, cannot seem set session variable. i using page_load function try , set them. protected void page_load(object sender, eventargs e) { this.session["username"] = user.identity.name; this.session["emplid"] = eval("emplid"); } i have sqldatasource : <asp:sqldatasource id="sqlgetemplid" runat="server" connectionstring="<%$ connectionstrings:mafapp %>" selectcommand="select distinct emplid, status employees (intlogin = @username) , (dept = n'eng' or dept = n'is') , (status = n'active')"> <selectparameters> <asp:sessionparameter name="username" sessionfield="username" /> </selectparameters> </asp:sqldatasource> an alternative doing if user.identity.name string

php - CodeIgniter doesn't load upload library -

i'm having problem loading codeigniter library, i've built 3 (3) websites codeigniter, consider myself familiar framework. the problem upload lib. i've tried multiple functions , still doesn't work. i've tried the codeigniter example in google can't find answers, have idea be? class admin extends ci_controller { public function __construct(){ parent::__construct(); $this->load->library('session'); $this->load->library('v'); $this->load->model('admin_model'); } public function upload_a_thing($set = null){ $this->load->helper(array('form', 'url')); if(!$set){ $this->load->view('admin/upload_a_thing'); }else{ $this->load->library('upload'); if (!$this->upload->do_upload('userfile')){ echo $this->upload->display_errors(); } else { $file = $this->upload-&

PHP Replacing Character Inside String With Variable -

in few words, trying replace "?" value inside variable , doesn't work. please help. $string = "? red ? blue"; $count = 1; update_query($string, array($v = 'violets', $r = 'roses')); function update_query($string, $values){ foreach ( $values $val ){ str_replace('?', $val, $string, $count); } echo $string; } the output getting is: ? red ? blue frustrated people not paying attention, compelled answer question properly . str_replace replace instances of search string. after violets , there nothing left roses replace. sadly str_replace not come limit parameter, preg_replace does. can better still preg_replace_callback , so: function update_query($string, $values){ $result = preg_replace_callback('/\?/', function($_) use (&$values) { return array_shift($values); }, $string); echo $string; }

c# - iTextSharp need to repeat table rows with textfield dynamically -

Image
i reading , filling dynamic pdf template(having dynamic table textfields in each cell) below way using itextsharp [assuming getting single product info source]: filestream fs = new filestream("c:\\abc\\destinationfile.pdf", filemode.create); pdfreader reader = new pdfreader("c:\\abc\\sourcetemplatefile.pdf"); pdfstamper stamper = new pdfstamper(reader, fs); xfa = stamper.acrofields.xfa; string[] strproductlist = productinfo.product.split('|'); string dname= string.format("{0} {1}", strproductlist[0], strproductlist[1]); string labeling = string.format("{0} {1}/{2}", strproductlist[4], strproductlist[2], strproductlist[3]); string did = strproductlist[5]; xfa.setnodetext(xfa.finddatasetsnode("textfield1"), did); xfa.setnodetext(xfa.finddatasetsnode("textfield2"), dname); xfa.setnodetext(xfa.finddatasetsnode("textfield3"), labeling); templatefile: and xfa xml is: <?xml version="1.0"

c++ - Eigen compile errors: no matching function for call to -

i trying use eigen 3.2.2 in qt5 project being compiled on win32 vista machine. code uses eigen library compiles fine on osx computer when setup simple c++ project. following 2 errors when add qt project on windows machine: <projectdir>\3rdparty\eigen-3.2.2\eigen\src\core\util\blasutil.h:198: error: no matching function call 'eigen::internal::blas_traits<eigen::cwiseunaryop<eigen::internal::scalar_multiple_op<float>, const eigen::returnbyvalue<eigen::internal::inverse_impl<eigen::block<eigen::matrix<float, 4, 4>, -1, -1, false> > > > >::extract(const type&)' static inline extracttype extract(const xprtype& x) { return base::extract(x.nestedexpression()); } ^ <projectdir>\3rdparty\eigen-3.2.2\eigen\src\core\util\blasutil.h:198: candidate is: <projectdir>\3rdparty\eigen-3.2.2\eigen\src\core\util\blasutil.h:16

function - bash Call ext func in a echo -

been testing out external functions. overall seem work expected, except one. i set colors in extern script (mylib) this seems work fine: #!/bin/bash . mylib red echo " red text " . mylib white echo " white text " this isn't, not sure how should go. i'm looking change colors on same line. (without escape coding) #!/bin/bash . mylib red echo "red text " . mylib white " white text" i tried out few brackets , '$' ideas, fell short. thanks dave you can this, it's ridiculously inefficient. echo "red text $(source mylib; white) white text" it slightly better source library once: source mylib # needs done once! echo "red text $(white) white text" think it: every single time want change colors, you're asking shell this: call fork() create subshell in parent shell, start reading output emitted subshell in subshell, read file mylib , execute each line (in former cas

android - Issues with dependencies, modules. How do I properly reference this library? -

i'm confused something. i'm working on android app 2 modules. here's project structure myproject app libs abc.jar src etc... importedproject libs src etc... build.gradle build.gradle if right click on abc.jar, , choose add library... , dialog comes asking me module add options app , importedproject . if select importedproject , adds dependency importedproject's build.gradle file.. uses full path file on hard drive. compile files('c:/users/my.name/workspace/myproject/app/libs/abc.jar') i'm confused why it's using full local path rather relative. android studio warns me not this, yet me. i've tried these , none work: compile files('app/libs/abc.jar') compile files('myproject/app/libs/abc.jar') anyone know i'm doing wrong here? thank you edit : got work using: compile files('../app/libs/abc.jar') however, i've read using relative pa

c# - WPF Create Label and Path in one Object -

i try create class label , path 1 single object did this: class myline : shape { point p1,p2; label lbl; path arrow; public void addtocanvas(canvas x) { x.children.insert(0, lbl); x.children.insert(0, arrow); updatelbl(); updatearrow(); } public void removefromcanvas(canvas x) { x.children.remove(lbl); x.children.remove(arrow); } // ... etc } it's work fine can't remove myline canvas single object,i have remove path label. class mainclass { // ... code public void drawmyline(myline m) { _canvas.children.add(m); // work fine } object selectdeobject; public void canvasmouseleftbuttondown(object sender, mousebuttoneventargs e) { selectdeobject = _canvas.inputhittest(e.getposition(_canvas)) frameworkelement; } public void delete() { if (selectdeobject != null) { if (selectdeobject myline) // false

powershell - Power Shell script to remove disabled and expired accounts from allusers group in AD -

i'm inherit script apparently takes 14 hours complete. i'm not best @ powershell seems me first step search ad disabled and/or expired user accounts, remove them group , maybe groups. here script; $expired_disabled_users = get-qadgroupmember -identity allusers -sizelimit 0 | ?{$_.accountisdisabled -eq $true -or $_.accountisexpired -eq $true} $expired_disabled_users | ?{$_.accountisdisabled -eq $true | select name,whenchanged} foreach ($user in $expired_disabled_users) {remove-qadgroupmember -identity allusers -member $user} so, don't have quest ad plugins. how speed script using regular module activedirectory in powershell? initial change this, don't have way test don't have rights in domain yet; $expired_disabled_users = get-aduser -filter * | ?{$_.accountisdisabled -eq $true -or $_.accountisexpired -eq $true} $expired_disabled_users | ?{$_.accountisdisabled -eq $true | select name,whenchanged} foreach ($user in $expired_disabled_users) {remove-qadgroupme

PHP watermark images on the fly -

background i have read through many sites including 1 solution. have watermark script until few months ago worked flawlessly. hosting provider performed routine updates , hosed script. made 1 adjustment it, worked. time, watermark script seems heavy on system resources, causing sorts of issues site including images not loading @ random, etc. currently, appears run site on php version 5.4 or version or 2 above , below it. running @ 5.4 if should help. explanation the script intended find image files specific location, pending on size, combine 1 of several png images on fly without overwriting original image. the script i have modified script in past week, minor performance improvement. i'm @ wits end, there further improvements script made or cleaner code. assistance appreciated. files .htaccess, 3 jpg(s), , watermark.php script. .htaccess rewriterule ^(.*)wp-content/uploads/(.*) $1watermark.php?src=wp-content/uploads/$2 watermark.php <?php $src

java - Passing objects from servlets to client side(javascript) -

i'd know best way pass data servlet js code. solution came mind serialize object json string, pass request attribute jsp page , in js code , deserialize. is there better approach this? you generate json object <script> tag within jsp syntax, have inline javascript browser deserialize on page load without needing grab request attribute. similar following within jsp page. ... <script> <% out.println("myjsonobj = " + myjsonobject.tostring()) %> //other javascript stuff... console.log(myjsonobj.key1); </script> ... so rendered output/read in on browser (the actual json object dependent on serialize -- put jsonobject of course): ... <script> myjsonobj = {key1:value1,array1:[val1,val2,val3]}; //other javascript stuff... console.log(myjsonobj.key1); </script> ... another option ajax simple return json string servlet , receive return type being json (if using jquery ajax, otherwise json.parse(...) on xhr response).

csv - How to change the exponent character's case for R's exponential notation convention -

simple question controlling notation of how r prints exponent character. default appears lowercase 'e' i'd uppercase 'e' purposes of writing data frame csv file won't alter columns diff'd other csv files exponent character holds upper case convention. default r options > 10^100 [1] 1e+100 desired output > 10^100 [1] 1e+100 try formatc > formatc(10^100,digits = 2,format = "e") [1] "1.00e+100" gsub("e","e",formatc(x = 10^100)) [1] "1e+100"

os.path - merge paths with python, from /a/b/c + c/d to /a/b/c/d -

in python, os.path.join , can join directories paths import os os.path.join('/usr','opt', 'bin') '/usr/opt/bin' how can merge 2 path ? from /a/b/c + c/d get /a/b/c/d if sure paths of form give example for, os.path.join(os.path.split(p1)[0], p2) would it.

c# - Custom Button with a Viewbox inside -

Image
i have style: <style targettype="{x:type local:imagebutton}" basedon="{staticresource {x:type button}}"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type local:imagebutton}"> <border> <stackpanel orientation="horizontal"> <viewbox x:name="viewboxinternal" child="{templatebinding child}"/> <textblock x:name="textblockinternal" text="{templatebinding text}" /> </stackpanel> </border> </controltemplate> </setter.value> </setter> </style> and have 2 dependency properties. static imagebutton() { defaultstylekeyproperty.overridemetadata(typeof(imagebutton), new frameworkpropertymetadata(typeo

php - Best way of storing 'website settings' data in a database table? -

Image
i working on marketplace, , wondering best way of handling website settings such title, url, if https, contact email, version, etc. i trying structure table easy update, , able have more , more settings added fetch. i developed 2 structures, either keep in 1 row, column names setting name, , row column value setting value. , echoing first row value column name mysql_fetch_assoc. i thinking having new auto-increment row every setting. , turning array fetch database assign column name column im fetching of setting name. what way of handling efficiently. thank you. a row each distinct option setting, using name/value pairs 1 per row, best way go. it's more flexible lots of columns; if add option setting won't have run kind of alter table operation. the wordpress wp_options table works way. see here. http://codex.wordpress.org/options_api if had "compound" option, serialize php array store in single row of table.

java - Android - Center Textview in ImageView of Relative Layout -

i have relative layout imageview in , want center textview in side imageview, in activity layout xml file. here image view , have tried textview this inside of relative layout: <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:minheight="170dp" android:minwidth="170dp" android:id="@+id/logobackground" android:layout_alignparenttop="true" android:layout_alignparentleft="true" android:layout_alignparentstart="true" android:layout_marginleft="33dp" android:layout_marginstart="33dp" android:layout_margintop="33dp" android:contentdescription="@string/content_description_useless" android:background="#ffffd0cd" /> <textview android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string

html - SVG image as :after border without fixed height? -

okay, here jsfiddle of nav in current project. i'm not sure if i'm going in best way, want logo centered in middle of nav , 3 links centered around logo. however, need site responsive : able handle variety of screen widths smoothly. suggestions? also, want able use .png border on divs without needing set fixed height. however, when set height:auto background-color disappears. html: <div id="header-wrap" class="group"> <nav> <a href="index.html"><img class="logo" src="http://i60.tinypic.com/1zxqqm1.png" alt="cat town cafe & adoption" /></a> <ul> <li><a href="index.html">about</a> </li> <li><a href="index.html">our cats</a> </li> <li><a href="index.html">reservations</a> </li> <li><a href=

c# - Medication reminder app -

i creating medication reminder app , here how works; creates directory store new medications' details user enters them, these stored text file name of medication file identifier. user able view list of stored medications , details of method searches directory. however, upon deleting 1 medication file directory, name remains in listbox shows existing names, can still create new file same name , names displayed together. think failing clear contents of listbox shows list of existing files have tried best still cannot working. code use deleteing file follows: try { // string filename = medlistbox.selecteditem.tostring() + ".txt"; isolatedstoragefile storageaccessor = isolatedstoragefile.getuserstoreforapplication(); /*while (storageaccessor.fileexists(filename)) storageaccessor.deletefile(filename);*/ storageaccessor.createdirectory("medicationdetails"); // string fileholderreappear = medlistbox.selec

Hadoop: Image processing of colored images -

i have huge number of colored images. , want process images in such way that whenever average of rgb values of image exceeds particular number, want output imageid , it's timestamp can locate time in actual video. reading image processing , people have suggested converting images sequence files or using hipi framework. not how can extract image information sequence file? , hipi framework has not been updated , doesn't work current hadoop version. ideas on how this?

javascript - How to tell if Ng-Repeat has printed x items -

how can tell if there 1 item displayed ng-repeat? like, if ng-repeat items === 1: something. <div ng-controller="mycontroller2"> <form ng-submit="submit()"> {% csrf_token %} search name: <input ng-model="artistname" /> <input type="submit" value="submit" /> </form> <table> <tr ng-repeat="name in names | filter:artistname | limitto:10"> <!-- if number of "name" === 1 want form submitted --> <td ng-hide="!artistname"> <a href="" ng-click="submit()"> {({ name })} </a> </td> </tr> </table> this code reads input user display list of links submit form. want form submit automatically when initial list of artist names displayed ng-repeat down 1, since there can 1 dataset database @ point anyway. add in form block: <div

javascript - Change chevron on click event -

i want change chevron down up based on user's onclick event. i've tried using other samples other people not work out. this jsfiddle . well, have couple of problems setup of jsfiddle, i'm assuming secondary actual problem. the easiest way use .toggleclass() (i'm assuming you're okay using jquery since use $(document).ready() , include in fiddle). you can use (classname, switch) signature add or remove classes: $(element).toggleclass("myclass", false) // removes myclass $(element).toggleclass("myotherclass", true) // adds myotherclass so, if add var change = true in .ready() , can switch between 2 glyphicons on each click: function toggle_caret() { $("#caret1").toggleclass("glyphicon-chevron-up", change); $("#caret1").toggleclass("glyphicon-chevron-down", !change); change = !change } demo var change = true; $(document).ready(function () { $('[da

graph - SAS Dynamic Output Save Files -

i using proc template , sgrender , outputting ods based on class variable (classvar). need output title update each graph name of class variable. here example of code: proc template; define statgraph heatmapparm; dynamic _byval_; begingraph; entrytitle _byval_; layout overlay; heatmapparm x=x_var y=y_var colorresponse=percent / colormodel=(blue yellow red) name="heatmapparm" xbinaxis=false ybinaxis=false datatransparency=.5; continuouslegend "heatmapparm" / location=outside valign=bottom; endlayout; endgraph; end; run; proc sgrender data=roundfreq template=heatmapparm; situation; run; thank help! this works in sas 9.3+ believe. version of sas have? proc template; define statgraph scatter; dynamic _x _y _byval_; begingraph; entrytitle "scatter plot of " _x " " _y " sex = " _byval_; layout overlay; scatterplot x=_x y=_y; endlayout; endgraph;

Java method that returns interface type -

as reading java interface, came across following example. know how implement interface. returning interface type in method new me. me understand example? methods in "animal" interface implemented in "categorizeanimals" method? if yes, "animals" array passed interface methods in "categorizeanimals" method? public class wild { public static interface animal { public list<string> getinvertebrates(); public list<string> getfishes(); public list<string> getamphibians(); public list<string> getreptiles(); } public static animal categorizeanimals(string[] animals) { ....... ....... ....... return null; } } appreciate reply, much. very simple solution if have put interface of method then ever class instance returning class has have interface implemented. public class implementedclass implements interfacename { @override public void sayhi(string hello) {

ios - What is swift's equivalent of a Pthread semaphore or a spin lock? -

background i using objc_sync_enter/exit pairs manage locks: func sync(lock: anyobject, closure: () -> ()) { objc_sync_enter(lock) closure() objc_sync_exit(lock) } func sync<t>(lock: anyobject, closure: () -> t ) -> t { var t : t objc_sync_enter(lock) t = closure() objc_sync_exit(lock) return t } i can use these mechanisms update semaphore count down tasks need complete. now, in separate thread, wait until semaphore reaches zero, perhaps using pthread semaphore or kind of cheap/light spin lock? var semaphore = 2 // ->0 using sync() when preparation complete fun call_me_when_semaphore_becomes_zero() { } question how can wait boolean condition using swift/ios synchronization mechanisms? it nice if interface looked this: // implementation func sync_wait(lock: anyobject, condition: (()->bool), closure: (() -> ())) { // need here ------------------------------------------------------- // using lock, w

asp.net - How to install executable for crystallreports? -

i have been working on installing crystal reports sp9 visual studio 2013, got downloaded , installed .msi file crruntime_64bit_13_0_12 but documentation says "you must run install executable. running msi not integrate crystal reports vs. msi files definition runtime distribution only." now install executable mean ? how ? http://scn.sap.com/docs/doc-7824 please click on link support pack 12 (v.13.0.12.1494) on executable column of downloads table. should start downloading crforvs_13_xx.exe file.

Wordpress plugin to do something on post publish -

i new wordpress. writing custom plugin take post title post url , post content of newly published post , store in other store in background. using "publish_post" action same. however, don't think gets invoked. i have few queries around : which api action / filter me achieve above problem statement ? is best use actions or filters ? how identify whether action registered ? how identify if action invoked ? tried putting echo statement not seem display. on "publish" click, icon next button keeps going round denote publish in progress. confused. kindly help. ! you can add save_post hook : add_action( 'save_post', 'save'); function save( $id ){ if( get_post_status( $id ) == 'publish' ) { } } for action vs filter question: these not can interchange; different beasts. think way: filter can alter value (so need return value), action can't.

Function latest post in wordpress -

i have next code show latest post in wordpress. want add thumbnail , date. suggestion? function last_article($atts){ extract(shortcode_atts(array( 'posts' => 1, ), $atts)); $return_string = '<ul>'; query_posts(array('orderby' => 'date', 'order' => 'desc' , 'showposts' => $posts)); if (have_posts()) : while (have_posts()) : the_post(); $return_string .= '<li><a href="'.get_permalink().'">'.get_the_title().'</a></li>'; endwhile; endif; $return_string .= '</ul>'; wp_reset_query(); return $return_string; } your shortcode pure evil. should never ever use extract() . extract() removed wordpress core. should tell how bad extract() is. see corresponding trac ticket here also, never ever use query_posts . note: function isn't meant used plugins or themes. explained l

hashmap - "double, Double, HashSet" in Java -

please see code below. "double"(upper d) used in hashset, , "double" used x1, x2 , x3. after x1 added hashset, x2 cannot added, x3 can! why?????? thanks in advance :) hashset<double> hs = new hashset<double>(); double x1, x2, x3; x1 = (double)0/1; system.out.println(hs.add(x1)); //true x2 = (double)0/2; system.out.println(hs.add(x2)); //false x3 = (double)0/-1; system.out.println(hs.add(x3)); //true and if add "0.0 +" x1, x2 , x3, result follows. x1 = 0.0 + (double)0/1; system.out.println(hs.add(x1)); //true x2 = 0.0 + (double)0/2; system.out.println(hs.add(x2)); //false x3 = 0.0 + (double)0/-1; system.out.println(hs.add(x3)); //false try understand difference: hashset<double> hs = new hashset<double>(); double x1, x2, x3; x1 = (double)0/1; system.out.println(x1 + " "+ hs.add(x1)); //true x2 = (double)0/2; system.out.println(x2 + " " + hs.add(x2)); //false x3 = (double)0/-1; sys

ios - reason: 'UITableView dataSource must return a cell from tableView:cellForRowAtIndexPath -

i've 1 tableview different section , each section have 1 row. if section selected video playing in mpmovieplayerviewcontroller . after click on done button app crashing times(some sections particular only). my code below: subcategorytable=[[uitableview alloc]initwithframe:cgrectmake(0,0,375,667) style:(uitableviewstyleplain)]; subcategorytable.datasource=self; subcategorytable.delegate=self; subcategorytable.separatorcolor=[uicolor orangecolour]; subcategorytable.hidden=yes; subcategorytable.backgroundview=nil; [subcategorytable registerclass:[uitableviewcell class] forcellreuseidentifier:@"subcatcellid"]; [self.view addsubview:subcategorytable]; ***cellforrowatindexpath*** static nsstring *cellidentifier3 = @"subcatcellid"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier3 ]; if (cell == nil) { cell = [[uitableviewcell alloc]initwithstyle:uitableviewcellsty