Search Results

Search found 4696 results on 188 pages for 'john wells'.

Page 78/188 | < Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >

  • How to make custom WCF error handler return JSON response with non-OK http code?

    - by John
    I'm implementing a RESTful web service using WCF and the WebHttpBinding. Currently I'm working on the error handling logic, implementing a custom error handler (IErrorHandler); the aim is to have it catch any uncaught exceptions thrown by operations and then return a JSON error object (including say an error code and error message - e.g. { "errorCode": 123, "errorMessage": "bla" }) back to the browser user along with an an HTTP code such as BadRequest, InteralServerError or whatever (anything other than 'OK' really). Here is the code I am using inside the ProvideFault method of my error handler: fault = Message.CreateMessage(version, "", errorObject, new DataContractJsonSerializer(typeof(ErrorMessage))); var wbf = new WebBodyFormatMessageProperty(WebContentFormat.Json); fault.Properties.Add(WebBodyFormatMessageProperty.Name, wbf); var rmp = new HttpResponseMessageProperty(); rmp.StatusCode = System.Net.HttpStatusCode.InternalServerError; rmp.Headers.Add(HttpRequestHeader.ContentType, "application/json"); fault.Properties.Add(HttpResponseMessageProperty.Name, rmp); -- This returns with Content-Type: application/json, however the status code is 'OK' instead of 'InternalServerError'. fault = Message.CreateMessage(version, "", errorObject, new DataContractJsonSerializer(typeof(ErrorMessage))); var wbf = new WebBodyFormatMessageProperty(WebContentFormat.Json); fault.Properties.Add(WebBodyFormatMessageProperty.Name, wbf); var rmp = new HttpResponseMessageProperty(); rmp.StatusCode = System.Net.HttpStatusCode.InternalServerError; //rmp.Headers.Add(HttpRequestHeader.ContentType, "application/json"); fault.Properties.Add(HttpResponseMessageProperty.Name, rmp); -- This returns with the correct status code, however the content-type is now XML. fault = Message.CreateMessage(version, "", errorObject, new DataContractJsonSerializer(typeof(ErrorMessage))); var wbf = new WebBodyFormatMessageProperty(WebContentFormat.Json); fault.Properties.Add(WebBodyFormatMessageProperty.Name, wbf); var response = WebOperationContext.Current.OutgoingResponse; response.ContentType = "application/json"; response.StatusCode = HttpStatusCode.InternalServerError; -- This returns with the correct status code and the correct content-type! The problem is that the http body now has the text 'Failed to load source for: http://localhost:7000/bla..' instead of the actual JSON data.. Any ideas? I'm considering using the last approach and just sticking the JSON in the HTTP StatusMessage header field instead of in the body, but this doesn't seem quite as nice?

    Read the article

  • Using a Visual Sourcesafe 2005 database with VB6 still launches VSS 6.0d

    - by John Galt
    I know all versions of VSS have many horror stories and I feel I will escape to a better source control mechanism someday but in the short term I am just trying to do a little cleanup and would like your advice on this issue: Objective - consolidate old VB6 source code in a "new" VSS 2005 database (currently all these old projects are checked in to an "old" VSS 6.0d database); eventually, eliminate the "old" VSS. Progress so far - The new VSS 2005 database now contains a mixture of projects. Some are using Visual Studio 2008, some use Vstudio 2005, and the more recently added ones are the above mentioned VB6 projects. Individually all these projects and "solutions" come up OK, I can check in - check out, launch SourceSafe, view differences, etc. But all the VB6 projects now in a VSS 2005 database launch VSS 6.0d when asked, rather than VSS 2005. Is this normal and just something to cope with until I get to some better nonVSS approach? Or can VB6 be re-configured someway to launch VSS 2005 when I click Tools-SourceSafe-Run SourceSafe? I seem to recall VSS 6.0d got "integrated" into VB6 by way of the "Add-In Manager". At this point, the development PC with VB6 installed has both VSS 2005 and VSS 6.0d clients installed.

    Read the article

  • PhantomJS not exactly rendering HTML to PNG

    - by John Leonard
    I'm having trouble adjusting PhantomJS to create a PNG file that matches the original browser presentation. Here is the entire sample html file. It's a sankey diagram creating using rCharts and d3-sankey. (You'll need to save the file to your hard drive and view it from there.) I'm running on Windows and using rasterize.js: >> phantomjs.exe rasterize.js test.html test.png ISSUE: Below is a snip of one of the text strings when viewed in a browser: And here is a snip of the same string from the PNG created by PhantomJS: How do I make the text-shadow go away? I've played around with various CSS attributes (text-shadow) and webkit-specific attributes (e.g., -webkit-text-rendering), but can't seem to make it go away. Is this a setting in PhantomJS? in the underlying webkit? or somewhere else? Many thanks!

    Read the article

  • Simple Program Question (TI-84 calculator)

    - by John
    I wrote a program (on my TI-84 calculator) to satisfy the following exercise: Write a program that will print all solutions of the inequality ax + b < c, where a, b, and c are entered by the user. In this program the domain of x will be a set of consecutive integers, where the smallest and largest members of the set will also be entered by the user. (Hint: Use a FOR . . . NEXT loop to test each integer from smallest to largest.) This is the code I have: :Input "A=",A :Input "B=",B :Input "C=",C :Disp "DOMAIN FOR X" :Input "MIN=",D :Input "MAX=",E :For(X,D,E,1) :If AX+B<C :Disp X :End I sort of figured it out by chance; I don't really know how 'If' works inside 'For.' I wanted to have it tell me if there is no solution, though, so I tried: :Input "A=",A :Input "B=",B :Input "C=",C :Disp "DOMAIN FOR X" :Input "MIN=",D :Input "MAX=",E :For(X,D,E,1) :If AX+B<C :Then :Disp X :Else :Disp "NO SOLUTION" :End But this returns the value for "MIN=" Why is this? Can anyone help me understand these work?

    Read the article

  • PHP / SimpleXML - Why does Simplexml_load_string() fail to parse Google Weather API xml in Chinese (

    - by John Himmelman
    I'm trying to load parse a Google Weather API response (chinese response). Here is the API call.. http://www.google.com/ig/api?weather=11791&hl=zh-CN // This code fails with the following error $xml = simplexml_load_file('http://www.google.com/ig/api?weather=11791&hl=zh-CN'); ( ! ) Warning: simplexml_load_string() [function.simplexml-load-string]: Entity: line 1: parser error : Input is not proper UTF-8, indicate encoding ! Bytes: 0xB6 0xE0 0xD4 0xC6 in C:\htdocs\weather.php on line 11 Why does loading this response fail? How do I encode/decode the response so that simplexml loads it properly?

    Read the article

  • XCode GCC-4.0 vs 4.2

    - by John Smith
    I have just changed a compiler option from 4.0 to 4.2. Now I get an error: jump to case label crosses initialization of 'const char* selectorName' It works fine in 4.0 Any ideas?

    Read the article

  • problem with revalidating a jframe.

    - by John Quesie
    I have this code which should take the radio button input do a little math and display a popup. which it does fine. but then it is supposed to re validate and ask the next question. when i get to the second question, the answer always comes out as the isSelected(true) value no matter which radio button you click on. SO to be clear the first time through it works fin but when the second question comes up, it just takes the default radio button every time. public class EventHandler implements ActionListener { private Main gui; public EventHandler(Main gui){ this.gui = gui; } public void actionPerformed(ActionEvent e){ String answer = ""; double val = 1; //get current answer set String [] anArr = gui.getAnswers(gui.currentStage, gui.currentQuestion); if(e.getSource() == gui.exit){ System.exit(0); } if(e.getSource() == gui.submit){ if(gui.a1.isSelected()){ answer = anArr[0]; val = gui.getScore(1); } if(gui.a2.isSelected()){ answer = anArr[1]; val = gui.getScore(2); } if(gui.a3.isSelected()){ answer = anArr[2]; val = gui.getScore(3); } if(gui.a4.isSelected()){ answer = anArr[3];; val = gui.getScore(4); } JOptionPane.showMessageDialog(null, popupMessage(answer, val), "Your Answer", 1); //compute answer here //figure out what next question is to send gui.moveOn(); gui.setQA(gui.currentStage, gui.currentQuestion); //resets gui gui.goWest(); gui.q.revalidate(); } } public String popupMessage(String ans, double val){ //displays popup after an answer has been choosen gui.computeScore(val); String text = " You Answered " + ans + " Your score is now " + gui.yourScore ; return text; } } public class Main extends JFrame { public JLabel question; public JButton exit; public JButton submit; public JRadioButton a1; public JRadioButton a2; public JRadioButton a3; public JRadioButton a4; public ButtonGroup bg; public double yourScore = 1; public int currentQuestion = 1; public String currentStage = "startup"; JPanel q; public Main(){ setTitle("Ehtics Builder"); setLocation(400,400); setLayout(new BorderLayout(5,5)); setQA("startup", 1); goNorth(); goEast(); goWest(); goSouth(); goCenter(); pack(); setVisible(true); setDefaultCloseOperation(EXIT_ON_CLOSE); } public void goNorth(){ } public void goWest(){ q = new JPanel(); q.setLayout(new GridLayout(0,1)); q.add(question); bg.add(a1); bg.add(a2); bg.add(a3); bg.add(a4); a1.setSelected(true); q.add(a1); q.add(a2); q.add(a3); q.add(a4); add(q, BorderLayout.WEST); System.out.println(); } public void goEast(){ } public void goSouth(){ JPanel p = new JPanel(); p.setLayout(new FlowLayout(FlowLayout.CENTER)); exit = new JButton("Exit"); submit = new JButton("Submit"); p.add(exit); p.add(submit); add(p, BorderLayout.SOUTH); EventHandler myEventHandler = new EventHandler(this); exit.addActionListener(myEventHandler); submit.addActionListener(myEventHandler); } public void goCenter(){ } public static void main(String[] args) { Main open = new Main(); } public String getQuestion(String type, int num){ //reads the questions from a file String question = ""; String filename = ""; String [] ques; num = num - 1; if(type.equals("startup")){ filename = "startup.txt"; }else if(type.equals("small")){ filename = "small.txt"; }else if(type.equals("mid")){ filename = "mid.txt"; }else if(type.equals("large")){ filename = "large.txt"; }else{ question = "error"; return question; } ques = readFile(filename); for(int i = 0;i < ques.length;i++){ if(i == num){ question = ques[i]; } } return question; } public String [] getAnswers(String type, int num){ //reads the answers from a file String filename = ""; String temp = ""; String [] group; String [] ans; num = num - 1; if(type.equals("startup")){ filename = "startupA.txt"; }else if(type.equals("small")){ filename = "smallA.txt"; }else if(type.equals("mid")){ filename = "midA.txt"; }else if(type.equals("large")){ filename = "largeA.txt"; }else{ System.out.println("Error"); } group = readFile(filename); for(int i = 0;i < group.length;i++){ if(i == num){ temp = group[i]; } } ans = temp.split("-"); return ans; } public String [] getValues(String type, int num){ //reads the answers from a file String filename = ""; String temp = ""; String [] group; String [] vals; num = num - 1; if(type.equals("startup")){ filename = "startupV.txt"; }else if(type.equals("small")){ filename = "smallV.txt"; }else if(type.equals("mid")){ filename = "midV.txt"; }else if(type.equals("large")){ filename = "largeV.txt"; }else{ System.out.println("Error"); } group = readFile(filename); for(int i = 0;i < group.length;i++){ if(i == num){ temp = group[i]; } } vals = temp.split("-"); return vals; } public String [] readFile(String filename){ //reads the contentes of a file, for getQuestions and getAnswers String text = ""; int i = -1; FileReader in = null; File f = new File(filename); try{ in = new FileReader(f); }catch(FileNotFoundException e){ System.out.println("file does not exist"); } try{ while((i = in.read()) != -1) text += ((char)i); }catch(IOException e){ System.out.println("Error reading file"); } try{ in.close(); }catch(IOException e){ System.out.println("Error reading file"); } String [] questions = text.split(":"); return questions; } public void computeScore(double val){ //calculates you score times the value of your answer yourScore = val * yourScore; } public double getScore(int aNum){ //gets the score of an answer, stage and q number is already set in the class aNum = aNum - 1; double val = 0; double [] valArr = new double[4]; for(int i = 0;i < getValues(currentStage, currentQuestion).length;i++){ val = Double.parseDouble(getValues(currentStage, currentQuestion)[i]); valArr[i] = val; } if(aNum == 0){ val = valArr[0]; } if(aNum == 1){ val = valArr[1]; } if(aNum == 2){ val = valArr[2]; } if(aNum == 3){ val = valArr[3]; } // use current stage and questiion and trhe aNum to get the value for that answer return val; } public void nextQuestion(int num){ //sets next question to use currentQuestion = num; } public void nextStage(String sta){ // sets next stage to use currentStage = sta; } public void moveOn(){ // uses the score and current question and stage to determine wher to go next and what stage to use next nextQuestion(2); nextStage("startup"); } public void setQA(String level, int num){ String [] arr = getAnswers(level, num); question = new JLabel(getQuestion(level, num)); bg = new ButtonGroup(); a1 = new JRadioButton(arr[0]); a2 = new JRadioButton(arr[1]); a3 = new JRadioButton(arr[2]); a4 = new JRadioButton(arr[3]); } }

    Read the article

  • Job Interview Question

    - by John Hpa
    What's your opinion of the following job interview question? In the requirement it never mentions about to have classic ASP experience. But the question is "What are the differences between ADO.NET DataSet and ADO Record Set?".

    Read the article

  • How can I detect when the .NET framework is "turned off"?

    - by John Myczek
    My application requires the .NET Framework version 3.5. I recently ran into a customer that had the .NET Framework installed but turned off. In this case, my installer (InstallShield 2009) does not prompt the user to install the Framework (because it is already installed) and when my application runs it crashes immediately. I tried another .NET application and it also crashes immediately. Is there any way to detect this situation and handle it more gracefully? Just detecting this during install is not ideal since the .NET Framework can be turned off at any time. Ideally, the application would be able to check and display a friendly message to the user telling them they need to turn on the .NET Framework.

    Read the article

  • Reading DBF with VFPOLEDB driver problem.

    - by John Sheares
    I am using VFPOLEDB driver to read DBF files and I keep getting this error and I am not sure why and how to fix the problem: The provider could not determine the Decimal value. For example, the row was just created, the default for the Decimal column was not available, and the consumer had not yet set a new Decimal value. Here is the code. I call this routine to return a DataSet of the DBF file and display the data in a DataGridView. public DataSet GetDBFData(FileInfo fi, string tbl) { using (OleDbConnection conn = new OleDbConnection( @"Provider=VFPOLEDB.1;Data Source=" + fi.DirectoryName + ";")) { conn.Open(); string command = "SELECT * FROM " + tbl; OleDbDataAdapter da = new OleDbDataAdapter(command, conn); DataSet ds = new DataSet(); da.Fill(ds); return ds; } }

    Read the article

  • What does it take to prove this Contract.Requires?

    - by John Gietzen
    I have an application that runs through the rounds in a tournament, and I am getting a contract warning on this simplified code structure: public static void LoadState(IList<Object> stuff) { for(int i = 0; i < stuff.Count; i++) { // Contract.Assert(i < stuff.Count); // Contract.Assume(i < stuff.Count); Object thing = stuff[i]; Console.WriteLine(thing.ToString()); } } The warning is: contracts: requires unproven: index < @this.Count What am I doing wrong? How can I prove this on an IList<T>? Is this a bug in the static analyzer? How would I submit a bug report to Microsoft?

    Read the article

  • Django Custom Widget For ManyToMany field

    - by John
    Does anyone know of a widget that displays 2 select boxes. One shows a list of all object in a model and the other shows the objects which have been selected. The user can then select an object from the first list, click an button which moves it to the 'selected' list. Then when the form is saved the objects in the selected list are saved in the manytomany field. Thanks

    Read the article

  • Code Igniter email protocols and rendering HTML emails?

    - by John
    I have a website built in code igniter that emails users. I use CI's email class from the controller to do mail out, but I discovered that if I use the "mail" protocol, some (not all) users see un-rendered html emails with the html mark up viewable, while others do not. But if I use the "sendmail" protocol, all users get rendered html emails. So if I did this $config['protocol'] = 'mail'; // add a few more config entries $this->email->initialize($config); Not everyone sees html emails If I did this $config['protocol'] = 'sendmail'; // add a few more config entries $this->email->initialize($config); Everyone sees html emails Why does the protocol matter? Are the email headers different between the two?

    Read the article

  • MS SQL Server 15MM rows, simple COUNT query. 15+ seconds?

    - by john
    We took over a website from another company after a client decided to switch. We have a table that grows by about 25k records a day, and is currently at 15MM records. The table looks something like: id (PK, int, not null) member_id (int, not null) another_id (int, not null) date (datetime, not null) SELECT COUNT(id) FROM tbl can take up to 15 seconds. A simple inner join on 'another_id' takes over 30 seconds. I can't imagine why this is taking so long. Any advice? SQL Server 2005 Express

    Read the article

  • Custom array sorting based on instance properties

    - by St. John Johnson
    I'm trying to perform a usort on an array inside an instance of a class. But the sort is dependent on the properties of said instance. Code (which doesn't work): class foo { private $array; private $key; private $dir; function sort() { usort($this->array, array("foo", "orderArray")); } function orderArray($a, $b) { return strcmp($a[$this->key], $b[$this->key]) * $this->dir; } } From the orderArray class, you can't access $key or $dir. The question is, how can I write this so I can?

    Read the article

  • How can I write good "research code"?

    - by John
    "Research code" is often held up as a paragon of what not to do when writing software. Certainly, the kind of code that often results from trying to solve a research problem can end up being poorly-designed, difficult to debug, etc. But my question is this: does research code have to be this way? Is it possible to write good research code? Is the only approach to consider the first version a poorly-written prototype to be discarded in favour of the better-designed second version? Software engineering has all sorts of best practices about how to design and write good code, but I don't usually find this relevant when you don't have a good idea ahead of time what the final system will look like. The final system is likely to be a result of what did or didn't work along the way, and the only way to determine what does or doesn't work is to write the code first. As you find things that don't work, you change what the final system looks like, moving further away from your original design (assuming you had one). I'd be interested in any personal experience with these issues, as well as any books or other resources anyone can point me to.

    Read the article

  • Wicket testing - AnnotApplicationContextMock - There is no application attached to current thread ma

    - by John
    I've written a couple of tests for a small web app, but I get an error when I try to run the page specific tests that makes use of WicketTester. Google sends me to a mailing list for Apache Wicket, where a user experienced the same exception. He/she said the problem was that AnnotApplicationContextMock was initialized before the Wicket Application. I've pasted my WicketApplication class as well. Has any of you dealt with this error before? I've pasted the exception and the class below. Exception: ------------------------------------------------------------------------------- Test set: com.upbeat.shoutbox.web.TestViewShoutsPage ------------------------------------------------------------------------------- Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.545 sec (AnnotApplicationContextMock.java:61) at com.upbeat.shoutbox.web.TestViewShoutsPage.setUp(TestViewShoutsPage.java:30) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:129) at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:93) at org.unitils.UnitilsJUnit4TestClassRunner$CustomMethodRoadie.runBeforesThenTestThenAfters(UnitilsJUnit4TestClassRunner.java:168) at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:84) at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:49) at org.unitils.UnitilsJUnit4TestClassRunner.invokeTestMethod(UnitilsJUnit4TestClassRunner.java:127) at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:59) at org.unitils.UnitilsJUnit4TestClassRunner.access$000(UnitilsJUnit4TestClassRunner.java:42) at org.unitils.UnitilsJUnit4TestClassRunner$1.run(UnitilsJUnit4TestClassRunner.java:87) at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:34) at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:44) at org.unitils.UnitilsJUnit4TestClassRunner.run(UnitilsJUnit4TestClassRunner.java:94) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:345) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:1009) My page specific test class: package com.upbeat.shoutbox.web; import org.apache.wicket.application.IComponentInstantiationListener; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; import org.apache.wicket.spring.injection.annot.test.AnnotApplicationContextMock; import org.apache.wicket.util.tester.FormTester; import org.apache.wicket.util.tester.WicketTester; import org.junit.Before; import org.junit.Test; import org.unitils.spring.annotation.SpringBeanByType; import com.upbeat.shoutbox.WicketApplication; import com.upbeat.shoutbox.integrations.AbstractIntegrationTest; import com.upbeat.shoutbox.persistence.ShoutItemDao; import com.upbeat.shoutbox.services.ShoutService; import com.upbeat.shoutbox.web.pages.ViewShoutsPage; public class TestViewShoutsPage extends AbstractIntegrationTest { @SpringBeanByType private ShoutService svc; @SpringBeanByType private ShoutItemDao dao; protected WicketTester tester; @Before public void setUp() { final AnnotApplicationContextMock appctx = new AnnotApplicationContextMock(); appctx.putBean("ShoutItemDao", dao); appctx.putBean("ShoutService", svc); tester = new WicketTester(new WicketApplication() { @Override protected IComponentInstantiationListener getSpringComponentInjector(WebApplication app) { return new SpringComponentInjector(app, appctx, false); } }); } @Test public void testRenderPage() { tester.startPage(ViewShoutsPage.class); tester.assertRenderedPage(ViewShoutsPage.class); FormTester ft = tester.newFormTester("addShoutForm"); ft.setValue("nickname", "test-nickname"); ft.setValue("content", "a whole lot of content"); ft.submit(); tester.assertRenderedPage(ViewShoutsPage.class); tester.assertContains("test-nickname"); tester.assertContains("a whole lot of content"); } } AbstractIntegrationTest: package com.upbeat.shoutbox.integrations; import org.springframework.context.ApplicationContext; import org.unitils.UnitilsJUnit4; import org.unitils.spring.annotation.SpringApplicationContext; @SpringApplicationContext({"/com/upbeat/shoutbox/spring/applicationContext.xml", "applicationContext-test.xml"}) public abstract class AbstractIntegrationTest extends UnitilsJUnit4 { private ApplicationContext applicationContext; } WicketApplication: package com.upbeat.shoutbox; import org.apache.wicket.application.IComponentInstantiationListener; import org.apache.wicket.protocol.http.WebApplication; import org.apache.wicket.request.target.coding.IndexedParamUrlCodingStrategy; import org.apache.wicket.spring.injection.annot.SpringComponentInjector; import com.upbeat.shoutbox.web.pages.ParamPage; import com.upbeat.shoutbox.web.pages.VeryNiceExceptionPage; /** * Application object for your web application. If you want to run this application without deploying, run the Start class. * * @see com.upbeat.shoutbox.Start#main(String[]) */ public class WicketApplication extends WebApplication { /** * Constructor */ public WicketApplication() { } /** * @see org.apache.wicket.Application#getHomePage() */ public Class getHomePage() { return HomePage.class; } @Override protected void init() { super.init(); // Enable wicket ajax debug getDebugSettings().setAjaxDebugModeEnabled(true); addComponentInstantiationListener(getSpringComponentInjector(this)); // Mount pages mountBookmarkablePage("/home", HomePage.class); mountBookmarkablePage("/exceptionPage", VeryNiceExceptionPage.class); mount(new IndexedParamUrlCodingStrategy("/view_params", ParamPage.class)); } protected IComponentInstantiationListener getSpringComponentInjector(WebApplication app) { return new SpringComponentInjector(app); } }

    Read the article

  • UTF-8 formatting in SPARQL

    - by john
    How can I "say" to SPARQL that ?churchname is in UTF-8 formatting? because response is like:Pražský hrad PREFIX lgv: <http://linkedgeodata.org/vocabulary#> PREFIX abc: <http://dbpedia.org/class/yago/> SELECT ?churchname WHERE { <http://dbpedia.org/resource/Prague> geo:geometry ?gm . ?church a lgv:castle . ?church geo:geometry ?churchgeo . ?church lgv:name ?churchname . FILTER ( bif:st_intersects (?churchgeo,?gm, 10)) } GROUP BY ?churchname ORDER BY ?churchname

    Read the article

  • CURL Authentication being lost?

    - by John Sloan
    I am authenticating a login via CURL just fine. I have a variable I am using to display the returned HTML, and it is returning my user control panel as if I am logged in. After authenticating, I want to communicate variables with a form on another page within the site; but for some reason the HTML from that page is returning a non-authenticated version of the header (as if the original authentication never took place.) I have a cookies.txt file with 777 permissions, and have tried just getting the contents of the same page shown when I authenticate and it is as if I am losing any associated session/cookie data somewhere along the way. Here is my curl.class file - <? class Curl { public $cookieJar = ""; // Make sure the cookies.txt file is read/write permissions public function __construct($cookieJarFile = 'cookies.txt') { $this->cookieJar = $cookieJarFile; } function setup() { $header = array(); $header[0] = "Accept: text/xml,application/xml,application/xhtml+xml,"; $header[0] .= "text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"; $header[] = "Cache-Control: max-age=0"; $header[] = "Connection: keep-alive"; $header[] = "Keep-Alive: 300"; $header[] = "Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7"; $header[] = "Accept-Language: en-us,en;q=0.5"; $header[] = "Pragma: "; // browsers keep this blank. curl_setopt($this->curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.2; en-US; rv:1.8.1.7) Gecko/20070914 Firefox/2.0.0.7'); curl_setopt($this->curl, CURLOPT_HTTPHEADER, $header); curl_setopt($this->curl, CURLOPT_COOKIEJAR, $this->cookieJar); curl_setopt($this->curl, CURLOPT_COOKIEFILE, $this->cookieJar); curl_setopt($this->curl, CURLOPT_AUTOREFERER, true); curl_setopt($this->curl, CURLOPT_COOKIESESSION, true); curl_setopt($this->curl, CURLOPT_FOLLOWLOCATION, true); curl_setopt($this->curl, CURLOPT_RETURNTRANSFER, true); } function get($url) { $this->curl = curl_init($url); $this->setup(); return $this->request(); } function getAll($reg, $str) { preg_match_all($reg, $str, $matches); return $matches[1]; } function postForm($url, $fields, $referer = '') { $this->curl = curl_init($url); $this->setup(); curl_setopt($this->curl, CURLOPT_URL, $url); curl_setopt($this->curl, CURLOPT_POST, 1); curl_setopt($this->curl, CURLOPT_REFERER, $referer); curl_setopt($this->curl, CURLOPT_POSTFIELDS, $fields); return $this->request(); } function getInfo($info) { $info = ($info == 'lasturl') ? curl_getinfo($this->curl, CURLINFO_EFFECTIVE_URL) : curl_getinfo($this->curl, $info); return $info; } function request() { return curl_exec($this->curl); } } ?> And here is my curl.php file - <? include('curl.class.php'); // This path would change to where you store the file $curl = new Curl(); $url = "http://www.site.com/public/member/signin"; $fields = "MAX_FILE_SIZE=50000000&dado_form_3=1&member[email]=email&member[password]=pass&x=16&y=5&member[persistent]=true"; // Calling URL $referer = "http://www.site.com/public/member/signin"; $html = $curl->postForm($url, $fields, $referer); echo($html); ?> <hr style="clear:both;"/> <? $html = $curl->postForm('http://www.site.com/index.php','nid=443&sid=733005&tab=post&eval=yes&ad=&MAX_FILE_SIZE=10000000&ip=63.225.235.30','http://www.site.com/public/member/signin'); echo $html; // This will show you the HTML of the current page you and logged into ?> Any ideas?

    Read the article

  • Vaadin - GWT error "module xxx may need to be recompiled

    - by John Leonard
    I'm ramping up on Vaadin and I'm getting this javascript alert whenever I try and run the demo apps. GWT module 'com.vaadin.terminal.gwt.DefaultWidgetSet' may need to be recompiled I've tried cleaning the project to no avail. As I said, I'm ramping up so I'm sure there's some simple step I'm missing or a concept I haven't grasped.

    Read the article

< Previous Page | 74 75 76 77 78 79 80 81 82 83 84 85  | Next Page >