Search Results

Search found 4060 results on 163 pages for '400 the cat'.

Page 14/163 | < Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >

  • A more elegant way to parse a string with ruby regular expression using variable grouping?

    - by i0n
    At the moment I have a regular expression that looks like this: ^(cat|dog|bird){1}(cat|dog|bird)?(cat|dog|bird)?$ It matches at least 1, and at most 3 instances of a long list of words and makes the matching words for each group available via the corresponding variable. Is there a way to revise this so that I can return the result for each word in the string without specifying the number of groups beforehand? ^(cat|dog|bird)+$ works but only returns the last match separately , because there is only one group.

    Read the article

  • What's the default ScaleType of ImageView?

    - by kknight
    What's the default ScaleType of ImageView?If I put an image which is 400 pixels x 400 pixels on a normal screen (320x480) without specifying ScaleType, how will the image be scaled? Thanks. <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:src="@drawable/big_image" /> </RelativeLayout>

    Read the article

  • Display url in text box

    - by xrx215
    I have a textbox as follows: <asp:TextBox runat="server" ID="txtOtherApps" Height="400" Width="400" TextMode="MultiLine" ontextchanged="txtOtherApps_TextChanged" ></asp:TextBox> How to display link in this textbox?

    Read the article

  • How to return this XML-RPC response in an array using PHP?

    - by mind.blank
    I'm trying to put together a WordPress plugin and I want to grab a list of all categories (of other WordPress blogs) via XML-RPC. I have the following code and it looks like it works so far: function get_categories($rpcurl,$username,$password){ $rpcurl2 = $rpcurl."/xmlrpc.php"; $params = array(0,$username,$password,true); $request = xmlrpc_encode_request('metaWeblog.getCategories',$params); $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $rpcurl2); curl_setopt($ch, CURLOPT_HEADER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: text/xml")); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_TIMEOUT, 10); curl_setopt($ch, CURLOPT_POSTFIELDS, $request); $results = curl_exec($ch); $res = xmlrpc_decode($results); curl_close($ch); return $res; } If I use $res I get the following string as the response: Array If I use $results then I get: categoryId17 parentId0 descriptionTest categoryDescription categoryNameTest htmlUrlhttp://test.yoursite.com/?cat=17 rssUrlhttp://test.yoursite.com/?feed=rss2&amp;cat=17 categoryId1 parentId0 descriptionUncategorized categoryDescription categoryNameUncategorized htmlUrlhttp://test.yoursite.com/?cat=1 rssUrlhttp://test.yoursite.com/?feed=rss2&amp;cat=1 I need to pull out the names after description so Uncategorized and Test in this case. It's my first time coding in PHP. I got these results by echoing them to the page, so not sure if they get changed in that process or not... By the way I modified the above code from one that posts to a WordPress blog remotely so maybe I haven't set some of the options correctly? With var_dump($res) I get: array(2) { [0]=> array(7) { ["categoryId"]=> string(2) "17" ["parentId"]=> string(1) "0" ["description"]=> string(4) "Test" ["categoryDescription"]=> string(0) "" ["categoryName"]=> string(4) "Test" ["htmlUrl"]=> string(40) "http://test.youreventwebsite.com/?cat=17" ["rssUrl"]=> string(54) "http://test.youreventwebsite.com/?feed=rss2&cat=17" } [1]=> array(7) { ["categoryId"]=> string(1) "1" ["parentId"]=> string(1) "0" ["description"]=> string(13) "Uncategorized" ["categoryDescription"]=> string(0) "" ["categoryName"]=> string(13) "Uncategorized" ["htmlUrl"]=> string(39) "http://test.youreventwebsite.com/?cat=1" ["rssUrl"]=> string(53) "http://test.youreventwebsite.com/?feed=rss2&cat=1" } }

    Read the article

  • JQuery Dialog with constant aspect ratio

    - by David Semeria
    I need to display an image in a resizable dialog (so far all the specific image popup libraries I have tried do not fit my needs). All I want to do is maintain the aspect ratio during resizing. Sounds easy, but it's not. I thought something like this might work, but no dice: var d = $("").dialog({title:title, width:400, height:400}); d.resizable( "option", "aspectRatio", true ); Any pointers greatly appreciated, tks

    Read the article

  • Problem with richfaces ajax datatable + buttons

    - by Schyzotrop
    Hello i have another problem with RichFaces this is my application and it shows how i want it to work : http://www.screencast.com/users/Schyzotrop/folders/Jing/media/a299dc1e-7a10-440e-8c39-96b1ec6e85a4 this is video of some glitch that i can't solve http://screencast.com/t/MDFiMGMzY the problem is that when i am trying to press any buttons on others than 1st category it won't do anything IF 1st category has less rows than the one i am calling it from from 1st category it works always i am using follwoing code in jsp for collumns : <h:form id="categoryAttributeList"> <rich:panel> <f:facet name="header"> <h:outputText value="Category Attribute List" /> </f:facet> <rich:dataTable id="table" value="#{categoryAttributeBean.allCategoryAttribute}" var="cat" width="100%" rows="10" columnClasses="col1,col2,col2,col3"> <f:facet name="header"> <rich:columnGroup> <h:column>Name</h:column> <h:column>Description</h:column> <h:column>Category</h:column> <h:column>Actions</h:column> </rich:columnGroup> </f:facet> <rich:column filterMethod="#{categoryAttributeFilteringBean.filterNames}"> <f:facet name="header"> <h:inputText value="#{categoryAttributeFilteringBean.filterNameValue}" id="input"> <a4j:support event="onkeyup" reRender="table , ds" ignoreDupResponses="true" requestDelay="700" oncomplete="setCaretToEnd(event);" /> </h:inputText> </f:facet> <h:outputText value="#{cat.name}" /> </rich:column> <rich:column filterMethod="#{categoryAttributeFilteringBean.filterDescriptions}"> <f:facet name="header"> <h:inputText value="#{categoryAttributeFilteringBean.filterDescriptionValue}" id="input2"> <a4j:support event="onkeyup" reRender="table , ds" ignoreDupResponses="true" requestDelay="700" oncomplete="setCaretToEnd(event);" /> </h:inputText> </f:facet> <h:outputText value="#{cat.description}" /> </rich:column> <rich:column filterMethod="#{categoryAttributeFilteringBean.filterCategories}"> <f:facet name="header"> <h:selectOneMenu value="#{categoryAttributeFilteringBean.filterCategoryValue}"> <f:selectItems value="#{categoryAttributeFilteringBean.categories}" /> <a4j:support event="onchange" reRender="table, ds" /> </h:selectOneMenu> </f:facet> <h:outputText value="#{cat.categoryID.name}" /> </rich:column> <h:column> <a4j:commandButton value="Edit" reRender="pnl" action="#{categoryAttributeBean.editCategoryAttributeSetup}"> <a4j:actionparam name="categoryAttributeID" value="#{cat.categoryAttributeID}" assignTo="#{categoryAttributeBean.id}" /> <a4j:actionparam name="state" value="edit" /> <a4j:actionparam name="editId" value="#{cat.categoryAttributeID}" /> </a4j:commandButton> <a4j:commandButton reRender="categoryAttributeList" value="Delete" action="#{categoryAttributeBean.deleteCategoryAttribute}"> <a4j:actionparam name="categoryAttributeID" value="#{cat.categoryAttributeID}" assignTo="#{categoryAttributeBean.id}" /> </a4j:commandButton> </h:column> <f:facet name="footer"> <rich:datascroller id="ds" renderIfSinglePage="false"></rich:datascroller> </f:facet> </rich:dataTable> <rich:panel id="msg"> <h:messages errorStyle="color:red" infoStyle="color:green"></h:messages> </rich:panel> </rich:panel> </h:form> and here is code of my backing bean @EJB private CategoryBeanLocal categoryBean; private CategoryAttribute categoryAttribute = new CategoryAttribute(); private ArrayList<SelectItem> categories = new ArrayList<SelectItem>(); private int id; private int categoryid; // Actions public void newCategoryAttribute() { categoryAttribute.setCategoryID(categoryBean.findCategoryByID(categoryid)); categoryBean.addCategoryAttribute(categoryAttribute); FacesContext.getCurrentInstance().addMessage("newCategoryAttribute", new FacesMessage("CategoryAttribute " + categoryAttribute.getName() + " created.")); this.categoryAttribute = new CategoryAttribute(); } public void editCategoryAttributeSetup() { categoryAttribute = categoryBean.findCategoryAttributeByID(id); } public void editCategoryAttribute() { categoryAttribute.setCategoryID(categoryBean.findCategoryByID(categoryid)); categoryBean.updateCategoryAttribute(categoryAttribute); FacesContext.getCurrentInstance().addMessage("newCategoryAttribute", new FacesMessage("CategoryAttribute " + categoryAttribute.getName() + " edited.")); this.categoryAttribute = new CategoryAttribute(); } public void deleteCategoryAttribute() { categoryAttribute = categoryBean.findCategoryAttributeByID(id); categoryBean.removeCategoryAttribute(categoryAttribute); FacesContext.getCurrentInstance().addMessage("categoryAttributeList", new FacesMessage("CategoryAttribute " + categoryAttribute.getName() + " deleted.")); this.categoryAttribute = new CategoryAttribute(); } // Getters public CategoryAttribute getCategoryAttribute() { return categoryAttribute; } public List<CategoryAttribute> getAllCategoryAttribute() { return categoryBean.findAllCategoryAttributes(); } public ArrayList<SelectItem> getCategories() { categories.clear(); List<Category> allCategory = categoryBean.findAllCategory(); Iterator it = allCategory.iterator(); while (it.hasNext()) { Category cat = (Category) it.next(); SelectItem select = new SelectItem(); select.setLabel(cat.getName()); select.setValue(cat.getCategoryID()); categories.add(select); } return categories; } public int getId() { return id; } public int getCategoryid() { return categoryid; } // Setters public void setCategoryAttribute(CategoryAttribute categoryAttribute) { this.categoryAttribute = categoryAttribute; } public void setId(int id) { this.id = id; } public void setCategoryid(int categoryid) { this.categoryid = categoryid; } and here is filtering bean : @EJB private CategoryBeanLocal categoryBean; private String filterNameValue = ""; private String filterDescriptionValue = ""; private int filterCategoryValue = 0; private ArrayList<SelectItem> categories = new ArrayList<SelectItem>(); public boolean filterNames(Object current) { CategoryAttribute currentName = (CategoryAttribute) current; if (filterNameValue.length() == 0) { return true; } if (currentName.getName().toLowerCase().contains(filterNameValue.toLowerCase())) { return true; } else { System.out.println("name"); return false; } } public boolean filterDescriptions(Object current) { CategoryAttribute currentDescription = (CategoryAttribute) current; if (filterDescriptionValue.length() == 0) { return true; } if (currentDescription.getDescription().toLowerCase().contains(filterDescriptionValue.toLowerCase())) { return true; } else { System.out.println("desc"); return false; } } public boolean filterCategories(Object current) { if (filterCategoryValue == 0) { getCategories(); filterCategoryValue = new Integer(categories.get(0).getValue().toString()); } CategoryAttribute currentCategory = (CategoryAttribute) current; if (currentCategory.getCategoryID().getCategoryID() == filterCategoryValue) { return true; } else { System.out.println(currentCategory.getCategoryID().getCategoryID() + "cate" + filterCategoryValue); return false; } } public ArrayList<SelectItem> getCategories() { categories.clear(); List<Category> allCategory = categoryBean.findAllCategory(); Iterator it = allCategory.iterator(); while (it.hasNext()) { Category cat = (Category) it.next(); SelectItem select = new SelectItem(); select.setLabel(cat.getName()); select.setValue(cat.getCategoryID()); categories.add(select); } return categories; } public String getFilterDescriptionValue() { return filterDescriptionValue; } public String getFilterNameValue() { return filterNameValue; } public int getFilterCategoryValue() { return filterCategoryValue; } public void setFilterDescriptionValue(String filterDescriptionValue) { this.filterDescriptionValue = filterDescriptionValue; } public void setFilterNameValue(String filterNameValue) { this.filterNameValue = filterNameValue; } public void setFilterCategoryValue(int filterCategoryValue) { this.filterCategoryValue = filterCategoryValue; } unfortunetly i can't even imagine what could cause this problem that's why i even made videos to help u understand my problem thanks for help!

    Read the article

  • What are the benefits and drawback of documentation vs tutorials vs video tutorials [closed]

    - by Cat
    Which types of learning resources do you find the most helpful, for which kinds of learning and/or perhaps at specific times? Some examples of types of learning you could consider: When starting to integrate a new SDK inside an existing codebase When learning a new framework without having to integrate legacy code When digging deeper into an already-used SDK that you may not know very well yet For example - (video) tutorials are usually very easy to follow and tells a story from beginning to end to get results, but will nearly always assume starting from scratch or a previous tutorial. Therefore such a resource is useful for quick learning if you don't have legacy code around, but less so if you have to search for the best-fit to the code you already have. SDK Documentation on the other hand is well-structured but does not tell a story. It is more difficult to get to a specific larger result with documentation alone, but it is a better fit when you do have legacy code around and are searching for perhaps non-obvious ways of employing the SDK or library. Are there other forms of resources that you find useful, such as interactive training?

    Read the article

  • Man pages not finding entry

    - by Mike
    So, I'm not sure what is going on with my system (ubuntu 12.04), but my man pages do not seem to be working. I try man gcc and get the following response No manual entry for gcc See 'man 7 undocumented' for help when manual pages are not available. However I see the man entry in /usr/share/man/man1/gcc.1.gz Here is what my /etc/manpath.config file looks like # manpath.config # # This file is used by the man-db package to configure the man and cat paths. # It is also used to provide a manpath for those without one by examining # their PATH environment variable. For details see the manpath(5) man page. # # Lines beginning with `#' are comments and are ignored. Any combination of # tabs or spaces may be used as `whitespace' separators. # # There are three mappings allowed in this file: # -------------------------------------------------------- # MANDATORY_MANPATH manpath_element # MANPATH_MAP path_element manpath_element # MANDB_MAP global_manpath [relative_catpath] #--------------------------------------------------------- # every automatically generated MANPATH includes these fields # #MANDATORY_MANPATH /usr/src/pvm3/man # MANDATORY_MANPATH /usr/man MANDATORY_MANPATH /usr/share/man MANDATORY_MANPATH /usr/local/share/man #--------------------------------------------------------- # set up PATH to MANPATH mapping # ie. what man tree holds man pages for what binary directory. # # *PATH* -> *MANPATH* # MANPATH_MAP /bin /usr/share/man MANPATH_MAP /usr/bin /usr/share/man MANPATH_MAP /sbin /usr/share/man MANPATH_MAP /usr/sbin /usr/share/man MANPATH_MAP /usr/local/bin /usr/local/man MANPATH_MAP /usr/local/bin /usr/local/share/man MANPATH_MAP /usr/local/sbin /usr/local/man MANPATH_MAP /usr/local/sbin /usr/local/share/man MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man MANPATH_MAP /usr/bin/X11 /usr/X11R6/man MANPATH_MAP /usr/games /usr/share/man MANPATH_MAP /opt/bin /opt/man MANPATH_MAP /opt/sbin /opt/man #--------------------------------------------------------- # For a manpath element to be treated as a system manpath (as most of those # above should normally be), it must be mentioned below. Each line may have # an optional extra string indicating the catpath associated with the # manpath. If no catpath string is used, the catpath will default to the # given manpath. # # You *must* provide all system manpaths, including manpaths for alternate # operating systems, locale specific manpaths, and combinations of both, if # they exist, otherwise the permissions of the user running man/mandb will # be used to manipulate the manual pages. Also, mandb will not initialise # the database cache for any manpaths not mentioned below unless explicitly # requested to do so. # # In a per-user configuration file, this directive only controls the # location of catpaths and the creation of database caches; it has no effect # on privileges. # # Any manpaths that are subdirectories of other manpaths must be mentioned # *before* the containing manpath. E.g. /usr/man/preformat must be listed # before /usr/man. # # *MANPATH* -> *CATPATH* # MANDB_MAP /usr/man /var/cache/man/fsstnd MANDB_MAP /usr/share/man /var/cache/man MANDB_MAP /usr/local/man /var/cache/man/oldlocal MANDB_MAP /usr/local/share/man /var/cache/man/local MANDB_MAP /usr/X11R6/man /var/cache/man/X11R6 MANDB_MAP /opt/man /var/cache/man/opt # #--------------------------------------------------------- # Program definitions. These are commented out by default as the value # of the definition is already the default. To change: uncomment a # definition and modify it. # #DEFINE pager pager -s #DEFINE cat cat #DEFINE tr tr '\255\267\264\327' '\055\157\047\170' #DEFINE grep grep #DEFINE troff groff -mandoc #DEFINE nroff nroff -mandoc #DEFINE eqn eqn #DEFINE neqn neqn #DEFINE tbl tbl #DEFINE col col #DEFINE vgrind vgrind #DEFINE refer refer #DEFINE grap grap #DEFINE pic pic -S # #DEFINE compressor gzip -c7 #--------------------------------------------------------- # Misc definitions: same as program definitions above. # #DEFINE whatis_grep_flags -i #DEFINE apropos_grep_flags -iEw #DEFINE apropos_regex_grep_flags -iE #--------------------------------------------------------- # Section names. Manual sections will be searched in the order listed here; # the default is 1, n, l, 8, 3, 0, 2, 5, 4, 9, 6, 7. Multiple SECTION # directives may be given for clarity, and will be concatenated together in # the expected way. # If a particular extension is not in this list (say, 1mh), it will be # displayed with the rest of the section it belongs to. The effect of this # is that you only need to explicitly list extensions if you want to force a # particular order. Sections with extensions should usually be adjacent to # their main section (e.g. "1 1mh 8 ..."). # SECTION 1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7 # #--------------------------------------------------------- # Range of terminal widths permitted when displaying cat pages. If the # terminal falls outside this range, cat pages will not be created (if # missing) or displayed. # #MINCATWIDTH 80 #MAXCATWIDTH 80 # # If CATWIDTH is set to a non-zero number, cat pages will always be # formatted for a terminal of the given width, regardless of the width of # the terminal actually being used. This should generally be within the # range set by MINCATWIDTH and MAXCATWIDTH. # #CATWIDTH 0 # #--------------------------------------------------------- # Flags. # NOCACHE keeps man from creating cat pages. #NOCACHE Thanks for any help (p.s. even 'man man' fails) Edit: When I run ls -l /usr/share/man/man1/gcc* I get the following output lrwxrwxrwx 1 root root 12 May 27 15:41 /usr/share/man/man1/gcc.1.gz -> gcc-4.6.1.gz -rw-r--r-- 1 root root 217776 Apr 15 17:34 /usr/share/man/man1/gcc-4.6.1.gz

    Read the article

  • WordPress get_post_count?

    - by Scott B
    I'd like to create a function that retrieves the post count for a given query. I don't want to use get_posts obviously as its way to expensive for this purpose. However, that's exactly what I'm having to use in absense of a get_post_count function. My code is... global $post; $cat=get_cat_ID('mymenu'); $catHidden=get_cat_ID('hidden'); $myrecentposts = get_posts(array('post_not_in' => get_option('sticky_posts'), 'cat' => "-$cat,-$catHidden",'showposts' => $NumberOfPostsToShow)); $myrecentposts2 = get_posts(array('post_not_in' => get_option('sticky_posts'), 'cat' => "-$cat,-$catHidden",'showposts' => -1)); $myrecentpostscount = count($myrecentposts2);

    Read the article

  • bi-directional o2m/m2o beats uni-directional o2m in SQL efficiency?

    - by Henry
    Use these 2 persistent CFCs for example: // Cat.cfc component persistent="true" { property name="id" fieldtype="id" generator="native"; property name="name"; } // Owner.cfc component persistent="true" { property name="id" fieldtype="id" generator="native"; property name="cats" type="array" fieldtype="one-to-many" cfc="cat" cascade="all"; } When one-to-many (unidirectional) Note: inverse=true on unidirectional will yield undesired result: insert into cat (name) values (?) insert into Owner default values update cat set Owner_id=? where id=? When one-to-many/many-to-one (bi-directional, inverse=true on Owner.cats): insert into Owner default values insert into cat (name, ownerId) values (?, ?) Does that mean setting up bi-directional o2m/m2o relationship is preferred 'cause the SQL for inserting the entities is more efficient?

    Read the article

  • problem processing xml in flex3

    - by john
    Hi All, First time here asking a question and still learning on how to format things better... so sorry about the format as it does not look too well. I have started learning flex and picked up a book and tried to follow the examples in it. However, I got stuck with a problem. I have a jsp page which returns xml which basically have a list of products. I am trying to parse this xml, in other words go through products, and create Objects for each product node and store them in an ArrayCollection. The problem I believe I am having is I am not using the right way of navigating through xml. The xml that is being returned from the server looks like this: <?xml version="1.0" encoding="ISO-8859-1"?><result type="success"> <products> <product> <id>6</id> <cat>electronics</cat> <name>Plasma Television</name> <desc>65 inch screen with 1080p</desc> <price>$3000.0</price> </product> <product> <id>7</id> <cat>electronics</cat> <name>Surround Sound Stereo</name> <desc>7.1 surround sound receiver with wireless speakers</desc> <price>$1000.0</price> </product> <product> <id>8</id> <cat>appliances</cat> <name>Refrigerator</name> <desc>Bottom drawer freezer with water and ice on the door</desc> <price>$1200.0</price> </product> <product> <id>9</id> <cat>appliances</cat> <name>Dishwasher</name> <desc>Large capacity with water saver setting</desc> <price>$500.0</price> </product> <product> <id>10</id> <cat>furniture</cat> <name>Leather Sectional</name> <desc>Plush leather with room for 6 people</desc> <price>$1500.0</price> </product> </products></result> And I have flex code that tries to iterate over products like following: private function productListHandler(e:JavaFlexStoreEvent):void { productData = new ArrayCollection(); trace(JavaServiceHandler(e.currentTarget).response); for each (var item:XML in JavaServiceHandler(e.currentTarget).response..product ) { productData.addItem( { id:item.id, item:item.name, price:item.price, description:item.desc }); } } with trace, I can see the xml being returned from the server. However, I cannot get inside the loop as if the xml was empty. In other words, JavaServiceHandler(e.currentTarget).response..product must be returning nothing. Can someone please help/point out what I could be doing wrong. My JavaServiceHandler class looks like this: package com.wiley.jfib.store.data { import com.wiley.jfib.store.events.JavaFlexStoreEvent; import flash.events.Event; import flash.events.EventDispatcher; import flash.net.URLLoader; import flash.net.URLRequest; public class JavaServiceHandler extends EventDispatcher { public var serviceURL:String = ""; public var response:XML; public function JavaServiceHandler() { } public function callServer():void { if(serviceURL == "") { throw new Error("serviceURL is a required parameter"); return; } var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, handleResponse); loader.load(new URLRequest(serviceURL)); // var httpService:HTTPService = new HTTPService(); // httpService.url = serviceURL; // httpService.resultFormat = "e4x"; // httpService.addEventListener(Event.COMPLETE, handleResponse); // httpService.send(); } private function handleResponse(e:Event):void { var loader:URLLoader = URLLoader(e.currentTarget); response = XML(loader.data); dispatchEvent(new JavaFlexStoreEvent(JavaFlexStoreEvent.DATA_LOADED) ); // var httpService:HTTPService = HTTPService(e.currentTarget); // response = httpService.lastResult.product; // dispatchEvent(new JavaFlexStoreEvent(JavaFlexStoreEvent.DATA_LOADED) ); } } } Even though I refer to this as mine and it is not in reality. This is from a Flex book as a code sample which does not work, go figure. Any help is appreciated. Thanks john

    Read the article

  • shell scripting: nested subshell ++

    - by jhon
    Hi guys, more than a problem, this is a request for "another way to do this" actually, if a want to use the result from a previous command I into another one, I use: R1=$("cat somefile | awk '{ print $1 }'" ) myScript -c $R1 -h123 then, a "better way"is: myScript -c $("cat somefile | awk '{ print $1 }'" ) -h123 but, what if I have to use several times the result, let's say: using several times $R1, well the 2 options: option 1 R1=$("cat somefile | awk '{ print $1}'") myScript -c $R1 -h123 -x$R1 option 2 myScript -c $("cat somefile | awk '{ print $1 }'" ) -h123 -x $("cat somefile | awk '{ print $1 }'" ) do you know another way to "store" the result of a previous command/script and use it as a argument into another command/script? thanks

    Read the article

  • Multi join query returns to many results and improperly matched

    - by Woot4Moo
    I have the following minimal schema in Oracle: http://sqlfiddle.com/#!4/c1ed0/14 The queries I have run yield too many results and this query: select cat.*, status.*, source.* from cats cat, status status, source source Left OUTER JOIN source source2 on source2.sourceid = 1 Right OUTER JOIN status status2 on status2.isStray =0 order by cat.name will yield incorrect results. What I am expecting is a table that looks like the following however I cannot seem to come up with the correct SQL. NAME AGE LENGTH STATUSID CATSOURCE ISSTRAY SOURCEID CATID Adam 1 25 null null null 1 2 Bill 5 1 null null null null null Charles 7 5 null null null null null Steve 12 15 1 1 1 1 1 In plain English what I am looking for is to return all known cats + their associated cat source + their cat status while retaining null values. The only information I will have is the source that I am curious about. I also only want the cats that have a status of either STRAY or UNKNOWN (null)

    Read the article

  • Cocos2d-iPhone: CCSprite positions differ between Retina & non-Retina Screens

    - by bobwaycott
    I have a fairly simple app built using cocos2d-iphone, but a strange positioning problem that I've been unable to resolve. The app uses sprite sheets, and there is a Retina and non-Retina sprite sheet within the app that use the exact same artwork (except for resolution, of course). There are other artwork within the app used for CCSprites that are both standard and -hd suffixed. Within the app, a group of sprites are created when the app starts. These initially created CCSprites always position identically (and correctly) on Retina & non-Retina screens. // In method called to setup sprites when app launches // Cache & setup app sprites [[CCSpriteFrameCache sharedSpriteFrameCache] addSpriteFramesWithFile: @"sprites.plist"]; sprites = [CCSpriteBatchNode batchNodeWithFile: @"sprites.png"]; hill = [CCSprite spriteWithSpriteFrameName: @"hill.png"]; hill.position = ccp( 160, 75 ); [sprites addChild: hill z: 1]; // ... [create more sprites in same fashion] // NOTE: All sprites created here have correct positioning on Retina & non-Retina screens When a user taps the screen a certain way, a method is called that creates another group of CCSprites (on- and off-screen), animating them all in. One of these sprites, hand, is always positioned identically (and correctly) on Retina & non-Retina screens. The others (a group of clouds) successfully create & animate, but their positions are correct only on Retina displays. On a non-Retina display, each cloud has incorrect starting positions (incorrect for x, y, or sometimes both), and their ending positions after animation are also wrong. I've included the responsible code below from the on-touch method that creates the new sprites and animates them in. Again, it works as expected on a Retina display, but incorrectly on non-Retina screens. The CCSprites used are created in the same way at app-start to setup all the initial sprites in the app, which always have correct positions. // Elsewhere, in a method called on touch // Create clouds cloud1 = [CCSprite spriteWithSpriteFrameName: @"cloud_1.png"]; cloud1.position = ccp(-150, 320); cloud1.scale = 1.2f; cloud2 = [CCSprite spriteWithSpriteFrameName: @"cloud_2.png"]; cloud2.position = ccp(-150, 335); cloud2.scale = 1.3f; cloud3 = [CCSprite spriteWithSpriteFrameName: @"cloud_4.png"]; cloud3.position = ccp(-150, 400); cloud4 = [CCSprite spriteWithSpriteFrameName: @"cloud_5.png"]; cloud4.position = ccp(-150, 420); cloud5 = [CCSprite spriteWithSpriteFrameName: @"cloud_3.png"]; cloud5.position = ccp(400, 350); cloud6 = [CCSprite spriteWithSpriteFrameName: @"cloud_1.png"]; cloud6.position = ccp(400, 335); cloud6.scale = 1.1f; cloud7 = [CCSprite spriteWithSpriteFrameName: @"cloud_2.png"]; cloud7.flipY = YES; cloud7.flipX = YES; cloud7.position = ccp(400, 380); // Create hand hand = [CCSprite spriteWithSpriteFrameName:@"hand.png"]; hand.position = ccp(160, 650); [sprites addChild: cloud1 z: 10]; [sprites addChild: cloud2 z: 9]; [sprites addChild: cloud3 z: 8]; [sprites addChild: cloud4 z: 7]; [sprites addChild: cloud5 z: 6]; [sprites addChild: cloud6 z: 10]; [sprites addChild: cloud7 z: 8]; [sprites addChild: hand z: 10]; // ACTION!! [cloud1 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(70, 320)]]; [cloud2 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(60, 335)]]; [cloud3 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(100, 400)]]; [cloud4 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(80, 420)]]; [cloud5 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(250, 350)]]; [cloud6 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(250, 335)]]; [cloud7 runAction:[CCMoveTo actionWithDuration: 1.0f position: ccp(270, 380)]]; [hand runAction: handIn]; It may be worth mentioning that I see this incorrect positioning behavior in the iOS Simulator when running the app and switching between the standard iPhone and iPhone (Retina) hardware options. I have not been able to verify this occurs or does not occur on an actual non-Retina iPhone because I do not have one. However, this is the only time I see this odd positioning behavior occur (the incorrect results obtained after user touch), and since I'm creating all sprites in exactly the same way (i.e., [CCSprite spriteWithSpriteFrameName:] and then setting position with cpp()), I would be especially grateful for any help in tracking down why this single group of sprites are always incorrect on non-Retina screens. Thank you.

    Read the article

  • Documentation vs tutorials vs video tutorials - which one's better?

    - by Cat
    As a developer/software engineer, what would you say are the most helpful resources when attempting to learn and use a new system? If you had to integrate a new SDK into your codebase/application, which one of the following options would you much rather go with? documentation tutorials video tutorials Same question for learning a new framework (e.g. writing an iOS app, learning Python, integrating the Android SDK, etc.). I'm not referring to becoming an expert, just get to know enough to use a system/language/framework properly. This is a pretty general question, but I think it's very relevant to anyone who's doing engineering work, since learning how to use new systems quickly is a very important skill to have. Thank you!

    Read the article

  • How to detect and configure an output with xrandr?

    - by ysap
    I have a DELL U2410 monitor connected to a Compaq 100B desktop equipped with an integrated AMD/ATI graphics card (AMD E-350). The installed O/S is Ubuntu 10.04 LTS. The computer is connected to the monitor via the DVI connection. The problem is that I cannot set the desktop resolution to the native 1920x1200. The maximum allowed resolution is 1600x1200. Doing some research I found about the xrandr utility. Unfortunately, when trying to use it I cannot configure it to the required resolution. First, it does not report the output name (which supposed to be DVI-0), saying default instead. Without it I cannot use the --fb option. The EDID utility seems to identify the monitor well. Here's the output from get-edid: # EDID version 1 revision 3 Section "Monitor" # Block type: 2:0 3:ff # Block type: 2:0 3:fc Identifier "DELL U2410" VendorName "DEL" ModelName "DELL U2410" # Block type: 2:0 3:ff # Block type: 2:0 3:fc # Block type: 2:0 3:fd HorizSync 30-81 VertRefresh 56-76 # Max dot clock (video bandwidth) 170 MHz # DPMS capabilities: Active off:yes Suspend:yes Standby:yes Mode "1920x1200" # vfreq 59.950Hz, hfreq 74.038kHz DotClock 154.000000 HTimings 1920 1968 2000 2080 VTimings 1200 1203 1209 1235 Flags "-HSync" "+VSync" EndMode # Block type: 2:0 3:ff # Block type: 2:0 3:fc # Block type: 2:0 3:fd EndSection but the xrandr -q command returns: Screen 0: minimum 640 x 400, current 1600 x 1200, maximum 1600 x 1200 default connected 1600x1200+0+0 0mm x 0mm 1600x1200 0.0* 1280x1024 0.0 1152x864 0.0 1024x768 0.0 800x600 0.0 640x480 0.0 720x400 0.0 When I try to set the resolution, I get: $ xrandr --fb 1920x1200 xrandr: screen cannot be larger than 1600x1200 (desired size 1920x1200) $ xrandr --output DVI-0 --auto warning: output DVI-0 not found; ignoring How can I set the screen resolution to 1920x1200? Why doesn't xrandr identify the DVI-0 output? Note that the same computer running Ubuntu version higher than 10.04 detects the correct resolution with no problems. On this machine I cannot upgrade due to some legacy hardware compatibility problems. Also, I don't see any optional screen drivers available in the Hardware Drivers dialog. ---- UPDATE: following the answer to this question, I got some advance. Now the required mode is listed in the xrandr -q list, but I can't switch to that mode. Using the Monitors applet (which now shows the new mode), I get the response that: The selected configuration for displays could not be applied. Could not set the configuration to CRTC 262. From the command line it looks like this: $ cvt 1920 1200 60 # 1920x1200 59.88 Hz (CVT 2.30MA) hsync: 74.56 kHz; pclk: 193.25 MHz Modeline "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync $ xrandr --newmode "1920x1200_60.00" 193.25 1920 2056 2256 2592 1200 1203 1209 1245 -hsync +vsync $ xrandr -q Screen 0: minimum 640 x 400, current 1600 x 1200, maximum 1600 x 1200 default connected 1600x1200+0+0 0mm x 0mm 1600x1200 0.0* 1280x1024 0.0 1152x864 0.0 1024x768 0.0 800x600 0.0 640x480 0.0 720x400 0.0 1920x1200_60.00 (0x120) 193.0MHz h: width 1920 start 2056 end 2256 total 2592 skew 0 clock 74.5KHz v: height 1200 start 1203 end 1209 total 1245 clock 59.8Hz $ xrandr --addmode default 1920x1200_60.00 $ xrandr -q Screen 0: minimum 640 x 400, current 1600 x 1200, maximum 1600 x 1200 default connected 1600x1200+0+0 0mm x 0mm 1600x1200 0.0* 1280x1024 0.0 1152x864 0.0 1024x768 0.0 800x600 0.0 640x480 0.0 720x400 0.0 1920x1200_60.00 59.8 $ xrandr --output default --mode 1920x1200_60.00 xrandr: Configure crtc 0 failed Another piece of info (if it helps anyone): $ sudo lshw -c video *-display UNCLAIMED description: VGA compatible controller product: ATI Technologies Inc vendor: ATI Technologies Inc physical id: 1 bus info: pci@0000:00:01.0 version: 00 width: 32 bits clock: 33MHz capabilities: pm pciexpress msi bus_master cap_list configuration: latency=0 resources: memory:c0000000-cfffffff(prefetchable) ioport:f000(size=256) memory:feb00000-feb3ffff

    Read the article

  • MySQL Server 5.6 defaults changes

    - by user12626240
    We're improving the MySQL Server defaults, as announced by Tomas Ulin at MySQL Connect. Here's what we're changing:  Setting  Old  New  Notes back_log  50  50 + ( max_connections / 5 ) capped at 900 binlog_checksum  off  CRC32  New variable in 5.6 binlog_row_event_max_size  1k  8k flush_time  1800  Windows changes from 1800 to 0  Was already 0 on other platforms host_cache_size  128  128 + 1 for each of the first 500 max_connections + 1 for every 20 max_connections over 500, capped at 2000  New variable in 5.6 innodb_autoextend_increment  8  64  Now affects *.ibd files. 64 is 64 megabytes innodb_buffer_pool_instances  0  8. On 32 bit Windows only, if innodb_buffer_pool_size is greater than 1300M, default is innodb_buffer_pool_size / 128M innodb_concurrency_tickets  500  5000 innodb_file_per_table  off  on innodb_log_file_size  5M  48M  InnoDB will always change size to match my.cnf value. Also see innodb_log_compressed_pages and binlog_row_image innodb_old_blocks_time 0  1000 1 second innodb_open_files  300  300; if innodb_file_per_table is ON, higher of table_open_cache or 300 innodb_purge_batch_size  20  300 innodb_purge_threads  0  1 innodb_stats_on_metadata  on  off join_buffer_size 128k  256k max_allowed_packet  1M  4M max_connect_errors  10  100 open_files_limit  0  5000  See note 1 query_cache_size  0  1M query_cache_type  on/1  off/0 sort_buffer_size  2M  256k sql_mode  none  NO_ENGINE_SUBSTITUTION  See later post about default my.cnf for STRICT_TRANS_TABLES sync_master_info  0  10000  Recommend: master_info_repository=table sync_relay_log  0  10000 sync_relay_log_info  0  10000  Recommend: relay_log_info_repository=table. Also see Replication Relay and Status Logs table_definition_cache  400  400 + table_open_cache / 2, capped at 2000 table_open_cache  400  2000   Also see table_open_cache_instances thread_cache_size  0  8 + max_connections/100, capped at 100 Note 1: In 5.5 there was already a rule to make open_files_limit 10 + max_connections + table_cache_size * 2 if that was higher than the user-specified value. Now uses the higher of that and (5000 or what you specify). We are also adding a new default my.cnf file and guided instructions on the key settings to adjust. More on this in a later post. We're also providing a page with suggestions for settings to improve backwards compatibility. The old example files like my-huge.cnf are obsolete. Some of the improvements are present from 5.6.6 and the rest are coming. These are ideas, and until they are in an official GA release, they are subject to change. As part of this work I reviewed every old server setting plus many hundreds of emails of feedback and testing results from inside and outside Oracle's MySQL Support team and the many excellent blog entries and comments from others over the years, including from many MySQL Gurus out there, like Baron, Sheeri, Ronald, Schlomi, Giuseppe and Mark Callaghan. With these changes we're trying to make it easier to set up the server by adjusting only a few settings that will cause others to be set. This happens only at server startup and only applies to variables where you haven't set a value. You'll see a similar approach used for the Performance Schema. The Gurus don't need this but for many newcomers the defaults will be very useful. Possibly the most unusual change is the way we vary the setting for innodb_buffer_pool_instances for 32-bit Windows. This is because we've found that DLLs with specified load addresses often fragment the limited four gigabyte 32-bit address space and make it impossible to allocate more than about 1300 megabytes of contiguous address space for the InnoDB buffer pool. The smaller requests for many pools are more likely to succeed. If you change the value of innodb_log_file_size in my.cnf you will see a message like this in the error log file at the next restart, instead of the old error message: [Warning] InnoDB: Resizing redo log from 2*64 to 5*128 pages, LSN=5735153 One of the biggest challenges for the defaults is the millions of installations on a huge range of systems, from point of sale terminals and routers though shared hosting or end user systems and on to major servers with lots of CPU cores, hundreds of gigabytes of RAM and terabytes of fast disk space. Our past defaults were for the smaller systems and these change that to larger shared hosting or shared end user systems, still with a bias towards the smaller end. There is a bias in favour of OLTP workloads, so reporting systems may need more changes. Where there is a conflict between the best settings for benchmarks and normal use, we've favoured production, not benchmarks. We're very interested in your feedback, comments and suggestions.

    Read the article

  • Safari flash wmode not working - anything wrong with this embed?

    - by hfidgen
    I've got a problem with this embed in Safari. It works just fine on all other browsers, IE6 included. The problem is that the embed seems to jump to the very top layer, ignoring all z-index or positioning statements. This is important, because several html design features are overlayed on the flash. This embed was written to work with swfobject, but still doesnt work when: swfobject disabled wmode = transparent/opaque/removed entirely Is this a problem with safari or the code? And if it's the code then what does safari do differently to all the other browsers? Bah. Thanks for any help ;) <object id="Flash_Banner" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="950" height="400" title=""> <param name="movie" value="ui.swf" /> <param name="quality" value="high" /> <param name="wmode" value="opaque" /> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="ui.swf" width="950" height="400" title=""> <param name="quality" value="high" /> <param name="wmode" value="opaque" /> <!--<![endif]--> <div id="banner_slider"><img src="images/banners/case.jpg" width="950" height="400" alt="" /></div> <!--[if !IE]>--> </object> <!--<![endif]--> </object>

    Read the article

  • How to include multiple tables programmaticaly into a Sweave document using R

    - by PaulHurleyuk
    Hello, I want to have a sweave document that will include a variable number of tables in. I thought the example below would work, but it doesn't. I want to loop over the list foo and print each element as it's own table. % \documentclass[a4paper]{article} \usepackage[OT1]{fontenc} \usepackage{longtable} \usepackage{geometry} \usepackage{Sweave} \geometry{left=1.25in, right=1.25in, top=1in, bottom=1in} \listfiles \begin{document} <<label=start, echo=FALSE, include=FALSE>>= startt<-proc.time()[3] library(RODBC) library(psych) library(xtable) library(plyr) library(ggplot2) options(width=80) #Produce some example data, here I'm creating some dummy dataframes and putting them in a list foo<-list() foo[[1]]<-data.frame(GRP=c(rep("AA",10), rep("Aa",10), rep("aa",10)), X1=rnorm(30), X2=rnorm(30,5,2)) foo[[2]]<-data.frame(GRP=c(rep("BB",10), rep("bB",10), rep("BB",10)), X1=rnorm(30), X2=rnorm(30,5,2)) foo[[3]]<-data.frame(GRP=c(rep("CC",12), rep("cc",18)), X1=rnorm(30), X2=rnorm(30,5,2)) foo[[4]]<-data.frame(GRP=c(rep("DD",10), rep("Dd",10), rep("dd",10)), X1=rnorm(30), X2=rnorm(30,5,2)) @ \title{Docuemnt to test putting a variable number of tables into a sweave Document} \author{"Paul Hurley"} \maketitle \section{Text} This document was created on \today, with \Sexpr{print(version$version.string)} running on a \Sexpr{print(version$platform)} platform. It took approx \input{time} sec to process. <<label=test, echo=FALSE, results=tex>>= cat("Foo") @ that was a test, so is this <<label=table1test, echo=FALSE, results=tex>>= print(xtable(foo[[1]])) @ \newpage \subsection{Tables} <<label=Tables, echo=FALSE, results=tex>>= for(i in seq(foo)){ cat("\n") cat(paste("Table_",i,sep="")) cat("\n") print(xtable(foo[[i]])) cat("\n") } #cat("<<label=endofTables>>= ") @ <<label=bye, include=FALSE, echo=FALSE>>= endt<-proc.time()[3] elapsedtime<-as.numeric(endt-startt) @ <<label=elapsed, include=FALSE, echo=FALSE>>= fileConn<-file("time.tex", "wt") writeLines(as.character(elapsedtime), fileConn) close(fileConn) @ \end{document} Here, the table1test chunk works as expected, and produced a table based on the dataframe in foo[[1]], however the loop only produces Table(underscore)1.... Any ideas what I'm doing wrong ?

    Read the article

  • wordpress categories and their subcategories

    - by Ayrton
    Hi I'm looking to obtain all the (parent) categories with their children accordingly (assuming you don't have grandchildren) and make the following structure <div class="box"> <h3><a href="#">Parent Category I</a></h3> <ul> <li><a href="#">sub cat 1</a></li> <li><a href="#">sub cat 2</a></li> <li><a href="#">sub cat 3</a></li> </ul> </div> <div class="box"> <h3><a href="#">Parent Category II</a></h3> <ul> <li><a href="#">sub cat 1</a></li> <li><a href="#">sub cat 2<</a></li> <li><a href="#">sub cat 3</a></li> </ul> </div> I figured it's something like (don't mind the syntax) however I don't know how to obtain those (parent)categories and their children: $parents = ... ; foreach($parents as $parent){ <div> <h3>$parent</h3> $children = ...; <ul> foreach ($children as $child){ <li>$child</li> } </ul> </div> }

    Read the article

  • PHP, MySQL: mysql substitute for php in_array function

    - by Devner
    Hi all, Say if I have an array and I want to check if an element is a part of that array, I can go ahead and use in_array( needle, haystack ) to determine the results. I am trying to see the PHP equivalent of this for my purpose. Now you might have an instant answer for me and you might be tempted to say "Use IN". Yes, I can use IN, but that's not fetching the desired results. Let me explain with an example: I have a column called "pets" in DB table. For a record, it has a value: Cat, dog, Camel (Yes, the column data is a comma separated value). Consider that this row has an id of 1. Now I have a form where I can enter the value in the form input and use that value check against the value in the DB. So say I enter the following comma separated value in the form input: CAT, camel (yes, CAT is uppercase & intentional as some users tend to enter it that way). Now when I enter the above info in the form input and submit, I can collect the POST'ed info and use the following query: $search = $_POST['pets']; $sql = "SELECT id FROM table WHERE pets IN ('$search') "; The above query is not fetching me the row that already exists in the DB (remember the record which has Cat, dog, Camel as the value for the pets column?). I am trying to get the records to act as a superset and the values from the form input as subsets. So in this case I am expecting the id value to show up as the values exist in the column, but this is not happending. Now say if I enter just CAT as the form input and perform the search, it should show me the ID 1 row. Now say if I enter just camel, cAT as the form input and perform the search, it should show me the ID 1 row. How can I achieve the above? Thank you.

    Read the article

  • json parsing problems

    - by C.
    Hi I have the following Json : "{\"doc\":{\"info\":{\"allowDistribution\":\"true\",\"allowSearch\":\"true\",\"calaisRequestID\":\"67a02f61-7e45-cfc4-1276-e123c5f7422f\",\"externalID\":\"\",\"id\":\"http://id.opencalais.com/dBo1YRiQeqS-kfO-m9UeWA\",\"docId\":\"http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb\",\"document\":\"What type of music do you listen to? How much would you pay for a cd? Do you still buy cds? Do you like Shakira? What genre of music do you listen to?\",\"docTitle\":\"\",\"docDate\":\"2010-03-17 17:40:41.323\",\"externalMetadata\":\"\",\"submitter\":\"\"},\"meta\":{\"contentType\":\"text/raw\",\"emVer\":\"7.1.1103.5\",\"langIdVer\":\"DefaultLangId\",\"processingVer\":\"CalaisJob01\",\"submitionDate\":\"2010-03-17 17:40:41.183\",\"submitterCode\":\"b54c734e-b865-185b-c83a-66e1c66272de\",\"signature\":\"digestalg-1|FXnvwLovOsqVoSPX0JfGvj3tp7s=|cyV2tZWY9OXG1RBO0SuND4kd3Pkvqv0cS2YpsEBQhXDfSV4KoE61sQ==\",\"language\":\"English\",\"messages\":[]}},\"http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/1\":{\"_typeGroup\":\"topics\",\"category\":\"http://d.opencalais.com/cat/Calais/EntertainmentCulture\",\"classifierName\":\"Calais\",\"categoryName\":\"Entertainment_Culture\",\"score\":1},\"http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/2\":{\"_typeGroup\":\"topics\",\"category\":\"http://d.opencalais.com/cat/Calais/HumanInterest\",\"classifierName\":\"Calais\",\"categoryName\":\"Human Interest\",\"score\":1},\"http://d.opencalais.com/dochash-1/8edabb36-eece-3f67-b187-ab64cd885ecb/cat/3\":{\"_typeGroup\":\"topics\",\"category\":\"http://d.opencalais.com/cat/Calais/TechnologyInternet\",\"classifierName\":\"Calais\",\"categoryName\":\"Technology_Internet\",\"score\":0.932}}" Can you please tell me why it won't parse this? This is my code: JObject o = JObject.Parse(json); String category = (string)o["doc"]["_typeGroup"]["categoryName"]; It tells me: Object reference not set to an instance of an object. Thanks :)

    Read the article

< Previous Page | 10 11 12 13 14 15 16 17 18 19 20 21  | Next Page >