Search Results

Search found 4242 results on 170 pages for 'mark c'.

Page 73/170 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Using Python simplejson for transmitting JSON to another server results in unicode encoding problems

    - by Mark
    Hi there, I'm encoding a string with Python's simplejson library with special characters: hello testing spécißl characters plusses: +++++ special chars :œ?´®†¥¨ˆøp“ß?ƒ©??°¬O˜çv?˜µ== However, when I encode it and transmit it to the other machine (using POST), it turns out like this: {'message': ['{"body": "hello testing sp\\u00e9ci\\u00dfl characters\\n\\nplusses: \\n\\nspecial chars :\\u0153\\u2211\\u00b4\\u00ae\\u2020\\u00a5\\u00a8\\u02c6\\u00f8\\u03c0\\u201c\\u00df\\u2202\\u0192\\u00a9\\u02d9\\u2206\\u02da\\u00ac\\u03a9\\u2248\\u00e7\\u221a\\u222b\\u02dc\\u00b5\\u2264\\u2265"}']} The + signs are completely stripped and the rest are in this unicode(?) format. My code for this is: data = {'body': data_string} data_encoded = json.dumps(data) Any ideas? Thanks! Edit: I've tried using json.dumps(data, ensure_ascii=False) but it results in a UnicodeError ordinal not in range error.

    Read the article

  • How To Add Custom ModelValidatorProviders To Web API Project?

    - by Mark S.
    I'm moving some MVC code to Web API and I need to update my custom ModelValidatorProviders. It seems as though my validators can stay much the same only they should inherit the System.Web.Http.Validation namespace. What I can't figure out is how to add the provider to Web API. When using MVC I can just add the following to my global.asax: ModelValidatorProviders.Providers.Add(new CustomModelValidatorProvider()); How do I use the custom provider with Web API?

    Read the article

  • Drupal CCK Text field not saving.

    - by Mark Milbourne
    Hey Guys, I've been trying to write a CCK Field based on the Text field. But if I create a standard CCK Text field with only 1 value. Then edit a content item for this type, the values are never persisted. When I go back in and edit the same node, the value isn't there. I checked the database and its not in the table for the CCK node. If I use more than one value it works fine. I'm upto date on CCK (6.x-2.6) and CTools (6.x-1.5). Has anyone seen this? and a possible solution?

    Read the article

  • When marking an item (changing background color) in ListView it's repeating for other items.

    - by Adi
    If I want to mark the second item I'm doing the following code: This code is from my Adapter that extends ArrayAdapter : if (convertView == null) { LayoutInflater mInflater = (LayoutInflater)getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); convertView = mInflater.inflate(R.layout.channel_list, null); } MyContent o = items.get(position); if (o != null) { TextView tt = (TextView) convertView.findViewById(R.id.toptext); TextView bt = (TextView) convertView.findViewById(R.id.bottomtext); if (tt != null) { tt.setText(o.Top()); } if(bt != null){ bt.setText(o.Bottom()); } if(position == 2) { convertView.setBackgroundColor(R.color.selectem_color); } } return convertView; It will show the list view but mark every 9'th item after this item (the 11'th item 13'th and so on). Does anyone know what's the reason?

    Read the article

  • drupal module, check if node type

    - by Mark
    As a more specific take on this question: http://stackoverflow.com/questions/2985518/drupal-jquery-1-4-on-specific-pages How do I check, inside a module, whether or not a node is a certain type to be able to do certain things to the node. Thanks

    Read the article

  • What does the C# operator => mean?

    - by Mr. Mark
    Answers to a recent post (Any chances to imitate times() Ruby method in C#?) use the = operator in the usage examples. What does this operator do? I can't locate it in my C# book, and it is hard to search for symbols like this online. (I couldn't find it.)

    Read the article

  • MySQL managing catalogue views

    - by Mark Lawrence
    A friend of mine has a catalogue that currently holds about 500 rows or 500 items. We are looking at ways that we can provide reports on the catalogue inclduing the number of times an item was viewed, and dates for when its viewed. His site is averaging around 25,000 page impressions per month and if we assumed for a minute that half of these were catalogue items then we'd assume roughly 12,000 catalogue items viewed each month. My question is the best way to manage item views in the database. First option is to insert the catalogue ID into a table and then increment the number of times its viewed. The advantage of this is its compact nature. There will only ever be as many rows in the table as there are catalogue items. `catalogue_id`, `views` The disadvantage is that no date information is being held, short of maintaining the last time an item was viewed. The second option is to insert a new row each time an item is viewed. `catalogue_id`, `timestamp` If we continue with the assumed figure of 12,000 item views that means adding 12,000 rows to the table each month, or 144,000 rows each year. The advantage of this is we know the number of times the item is viewed, and also the dates for when its viewed. The disadvantage is the size of the table. Is a table with 144,000 rows becoming too large for MySQL? Interested to hear any thoughts or suggestions on how to achieve this. Thanks.

    Read the article

  • Checkboxes in ADF are initially null, where I want them to be 0

    - by Mark Tielemans
    I am using ADF in JDeveloper and don´t have any experience with either of the two. Now I´ve run into quite some trouble yet, but for this particular thing I decided to consult the wisom of stackoverflow. The thing is, I have an edit form for an object that contains 3 checkboxes. The checked values are set to 1, unchecked to 0. In my database, the values are NOT NULL, and I want to keep it that way. The thing is, in the edit form, if the user submits the form leaving any boxes unchecked, it will result in an error, because the unchecked box values apparently remain null. Only after checking and then unchecking the boxes again, their values will be '0' rather than null. I've tried some things, including making the attributes mandatory in the domain BCD, but that just gives a bit more neat error message.. Any help would be greatly appreciated!! EDIT I made a little progress thanks to the guide provided by Joe, but still run into problems. I changed the values that should be checkboxes in my model, making them BOOLEANs where the table columns are NUMBERs (All are also mandatory and have a default value of 0). This automatically changed the corresponding View Object too. In the Application module, this now works great. It shows checkboxes, a checked one will return 1, an untouched one will return 0. However, I deleted the old form, and inserted a new one using the corresponding Data Control. I gave these values the checkbox type. I still had to edit the bindings (which I think reflects the problem, as this is not the case with, say, a model-level defined LOV) and gave them 1 for checked and 0 for unchecked. However, now apart from the original problem still occurring, also the checkboxes cannot be unchecked after checking, and return 0 when checked (and null when left untouched). Even though this has created new problems, it works correctly in my AM. Does someone know what I'm doing wrong in my Swing form?

    Read the article

  • How do I clear a WebView's content before loading a page?

    - by Mark
    I have an embedded WebView in my Cocoa application in which I load an external web page. Each time the user clicks on a button, the view opens and shows the page. The problem is that the second time the user opens the WebView, the previous page is still visible. Instead I'd like to show a blank/empty page (together with a progress indicator). How can I clear a WebView before loading a new page? The closest solution I could find was to call this: [webView stringByEvaluatingJavaScriptFromString:@"document.open();document.close()"]; Is there a better way to do this? Thanks!

    Read the article

  • DispatcherOperations.Wait()

    - by Mark
    What happens if you call dispatcherOperation.Wait() on an operation that has already completed? Also, the docs say that it returns a DispatcherOperationStatus, but wouldn't that always be Completed since it (supposedly) doesn't return until it's done? I was trying to use it like this: private void Update() { while (ops.Count > 0) ops.Dequeue().Wait(); } public void Add(T item) { lock (sync) { if (dispatcher.CheckAccess()) { list.Add(item); OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, item)); } else { ops.Enqueue(dispatcher.BeginInvoke(new Action<T>(Add), item)); } } } I'm using this in WPF, so all the Add operations have to occur on the UI thread, but I figured I could basically just queue them up without having to wait for it to switch threads, and then just call Update() before any read operations to ensure that the list is up to date, but my program started hanging.

    Read the article

  • Large static arrays are slowing down class load, need a better/faster lookup method

    - by Visualize
    I have a class with a couple static arrays: an int[] with 17,720 elements a string[] with 17,720 elements I noticed when I first access this class it takes almost 2 seconds to initialize, which causes a pause in the GUI that's accessing it. Specifically, it's a lookup for Unicode character names. The first array is an index into the second array. static readonly int[] NAME_INDEX = { 0x0000, 0x0001, 0x0005, 0x002C, 0x003B, ... static readonly string[] NAMES = { "Exclamation Mark", "Digit Three", "Semicolon", "Question Mark", ... The following code is how the arrays are used (given a character code). [Note: This code isn't a performance problem] int nameIndex = Array.BinarySearch<int>(NAME_INDEX, code); if (nameIndex > 0) { return NAMES[nameIndex]; } I guess I'm looking at other options on how to structure the data so that 1) The class is quickly loaded, and 2) I can quickly get the "name" for a given character code. Should I not be storing all these thousands of elements in static arrays?

    Read the article

  • Forced naming of parameters in python

    - by Mark Mayo
    In python you may have a function definition: def info(object, spacing=10, collapse=1) which could be called in any of the following ways: info(odbchelper) info(odbchelper, 12) info(odbchelper, collapse=0) info(spacing=15, object=odbchelper) thanks to python's allowing of any-order arguments, so long as they're named. The problem we're having is as some of our larger functions grow, people might be adding parameters between spacing and collapse, meaning that the wrong values may be going to parameters that aren't named. In addition sometimes it's not always clear as to what needs to go in. We're after a way to force people to name certain parameters - not just a coding standard, but ideally a flag or pydev plugin? so that in the above 4 examples, only the last would pass the check as all the parameters are named. Odds are we'll only turn it on for certain functions, but any suggestions as to how to implement this - or if it's even possible would be appreciated.

    Read the article

  • jQuery Running a function in a context and adding to a variable

    - by Mark
    For this question I'm going to give a simplified example of what I want to do, and the function I want to learn to write. var collection = ''; <div id='container'> <span>1</span> <span>2</span> <span>3</span> </div> What I want to do this, for every span in the div, take its text, add it to the collection. So ideally it would look like: $('#container').addtoCollection(collection); The method would be something like: $(this).find('span').each(function () { collection = collection + $(this).text(); }). Where the first this would equal #container. So in the end you can do: console.log(collection); and get: 123 How do I write the function that does this? Thanks!

    Read the article

  • simple fbml fb:login-button is not rendering in ie6

    - by Mark
    The following codes works in FF and Chrome, but IE6 does not render the connect button. What am I missing here? <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:fb="http://www.facebook.com/2008/fbml"> <head> <title></title> </head> <body> <fb:login-button>Login button</fb:login-button> <script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script> <script type="text/javascript"> FB_RequireFeatures(["XFBML"], function(){ FB.Facebook.init("API_KEY", "/xd_receiver.htm"); }); </script> </body> </html>

    Read the article

  • Not compile code blocks when publishing?

    - by Menno Gouw
    I have many lines i just use for debugging and helpers. Is there a way i can mark these so they do not compile when publishing a project but still can use when running/debugging my program within Eclipse? Even better would be to mark a certain field as debug only and discard everything that has to do with that field completely when publishing. I understand this might get one in trouble when using fields like that and using that in critical parts of the code. But i often find myself initializing a lot of debug fields then comment them out which results in errors down the line if i do not comment those out as well. So is there some way to handle this in a better and more efficient way?

    Read the article

  • Mongodb - how to deserialze when a property has an Interface return type

    - by Mark Kelly
    I'm attempting to avoid introducing any dependencies between my Data layer and client code that makes use of this layer, but am running into some problems when attempting to do this with Mongo (using the MongoRepository) MongoRepository shows examples where you create Types that reflect your data structure, and inherit Entity where required. Eg. [CollectionName("track")] public class Track : Entity { public string name { get; set; } public string hash { get; set; } public Artist artist { get; set; } public List<Publish> published {get; set;} public List<Occurence> occurence {get; set;} } In order to make use of these in my client code, I'd like to replace the Mongo-specific types with Interfaces, e.g: [CollectionName("track")] public class Track : Entity, ITrackEntity { public string name { get; set; } public string hash { get; set; } public IArtistEntity artist { get; set; } public List<IPublishEntity> published {get; set;} public List<IOccurenceEntity> occurence {get; set;} } However, the Mongo driver doesn't know how to treat these interfaces, and I understandably get the following error: An error occurred while deserializing the artist property of class sf.data.mongodb.entities.Track: No serializer found for type sf.data.IArtistEntity. --- MongoDB.Bson.BsonSerializationException: No serializer found for type sf.data.IArtistEntity. Does anyone have any suggestions about how I should approach this?

    Read the article

  • CS Majors: Hardest concept(s) you learned in school?

    - by Mark Lubin
    For the CS majors out there what were the hardest CS classes or concepts that you learned in your undergraduate schooling? Did you find once you learned the basics,(data structs, OOP fundamentals, discrete math, pointers, recursion, etc) the rest followed naturally or did you hit a wall at any point in your higher classes like OS'es and Compilers? Thanks for the input!

    Read the article

  • streaming xml pretty printer in C/C++ using expat or libxml2?

    - by Mark Zeren
    I have a library that outputs xml without whitespace all on one line. In some cases I'd like to pretty print that output. I'm looking for a BSD-ish licensed C/C++ library or sample code that will take a raw xml byte stream and pretty print it. Here's some pseudo code showing one way that I might use this functionality: void my_write(const char* buf, int len); PrettyPrinter pp(bind(&my_write)); while (...) { // ... get some more xml ... const char* buf = xmlSource.get_buf(); int len = xmlSource.get_buf_len(); int written = pp.write(buf, len); // calls my_write with pretty printed xml // ... error handling, maybe call write again, etc. ... } I'd like to avoid instantiating a DOM representation. I already have dependencies on the expat and libxml2 shared libraries, and I'd rather not add any more shared library dependencies.

    Read the article

  • How to refer to enum values inside nhibernate formula mapping specification?

    - by mark
    Dear ladies and sirs. I have two entities types: RunContainer parent entity type Run child entity type Run has a property Status, which is of type RunStatus, like so: public enum RunStatus { Created, Starting, // ... } public class Run { public int ContainerId { get; private set; } // ... public RunStatus Status { get; private set; } } RunContainer has a calculated property ActiveRunCount, like so: public class RunContainer { public int Id { get; private set; } // ... public int ActiveRunCount { get; private set; } } In the mapping for the RunContainer.ActiveRunCount property, I use the formula specification like so: <property name="ActiveRunCount" formula="(select count(r.Id) from Run r where r.ContainerId = Id and r.Status = 1)"/> My problem is that I refer to the RunStatus enum values in the formula by their respective numeric value, rather than the appropriate symbolic name. Can anyone tell me how can I use the symbolic name instead? Thanks.

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >