Search Results

Search found 1652 results on 67 pages for 'abc'.

Page 25/67 | < Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >

  • SQL Server : copy data from one table to another

    - by Gladdy
    I want to update Table2 names with names from Table1 with matching Ids I have around 100 rows in each table. Here is my sample tables. Table1 ID Name Table2 ID Name Sample data Table1 ID |Name -------- 1 |abc 2 |bcd Table2 ID |Name -------- 1 |xyz 2 |OOS Expected result Table2 ID |Name -------- 1 |abc 2 |bcd How can I do this?

    Read the article

  • Multiple schema validation in Java

    - by user279554
    Hi, I am trying to do multiple schema validation in Java. I don't understand where I am doing wrong. Any help will be appreciated. abc.xsd <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xn="project-xml-r4j_another.xsd"> <xsd:import namespace="project-xml-r4j_another.xsd"/> <xsd:element name="abc" type="abc"> </xsd:element> <xsd:complexType name="abc"> <xsd:sequence> <xsd:element name="test" type="test" minOccurs="0" maxOccurs="1"> </xsd:element> <!--<xsd:element name="proj" type="xn:proj"/>--> </xsd:sequence> <xsd:attribute name="id" type="xsd:ID" use="required"/> </xsd:complexType> <xsd:complexType name="test"> <xsd:attribute name="id" type="xsd:ID" use="required"></xsd:attribute> <xsd:attribute name="value" use="required"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:maxLength value="100" /> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:schema> project-xml-r4j_another.xsd <?xml version="1.0" encoding="UTF-8"?> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="project-xml-r4j_another.xsd" xmlns="project-xml-r4j_another.xsd" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:element name="proj" type="proj"> <xsd:annotation> <xsd:documentation> The project is the root tag of a project-xml. </xsd:documentation> </xsd:annotation> </xsd:element> <xsd:complexType name="proj"> <xsd:attribute name="id" type="xsd:ID" use="required"/> </xsd:complexType> </xsd:schema> Test case package test; import java.io.File; import java.io.IOException; import javax.xml.XMLConstants; import javax.xml.transform.Source; import javax.xml.transform.stream.StreamSource; import javax.xml.validation.Schema; import javax.xml.validation.SchemaFactory; import javax.xml.validation.Validator; import org.apache.log4j.Logger; import org.junit.Test; import org.xml.sax.SAXException; import org.xml.sax.SAXParseException; import org.xml.sax.helpers.DefaultHandler; import com.ericsson.ccrtool.core.project.projectxml.InvalidProjectXmlException; public class TestSchema { private static final Logger logger = Logger.getLogger(TestSchema.class); static final String W3C_XML_SCHEMA = XMLConstants.W3C_XML_SCHEMA_NS_URI; @Test public void test() { System.out.println("TestSchema.test()"); try { SchemaFactory schemaFactory = SchemaFactory.newInstance(W3C_XML_SCHEMA); // create a grammar object. Source [] source = { new StreamSource(new File("C:\\jaydeep\\Ericsson\\R5B\\abc.xsd")), new StreamSource(new File("C:\\jaydeep\\Ericsson\\R5B\\project-xml-r4j.xsd"))}; Schema schemaGrammar = schemaFactory.newSchema(source); Validator schemaValidator = schemaGrammar.newValidator(); schemaValidator.setErrorHandler(new MessageHandler()); // validate xml instance against the grammar. schemaValidator.validate(new StreamSource("C:\\jaydeep\\Ericsson\\R5B\\project_tmmk17cells_xnaveen_project-xml.xml")); } catch (SAXException e) { throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + e.getMessage(), e); } catch (IOException e) { throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + e.getMessage(), e); } } class MessageHandler extends DefaultHandler { private String errMessage = ""; @Override public void warning(SAXParseException e) { logger.info("Warning Line " + e.getLineNumber() + ": " + e.getMessage()); } @Override public void error(SAXParseException e) { errMessage = new String("Error Line " + e.getLineNumber() + ": " + e.getMessage()); logger.info(errMessage); throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + errMessage); } @Override public void fatalError(SAXParseException e) { errMessage = new String("Error Line " + e.getLineNumber() + ": " + e.getMessage()); logger.info(errMessage); throw new InvalidProjectXmlException("Project-xml validation failed, Exception: " + errMessage); } } } Thanks, Jaydeep

    Read the article

  • Distinctly LINQ &ndash; Getting a Distinct List of Objects

    - by David Totzke
    Let’s say that you have a list of objects that contains duplicate items and you want to extract a subset of distinct items.  This is pretty straight forward in the trivial case where the duplicate objects are considered the same such as in the following example: List<int> ages = new List<int> { 21, 46, 46, 55, 17, 21, 55, 55 }; IEnumerable<int> distinctAges = ages.Distinct(); Console.WriteLine("Distinct ages:"); foreach (int age in distinctAges) { Console.WriteLine(age); } /* This code produces the following output: Distinct ages: 21 46 55 17 */ What if you are working with reference types instead?  Imagine a list of search results where items in the results, while unique in and of themselves, also point to a parent.  We’d like to be able to select a bunch of items in the list but then see only a distinct list of parents.  Distinct isn’t going to help us much on its own as all of the items are distinct already.  Perhaps we can create a class with just the information we are interested in like the Id and Name of the parents.  public class SelectedItem { public int ItemID { get; set; } public string DisplayName { get; set; } } We can then use LINQ to populate a list containing objects with just the information we are interested in and then get rid of the duplicates. IEnumerable<SelectedItem> list = (from item in ResultView.SelectedRows.OfType<Contract.ReceiptSelectResults>() select new SelectedItem { ItemID = item.ParentId, DisplayName = item.ParentName }) .Distinct(); Most of you will have guessed that this didn’t work.  Even though some of our objects are now duplicates, because we are working with reference types, it doesn’t matter that their properties are the same, they’re still considered unique.  What we need is a way to define equality for the Distinct() extension method. IEqualityComparer<T> Looking at the Distinct method we see that there is an overload that accepts an IEqualityComparer<T>.  We can simply create a class that implements this interface and that allows us to define equality for our SelectedItem class. public class SelectedItemComparer : IEqualityComparer<SelectedItem> { public new bool Equals(SelectedItem abc, SelectedItem def) { return abc.ItemID == def.ItemID && abc.DisplayName == def.DisplayName; } public int GetHashCode(SelectedItem obj) { string code = obj.DisplayName + obj.ItemID.ToString(); return code.GetHashCode(); } } In the Equals method we simply do whatever comparisons are necessary to determine equality and then return true or false.  Take note of the implementation of the GetHashCode method.  GetHashCode must return the same value for two different objects if our Equals method says they are equal.  Get this wrong and your comparer won’t work .  Even though the Equals method returns true, mismatched hash codes will cause the comparison to fail.  For our example, we simply build a string from the properties of the object and then call GetHashCode() on that. Now all we have to do is pass an instance of our IEqualitlyComarer<T> to Distinct and all will be well: IEnumerable<SelectedItem> list =     (from item in ResultView.SelectedRows.OfType<Contract.ReceiptSelectResults>()         select new SelectedItem { ItemID = item.dahfkp, DisplayName = item.document_code })                         .Distinct(new SelectedItemComparer());   Enjoy. Dave Just because I can… Technorati Tags: LINQ,C#

    Read the article

  • curl POST to RESTful services

    - by Sashikiran Challa
    Hello All, There are a lot of questions on Stackoverflow about curl but I could not figure out what is that I am doing what I am not supposed to. I am trying to call a RESTful service that I had written using Jersey API and am trying to POST an xml string to it and I get HTTP 415 error which is supposed to be a Media Type error. Here in my shell script call to 1st service: abc=curl http://gf...:8080/InChItoD/inchi/3dstructure?InChIstring=$inchi echo $abc (this works fine the output that it returns is given below.) Posting this xml string to second service def= curl -d $abc -H "Content-Type:text/xml" http://gf...:8080/XML2G/xml3d/gssinput I get the following error: ... ... HTTP Status 415 Status report message description.The server refused this request because the request entity is in a format not supported by the requested resource for the requested method ().Apache Tomcat/6.0.26 This is a sample of xml string I am trying to POST <?xml version="1.0"?><molecule xmlns="http://www.xml-cml.org/schema"> <atomArray> <atom id="a1" elementType="N" formalCharge="1" x3="0.997963" y3="-0.002882" z3="-0.004222"/> <atom id="a2" elementType="H" x3="2.024650" y3="-0.002674" z3="0.004172"/> <atom id="a3" elementType="H" x3="0.655444" y3="0.964985" z3="0.004172"/> <atom id="a4" elementType="H" x3="0.649003" y3="-0.496650" z3="0.825505"/> <atom id="a5" elementType="H" x3="0.662767" y3="-0.477173" z3="-0.850949"/> </atomArray> <bondArray> <bond atomRefs2="a1 a2" order="1"/> <bond atomRefs2="a1 a3" order="1"/> <bond atomRefs2="a1 a4" order="1"/> <bond atomRefs2="a1 a5" order="1"/> </bondArray></molecule> Thanks in advance

    Read the article

  • jquery validate: focusCleanup: true and focusInvalid: false don't work as expected

    - by laramichaels
    I am using Joern's jquery validation plugin 1.6. My goal is to have the following behavior: remove the error message for an element once the user focuses it. From what I understand setting 'focusCleanup: true' should take care of this. However (at least on my browser (Firefox 3.5.7 on Linux)), I only get the desired behavior (ie, error message for a field disappearing once you focus it) if I click into the field; it doesn't handle tabbing into the field correctly. Sample code: HTML: <form id='abc' name='abc'> <input type="text" id="t1" name="t1"/> <input type="text" id="t2" name="t2"/> <input type="submit" id="submit" value='submit'/> </form> JS: $("#abc").validate({ focusCleanup: true, focusInvalid: false, rules: {t1: {required: true, email:true}, t2: {required: true,email:true}} }); I am setting 'focusInvalid: false' because the docs say one should avoid combining focusCleanup and focusInvalid; in my experience commenting out that line makes no difference. Am I doing something wrong?

    Read the article

  • SHA1 hashing in Delphi XE

    - by Leonardo Herrera
    Hello, I'm in the process of implementing XML digital signatures. I'm starting with little steps, so right now I want to solve the problem of SHA-1 hashing. There are lots of questions about this in SO: Digitially Sign Key with Lockbox Encryption library for Delphi Convert this php digital signing to Delphi Delphi: is there a version of LockBox for Delphi-XE Delphi 2010 Cryptography libraries ...and probably more. However, I'm using Delphi XE. So far, I've tried LockBox 2 (both the Songbeamer and Sourceforge versions), Lock Box 3, DCPCrypto2 and some others (Hashes is an easy to use unit which uses Windows crypto functions) I prepared a small test rig that gives me the following: LockBox2 FAILED: 1 ('abc') Got: '9f04f41a848514162050e3d68c1a7abb441dc2b5' Expected: 'a9993e364706816aba3e25717850c26c9cd0d89d' FAILED: 2 ('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') Got: '51d7d8769ac72c409c5b0e3f69c60adc9a039014' Expected: '84983e441c3bd26ebaae4aa1f95129e5e54670f1' LockBox3 FAILED: 1 ('abc') Got: '9f04f41a848514162050e3d68c1a7abb441dc2b5' Expected: 'a9993e364706816aba3e25717850c26c9cd0d89d' FAILED: 2 ('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') Got: '51d7d8769ac72c409c5b0e3f69c60adc9a039014' Expected: '84983e441c3bd26ebaae4aa1f95129e5e54670f1' DCPCrypto2 FAILED: 1 ('abc') Got: '9f04f41a848514162050e3d68c1a7abb441dc2b5' Expected: 'a9993e364706816aba3e25717850c26c9cd0d89d' FAILED: 2 ('abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq') Got: '51d7d8769ac72c409c5b0e3f69c60adc9a039014' Expected: '84983e441c3bd26ebaae4aa1f95129e5e54670f1' Hashes Test 1 passes Test 2 passes Have you succeeded in compile the mentioned libraries under Delphi XE and make them give the appropriate values? I'm particularly interested in DCPCrypt2 SelfTest procedure. Edit: I've added this answer with the fixed source code. Thank you all for your help, it is most appreciated.

    Read the article

  • Finding duplicate rows in SQL Server

    - by xtine
    I have a SQL Server database of organizations, and there are many duplicate rows. I want to run a select statement to grab all of these and the amount of dupes, but also return the ids that are associated with each organization. A statement like: SELECT orgName, COUNT(*) AS dupes FROM organizations GROUP BY orgName HAVING (COUNT(*) > 1) Will return something like orgName | dupes ABC Corp | 7 Foo Federation | 5 Widget Company | 2 But I'd also like to grab the IDs of them. Is there any way to do this? Maybe like a orgName | dupeCount | id ABC Corp | 1 | 34 ABC Corp | 2 | 5 ... Widget Company | 1 | 10 Widget Company | 2 | 2 The reason being that there is also a separate table of users that link to these organizations, and I would like to unify them (therefore remove dupes so the users link to the same organization instead of dupe orgs). But I would like part manually so I don't screw anything up, but I would still need a statement returning the IDs of all the dupe orgs so I can go through the list of users. Any help would be greatly appreciated. Thanks :)

    Read the article

  • Embedding a Media manager video in the article in Joomla1.5

    - by Aruna
    Hi, I am working on Joomla currently for the past one month. I am trying to embed a video stream in my article page like inside the content i am trying to have video stream like youtube video. I have uploaded a video in my media manager. And i dono how to stream that video in my page. Please help me in doing so.. EDIT: FOr an youtube video i have used like <object width='425' height='344'> <param name='movie' value='http://www.youtube.com/v/hQVTIJBZook&hl=en&fs=1'> <param name='type' value='application/x-shockwave-flash'> <param name='allowfullscreen' value='true'> <param name='allowscriptaccess' value='always'> <param name="wmode" value="opaque" /> <embed width='425' height='344' src='http://www.youtube.com/v/hQVTIJBZook&hl=en&fs=1' type='application/x-shockwave-flash' allowfullscreen='true' allowscriptaccess='always' wmode="opaque"> </embed> </object> But i am having the video in my http://www.abc.com/images/abc.flv i am not able to know of how to use this video ?? where http://www.abc.com is my website running in Joomla1.5 . Please help me..

    Read the article

  • How can I stop SharePoint from appending <mso:CustomDocumentProperties> to my output

    - by tath.am
    I'm trying to hack together an extra feature on top of a POC (smoke and mirrors demo). The POC is on SPS 2007 and I need to integrate with another system. To facilitate part of this, I need to provide a JSONP endpoint. I want this URL: http://sharepoint:2024/Pages/SomeExternalSystem/Payload.aspx?callback=abc To return this: abc({ sampleField1: "sampleData1", sampleField2: 234.56 }); It's all smoke and mirrors anyway, so I uploaded this file to SharePoint: <%@ Page ContentType="text/javascript" Language="C#" %> <%= Request.QueryString["callback"] %>({ sampleField1: "sampleData1", sampleField2: 234.56 }); (And added a page parser rule to allow it to compile the code blocks.) No matter what I seem to do, SharePoint emits this instead: abc({ sampleField1: "sampleData1", sampleField2: 234.56 }); <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"><head> <!--[if gte mso 9]><xml> <mso:CustomDocumentProperties> <mso:PublishingContactPicture msdt:dt="string"></mso:PublishingContactPicture> <mso:PublishingRollupImage msdt:dt="string"></mso:PublishingRollupImage> <mso:Audience msdt:dt="string"></mso:Audience> <mso:PublishingContactName msdt:dt="string"></mso:PublishingContactName> <mso:ContentType msdt:dt="string">Page</mso:ContentType> <mso:Comments msdt:dt="string"></mso:Comments> <mso:PublishingContactEmail msdt:dt="string"></mso:PublishingContactEmail> </mso:CustomDocumentProperties> </xml><![endif]--> </head> It's proving hard to Google for.

    Read the article

  • Bash Array Problem

    - by Deepak Prasanna
    I wrote a bash script which tries to find a process and run the process if it had stopped. This is the script. #!/bin/bash process=thin path=/home/deepak/abc/ initiate=thin start -d process_id=`ps -ef | pgrep $process | wc -m` if [ "$process_id" -gt "0" ]; then echo "The process process is running!!" else cd $path $initiate echo "Oops the process has stopped" fi This worked fine and I thought of using arrays so that i can form a loop use this script to check multiple processes. So I modified my script like this #!/bin/bash process[1]=thin path[1]=/home/deepak/abc/ initiate[1]=thin start -d process_id=`ps -ef | pgrep $process[1] | wc -m` if [ "$process_id" -gt "0" ]; then echo "Hurray the process ${process[1]} is running!!" else cd ${path[1]} ${initiate[1]} echo "Oops the process has stopped" echo "Continue your coffee, the process has been stated again! ;)" fi I get this error if i run this script. DontWorry.sh: 2: process[1]=thin: not found DontWorry.sh: 3: path[1]=/home/deepak/abc/: not found DontWorry.sh: 4: initiate[1]=thin start -d: not found I googled to find any solution for this, most them insisted to use "#!/bin/bash" instead of "#!/bin/sh". I tried both but nothing worked. What am i missing?

    Read the article

  • Powershell Regex help in extracting text between strings

    - by vivekeviv
    i Have an arguments like the one below which i pass to powershell script -arg1 -abc -def -arg2 -ghi -jkl -arg3 -123 -234 Now i need to extract three strings without any whitespace string 1: "-abc -def" string 2: "-ghi -jkl" string 3: "-123 -234" i figured this expression could do it. But this doesnt seem to work. $args -match '-arg1(?'arg1'.*?) -arg3(?'arg3'.*?) -arg3(?'arg3'.*)'. THis should return $matches['arg1'] etc. So whats wrong in above expression. Why do i get an error as shown below runScript.ps1 -arg1 -abc -def -arg2 -ghi -jkl -arg3 -123 -234 Unexpected token 'arg1'.?) -arg2 (?'arg2'.?) -arg3 (?'arg3'.)'' in expression or statement. At G:\powershell\tools\powershell\runTest.ps1:1 char:71 + $args -match '-arg1 (?'arg1'.?) -arg2 (?'arg2'.?) -arg3 (?'arg3'.)' <<<< + CategoryInfo : ParserError: (arg1'.?) -arg2...g3 (?'arg3'.)':String) [], ParseException + FullyQualifiedErrorId : UnexpectedToken and also the second question is how do i make arg1 or arg2 or arg3 optional? The argument to script can be -arg2 -def -ghi. I'll take some default values for arg(1|2|3) that is not mentioned. Thanks

    Read the article

  • SQL View with Data from two tables

    - by Alex
    Hello! I can't seem to crack this - I have two tables (Persons and Companies), and I'm trying to create a view that: 1) shows all persons 2) also returns companies by themselves once, regardless of how many persons are related to it 3) orders by name across both tables To clarify, some sample data: (Table: Companies) Id Name 1 Banana 2 ABC Inc. 3 Microsoft 4 Bigwig (Table: Persons) Id Name RelatedCompanyId 1 Joe Smith 3 2 Justin 3 Paul Rudd 4 4 Anjolie 5 Dustin 4 The output I'm looking for is something like this: Name PersonName CompanyName RelatedCompanyId ABC Inc. NULL ABC Inc. NULL Anjolie Anjolie NULL NULL Banana NULL Banana NULL Bigwig NULL Bigwig NULL Dustin Dustin Bigwig 4 Joe Smith Joe Smith Microsoft 3 Justin Justin NULL NULL Microsoft NULL Microsoft NULL Paul Rudd Paul Rudd Bigwig 4 As you can see, the new "Name" column is ordered across both tables (the company names appear correctly in between the person names), and each company appears exactly once, regardless of how many people are related to it. Can this even be done in SQL?! P.S. I'm trying to create a view so I can use this later for easy data retrieval, fulltext indexing and make the programming side simpler by just querying the view.

    Read the article

  • php string versus boolean speed test

    - by ae
    I'm looking at trying to optimise a particular function in a php app and foolishly assumed that a boolean lookup in a 'if' statement would be quicker than a string compare. But to check it I put together a short test (see below). To my surprise, the string lookup was quicker. Is there anything wrong with my test (I'm wired on too much coffee so I'm suspicious of my own code)? If not, I would be interested in any comments people have around string versus boolean lookups in php. The result for the first test (boolean lookup) was 0.168 The result for the second test (string lookup) was 0.005 <?php $how_many = 1000000; $counter1 = 0; $counter2 = 0; $abc = array('boolean_lookup'=>TRUE, 'string_lookup'=>'something_else'); $start = microtime(); for($i = 0; $i < $how_many; $i++) { if($abc['boolean_lookup']) { $counter1++; } } echo ($start - microtime()); echo '<hr>'; $start = microtime(); for($i = 0; $i < $how_many; $i++) { if($abc['string_lookup'] == 'something_else') { $counter2++; } } echo ($start - microtime());

    Read the article

  • Tikz: horizontal centering of group of nodes

    - by mindhex
    Hi, I need to align each row of the graph to the center. I am trying to do it with xshift. Here the code: \begin{tikzpicture}[node distance=1.5cm, auto, text centered] \tikzstyle{every node}=[draw,ball,align=center]; \begin{scope}[xshift=1.5cm] \node (A) {A}; \node [right of=A] (B) {B}; \node [right of=B] (C) {C}; \node [right of=C] (D) {D}; \end{scope} \begin{scope}[yshift=-1.5cm] \node (AB) {AB}; \node [right of=AB] (AC) {AC}; \node [right of=AC] (AD) {AD}; \node [right of=AD] (BC) {BC}; \node [right of=BC] (BD) {BD}; \node [right of=BD] (CD) {CD}; \end{scope} \begin{scope}[yshift=-3cm,node distance=2cm,xshift=1cm] \node (ABC) {ABC}; \node [right of=ABC] (ABD) {ABD}; \node [right of=ABD] (ACD) {ACD}; \node [right of=ACD] (BCD) {BCD}; \end{scope} \begin{scope}[xshift=4cm, yshift=-4.5cm, node distance=2cm] \node (ABCD) {ABCD}; \end{scope} \end{tikzpicture} Is there any other way to do it? Do not like to change xshift values every time.

    Read the article

  • Getting the highlighted text inside selected element only.

    - by ashays
    My goal is to be able to get the highlighted text within a document, but only if that text is within a given section, and then apply a certain style to that selected text after clicking a div tag. I'll explain what I mean: So, having looked at window.getSelection() and document.selection.createRange().text, I attempted to use elmnt.getSelection() or elmnt.selection.createRange().text for some HTML element, elmnt. However, it doesn't seem to work, so that idea seems pretty null. This means I can't use this idea to determine the text that is highlighted within a given location. In case this doesn't make sense, essentially, I want html code that looks like this: <body> <div id="content">Stuff here will not be effected</div> <div id="highlightable">Stuff here can be effected when highlighted</div> <div id="morecontent">Stuff here will also not be effected</div> </body> So that whenever I've highlighted text, clicking on a specified div will apply the proper CSS. Now, on to the div tags. Basically, here's what I've got on that: $('.colorpicker').click( function(e) { console.log(getSelectedText()); } Eventually, all I want this to highlight the selected text and have the div tag change the color of the selected text to that of the respective div tag that I've selected. Neither of these seems to be working right now, and my only guess for the reason of the div tag is that it unhighlights whatever I've got selected whenever I click on the div tag. Fallbacks: If there is more than one time that 'abc' is found on the page and I highlight to color 'abc', I would like that only that copy of 'abc' be highlighted. I know this is a lot in one question, but even if I could get a little head start on this idea, my next personal project would be going a lot more smoothly. Thanks. :)

    Read the article

  • URL rewriting to a common end point

    - by sunil
    I want to create an asp.net white-label site http://whitelabel.com, that could be styled for each of our clients according to their specific needs. So for example, client abc would see the site in their corporate colours and be accessed through their specific url http://abc.com. Likewise client xyz would see the site in their own styling and url http://xyz.com. Typing either url, in effect, takes the user to http://whitelabel.com where the styling is applied, and the client's url structure is retained. I was thinking of URL rewriting using URLRewriter.Net (http://urlrewriter.net/), or similar, mapping the incoming address to a client id and applying the theme accordingly. So, a url rewrite rule may be something like <rewrite url="http//abc.com/(.+)" to="~/$1?id=1" /> <rewrite url="http//xyz.com/(.+)" to="~/$1?id=2" /> I could then read the id, map it to the client, and with a bit of jiggery-pokery, apply the correct theme. I was wondering if: this is the right approach ? I've overlooked something ? there is a better way to do this ? Any suggestions would be appreciated.

    Read the article

  • How do I pass parameters between request-scoped beans

    - by smayers81
    This is a question that has been bothering me for sometime. My application uses ICEFaces for our UI framework and Spring 2.5 for Dependency Injection. In addition, Spring actually maintains all of our backing beans, not the ICEFaces framework, so our faces-config is basically empty. Navigation is not even really handled through navigation-rules. We perform manual redirects to new windows using window.open. All of our beans are defined in our appContext file as being request-scoped. I have Page ABC which is backed by BackingBeanABC. Inside that backing bean, I have a parameter say: private Order order; I then have Page XYZ backed by BackingBeanXYZ. When I redirect from page ABC to page XYZ, I want to transfer the 'order' property from ABC to XYZ. The problem is since everything is request-scoped and I'm performing a redirect, I am losing the value of 'description'. There has got to be an easier way to pass objects between beans in request scope during a redirect. Can anyone assist with this issue?

    Read the article

  • Awkward looking uses of Contract.ValueAtReturn()

    - by devoured elysium
    I am designing a method that will add an element to an internal list. The structure of the class is something along the lines of: class MyCustomerDatabase { private IList<Customer> _customers = new List<Customer>(); public int NumberOfCustomers { get { return _customers; } } public void AddCustomer(Customer customer) { _customers.Add(customer); } } Now, I was thinking of adding a Contract.Ensures() about the size of the _customers growing by 1 with this call. The problem is that I end up with some weird looking code: public void AddCustomer(Customer customer) { int numberOfCustomersAtReturn; Contract.Ensures(Contract.ValueAtReturn<int>(out numberOfCustomersAtReturn) == Contract.OldValue<int>(NumberOfCustomers) + 1); _customers.Add(customer); numberOfCustomersAtReturn = NumberOfCustomers; } The main problem is that properties are in fact methods, so you can't just reference them direcly when using Contract.ValueAtReturn() as its only parameter accepts variables as out. The situation gets even odder if I want to achieve the same but this time with a method that should return a value: public int MyReturningMethod() { ... return abc(); //abc will add by one the number of customers in list } //gets converted to public int MyReturningMethod() { int numberOfCustomersAtReturn; Contract.Ensures(Contract.ValueAtReturn<int>(out numberOfCustomersAtReturn) == Contract.OldValue<int>(NumberOfCustomers) + 1); int returnValue = abc(); numberOfCustomersAtReturn = NumberOfCustomers; return returnValue; } This seems pretty clumsy :( Code Contracts should aim to get things clearer and this seems right the opposite. Am I doing something wrong? Thanks

    Read the article

  • Attachment empty/blank when sending mail using phpmailer

    - by chupinette
    Hello! I am using phpmailer class to send email and i am attaching a file to the mail. The email is sent successfully but the attachment which is an sql file is empty which should not be the case. I have tried with an image file, but it seems that every file that i attach is empty. Can anyone help me solve this problem please? $mail = new PHPMailer(); $body = "Reminder"; $mail->IsSMTP(); $mail->Host = "mail.yourdomain.com"; $mail->SMTPDebug = 1; $mail->SMTPAuth = true; $mail->SMTPSecure = "ssl"; $mail->Host = "smtp.gmail.com"; $mail->Port = 465; $mail->Username = "[email protected]"; $mail->Password = "abc"; $mail->SetFrom('[email protected]', 'blbla'); $mail->AddReplyTo("[email protected]","First Last"); $mail->Subject = "Your order has been successfully placed" $mail->MsgHTML($body); $mail->AddAddress("[email protected]","xyz"); $mail->AddAttachment("D:\b2\shop3.sql","shop3.sql"); I have tried to display the size of the file before attaching it, and it actually displays the file size. Can anyone help me please?

    Read the article

  • mail send using C# code debugging.

    - by riad
    Dear all, I have to send mail using C#.I follow each and every step properly but i cannot send mail using this below code.Can anybody pls help me to solve this issue??I know its an old issue and i read all the related articles on that's site about it.But cannot solved my issue.So pls help me to solve this code.The error is: Failur sending mail.I use System.Net.Mail to do it using System.Net.Mail; string mailTo = emailTextBox.Text; string messageFrom = "[email protected]"; string mailSubject = subjectTextBox.Text; string messageBody = messageRichTextBox.Text; string smtpAddress = "mail.abc.com"; int smtpPort = 25; string accountName = "[email protected]"; string accountPassword = "123"; MailMessage message = new MailMessage(messageFrom, mailTo); message.Subject = mailSubject; message.SubjectEncoding = System.Text.Encoding.UTF8; message.Body = messageBody; message.BodyEncoding = System.Text.Encoding.UTF8; SmtpClient objSmtp = new SmtpClient(smtpAddress, smtpPort); objSmtp.UseDefaultCredentials = false; NetworkCredential basicAuthenticationInfo = new System.Net.NetworkCredential(accountName, accountPassword); objSmtp.Credentials = basicAuthenticationInfo; objSmtp.Send(message); MessageBox.Show("Mail send properly"); Thanks in advance Riad

    Read the article

  • how to append a string to next line in perl

    - by tprayush
    hi all , i have a requirement like this.. this just a sample script... $ cat test.sh #!/bin/bash perl -e ' open(IN,"addrss"); open(out,">>addrss"); @newval; while (<IN>) { @col_val=split(/:/); if ($.==1) { for($i=0;$i<=$#col_val;$i++) { print("Enter value for $col_val[$i] : "); chop($newval[$i]=<STDIN>); } $str=join(":"); $_="$str" print OUT; } else { exit 0; } } close(IN); close(OUT); ' when i run this scipt... $ ./test.sh Enter value for NAME : abc Enter value for ADDRESS : asff35 Enter value for STATE : XYZ Enter value for CITY : EIDHFF Enter value for CONTACT : 234656758 $ cat addrss NAME:ADDRESS:STATE:CITY:CONTACT abc:asff35:XYZ:EIDHFF:234656758 when ran it second time $ cat addrss NAME:ADDRESS:STATE:CITY:CONTACT abc:asff35:XYZ:EIDHFF:234656758ioret:56fgdh:ghdgh:afdfg:987643221 ## it is appended in the same line... i want it to be added to the next line..... NOTE: i want to do this by explitly using the filehandles in perl....and not with redirection operators in shell. please help me!!!

    Read the article

  • how to lucene serch in android

    - by xyz Sad
    Lucen with android logic ..??? public class TestAndroidLuceneActivity extends Activity { @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.main); try { Directory directory = new RAMDirectory(); Analyzer analyzer = new StandardAnalyzer(); Document doc = new Document(); doc.add(new Field("header", "ABC", Field.Store.YES,Field.Index.TOKENIZED)); indexWriter.addDocument(doc); doc.add(new Field("header", "DEF", Field.Store.YES,Field.Index.TOKENIZED)); indexWriter.addDocument(doc); doc.add(new Field("header", "GHI", Field.Store.YES,Field.Index.TOKENIZED)); indexWriter.addDocument(doc); doc.add(new Field("header", "JKL", Field.Store.YES,Field.Index.TOKENIZED)); indexWriter.addDocument(doc); indexWriter.optimize(); indexWriter.close(); IndexSearcher indexSearcher = new IndexSearcher(directory); QueryParser parser = new QueryParser("header", analyzer); // Query query = parser.parse("(" + "Anil" + ")"); Query query = parser.parse("(" + "ABC" + ")"); Hits hits = indexSearcher.search(query); for (int i = 0; i < hits.length(); i++) { Document hitDoc = hits.doc(i); Log.i("TestAndroidLuceneActivity", "Lucene: " +hitDoc.get("header")); // Toast.makeText(this, hitDoc.get("header"),Toast.LENGTH_LONG).show(); } indexSearcher.close(); directory.close(); } catch (Exception ex) { System.out.println(ex.getMessage()); } } } i have this code but i m not able to understnd plz send me related or modifed and set it main.xml show me some out put plzz..its does not serch after "ABC" plz tell me wat is the problem in logic any thing missing???..

    Read the article

  • create a class attribute without going through __setattr__

    - by eric.frederich
    Hello, What I have below is a class I made to easily store a bunch of data as attributes. They wind up getting stored in a dictionary. I override __getattr__ and __setattr__ to store and retrieve the values back in different types of units. When I started overriding __setattr__ I was having trouble creating that initial dicionary in the 2nd line of __init__ like so... super(MyDataFile, self).__setattr__('_data', {}) My question... Is there an easier way to create a class level attribute with going through __setattr__? Also, should I be concerned about keeping a separate dictionary or should I just store everything in self.__dict__? #!/usr/bin/env python from unitconverter import convert import re special_attribute_re = re.compile(r'(.+)__(.+)') class MyDataFile(object): def __init__(self, *args, **kwargs): super(MyDataFile, self).__init__(*args, **kwargs) super(MyDataFile, self).__setattr__('_data', {}) # # For attribute type access # def __setattr__(self, name, value): self._data[name] = value def __getattr__(self, name): if name in self._data: return self._data[name] match = special_attribute_re.match(name) if match: varname, units = match.groups() if varname in self._data: return self.getvaras(varname, units) raise AttributeError # # other methods # def getvaras(self, name, units): from_val, from_units = self._data[name] if from_units == units: return from_val return convert(from_val, from_units, units), units def __str__(self): return str(self._data) d = MyDataFile() print d # set like a dictionary or an attribute d.XYZ = 12.34, 'in' d.ABC = 76.54, 'ft' # get it back like a dictionary or an attribute print d.XYZ print d.ABC # get conversions using getvaras or using a specially formed attribute print d.getvaras('ABC', 'cm') print d.XYZ__mm

    Read the article

  • need an empty XML while unmarshalling a JAXB annotated class

    - by sswdeveloper
    I have a JAXB annotated class Customer as follows @XmlRootElement(namespace = "http://www.abc.com/customer") public class Customer{ private String name; private Address address; @XmlTransient private HashSet set = new HashSet<String>(); public String getName(){ return name; } @XmlElement(name = "Name", namespace = "http://www.abc.com/customer" ) public void setName(String name){ this.name = name; set.add("name"); } public String getAddress(){ return address; } @XmlElement(name = "Address", namespace = "http://www.abc.com/customer") public void setAddress(Address address){ this.address = address; set.add("address"); } public HashSet getSet(){ return set; } } I need to return an empty XML representing this to the user, so that he may fill the necesary values in the XML and send a request So what I require is : <Customer> <Name></Name> <Address></Address> </Customer> If i simply create an empty object Customer cust = new Customer() ; marshaller.marshall(cust,sw); all I get is the toplevel element since the other fields of the class are unset. What can I do to get such an empty XML? I tried adding the nillable=true annotation to the elements however, this returns me an XML with the xsi:nil="true" which then causes my unmarshaller to ignore this. How do I achieve this?

    Read the article

  • Why strings behave like ValueType

    - by AJP
    I was perplexed after executing this piece of code, where strings seems to behave as if they are value types. I am wondering whether the assignment operator is operating on values like equality operator for strings. Here is the piece of code I did to test this behavior. using System; namespace RefTypeDelimma { class Program { static void Main(string[] args) { string a1, a2; a1 = "ABC"; a2 = a1; //This should assign a1 reference to a2 a2 = "XYZ"; //I expect this should change the a1 value to "XYZ" Console.WriteLine("a1:" + a1 + ", a2:" + a2);//Outputs a1:ABC, a2:XYZ //Expected: a1:XYZ, a2:XYZ (as string being a ref type) Proc(a2); //Altering values of ref types inside a procedure //should reflect in the variable thats being passed into Console.WriteLine("a1: " + a1 + ", a2: " + a2); //Outputs a1:ABC, a2:XYZ //Expected: a1:NEW_VAL, a2:NEW_VAL (as string being a ref type) } static void Proc(string Val) { Val = "NEW_VAL"; } } } In the above code if I use a custom classes instead of strings, I am getting the expected behavior. I doubt is this something to do with the string immutability? welcoming expert views on this.

    Read the article

< Previous Page | 21 22 23 24 25 26 27 28 29 30 31 32  | Next Page >