Posts

Showing posts from May, 2012

c# - Need help resolving redirect_uri_mismatch error -

i'm using google/facebook/linkedin authentication on asp.net mvc 5 website. reason, every once in while, users complain not being able login because redirect_uri_mismatch error. as said, what's strange error seems happen intermittently , users. i'm including code down below can point out i'm doing wrong. here's startup.cs file code using system; using system.collections.generic; using system.linq; using system.security.claims; using system.web; using owin; using owin.security.providers.linkedin; using microsoft.owin.security.cookies; using microsoft.owin.security.facebook; using microsoft.owin.security.google; namespace mywebsite { public class startup { public void configuration(iappbuilder app) { // set app use cookies authentication var cookieoptions = new cookieauthenticationoptions { authenticationtype = "cookies", cookiesecure = cookiesecureoption.s...

reactjs - list not ordering well dynamic children -

my problem react not respecting order giving backend. it gives me warning. child objects should have non-numeric keys ordering preserved i checked documentation , don't know error is. dynamic children i'm passing key component , doesn't work... i have films component code {this.props.films && this.props.films.map((film, i) => <filmslistitem key={film.id()} data={film}/> ).tojs()} then have filmlistitem this <div> <div classname="show-image"> <img onclick={this.modifyfilm.bind(this, this.props.data)} src={this.props.data.foto()} title={this.props.data.nombre()} alt={this.props.data.nombre()} width="230" height="345"/> <input type="button" classname="delete" value="borrar"...

c++ - Box doesn't roll in Bullet Physics -

Image
as can see in image, box doesn't roll slides on slope. here how create box in code, config = new btdefaultcollisionconfiguration(); dispatcher = new btcollisiondispatcher(config); broadphase = new btdbvtbroadphase(); solver = new btsequentialimpulseconstraintsolver(); bworld = new btdiscretedynamicsworld(dispatcher, broadphase, solver, config); bworld->setgravity(btvector3(0, -9.8f, 0)); // ... bttransform t; t.setidentity(); t.setorigin(btvector3(position.x, position.y, position.z)); btboxshape* box = new btboxshape(btvector3(size.x, size.y, size.z)); btvector3 inertia(0, 0, 0); float mass = 10.f; box->calculatelocalinertia(mass, inertia); btmotionstate* mstate = new btdefaultmotionstate(t); btrigidbody::btrigidbodyconstructioninfo cinfo(mass, mstate, box); //cinfo.m_restitution = 0.4f; //cinfo.m_friction = 0.5f; btrigidbody* body = new btrigidbody(cinfo); //body->setlinearfactor(btvector3(1,1,0)); //body->setangularfactor(btvector3(0,0,1)); m_impl->bw...

How to change/add chart data series in python-pptx? -

i'm trying set data in existing chart using python-pptx. from pptx import presentation pres_path = "c:\\pres.pptx" pres = presentation(pres_path) pres.slides[3].shapes[4].chart.series[0].values (92.0, 330.0, 309.0, 313.0, 356.0, 421.0, 457.0) pres.slides[3].shapes[4].chart.series[0].values = (1,2,3) traceback (most recent call last): file "<input>", line 1, in <module> attributeerror: can't set attribute there's method mentioned in documentation seems relevant, can't understand how use it: http://python-pptx.readthedocs.org/en/latest/_modules/pptx/chart/data.html pres.slides[3].shapes[4].chart.replace_data((1,2,3)) traceback (most recent call last): file "<input>", line 1, in <module> file "c:\python27\lib\site-packages\pptx\chart\chart.py", line 119, in replace_data _seriesrewriter.replace_series_data(self._chartspace, chart_data) file "c:\python27\lib\site-packages...

java ee - JPA Entities and GlassFish server -

