text:
Q: How to call the Magento API from VB.NET Magento has an API and it seems some people are using it via VB.NET but I cannot get it to work after trying for many hours.
I'm on Magento 1.7.0.2
Trying to get a VB.NET app working with the API.
I'm using the WS-I compliant web service setting.

Error 1 Custom tool error: Unable to import WebService/Schema. Unable to import binding 'Mage_Api_Model_Server_Wsi_HandlerBinding' from namespace 'urn:Magento'. The operation 'catalogProductAttributeRemove' on portType 'Mage_Api_Model_Server_Wsi_HandlerPortType' from namespace 'urn:Magento' had the following syntax error:  The operation has no matching binding. Check if the operation, input and output names in the Binding section match with the corresponding names in the PortType section.  d:\Documents\Visual Studio 2010\Projects\Mage\Mage\My Project\Settings.settings 1 1 Mage

if I try to add it as a Service Reference (instead of a Web Reference) I get a different set of errors.
Cannot import wsdl:binding
Cannot import wsdl:port
Cannot import wsdl:portType

Error 5 Custom tool error: Failed to generate code for the service reference 'ServiceReference1'.  Please check other error and warning messages for details.  d:\Documents\Visual Studio 2010\Projects\Mage\Mage\Service References\ServiceReference1\Reference.svcmap 1 1 Mage
Warning 3 Custom tool warning: Cannot import wsdl:binding
  Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on.
  XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='urn:Magento']/wsdl:portType[@name='Mage_Api_Model_Server_Wsi_HandlerPortType']
  XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:Magento']/wsdl:binding[@name='Mage_Api_Model_Server_Wsi_HandlerBinding'] d:\Documents\Visual Studio 2010\Projects\Mage\Mage\Service References\ServiceReference1\Reference.svcmap 1 1 Mage
Warning 4 Custom tool warning: Cannot import wsdl:port
  Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
  XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='urn:Magento']/wsdl:binding[@name='Mage_Api_Model_Server_Wsi_HandlerBinding']
  XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:Magento']/wsdl:service[@name='MagentoService']/wsdl:port[@name='Mage_Api_Model_Server_Wsi_HandlerPort'] d:\Documents\Visual Studio 2010\Projects\Mage\Mage\Service References\ServiceReference1\Reference.svcmap 1 1 Mage
Warning 2 Custom tool warning: Cannot import wsdl:portType
  Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.XmlSerializerMessageContractImporter
  Error: Element message named catalogProductAttributeRemoveRequest from namespace urn:Magento is missing.
  XPath to Error Source: //wsdl:definitions[@targetNamespace='urn:Magento']/wsdl:portType[@name='Mage_Api_Model_Server_Wsi_HandlerPortType'] d:\Documents\Visual Studio 2010\Projects\Mage\Mage\Service References\ServiceReference1\Reference.svcmap 1 1 Mage

Can someone give me very explicit instruction/code on how to make a call and get a result? I can't even seem to get the initial configuration correct. I've downloaded some code others have provided online, but if doesn't work--probably because it was for a earlier version.

A: Function getHTTPStream() As String
    Dim myh As HttpWebRequest = _
    HttpWebRequest.Create("http://yourmagentoweb/soap/api/?wsdl")
    myh.Timeout = 30000
    myh.UserAgent = "Test"
    Dim myR As HttpWebResponse = myh.GetResponse()
    Dim myEnc As Encoding = Encoding.GetEncoding(1252)
    Dim mySr As StreamReader = New StreamReader(myR.GetResponseStream(), myEnc)

    Return mySr.ReadToEnd()
End Function

That code needs tweaking obviously- i have not got time to prettify this stuff

from Abid Hussain's link
1. Using wdsl tool I created a .vb source file by calling:

wsdl /language:VB /out:MageProxyClass.vb http:///api/v2_soap?wsdl

2. Afterwards I used the VB Comand Line Editor to compile the sourcefile into a dll.

vbc /out:MageProxyClass.dll /t:library
  /r:System.XML.dll,System.Web.Services.dll MageProxyClass.vb

