Search Results

Search found 2348 results on 94 pages for 'cat pants'.

Page 12/94 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • How can I check detailed memory information on linux?

    - by user35153
    I know that I can check cpu info via cat /proc/cpuinfo and memory info via cat /proc/meminfo. but cat /proc/meminfo yiels result like : MemTotal: 66098352 kB MemFree: 329152 kB Buffers: 632432 kB Cached: 62619692 kB SwapCached: 0 kB Active: 6425444 kB Inactive: 58717276 kB SwapTotal: 1951888 kB SwapFree: 1951796 kB Dirty: 38416 kB Writeback: 0 kB AnonPages: 1890268 kB Mapped: 12624 kB Slab: 464580 kB SReclaimable: 275812 kB SUnreclaim: 188768 kB PageTables: 7524 kB NFS_Unstable: 0 kB Bounce: 0 kB CommitLimit: 35001064 kB Committed_AS: 3860248 kB VmallocTotal: 34359738367 kB VmallocUsed: 125636 kB VmallocChunk: 34359612527 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB But I want to learn info on the clock speed of the memories (in Mhz?) HOW can I get That Info ? Thnks

    Read the article

  • Checking detailed memory information on Linux

    - by user35153
    I know that I can check CPU info via cat /proc/cpuinfo and memory info via cat /proc/meminfo. But cat /proc/meminfo yields results like the following: MemTotal: 66098352 kB MemFree: 329152 kB Buffers: 632432 kB Cached: 62619692 kB SwapCached: 0 kB Active: 6425444 kB Inactive: 58717276 kB SwapTotal: 1951888 kB SwapFree: 1951796 kB Dirty: 38416 kB Writeback: 0 kB AnonPages: 1890268 kB Mapped: 12624 kB Slab: 464580 kB SReclaimable: 275812 kB SUnreclaim: 188768 kB PageTables: 7524 kB NFS_Unstable: 0 kB Bounce: 0 kB CommitLimit: 35001064 kB Committed_AS: 3860248 kB VmallocTotal: 34359738367 kB VmallocUsed: 125636 kB VmallocChunk: 34359612527 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB I want to learn more about the clock speed of the memory (in Mhz?). How do I get that information?

    Read the article

  • Need script to redirect STDIN & STDOUT to named pipes

    - by user54903
    I have an app that launches an authentication helper (my script) and uses STDIN/STDOUT to communicate. I want to re-direct STDIN and STDOUT from this script to two named pipes for interaction with another program. E.g.: SCRIPT_STDIN pipe1 SCRIPT_STDOUT < pipe2 Here is the flow I'm trying to accomplish: [Application] - Launches helper script, writes to helpers STDIN, reads from helpers STDOUT (example: STDIN:username,password; STDOUT:LOGIN_OK) [Helper Script] - Reads STDIN (data from app), forwards to PIPE1; reads from PIPE2, writes that back to the app on STDOUT [Other Process] - Reads from PIPE1 input, processes and returns results to PIPE2 The cat command can almost do what I want. If there were an option to copy STDIN to STDERR I could make cat do this with a command (assuming the fictitious option -e echos to STDERR rather than STDOUT): cat -e PIPE2 2PIPE1 (read from PIPE2 and write it to STDOUT, copy input, normally going to STDERR to PIPE1)

    Read the article

  • .php files see Apache environment variables, .html files don't

    - by dotancohen
    Consider this environment: $ cat .htaccess AddType application/x-httpd-php .php .html SetEnv Foo Bar $ cat test.php <?php echo "Hello: "; echo $_SERVER['Foo']; echo $_ENV['Foo']; echo getenv('Foo'); ?> $ cat test.html <?php echo "Hello: "; echo $_SERVER['Foo']; echo $_ENV['Foo']; echo getenv('Foo'); ?> This is the output of test.php: Hello BarBarBar This is the output of test.html: Hello Why might that be? How might I fix it? Here is phpinfo.php: http://pastebin.com/rgq7up61 Here is phpinfo.html: http://pastebin.com/VUKFNZ36 If anyone knows where I can host a real webpage instead of just the HTML for one, please let me know and I'll move the content to there. Thanks.

    Read the article

  • Syntax error in apc.ini: unexpected '='

    - by Ashley
    I installed APC on Ubuntu 10.04 and it seems to be working fine but I'm seeing this error in my Apache error.log: PHP: syntax error, unexpected '=' in /etc/php5/apache2/conf.d/apc.ini on line 2 The contents of the file are: cat /etc/php5/apache2/conf.d/apc.ini extension=apc.so apc.enabled="1" apc.shm_segments="1" apc.shm_size="192" apc.num_files_hint="1024" And I have also tried it without the quotes (") around the values and get the same error. I've looked at loads of the tutorials on installing APC that mention apc.ini and they all seem to use one of the two syntax formats I have tried. I'd appreciate any ideas. Update: This still causes it: cat /etc/php5/apache2/conf.d/apc.ini extension='apc.so' apc.enabled='1' apc.shm_segments='1' apc.shm_size='192' apc.num_files_hint='1024' I changed to: cat /etc/php5/apache2/conf.d/apc.ini extension=apc.so and it still happens (there's no line 2 in the file now!) I'm assuming a /etc/init.d/apache2 reload will be sufficient to read the new config, is that my mistake?

    Read the article

  • passing URL vars to a wordpress page and pretty-fying it with .htaccess

    - by Jonah
    I have wordpress installed in a directory called welcome, and /welcome/samples is a "page" (created via Wordpress). It's has a php template waiting for a $_REQUEST['category'] When a user goes to /welcome/samples/fun, I want to have "fun" passed to the samples php template in the form welcome/samples/?category=fun But I want the URL to remain in its original form - it's currently replacing the it with the ugly "?cat...etc" # Outside the wordpress block so it won't be overwritten Options +FollowSymlinks RewriteEngine On RewriteRule ^samples/([^/]+)$ /welcome/samples?cat=$1 [R,L] # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /welcome/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /welcome/index.php [L] </IfModule> # END WordPress I tried Rewriting with simply samples?cat=$1 but I was getting a 404. I tried putting in the RewriteBase /welcome/ in the first block. without the [R] flag it doesn't work at all. I keep trying different permutations... and failing:( Perhaps I'm missing some basic concepts... thanks if you take the time to even read through this:) ciao

    Read the article

  • Files listed by bash but unaccessible

    - by Cerin
    What would cause the following behavior on an Ubuntu 12.04 system? I've SSHed into a machine as the "ubuntu" user. Running ls -lah /data/* shows dozens of non-empty files (e.g. file1.txt, file2.txt, etc), all owned by the "ubuntu" user/group, and with full read/write access. If I try to cat /data/file1.txt, bash gives me the error "cat: /data/file1.txt: No such file or directory" In short, ls is listing files, but in every other way, the files essentially don't exist. I can't cat them or read them in any way. Even giving all the files 777 permission doesn't change anything. This is really bizarre. What's going on here?

    Read the article

  • Grepping grep output fails

    - by viraptor
    I'm trying to grep the output of ngrep. Unfortunately when I add another grep to the pipeline, I get no output at all. It can be some other command too - cat / grep / tee - everything breaks the chain. Example: # this works: $ ngrep -l -q -T -Wbyline -d any udp and port 5060 | egrep -B1 '^SIP/2.0 180' -- U +1.469535 xxx:5060 -> xxx:5060 SIP/2.0 180 Ringing. -- U +0.001384 xxx:5060 -> xxx:2048 SIP/2.0 180 Ringing. but #these don't: $ ngrep -l -q -T -Wbyline -d any udp and port 5060 | egrep -B1 '^SIP/2.0 180' | egrep '^U' $ ngrep -l -q -T -Wbyline -d any udp and port 5060 | egrep -B1 '^SIP/2.0 180' | cat $ ngrep -l -q -T -Wbyline -d any udp and port 5060 | egrep -B1 '^SIP/2.0 180' | tee test If I use cat somefile instead of ngrep at the start, everything works as expected. Any ideas what could go wrong here?

    Read the article

  • ssl_error_log apache issue

    - by lakshmipathi
    https://localhost works but https://ipaddress didn't cat logs/ssl_error_log [Mon Aug 02 19:04:11 2010] [error] [client 192.168.1.158] (13)Permission denied: access to /ajaxterm denied [root@space httpd]# cat logs/ssl_access_log 192.168.1.158 - - [02/Aug/2010:19:04:11 +0530] "GET /ajaxterm HTTP/1.1" 403 290 [root@space httpd]# cat logs/ssl_request_log [02/Aug/2010:19:04:11 +0530] 192.168.1.158 SSLv3 DHE-RSA-CAMELLIA256-SHA "GET /ajaxterm HTTP/1.1" 290 httpd.conf file NameVirtualHost *:443 <VirtualHost *:443> ServerName localhost SSLEngine on SSLCertificateFile /etc/pki/tls/certs/ca.crt SSLCertificateKeyFile /etc/pki/tls/private/ca.key <Directory /usr/share/ajaxterm > Options FollowSymLinks AllowOverride None Order deny,allow Allow from All </Directory> DocumentRoot /usr/share/ajaxterm DirectoryIndex ajaxterm.html ProxyRequests Off <Proxy *> # Order deny,allow Allow from all </Proxy> ProxyPass /ajaxterm/ http://localhost:8022/ ProxyPassReverse /ajaxterm/ http://localhost:8022/ ErrorLog error_log.log TransferLog access_log.log </VirtualHost> How to fix this ?

    Read the article

  • NFSv4 with idmap

    - by HTF
    The following errors appear on the NFS server, could you please advise how I can fix this? Details: System: CentOS release 6.4, NFS: nfs-utils-1.2.3-36 # cat /etc/idmapd.conf [General] Domain = domain.com [Mapping] Nobody-User = nobody Nobody-Group = nobody [Translation] Method = nsswitch Sep 3 08:25:28 snode1 rpc.idmapd[1382]: nss_getpwnam: name '0' does not map into domain 'domain.com' Sep 3 08:25:29 snode1 rpc.idmapd[1382]: nss_getpwnam: name '500' does not map into domain 'domain.com' EDIT: 03 Sep 2013 10:41 Please note that I'm using NFSv4 and these errors appear on NFS server only (not NFS clients). Server: # cat /etc/sysconfig/nfs MOUNTD_NFS_V2="no" MOUNTD_NFS_V3="no" ... RPCNFSDARGS="-N 2 -N 3" Clients: # cat /etc/fstab server:/ /data nfs4 defaults,hard,intr,timeo=15,_netdev,noatime,nodiratime,nosuid 0 0

    Read the article

  • jquery dynamic select doesn't submit values

    - by n00b0101
    I have a form that includes three select boxes. The first one is categories, and selecting a category from it will populate the variables multi-select box with values specific to the selected category. Selecting variables and then clicking "add selected" will populate the target select box will those variables. The problem is, print_r shows that the values in the target select box aren't passed upon submit, and I don't understand why... Below is the code, and help is really appreciated Here's the html markup: <select multiple="" id="categories" name="categories[]"> <option class="category" value="Income">Income</option> <option class="category" value="Gender">Gender</option> <option class="category" value="Age">Age</option> </select> //note that i'm only showing variables for a presumably select category <select multiple="multiple" id="variables" name="variables[]"> <option value="2">Less Than $15,000</option> <option value="3">$15,000 - $19,999</option> <option value="4">$20,000 - $29,999</option> <option value="5">$30,000 - $39,999</option> <option value="6">$40,000 - $49,999</option> <option value="11">$90,000 - $99,999</option> <option value="12">$100,000 - $124,999</option> <option value="13">$125,000 - $149,999</option> <option value="14">Greater than $149,999</option> </select> <select name="target[]" id="target" multiple="multiple" height="60"> </select> And here's the jquery code: $(function(){ var opts = {}, $cats = $("#categories"), $target = $("#target"), $vars = $("#variables"); $vars.find("option").each(function(){ var $opt = $(this), cat = this.className, value = this.value, label = $opt.text(); if(!opts[cat]) { opts[cat] = []; } opts[cat].push({label: label, value: value}); $opt.remove(); }); function update_variables(){ var cat = $cats.val(), new_opts = []; $vars.empty(); $.each(opts[cat], function(){ if( $target.find('[value=' + this.value + ']').length === 0 ){ new_opts.push(option(this.value, this.label)); } }); $vars.html(new_opts.join('')); } function option(value, label){ return "<option value='" + value + "'>" + label + "</option>"; } $("#add").click(function(e){ e.preventDefault(); $vars.find(':selected').appendTo($target).attr('selected',false); update_variables(); }); $("#remove").click(function(e){ e.preventDefault(); $target.find(':selected').remove(); update_variables(); }); $cats.change(function(){ update_variables(); }).change(); })

    Read the article

  • How to join video files from terminal?

    - by Leon Vitanos
    I have tried avidemux2_cli, mencoder, ffmpeg, cat.. But this doesn't always work (With the most of the times the error is that the audio codec is not the same) Maybe i put wrong options in the commands. So the commands: cat Sample.avi rrr.avi > complete.avi ffmpeg -i Sample.avi -i output.avi -vcodec copy -acodec copy complete.avi mencoder -ovc lavc -oac copy Sample.avi rrr.avi -o complete.avi avidemux2_cli --audio-codec copy --video-codec copy --output-format avi --load Sample.avi -append output.avi --save video.avi The cat problem is that it doesn't show error but it doesn't work always..Like the complete.avi will be exactly the same with Sample.avi Fmmpeg does nothing. The complete.avi is always the same with Sample.avi Mencoder error: All files must have identical audio codec and format for -oac copy. So the complete.avi is the same with Sample.avi avidemux2_cli there is no error but the complete.avi is again the same with Sample.avi.. So to sum up, all complete.avi are the same with Sample.avi.. And the problem is that they don't have the same audio codec ( i quess ).. Any ideas?

    Read the article

  • Wake laptop when lid is opened?

    - by crackout12
    I have a SAMSUNG laptop, which by the experience in the last months, has been a great one. I am actually implementing some functionality to it, and since I noticed, I am able to wake up my laptop from sleep by just opening the lid on Windows 7, however, I need to press to power button to wake up in Ubuntu. Using a program called i-nex, I noted that the kernel DOES dettect a "lid switch", and I am looking forward to use it to wake up function. Any ideas? UPDATE: Thanks @yossile for bringing up some clues! However, output of command cat /proc/acpi/wakeup does not show the LID device. I still tried the second set of commands you gave me with no effect. Then I tried experimenting, guessing that LID should be named by other value, so I tried enabling the others. No victory so far. But I noticed that devices that did not have any pci listings were disabled at all time no matter what I tried. Here is the output of command cat /proc/acpi/wakeup: root@samsung:~# cat /proc/acpi/wakeup Device S-state Status Sysfs node PCE4 S4 *disabled pci:0000:00:04.0 SBAZ S4 *disabled pci:0000:00:14.2 P0PC S4 *disabled pci:0000:00:14.4 GEC S4 *disabled PE20 S4 *disabled pci:0000:00:15.0 PE21 S4 *disabled PE22 S4 *disabled pci:0000:00:15.2 PE23 S4 *disabled PWRB S5 *enabled So maybe it could be that LID is either GEC,PE21, or PE23? Still, there is /proc/acpi/button/lid/LID/state file which shows that LID is opened. Any more ideas?

    Read the article

  • Jocuri friv pentru toti

    - by haioase
    Jocurile online sunt o modalitate foarte simpla de a te relaxa in timpul liber si spun acest lucru deoarece nu ai altceva de facut decat sa te asezi in fata calculatorului, sa cauti pe internet ceea ce iti place si sa te joci cat vrei - sau cat de mult timp ai la dispozitie.Poate si din cauza ca sunt atat de cautate, industria jocurilor de pe internet a devenit tot mai infloritoare in ultima decada.Un site unde poti sa gasesti o multitudine de jocuri flash este si friv.me.uk games - Play your favorite online game, site dedicat in exclusivitate jocurilor friv de tot felul. Dupa cum se vede din titlu este in limba engleza, dar acest lucru nu cred ca reprezinta un impediment pentru vizitatorii din lumea intreaga care viziteaza www.friv.me.uk , deoarece astazi pana si copiii de gradinita stiu semnificatia cuvintelor play this game sau click here to play.Daca va intrebati ce sa alegeti din multele jocuri de acolo, v-as sugera sa incercati noile jocuri friv de strategie, deoarece sunt atat haioase, cat si interesante si educative pentru cei mici. Nu iti trebuie dexteritate in apasarea tastelor, ci o minte organizata, deoarece trebuie sa iti faci un plan de aparare foarte bun pentru a putea castiga un joc de genul lui Bloons tower defense, de exemplu.Fetelor care vor sa se joace pe friv.me.uk as vrea sa le sugerez cateva jocuri speciale pentru ele, cum ar fi cele de gatit impreuna cu Dora. Se vor distra copios, preparand cea mai gustoasa pizza in bucataria virtuala a Dorei si, in acelasi timp, vor invata fractiile, deoarece trebuie sa imparta pizza in felii egale pentru toti cei aflati la masa.Acestea au fost doar cateva idei despre ce jocuri friv puteti sa va jucati in fiecare zi pe friv.me.uk. Voi alegeti orice va place si stati oricat vreti acolo, pentru ca este un site unde va puteti amuza foarte tare impreuna cu prietenii sau familia. Distractie placuta tuturor!

    Read the article

  • GDM locale problems

    - by Simón
    I have two problems with GDM on Ubuntu 10.04. The first is with locales. In my system I have defined: $ cat /etc/environment PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games" LANG="es_ES.UTF-8" LANGUAGE="es_ES:es:en_US:en" $ cat /etc/default/locale LANG="es_ES.UTF-8" LANGUAGE="es_ES:es:en_US:en" $ cat /var/lib/locales/supported.d/local es_ES UTF-8 es_ES.UTF-8 UTF-8 en_US UTF-8 en_US.UTF-8 UTF-8 But when I enter in gnome desktop: $ locale LANG=es_ES LANGUAGE=es_ES:es:en_US:en LC_CTYPE="es_ES" LC_NUMERIC="es_ES" LC_TIME="es_ES" LC_COLLATE="es_ES" LC_MONETARY="es_ES" LC_MESSAGES="es_ES" LC_PAPER="es_ES" LC_NAME="es_ES" LC_ADDRESS="es_ES" LC_TELEPHONE="es_ES" LC_MEASUREMENT="es_ES" LC_IDENTIFICATION="es_ES" LC_ALL= I have deleted ~/.dmrc and I have restarted the system but nothing. GDM login screen also doesn't permit change this setting. However, in the text terminals (tty1,...): $ locale LANG=es_ES.UTF-8 LANGUAGE=es_ES:es:en_US:en LC_CTYPE="es_ES.UTF-8" LC_NUMERIC="es_ES.UTF-8" LC_TIME="es_ES.UTF-8" LC_COLLATE="es_ES.UTF-8" LC_MONETARY="es_ES.UTF-8" LC_MESSAGES="es_ES.UTF-8" LC_PAPER="es_ES.UTF-8" LC_NAME="es_ES.UTF-8" LC_ADDRESS="es_ES.UTF-8" LC_TELEPHONE="es_ES.UTF-8" LC_MEASUREMENT="es_ES.UTF-8" LC_IDENTIFICATION="es_ES.UTF-8" LC_ALL= The solution to problem is to edit .drmc file, but I think this isn't the right way. Why doesn't GDM read/apply the system locales? Why don't I see, in GDM login screen, the box to change the locale?

    Read the article

  • Better solution then simple factory method when concrete implementations have different attributes

    - by danip
    abstract class Animal { function eat() {..} function sleep() {..} function isSmart() } class Dog extends Animal { public $blnCanBark; function isSmart() { return $this->blnCanBark; } } class Cat extends Animal { public $blnCanJumpHigh; function isSmart() { return $this->blnCanJumpHigh; } } .. and so on up to 10-20 animals. Now I created a factory using simple factory method and try to create instances like this: class AnimalFactory { public static function create($strName) { switch($strName) { case 'Dog': return new Dog(); case 'Cat': return new Cat(); default: break; } } } The problem is I can't set the specific attributes like blnCanBark, blnCanJumpHigh in an efficient way. I can send all of them as extra params to create but this will not scale to more then a few classes. Also I can't break the inheritance because a lot of the basic functionality is the same. Is there a better pattern to solve this?

    Read the article

  • SQL*Plus??? - ?????????1??????(????? ???Tips-1)

    - by Yuichi.Hayashi
    ??????????SQL*Plus????3?????????????? ????????????????????????????????????????2??????????????????????????????????????????????? ??????????????????1????????????????????? ??1:SQL*Plus?-l?????????? ?????????????????SQL*Plus?-l???????????????? <-l ??????????????> $ sqlplus scott/cat SQL*Plus: Release 11.2.0.1.0 Production on ? 12? 22 15:15:11 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. ERROR: ORA-01017: invalid username/password; logon denied ??????????????: <-l ???????????????> $ sqlplus -l scott/cat SQL*Plus: Release 11.2.0.1.0 Production on ? 12? 22 15:18:55 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. ERROR: ORA-01017: invalid username/password; logon denied SP2-0751: Oracle????????????SQL*Plus??????? $ ????????-l??????????????????????????????????SQL*Plus?????????????????? ??2:/nolog??????????? ?????/nolog??????????????SQL???????connect???????????????????? connect????????????????????????exit??????????????????SQL??????SP2-0640: ??????????????????????? $ sqlplus /nolog SQL*Plus: Release 11.2.0.1.0 Production on ? 12? 22 15:46:53 2010 Copyright (c) 1982, 2009, Oracle. All rights reserved. SQL conn scott/cat ERROR: ORA-01017: invalid username/password; logon denied SQL select sysdate from dual; SP2-0640: ?????????? SQL SQL exit $ (Written by Hiroyuki Nakaie)

    Read the article

  • Losing reference to $_post variable?

    - by Scott B
    In the code below, the echo at the top returns true, but the echo at the bottom returns nothing. Apparently the code in between is causing me to lose a reference to the $_post variable? <?php echo "in category: ".in_category('is-sidebar', $_post); //RETURNS TRUE if (!get_option('my_hide_recent')) { $cat=get_cat_ID('top-menu'); $catHidden=get_cat_ID('hidden'); $myquery = new WP_Query(); $myquery->query(array( 'cat' => "-$cat,-$catHidden", 'post_not_in' => get_option('sticky_posts') )); $myrecentpostscount = $myquery->found_posts; if ($myrecentpostscount > 0) { ?> <div class="menu"><h4><?php if ($my_sidebar_heading_recent !=="") { echo $my_sidebar_heading_recent; } else { echo "Recent Posts";} ?></h4><ul> <?php global $post; $current_page_recent = get_post( $current_page ); $myrecentposts = get_posts(array('post_not_in' => get_option('sticky_posts'), 'cat' => "-$cat,-$catHidden",'showposts' => $my_recent_count)); foreach($myrecentposts as $idxrecent=>$post) { if($post->ID == $current_page_recent->ID) { $home_menu_recent = ' class="current_page_item'; } else { $home_menu_recent = ' class="page_item'; } $myclassrecent = ($idxrecent == count($myrecentposts) - 1 ? $home_menu_recent.' last"' : $home_menu_recent.'"'); ?> <li<?php echo $myclassrecent ?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php } ; if (($myrecentpostscount > $my_recent_count) && $my_recent_count > -1){ ?><li><a href="<?php bloginfo('url'); ?>/site-map">View all</a></li><?php } ?></ul></div> <?php } } global $sitemap; echo "in category: ".in_category('is-sidebar', $_post); //RETURNS NOTHING

    Read the article

  • Need to optimize this PHP script for "recent posts". Fatal error when post count is high...

    - by Scott B
    The code below is resulting in an error on a site in which there are ~ 1500 posts. It performs fine when post count is nominal, however, this heavy load is exposing the weakness of the code and I'd like to optimize it. Interestingly, when I disable this menu and instead use the "Recent Posts" widget, the posts are drawn fine. So I'd probably do good to borrow from that code if I knew where to find it, or better yet, If I could call the widget directly in my theme, passing it a post count variable. Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 16384 bytes) in /home1/est/public_html/mysite/wp-includes/post.php on line 3462 The code is below. Its purpose is to list "recent posts". global $post; $cat=get_cat_ID('myMenu'); $cathidePost=get_cat_ID('hidePost'); $myrecentposts = get_posts(array('post_not_in' => get_option('sticky_posts'), 'cat' => "-$cat,-$cathidePost",'showposts' => $count-of-posts)); $myrecentposts2 = get_posts(array('post_not_in' => get_option('sticky_posts'), 'cat' => "-$cat,-$cathidePost",'showposts' => -1)); $myrecentpostscount = count($myrecentposts2); if ($myrecentpostscount > 0) { ?> <div class="recentPosts"><h4><?php if ($myHeading !=="") { echo $myHeading; } else { echo "Recent Posts";} ?></h4><ul> <?php $current_page_recent = get_post( $current_page ); foreach($myrecentposts as $idxrecent=>$post) { if($post->ID == $current_page_recent->ID) { $home_menu_recent = ' class="current_page_item'; } else { $home_menu_recent = ' class="page_item'; } $myclassrecent = ($idxrecent == count($myrecentposts) - 1 ? $home_menu_recent.' last"' : $home_menu_recent.'"'); ?> <li<?php echo $myclassrecent ?>><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li> <?php } ; if (($myrecentpostscount > $count-of-posts) && $count-of-posts > -1){ ?><li><a href="<?php bloginfo('url'); ?>/recent">View All Posts</a></li><?php } ?></ul></div>

    Read the article

  • INNER JOIN code calculated value with SELECT statement

    - by sp-1986
    I have the following stored procedure which will generate mon to sun and then creates a temp table with a series of 'weeks' (start and end weeks) : USE [test_staff] GO /****** Object: StoredProcedure [dbo].[sp_timesheets_all_staff_by_week_by_job_grouping_by_site] Script Date: 03/21/2012 09:04:49 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE PROCEDURE [dbo].[sp_timesheets_all_staff_by_week_by_job_grouping_by_site] ( @grouping_ref int, @week_ref int ) AS CREATE TABLE #WeeklyList ( Start_Week date, End_Week date, week_ref int --month_name date ) DECLARE @REPORT_DATE DATETIME, @WEEK_BEGINING VARCHAR(10) SELECT @REPORT_DATE = '2011-01-19T00:00:00' --SELECT @REPORT_DATE = GETDATE() -- should grab the date now. SELECT @WEEK_BEGINING = 'MONDAY' IF @WEEK_BEGINING = 'MONDAY' SET DATEFIRST 1 ELSE IF @WEEK_BEGINING = 'TUESDAY' SET DATEFIRST 2 ELSE IF @WEEK_BEGINING = 'WEDNESDAY' SET DATEFIRST 3 ELSE IF @WEEK_BEGINING = 'THURSDAY' SET DATEFIRST 4 ELSE IF @WEEK_BEGINING = 'FRIDAY' SET DATEFIRST 5 ELSE IF @WEEK_BEGINING = 'SATURDAY' SET DATEFIRST 6 ELSE IF @WEEK_BEGINING = 'SUNDAY' SET DATEFIRST 7 DECLARE @WEEK_START_DATE DATETIME, @WEEK_END_DATE DATETIME --GET THE WEEK START DATE SELECT @WEEK_START_DATE = @REPORT_DATE - (DATEPART(DW, @REPORT_DATE) - 1) --GET THE WEEK END DATE SELECT @WEEK_END_DATE = @REPORT_DATE + (7 - DATEPART(DW, @REPORT_DATE)) PRINT 'Week Start: ' + CONVERT(VARCHAR, @WEEK_START_DATE) PRINT 'Week End: ' + CONVERT(VARCHAR, @WEEK_END_DATE) DECLARE @Interval int = datediff(WEEK,getdate(),@WEEK_START_DATE)+1 --SELECT Start_Week=@WEEK_START_DATE --, End_Week=@WEEK_END_DATE --INTO #WeekList INSERT INTO #WeeklyList SELECT Start_Week=@WEEK_START_DATE, End_Week=@WEEK_END_DATE WHILE @Interval <= 0 BEGIN set @WEEK_START_DATE=DATEADD(WEEK,1,@WEEK_START_DATE) set @WEEK_END_DATE=DATEADD(WEEK,1,@WEEK_END_DATE) INSERT INTO #WeeklyList values (@WEEK_START_DATE,@WEEK_END_DATE) SET @Interval += 1; END SELECT CONVERT(VARCHAR(11), Start_Week, 106) AS 'month_name', CONVERT(VARCHAR(11), End_Week, 106) AS 'End', DATEDIFF(DAY, 0, Start_Week) / 7 AS week_ref -- create the unique week reference number --'VIEW' AS month_name FROM #WeeklyList In this section i am creating the week_ref DATEDIFF(DAY, 0, Start_Week) / 7 AS week_ref -- create the unique week reference number I then need to combine it with this select code: DECLARE @YearString char(3) = CONVERT(char(3), SUBSTRING(CONVERT(char(5), @week_ref), 1, 3)) DECLARE @MonthString char(2) = CONVERT(char(2), SUBSTRING(CONVERT(char(5), @week_ref), 4, 2)) --Convert: DECLARE @Year int = CONVERT(int, @YearString) + 1200 DECLARE @Month int = CONVERT(int, @MonthString) **--THIS FILTERS THE REPORT** SELECT ts.staff_member_ref, sm.common_name, sm.department_name, DATENAME(MONTH, ts.start_dtm) + ' ' + DATENAME(YEAR, ts.start_dtm) AS month_name, ts.timesheet_cat_ref, cat.desc_long AS timesheet_cat_desc, grps.grouping_ref, grps.description AS grouping_desc, ts.task_ref, tsks.task_code, tsks.description AS task_desc, ts.site_ref, sits.description AS site_desc, ts.site_ref AS Expr1, CASE WHEN ts .status = 0 THEN 'Pending' WHEN ts .status = 1 THEN 'Booked' WHEN ts .status = 2 THEN 'Approved' ELSE 'Invalid Status' END AS site_status, ts.booked_time AS booked_time_sum, start_dtm, CONVERT(varchar(20), start_dtm, 108) + ' ' + CONVERT(varchar(20), start_dtm, 103) AS start_dtm_text, booked_time, end_dtm, CONVERT(varchar(20), end_dtm, 108) + ' ' + CONVERT(varchar(20), end_dtm, 103) AS end_dtm_text FROM timesheets AS ts INNER JOIN timesheet_categories AS cat ON ts.timesheet_cat_ref = cat.timesheet_cat_ref INNER JOIN timesheet_tasks AS tsks ON ts.task_ref = tsks.task_ref INNER JOIN timesheet_task_groupings AS grps ON tsks.grouping_ref = grps.grouping_ref INNER JOIN timesheet_sites AS sits ON ts.site_ref = sits.site_ref INNER JOIN vw_staff_members AS sm ON ts.staff_member_ref = sm.staff_member_ref WHERE (ts.status IN (1, 2)) AND (cat.is_leave_category = 0) GROUP BY ts.staff_member_ref, sm.common_name, sm.department_name, DATENAME(MONTH, ts.start_dtm), DATENAME(YEAR, ts.start_dtm), ts.timesheet_cat_ref, cat.desc_long, grps.grouping_ref, grps.description, ts.status, ts.booked_time, ts.task_ref, tsks.task_code, tsks.description, ts.site_ref, sits.description, ts.start_dtm, ts.end_dtm ORDER BY sm.common_name, timesheet_cat_desc, tsks.task_code, site_desc DROP TABLE #WeeklyList GO I want to pass the week_ref into the SELECT statement (refer to comment - THIS FILTERS THE REPORT) but the problem is week_ref isnt a valid column as its derived by code. Any ideas?

    Read the article

  • Why is my RAID /dev/md1 showing up as /dev/md126? Is mdadm.conf being ignored?

    - by mmorris
    I created a RAID with: sudo mdadm --create --verbose /dev/md1 --level=mirror --raid-devices=2 /dev/sdb1 /dev/sdc1 sudo mdadm --create --verbose /dev/md2 --level=mirror --raid-devices=2 /dev/sdb2 /dev/sdc2 sudo mdadm --detail --scan returns: ARRAY /dev/md1 metadata=1.2 name=ion:1 UUID=aa1f85b0:a2391657:cfd38029:772c560e ARRAY /dev/md2 metadata=1.2 name=ion:2 UUID=528e5385:e61eaa4c:1db2dba7:44b556fb Which I appended it to /etc/mdadm/mdadm.conf, see below: # mdadm.conf # # Please refer to mdadm.conf(5) for information about this file. # # by default (built-in), scan all partitions (/proc/partitions) and all # containers for MD superblocks. alternatively, specify devices to scan, using # wildcards if desired. #DEVICE partitions containers # auto-create devices with Debian standard permissions CREATE owner=root group=disk mode=0660 auto=yes # automatically tag new arrays as belonging to the local system HOMEHOST <system> # instruct the monitoring daemon where to send mail alerts MAILADDR root # definitions of existing MD arrays # This file was auto-generated on Mon, 29 Oct 2012 16:06:12 -0500 # by mkconf $Id$ ARRAY /dev/md1 metadata=1.2 name=ion:1 UUID=aa1f85b0:a2391657:cfd38029:772c560e ARRAY /dev/md2 metadata=1.2 name=ion:2 UUID=528e5385:e61eaa4c:1db2dba7:44b556fb cat /proc/mdstat returns: Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md2 : active raid1 sdb2[0] sdc2[1] 208629632 blocks super 1.2 [2/2] [UU] md1 : active raid1 sdb1[0] sdc1[1] 767868736 blocks super 1.2 [2/2] [UU] unused devices: <none> ls -la /dev | grep md returns: brw-rw---- 1 root disk 9, 1 Oct 30 11:06 md1 brw-rw---- 1 root disk 9, 2 Oct 30 11:06 md2 So I think all is good and I reboot. After the reboot, /dev/md1 is now /dev/md126 and /dev/md2 is now /dev/md127????? sudo mdadm --detail --scan returns: ARRAY /dev/md/ion:1 metadata=1.2 name=ion:1 UUID=aa1f85b0:a2391657:cfd38029:772c560e ARRAY /dev/md/ion:2 metadata=1.2 name=ion:2 UUID=528e5385:e61eaa4c:1db2dba7:44b556fb cat /proc/mdstat returns: Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md126 : active raid1 sdc2[1] sdb2[0] 208629632 blocks super 1.2 [2/2] [UU] md127 : active (auto-read-only) raid1 sdb1[0] sdc1[1] 767868736 blocks super 1.2 [2/2] [UU] unused devices: <none> ls -la /dev | grep md returns: drwxr-xr-x 2 root root 80 Oct 30 11:18 md brw-rw---- 1 root disk 9, 126 Oct 30 11:18 md126 brw-rw---- 1 root disk 9, 127 Oct 30 11:18 md127 All is not lost, I: sudo mdadm --stop /dev/md126 sudo mdadm --stop /dev/md127 sudo mdadm --assemble --verbose /dev/md1 /dev/sdb1 /dev/sdc1 sudo mdadm --assemble --verbose /dev/md2 /dev/sdb2 /dev/sdc2 and verify everything: sudo mdadm --detail --scan returns: ARRAY /dev/md1 metadata=1.2 name=ion:1 UUID=aa1f85b0:a2391657:cfd38029:772c560e ARRAY /dev/md2 metadata=1.2 name=ion:2 UUID=528e5385:e61eaa4c:1db2dba7:44b556fb cat /proc/mdstat returns: Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md2 : active raid1 sdb2[0] sdc2[1] 208629632 blocks super 1.2 [2/2] [UU] md1 : active raid1 sdb1[0] sdc1[1] 767868736 blocks super 1.2 [2/2] [UU] unused devices: <none> ls -la /dev | grep md returns: brw-rw---- 1 root disk 9, 1 Oct 30 11:26 md1 brw-rw---- 1 root disk 9, 2 Oct 30 11:26 md2 So once again, I think all is good and I reboot. Again, after the reboot, /dev/md1 is /dev/md126 and /dev/md2 is /dev/md127????? sudo mdadm --detail --scan returns: ARRAY /dev/md/ion:1 metadata=1.2 name=ion:1 UUID=aa1f85b0:a2391657:cfd38029:772c560e ARRAY /dev/md/ion:2 metadata=1.2 name=ion:2 UUID=528e5385:e61eaa4c:1db2dba7:44b556fb cat /proc/mdstat returns: Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10] md126 : active raid1 sdc2[1] sdb2[0] 208629632 blocks super 1.2 [2/2] [UU] md127 : active (auto-read-only) raid1 sdb1[0] sdc1[1] 767868736 blocks super 1.2 [2/2] [UU] unused devices: <none> ls -la /dev | grep md returns: drwxr-xr-x 2 root root 80 Oct 30 11:42 md brw-rw---- 1 root disk 9, 126 Oct 30 11:42 md126 brw-rw---- 1 root disk 9, 127 Oct 30 11:42 md127 What am I missing here?

    Read the article

  • database design help for game / user levels / progress

    - by sprugman
    Sorry this got long and all prose-y. I'm creating my first truly gamified web app and could use some help thinking about how to structure the data. The Set-up Users need to accomplish tasks in each of several categories before they can move up a level. I've got my Users, Tasks, and Categories tables, and a UserTasks table which joins the three. ("User 3 has added Task 42 in Category 8. Now they've completed it.") That's all fine and working wonderfully. The Challenge I'm not sure of the best way to track the progress in the individual categories toward each level. The "business" rules are: You have to achieve a certain number of points in each category to move up. If you get the number of points needed in Cat 8, but still have other work to do to complete the level, any new Cat 8 points count toward your overall score, but don't "roll over" into the next level. The number of Categories is small (five currently) and unlikely to change often, but by no means absolutely fixed. The number of points needed to level-up will vary per level, probably by a formula, or perhaps a lookup table. So the challenge is to track each user's progress toward the next level in each category. I've thought of a few potential approaches: Possible Solutions Add a column to the users table for each category and reset them all to zero each time a user levels-up. Have a separate UserProgress table with a row for each category for each user and the number of points they have. (Basically a Many-to-Many version of #1.) Add a userLevel column to the UserTasks table and use that to derive their progress with some kind of SUM statement. Their current level will be a simple int in the User table. Pros & Cons (1) seems like by far the most straightforward, but it's also the least flexible. Perhaps I could use a naming convention based on the category ids to help overcome some of that. (With code like "select cats; for each cat, get the value from Users.progress_{cat.id}.") It's also the one where I lose the most data -- I won't know which points counted toward leveling up. I don't have a need in mind for that, so maybe I don't care about that. (2) seems complicated: every time I add or subtract a user or a category, I have to maintain the other table. I foresee synchronization challenges. (3) Is somewhere in between -- cleaner than #2, but less intuitive than #1. In order to find out where a user is, I'd have mildly complex SQL like: SELECT categoryId, SUM(points) from UserTasks WHERE userId={user.id} & countsTowardLevel={user.level} groupBy categoryId Hmm... that doesn't seem so bad. I think I'm talking myself into #3 here, but would love any input, advice or other ideas. P.S. Sorry for the cross-post. I wrote this up on SO and then remembered that there was a game dev-focused one. Curious to see if I get different answers one place than the other....

    Read the article

  • Intelligent "Subtraction" of one text logfile from another

    - by Vi
    Example: Application generates large text log file A with many different messages. It generates similarly large log file B when does not function correctly. I want to see what messages in file B are essentially new, i.e. to filter-out everything from A. Trivial prototype is: Sort | uniq both files Join files sort | uniq -c grep -v "^2" This produces symmetric difference and inconvenient. How to do it better? (including non-symmetric difference and preserving of messages order in B) Program should first analyse A and learn which messages are common, then analyse B showing with messages needs attention. Ideally it should automatically disregard things like timestamps, line numbers or other volatile things. Example. A: 0:00:00.234 Received buffer 0x324234 0:00:00.237 Processeed buffer 0x324234 0:00:00.238 Send buffer 0x324255 0:00:03.334 Received buffer 0x324255 0:00:03.337 Processeed buffer 0x324255 0:00:03.339 Send buffer 0x324255 0:00:05.171 Received buffer 0x32421A 0:00:05.173 Processeed buffer 0x32421A 0:00:05.178 Send buffer 0x32421A B: 0:00:00.134 Received buffer 0x324111 0:00:00.137 Processeed buffer 0x324111 0:00:00.138 Send buffer 0x324111 0:00:03.334 Received buffer 0x324222 0:00:03.337 Processeed buffer 0x324222 0:00:03.338 Error processing buffer 0x324222 0:00:03.339 Send buffer 0x3242222 0:00:05.271 Received buffer 0x3242FA 0:00:05.273 Processeed buffer 0x3242FA 0:00:05.278 Send buffer 0x3242FA 0:00:07.280 Send buffer 0x3242FA failed Result: 0:00:03.338 Error processing buffer 0x324222 0:00:07.280 Send buffer 0x3242FA failed One of ways of solving it can be something like that: Split each line to logical units: 0:00:00.134 Received buffer 0x324111,0:00:00.134,Received,buffer,0x324111,324111,Received buffer, \d:\d\d:\d\d\.\d\d\d, \d+:\d+:\d+.\d+, 0x[0-9A-F]{6}, ... It should find individual words, simple patterns in numbers, common layouts (e.g. "some date than text than number than text than end_of_line"), also handle combinations of above. As it is not easy task, user assistance (adding regexes with explicit "disregard that","make the main factor","don't split to parts","consider as date/number","take care of order/quantity of such messages" rules) should be supported (but not required) for it. Find recurring units and "categorize" lines, filter out too volatile things like timestamps, addresses or line numbers. Analyse the second file, find things that has new logical units (one-time or recurring), or anything that will "amaze" the system which has got used to the first file. Example of doing some bit of this manually: $ cat A | head -n 1 0:00:00.234 Received buffer 0x324234 $ cat A | egrep -v "Received buffer" | head -n 1 0:00:00.237 Processeed buffer 0x324234 $ cat A | egrep -v "Received buffer|Processeed buffer" | head -n 1 0:00:00.238 Send buffer 0x324255 $ cat A | egrep -v "Received buffer|Processeed buffer|Send buffer" | head -n 1 $ cat B | egrep -v "Received buffer|Processeed buffer|Send buffer" 0:00:03.338 Error processing buffer 0x324222 0:00:07.280 Send buffer 0x3242FA failed This is a boring thing (there are a lot of message types); also I can accidentally include some too broad pattern. Also it can't handle complicated things like interrelation between messages. I know that it is AI-related. May be there are already developed tools?

    Read the article

  • Algorithm - Pick the best combination of Armor (for a game)

    - by Chu
    I'm designing a piece of a game where the AI needs to determine which combination of armor will give the best overall stat bonus to the character. Each character will have about 10 stats, of which only 3-4 are important, and of those important ones, a few will be more important than the others. Armor will also give a boost to 1 or all stats. For example, a shirt might give +4 to the character's int and +2 stamina while at the same time, a pair of pants may have +7 strength and nothing else. So let's say that a character has a healthy choice of armor to use (5 pairs of pants, 5 pairs of gloves, etc.) We've designated that Int and Perception are the most important stats for this character. How could I write an algorithm that would determine which combination of armor and items would result in the highest of any given stat (say in this example Int and Perception)?

    Read the article

  • How do I output an individual character when using char *[] = "something"

    - by Matt
    I've been playing with pointers to better understand them and I came across something I think I should be able to do, but can't sort out how. The code below works fine - I can output "a", "dog", "socks", and "pants" - but what if I wanted to just output the 'o' from "socks"? How would I do that? char *mars[4] = { "a", "dog", "sock", "pants" }; for ( int counter = 0; counter < 4; counter++ ) { cout << mars[ counter ]; } Please forgive me if the question is answered somewhere - there are 30+ pages of C++ pointer related question, and I spent about 90 minutes looking through them, as well as reading various (very informative) articles, before deciding to ask.

    Read the article

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