hello i'm creating simple javaee application. i've started creating ejb module has create databases jpa. problem cannot create these databases glassfish server (without maven project works) here 1 of entity classes: package task.jpa.dto; import java.io.serializable; import javax.persistence.column; import javax.persistence.entity; import javax.persistence.generatedvalue; import javax.persistence.generationtype; import javax.persistence.id; import javax.persistence.table; /** * * @author ml */ @entity @table(name = "model", schema = "komis") public class modeldto implements serializable { @id @generatedvalue(strategy = generationtype.identity) private int id; @column(name = "marka", nullable = false, length = 30) private string marka; @column(name = "nazwa_modelu", nullable = false, length = 30) private string nazwamodelu; public int getid() { return id; } public void setid(int id) { this.id = id; } public string getm...

HTML/CSS Same size no matter text -

Image
hey need section's, how make section size unchangeable no matter text size. photo: i want both section same size in left no matter text size. here css #info2 { background-color: white; float: left; width: 45%; padding-bottom: 2%; padding-left: 2%; padding-right: 2%; margin-top: 2%; padding-top: 0.1%; } #info3 { background-color: white; float: right; width: 45%; margin-top: 2%; padding-left: 2%; padding-right: 2%; } create add class sections want same , call sectionheight. create css setting height. for example; html <div class="sectionheight" id="info2"></div> <div class="sectionheight" id="info3"></div> css #info2 { background-color: white; float: left; width: 45%; padding-bottom: 2%; padding-left: 2%; padding-right: 2%; margin-top: 2%; padding-top: 0.1%; } #info3 { background-color: white; fl...

c - "Multiple definition", "first defined here" errors -

i have 3 projects: server , client , commons . making header & source pairs in commons doesn't cause problems , can access functions freely both server , client . however, reason making additional source/header files within server or client project causes multiple definition of (...) , first defined here errors. example: commands.h (in root dir of client project) #ifndef commands_h_ #define commands_h_ #include "commands.c" void f123(); #endif /* commands_h_ */ commands.c (in root dir of client project) void f123(){ } main.c (in root dir of client project) #include "commands.h" int main(int argc, char** argv){ } errors: make: *** [client] error 1 client first defined here client multiple definition of `f123' commands.c cleaning, rebuilding index, rebuilding projects doesn't help. neither restarting computer. the problem here including commands.c in commands.h before function p...

java - Error:Android Pre Dex: Android SDK is not specified -

i have downloaded gdx-setup.jar website , run as: java -jar gdx-setup.jar i select options want , generate project idea (libgdx 1.6.2). when click in generate button, tool doesn't throw me error. when run idea 14.1.3 go file > open... , select ipr file generated. when try run desktop launcher, idea throw me next error: error:android pre dex: [android] android sdk not specified i have tried different build tools , api of android (most of them throw me warnings when pressed generate button gdx-setup.jar ). using build tools 20.0.0 , api 20 , configuration gdx-setup.jar doesn't throw me warnings. i check local.properties of general project: sdk.dir=/home/xxxx/escritorio/android-sdk-linux-libgdx/ right check file > project structure... > sdk's > android sdk , right: /home/xxxx/escritorio/android-sdk-linux-libgdx any advice? thanks. go in project structure, select platform settings -> sdks (left panel) add android sdk selecting...

javascript - Search and replace a text sequence in html -

i trying search , replace text sequence in website. webpage has text "#45421" (# followed 5 digits). need replace <a href="http://example.com/45421">#45421</a> . tried below code this, var mystring = $('.content').html(); var re = /\b\#d{5}\b/g; mystring.replace(re, "<a href='http://example.com/'"+re+">"+re+"</a>"); but unable desired results. see text sequence replaced links script executed. script injected page chrome extension. missing here? you need use regex capturing groups - put parentheses around part of regex want capture, , refer in replacement string $1 (and, if you're capturing multiple, next $2 , on): mystring.replace(/#(\d{5})\b/g, '<a href="http://example.com/$1">#$1</a>'); your regex has misplaced escape backslash - d should escaped, not #

html - Responsive HTML5 Video -

i trying make video fill entire window width , height. video should resize, if window resized. therefore might have change aspect ratio. got scrolling bars on right, should removed somehow. this code far: html: <html> <head> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <video autoplay loop id="bgvid"> <source src="myvideo.mp4" type="video/mp4"> </video> </body> </html> css video#bgvid { position: absolute; top: 50%; left: 50%; min-width: 100%; min-height: 100%; transform: translate(-50%, -50%); z-index: -100; -webkit-transform: translatex(-50%) translatey(-50%); transform: translatex(-50%) translatey(-50%); } jsfiddle : http://jsfiddle.net/6u1krl0l/ to fill complete window should ensure video have same aspect ratio window, tricky. i think best option ensure fi...

Python decorator pattern: reducing code duplication involving inner functions and functools.wraps -

i'm seeing lot of documentation on stackoverflow , elsewhere how write python decorators. typically recommend using functools.wraps , (potentially multiple) inner functions. complex if want decorator can either called or without brackets, i.e. @foo or @foo(bar) . for example, this stackoverflow question , various answers give lot of insight how this. however, appear rather surprisingly complicated (either conditional logic or deeper nesting of functions) seems conceptually simple. biggest concern that, in examples given, >50% of code unrelated particular decorator's behavior , shared boilerplate among decorators written using pattern. the real-world examples looking @ the fabric project's decorators.py , some of django project's various decorator.py instances . seems bit strange me there lot of boilerplate code unrelated actual intent. i understand why want use functools.wraps code maintainability reasons, seems overly complex. there way dry and/or enc...

Spring <mvc:resources /> returns 404 error -

i can't mvc:resources work, returns http 404 error. relevant part of applicationcontext.xml: <mvc:resources mapping="/resources/**" location="file:///c:/users/asus/desktop/app_images/" /> i have .jpeg file in folder c:/users/asus/desktop/app_images called "user_dfd3f052138649fe8e76fb46e62e2417.jpeg". if go address http://localhost:8084/pro/resources/user_dfd3f052138649fe8e76fb46e62e2417.jpeg http 404 error, can image url file:///c:/users/asus/desktop/app_images/user_dfd3f052138649fe8e76fb46e62e2417.jpeg potentially relevant part of deployment descriptor file: <context-param> <param-name>contextconfiglocation</param-name> <param-value>/web-inf/applicationcontext.xml</param-value> </context-param> <context-param> <param-name>imagesfolderroot</param-name> <!--<param-value>/home/asus/app_images/pro</param-value>--> <param-value>c:\users\a...

python - Multiplying raw_input variables -

i'm getting stuck in multiplying variables. example... hrs = raw_input("enter hours:") float(hrs) rateperhr = raw_input("enter rate:") float(rateperhr) grosspay = (hrs) * (rateperhr) the error i'm getting is: traceback (most recent call last): file "hello.py", line 5, in <module> grosspay = (hrs) * (rateperhr) typeerror: can't multiply sequence non-int of type 'str' how solve this? i guess forgot to: hrs = float(hrs) and: rateperhr = float(rateperhr) no need parentheses: grosspay = hrs * rateperhr

android - This Handler class should be static or leaks may occur (null) -

this handler class should static or leaks may occur (null) is 'class' message referring 'myactivity' here, since handler object , did declare static. should ignore or there should add, 'static' somewhere in 'myactivity' declaration (i tried , got errors). notice 'weakreference' suggested lint warning. public class myactivity extends activity{ ... static handler handler; ... handler = new handler() { public void handlemessage(message msg) { since handler object , did declare static you declared data member static. however, using anonymous inner class, , therefore subclass of handler not static . instead of: handler = new handler() { public void handlemessage(message msg) { // cool stuff } }; use: handler=new myveryownhandler(); where myveryownhandler either regular java class or static inner class: private static class myveryownhandler extends handler { public void handlemessage(mess...

html - Repositioning an image on mobile view -

Image
i trying place image when window size reaches <= 700px. however cannot image centered in position want, continues stay in left. here code: http://www.bootply.com/7lautspsg4 /* css used here applied after bootstrap.css */ .nofix { background-color: #363535; padding: 10px; margin-bottom: 10px; } .nofixtable { margin-left: auto; margin-right: auto; vertical-align: top; } .about { vertical-align: top; } .nofixtable p { color: white; height: auto; min-height: 200px; border: 1px solid white; max-width: 400px; width: auto; text-align: justify; margin-left: 20px; margin-right: 20px; margin-top: -5px; } .nofixtable h3, .nofixtable h4 { color: white; text-align: left; margin-left: 20px; font-size: 25px; } .nofixtable td { text-align: center; width: auto; } #fiximg { width: 400px; height: auto; } #repairimg { width: 400px; height: auto; margin-top: 10px; } .nofixtable hr { ...

php - Laravel Argument 1 passed string given -

so been 2 hours , can't still app work. getting error exception argument 1 passed app\http\controllers\programcontroller::index() must instance of app\user, string given . here route: $app->bind('user', function($value, $route) { return user::findorfail($value); }); $app->get('program/profile/{user}', 'app\http\controllers\programcontroller@index'); and in controller: public function index(user $user) { return view('auth.welcome', compact('user')); } whenever run http://localhost:8000/program/profile/username , error. thoughts? try: public function index($username) { $user = user::where('username', '=', $username)->first(); return view('auth.welcome', compact('user')); }

java - how to get the right Element from recyclerView -

we developing android application we're walking problem. we have recyclerview filled cardview's based on database results. inside cardview have button. now try create onclick effect on button (this works). but when onclick button in cardview want code return specefic id cardview. we tried use getparent() but returns same cardview if press button on cardview. possible without creating onclick on recyclerview itself? we want unique id of cardview edit: we want button on card extract information on card fragment: package info.androidhive.materialnavbar.fragment; import android.os.bundle; import android.support.v4.app.fragment; import android.support.v4.app.fragmenttransaction; import android.support.v7.widget.linearlayoutmanager; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import java.util.arraylist; import java.util.list; import java.util.map; import in...

Mobile Web App login and show data in tables using jquery ajax and php -

i creating app let's students login , show module have registered in styled tables. have done server side login , respond in json format have little knowledge in ajax , jquery not sure how use json keys values of variables in jquery. this is have on server side , responds in json upon successful or failed login , return student info + modules (to added sql query) : <?php ob_flush(); ob_clean(); ob_end_flush(); ob_end_clean(); ob_start(); $server = "sqlserveraddress\sqlexpress"; $connectioninfo = array( "database"=>"dbname", "uid"=>"sa", "pwd"=>"sqlpassword" ); $conn = sqlsrv_connect( $server, $connectioninfo ); $username=$_post["sid"]; $password1= sha1($_post["password"]); $sql = "select name, sid, dob students sid = '$username' , ` `password='$password1'"; $params = array(); $options = array( "scrollable" => sqlsrv_cursor_k...

java - Android how to draw line between 2 points -

i newbie in android studio , took code stackoverflow. have problem draw line between 2 points. can draw line between 2 points like: b c. want draw lines between them want. c or c a. wanted draw lines on image background. have background there, when draw line background app lagging. here's code: package com.example.grzegorz.kropy; import android.content.context; import android.content.res.resources; import android.graphics.bitmap; import android.graphics.canvas; import android.graphics.color; import android.graphics.paint; import android.graphics.path; import android.graphics.point; import android.graphics.drawable.*; import android.util.attributeset; import android.util.typedvalue; import android.view.motionevent; import android.view.view; import android.graphics.bitmapfactory; import java.util.arraylist; import java.util.list; public class paintview extends view { private bitmap mbitmap; private canvas mcanvas; // holds "draw" calls private path mpath; //create e...

python - How to permissions to a group in Django 1.8? -

i have 'document' model has many-to-many relationship user model.there separate web page in project displays document instance in text editor. now suppose user created 1 document wants invite other users document.but wants give read-only permission , read-write permission others. how implement permission functionality in django?how groups , other permissions frameworks work in django? django group , permission applies on model itself. specific entry of document if want give access user in case need change schema of document model. add users_who_can_read=manytomany(users) , users_who_can_write=manytomany(users) , , @ view.py when user trying load page check if in users_who_can_read or not. i think should solve problem without problem.

database - Android listview with filter issue -

i have listview of items coming database. have put edit text @ top of listview. want when user start typing in edit text, listview should filtered. example, if user enters letter "a", names starting "a" should appear in list. have used custom adapter in code. asked question many times, haven't found solution yet. this data list activity code: public class datalistactivity extends activity { listview listview; sqlitedatabase sqlitedatabase; fooddbhelper fooddbhelper; cursor cursor; listdataadapter listdataadapter; private button button1; listdataadapter dataadapter = null; button button; dataprovider dataprovider; arraylist<hashmap<string, string>> namesslist; edittext inputsearch; string search_name; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); requestwindowfeature(window.feature_no_title); setcontentview(r.l...

vb.net - Optimal sizes to display X picture boxes in an given space -

Image
i searched before posting couldn't find close issue. what need figure out how come optimal width , height of picture boxes (with 4:3 ratio), given required number of boxes displayed, , available space. now, it's not simple dividing available space number of required boxes, because available space not uniform shape, rather 2 rectangles of size may vary (see picture, it's a+b space). if fact, have tried starting there following code : private sub layoutsnapshots() dim ltotalspace single, lsnapsize single, sxsize single, sysize single dim integer, j integer, x integer = 0, y integer = 0, opic picturebox ' bsnaps number of picture boxes displayed if stsetting.bsnaps = 0 exit sub ' osnaps list(of pictureboxe) groupp actual picture boxes if osnaps.count > 0 each octrl picturebox in osnaps me.controls.remove(octrl) next end if osnaps.clear() ' calculating a+b space shown on picture ...