Posts

Showing posts from March, 2014

DSpace CRIS build failure -

i trying deploy dspace cris ver 5.x. after following guidelines provided on dspace cris wiki, getting message of build failure. after referring 1 of solution provided in forum, tried download maven dependencies in off-line mode. getting failed in between. request deploying , checking dspace cris. it looks have used "unstable" master branch build dspace-cris. reccomended branch (currently) dspace-cris-5.x.x https://github.com/cineca/dspace/tree/dspace-5_x_x-cris when new version of platform released new dspace--cris branch created maintenance , collaborative development created too. the dspace-cris-master branch make experiments when possible on unreleased version of dspace.

python - Entry widget contents not changing with function call -

i need change content of entry whenever tkinter frame shown. below have far, , doesn't seem work. have tried use data = self.read() , now.insert(0, data) , has not worked either. if value displayed doesn't changed every time class readlabel1 called. class readlabel1(tk.frame): def __init__(self, parent, controller): tk.frame.__init__(self, parent, bg="blue") label = tk.label(self, text="somedata:", font = "times 12", bg="blue") label.place(x=10, y=100) #ack(pady=5,padx=30) self.smstr = tk.stringvar() now=tk.entry(self, width=22, textvariable=self.read()) now.place(x=120, y=103) def read(self): # code data return data you need turn 'change content of entry' 1 parameter callback, turn 'whenever tkinter frame shown' event, , bind app, event, , callback. here minimal example. import time import tkinter tk root = tk.tk() = tk.string

javascript - function inside page not working correctly after using load() jquery -

im using jquery tab example have index.php <div id="content"></div> and custom.js : load page.php only after navigation click , default #content blank $(function() { $('#tabs').tabs(); }); // clicked event below $('#content').load(page.php) // load when clicked page.php : page.php load tabs inside page not displaying correctly , function not working because im using .load() <div id="tabs"> tabs data etc.. </div> so question is: 1. there way reload custom.js(file) after using .load() function? or 2. there way without writing bunch of jquery code script tag on page.php? or 3. there better way doing this? you trigger event in load callback , listen in document ready. $(function(){ $(document).on('contentsloadedevent', function(){ $('#tabs').tabs(); }); }); $('#contents').load('http://localhost/page.php', function() { $(document).trigger($.even

ios - Increasing an integer upon collision with an object. Swift -

i have code creates , prints score game, want score increase upon collision object. , despite best efforts, cannot seen figure out how it. this code deals score: import spritekit public class score { public let label = sklabelnode(fontnamed: "chalkduster") private var currentscore = 0 public func setup (fontsize: cgfloat, x: cgfloat, y: cgfloat) { label.fontsize = fontsize label.position.x = x label.position.y = y setscore(currentscore) } public func setscore(value: int) { currentscore = value label.text = string(currentscore) } public func incrementscore(value: int) { setscore(currentscore + value) } }

html - Div Style Display Property not working properly ? Wordpress theme -

orking on wordpress fart theme . trying disable 1 of 3 div new css , wordpress. i showing html code clear, <div id="footer-cols-inner"> <div class="col3a"> <h2 class="footer-title">footer col widget 1</h2> <div class="footer-after-title"/> <div class="textwidget">this first footer widget area. customize it, please navigate admin panel -> appearance -> widgets , add widgets footer column #1.</div> </div> <div class="col3b"> <h2 class="footer-title">footer col widget 2</h2> <div class="footer-after-title"/> <div class="textwidget">this second footer widget area. customize it, please navigate admin panel -> appearance -> widgets , add widgets footer column #2.</div> </div> <div class="col3c"> <div class="clear"/> </div> in html trying apply display none

Android Youtube API thumbnail crash -

when initialize youtubethumbnailview, found exception my code : youtubethumbnailview.initialize(api_key, new youtubethumbnailview.oninitializedlistener() { @override public void oninitializationsuccess(youtubethumbnailview youtubethumbnailview, youtubethumbnailloader thumbnailloader) { } @override public void oninitializationfailure(youtubethumbnailview youtubethumbnailview, youtubeinitializationresult youtubeinitializationresult) { } }); exception: java.lang.illegalstateexception: not connected. call connect() , wait onconnected() called. @ com.google.android.youtube.player.internal.r.i(unknown source) @ com.google.android.youtube.player.internal.o.k(unknown source) @ com.google.android.youtube.player.internal.o.a(unknown source) @ com.google.android.youtube.player.internal.p.<init>(unknown source) @

r - How to acces the same datafile from to different DigitalOcean servers? -

the title more or less says - how acces same rdata file, different digitalocean droplets? your question quite vague, can offer generic advice. in general, rdata file (created using save ) needs physically transported each node used. if using multiple droplets (servers), have central node cut data in pieces, , send each of droplets piece of data process. alternatively, put data in database accessible via internet. then, each droplet told needs read.

ruby - Truncate only older posts in rails -

i have simple block here truncates posts on index.html.erb. want not truncate recent post @ top truncate rest below bulk of page recent post. know easy fix can't seem figure out. appreciated. thanks. </div> <% @posts.each |post| %> <h2 class="title"><%= link_to post.title, post %></h2> <p><%= truncate(post.body, :length => 300) %></p> <p class="date"><%= post.created_at.strftime("%b, %d, %y") %></p> <% end %> </div> try this <div> <% @posts.each_with_index |post, index| %> <h2 class="title"><%= link_to post.title, post %></h2> <p><%= index.zero? ? post.body : truncate(post.body, length: 300) %></p> <p class="date"><%= post.created_at.strftime("%b, %d, %y") %></p> <% end %> </div>

