Posts

Showing posts from July, 2010

javascript - How to re-enable RightClick only for specific tag/id -

i'm using code: document.oncontextmenu = (function() { var counter = 0; return function() { counter++; if (counter == 3) { $("<div id='r-click'></div>").appendto("#container").html("<span>!!! protected content !!!</span>").fadein(500).show().delay(4000).fadeout(800, function() { counter = 0; }); } return false; }; })(); now, issue have textarea html code banner, , need context menu appear on it. possible edit code i'm using? you need use event object, passed oncontextmenu function. here solution: document.oncontextmenu = function(e) { var self = this; self.cnt = self.cnt || new(function() { this.counter = 0; }); if (e.target.id !== "somebannerid") { return false; } else { self.cnt.counter++; if (self.cnt.counter === 3) { $('#r-click').remove(); ...

java - Paint Panel Incorrect Rendering -

Image
here going on: i wanted make basic paint program practice using paint method, working graphics, using toolbars, et cetera. i've been doing lot of reading on how these things, , i'm sure i'm missing important line of code somewhere because paintpanel rendering jmenu isn't supposed there. have jmenu set actionlisteners, 1 rendered doesn't , cannot interacted with. here's picture: as can see in following image, can paint on menu , still not react @ all. plus, time can see radom button previous window in program added reason. here's button came from: i @ loss how fix this, here code relevant classes: this panel painting. package painter; import java.awt.color; import java.awt.graphics; import java.awt.event.mouseevent; import javax.swing.jpanel; import javax.swing.event.mouseinputlistener; @suppresswarnings("serial") public class paintpanel extends jpanel implements mouseinputlistener { //these 2 values used determine m...

c++ - How to simple assign vectors of different structs? -

so have 2 different structs (a & b) same variables , overloaded = operator in struct b convert b. i want able simple assign vector of a vector b, compiler gives me error: main.cpp|61|error c2679: binary '=' : no operator found takes right-hand operand of type 'std::vector<_ty>' (or there no acceptable conversion)| i assumed had overloaded = operator , iterate on vector , use = operator each instance. how this? here code: #include <iostream> #include <vector> using namespace std; struct { int x, y; a() {} a(int _x, int _y) { x = _x; y = _y; } }; struct b { int x, y; b(){} b(int _x, int _y) { x = _x; y = _y; } b& operator=(const a& _a) { x = _a.x; y = _a.y; return *this; } }; int main() { a_test(1,2); std::vector<a> a_vec; std::vector<b> b_vec; for(int = 0; <10; i++) { a_vec...

python - OpenShift Requirements.txt Pip error -

i want deploy python app openshift , app using tweepy library in it. tweepy, easy_install not working, created requirements.txt file has 1 line "tweepy", i'm getting error parse_requirements() got unexpected keyword argument 'session' , permission denied. don't know is. searched lot, none of solutions worked. solution, tried install manually, cannot reach sudo level , not allow me use pip. in advance. checking pip dependency listed in requirements.txt file.. remote: downloading/unpacking tweepy (from -r /var/lib/openshift/556db0635004460bb70000f6/app-root/runtime /repo/requirements.txt (line 1)) remote: downloading tweepy-3.3.0.tar.gz remote: running setup.py egg_info package tweepy remote: tracebac...

mysql - PHP - Find out the most repeated name ( first name of last name ) from the database -

i have developed app let college student search student of college , find out detail other students within college. currently, have been recording search queries on database , want is, list of top searched student name on list. so, want add script searched name ( either first name or last name ) database , make automatically update on app. currently working manually stuff. can give me proper solution , how can improved. this should work you: select first_name, count(*) num_searches table group first_name order num_searches desc limit 1; alternatively, can remove limit 1 see names ranked in order of occurance, or set limit 10 see 10 common searches.

file - Java - Working with IO - Clarification -

i working on few lessons in java, , instructor started introducing how io working in java. have couple of question experience java programmer clarify. the piece of code below program creates (notepad) text file in same file directory writing code. after that, prints basic lines of text file. import java.io.filewriter; //imports filewriter class import java.io.printwriter; //imports printwriter class import java.io.ioexception; //imports ioexception public class chap17part2 { public static void main(string[] args) throws ioexception { string filename = "grades.txt"; //creating name file printwriter outfile = new printwriter(new filewriter(filename)); //question 1 outfile.println(85); //prints file outfile.println(77); //prints file outfile.close(); //ends buffer, , flushes data file. } } question 1: due brief explanations instructor, line of code bit confusing me. know in line, creating "outfile" obje...

html - Navigation bar extended clickable area -

i've been playing around html , css , i've got problem. how can make padding left-right have link property too? <div class="baranavigatie"> <ul class="lista"> <li><a href="default.html">bine ati venit!</a></li> <li><a href="cinesunt.html">cine sunt?</a></li> <li><a href="ceofer.html">ce ofer?</a></li> <li><a href="evenimente.html">evenimente</a></li> <li><a href="contact.html">contact</a></li> </ul> </div> ^a part of html code^ li{ font-size:25px; display:inline; padding-left:40px; padding-right:40px; } .baranavigatie{ height:33px; background-color:blue; text-align:center; } li a{ text-decoration:none; color:whit...

python - PyQt progress bar not updating or appearing until 100% -

Image
edit: there number of similar posts on pyqt4 progress bars not updating. focus on issue of threads & program updates window. although helpful, code structured replies not practical. accepted answer given here simple, point & works. i using python 2.7 , pyqt 4 on win 7 x64 machine. i trying clear window of 1 widget, 'accept' button, see code, , replace progress bar. even though close 'accept' button & add progress bar before processing loop entered into. window updated after loop has finished & progress bar jumps straight 100%. my code, from pyqt4 import qtcore, qtgui import sys import time class centralwidget(qtgui.qwidget): def __init__(self, parent=none): super(centralwidget, self).__init__(parent) # set layouts self.layout = qtgui.qvboxlayout(self) # poly names self.pnames = qtgui.qlabel("import file name", self) self.polynameinput = qtgui.qlineedit(self) # pol...

php - can't sort data in Postgresql data type json -

i'm trying out "new" data type json. part of definition php array (one row of data stored in field) 'processed'=>array(5): ["ct"]=> int(1) ["wt"]=> int(11) ["cpu"]=> int(0) ["mu"]=> int(1056) ["pmu"]=> int(0) i tried following query: select id, data->>'processed'>'ct' sortfield system_debug order sortfield asc but in return table this: id sortfield 6 true 7 true 8 true 9 true 10 true 11 true 12 true 13 true 14 true 15 true 16 true 17 true 18 true i'm trying implement sorting without needs of storing data seperatly inside table. mistaking? table scheme: create table system_debug ( data json, id integer not null ); ...

regex - How to find all documents having an identical values in two fields with MongoDB? -

given new documents , querys: { "_id" : objectid("55803fd1cc0c9aa090e608be"), "song_name" : "mickey good", "time" : "3.56", "artist" : "mickey" } { "_id" : objectid("55803fd1cc0c9aa090e608bf"), "song_name" : "love nothing", "time" : "5.56", "artist" : "jimmy" } i need find songs have title identical artist name. have tried: db.mycollection.find( { $where: "this.artist == /this.song_name/" } ); but did not work out. please help` if understand well, need find songs title contains name of artist . don't need regular expression that 1 . simple test using indexof suffice. given sample data: > db.test.find({$where: "this.song_name.tolowercase().indexof(this.artist.tolowercase()) > -1" }) { "_id" : objectid("557ccec684ee2ba0375f...

c++ - LinkerErrors on opencv3.0 included project -

first of have checked many linkererror questions in stackoverflow. seems connected on sight. let me share information: code: #include<opencv\cv.h> #include<opencv\highgui.h> void main(){ iplimage* img = cvloadimage("c:\kaplan.jpg"); cvnamedwindow("imgdisp", cv_window_autosize); cvshowimage("imgdisp", img); cvwaitkey(0); cvreleaseimage(&img); cvdestroywindow("imgdisp"); } system settings: configuration : debug platform : x64 vc++ directories -> executable directories = c:\opencv\build\x64\vc12\bin;$(executablepath) vc++ directories -> library directories = c:\opencv\build\x64\vc12\staticlib;c:\opencv\build\x64\vc12\lib;$(librarypath) c/c++ -> general -> additional include directories = c:\opencv\build\include\opencv2;c:\opencv\build\include;c:\opencv\build\include\opencv;%(additionalincludedirectories) linker -> general -> additional library directories = c:\opencv\bui...

grails - GORM Gotchas Part 2 by Peter Ledbrook -

i trying understand meaning of phrase in gorm gotchas part 2 : the advantage of syntax can define multiple cascading relationships. does mean multiple cascading relationships between location , domain classes other author author or mean transitive (chaining) cascading relationships between location , author , author , other domain class? can provide example of syntax of these multiple cascading relationships? think make clearer. thank you. i provide example our current application: have user s , home s. home has many residents (instances of user ) can live in multiple home s. a user can register webhook events happening on home. if user gets deleted (his account removed), want remove web hooks, registered user. if home gets deleted users remain, web hooks of home should removed (since there not more events happening deleted home). so class webhook this: class webhook { string url static belongsto = [home: home, registrator: user] } the belongst...

iOS Swift Objective-C with bridging header sqlite3 sqlite3_create_function error: ambiguous without more context -

when call sqlite3_create_function receiving error. xcode "hint" problem indicates "&distancefunc" problem coming in at. here code: var mydb : sqlite3_file var sqlitedatabaseptr = sqlite3_open("septastopsdb", nil) sqlite3_create_function(sqlitedatabaseptr, "distance", 4, sqlite_utf8, nil, &distancefunc, nil, nil); "type of expression ambiguous without more context" i grateful in understanding how can correctly place code here. and function coming from? creating swift project uses sqlite3. have created bridging header file objective c , added sqlite3 library project build settings. see autocomplete sqlite c functions in swift know bridge working. i know there "fully swift" solutions sqlite3 need functions dylib (such sqlite3_create_function can create function cos ) the basic outline of sqlite function here @ link

vbscript - run as administrator password contain tilde -

how can use special character password mine have tilde in password ka$$1001~1 here script below, i'm unable run script. set wshshell = wscript.createobject("wscript.shell") wshshell.run "runas /user:administrator92 " & chr(34) & & chr(34) wscript.sleep 1000 wshshell.sendkeys "ka$$1001~1" 'send password wshshell.sendkeys "{enter}" as documented , ~ shorthand {enter} (the enter key). put special characters in curly braces: {+} {^} {%} {~} {(} {)} {[} {]} {{} {}} so line following: wshshell.sendkeys "ka$$1001{~}1" 'send password

python - accessing data in the kivy language from ScreenManager -

how can access kivy data myscreenmanager ? how can access hellow or timer data ? cant use on_release: root.starttimer() in hellow. class hellow(screen): pass class timer(screen): pass class myscreenmanager(screenmanager): def starttimer(self): #change text hellow button root_widget = builder.load_string(''' #:import fadetransition kivy.uix.screenmanager.fadetransition myscreenmanager: transition: fadetransition() hellow: timer: <hellow>: anchorlayout: button: id: size_hint: none, none size:300,100 text: 'make foto' font_size: 30 on_release: app.root.starttimer() <timer>: name: 'timer' ''') class screenmanagerapp(app): def build(self): print(self.ids) return root_widget if __name__ == '__main__': screenmanagerapp().run() some text stackoverflow (it says need type more t...

android - Epson POS printer, ePOS Sdk. What's the default port? -

i'm using tm-t82ii epos printer epos-print sdk . couldn't figure out how specify port on need devices (mobile , printer) communicate. what default port used printer/sdk? can enable on customised android on mobile device? also, there's way specify port on communication happens. in tm-t20ii default port 9100 . maybe printer uses port.

In R, why does is.na cause data.table to display the data.table as ouput? Version 1.9.4 -

the data.table package (which amazingly useful) still prints data.table output in following scenario. known issue? seems occur when is.na used. earlier posting reference di <- data.table(iris) di[is.na(sepal.length),color := "blue"] packageversion("data.table") sepal.length sepal.width petal.length petal.width species 1: 5.1 3.5 1.4 0.2 setosa 2: 4.9 3.0 1.4 0.2 setosa 3: 4.7 3.2 1.3 0.2 setosa 4: 4.6 3.1 1.5 0.2 setosa 5: 5.0 3.6 1.4 0.2 setosa --- 146: 6.7 3.0 5.2 2.3 virginica 147: 6.3 2.5 5.0 1.9 virginica 148: 6.5 3.0 5.2 2.0 virginica 149: 6.2 3.4 5.4 2.3 virgi...

Converting localized string date representation to UTC in python -

how convert following localized datetime string utc datetime. string has date, time , timezone mentioned in e.g. may 15,2015, 04.24am ist , here ist indian standard time. can time zone. tried using pytz couldn't make work. the thing it's quite difficult parse string abbreviated timezone information. but, if know timezone, can it's name recognized pytz . can list timezone names pytz.all_timezones . in case 'asia/calcutta' , should work convert utc. strip timezone information string , add later: import pytz import datetime # string without timezone info str = "may 15, 2015, 04.24am" # parse naive time dt = datetime.datetime.strptime(str, "%b %d, %y, %i.%m%p") # localize asia/calcutta dt_localized = pytz.timezone('asia/calcutta').localize(dt) # convert utc dt_utc = dt_localized.astimezone(pytz.timezone('utc')) and get: >>> dt datetime.datetime(2015, 5, 15, 4, 24) >>> dt_localized datetime.date...

apple maps - openMapsWithItems cannot Invoke with argument list issue in Swift 2.0 -

i'm having few issues converting swift 1.2 code 2.0 - 1 of issues. i have function opens ios maps app give directions location. working fine until conversion. following error message: cannot invoke 'openmapswithitems' argument list of type '([mkmapitem], launchoptions: [nsobject : anyobject])' this code (the error appears on last line): func openmapswithdirections(longitude:double, latitude:double, placename:string){ var coordinate = cllocationcoordinate2dmake(cllocationdegrees(longitude), cllocationdegrees(latitude)) var placemark:mkplacemark = mkplacemark(coordinate: coordinate, addressdictionary:nil) var mapitem:mkmapitem = mkmapitem(placemark: placemark) mapitem.name = placename let launchoptions:nsdictionary = nsdictionary(object: mklaunchoptionsdirectionsmodedriving, forkey: mklaunchoptionsdirectionsmodekey) var currentlocationmapitem:mkmapitem = mkmapitem.mapitemforcurrentlocation() mkmapitem.openmapswithitems([curren...

javascript - How to disable checkbox with jquery? -

i searched more time it's not work, want checkbox disabled, user not check , can check if condition. ok, now, tried disabled them. use jquery 2.1.3 <input type="checkbox" class="checkbox1" id="chk" name="check[]" value="u01" />banana <input type="checkbox" class="checkbox1" id="chk" name="check[]" value="u02" />orange <input type="checkbox" class="checkbox1" id="chk" name="check[]" value="u03" />apple <input type="checkbox" class="checkbox1" id="chk" name="check[]" value="u04" />candy $(window).load(function () { $('#chk').prop('disabled', true); }); id should unique. cannot have 4 checkboxes same id. you can try other selectors select whole range of checkboxes, .checkbox1 (by class), input[type="che...

java - Clean and install command is not working maven-eclipse -

maven run , install not working , shows below error: plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or 1 of dependencies not resolved: failed read artifact descriptor org.apache.maven.plugins:maven-clean-plugin:jar:2.5: not transfer artifact org.apache.maven.plugins:maven-clean-plugin:pom:2.5 from/to central (http://repo1.maven.org/maven2): connect timed out what have tried solve problem till today: 1.i have updated project 2.tweak pom.xml 3.i have used force update command 4.proxy setting not required it's local internet connection. 5.compile command working fine. p.s:same project works fine friend not working me. any more suggestion??????????

android - unBind a bound service -

i've bound service runs in separate process public class downloadservice extends service { private looper mlooper; private servicehandler mservicehandler; private messenger messenger; private messenger uimessenger; @override public void oncreate() { super.oncreate(); handlerthread thread = new handlerthread("servicestartarguments", process.thread_priority_foreground); thread.start(); mlooper = thread.getlooper(); mservicehandler = new servicehandler(mlooper); messenger = new messenger(mservicehandler); } private class servicehandler extends handler { public servicehandler() { } public servicehandler(looper looper) { super(looper); } @override public void handlemessage(message msg) { switch (msg.what) { case msg_download_request: string url = msg.getdata().getstring("url"); log.d("test", url); // download(url); ...

OCaml error in basic loop -

i'm new ocaml. i'm making function working way : have "tab" in scope represents 2d map, , 3 parameters, x, y , u. x , y represent position of player, , u direction of bomb (right, top left etc.). want function update tab every cell not in given direction updated 0. here code far : let test = fun x y u -> (for = 0 (w-1) j = 0 (h-1) if > x if j > y tab.(i).(j) = (if u = "dr" tab.(i).(j) else 0) else if j = y tab.(i).(j) = (if u = "r" tab.(i).(j) else 0) else tab.(i).(j) = (if u = "ur" tab.(i).(j) else 0) else if = x if j > y tab.(i).(j) = (if u = "d" tab.(i).(j) else 0) else tab.(i).(j) = (if u = "u" tab.(i).(j) else 0) else if j > y ta...

ansible loop over list and dictionary at the same time -

i writing playbook ensure nodes appear in /etc/fstab . i using loops prevent code duplication. the logic first check if line appears using grep (with perl regex because multi line) , store results in register. then want add lines not in fstab file. achieve need loop on list (the register grep return codes) , dictionary (that contains fstab entries). i having errors parallel loop. tried follow these steps. one or more undefined variables: 'str object' has no attribute 'item' tasks/fstab.yaml: --- - name: make dirs sudo: yes file: path={{ item.value }} state=directory with_dict: "{{ fstab.paths }}" - name: check whether declared in fstab sudo: no command: grep -pzq '{{ item.value }}' /etc/fstab register: is_declared with_dict: "{{ fstab.regexs }}" - name: add missing entries sudo: yes lineinfile: dest=/etc/fstab line="{{ item.1.item.value }}" when: item.0.rc == 1 with_together: - ...

javascript - Knockout subscribe/event type system without observable? -

i want make use of subscribe() function of knockout js manually trigger event @ point. i make observable() , everytime put guid in there trigger scubscribe. is there cleaner way within knockout js have typical event-like structure? edit ok, apparently can use observable.valuehasmutated() - might a bit cleaner using guid. example this behaviour i'm looking for: function car() { var self = this; self.onopendoor = ko.observable(); self.opendoor = function() { // using observable / valuehasmutated feels bit hacky // there other way use underlying subscribe() system? self.onopendoor.valuehasmutated(); } } var car = new car(); // multiple subscribers car.onopendoor.subscribe(function() { console.log('do something'); }) car.o**nopendoor.subscribe(function() { console.log('do else'); }) car.opendoor(); i aware not default 'knockout' way stuff - not question about. update after @royj...

matlab - Converting mixed empty/non-empty cells into a numeric matrix -

i working on code extract ar(1)-garch(1) parameter, estimated using ar(1)-gjr(1,1) model individual matrices can use them variables in calculations. have 16 time series variables, combine code loop in following way: for i=1:nindices aa_arch(:,i) = cell2mat(fit{i}.variance.arch)'; end; my problem variables no aa_arch(:,i) dimension lower nindices. naturally, when try export estimates in loop specified dimension of (:,i) , nindices matlab reports dimension mismatch. tell matlab replace nan 0 instead of leaving spot empty able produce (1,nindices) matrix aa_arch. i thought of this: fit{i}.variance.leverage(isnan(fit{i}.variance.leverage))=0 but wasn't able combine part previous code. i happy hints! best, carolin update: here runnable version of code produces problem. notice code produces dimension mismatch error because there no arch , garch estimate in fit.gjr(1,1) time series 1. these missing values have 0 placeholder in extracted matrix. returns = randn...

swift - Is it possible to run Xcode 6.3 on El Capitan? -

i'd try el capitan don't know if possible run old xcode on it, because critical me now. has tried it? xcode 6.3.2 run on first el capitan beta. have tried building , running swift app, worked should. although using xcode 6.3.2 work on first (and second) el capitan beta. there might steps involved. submissions app store rejected! if using beta version of osx

ios - Definite article before country name in sentence -

i have ios app want include user's country (as defined region) in text string, e.g. “in portugal …”. country names easy: let countrycode = locale.objectforkey(nslocalecountrycode) as! string let countryname = locale.displaynameforkey(nslocalecountrycode, value: countrycode)! let text = "in \(countryname) …" however, country names, name should prefixed “the”, example “the netherlands” , “the united states”. information available in nslocale somehow, or there other libraries can this?

math - Calculating angular acceleration c# -

i have 2 points. each point has course (degrees), , speed (m/s). these points come gps file, , there thousands of them. i trying eliminate glitches file, bad data unbelievable. 1 way of doing work out angular acceleration of change in speed , course between 2 points , if on kind of threshold, can eliminate point set piece of bad data (a spike in gps.) this worked fine when points 1 second apart, i'm dealing points less 1 second apart (typically .2 second) , more valid data getting flagged spurious. i'm wondering if i've done wrong? here code i'm using: double radcourse2 = p1.course*math.pi/180; double radcourse1 = p2.course*math.pi/180; double vel1x = math.abs(p1.speed*math.cos(radcourse1)); double vel1y = p1.speed*math.sin(radcourse1); double vel2x = math.abs(p2.speed*math.cos(radcourse2)); double vel2y = p2.speed*math.sin(radcourse2); // secs -1, -.2 double secs = p1.creationtime.subtract(p2.creationtime).totalseconds; double accx = (v...

python contextmanager newline issue -

using python's contextmanager want generate wrapper display linux-like progress of block of code: doing something... done. [42 ms] this working - kind of: from contextlib import contextmanager import time @contextmanager def msg(m): print(m + "... ", end='') t_start = time.time() yield t_duration_ms = 1000 * (time.time() - t_start) print("done. [{:.0f} ms]".format(t_duration_ms)) this usage example should print "doing something... " without line break, wait second, print "done. [1000 ms]" including line break , quit. with msg("doing something"): time.sleep(1) however, when running snippet, output first waits second, , afterwards prints whole line. when removing end='' @ first print() statement works expected, @ cost of ugly output. why case, intended, , done avoid behavior? (python 3.4.0 on linux mint 17.1) the problem due buffering of stdout . need manua...

windows - Batch Replace of !-sign -

i trying remove character ! in variable. setlocal enableextensions enabledelayedexpansion set filename=!filename:!=_! i have tried escape ^ did not work. set filename=!filename:^!=_! how can rid of !-sign in variable? you cannot replace % when using normal expansion. must use delayed expansion insntead: !var:%%=_! likewise, cannot replace ! when using delayed expansion. must use normal expansion instead: %var:!=_% . but can problem if variable may contain mixture of poison characters ^ , & , | , > , < quotes. example, there no single step way replace ! within following string: "this & that" & other thing! the trick replacement in stages, using delayed expansion, 1 replacement using normal expansion. 1) delayed expansion - convert " "" 2) normal expansion - convert ! replacement . because quotes doubled, outer quotes around expansion guaranteed protect poison characters 3) delayed expansion - convert ...

jboss7.x - Jboss 4.2 to latest free Jboss version migration -

currently using jboss 4.2 in our production application. want move our application version latest stable version of jboss. before starting doing this, have few queries which latest jboss free version stable , can used in production ? is there migration guide available same? ps: have read many other articles not got specific details queries. as per thread( https://developer.jboss.org/thread/229160?tstart=0 ), latest jboss free version wildfly 8.1 , can used in production want know version stable or bug free? i.e. can used directly in production.

c# - Writing List<String> of Directories with Subdirectories -

now, know there lot of questions on stackoverflow folder recursion , getting folder including it's sub-directories etc. pp., haven't found related i'm encountering here. my problem follows: i've taken code snippet folder recursion here (page bottom) , adapted needs; is, having not write (sub)directories console having add them list instead. here code (note part that's commented out): private static list<string> showallfoldersunder(string path) { var folderlist = new list<string>(); try { if ((file.getattributes(path) & fileattributes.reparsepoint) != fileattributes.reparsepoint) { foreach (string folder in directory.getdirectories(path)) { folderlist.add(folder); // console.writeline(folder); showallfoldersunder(folder); } } } catch (unauthorizedaccessexception) { } return folderlist; } this how call ( dir string containing path)...

jquery - Ransack sorting not working properly with Ajax, Rails 4 -

i can't sorting ajax work. far created search , sorting works great separately. when want sort given results, ransack reloads , starts beginning. so previous search results cleared. controller: @search = advertisement.search(params[:q]) @search.sorts = ['height asc','age asc'] if @search.sorts.empty? @advertisements = @search.result(distinct: true) view: <%= search_form_for @search, :class=>"search",:id=>"search-menio",:remote=>"true", url: advertisements_path, :method => :get |f| %> <%= sort_link(@search, :height,"augums",{hide_indicator: true},{ :remote => true, :method => :get }) %> <%= sort_link(@search, :age,"vecums",{hide_indicator: true},{ :remote => true, :method => :get }) %> <% @regions.each_slice(20) |slice| -%> <div class="pull-left"> ...

c# - Unity setting GUIText of another object -

i have (planetcontroller): private gamecontroller gamecontroller; ... void onmouseenter() { gamecontroller.setclasstext("orbital speed: " + orbitspeed); } in gamecontroller script: public class gamecontroller : monobehaviour { public guitext classtext; void start () { this.setclasstext (""); } public void setclasstext(string text) { classtext.text = text; } } but i'm getting: nullreferenceexception: object reference not set instance of object planetcontroller.onmouseenter () (at assets/scripts/planetcontroller.cs:29) the text object assigned correctly in inspector @ lost wrong. how can fix this? if have gamecontroller = getcomponent<gamecontroller> (); make sure planetcontroller , gamecontroller on same game object in scene. if not, have use: http://docs.unity3d.com/scriptreference/object.findobjectoftype.html

css - Centering an image in a div -

i had gotten through setting div inside div , wanted graphic in inner div managed , centre gave myself big pat on atleast trying , getting far without having go using dream weaver. then tried create class div use produce 3 columns put text , images in. when couldn't work went using tables because div's can such bitch , never know if div's going display correctly in every browser tables seem more stable. here link have done far picture michael.sydney . i have link how looking without table centered graphic , example of how looks now. i tried adding #boxinner { text-align: center; } and worked page

Android: programmatically changing to a solid xml shape makes text disappear -

i have button in layout background , textcolor defined selectors. when unpressed button has background color , textcolor , when pressed color , text color - e.g. white background black text -> black background white text. at point in code need replace background/text color third set of colors , go original selector defined in xml. however, after going text no longer appears , instead solid colored button. <button android:id="@+id/somebutton" android:layout_width="80" android:layout_height="80" android:textcolor="@color/sometext_selector" android:background="@drawable/somebackground_selector" android:gravity="center" android:text="@string/sometext" android:textsize="15sp" /> at point fine, when this: somebutton.setbackgrounddrawable(resourcescompat.getdrawable(getresources(), r.drawable.backgroundred, null)); somebutton.settextcolor(getres...

ios - Dynamic height for uiwebview with html data -

Image
as part of applications need display html contents in uiwebview , data conatins <ul> , <li> tags using attributed string calculating height of webview whenever data comes listed contents calculate incorrect height stuck issue lat 2 days, when list contain short text data returns less heights , contents misssed when comes ipad issue became worst because of large width of webview. nsmutableattributedstring *htmlstring1 = [[nsmutableattributedstring alloc] initwithdata:[[self.doctordetail objectforkey:@"description"] datausingencoding:nsutf8stringencoding] options:@{nsdocumenttypedocumentattribute: nshtmltextdocumenttype, nscharacterencodingdocumentattribute:[nsnumber numberwithint:nsutf8stringencoding]} documentattributes:null error:nil]; [htmlstring1 addattributes:attrsdictionary range:nsmakeran...

Class method returning reference C++/SystemC -

this question has answer here: why should assignment operator return reference object? 3 answers to pass user-defined datatypes systemc channels templates requires these datatypes defined class implements different kind of operators '<<', '=', '=='. need define sc_fifo such as: sc_fifo<route_t> for correct, route_t datatype has written in below example. class route_t { public: route_dir_t route_dir; unsigned int vc_index; // methods allowing structure passed systemc channels // constructor route_t(route_dir_t _route_dir, unsigned int _vc_index) { route_dir = _route_dir; vc_index = _vc_index; } inline bool operator == (const route_t& _route) const { return (route_dir == _route.route_dir && vc_index == _route.vc_i...

android: show font icon as a sequence of number string -

i want put font-awesome icon inside textview text. after set text, android shows me string sequence instead of font-icon. my code is: string formatedsection = formatedsection + sections.get(i).getcontent() +getresources().getstring(r.string.icon_ref); i define icon_ref in string.xml below: <string name="icon_ref">&#xf075;</string> i followed these instructions add font-icon. doing wrong? if did step 5 in short guid problem seem forget there diff between java , xml. in xml use xml escape (&...;), in java you'll have use java escape (\u...). – biffen may 20 @ 10:10 try hard code string "\uf075" , work charm.

.net - InvalidOperationException in Mobile Service Initialization -

i working on azure mobile service .net backend. started having problems in seed method when publishing service. collection modified; enumeration operation may not execute. description: unhandled exception occurred during execution of current web request. please review stack trace more information error , originated in code. exception details: system.invalidoperationexception: collection modified; enumeration operation may not execute. it points line 196 line 182: foreach (service s in listservices.toarray()) line 183: { line 184: context.services.add(s); line 185: } line 186: foreach (client c in listclient.toarray()) line 187: { line 188: context.clients.add(c); line 189: } line 190: foreach (employee e in listemployees.toarray()) line 191: { line 192: context.employees.add(e); line 193: } line 194: foreach (calendar c in listcalendar.toarray()) line ...

jasperserver - Jaspersoft, How to return from the page you drilled down in a report? -

i have long table spans multiple pages , in have column hyperlink drilldown report. hyperlink self , replaces current report. how can return original report exact point left it? (same page, same filter, , same order) there shall "back" button on top of drill down. native functionality of jasperserver. @ least in version of jasper reports use. hope help:)

Microsoft Advertising SDK: Windows Phone - number of requests -

sorry "bad" title problem, wasn't sure how phrase it. anyway... i'm using microsoft advertising sdk (pubcenter) windows phone (no mediation involved). i'm starting question if i've done wrong, yet i'm pretty sure haven't. it's either: behaving should. the sdk broken. i'm doing wrong. so determine 1 if is, i'm gonna give numbers dashboard , can confirm if have similar numbers or not. see numbers below: this app on windows phone store: downloads: 28,000 users requests: 6,234 requests impressions: 5,697 impressions fill rate: 91% estimated revenue: ~$4 in opinion, request-count should @ least same amount of downloads. it's waaaay below. , ms calling "91% fill rate" joke. the app on windows store ( pc & tablet ): downloads: 20,000 users requests: 228,792 requests impressions: 176,108 impressions fill rate: 76% estimated revenue: ~$150 there's extreme difference in requests between 2 platforms. ca...

c# - How to write one read, insert, update, delete method that does the job for each database models? -

Image
i had write 4 methods (read, insert, update, delete) for each model in mvc. need know if there's better way write less code , use c# features interfaces, generic types , don't know ... etc. , let's have these tables map corresponding models generated ado.net entity data model. for simple crud logic, can use generic repository pattern. here example: interface irepository<t> t: class { list<t> getall(); void add(t entity); void update(t entity); void remove(t entity); } implementation entity framework (replace dbcontext context class): class genericrepository<t>: irepository<t> t: class { public virtual list<t> getall() { using(var context = new dbcontext()) { return content.set<t>().tolist(); } } public virtual void add(t entity) { using(var context = new dbcontext()) { context.entry(entity).state = entitystate.added...