Search Results

Search found 2301 results on 93 pages for 'calico cat'.

Page 60/93 | < Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >

  • C++: ifstream::getline problem

    - by Jay
    I am reading a file like this: char string[256]; std::ifstream file( "file.txt" ); // open the level file. if ( ! file ) // check if the file loaded fine. { // error } while ( file.getline( string, 256, ' ' ) ) { // handle input } Just for testing purposes, my file is just one line, with a space at the end: 12345 My code first reads the 12345 successfully. But then instead of the loop ending, it reads another string, which seems to be a return/newline. I have saved my file both in gedit and in nano. And I have also outputted it with the Linux cat command, and there is no return on the end. So the file should be fine. Why is my code reading a return/newline? Thanks.

    Read the article

  • Localized tables and Entity Framework

    - by Pyttroll
    Hi all, I have a scenario where I need to localized values of objects in my database. Let's say you have an application that can create animals, if the user is english the value of the "Name" property of an animal would be entered as "Cat" in the UI whereas it would be entered as "Chat" in french. The animal culture table would contain 2 records pointing to the same animal in the parent table. When reading values back, if the value of "Name" does not exist in the user culture the default value (value the object was originally created with) would be used. The following diagrams demonstrate how the data is stored in SQL: I'm trying to map this schema to an object model using the Entity Framework, I'm a bit confused as to what the best way to approach the problem. Is EF appropriate for this? Should I used EF4? This EF model will be used by .NET RIA Services. Thanks, Pierre-Yves Troel Ayuda Media Systems http://www.ayudasystems.com

    Read the article

  • Listing mysql row entries from tags into one single row

    - by Derrick
    Hi guys, Ive got two tables, one a listings and another representing a list of tags for the listing table. In the listings table the tag ids are stored in a field called tags as 1-2-3- this has worked out very well for me regular expressions and joins to seperate and display the data, BUT... I now need to pull the titles of those tags into a single row. See below. listings table id tags 1 1-2-3- 2 4-5-6- tags table id title 1 pig 2 dog 3 cat 4 mouse 5 elephant 6 duck And what I need to produce out of the listings table is: id tags 2 mouse, elephant, duck any suggestions?

    Read the article

  • JSON Search and remove in php?

    - by moogeek
    Hello! I have a session variable $_SESSION["animals"] containing a deep json object with values: $_SESSION["animals"]='{ "0":{"kind":"mammal","name":"Pussy the Cat","weight":"12kg","age":"5"}, "1":{"kind":"mammal","name":"Roxy the Dog","weight":"25kg","age":"8"}, "2":{"kind":"fish","name":"Piranha the Fish","weight":"1kg","age":"1"}, "3":{"kind":"bird","name":"Einstein the Parrot","weight":"0.5kg","age":"4"}, }'; For example, I want to find the line with "Piranha the Fish" and then remove it (and json_encode it again as it was). How to do this? I guess i need to search in json_decode($_SESSION["animals"],true) resulting array and find the parent key to remove but i'm stucked anyways.

    Read the article

  • Merging MySQL row entries into a single row

    - by Derrick
    I've got two tables, one for listings and another representing a list of tags for the listings table. In the listings table the tag ids are stored in a field called tags as 1-2-3-. This has worked out very well for me (regular expressions and joins to separate and display the data), but I now need to pull the titles of those tags into a single row. See below. listings table id tags 1 1-2-3- 2 4-5-6- tags table id title 1 pig 2 dog 3 cat 4 mouse 5 elephant 6 duck And what I need to produce out of the listings table is: id tags 2 mouse, elephant, duck

    Read the article

  • Wordpress Post order

    - by kwek-kwek
    I wanted to re-arrange my post in wordpress so they go Ascending/Descending. Here is my code: <ul> <?php $postslist = get_posts('cat=3,4,5,numberposts=5&order=DESC&orderby=date'); foreach ($postslist as $post) : setup_postdata($post); ?> <li> <span class="date"><?php the_time('M j') ?></span> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a> </li> <?php endforeach; ?> </ul> Each post is pulled from different categories.

    Read the article

  • implementing feature structures: what data type to use?

    - by Dervin Thunk
    Hello. In simplistic terms, a feature structure is an unordered list of attribute-value pairs. [number:sg, person:3 | _ ], which can be embedded: [cat:np, agr:[number:sg, person:3 | _ ] | _ ], can subindex stuff and share the value [number:[1], person:3 | _ ], where [1] is another feature structure (that is, it allows reentrancy). My question is: what data structure would people think this should be implemented with for later access to values, to perform unification between 2 fts, to "type" them, etc. There is a full book on this, but it's in lisp, which simplifies list handling. So, my choices are: a hash of lists, a list of lists, or a trie. What do people think about this?

    Read the article

  • Wordpress comments - perform simple math?

    - by RodeoRamsey
    I have a Wordpress website in which one of the categories I've stripped the comments field down to basic whole numbers only. The logged in user can enter data on the post via the "comments" field, in basic simple whole numbers. Is there any way to take the MOST RECENT comment on all posts from that category (cat 1) and run basic math? My goal is to take the most recent comment's input from each post and add it together and display it via some php/html on another page/post or widget somewhere. Thanks!

    Read the article

  • What is the best method to write user "log files" of an android application to a file in a remote server or a table in a remote database?

    - by Samitha Chathuranga
    I am creating a multi user android application and it is connected to a php web service in a remote server and to a remote database via that web service. I want to keep a track of all the important activities done by the users. For an example if a user logged in to the app and changed his profile details and then logged out, a brief description of what he has done should be recorded(with time) somewhere. So then the admin of the system can see what the users are doing. So I think it is better to use log cat files and then flush all those data to a unique file in the server or a table in the database, when the user logs out or exists from his account. If it is appropriate How to do it?

    Read the article

  • Linux standard input issue

    - by George2
    Hello everyone, I am new to Linux. And I am using Red Hat Enterprise Version 5. There is a ruby program which use standard input as its input (e.g. the Ruby program process input from standard input). I think standard input should be keyboard, correct? So, I think other kinds of input (non-standard input) should not work (i.e. the ruby program should not be able to read input from such non-standard input), but actually I have tried using pipe works, I am so confused because I think pipe should be some other kinds of input -- other than standard input, why it could work? i.e. put text "123" in abc.txt with pipe, could achieve the same result as using keyboard as input to type "123" for the ruby program. Here is the sample which works and makes me confused, cat abc.txt | ~/test/rubysrc/foo.rb thanks in advance, George

    Read the article

  • empty() not a valid callback?

    - by user151841
    I'm trying to use empty() in array mapping in php. I'm getting errors that it's not a valid callback. $ cat test.php <? $arrays = array( 'arrEmpty' => array( '','','' ), ); foreach ( $arrays as $key => $array ) { echo $key . "\n"; echo array_reduce( $array, "empty" ); var_dump( array_map("empty", $array) ); echo "\n\n"; } $ php test.php arrEmpty Warning: array_reduce(): The second argument, 'empty', should be a valid callback in /var/www/authentication_class/test.php on line 12 Warning: array_map(): The first argument, 'empty', should be either NULL or a valid callback in /var/www/authentication_class/test.php on line 13 NULL Shouldn't this work? Long story: I'm trying to be (too?) clever and checking that all array values are not empty strings.

    Read the article

  • scala syntax highlighting in bluefish

    - by Synesso
    Scala comes packaged with bluefish syntax config in misc/scala-tool-support/bluefish/ I have attempted to configure this, as per the README, but there is no effect. cp ~/.bluefish/highlighting ~/.bluefish/highlighting_ cat ~/.bluefish/highlighting_ /opt/scala/scala-2.7.7.final/misc/scala-tool-support/bluefish/highlighting > ~/.bluefish/highlighting I have ensured highlighting is turned on in the bluefish config. I have not used bluefish before and am trying it for the first time because there is syntax highlighting support for it. The README says any file I open that has a .scala extension will have the scala highlighting applied. Instead I see no highlighting.

    Read the article

  • CentOS: revert python version back to original

    - by NP
    Hi all, I installed python 2.6 using the instructions here on CentOS 5.4. However I realized it was a bad move and I need to revert back to 2.4, which was there originally. Can anyone guide me on how to undo what I did here? In particular, I am not sure how to undo this: Configure ld to find your shared libs: $ cat /etc/ld.so.conf.d/opt-python2.5.conf /opt/python2.5/lib (hit enter) (hit ctrl-d to return to shell) $ ldconfig I tried removing the alias and the symlink and even re-aliasing python to /usr/bin/python, but when I try to install an RPM i get this error: error: Failed dependencies: libpython2.4.so.1.0 is needed by ... Thanks in advance.

    Read the article

  • wp-pagenavi keeps loading first page

    - by Adrian
    Hi I had done this correctly but unfornately its still not working, no matter what page I click in the pagination it keeps loading the first page, is it something to do with $paged? <?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?> <?php query_posts('cat=14&posts_per_page=3'."&paged=$paged".get_query_var('page')); ?> <?php $id = get_the_ID(); $count = 0; if (have_posts()) : ?> <?php while ( have_posts() ) : the_post(); .......do stuff <?php endwhile; ?> <?php wp_pagenavi(); ?> <?php wp_reset_query();?> <?php endif; ?>

    Read the article

  • Bash: Check if file was modified since used in script

    - by Thomas Münz
    I need to check in a script if a file was modified since I read it (another application can modify it in between). According to bash manual there is a "-N" test which should report if a file was modified since last read. I tried it in a small script but it seems like it doesn't work. #!/bin/bash file="test.txt" echo "test" > $file cat $file; if [ -N $file ]; then echo "modified since read"; else echo "not modified since read"; fi I also tried an alternative way by touching another file and using if [ "file1" -nt "file2 ]; but this works only on a seconds accuracy which may under rare conditions not be sufficient. Is there any other bash-inbuilt solution for this problem or I do really need to use diff or md5sum?

    Read the article

  • unexpected result from gnu sort

    - by funkycat
    when I try to sort the following text file 'input': test1 3 test3 2 test 4 with the command sort input the output is exactly the input. Here is the output of od -bc input : 0000000 164 145 163 164 061 011 063 012 164 145 163 164 063 011 062 012 t e s t 1 \t 3 \n t e s t 3 \t 2 \n 0000020 164 145 163 164 011 064 012 t e s t \t 4 \n 0000027 It's just a tab separated file with two columns. When I do sort -k 2 The output changes to test3 2 test1 3 test 4 which is what I would expect. But if I do sort -k 1 nothing changes with respect to the input, whereas I would expect 'test' to sort before 'test1'. Finally, if I do cat input | cut -f 1 | sort I get test test1 test3 as expected. Is there a logical explanation for this? What exactly is sort supposed to do by default, something like: sort -k 1 ? My version of sort: sort (GNU coreutils) 7.4

    Read the article

  • Getting publish_stream extended permission from the user

    - by José Joel.
    I was ussing Facbook connect in my iPhone app, but in december the posts stopped working. After some research I found that i'm supossed to use stream.publish, something like: NSString *att = @"{\"bob\":\"i\'m happy\",\"caption\": \"User rated the internet 5 stars\", \"description\": \"a giant cat\"}"; NSDictionary *attachment = [NSDictionary dictionaryWithObject:att forKey:@"attachment"]; [[FBRequest requestWithDelegate:self] call:@"facebook.stream.publish" params:attachment]; Which i think it's correct, but the posts still don't work. Someone told me that i need to get publish_stream extended permission from the user, but i dont know how to do that.

    Read the article

  • click buttons error

    - by sara
    I will retrieve student information (id -number- name) from a database (MySQL) as a list view, each student have 2 buttons (delete - alert ) and radio buttons Every thing is ok, but how can I make an onClickListener, for example for the delete button because I try lots of examples, I heard that I can use (custom list or get view or direct onClickListener as in my code (but it is not working ) or Simple Cursor Adapter) I do not know what to use, I looked around for examples that can help me, but in my case but I did not find any so I hope this be reference for anyone have the same problem. this is my code which I use direct onClick with Simple Adapter public class ManageSection extends ListActivity { //ProgresogressDialog pDialog; private ProgressDialog pDialog; // Creating JSON Parser object // Creating JSON Parser object JSONParser jParser = new JSONParser(); //class boolean x =true; Button delete; ArrayList<HashMap<String, String>> studentList; //url to get all products list private static String url_all_student = "http://10.0.2.2/SmsPhp/view_student_info.php"; String cl; // JSON Node names private static final String TAG_SUCCESS = "success"; private static final String TAG_student = "student"; private static final String TAG_StudentID = "StudentID"; private static final String TAG_StudentNo = "StudentNo"; private static final String TAG_FullName = "FullName"; private static final String TAG_Avatar="Avatar"; HashMap<String, String> selected_student; // course JSONArray JSONArray student = null; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.manage_section); studentList = new ArrayList<HashMap<String, String>>(); ListView list1 = getListView(); list1.setAdapter(getListAdapter()); list1.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int pos, long l) { selected_student =(HashMap<String, String>) studentList.get(pos); //member of your activity. delete =(Button)view.findViewById(R.id.DeleteStudent); cl=selected_student.get(TAG_StudentID); Toast.makeText(getBaseContext(),cl,Toast.LENGTH_LONG).show(); delete.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Log.d("id: ",cl); Toast.makeText(getBaseContext(),cl,Toast.LENGTH_LONG).show(); } }); } }); new LoadAllstudent().execute(); } /** * Background Async Task to Load all student by making HTTP Request * */ class LoadAllstudent extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(ManageSection.this); pDialog.setMessage("Loading student. Please wait..."); pDialog.setIndeterminate(false); } /** * getting All student from u r l * */ @Override protected String doInBackground(String... args) { // Building Parameters List<NameValuePair> params = new ArrayList<NameValuePair>(); // getting JSON string from URL JSONObject json = jParser.makeHttpRequest(url_all_student, "GET", params); // Check your log cat for JSON response Log.d("All student : ", json.toString()); try { // Checking for SUCCESS TAG int success = json.getInt(TAG_SUCCESS); if (success == 1) { // student found // Getting Array of course student = json.getJSONArray(TAG_student); // looping through All courses for (int i = 0; i < student.length(); i++)//course JSONArray { JSONObject c = student.getJSONObject(i); // read first // Storing each json item in variable String StudentID = c.getString(TAG_StudentID); String StudentNo = c.getString(TAG_StudentNo); String FullName = c.getString(TAG_FullName); // String Avatar = c.getString(TAG_Avatar); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_StudentID, StudentID); map.put(TAG_StudentNo, StudentNo); map.put(TAG_FullName, FullName); // adding HashList to ArrayList studentList.add(map); } } else { x=false; } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { // dismiss the dialog after getting all products pDialog.dismiss(); if (x==false) Toast.makeText(getBaseContext(),"no student" ,Toast.LENGTH_LONG).show(); ListAdapter adapter = new SimpleAdapter( ManageSection.this, studentList, R.layout.list_student, new String[] { TAG_StudentID, TAG_StudentNo,TAG_FullName}, new int[] { R.id.StudentID, R.id.StudentNo,R.id.FullName}); setListAdapter(adapter); // Updating parsed JSON data into ListView } } } So what do you think, why doesn't the delete button work? There is no error in my log cat. What is the alternative way ?.. what should I do ?

    Read the article

  • how to pass the value in php file using Ajax.Request() function.The way i do use it's not working Wh

    - by user309381
    <html><head> function reload(form) { var val = $('seltab').getValue(); new Ajax.Request('Website.php?$cat = val', { method:'post', onSuccess: function(transport) { ..... </head> Code in PHP: echo "<select id = seltab onchange = 'reload(this.form)'>"; $querysel = "SELECT title_id,author FROM authors NATURAL JOIN books"; $result1 = mysql_query($querysel) ; while($rowID = mysql_fetch_assoc($result1)) { .... }

    Read the article

  • No drop packets using the error models for wirelesss scenario ?

    I am trying to use the error model in ns2 with wireless links, I am using ns2.33. I tried the uniform error model and the markov chain model. No errors from ns but when I am trying to find the dropped packets due to corruption I can not find any of them using either the uniform or markov models. So please help me if I made any error in using the error model. to search for dropped packets I am using eid@eid-laptop:~/code/ns2/noisy$ cat mixed.tr | grep d My code is available here : http://pastebin.com/f68749435

    Read the article

  • Inheritance or identifier

    - by Lina
    Hi! Does anyone here have opinions about when to user inheritance and when to use an identifier instead? Inheritance example: class Animal { public int Name { get; set; } } class Dog : Animal {} class Cat : Animal {} Identifier example: class Animal { public int Name { get; set; } public AnimalType { get; set; } } In what situations should i prefer which solution and what are the pros and cons for them? /Lina

    Read the article

  • Mysql 'On Duplicate Key INSERT .... SELECT...'

    - by calumbrodie
    Hi, I'm looking for a way to do the following in mysql. INSERT INTO category (cat_id,sku,description,color) VALUES ('$cat_id','$sku','$description','$color') ON DUPLICATE KEY UPDATE description=$description" this works fine... but I want something further to happen if there is a duplicate key. I want to copy a row from the 'product' table to the 'categorized_products'... AND INSERT categorized_products (a,b,c) SELECT a,b,c FROM products WHERE products.cat = '$cat_id' is there a way to do the INSERT...SELECT as part of the first query or do I need to evaluate the above with mysql_affected_rows ( 1 is updated and == 1 is inserted) and then run my second query. Obviously the above will work but means another query and more LOC. Thanks!

    Read the article

  • Weird problem, with ghostscript and pdf files.

    - by kofucii
    Hello, am using ghostscript to create pdf file from postscript file. My PS file, doesn't have orientation instructions, so when I want to create landscape pdf file, I'm using ghostscript to rotate the page. The problem is, that ghostscript rotates only the first page, and when my pdf file is more than 1 page, the others, are not rotated correctly. Here is the command I'm using: cat $psinput | gs -sPAPERSIZE=a4 -sDEVICE=pdfwrite -sOuputFile="/tmp/pdf" \ -dAutoRotatePages="/None" -c "<< /Orientation 3 >> setpagedevice" \ 90 rotate 0 -595 translate -dNOPAUSE -dEPSCrop -f - -c -quit Does anybody have an idea how to correct this?

    Read the article

  • Cell color change In Excel Using Conditional formatting in C#

    - by Suryakavitha
    Hi, I have exported datatable to excel successfully... Now i have to change some cell color using Conditional formatting in Excel sheet using C#.... For example if a cell contains text as "Cat" it should be display in Green color and if a cell contains text as "Dog" it should display in blue Color.... Now how can i do this ? Plz Anyone tell me the solution of this ... or give me the code for it... Thanks In Advance..

    Read the article

  • Svn: revert file content changes without reverting any related mergeinfo?

    - by George Hawkins
    If you've done a merge you may find, before committing the changes, that actually you don't want to accept any of the changes merged into one of the affected files. So you do e.g.: $ svn revert foo.c However this also seems to revert the mergeinfo related to this file. So when you do a subsequent merge it will merge in exactly the same changes again. Rather than revert one could do: $ svn cat foo.c foo.c But this doesn't seem like the right way to do things? Is there something that more clearly indicates what I'm trying to achieve, i.e. to say "consider the merge done for this file but don't change its contents"?

    Read the article

< Previous Page | 56 57 58 59 60 61 62 63 64 65 66 67  | Next Page >