Posts

Showing posts from June, 2011

image - .htaccess rewrite url - show html file as jpg -

i have image.html , want shown in browser image.jpg, because there operations when showing picture, can't done before or after. possible .htaccess , url rewriting? i tried rewriteengine on rewritebase / rewriterule ^image\.html$ image.jpg but without luck. thanks answers first of all, you'll need let's php script. call image.php . after that, use parameter handle image name. let's call name . call picture need image.php?name=allo . now. in php script, need specify in header it's image, jpeg. required. after that, "print" picture within page. all need after rewrite rule. rewriteengine on rewritebase / rewriterule ^image\.php?name=(.*)$ /images_jpeg/$1 the header important. why doesn't work html file.

regex - Search through list of strings and determine if there is an exact match in separate list of strings. python. sentiment analysis -

suppose have list of keywords , list of sentences: keywords = ['foo', 'bar', 'joe', 'mauer'] listofstrings = ['i frustrated', 'this task foobar', 'mauer awesome'] how can loop through listofstrings , determine if contain of keywords...must exact match! such that: >>for in listofstrings: p in keywords: if p in i: print >> 'mauer awesome' (because 'foobar' not exact match 'foo' or 'bar', function should catch 'foobar' if keyword) i suspect re.search may way, cant figure out how loop through list, using variables rather verbatim expressions using re module. thanks instead of checking if each keyword contained anywhere in string, can break sentences down words, , check whether each of them keyword. won’t have problems partial matches. here, re_word defined regular expression of word-boundary, @ least 1 character, , word boundary. can u

asp.net - add new string object method -

i have codeline: newurl = request.rawurl.tostring.replace(server.urlencode(category), "") when category="" error: string cannot of 0 length. parameter name: oldvalue so want add new replace method, except empty string parameter replace. don't want check if category empty string, since check needs happen lot , make code complex. want add method "replacenew" or overload "replace" method of string object parameter "ignoreemptyvalue". i tried: public module custommethods public function replaceex(original string, pattern string, replacement string) string if [string].isnullorempty(pattern) return original else return original.replace(pattern, replacement) end if end function end module and public class globalfunctions public shared function replaceex(original string, pattern string, replacement string) string if [string].isnullorempty(pattern) return original else

java - Using Cookie for Authentication with Restful service in Spring -

i've used spring security secure restful web services built spring, in past request has used authentication headers authentication. need secure application when user's credentials in cookie. i'm trying figure out best way either extract user's information cookie , put authentication header, or ideally use value of cookie loaduserbyusername method in userdetailsservice bean. so far i've come few ideas how this: i add handlerinterceptor use cookie add authentication headers requests. however, not requests require authentication, if did want apply methods or request mappings , not others, , don't know how that. i implement authenticationentrypoint show in this tutorial . in tutorial though don't understand why has response.senderror( httpservletresponse.sc_unauthorized, "unauthorized" ); body of commence method. in use case, adding authentication header using cookie there? i perform security checks using custom method in first line

serialization - MPI_Datatype for C++ container -

how can define mpi_datatype s , mpi_op s mpi communication routines can used c++ containers? in specific case, i'd union (distributed) array of std::set<int> s using mpi_allreduce . according related questions mpi_allgather , mpi_pack in c mpi_reduce() custom datatype containing dynamically allocated arays : segmentation fault creating mpi_datatype structure containing pointers it seems requires (un-)serializing container data. in case, size() of each std::set varies widely, , interested in solution not require padding (if possible).

How can I get git to use graphical diff locally and textual diff over ssh? -

i've configured git use meld difftool, need see textual diffs when working on ssh. there way configure git uses proper diff tool environment? my current .gitconfig: [diff] external = meld tool = meld [merge] external = meld tool = meld [difftool] prompt = false write differ checks environment , invokes right diff engine , put in config.

algorithm - Binary search on unknown size array -

suppose array has been given , want find element in array , how can search element in array using binary search , given array sorted , size of array unknown. linear search can applied trying figure out faster search linear algorithm. if can test whether have fallen out of array range, use modified binary search (assume 1-based array): lower = 1, upper = 1; while (a[upper] < element) upper *= 2; normal binary search on (lower, upper). otherwise, there no real way it: assume find somewhere equals element need, cannot know if falls out of array.