math - Rotation and Transformation of a plane to XY plane and origin in PointCloud -

i have point cloud known contain floor. oriented in unknown direction , not @ origin (0,0,0). have to move floor_plane xy plane, floor_plane lies on xy plane move centroid of floor_plane origin (0,0,0) . my approach above is: get plane coefficients of floor_plane ransac. first 3 coefficients correspond floor_plane 's normal. generate normal vector xy plane. x=0,y=0 , z=1. calculate cross product of normal of ground plane , normal of xy plane rotation vector (axis) unit vector. calculate rotation angle. angle between planes equal angle between normals. definition of dot product, can extract angle between 2 normal vectors. in case of xy plane, equal theta=acos(c/sqrt(a^2+b^2+c^2) a, b, c first 3 coefficients of floor_plane . generate rotation matrix (3x3) or quaternion. formula in wikipedia. find centroid of floor_plane . negate them generate translation apply transformation transformpointcloud(cloud,transformed,transformationmatrix) my code using pointc

Calling angular directive from meteor isn't working -

i trying call angular directive meteor display intuit button. have tried using quickbook button directly in meteor, didn't work did not allow me display button in area of choice. hence route . the directive defined in js file in following way if (meteor.isclient) { console.log("yes client"); angular.module('connectintuitangular',['angular-meteor']) .directive('connecttoquickbooks', function($window){ return { restrict: 'e', template: '<ipp:connecttointuit></ipp:connecttointuit>', link: function(scope) { var script = $window.document.createelement("script"); script.type = "text/javascript"; script.src = "https://appcenter.intuit.com/content/ia/intuit.ipp.anywhere-1.3.3.js"; script.onload = function () { console.log("on load called"); s

html table - Angularjs double ng-repeat data shown from back to front, Why? -

i have 2 confused points in code, first one, html: <table class="table table-hover" my-element="docu"> i used double ng-repeat, data shown front. how fix this? angularjs file: this data: $scope.people = [ {'name':1,'des':'nice','age':12}, {'name':2,'des':'good','age':13} ]; .......... .directive('myelement', function () { return { scope: { items: '=myelement' }, restrict: 'eac', template: '<tr ng-repeat="item in items" ><td ng-repeat="p in item">{{p}}</td></tr>' }; }); the result: 12 nice 1 13 2 the result should this: 1 nice 12 3 13 second one, i used ng-if check data's length, if there's no data, table's body shown "upload file". sentence shows table head. don't know why. how fix this? html: <tbody my-elemen

how to cut a string in C -

i have document telephone number , andresses. try copy numbers in 1 part of struct , adress another. @ moment able data of document can't put in struct please me c code #define _crt_secure_no_warnings #include <stdio.h> #include <string.h> struct telefon{ char nummer[16]; char adresse[128]; }; typedef struct telefon telefon; void main() { telefon tel; char buffer[256]; file *fp; int = 0; int countsemi = 0; fp = fopen("telefondatei.txt", "r"); if(fp == null) { printf("datei konnte nicht geoeffnet werden.\n"); } else{ while(fgets(buffer,1000,fp) != 0){ //printf("%s\n",buffer); while(buffer != 0){ i++; if(buffer[i] == ';'){ countsemi++; } while(countsemi <= 7){ strcpy(tel.adresse,buffer); printf(&quo

Transforming vertical Data to a horizontal format in R -

this conceptual question. have data in sql express database loading r via odbc package. data format is: name, symbol, number of days 1/1/2015, closing price. the main company, tmc, 1, 12 xyz company, xyz, 1, 233 1 company, toc, 1, 56 2 company, ttc, 1, 88 main company,tmc, 2, 11.5 xyz company, xyz, 2, 232 1 company, toc, 2, 59 2 company, ttc, 2, 89 my question is: there r package can transform data being in vertical format horizontal? ie name, symbol, price lag1 , price lag2 the main company, tmc, 12, 11.5 xyz company, xyz, 233, 232 1 company, toc, 56,59 2 company, ttc, 88,89 or should try sql code? we use dcast reshape2 or spread tidyr . before reshaping, may better change lengthy column names spaces no space column names. specify value column in value.var in dcast . library(reshape2) colnames(df1)[3:4] <- c('numberofdays', 'closing_price') dcast(df1, name+symbol~paste0('lag', numberofdays), value.var=

How to receive files with python IRC bot? -

i've created semi-functional irc bot in python following sample code: import socket import time import random import os def stringtobytes(s): blit = "" char in s: blit += char return bytes(blit, "utf-8") server = "irc.irchighway.net" # settings channel = "#ebooks" botnick = "noobbot" irc = socket.socket(socket.af_inet, socket.sock_stream) # defines socket irc.connect((server, 6667)) # connects server irc.send(stringtobytes("user " + botnick + " " + botnick + " " + botnick + " :this fun bot!\n")) # user authentication irc.send(stringtobytes("nick " + botnick + "\n")) # sets nick irc.send(stringtobytes("privmsg nickserv :inoope\r\n")) # auth time.sleep(4) irc.send(stringtobytes("join " + channel + "\n")) # join channel irc.send(stringtobytes("privmsg #ebooks @search save cat\r\n")) while 1: # puts

Assembly data types limits and examples -

i'm taking assembly language class , book gives me list of data types: byte - 8 bit unsigned integer sbyte - 8 bit signed integer word - 16 bit unsigned integer sword - 16 bit signed integer dword - 32 bit unsigned integer sdword - 32 bit signed integer fword - 48 bit integer qword - 64 bit integer tbyte - 80 bit (10 byte) integer real4 - 32 bit (4 byte) short real real8 - 64 bit (8 byte) long real real10 - 80 bit (10 byte) extended real just title says, i'm hoping information on upper/lower limits of each of these data types, , maybe examples. limit of unsigned type: 0 2^bit_count - 1 limit of signed type: -(2^(bit_count-1)) (2^(bit_count-1))-1 for example, unsigned byte's limit is: 0 255 and signed word's limit is: -32768 32767 i'm not entirely sure real numbers are, assumption floating point numbers. for more info, see here .

asynchronous - Clojure RethinkDB subscribe to a changefeed -

i using clojure driver rethinkdb . want change feeds query. here have far : (defn change-feed [conn] (loop [changes (future (-> (r/db "mydb") (r/table "mytable") r/changes (r/run conn)))] (println "date : " ((comp :name :newval) first @changes)) ;;prints nil (recur (rest changes)))) it blocks in repl when called (which normal). add data using rethinkdb interface. prints nil , following error : illegalargumentexception don't know how create iseq from: clojure.core$future_call$reify__6736 clojure.lang.rt.seqfrom (rt.java:528) what doing wrong ? able : take items future know how many items can take @ once (if several waiting) note : plan use manifold manipulate result in end, solution using fine. i don't think need future block there, cursor returned clj-rethinkdb library block until it's ready. you use doseq inst

ruby - I can't seem to generate a migration for my rails app, how do I get past this error? -

a:/dev/web/private_app/config/initializers/simple_form.rb:2:in`<top (required)>': uninitialized constant simpleform (nameerr or) e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:648:in `block in load_config_initializ er' e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/activesupport-4.1.8/lib/active_support/notifications.rb:161:in `instrumen t' e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:647:in `load_config_initializer' e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:612:in `block (2 levels) in <class:eng ine>' e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:611:in `each' e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/lib/rails/engine.rb:611:in `block in <class:engine>' e:/dev/rails/ruby2.1.0/lib/ruby/gems/2.1.0/gems/railties-4.1.8/li

Java Runtime OR Processbuilder OR Other -

i'd know best alternative running command line executables java. target platforms commands windows 7(+) , unix/linux. i have class uses runtime.exec() along enhancements javaworld streamgobbler article. works 90% of time on both windows , unix. other 10% of time need extend class , fiddle putting cmd.exe of /bin/sh in front of command. i've had fiddle between using single string has command , arguments splitting command , args string[] array. my latest new error/exception "java.lang.illegalargumentexception: executable name has embedded quote, split arguments." current runtime.exec() class works fine in eclipse running java application, once build , run command prompt, fails above exception. so i'm reading should using processbuilder command line executables os platform. my question is, best alternative? runtime.exec(), processbuilder, or other option? there 1 option service both windows , unix/linux? if not, 1 works best windows? 1 works best

javascript - bug in content warning page -

i'm helping friend little debugging site, i'm not familiar php though use help. if (has_nav_menu('header menu')) { ht_header_menu_wp_nav(); // header menu }else{ echo '<nav id="header-menu">'; echo '<ul>'; ht_no_wp_nav_notice(); echo '</ul>'; echo '</nav>'; } ht_top_social_media(); ht_top_search_from(); $url=$_server['http_referer']; $server=$_server['http_referer']; $str=strstr($url,'www.sample.com'); if($str==""){ ?> <script> $( document ).ready(function() { $("#popup").show(); $("#warningpop").show(); }); </script> <?php } it's code content warning page, meaning in first time enter page: popup , warningpop shown, second time when press enter button http_refer should address of site , not show popup , warningpop. thing when press enter see popup , warningpop can't access content of sit

php - Move main site into subfolder (htaccess) -

need organize several sites in 1 hosting account, putting each own folder. via cpanel, completed , working add-on domains, main site (with subfolders) needs in own folder. i have been doing via php: example.com/index.php : <?php header('location: subdir/mainsite/index.php'); ?> the down side there page flash site redirects. another downside url reflects new location in address bar: http://example.com/subdir/mainsite/ i want visitors see http://example.com i suspect can resolved using htaccess instead of php. so, if domain is: http://example.com and place main site files in: public_html/_sub/mainsite and add-on sites must continue work... what htaccess like? this have far: rewriteengine on rewritecond %{http_host} ^(www.)?example.com$ rewritecond %{request_uri} !^/_sub/mainsite/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ /_sub/mainsite/$1 rewritecond %{http_host} ^(www.)?example.com$

python - Could not find a version that satisfies the requirement <package> -

i'm installing several python packages in ubuntu 12.04 using following requirements.txt file: numpy>=1.8.2,<2.0.0 matplotlib>=1.3.1,<2.0.0 scipy>=0.14.0,<1.0.0 astroml>=0.2,<1.0 scikit-learn>=0.14.1,<1.0.0 rpy2>=2.4.3,<3.0.0 and these 2 commands: $ pip install --download=/tmp -r requirements.txt $ pip install --user --no-index --find-links=/tmp -r requirements.txt (the first 1 downloads packages , second 1 installs them). the process stopped error: not find version satisfies requirement <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) (from versions: ) no matching distribution found <package> (from matplotlib<2.0.0,>=1.3.1->-r requirements.txt (line 2)) which fix manually with: pip install --user <package> and run second pip install command again. but works that particular package. when run second pip install command again, process stopped complaining another

oop - Trying to Increment a variable on its inheritance python -

hi there new oop , python, trying increment user id variable child class, when create instance of parent class using inheritance doesn't seem recognise id variable parent class. example here class user: _id = 0 def __init__(self, name): self.name = name self.id = self._id self.__class__._id += 1 class customer(user): def __init__(self, name): def lastname(self): return "self.name.split()[-1]" if able access class attribute >> chris = user("christopher allan") >> chris.id >> 0 when try run >> andy = customer('andy smith') >> andy.id >> traceback (most recent call last): file "<pyshell#83>", line 1, in <module> andy.id attributeerror: 'customer' object has no attribute 'id' update i completed rest of customer class cause of code not working me, sorry people used pass before briefness of question didn&#

java - JLayeredPane not showing my custom JPanel -

i'm having trouble getting custom panel show using jlayeredpanel. i'm trying create black rectangle on first layer, , on second layer, have custom jpanel slideshow of images. slideshow not display @ all, works when add frame. thoughts? code: import java.awt.color; import java.awt.container; import java.awt.dimension; import java.awt.image; import java.awt.toolkit; import java.util.arraylist; import javax.swing.imageicon; import javax.swing.jframe; import javax.swing.jlayeredpane; import javax.swing.jpanel; public class gui extends jframe { private container pane; private jpanel emptyslideshow; private jlayeredpane layeredpane; public gui(){ this.setvisible(true); dimension screensize = toolkit.getdefaulttoolkit().getscreensize(); this.setbounds(0,0,screensize.width, screensize.height); // //set content pane // pane = this.getcontentpane(); //get content pane place components // pane.

objective c - Using an Objecitve C .dylib in a Swift Project -

i trying integrate api eye tracking device app writing in swift. api xcode project designed dylib wraps c++ project same thing. git api can found here: https://github.com/eyetribe/tet-objectivec-client after few tweaks of linking flags, able project compile. however, lost how can use .dylib in swift project. have tried adding "link binary libraries" list, adding bridging header file include public header file original project, etc. i'm pretty stuck on , wondering doing wrong. tried adding cocoa framework target objective c project although project build, actual framework file blank (i added .m files compile sources , headers headers section).

matlab: splitting small arrays by latitude/longitude into individual grid cells of one large array -

i have multiple satellite orbit paths cover different latitudes/longitudes, bounded same overall lat/lon grid (below). trying split data each orbit path corresponding 0.5x0.5 o lat/lon cell of large grid. for example, i'm looking @ individual satellite orbits cross beaufort sea, total lat/lon boundary below: lat = [82:-0.5:68]; lon = [-118:-0.5:-160]; i have 88 orbit files cover different tracks on beaufort sea. latitude, longitude, , data each orbit track stored in separate cells. example 1 orbit path: lat{16,1} = [68.751 68.749 68.746 68.743 68.740 68.738 68.735 68.732 68.729 68.726]; lon{16,1} = [-118.002 -118.006 -118.009 -118.013 -118.016 -118.020 -118.023 -118.027 -118.030 -118.034]; data{16,1} = [0 0 0 0 0 1 0 0 0 0; 0 0 0 0 1 1 1 1 1 0; 0 0 0 1 1 1 0 0 0 0]; % data stored in height x location % each 1 cloud, each 0 clear air each data array different length because each orbit path crossed different number of locations, has same number of h

shell - automate email validation using telnet -

i'm trying use following script validate if email address exists: telnet gmail-smtp-in.l.google.com 25 helo example.com mail from: <me@example.com> rcpt to: <somenonexistinguser@gmail.com> how automate process since have list of emails addresses need validated? need determine it's valid or not based on return value (550 or 220) , quit move next email address. smtp-quirks greet-delays , multi-line smtp replies difficult automate using telnet. suggest use rfc-compliant smtp library in programming language of choice, example python's smtplib . remember there more return codes 550 , 220 need handle well. example 4xx codes happen quite (greylisting, overquota, ...) note however, not reliable way validate email address. many servers accept address in hosted domains during smtp stage , bounce them afterwards. also, these kinds of smtp-probes considered abusive postmasters , can lead blacklistings.

how eclipse recognize *.xml.vm as xml extension? -

difference this make eclipse recognize unknown file extension xml i have velocity files based on xml, want open them xml file. in window -> preferences -> general -> editor -> file associations i cannot add *.xml.vm file types tab, how solve this? .xml.vm isn't valid filename extension. .vm be. , use content types preference page, not file associations , faq says.

MySQLi Update data in a table -

please me out this. update existing table (chem_users) data using 2 keys userid & password (or 1 primary key allowed?). using mysqli, wrong syntax. $sql = "update chem_users set (prj1, prj2) values ('{$_post['kinetics']}', '{$_post['thermo']}') (userid=johnking password=1234rewq)"; i got error: error saving user data have error in sql syntax; check manual corresponds mysql server version right syntax use near '(prj1, prj2) values ('kinetics' @ line 1 try using syntax: $sql="update `chem_users` set `prj1`=".$_post['kinetics'].",`prj2`=".$_post['thermo']." `userid`='johnking' , `password`='1234rewq'"; by way, shouldn't concatenate variable inside query doing,you should use prepared statements.you can learn little bit in link: http://www.w3schools.com/php/php_mysql_prepared_statements.asp

How to secure app.php encryption key? (Laravel 5) -

according this , laravel supports encryption , decryption of data. works , easy set up, question how secure really? what if encrypted fields in database compromised , app.php file compromised? have access encryption key. is there way can programmatically secure encryption key hackers? this answer helpful, i'm wondering if there specific method laravel apps. appreciated! laravel's encryption strong, uses aes algorithm through mcrypt, known php extension. if encrypted fields , encryption key falls wrong hands you're pretty screwed , there's nothing it. fortunately, there ways secure key. first of all, don't ever put key inside app.php file. laravel 5 makes easier ever use environments . put key inside .env file , refer inside app.php file. as files lay outside reach of code run through public folder, you're go. if bad intentions finds way ssh or ftp server, approach won't save no 1 else will. i don't know planning on en

visual studio 2015 - Create universal app *.WINMD and *.DLL for distribution i.e. to be referenced like the Universal app API -

i want create winmd file project should work windows.foundation.foundationcontract.winmd in universal app api can reference them instead of building runtime project again , again after setting new development machines. think of releasing *.dll (and other files) 1 can reuse without recompile source. how can set project in visual studio achieve that? note winmd should somehow cross-platform i.e. usable x86 , arm alike. (i sorry not programming-related question. not sure ask such thing.) to put way, how reference output of windows runtime component project (i.e. *.dll , *.winmd , *.lib , *.pdb , ... in debug or release folder) compiled visual studio directly just loading dll , using library via appropriate header files in classical c/c++ without adding windows runtime component project source code solution , "add reference" visual studio automatically recompiles necessary?

ios - How can I segue between two xib files in xamarin? -

Image
i'm new xamarin , i'm working way through app. i'm using mvvmcross. how can segue between 2 views on button click? use storyboard that's simple control+click , drag hook up. second thought like: performsegue(identifier, sender); however, there's no way me set identifier when open xib edit interface. so have 2 xib files, homeview.xib , secondview.xib. 2 c sharp files homeview.cs , secondview.cs. homeview has button , have control+dragged ibaction c sharp , have method buttonpressed() wish segue secondview. partial void buttonpressed (foundation.nsobject sender){ //insert code segue secondview. } thanks :) edit: found piece of code: nsbundle.mainbundle.loadnib("secondview", this, null); which works, segue still preferable looks nicer create 2 segues in storyboard , set different identifier each segue. then use this.performsegue("targetsegueidentifier", this);

c# - SharpDX Toolkit models rendering inside out -

a little while ago decided switch xna sharpdx toolkit actively being supported , quite similar xna. while i've had no trouble @ creating 2d games decided attempt basic 3d game. can both model , it's texture load when renders shows texture on side facing away camera doesn't show @ in between. this code using set environment. vector3 cameraposition = new vector3(0, 0, -10f * 2.5f); vector3 cameratarget = vector3.zero; boundingsphere modelbounds = model.calculatebounds(); float fovangle = mathutil.degreestoradians(45); float aspectratio = (float)graphicsdevice.backbuffer.width / graphicsdevice.backbuffer.height; float near = 0.01f; float far = 100f; float scaling = 10f / modelbounds.radius; matrix translation = matrix.scaling(scaling) * matrix.rotationy((float)gametime.totalgametime.totalseconds) * matrix.translation(0, -modelbounds.center.y * scaling, 0); matrix lookat = matrix.lookatlh(cameraposition, cameratarget, vector3.u

Python barbs wrong direction -

there simple answer , i'm asking last resort answers searching can't figure out or find answer. i'm plotting wind barbs in python pointing in wrong direction , don't know why. data imported file , put lists, found on stackoverflow post how set u, v barbs using np.sin , np.cos, results in correct wind speed direction wrong. i'm plotting simple tephigram or skew-t. # program read in radiosonde data file named "raob.dat" # import numpy since going use numpy arrays , loadtxt # function. import numpy np import matplotlib.pyplot plt # open file reading , store file handle "f" # filename 'raob.dat' f=open('data.dat') # read data file handle f. np.loadtxt() useful reading # simply-formatted text files. datain=np.loadtxt(f) # close file. f.close(); # can copy different columns # pressure, temperature , dewpoint temperature # note colon means consider elements in dimension. # , remember indices start 0 p=datain[:,0] temp=datai

validation - In Grails, how to allow newer DNS in email validator constraint? -

static constraints = { email email:true } this constraint treats test@email.wtf invalid. how allow newer dns '.wtf' valid email? i create customemailvalidator extending org.apache.commons.validator.routines.emailvalidator , using class similar org.codehaus.groovy.grails.validation.routines.domainvalidator additional dns. but there simpler way it? if ok not matching new domains specifically, relax email rules this: static constraints = { email(matches: '^\\w+@[a-za-z_]+?\\.[a-za-z]{2,63}$') }

jquery - Bootstrap Tags Input objects and json -

i trying use boorstrap tag input control located here: http://timschlechter.github.io/bootstrap-tagsinput/examples/ in controller, creating list of selectlistitems: var tags = new list<selectlistitem>(); tags.add(new selectlistitem { value = "1", text = "craig" }); tags.add(new selectlistitem { value = "2", text = "lister" }); model.tags = tags; i pass model, 'tag' a: public ienumerable tags { get; set; } on view, render control: <div class="row"> <div class="col-xs-12"> <label class="control-label text-right">tags:</label> <br /> @html.textboxfor(x=>x.tags, new { @class= "form-control txttags", @data_

How to include output when saving history as notebook in iPython -

i not seem able output included in .ipynb created the %notebook -e tmp.ipynb magic command. when create simple function should produce output, f, can save the %history -o -f history.test magic command, , see output : f = lambda x : x + 2 /f 1 3. however, when try same using above %notebook magic command, following : { "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "f = lambda x : x + 2" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "/f 1" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "%history -o -f history.test" ] } ], "

cocoapods - What's the difference between 'pod spec lint' and 'pod lib lint'? -

cocoapods provides 2 lint commands, spec lint , lib lint . what's exact different between them, , in scenario each used? i read documentation ( spec , lib ), can not find difference between them, , not understand why cocoapods provides 2 command same thing. tl;dr : pod lib lint = local, pod spec lint = local/remote you mentioned had read docs it's still unclear. i'll try make more clear : pod lib lint will lint pod locally, , ensure provided create pod. not enough validate pod, pod spec lint will. pod spec lint will lint pod anywhere. mean can have pod source code on github, example, , lint . if pod spec lint returns without errors, can push linted pod cocoapods.

java - how to create a server that send image from a request images from Glide? -

i'm using glide image loader client. , create own server java. my server's code: file f = new file(imagelocation); try{ bi = imageio.read(f); }catch (exception e){ f = new file(imagelocation); bi = imageio.read(f); } respond = "http/1.1 200 ok\r\n"; respond += "date: " + localdatetime.now() + "\r\n"; respond += "content-type: image/png\r\n"; respond += "content-length: " + f.length() + "\r\n"; respond += "connection: keep-alive\r\n"; respond += "\r\n"; output.write((respond).getbytes()); output.flush(); imageio.write(bi,"jpg",output); output.flush(); i tested browser , work fine, when call using glide android, no image displayed the content-length may co

Remove git mapping in Visual Studio 2015 -

Image
this question has nothing git itself; rather, has removing binding/mapping git repository visual studio 2015 (vs2015) has seen. here's screen shot of problem: notice remove button grayed out (disabled). how can remove entry "local git repositories" list? the solution simpler that. need remove 3 files project unc path. navigate solution's unc path. example: c:\users\your user name\documents\visual studio 2015\projects\your project folder then permanently delete ("shift + del") .git* files , folder. there 2 files , 1 folder, may hidden ensure have folders , search options > view > show hidden files, folder, , drives (radio button) selected. the files permanently delete are: .gitignore (file) .gitattributes (file) .git (folder) reopen visual studio , there no more relationship git source control. if wanted take far removing registry mentioned above, could, shouldn't necessary aside "house keeping&quo

How to create and manage plugins in ASP.NET Core MVC 1.0? -

since asp.net redesigned it's architecture,we totally blank regarding how create plugins , manage on our asp.net mvc 6 applications prior mvc5.we grateful if provide example. orchardcms 2 developing modular application framework asp.net core mvc think still work in progress. 1 watch future. see https://github.com/orchardcms/orchard2/pull/530 code , more information in video: https://channel9.msdn.com/shows/on-net/sbastien-ros-modular-aspnet-apps

How to list files from iOS app document directory using cordova? -

how can see list of files stored in ios app document directory using cordova? if want work device's file system, can use cordova file plugin http://cordova.apache.org/docs/en/2.5.0/cordova_file_file.md.html supports major platforms ios,android, etc.

javascript - How to get select box value in a href tag -

how select box value in href tag php variable? <script type="text/javascript"> $(document).ready(function(){ $("select.id").change(function(){ var selectedid = $(".id option:selected").val(); alert(selectedid); }); }); </script> <label>select id</label> <select class="id"> <option value="">select</option> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="4">5</option> </select> <a href="test.php?id=id">testing</a> code shown below, tested , works 100%, use jquery attr , give id hyperlink, here id "link": <a id="link" href="test.php?id=id">testing</a>

mongodb - How to get values of cursor object by using Python -

i have data in mondodb; db.np_tpy_gla.find({},{"_id":0, "c": 1}) result: { "c" : numberlong(18) } { "c" : numberlong(40) } { "c" : numberlong(42) } { "c" : numberlong(54) } ... i trying these values using python (pymongo). here code: counternumber = cursor.count() gettingtotalsize = cursor.find({"c": true}) print counternumber print gettingtotalsize and here result: 115 <pymongo.cursor.cursor object @ 0x13c7890> i'm tring "gettingtotalsize" values 1 one. how can these values? tried loop. thanks. edit : i changed codes like: gettingtotalsize = cursor.find({}, {"_id": 0, "c": 1}) vignesh kalai'codes: for x in gettingtotalsize : print x here new result : {u'c': 18l} {u'c': 40l} {u'c': 42l} {u'c': 54l} ... now need value (18,40,42,54...) any ideas? :) to iterate on cursor loop on cursor ,

python - Regex for CSV split including multiple double quotes -

Image
i have csv column data containing text. each row separated double quotes " sample text in row similar ( notice : new lines , spaces before each line are intended ) "lorem ipsum dolor sit amet, consectetur adipisicing elit, sed eiusmod tempor incididunt ut labore et dolore magna aliqua. ut ""enim ad"" minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat ""nulla pariatu""" "ex ea commodo consequat. duis aute irure ""dolor in"" reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum." the above represent 2 subsequent rows. i want select separated groups text contained between every first double quote " (startin

c - GDB bit position bit-values -

i'm trying determine address values , sizes using arm .elf output in gdb. usual p& , print functions can determine of addresses , and variable sizes, can't figure out if variable bitvalue or not. to give example: typedef struct { bool_t start; bool_t running :1; bool_t objectpoolusable :1; bool_t ready :1; bool_t test :1; bool_t stop :1; uint8_t defaultmachine; }bitfieldtest; bitfieldtest bitvalues; when asking gdb address of "bitvalues.ready" or "bitvalues.running" return same address (since uses same address), doesn't give me bit position. neither know if bitvalue or boolean taking space of uint8_t. to clarify need do: give gdb single name, might bitvalue, , return me right address , type. if type bitvalue, need find bit position. non-bitvalues works fine, bitvalues causing trouble now. is gdb able give kind of output solve problem? there's no way information directly using gdb expression api. there's

ios - App delegate issues with multiple view controllers -

i created tab bar controller , implemented in app delegate before implemented other view controller.i don't know how use call them orderly.please tell me how make them arrange like. @interface appdelegate () { uinavigationcontroller *navigation; } @property (strong, nonatomic) jasidepanelcontroller *viewcontroller; @property (strong, nonatomic) uitabbarcontroller *this; @end @implementation appdelegate @synthesize viewcontroller = _viewcontroller; - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { // override point customization after application launch. [[uiapplication sharedapplication] setstatusbarstyle:uistatusbarstylelightcontent]; self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; navigation = [[uinavigationcontroller alloc] initwithrootviewcontroller:[[viewcontroller alloc] init]]; self.window.rootviewcontroller = navigation; //uiwindow *window = [[u

graphics - Unity 5 collider is not working -

i have 2 prefabs (a character , wall), attached capsule player , cube wall. both capsule , player, have collider component. problem character walks through wall. need help, please! collider defined without rigidbody component called static collider in unity. if so, unity assumes object never move in scene. on other hand, if object active 1 (moving), need attach rigidbody component in addition collider component. in case, need attach rigidbody character. for more info: http://docs.unity3d.com/manual/collidersoverview.html

java - Splitting a string and extracting specific strings to array -

this question has answer here: how split string in java 28 answers i having string "s".only substrings in single quotes must assigned string array.its may not necessary alternate words in single quotes. string s = "username 'user1' username2 'user2' usermane3 'user3' 'user4'"; it must assigned below (only substrings single quotes ) string username[] ={'user','user1','user2','user4'}; what tried string s1 = s.replace(system.getproperty("line.separator"), " "); //replacing newline single space string username[] = s1.split(" "); //separating string sub-string username[]={username,'user1',username2,'user2',username3, 'user3','user4'}; you split input using delimiter , take

SQL syntax error in MySQL unsing a cast(Partition as Signed) -

i have support application on mysql server. can´t change source code can´t change used syntax. problem syntax error this: microsoft ole db provider odbc drivers [-2147217900] [mysql][odbc 5.1 driver][mysqld-5.6.26]you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'partition signed)' @ line 1 i looked log file , found problem in line: select * xyz `type`='something' , client='{3dbea33a-9f0a-4e86-8354-f652713ea458}' order cast(partition signed); i error when "cast(partition signed)" appears. is there way configure server accept syntax? i´m using mysql (x64) 5.6.26 innodb . partition reserved word. http://dev.mysql.com/doc/refman/5.6/en/keywords.html you should use backticks `partition`

javascript - Failed to execute 'querySelectorAll' on 'Element' in ExtJS 5 -

i trying using ext.dom.query.select method find divs having class name square , highlightedreactangle.same method working extjs 4 , after grading extjs 5 start throwing error. uncaught syntaxerror: failed execute 'queryselectorall' on 'element': 'div:any(div.square|div.highlightedreactangle|div.highlightedreactangleie|div.pin|div.redcirclecount|div.stamppreviewcls)' not valid selector. the statement i'm using find related div is, this.el.select("div:any(div.square|div.highlightedreactangle|div.highlightedreactangleie|div.pin|div.redcirclecount|div.stamppreviewcls)", true); what exactely i'm missing ? what exactely i'm missing ? from version 5, when select called on element (versus explicitly using ext.dom.query.select ), ext js uses native queryselectorall method requires valid css selectors. error message suggests, selector not valid one . in version 4, ext js used ext.dom.query.select processi

Why does Django Queryset say: TypeError: Complex aggregates require an alias? -

i have django class follows: class mymodel(models.model): my_int = models.integerfield(null=true, blank=true,) created_ts = models.datetimefield(default=datetime.utcnow, editable=false) when run following queryset, error: >>> django.db.models import max, f, func >>> mymodel.objects.all().aggregate(max(func(f('created_ts'), function='unix_timestamp'))) traceback (most recent call last): file "<console>", line 1, in <module> file "myvirtualenv/lib/python2.7/site-packages/django/db/models/query.py", line 297, in aggregate raise typeerror("complex aggregates require alias") typeerror: complex aggregates require alias how adjust queryset don't error? want find instance of mymodel latest created_ts. , want use unix_timestamp function it. i'm not running same django version, think this'll work: mymodel.objects.all().aggregate(latest=max(func(f('created_ts'),

Redis - node.js / ping or alive call -

i want check if connection redis db alive. i want node.js - every 5 minutes send call db redis, , if connection lost, notify it. i use following: var db = require("redis"); var dbclient = db.createclient(); the problem don't see , alive/ping command supported package. i suggest using events client provides: var redis = require('redis'); var client = redis.createclient(); client.on('ready', function() { console.log('redis ready'); }).on('error', function(err) { // should assume here connection lost, or compromised. console.log('redis error', err); ... }); the error event trigger regardless of whether command sent or not.

python - Django Template Tag Loop dictionary variable -

i've reading template tags posts regarding loop variable in key. apparently django not support loop variable in key , not sure how use custom template tag. i wanted display this, how can achieve {% in mdata %} loop ? {{ mdata.0.name }} {{ mdata.1.name }} {{ mdata.2.name }} {{ mdata.0.age }} {{ mdata.1.age }} {{ mdata.2.age }} mdata list of dictionaries. mdata = { "name":"alex", "age":"12"},{"name":"amy","age":"14"} ... considering data in list of dictionaries such as: my_data = [{"name" : "abc" , "age":20,...}, {} , {}...] you can access attributes of each dictionary in template way: {% dict in my_data %} <!-- here dict each of dictionary in my_data --> <!-- can access elements of dict using dot syntax, dict.property --> {{ dict.name }}, {{ dict.age }}, ... {{ dict.property }} {% endfor %} reference links: django templating langu

date - how to decrease months in php? -

i want separate 4 quarter months current month. $q1start = date('y-m-01',strtotime('-2 months')); $q1end = date('y-m-d'); $q2start = date('y-m-01',strtotime('-5 months')); $q2end = date('y-m-d',strtotime('-3 months')); $q3start = date('y-m-01',strtotime('-8 months')); $q3end = date('y-m-t',strtotime('-6 months')); $q4start = date('y-m-01',strtotime('-11 months')); $q4end = date('y-m-t',strtotime('-9 months')); but not showing exact date. i want this. 2015-06-01 2015-08-31 2015-03-01 2015-05-31 2015-02-28 2014-12-01 2014-09-01 2014-11-30 how decrease current month? thanks since quarters should based on current month, it's easier start first day of month calculations. $dayofmonth = date('d'); $firstdayofcurrentmonth = strtotime(sprintf('-%d days + 1 day midnight', $dayofmonth)); $q1start = date('y-m-d', strtoti

c++ - Destructors of builtin types (int, char etc..) -

in c++ following code gives compiler error: void destruct1 (int * item) { item->~int(); } this code same, typedef int type , magic happens: typedef int myint; void destruct2 (myint * item) { item->~myint(); } why second code works? int gets destructor because has been typedefed? in case wonder why 1 ever this: comes refactoring c++ code. we're removing standard heap , replacing selfmade pools. requires call placement-new , destructors. know calling destructors primitive types useless, want them in code nevertheless in case later replace pods real classes. finding out naked int's don't work typedefed ones quite surprise. btw - have solution involves template-functions. typedef inside template , fine. it's reason makes code work generic parameters. consider container c: template<typename t> struct c { // ... ~c() { for(size_t = 0; i<elements; i++) buffer[i].~t(); } }; it annoying introduce

testing - Writing Bash script to test C Program -

i quite new bash scripting , thinking of using run few test cases c program. have results expected in file called output.txt i run program: ./a.out > output_res_gen.txt diff output_gen.txt output_res_gen.txt if program has run correct following difference: 10001c10001 < time: 0.291555 --- > time: 0.111091 (that time taken execute code, can vary). i wrote bash script follows: #!/bin/bash cd .. ./a.out > ../tests/output_res_gen.txt diff ../tests/output_gen.txt ../tests/output_res_gen.txt however code not execute (./a.out not run). there way find difference between 2 files , verify difference in between time execute?

Ruby on rails get mac address -

i want mac address user in form, don't know there simple way it, or have using 6 text field. update: jquery $(document).on('ready page:load', function() { $('.field-id').mask('00:00:00:00:00:00', {'translation': {0: {pattern: /[a-z0-9]/}}}); }); form view <%= f.text_field :comp_id, class: "field-id" %> i don't understand why not working you can use jquery client-side input mask. here jquery plugin this: http://igorescobar.github.io/jquery-mask-plugin/ in case of mac address, field masking might this: $('#field-id').mask('00:00:00:00:00:00', {'translation': {0: {pattern: /[a-z0-9]/}}});

python - How do i add the value that is in createData using @property and use that in putData -

class data(self): def __ init __(self): self._dictlist = [] @property def dictlist(self): return self._dictlist @dictlist.setter def dictlist(self, value): self._dictlist.append(value) def putdata(self): value in self.dictlist: print value def createdata(self): value = 10 self.dictlist = value how add value in createdata using @property , use in putdata ? even if still not understand expectation, let's correct what's wrong here: this not how declare class class data(self): # incorrect class data(object): # correct your dict list ... , should not name dict then comment propose use heritage: class data(list): # <-- data list that way can add values on normal list (ie: list[key] = value or list.append(value) or list.insert(index, value) ) , add custom methods in normal class.

javascript - 500 TypeError: Cannot read property 'name' of undefined WHILE transferring data from html form to Node js server? -

i trying send data html page nodejs server . my html code : <body> <nav> <ul> <li> <a href="#" class="button add">add product</a> <div class="dialog" style="display:none"> <div class="title">add product</div> <form action="addevent" method="get"> <input id = "name" name="name" type="text" placeholder="product name"/> <input name="code" type="text" placeholder="product code"/> <input name="category" type="text" placeholder=" category"/> <input name="brand" type="text" placeholder="brand"/> <input type="submit" value="ok"/> </form> </div> </li> <li class="radio"> <a href="#" class="button

Define when class is truthy/falsy in ruby -

this question has answer here: how create object act false in ruby 2 answers i want define when class truthy/falsy. possible? class customnullobject def nil? true end end example usage: puts customnullobject.new ? 'ignore me' : 'print me! nullobject falsy' it seems new method customnullobject should return true of false.

Visual studio 2013 regex search : looking for all strings of the form "if (something > 0)" + variations -

Image
i using visual studio 2013 , working quite big c++/c# library. in it, looking occurences of strings of form ifxpoxvarxsymxzeroxpc : x string composed spaces (the empty caracter, 0 space, allowed) po , pc either both empty or respectively equal ( , ) var (c++ or c# kosher) variable name sym operator equal > , < , <= or >= zero equal 0 , 0. or 0.0 example of strings want catch : if avar <= 0. if(anothervar>0) if yetanothervar> 0 if ( lastvar >= 0.0 ) etc ... i tried if \s*\(\s*\w+ > 0\.?\0?\s*\)\s* and if \s*\(\s*\w+\s*>\s*0\.?\0?\s*\)\s* without success remarked each time in results lists did not everything. btw stick visual studio 2013's regex. ideally, find string po composed more 1 opening parenthesis, in omit pc , able find strings of form if (((x > 0) algebraic condition looked belongs combo of many "algebraic comparisions" or other comparisons. here regex can leverage here: (?m)^if\