3. Finally I was able to create an instance of MagentoService class defined in my MageProxyClass.dll
Private WithEvents msvc As New MagentoService()

4. Example:
 Public Class main
    Private WithEvents msvc As New MagentoService()
    Private ssid As String
    Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ListBox1.Items.Clear()
        ListBox1.Items.Add("Trying to connect")
        msvc.loginAsync("xxxx", "xxxxxxxxxxxxxxxx")
    End Sub

    Public Sub MageLoginComplete(ByVal sender As System.Object, ByVal e As loginCompletedEventArgs) Handles msvc.loginCompleted
        ListBox1.Items.Add("Login completed")
        ssid = e.Result
        ListBox1.Items.Add(String.Concat("Session ID: ", ssid))
    End Sub
End Class

A: Finally got this working.
Add your webservice as usual (it will fail to compile but add it anyway)
Open Magento.wsdl (or whatever your VS has called the wsdl file in your web reference) and remove the call to catalogProductAttributeRemove completely.
 <!--wsdl:operation name="catalogProductAttributeRemove">
    <wsdl:documentation>Delete attribute</wsdl:documentation>
    <wsdl:input message="typens:catalogProductAttributeRemoveRequest" />
    <wsdl:output message="typens:catalogProductAttributeRemoveResponse" />
</wsdl:operation-->

Fire up the Visual Studio Command Prompt and navigate to your project, then the "Web References"
Type:
wsdl /language:VB /out:Reference.vb Magento.wsdl /namespace:com.yourwebservicename.www
This will correctly generate the reference.vb file you need to continue.

A: You may want to give this example a try

*

*http://www.dhmedia.com.au/blog/improved-net-soap-example
Also a more detailed C# library for Magento can be found here:

*

*http://code.google.com/p/csharlibformagexmlrpcapi/


text:
Q: How to make Screen Background Data visible in swift? I want to make the screen like the following.

In source class, I write this code and push to side menu controller.
let vc = self.storyboard?.instantiateViewController(withIdentifier: "SidemenuController")as! SidemenuController

self.navigationController?.pushViewController(vc, animated: false)

I write the following code in destination controller view did load method but just color opacity is decreased data is not visible.
override func viewDidLoad() {
    self.view.backgroundColor = self.hexStringToUIColor(hex: "BE8790").withAlphaComponent(0.4)
}

A: Instead of using .withAlphaComponent(0.4)
Try this  Adjust the number as needed
self.view.alpha = 0.5

A: You show present your SideViewController. Maybe custom how it shows
 let sideVC = // Your init
 sideVC.modalPresentationStyle = .fullScreen
 present(sideVC, animated: true, completion: nil)

In your SideViewController,
override func viewDidLoad() {
        super.viewDidLoad()
        view.alpha = 0.5
        view.backgroundColor = // Your color
        tableView.backgroundColor = .clear
}

redpajama_set_name: RedPajamaStackExchange


text:
Q: JS Global variable to local equivalent Simple question - is it worth to create local equivalents of global variables inside of functions if we make a lot of actions on them?
var global = $(elements);

function foo(){
    var local = global;
    // lots of actions on local
}

function foo2(){
    // lots of actions on global
}

As far as I know, refering to global variables forces script to access the global scope and get values from them. I just wonder if is it worth to make an equivalents of global inside of functions which uses them?

A: It helps to create a local copy because variable resolution starts at the most local and goes toward looking in the global namespace, making it slower.
Much slower in certain older browsers.
Here is a benchmark: http://jsperf.com/global/25
Update:
Added an updated version with another test case that in theory shows that most of the performance impact comes from going up the scope chain.
http://jsperf.com/global/30

A: You don't have nothing to worry about.
Usually using global variables is discouraged because can make you code harder to mantain.
The performance impact of a global variable is very little.


text:
Q: Chat adds arbitrary semicolon for no apparent reason
*

*Go to chat

*Write "like http://xkcd.com"

*Wait a few moments for the submission to go through

*Resulting text is:

I tried a few variations and, as long as the URL is within a quoted passage, and some non-link text is prior within the quote, the semicolon appears.
More proof that this is a strange bug (as the two blocks in the below image ought to be identical):

