Daily Archives

Articles indexed Thursday June 3 2010

Page 28/111 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • TabContainer in BorderContainer not showing correctly

    - by Stefaan
    Hi, I am using a borderContainer with a fix width and centering in the center of my page (Use of a div around the bordercontainer). Everything works fine until i add a TabContainer. All of a sudden i can not see my Tab's anymore. This goes as wel for IE as FF. Is this a bug or something else? How could i work around this? I'm using the latest release of dojo 1.4.3. I've tried using borderContainer in borderContainer with no result. Thnx Stefaan

    Read the article

  • How to join two query in SQL (Oracle)

    - by MAHESH A SONI
    How can I join these queries? SELECT RCTDT, SUM(RCTAMOUNT), COUNT(RCTAMOUNT) FROM RECEIPTS4 WHERE RCTDT BETWEEN '01-nov-2009' AND '30-nov-2009' AND RCTTYPE='CA' AND RCTAMOUNT>0 GROUP BY RCTDT --- SELECT RCTDT, SUM(RCTAMOUNT), COUNT(RCTAMOUNT) FROM RECEIPTS4 WHERE RCTDT BETWEEN '01-nov-2009' AND '30-nov-2009' AND RCTTYPE='CQ' AND RCTAMOUNT>0 GROUP BY RCTDT

    Read the article

  • CSS Rollovers: how to main "hit area" size when hidden image is larger than anchor area

    - by nukefusion
    I have a small problem and I don't think what I want to do can be achieved with just pure CSS, but I figured I'd ask anyway. Basically, I have one DIV which contains a hyperlinked element that is smaller in size to it's parent DIV. So in effect I have a square within a square with the inner square being the "hit area". When I mouse over this inner square I want the background of the outer square to change. I know it's not possible to change the parent DIV's background on a:hover, but I figured I could give the illusion of it happening by nesting a hidden image inside the anchor. This works great until I want to "roll off". The problem is that I want the image to disappear when I leave the area of the anchor tag, not the larger hidden image. Is this possible? For the benefit of everyone I've provided an example to demonstrate what I mean: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <title>Test Rollover</title> <link href="main.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="d1"> <a href="#nogo"> <b id="b1"></b> <b id="b2"></b> </a> </div> </body> And the css: #b1 { width: 200px; height: 200px; top: 100px; left: 100px; background-color:aqua; position: absolute; } #b2 { width: 400px; height: 400px; background-color:lime; position: absolute; display: none; } #d1 { width: 400px; height: 400px; background-color:fuchsia; position: relative; } #d1 a:hover #b2 { display: block; } In this example I want the green outer square to disappear when I leave the bounds of the hidden inner blue square.

    Read the article

  • Friends, templates, overloading <<

    - by Crystal
    I'm trying to use friend functions to overload << and templates to get familiar with templates. I do not know what these compile errors are: Point.cpp:11: error: shadows template parm 'class T' Point.cpp:12: error: declaration of 'const Point<T>& T' for this file #include "Point.h" template <class T> Point<T>::Point() : xCoordinate(0), yCoordinate(0) {} template <class T> Point<T>::Point(T xCoordinate, T yCoordinate) : xCoordinate(xCoordinate), yCoordinate(yCoordinate) {} template <class T> std::ostream &operator<<(std::ostream &out, const Point<T> &T) { std::cout << "(" << T.xCoordinate << ", " << T.yCoordinate << ")"; return out; } My header looks like: #ifndef POINT_H #define POINT_H #include <iostream> template <class T> class Point { public: Point(); Point(T xCoordinate, T yCoordinate); friend std::ostream &operator<<(std::ostream &out, const Point<T> &T); private: T xCoordinate; T yCoordinate; }; #endif My header also gives the warning: Point.h:12: warning: friend declaration 'std::ostream& operator<<(std::ostream&, const Point<T>&)' declares a non-template function Which I was also unsure why. Any thoughts? Thanks.

    Read the article

  • Can nohup change the result of a C++ code?

    - by Biga
    I am having this very weird behaviour with a C++ code: It gives me different results when running with and without 'nohup' (reproducible in cygwin and linux). I mean, if I get the same executable and run it like './run' or run it like 'nohup ./run out.log', I get different results! I use std::cout to output to screen, all lines ending with endl; I use ifstream for the input file; I use ofstream for output, all lines ending with endl. I am using g++ 4. Any idea what is going on?

    Read the article

  • Using Active Directory Web Services in .Net application

    - by Iain Carlin
    Hello, I'm trying to build a .Net application to interrogate Active Directory. From my research, Windows 2008 R2 has Active Directory Web Services (ADWS) built in. I can't find any details or examples anywhere on the web which tell me whether I should be able to use ADWS in a .Net application to read/write AD information. Should I simply be able to add a web reference or is ADWS just for Powershell use. Cheers, Iain

    Read the article

  • UItableView Problem in deleting items from database

    - by Arun Sharma
    Hi All, I am using in UitableView database.My table view works successfully (add single item,add multiple item,delete all) only problem is there when i want to delete single item for this i using Uitableview edit option. so how i add database method for deleting single item from database and also from table view. Please help me.

    Read the article

  • How to do a join with ttwo tables ??

    - by bahamut100
    HI, I try to translate this query : SELECT * FROM `reunion` , lieu WHERE reunion.lieu_reunion = lieu.id_lieu to propel query : $c=new Criteria(); $c->addJoin(ReunionPeer::LIEU_REUNION,LieuPeer::ID_LIEU, Criteria::LEFT_JOIN); $this->reunions = ReunionPeer::doSelect($c); But in my template, when I made a print_r($reunions), the field "ville" (from the table 'lieu') is not present. Why ??

    Read the article

  • textbox issue regarding shrinking first time input text

    - by picnic4u
    i have a problem regarding the textbox. i have done the textbox auto expandable but when i insert the text first time then the textbox shrink in size from their original size.but my requirement is that when my text is exceeding the text box length then it auto expand. my code is <script type="text/javascript"> $(document).ready(function() { $('.txtStyle').autogrow(); }); </script> pls somebody suggest how ot is possible

    Read the article

  • Android: how to get the walking distance between two geo coordinats?

    - by wei
    I used this query URL http://maps.google.com/maps?q=from+A+to+B&output=kml ,which is given in the answer to this question. But after I tried it, it doesn't work with coordinates. It works with address names tho. I guess I could use google's geocoding to get the addresses first. But I wonder if there is another way to get the walking distance between two coordinates?

    Read the article

  • error working with wsdl files in visual studio 2008

    - by deostroll
    Hi. I got a wsdl file in email. At first I didn't know how to use it. I've simply saved the file to my disk. Opened visual studio...added a service reference...provided path to file, and service was discovered. I opened the object browser to see the types and methods that got imported. I figure anything that ends with the name 'Client' is a good place to start using the web service. I've tried using a simple method to get data but it has run into and expception. Need help in resolving it. System.InvalidOperationException was unhandled Message="The XML element 'ListsRequest' from namespace 'http://www.asd.org/MGMMIRAGE.MDM.WS/Customer' references a method and a type. Change the method's message name using WebMethodAttribute or change the type's root element using the XmlRootAttribute." Source="System.Xml" StackTrace: at System.Xml.Serialization.XmlReflectionImporter.ReconcileAccessor(Accessor accessor, NameTable accessors) at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel, XmlMappingAccess access) at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean openModel) at System.Xml.Serialization.XmlReflectionImporter.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc) at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.XmlSerializerImporter.ImportMembersMapping(XmlName elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, Boolean isEncoded, String mappingKey) at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.ImportMembersMapping(String elementName, String ns, XmlReflectionMember[] members, Boolean hasWrapperElement, Boolean rpc, String mappingKey) at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.LoadBodyMapping(MessageDescription message, String mappingKey, MessagePartDescriptionCollection& rpcEncodedTypedMessageBodyParts) at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.CreateMessageInfo(MessageDescription message, String key) at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.EnsureMessageInfos() at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.EnsureMessageInfos() at System.ServiceModel.Description.XmlSerializerOperationBehavior.Reflector.OperationReflector.get_Request() at System.ServiceModel.Description.XmlSerializerOperationBehavior.CreateFormatter() at System.ServiceModel.Description.XmlSerializerOperationBehavior.System.ServiceModel.Description.IOperationBehavior.ApplyClientBehavior(OperationDescription description, ClientOperation proxy) at System.ServiceModel.Description.DispatcherBuilder.BindOperations(ContractDescription contract, ClientRuntime proxy, DispatchRuntime dispatch) at System.ServiceModel.Description.DispatcherBuilder.ApplyClientBehavior(ServiceEndpoint serviceEndpoint, ClientRuntime clientRuntime) at System.ServiceModel.Description.DispatcherBuilder.BuildProxyBehavior(ServiceEndpoint serviceEndpoint, BindingParameterCollection& parameters) at System.ServiceModel.Channels.ServiceChannelFactory.BuildChannelFactory(ServiceEndpoint serviceEndpoint) at System.ServiceModel.ChannelFactory.CreateFactory() at System.ServiceModel.ChannelFactory.OnOpening() at System.ServiceModel.Channels.CommunicationObject.Open(TimeSpan timeout) at System.ServiceModel.ChannelFactory.EnsureOpened() at System.ServiceModel.ChannelFactory`1.CreateChannel(EndpointAddress address, Uri via) at System.ServiceModel.ChannelFactory`1.CreateChannel() at System.ServiceModel.ClientBase`1.CreateChannel() at System.ServiceModel.ClientBase`1.CreateChannelInternal() at System.ServiceModel.ClientBase`1.get_Channel() at MDMWSDemo.MDMWebSrvc.MGMCustomerSoapPortTypeClient.MDMWSDemo.MDMWebSrvc.MGMCustomerSoapPortType.CountryCodeGet(CountryCodeGetRequest request) in C:\Documents and Settings\tbhagava01\My Documents\Visual Studio 2008\Projects\MDMWSDemo\MDMWSDemo\Service References\MDMWebSrvc\Reference.cs:line 2983 at MDMWSDemo.MDMWebSrvc.MGMCustomerSoapPortTypeClient.CountryCodeGet(String countryCode) in C:\Documents and Settings\tbhagava01\My Documents\Visual Studio 2008\Projects\MDMWSDemo\MDMWSDemo\Service References\MDMWebSrvc\Reference.cs:line 2989 at MDMWSDemo.Program.Main(String[] args) in C:\Documents and Settings\tbhagava01\My Documents\Visual Studio 2008\Projects\MDMWSDemo\MDMWSDemo\Program.cs:line 15 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:

    Read the article

  • Python - Converting CSV to Objects - Code Design

    - by victorhooi
    Hi, I have a small script we're using to read in a CSV file containing employees, and perform some basic manipulations on that data. We read in the data (import_gd_dump), and create an Employees object, containing a list of Employee objects (maybe I should think of a better naming convention...lol). We then call clean_all_phone_numbers() on Employees, which calls clean_phone_number() on each Employee, as well as lookup_all_supervisors(), on Employees. import csv import re import sys #class CSVLoader: # """Virtual class to assist with loading in CSV files.""" # def import_gd_dump(self, input_file='Gp Directory 20100331 original.csv'): # gd_extract = csv.DictReader(open(input_file), dialect='excel') # employees = [] # for row in gd_extract: # curr_employee = Employee(row) # employees.append(curr_employee) # return employees # #self.employees = {row['dbdirid']:row for row in gd_extract} # Previously, this was inside a (virtual) class called "CSVLoader". # However, according to here (http://tomayko.com/writings/the-static-method-thing) - the idiomatic way of doing this in Python is not with a class-fucntion but with a module-level function def import_gd_dump(input_file='Gp Directory 20100331 original.csv'): """Return a list ('employee') of dict objects, taken from a Group Directory CSV file.""" gd_extract = csv.DictReader(open(input_file), dialect='excel') employees = [] for row in gd_extract: employees.append(row) return employees def write_gd_formatted(employees_dict, output_file="gd_formatted.csv"): """Read in an Employees() object, and write out each Employee() inside this to a CSV file""" gd_output_fieldnames = ('hrid', 'mail', 'givenName', 'sn', 'dbcostcenter', 'dbdirid', 'hrreportsto', 'PHFull', 'PHFull_message', 'SupervisorEmail', 'SupervisorFirstName', 'SupervisorSurname') try: gd_formatted = csv.DictWriter(open(output_file, 'w', newline=''), fieldnames=gd_output_fieldnames, extrasaction='ignore', dialect='excel') except IOError: print('Unable to open file, IO error (Is it locked?)') sys.exit(1) headers = {n:n for n in gd_output_fieldnames} gd_formatted.writerow(headers) for employee in employees_dict.employee_list: # We're using the employee object's inbuilt __dict__ attribute - hmm, is this good practice? gd_formatted.writerow(employee.__dict__) class Employee: """An Employee in the system, with employee attributes (name, email, cost-centre etc.)""" def __init__(self, employee_attributes): """We use the Employee constructor to convert a dictionary into instance attributes.""" for k, v in employee_attributes.items(): setattr(self, k, v) def clean_phone_number(self): """Perform some rudimentary checks and corrections, to make sure numbers are in the right format. Numbers should be in the form 0XYYYYYYYY, where X is the area code, and Y is the local number.""" if self.telephoneNumber is None or self.telephoneNumber == '': return '', 'Missing phone number.' else: standard_format = re.compile(r'^\+(?P<intl_prefix>\d{2})\((?P<area_code>\d)\)(?P<local_first_half>\d{4})-(?P<local_second_half>\d{4})') extra_zero = re.compile(r'^\+(?P<intl_prefix>\d{2})\(0(?P<area_code>\d)\)(?P<local_first_half>\d{4})-(?P<local_second_half>\d{4})') missing_hyphen = re.compile(r'^\+(?P<intl_prefix>\d{2})\(0(?P<area_code>\d)\)(?P<local_first_half>\d{4})(?P<local_second_half>\d{4})') if standard_format.search(self.telephoneNumber): result = standard_format.search(self.telephoneNumber) return '0' + result.group('area_code') + result.group('local_first_half') + result.group('local_second_half'), '' elif extra_zero.search(self.telephoneNumber): result = extra_zero.search(self.telephoneNumber) return '0' + result.group('area_code') + result.group('local_first_half') + result.group('local_second_half'), 'Extra zero in area code - ask user to remediate. ' elif missing_hyphen.search(self.telephoneNumber): result = missing_hyphen.search(self.telephoneNumber) return '0' + result.group('area_code') + result.group('local_first_half') + result.group('local_second_half'), 'Missing hyphen in local component - ask user to remediate. ' else: return '', "Number didn't match recognised format. Original text is: " + self.telephoneNumber class Employees: def __init__(self, import_list): self.employee_list = [] for employee in import_list: self.employee_list.append(Employee(employee)) def clean_all_phone_numbers(self): for employee in self.employee_list: #Should we just set this directly in Employee.clean_phone_number() instead? employee.PHFull, employee.PHFull_message = employee.clean_phone_number() # Hmm, the search is O(n^2) - there's probably a better way of doing this search? def lookup_all_supervisors(self): for employee in self.employee_list: if employee.hrreportsto is not None and employee.hrreportsto != '': for supervisor in self.employee_list: if supervisor.hrid == employee.hrreportsto: (employee.SupervisorEmail, employee.SupervisorFirstName, employee.SupervisorSurname) = supervisor.mail, supervisor.givenName, supervisor.sn break else: (employee.SupervisorEmail, employee.SupervisorFirstName, employee.SupervisorSurname) = ('Supervisor not found.', 'Supervisor not found.', 'Supervisor not found.') else: (employee.SupervisorEmail, employee.SupervisorFirstName, employee.SupervisorSurname) = ('Supervisor not set.', 'Supervisor not set.', 'Supervisor not set.') #Is thre a more pythonic way of doing this? def print_employees(self): for employee in self.employee_list: print(employee.__dict__) if __name__ == '__main__': db_employees = Employees(import_gd_dump()) db_employees.clean_all_phone_numbers() db_employees.lookup_all_supervisors() #db_employees.print_employees() write_gd_formatted(db_employees) Firstly, my preamble question is, can you see anything inherently wrong with the above, from either a class design or Python point-of-view? Is the logic/design sound? Anyhow, to the specifics: The Employees object has a method, clean_all_phone_numbers(), which calls clean_phone_number() on each Employee object inside it. Is this bad design? If so, why? Also, is the way I'm calling lookup_all_supervisors() bad? Originally, I wrapped the clean_phone_number() and lookup_supervisor() method in a single function, with a single for-loop inside it. clean_phone_number is O(n), I believe, lookup_supervisor is O(n^2) - is it ok splitting it into two loops like this? In clean_all_phone_numbers(), I'm looping on the Employee objects, and settings their values using return/assignment - should I be setting this inside clean_phone_number() itself? There's also a few things that I'm sorted of hacked out, not sure if they're bad practice - e.g. print_employee() and gd_formatted() both use __dict__, and the constructor for Employee uses setattr() to convert a dictionary into instance attributes. I'd value any thoughts at all. If you think the questions are too broad, let me know and I can repost as several split up (I just didn't want to pollute the boards with multiple similar questions, and the three questions are more or less fairly tightly related). Cheers, Victor

    Read the article

  • how convert DataTable to List<String> in C#

    - by Jitendra Jadav
    Hello Everyone .. I am using C# Linq now I am converting DataTable to List and I am getting stuck... give me right direction thanks.. private void treeview1_Expanded(object sender, RoutedEventArgs e) { coa = new List<string>(); //coa = (List<string>)Application.Current.Properties["CoAFull"]; HMDAC.Hmclientdb db = new HMDAC.Hmclientdb(HMBL.Helper.GetDBPath()); var data = (from a in db.CoA where a.ParentId == 0 && a.Asset == true select new { a.Asset, a.Category, a.CoAName, a.Hide, a.Recurring, a.TaxApplicable }); DataTable dtTable = new DataTable(); dtTable.Columns.Add("Asset", typeof(bool)); dtTable.Columns.Add("Category", typeof(string)); dtTable.Columns.Add("CoAName", typeof(string)); dtTable.Columns.Add("Hide", typeof(bool)); dtTable.Columns.Add("Recurring", typeof(bool)); dtTable.Columns.Add("TaxApplicable", typeof(bool)); if (data.Count() > 0) { foreach (var item in data) { DataRow dr = dtTable.NewRow(); dr["Asset"] = item.Asset; dr["Category"] = item.Category; dr["CoAName"] = item.CoAName; dr["Hide"] = item.Hide; dr["Recurring"] = item.Recurring; dr["TaxApplicable"] = item.TaxApplicable; dtTable.Rows.Add(dr); } } coa = dtTable; }

    Read the article

  • bluetooth file send.

    - by cheesebunz
    i'm new to bluetooth development and i found the 32netfeet . Right now i'm able to search for bluetooth devices nearby and connect to them but how do i send a file e.g SendTest.txt? I tried buttonclick event using the OBEX but i don't understand this is my example code: using InTheHand.Net; using InTheHand.Net.Sockets; using InTheHand.Net.Bluetooth; namespace BluetoothIntheHand { public partial class Form2 : Form { private Guid service = BluetoothService.DialupNetworking; private BluetoothClient bluetoothClient; public Form2() { InitializeComponent(); } private void btnSearch_Click(object sender, EventArgs e) { BluetoothRadio.PrimaryRadio.Mode = RadioMode.Discoverable; BluetoothRadio myRadio = BluetoothRadio.PrimaryRadio; lblSearch.Text = "" + myRadio.LocalAddress.ToString(); bluetoothClient = new BluetoothClient(); Cursor.Current = Cursors.WaitCursor; BluetoothDeviceInfo[] bluetoothDeviceInfo = { }; bluetoothDeviceInfo = bluetoothClient.DiscoverDevices(10); comboBox1.DataSource = bluetoothDeviceInfo; comboBox1.DisplayMember = "DeviceName"; comboBox1.ValueMember = "DeviceAddress"; comboBox1.Focus(); Cursor.Current = Cursors.Default; } private void btnConnect_Click(object sender, EventArgs e) { if (comboBox1.SelectedValue != null) { try { bluetoothClient.Connect(new BluetoothEndPoint((BluetoothAddress)comboBox1.SelectedValue, service)); MessageBox.Show("Connected"); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } private void btnSend_Click(object sender, EventArgs e) { bluetoothClient.Connect(new BluetoothEndPoint((BluetoothAddress)comboBox1.SelectedValue, service)); String addr = "112233445566"; Uri uri = new Uri("obex://"+@"SendTest.txt"); ObexWebRequest req= new ObexWebRequest(uri); ObexWebResponse rsp; } I found the guide but don't really know how to convert to C# ' The host part of the URI is the device address, e.g. IrDAAddress.ToString(), ' and the file part is the OBEX object name. Dim addr As String = "112233445566" Dim uri As New Uri("obex://" & addr & "/HelloWorld2.txt") Dim req As New ObexWebRequest(uri) Using content As Stream = req.GetRequestStream() ' Using a StreamWriter to write text to the stream... Using wtr As New StreamWriter(content) wtr.WriteLine("Hello World GetRequestStream") wtr.WriteLine("Hello World GetRequestStream 2") wtr.Flush() ' Set the Length header value req.ContentLength = content.Length End Using ' In this case closing the StreamWriter also closed the Stream, but ... End Using Dim rsp As ObexWebResponse = CType(req.GetResponse(),ObexWebResponse) Console.WriteLine("Response Code: {0} (0x{0:X})", rsp.StatusCode)

    Read the article

  • Incompatible type in assignment

    - by coure06
    Getting error: Incompatible type in assignment at fValue = ..., see the code static float t = 0; float d = .5; static float fValue = 0; fValue = [self easeOutBounce:t andB:0 andC:30 andD:d]; here is the method -(float) easeOutBounce:(float)t andB:(float)b andC:(float)c andD:(float)d { if ((t/=d) < (1/2.75)) { return c*(7.5625*t*t) + b; } else if (t < (2/2.75)) { return c*(7.5625*(t-=(1.5/2.75))t + .75) + b; } else if (t < (2.5/2.75)) { return c(7.5625*(t-=(2.25/2.75))t + .9375) + b; } else { return c(7.5625*(t-=(2.625/2.75))*t + .984375) + b; } }

    Read the article

  • Resources/Teaching ideas to teach computers to kids

    - by Shravan
    A small initiative from my work place plans to teach very basic computers to not so fortunate kids. I was looking for some very basic topics/resources. These kids are very young and have not seen/worked with a computer before. The fun factor should not be lost and hence I don't want it to be rigorous, just plain, what is computer, keyboard, mouse, browser, where to look for what (google.com) and so on. Has any-one done this sort of thing before, if yes, could you point me to some resources.

    Read the article

  • javamail api isertion of main class help

    - by bobby
    import javax.servlet.*; import javax.servlet.http.*; import java.io.*; import javax.mail.*; import javax.mail.internet.*; import javax.mail.event.*; import javax.mail.Authenticator; import java.net.*; import java.util.*; public class servletmail extends HttpServlet { public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException { PrintWriter out=response.getWriter(); response.setContentType("text/html"); try { Properties props=new Properties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.host","smtp.googlemail.com"); props.put("mail.smtp.port", "995"); props.put("mail.smtp.auth", "true"); javax.mail.Authenticator authenticator = new javax.mail.Authenticator() { protected javax.mail.PasswordAuthentication getPasswordAuthentication() { return new javax.mail.PasswordAuthentication("[email protected]", "password"); } }; Session sess=Session.getDefaultInstance(props,authenticator); sess.setDebug (true); Transport transport =sess.getTransport ("smtp"); Message msg=new MimeMessage(sess); msg.setFrom(new InternetAddress("[email protected]")); msg.addRecipient(Message.RecipientType.TO, new InternetAddress("[email protected]")); msg.setSubject("Hello JavaMail"); msg.setText("Welcome to JavaMail"); transport.connect(); transport.send(msg); out.println("mail has been sent"); } catch(Exception e) { System.out.println("err"+e); } } } how to insert main class in above java code and how to pass arguments of "from" and "to"

    Read the article

  • XML strings in JAXB

    - by OOO
    I have a JPA entity class mimicking a table. Something like this: @XmlType(name="MyClassElementType") public class MyClass { String name; String xmlDesc; public MyClass() {} @XmlElement String getName() { return name; } void setName(String name) { this.name = name; } @XmlElement String getXmlDesc() { return xmlDesc; } void setXmlDesc(String xmlDesc) { this.xmlDesc = xmlDesc; } } In a Jersey REST get call I'm trying to return this class: @Get @Produces("application/xml") public MyClass get() { return myClass; } Now I'm expecting the already xml string(xmlStr) to be returned as is, but Jersey/JAXB escapes it... So anyway around this?

    Read the article

  • How to organize Enterprise scale Composite Applications (CAG)

    - by David
    All QuickStarts and RI examples in the CAG documentation are good but I lack the more Enterprise scale examples. Let's say we have 40+ modules, each containing a Proxy,Facade,PresentationModel,Model and Views. Each module also makes calls to a Module-specific WCF service which is to be hosted in IIS or in a stand-alone console host. Our approach have been to include the UI-module, service-module and related tests into one solution so they can be developed and tested separately from other modules. My problem is how the hosting of the services should be done when the services are in separate modules and how to actually run the separate module together with the rest of the application-modules when I press F5. Is there a best practise for this? I guess it has been done before?

    Read the article

  • Why is 'virtual' optional for overridden methods in derived classes?

    - by squelart
    When a method is declared as virtual in a class, its overrides in derived classes are automatically considered virtual as well, and the C++ language makes this keyword virtual optional in this case: class Base { virtual void f(); }; class Derived : public Base { void f(); // 'virtual' is optional but implied. }; My question is: What is the rationale for making virtual optional? I know that it is not absolutely necessary for the compiler to be told that, but I would think that developers would benefit if such a constraint was enforced by the compiler. E.g., sometimes when I read others' code I wonder if a method is virtual and I have to track down its superclasses to determine that. And some coding standards (Google) make it a 'must' to put the virtual keyword in all subclasses.

    Read the article

  • sorting in python

    - by tipu
    I have a hashmap like so: results[tweet_id] = {"score" : float(dot(query,doc) / (norm(query) * norm(doc))), "tweet" : tweet} What I'd like to do is to sort results by the innser "score" key. I don't know how possible this is, I saw many sorting tutorials but they were for simple (not nested) data structures.

    Read the article

  • Lucene based database search engine

    - by Abhay
    Hi All, I am planing to add search feature in my web application. Now the items that will be searched are strored in a Relational database. In order to achieve a full text search engine I have following doubts : For database based search engine should I use just lucene or some other utility based on Luncene like Solr, luSql, Compass etc. In case of Solr, can it be embeded in to the web applcation rather than deploying it as a seaparate WAR. Thanks for your time. regards

    Read the article

  • displaying jpg image via jquery ajax call

    - by Sobek
    Hi, I want to show images that are requested from a binary field (blob) out of a mysql database. They are retrieved by a PHP script and outputs a 'real' jpeg image i.e. header('Content-Type') = 'image/jpeg'. This is working. But how can i intercept this image that is being made by an ajax call ?

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >