Daily Archives

Articles indexed Sunday June 8 2014

Page 10/15 | < Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Incomplete mesh using DrawIndexedPrimitives after rotating mesh

    - by user1278255
    Through help on this site I was able to draw the triangles of an unrotated, nonscaled nontransformed mesh created in Blender and exported to OBJ, accurately imported through Assimp and rendered in XNA Graphics. However after applying rotation on a single axis in Blender(Z) and adding materials(I wanted to test loading of materials through Assimp) the same mesh appears incomplete. Is something wrong with my view matrix or is it something else? This is what the unrotated mesh looks like: http://www.4shared.com/photo/qXNUSvxtba/okcube.html Here is the rotated mesh: http://www.4shared.com/photo/HAys2rWvba/badcube.html Camera, View and Projection are defined as follows: cameraPos = new Vector3(0, 5, 9); viewMatrix = Matrix.CreateLookAt(cameraPos, new Vector3(0, 0, 1), new Vector3(0, 1, 0)); projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 1.0f, 200.0f); Rendering is done through this code: device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0); effect = new BasicEffect(GraphicsDevice); effect.VertexColorEnabled = true; effect.View = viewMatrix; effect.Projection = projectionMatrix; effect.World = Matrix.Identity; foreach (EffectPass pass in effect.CurrentTechnique.Passes) { pass.Apply(); device.SetVertexBuffer(vertexBuffer); device.Indices = indexBuffer; device.DrawIndexedPrimitives(Microsoft.Xna.Framework.Graphics.PrimitiveType.TriangleList, 0, 0, oScene.Meshes[0].VertexCount, 0, mMesh.FaceCount); } base.Draw(gameTime);

    Read the article

  • determine collision angle on a rotating body

    - by jorb
    update: new diagram and updated description I have a contact listener set up to try and determine the side that a collision happened at relative to the a bodies rotation. One way to solve this is to find the value of the yellow angle between the red and blue vectors drawn above. The angle can be found by taking the arc cosine of the dot product of the two vectors (Evan pointed this out). One of my points of confusion is the difference in domain of the atan2 function html canvas coordinates and the Box2d rotation information. I know I have to account for this somehow... SS below questions: Does Box2D provide these angles more directly in the collision information? Am I even on the right track? If so, any hints? I have the following javascript so far: Ship.prototype.onCollide = function (other_ent,cx,cy) { var pos = this.body.GetPosition(); //collision position relative to body var d_cx = pos.x - cx; var d_cy = pos.y - cy; //length of initial vector var len = Math.sqrt(Math.pow(pos.x -cx,2) + Math.pow(pos.y-cy,2)); //body angle - can over rotate hence mod 2*Pi var ang = this.body.GetAngle() % (Math.PI * 2); //vector representing body's angle - same magnitude as the first var b_vx = len * Math.cos(ang); var b_vy = len * Math.sin(ang); //dot product of the two vectors var dot_prod = d_cx * b_vx + d_cy * b_vy; //new calculation of difference in angle - NOT WORKING! var d_ang = Math.acos(dot_prod); var side; if (Math.abs(d_ang) < Math.PI/2 ) side = "front"; else side = "back"; console.log("length",len); console.log("pos:",pos.x,pos.y); console.log("offs:",d_cx,d_cy); console.log("body vec",b_vx,b_vy); console.log("body angle:",ang); console.log("dot product",dot_prod); console.log("result:",d_ang); console.log("side",side); console.log("------------------------"); }

    Read the article

  • OpenGL ES, orthopgraphics projection and viewport

    - by DarkDeny
    I want to make some simple 2D game on iOS to familiarize myself with OpenGL ES. I started with Ray Wenderlich tutorial (How To Create A Simple 2D iPhone Game with OpenGL ES 2.0 and GLKit). That tutorial is quite good, but I miss some parts of a puzzle. Ray creates orthographic projection using some magic numbers like 480 and 320. It is not clear to me why did he take these numbers, and as far as I can see - sprite is not mapped to the ipad simulator screen one-to-one pixel. I tried to play with parameters with which ortho matrix is created, but I cannot figure out what math is here. How can I calculate numbers (bottom, top, left, right, close, far) which will be parameters to orthographic projection matrix creation and have sprite on the screen shown in its original size?

    Read the article

  • How can I rename by CarrierWave file versions?

    - by AKWF
    Upon the uploading of an image in my application, 4 different sizes are created and saved using CarrierWaves version functionality. However, I am converting all of these versions to JPEG. The source file that is uploaded remains unchanged. So I can upload a TIFF file, and CarrierWave will create :large, :medium, :small, and :thumb versions. My problem is that these files all still end in .tif. Yet they are indeed JPEG files, as I've verified this with the file command. How can I write the filenames correctly for each version, and ensure that CarrierWave will report each version's name correctly?

    Read the article

  • Javascript - Wait for function to return

    - by LoadData
    So, I am working on a project which requires me to call upon a function to get data from an external source. The issue I am having, I call upon the function - However the code after the function call is continuing before the function has returned a value. Here is the function - function getData() { var myVar; var xmlLoc = $.get("http://ec.urbentom.co.uk/StudentAppData.xml", function(data) { $xml = $(data); myVar = $xml; console.log(myVar); console.log(String($xml)); localStorage.setItem("Data", $xml); console.log(String(localStorage.getItem("Data"))); return myVar; }); return myVar; console.log("Does this continue"); } And here is where it is called upon - $(document).on("pageshow","#Information",function() { $xml = $(getData()); //Here is the function call console.log($xml); //However, it will instantly go to this line before 'getData' has returned a value. $xml.find('AllData').each(function() { $(this).find('item').each(function() { if ($(this).find('Category').text()=="Facilities") { console.log($(this).find('Title').text()); //Do stuff here } else if ($(this).find('Category').text()=="Contacts" || $(this).find('Category').text()=="Information") { console.log($(this).find('Title').text()); //Do stuff here too } }); $('#informationList').html(output).listview().listview("refresh"); console.log("Finished"); }); }); Right now, I'm unsure of why it is not working. My guess is that it is because I am calling a function within a function. Does anyone have any ideas on how this issue can be fixed?

    Read the article

  • Tuple struct constructor complains about private fields

    - by Grubermensch
    I am working on a basic shell interpreter to familiarize myself with Rust. While working on the table for storing suspended jobs in the shell, I have gotten stuck at the following compiler error message: tsh.rs:8:18: 8:31 error: cannot invoke tuple struct constructor with private fields tsh.rs:8 let mut jobs = job::JobsList(vec![]); ^~~~~~~~~~~~~ It's unclear to me what is being seen as private here. As you can see below, both of the structs are tagged with pub in my module file. So, what's the secret sauce? tsh.rs use std::io; mod job; fn main() { // Initialize jobs list let mut jobs = job::JobsList(vec![]); loop { /*** Shell runtime loop ***/ } } job.rs use std::fmt; pub struct Job { jid: int, pid: int, cmd: String } impl fmt::Show for Job { /*** Formatter ***/ } pub struct JobsList(Vec<Job>); impl fmt::Show for JobsList { /*** Formatter ***/ }

    Read the article

  • NSTextField is not changing value?

    - by Curnelious
    Migrating from iOS , i might do something stupid ,but after 1 hour i couldn't change the text in a NSTextField. Yes, its connected with an outlet, and i have tried to remove and add a few of them to the costume view, by choosing the xib file,drag a line from the NSTextField to the class than created this: @property (strong) IBOutlet NSTextField *ProgressLabel; I can see on the screen the label ,but it wouldn't change : NSLog(@"starting "); [self.ProgressLabel setStringValue:@"1 2 4"]; I keep seeing a "label" on screen..

    Read the article

  • Suffix if statement

    - by Aardschok
    I was looking for a way to add a suffix to jointchain in Maya. The jointchain has specific naming so I create a list with the names they need to be. The first chain has "_1" as suffix, result: R_Clavicle_1|R_UpperArm_1|R_UnderArm_1|R_Wrist_1 When I create the second this is the result: R_Clavicle_2|R_UpperArm_1|R_UnderArm_1|R_Wrist_1 The code: DRClavPos = cmds.xform ('DRClavicle', q=True, ws=True, t=True) DRUpArmPos = cmds.xform ('DRUpperArm', q=True, ws=True, t=True) DRUnArmPos = cmds.xform ('DRUnderArm', q=True, ws=True, t=True) DRWristPos = cmds.xform ('DRWrist', q=True, ws=True, t=True), cmds.xform('DRWrist', q=True, os=True, ro=True) suffix = 1 jntsA = cmds.ls(type="joint", long=True) while True: jntname = ["R_Clavicle_"+str(suffix),"R_UpperArm_"+str(suffix),"R_UnderArm_"+str(suffix),"R_Wrist_"+str(suffix)] if jntname not in jntsA: cmds.select (d=True) cmds.joint ( p=(DRClavPos)) cmds.joint ( p=(DRUpArmPos)) cmds.joint ( 'joint1', e=True, zso=True, oj='xyz', radius=0.5, n=jntname[0]) cmds.joint ( p=(DRUnArmPos)) cmds.joint ( 'joint2', e=True, zso=True, oj='xyz', radius=0.5, n=jntname[1]) cmds.joint ( p=(DRWristPos[0])) cmds.joint ( 'joint3', e=True, zso=True, oj='xyz', radius=0.5, n=jntname[2]) cmds.rename ('joint4', jntname[3]) cmds.select ( cl=True) break else: suffix + 1 I tried adding +1 in jntname which resulted in a good second chain but the third chain had "_2" after R_Clavicle_3 The code, in my eyes should work. Can anybody point me in the correct direction :)

    Read the article

  • Make a String text Bold in Java Android

    - by meskh
    I want to make Habit Number: bold , I tried the HTML tag but it didn't work. I did some research but couldn't find any. Hope someone is able to help me. Thanks! String habitnumber = "Habit Number: " + String.valueOf(habitcounter); String Title = habit.getTitle(); String description = habit.getDescription(); //Set text for the row tv.setText(habitnumber+ "\n" + Title + " \n" + description + "\n --------------------");

    Read the article

  • Why this doesnt't work in C++?

    - by user3377450
    I'm doing something and I have this: //main.cpp file template<typename t1, typename t2> std::ostream& operator<<(std::ostream& os, const std::pair<t1, t2>& pair) { return os << "< " << pair.first << " , " << pair.second << " >"; } int main() { std::map<int, int> map = { { 1, 2 }, { 2, 3 } }; std::cout << *map.begin() << std::endl;//This works std::copy(map.begin(), map.end(), std::ostream_iterator<std::pair<int,int> >(std::cout, " "));//this doesn't work } I guess this is not working because in the std::copy algorithm the operator isn't defined, but what can I do?

    Read the article

  • NOT replacing ? with letter guessed

    - by user3720541
    i need my code to replace the ? with the letter guessed. The ? needs to be replaced with a for only those to spots. The word in array is parameter. public static void replace(String[] wordOne, String blanks, char guess) { int i; blanks = wordOne[0]; for (i = 0; i < wordOne.length; i++) { for (int j = 0; j < wordOne[0].length(); j++) { blanks = blanks.replace(blanks.charAt(j), '?'); if (wordOne[0].charAt(i) == guess) { blanks = blanks.replace(blanks.charAt(i), guess); } } } System.out.println(blanks); } }

    Read the article

  • apt-get install fuse - MAKEDEV not installed, skipping device node creation

    - by holms
    This happened with command apt-get dist-upgrade to upgrade to debian jessie, after which I've tried to remove fuse, and install it again. Same error: root@msgapp:/dev# apt-get install fuse Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: fuse 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/69.9 kB of archives. After this operation, 191 kB of additional disk space will be used. Selecting previously unselected package fuse. (Reading database ... 39354 files and directories currently installed.) Preparing to unpack .../fuse_2.9.3-10_amd64.deb ... Unpacking fuse (2.9.3-10) ... Processing triggers for man-db (2.6.7.1-1) ... Setting up fuse (2.9.3-10) ... MAKEDEV not installed, skipping device node creation. device node not found dpkg: error processing package fuse (--configure): subprocess installed post-installation script returned error exit status 2 Errors were encountered while processing: fuse E: Sub-process /usr/bin/dpkg returned an error code (1) UPDATE Reinstalling makedev gives another problem: root@msgapp:/dev# apt-get install makedev Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: makedev 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 0 B/42.6 kB of archives. After this operation, 129 kB of additional disk space will be used. Selecting previously unselected package makedev. (Reading database ... 39347 files and directories currently installed.) Preparing to unpack .../makedev_2.3.1-93_all.deb ... Unpacking makedev (2.3.1-93) ... Processing triggers for man-db (2.6.7.1-1) ... ySetting up makedev (2.3.1-93) ... /run/udev or .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. /run/udev or .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. /run/udev or .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation. There's ticket raised, and their fix doesn't give any result: root@msgapp:/dev# cd /dev && ./MAKEDEV fuse /run/udev or .udevdb or .udev presence implies active udev. Aborting MAKEDEV invocation.

    Read the article

  • understanding list[i-1] vs list[i]-1

    - by user3720527
    Hopefully this is a simple answer that I am just failing to understand. Full code is public static void mystery(int[] list) { for( int i = list.length - 1; i>1; i --) { if (list[i] > list[i - 1]) { list[i -1] = list[i] - 2; list[i]++; } } } } and lets say we are using a list of [2,3,4]. I know that it will output 2,2,5 but I am unclear how to actually work through it. I understand that the list.length is 3 here, and I understand that the for loop will only run once, but I am very unclear what happens at the list[i - 1] = list[i] - 2; area. Should it be list[2-1] = list[2] - 2? How does the two being outside the bracket effect it differently? Much thanks.

    Read the article

  • Sqlite returns error

    - by ruruma
    I'm trying to implement loading data from database and put it into different views. But log cat returns error, that it cannot find "_id" column. Can somebody help me with this? SqlHelper Code public class FiboSqlHelper extends SQLiteOpenHelper { public static final String TABLE_FILMDB = "FiboFilmTop250"; public static final String COLUMN_ID = "_id"; private static final String DATABASE_NAME = "FiboFilmDb250.sqlite"; private static final int DATABASE_VERSION = 1; public static final String COLUMN_TITLE = "Title"; public static final String COLUMN_RATING = "Rating"; public static final String COLUMN_GENRE = "Genre"; public static final String COLUMN_TIME = "Time"; public static final String COLUMN_PREMDATE = "PremDate"; public static final String COLUMN_PLOT = "Plot"; private static final String DATABASE_CREATE = "create table "+TABLE_FILMDB+"("+COLUMN_ID +" integer primary key autoincrement, " +COLUMN_TITLE+" text not null "+COLUMN_RATING+" text not null "+COLUMN_GENRE+" text not null "+COLUMN_TIME+" text not null "+COLUMN_PREMDATE+" text not null "+COLUMN_PLOT+" "+"text not null)"; public FiboSqlHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); // TODO Auto-generated constructor stub } @Override public void onCreate(SQLiteDatabase db) { // TODO Auto-generated method stub db.execSQL(DATABASE_CREATE); } @Override public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { // TODO Auto-generated method stub Log.w(FiboSqlHelper.class.getName(), "Upgrading database from version " + oldVersion + " to " + newVersion + ", which will destroy all old data"); db.execSQL("DROP TABLE IF EXISTS " + TABLE_FILMDB); onCreate(db); } }` SqlAdapterCode: public class FiboSqlAdapter { private SQLiteDatabase database; private FiboSqlHelper dbHelper; private String[] allColumns = {FiboSqlHelper.COLUMN_ID, FiboSqlHelper.COLUMN_TITLE, FiboSqlHelper.COLUMN_GENRE, FiboSqlHelper.COLUMN_PREMDATE, FiboSqlHelper.COLUMN_TIME, FiboSqlHelper.COLUMN_PLOT}; public FiboSqlAdapter (Context context){ dbHelper = new FiboSqlHelper(context); } public void open() throws SQLException { database = dbHelper.getWritableDatabase(); } public void close(){ dbHelper.close(); } public List<FilmDataEntity> getAllFilmData(){ List<FilmDataEntity> fDatas = new ArrayList<FilmDataEntity>(); Cursor cursor = database.query(FiboSqlHelper.TABLE_FILMDB, allColumns, null,null,null,null,null); cursor.moveToFirst(); while(!cursor.isAfterLast()){ FilmDataEntity fData = cursorToData(cursor); fDatas.add(fData); cursor.moveToNext(); } cursor.close(); return fDatas; } private FilmDataEntity cursorToData(Cursor cursor){ FilmDataEntity fData = new FilmDataEntity(); fData.setId(cursor.getLong(1)); fData.setTitle(cursor.getString(2)); fData.setRating(cursor.getString(6)); fData.setGenre(cursor.getString(4)); fData.setPremDate(cursor.getString(5)); fData.setShortcut(cursor.getString(8)); return fData; }} DataEntity: ` public class FilmDataEntity { private long id; private String title; private String rating; private String genre; private String premDate; private String shortcut; public String getShortcut() { return shortcut; } public void setShortcut(String shortcut) { this.shortcut = shortcut; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } public String getPremDate() { return premDate; } public void setPremDate(String premDate) { this.premDate = premDate; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public long getId() { return id; } public void setId(long id) { this.id = id; } } Part from main activity: `List<FilmDataEntity> fE1; sqA = new FiboSqlAdapter(this); sqA.open(); fE1 = sqA.getAllFilmData(); `

    Read the article

  • Unity 2D Instantiating a prefab with it's components

    - by TazmanNZL
    I have some block prefabs that I add to an array of game objects: public GameObject[]blocks; Each prefab has a BoxCollider2D, Script & Rigidbody2D components. But when I try to instantiate the prefab in the scene it doesn't appear to have the components attached? Here is how I am instantiating the prefab: for (int i = 0; i < 4; i++) { for (int j = 0; j < gridWidth; j++) { blockClone = Instantiate (blocks [Random.Range (0, blocks.Length)] as GameObject, new Vector3 (j, -i-2, 0f), transform.rotation) as GameObject; } } What am I doing wrong?

    Read the article

  • Insert a transformed integer_sequence into a variadic template argument?

    - by coderforlife
    How do you insert a transformed integer_sequence (or similar since I am targeting C++11) into a variadic template argument? For example I have a class that represents a set of bit-wise flags (shown below). It is made using a nested-class because you cannot have two variadic template arguments for the same class. It would be used like typedef Flags<unsigned char, FLAG_A, FLAG_B, FLAG_C>::WithValues<0x01, 0x02, 0x04> MyFlags. Typically, they will be used with the values that are powers of two (although not always, in some cases certain combinations would be made, for example one could imagine a set of flags like Read=0x1, Write=0x2, and ReadWrite=0x3=0x1|0x2). I would like to provide a way to do typedef Flags<unsigned char, FLAG_A, FLAG_B, FLAG_C>::WithDefaultValues MyFlags. template<class _B, template <class,class,_B> class... _Fs> class Flags { public: template<_B... _Vs> class WithValues : public _Fs<_B, Flags<_B,_Fs...>::WithValues<_Vs...>, _Vs>... { // ... }; }; I have tried the following without success (placed inside the Flags class, outside the WithValues class): private: struct _F { // dummy class which can be given to a flag-name template template <_B _V> inline constexpr explicit _F(std::integral_constant<_B, _V>) { } }; // we count the flags, but only in a dummy way static constexpr unsigned _count = sizeof...(_Fs<_B, _F, 1>); static inline constexpr _B pow2(unsigned exp, _B base = 2, _B result = 1) { return exp < 1 ? result : pow2(exp/2, base*base, (exp % 2) ? result*base : result); } template <_B... _Is> struct indices { using next = indices<_Is..., sizeof...(_Is)>; using WithPow2Values = WithValues<pow2(_Is)...>; }; template <unsigned N> struct build_indices { using type = typename build_indices<N-1>::type::next; }; template <> struct build_indices<0> { using type = indices<>; }; //// Another attempt //template < _B... _Is> struct indices { // using WithPow2Values = WithValues<pow2(_Is)...>; //}; //template <unsigned N, _B... _Is> struct build_indices // : build_indices<N-1, N-1, _Is...> { }; //template < _B... _Is> struct build_indices<0, _Is...> // : indices<_Is...> { }; public: using WithDefaultValues = typename build_indices<_count>::type::WithPow2Values; Of course, I would be willing to have any other alternatives to the whole situation (supporting both flag names and values in the same template set, etc). I have included a "working" example at ideone: http://ideone.com/NYtUrg - by "working" I mean compiles fine without using default values but fails with default values (there is a #define to switch between them). Thanks!

    Read the article

  • Batch script crashing

    - by TamirGali
    My Batch script keeps crashing with the note: "set was unexpected at this time" which I could only see via video recording and checking frame by frame. here is the script: @echo off color 6f set min=0 set max=25 goto REDIR :REDIR set var=0 goto TOP :TOP cls set /a var=%var%+1 set /a rand%var%=%random% %% (max - min + 1)+ min if %rand2%==%rand1% set var=0&goto TOP if %rand3%==%rand2% set var=1&goto TOP if %rand4%==%rand3% set var=2&goto TOP if %rand5%==%rand4% set var=3&oto TOP if %rand6%==%rand5% set var=4&goto TOP if %rand7%==%rand6% set var=5&goto TOP if %rand8%==%rand7% set var=6&goto TOP if %rand9%==%rand8% set var=7&goto TOP if %rand10%==%rand9% set var=8&goto TOP if %rand11%==%rand10% set var=9&goto TOP if %rand12%==%rand11% set var=10&goto TOP if %rand13%==%rand12% set var=11&goto TOP if %rand14%==%rand13% set var=12&goto TOP if %rand15%==%rand14% set var=13&goto TOP if %rand16%==%rand15% set var=14&goto TOP if %rand17%==%rand16% set var=15&goto TOP if %rand18%==%rand17% set var=16&goto TOP if %rand19%==%rand18% set var=17&goto TOP if %rand20%==%rand19% set var=18&goto TOP if %rand21%==%rand20% set var=19&goto TOP if %rand22%==%rand21% set var=20&goto TOP if %rand23%==%rand22% set var=21&goto TOP if %rand24%==%rand23% set var=22&goto TOP if %rand25%==%rand24% set var=23&goto TOP if %rand26%==%rand25% set var=24&goto TOP if %var%==26 goto SHOW goto TOP :SHOW cls echo A=%rand1% echo B=%rand2% echo C=%rand3% echo D=%rand4% echo E=%rand5% echo F=%rand6% echo G=%rand7% echo H=%rand8% echo I=%rand9% echo J=%rand10% echo K=%rand11% echo L=%rand12% echo M=%rand13% echo N=%rand14% echo O=%rand15% echo P=%rand16% echo Q=%rand17% echo R=%rand18% echo S=%rand19% echo T=%rand20% echo U=%rand21% echo V=%rand22% echo W=%rand23% echo X=%rand24% echo Y=%rand25% echo Z=%rand26% pause goto REDIR

    Read the article

  • ASP.NET MVC tries to load older version of Owin assembly

    - by d_mcg
    As a bit of context, I'm developing an ASP.NET MVC 5 application that uses OAuth-based authentication via Microsoft's OWIN implementation, for Facebook and Google only at this stage. Currently (as of v3.0.0, git-commit 4932c2f), the FacebookAuthenticationOptions and GoogleOAuth2AuthenticationOptions don't provide any property to force Facebook nor Google respectively to reauthenticate users (via appending the appropriate query string parameters) when signing in. Initially, I set out to override the following classes: FacebookAuthenticationOptions GoogleOAuth2AuthenticationOptions FacebookAuthenticationHandler (specifically AuthenticateCoreAsync()) GoogleOAuth2AuthenticationHandler (specifically AuthenticateCoreAsync()) yet discovered that the ~AuthenticationHandler classes are marked as internal. So I pulled a copy of the source for the Katana project (http://katanaproject.codeplex.com/) and modified the source accordingly. After compiling, I found that there are several dependencies that needed updating in order to use these updated assemblies (Microsoft.Owin.Security.Facebook and Microsoft.Owin.Security.Google) in the MVC project: Microsoft.Owin Microsoft.Owin.Security Microsoft.Owin.Security.Cookies Microsoft.Owin.Security.OAuth Microsoft.Owin.Host.SystemWeb This was done by replacing the existing project references to the 3.0.0 versions and updating those in web.config. Good news: the project compiles successfully. In debugging, I received an exception on startup: An exception of type 'System.IO.FileLoadException' occurred in [MVC web assembly].dll but was not handled in user code Additional information: Could not load file or assembly 'Microsoft.Owin.Security, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) The underlying exception indicated that Microsoft.AspNet.Identity.Owin was trying to load v2.1.0 of Microsoft.Owin.Security when calling app.UseExternalSignInCookie() from Startup.ConfigureAuth(IAppBuilder app) in Startup.Auth.cs. Unfortunately that assembly (and its other dependency, Microsoft.AspNet.Identity.Owin) aren't part of the Project Katana solution, and I can't find any accessible repository for these assemblies online. Are the Microsoft.AspNet.Identity assemblies open source, like the Katana project? Is there a way to fool those assemblies to use the referenced v3.0.0 assemblies instead of v2.1.0? The /bin folder contains the 3.0.0 versions of the Owin assemblies. I've upgraded the NuGet packages for Microsoft.AspNet.Identity.Owin, and this is still an issue. Any ideas on how to resolve this issue?

    Read the article

  • Merging elements inside a xml.etree.ElementTree

    - by theAlse
    I have a huge test data like the one provided below (and yes I have no control over this data). Each line is actually 6 parts and I need to generate an XML based on this data. Nav;Basic;Dest;Smoke;No;Yes; Nav;Dest;Recent;Regg;No;Yes; Nav;Dest;Favourites;Regg;No;Yes; ... Nav;Dest using on board;By POI;Smoke;No;Yes; Nav;Dest using on board;Other;Regg;No;Yes; The first 3 elements on each line denotes "test suites"-XML element and the last 3 element should create a "test case"-XML element. I have successfully converted it into a XML using the following code: # testsuite (root) testsuite = ET.Element('testsuite') testsuite.set("name", "Tests") def _create_testcase_tag(elem): global testsuite level1, level2, level3, elem4, elem5, elem6 = elem # -- testsuite (level1) testsuite_level1 = ET.SubElement(testsuite, "testsuite") testsuite_level1.set("name", level1) # -- testsuite (level2) testsuite_level2 = ET.SubElement(testsuite_level1, "testsuite") testsuite_level2.set("name", level2) # -- testsuite (level3) testsuite_level2 = ET.SubElement(testsuite_level2, "testsuite") testsuite_level2.set("name", level3) # -- testcase testcase = ET.SubElement(testsuite_level2, "testcase") testcase.set("name", "TBD") summary = ET.SubElement(testcase, "summary") summary.text = "Test Type= %s, Automated= %s, Available=%s" %(elem4, elem5, elem6) with open(input_file) as in_file: for line_number, a_line in enumerate(in_file): try: parameters = a_line.split(';') if len(parameters) >= 6: level1 = parameters[0].strip() level2 = parameters[1].strip() level3 = parameters[2].strip() elem4 = parameters[3].strip() elem5 = parameters[4].strip() elem6 = parameters[5].strip() lines_as_list.append((level1, level2, level3, elem4, elem5, elem6)) except ValueError: pass lines_as_list.sort() for elem in lines_as_list: _create_testcase_tag(elem) output_xml = ET.ElementTree(testsuite) ET.ElementTree.write(output_xml, output_file, xml_declaration=True, encoding="UTF-8") The above code generates an XML like this: <testsuite name="Tests"> <testsuite name="Nav"> <testsuite name="Basic navigation"> <testsuite name="Set destination"> <testcase name="TBD"> <summary>Test Type= Smoke test Automated= No, Available=Yes</summary> </testcase> </testsuite> </testsuite> </testsuite> <testsuite name="Nav"> <testsuite name="Set destination"> <testsuite name="Recent"> <testcase name="TBD"> <summary> Test Type= Reggression test Automated= No, Available=Yes </summary> </testcase> </testsuite> </testsuite> </testsuite> </testsuite> ... This is all correct, but as you can see I have created a whole tree for each line and that is not what I need. I need to combine e.g. all testsuite with the same name into one testsuite and also perform that recursively. So the XML looks like this instead: <testsuite name="Tests"> <testsuite name="Nav"> <testsuite name="Basic navigation"> <testsuite name="Set destination"> <testcase name="TBD"> <summary>Test Type= Smoke test Automated= No, Available=Yes</summary> </testcase> </testsuite> <testsuite name="Recent"> <testcase name="TBD"> <summary> Test Type= Reggression test Automated= No, Available=Yes </summary> </testcase> </testsuite> </testsuite> </testsuite> </testsuite> I hope you can understand what I mean, but level1, level2 and level3 should be unique with testcases inside. How should I do this? Please do not suggest the use of any external libraries! I can not install new libraries in customer site. xml.etree.ElementTree is all I have. Thanks

    Read the article

  • send and receive in socket [closed]

    - by user3696492
    I have trouble in sending an object through socket in c#, my client can send to server but server can't send to client, i think there is something wrong with the client. Server private void Form1_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; Thread a = new Thread(connect); a.Start(); } private void sendButton_Click(object sender, EventArgs e) { client.Send(SerializeData(ShapeList[ShapeList.Count - 1])); } void connect() { try { server = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 5555); server.Bind(iep); server.Listen(10); client = server.Accept(); while (true) { byte[] data = new byte[1024]; client.Receive(data); PaintObject a = (PaintObject)DeserializeData(data); ShapeList.Add(a); Invalidate(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } client private void Form1_Load(object sender, EventArgs e) { CheckForIllegalCrossThreadCalls = false; Thread a = new Thread(connect); a.Start(); } private void SendButton_Click(object sender, EventArgs e) { client.Send(SerializeData(ShapeList[ShapeList.Count - 1])); } void connect() { try { client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); iep = new IPEndPoint(IPAddress.Parse("127.0.0.1"), 5555); client.Connect(iep); while (true) { byte[] data = new byte[1024]; client.Receive(data); PaintObject a = (PaintObject)DeserializeData(data); ShapeList.Add(a); Invalidate(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }

    Read the article

  • MessageListener didnt receive full message ASMACK Android

    - by Frank Junior
    i got problem when want to receive message, right now i am able to receive message, but some attribut is missing class MyMessageListener implements MessageListener { @Override public void processMessage(Chat chat, Message message) { Util.DebugLog("message->"+message.toXmlns()); } } what i got is <message to="[email protected]" type="chat" from="[email protected]/ff3b2485"><body asdf="asdf">aaa</body></message> talk_id and chat type inside message is missing. This is want i want when receive message <message to="[email protected]" type="chat" talk_id="304" chat_type="0" from="[email protected]/ff3b2485"><body asdf="asdf">aaa</body></message>

    Read the article

  • No idea how to solve SICP exercise 1.11

    - by Javier Badia
    This is not homework. Exercise 1.11: A function f is defined by the rule that f(n) = n if n<3 and f(n) = f(n - 1) + 2f(n - 2) + 3f(n - 3) if n 3. Write a procedure that computes f by means of a recursive process. Write a procedure that computes f by means of an iterative process. Implementing it recursively is simple enough. But I couldn't figure out how to do it iteratively. I tried comparing with the Fibonacci example given, but I didn't know how to use it as an analogy. So I gave up (shame on me) and Googled for an explanation, and I found this: (define (f n) (if (< n 3) n (f-iter 2 1 0 n))) (define (f-iter a b c count) (if (< count 3) a (f-iter (+ a (* 2 b) (* 3 c)) a b (- count 1)))) After reading it, I understand the code and how it works. But what I don't understand is the process needed to get from the recursive defintion of the function to this. I don't get how the code formed in someone's head. Could you explain the thought process needed to arrive at the solution?

    Read the article

  • Setting up SSL on Nginx, Passenger, Sinatra

    - by 12preschph
    I have a Sinatra app that runs both on locally and on Heroku. When visiting my site over HTTPS across Heroku, it will indeed work as Heroku provides this by default. How can I set up SSL to work on my localhost machine? I will enable my Sinatra app to only allow secure connections so I need to test this both in development and production. Currently, I am running the following locally: SERVER= nginx/1.6.0 + Phusion Passenger 4.0.42 Also, where is my nginx folder? I don't have it installed in the normal location (Ubuntu) so this must come custom with Passenger?

    Read the article

  • How to get stable WIFI connection between phone and router when thousands of irrelevant phones are around?

    - by Karl
    I want to use Android phones to check tickets at the gate of an event. These phones are connected to a password protected router (WPA2) and a PC to validate. That all works nicely in a test setting, but I'm worried it might collaps if there are many other competing phones around. How can I get a stable WIFI connection between my phones and my router when thousands of irrelevant phones are around? Do the other phones clogg the router with requests even when the router is password protected? Shall I hide the SSID?

    Read the article

  • How to restrict all services to single domain in Ubuntu?

    - by harold
    Someone has pointed an unknown domain to my server's IP address likely via A records. I would like to reject access to ALL services (httpd, ssh, mail, etc.) from this domain and only allow requests from my domain. I want to make it so when I connect to that domain it's completely rejected from my server. I can disallow access from HTTP by changing my web server settings, but I want to do this for every single type of connection. How can I do this?

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15  | Next Page >