Daily Archives

Articles indexed Wednesday December 22 2010

Page 3/32 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Replace into equivalent for postgresql and then autoincrementing an int

    - by Mohamed Ikal Al-Jabir
    Okay no seriously, if a postgresql guru can help out I'm just getting started. Basically what I want is a simple table like such: CREATE TABLE schema.searches ( search_id serial NOT NULL, search_query character varying(255), search_count integer DEFAULT 1, CONSTRAINT pkey_search_id PRIMARY KEY (search_id) ) WITH ( OIDS=FALSE ); I need something like REPLACE INTO for mysql. I don't know if I have to write my own procedure or something? Basically: check if the query already exists if so, just add 1 to the count it not, add it to the db I can do this in my php code but I'd rather all that be done in postgres C engine Thanks for helping

    Read the article

  • mature, powerful Perl library to support text/string operation ?

    - by user534009
    Do we have a mature, powerful Perl library to support text/string operation ? for example, if I need to trim a string, I need to write a function like below. Then question is, do we have an existing API so that I can import and call it ? just like StringUtils.trim(s) in Apache Common Lang. Thanks. sub trim($) { my $string = shift; $string =~ s/^\s+//; $string =~ s/\s+$//; return $string; }

    Read the article

  • Ruby: Twitter API: Get All followers

    - by user28871
    Hi, Anyone have any idea why the next cursor isn't changing in the below code? cursor = "-1" followerIds = [] while cursor != 0 do followers = Twitter.follower_ids("IDTOLOOKUP",{"cursor"=>cursor}) cursor = followers.next_cursor followerIds+= followers.ids sleep(2) end After the first iteration where cursor = -1, it gets assigned the nextcursor from the twitter api. However, when this is sent to the twitter API on subsequent iterations, I get the same response back as I did the first time.. with the same next_cursor. Any ideas what I'm doing wrong? I'm using the twitter gem.

    Read the article

  • Jquery Hidden Field in Table

    - by zSysop
    Hi all, I was wondering if anyone knew of a way to access a hidden field (by client id) within a table row using jquery. $("#tblOne").find("tr").click(function() { var worker = $(this).find(":input").val(); }); I find that the above works for a row that has only one input, but i need some help figuring out a way to get the value by the inputs name. Here's the example of a table row. How would i access the two fields by their id's? <table id="tblOne"> <tr> <td> <asp:HiddenField id="hdnfld_Id" Text='<% Eval("ID") %>'></asp:HiddenField> </td> <td> <asp:HiddenField id="hdnfld_Id2" Text='<% Eval("ID2") %>'></asp:HiddenField> </td> </tr> </table>

    Read the article

  • loading.gif ( but customized )

    - by 422
    I know the various websites around the tinternet, that allow you to customize a loading.gif etc, but what I wanted to know... Is there a way, aside from creating a gif with adobe etc, to create custom text loading... So instead of the ubiquitous spinner, you can specify text that animates whilst an image loads. I have searched high and low, and not found anything. Nearest I got was a jquery spinner, but thats not what I am after. Wondered if any of you guys had come across this before. If so, what did you do to customize it.. Example: Sometimes you may see the following animated ( as a gif ) L...... LO..... LOA.... LOAD... LOADI.. LOADIN. LOADING I know the above is done by creating a loop of animations, but wondered if there was a more upto date method of creating custom loading messages, perhaps using jquery ... I have seen it done in flash etc

    Read the article

  • How to replace part of an input value in jquery?

    - by WonderBugger
    I've been trying to figure out a way to replace part of a string in an input value, but haven't been able to get it working. the input field looks like this: <input type="text" value="20,54,26,99" name="ids" /> I've tried: $('input[name=ids]').val().replace("54,",""); and var replit = $('input[name=ids]').val(); replit.replace("54,",""); $('input[name=ids]').val(replit); but neither worked?

    Read the article

  • Endianness inside CPU registers

    - by Abhishek Tamhane
    I need help understanding endianness inside CPU registers of x86 processors. I wrote this small assembly program: section .data section .bss section .text global _start _start: nop mov eax, 0x78FF5ABC mov ebx,'WXYZ' nop ; GDB breakpoint here. mov eax, 1 mov ebx, 0 int 0x80 I ran this program in GDB with a breakpoint on line number 10 (commented in the source above). At this breakpoint, info registers shows the value of eax=0x78ff5abc and ebx=0x5a595857. Since the ASCII codes for W, X, Y, Z are 57, 58, 59, 5A respectively; and intel is little endian, 0x5a595857 seems like the correct byte order (least significant byte first). Why isn't then the output for eax register 0xbc5aff78 (least significant byte of the number 0x78ff5abc first) instead of 0x78ff5abc?

    Read the article

  • Binding custom property in Entity Framework

    - by deverop
    I have an employee entity in my EF model. I then added a class to the project to add a custom property public partial class Employee { public string Name { get { return string.Format("{0} {1}", this.FirstName, this.LastName); } } } On a aspx form (inside a FormView), I want to bind a DropDownList to the employee collection: <asp:Label runat="server" AssociatedControlID="ddlManagerId" Text="ManagerId" /> <asp:DropDownList ID="ddlManagerId" runat="server" DataSourceID="edsManagerId" DataValueField="Id" DataTextField="Name" AppendDataBoundItems="true" SelectedValue='<%# Bind("ManagerId") %>'> <asp:ListItem Text="-- Select --" Value="0" /> </asp:DropDownList> <asp:EntityDataSource ID="edsManagerId" runat="server" ConnectionString="name=Entities" DefaultContainerName="Entities" EntitySetName="Employees" EntityTypeFilter="Employee" EnableFlattening="true"> </asp:EntityDataSource> Unfortunately, when I fire up the page, I get an error: DataBinding: 'System.Web.UI.WebControls.EntityDataSourceWrapper' does not contain a property with the name 'Name'. Any ideas what I'm doing wrong?

    Read the article

  • Some little extra space is being added when a drop-down is on :focus

    - by catandmouse
    My problem is that when I place :focus style for our dropdown lists like so: input, select { margin: 0; padding: 0; } select:focus { background: #FFC; } ...the dropdown with the focused selection suddenly has an extra spacing on all sides (1-2px spacing). See images below: It may seem unnoticable on the photos above but when you do a selection, the increase in padding/spacing cannot be missed. I already tried removing margin: 0, padding: 0, thinking that the :focus state might be reverting to the padded version but still the same. Has anybody encountered this problem? Only happens in Firefox.

    Read the article

  • Ruby - Nokogiri - Parsing XML from memory and putting all same name node values into an array.

    - by r3nrut
    I have an XML I'm trying to parse from memory and get the status of each of my heart beat tests using Nokogiri. Here is the solution I have... xml = <a:HBeat> <a:ElapsedTime>3 ms</a:ElapsedTime> <a:Name>Service 1</a:Name> <a:Status>true</a:Status> </a:HBeat> <a:HBeat> <a:ElapsedTime>4 ms</a:ElapsedTime> <a:Name>Service 2</a:Name> <a:Status>true</a:Status> </a:HBeat> <a:HBeat> I have tried using both css and xpath to pull back the value for each Status and put it into an array. Code is below: doc = Nokogiri::XML.parse(xml) #service_state = doc.css("a:HBeat, a:Status", 'a' => 'http://schemas.datacontract.org/2004/07/OpenAPI.Entity').map {|node| node.children.text} service_state = doc.xpath("//*[@a:Status]", 'a' => 'http://schemas.datacontract.org/2004/07/OpenAPI.Entity').map(&:text) Both will return service_state = []. Any thoughts or recommendations? Also, consider that I have almost identical xml for another test and I used the following snippet of code which does exactly what I wanted but for some reason isn't working with the xml that contains namespaces. service_state = doc.css("HBeat Status").map(&:text) Thanks!

    Read the article

  • LINQ to SQL - Lightweight O/RM?

    - by CoffeeAddict
    I've heard from some that LINQ to SQL is good for lightweight apps. But then I see LINQ to SQL being used for Stackoverflow, and a bunch of other .coms I know (from interviewing with them). Ok, so is this true? for an e-commerce site that's bringing in millions and you're typically only doing basic CRUDs most the time with the exception of an occasional stored proc for something more complex, is LINQ to SQL complete enough and performance-wise good enough or able to be tweaked enough to run happily on an e-commerce site? I've heard that you just need to tweak performance on the DB side when using LINQ to SQL for a better approach. So there are really 2 questions here: 1) Meaning/scope/definition of a "Lightweight" O/RM solution: What the heck does "lightweight" mean when people say LINQ to SQL is a "lightweight O/RM" and is that true??? If this is so lightweight then why do I see a bunch of huge .coms using it? Is it good enough to run major .coms (obviously it looks like it is) and what determines what the context of "lightweight" is...it's such a generic statement. 2) Performance: I'm working on my own .com and researching different O/RMs. I'm not really looking at the Entity Framework (yet), just want to figure out the LINQ to SQL basics here and determine if it will be efficient enough for me. The problem I think is you can't tweak or control the SQL it generates...

    Read the article

  • Overview of Microsoft SQL Server 2008 Upgrade Advisor

    - by Akshay Deep Lamba
    Problem Like most organizations, we are planning to upgrade our database server from SQL Server 2005 to SQL Server 2008. I would like to know is there an easy way to know in advance what kind of issues one may encounter when upgrading to a newer version of SQL Server? One way of doing this is to use the Microsoft SQL Server 2008 Upgrade Advisor to plan for upgrades from SQL Server 2000 or SQL Server 2005. In this tip we will take a look at how one can use the SQL Server 2008 Upgrade Advisor to identify potential issues before the upgrade. Solution SQL Server 2008 Upgrade Advisor is a free tool designed by Microsoft to identify potential issues before upgrading your environment to a newer version of SQL Server. Below are prerequisites which need to be installed before installing the Microsoft SQL Server 2008 Upgrade Advisor. Prerequisites for Microsoft SQL Server 2008 Upgrade Advisor .Net Framework 2.0 or a higher version Windows Installer 4.5 or a higher version Windows Server 2003 SP 1 or a higher version, Windows Server 2008, Windows XP SP2 or a higher version, Windows Vista Download SQL Server 2008 Upgrade Advisor You can download SQL Server 2008 Upgrade Advisor from the following link. Once you have successfully installed Upgrade Advisor follow the below steps to see how you can use this tool to identify potential issues before upgrading your environment. 1. Click Start -> Programs -> Microsoft SQL Server 2008 -> SQL Server 2008 Upgrade Advisor. 2. Click Launch Upgrade Advisor Analysis Wizard as highlighted below to open the wizard. 2. On the wizard welcome screen click Next to continue. 3. In SQL Server Components screen, enter the Server Name and click the Detect button to identify components which need to be analyzed and then click Next to continue with the wizard. 4. In Connection Parameters screen choose Instance Name, Authentication and then click Next to continue with the wizard. 5. In SQL Server Parameters wizard screen select the Databases which you want to analysis, trace files if any and SQL batch files if any.  Then click Next to continue with the wizard. 6. In Reporting Services Parameters screen you can specify the Reporting Server Instance name and then click next to continue with the wizard. 7. In Analysis Services Parameters screen you can specify an Analysis Server Instance name and then click Next to continue with the wizard. 8. In Confirm Upgrade Advisor Settings screen you will be able to see a quick summary of the options which you have selected so far. Click Run to start the analysis. 9. In Upgrade Advisor Progress screen you will be able to see the progress of the analysis. Basically, the upgrade advisor runs predefined rules which will help to identify potential issues that can affect your environment once you upgrade your server from a lower version of SQL Server to SQL Server 2008. 10. In the below snippet you can see that Upgrade Advisor has completed the analysis of SQL Server, Analysis Services and Reporting Services. To see the output click the Launch Report button at the bottom of the wizard screen. 11. In View Report screen you can see a summary of issues which can affect you once you upgrade. To learn more about each issue you can expand the issue and read the detailed description as shown in the below snippet.

    Read the article

  • Server memory issues, and expected level of service from hosting company

    - by Greg
    I'm involved in maintaining an Ubuntu VPS which runs our django websites (nginx/apache/mod_wsgi) and we've been having some memory spikes which have either caused the database to die, or induced kernel panic when the memory management system can't find any killable processes. I'm working on fixing the memory spikes, but I'm wondering whether there's anything I can do to better deal with the problem if it occurs again. Are there any tools I could use to detect the memory spikes and then, say, kill the offending process and email the server admin to fix it up? Killing off one website so that the server can remain operational is certainly preferable to the whole thing falling over. Also, we were charged $600 for after-hours service because we had to get the hosting company to restart the server - is this standard practice among hosting companies? Another provider I work with provides a panel with which I can stop and start the server myself, and given that a restart was all that was needed, $600 seems mightily excessive. (That's NZD, it's around $445 USD)

    Read the article

  • Sign multiple domains with single Domain Key (dk-filter)

    - by Lashae
    Motivation The private shopping website GILT, send periodical update emails from giltgroupe.bounce.ed10.net however all of the mails are signed with domain keys of giltgroupe.com. mailed-by giltgroupe.bounce.ed10.net signed-by giltgroupe.com My Story I couldn't manage to sign x.com with y.com 's domain key using dk-filter under Debian Lenny with postfix. If I try to init dk-filter service with following arguments: DAEMON_OPTS="$DAEMON_OPTS -d x.com,y.com -c nofws -k -i /var/dk-filter/internal_hosts -s /etc/dk-keys.conf" dk-filter service signs with domain x.com (d=x.com) If I change the daemon arg.s as following: DAEMON_OPTS="$DAEMON_OPTS -d x.com -c nofws -k -i /var/dk-filter/internal_hosts -s /etc/dk-keys.conf" then emails sent From y.com is not being signed. the dk-keys.conf file is as follows: *:/var/dk-filter/y.com/mail I managed to do same thing with DKIM, works perfect. However DK doesn't seem to work. I don't have any problem signing y.com's emails with y.com's key and x.com's emails x.com's key, which indicates there is no configuration problem. Do you have any experience/advice to make it possible to sign emails from multiple domains by a specific chosen domain?

    Read the article

  • Port forwarding (portmap) works only locally

    - by Tag Wint
    There are four hosts hostA winXP hostB Win2003 hostC Linux RHEL hostD Linux RHEL hostA cannot connect to C and D directly, but B can hostA connects to hostB using VPN hostB and hostC belong to the same subnet1 hostD is in subnet2 From hostA I need to connect to hostC and hostD by SSH. Now I can do it as follows: 1.connecting from hostA to hostB by RDP logon and there: 2.start putty client. I'd like to omit step 1 and connect from A to C and D directly On hostB I have admin acoount and configure port forwarding as follows: netsh interface portproxy add v4tov4 listenport=N1 connectaddress=hostC_IP connectport=N2 netsh interface portproxy add v4tov4 listenport=N3 connectaddress=hostD_IP connectport=N2 netsh interface portproxy show all: Listen on IPv4: Connect to IPv4: Address Port Address Port --------------- ---------- --------------- ---------- * N1 hostC_IP N2 * N3 hostD_IP N2 Now from hostB I can connect to either C and D: ssh localhost:N1 ssh localhost:N3 from hostA ssh hostB:N1 works too, but ssh hostB:N3 DON'T I guess the reason might be different subnets, still have no idea how to fix it. What should I do?

    Read the article

  • Getting PATH right for python after MacPorts install

    - by BenjaminGolder
    I can't import some python libraries (PIL, psycopg2) that I just installed with MacPorts. I looked through these forums, and tried to adjust my PATH variable in $HOME/.bash_profile in order to fix this but it did not work. I added the location of PIL and psycopg2 to PATH. I know that Terminal is a version of python in /usr/local/bin, rather than the one installed by MacPorts at /opt/local/bin. Do I need to use the MacPorts version of Python in order to ensure that PIL and psycopg2 are on sys.path when I use python in Terminal? Should I switch to the MacPorts version of Python, or will that cause more problems? In case it is helpful, here are more facts: PIl and psycopg2 are installed in /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages which pythonreturns/usr/bin/python echo $PATHreturns (I separated each path for easy reading): :/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/ :/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages :/opt/local/bin :/opt/local/sbin :/usr/local/git/bin :/usr/bin :/bin :/usr/sbin :/sbin :/usr/local/bin :/usr/local/git/bin :/usr/X11/bin :/opt/local/bin in python, sys.path returns: /Library/Frameworks/SQLite3.framework/Versions/3/Python /Library/Python/2.6/site-packages/numpy-override /Library/Frameworks/GDAL.framework/Versions/1.7/Python/site-packages /Library/Frameworks/cairo.framework/Versions/1/Python /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6 /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-darwin /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat-mac/lib-scriptpackages /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-old /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-dynload /Library/Python/2.6/site-packages /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/PyObjC /System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode I welcome any criticism and comments, if any of the above looks foolish or poorly conceived. I'm new to all of this. Thanks! Running OSX 10.6.5 on a MacBook Pro, invoking python 2.6.1 from Terminal

    Read the article

  • sound clipping in windows 7 64bit

    - by Sonic Soul
    something is up with 64 bit version of windows 7. i have 2 (good pro-sumer) sound cards which i've used in other version of windows 7 w/out problems, but now it is causing severe clipping (noise, sound having little gaps surrounded by static).. the cards i am using is echo mia, and native instruments audio kontrol 1. the audio kontrol 1 is a external card, and would work ok for a few hours after rebooting, and than it would go back into clipping mode, to the point where you tube videos would not play from trying to process sound and it stopping for extended periods of time. echo mia is performing better, but there is still some clipping and distortion. the machine i use is newly built, with i7 920 64 bit cpu, 6 gigs of ram and an outdated nvidia video card (geforece 7950 gx2)

    Read the article

  • Windows 7 doesn't connect to mapped drives at start up.....

    - by danbo
    We are testing Windows 7 (32bit version) and logon to a windows 2003 domain that runs a logon script whichs maps our drive letters. We have no control over the domain. Of our 7 test users, 5 continually recieve red X's on their network drives after they logon. Double clicking on them connects the drives, however, any aplpication that requires files on the fileserver will fail since it thinks it has no connection to the drive. We have tried several reg edits (Enable Linked connections, KeepConn), we have tried to find information in the event viewer to no avail. We have also looked at any differences in NIC driver versions (none). The other 2 computers that can connect without problem are local admins, but, if we logon to the 5 that have the problem with the local admin credentials we get the red x's as well??? This one is a real head scratcher......

    Read the article

  • Collaborative data modelling software?

    - by at01
    I'm trying to find a tool where a lot of people can work on a data model collaboratively. Embarcadero has a an ER application called ER/studio which apparently comes with a repository system that acts like typical version control software. That sounds great except ER/studio is expensive and this is a non-profit and open source organization where we encourage members to even contribute small changes. What's the best solution? Either downloadable software or a web service would work. We don't mind paying, but the cost can't go up with the number of participants...

    Read the article

  • unzip and maintain directory structure of archives

    - by Ramy
    On fedora-13, I tried using: unzip -j [nameof.zip] but this doesn't seem to maintain the folder structure of the original archive. I REALLY need to maintain this structure because the archive is a backup of all my m4a's which are being converted to mp3. If I just convert it as is, then i'll just have a single massive directory full of mp3's, but they won't be in their respective "artist" folder.

    Read the article

  • An XEvent a Day (21 of 31) – The Future – Tracking Blocking in Denali

    - by Jonathan Kehayias
    One of my favorite features that was added to SQL Server 2005 has been the Blocked Process Report trace event which collects an XML report whenever a process is blocked inside of the database engine longer than the user configurable threshold.  I wrote an article about this feature on SQL Server Central  two years ago titled Using the Blocked Process Report in SQL Server 2005/2008 .  One of the aspects of this feature is that it requires that you either have a SQL Trace running that...(read more)

    Read the article

  • Does anyone know of a good guide to configure GC in Java?

    - by evilpenguin
    I'm having trouble with a JVM running an app, whose heap memory looks like a comb. It's constantly jumping from 1.5 GB to 3 GB and slowly deteriorating to higher values. I'm using G1 GC algorithm, but have no idea how to configure it. I do not have access to the code of the app I'm running and, needless to say, it's a rather large app. So, bottom line, does anyone know of a good guide to configure GC in Java?

    Read the article

  • How important is it to use short names for Python packages and modules?

    - by Dan
    PEP 8 says that Python package and module names should be short, since some file systems will truncate long names. And I'm trying to follow Python conventions in a new project. But I really like long, descriptive names. So I'm wondering, how short do names need to be to comply with PEP 8. And does anyone really worry about this anymore? I'm tempted to ignore this recommendation, and use longer names, thinking this isn't all that relevant anymore. Does anyone think this recommendation is still worth following? If yes, why? And how short is short enough?

    Read the article

  • How to retrieve content via .load() or $.get() with this line

    - by Sin
    hello :) I posted a question a day or two ago about how to retrieve php via ajax method in this modal I was using. I kinda found out the right way to go about it, but there's still something I'm not doing right (obviously lol) Here's the section thats giving me the issues: jQuery('div that holds content').fadeIn(200).css({ 'width': Number( popWidth ) }); $('').load('/something/somewhere/this #content'); So, im using safari, and a local server (mamp), when I check activity in my browser, it shows that it is loading the content with every click, AND the pop up pops up, but no content. When I simply retrieve content via hidden div, ofcourse, i get it. This is what I'm trying to avoid. right now I have that div in my footer stashed as hidden. I'd rather just make a call when its needed, instead of loading it every single time a page is accessed. you can go here to see the whole script i posted in my last question: How to use ajax to show php in a modal pop up Anyone have any idea? I read that .load() has the ability to grab specific content from a request, but im not sure the major difference between that and $.get() I've tried both, and I get the same results. Im using wordpress, and wordpress's ajax requests run smooth as ever, so I know its not a local problem, i'ts my coding lol Ok....Im done typing :)

    Read the article

  • How to prevent a javascript/backbone.js cloned model from sharing attributes

    - by user540727
    I'm working with backbone.js models, so I don't know if my question is particular to the way backbone handles cloning or if it applies to javascript in general. Basically, I need to clone a model which has an attribute property assigned an object. The problem is that when I update the parent or clone's attribute, the other model is also updated. Here is a quick example: var A = Backbone.Model.extend({}); var a = new A({'test': {'some': 'crap'}}); var b = a.clone(); a.get('test')['some'] = 'thing'; // I could also use a.set() to set the attribute with the same result console.log(JSON.stringify(a)) console.log(JSON.stringify(b)) which logs the following: {"test":{"some":"thing"}} {"test":{"some":"thing"}} I would prefer to clone a such that b won't be referencing any of its attributes. Any help would be appreciated.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >