Posts

Showing posts from March, 2015

c# - Modifying a property to automatically resolve "Cannot modify the return value" error -

i'd know if there's built-in or easy implement way handle "cannot modify return value because not variable" problem. let's have class: myclass { rectangle _rect = new rectangle(1, 2, 3, 4); public rectangle rect { { return _rect; } set { _rect = value; } } } this i'm trying do: rect.width += 20; // , error pops the usual approach instead: rect = new rectangle(rect.x, rect.y, rect.width + 20, rect.height); but there has way automate it, right? , don't mean adding bunch of properties myclass rect_width , such (because have 9 rectangles in real class implementation, , bad), make line of code work: rect.width += 20; there's nothing can circumvent problem, since rectangle-class immutable , that's way intended work. however, expose method encapsulates creation of new rectangles: myclass { rectangle _rect; public rectangle rect { { return _rect; } set { _rect = value; } } public void addwidth(int

c# - Understanding the JWT token for Google OAuth2 -

eta 2: i able figure out using publicly-available documentation , so's extensive knowledge of cryptography, along convenient code example on msdn handled important part of oauth2 implementation - verifying integrity of signed jwt. i detailed in three-part series on blog. the critical component verifying integrity of jwt response oauth2 provider - many devs fail implement due poor understanding of cryptographic functions, why public documentation various providers (including google) recommend using pre-existing library handle authentication. the problem dotnetopenauth hasn't been updated in years , , don't recommend using aging library authentication, since there's no telling security holes may remain unpatched. the verification component in c# makes use of rsapkcs1signaturedeformatter.verifysignature, , t he sample code in msdn article on method pretty verbatim need use ensure signed jwt valid , has not been intercepted malicious third party. eta: i p

javascript - .slideToggle(); works on every other div? -

i'm trying work slidetoggle in order show post information when clicking on + sign. you can see progress on test blog here: http://noitsnotitsnotokay.tumblr.com/ so far, have html , javascript (the html portion repeats every post, , because of tumblr defauts, can't create new class every post): <div id="info"> <div class="pstinfo"> <!-- info here --> </div> <span class="plsign">+</span> </div> <script> $("div.pstinfo").hide(); $("span.plsign").click(function() { $(this).parent().children("div.pstinfo").stop().slidetoggle("slow"); return false; }); </script> as can see in test blog, works in 1 post, , in next, won't open way. there way fix this? the main problem see in code, repeating code block each time on each comment. so, have multiple div same id & multiple <script> blocks same bind actions. like: {blo

c# - Search entire workbook and fetch out values -

in excel workbook the first sheet tab contains number name code subject 100 mark abc mathematics 101 john xyz physics second sheet tab contains number name code subject 103 mark def chemistry 104 john ghi biology i want pass code(which going unique) parameter , search entire excel workbook and fetch name , subject.. ie..select name,subject myexcelworkbook code='abc' i able sheet names, column count etc. not able search thro' entire excel workbook , required values const string filename="c:\\filename.xls"; oledbconnectionstringbuilder connectionstringbuilder = new oledbconnectionstringbuilder(); connectionstringbuilder.provider = "microsoft.ace.oledb.12.0"; connectionstringbuilder.datasource = filename; connectionstringbuilder.add("mode", "read"); const string extendedproperties = "excel 12.0;imex=1;hdr=yes"; connectionstringbu

javascript - jQuery's jquery-1.10.2.min.map is triggering a 404 (Not Found) -

Image
i'm seeing error messages file, min.map , being not found: get jquery's jquery-1.10.2.min.map triggering 404 (not found) screenshot where coming from? if chrome devtools reporting 404 .map file (maybe jquery-1.10.2.min.map , jquery.min.map or jquery-2.0.3.min.map , can happen anything) first thing know requested when using devtools. your users not hitting 404. now can fix or disable sourcemap functionality. fix: files next, it's easy fix. head http://jquery.com/download/ , click download map file link version, , you'll want uncompressed file downloaded well. having map file in place allows debug minified jquery via original sources, save lot of time , frustration if don't dealing variable names a , c . more sourcemaps here: an introduction javascript source maps dodge: disable sourcemaps instead of getting files, can alternatively disable javascript source maps now, in settings. fine choice if never plan on debugging j

hibernate - How do I specify DISTINCT when using JPA 2? -

i'm using hibernate 4.1.0.final, mysql 5.5, , jpa 2.0. when returning values jpa query, how specify "distinct" clause without rewriting function sql (or jpql) statement? below if how have coded jpa method far ... final list<returnedobject> foundreturnedobjects = new arraylist<returnedobject>(); final criteriabuilder builder = m_entitymanager.getcriteriabuilder(); final criteriaquery<returnedobject> query = builder.createquery(returnedobject.class); final root<joinedobject> joinedobject = query.from(joinedobject.class); final join<joinedobject, returnedobject> returnedobject = joinedobject.join(joinedobject_.returnedobject); if (params != null && !params.isempty()) { query.where(joinedobject.get(joinedobject_.organization).in(params)); query.select(returnedobject); foundreturnedobjects.addall(m_entitymanager.createquery(query).getresultlist()); } // if return foundreturnedobjects; however, problem duplicate ite

java - How to get month number from Calender -

line holds month name given user. display month number. example: june -> 6 present code: string line="june"; int monthno = integer.parseint(gregoriancalendar.class.getfield(line.touppercase()).get(line))+1; system.out.println(monthno); what best method this? edit: using existing calender classes java's calendar api not best api around. many people therefore changed use http://www.joda.org/joda-time/ quasi alternative standard. if application simple, think hard-coding map of names pointing numbers easiest , efficient solution (assuming, string in fact user input, otherwise, use enum suggested). alternatively, can use date format .

xcode - Add database to compiled application -

i using sqlite3 database in xcode/ios application , database copied compiled application folder. i've added .db file project, doesn't copied. idea why ? check target settings sql database.

cuda - using FFTW compatablity mode in cuFFT -

i have full project created using fftw. want transition using cufft. understand cufft has "compatibility mode". how work? the cufft manual says: after application working using fftw3 interface, users may want modify code move data , gpu , use routines documented in fftw conversion guide best performance. does mean need change individual function calls? example, call cufftplan1d() instead of fftw_plan_dft_1d() . do have change data types? fftw_complex *inputdata; // fftw data storage gets replaced.. cufft_complex *inputdata; // ... cufft data storage? fftw_plan forwardfft; // fftw plan gets replaced... cuffthandle forwardfft; // ... cufft plan? if i'm going have rewrite of code, point of cufftsetcompatabilitymode(.) ? probably want cufftw interface cufft . suggest read documentation close have in mind. allow use cufft in fftw application minimum amount of changes. indicated in documentation, there should

mysql - PHP How to filter array values -

i'm trying show in div 3 thumbnails stored in different folders. in bd determined (with value "1") record has pictures. db: +------+----------------+---------+--------+--------+ | id | brand | php | ruby | java | +------+----------------+---------+--------+--------+ | 1 | ford | 1 | 0 | 0 | +------+----------------+---------+--------+--------+ | 2 | seat | 1 | 1 | 1 | +------+----------------+---------+--------+--------+ | 3 | fiat | 1 | 1 | 0 | +------+----------------+---------+--------+--------+ | 4 | toyota | 1 | 0 | 0 | +------+----------------+---------+--------+--------+ | 5 | vw | 1 | 0 | 1 | +------+----------------+---------+--------+--------+ selecting records: $result = mysqli_query($connecdb,"select * brands php = '1' or ruby = '1' or java = '1' order id asc&

java - How to make Weakrefernce in Concurrent HashMap -

in program have scenario, mutiple thread operate (put , get) on single map. thread using put key/value in map , same time thread retrieving key/value map same or different key. if make map synchronize wil big performance issue, decided move concurrenthashmap. during scenario, have complexity after period of time(not known application) few of key/value pairs not needed in application, need remove same(garbage collection) free memory. though programm doesn't have idea key/values not needed thought use weakrefernce. so, after ceratin period of time if key(string) not reachable automatically garbage collected. know process same in weakhashmap doesn't know process in concurrenthashmap. so, can tell me how weakrefernce in concurrenthashmap. or else there other way achieve above scenario? looking through weakhashmap code seems there no straight forward way of doing of following form should work: (this code has not been tested think @ least on correct path, implements put

entity framework - EF Code-First - Fluent API Mapping -

i have set of relationships not sure to set in fluentapi. here distilled model: public class customer { public int id { get; set; } public string name { get; set; } public virtual icollection<reference> references { get; set; } } public class reference { public int id { get; set; } public string relationship { get; set; } // brother, father, etc public virtual customer linkedcustomer { get; set; } public virtual customer referencefor { get; set; } } referencefor links references in customer. linkedcustomer references customer reference based on. basically, customer can reference other number of customers. i think many-many , many-one set of relationships, not sure how specify them in fluent api. appreciated! modelbuilder.entity<customer>() .haskey(x => x.id) .hasmany(x => x.references) modelbuilder.entity<references>() .haskey(x => x.id) .hasoptional(x => x.linkedcustomer

java - android- setAdapter on AlertDialog not working -

i making list of user's tumblr blogs in pop-box. of happens within handler. here code: private class pichandler extends handler{ context c; string name; jumblrclient client; public pichandler(context context, string n, jumblrclient cl){ c=context; name = n; client = cl; } public void handlemessage(message msg) { final string[] cs = preferences.getstring("allblogs", "").split(","); (string s : cs){ log.d("drawlog", s); //logs blogs correctly } listadapter adapter = new arrayadapter<string>( getapplicationcontext(), android.r.layout.simple_selectable_list_item, cs); log.d("drawlog", (string) adapter.getitem(0)); //logs first blog correctlys new alertdialog.builder(c) .settitle("choose blog") .setmessage("choose blog publish .gif") .setadapter(adapter, n

tomcat - Can I force a grails dev server to reload when any code recompiles? -

the short question is: can force grails 2.2 dev server reload (reinitializing singleton services, etc) whenever new code hot-compiled , swapped in? let me make question clear example. let's i have singleton-scoped service called myservice . in @postconstruct function, initializes new object of type helper (and holds on reference). i run-app in dev mode, test things out, , then... i edit source code helper.groovy what happens next is: grails automatically recompiles helper.groovy grails swaps new code running dev server but new helper code isn't called because already-instantiated myservice object has handle on instance of old kind. my current workaround keep dependency graph in head , , touch or trivially modify myservice every time change 1 of dependencies . i'd rather force dev server reload whenever new code swapped in. so... is possible force dev server reload whenever code changes ? and bonus question : when change domain object, way

ember.js - Redirect don't work with afterModel -

i have following route: var userroute = ember.route.extend({ aftermodel: function(model) { // model.ensurealldata(); }, redirect: function (model) { this.transitionto('user.followers', model); } }); after adding aftermodel hook, redirection don't work anymore, code in hook commented out. i guess should put transitionto aftermodel hook , remove redirect @ all, if i'm not mistaken deprecated in favor aftermodel : var userroute = ember.route.extend({ aftermodel: function(model) { //model.ensurealldata(); this.transitionto('user.followers', model); } }); hope helps.

codeigniter - PHP Write string to new line for the first time and not at the end of file -

using codeigniter function write_file() , can write existing file this: write_file("path_to_file", "string four"."\n", "a+"); assume have file this: string 1 string 2 string 3 with write_file("path_to_file", "string four"."\n", "a+") , have ouput below when writing file first time: string 1 string 2 string 3 string 4 any idea how can write string four new line first time? shown below: string 1 string 2 string 3 string 4 thanks. not knowing write_file() function, given said, should work : write_file("path_to_file", "\n"."string four"."\n", "a+")

iphone - NSFetchRequest does not read updated rows -

the data gets downloaded , written in core data in background thread (child/parent context) using nsfetchrequest first time reading ok. after refresh, pull data core data , update new values. again reading data nsfetchrequest in main thread/main context. still returns old values. have checked core data table , has new values in it. , can see updated data after killing , restarting app. what doing wrong? ps: sorry cant post code. huge project. other parts of project based on core data works perfectly. part getting on nerve. :-( the problem fetchresult controller retrieving objects on main thread , had group on more 1 attribute , calculate date current time zone. had allthis done in background thread. once again learned core data objects not thread safe!

c++ - Remove item from std::list with only having access to the iterator -

std::list double linked list. doesn't mean should possible remove item list having access iterator? maybe question wasn't clear enough. #pragma once #include <list> typedef std::list<int> intlist ; typedef intlist::iterator intiterator; class inthiddenlist { private: intlist list; public: intiterator addint(int x) { list.push_front(x); return list.begin(); } }; int main() { inthiddenlist a; intiterator = a.addint(5); // how go deleting 5 list using "it"? } yes, notionally it's possible. however, standard library not allow (it requires container , iterator erase). however you're in luck: boost provides boost::instrusive ( http://www.boost.org/doc/libs/1_54_0/doc/html/intrusive/list.html ) capability want.

iphone - Should I animate a three dots loading animation using Core Animation or should I find a way to show a gif of the same operation? -

basically have 3 dots supposed bigger , smaller in succession on loading screen , i'm wondering best way simple animation - coding or otherwise? for simple animation can use uiimageview animation animate set of images (i.e. use images frames in animation). uiimageview* dotsimageview= [[uiimageview alloc] initwithframe:dotsframe]; // load frames of animation dotsimageview.animationimages = @[[uiimage imagenamed:@"image1.png"], [uiimage imagenamed:@"image2.png"], [uiimage imagenamed:@"image3.png"]]; // set how long take go through images dotsimageview.animationduration = 1.0; // repeat animation forever dotsimageview.animationrepeatcount = 0; // start animation [dotsimageview startanimating]; // add view [self.view addsubview:dotsimageview]; if don't want use preset images dots, can chain uiview animations using completion block. here's tutorial on uiview anim

javascript - Scroll to top of IFrame when submit the form in iframe -

i have form placed in iframe.i have added javascript function validation. rise error message when click submit button without filling mandatory fields. the form contains more 8 fields. error message displayed in top of page. when click submit button, stays bottom of page. that, error message not visible. for scroll in iframe, have added following code, parent.parent.window.scroll(0,0); it takes me top of page in iframe.but , skips javascript validation. passes request without validation. please me on one. thanks in advance set id error's wrapping div, use javascript's window.location move internally id, after - , depending- mandatory field validation code (you can put in conditional statement). example on how use it: <!doctype html> <html> <head> <script> function scroll(){ window.location = '#error'; } </script> </head> <body> <div id='e

extjs - Preselect items in EXT JS 4.2 Grid -

i trying preselect items in ext grid based on value of 1 of items in data store. in data store fetch 7 items, last item grab 'installed' boolean , use preselect items in grid. here code have far not working... ext.require([ 'ext.grid.*', 'ext.data.*', 'ext.selection.checkboxmodel' ]); ext.onready(function(){ ext.quicktips.init(); var sb = $('#sb_id').val(); // data store var data = ext.create('ext.data.jsonstore', { autoload: true, fields: [ 'name', 'market', 'expertise', 'id', 'isfull', 'isprimary', 'installed'], proxy: { type: 'ajax', url: '/opslibrary/getlibraryjsonedit', extraparams: { sb_id: sb }, actionmethods: 'post' }, sorters: [{ property: 'market', direction: 'asc' }, { property: 'expertise', directio

c - Function declaration: K&R vs ANSI -

this question has answer here: alternative (k&r) c syntax function declaration versus prototypes 6 answers what differences between k&r function declaration , ansi function declaration? k&r syntax obsolete, can skip unless have maintain old code. // k&r syntax int foo(a, p) int a; char *p; { return 0; } // ansi syntax int foo(int a, char *p) { return 0; }

iphone - Setting UITabBarIcon tint when unselected -

Image
i trying set icons of uitabbaritem, not working. way, i'm using xcode 5 beta project. @implementation appdelegate - (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { { [[uitabbaritem appearance] settitletextattributes:[nsdictionary dictionarywithobjectsandkeys:[uicolor whitecolor], nsforegroundcolorattributename, nil] forstate:uicontrolstatenormal]; uiimage *tabbarbackground = [uiimage imagenamed:@"tabbar.png"]; [[uitabbar appearance] setbackgroundimage:tabbarbackground]; [[uitabbar appearance] setselectionindicatorimage:[uiimage imagenamed:@"tabbar_selected.png"]]; [[uitabbar appearance] settintcolor:[uicolor whitecolor]]; } return yes; } i trying icons white when both selected , unselected, remaining gray in unselected state. edit i tried doing this, im getting error "expression result unused" uitabbarcontroller *tabbarcon

Read youtube channel xml file with c# xmldocument -

i want channel information , list of files rss feed channel. instance, http://gdata.youtube.com/feeds/api/users/google/uploads rss feed google. how title feed, instance? or list of videos? tried webclient wc = new webclient(); xmldocument xd = new xmldocument(); xd.loadxml(wc.downloadstring(strurl)); xmlnode xn = xd.selectsinglenode("/feed/title"); but xn returning null. tried "/title", "feed/title", , "title", none of worked. list of videos, tired xmlnodelist vids = xd.selectnodes("/entry"); and few other permutations without success. (edit adding xml info no 1 have click on link) here's top of xml file looks like: <?xml version='1.0' encoding='utf-8'?> <feed xmlns="http://www.w3.org/2005/atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:opensearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:gd="http://schemas.google.com/g/

What would happen when facebook reaches maximum autoincrement value -

i wondering. happen facebook database store messages when autoincrement column (bigint) reaches maximum value? it fall over. it's not happen time given how big bigint (nine quintillion 2 hundred twenty 3 quadrillion 3 hundred seventy 2 trillion thirty 6 billion). thats presuming use sort of system store messages, if used nosql system wouldn't happen.

Stepping through regex pattern matches in Python: -

in python: assignment not allowed in conditionals. the state of regex match determined based on returned match object contains other match info. now want match particular pattern out of 10 or 15, end cluttered this: m = pat1.match(buffer) if m: tok = tok1 val = m.group(0) else: m = pat2.match(buffer) if m: tok = tok2 val = m.group(0) else: m = pat3.match(buffer) if m: tok = tok3 val = m.group(0) # processing here , there - makes looping unsuitable else: m = pat4.match(buffer) if m: tok = tok4 val = m.group(0) else: # ... keep indenting we have follows: if match ... pat1: tok = val = elif match ... pat2: tok = val = elif match ... pat3: tok = val = ... (like can done in other languages possibly using features like: assignment in conditionals, side effe

c++ - Issues with including headers from static library -

i may missing something, i'm trying include mongodb c++ driver library build dll project. i'm trying follow this guide i've tried including folder in configuration properties->linker->general->additional library directories, , .lib file in linker->input->additional dependencies. i've added /mt command-line option. now here comes problem - how use files? use #include "mongo/client/dbclient.h" , because doesn't seem work (cannot open source file). can't find of helpful documentation on subject. any ideas?

android - search items in database and display dropdown list -

i have following app architecture (generalized simplification): main layout consists of actionbar custom view , scrollable tabs , , viewpager hosting multiple listfragments . each listfragment has own set of data (1 row = imageview + textview ) loaded sqlite database. in actionbar's custom view have "search" edittext . when user starts typing something, i'd perform "on-the-go" search in database , display matching names (those names should clickable) in form of dropdown list. saw examples how perform search in listview , nothing related database search. so question is: how display database search results dropdown list , refresh anytime user adds or removes character? you need implement autocompletetextview . allows suggestions user typing. can bind data searched for, using adapters . this should solve problem. an example might helpful can found here .

How do I edit jQuery.mmenu.js to allow classes (not only IDs) to be targeted? -

i'm working on mobile site , want reveal hidden submenus underneath divs twitter's mobile site (swipe tweet reveal other options). interface in jquery.mmenu.js plug-in, it's limited target ids , need target classes. i'm sure set-up fred, means theoretically changed. the code can downloaded here: http://mmenu.frebsite.nl/ ps. post intended fred per contact requirements, if can think of solution i'd love try it. this should work well: $('.classselector').mmenu(); only real issue plugin binds dragging events "page". therefor opening menu dragging across page limited 1 menu per direction ("left","right", "top", "bottom"). i guess relatively easy change plugin can bind dragging events specified element (via configuration) fallback "page". until implemented in official plugin, try this: for ( var = 0; < 10; a++ ) { $(".menu" + a).mmenu({ dragopen :{

google maps - Using iframe to embed HTML fragment -

i wanting embed html fragment (a google maps div) using iframe. (it has iframe, because requirement of wordpress plugin using.) embedding entire html of map page making google map misbehave. possible (and practice) embed 'page' not complete html page - i.e., 'page' html snippet (in case, map div , associate javascript)? an idea set iframe appropriate width , height , set scrolling attribute "no". i've seen many times.

asp.net - Keep drop down value in edit mode of datagrid same even when user clicks between different controls -

this question related scenario.i have datagrid editable. 1 of columns drop down list when in edit mode. out of data grid have 2 radio buttons (open,all). (outside grid,not within column)default open selected. based on selected radio button , list drop down in edit mode changes. suppose grid in edit mode , open selected. selected value of "a" show in drop down. chosen value. user clicks on "all" , list varies. "a" no longer present in list when "all" selected (works intended). grid still in edit mode user clicks on "open". should see "a" selected value drop down. (when grid not in edit mode "a" value binded column.so when edit clicked drop down appears "a" selected value). my question how save/preserve original value there when edit clicked. user has neither hit cancel or update yet. can hide in list,making invisible or how? important thing when user clicks on "all" , should not see "a&q

cross validation using pls function in R -

Image
i'm new r , have been trying use following code (thanks stackoverflow) cross validating mars regression. i'm getting error when execute code. in addition above question, there way print results cross validation? i appreciate if help. library(earth) library(pls) set.seed(1) k <- 10; result <- 0; folds <- cvsegments(nrow(trees), k); (fold in 1 : k){ currentfold <- folds[fold][[1]]; fit = earth(volume ~ ., data=trees[-currentfold,]) pred = predict(fit, trees[currentfold,]); result <- result + table(true=trees[currentfold,3], pred=pred) } because k-fold cross validation gets 1 prediction per case (row) in each run, can collect predictions in vector (or matrix, more iterations/repetitions and/or multiple predicted values per case): library(earth) library(pls) set.seed(1) k <- 10; folds <- cvsegments(nrow(trees), k); result <- rep (na, nrow (trees)) (fold in 1 : k){ currentfold <- folds[[fold]] fit = earth(volume ~ ., d

java - Does Class.getDeclaredFields() return members in a consistent order? -

the documentation describes method as: the elements in array returned not sorted , not in particular order however not sure if implies order not consistent each time application invokes routine. i looking way pair unique id each field found - needs consistent next time application run, i.e continuously generate same id. i wanting iterate on each field found , increment counter per each element iterated. assign id of particular element whatever counter equal to, these 'ids' aren't consistent though if fields not returned in consistent order. the order not required stable across runs. however, field's hashcode() value defined stable (it's documented field.getdeclaringclass().getname().hashcode() ^ field.getname().hashcode() ), may able use id, understanding hash code not guaranteed unique. alternatively, may sort results returned getdeclaredfields() yourself, using whatever sorting criteria suits you.

ruby - Handling two independent gems that cause compatible version issue for Bundler -

if have gemfile is source 'https://rubygems.org' gem "heckle", "~> 2.0.0.b1" gem "reek", "~> 1.3.2" then error message fetching gem metadata https://rubygems.org/......... resolving dependencies... bundler not find compatible versions gem "ruby_parser": in gemfile: reek (~> 1.3.2) ruby depends on ruby_parser (~> 3.1.1) ruby heckle (~> 2.0.0.b1) ruby depends on ruby_parser (2.3.1) is possible tell bundler heckle , reek don't need work each other, , therefore it's ok have 2 versions of ruby_parser? for unfamiliar 2 gems involved, heckle , reek both gems provide executables analyse source code. don't need required code.

ffmpeg - sdl cross compile fail -

i want cross compile ffmpeg arm ffplay, needs sdl. so, have cross compile sdl. download latest sdl, , configure. there errors, error: 'ullong_max' undeclared (first use in function), how solve? , how cross compile sdl successfully?

java - org.hibernate.HibernateException error -

i'm getting error continuously...eclips ide appach tomcat root cause java.lang.classnotfoundexception: org.hibernate.hibernateexception org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1680) org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1526) java.lang.classloader.loadclassinternal(unknown source) com.rmi.servlet.provinceservlet.dopost(provinceservlet.java:59) javax.servlet.http.httpservlet.service(httpservlet.java:643) javax.servlet.http.httpservlet.service(httpservlet.java:723) you need add hibernate dependency project. basically, need add 1 of these jars: http://www.jarfinder.com/index.php/java/info/org.hibernate.hibernateexception here how eclipse: http://www.wikihow.com/add-jars-to-project-build-paths-in-eclipse-(java)

upload - ServiceStack PostFIleWithRequest "has" hard coded content-disposition name field -

i have issue postfilewithrequest<> method in servicestack in name of file field hard coded word "upload"> part of data stream content-disposition: form-data;name="upload";filename="julie.mp3" and line 407 in file serviceclientbase.cs stream.write("content-disposition: form-data;name=\"{0}\";filename=\"{1}\"{2}{3}".formatwith(new object[] { "upload", filename, text, text })); this contained in virtual method not know how can change in derived class there other methods not accessible new class. public virtual tresponse postfilewithrequest<tresponse>(string relativeorabsoluteurl, stream filetoupload, string filename, object request) any ideas? this bug me name of form-data;name should configurable , not hard coded. in case need file in name called "file" in order use specific api. chris i submitted pull request servicestack (albeit v4) has been accepte

webhooks - github service hook and basic authentication -

i'm trying figure out how secure webhook reciever github service hook. in github manual pages, when in section on ip addresses github hooks come from, has warning: "we highly recommend don't white list ips service hooks. instead, setup https , basic authentication verify incoming requests." https://help.github.com/articles/what-ip-addresses-does-github-use-that-i-should-whitelist#service-hook-ip-addresses in documentation on post receive hooks don't see way set basic authentication. how can use basic authentication github post-recieve/service/web hook notifies me of commit repository? i think can use https://youruser:yoursecret@yoursite.net/path like in basic auth situation. i give try tomorrow, :) https://github.com/blog/237-basic-auth-post-receives

android - sqlcipher - how safe is sqlcipher? has it been hacked? -

it encrypts sqllite database @ page level, ok thats fine, nothing wrong that! but source code? compiled, if compiled decompile it, retrieve password , decrypt database? how safe sqlcipher? according sqlcipher design documentation , based on secure components (aes, openssl, hmac_sha1, pbkdf2,...). if claims correct, sounds me. what bit unusual (to me, @ least) there random iv per page. different typical file system encryption mode aes-xts . design used sqlcipher has advantages on aes-xts, example writing same data again not result in same encrypted page. however, possibly there disadvantages, example i'm not quite sure if sqlcipher possible move or copy pages (copy encrypted pages page). might not possible, design document don't see how prevented. such risk if non-standard encryption mode used :-) if problem, wouldn't allow attacker read data; allow types of attacks. aes-xts types of attacks possible, wouldn't worried much. what source code? to

unity3d - Sell items in a game -

like angry birds or candy crush saga, there items can have if buy it, want know how done, because i'm making game want put system in game, how work? there 2 ways system can work. 1 can pay-to-win system, other can pure cosmetic system. with pay-to-win, game free has store in players can buy items or other stuff make them better non-paying players. example can buying gun in shooter has more damage other weapon obtainable free. the other thing can cosmetic system. there, can choose buy stuff not better other players. think of hack 'n slash game, in can buy huge sword, twice large free obtainable weapon. damage range stays same. other things can is: "pay play", "pay remove commercials", "pay play longer each day", , more.

java me - Out of memory error native Image decode Error while loading image to gallery -

i trying load image folder application, code using is fileconnection fc = null; datainputstream in = null; dataoutputstream out = null; try { fc = (fileconnection)connector.open("file:///e:/images/abc.jpg"); int length = (int)fc.filesize();//possible loss of precision may throw error byte[] data = null; if (length != -1) { data = new byte[length]; in = new datainputstream(fc.openinputstream()); in.readfully(data); } else { int chunksize = 112; int index = 0; int readlength = 0; in = new datainputstream(fc.openinputstream()); data = new byte[chunksize]; { if (data.length < index + chunksize) { byte[] newdata = new byte[index + chunksize]; system.arraycopy(data, 0, newdata, 0, data.length); data = newdata; } readlength = in.read(data, index, chunksize); index += readlength; } while (readlength == chunksize); length = index; } image image = image.createimage(data

how to evaluate a mathematical function in matlab? -

i novice in matlab , searching, how solve mathematical function in matlab. it's want, want solve function f(x)=x^2+2x+1, x=2. want take x^2+2x+1 , 2 input , show output. from link , saw how solve mathematical function. procedure available in link is: >>f = @(x) 2*x^2-3*x+4; >>f(3) ans = 13 so, wrote following part in script: f=input('enter function: ','s'); v = input('parameter: '); f=@(x)f; disp(f(v)); when provide x+1 , 3 input, ans getting x+1. how solve problem? thanks in advance. your f variable string says "x + 1" . you'll have ask matlab interpret string function in order numerical value. one way of doing using eval f = input('enter function: ', 's' ); v = input('parameter: '); myfun = sprintf('@( %s ) %s', v, f ); % string f = eval( myfun ); % interpret string command f( 3 ), % math - evaulate f(3) edit, clarification based on comments below: above solutio

opencv - Business card segmentation and location -

recently,i writing program business card recognition. firstly, should segment input image , locate business card region. compute gradient , detect lines using hough transformation. in cases method works well, in cases didn't because lines can detected in background. don't know how deal problem. please provide me ideas , suggestion.

c# - Cancelling Google caledar event by iCal -

i have used dday.ical library in .net send event. sending event working fine , event can added google calendar, cancelling event, after sending cancellation email, event still in google calendar. could please guide me how cancel google calendar event ical ? this event file: begin:vcalendar version:2.0 prodid:-//ddaysoftware.com//nonsgml dday.ical 1.0//en begin:vevent description:a dtend:20130820t180000 dtstamp:20130820t050748z dtstart:20130820t180000 sequence:0 summary:a uid:c7da09c3-12c3-4e6c-8ab4-4c9bdede2221 end:vevent end:vcalendar this cancellation event file begin:vcalendar version:2.0 prodid:-//ddaysoftware.com//nonsgml dday.ical 1.0//en method:cancel begin:vevent description:acancel dtend:20130820t180000 dtstamp:20130820t050748z dtstart:20130820t180000 sequence:1 status:cancelled summary:acancel uid:c7da09c3-12c3-4e6c-8ab4-4c9bdede2221 end:vevent end:vcalendar you missing mandatory properties organizer , attendee in both original event , in cancellatio

javascript - How to make array of values of objects -

<input name="hello">value1 <input name="hello">value2 <input name="hello">value3 <input name="hello">value4 var = getelementsbyname('hello') now, how create array contains (value1,value2,value3,value4)? i thought of using makearray, returns objects not values. you can iterate on them, or use map. var items = array.prototype.map.call(a, function(el){ return el.nextsibling.textcontent; }); demo var items = []; (var i=0; i<a.length; i++) { items.push(a[i].nextsibling.textcontent); } demo

ruby - Scraping data based on the text of other neighboring elements? -

i have code this: <div id="left"> <div id="leftnav"> <div id="leftnavcontainer"> <div id="refinements"> <h2>department</h2> <ul id="ref_2975312011"> <li> <a href="#"> <span class="expand">pet supplies</span> </a> </li> <li> <strong>dogs</strong> </li> <li> <a> <span class="refinementlink">carriers &amp; travel products</span> <span class="narrowvalue">&nbsp;(5,570)</span> </a> </li> (etc...) which i'm scriping this: html = file data = nokogiri::html(open(html)) categories = data.css('

Github "Updates were rejected because the remote contains work that you do not have" -

i created new repo, cloned it, added files directory, added them add -a , committed changes, , when try push using git push <repo name> master "updates rejected because remote contains work not have". this doesn't seem make sense since it's new repo , contains readme file. this happens if initialized new github repo readme and/or license file git remote add origin [//your github url] //pull changes git pull origin master //now, push work new repo git push origin master now able push repository github. basically, have merge new initialized files work. git pull fetches , merges you. can fetch , merge if suits you.

integration testing - Rails test with Capybara check if attribute of an element present or not -

i need find weather no-follow link exists in external email , should not in internal email. test "should have nofollow in external links , not in internal links in comment" visit @game_path fill_in('comment_comment', :with => 'please click link <a href='http://www.internallink.com/soccer'> internal link <a/> , click external link <a href='http://www.google.com'> external link <a/> click_button('submit_comment') assert page.has_no_css?('div.error'), "error div found on page after posting comment" assert page.has_content?('please click link '), "comment not found on page after posting" ext = find(:xpath, "//a[@href='http://www.google.com']") assert_equal(ext['rel'], "nofollow") internal = find(:xpath, "//a[@href='http://www.internallink.com/soccer']") assert_equal(internal.try(:rel), nil) end it givin

asp.net - Procedure not updating the data in the database -

this asp code: <body> <form id="form1" runat="server"> <div> <asp:gridview id="gridview1" runat="server"> <columns> <asp:commandfield showeditbutton="true" /> <asp:templatefield headertext="id" insertvisible="false"> <edititemtemplate> <asp:textbox id="textbox1" runat="server" text='<%# bind("id") %>'></asp:textbox> </edititemtemplate> <itemtemplate> <asp:label id="lblid" runat="server" text='<%# bind("id") %>'></asp:label> </itemtemplate> </asp:templatefield> <asp:templatefield headertext="firstname"> <edititemtemplate>

java - Jackson empty xml array deserialization -

i have incoming xml recurly service list of transactions. it's empty , looks this: <transactions type="array"> </transactions> i need deserialize using jackson. i've tried next mapping @xmlrootelement(name = "transactions") public class transactionobjectlistresponse extends arraylist<transactionobjectresponse> { } where transactionobjectresponse class each transaction. works fine non-empty collections, fails when no transactions came. next message appears: java.lang.illegalstateexception: missing name, in state: end_array @ com.fasterxml.jackson.dataformat.xml.deser.fromxmlparser.getcurrentname(fromxmlparser.java:310) @ com.fasterxml.jackson.databind.deser.beandeserializer.deserializefromobject(beandeserializer.java:289) @ com.fasterxml.jackson.databind.deser.beandeserializer._deserializeother(beandeserializer.java:157) @ com.fasterxml.jackson.databind.deser.beandeserializer.deserialize(beandeserializer.java:123) @ com.faster

iphone - How to add a callout having one title -

my map code: if (latitude != [nsnull null] && longitude != [nsnull null]) { location.latitude=[latitude doublevalue]; location.longitude=[longitude doublevalue]; myannotationview *newannotation=[[myannotationview alloc]initwithtitle:[nsstring stringwithformat:@"bus-%d",h] latitude:location.latitude longitude:location.longitude]; [self.mymap addannotation:newannotation]; mymap.maptype=mkmaptypestandard; [mymap setcentercoordinate:location animated:yes]; mkcoordinateregion region = mkcoordinateregionmakewithdistance(location,1000,1000); [mymap setregion:region animated:yes]; } -(void)locationmanager:(cllocationmanager *)manager didupdatetolocation:(cllocation *)newlocation fromlocation:(cllocation *)oldlocation { location.latitude=newlocation.coordinate.latitude; location.longitude=newlocation.coordinate.longitude; myannotationview *newannotation=[[myannotationview alloc]initwithtitle:[nsstring stringwithformat:@"bus

xml - Magento 1.7*: How do I add "Logout"-link in the sidebar, of my-account-page -

i add "logout" link magento shop, developing. in page "my account", left sidebar under links (last link @ bottom): account dashboard account information adress book etc. how add link @ bottom? i think should add line of code in customer.xml. i guess should in block: <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml"> <action method="addlink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>account dashboard</label></action> <action method="addlink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>account information</label></action>

entity framework 5 - C# .NET 4.5 and EF 5 update navigation property (foreign key) -

i can't update navigation property have 2 entities: user public class user : entity { public string username { get; set; } public string password { get; set; } public int? addressid { get; set; } public virtual address address { get; set; } } and address public class address : entity { public string addressname { get; set; } public int userid { get; set; } public virtual user user { get; set; } } when trying following: address.user = user; address userid updates succesfully, , in commit method, entity state modified. users addressid won't update. here context public dbset<user> users { get; set; } public dbset<address> addresses { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { modelbuilder.entity<user>() .hasoptional(x=>x.address) .withmany() .hasforeignkey(x=>x.addressid) .willcascad

include - Are the following assertions about Go packages accurate? -

are following assertions go packages accurate? import "package_name" imports files directory called package_name assuming found in $gopath, variable holds users go directory, or in standard go installation directory tree. files within package_name directory state package package_name . not required to. in fact, import "package_name" , import file including line package foo if file found in imported package_name directory. all functions capitalized accessed through name given in package package_name declaration--for instance: package_name.function_in_file_that_declares_package_name or other_than_package_name.function_in_file_that_declares_other_than_package_name user defined packages command-line go install -ed within package directory. however, go refuse install directory named identically builtin package directories. instance cannot install strings directory since go has strings directory builtin package "strings." however, user can appe