Daily Archives

Articles indexed Monday April 12 2010

Page 17/116 | < Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >

  • AWK If/ElseConditional Problem

    - by neversaint
    I have a data that looks like this: foo foo scaffold_7 1 4845 6422 4845 bar bar scaffold_7 -1 14689 16310 16310 What I want to do is to process the above lines where I just want to print column 1,2,3, 7 and one more column after 7th. But with condition when printing column 7 onwards. Below is my awk script: awk '{ if ($4=="+") { {end=$6-$5}{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $7 "\t" end+$7} } else {end=$6-$5}{print $1 "\t" $2 "\t" $3 "\t" $4 "\t" $7-end "\t" $7} }' But why it doesn't achieve the desired result like this? foo foo scaffold_7 1 4845 6422 bar bar scaffold_7 -1 14689 16310 Note that the arithmetic (e.g. $7-end or end+$7) is a must. So we can't just swap column from input file. Furthermore this AWK will be inside a bash script.

    Read the article

  • Multi table Triggers SQL Server noob

    - by Chin
    I have a load of tables all with the same 2 datetime columns (lastModDate, dateAdded). I am wondering if I can set up global Insert Update trigger for these tables to set the datetime values. Or if not, what approaches are there? Any pointers much appreciated

    Read the article

  • Using XTemplate with SimpleStore in Ext

    - by qui
    I am currently adding some functionality to some old code. There used to be a template which took a flat array of items and spat out some HTML, now the data is coming from a simple store which reads some JSON.. var allwords = [ ['abacteriano', 'abacteriano'], ['abacterial', 'abacteriano'], ['abciximab', 'abciximab'], etc.. So my simplestore goes like this: termStore = new Ext.data.SimpleStore({ fields: ['term', 'lookup'], data: allwords }); This definitly works fine as I use the termStore in a combobox. However I am having difficulty getting it to play with an XTemplate. It seems the syntax in extjs doesn't play well with SO, so this bit wont be in a code block... So I guess I'll describe it :p Essentially its a simple template which tries to get values out of the passed collection by doing {term} I then try and apply it by doing: tpl.overwrite(Ext.get("contentbox"), termStore); This gives me a JS error of "invalid object initializer"

    Read the article

  • How can I order by the result of a recursive SQL query

    - by Tony
    I have the following method I need to ORDER BY: def has_attachments? attachments.size > 0 || (!parent.nil? && parent.has_attachments?) end I have gotten this far: ORDER BY CASE WHEN attachments.size > 0 THEN 1 ELSE (CASE WHEN parent_id IS NULL THEN 0 ELSE (CASE message.parent ...what goes here ) END END END I may be looking at this wrong because I don't have experience with recursive SQL. Essentially I want to ORDER by whether a message or any of its parents has attachments. If it's attachment size is 0, I can stop and return a 1. If the message has an attachment size of 0, I now check to see if it has a parent. If it has no parent then there is no attachment, however if it does have a parent then I essentially have to do the same query case logic for the parent. UPDATE The table looks like this +---------------------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +---------------------+--------------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | message_type_id | int(11) | NO | MUL | | | | message_priority_id | int(11) | NO | MUL | | | | message_status_id | int(11) | NO | MUL | | | | message_subject_id | int(11) | NO | MUL | | | | from_user_id | int(11) | YES | MUL | NULL | | | parent_id | int(11) | YES | MUL | NULL | | | expires_at | datetime | YES | MUL | NULL | | | subject_other | varchar(255) | YES | | NULL | | | body | text | YES | | NULL | | | created_at | datetime | NO | MUL | | | | updated_at | datetime | NO | | | | | lock_version | int(11) | NO | | 0 | | +---------------------+--------------+------+-----+---------+----------------+ Where the parent_id refers to the parent message, if it exists. Thanks!

    Read the article

  • Is there a way to automatically strip out trailing whitespace in code on commit to CVS?

    - by Steven Swart
    Hi! We're using CVS, on every release we have to synchronise two different branches of code, and in every release cycle it's the same story, whitespace problems causing errors and wasting time. I'm looking for a way to automatically strip out trailing whitespace upon committing a file to CVS, unless explicitly forbidden, say by a command-line option. Is there a solution already available? If not, would anyone be interested if I wrote a plugin to do this? Regards, Steven

    Read the article

  • User controls do not properly fit on the screen

    - by Royson
    Hi, My application has several controls. Like in one screen has TreeView on left side, GridView with paging in the middle and 4 buttons at right side. The controls properly appear when the form is in a maximized state, but if I minimize it the controls do not properly fit on the screen. I tried with different different tricks like table layout.. in dat I added a panel, etc... But I could not solve the problem. How can I create such type of screens which fits independently of size of my window? Thanks

    Read the article

  • Linked List Design

    - by Jim Scott
    The other day in a local .NET group I attend the following question came up: "Is it a valid interview question to ask about Linked Lists when hiring someone for a .NET development position?" Not having a computer sciense degree and being a self taught developer my response was that I did not feel it was appropriate as I in 5 years of developer with .NET had never been exposed to linked lists and did not hear any compeling reason for a use for one. However the person commented that it is a very common interview question so I decided when I left that I would do some reasearch on linked lists and see what I might be missing. I have read a number of posts on stack overflow and various google searches and decided the best way to learn about them was to write my own .NET classes to see how they worked from the inside out. Here is my class structure Single Linked List Constructor public SingleLinkedList(object value) Public Properties public bool IsTail public bool IsHead public object Value public int Index public int Count private fields not exposed to a property private SingleNode firstNode; private SingleNode lastNode; private SingleNode currentNode; Methods public void MoveToFirst() public void MoveToLast() public void Next() public void MoveTo(int index) public void Add(object value) public void InsertAt(int index, object value) public void Remove(object value) public void RemoveAt(int index) Questions I have: What are typical methods you would expect in a linked list? What is typical behaviour when adding new records? For example if I have 4 nodes and I am currently positioned in the second node and perform Add() should it be added after or before the current node? Or should it be added to the end of the list? Some of the designs I have seen explaining things seem to expose outside of the LinkedList class the Node object. In my design you simply add, get, remove values and know nothing about any node object. Should the Head and Tail be placeholder objects that are only used to define the head/tail of the list? I require my Linked List be instantiated with a value which creates the first node of the list which is essentially the head and tail of the list. Would you change that ? What should the rules be when it comes to removing nodes. Should someone be able to remove all nodes? Here is my Double Linked List Constructor public DoubleLinkedList(object value) Properties public bool IsHead public bool IsTail public object Value public int Index public int Count Private fields not exposed via property private DoubleNode currentNode; Methods public void AddFirst(object value) public void AddLast(object value) public void AddBefore(object existingValue, object value) public void AddAfter(object existingValue, object value) public void Add(int index, object value) public void Add(object value) public void Remove(int index) public void Next() public void Previous() public void MoveTo(int index)

    Read the article

  • Can Fluent nhibernate's automapper be configured to handle private readonly backing fields?

    - by Mark Rogers
    I like private readonly backing fields because some objects are mostly read-only after creation, and for collections, which rarely need to be set wholesale (instead using collection methods to modify the collection). For example: public class BuildingType : DomainEntity { /* rest of class */ public IEnumerable<ActionType> ActionsGranted { get { return _actionsGranted; } } private readonly IList<ActionType> _actionsGranted = new List<ActionType>(); private readonly Image _buildingTile; public virtual Image BuildingTile { get { return _buildingTile; } } } But as far as I remember fluent-nhibernate's automapper never had a solution for private readonly backing fields, I'm wondering if that's changed in the last few months. So here's my question: How do I configure automapper or create an automapping convention to map private readonly backing fields?

    Read the article

  • Cover flow model screen adjust in iphone

    - by abdulsamad
    Hi All, Below is the link for making the cover flow model in iphone. This is a sample tutorial. http://www.chaosinmotion.com/flowcover.m Can any one tell me how can i make the cover flow model to adjust some where up on the screen. Currently it is in the centre of the screen i want if about 70 to 80pixels to move up in the screen. Your help will be highly appreciated.

    Read the article

  • SIP and NAT routers?

    - by OverTheRainbow
    Hello SIP was not built with NAT routers in mind, and I'd like to get to the bottom of this issue to check what needs to be done on all devices so it works with NAT routers, and understand in what context it just can't be used and I should check more NAT-friendly alternatives like IAX. A picture being worth a thousand words, here's the layout I need to use: http://img62.imageshack.us/img62/4077/sipandnatrouters.jpg The PBX server is located in the private LAN behind a NAT router connected to the Internet (I know it'd be easier if it were located in the public network, but this router doesn't support DMZ's so the server has to be in the private network) A couple of (soft|hard)phones are located on the same LAN and connected to the PBX server, along with a PSTN gateway (Linksys 3102 or a Digium PCI card) Remote users using (soft|hard)phones are located somewhere on the Net with dynamic IP's and are also located behind NAT routers I may or may not have control over the local NAT router where the PBX server is located, but I have no control over the remote NAT routers, either because the users don't have the computer knowledge to map ports or because the routers are off-limit (eg. web cafés, hotel LAN's, etc.) Is it possible to configure the PBX server, the (soft|hard)phones, and the PSTN gateway so that the all conversations work fine, no matter the endpoints (POTS caller/local phone, POTS caller/remote phone, local phones, remote phone/local phone)? In which cases may I expect problems, and are there solutions? FWIW, I'm leaning toward using Freeswitch, but I could end up using Asterisk if there are technical advantages to it in this context. Thank you for any info.

    Read the article

  • How to use mod_proxy to let my index of Apache go to Tomcat ROOT and be able to browse my other Apac

    - by Dagvadorj
    Hello, I am trying to use my Tomcat application (deployed at ROOT) to be viewed from Apache port 80. To do this, I used mod_proxy, since mod_jk made me try harder. I used sth like this in httpd.conf: <location http://www.example.com> Order deny,allow Allow from all PassProxy http://localhost:8080/ PassProxyReverse http://localhost:8080/ </location> <Proxy *> Order deny,allow Allow from all </Proxy> And now I can not retrieve my previous sites on Apache, which was running prior to my configuration. How can I have both running?

    Read the article

  • How to disable Finder launching at login in Snow Leopard?

    - by fooman
    Pre-Snow Leopard, I could use the following command: defaults write com.apple.loginwindow Finder /Applications/My-replacement-app-such-as-Terminal.app Which would a.) replace the Finder launching at login with an application of my choice, and b.) cause that application to launch instead of Finder when all other applications are quit. Is it possible to do this in Snow Leopard, or has this behavior been deprecated? (I don't want to disable Finder altogether, I just don't want it to start at login.)

    Read the article

  • Microsoft Visual Studio Professional 2010

    Visualize your workspace with new multiple monitor support, powerful Web development, new SharePoint support with tons of templates and Web parts, and more accurate targeting of any version of the .NET Framework. Get set to unleash your creativity.

    Read the article

  • PostgreSQL + Rails citext

    - by glebm
    I am trying to move to heroku which uses PostgreSQL 8.4 which has a citext column type which is nice since the app was written for MySQL. Is there any way to use :citext with rails (so that if the migrations are run on MySQL the citext would just use string/text? I found this ticket, but it seems like it isn't going to be a part of rails for a while: https://rails.lighthouseapp.com/projects/8994/tickets/3174-add-support-for-postgresql-citext-column-type

    Read the article

  • How do i keep my DB and lucene in sync?

    - by acidzombie24
    So i can have a transaction in sql. But i am sure its not a good idea to wait in the middle of a transaction for lucene to finish also i am unsure if lucene is permanently saved in the DB until i do something there. Whats the best way to keep my DB and lucene in sync? I am thinking of adding a lucene_queue in my sql db and everytime i make a change i add it into the queue (removing older queue if any) and delete it once it is done. Is this the best way? Also i am unsure how to make lucene permanently keep the changes i made and how frequent i can/should do it.

    Read the article

  • Best practice for setting up wsgi on root directory?

    - by Timmy
    what's the best ways to mix static files and wsgi app served on the root directory? http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide recommends setting up WSGIScriptAlias / /usr/local/www/wsgi-scripts/myapp.wsgi and alias other directories and files: Alias /robots.txt /usr/local/www/documents/robots.txt Alias /favicon.ico /usr/local/www/documents/favicon.ico Alias /media/ /usr/local/www/documents/media/ is there a cleaner way to do this?

    Read the article

  • Form submits correctly in Chrome/FF, but fails altogether in IE/Safari

    - by culov
    I have a form with a css submit button. When a the submit button is clicked, i call a function that executes: document.forms["request"].onsubmit(); What should happen, then, is that the onsubmit method ought to be triggered. This works properly in Chrome/FF, but for some reason IE/Safari will bypass the onsubmit function and simply add the parameter "address=" onto the url as if it were submitting the form and ignoring the onsubmit function. Heres the code for the form: <form id="request" method="get" onsubmit="addLocation(this.address.value); return false;"> <br> <label style="position:relative;left:5px;" for="address">Enter an intersection or address: </label> <br> <br> <input style="height:35px; width:300px;position:relative;bottom:1px;left:10px;" id="address" name="address" class="required address"/> <a style="float:right;right:120px;position:relative;" class="button" onclick="submit();"> <span>Submit Request </span> </a> </form> and what follows are some relevant js functions: function addLocation(address) { if (geocoder) { geocoder.getLocations(address, function (point) { if (!point) { alert(address + " not found"); } else { if (point.Placemark[0].address != submittedString) { submittedString = point.Placemark[0].address; addRow(point.Placemark[0].address); req = "addrequest?truck=" + "coolhaus&address=" + point.Placemark[0].address; alert(req); addRequest(req); request.onreadystatechange = function () {} } } }); } } function addRequest(req) { try { request = new XMLHttpRequest(); } catch (e) { try { request = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { alert("XMLHttpRequest error: " + e); } } request.open("GET", req, true); request.send(null); return request; } You can test the form here: http://la.truxmap.com/request?id=grillmastersla Thanks so much!

    Read the article

  • Fastest way to deploy rails apps with Passenger

    - by yuval
    I am working on a Dreamhost server with Rails 2.3.5. Every time I make changes to a site, I have to ssh into the site, remove all the files, upload a zip file containing all the new files for the site, unzip that file, migrate the database, and go. Something tells me there's a faster way to deploy rails apps. I am using mac Time Machine to keep track of different versions of my applications. I know git tracks files, but I don't really know how to work with it to deploy my applications, since passenger takes care of all the magic for me. What would be a faster way to deploy my applications (and avoid the downtime associated with my method when I delete all files on the server)? Thanks!

    Read the article

  • Java: initialization problem with private-final-int-value and empty constructor

    - by HH
    $ javac InitInt.java InitInt.java:7: variable right might not have been initialized InitInt(){} ^ 1 error $ cat InitInt.java import java.util.*; import java.io.*; public class InitInt { private final int right; InitInt(){} public static void main(String[] args) { // I don't want to assign any value. // just initialize it, how? InitInt test = new InitInt(); System.out.println(test.getRight()); // later assiging a value } public int getRight(){return right;} } Initialization problem with Constructor InitInt{ // Still the error, "may not be initialized" // How to initialise it? if(snippetBuilder.length()>(charwisePos+25)){ right=charwisePos+25; }else{ right=snippetBuilder.length()-1; } }

    Read the article

< Previous Page | 13 14 15 16 17 18 19 20 21 22 23 24  | Next Page >