I have to set this up so that users can make labels, and track shipments, can someone outline the steps of how this works, including any interaction I need to do in regards to testing and contacting Fedex support, any special keys, gotchas?
Imagine a code:
search = Project.search(
:title_or_description_or_child_name_or_child_age_or_inspiration_or_decorating_style_or_favorite_item_or_others_like_any => keys,
:galleries_id_like_any => @g,
:styles_id_like_any => @st,
:tags_like_any => @t
)
search.all returns the rows correctly.
But search.descend_by_views returns nil.
Is this gem buggy? What else should I use then?
I have created custom attributes for a category in my module's install script like so:
$attrib = array(
'type' => 'varchar',
'group' => 'My Data',
'backend' => '',
'frontend' => '',
'label' => 'My Custom Field',
'input' => 'text',
'class' => '',
'source' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_STORE,
'visible' => true,
'required' => false,
'user_defined' => false,
'default' => '',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => false,
'unique' => true,
);
$installer->addAttribute(3, 'custom_field', $attrib);
The field shows up fine in the admin, and when I create the category in my script like so:
$p_category = Mage::getModel('catalog/category')
->setStoreId(0)
->load(2);
$category = Mage::getModel('catalog/category');
$category->setStoreId(0)
->setName('Test Category')
->setCustomField('abcd')
->setDisplayMode('PRODUCTS')
->setAttributeSetId($category->getDefaultAttributeSetId())
->setIsActive(1)
->setIsAnchor(1)
->setPath(implode('/',$p_category->getPathIds()))
->setInitialSetupFlag(true)
->save();
I can see the value 'abcd' in the Magneto admin interface. But when I call the code below:
<?php
$category = Mage::getModel('catalog/category')->loadByAttribute('custom_field', 'abcd');
print_r($category);
?>
I get no result. But if I loadByAttribute using the 'name' field set to 'Test Category', I DO get a result.
So, in the database, I looked into the catalog_category_entity_varchar table and noticed that the 'name' attribute had an entry for both store_id = 0 AND store_id = 1 whereas the 'custom_field' attribute had only an entry for store_id = 1.
When I added a store_id = 0 entry for 'custom_field' with the value set to 'abcd' in the catalog_category_entity_varchar table, loadByAttribute got the expected result.
My question is, why is the 'name' field getting a store_id = 0 entry in catalog_category_entity_varchar and my custom field is not?
How do I load categories by custom attributes?
I saw one other question on how to do a mass import of products, categories, and all that, but all I want to be able to do is import my categories from one store to another.
When you export products I see that there is still a category ID attribute that it gives the products, but I don't see any options for exporting product categories.
I assume the simplest way would be to just copy over the tables with SQL, but when I export/import through phpMyAdmin it never works....
Any ideas?
Thanks,
Chris
I want to write something of the sort:
//a[not contains(@id, 'xx')]
(meaning all the links that there 'id' attribute doesn't contain the string 'xx')
I can't find the right syntax.
Thanks
I found all the code I need to make SHBrowseForFolder work in my application. But I hate that it forces you to do everything in the little folder window, without a text box to navigate by typing.
In Windows, I know I commonly see a different folder browse dialog that does let me type folder names and use the other regular navigation keys to get around to select the desired folder (backspace, "..", Enter, and so on).
Is there a different API call for that?
Hi,
I need to read a complex model in an ordered way with eclipselink. The order is mandantory because it is a huge database and I want to have an output of a small portion of the database in a jface tableview. Trying to reorder it in the loading/quering thread takes too long and ordering it in the LabelProvider blocks the UI thread too much time, so I thought if Eclipselink could be used that way, that the database will order it, it might give me the performance I need. Unfortunately the object model can not be changed :-(
The model is something like:
@SuppressWarnings("serial")
@Entity
public class Thing implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
private String name;
@OneToMany(cascade=CascadeType.ALL)
@PrivateOwned
private List<Property> properties = new ArrayList<Property>();
...
// getter and setter following here
}
public class Property implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
@OneToOne
private Item item;
private String value;
...
// getter and setter following here
}
public class Item implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
private int id;
private String name;
....
// getter and setter following here
}
// Code end
In the table view the y-axis is more or less created with the query
Query q = em.createQuery("SELECT m FROM Thing m ORDER BY m.name ASC");
using the "name" attribute from the Thing objects as label.
In the table view the x-axis is more or less created with the query
Query q = em.createQuery("SELECT m FROM Item m ORDER BY m.name ASC");
using the "name" attribute from the Item objects as label.
Each cell has the value
Things.getProperties().get[x].getValue()
Unfortunately the list "properties" is not ordered, so the combination of cell value and x-axis column number (x) is not necessarily correct. Therefore I need to order the list "properties" in the same way as I ordered the labeling of the x-axis.
And exactly this is the thing I dont know how it is done. So querying for the Thing objects should return the list "properties" "ORDER BY name ASC" but of the "Item"s objects. My ideas are something like having a query with two JOINs. Joing Things with Property and with Item but somehow I was unable to get it to work yet.
Thank you for your help and your ideas to solve this riddle.
Hi,
I've seen lots on how to do this with an tag, and I have no problem doing it with that one, but I can't seem to retrieve the href attribute of a <link> tag.
Even trying to grab the link tag at all:
alert($("link").length);
Gives 0.
Any ideas?
Thanks,
Matt
In a B- tree you can store both keys and data in the internal/leaf nodes.
But in a B+ tree you have to store the data in the leaf nodes only.
Is there any advantage of doing the above in a B+ tree?
Why not use B- trees instead of B+ trees everywhere?
As intuitively they seem much faster. I mean why do you need
to replicate the key(data) in a B+ tree?
I have the following in my model:
class info(models.Model):
add = models.CharField(max_length=255)
name = models.CharField(max_length=255)
An in the views when i say
info_l = info.objects.filter(id=1)
logging.debug(info_l.name)
i get an error saying name doesnt exist at debug statement.
'QuerySet' object has no attribute 'name'
1.How can this be resolved.
2.Also how to query for only one field instead of selecting all like select name from info.
As per the trouble shooting guide for VS2010 Load Testing (http://social.msdn.microsoft.com/Forums/en/vststest/thread/df043823-ffcf-46a4-9e47-1c4b8854ca13), I'm trying to restrict the range of ports used for client-controller communication.
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\VisualStudio\10.0\EnterpriseTools\QualityTools\ListenPortRange\PortRangeStart
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\VisualStudio\10.0\EnterpriseTools\QualityTools\ListenPortRange\PortRangeEnd
I've set these keys on the client as described but according to netstat the client is still listening on random ports. The controller is attempting to communicate on the same random ports as the client.
Anyone experienced the same?
I'm trying to write a script that, in its process, would need to be able to write an undefined number of nested arrays, and those arrays need to be able to have custom keys.
Essentially, the script is being used to convert an HTML DOM into a multidimensional array. I'm not extremely well versed in recursion, so any pointers would be awesome.
Hi all,
I have googled an example for converting Word to Html.
import win32com from win32com.client import Dispatch, constants
w = win32com.client.Dispatch('Word.Application')
w = win32com.client.DispatchEx('Word.Application')
'''skip some code here'''
wc = win32com.client.constants
w.ActiveDocument.SaveAs( FileName = filenameout, FileFormat = wc.wdFormatHTML )
I tried looking for something like wc.wdFormatPNG as wc.wdFormatHTML in the example but failed.And I wonder does the attribute exist?Or any other better solutions?Suggestions would be appreciated.
I use the classpath attribute in custom Ant tasks to tell Ant where to find the external task jar, but how do I do the same for built-in tasks?
In my case I'd like to make sure ant uses my copy of jsch.jar for the scp task, and not one that my already be installed on the system. Is there any way I can <scp> while guaranteeing it's using my jsch.jar?
Hello, I can't login to github with generated ssh-keys. I've followed this manual: http://help.github.com/linux-key-setup but at step:
ssh [email protected]
I get:
Agent admitted failure to sign using
the key. Permission denied
(publickey).
What's wroing? And, of course, I'm adding my own user email.
I am using urllib2 to interact with a website that sends back multiple Set-Cookie headers. However the response header dictionary only contains one - seems the duplicate keys are overriding each other.
Is there a way to access duplicate headers with urllib2?
Oddly enough, MSDN has no information on the order preserving properties of data structures. So I've been making the assumption that:
Hashtable and Hashset do not preserve the insertion order (aka the "hash" in there is a giveaway)
Dictionary and List DO preserve the insertion order.
from this I extrapolate that if I have a Dictionary<double,double> foo that defines a curve, foo.Keys.ToList() and foo.Values.ToList() will give me an ordered list of the scope and domain of that curve without messing about with it?
I am just learning XML/XSD and am struggling with the implementation of an XML-schema which models a folder structure.
What I had in mind was defining a complexType for the folder which can have additional folder instances that represent subfolders. Using the xsd schema validator here always returns that the schema is invalid.
I tried defining the complexType up front and then using the ref keyword for subfolders:
<xs:complexType name="tFolder">
<xs:sequence>
<xs:element name="Path" type="tFolderType" msdata:Ordinal="0" />
<xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0">
<xs:extension base="xs:string">
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Type" type="tFolderType" />
As for the element itself:
<xs:element name="Folder" type="tFolder" />
The error returned by the validator is:
"Cannot resolve the name 'Folder' to a(n) 'element declaration' component."
and the error occurs at the line
<xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" /\>
Defining the complexType within the element itself yields the exact same error:
<xs:element name="Folder">
<xs:complexType>
<xs:sequence>
<xs:element name="Path" type="tFolderType" msdata:Ordinal="0" />
<xs:element ref="Folder" minOccurs="0" maxOccurs="unbounded" />
<xs:element name="File" nillable="true" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:simpleContent msdata:ColumnName="File_Text" msdata:Ordinal="0">
<xs:extension base="xs:string">
</xs:extension>
</xs:simpleContent>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="Type" type="tFolderType" />
</xs:complexType>
</xs:element>
What I've read, this kind of recursion should work using ref.
Can anyone tell me what I've done wrong? Maybe the xsd validator is just faulty? If so, does anyone know a better alternative? I've tried using the one from w3.org as well, but it seems to be taken offline...
Is it possible to use PHP magic methods (specifically __get()) outside a defined class?
I'm wanting to use it in a configuration file for quick loading. The configuration file has a single array, $config, with many keys. Therefore, I'd like to override __get() to return the key in the array.
Hi,
How can I have multiple properties in my usercontrol that can be databound? For a single property I have found that DefaultBindingProperty Attribute does the trick but I have no idea on how to get databinding with multiple properties.
Recently I found an nice blog post presenting 2 approaches for tracking online users of a web site with the help of Redis.
1) Smart-keys and setting their expiration
http://techno-weenie.net/2010/2/3/where-s-waldo-track-user-locations-with-node-js-and-redis
2) Set-s and intersects
http://www.lukemelia.com/blog/archives/2010/01/17/redis-in-practice-whos-online/
Can you judge which one should be faster and why?
Was just wondering if there was any software out there to do this? The storage engine is InnoDB so the foreign keys are in place to connect the tables up in the diagram (if such software even exists).
A portable thread specific storage reference/identity mechanism, of which boost/thread/tss.hpp is an instance, needs a way to generate a unique keys for itself. This key is unique in the scope of a thread, and is subsequently used to retrieve the object it references. This mechanism is used in code written in a thread neutral manner.
Since boost is a portable example of this concept, how specifically does such a mechanism work ?