Posts

Showing posts from May, 2013

ruby on rails 3.2 - Can't start Solr-Server after installation: bundle exec rake sunspot:solr:start rake aborted! undefined method `map' for :needs:Symbol -

after installed sunspot_rails i'm getting error "undefined method `map' :needs:symbol" if run bundle exec rake sunspot:solr:start i don't know how pinpoint error.. if have suggestions please let me know error: http://pastebin.com/5x8bkfkd gemfile: source 'https://rubygems.org' gem 'rails', '3.2.16' # bundle edge rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem "sunspot_rails", "~> 1.2.1" gem "sunspot_with_kaminari", "~> 0.1.0" gem "jquery-ui-rails" gem 'sqlite3' gem "kaminari", "~> 0.12.4" gem "devise", ">=1.4.4" gem "dynamic_form", "~> 1.1.4" group :development, :test gem "rspec-rails", "~> 2.6.1" gem "database_cleaner", "~> 0.6.7" end # gems used assets , not required # in production environm

java - Clicking outside of Phonegap/Cordova InAppBrowser -

Image
so i'm making phonegap/cordova application (v 3.1.0) , need open inappbrowser doesn't cover full layout, can make custom toolbars , such show beneath browser. i've managed make inappbrowser appear smaller screen fiddling layout options , can succesfully show toolbars i'm not able click on them. need on how manage clicks propagate main phonegap view inappbrowser. as code - edit inappbrowser.java @ following lines desired height: inappwebview.setlayoutparams(new linearlayout.layoutparams(width, height)); and lp.height = height; lp.width = width; any ideas on how pass click, example on blue close div? here's screenshot show more detail: edit: managed click events setting onclick/touch listener on inappbrowser webview, doing samo on main view attached on dialog created registers no touch events @ all. also can find source code of inappbrowser plugin on github on here .

backbone.js - Marionette CompositeView as itemView of its own itemView (circular recursion?) -

here's interesting one. i've got 2 compositeviews, categoriesview , categoryview , i've got nested collection of categories, each category may have 0 or more children. i'd render collection category children uses categoriesview itemview , category without uses categoryview . ideally, i'd have categoryview use categoriesview itemview , , vice versa. so: +---------------------------------+ | categoriesview: title | <- 4 children |---------------------------------| | categoryview: item 1 | <- 0 children | categoryview: item 2 | <- 0 children | categoryview: item 3 | <- 0 children | +-----------------------------+ | | | categoriesview: title | | <- 10 children | |-----------------------------| | | | categoryview: item 5 | | ... the issue i'm running can't define categoryview 's itemview property categoriesview because object defined later in script file. causes compositevi

What User Mode Graphics Driver (UMD) does OpenGL call in the Graphics Pipeline? -

according windows : graphics hardware vendors must write user-mode display drivers display adapters. user-mode display driver dynamic-link library (dll) loaded microsoft direct3d runtime. user-mode display driver must @ least support direct3d version 9 ddi. e.g. nvd3dum.dll umd directx11 running nvidia. shader compilation happens here directx code called api, before goes kernal mode driver. also umd put code in intermediate representation? (e.g. can driver intermediate language)? opengl has had user-mode component of sort on windows beginning far windows 95 osr2. separation of client/server in architecture made extremely easy do. means lot of client-side api can basic command queuing, validation, resource creation, etc. without having switch kernel-mode. historically, meant draw calls, instance, cheaper in opengl direct3d. in windows vista (wddm) situation changed, wddm mandates user mode driver d3d (this includes d3d9 on vista) serves similar role openg

deployment - Using Ansible to download a single file from a private github repo to a remote host -

example scenario: config files service kept under version control on private github repo. want write playbook fetches 1 of these files on remote node , puts desired location. i can think of several solutions this: do checkout on machine runs ansible ( local_action ) , use copy module do checkout on remote node (with git module), copy files desired location command: cp src dest creates=dest (perhaps handler - when repo has changes pulled) use url module or command: wget https://raw.github.com/repo/.../file creates=file in playbook download file of interest. command module going check if file created different 1 may exist or check file exists? use wget on machine runs ansible ( local_action ) , use copy module push remote node what advantages/disadvantages of these. (if any) of these considered practice. best general solution this? i'll start saying chose 2nd solution our production environment , guarantee 1 thing - works. longer version: solution no. 1

jquery - How to remove class hover -

listen guys im here again, have trouble , donk know how search problmen in web (i searched "remove hover" , didnt find wanted). i have style one: .mystyle li:hover { background: #9999ff; } and have in html <ul class="mystyle"> <li id="li1">1</li> <li id="li2">2</li> <li id="li3">3</li> </ul> and have script too $('ul li').on('click', function() { $(this).prependto(list.closest('ul')); } so now, works perfectly, li moved conserves color of class (#9999ff) after click, , doesnt quit until pass mouse on there. have tried remove class removeclass doesnt work, please me. any ideas problem? thank u time! no, can't, can attach styles not tags classes , on hover event can delete/add class. in jquery hover combination of mouseenter , mouseleave events, can bind handler hover start: css: .hoverable { /* styles */ } .hover

visual studio - MSBuild or NAnt script that generates C# files, adds them to a project and compiles the project -

i've written code generator app fluentmigrator api emits unknown number of c# class files. wish compile code generator, run emit c# classes add new c# files existing c# project , compile final solution. what's best approach adding code generated c# files project? given know post, there couple approaches. you have api generate class files , want integrate build process make api call generate new class files, incorporate class files build. if executable emits output files it's current working directory, use exec task run command in $(intermeidateoutputpath) not clutter project's source tree: <exec command="myexe.exe " workingdirectory="$(intermediateoutputpath)\autogenclasses\" /> following command, append output classes default compile group: <itemgroup> <compile include="$(intermediateoutputpath)\autogenclasses\**\*.cs" /> </itemgroup> now you'd want control when occurs, you'd e

c# - Async chat server buffer issue -

Image
can please me out this... i've been struggling day. so i'm trying learn async sockets that's been giving me trouble. the issue way i'm updating listbox people have joined chat room's names: basically i'm doing having each client send "!!addlist [nickname]" when join server. it's not ideal doesn't check duplicates etc. want know why won't work. whenever adds name haven't seen before, send "!!addlist [nick]" in way, every time joins, lists should updated everyone. issue seems clients start communicating @ same time , interferes buffer. i've tried using separate buffer every client that's not issue. i've tried using lock() doesn't seem working either. essentially happens buffers seem truncate; there data 2 different people in same buffer. please tell me i'm doing wrong buffers or on client side: note async socket using send instead of beginsend. i've tried both methods , run same

r - Is something new with factor()? -

Image
there issues examples of "epitools" package, example epicurve.dates function. here simple example of epidemic curve (by days, epicurve.dates ) sampdates <- seq(as.date("2014-01-01"), sys.date(), 1) x <- sample(sampdates, 100, rep=true) epicurve.dates(x) this resulted plot : nothing ploted, , if in epicurve.dates code can see problem happened when try encode date vector factor. nas produced. format <- "%y-%m-%d"; before <- after <- 7 dates0 <- as.date(x, format = format) min.date <- min(dates0, na.rm = true) - before max.date <- max(dates0, na.rm = true) + after cdates <- seq(min.date, max.date, = 1) > factor(dates0, levels = cdates) [1] <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> <na> [24] <na>

three.js - Erroneous bindTexture(TEXTURE_2D, null); call, or bad shader? Texture disapparing with three.ShaderMaterial -

in 2 cases, have three.shadermaterial doesn't doesn't correctly render object, omitting texture. on both examples, middle object basic three.meshphongmaterial example1: http://jsfiddle.net/sg9mp/4/ object that's closest screen never shows. on one, works renderer.render(...) not composer.render(...). renderer.render( scene, camera ); //composer.render(); example2: http://jsfiddle.net/sg9mp/5/ here i'm trying duplicate meshphongmaterial shader base can modify it. tried replicate perfectly. copied uniform, vert, frag, , replicated what's in object. can't see different, don't why it's not working same standard three.js phong shader. so it's 2 cases i'm using three.shadermaterial , it's not rendering shader correctly, , can't figure out why. on second example(which 1 need fixed. first old test), in webgl inspector see scene looks fine until there "bindtexture(texture_2d, null);" call happens under hood three.js. tho

css3 - Is there a way(formula) to calculate absolute size of flex elements described with flex-grow, flex-shrink and flex basis? -

i made small demo http://html5.by/blogdemo/flexbox/flex-grow-shrink-basis-stackoverflow.html there 2 flex items in flex container flex: 1 2 1000px; flex: 1 1 100px; absolute width of flex container - 500px; finally, can see, width of flex elements are: 421px 79px my question: there way mathematically describe calculated sizes (with formula)? the closest thing formula algorithm in spec: http://www.w3.org/tr/css3-flexbox/#resolve-flexible-lengths i don't think can described in formula. can cover easy cases formula, gets bit more complex (and requires multiple loops of algorithm) when elements have min-width or max-width constraints. side note: flexbox spec make small change flex-grow , flex-shrink behavior, they're treated more percentage when sum less 1. (so e.g. flex-grow: 0.1 never give more 10% of free space, if you're child.) proposal described here: http://lists.w3.org/archives/public/www-style/2013oct/0246.html

java - I need help to fetch the data from database -

this table firstname----lastname----city--------state ram----------padhan------houston-----tx ram----------padhan------washingtom--mi ram----------padhan------alok--------bg keiry--------lading------azan--------bl keiry--------lading------aror--------bs how can fetch data output be: firstname: ram--lastname: padhan city: houston--state:tx city:washington--state:mi city:alok--state:bg firstname: keiry--lastname: lading city: azan--state:bl city:aror--state:bs beside getting value each row: firstname: ram--lastname: padhan city: houston--state:tx firstname: ram--lastname: padhan city:washington--state:mi here's did. output getting first row firstname , lastname whereas state , city columns , getting value till end row. public class practise { public static void main(string[] args) { connection conn = null; statement stmt = null; try { class.forname("com.mysql.jdbc.driver") ; st

javascript - Replace html checkbox with X -

i'm trying replace checkbox on form red x. basically, want the form functionality stay same don't want display box check rather red x click. i'm not sure how replace checkbox icon though. you can't replace because browser-specific implementation , notice looks different in different browsers. however, little bit of effort can write own. minimalistic example create following html structure... <div> <span class="chk" unchecked></span> <input type="checkbox" /> </div> hide checkbox , style span way want to... .chk { display:inline-block; width:13px; height:13px; border-radius: 3px; padding:2px; border:1px #ccc solid; cursor:pointer; } .chk[checked]{ background:url(your-checked_image.png); } .chk[unchecked]{ background:url(your_own_image.png); } input[type=checkbox] { display:none; } and then, need intersect click event change background image, keep track

java - Action is not getting called in Struts 2 -

in struts application action not getting called instead of page getting refreshed . after changing library jar files. before changing worked fine. below details of lib folder after changing the changes have made struts2-core-2.3.16 struts2-jquery-plugin 3.7.0 struts2-jquery-grid-plugin 3.7.0 xwork-core-2.3.16 ognl-3.0.8 freemaker 2.3.20 you missing following jar in application: freemarker.jar are new struts2?.if yes.. follow proper tutorial. here 1 ya :) tutorial1 tutorial2

ios - CPPickerView DataSource -

using cppickerview . have working , have been coding bit long think , brain has gone dead appreciated. know answer simple life of me can't see it. i want load array of strings view, not numbers. the current method use numbers is: - (nsstring *)pickerview:(cppickerview *)pickerview titleforitem:(nsinteger)item { return [nsstring stringwithformat:@"%i", item + 1]; } how create/edit method make strings appear instead of integers? if strings in array perhaps want: - (nsstring *)pickerview:(cppickerview *)pickerview titleforitem:(nsinteger)item { return yourstringarray[item]; }

java - How to call a function of other class from another class -

i developing project in javafx using netbeans ide. want call method of class in other package class in package. both packages under same project. code of main class below : package welcomepage; import javafx.application.application; import javafx.collections.fxcollections; import javafx.collections.observablelist; import javafx.event.actionevent; import javafx.event.eventhandler; import javafx.geometry.insets; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.combobox; import javafx.scene.control.label; import javafx.scene.control.passwordfield; import javafx.scene.control.textfield; import javafx.scene.control.tooltip; import javafx.scene.image.image; import javafx.scene.image.imageview; import javafx.scene.layout.borderpane; import javafx.scene.layout.hbox; import javafx.scene.layout.vbox; import javafx.scene.paint.color; import javafx.scene.text.font; import javafx.scene.text.fontweight; import javafx.stage.

html - Simplifying table into div -

<table border="1" width="800"> <tr> <td colspan="2">1</td> <td colspan="2">1</td> </tr> <tr> <td>1</td> <td>1</td> <td>1</td> <td>1</td> </tr> </table> i'm having troubles simplifying table div tags.. help? a simple example be: html <div class="container"> <div class="col-4"> 1 </div> <div class="col-4"> 1 </div> <div class="col-2"> 1 </div> <div class="col-2"> 1 </div> <div class="col-2"> 1 </div> <div class="col-2"> 1 </div> </div> css .container {width:800px;} .col-2, .col-4 {float:left;} .col-4 {width:400px;} .col-2 {width:200px;} demo: http://jsfiddle.net/er6g3/

Trouble connecting to database--java.sql.SQLNonTransientConnectionException -

i trying databases , failing miserably..please help! this code, until point of sqlnontransientconnectionexception: public class uftest { public static void main(string[] args) throws classnotfoundexception, sqlexception{ hashtable ht = new hashtable(); ht.put(context.initial_context_factory, "weblogic.jndi.wlinitialcontextfactory"); ht.put(context.provider_url, "t3://localhost:7001"); ht.put(context.security_principal, "user"); ht.put(context.security_credentials, "pw"); system.out.println("cx/ht succesful"); context cx = null; connection con = null; statement stmt = null; resultset rs = null; string source = "jdbc/lf_jhu_derby"; file file = new file("student_list.txt"); try{ system.out.println("try entered"); cx = new initialcontext(ht); system.out.println("cx created"); class.forname("org.apache.derby.jdbc.

node.js - Helenus throwing Exception -

i trying connect node.js(using express) cassandra cql using helenus. i have created keyspace in cql , installed helenus getting exception shown below: d:\test\node_modules\helenus\node_modules\helenus-thrift\lib\thrift\connection.js:90 throw e; helenusnoavailablenodesexception: not connect nodes any appreciated.

javascript - Refresh child in dynamically created nested accordion -

i trying append items nested accordion dynamically when user clicks button. using following code create nested accordion: $(".accordion").accordion({ collapsible: true, autoheight: false, animated: 'swing', heightstyle: "content", changestart: function(event, ui) { child.accordion("activate", false); } }); var child = $(".child-accordion").accordion({ active:false, collapsible: true, autoheight: false, animated: 'swing' }); in order this, have found need refresh accordion using following: $('.accordion').accordion("refresh"); my problem when try refresh inner accordion using: $('.child-accordion').accordion("refresh"); i following: error: cannot call methods on accordion prior initialization; attempted call method 'refresh' when inspect div should refreshed has following ids/classes: div#shelf0sections.child-accordion.ui-accordion-

android - How to use Canvas.clipRects to highlight face rects? -

i have bitmap multiple faces. want highlight each face such that, face rects have original color , rest of area blacked out. i did like, for(int i=0; i<getnumfaces(); i++) { rect rect = getrect(); canvas = new canvas(mutablebitmap); canvas.cliprect(rect, region.op.difference); canvas.drawcolor(color.black, mode.src_atop); } confirmationview.setimagebitmap(mutablebitmap); but makes entire image black. kinda know reason not able figure out solution. there might better way, try this: canvas = new canvas(mutablebitmap); for(int i=0; i<getnumfaces(); i++) { rect rect = getrect(); canvas.cliprect(rect, region.op.union);

insertAfter multiple elements in jQuery -

var group1 = $('#coach-group-group1'); var group2title = $('#title-group2').clone(); group2title.remove(); var group2 = $('#coach-group-group2').clone(); group2.remove(); $(group2, group2title).insertafter(group1); .. doesn't seem work, inserts first of 2 elements provided, not second, , there no errors in console either. how insert multiple elements, in order, 1 after other using insertafter ? $(group2, group2title) doesn't create set of 2 dom elements. second argument is context in first argument evaluated, if first argument not selector, second argument ignored. it seems looking .add : group2.add(group2title).inserafter(...); demo but think intentions clearer if used .after : group1.after(group2, group2title); fwiw, doesn't make sense call .remove on elements because not in document.

jquery - if i have 5 buttons with same CLASS, can i use javascript onclick to get ID? -

i have 5 buttons set same class "deletebutton" but each deleton button has unique purpose ( delete different id ) $(".deletebutton").click(function (e){ document.getelementbyid("abc").href="delete.php?adid="; + id of button clicked }); what need modify link of button, based on id of button clicked. <a id="delete" href="remove.php?adid=" >confirm</a> i have been having issue this, , think because "deletebutton" function running off class of button knows class not id of specifc button clicked? thoughts? you can use of these id this.id or e.target.id or $(this).attr("id") $(".deletebutton").click(function (e){ document.getelementbyid("abc").href="delete.php?"+ this.id; });

c# - MySQL OdbcConnection Error System.Data.Odbc.OdbcException -

i trying connect mysql database using odbcconnection in c#. getting following error: an unhandled exception of type 'system.data.odbc.odbcexception' occurred in system.data.dll additional information: error [im002] [microsoft][odbc driver manager] data source name not found , no default driver specified what causing error? here code: string connectionstring = "driver=mysql odbc 5.2 unicode driver;server=myserver.com;database=mydb;user=myusername;password=mypassword;option=3;"; odbcconnection myodbcconnection = new odbcconnection(connectionstring); odbccommand cmd = new odbccommand(); odbcdatareader reader; cmd.commandtext = sql; cmd.commandtype = commandtype.text; cmd.connection = myodbcconnection; myodbcconnection.open(); reader = cmd.executereader(); myodbcconnection.close(); i have tried following connection strings: "provider=msdasql;driver={mysql odbc 5.2 unicode driver};server=tcr.cjcresources.com;database=tcr;user=ahardi

java - how to display html5 page in android web view -

i have requirement of render html5 page in web view. html5 page plays video of jw player. while running, web view can not display video. url of web page. http://166.78.178.47:8080/imagedetails?contentid=619&categoryid= how display html5 page in android. thanks in advance. actually not sure either of flash video playback option. check out jw player not support flash on android anymore but eager know, did tried html5 video support option in webview? supports mp4/webm(html5 supported videos). @ webview , html5

.htaccess - how to redirect users to different index.php pages based on their states location -

we had different index pages different states of users. let site www.example.com so if user requesting andhra pradesh state needs load apindex.php. if tamilnadu needs load tamilindex.php. how can accomplish this? possible identify users request on server side can redirect required page or else have handle in client side? new redirection, approach redirection. thanks in advance. we can achieve php script , third party application check state on basis of ip. using can redirect user particular index page. geo location based on ip address - php http://css-tricks.com/snippets/php/detect-location-by-ip/

c - What is the intention of following function? -

i found following function in device driver code. static void module_exit(void) { { } while (0); } my question why used do { } while (0); inside function. can return there instead of calling do { } while (0); . there special reason having do { } while (0); here? there no special reason use while, in module_exit has clean functions un-register drivers. while exit in case. while(0) false case , fall out of loop .

wamp - Localhost page is not loading entirely -

Image
when start localhost (wamp server) shows me list of projects , nothing else. why isn't page loading completely? its not fresh install , wampmanager icon green in color. i using os-windows 7 64bit, wampserver 2.4 64bit, apache - 2.4.4, mysql - 5.6.12 , php - 5.4.12. this wampserver home page should missing on seeing?

javascript - Using sprintf in jQuery -

this question has answer here: javascript equivalent printf/string.format 42 answers how can use sprintf in jquery? i'm trying add id chunk of html returned script so: success: function(html){ $('.data').html($.sprintf(html,'test')); }, the html returned large chunk of html i've added %s sprintf it's replacement. eg: '<div>welcome blah</div><div>you userid %s</div>' if it's simple you've described, use string#replace regular expression (so can use g flag make replacement happen throughout string): $('.data').html(html.replace(/%s/g, 'test'));

batch file - On Windows Machine how to check whether Microsoft Visual Studio 2005 or 2008 or 2010 SPs are installed or not -

i want check whether microsoft visual studio 2005 or 2008 or 2010 sps installed or not on machine through batch file. if not installed have exe install. here need know how check whether microsoft visual studio 2005 or 2008 or 2010 sps installed or not. thanks in advance.

Using two dynamic layers on Google fusion maps -

i have created several fusion table maps, work great, in 1 of maps, want create dual layer functionality, polygon viewed beginning, , when zoom in, instead have functionality of linestrings. understood, it's not possible have 2 active dual layers simultaneously, , having functioning lightboxes them. how can make work? here example: parkeringszoner københavn you need use fusiontableslayer in google maps javascript api v3 you can have multiple (up 5) fusiontableslayers on single map , write code change 1 being displayed based on zoom level of map.

angularjs - angular watch on object and it's child -

i have on object in directive, let's say: scope = { : { b : [], c : 5 } } scope.$watch('a', function awaschanged(){}); scope.$watchcollection('b', function bwaschanged(){}); i have watch on , on b. when changed watch of b called well. want when changed "awaschanged" called (even if b changed well) , "bwaschanged" called when b changed. what mean under a changed. generally $watch() checks object reference equality not structure. for example if write like: $scope.a.ddd = "ddd"; the $watch not catch that. however deep-watch (with flag true ) should take care case. when changed "awaschanged" called... i suppose mean if c change ... write custom comparator like: $scope.$watch(function () { return $scope.a; }, function (newvalue, oldvalue) { if(newvalue.c == oldvalue.c){return;} // avoid b /*...*/ }, true); // object equality (not refer

string - Schematron: Element within mixed-type element only with other content -

my xml data should this: <mixed_type_parent> ...text... <other_element1/> <other_element2/> <element_in_question>...some content...</element_in_question> <other_element2>...text...</other_element2> <other_element1>...text...</other_element1> ...text... </mixed_type_parent> what want make sure using schematron "element_in_question" may appear within "mixed_type_parent" if there text outside of "element_in_question". means <mixed_type_parent> <element_in_question>...some content...</element_in_question> </mixed_type_parent> is not allowed , should cause error. i tried string-length of text within "mixed_type_parent" string-length(replace(ancestor::mixed_type_parent[1]/text(),' ', '')) but, again, there 1 of annoying errors in xpath: "a sequence of more 1 item not allowed first argument of replace()" in x

php - How to ping two server address? -

i want have php code ping 2 servers if these servers online php code echo online this code : $ip = "ip1"; //ip or web address $port = "22"; //port $ip2 = "ip2"; //ip or web address $port2 = "22"; //port $sock = @fsockopen( $ip, $port, $num, $error, 5 ); //2 ping time, can sub need $sock2 = @fsockopen( $ip2, $port2, $num2, $error2, 5 ); //2 ping time, can sub need if( !$sock & !$sock2 ){ //do if closed echo '<img title="offline" src="../images/down.png">'; } if( $sock & $sock2 ){ //do if open echo '<img title="online" src="../images/up.png">'; fclose($sock); fclose($sock2); } ?> is correct code ? your code has few minor issues: if 1 sock open , other not, not close open socket (php close @ end of script anyway), because close them if both open. used binary , (&) instead of logical , && if( $sock && $sock2 ) { ,

c# - Change backcolor of textboxes when their bound properties change? -

what best way of accomplishing this? some sample code: adding binding text boxes, , adding event listener: this.myobject = new myobject(); this.mytextbox.databindings.add( new binding("text", this.myobject, "myproperty", true, datasourceupdatemode.onpropertychanged)); this.myothertextbox.databindings.add( new binding("text", this.myobject, "myotherproperty", true, datasourceupdatemode.onpropertychanged)); this.myobject.propertychanged += handler; the propertychangedeventhandler handler passed in parent user control, new propertychangedeventhandler(handlepropertychange) . because parent contains save button enabled/disabled, , tab control has multiple pages containing multiple user controls. want handle property changes children, seemed best way of structuring things (??) this object/property bind (based on https://stackoverflow.com/a/1316566/1061602 ) public class myobject : inotifypropertychanged {