Search Results

Search found 62 results on 3 pages for 'anurag kapur'.

Page 1/3 | 1 2 3  | Next Page >

  • Convert sqlalchemy row object to python dict

    - by Anurag Uniyal
    or a simple way to iterate over columnName, value pairs? My version of sqlalchemy is 0.5.6 Here is the sample code where I tried using dict(row), but it throws exception , TypeError: 'User' object is not iterable import sqlalchemy from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker print "sqlalchemy version:",sqlalchemy.__version__ engine = create_engine('sqlite:///:memory:', echo=False) metadata = MetaData() users_table = Table('users', metadata, Column('id', Integer, primary_key=True), Column('name', String), ) metadata.create_all(engine) class User(declarative_base()): __tablename__ = 'users' id = Column(Integer, primary_key=True) name = Column(String) def __init__(self, name): self.name = name Session = sessionmaker(bind=engine) session = Session() user1 = User("anurag") session.add(user1) session.commit() # uncommenting next line throws exception 'TypeError: 'User' object is not iterable' #print dict(user1) # this one also throws 'TypeError: 'User' object is not iterable' for u in session.query(User).all(): print dict(u) Running this code on my system outputs: sqlalchemy version: 0.5.6 Traceback (most recent call last): File "untitled-1.py", line 37, in <module> print dict(u) TypeError: 'User' object is not iterable

    Read the article

  • problem in adding data to an array in Objective-C!!!

    - by anurag
    I am grappling with adding an NSData object to a NSMutable array. The code is executing fine but it is not adding the objects in the array.The code is as follows: NSData * imageData = UIImageJPEGRepresentation(img, 1.0); int i=0; do{ if([[tempArray objectAtIndex:i] isEqual:imageData]) { [tempArray removeObjectAtIndex:i]; } else { [tempArray addObject:imageData]; //NSLog(@"ANURAG %@",[tempArray objectAtIndex:0]); } }while(i<[tempArray count]) ; The NSLog statement shows the object added is null however the value of imageData is not null. I have defined the tempArray as a static memeber of the class in which this code is written. Is it because of the size of the data object as it is the data of an image????

    Read the article

  • How can I configure apigee to fail stale if the backend is unavialble?

    - by Anurag Kapur
    We have an API proxy configured with cache ttl of 2mins. Is it possible to configure apigee to serve stale cached content if the backend goes down so that our end users don't see errors? We would rather have our end users get copies of stale cached content (even after the configured ttl of 2mins expires) instead of errors when the backend goes down. Would appreciate if someone could point me to the relevant documentation if this is possible.

    Read the article

  • Innovating with Customer Needs Management

    - by Anurag Batra
    We're pleased to announce the addition of Agile Customer Needs Management (CNM) to the portfolio of PLM offerings by Oracle. CNM allows manufacturing companies to capture the voice of the customer and market, and arm their product designers with the information that they need to better meet customer requirements. It's an Enterprise 2.0 product that focuses on the quick information capture, ease of organizing information and association of that information with the product record - some of the key aspects of early stage innovation. Read on to learn more about this revolutionary new product that redefines how information is used to drive innovation.

    Read the article

  • Command-line to list DNS servers

    - by Anurag Uniyal
    Is there a command to list dns servers? I tried $ cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 127.0.0.1 $ cat /etc/network/interfaces # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback But it doesn't list any servers, if I go to "Network GUI Tool", in Wireless section it lists "DNS 192.168.1.1 8.8.8.8 8.8.4.4" Can I get same information from command line? I am using Ubuntu 12.04 LTS

    Read the article

  • unable to connect mobile broadband ubuntu 12.10

    - by Anurag Srivastava
    i recently installed ubuntu 12.10 on my desktop. now the mobile connection was not working, which i later found out to be a bug in modem manger so i downgraded it to v0.5.2 but still the problem persists. whenever i try connecting, the mobile broadband option gets automatically disabled. i have a bsnl EVDO connection, which i had to manually configure as the device was not automatically detected at first.

    Read the article

  • Job Change Problem [closed]

    - by Anurag Jain
    I joined an organisation in April 2010. I just changed my job in January 2012. I was previously working with Java. But in my current organisation, the work is not in java. They told me in the interview that the work will be use Java technology. But this is not the case. I dont want to lose my previous Java experience. And moreover, in my current company , I am working on a language which is not used anywhere. I want to change again. Can anyone please help and guide me that will there be any issue now in changing the job again.?

    Read the article

  • How to Set Up an Online Ecommerce Store

    Online Ecommerce stores are gaining popularity these days. Their business is achieving exceptional heights. The reason behind their success is the lack of time that people in the present world have. ... [Author: Anurag Gupta - Web Design and Development - May 11, 2010]

    Read the article

  • Windows 8.1 Enterprise Sysprep Error

    - by Anurag Shetti
    I am Trying to sysprep my WIndows 8.1 enterprise (MSDN) and i get the following errors I have upgraded the Windows 8 to windows 8.1 and the machine contains all the configuration for VS 2012 and rest Exact error Sysprep was not able to validate your windows installation Error msg line in log C:\Users\André>err 0x8007139f # as an HRESULT: Severity: FAILURE (1), FACILITY_WIN32 (0x7), Code 0x139f # for hex 0x139f / decimal 5023 ERROR_INVALID_STATE winerror.h # The group or resource is not in the correct state to # perform the requested operation. # 1 matches found for "0x8007139f" SYSPRP ActionPlatform::GetValue: Error from RegQueryValueEx on value SysprepMode under key HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup\Sysprep; dwRet = 0x2 I have searched the HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Setup\Sysprep But i coud'nt find anything for SYSprep mode The value for sysprep was (Value not set)

    Read the article

  • df -h showing wrong output in GB

    - by Anurag Uniyal
    If I list df output for KB, MB and GB, they do not match e.g. $ df -k |grep xvdb /dev/xvdb1 12796048 732812 11413172 7% /xxx $ df -m |grep xvdb /dev/xvdb1 12497 716 11146 7% /xxx $ df -h |grep xvdb /dev/xvdb1 13G 716M 11G 7% /xxx 12796048 KB = 12496.14 MB so that is slight off but OK 12796048 KB = 12.2 GB, 12407 MB is also 12.2 GB so why df is showing 13 GB or am I missing something? Here is full df listing $ df -h Filesystem Size Used Avail Use% Mounted on /dev/xvda1 7.5G 1.7G 5.5G 24% / none 5.8G 128K 5.8G 1% /dev none 5.8G 0 5.8G 0% /dev/shm none 5.8G 44K 5.8G 1% /var/run none 5.8G 0 5.8G 0% /var/lock none 5.8G 0 5.8G 0% /lib/init/rw /dev/xvdb1 13G 716M 11G 6% /xxx Coreutils version seems to 7.4 as info coreutils shows This manual documents version 7.4 of the GNU core utilities,

    Read the article

  • TCP failure on Solaris

    - by anurag kohli
    Hi All, I recently ran into a problem where a Solaris server could not establish a TCP socket on port 2126. From a packet capture I see this (note: A is a Solaris server, B is a router): A sends SYN to B B sends SYN, ACK to A Notice A (Solaris) does not acknowledge the SYN from B. Due to the business impact of the problem, I had to reboot the server to fix the problem. That said, I want to know the next time the problem occurs, what can I do to get a root cause (ie before server reboot)? Thanks in advance.

    Read the article

  • Solaris 10: cannot ping to/from server

    - by anurag kohli
    All, I have a Solaris 10 server which is not reachable by IP (ie can't ping to/from the server). I believe I have the default route setup correctly. See below: # ifconfig -a lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1 inet 127.0.0.1 netmask ff000000 bge0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 1500 index 2 inet 192.168.62.100 netmask ffffff00 broadcast 192.168.62.255 ether 0:14:4f:b1:9b:30 # netstat -rn Routing Table: IPv4 Destination Gateway Flags Ref Use Interface -------------------- -------------------- ----- ----- ------ --------- 192.168.62.0 192.168.62.100 U 1 40 bge0 224.0.0.0 192.168.62.100 U 1 0 bge0 default 192.168.62.1 UG 1 0 127.0.0.1 127.0.0.1 UH 1 4 lo0 # # cat /etc/defaultrouter 192.168.62.1 I have verified layer1 and layer 2 are up on the switchport, and that it's on the correct VLAN. I have also checked the default gateawy (192.168.62.1) is in fact reachable since I can ping it from my PC: Pinging 192.168.62.1 with 32 bytes of data: Reply from 192.168.62.1: bytes=32 time=1ms TTL=254 Reply from 192.168.62.1: bytes=32 time=1ms TTL=254 Reply from 192.168.62.1: bytes=32 time=3ms TTL=254 Reply from 192.168.62.1: bytes=32 time=6ms TTL=254 I'm at a loss as to what is wrong. I would highly appreciated your assistance. Thank you very much.

    Read the article

  • What does transactions per seconds for a load balancer mean

    - by Anurag
    I was looking at the product matrix of webmux 592G(load balancer). It says maximum connections per sec = 2.8M Maximum number of transactions = 100,000 What does the above numbers mean. Does above means that load balancer can have 2.8M connections open but only 100K of them will be active per seconds. Also incase any one has used webmux 592G do you guys know in practice how many connections it can have open and what qps it can serve

    Read the article

  • Javascript object dependencies

    - by Anurag
    In complex client side projects, the number of Javascript files can get very large. However, for performance reasons it's good to concatenate these files, and compress the resulting file for sending over the wire. I am having problems in concatenating these as the dependencies are included after they are needed in some cases. For instance, there are 2 files: /modules/Module.js <requires Core.js> /modules/core/Core.js The directories are recursively traversed, and Module.js gets included before Core.js, which causes errors. This is just a simple example where dependencies could span across directories, and there could be other complex cases. There are no circular dependencies though. The Javascript structure I follow is similar to Java packages, where each file defines a single Object (I'm using MooTools, but that's irrelevant). The structure of each javascript file and the dependencies is always consistent: Module.js var Module = new Class({ Implements: Core, ... }); Core.js var Core = new Class({ ... }); What practices do you usually follow to handle dependencies in projects where the number of Javascript files is huge, and there are inter-file dependencies?

    Read the article

  • StAX - Setting the version and encoding using XMLStreamWriter

    - by Anurag
    Hi, I am using StAX for creating XML files and then validating the file with and XSD. I am getting an error while creating the XML file: javax.xml.stream.XMLStreamException: Underlying stream encoding 'Cp1252' and input paramter for writeStartDocument() method 'UTF-8' do not match. at com.sun.xml.internal.stream.writers.XMLStreamWriterImpl.writeStartDocument(XMLStreamWriterImpl.java:1182) Here is the code snippet: XMLOutputFactory xof = XMLOutputFactory.newInstance(); try{ XMLStreamWriter xtw = xof.createXMLStreamWriter(new FileWriter(fileName)); xtw.writeStartDocument("UTF-8","1.0");} catch(XMLStreamException e) { e.printStackTrace(); } catch(IOException ie) { ie.printStackTrace(); } I am running this code on unix. Does anybody know how to set the version and encoding style.

    Read the article

  • Memory leak with JAXB

    - by Anurag
    Hi, I am getting Out of Memory error: Memory Exception in thread "main" java.lang.OutOfMemoryError: Java heap space at org.apache.xerces.dom.CoreDocumentImpl.createElement(CoreDocumentImpl.java:564) I have a standalone Java program which fetches data from DB and create an XML file using DOM. I get the above error if the data fetched is huge, in my case it is 1,000,000 records. I have defined 2GB as heap size while calling the Java class from unix. I tried it with JAXB, but still do not any significant improvement. Any suggestions how to improve the code.

    Read the article

  • extjs add plugins to dynamic form fields

    - by Anurag Uniyal
    I am creating a form dynamically from the fields returned from server using json e.g. data is "items": [ {"xtype": "textfield", "fieldLabel": "Name", "name": "name"}, {"xtype": "textfield", "fieldLabel": "Description", "name": "description"}, {"xtype": "textarea", "fieldLabel": "Text", "name": "text"} ], Now I want to add a custom plugin to each field usually on client side I do this plugins:new Ext.ux.plugins.MyPlugin() but as my form fields are coming from server, how can I add plugin to field e.g. something like this (but that doesn't work) "plugins": "Ext.ux.plugins.MyPlugin"

    Read the article

  • JAXB - How to add xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance

    - by Anurag
    I am using JAXB to create XML file from a result set. I have created java/ /class files using the xsd with the help of xjc utiliy. Now I am trying to create the xml file using the Marshaller. In the XML file I do not see theh xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" attribute with the root tag. My xsd Below is the code : public class JAXBConstructor { public void generateXMLDocument(File xmlDocument){ try { JAXBContext jaxbContext = JAXBContext.newInstance("com"); Marshaller marshaller = jaxbContext.createMarshaller(); marshaller.setProperty(Marshaller.JAXB_FRAGMENT, true); marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true); com.ObjectFactory factory = new com.ObjectFactory(); USERTASKSImpl userTasks =(USERTASKSImpl)(factory.createUSERTASKS()); USERTASKTypeImpl userTaskType = (USERTASKTypeImpl)(factory.createUSERTASKSTypeUSERTASKType()); userTaskType.setName("zmannan"); userTaskType.setCode("G5023920"); java.util.List userTaskList=userTasks.getUSERTASK(); userTaskList.add(userTaskType); marshaller.marshal(userTasks, new FileOutputStream("User_Task.xml")); } Output of the code : This does not contain the XMLSchema value - < ?xml version="1.0" encoding="UTF-8" standalone="yes"? < USER_TASKS xmlns="http://schemas.jpmchase.net/Recertification" < CodeG5023920< /Code < Namezmannan< /Name < /USER_TASK < /USER_TASKS Please help how can I add the schema-instance value in the rrot tag.

    Read the article

  • Should I mix wxpython and pyobjc ?

    - by Anurag Uniyal
    I have a wxPython based app which I am porting to Mac OS X, in that I need to show some alerts which should look like native mac alerts, so I am using pyobjc for that e.g. import Cocoa import wx app = wx.PySimpleApp() frame = wx.Frame(None, title="mac alert test") app.SetTopWindow(frame) frame.Show() def onclick(event): Cocoa.CFUserNotificationDisplayAlert(0, 3, 0, 0, 0, "Should i mix wxpython and objc", "hmmm...", "Cool", "Not Cool", "Whatever") frame.Bind(wx.EVT_LEFT_DOWN, onclick) app.MainLoop() Is there any thing wrong in such mixing of wx and objc code, any failure points ?

    Read the article

  • Add table of contents to RTF document

    - by Anurag Uniyal
    I am trying to generate a RTF document by hand and eventually will do it programtically. I plan to improve pyRTF so that it can generate "Table of contents", which I think it can't. I am not able to use RTF controls words (\tc, \tcf and \tcl.) to generate a TOC. http://msdn.microsoft.com/en-us/library/aa140283(office.10).aspx gives details about TOC but I couldn't find or make any example RTF which have a TOC. So is there a simple sample showing a RTF with TOC?

    Read the article

  • Designing a fluid Javascript interface to abstract away the asynchronous nature of AJAX

    - by Anurag
    How would I design an API to hide the asynchronous nature of AJAX and HTTP requests, or basically delay it to provide a fluid interface. To show an example from Twitter's new Anywhere API: // get @ded's first 20 statuses, filter only the tweets that // mention photography, and render each into an HTML element T.User.find('ded').timeline().first(20).filter(filterer).each(function(status) { $('div#tweets').append('<p>' + status.text + '</p>'); }); function filterer(status) { return status.text.match(/photography/); } vs this (asynchronous nature of each call is clearly visible) T.User.find('ded', function(user) { user.timeline(function(statuses) { statuses.first(20).filter(filterer).each(function(status) { $('div#tweets').append('<p>' + status.text + '</p>'); }); }); }); It finds the user, gets their tweet timeline, filters only the first 20 tweets, applies a custom filter, and ultimately uses the callback function to process each tweet. I am guessing that a well designed API like this should work like a query builder (think ORMs) where each function call builds the query (HTTP URL in this case), until it hits a looping function such as each/map/etc., the HTTP call is made and the passed in function becomes the callback. An easy development route would be to make each AJAX call synchronous, but that's probably not the best solution. I am interested in figuring out a way to make it asynchronous, and still hide the asynchronous nature of AJAX.

    Read the article

  • MooTools Event Delegation using HTML5 data attributes.

    - by Anurag
    Is it possible to have event delegation using the HTML5 data attributes in MooTools? The HTML structure I have is: ?<div id="parent"> <div>not selectable</div> <div data-selectable="true">selectable</div> <div>not selectable either.</div> <div data-selectable="true">also selectable</div> </div>???????????????????????????????????????????????????????????????????????? And I want to setup <div id="parent"> to listen to all clicks only on child elements that have the data-selected attribute. Please let me know if I'm doing something wrong: The events are being setup as: $("parent").addEvent("click:relay([data-selectable])", function(event, el) { alert(this.get('text')); }); but the click callback is fired on clicking all div's, not just the ones with a data-selectable attribute defined. You can see this example on http://jsfiddle.net/NUGD4/ A workaround is to adding this as a CSS class, which works with delegation but I would prefer to be able to use data-attributes as it's used throughout the application.

    Read the article

  • How would you organize a large complex web application (see basic example)?

    - by Anurag
    How do you usually organize complex web applications that are extremely rich on the client side. I have created a contrived example to indicate the kind of mess it's easy to get into if things are not managed well for big apps. Feel free to modify/extend this example as you wish - http://jsfiddle.net/NHyLC/1/ The example basically mirrors part of the comment posting on SO, and follows the following rules: Must have 15 characters minimum, after multiple spaces are trimmed out to one. If Add Comment is clicked, but the size is less than 15 after removing multiple spaces, then show a popup with the error. Indicate amount of characters remaining and summarize with color coding. Gray indicates a small comment, brown indicates a medium comment, orange a large comment, and red a comment overflow. One comment can only be submitted every 15 seconds. If comment is submitted too soon, show a popup with appropriate error message. A couple of issues I noticed with this example. This should ideally be a widget or some sort of packaged functionality. Things like a comment per 15 seconds, and minimum 15 character comment belong to some application wide policies rather than being embedded inside each widget. Too many hard-coded values. No code organization. Model, Views, Controllers are all bundled together. Not that MVC is the only approach for organizing rich client side web applications, but there is none in this example. How would you go about cleaning this up? Applying a little MVC/MVP along the way? Here's some of the relevant functions, but it will make more sense if you saw the entire code on jsfiddle: /** * Handle comment change. * Update character count. * Indicate progress */ function handleCommentUpdate(comment) { var status = $('.comment-status'); status.text(getStatusText(comment)); status.removeClass('mild spicy hot sizzling'); status.addClass(getStatusClass(comment)); } /** * Is the comment valid for submission */ function commentSubmittable(comment) { var notTooSoon = !isTooSoon(); var notEmpty = !isEmpty(comment); var hasEnoughCharacters = !isTooShort(comment); return notTooSoon && notEmpty && hasEnoughCharacters; } // submit comment $('.add-comment').click(function() { var comment = $('.comment-box').val(); // submit comment, fake ajax call if(commentSubmittable(comment)) { .. } // show a popup if comment is mostly spaces if(isTooShort(comment)) { if(comment.length < 15) { // blink status message } else { popup("Comment must be at least 15 characters in length."); } } // show a popup is comment submitted too soon else if(isTooSoon()) { popup("Only 1 comment allowed per 15 seconds."); } });

    Read the article

  • Strange behavior due to wx.Frame.SetTitle

    - by Anurag Uniyal
    In a wxPython application, which i am porting to Mac OSX, I set title of app frame every 500msec in update UI event, and due to that all the panels and windows are refreshed. That seems strange to me and almost halts my application which has many custom drawn controls and screens. I wanted to know what could be the reason behind it, is it normal for MAC? Here is a self-constrained script which replicates the scenario using timers. It keeps on printing "on paint" every 500ms because in timer I set title every 500ms. import wx app = wx.PySimpleApp() frame = wx.Frame(None, title="BasePainter Test") painter = wx.Panel(frame) def onPaint(event): dc = wx.PaintDC(painter) print "onPaint" painter.Bind(wx.EVT_PAINT, onPaint) def loop(): frame.SetTitle(frame.GetTitle()) wx.CallLater(500, loop) loop() frame.Show(True) app.SetTopWindow(frame) app.MainLoop() My system details: >>> sys.version '2.5 (r25:51918, Sep 19 2006, 08:49:13) \n[GCC 4.0.1 (Apple Computer, Inc. build 5341)]' >>> wx.VERSION (2, 8, 10, 1, '') >>> os.uname() ('Darwin', 'agyeys-mac-mini.local', '9.8.0', 'Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386', 'i386')

    Read the article

  • Designing a fluid Javascript interface to hide callback asynchrony

    - by Anurag
    How would I design an API to hide the asynchronous nature of AJAX and HTTP requests, or basically delay it to provide a fluid interface. To show an example from Twitter's new Anywhere API: // get @ded's first 20 statuses, filter only the tweets that // mention photography, and render each into an HTML element T.User.find('ded').timeline().first(20).filter(filterer).each(function(status) { $('div#tweets').append('<p>' + status.text + '</p>'); }); function filterer(status) { return status.text.match(/photography/); } vs this (asynchronous nature of each call is clearly visible) T.User.find('ded', function(user) { user.timeline(function(statuses) { statuses.first(20).filter(filterer).each(function(status) { $('div#tweets').append('<p>' + status.text + '</p>'); }); }); }); It finds the user, gets their tweet timeline, filters only the first 20 tweets, applies a custom filter, and ultimately uses the callback function to process each tweet. I am guessing that a well designed API like this should work like a query builder (think ORMs) where each function call builds the query (HTTP URL in this case), until it hits a looping function such as each/map/etc., the HTTP call is made and the passed in function becomes the callback. An easy development route would be to make each AJAX call synchronous, but that's probably not the best solution. I am interested in figuring out a way to make it asynchronous, and still hide the asynchronous nature of AJAX.

    Read the article

1 2 3  | Next Page >