Posts

asp.net web api2 - OWIN and CORS - One CORS Header to rule them all? -

there seems lots of different answers on define cors headers when using owin. have seen these ... 1) add grantresourceownercredentials method context.owincontext.response.headers.add("access-control-allow-origin", new[] { allowedorigin }); 2) in configuration(iappbuilder app) method of startup.cs app.usecors(microsoft.owin.cors.corsoptions.allowall); 3) add web.config <system.webserver> <httpprotocol> <customheaders> <add name="access-control-allow-origin" value="*" /> <add name="access-control-allow-headers" value="content-type" /> <add name="access-control-allow-methods" value="get, post, put, delete, options" /> </customheaders> </httpprotocol> </system.webserver> when try multiple options error saying duplicate cors headers , therefore none of them allowed. is there single place can define cors po...

c++ - Initializing a string array -

i try initialize string array std::cin can not code : string *words[6]; (int i=0 ; i<6;i++){ cin >> words[i]; //error } can me!! you don't need create them dynamically: string words[6]; //notice deleted '*' here (int i=0 ; i<6;i++){ cin >>words[i]; } what you've created array of pointers, in every pointer must initalized new before can use , deleted afterwards.

ionic 2 blank after splash page under android 4.3 -

my question similar ionic-mobile-app-gives-white-screen i have created 1 ionic app runs fine in browser, when convert app getting white screen. i have installed white list plugin , allowed urls in config. have kept meta tag. this 1 ionic 2 application. it runs in web , on android devices when use ionic 1. but, can use android 5.0 or higher version run ionic2. i have tried many methods such how-to-debug-the-white-screen-of-death-in-your-ionic-app , can't inspect button debug chrome inspect . my android device: genymotion, htc one, running android 4.3 (api 18).

c# - XmlSerializer.Deserialize only specific classes -

Image
this situation. need create new application based off existing object classes i'm not allowed change being used other projects. need use these object in conjunction new objects in new application. in new application, each action have request , response class, serialized/deserilized sent on sockets company. provide xsd company use form response , send xml. need deserialize xml newly created object, in case called getaccountdetailsmessageresponse. [system.xml.serialization.xmlroot("getaccountdetailsmessageresponse", namespace = "http://test.com.au/")] public class getaccountdetailsmessageresponse { public mynewheader header { get; set; } public accountsresponse response { get; set; } } //here existing class structure need use, , cannot // main class - containing collection of accounts public class accountsresponse : responseheader { public accountsresponse() { acc...

swift - Comparing array of force unwrapped optionals -

i'm writing test: func test_arrayfromshufflingarray() { var videos = [mockobjects.mockvmvideo_1(), mockobjects.mockvmvideo_2(), mockobjects.mockvmvideo_3()] let tuple = shufflehelper.arrayfromshufflingarray(videos, currentindex:1) var shuffledvideos = tuple.0 let shuffleindexmap = tuple.1 // -- test order different xctassert(videos != shuffledvideos, "test_arrayfromshufflingarray fail") } but on last line last line: binary operator '!=' cannot applied 2 '[vmvideo!]' operands arrays can compared == if element type equatable : /// returns true if these arrays contain same elements. public func ==<element : equatable>(lhs: [element], rhs: [element]) -> bool but neither implicitlyunwrappedoptional<wrapped> nor optional<wrapped> conform equatable , if underlying type wrapped does. possible options (assuming vmvideo conforms equatable ): change cod...

How do I get a computer's programing name and static IP address using VB.NET? -

public function getcomputername() string dim computername string computername = system.net.dns.gethostname return computername end function for pc name use: my.computer.name for ip use: private sub getipaddress() dim strhostname string dim stripaddress string strhostname = system.net.dns.gethostname() stripaddress = system.net.dns.gethostbyname(strhostname).addresslist(0).tostring() messagebox.show("host name: " & strhostname & "; ip address: " & stripaddress) end sub

mysql - One PHP Template Page, Call Different Tables with Hyperlinks -

i have table called c33062 displays data rows in page. have twenty other mysql tables same structure , information, different data. instead of creating page each, i'd create hyperlinks each calls links table information. statement is: $query = "select id, year, price_avg_sold, price_sqft, pct_list_sold, adom, sold_nu, sold_chg, year_1, year_2, year_3, year_4, year_5, year_6, year_7, year_8, year_9, year_10 c33062"; so in essence, i'd make hyperlinks each table, c33063, c33064, c33065 etc when clicked, call particular table's data template page. what correct way hyperlink table? set table name variable in each link , variable value. example http://www.name.com?tabe=30063 table 30063 http://www.name.com?tabe=30064 table 30064 and table value $table = $_get['table']; then use variable in query code below: $query = "select id, year, price_avg_sold, price_sqft, pct_list_sold, ado...