(Thanks to the Robot for caring more than any human would.)

A: This is definitely an SO-Markdown bug of some sort, since the source is like this:

    like when people go "omg this is so funny xkcd.com" cos they're too stupid to realise that their link has a shelf life of, at most, three days

It's like the " has been HTML-encoded before linkification occurs.... then linkification goes up to the entity's ;, leaving &quot orphaned (and browsers tend to accept &quot rather than " because Internet Explorer -5 set a precedent back in the late 1850s).


text:
Q: I want to fill the gridview rows with the data selected in popup window i want to fill the grid view rows with the data selected in popup window
I attached a sample image link
https://photos.google.com/search/tra/photo/AF1QipNHlfe6sBiAsY9_czvTF8JJn8kIzBOV6RbjP2dw


text:
Q: $\infty$ is a regular cusp for the group $\Gamma_1(5)$ How can we show that $\infty$ is a regular cusp for the group $\Gamma_1(5)$?

A: The stabilizer of $\infty$ is : $$ \Gamma_1(N)_{\infty} :=\left\{\begin{pmatrix} a & b \\ c & d \end{pmatrix} \ | \ \begin{pmatrix} a & b \\ c & d \end{pmatrix} \infty=\infty \right\}=\left\{\begin{pmatrix} a & b \\ c & d \end{pmatrix} | \frac{a}{c}=\infty \right\}=\left\{ \begin{pmatrix} a & b \\ 0 & d \end{pmatrix}\right\} .$$


text:
Q: How to use WHERE clauses to optimise SQL query I have a very simple query.
SELECT top 100 *
FROM logs
WHERE description LIKE '%5488826%'
ORDER BY id DESC

However it contains a LIKE clause which is searching a largish text field.
I know the table only has (for example) 200200 rows
(I'm only interested in finding something that happened in a row id > 200000).
I tried to optimise the query by adding in
 SELECT top 100 *
 FROM logs
 WHERE  ID > 200000
 AND description LIKE '%5488826%'
 ORDER BY id DESC

my thinking was that SQL would run the ID > 200000 constraint first and that would help speed up the query, but it still takes minutes to run, what should I do to make this run faster.
EDIT:
ID is PK and indexed

A: You could try to create a temp-table with only the entries with an id > 200000, and query that to see if it makes any difference:
SELECT * INTO #temp FROM logs WHERE id > 200000;

SELECT * FROM #temp WHERE description LIKE '%5488824%' ORDER BY id DESC;

A: See if this works:
SELECT top 100 * from
(select description FROM logs  WHERE  ID > 200000 )  s
where s.description LIKE '%5488826%'
ORDER BY s.id DESC

A: I would try subquery first constraint. Depends on DB which you use you can try something like:
SELECT TOP 100 * FROM (
SELECT ID, description FROM logs WHERE ID > 200000
) AS data
JOIN
   logs
ON
   logs.id = data.id
WHERE
   data.description LIKE '%5488826%'
ORDER BY
   ID DESC

OR (for SQL Server -- with CTE and read uncommitted hint):
;WITH data AS (
    SELECT ID, description FROM logs WITH (NOLOCK) WHERE ID > 200000
)
SELECT
  logs.*
FROM
  data
  JOIN
    logs WITH (NOLOCK)
  ON
    logs.id = data.id
WHERE
  data.description LIKE '%5488826%'

And make sure you have index on id column.

A: Very short answer ;-) Add an index to the columns.


text:
Q: Importing a sql file to mysql on an ubuntu server failing I'm trying to import a sql file that is on the server using the following command in the terminal
mysql -u NAME -p DBNAME < path/to/FILE.sql

when i do that it asks for the password, after inputting the password nothing happens. I check the database and no tables have been added.
Note:

*

*DBNAME is created in the mysql database.

*I have also tried the following syntax in mysql and also that didn't work
mysql> source PATH/TO/FILE.sql
Please Help :D

A: The sql file was corrupt, all i had to do was delete it and upload it once again. thanks @CBroe

A: Hello you can trying with

*

*Create the database for import the tables:
mysql -u root -p
create database database_name;
exit
mysql -u user -p databasename < databasename.sql


text:
Q: How to do _fast_ table sorting in Ember.js? I have an Ember application which renders a table of ~200-300 rows. I tried to implement Tablesorter-like functionality but ran across very poor performance.
Outline of the relevant part of application is the following: there is a collection of objects, an ArrayController and CollectionView. CollectionView#content is bound to ArrayController#arrangedContent and sorting is done by setting ArrayController#sortProperties property.
I have setup a JS fiddle for convenience: http://jsfiddle.net/496tT/1/ . In Chrome in JS console you can see that raw sorting takes ~5ms and table sorting takes ~1000ms.
In my current implementation Ember rerenders all views when arrangedContent gets updated. I suppose that sorting could be speed up by sorting item views within CollectionView hence effectively reattaching views to the DOM in a proper order. But I have no idea how to do this properly in Ember.js.
Any thoughts?
PS — There is a duplicate here on SO — https://stackoverflow.com/questions/12915647/table-sort-with-emberjs-clear-and-rebuild-the-table — but it has no answer; in this question I have set up a fiddle for convenience.

A: I don't know if this will get you enough of a speed increase for what you are doing, but one thing you can do is change what the view binds to. You have it bound to controller.arrangedContent instead of just controller. In the fiddle if I change:
App.MyView = Ember.CollectionView.extend({
    tagName: 'ul',
    contentBinding: 'controller.arrangedContent',
    itemViewClass: Ember.View.extend({
        tagName: 'li',
        templateName: 'element'
    })
});

to:
App.MyView = Ember.CollectionView.extend({
    tagName: 'ul',
    contentBinding: 'controller',
    itemViewClass: Ember.View.extend({
        tagName: 'li',
        templateName: 'element'
    })
});

Things go from around 9 seconds "rawsort" to 6 seconds for me. The s1 and s2 also average around 900 instead of 1400 or so.


text:
Q: Python: dynamically adding classes to QtWidgets.QMainWindow() instance? I have many QtDesigner py files (version 5.11).  I want to include the classes of the QtDesigner py files in a main class.  Manually, I would do this for the first subclass, mainMenu.py
menu = QtWidgets.QMainWindow()

menu.Ui_mainMenu = mainMenu.Ui_mainMenu
menu.QtCore = mainMenu.QtCore
menu.QtGui = mainMenu.QtGui
menu.QtWidgets = mainMenu.QtWidgets

Then, I'd have to take the next QtDesigner-generated py file and add its Ui_nextMenu, etc.  I suppose that there must be an automated way to populate the menu class with all the Ui_* classes from the files.  Any help, please.


text:
Q: 14 - 7 = 3: Arithmetic overflow in Careers invitation? I recently was invited to create a Careers profile (I'm flattered, by the way).
On Monday, the 29th of October, I received the invitation, saying

[snip flattering stuff about my contributions and Careers] But please act soon: this invitation expires in 14 days, ...

(Emphasis is mine.)
I didn't act swiftly, so today, Monday the 5th of November [Remember, remember ...] I received the following reminder:

We noticed you have not accepted our invitation to join Stack Overflow Careers.  Only 3 days remain before it expires, and we'd love to have you.

(Emphasis is mine again.)
Thank you for the flowers, and I acted before Careers decided that maybe 3 - 1 = 0, but somebody should take a look at the code for calculating how many days the invitation remains standing.

A: Thanks for the report Daniel. Invites should definitely be good for 14 days, but our invitation code was creating them with 10 day expirations for some reason. The first invitation e-mail text has 14 hard coded in it, so that was still right. However, the follow-up e-mail actually calculates the days remaining on the invitation, so it was using the 10 day expiration we store in the database.
Sorry for the bug. You won't ever get to see it work correctly :( but it has been fixed.


text:
Q: how to auto resize materialize collapsible to fit window height I'm using materialize css collapsible component. I'm filling this collapsible content dynamically with thymeleaf template engine. And i want at final when i click on collapsible to show the collapsible body to fill all the window empty space.
I have any clue how to do it with css please help !

                        <input th:name="${button.name}" th:value="${button.data}" type="text" class="validate" />
                         Entrez la valeur


text:
Q: Chat messaging application for ios I am using simple peer-to-peer chat room iPhone app which makes use of local wifi network: https://bitbucket.org/snej/chatty/src. I would like to be able to use an internet-based connection instead of the local wifi network.
Alternatively I have tried to create a socket based iPhone App and Server: http://www.raywenderlich.com/3932/how-to-create-a-socket-based-iphone-app-and-server. The simple tcp server works, i have tested it and i get the response but the client doesn't. What went wrong?
Could you please help. Thanks in advance.

A: You need to setup some server to achieve that.
iPhone<----->wifi router (local IP address range!)<----->internet<------>[something here!]

[something here!] will not be able to send packages to your iPhone, because it's local wifi address is not routed in internet. You would need to do some port forwarding magic to get this running, but this is odd since you would need to require all users to be changing their router's config and so on.
Using the mobile network
iPhone<----->mobile network operator<----->internet<------>[something here!]

does not improve that situation, because MNOs tend to filter their incoming trafic (at least in Europe) -
you just can not ping/ftp/ssh/connect to the phones on their networks.
That's why there is Apple Push Notification service and so on...
The correct setup is to make both phones clients and talk to a server
doing the session handling for both of them.
iPhone<----->wifi router (local IP address range!)<----->internet<------> YOUR
                                                                          SERVER
iPhone<----->mobile network operator<------------------->internet<------> HERE!


text:
Q: How to check whether a key already exists in a Kafka topic? I want a function, say checkKey() which should work as follows:
def checkKey(key):
    if(key in topic-name):
        return True
    return False

I could not find this in Kafka's documentation. I am aware that in order to deduplicate data, Kafka can update the key. However, I do not want the updation, I want to know whether it already exists or not. And if it exists, I want to update its value in the following way:
def updateValue(key):
    if(checkKey(key)):
        value of key in topic-name += 1

This I need to perform using Python, so code sample of the same would be very helpful.

A: You can use Kafka Streams for that. Simply define a KTable for your topic using StreamBuilder.table providing a name for the state store using Materialized.as("store-name") and then you can query it using Interactive Queries, see that page for more examples but it's as simple as streams.store("store-name", QueryableStoreTypes.keyValueStore()).get(key).

A: Kafka is not a table, it's a queue.  To see if a key exists in a topic, you need to read the entire topic or, if at all possible, keep a local copy of the topic.  You might be able to restrict your search to a specific partition if you know your partitioning logic.
That being said, Confluent has a streaming SQL engine called KSQL which might help you.  You can look it up here


text:
Q: Incorrect object returned from a has_and_belongs_to_many relationship I have two models, User and Discussion
User model
has_and_belongs_to_many :subscribed_discussions, :class_name => 'Discussion', :join_table => 'discussions_subscriptions'
has_many :discussions

Discussion model
has_and_belongs_to_many :subscribed_users, :class_name => 'User', :join_table => 'discussions_subscriptions'
belongs_to :user

When I access discussions from a user u.subscribed_discussions[0].user_id, I get a completely different value of user than when I access the user directly from Discussion.find
system :029 > u.subscribed_discussions.first == Discussion.find(10)
 => true
system :030 > Discussion.find(10)
 => #<Discussion id: 10, title: "MBA", content: "What do you think about management education, speci...", user_id: 7, created_at: "2011-01-24 21:44:22", updated_at: "2011-01-24 21:44:22", group_id: nil, profile_id: 8>
system :031 > u.subscribed_discussions.first
 => #<Discussion id: 10, title: "MBA", content: "What do you think about management education, speci...", user_id: 1, created_at: "2011-01-24 21:44:22", updated_at: "2011-01-24 21:44:22", group_id: nil, profile_id: 8>
system :032 > u.id
 => 1
system :034 > Discussion.find(10).user_id
 => 7

u is a user who has subscribed to the discussion with id=10. When I access the discussion through the subscribed_discussions relationship, and access its user, I get u back, instead of the creator of that discussion.

A: I'm assuming your Discussion model belongs_to :user, which means the user_id field on the discussion model will be that user, it's unrelated to the has_and_belongs_to_many :subscribed_users association.
Can you post your models and schema.rb? It'll make it easier to understand what your model is doing.
Also, I suggest moving away from HABTM and using has_many :through instead, it'll give you a richer model.

A: I confirmed this on IRC that this is a bug in HABTM relationships in Rails 3, if one of the table and the join table both have a column of the same name.


text:
Q: Why does python class method's first argument change when used as decorator Consider the following code:
class C:
    def decorator(self):
        print(self)
        def inner(*args):
            return self(*args)
        return inner

    @decorator
    def decorated(self):
        ...

if __name__ == '__main__':
    c = C()
    c.decorator() # 1
    c.decorated() #2

The output is this:
<function C.decorated at 0x1121cd9d8>
<__main__.C object at 0x111f5a8d0>

*

*When the decorator function is called as a normal class function, the first argument it receives is a class instance.

*However, when decorated is called and the decorator function is used as a decorator, the first argument is a decorated function; the decorator function now behaves virtually the same as a normal function that's defined outside of the class.

Intuitively, since the decorator function is defined as a function inside a class without the @staticmethod or @classmethod decorator, I thought the first argument it receives should always be the instance of the class. However this was not the case.
I don't see this coding pattern often, but is this coding pattern widely used? What are the possible pitfalls of using this coding pattern?

A: I made a little change to your code and I tried to explain what happens in the comments:
class C:
    def decorator(self, count=[0]):
        print(count, ":", self)
        count[0] += 1
        def inner(*args):
            return self(*args)
        return inner

    @decorator
    def decorated(self):
        print(self)

if __name__ == '__main__':
    c = C() #0 Applies the decorator like
            #  decorated = decorator(decorated)
            #  Above, self equals decorated function, and gets printed
            #  inside decorator function.
            #  The decorated function is now a function that returns decorated(*args), actually None, but prints self, at call moment (not now).
    c.decorator() #1 normal bound method call, self is c
    print("[2] : ", end="") # for visual reference
    c.decorated() #2 calls C.decorated(c) so now self is c again and decorated is the result of decorated(c) that returns None but prints self (equals c), with no print from the decorator bound method, that does not run.

Outputs:
[0] : <function C.decorated at 0x7f26945b4ee0>
[1] : <__main__.C object at 0x7f26945bddc0>
[2] : <__main__.C object at 0x7f26945bddc0>

I think this use is a bit confusing, so unless you have a concrete reason to do that... However I have seen some advanced code with decorators or metaclasses that can be difficult to grasp. It is always a matter of really needing something worth of it. I suggest you search for typical decorator and class decorator uses. Rarely seen looks different from widely used.

A: It seem the "problem" its actually at init
class C:
    def decorator(self):
        print(self)
        def inner(*args):
            return self(*args)
        return inner
    @decorator
    def decorated(self):
        pass
if __name__ == '__main__':
    c = C()
    #c.decorator() # 1
    #c.decorated() #2

python test.py
<function C.decorated at 0x00000289DD5BE160>

So... at init of a class with decorated functions first it modifies the function (to launch the decorator instead of the decorated).
Probably there is some documentation that can be read. I never used decorators inside the class, only stand alone.


text:
Q: How to add attribute value in xml i use this code for creating xml file using c# class.
XmlDocument doc = new XmlDocument();
            XmlNode docNode = doc.CreateXmlDeclaration("1.0", "UTF-8", null);
            doc.AppendChild(docNode);
            XmlNode RootNode = doc.CreateElement("SDF");
            doc.AppendChild(RootNode);
            XmlAttribute rootAttribute2 = doc.CreateAttribute("Version");
            rootAttribute2.Value = "3.0";
            RootNode.Attributes.Append(rootAttribute2);
            XmlAttribute rootAttribute = doc.CreateAttribute("xmlns:sdf");
            rootAttribute.Value = "http://www.w3.org/2001/XMLSchema-instance";
            RootNode.Attributes.Append(rootAttribute);
            XmlAttribute rootAttribute1 = doc.CreateAttribute("sdf:noNamespaceSchemaLocation");
            rootAttribute1.Value = "SDF.xsd";
            RootNode.Attributes.Append(rootAttribute1);

output of this code..
 <?xml version="1.0" encoding="UTF-8"?>
    <SDF Version="3.0" xmlns:sdf="http://www.w3.org/2001/XMLSchema-instance" noNamespaceSchemaLocation="SDF.xsd">

but i want output like that
  <?xml version="1.0" encoding="UTF-8"?>
    <SDF Version="3.0" xmlns:sdf="http://www.w3.org/2001/XMLSchema-instance" sdf:noNamespaceSchemaLocation="SDF.xsd">

A: You need to use a different overload:
XmlAttribute rootAttribute1 =
    doc.CreateAttribute("sdf", "noNamespaceSchemaLocation", null);

A: Use Overloaded version CreateAttribute method.
doc.CreateAttribute("name","namespaceURI")

See below link for detials.
http://msdn.microsoft.com/en-us/library/System.Xml.XmlDocument.CreateAttribute%28v=vs.110%29.aspx

A: i searched on google and find answer that solve my problem
XmlNode RootNode = doc.CreateElement("SDF");
            doc.AppendChild(RootNode);
            XmlAttribute rootAttribute2 = doc.CreateAttribute("Version");
            rootAttribute2.Value = "3.0";
            RootNode.Attributes.Append(rootAttribute2);
            XmlAttribute newAttr = doc.CreateAttribute("sdf", "noNamespaceSchemaLocation", "http://www.w3.org/2001/XMLSchema-instance");
            newAttr.Value = "SDF.xsd";
            RootNode.Attributes.Append(newAttr);


text:
Q: Why background color is orange in Xcode but white in Simulator I have create a page based application using the template.
The color of my DataViewController is orange in Xcode (I have a label, an image and a textview)

but in simulator the bottom is white instead of orange, why ? How can I change
UPDATE : Storyboard properties

A: Based on the limited information you provide, it is possible that another view is covering your background. Set a breakpoint in the view controller and tell the debugger
po [self.view recursiveDescription]

and examine the frames of all the subviews. A label, for example is white by default, so if the label expands (due to the constraints defined in storyboard), it could cover your background.


text:
Q: TFS Build: How to execute post-build event I have asp.net mvc project. I am updating some JavaScript files in the post-build event. It has the next format - "helperApp /sourceFolder /destinationFolder". It works great. But when I try to build it on TFS build server I have received the error (255 cant open file). It was happened because "C:\Build\.." folder and files inside are read only. So I can't update my JavaScript files.
I had similar issue when used WebDeploy from developer machine (files in destinationFolder were locked) but I fix this by using command "Check out for edit" from VS (It makes them writable).
My question: How is it possible to get access helperApp to project's files in post-build event during TFC build?

A: First question is why are you editing source-controlled files as part of the build?  Do you intend to check-in the changes as part of the build also?
You will need to update the build (either the TFS Workflow, or your MSBuild Targets) to Check-Out the files from TFS before attempting to modify them (or simply turn-off the Read-Only flag), then either Check-In when done modifying them or Undo Checkout on them.


text:
Q: Searching multiple labels in google CSE I know it has been asked before: 1, 2. But I was reading the documents and saw it might be possible.
I need to add multiple refinements to the query in google custom search engine. So if I have multiple labels on my CSE, I would like to query a subset of them in a way. Say I have three labels: news, articles and stories. I would like to be able to search for a query like earth in all the pages included in news or stories.
For adding just one label, querying like this works fine: earth more:news. But no like when I add the second label.
According to google's documentation, you can use OR between multiple refinements. But It does not work for me. I'm using javascript and the RESTful APIs and yet I tried many combinations:

*

*earth more:news more:stories

*earth more:news OR more:stories

*earth [more:news OR more:stories]

*earth more:news,stories
Anyone has any ideas how it would work?

A: It seems AND and OR options are only for pagemap data and meta-tags and they don't work on directory structures and labels.