c# - What is the easiest way to create sequence with entity framework code first approach? -

i want use sequence in ms sql-server generate auto increment number me without table, , application using entity framework 4.4 + code first + sql-server 2008. easiest way create , retrieve value? just add [key] on top of property. should int way. need add dataannotations reference project.

excel - Insert copied row based on cell value -

the vba code below (modified here ) insert blank row above row has value of "0" in column e. instead of inserting blank row, there way copy row "0" , insert above itself? can vba code modified this? sub blankline() dim col variant dim blankrows long dim lastrow long dim r long dim startrow long col = "e" startrow = 1 blankrows = 1 lastrow = cells(rows.count, col).end(xlup).row application.screenupdating = false activesheet r = lastrow startrow + 1 step -1 if .cells(r, col) = "0" .cells(r, col).entirerow.insert shift:=xldown end if next r end application.screenupdating = true end sub just add line .cells(r, col).entirerow.copy before .insert line

javascript - bgStretcher not working in FireFox or Chrome -

okay i'm wrapping website , i'm having issue firefox , chrome. issue same both browsers i'm guessing it's easy fix , i'm being dumb. so i'm using bgstretcher ajaxblender.com. works wonderfully on ie9 when load site on firefox , chrome, bgstretcher either not loading or not loading correctly. background not function background , divs pushed bottom , moved out of whack. html code follows: <script type="text/javascript"> $(document).ready(function(){ // initialize backgound stretcher $('body').bgstretcher({ images: ['images/gervais_street.jpg'], imagewidth: 1024, imageheight: 720, }); }); when comment section out, divs function correctly there no background. can see wrong? here code page: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.

c - How to have absolute padding in printf()? -

i tried printf("%s %15s", string1, string2); and found out kind of left padding depends distance first string, if want absolute left padding counting left most? you want pad first string on right, instead of padding second sting on left: printf("%-15s %s",string1,string2);

sqlite - Rails 4.0rc1 app not running due to missing sqlite3 gem -

first time i've tried installing rails 4.0. on windows 8 ruby 2.0 x64. ran: gem install rails --version 4.0.0.rc1 --no-ri --no-rdoc then run: rails new test_app cd test_app rails s but webpage @ localhost:3000 reports following error: specified 'sqlite3' database adapter, gem not loaded. add gem 'sqlite3' gemfile. it's there in gemfile: gem 'sqlite3' i tried running bundle install several times , doesn't list among other gems. update : i've tried installing sqlite3 gem in 2 different ways, both using terminal opens msys.bat file devkit. way @szines below mentions gives me following error: $ gem install sqlite3 --platform=ruby -- --with-opt-dir=c:/sqlite-amalgamation-3071602 temporarily enhancing path include devkit... building native extensions with: '--with-opt-dir=c:/sqlite-amalgamation-3071602' take while... error: error installing sqlite3: error: failed build gem native extension. c:/ruby

c# - Maximize/Minimize Form With Two KeyDown Methods Not Working -

i'm attempting wpf form maximize or minimize when "enter" pressed. however,when debugging, doesn't work. can write can minimize not maximize, not able both once 1 action performed. if push me in right direction, appreciated. i'm using "enter" placeholder combination of 2 keys haven't decided yet. may annoying some, know, works me @ moment. also, i'm attempting make general overlay program can run in background , can pop when key combination pressed. private void mainwindow_keydown(object sender, keyeventargs e) { if (this.windowstate == windowstate.minimized) { if (e.key == key.enter) { this.windowstate = windowstate.maximized; } } } private void mainwindow_keydown2(object sender, keyeventargs e) { if (this.windowstate == windowstate.maximized) { if (e.key == key.enter) { this.windowstate = windowstate.minimized; } } } try th

c# - Issues with webbrowser control -

i developing windows form application in vs2010.i used webbrowser control view excel files. its getting delay load file in control. , if click on control before loading file, opened in actual excel application. i new control, , dont have idea how resolve this. please me. if suggest other controls operate data excel more grateful. thank you. edit webbrowser1.navigate(this.fileopencontrol.filename); i used above commmad diplay file chosen in fileopen window. , there 2 other same controls used display files. , when switch controls display excel alignment getting changed in same. i have used visible property switch controls below. webbrowser2.visible = false; webbrowser3.visible = false; webbrowser1.visible = true; which display first selected excel file.

opengl - glTexImage2D giving GL_INVALID_VALUE because width or height cannot be represented as 2k + 2 -

i have screenshot taken first opengl canvas need draw in second opengl canvas. have taken screenshot using glreadpixels : glreadpixels(posx, posy, pagewidth , pageheight, gl_rgb, gl_unsigned_byte, data); the first opengl canvas has 2 or more images lines , text data around it. using second opengl canvas show tiling of images surrounding data whole.i not want redraw same in second opengl canvas , hence want take screenshot , draw tiling part of screenshot in second canvas. i have saved snapshot taken in jpg file coming perfectly. but problem comes when need draw pixel data using glteximage2d pagewidth or pageheight used cannot represented 2k+ 2. hence error coming gl_invalid_value . glteximage2d (gl_texture_2d, 0, imgsamplesperpixel), pagewidth, pageheight, 0,samplesperpixel, gl_unsigned_byte, data); the pagewidth , pageheight can of value (lesser gl_max_texture_size ), example 240 x 600. how should solve problem ?

The Python 3.3 equivalent of 'execfile' -

this question has answer here: what alternative execfile in python 3? 12 answers alternative execfile in python 3? [duplicate] 4 answers i need find out how open .py files after writing them in notepad++. find interface more useful python window. in tutorial following along guy uses execfile(pathway) but execfile not work in 3.3. is there equivalent statement in 3.x? open file, read it, , pass contents exec : with open('file.py') source_file: exec(source_file.read())

android - "...cannot be resolved to type" error message; no method suggestions in Eclipse -

ok guys i've got question life of me cannot figured out. i'm using eclipse, , i've got android adt pluging installed, program configured android sdk path, , sdk parts downloaded (google api's, sdk platforms, system images). here problem: whenever go access method object, eclipse gives no method "suggestions" does. i'm not explaining best, i've attached screenshot kind of illustrates issue. public class startingpoint extends activity { int counter; button add; button sub; textview display; //putting add.whatever here doesn't work @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_starting_point); counter = 0; add = (button) findviewbyid(r.id.buttonadd); sub = (button) findviewbyid(r.id.buttonsub); display = (textview) findviewbyid(r.id.textview1); add.setonclicklistener(new view.onclicklistener() { //putting add.wha

mysql - An explanation for BNF rule -

i'm investigating mysql's sql parser @ moment. and here interesting thing have noticed , cannot explain: (in sql_yacc.yy ) predicate: ... | bit_expr between_sym bit_expr and_sym predicate { $$= new (yythd->mem_root) item_func_between($1,$3,$5); if ($$ == null) mysql_yyabort; } the same on expression syntax page: predicate: ... | bit_expr [not] between bit_expr , predicate that means that foo between 1 , bar between 1 , 2 query syntactically correct, while makes no sense @ all. my question: used for? miss if used bit_expr [not] between bit_expr , bit_expr instead? lol (not lol anymore actually) this query executes without errors: select * users id between 1 , id between 1 , 10; // returns row id = 1 select * users id between 2 , id between 2 , 10; empty set (0.00 sec) (update added here) ... , is expected. presumably converts second expression straight 0 or

jquery - ZClip with <p:panelGrid> does not work -

Image
in jsf-primefaces web-application copy clipboard using zclip. works small code snipet given below rongnk doesnot work actual code please find same below: <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <f:view id="offer_details" encoding="utf-8" contenttype="text/html"> <h:head> </h:head> <h:body> <h:outputstylesheet library="default" name="css/discount_box.css" /> <h:outputstylesheet library="default" name="css/discountbox_primefaces.css&

reflection - pass "this" class type as a parameter in c# -

i want create common method classes, ---> restmethods.clearallstaticvalues(this); so here passing argument, class reference. how can catch in method definition, in processing class fields (using reflection), doing in same class. code below---> var varlist = this.gettype().getfields(bindingflags.nonpublic | bindingflags.static).tolist(); varlist.where(x => x.fieldtype == typeof(int32)).tolist().foreach(x => x.setvalue(this, 0)); note: don't wanna use this---> class { restmethods.clearallstaticvalues(this); } & method definition---> restmethods.clearallstaticvalues(a args); because class specific. you can pass type : public static void clearallstaticvalues(type t) { var varlist = t.getfields(bindingflags.nonpublic | bindingflags.static); varlist.where(x => x.fieldtype == typeof(int32)).tolist().foreach(x => x.setvalue(null, 0)); } call this: public class { public static void clear() { //sta

android - Landscape Background with OpenGL1.0 -

im bit confused power of 2 restriction opengles1.0/1.1 what image size should using decent quality landscape background tablet or mobile device? i have tried 512 x 512 , 1024 x 1024, scaling wrong , image looks terrible. android: 1.6,1.7 for such purposes create texture larger image, use texture sub image load data, create texture coordinates fit image. try doing this: float texturewidth = 1; float textureheight = 1; while(texturewidth < imagesize.width) texturewidth <<= 1; while(textureheight < imagesize.height) textureheight <<= 1; //create texture dimensions of texturewidth x textureheight (glteximage2d) //fill data imagesize parameters , raw data image (gltexsubimage) float texturecoordinatewidthratio = imagesize.width/(float)texturewidth; float texturecoordinateheightratio = imagesize.height/(float)textureheight; float texturecoordinates[] = { .0, .0, texturecoordinatewidthratio, .0, .0, texturecoordinateheightratio, texturecoor

reporting services - Number formatting on Y axis in SSRS report -

Image
i creating ssrs below report, y axis getting values more zeros. tried change number format still getting below values more zeros. actual on y axis under 5000. how can rid of zeros y axis. thanks you should able set custom number formatting scale them back. set custom formatting 10,, should it.

java - Getting a Field from an instance? -

is there way field reference instance (not class) ? this example : public class element { @myannotation("hello") public string label1; @myannotation("world") public string label2; } public class app { private element elem = new element(); public void printannotations() { string elemlabel1 = elem1.label; string elemlabel2 = elem2.label; // cannot elemlabel.getfield().getdeclaredannotations(); string elemlabel1annotationvalue = // how ? string elemlabel2annotationvalue = // how ? } } sorry not being clear, know how fetch fields class (class --> field --> declaredannotations) what wondering how field particular instance. in example, elemlabel1 string instance, wish able field of element.label1. what mean? field on defined on class . can value specific instance:- private static class test { private int test = 10; } public static void main(string[] args) throws exc

mongoose npm install on windows 7 fail -

i try install mongoose on windows 64bit 7 using npm install mongoose but receive following error c:\>npm install mongoose npm http https://registry.npmjs.org/mongoose npm http 304 https://registry.npmjs.org/mongoose npm http https://registry.npmjs.org/ms/0.1.0 npm http https://registry.npmjs.org/hooks/0.2.1 npm http https://registry.npmjs.org/mongodb/1.3.3 npm http https://registry.npmjs.org/mpromise/0.2.1 npm http https://registry.npmjs.org/muri/0.3.1 npm http https://registry.npmjs.org/sliced/0.0.3 npm http https://registry.npmjs.org/mpath/0.1.1 npm http 304 https://registry.npmjs.org/mpromise/0.2.1 npm http 304 https://registry.npmjs.org/ms/0.1.0 npm http 304 https://registry.npmjs.org/hooks/0.2.1 npm http 304 https://registry.npmjs.org/muri/0.3.1 npm http 304 https://registry.npmjs.org/mongodb/1.3.3 npm http 304 https://registry.npmjs.org/sliced/0.0.3 npm http 304 https://registry.npmjs.org/mpath/0.1.1 npm http https://registry.npmjs.org/sliced/0.0.4 npm http https://r

Does SASS/SCSS/Compass have a SWITCH function? -

with sass' ability use variables, 1 hope there large set of logic functions can them. is there way this? $somevar: somevalue !default; @switch $somevar { @case 'red': .arbitrary-css here {} @break; @case 'green': .arbitrary-css here {} @break; @case 'blue': .arbitrary-css here {} @break; } however, can't find in sass reference this. sass doesn't support switch case. sass support 4 control directives: @if @for @each @while

redirect - "If" tag in <VIRTUAL_HOST> of httpd.conf file checking HTTP_UESR_AGENT of apache 2.4 not working as expected -

i found out documentation apache 2.3 onwards can use tag in hattpd.conf file. but when tried following in httpd.conf file, not able required redirection. part of httpd.conf file follows: <virtualhost *:80> servername localhost:80 serveralias localhost1 <if "%{http_user_agent} == 'iphone'"> rewriteengine on redirect / http://172.26.50.246:90/ </if> documentroot "c:/apache24/htdocs" </virtualhost> please me in finding flaw in above sniplet... i found solution #-strmatch <if "%{http_user_agent} -strcmatch '*iphone*'"> redirect / http://172.26.50.246:90/ </if>

iphone - How to connect two buttons( dots) with a line in iOS? -

this question has answer here: draw line between 2 points in iphone? 3 answers i want make project in have touch 1 dot , connect dot , after connect dot. when connect 1 dot dot line create between them. actually when click/ touch 1 dot line show , when touch second dot line create between 2 dots. i not able yet, trying , searching on net unable find solution yet. this need 1 https://play.google.com/store/apps/details?id=zok.android.dots&hl=en i think done uigesture recogniser? or else? how can achieve this? any idea or suggestions experts highly welcome. modify code according requiements cgcontextref context = uigraphicsgetcurrentcontext(); uicolor *currentcolor = [uicolor blackcolor]; cgcontextsetstrokecolorwithcolor(context, currentcolor.cgcolor); cgcontextsetlinewidth(context, 2.0); cgcontextbeginpath(context); cgcontextmovetopoint(context

php - Adding CSRF anti-spoofing to Sencha forms -

i made sencha frontend app , backend done php/joomla. data sent sencha js app validated , saved using php joomla framework. how can create csrf token in sencha js app , validate on php/joomla code joomla forms protected token checked on every new post. token hidden field insert form echo jhtml::_('form.token'); this checked in controller jsession::checktoken('post') or jexit(jtext::_('jinvalid_token')); this works fine standard get/post interaction. if you're going ajax, need way retrieve new token after each request made: you controller have return jsession::getformtoken() to frontend, should include in next call. beware: make sure ajax responses not cached: while hidden token input inserted first code snippet handled page cache, must take care of updating other occurrence.

mysql - Persist Text SQL Type via ORMLite (not LONGVARCHAR) -

using datatype.long_string attribute value persisted sql type longvarchar handles longer strings. however, want map field sql type text . @databasefield(datatype = datatype.long_string) string comment; since there difference between longvarchar , text sql type , datatype.long_string value not solve problem so default long_string type supposed generate text schema -- postgres , mysql example. database type using? derby generates long varchar , hsqldb longvarchar , , oracle long . think compatibility reasons. there couple of ways can override schema ormlite produces. easiest define column columndefinition part of @databasefield : @databasefield(columndefinition = "text") string comment; if making more complex changes database compability code, can override databasetype using. in case can override appendlongstringtype(...) method produce different schema. i'd override derbydatabasetype or whatever database using , add like: @override

How to compile Android 4.1/4.2 Camera+Gallery App together -

the android camera , gallery has been merged in android 4.1 , above. now, want play around android 4.2 camera app, , try port on older devices. how compile https://android.googlesource.com/platform/packages/apps/gallery2/ , https://android.googlesource.com/platform/packages/apps/camera/ as far sources etc concerned, both of these should compiled together.however, camera source doesn't have manifest, makes impossible port on eclipse. so, need with: 1.how import both of these projects? 2.how join them 1 single apk (i tried merging res , src folders, still lot of compiling errors). 3.the camera source, while calling popup menus, make reference r.styleable references populate list, instead of normal arrays, i'm unable fix. problem becomes manifold when set build target ics, because r.styleable references refuse cooperate. deleting them brings empty popup menus. any appreciated. thank you. you can have multiple source folders in java project (android pr

backbone.js - Calling destroy on collection -

i doing sample application similar backbone-todo. when invoking destroy on collection it's giving error: uncaught typeerror: cannot read property 'destroy' of undefined how can solve problem. please suggest. following method code: $(function(){ var todo = backbone.model.extend({ defaults: function() { return { title: "empty todo...", order: todos.nextorder(), done: false }; } }); var todolist = backbone.collection.extend({ model : todo, localstorage: new backbone.localstorage("todos-backbone"), done: function() { return this.where({done: true}); }, remaining: function() { return this.without.apply(this, this.done()); }, nextorder: function() { if (!this.length) return 1; return this.last().get('order') + 1; }, comparator: 'order' }); var todoview = backbone.view.extend({ tagname: "li", template: _.template($('#item-template').html()),

Getting first line argument in bash after forking processes -

here file.sh bash script: #!/bin/bash $(awk '/[ \t]+'$1'\/'$2'/' /etc/servicies) | awk '{print '$1'}'; if run: file.sh 21 tcp it should print ftp. error: ./file.sh: line 2: ftp: command not found can explain me little bit why error , how fix it? thanks. awk '/[ \t]+'$1'\/'$2'/ { print $1 }' /etc/services

visual studio 2005 - Query time of ms access on network -

a ms access 2000 mdb file hosted on network drive. inside mdb, tbl_history table has 42,223 records. every month, new 2,400 records stored on table. a customized application developed vs 2005 queried on table. query - select top 1 memonth, meyear tbl_history snapdate in (select max(snapdate) tbl_history companycode = 'abc' to query result, takes minute. there way fine-tune query time? thank you.

debugging - Eclipse Android - Debugger doesn't stop at breakpoint on OnClick method -

i want debug onclick method in saveactivity : public class saveactivity extends activity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_save); getactionbar().setdisplayhomeasupenabled(true); } // button // (http://developer.android.com/training/implementing-navigation/ancestral.html) @override public boolean onoptionsitemselected(menuitem item) { switch (item.getitemid()) { case android.r.id.home: // called when home (up) button pressed // in action bar. intent parentactivityintent = new intent(this, mainactivity.class); parentactivityintent.addflags(intent.flag_activity_clear_top | intent.flag_activity_new_task); startactivity(parentactivityintent); finish(); return true; } return super.onoptionsitemselected(item); } public void onclick(view view) { switch (view.getid()) { // <--

java - updating in db from resultset -

the sql statement layers returns more 1 value, want update column in db these values problem here? string cust_code = session.getattribute("cust_code").tostring(); string video_typ = session.getattribute("video_typ").tostring(); int personal_p = integer.parseint(session.getattribute("personal_p").tostring()); int layers_p = integer.parseint(session.getattribute("layers_p").tostring()); string parent_cod = session.getattribute("parent_code").tostring(); class.forname("com.mysql.jdbc.driver"); connection con = drivermanager.getconnection("jdbc:mysql://localhost:3306/ontube", "root", "123456"); statement st = con.createstatement(); string personal_po = "update customers set personal_p =personal_p + '"+personal_p+"' membership_num='"+cust_code+"' "; string first_layer=&q

python - Pandas: Using Unix epoch timestamp as Datetime index -

my application involves dealing data (contained in csv) of following form: epoch (number of seconds since jan 1, 1970), value 1368431149,20.3 1368431150,21.4 .. currently read csv using numpy loadtxt method (can use read_csv pandas). series converting timestamps field follows: timestamp_date=[datetime.datetime.fromtimestamp(timestamp_column[i]) in range(len(timestamp_column))] i follow setting timestamp_date datetime index dataframe. tried searching @ several places see if there quicker (inbuilt) way of using these unix epoch timestamps, not find any. lot of applications make use of such timestamp terminology. is there inbuilt method handling such timestamp formats? if not, recommended way of handling these formats? convert them datetime64[s] : np.array([1368431149, 1368431150]).astype('datetime64[s]') # array([2013-05-13 07:45:49, 2013-05-13 07:45:50], dtype=datetime64[s])

Google App Engine - Update JPA 1 to JPA 2 -

Image
i want update gae web app use jpa 2.0. doc here , says have copy content of appengine-java-sdk/lib/opt/user/datanucleus/v2/ lib folder of project. this files of appengine-java-sdk/lib/opt/user/datanucleus/v2/ : asm-4.0.jar datanucleus-api-jdo-3.1.3.jar datanucleus-api-jpa-3.1.3.jar datanucleus-appengine-2.1.2.jar datanucleus-core-3.1.3.jar geronimo-jpa_2.0_spec-1.0.jar jdo-api-3.0.1.jar jta-1.1.jar currently, content of project's lib folder might affect migration: appengine-api-1.0-sdk-1.7.7.1.jar appengine-api-labs.jar appengine-endpoints.jar appengine-jsr107cache-1.7.7.1.jar asm-3.3.jar asm-commons-3.3.jar asm-tree-3.3.jar datanucleus-appengine-1.0.10.final.jar datanucleus-core-1.1.5.jar datanucleus-jpa-1.1.5.jar geronimo-jpa_3.0_spec-1.1.1.jar geronimo-jta_1.1_spec-1.1.1.jar jdo2-api-2.3-eb.jar jsr107cache-1.1.jar which files should delete? tried delete files have new version eclipse looking older files: datanucleus-appengine-1.0.10.fi

emgucv - Element-wise square of a matrix in EMGU CV -

i need element-wise square of matrix. in matlab find code: if a matrix a.^2 calculates element wise square of matrix. there function in emgu cv same? actually need standard deviation of matrix. if there function of computing standard deviation of method computing standard deviation more helpful me. element-wise square same element-wise multiplication matrix itself. so, following code line should trick (assuming matrix called mat ): mat._mul(mat); be aware though replaces original mat . if want have saved, can do: matrix<byte> squaredmatrix = mat.copy(); squaredmatrix._mul(mat);

loops - Generate all coordinates of earth? -

does know algorithm calculates/generates coordinates of earth? want generate dot mesh high resolution. each dot represents 1 real coordinate of earth. (latitude , longitude minutes , seconds or in decimal format) not coordinates, somehow possible them all? the x or longitude range on earth -180.0 180.0 y or latitudinal range on earth -90.0 90.0 unit degrees, distance between 2 degrees (on equator) 111 km. choose step, loop.

Sanity check my Rails "Roles and Users" approach with Devise and Cancan -

been kicking 1 while now, , knows rails test theory (i'm new rails). in (simplified) scenario, want manage list of users, of are, example, "paid" users, "free" users etc, , there straight "isa" relationship. i.e. paid user isa user, free user isa user etc to reduce redundancy , keep semantically correct, want manage users in 1 table , use foreign-key correct "type" of user, can create role of correct type. e.g. instantiate user, id , store in user of correct type e.g. "paiduser" in "user_id" foreign-key. gives me ability store specific metadata want store against them, , don't have have 1 table ("users") every field every type of user. this sort of feels confusion of roles , types of users. question is, using approach above going make life difficult? there accepted approach in rails i'm missing? i'm using devise , have removed routes except /users/ thinking pass "type" argument, ,

Custom Form not showing up in magento -

i having difficulty getting form show on magento store working on. site has contact form i've copied form.phtml file , renamed brochure.phtml. i've created static page on cms section , added line of code based on this qusetion {{block type="core/template" template="contacts/brochure.phtml"}} when view page though nothing shows up. doing wrong? i've never used magento before please detailed in answers if can. cms -> pages ->select page -> select "content" on left side navigation post code there {{block type="core/template" name="contactform" form_action="/contacts/index/post" template="contacts/brochure.phtml"}} make sure brochure.phtml file in same folder form.phtml file. if cms page coming header, body format , rest of website layout middle content section plain white not loading brochure.phtml. if case try loading default form, replace "brochure.phtml" &quo

java - Getter for mutable object -

i read many articles how write right getter/ setter mutable object date or array. when changed on public date getdateto() { return (date) dateto.clone(); } public void setdateto(date dateto) { this.dateto = (date) dateto.clone(); } i java.lang.nullpointerexception . means shoul initialize date in (post)constructor? it dateto not constructed, there nothing clone. answer yes - should initialize it.

git - How to make a small change with a meaningful commit message that can be reverted? -

in using git, try make 1 small change @ time , commit each change separately. lets me have detailed commit messages, , lets me revert individual changes easily, described in blog post (not mine). when working on 1 large feature, see small unrelated bug fix. per current system, have note bug fix later (usually code comment), commit large feature, go , fix bug. i wondering if branches let me make fix bug , push commit immediately, while finish feature in branch. can push fix both public repository and 'adding feature' branch? branches seem bit unwieldy this, there simpler method result i'm looking for? it sounds should developing feature in feature branch (see, instance, this branching model ). so feature work in feature branch. when bug fix needed, switch feature branch master branch do bug fix in master push master switch feature branch continue work on feature

android - Error in importing project n eclipse -

this question has answer here: project has no target set. edit project properties set one 8 answers i'm trying add project eclipse. import. eclipse write project has no target set. edit project properties set one. what do? added project, files empty. right click on project --> android --> selecte proper android version. this solve porblem

pgadmin - Canot connect to postgresql server from out -

i want connect postgresql server occur below error. search , find result below after these again error occured in postgresql.conf change listen_addresses localhost * in pg_hba.conf change 127.0.0.1/32 0.0.0.0/0 reboot server error: could not connect server: connection refused.is server running on host "ip number" , accepting.tcp/ip connections on port 5432? i suggest should following steps. check postgresql server running. check listen_addresses parameter ( postgresql.conf ) check port number of postgresql ( port parameter of postgresql.conf ) check firewall policy of database server , set allow port of postgresql. if want connect db server, may shoud set pg_hba.conf following : # type database user cidr-address method local trust host 0.0.0.0/0 md5

python - Different way to implement this threading? -

i'm trying out threads in python. want spinning cursor display while method runs (for 5-10 mins). i've done out code wondering how it? don't use globals, assume there better way? c = true def b(): j in itertools.cycle('/-\|'): if (c == true): sys.stdout.write(j) sys.stdout.flush() time.sleep(0.1) sys.stdout.write('\b') else: return def a(): global c #code stuff here 5-10 minutes #simulate sleep time.sleep(2) c = false thread(target = a).start() thread(target = b).start() edit: another issue when processing ends last element of spinning cursor still on screen. \ printed. you use events: http://docs.python.org/2/library/threading.html i tested , works. keeps in sync. should avoid changing/reading same variables in different threads without synchronizing them. #!/usr/bin/python threading import thread threading import event import tim

ruby - 'string' to ['s', 'st', 'str', 'stri', 'strin', 'string'] -

what's elegant way of doing 'string' => ['s', 'st', 'str', 'stri', 'strin', 'string'] i've been trying think of 1 liner, can't quite there. solutions welcome, thanks. you can use abbrev in standard library require 'abbrev' s = abbrev::abbrev(['string']).keys puts s.inspect i must add other way use after requiring abbrev library, .abbrev method added array: require 'abbrev' s = ['string'].abbrev.keys puts s.inspect if order important match return in question, call .sort on keys .

ios - Refresh UITableView with iCloud changes -

i have app have intergrated core data icloud. have following notifications in view controller. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(reloadfetchedresults:) name:nspersistentstorecoordinatorstoresdidchangenotification object:coredatacontroller.psc]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(reloadfetchedresults:) name:nspersistentstoredidimportubiquitouscontentchangesnotification object:coredatacontroller.psc]; the view controller contains uitableview loaded core data using nsfetchedresultscontroller . unsure put in following method (called notifications above) refresh table. have tried reloading table, , refetching data no avail. know icloud doing job because if reload viewcontroller changed data shows. - (void)reloadfetchedresults:(nsnotification*)note { nslog(@"underlying data changed ... refreshing!"); //_fetchedresultscontroller=nil; //[self fetchedresultscontroller]; [theta