Posts

Showing posts from January, 2011

How do I get the content between two xml tags in python? -

import xml.dom.minidom water = """ <channel> <item> <title>water</title> <link>http://www.water.com</link> </item> <item> <title>fire</title> <link>http://www.fire.com</link> </item> </channel>""" dom=xml.dom.minidom.parsestring(water) linklist = dom.getelementsbytagname('link') print (len(linklist)) using minidom, want content between link , /link string. please let me know how to. if want stick xml.dom.minidom call .firstchild.nodevalue. example, stored links in variable "linklist", print them iterate through them , call .firstchild.nodevalue, this... for link in linklist: print link.firstchild.nodevalue prints... http://www.water.com http://www.fire.com more detailed answer here.... get element value minidom python in response other question: if wanted specific element need know either in document or search it. for ex

java - Use of readConfiguration method in logging activities -

in order use logging in small java desktop application i'm trying understand in depth operation of methods. use stupid , small java program test them. in particular, when testing behaviour of logmanager.readconfiguration() method i've found strange. in tests logmanager reads configuration properties files located in lib/logging.properties in jre directory. @ time, contents of file follows : handlers=java.util.logging.consolehandler myapp2.handlers=java.util.logging.consolehandler myapp2.myapp2.handlers=java.util.logging.consolehandler .level=off java.util.logging.consolehandler.level=all java.util.logging.consolehandler.formatter=java.util.logging.simpleformatter java.util.logging.simpleformatter.format=%4$s: %5$s [%1$tc]%n myapp2.level=warning myapp2.myapp2.level=info the code of java program : package myapp2; import java.io.ioexception; import java.util.logging.logmanager; import java.util.logging.logger; public class myapp2 { private static final logger lo

cmd - How to copy only files(not directories) using batch file? -

the directory structure is: images -folder1 -image1.jpg -image2.jpg -folder2 -image3.jpg -image4.png -folder3 -image6.png -image7.jpg -folder4 i want copy images(i.e *.jpg, *.png) files (not folders) parent directory("images"). i have tried using "robocopy" follows: robocopy /np ..\..\exam\images ..\..\exam\images *.jpg *.png /s here files folders copied :(. need files copied. how this? many many in advance! try on command line: for /r "images" %i in (*.jpg *.png) copy "%~fi" "my\target folder" for bach script % must doubled %% .

sql - Android SQLite How to format data? -

currently have textview gets populated data string sqlite database, not pretty at. currently data looks like: 1 data1 data2 data3 data4 < on same line whatever formatting afforded textview. how format kind of data in android? have seen examples using list view. <tablelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <tablelayout android:layout_width="fill_parent" android:layout_height="fill_parent" > <tablerow android:id="@+id/tablerow1" android:layout_width="wrap_content" android:layout_height="wrap_content" > <textview android:layout_width="wrap_content" android:layout_height="fill_parent" android:text="weight" />

c++ - bitwise OR int and char -

i have value know less 16 (no more 4 bits) in int . want bitwise-or char . can this: c |= i; or depend on endianness? if problem, this: c |= (char)i; solve it? endianness never matters when doing arithmetic, matters when dealing values (larger 1 char ) in other way, i.e. when using char-pointers traverse buffers holding larger values, instance. in case, there no need cast, automatic arithmetic promotion make sure it's fine. code: char c = 0; int =3; c |= i; is equivalent to c = c | i; the expression computed int , , converted down storage.

Warnings with Homebrew -

i did link http://www.moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/#lion-install but when command "brew doctor" see warnings: warning: "config" scripts exist outside system or homebrew directories. ./configure scripts *-config scripts determine if software packages installed, , additional flags use when compiling , linking. having additional scripts in path can confuse software installed via homebrew if config script overrides system or homebrew provided script of same name. found following "config" scripts: /usr/local/bin/gpg-error-config /usr/local/bin/ksba-config /usr/local/bin/pkg-config warning: homebrew not installed /usr/local can install homebrew anywhere want, brews may build correctly if install in /usr/local. sorry! i don't know that. want install calabash-cucumber gem, when try that, says can't find files.

jquery - Disable bypassing javascript overlays -

i'm using colorbox show login form every new visitor. , have disabled options close overlay: overlayclose: false, esckey: false, onload: function() { $('#cboxclose').remove(); } ... assume intermediate user can hide overlay using css overrides. i'd know if there's in case? use setinterval , checks every few seconds , redirect if changes found or something? how not give them content? way secure page. you need check visibility, z-index, top, left, indents, node there, etc. there whole list of ways remove content off screen. but people checks use interval , check element there , either move or redirect. there sites , wrote code disables scripts checks. :)

asp.net mvc - Routing, hitting wrong action -

i have 2 actions, , whenever explicitly call second one, first 1 still gets called. need able write in mysite.com/api/awesome/getsomeexamples, without triggering getallclasses public class awesomecontroller : controller { public ienumerable<myclass> getallclasses() { //...some stuff } public ienumerable<string> getsomeexamples() { //...some stuff } //... have more actions take in 1 parameter } my routing such, not working public static void registerroutes(routecollection routes) { routes.ignoreroute("{resource}.axd/{*pathinfo}"); routes.maproute( name: "actionapi", url: "api/{controller}/{action}/{id}", defaults: new { id = urlparameter.optional } ); routes.maproute( name: "default", url: "{controller}/{action}/{id}", defaults:

stdvector - C++: Dealing with 'Vector subscript out of range' -

Image
using openframeworks 0.7.4, vs2012, v100 platform toolset. i'm making family of circles, each spawning children circles if circles.size() < 200 && rand() % 20 == 0 . each circle pushed std::vector using push_back() function. the lines of polygon constructed children circles drawn according std::vector<std::vector<int>> each of elements contain 6 integer values, each being previous child , current child circle's x , y positions, , index of previous , current child circle in mentioned std::vector . and @ random times error. i tried using cout check how many elements 2 vectors hold , results not constant: 1: circles.size() = 57, lines.size() = 56; 2: circles.size() = 42, lines.size() = 41; 3: circles.size() = 72, lines.size() = 71; 4: circles.size() = 78, lines.size() = 77; the error mentioned pressing 'retry' debug. the problem must in circles . these top parts , bottom parts when circles collapsed. i read questi

java - Android HttpURLConnection: gzip compression -

i can't understand documentation says that. by default, implementation of httpurlconnection requests servers use gzip compression. since getcontentlength() returns number of bytes transmitted, cannot use method predict how many bytes can read getinputstream(). instead, read stream until exhausted: when read() returns -1. gzip compression can disabled setting acceptable encodings in request header: urlconnection.setrequestproperty("accept-encoding", "identity"); i know if current implementation decompress stream before returning (using conn.getinputstream()) or if says connection automatically sends header gzip encoding , need manage that. thanks. you dont need handle this. use conn.getinputstream() from this blogpost: in gingerbread, added transparent response compression. httpurlconnection automatically add header outgoing requests, , handle corresponding response: accept-encoding: gzip

iphone - Facebook connect with Phonegap iOS -

i'm building phonegap application ios , i'm trying include facebook connect framework. i followed steps twice https://github.com/phonegap/phonegap-facebook-plugin , keeps giving following errors: undefined symbols architecture i386: "_objc_class_$_fbsbjson", referenced from: objc-class-ref in facebookconnectplugin.o "_secrandomcopybytes", referenced from: +[fbcrypto randombytes:] in facebooksdk(fbcrypto.o) -[fbcrypto encrypt:additionaldatatosign:] in facebooksdk(fbcrypto.o) "_ksecrandomdefault", referenced from: +[fbcrypto randombytes:] in facebooksdk(fbcrypto.o) -[fbcrypto encrypt:additionaldatatosign:] in facebooksdk(fbcrypto.o) ld: symbol(s) not found architecture i386 clang: error: linker command failed exit code 1 (use -v see invocation) does know problem here? with kind regards you have add 5 other frameworks , libraries (adsupport, accounts, libsqlite3, security , social) use facebook sdk. see also: https://d

excel - How can I open an xls file, save it, and then close it all in java? -

how can open xls file, save it, , close in java? i have workaround make java write vbs script same thing set excel = createobject("excel.application") excel.workbooks.open("path xls file") excel.activeworkbook.save() excel.quit java runs vbs script passing path cmd runtime rt = runtime.getruntime(); rt.exec("cscript " + decodedpath3 + filename + ".vbs"); and delete vbs created is there way can replicate these steps in java? i've done lot of reading poi , i'm not sure how simple task java. note - vbs script doesn't make excel open , display sheet making fast. need java same thing. in response comments http://jexcelapi.sourceforge.net/ work? import java.io.file; import java.util.date; import jxl.*; import jxl.write.*; workbook workbook = workbook.getworkbook(new file("myfile.xls")); writableworkbook copy = workbook.createworkbook(new file("myfile.xls"), workbook); you can this,

In Java, how to replace a symbol occurring in multiple places in the string by another symbol at all instances? -

i have written method replace first instance of given symbol symbol in given string. i modify method replace instances of old symbol given new symbol in string. public static string myreplace(string origstring, string oldvalue, string newvalue) { char[] chars = origstring.tochararray(); char[] charsnewvalue = newvalue.tochararray(); stringbuffer sb = new stringbuffer(); int startpos = origstring.indexof(oldvalue); int endpos = startpos + oldvalue.length(); int lengthofstring = origstring.length(); if (startpos != -1) { (int = 0; < startpos; i++) sb.append(chars[i]); (int = 0; < newvalue.length(); i++) sb.append(charsnewvalue[i]); (int = endpos; < lengthofstring; i++) sb.append(chars[i]); } else return toreplaceinto; return sb.tostring(); } just use string.replace . you've asked for: replaces each substring of string matches literal target

c# - How can the html encoding for a text box be disabled? -

i have troubles text box input control value on ascx page. it's value somehow html encoded, , don't know how can disabled. example when value contains < character converted &lt; . strange thing is, happens on fields name.lastname (which have child property). first thought caused html extension method html.textboxfor(m => m.name.lastname, new { maxlength = "100" }) but not case, because when use html input directly, it's value still encoded: <input id="name_lastname" maxlength="100" name="name.lastname" type="text" value="<%= model.name.lastname %>" /> does know how html encoding of text box values fields name.lastname (with child property) can disabled? after more research found out caused javascript function variables initialized using <%: , , function used initialize text boxes. in end had nothing child properties. changed <%: <%= in javas

sql - Problems with INNER JOIN and LEFT/RIGHT OUTER JOIN -

i have 3 tables: orders orderid, int pk customerid, int fk customer, null allowed customers customerid, int pk companyid, int fk company, null not allowed companies companyid, int pk name, nvarchar(50) i want select orders, no matter if have customer or not, , if have customer customer's company name. if use query... select orders.orderid, customers.customerid, companies.name orders left outer join customers on orders.customerid = customers.customerid inner join companies om customers.companyid = companies.companyid ...it returns orders have customer. if replace inner join left outer join ... select orders.orderid, customers.customerid, companies.name orders left outer join customers on orders.customerid = customers.customerid left outer join companies om customers.companyid = companies.companyid ...it works don't understand why necessary because relationship

java - While(false) causes unreachable statement compilation error -

i removing block of code our code base before release , used if(false) statement prevent execution: if (false) { arraylist<string> list = new arraylist<string>(); ... } this compiles fine , prevent execution of offending block of code (right or wrong, that's not current argument). however, kind of accident, changed block above to: while (false) { arraylist<string> list = new arraylist<string>(); ... } and received unreachable statement compilation error. i appreciate compilation error , understand reasons, however, i'm struggling comprehend difference between 2 blocks , why former compiles fine latter not when both have unreachable statements. in both case compiler should raise error, because code between braces pointless, but if (false) kept in java simulate c/c++ preprocessor #if 0 , quite common way of disabling parts of code testing or debugging. edit: reference, "conditional compiling" detailed

Using $_GET in PHP include with variable in the include URL -

firslty, please forgive ineloquent phrasing of question. what trying do, create simple odbc script, , store in file included in main php file several times different variables. when including them, want specify variables pass it. my example be: main page include("table-fields.php?table=sometable"); table-fields.php $table = $_get['table']; odbc_exec(some database function tbl= $table); however, if understanding correct, $_get global, looking main.php?table= would better choice set variable before including, e.g.: $table = table; include("table-fields.php"); table-fields.php odbc(some database function tbl= $table); i want try , avoid if possible. thanks, eds when including file, contents of file outputted current file, it's not requested http, need : $table = "sometable"; include("table-fields.php"); and in included file, use variable : odbc(some database function tbl= $table); as incl

ruby on rails - Removing redundant queries using Active Record -

the following code works, runs far many sql statements liking; user.includes([:profile,:roles]).select("id, email, created_at, confirmed_at, countries.name").find_in_batches |users| users.map{|u| # in here access profile.country.name} end what meant grab user information along profile information , put csv format. inside .map calling profile.country.name coming in fine rails running sql call find name, want capture information in initial lookup. my issue because country linked profile , not user can't add .includes because doesn't see linkable table. there can force includes join table linked profile ? the relevant model information below; user: has_one :profile, dependent: :destroy profile: belongs_to :user belongs_to :country country: has_many :profiles you should able include country in original query nesting under profile in .includes call: user.includes( {:profile => [:country], :roles} )

Rails Nginx and Thin - why don't users get logged off when recycling? -

i have rails app running on ubuntu, nginx, , thin. when stop nginx , stop thin servers, $ cap deploy , restart thin , nginx, expect user have log in. but, don't. is there way force them log-in again? thanks! users don't have log in because sessions stored in persistent session store (typically database) rails doesn't modify between deployments. logged-in user's browser send cookies on every http request, , rails authenticates these cookies against session store. force users log in have modify session store either deleting records or changing expiration time. assuming storing sessions in database using activerecord, rake db:sessions:clear should force expire existing sessions deleting rows in table stores sessions.

Rails 3 helper methods not available in controllers even after explicitly including them -

fist of i'm newbie rails. have in sessionscontroller: def method sign_in 'user' end and in sessionshelper: def sing_in(user) ...... end so googling , reading answers on stackoverflow let me try this: including 'sessionshelper' sessionscontroller , tried put in 'applicationcontroller' this: class applicationcontroller < actioncontroller::base protect_from_forgery include sessionshelper def handle_unverified_requests sign_out super end end but i'm getting nomethoderror : undefined method `sign_in' sessionscontroller:0x007eff2004fcd8 also few questions: 1) what's point/difference in putting few methods in heplers , few in controllers? security issue or what? 2) tried puting sign_in method in sessionscontroller read in stackoverflow methods defined in controllers can accessed in views. avoid problems in views used helper_method but still same nomethoderror 3) best , easy way acce

sql - How to get array/bag of elements from Hive group by operator? -

i want group given field , output grouped fields. below example of trying achieve:- imagine table named 'sample_table' 2 columns below:- f1 f2 001 111 001 222 001 123 002 222 002 333 003 555 i want write hive query give below output:- 001 [111, 222, 123] 002 [222, 333] 003 [555] in pig, can achieved this:- grouped_relation = group sample_table f1; can please suggest if there simple way in hive? can think of write user defined function (udf) may time consuming option. the built in aggregate function collect_set ( doumented here ) gets want. work on example input: select f1, collect_set(f2) sample_table group f1 unfortunately, removes duplicate elements , imagine isn't desired behavior. find odd collect_set exists, no version keep duplicates. someone else apparently thought same thing . looks top , second answer there give udaf need.

google chrome - How to get an image on top of another website -

i'm trying prototype sort of torch 'light up' webpages. i've done placing black image transparent hole in middle, on background. i'm struggling think of way post code in way that's tangible here files (whole lot under 2mb, open in chrome): https://www.dropbox.com/sh/1cyl710mmhtbo51/843tzpcuq_ i'm trying replace website backgrounds, in example images, real sites. i've tried iframes, found unsuccessful can't embed google etc. can think of way in have dark image hovering on live website? this need work demo on own laptop. if needs work on machine, copy source of page html file , save it. can edit way want. may have adjust urls images , css work properly.

android - Reduce size of debug APK in IntelliJ -

i co-working on medium sized android project 9 android libraries , 10 jar libs. develop in intellij , collaborant works in eclipse. in eclipse size of debug apk 2.5 mb, in intellij 20 mb. how possible? can reduce size of apk in intellij make faster upload device? an apk zip file. change extension .zip , unzip it. see in it.

c++ - Pass by reference vs. Pass by pointer: Boost threads and deadline timer -

i have simple program outputs increasing integers in span of 1 second using boost libraries: #include <iostream> #include <boost/thread/thread.hpp> #include <boost/asio.hpp> using namespace std; void func1(bool* done) { float i=0; while (!(*done)) { cout << << " "; i++; } return; } void timer(bool* done, boost::thread* thread) { boost::asio::io_service io; boost::asio::deadline_timer timer(io, boost::posix_time::seconds(1)); timer.wait(); *done = true; return; } int main() { bool done = false; boost::thread thread1(func1, &done); boost::thread thread2(timer, &done, &thread1); thread2.join(); thread1.join(); } that iteration of code works, had had bool defined in main function passed reference functions func1 , thread. i.e.: void func1(bool& done) /*...*/ while (!(done)) /* ... */ void timer(bool& done, boost::thread* thread) /*...*/ done

backbone.js - How can i create object of 'Todo' model in b.js which is in another javascript file a.js -

in a.js var todo = backbone.model.extend({ idattribute: "_id", defaults: { _id: '', label: '', }, }); in b.js $(function(){ $.getscript("/js/a.js"); var obj = new todo(); }); it giving error problem not constructor i believe getscript asynchronous call todo not available, resolve issue call todo constructor in getscript success callback: $(function(){ $.getscript("/js/a.js", function() { var obj = new todo(); }); });

c++ - Invalid deque <T> subscript . Why am I getting this error? -

i getting execption error in following piece of code. suggestions on might causing ? error : invalid deque <t> subscript typedef boost::shared_ptr<histobj> shared_hist_def; typedef std::deque<shared_hist_def> vector_def; typedef boost::shared_ptr<vector_def> shared_vector_def; typedef boost::unordered_map<int,shared_vector_def> in_map_def; typedef boost::shared_ptr<in_map_def> shared_inner_map_def; domain::shared_hist_def& domain::getspecifichistoricaltuple(const std::string& symb,const int& tframe,const int& val) { domain::shared_inner_map_def tshare = stat_history_base[symb]; shared_vector_def tmp = tshare->at(tframe); try { domain::shared_hist_def safe_tuple = tmp->at(val); return safe_tuple; } catch (std::exception &ex) { std::string = ex.what(); __debugbreak(); } } more information: the above method static method.

jquery - How to refresh Fancybox content when closed? -

is there way reset fancybox instance or refresh contents of it, when closed? note grabs content div on same page. i want display content first loaded dom, when re-opening fancybox. i guess more of javascript/jquery thing, fancybox thing, right? $.fancybox.open({ href: '#popup', padding: 0, autowidth: true, arrows: false, closebtn: false, scrolloutside: true, helpers: { overlay: { css: { 'background': 'rgba(0, 0, 0, 0.5)' }, locked: false } }, afterclose: function() { // reset or refresh here } }); it depends on sort of changes making target div , not able "reset" them without reloading page, or performing funky ajax call page , getting div contents there. the simplest way of getting around store markup of div in variable (using jquery's html() , , "reset" div using variable in afterclose() callback. j

php - How to properly manage the sending of so many different bulk e-mails to the entire user base? -

one of php/mysql sites social network , need send many different e-mails, including: 1) event-based: e-mails sent when specific action occurs on user's account notify them (they received new message on site, friended them, posted on wall, etc). 2) periodic: e-mails sent on regular basis (e.g weekly list of people might know sent every saturday, monthly newsletter discussing new features of site, fortnightly list of new users in area, etc.). with hundreds of thousands of users, how in world manage sending of e-mail, many users? how ensure e-mails don't blocked isp's? how handle unsubscriptions many different e-mail categories? how personalize e-mails each user? how ensure users don't bombarded many e-mails within 1-day, 7-day, , 30-day period? how integrate existing site? i have amazon ses account 100,000 daily / 28 per second send limits. how can use amazon ses handle of above? sounds incredibly overwhelming! edit: since interpreting question a

node.js - Why async.map function works with the native fs.stat function? -

async.map(['file1','file2','file3'], fs.stat, function(err, results){ // results array of stats each file }); as per documentation , second argument is: iterator(item, callback) - function apply each item in array. fine. the iterator passed callback(err, transformed) must called once has completed error (which can null) , transformed item. i think that fs.stat not conform , shouldn't work. it should like: async.map(['file1','file2','file3'], function (file, complete) { fs.stat(file, function (err, stat) { complete(err, stat) }); }, function(err, results){ // results array of stats each file } ); fs.stat accepts 2 parameters, first file, second callback, node convention accepts 2 parameters, error , stats of file: fs.stat(path, callback) which seen as fs.stat(path, function(err, stats){ // ... }); this why works, fs.stat called pa

Powershell asking for git RSA passphrase on every pull instead of on startup? -

Image
i've installed poshgit , i've set rsa key github , in ~\.ssh folder, powershell still prompts me enter passphrase on every pull/push. i've followed instructions given here . powershell profile looks so: $env:path += ";" + (get-item "env:programfiles(x86)").value + "\git\bin" . 'c:\users\caleb\documents\windowspowershell\modules\posh-git\profile.example.ps1' cd ~\documents\github\travefy here's happens. how ask me on startup? it turns out need run > ssh-add i'm not sure why wasn't mentioned in of docs on github.com.

onTouch event on Android Games -

Image
my question not ontouch events every method can use recognise touch on areas of screen. right now, have "background" image, use layout contains 2 "buttons": start , options can see here: ok, want know best way identify when user touching each button. way, should nice info how deal different screen sizes. lots of thanks. pd: seems didnt explain well. not "android buttons" theirselves. background whole image, can find 2 "buttons", part of image. thats because need know how this i think you're missing fundamentals, recommend take tutorial track. direct answer question , can see this page tutorial.

Highcharts - Wrong date in tooltip -

Image
fiddle - http://jsfiddle.net/z8fw7/ when hover on column can see weird big number, coming from. if add 1 more date entry. e.g [date.utc(2010,2,31), 28.84], [date.utc(2011,2,31), 28.84], [date.utc(2012,2,31), 32.65] the tooltip displays proper year value expected. works flawlessly 3 data values while not work 2 data values. how can make sure works 2 data values. looks bug in highcharts 2 data points when using pointformat . suggest using more customizable formatter function. so in option configuring tooltip , use this: tooltip: { formatter: function() { var date = new date(this.x); var year = date.getfullyear(); return year + '<br/>' + '<span style="color:'+this.series.color+'">'+ this.series.name +'</span>: '+ this.y + '%'; }, } works fine 2 data points or 3, etc. see: http://jsfiddle.net/uqbkq/

Read from a file (.txt) and save into a char* C -

i have file.txt contais, example, "this txt file" (this content can variable) , need function reads file.txt , save content char*. file.txt contains -> "this .txt file" and need char *readedcontent contains "this .txt file". first, save content of char *str (str contains "this .txt file") "file.txt" , try string file string have more chars "this .txt file". (often add characters spaces or @,?) my function is: char *special_char_remplace(char *str){ file *f1; f1 = fopen("file.txt","w+"); fprintf(f1,"%s", str); fclose(f1); size_t len, bytesread; char *readedcontent; file* f2; f2 = fopen("file.txt", "rb"); fseek(f2, 0, seek_end); len = ftell(f2); rewind(f2); readedcontent = (char*) malloc(sizeof(char) * len + 1); readedcontent[len] = '\0'; // needed printing stdout printf bytesread = fread(rea

python - Move from google app engine to virtual machine -

i had assignement create website. did on google app engine. use jinja2 , google database. now, proffesor ask move google app engine virtual machine. probably, have rewrite part of google database mysql example. how setup libraries, files , templates in virtual machine? know tutorial? the simplest method install appengine sdk on virtual machine , run appengine app on local dev server. see: https://developers.google.com/appengine/docs/python/tools/devserver

ruby on rails - Parsing Request Headers in Test::Unit -

i'm trying parse http request headers in test::unit, no avail. i'm writing functional test controller so: test "create shopify order" :order, params, {header1 => val, header2 => val} assert_response :success # make sure returns 200, first off ... end normally, read headers like, request.headers[header1] , returns nil in test::unit. request isn't defined. how grab value of headers set in above request? , how assign them request ? app pulls webservices, , need test values passed through in headers, don't want change app code. need simulate requests in test::unit. thanks! knowing test quite you're using helps (thanks jesse). found i'd been looking @ doc integration tests, not functional tests, , setting headers works differently in functional tests: http://twobitlabs.com/2010/09/setting-request-headers-in-rails-functional-tests/ so wasn't setting headers thought was. being read fine--just not set.

git - Custom Gradle Task Fails - Can't Find GitPush -

i'm trying push remote git repo in gradle task. best way i've found use plugin gradle-git found here: https://github.com/ajoberstar/gradle-git i'm trying able run push task , go there configuring used in project. here's build.gradle script looks like. apply plugin: 'eclipse' apply plugin: 'groovy' apply plugin: 'maven' apply plugin: 'base' import org.ajoberstar.gradle.git.tasks.* repositories { mavencentral() maven { url "[my custom repository repo]" } } dependencies { compile 'org.ajoberstar:gradle-git:0.4.0' } task push(type: gitpush) { println "test" } and error is failure: build failed exception. * where: build file '[my_path]\build.gradle' line: 19 * went wrong: problem occurred evaluating root project 'name'. > not find property 'gitpush' on root project 'name'. * try: run --stacktrace option stack trace. run --info or --

asp.net mvc 4 - MVC4 Get Route Data From ApiController -

i'm looking grab {contract} value out of route when hit api controller. config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{contract}/{controller}/{id}", defaults: new { id = routeparameter.optional } ); so when user hits /api/rearch/allergies/1234 i'd grab "rearch" , use fetch connection string. i've attempted using routedata , routetable below no luck: this.routedata.values["contract"].tostring() routetable.routes["contract"] is there i'm missing? different in apicontroller? thanks in advance! you can grab out of method's parameters... if can change those: [httppost] [actionname("actionname_ifdifferentthanmethodname")] public httpresonsemessage method(string contract, int id) { string connectionstring = system.configuration.configurationmanager.connectionstrings[contract]; }

javascript - jQuery draggable with touch punch - flickering issue -

my draggable div becomes draggable on touch devices, "flickers" weird positions when starting move it. works charm om desktop devices not on ipad or android. any suggestions solution? thanks in advance! unfortunately, can't share code since go product, , not able reproduce issue in jsfiddle or similar. but have made fix draggable flickering on touch devices, share here if else encounters problem. var prevpos = null, diffx, diffy, maxdiff; $( '#draggable' ).draggable( { ..., ..., drag: function ( event, ui ) { if ( prevpos ) { diffx = math.abs( prevpos.left - ui.position.left ); diffy = math.abs( prevpos.top - ui.position.top ); maxdiff = math.max( diffx, diffy ); if ( maxdiff > 60 ) { ui.position = prevpos; } } prevpos = ui.position; }, stop: function ( event, ui ) { prevpos = null; } } );

Trying to Write Multiple Files at Once - Java -

i trying split dictionary file have multiple dictionaries of different lengths, example if want take , put smaller dictionaries of length 2, 3, 4, ..... n, can search them quicker. when quicker mean know input length , therefore accessing corresponding length dictionary (a fraction of whole) mean quicker accesses. current implementation generates files doesn't write them desire. ideally, words of length 2 example written length2 text file. have suggestions? import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.printwriter; import java.io.ioexception; public class main { public static void main(string[] args) throws ioexception { filereader fr = new filereader("dictionary.txt"); printwriter l2 = new printwriter("dictionary_length2.txt", "utf-8"); printwriter l3 = new printwriter("dictionary_length3.txt", "utf-8"); printwriter l4 = new printwriter("

java - Eclipse - Android app crashing -

i started learning how develop apps using eclipse, have made app , menu it. upon opening app, start screen supposed stay 5 seconds , move menu. after start screen app crashes. developing 4.1.2. log cat report following 05-08 13:46:21.170: v/mediaplayer(16864): message received msg=2, ext1=0, ext2=0 05-08 13:46:21.170: v/mediaplayer(16864): playback complete 05-08 13:46:21.170: v/mediaplayer(16864): callback application 05-08 13:46:21.170: v/mediaplayer(16864): callback 05-08 13:46:23.585: d/instrumentation(16864): checkstartactivityresult :intent { act=com.example.first_app.menu } 05-08 13:46:23.585: d/instrumentation(16864): checkstartactivityresult inent instance of inent: 05-08 13:46:23.590: w/dalvikvm(16864): threadid=11: thread exiting uncaught exception (group=0x40f122a0) 05-08 13:46:23.590: e/androidruntime(16864): fatal exception: thread-1262 05-08 13:46:23.590: e/androidruntime(16864): android.content.activitynotfoundexception: no activity found handle intent

CSS Border height different on each side -

Image
i wondering if border possible in pure css? there no content within box, image within future. i achieve in pure css, no jquery. have looked around , seems isn't possible, css evolving wondering if possible apart using nested divs etc. cheers! you can fake it. jsfiddle example . html <div id="wrapper"> <div id="top"></div> <div id="bottom"></div> <img src="http://www.placekitten.com/200/100" /> </div> css #top, #bottom { width: 200px; height:50px; position:absolute; left:-1px; } #bottom { border-left: 1px solid #f00; border-right: 1px solid #f00; border-bottom: 1px solid #f00; bottom:0; } #top { border-left: 1px solid #f00; top:0; } #wrapper { position:relative; width: 200px; height:100px; background: #faa; }

sql - How to populate "between dates" given start and end dates -

i have table tells me start , end "reserve date" piece of equipment. want create , populate new table, filling in "between dates" along start , end date particular item. new table should include following columns: item name conferencename reserved dates i may 1 finds question quite interesting (- not explained). here sql fiddle demo shows 1 way of doing using cursor populate dates. part of script believe asking shown below: create table equipmentlog ([item name] varchar(255), conferencename varchar(255), [reserved dates] datetime); declare @item_name varchar(255), @conferencename varchar(255), @start_reserve_date datetime, @end_reserve_date datetime, @reserve_date datetime declare cur cursor fast_forward select * equipmentregister open cur fetch next cur @item_name, @conferencename, @start_reserve_date, @end_reserve_date while (@@fetch_status=0) begin set @reserve_date = @start_reserve_dat

http - Why are my querystring parameters being doubled up in the post body of my ASP.NET MVC 4 Application? -

here relevant bits of my viewmodel: [display(name = "one per line")] public bool oneperline { get; set; } [display(name = "comma separated")] public bool commaseparated { get; set; } [display(name="upper case")] public bool uppercase { get; set; } view: @using (html.beginform("index", "home", formmethod.post, new { @class = "form-horizontal" })) { . . <div class="control-group"> @html.labelfor(m => m.oneperline, "one per line?", new dictionary<string, object> { { "class", "control-label" } }) <div class="controls"> @html.checkboxfor(m => m.oneperline) </div> </div> <div

java - Set header web socket? -

i want pass blob data java server using web socket. java server is: providersocket = new serversocket(2007, 10); system.out.println("waiting connection"); connection = providersocket.accept(); system.out.println("connection received " + connection.getinetaddress().gethostname()); out = new objectoutputstream(connection.getoutputstream()); out.flush(); in = new objectinputstream(connection.getinputstream()); sendmessage("connection successful"); and javascript client is: var ws = new websocket("ws://127.0.0.1:2007"); ws.binarytype = "blob"; ws.onopen = function () { console.log("openened connection websocket"); }; ws.onmessage = function(e) { console.log(e.data); }; function doneencoding( blob ) { // blob audio blob ws.send(blob); } error is: in server connection received 127.0.0.1 java.io.streamcorruptedexception: invalid stream header: 47455420 @ java.io.objectinputstream.readstreamheader(unknown s

c# - How do I collapse a Category attribute with System.ComponentModel? -

i have number of categories on design time component being expanded default. i'd have them appear collapsed default, or @ least problematically collapse them before user sees them. [category("misc")] public int id { // ... } do need use type converter? docs on pretty sketchy... i don't think there's viable way this. while can programmatically collapse category in propertygrid control, you'd need access instance being used visual studio (or whatever editor they're using). far know there's no way control declaratively, e.g. attribute or anything. it might possible custom uitypeeditor or something, fragile , need awful lot of effort, , feels kind of thing should left users' preferences anyway.

unit testing - Is it necessary to create mocks for all table classes in every PHPUnit test method in Zend Framework 2? -

i have complete running application , want write tests it. i've started application module , following manual . i'm writing " first controller test " , expected getting error: 1) applicationtest\controller\indexcontrollertest::testindexactioncanbeaccessed zend\servicemanager\exception\servicenotfoundexception: zend\servicemanager\servicemanager::get unable fetch or create instance zend\db\adapter\adapter the error says service manager can not create instance of database adapter us. database adapter indirectly used our album\model\albumtable fetch list of albums database. ... the best thing mock out our album\model\albumtable class retrieves list of albums database. when i'd follow manual now, i'd have create mocks / many tables of application in every test method or @ least in every setup() : 1) applicationtest\controller\indexcontrollertest::testindexactioncanbeaccessed zend\servicemanager\exception\servicenotfoundexception: zen

Using User-Downloaded DLLs In Windows Phone 8 Application -

short question: windows store allow applications obtain dlls or other low-level resources not packaged @ compile time? there requirement either windows phone or microsoft requires dlls signed? if so, can use dll in application signed developer? why i'm asking/explanation: i'm working an application android allows users download extensions (like themes), , i'd port windows phone. have determined it's not possible app utilize libraries or other resources of other applications downloaded windows store. (please correct me if not case) workaround i'm considering in-app download center other resources specific application. i'm wondering if downloads app, dlls, can used in application. these dlls developed 3rd party developers, see signing might issue. the store prohibits additions / modifications after app has been purchased. although may technically possible, won't certify it. this makes sense if think certification . if allow this, make

beagleboard - Problems connecting to a Beaglebone -

i have beaglebone black rev 0a5a. i've got showing both serial adapter , network adapter in osx.8, linux mint 13, , windows 7. under windows see 1 com port, , 1 doesn't send back. under osx , linux, see number of ports. of them don't respond (like windows), of them busy according screen. under os, using ssh in terminal or gate one, ssh_exchange_identification: connection closed remote host . don't have microhdmi hdmi adapter. how access thing? p.s.: can access usb storage drivers etc , normal web interface. can access gate one, doesn't work.

Getting mouse position in assembly TASM -

i'm taking course in assembly language , i'm required make calculator (gui?) , of course use mouse choose numbers , on ... i'm done i'm stuck, how can position of mouse? know have use ax=3 , int33 , values of coordinates stored in cx & dx. now, layout of numbers 3x3, how can check if particular position equals 4? if using emulator doesn't have ms-dos, big problem. since said you're taking course, emulator has ms-dos. int 33h mouse handling event register ax input. output results may vary depending on graphics mode have on (40x85, 320x200, ext). here of basics need know. mov ax, 0000h: resets driver (may wanna first) mov ax, 0001h: show cursor mov ax, 0002h: hide cursor mov ax, 0003h: return cursor position mov ax, 0004h: set cursor position mov ax, 001ah: set mouse sensitivity mov ax, 001bh: mouse sensitivity in syntax asking cursor position [no. 4]. first need ax 0003h. return values cx (horizontal position (x)), dx (vert

ios - Using AVPlayer to view transparent video -

i trying view video witch has alpha channel (the background transparent). problem don't seem how make background of player transparent. know have use avplayer, can't access it's .view property. how can add subview , add layer? nsstring *path = [nsstring stringwithformat:@"%@%@", [[nsbundle mainbundle] resourcepath], @"/new project 5.m4v"]; nsurl *filepath = [nsurl fileurlwithpath:path isdirectory:no]; movieplayer = [[avplayer alloc] initwithurl:filepath]; avplayerlayer* playerlayer = [avplayerlayer playerlayerwithplayer:movieplayer]; self.playerlayer.frame = self.view.bounds; movieplayer.view.alpha = 0.3; [movieplayer.layer addsublayer:playerlayer]; [movieplayer play]; the ios sdk not support alpha channel video playback. applies avframework mediaplayer framework. video material contains alpha channel not work expect when using apple's api. and show within code, avplayer not use uiview surface playing videos subclass of cala

linux - Steps: point application to Web (instead of 'localhost') -

i have question on how go posting page internet using spring sts framework tomcat container (i using linux). have basic hello world program created , able bring within http://localhost:8080/mypage . i have checked following sites far, have not found definitive process: springsource.org , apache.org , , stackoverflow.com , , askubuntu.com i noticed 1 possible way add ip address , domain name /etc/hosts file. if simple that, go ahead , purchase domain name/address. if not simple that, steps able have page display onto internet? the answer question occur in process of taking further steps. assumption: question may not have been posted on correct forum within stackexchange. upon ravi's suggestion, may better suited serverfault forum. the intent in asking question few general ideas on direction, question specific steps. since there may several variables answer question accurately involving cable modem, router, 'server' settings, , ide settings example, go

scala - Filtering a list of tuples -

i have list of tuples , want filter out elements second value in tuple not equal 7. i do: valuesaslist.filter(x=>x._2 != 7) can use wildcard notation make shorter? thanks. you can valuesaslist.filter(_._2 != 7) but doubt should preferred on example or (think readability): valuesaslist.filter {case (_, v) => v != 7}

ios - How to instantiate a Custom UIButton in UITableViewCell -

i have uitableviewcell , cells contain uibutton subclass (coolbutton). have picked code of coolbutton raywenderlich tutorial available here in ib have created subclass of uitableviewcell , have configured class of button coolbutton , set property type custom , configured iboutlet coolbutton uitableview subclass. my problem when cells created, uibutton instead of coolbutton. consequence when i'm setting properties of coolbutton crash "unrecognized selector". why uibutton instantiated instead of coolbutton? how can coolbutton in table? thanks, séb. i'm going guess doing like: coolbutton *b = [uibutton ...] you need create using coolbutton class: coolbutton *b = [coolbutton ....]; or, if used ib, created uibutton used iboutlet of coolbutton. need make actual class of button drag ib coolbutton, can selecting button , tapping (i think) second left top tab in inspector.