w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How to use GeoDjango with Haystack?
I'm using a very similar setup (Django 1.5.4, Haystack 2.0.0, Elasticsearch 0.90.0) and this is what I've got: from haystack.utils.geo import D, Point from haystack.views import SearchView class MySearchView(SearchView): results = super(MySearchView, self).get_results() ... lng = -112.0739 lat = 33.4492 center = Point(lng, lat) radius = D(mi=50) results = results.dwithin('geo_point', center, radius) ... return results An important thing to keep in mind as well is the backend. According to the Haystack backend support matrix (http://django-haystack.readthedocs.org/en/latest/backend_support.html#backend-support-matrix) only Solr and Elasticsearch support spatial data.

Categories : Django

GeoDjango GEOSException error
This is my solution (obviously it is ugly, like my English, but works). The problem is that the versions string has an white space unwanted in the RegEx. The error says: GEOSException: Could not parse version info string "3.4.2-CAPI-1.8.2 r3921" And the geos_version_info warns: Regular expression should be able to parse version strings such as '3.0.0rc4-CAPI-1.3.3', '3.0.0-CAPI-1.4.1' or '3.4.0dev-CAPI-1.8.0' Edit this file: site-packages/django/contrib/gis/geos/libgeos.py Look for the function: geos_version_info And change this line: ver = geos_version().decode() With this line: ver = geos_version().decode().split(' ')[0]

Categories : Python

Display PointFields in GeoDjango interface
My guess is that you switched the latitude and the longitude. Looking at the coordinates you gave, I assume that you wanted the latitude to be 43.620416, and the longitude to be 7.065491, so that the point would be in France. However, according to the doc, GeoDjango expects the first value to be the longitude, and the second one the latitude. Switching these two coordinates may have caused GeoDjqngo to get lost with the values you gave. (4856153.76879, 788079.64711) may then be some internal representation of the point you gave.

Categories : Python

geodjango admin : An error occurred when transforming the geometry to the SRID of the geometry
Proj4 and Geos Lib was not properly installed ! It's simplier when you just do that : sudo apt-get install binutils libproj-dev gdal-bin As the official doc said before this line : "On Debian/Ubuntu, you are advised to install the following packages which will install, directly or by dependency, the required geospatial libraries:" Then you're sure everything is correctly installed Source : lien

Categories : Django

Trouble implementing a custom list into custom array list into custom array adapter all from jsoup
The problem is in the onPostExecute() method of your AsyncTask. mTeachers = new ArrayList<Teacher>(); mTeachers.add(new Teacher(Splash.mNames, Splash.mEmails, Splash.mPictures)); Here, you initialize the mTeachers list, but only add one Teacher object. I am not sure what Splash.mNames, Splash.mEmails and Splash.mPictures are. Now, in your adapter's getView() method, Teacher teacher = mTeacher.get(position); works for position zero. Since the size of mTeachers is one, only one item is displayed in your listview. Edit 1: Let's make some changes to your Adapter. Add the following above Typeface thin;: private ArrayList<String> mNames; private ArrayList<String> mEmails; private ArrayList<String> mPictures; Next, change the constructor from: public

Categories : Android

move the custom scroll by using mouse scrolling event in jQuery Custom Scrollbar
There does not seem to be an option to configure this in the library. But assuming that your container has no vertical scrollbar you could extend hack the plugin by altering the order in which the mouse wheel delta is supplied to the various functions. In the source, you could change args.unshift(event, delta, deltaX, deltaY); to args.unshift(event, delta, deltaY, deltaX); You could also create an issue on github asking for this functionality to be added, or make a pull request yourself :-)

Categories : Jquery

Get Custom field value from Custom Post Types with a Parent Child Relationship in Wordpress
I hope I understood your question correctly First we need to call the Hotel Query. Then display its image and custom meta. Then within the hotel query - display the room post and meta. <?php $parent = array( 'post_type' => 'hotel', 'post_parent' => 0, 'order' => 'DESC', 'orderby' => 'date'); $hotelparent = new WP_Query($parent); if ( $hotelparent->have_posts() ) : while ($hotelparent->have_posts()) : $hotelparent->the_post();?> <article> <header> <figure><img width="300" height="160" alt="Placeholder" src="<?php echo get_post_meta($hotelparent->ID,'wpcf-image',true);?>"><div class="fit-a"></div></figure> <h3><a href="<?php the_permalink(); ?>"><?php the_title();?></a></h3> &l

Categories : PHP

Show Custom Meta Field Linked to Custom Taxonomy on Front End
You will need: The post ID of the researcher. On the single-researcher.php page (if your post type is named researcher) you should be able to use $post->ID to obtain the post ID of the researcher. The name of the taxonomy. This can be obtained by reading the URL of the screenshot you posted previously. It should say: ...edit-tags.php?taxonomy=supervisors&.... I'll assume the taxonomy is named supervisors. If you're on the single-researcher.php page, this might work... Note: $supervisor_tags is an array of tags for that researcher. Each researcher could have 0, 1, or more supervisors, so you might want to loop through them: global $post; $supervisor_tags = get_the_terms($post->ID, 'supervisors'); echo "<h2>Supervisors:</h2>"; foreach ($supervisor_tags as $tag)

Categories : PHP

Custom Prototype Cell designed in Storyboard with Custom View Controller
I've definitely seen this issue before and I believe it is because imageView and textLabel are properties of UITableViewCell and the default implementation of layoutSubviews is overriding your storyboard's layout with UITableViewCell's defaults. Try overriding layoutSubviews, or provide your own image and label properties (named differently from UITableViewCell's, ie: myImageView and myTextLabel).

Categories : IOS

filter custom columns(having values from custom methods in model) in CGridView
Try this: In Model: class Plans extends BasePlans { ... public $planTypeSearch; ... public function search() { ... $criteria->compare('plan.plan_type', $this->planTypeSearch, true); ... ), return new CActiveDataProvider($this, array( 'criteria' => $criteria, 'sort'=>array( 'attributes'=>array( 'planTypeSearch'=>array( 'asc'=>'plan.plan_type', 'desc'=>'plan.plan_type DESC', ), ), ), ); In your view: array( 'name'=>'planTypeSearch', 'header'=> 'Plan Type', 'value'=>'(isset($data->plan)) ? $data->plan->plan_type: null', 'filter'=>isset($plans) ? CHtml::listData($plans, 'plan_type','plan_type') : NULL, ),

Categories : PHP

Django Haystack custom form custom attribute returns no results
super(MySearchForm, self).search() performs an auto_query() with a default field name of content... As you haven't defined a field like this it will not return any results... Therefore I wouldn't do the super call, but replace with an implementation similar to the original one - but pass a fieldname to auto_query: auto_query(querystring, fieldname='text'). Also make sure to have the template defined correctly if you are searching in it. (If you are chaining multiple filter() calls they will be combined usind and). Also depending on the search engine you use it will probably offer you a frontend where you can check independently from haystack if the data is indexed properly...

Categories : Python

Custom Textview with Html text and Custom Font whole Android application
Have you consideret to use SpannbleString? How can i use TypefaceSpan or StyleSpan with custom Typeface? Here is different spans that you can apply on SpannableString. public void setSpan(){ Spannable spantext = new SpannableString("My application"); spantext.setSpan(new StyleSpan(Typeface.BOLD), 3//Start of span, 6//End of span, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); Typeface HelveticaNeueBoldItalic = Typeface.createFromAsset(getActivity().getAssets(), "fonts/HelveticaNeueBoldItalic.ttf"); spantext.setSpan(new CustomTypefaceSpan("", HelveticaNeueBoldItalic ), 0, text.lenght(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); TextView text; text.setText(spantext); } public class CustomTypefaceSpan extends TypefaceSpan { private final Typeface newType;

Categories : Android

Custom Qt designer widget : a scroll Area containing a custom vertical layout
Qt 4 does not support custom layout plugins for designer, so I couldn't achieve what I wanted to do. I will instead use a Vertical Layout and try to implement the additional features that were supposed to be in the custom layout code in the widget code.

Categories : Qt

How do I get data out of a custom function inside a custom binding handler into the viewmodel?
$root or $parent psuedo variables are only available from within the context of data-binding. However, you could pass those values into your custom binding with something like this: //in your view data-bind="groupTree: {rootVm: $root}" //in your binding init: function (element, valueAccessor, allBindingsAccessor, viewModel) { var settings = valueAccessor(); var rootVm = settings.rootVm; //...

Categories : Knockout Js

WP_Query - multiple custom post types and sort by custom meta
use orderby instead of order_by $warsztaty_q = new WP_Query(array( 'post_type' => array('kalendarium', 'warsztaty'), 'orderby' => 'meta_value', 'meta_key' => 'data_start', 'order' => 'ASC' )); refer codex for more details

Categories : Wordpress

Android Maps V2: Custom info window at custom position or work around?
You can place a normal View (or some ViewGroup in this case) on top of the map and move camera, so that Marker is placed where it looks like is pointed to by this View. No native (using Google Maps Android API v2) way currently, but you may track this gmaps-api-issue for when it will be possible.

Categories : Android

How to set custom font in android custom soft keyboard irrespective of any application
To embed a custom font into your app, you need to create an "assets/fonts" folder and copy your TTF file there. If you have sub class of TextView then you can directly call this piece of code from its costructor, Typeface font = Typeface.createFromAsset(this.getContext().getAssets(), "fonts/mycustomfont.ttf"); setTypeface(font); Otherwise, If you want to use TTF without making sub-class then you can follow these steps in Activity class. Typeface font = Typeface.createFromAsset(this.getContext().getAssets(), "fonts/mycustomfont.ttf"); TextView tv = (TextView)findViewById(res); tv.setTypeface(font); For more details follow this link.

Categories : Android

Add custom taxonomies as class names to an archive page of custom post types, wordpress
wordpress has a clean way of outputting the class name for a post item - using post_class so in your case first set the div to <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>...</div> and to add the taxonomy name to the class you have to add a filter. So in your functions.php drop this in (change YOUR_TAXO_NAME to the name of your custom taxonomy): (taken from here) add_filter( 'post_class', 'custom_taxonomy_post_class', 10, 3 ); if( !function_exists( 'custom_taxonomy_post_class' ) ) { function custom_taxonomy_post_class( $classes, $class, $ID ) { $taxonomy = 'YOUR_TAXO_NAME'; $terms = get_the_terms( (int) $ID, $taxonomy ); if( !empty( $terms ) ) { foreach( (array) $terms as $order =

Categories : PHP

Facebook Javascript SDK open-graph: error adding custom objects for custom stories
The object is a JSON-encoded version of an object, the sample code generated for you was incorrect. Also remove type from the parameter list. So something like, FB.api( 'me/objects/[namespace]:opinion', 'post', { object: {"app_id":xxx,"url":"http://samples.ogp.me/331257847005141","title":""Sample Opinion"","image":"https://s-static.ak.fbcdn.net/images/devsite/attachment_blank.png","description":""""} }, function(response) { // handle the response } ); An example of how it looks can be seen at http://philippeharewood.com/facebook/objectify.html and it was based off the curl example given at https://developers.facebook.com/docs/opengraph/using-object-api/

Categories : Javascript

Displaying only custom post types that's custom date fields values are either today or in the future
You should use meta_query custom field parameters. $args = array( 'post_type' => 'events', 'posts_per_page' => '3', 'orderby' => 'meta_value', 'order' => 'ASC', 'meta_query' => array( array( 'key' => 'event_date', 'value' => date( YOUR-FORMAT-HERE ), 'compare' => '>=' ) ) ); $query = new WP_Query( $args ); Hope it helps!

Categories : PHP

different ways of creating custom views / custom view not able to be interacted with when created from object library
It looks like you're loading testview from inside the testview class initialiser with a hacky check for subviews to prevent it from becoming recursive. Since the code outside probably also loads the nib, what you're actually doing here is loading the nib twice, once inside the other. If you set up the owner then the inner one will be setting the outlets on the outer one. It's just a guess as there is not enough information here to know for sure - but if you are setting outlets in your view class for some of the sub-views within it then you must supply an owner object to loadNibNamed:owner:options: with the type of your class. So you could pass self as owner in your code and this might work. However it's really the wrong way to use nibs for single-views. Instead of having the single view

Categories : IOS

Transfer All Custom Field Data From Custom Post Type to User Accounts - Wordpress
Take a look to the excellent Posts 2 Posts plugin. In the official Wiki you can find a specific topic that seems to fit your needs: it's called Posts 2 Users. I hope this will be helpful for you.

Categories : Mysql

Change WORDPRESS permalinks Structure to use Custom Field Values Dynamically for Custom Post Types
The fastest and easiest way with almost 0 coding to do this is to stop using Custom Fields, and set all those fields as Taxonomies Categories, hierarchical categories in which geocraft_state would have geocraft_city as children, and using the permalink structure as /%category%/%postname%/ More about taxonomies here: http://codex.wordpress.org/Taxonomies

Categories : PHP

Deserializing a Custom Object with GSON error Failed to invoke public custom class with no args
The Cell class you linked to is an Abstract class. You cannot instantiate an abstract class. Either make Cell a concrete class or provide a concrete implementation of Cell.

Categories : Java

How to pass an object of custom class containing a custom list to a web service?
If your web service is a WCF one and you created a proxy for it by adding a web reference you should be able to change it by editing the refernce in Visual Studio. Right Click on it and select "Configure Service Reference" then choose a Collection type of List.

Categories : C#

Custom Filter and LimitTo options with Custom ng-repeat directive
Yes, you can use filters inside your linking function: myApp.directive('myRepeater', function(filterFilter, limitToFilter) { return { restrict: 'A', link: function(scope, element, attrs) { var myTemplate = "<div>{{rating}}</div>"; var filteredItems = filterFilter(scope.items, scope.SearchText); var limitedItems = limitToFilter(filteredItems, 5); angular.forEach(limitedItems, function(item){ var text = myTemplate.replace("{{rating}}",item.rating); element.append(text); }); } }; }); Then, you would continue from there by creating $watchers to observe the changes on scope.SearchText and scope.NumberOfItems to update the list accordingly.

Categories : Javascript

Adding Grid Serializer of a custom module into a custom product tab
you need to add new tab to Tabs block 'Namespace/Module/Block/Adminhtml/Form/Edit/Tabs.php': $product_content = $this->getLayout()->createBlock('module/adminhtml_form_edit_tab_product', 'adminform_products.grid')->toHtml(); $serialize_block = $this->getLayout()->createBlock('adminhtml/widget_grid_serializer'); $serialize_block->initSerializerBlock('adminform_products.grid', 'getSelectedProducts', 'products', 'selected_products'); $serialize_block->addColumnInputName('position'); $product_content .= $serialize_block->toHtml(); $this->addTab('associated_products', array( 'label' => Mage::helper('module')->__('Products'), 'title' => Mage::helper('module')->__('Products'), 'content' => $product_content )); The serializer is most important feature wh

Categories : Magento

Showing custom static block on the custom page Magento
Override catalog.xml in you local module Add in in content reference in you catalog/category/voew.phtml add this code $_current_category=$this->getCurrentCategory(); if(cond == '1st category') { echo $this->getChildHtml('block1'); } Similarly for other blocks

Categories : Magento

Building a custom field type: How do I render a custom attribute?
I found the solution for this. It turns out FieldViewModel has an AdditionalSettings attribute which is of type List<FieldSettingViewModel> which consists of a string Key and Value To get my above example to work, I can use the following: @model Umbraco.Forms.Mvc.Models.FieldViewModel @{ var widthSetting = Model.AdditionalSettings.FirstOrDefault(s => s.Key.Equals("Width")); string width = (widthSetting == null) ? null : widthSetting.Value; } <input type="text" name="@Model.Name" id="@Model.Id" class="text" value="@Model.Value" maxlength="500" style="@{if(!string.IsNullOrEmpty(width)){<text>width:@(width)px; </text>}}" @{if(Model.Mandatory || Model.Validate){<text>data-val="true"</text>}} @{if (Model.Mandatory) {<text> data-

Categories : C#

Custom sorting DevExpress PivotGrid for a column whose PivotGroupInterval is custom
I've figured out the answer myself protected void Page_Load(object sender, EventArgs e) { pivotGrid.RetrieveFields(); pivotGrid.Fields["YEAR"].Area = PivotArea.ColumnArea; pivotGrid.Fields["YEAR"].GroupInterval = PivotGroupInterval.DateYear; pivotGrid.Fields["MONTH"].Area = PivotArea.ColumnArea; pivotGrid.Fields["MONTH"].GroupInterval = PivotGroupInterval.Custom; pivotGrid.Fields["MONTH"].SortMode = PivotSortMode.Custom; } private void pivotGrid_CustomGroupInterval(object sender, PivotCustomGroupIntervalEventArgs e) { e.GroupValue = ((DateTime)e.Value).ToString("MMM"); } private void pivotGrid_CustomFieldSort(object sender, PivotGridCustomFieldSortEventArgs e) { if (e.Field.FieldName == "MONTH") {

Categories : C#

custom delegate ios respondsToSelector not working custom table cell
Edit the code in PositionViewController.m as below. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { // Other code to draw the cell cell.delegate = self; return cell; }

Categories : Iphone

wpf: setting of ItemsContainerStyle rewrites all custom style of custom TreeViewControl
You can just Base it on whatever existing style you want and only modify the stuff necessary for the instance like you're doing using the Style BasedOn Property like; <Style TargetType="TreeViewItem" BasedOn="{StaticResource YourExistingStyleYouWantToBaseItOn}"> <Setter Property="Background" Value="Red"/> </Style> Hope this Helps.

Categories : Wpf

Custom sort Criterion HQL query for a custom part with no ContentPartRecord
I could figure out the answer myself finally with the help of this [question]:Join Non ContentPart Table to ContentPart Table Using Orchard HQL API. Here is the final code for ApplyFilter method. public void ApplyFilter(SortCriterionContext context) { bool ascending = false; if (context.State.SortAsc != null) { var _SortAsc = _tokenizer.Replace( context.State.SortAsc, null, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode }); if (!string.IsNullOrWhiteSpace(_SortAsc)) ascending = Convert.ToBoolean(_SortAsc); } System.Collections.IDictionary dictionary = new Dictionary<string, string>(); if (context.State.SortBy != null) { var _SortBy = _tokenizer.Replace(

Categories : C#

wordpress adding custom columns to custom post type
$columns that is being passed to your function my_edit_product_columns is an array of all of the existing columns. You can replace the entire thing or use any standard array manipulation to change the columns & column order. For example, if you wanted to specify the columns you would do something like (taken from an events custom post type I use): $columns = array( "cb" => "<input type="checkbox" />", "title" => "Event Name", "event_date" => "Date", "start_time"=>"Time", ); So if you simply print_r($columns) to see what it currently has, you could manually reorder it. To insert your column at a specific position in the existing $columns array use: # Insert at offset 2 $offset

Categories : PHP

Facebook open graph custom stories and custom objects with js sdk
I think you are using football as a wrong way of specifying your story. You are using name of the instance instead of class. Let me explain. Following are the two scenarios I could come up with: Your app is about games that users play. So in this case your object becomes game and football will be the name of the game. So now your story reads like: "A played football with B and C via your_app" since you will be providing the name property of the game object, facebook will select the right story sentence for you Your app is about sports products, in which case your object becomes sport_product or product and football will be an instance of sport product. But in this case an action of play does not make any sense. So lets say buy is an action. So now your story reads like: "A bought foot

Categories : Facebook

Custom UIButton disappears when linked as IBOutlet in custom UITableViewCell
Did you set the UITableView delegate and dataSource in your XIB file and the protocols in the header file? @interface MerchantListController : UITableViewController <UITableViewDelegate, UITableViewDataSource> Also did you set the cell identifier? You also need to set the delegate methods of UITableView - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.merchantList count]; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { NSString *cellIdentifier = @"MerchantListCell"; MerchantListCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; if (

Categories : IOS

Associating a custom post type with a custom (user) taxonomy
$pagename = get_the_title(); $user_query= new WP_User_Query( array( 'meta_key' => 'tm-name', 'meta_value'=>$pagename )); if ( ! empty( $user_query->results ) ) { foreach ( $user_query->results as $user ) { echo '<p>' . $user->display_name . '</p>'; } } else { echo 'No users found.'; } ?>

Categories : Wordpress

How to create Android custom keyboard OR write custom Dictionary
Refer this link, http://www.fampennings.nl/maarten/android/09keyboard/index.htm. Hope this will help you

Categories : Java

pass in a layout resource using custom attributes for a custom view
try to place your layout in master layout file: <ShowcaseView ...> <include .../> </ShowcaseView> of course you can also add children directly instead of include tag: <ShowcaseView ...> <Button .../> ... <Button .../> </ShowcaseView>

Categories : Android

Android - Executing a custom listview in a custom dialog properly
Are you doing the following? You will need to inflate the layout file dialog_main, find the ListView, set an adapter and an OnItemClickListener for it. After this, you can use the dialog's setContentView(View) method to get the list to display. private void showDialog(){ final Dialog dialog = new Dialog(this); View view = getLayoutInflater().inflate(R.layout.dialog_main, null); ListView lv = (ListView) view.findViewById(R.id.custom_list); // Change MyActivity.this and myListOfItems to your own values CustomListAdapterDialog clad = new CustomListAdapterDialog(MyActivity.this, myListOfItems); lv.setAdapter(clad); lv.setOnItemClickListener(........); dialog.setContentView(view); dialog.show(); } By the way, your adapter looks alright. It isn't w

Categories : Android



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.