Posts

Showing posts from January, 2013

path - Sublime Text 2 and Repl - Run python -

i start using sublime text 2 , repl , got problems. when run file tells me file du not exist. script works perfect if build directly terminal. code def stopwords(text): open('danish', 'ru') f: line in f: text = text.replace(' '+line.strip()+' ', "") return text log ioerror: [errno 2] no such file or directory: 'danish' i have tried things os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) reload(sys) , __file__ not work. any ideas why __file__ don't work when running through sublime text 2 repl or file stored??

javascript - jQuery php variable echo not working -

i have little contact form, ask user calculate , enter correct value in order prevent spam. now, when send button clicked, fire php script, change calculation values. echo these values , show them new placeholder in case of both, success, failure. $("#send_button").click(function() { var url = "contact.php"; // script handle form input. $.ajax({ type: "post", url: url, data: $("#contact_form").serialize(), // serializes form's elements. success: function(data) { var txt = "<?php echo 'spam protection: calculate ($first_num + $second_num) x $multiplier';?>"; $("#form_info_label").css('color','#0ed68d'); $("#form_info_label").text(data); $("#user_answer").attr("pla

java - Exporting variables with multiple values? -

import java.util.*; import java.text.*; import java.io.*; public class avgtime { static double hrs1; static double min1; public static void main(string[] args) throws interruptedexception, filenotfoundexception { scanner in = new scanner(system.in); system.out.print("how many times? "); int numoftimes = in.nextint(); double hrtotal = 0; double mintotal = 0; (int = 1; <= numoftimes; i++){ system.out.println("\nenter time in military time notation: "); system.out.print("hour "); double hrs1 = in.nextdouble(); system.out.print("minute "); double min1 = in.nextdouble(); hrtotal += hrs1; mintotal += min1; } //calculate average double avghr1 = hrtotal/numoftimes; double timemin1 = math.round(mintotal/numoftimes); decimalformat df = new decimalformat("###"); string hours = df.format(avghr1); string minutes = df.format(timemin1); string time = hours+":"+minutes+":"+00; string mt = hours+

google apps script - Collect Data from several Spreadsheets and copy it into another sheet -

i want copy data 1 spreadsheet one. 1. data on several sheets 2. columns (just speed up, don't need columns) for beginning used following script: function copydatatonewfile() { var sss = spreadsheetapp.openbyid('0ajn7uzg....'); // sss = source spreadsheet var ss = sss.getsheetbyname('monthly'); // ss = source sheet //get full range of data var srange = ss.getdatarange(); //get a1 notation identifying range var a1range = srange.geta1notation(); //get data values in range var sdata = srange.getvalues(); var tss = spreadsheetapp.openbyid('8ajn7u....'); // tss = target spreadsheet var ts = tss.getsheetbyname('rawdata'); // ts = target sheet //set target range values of source data ts.getrange(a1range).setvalues(sdata); } i took 1 user2741, posted here : ..this 1 works fine 1 sheet. unsure how data more sheets , sort it. has idea on how this? thank all, sascha this 1 here works, if happens in same spreadsheet

Listening to events in Durandal -

i'm reviewing durandal documentation, , can't find concrete implementation of listening durandal events , e.g, router events . can point me docs, or (if there no documentation on this) example? in view model should listen activator events. link . check example durandal starter template. listening activate , candeactivate events: define(['plugins/http', 'durandal/app', 'knockout'], function (http, app, ko) { //note: module exports object. //that means every module "requires" same object instance. //if wish able create multiple instances, instead export function. //see "welcome" module example of function export. return { displayname: 'flickr', images: ko.observablearray([]), activate: function () { //the router's activator calls function , waits complete before proceding if (this.images().length > 0) { return;

Multidimensional sparse matrices in Julia -

why aren't there multidimensional sparse matrices/arrays in julia? why can have 2d sparse matrices , not example 3d sparse matrices (or arrays)? the problem understand (i'm not sparse linear algebra expert, although viral shah, 1 of other julia co-founders is) libraries (e.g. suitesparse) doing sparse computations matrix-only. don't support sparse vectors , don't support higher dimensional tensors either. define types higher-dimensional sparse tensors, wouldn't able useful them.

reshaping time series data in R -

i have quarterly time series economic data imf ifs need long form. right now, rows variables per country , columns time, looks this. country variable q1 q2 [1,] "usa" "inflation" "1" "5" [2,] "usa" "gdppc" "2" "6" [3,] "uk" "inflation" "3" "7" [4,] "uk" "gdppc" "4" "8" i need long form: country time inflation gdppc [1,] "usa" "q1" "1" "2" [2,] "usa" "q2" "5" "6" [3,] "uk" "q1" "3" "4" [4,] "uk" "q2" "7" "8" i haven't been able find advice on using reshape when id variable , measurement variables both in rows. it partial melt followed dcast in reshape

ruby on rails - asset_path helper is not implemented -

i receiving error when trying compile assets on heroku custom asset_path helper not implemented extend environment context custom method. environment.context_class.class_eval def asset_path(path, options = {}) end end i have tried pretty find through google. heroku seems getting caught when precompiling assets active_admin.css, contains 2 @import statements. if comment out, build proceeds, without active admin stylesheets working in production. if has thoughts, please advise. thank you. i fixed issue removing config in application.rb relating asset precompiling, , added catch compile script. guess somehow missing file, caused error: # precompile assets # application.rb config.assets.precompile << proc.new |path| if path =~ /\.(css|js)\z/ full_path = rails.application.assets.resolve(path).to_path app_assets_path = rails.root.join('app', 'assets').to_path if full_path.starts_with? app_assets_path puts &q

php - How do I get all of the results from a hasMany() relationship in Laravel? -

for example, have product, , have baseproduct. in model product, i've specified following: //in class product public function baseproduct() { return $this->belongsto("baseproduct", "baseproductid"); } in baseproduct, i've specified following relationship: //in class baseproduct public function products() { return $this->hasmany("product", "productid"); } if select product, so: $product::first() i baseproduct doing following: $product::first()->baseproduct()->get(); instead of getting array of result that, how model of baseproduct, can of children of baseproduct, meaning products have foreign key relating baseproduct. i've tried baseproduct()->all(); instead, isn't valid method. edit: i've created following chain of function calls - it's awful. return baseproduct::find(product::first()->baseproduct()->getresults()['baseproductid'])->products()->get

vb.net - Error saying file is already open when writing to a file -

i have form fields saving text file. on same form have button allows view saved prior text file when hit button reads textfile , displays on datagrid. this code displaying datagrid dim reader streamreader reader = new streamreader("c:\users\john\desktop\tickets.txt") dim string dim results() string = reader.readline results = a.split(vbtab) dgv.rows.add(results(0), results(1), results(2), results(3), results(4), results(5)) ' code here ' loop until nothing reader.close() reader.dispose() this code saves file dim file streamwriter file = new streamwriter("c:\users\john\desktop\tickets.txt", true) file.writeline(txtname.text & vbtab & dtdate.text & vbtab & txttime.text & vbtab & txtwho.text & vbtab & txtproblem.text & vbtab & txtresolution.text) file.close() when read records first try save them keep getting error process

php - How to convert a date and time to be stored in mysql datetime -

how convert stored in mysql database datetime field? $phptime = '02/21/2014 9:30 am'; convert string timestamp, use php date function in format want. $datetimestring = date( 'y-m-d h:i:s', strtotime( $phptime ) );

Submit form and get echo from php in jquery -

i have form , submit button sends input values per post php file. php validates , echos value. how can handle echo value per jquery (in jquery function)? sample code: <form id="login" method="post" action="/php/login.php"> <input type="text" id="username" name="username" placeholder="username" autofocus="true"></input> <input type="password" id="password" name="password" placeholder="password"></input> <button id="loginbutton" type="submit" name="submit">login</button> </form> just pretend /php/login.php is <?php echo "ok"; ?> now, imagine there must way echo value in sort of form-submit callback in jquery? ok, found out had elude actual submit , seperate post $("#login").submit(fun

How to use Rails select with ransack -

i need use rails select method oppose *text_field* search legacy data. unfortunately, 1 of attributes in project's table capitalized, , if use alias_attribute on it, still complains correct naming actual table. code blow works point, instead of passing project_cont name value in params, id description. how can make work? here current code have @ moment: = search_form_for @search, :html => {:class => "form-inline"} |f| .form-group = f.select :decsription_cont, options_from_collection_for_select(project.all, "id","description", @search) here controller's code: def index @search = project.search(params[:q]) @products = @search.result end here view's code: = search_form_for @search, :html => {:class => "form-inline"} |f| = f.select :decsription_cont, options_from_collection_for_select(project.all, "id","description", @search.description_cont)

parsing - Fuzzy java parser in Antlr 4 -

in 2012, terence parr wrote: "added fuzzy java "parser" v4 examples page hi, check out bottom of page fuzzy java parser uses lexical rules grab items of interest: http://www.antlr.org/wiki/display/antlr4/examples ter" but page "404" , cannot find grammar. has copy? or pointer fuzzy or error-recovery java grammar?

How to create XSLT stylesheet from input and output XML files -

i'm finding hard create xslt stylesheet following input , output files. input xml: <documentmanagement> <document> <docuniqueid>medtypeabc1234140204132332932cl</docuniqueid> <patientid>abc1234</patientid> <creationdate>03 feb 2014</creationdate> <documentclass>clinical letters</documentclass> <mimetype>application/msword</mimetype> <metadata> <fieldname>original document creation date</fieldname> <value>03 feb 2014</value> </metadata> <metadata> <fieldname>subject</fieldname> <value>neurology</value> </metadata> <metadata> <fieldname>description</fieldname> <value>neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit</value> </metadata> <metadata>

python - tuple error while cropping -

i crop image using command. def imgcrop(im): box = (0, 150, 640, 200) region = im.crop(box) region.save('crop.jpg') return region then error come out this attributeerror: 'tuple' object has no attribute 'crop' and im refering http://effbot.org/imagingbook/image.htm , method correct. please advise. here full program, please advise import cv2 cv2 import * pil import image import rpi.gpio gpio import time im = 0 gpio.setwarnings(false) gpio.setmode(gpio.bcm) gpio.setup(27, gpio.out) #input 1 gpio.setup(22, gpio.out) #input 2 gpio.setup(9, gpio.out) #input 3 gpio.setup(10, gpio.out) #input 4 gpio.setup(7, gpio.out) #enable 1 gpio.setup(8, gpio.out) #enable 2 gpio.setup(15, gpio.in) #turn right gpio.setup(18, gpio.in) #turn left gpio.setup(23, gpio.in) #backward gpio.setup(24, gpio.in) #forward p = gpio.pwm(7,50) q = gpio.pwm(8,50) p.star

vb.net - How to split textbox value then display splitted value on label -

how split text box (delimited "-") value display split values on 2 labels? heres code: dim s string dim substring string dim sp() string s = txttime1.text 'this text box contains value (08:00-17:41) sp = s.split("-") each substring in sp txttimein.text = substring txttimeout.text = substring next my problem txttimein , txttimeout displays value '17:41'. thank in advance. try this: dim s string dim substring string dim sp() string s = txttime1.text 'this text box contains value (08:00-17:41) sp = s.split("-") txttimein.text = sp(0) txttimeout.text = sp(1)

java - Gradle project in Android Studio not importing libraries -

so downloaded template http://www.androidbootstrap.com/ , able compile , deploy after changing few things. however, there errors in every java , layout file. of libraries showing red underlines in imports section , of functions doing same. it's not able find functions when i'm editing, when building seems fine. can fix this? none of these solutions helped me solve problem. ended creating new project , giving on android bootstrap because never work. things ensure gradle behaves well: updated android studio via menu. latest version downloaded google 0.4.2, , able upgrade 0.4.4. created new project, without fluff. made sure build project , deploy. when added libraries, such androidannotations, added them second level gradle.build file , went tools-->refresh project gradle . made sure project built. important because project won't import library until refresh project gradle. hopefully helps people getting gradle development.

java - Instantiation of InternetAddress cause NPE although check -

guys thought java ignoring check null value, after careful inspection , debugging here's silly code part of huge program. cannot post entire method should point across. public class nullcheck { public static void main(string[] args) { arraylist<string>copied = new arraylist<string>(); copied.add("bg@ascii.com"); copied.add(null); /* built mimemessage msg = new mimemessage(session); */ internetaddress[] copiedpeople = new internetaddress[copied.size()]; (int = 0; < copied.size(); i++) { string reccc = (string)copied.get(i); if ((reccc != null) && (!reccc.equalsignorecase(""))) { try { copiedpeople[i] = new internetaddress((string)copied.get(i)); } catch (addressexception e) { // todo auto-generated catch block e.printstacktrace(); } } } // crash here // msg.addrecipients(message.rec

java - Loading data from cursor crashing onLoadFinished -

in application retrieving contact data using loader. have debugged application , find application crashes on first statement occurs in onloadfinished callback. here code: @override public void onloadfinished(loader<cursor> arg0, cursor arg1) { log.d("loader","load finished"); madapter.changecursor(arg1); phonenumber_enter.setadapter(madapter); } i finding application crashes on first line in callback(in case application crashes when message logged). here logcat: 02-05 21:31:07.357: e/androidruntime(31707): java.lang.runtimeexception: error occured while executing doinbackground() 02-05 21:31:07.357: e/androidruntime(31707): @ android.support.v4.content.modernasynctask$3.done(modernasynctask.java:137) 02-05 21:31:07.357: e/androidruntime(31707): @ java.util.concurrent.futuretask.finishcompletion(futuretask.java:355) 02-05 21:31:07.357: e/androidruntime(31707): @ java.util.concurrent.futuretask.setexception(futuretask.java:222)

mysql - Summing values over multiple, non-related tables? -

i have 3 tables: users, sales , points. each user has multiple sales , multiple points. sales have column "value" , points have column "score", so users = | user_id | name | sales = | sale_id | user_id | value | points = | point_id | user_id | score | now want show listing of users sums of sales , points so user_id | sum(sales.value) | sum(points.value) 1 | 500 | 200 2 | 213 | 132 3 . . . is possible achieve in 1 query, without using subqueries? or best, simpliest approach? i'm trying simplify as possible because have lots of information related users have show in manner. i tried using left joins when join 2 one-to-many tables in 1 query, sum becomes messed because of repeated rows. tried grouping data think i'm lost. the "right" approach in sql summarize tables before joining them: select u.user_id, sumvalue, sumscore users u left outer join (select user_id, sum(v

gorm - Explain belongsTo in Grails -

from grails belongsto documentation, use of class book { static belongsto = author } what impact of cascading operations on book, when crud operations performed on author? edit: thanks responses, may didn't specify question correctly. know difference between static belongsto [author:author] vs static belongsto = author belongsto helpful if need reference owning object. in case author has many book s. maybe you're using book object , want mention book instance's author . way it. as far crud goes, deleting or updating book not author , deleting author delete book . if don't add belongsto there no cascading saves/updates/deletes, have manually. example: def = new author(name: 'j.k. rawling') a.addtobooks(new book(title: 'harry potter 1')) a.addtobooks(new book(title: 'harry potter 2')) a.save() // saves author , book instances a.delete() // author , both books deleted edit: the op updated questio

javascript - Why can't I chain this series of lodash calls? -

this code: _(gamestate.loot) .pick((value, key) -> key isnt "pickupanimations") .filter ((d) -> _.isarray (d)) .reduce ((sum, d) -> sum.concat (d)) is giving me error: typeerror: 'undefined' not function (evaluating '(function(d) { whereas code works fine: removedanimations = _.pick(gamestate.loot, (value, key) -> key isnt "pickupanimations") removedanimations = _.filter removedanimations, ((d) -> _.isarray (d)) removedanimations = _.reduce removedanimations, ((sum, d) -> sum.concat (d)) removedanimations to me seems these should doing same thing. schema of gamestate.loot looks this: loot: { ttl: 6000 slowblinkwhenttllessthanpercent: 60 fastblinkwhenttllessthanpercent: 30 resurrections: [] gold: [] health: [] equipment: [] pickupanimations: [] } btw, javascript being generated first example: return _(gamestate.loot).pick(function(value, key) { return key !== "pickupanimation

java - JPA, HIBERNATE strange error -

i dont know why im getting error, tryed lot of different persistence.xml configs on internet, error never change... and in classpath have .jars required folder hibernate download ( http://hibernate.org/orm/ ) , downloaded validator, have in webcontent/web-inf/libs , hibernate.xml in src/meta-inf.... what can be? error: fev 06, 2014 1:38:49 org.hibernate.ejb.hibernatepersistence logdeprecation warn: hhh015016: encountered deprecated javax.persistence.spi.persistenceprovider [org.hibernate.ejb.hibernatepersistence]; use [org.hibernate.jpa.hibernatepersistenceprovider] instead. fev 06, 2014 1:38:49 org.hibernate.ejb.hibernatepersistence logdeprecation warn: hhh015016: encountered deprecated javax.persistence.spi.persistenceprovider [org.hibernate.ejb.hibernatepersistence]; use [org.hibernate.jpa.hibernatepersistenceprovider] instead. fev 06, 2014 1:38:49 org.hibernate.ejb.hibernatepersistence logdeprecation warn: hhh015016: encountered deprecated javax.persistence.spi.persiste

c# - Display random number and sorting -

i hitting wall here, fellow people. there way can generate random numbers, , indicate them if positive or negative? i tried using if statement, know once hits if doesn't go else . please keep code simple in such way person understand what's going on or @ least indicate what's going on in code. how can fix mistake? random rnd = new random(); console.writeline("\n5 random integers -100 100:"); (int x = 1; x <= 5; x++) { if (x >= 0) { console.writeline("these positive numbers: {0}", rnd.next(0, 100)); } else { console.writeline("these negative numbers: {0}", rnd.next(-100, 0)); } } console.readline(); try following code... don't compare x; have compare random number. random rnd = new random(); console.writeline("\n5 random integers -100 100:"); (int x = 1; x <= 5; x++) { int y = rnd.next(-100, 100); if (y >= 0) { console.writeline("

php - Adding MySQL Queries -

i have been instructed update following tables in osticket mysql follows: update database [please edit fit installation] following mysql queries: alter table ost_ticket change status status enum('open','closed','pending') default 'open'; alter table ost_ticket_event change state state enum('created','closed','reopened','assigned','transferred','o how using phpmyadmin ? click on sql tab, paste it, , submit last sql command cut off atleast hope was

c# - How to implement the paging functionality using pagination control in mvc3? -

i implemented paging in mvc3 aspx pages using normal hyperlink control.but if more pages ex:200 pages ,it's occupying space , looks not good.so,i need change or design paging below. prev 1 2 3 4 5 … 90 next please tell me how implement paging functionality above in mvc3 pages ? let me know samples on paging implemenation above. thanks, try mvc pager . there examples , demos on site.

python - refrencing certain values in a list -

i have following json: [ { "name": "person 1", "phones": { "home": [ "000-111-2222", "333-444-5555" ], "cell": "666-777-8888" } }, { "phones": { "home": "123-456-7890" }, "name": "person 2" } ] if load file using open, saves file type list. have seen using open with, json object load type dict json array load type list. def get_json(): file_name = raw_input("enter name of json file: ") open(file_name) json_file: json_data = json.load(json_file) return json_data i'm trying figure out how access parts of file, such after loading json if wanted print line: "name": "person 1", saving json "list1" , calling print first element in list1 (p

sql - openoffice base won't let me select more than 3 columns -

so following query works fine me: select distinct stno,haulno,catcatchwgt hl speccode='126436'; but, when try add column selection, so: select distinct stno,haulno,year,catcatchwgt hl speccode='126436'; suddenly, errors. specifically, when open details get: hy000 error code 1000 syntax error, unexpected $end, expecting between or in or sql_token_like however, when go w3 schools sql website , try query 4 columns ( http://www.w3schools.com/sql/trysql.asp?filename=trysql_select_all ), works fine. openoffice base hate when try query many columns? have special in openoffice? or forgetting key concept?

qt - How to access stuff in one function from another, called from third in c++ -

i have code: void forms::login() { loginform *loginform = new loginform; loginform->show(); } void forms::startgame() { worldform *worldform = new worldform; worldform->show(); loginform->hide(); } so, trying tie logics 1 separate file, logics.cpp. first using regular functions, couldn't access loginform startgame (cause cannot add .h file, crashes program, don't ask why - qt stuff. these types qwidgets). need is: how add declaration of worldform & loginform root of class forms (or header file), cannot this. the final goal call startgame() (or, in case, forms::startgame() static function) class in file, , startgame() should able hide loginform, seemed above. i can't this: void forms::world(int a) { worldform *worldform = new worldform; if(a==0) { worldform->show(); }else{ worldform->hide(); } } because need worldform created once, , create lots of instances 1 each call. here's

java - Symja Jar Algebra -

i using symja-0.0.7a.jar algebra expression evaluation. working in standalone java application. when run in server using tomcat , eclipse, following error... workingexp: (4p * 2) + (8q * 2) java.lang.reflect.invocationtargetexception @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:57) @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) @ java.lang.reflect.method.invoke(method.java:601) @ core.markans.doget(markans.java:53) @ core.markans.dopost(markans.java:76) @ javax.servlet.http.httpservlet.service(httpservlet.java:641) @ javax.servlet.http.httpservlet.service(httpservlet.java:722) @ org.apache.catalina.core.applicationfilterchain.internaldofilter(applicationfilterchain.java:305) @ org.apache.catalina.core.applicationfilterchain.dofilter(applicationfilterchain.java:210) @ org.apache.catalina.core.standardwrapp

php - Unable to retrieve values from checkbox array -

i have multiple checkboxes(array) codes below: <div class="checkbox"> <label><input type="checkbox" name="major[]" value="business" /> business</label> </div> <div class="checkbox"> <label><input type="checkbox" name="major[]" value="public affairs / law" />public affairs / law</label> </div> <div class="checkbox"> <label><input type="checkbox" name="major[]" value="medicine" />medicine</label> </div> <div class="checkbox"> <label><

sql server - Microsoft Data Platform Competency Spatial Data Types Failing -

i attempting pass the sql server 2012 platform ready tests. i have selected "spatial data" 1 of tests. sql database contains geography data type field. have app inserting multiple records table, , reading them out (including dbgeography records). when run microsoft platform ready test tool v4.1 , go through steps, fails spatial test stating: no records geography data type found or records count found less 2. test status: fail test case/verification: tc 11.1 - geography data type present , record count greater 1 given table in sql instance? as have geography field, , populated multiple records, not understand why failing. create table blah { field1..., [incidentlocation] [geography] not null, } any suggestions how pass? to resolve issues believe test should passing, contact mpr support providing application id. odds grant waiver passing test you.

c# - How to get server element id on click event in asp.net? -

i have server elements: <custom:menuitem id="buttonadd" onclick="button_click" runat="server"/> <custom:menuitem id="buttondelete" onclick="button_click" runat="server"/> i created method "click" event: protected void button_click(object sender, eventargs eventargs) { /*solution of problem*/ } i want element id clicked in method. protected void button_click(object sender, eventargs eventargs) { var menuitem = sender menuitem; if(menuitem!=null) { var prop = menuitem./*any property want here*/ } }

rstudio - Unable to install package shiny on R 3.0.2 -

i using win64 , unable install 'shiny' package on r. when trying install, following message populated. can please put me in right track or missing stupid here? > install.packages("shiny") installing package ‘c:/users/ayan/documents/r/win-library/3.0’ (as ‘lib’ unspecified) --- please select cran mirror use in session --- warning: unable access index repository http://ftp.iitm.ac.in/cran/bin/windows/contrib/3.0 warning: unable access index repository http://www.stats.ox.ac.uk/pub/rwin/bin/windows/contrib/3.0 warning messages: 1: in open.connection(con, "r") : unable resolve 'cran.r-project.org' 2: package ‘shiny’ not available (for r version 3.0.2) i tried using india, cloud(0) cran mirror contents of ui.r file: library(shiny) # define ui application plots random distributions shinyui(pagewithsidebar( # application title headerpanel("hello shiny!"), # sidebar slider input number of observations sidebarpanel( slide

apigee - What is the request timeout for management api from Devconnect -

is there recommended value request timeout management api of apigee edge when using devconnect.? depends on 2 factors user experience particular use case network latency between frontend ( devconnect server) , backend (management server) my personal favorite 20 seconds workable web interface.

paperclip 4 and ruby on rails 4 problems -

i'm learning rails4 , want create album management app i choose paperclip this. but failed upload image , me? photo controller - upload method receive post upload_test method class photoscontroller < applicationcontroller before_action :set_photo, only: [:show, :edit, :update, :destroy] # /photos # /photos.json def index @photos = photo.all end # /photos/1 # /photos/1.json def show end # /photos/new def new @photo = photo.create end # /photos/1/edit def edit end def upload @photo = photo.create(photo_params) @photo.album_id = params[:album_id] @photo.avatar = params[:avatar] if @photo.save render text: "1" else render text: "0" end end def upload_test @photo = photo.create end # post /photos # post /photos.json def create @photo = photo.create(photo_params) respond_to |format| if @photo.save format.html { redirect_to @photo, n

devenv.exe execute through jenkin's job doesn't work -

i trying execute devenv.exe through windows batch command plugin in jenkins keeps on executing , fails launch application. console output : **in progressconsole output started user anonymous building on master in workspace c:\program files (x86)\jenkins\jobs\temp\workspace [workspace] $ cmd /c call c:\windows\temp\hudson3900292017086958332.bat c:\program files (x86)\jenkins\jobs\temp\workspace>set devpath=c:\program files (x86)\microsoft visual studio 10.0\common7\ide c:\program files (x86)\jenkins\jobs\temp\workspace>set path=d:\app\nazopay\product\11.2.0\dbhome_1\bin;d:\app\nazopay\product\11.2.0\client_1;c:\program files (x86)\integrity\integrityclient10\bin;c:\windows\system32;c:\windows;c:\windows\system32\wbem;c:\windows\system32\windowspowershell\v1.0\;c:\windows\cde\tools;c:\program files\tortoisesvn\bin;c:\program files\java\jdk1.6.0_23\bin\;c:\program files (x86)\google\chrome\application;c:\mingw;c:\progra~2\integr~1\toolkit\mksnt;%java_home%;,;c:\program fil

Not able to install packages in R with install.packages() -

i have installed r version 3.0.2. trying run association analysis on dataset. while trying install arules package, using code: install.packages(“arules”) i , error: error: unexpected input in "install.packages(“arules") can guide how can install package , use run association on imported txt file using r? you appear using "smartquotes" instead of straight quotes " around arules . r cannot recognize these. change straight quotes , should work.

javascript - Bad quality for 100% both width and height of canvas -

Image
i have done tiny example canvas, it's available on jsfiddle : http://jsfiddle.net/yptr5/ <!doctype html> <html> <head> <title></title> <style type="text/css"> html, body { width: 100%; height: 100%; margin: 0px; padding: 0px; } #mycanvas { width: 100%; height: 100%; display: block; } </style> </head> <body> <canvas id="mycanvas"> browser not support html5 canvas tag. </canvas> <script> var canvas = document.getelementbyid( "mycanvas" ); var context = canvas.getcontext( "2d" ); context.id = "mycontext"; context.beginpath(); context.arc( 95, 50, 40, 0, 2 * math.pi ); context.stroke(); settimeout( function() { var rectwidt

makefile - Compiling gnuradio on Raspberry pi using distcc -

i want compile gnuradio on raspberry pi fresh copy of raspbian wheezy. have setup of distcc i7 offload work rpi. works simple test file when use $gcc -c hello.c i can see task done in log of other computer. but, when want build gnuradio , invoke 'make' command, distcc doesn't produce output in verbose mode. trying $distcc make produces this: distcc[5464] (dcc_scan_args) compiler apparently called not compile and continues building on localhost. is there way around ? do have $distcc_hosts set in shell you're calling make from? have specified -j multiple jobs? result of which gcc , echo $cc ? if follow directions here can see gcc, cc, etc. symlinked /usr/local/bin references /usr/bin/distcc, added beginning of path make find first. it can helpful export distcc_verbose=1 provide more output. there's more thorough documentation on this rpi stackexchange answer .

javascript - Typo3 and changing CSS values with jQuery -

i've got problem website. i've got 2 divs, in left 1 main content of page , in right div texts. when there content in 1 of divs height bigger other div. tried make css value equal, didn't work @ all. have doublechecked everything, code, file directory etc. still don't see mistake. that's typoscript code include jquery , js-file: # jquery includejslibs.jquery.external = 1 includejslibs.jquery = http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js # javascript includejs.file1 = fileadmin/script.js and that's js-file (script.js): $(document).ready(function() { var contentheight = $(#content).css(["height"]); var sidebarheight = $(#sidebar).css(["height"]); if (contentheight > sidebarheight) { $(#sidebar).height(contentheight - 110); } else { $(#content).height(sidebarheight + 110); } }); edit: forgot css code: #content { position: relative; background-col