Search Results

Search found 16885 results on 676 pages for 'custom headers'.

Page 196/676 | < Previous Page | 192 193 194 195 196 197 198 199 200 201 202 203  | Next Page >

  • Is it possible to route heroku-rails-app to a subdirectory of my custom domain?

    - by ernd enson
    I want to setup a rails app on heroku that is part of a website. The website which is hosted on a different server explains the usage of the app, shows a tour, plans, contains a blog on related stuff and so on. I want to route to my_domain/app and the app should respond to that url. The custom_domain add-on doesnt allow to enter directories. How can I configure that or how would you realize that scenario?

    Read the article

  • how do I create a custom route in rails where I pass the id of an existing Model?

    - by Angela
    I created the following route: map.todo "todo/today", :controller => "todo", :action => "show_date" Originally, the 'show_date' action and associated view would display all the activities associated for that day for all the Campaigns. This ended up being very slow on the database...it would generate roughly 30 records but was still slow. So, I'm thinking of creating a partial that would first list the campaigns separately. If someone clicked on a link associated with campaign_id = 1, I want it to go to the following route: todo/today/campaign/1 Then I would like to know how to know that the '1' is the campaign_id in the controller and then just do its thing. The reason I want a distinct URL is so that I can cache this list. I have to keep going back to this and it's slow. NOTE: It's possibly the problem actually is that I've written the queries in a slow way and sqlite isn't representative of how it will be in production, in which case this work-around is unnecessary, but right now, I need a way to get back to the whole list quickly.

    Read the article

  • C#/DataSet: Create and bind a custom column/property in a DataSet`s DataTable in the XXXDataSet.cs

    - by msfanboy
    Hello, I have a DataSet with a DataTable having the columns Number and Description. I do not want to bind both properties to a BindingSource bound again to 2 controls. What I want is a 3rd column in the DataTable called NumberDescription which is a composition of Number and Description. This property is bound only to 1 control/BindingSource`s property not 2. There is the partial XXXDataSet.Designer.cs file and the partial XXXDataSet.cs file. Of course I have defined the public string NumberDescription {get (doing some checks here;set (doing also some checks here} in the XXXDataSet.cs file. But all this does not bind my new property/Column to the BindingSource the DataTable is bound to because the DataSet does not know the new column/property. To make this new property/column known I could add a new column to the DataTAble in the DataSet designer view naming it NumberDescription. At least I see know the new property in the listing of the BindingSource so I can choose it. But all that did not help?? So how do I do that stuff properly? Should I call the NumberDescription Property in the Number AND Description Property ?

    Read the article

  • Django & custom auth backend (web service) + no database. How to save stuff in session?

    - by Infinity
    I've been searching here and there, and based on this answer I've put together what you see below. It works, but I need to put some stuff in the user's session, right there inside authenticate. How would I store acme_token in the user's session, so that it will get cleared if they logged out? class AcmeUserBackend(object): # Create a User object if not already in the database? create_unknown_user = False def get_user(self, username): return AcmeUser(id=username) def authenticate(self, username=None, password=None): """ Check the username/password and return an AcmeUser. """ acme_token = ask_another_site_about_creds(username, password) if acme_token: return AcmeUser(id=username) return None ################## from django.contrib.auth.models import User class AcmeUser(User): objects = None # we cannot really use this w/o local DB def save(self): """saving to DB disabled""" pass def get_group_permissions(self): """If you don't make your own permissions module, the default also will use the DB. Throw it away""" return [] # likewise with the other permission defs def get_and_delete_messages(self): """Messages are stored in the DB. Darn!""" return []

    Read the article

  • We failed trying database per custom installation. Plan to recover?

    - by Fedyashev Nikita
    There is a web application which is in production mode for 3 years or so by now. Historically, because of different reasons there was made a decision to use database-per customer installation. Now we came across the fact that now deployments are very slow. Should we ever consider moving all the databases back to single one to reduce environment complexity? Or is it too risky idea? The problem I see now is that it's very hard to merge these databases with saving referential integrity(primary keys of different database' tables can not be obviously differentiated). Databases are not that much big, so we don't have much benefits of reduced load by having multiple databases.

    Read the article

  • Grails: No tag library for namespace. Cannot use any plugins with custom taglibs.

    - by user312435
    I can't seem to use any of the grails ui plugins such as richui or grails-ui. I used grails install-plugin to install them, and grails list-plugins shows that they are correctly installed. However, whenever I use their provided taglibs in my views, I get this exception: Tag [tabview] does not exist. No tag library found for namespace: gui or Tag [tabview] does not exist. No tag library found for namespace: richui I'd really like to use these features, but cannot figure out how to get grails to recognize that the tag libraries are installed.

    Read the article

  • Add a custom class name to Wordpress body tag?

    - by Scott B
    I'd like to place a directive in my theme's functions.php file which appends a classname to the wordpress body tag. Is there a built-in API method for this? For example, my body tag code is... <body <?php if(function_exists("body_class") && !is_404()){body_class();} else echo 'class="page default"'?>> And it results in the following being written to the body tag (depending on the context in which the page is presented (page, post, logged-in, etc) <body class="home blog logged-in"> Depending on the child theme I'm using at the time, I want it to be... <body class="home blog logged-in mychildthemename">

    Read the article

  • Custom class deallocated as soon as the app starts.

    - by Tangrs
    Heya, I've added a class object to the nib file. All connections are made. But for some reason, the object is deallocated as soon as it's created. Here's the code: control.h: #import <Foundation/Foundation.h> @interface control : NSObject { IBOutlet UILabel *PlayerScore; } -(IBAction) addPoint: sender; -(void) dealloc; @end control.m: #import "control.h" @implementation control -(IBAction)addPoint: sender { NSLog(@"Ohhai. Didn't crash."); //Doesn't even make it to this stage. int i = [PlayerScore.text intValue]; PlayerScore.text=[NSString stringWithFormat: @"%d",++i]; } -(void) dealloc { NSLog(@"ZOMGWTF?"); [super dealloc]; } @end Here is the console log: [Session started at 2010-06-09 19:47:57 +1000.] 2010-06-09 19:47:58.771 App[91100:207] ZOMGWTF? And after I click the button which messages addPoint, of course, it crashes. 2010-06-09 19:47:59.703 App[91100:207] * -[control] performSelector:withObject:withObject:]: message sent to deallocated instance 0x3843d80 Does anyone have any ideas?

    Read the article

  • Better way to implement custom views in a listview with simpleadapter?

    - by jonaz
    I have a value called tags which is a comma separated list of words. I want to put this into nicely designed "tag-buttons". The below works. However the line ((LinearLayout) view).removeAllViews(); seems like an ugly fix for not adding the tags multiple times every time adapter.notifyDataSetChanged(); is called after i load more rows with a setOnScrollListener() Any suggestion to "best practice" here, or at least a more good looking solution? adapter = new SimpleAdapter(activity,data, R.layout.list_transactions, new String[] {"comment", "amount","date","tags","category"}, new int[] { R.id.comment, R.id.amount,R.id.date,R.id.tags_container,R.id.category } ); SimpleAdapter.ViewBinder binder = new SimpleAdapter.ViewBinder() { @Override public boolean setViewValue(View view, Object object, String value) { //Log.d(TAG,"view.toString()= "+ view.toString()); if (view.getId() == R.id.tags_container) { String[] tags = value.split(","); ((LinearLayout) view).removeAllViews(); for (String tag : tags) { View v = createTagView(activity.getLayoutInflater(),tag); ((LinearLayout) view).addView(v); } return true; } return false; } };

    Read the article

  • In Lua, can I easily select the Nth result without custom functions?

    - by romkyns
    Suppose I am inserting a string into a table as follows: table.insert(tbl, mystring) and that mystring is generated by replacing all occurrences of "a" with "b" in input: mystring = string.gsub(input, "a", "b") The obvious way to combine the two into one statement doesn't work, because gsub returns two results: table.insert(tbl, string.gsub(input, "a", "b")) -- error! -- (second result of gsub is passed into table.insert) which, I suppose, is the price paid for supporting multiple return values. The question is, is there a standard, built-in way to select just the first return value? When I found select I thought that was exactly what it did, but alas, it actually selects all results from N onwards, and so doesn't help in this scenario. Now I know I can define my own select as follows: function select1(n, ...) return arg[n] end table.insert(tbl, select1(1, string.gsub(input, "a", "b"))) but this doesn't look right, since I'd expect a built-in way of doing this. So, am I missing some built-in construct? If not, do Lua developers tend to use a separate variable to extract the correct argument or write their own select1 functions?

    Read the article

  • How does the CLR (.NET) internally allocate and pass around custom value types (structs)?

    - by stakx
    Question: Do all CLR value types, including user-defined structs, live on the evaluation stack exclusively, meaning that they will never need to be reclaimed by the garbage-collector, or are there cases where they are garbage-collected? Background: I have previously asked a question on SO about the impact that a fluent interface has on the runtime performance of a .NET application. I was particuarly worried that creating a large number of very short-lived temporary objects would negatively affect runtime performance through more frequent garbage-collection. Now it has occured to me that if I declared those temporary objects' types as struct (ie. as user-defined value types) instead of class, the garbage collector might not be involved at all if it turns out that all value types live exclusively on the evaluation stack. What I've found out so far: I did a brief experiment to see what the differences are in the CIL generated for user-defined value types and reference types. This is my C# code: struct SomeValueType { public int X; } class SomeReferenceType { public int X; } . . static void TryValueType(SomeValueType vt) { ... } static void TryReferenceType(SomeReferenceType rt) { ... } . . var vt = new SomeValueType { X = 1 }; var rt = new SomeReferenceType { X = 2 }; TryValueType(vt); TryReferenceType(rt); And this is the CIL generated for the last four lines of code: .locals init ( [0] valuetype SomeValueType vt, [1] class SomeReferenceType rt, [2] valuetype SomeValueType <>g__initLocal0, // [3] class SomeReferenceType <>g__initLocal1, // why are these generated? [4] valuetype SomeValueType CS$0$0000 // ) L_0000: ldloca.s CS$0$0000 L_0002: initobj SomeValueType // no newobj required, instance already allocated L_0008: ldloc.s CS$0$0000 L_000a: stloc.2 L_000b: ldloca.s <>g__initLocal0 L_000d: ldc.i4.1 L_000e: stfld int32 SomeValueType::X L_0013: ldloc.2 L_0014: stloc.0 L_0015: newobj instance void SomeReferenceType::.ctor() L_001a: stloc.3 L_001b: ldloc.3 L_001c: ldc.i4.2 L_001d: stfld int32 SomeReferenceType::X L_0022: ldloc.3 L_0023: stloc.1 L_0024: ldloc.0 L_0025: call void Program::TryValueType(valuetype SomeValueType) L_002a: ldloc.1 L_002b: call void Program::TryReferenceType(class SomeReferenceType) What I cannot figure out from this code is this: Where are all those local variables mentioned in the .locals block allocated? How are they allocated? How are they freed? Why are so many anonymous local variables needed and copied to-and-fro only to initialize my two local variables rt and vt?

    Read the article

  • Why can't I register a custom model binder for a List<int>?

    - by quarksoup
    I have an action that looks like public ActionResult GetUsers(List<int> userIds) {//do stuff} The list of userIds can become quite long, so I want to use Json.Net to deserialize it. To do so I created an IModelBinder implementation, which works fine for other objects, but never gets called for a List. The IModelBind looks like this public class JsonBinder : System.Web.Mvc.IModelBinder { public object BindModel(System.Web.Mvc.ControllerContext controllerContext, System.Web.Mvc.ModelBindingContext bindingContext) { //Do model binding stuff using Json.Net } } And I register this model binder with this line ModelBinders.Binders.Add(typeof(List<int>), new JsonBinder()); However the JsonBinder is never called. Why is this? Should I be using a ValueProvider?

    Read the article

  • What's the easiest way to create an extensible custom container in Flex?

    - by Chris R
    I want to create an MXML container component that has some of its own chrome -- a standard query display, et al -- and that supports the addition of child components to it. Something a lot like the existing mx:Panel class, which includes a title label, but acts like a plain mx:Box with regards to adding children. What's the easiest way to do this? Edit: To be clear, I want to be able to extend the container using MXML, so the "Multiple visual children" problem is relevant.

    Read the article

  • How to correctly migrate urls from custom asp.net solution to Wordpress?

    - by Marek
    I have a web site built using asp.net with ugly URLs like /DisplayContent.aspx?id=789564. I know how to migrate the database, but the Wordpress urls will be (naturally) different. Can I simply write some mapping or do I have to include a rewrite rule for each subpage (300 pages) in .htaccess? Should I provide a rewrite rule for each existing page that would transform a full old url to the known new url, like for example: /DisplayContent.aspx?id=789798 -> /2010-5-10/Title-Of-The-Post Even if I manage to migrate the URLs, the structure of the HTML for the new content will naturally be different. How does this affect SEO? Should I run asp.net and wordpress side by side and issue the redirects from the asp.net application? What is the most efficient solution to this kind of migration of URLs without doing PHP programming?

    Read the article

  • How to define custom exception class in Java, the easiest way?

    - by yegor256
    I'm trying to define my own exception class the easiest way, and this is what I'm getting: public class MyException extends Exception {} public class Foo { public bar() throws MyException { throw new MyException("try again please"); } } This is what Java compiler says: cannot find symbol: constructor MyException(java.lang.String) I had a feeling that this constructor has to be inherited from java.lang.Exception, isn't it?

    Read the article

  • Why does the Win32-API have so many custom types?

    - by sub
    I'm new to the Win32 API and the many new types begin to confuse me. Some functions take 1-2 ints and 3 UINTS as arguments. Why can't they just use ints? What are UINTS? Then, there are those other types: DWORD LPCWSTR LPBOOL Again, I think the "primitive" C types would be enough - why introduce 100 new types? This one was a pain: WCHAR* I had to iterate through it and push_back every character to an std::string as there wasn't another way to convert it to one. Horrible. Why WCHAR? Why reinvent the wheel? They could have just used char* instead, or?

    Read the article

  • How to use Jquery UI in my Custom Function? (Autocomplete)

    - by bakazero
    I want to create a function to simplify configuration of jQuery UI AutoComplete. Here is my function code: (function($) { $.fn.myAutocomplete = function() { var cache = {}; var dataUrl = args.dataUrl; var dataSend = args.dataItem; $.autocomplete({ source: function(request, response) { if (cache.term == request.term && cache.content) { response(cache.content); } if (new RegExp(cache.term).test(request.term) && cache.content && cache.content.length < 13) { var matcher = new RegExp($.ui.autocomplete.escapeRegex(request.term), "i"); response($.grep(cache.content, function(value) { return matcher.test(value.value) })); } $.ajax({ url: dataUrl, dataType: "json", type: "POST", data: dataSend, success: function(data) { cache.term = request.term; cache.content = data; response(data); } }); }, minLength: 2, }); } }) (jQuery); but when I'm using this function like: $("input#tag").myAutocomplete({ dataUrl: "/auto_complete/tag", dataSend: { term: request.term, category: $("input#category").val() } }); It's give me an error: Uncaught ReferenceError: request is not defined

    Read the article

  • How to use custom front at SimpleCursorAdapter for a list view at Searchable Dictionary App??? please help me

    - by user1877275
    I am new in android. this is my frist project.I am tring to make a Name dictionary in bangla so i need to change the front. I already add front into the asset folder.. private void showResults(String query) { Cursor cursor = managedQuery(DictionaryProvider.CONTENT_URI, null, null, new String[] {query}, null); if (cursor == null) { // There are no results mTextView.setText(getString(R.string.no_results, new Object[] {query})); } else { // Display the number of results int count = cursor.getCount(); String countString = getResources().getQuantityString(R.plurals.search_results,count, new Object[] {count, query}); mTextView.setText(countString); // Specify the columns we want to display in the result String[] from = new String[] { DictionaryDatabase.KEY_WORD, DictionaryDatabase.KEY_DEFINITION }; // Specify the corresponding layout elements where we want the columns to go int[] to = new int[] { R.id.word, R.id.definition }; // Create a simple cursor adapter for the definitions and apply them to the ListView SimpleCursorAdapter words = new SimpleCursorAdapter(this, R.layout.result, cursor, from, to); mListView.getAdapter(); // Define the on-click listener for the list items mListView.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView<?> parent, View view, int position, long id) { // Build the Intent used to open WordActivity with a specific word Uri Intent wordIntent = new Intent(getApplicationContext(), WordActivity.class); Uri data = Uri.withAppendedPath(DictionaryProvider.CONTENT_URI, String.valueOf(id)); wordIntent.setData(data); startActivity(wordIntent); } }); } }

    Read the article

< Previous Page | 192 193 194 195 196 197 198 199 200 201 202 203  | Next Page >