Daily Archives

Articles indexed Sunday April 1 2012

Page 6/14 | < Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >

  • cant show MBProgressHUD

    - by dejoong
    In here said that using MBProgressHUD is easy. But i cant make it. Here my code: - (IBAction)save{ HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; [self.navigationController.view addSubview:HUD]; HUD.delegate = self; [HUD show:YES]; NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"]; SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title]; [savePage save]; [HUD hide:YES]; } the progress indicator not show during [savePage save] method run, but show after the page completely saved (the indicator show for less than 1 second). I also tried this way: - (IBAction)save { HUD = [[MBProgressHUD alloc] initWithView:self.navigationController.view]; [self.navigationController.view addSubview:HUD]; HUD.delegate = self; HUD.labelText = @"Saving..."; [HUD showWhileExecuting:@selector(performFetchOnMainThread) onTarget:self withObject:nil animated:YES]; } - (void) savingPage{ NSString *title = [page stringByEvaluatingJavaScriptFromString:@"document.title"]; SavePageAs *savePage = [[SavePageAs alloc] initWithUrl:self.site directory:title]; [savePage save]; } -(void) performFetchOnMainThread { [self performSelectorOnMainThread:@selector(savingPage) withObject:nil waitUntilDone:YES]; } but still no luck. Anyone let me know where im lack here?? P.S [savePage save] is saving all website contents to local directory. I wish once the saving is complete the progressHUD disappear. Thanks

    Read the article

  • parseInt and viewflipper layout problems

    - by user1234167
    I have a problem with parseInt it throws the error: unable to parse 'null' as integer. My view flipper is also not working. Hopefully this is an easy enough question. Here is my activity: import javax.xml.parsers.SAXParser; import javax.xml.parsers.SAXParserFactory; import org.xml.sax.InputSource; import org.xml.sax.XMLReader; import android.app.Activity; import android.graphics.Color; import android.os.Bundle; import android.util.Log; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.LinearLayout; import android.widget.TextView; import android.widget.ViewFlipper; import xml.parser.dataset; public class XmlParserActivity extends Activity implements OnClickListener { private final String MY_DEBUG_TAG = "WeatherForcaster"; // private dataset myDataSet; private LinearLayout layout; private int temp= 0; /** Called when the activity is first created. */ //the ViewSwitcher private Button btn; private ViewFlipper flip; // private TextView tv; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); layout=(LinearLayout)findViewById(R.id.linearlayout1); btn=(Button)findViewById(R.id.btn); btn.setOnClickListener(this); flip=(ViewFlipper)findViewById(R.id.flip); //when a view is displayed flip.setInAnimation(this,android.R.anim.fade_in); //when a view disappears flip.setOutAnimation(this, android.R.anim.fade_out); // String postcode = null; // public String getPostcode { // return postcode; // } //URL newUrl = c; // myweather.setText(c.toString()); /* Create a new TextView to display the parsingresult later. */ TextView tv = new TextView(this); // run(0); //WeatherApplicationActivity postcode = new WeatherApplicationActivity(); try { /* Create a URL we want to load some xml-data from. */ URL url = new URL("http://new.myweather2.com/developer/forecast.ashx?uac=gcV3ynNdoV&output=xml&query=G41"); //String url = new String("http://new.myweather2.com/developer/forecast.ashx?uac=gcV3ynNdoV&output=xml&query="+WeatherApplicationActivity.postcode ); //URL url = new URL(url); //url.toString( ); //myString(url.toString() + WeatherApplicationActivity.getString(postcode)); // url + WeatherApplicationActivity.getString(postcode); /* Get a SAXParser from the SAXPArserFactory. */ SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = spf.newSAXParser(); /* Get the XMLReader of the SAXParser we created. */ XMLReader xr = sp.getXMLReader(); /* Create a new ContentHandler and apply it to the XML-Reader*/ handler myHandler = new handler(); xr.setContentHandler(myHandler); /* Parse the xml-data from our URL. */ xr.parse(new InputSource(url.openStream())); /* Parsing has finished. */ /* Our ExampleHandler now provides the parsed data to us. */ dataset parsedDataSet = myHandler.getParsedData(); /* Set the result to be displayed in our GUI. */ tv.setText(parsedDataSet.toString()); } catch (Exception e) { /* Display any Error to the GUI. */ tv.setText("Error: " + e.getMessage()); Log.e(MY_DEBUG_TAG, "WeatherQueryError", e); } temp = Integer.parseInt(xml.parser.dataset.getTemp()); if(temp <0){ //layout.setBackgroundColor(Color.BLUE); //layout.setBackgroundColor(getResources().getColor(R.color.silver)); findViewById(R.id.flip).setBackgroundColor(Color.BLUE); } else if(temp > 0 && temp < 9) { //layout.setBackgroundColor(Color.GREEN); //layout.setBackgroundColor(getResources().getColor(R.color.silver)); findViewById(R.id.flip).setBackgroundColor(Color.GREEN); } else { //layout.setBackgroundColor(Color.YELLOW); //layout.setBackgroundColor(getResources().getColor(R.color.silver)); findViewById(R.id.flip).setBackgroundColor(Color.YELLOW); } /* Display the TextView. */ this.setContentView(tv); } @Override public void onClick(View arg0) { // TODO Auto-generated method stub onClick(View arg0) { // TODO Auto-generated method stub flip.showNext(); //specify flipping interval //flip.setFlipInterval(1000); //flip.startFlipping(); } } this is my dataset: package xml.parser; public class dataset { static String temp = null; // private int extractedInt = 0; public static String getTemp() { return temp; } public void setTemp(String temp) { this.temp = temp; } this is my handler: public void characters(char ch[], int start, int length) { if(this.in_temp){ String setTemp = new String(ch, start, length); // myParsedDataSet.setTempUnit(new String(ch, start, length)); // myParsedDataSet.setTemp; } the dataset and handler i only pasted the code that involves the temp as i no they r working when i take out the if statement. However even then my viewflipper wont work. This is my main xml: <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/linearlayout1" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="25dip" android:text="Flip Example" /> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="25dip" android:id="@+id/tv" /> <Button android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="25dip" android:text="Flip" android:id="@+id/btn" android:onClick="ClickHandler" /> <ViewFlipper android:layout_width="fill_parent" android:layout_height="fill_parent" android:id="@+id/flip"> <LinearLayout android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="25dip" android:text="Item1a" /> </LinearLayout> <TextView android:layout_width="fill_parent" android:layout_height="wrap_content" android:textSize="25dip" android:id="@+id/tv2" /> </ViewFlipper> </LinearLayout> this is my logcat: 04-01 18:02:24.744: E/AndroidRuntime(7331): FATAL EXCEPTION: main 04-01 18:02:24.744: E/AndroidRuntime(7331): java.lang.RuntimeException: Unable to start activity ComponentInfo{xml.parser/xml.parser.XmlParserActivity}: java.lang.NumberFormatException: unable to parse 'null' as integer 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1830) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1851) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.ActivityThread.access$1500(ActivityThread.java:132) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1038) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.os.Handler.dispatchMessage(Handler.java:99) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.os.Looper.loop(Looper.java:150) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.ActivityThread.main(ActivityThread.java:4293) 04-01 18:02:24.744: E/AndroidRuntime(7331): at java.lang.reflect.Method.invokeNative(Native Method) 04-01 18:02:24.744: E/AndroidRuntime(7331): at java.lang.reflect.Method.invoke(Method.java:507) 04-01 18:02:24.744: E/AndroidRuntime(7331): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) 04-01 18:02:24.744: E/AndroidRuntime(7331): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) 04-01 18:02:24.744: E/AndroidRuntime(7331): at dalvik.system.NativeStart.main(Native Method) 04-01 18:02:24.744: E/AndroidRuntime(7331): Caused by: java.lang.NumberFormatException: unable to parse 'null' as integer 04-01 18:02:24.744: E/AndroidRuntime(7331): at java.lang.Integer.parseInt(Integer.java:356) 04-01 18:02:24.744: E/AndroidRuntime(7331): at java.lang.Integer.parseInt(Integer.java:332) 04-01 18:02:24.744: E/AndroidRuntime(7331): at xml.parser.XmlParserActivity.onCreate(XmlParserActivity.java:118) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1072) 04-01 18:02:24.744: E/AndroidRuntime(7331): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1794) I hope I have given enough information about my problems. I will be extremely grateful if anyone can help me out.

    Read the article

  • Getting Bad file descriptor when running Tornado AsyncHTTPTestCase

    - by Will
    When running a test using the Tornado AsyncHTTPTestCase I'm getting a stack trace that isn't related to the test. The test is passing so this is probably happening on the test clean up? I'm using Python 2.7.2, Tornado 2.2. The test code is: class AllServersHandlerTest(AsyncHTTPTestCase): endpoint = AllServersHandler.endpoint # '/rest/test/' def test_server_status_with_advertiser(self): on_new_host(None, '127.0.0.1') response = self.fetch(self.endpoint, method='GET') result = json.loads(response.body, 'utf8').get('data') self.assertEquals(['127.0.0.1'], result) The test passes ok, but I get the following stack trace from the Tornado server. OSError: [Errno 9] Bad file descriptor INFO:root:200 POST /rest/serverStatuses (127.0.0.1) 0.00ms DEBUG:root:error closing fd 688 Traceback (most recent call last): File "C:\Python27\Lib\site-packages\tornado-2.2-py2.7.egg\tornado\ioloop.py", line 173, in close os.close(fd) OSError: [Errno 9] Bad file descriptor Any ideas how to cleanly shutdown the test case?

    Read the article

  • JavaScript - How to change a dom node back to an existing Google Map?

    - by David Robertson
    I set a div to a class which shows a spinning animated when the map is loading some data, the question is, how can I set the div back to the map (I don't want to load a new map, but load the existing one, which is assigned to a var 'map')? //map is assigned originally like this: map = new google.maps.Map(document.getElementById('map3'),options); //animated graphic is assigned to map div on load of data: document.getElementById('map3').className = "loading"; but how to get the map back? Thanks for any tips! David

    Read the article

  • Android Webkit Input elements buggy with CSS3 translate3D

    - by Dansl
    I'm having a couple issues with the Input element in a Webkit Android App i'm developing. Testing on 2.X, but 3.x doesn't seem to have these issues... The app works by having separate Div's for each "page", and I'm using CSS3 translate3D to animate between the pages. Some of those pages include Input elements. When I tap on the input to gain focus, any of my "position:fixed" Div's will shift about 5px from the top, and 5px left. Now the kicker... it will eventually fix itself, and then never happen again when you tap on an input, its only that first time... My other problem, the Input elements are screwy with keyboards, for instance, spell corrections/autocomplete will not input text, and when using Swype Keyboard, you can't "swipe" the word, ONLY individual taps for each letter will input text into the Input element. I've read that a lot of these might be caused by CSS3 Translate3D. But, I've tried just about everything to fix these issues, and I've searched just about every site for a solution, but havent been able to find a fix, or find anyone else with this issue... Does anyone else have these issues, or know of a fix? (Possible solution??) Anyone know of a way to override the default behavior of Input elements in the webkit? I wonder if I can generate my own TextView and position it over these input fields...? Any help is greatly appreciated :)

    Read the article

  • Can I delay the keyup event for jquery?

    - by Paul
    I'm using the rottentomatoes movie API in conjunction with twitter's typeahead plugin using bootstrap 2.0. I've been able to integerate the API but the issue I'm having is that after every keyup event the API gets called. This is all fine and dandy but I would rather make the call after a small pause allowing the user to type in several characters first. Here is my current code that calls the API after a keyup event: var autocomplete = $('#searchinput').typeahead() .on('keyup', function(ev){ ev.stopPropagation(); ev.preventDefault(); //filter out up/down, tab, enter, and escape keys if( $.inArray(ev.keyCode,[40,38,9,13,27]) === -1 ){ var self = $(this); //set typeahead source to empty self.data('typeahead').source = []; //active used so we aren't triggering duplicate keyup events if( !self.data('active') && self.val().length > 0){ self.data('active', true); //Do data request. Insert your own API logic here. $.getJSON("http://api.rottentomatoes.com/api/public/v1.0/movies.json?callback=?&apikey=MY_API_KEY&page_limit=5",{ q: encodeURI($(this).val()) }, function(data) { //set this to true when your callback executes self.data('active',true); //Filter out your own parameters. Populate them into an array, since this is what typeahead's source requires var arr = [], i=0; var movies = data.movies; $.each(movies, function(index, movie) { arr[i] = movie.title i++; }); //set your results into the typehead's source self.data('typeahead').source = arr; //trigger keyup on the typeahead to make it search self.trigger('keyup'); //All done, set to false to prepare for the next remote query. self.data('active', false); }); } } }); Is it possible to set a small delay and avoid calling the API after every keyup?

    Read the article

  • Database call crashes Android Application

    - by Darren Murtagh
    i am using a Android database and its set up but when i call in within an onClickListener and the app crashes the code i am using is mButton.setOnClickListener( new View.OnClickListener() { public void onClick(View view) { s = WorkoutChoice.this.weight.getText().toString(); s2 = WorkoutChoice.this.height.getText().toString(); int w = Integer.parseInt(s); double h = Double.parseDouble(s2); double BMI = (w/h)/h; t.setText(""+BMI); long id = db.insertTitle("001", ""+days, ""+BMI); Cursor c = db.getAllTitles(); if (c.moveToFirst()) { do { DisplayTitle(c); } while (c.moveToNext()); } } }); and the log cat for when i run it is: 04-01 18:21:54.704: E/global(6333): Deprecated Thread methods are not supported. 04-01 18:21:54.704: E/global(6333): java.lang.UnsupportedOperationException 04-01 18:21:54.704: E/global(6333): at java.lang.VMThread.stop(VMThread.java:85) 04-01 18:21:54.704: E/global(6333): at java.lang.Thread.stop(Thread.java:1391) 04-01 18:21:54.704: E/global(6333): at java.lang.Thread.stop(Thread.java:1356) 04-01 18:21:54.704: E/global(6333): at com.b00348312.workout.Splashscreen$1.run(Splashscreen.java:42) 04-01 18:22:09.444: D/dalvikvm(6333): GC_FOR_MALLOC freed 4221 objects / 252640 bytes in 31ms 04-01 18:22:09.474: I/dalvikvm(6333): Total arena pages for JIT: 11 04-01 18:22:09.574: D/dalvikvm(6333): GC_FOR_MALLOC freed 1304 objects / 302920 bytes in 29ms 04-01 18:22:09.744: D/dalvikvm(6333): GC_FOR_MALLOC freed 2480 objects / 290848 bytes in 33ms 04-01 18:22:10.034: D/dalvikvm(6333): GC_FOR_MALLOC freed 6334 objects / 374152 bytes in 36ms 04-01 18:22:14.344: D/AndroidRuntime(6333): Shutting down VM 04-01 18:22:14.344: W/dalvikvm(6333): threadid=1: thread exiting with uncaught exception (group=0x400259f8) 04-01 18:22:14.364: E/AndroidRuntime(6333): FATAL EXCEPTION: main 04-01 18:22:14.364: E/AndroidRuntime(6333): java.lang.IllegalStateException: database not open 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.database.sqlite.SQLiteDatabase.insertWithOnConflict(SQLiteDatabase.java:1567) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1484) 04-01 18:22:14.364: E/AndroidRuntime(6333): at com.b00348312.workout.DataBaseHelper.insertTitle(DataBaseHelper.java:84) 04-01 18:22:14.364: E/AndroidRuntime(6333): at com.b00348312.workout.WorkoutChoice$3.onClick(WorkoutChoice.java:84) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.view.View.performClick(View.java:2408) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.view.View$PerformClick.run(View.java:8817) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.os.Handler.handleCallback(Handler.java:587) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.os.Handler.dispatchMessage(Handler.java:92) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.os.Looper.loop(Looper.java:144) 04-01 18:22:14.364: E/AndroidRuntime(6333): at android.app.ActivityThread.main(ActivityThread.java:4937) 04-01 18:22:14.364: E/AndroidRuntime(6333): at java.lang.reflect.Method.invokeNative(Native Method) 04-01 18:22:14.364: E/AndroidRuntime(6333): at java.lang.reflect.Method.invoke(Method.java:521) 04-01 18:22:14.364: E/AndroidRuntime(6333): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858) 04-01 18:22:14.364: E/AndroidRuntime(6333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 04-01 18:22:14.364: E/AndroidRuntime(6333): at dalvik.system.NativeStart.main(Native Method) i have notice errors when the application opens but i dont no what thet are from. when i take out the statements to do with the database there is no errors and everthign runs smoothly

    Read the article

  • Update MySQL table from jsp

    - by vishnu
    I have these in a jsp file. But these values are not updated in the mysql table. May be it is not commiting. How can i solve this ? String passc1 = request.getParameter("passc1"); String accid = request.getParameter("accid"); int i = 0; String sql = " update customertb " + " set passwd = ?" + " where acc_no = ?;"; try { PreparedStatement ps = con.prepareStatement(sql); ps.setString(1, passc1); ps.setString(2, accid); i = ps.executeUpdate(); } catch (Exception e) { // do something with Exception here. Maybe just throw it up again } finally { con.close(); }

    Read the article

  • Reference-counted object is used after it is released

    - by EndyVelvet
    Doing code analysis of the project and get the message "Reference-counted object is used after it is released" on the line [defaults setObject: deviceUuid forKey: @ "deviceUuid"]; I watched this topic Obj-C, Reference-counted object is used after it is released? But the solution is not found. ARC disabled. // Get the users Device Model, Display Name, Unique ID, Token & Version Number UIDevice *dev = [UIDevice currentDevice]; NSString *deviceUuid; if ([dev respondsToSelector:@selector(uniqueIdentifier)]) deviceUuid = dev.uniqueIdentifier; else { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; id uuid = [defaults objectForKey:@"deviceUuid"]; if (uuid) deviceUuid = (NSString *)uuid; else { CFStringRef cfUuid = CFUUIDCreateString(NULL, CFUUIDCreate(NULL)); deviceUuid = (NSString *)cfUuid; CFRelease(cfUuid); [defaults setObject:deviceUuid forKey:@"deviceUuid"]; } } Please help find the cause.

    Read the article

  • CoffeeScript Class Properties Within Nested Anonymous Functions

    - by Aric
    I'm just taking a look at CoffeeScript for the first time so bare with me if this is a dumb question. I'm familiar with the hidden pattern methodology however I'm still wrapping my head around object prototypes. I'm trying to create a basic class for controlling a section on my site. The problem I'm running into is losing defined class variables within a different scope. For example, the code below works fine and creates the properties within the object perfectly. However when I jump into a jQuery callback I lose all knowledge of the class variables storing some of the jQuery objects for multiple uses. Is there a way to grab them from within the callback function? class Session initBinds: -> @loginForm.bind 'ajax:success', (data, status, xhr) -> console.log("processed") return @loginForm.bind 'ajax:before', (xhr, settings) -> console.log @loader // need access to Session.loader return return init: -> @loginForm = $("form#login-form") @loader = $("img#login-loader") this.initBinds() return

    Read the article

  • RestSharp post object to WCF

    - by steve
    Im having an issue posting an object to my wcf rest webservice. On the WCF side I have the following: [WebInvoke(UriTemplate = "", Method = "POST")] public void Create(myObject object) { //save some stuff to the db } When im debugging this never gets hit - it does however get hit when I remove the parameter so im guessing ive done something wrong on the restSharp side of things. Heres my code for that part: var client = new RestClient(ApiBaseUri); var request = new RestRequest(Method.POST); request.RequestFormat = DataFormat.Xml; request.AddBody(myObject); var response = client.Execute(request); Am I doing this wrong? How can the WCF side see my object? What way should I be making the reqest? Or should I be handling it differently WCF side? Things ive tried: request.AddObject(myObject); and request.AddBody(request.XmlSerialise.serialise(myObject)); Any help and understanding in what could possibly be wrong would be much appreciated. Thanks.

    Read the article

  • RegexKitLite Runtime Crash

    - by Hasan Can Saral
    I'm overlaying the mapview and using RegexKitLite. I couldn't make it work. I've downloaded .m and .h files and added to the project. Also I tried, adding libicucore.dylib or libicucore.A.dlib or adding -licucore to other compiler flags field. Still getting the error: 2012-04-01 19:38:04.633 sennerdeysen[907:15803] -[__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x88b6a00 2012-04-01 19:38:04.634 sennerdeysen[907:15803] * Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString stringByMatching:capture:]: unrecognized selector sent to instance 0x88b6a00' Any idea? Latest Xcode but the sdk is 4.3 Without ARC or anything else that iOS 5.0 SDK provides.

    Read the article

  • How to specify a font from javascript?

    - by Steven Lu
    I am trying to customize a view-src bookmarklet for iPad. This one is looking pretty good so far. But I want to make it just a little more readable: The Courier (New) font is a bit ugly even (especially?) on the retina display and I'd prefer any one of DejaVu Sans Mono, Monaco, Lucida Console, Bitstream Vera Sans Mono. I tried to modify the bookmarklet script by adding: pre.style.fontFamily = '"DejaVu Sans Mono", "Lucida Console", Monaco;'; It's not doing the trick. Perhaps prettyprint cancels out my fontFamily setting when it loads. Maybe I can set it at the end of the script somehow...

    Read the article

  • How can I emulate forward on 404 in jersey?

    - by koppor
    I have a picture on a given URL. The picture might need a referesh. I want to do the freshness-check at the time of the request. Therefore, I coded a jersey resource handling the request on the picture URL. It refreshes the picture on the filesystem if necessary. I do not want to re-code a caching mechansim, but rely on tomcat's implementation. Therefore, I would like to "forward" the request in the internal handler chain. I tried return new Viewable(sb.toString());, but a viewable is not a picture. What return type can I use? I could let the concrete picture reside on another URL and send a 307 (Temporary Redirect). Always sending that as answer seems odd to me. Related question: How to return a PNG image from Jersey REST service method to the browser

    Read the article

  • Unobtrusive Client Validation without accepting model

    - by user1010609
    I have simple form like this which accepts only two values string action and editText.Is there a way to enable Unobtrusive Client Validation on this without Data Annotations? Or do I have to accept model and use Data Annotations? I just need it to make sure editText is atleast 5 chars long. @using (Ajax.BeginForm("Action", "Controller", null, new AjaxOptions { OnFailure = "error", UpdateTargetId = "Pcedit" + @Model.ID})) { <textarea rows="3" cols="2" name="editText" style="width:100%;"></textarea> <br /> <input type="submit" name="action" value="Save"/> <input type="submit" name="action" value="Cancel"/> }

    Read the article

  • Using Entity Framework Entity splitting customisations in an ASP.Net application

    - by nikolaosk
    I have been teaching in the past few weeks many people on how to use Entity Framework. I have decided to provide some of the samples I am using in my classes. First let’s try to define what EF is and why it is going to help us to create easily data-centric applications.Entity Framework is an object-relational mapping (ORM) framework for the .NET Framework.EF addresses the problem of Object-relational impedance mismatch . I will not be talking about that mismatch because it is well documented in many...(read more)

    Read the article

  • Migration & Modernization: Windows/VB6 Apps to ASP.NET HTML5

    - by Visual WebGui
    I would like to invite you to a webinar we are doing in collaboration with Jeffrey S. Hammond , Principal Analyst serving Application Development & Delivery Professionals at Forrester Research. The webinar is free and it will will introduce the substantial changes brought on by the move to Web Applications and Open Web architectures, and the challenges it places on application development shops. We’ll also introduce how we at Gizmox are helping client navigate this mobile shift and evolve existing...(read more)

    Read the article

  • Adding AjaxOnly Filter in ASP.NET Web API

    - by imran_ku07
            Introduction:                     Currently, ASP.NET MVC 4, ASP.NET Web API and ASP.NET Single Page Application are the hottest topics in ASP.NET community. Specifically, lot of developers loving the inclusion of ASP.NET Web API in ASP.NET MVC. ASP.NET Web API makes it very simple to build HTTP RESTful services, which can be easily consumed from desktop/mobile browsers, silverlight/flash applications and many different types of clients. Client side Ajax may be a very important consumer for various service providers. Sometimes, some HTTP service providers may need some(or all) of thier services can only be accessed from Ajax. In this article, I will show you how to implement AjaxOnly filter in ASP.NET Web API application.         Description:                     First of all you need to create a new ASP.NET MVC 4(Web API) application. Then, create a new AjaxOnly.cs file and add the following lines in this file, public class AjaxOnlyAttribute : System.Web.Http.Filters.ActionFilterAttribute { public override void OnActionExecuting(System.Web.Http.Controllers.HttpActionContext actionContext) { var request = actionContext.Request; var headers = request.Headers; if (!headers.Contains("X-Requested-With") || headers.GetValues("X-Requested-With").FirstOrDefault() != "XMLHttpRequest") actionContext.Response = request.CreateResponse(HttpStatusCode.NotFound); } }                     This is an action filter which simply checks X-Requested-With header in request with value XMLHttpRequest. If X-Requested-With header is not presant in request or this header value is not XMLHttpRequest then the filter will return 404(NotFound) response to the client.                      Now just register this filter, [AjaxOnly] public string GET(string input)                     You can also register this filter globally, if your Web API application is only targeted for Ajax consumer.         Summary:                       ASP.NET WEB API provide a framework for building RESTful services. Sometimes, you may need your certain API services can only be accessed from Ajax. In this article, I showed you how to add AjaxOnly action filter in ASP.NET Web API. Hopefully you will enjoy this article too.

    Read the article

  • Dump nginx config from running process?

    - by Sergio Tulentsev
    Apparently, I shouldn't have spent sleepless night trying to debug an application. I wanted to restart my nginx and discovered that its config file is empty. I don't remember truncating it, but fat fingers and reduced attention probably played their part. I don't have backup of that config file. I know I should have made it. Good for me, current nginx daemon is still running. Is there a way to dump its configuration to a config file that it'll understand later?

    Read the article

  • Method to calculate downtime percentage

    - by Chris
    I need a calculation to work out the downtime percentage of a server. I am making a script that runs via cron every minute to check the uptime of a remote server. The two values I have to play with are number of checks run and times the checks failed (outages). Is this a plausible way of calculating it? I am thinking it must be but can't be too sure as my Maths skills are slipping away from me with age!

    Read the article

  • Apache virtualhost - Mac OSX 10.7.3

    - by Rakan
    After upgrading to Lion, all my virtualhosts stopped working. They redirect to "It works" main apache page on my device for some weird reason. Example: /etc/hosts: 127.0.0.1 myhost.com <VirtualHost *:80> DocumentRoot "/Library/WebServer/Documents/testproj/" ServerName myhost.com <Directory "/Library/WebServer/Documents/testproj/"> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny Allow from all </Directory> ErrorLog "/private/var/log/apache2/testproj-error_log" CustomLog "/private/var/log/apache2/testproj-access_log" common </VirtualHost> Did anyone else face the same issue? How can I fix this?

    Read the article

  • using wbadmin to backup and recover

    - by g7rpo
    HI I am using wbadmin to perform backups of a specific folder, primarily to backup my VHD files this is working fine but I tried to recover the files today using a different machine to the one which created the backup and couldnt get the machine doing the recovery to 'see' the backups. Is there a way to do this as my worry is that if I have a failure on the host which is perfmorming the backups I need to be able to install hyper-v on another host and recover the backed up VMs to there until I can rebuild the host. It appears that this isnt possible, I am hoping I am missing something. Any help would be greatly appreciated.

    Read the article

  • Disk quota problem in Windows Server SBS 2003

    - by deddebme
    I have got a new job and the existing SBS 2003 domain setup is unsecure (i.e. everyone is a domain admin etc etc). There are lots of problem due to inexperienced "network admin", and I am trying to fix them one by one. There exist one issue which I found quite weird, that the "Quota" tab exists in the C:(NTFS) drive but not the D:(NTFS) drive. I played around with gpedit to enable disk quota (it was "not configured" before), but still I can't see that tab. Have you seen this problem before? How did you solve it?

    Read the article

  • How to fix error with "class" when creating a dhcp split-scope on Windows 2008?

    - by Jonas Stensved
    I'm trying to split a dhcp scope between a existing domain controller TTP01 and the new DC TTP02 to provide failover. I'm using the the wizard in DHCP [my scope] Advanced Split-scope. In the final step I get an error saying: Migration of Scope Options on Added DHCP Server: Failed Error: 0x00004E4C - The class name being used is unknown or incorrect. I can't find anything that seems to be wrong with my Scope Options settings, they are: Option Name Vendor Value Class 003 Router Standard 192.168.137.1 None 006 DNS Server Standard 192.168.137.2 None 015 DNS Domain Name Standard ttp.local None 060 PXEClient Standard PXEClient None I can't find any information about this error except this msdn article when searching. How do make it work?

    Read the article

  • EC2 configuration for medium load service on Django

    - by Luberg
    I have created a very basic Django application which puts an email to the database (Coming soon page for a startup). I launched a t1.micro instance to try out which load it can carry out. Nginx+FastCGI from Django+sqllite/postgres - tried both. blitz.io test gave me a pretty unhappy result (just 100 users within 1 minute): This rush generated 542 successful hits in 1.0 min and we transferred 809.01 KB of data in and out of your app. The average hit rate of 8.81/second translates to about 761,612 hits/day. You got bigger problems though: 87.28% of the users during this rush experienced timeouts or errors! I tried both to put varnish, disabled Debub mode in django and started fastcgi in threaded mode - nothing helps. This is not gonna be a super highload page - just a coming soon page to save email of subscribers, it should carry at least 500-1000 users at the same time in peak... I believe t1.micro is super small for that, but I also have tried small instance - not better result.. Please let me know should I use something different from Amazon EC2, or to pick smth better than t1.micro, or I that is definetely a configuration issues?...

    Read the article

< Previous Page | 2 3 4 5 6 7 8 9 10 11 12 13  | Next Page >