Search Results

Search found 19539 results on 782 pages for 'pretty print'.

Page 41/782 | < Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >

  • printing parent page and iframe contents from print button withing iframe.

    - by user329094
    I am using an iframe (I hate them by the way!) to call in a 3rd party checkout page into my parent page. The check out page doesn't allow me to pass any variables into it other than $total_amount. So, if an individual purchases 2 or more items they have no record of the items they purchase just the total amount. I have echoed the list of items purchased with php above the iframe for their reference. The final checkout step in the iframe allows you to print the receipt. However, it only prints the iframe content. Can you tell a print button within an iframe to print the parent page as well?

    Read the article

  • Is there a way to tell Drupal not to cache a specific page?

    - by TechplexEngineer
    I have a custom php page that processes a feed of images and makes albums out of it. However whenever i add pictures to my feed, the Drupal page doesn't change until I clear the caches. Is there a way to tell Drupal not to cache that specific page? Thanks, Blake Edit: Drupal v6.15 Not exactly sure what you mean oswald, team2648.com/media is hte page. I used the php interpreter module. Here is the php code: <?php //////// CODE by Pikori Web Designs - pikori.org /////////// //////// Please do not remove this title, /////////// //////// feel free to modify or copy this software /////////// $feedURL = 'http://picasaweb.google.com/data/feed/base/user/Techplex.Engineer?alt=rss&kind=album&hl=en_US'; $photoNodeNum = 4; $galleryTitle = 'Breakaway Pictures'; $year = '2011'; ?> <?php /////////////// DO NOT EDIT ANYTHING BELOW THIS LINE ////////////////// $album = $_GET['album']; if($album != ""){ //GENERATE PICTURES $feedURL= "http://".$album."&kind=photo&hl=en_US"; $feedURL = str_replace("entry","feed",$feedURL); $sxml = simplexml_load_file($feedURL); $column = 0; $pix_count = count($sxml->channel->item); //print '<h2>'.$sxml->channel->title.'</h2>'; print '<table cellspacing="0" cellpadding="0" style="font-size:10pt" width="100%"><tr>'; for($i = 0; $i < $pix_count; $i++) { print '<td align="center">'; $entry = $sxml->channel->item[$i]; $picture_url = $entry->enclosure['url']; $time = $entry->pubDate; $time_ln = strlen($time)-14; $time = substr($time,0,$time_ln); $description = $entry->description; $tn_beg = strpos($description, "src="); $tn_end = strpos($description, "alt="); $tn_length = $tn_end - $tn_beg; $tn = substr($description, $tn_beg, $tn_length); $tn_small = str_replace("s288","s128",$tn); $picture_url = $tn; $picture_beg = strpos($picture_url,"http:"); $picture_len = strlen($picture_url)-7; $picture_url = substr($tn, $picture_beg, $picture_len); $picture_url = str_replace("s288","s640",$picture_url); print '<a rel="lightbox[group]" href="'.$picture_url.'">'; print '<img '.$tn_small.' style="border:1px solid #02293a"><br>'; print '</a></td> '; if($column == 4){ print '</tr><tr>'; $column = 0;} else $column++; } print '</table>'; print '<br><center><a href="media">Return to album</a></center>'; } else { //GENERATE ALBUMS $sxml = simplexml_load_file($feedURL); $column = 0; $album_count = count($sxml->channel->item); //print '<h2>'.$galleryTitle.'</h2>'; print '<table cellspacing="0" cellpadding="0" style="font-size:10pt" width="100%"><tr>'; for($i = 0; $i < $album_count; $i++) { $entry = $sxml->channel->item[$i]; $time = $entry->pubDate; $time_ln = strlen($time)-14; $time = substr($time,0,$time_ln); $description = $entry->description; $tn_beg = strpos($description, "src="); $tn_end = strpos($description, "alt="); $tn_length = $tn_end - $tn_beg; $tn = substr($description, $tn_beg, $tn_length); $albumrss = $entry->guid; $albumrsscount = strlen($albumrss) - 7; $albumrss = substr($albumrss, 7, $albumrsscount); $search = strstr($time, $year); if($search != FALSE || $year == ''){ print '<td valign="top">'; print '<a href="/node/'.$photoNodeNum.'?album='.$albumrss.'">'; print '<center><img '.$tn.' style="border:3px double #cccccc"><br>'; print $entry->title.'<br>'.$time.'</center>'; print '</a><br></td> '; if($column == 3){ print '</tr><tr>'; $column = 0; } else { $column++; } } } print '</table>'; } ?>

    Read the article

  • How to read a file byte by byte in Python and how to print a bytelist as a binary?

    - by zaplec
    Hi, I'm trying to read a file byte by byte, but I'm not sure how to do that. I'm trying to do it like that: file = open(filename, 'rb') while 1: byte = file.read(8) # Do something... So does that make the variable byte to contain 8 next bits at the beginning of every loop? It doesn't matter what those bytes really are. The only thing that matters is that I need to read a file in 8-bit stacks. EDIT: Also I collect those bytes in a list and I would like to print them so that they don't print out as ASCII characters, but as raw bytes i.e. when I print that bytelist it gives the result as ['10010101', '00011100', .... ]

    Read the article

  • [C] this code, its work fine and return what i want, but its hangs before print it ??

    - by Rami Jarrar
    I make this program :: #include<stdio.h> char *raw_input(char *msg); main() { char *s; *s = *raw_input("Message Here Is: "); printf("Return Done.."); printf(s); } char *raw_input(char *msg){ char *d; printf("%s", msg); scanf("%s",&d); return d; } What this do is, it print my message and scan for input from the user, then print it,, but whats the problem in print the input from the user ??? Update:: I need the raw_input func. call be like this without any extra *s = *raw_input("Message Here"); I dont want to use this :: raw_input("Message Here Is: ", d); .... Just want to return the string that the user will enter .

    Read the article

  • [C] this code, its work fine and return what i want, but its hang before print it ??

    - by Rami Jarrar
    I make this program :: #include<stdio.h> char *raw_input(char *msg); main() { char *s; *s = *raw_input("Message Here Is: "); printf("Return Done.."); printf(s); } char *raw_input(char *msg){ char *d; printf("%s", msg); scanf("%s",&d); return d; } What this do is, it print my message and scan for input from the user, then print it,, but whats the problem in print the input from the user ???

    Read the article

  • Order a sentence alphabetically and count the number of times each words appears and print in a table

    - by JaAnTr
    I am struggling with the print in a table part of the question. So far I have managed to order the user inputted sentence alphabetically and count the number of times each word occurs. Here is the code: thestring = (raw_input()) sentence = thestring.split(" ") sentence.sort() count = {} for word in thestring.split(): try: count[word] += 1 except KeyError: count[word] = 1 print sentence print count And when I run the code I get this: ['apple', 'apple', 'banana', 'mango', 'orange', 'pear', 'pear', 'strawberry'] {'apple': 2, 'pear': 2, 'strawberry': 1, 'mango': 1, 'orange': 1, 'banana': 1} However, ideally I want it printed in a table that looks something like: apple.....|.....2 banana....|.....1 mango.....|.....1 orange....|.....1 pear......|.....2 strawberry|.....1 Thanks for any help!

    Read the article

  • Is it not possible to print a pdf from a hyperlink?

    - by andrew
    I have looked for weeks and I keep hitting dead ends. I know you can create a text or image link and tell it to "print page" in a browser. But so far, I can't get it to print a document, specifically a pdf. I would like the print dialog to show after the link is clicked and yes, the pdf linked to has been printed. Why does this seem to be such an impossible feat? I have seen it work in a Flash movie, but since I cannot access the native file I cannot see how it was done. Any advice? Thanks.

    Read the article

  • add/remove items in a list

    - by Jam
    I'm trying to create a player who can add and remove items from their inventory. I have everything working, I just have 1 small problem. Every time it prints the inventory, 'None' also appears. I've been messing with it to try and remove that, but no matter what I do, 'None' always appears in the program! I know I'm just missing something simple, but I can't figure it out for the life of me. class Player(object): def __init__(self, name, max_items, items): self.name=name self.max_items=max_items self.items=items def inventory(self): for item in self.items: print item def take(self, new_item): if len(self.items)<self.max_items: self.items.append(new_item) else: print "You can't carry any more items!" def drop(self, old_item): if old_item in self.items: self.items.remove(old_item) else: print "You don't have that item." def main(): player=Player("Jimmy", 5, ['sword', 'shield', 'ax']) print "Max items:", player.max_items print "Inventory:", player.inventory() choice=None while choice!="0": print \ """ Inventory Man 0 - Quit 1 - Add an item to inventory 2 - Remove an item from inventory """ choice=raw_input("Choice: ") print if choice=="0": print "Good-bye." elif choice=="1": new_item=raw_input("What item would you like to add to your inventory?") player.take(new_item) print "Inventory:", player.inventory() elif choice=="2": old_item=raw_input("What item would you like to remove from your inventory?") player.drop(old_item) print "Inventory:", player.inventory() else: print "\nSorry, but", choice, "isn't a valid choice." main() raw_input("Press enter to exit.")

    Read the article

  • Why does this cast to Base class in virtual function give a segmentation fault?

    - by dehmann
    I want to print out a derived class using the operator<<. When I print the derived class, I want to first print its base and then its own content. But I ran into some trouble (see segfault below): class Base { public: friend std::ostream& operator<<(std::ostream&, const Base&); virtual void Print(std::ostream& out) const { out << "BASE!"; } }; std::ostream& operator<<(std::ostream& out, const Base& b) { b.Print(out); return out; } class Derived : public Base { public: virtual void Print(std::ostream& out) const { out << "My base: "; //((const Base*)this)->Print(out); // infinite, calls this fct recursively //((Base*)this)->Print(out); // segfault (from infinite loop?) ((Base)*this).Print(out); // OK out << " ... and myself."; } }; int main(int argc, char** argv){ Derived d; std::cout << d; return 0; } Why can't I cast in one of these ways? ((const Base*)this)->Print(out); // infinite, calls this fct recursively ((Base*)this)->Print(out); // segfault (from infinite loop?)

    Read the article

  • cant download youtube video

    - by dsaccount1
    I'm having trouble retrieving the youtube video automatically, heres the code. The problem is the last part. download = urllib.request.urlopen(download_url).read() # Youtube video download script # 10n1z3d[at]w[dot]cn import urllib.request import sys print("\n--------------------------") print (" Youtube Video Downloader") print ("--------------------------\n") try: video_url = sys.argv[1] except: video_url = input('[+] Enter video URL: ') print("[+] Connecting...") try: if(video_url.endswith('&feature=related')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=related')[0] elif(video_url.endswith('&feature=dir')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=dir')[0] elif(video_url.endswith('&feature=fvst')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=fvst')[0] elif(video_url.endswith('&feature=channel_page')): video_id = video_url.split('www.youtube.com/watch?v=')[1].split('&feature=channel_page')[0] else: video_id = video_url.split('www.youtube.com/watch?v=')[1] except: print("[-] Invalid URL.") exit(1) print("[+] Parsing token...") try: url = str(urllib.request.urlopen('http://www.youtube.com/get_video_info?&video_id=' + video_id).read()) token_value = url.split('video_id='+video_id+'&token=')[1].split('&thumbnail_url')[0] download_url = "http://www.youtube.com/get_video?video_id=" + video_id + "&t=" + token_value + "&fmt=18" except: url = str(urllib.request.urlopen('www.youtube.com/watch?v=' + video_id)) exit(1) v_url=str(urllib.request.urlopen('http://'+video_url).read()) video_title = v_url.split('"rv.2.title": "')[1].split('", "rv.4.rating"')[0] if '&quot;' in video_title: video_title = video_title.replace('&quot;','"') elif '&amp;' in video_title: video_title = video_title.replace('&amp;','&') print("[+] Downloading " + '"' + video_title + '"...') try: print(download_url) file = open(video_title + '.mp4', 'wb') download = urllib.request.urlopen(download_url).read() print(download) for line in download: file.write(line) file.close() except: print("[-] Error downloading. Quitting.") exit(1) print("\n[+] Done. The video is saved to the current working directory(cwd).\n")

    Read the article

  • Perl Unicode glitch

    - by RedGrittyBrick
    In this output, why am I getting extra newlines between lines b&c and d&e? a: ....v....1....v... (a) b: 'Budejovický Budvar' length 18 (b) c: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (c) d: B u d e j o v i c k ý B u d v a r (d) e: 42 75 64 11b 6a 6f 76 69 63 6b fd 20 42 75 64 76 61 72 (e) from this program #!perl use strict; use warnings; binmode (STDOUT, "encoding(UTF-8)"); # so no "Wide characater in print" warning print "\n"; my $r = "Bud\N{U+011B}jovick\N{U+00FD} Budvar"; print "a: ....v....1....v... (a)\n"; print "b: '$r' length ", length($r)," (b)\n"; print "c:"; printf "%4d",$_ for (1..18); print " (c)\n"; print "d: "; print join(" ", split("", $r)); print " (d)\n"; print "e: "; printf "%*v3x", " ", $r; print " (e)\n";

    Read the article

  • how to multithread on a python server

    - by user3732790
    HELP please i have this code import socket from threading import * import time HOST = '' # Symbolic name meaning all available interfaces PORT = 8888 # Arbitrary non-privileged port s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print ('Socket created') s.bind((HOST, PORT)) print ('Socket bind complete') s.listen(10) print ('Socket now listening') def listen(conn): odata = "" end = 'end' while end == 'end': data = conn.recv(1024) if data != odata: odata = data print(data) if data == b'end': end = "" print("conection ended") conn.close() while True: time.sleep(1) conn, addr = s.accept() print ('Connected with ' + addr[0] + ':' + str(addr[1])) Thread.start_new_thread(listen,(conn)) and i would like it so that when ever a person comes onto the server it has its own thread. but i can't get it to work please someone help me. :_( here is the error code: Socket created Socket bind complete Socket now listening Connected with 127.0.0.1:61475 Traceback (most recent call last): File "C:\Users\Myles\Desktop\test recever - Copy.py", line 29, in <module> Thread.start_new_thread(listen,(conn)) AttributeError: type object 'Thread' has no attribute 'start_new_thread' i am on python version 3.4.0 and here is the users code: import socket #for sockets import time s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) print('Socket Created') host = 'localhost' port = 8888 remote_ip = socket.gethostbyname( host ) print('Ip address of ' + host + ' is ' + remote_ip) #Connect to remote server s.connect((remote_ip , port)) print ('Socket Connected to ' + host + ' on ip ' + remote_ip) while True: message = input("> ") #Set the whole string s.send(message.encode('utf-8')) print ('Message send successfully') data = s.recv(1024) print(data) s.close

    Read the article

  • What is a fast way to set debugging code at a given line in a function?

    - by Josh O'Brien
    Preamble: R's trace() is a powerful debugging tool, allowing users to "insert debugging code at chosen places in any function". Unfortunately, using it from the command-line can be fairly laborious. As an artificial example, let's say I want to insert debugging code that will report the between-tick interval calculated by pretty.default(). I'd like to insert the code immediately after the value of delta is calculated, about four lines up from the bottom of the function definition. (Type pretty.default to see where I mean.) To indicate that line, I need to find which step in the code it corresponds to. The answer turns out to be step list(c(12, 3, 3)), which I zero in on by running through the following steps: as.list(body(pretty.default)) as.list(as.list(body(pretty.default))[[12]]) as.list(as.list(as.list(body(pretty.default))[[12]])[[3]]) as.list(as.list(as.list(body(pretty.default))[[12]])[[3]])[[3]] I can then insert debugging code like this: trace(what = 'pretty.default', tracer = quote(cat("\nThe value of delta is: ", delta, "\n\n")), at = list(c(12,3,3))) ## Try it a <- pretty(c(1, 7843)) b <- pretty(c(2, 23)) ## Clean up untrace('pretty.default') Questions: So here are my questions: Is there a way to print out a function (or a parsed version of it) with the lines nicely labeled by the steps to which they belong? Alternatively, is there another easier way, from the command line, to quickly set debugging code for a specific line within a function? Addendum: I used the pretty.default() example because it is reasonably tame, but with real/interesting functions, repeatedly using as.list() quickly gets tiresome and distracting. Here's an example: as.list(as.list(as.list(as.list(as.list(as.list(as.list(as.list(as.list(body(# model.frame.default))[[26]])[[3]])[[2]])[[4]])[[3]])[[4]])[[4]])[[4]])[[3]]

    Read the article

  • Alert visualization recipe: Get out your blender, drop in some sp_send_dbmail, Google Charts API, add your favorite colors and sprinkle with html. Blend till it’s smooth and looks pretty enough to taste.

    - by Maria Zakourdaev
      I really like database monitoring. My email inbox have a constant flow of different types of alerts coming from our production servers with all kinds of information, sometimes more useful and sometimes less useful. Usually database alerts look really simple, it’s usually a plain text email saying “Prod1 Database data file on Server X is 80% used. You’d better grow it manually before some query triggers the AutoGrowth process”. Imagine you could have received email like the one below.  In addition to the alert description it could have also included the the database file growth chart over the past 6 months. Wouldn’t it give you much more information whether the data growth is natural or extreme? That’s truly what data visualization is for. Believe it or not, I have sent the graph below from SQL Server stored procedure without buying any additional data monitoring/visualization tool.   Would you like to visualize your database alerts like I do? Then like myself, you’d love the Google Charts. All you need to know is a little HTML and have a mail profile configured on your SQL Server instance regardless of the SQL Server version. First of all, I hope you know that the sp_send_dbmail procedure has a great parameter @body_format = ‘HTML’, which allows us to send rich and colorful messages instead of boring black and white ones. All that we need is to dynamically create HTML code. This is how, for instance, you can create a table and populate it with some data: DECLARE @html varchar(max) SET @html = '<html>' + '<H3><font id="Text" style='color: Green;'>Top Databases: </H3>' + '<table border="1" bordercolor="#3300FF" style='background-color:#DDF8CC' width='70%' cellpadding='3' cellspacing='3'>' + '<tr><font color="Green"><th>Database Name</th><th>Size</th><th>Physical Name</th></tr>' + CAST( (SELECT TOP 10                             td = name,'',                             td = size * 8/1024 ,'',                             td = physical_name              FROM sys.master_files               ORDER BY size DESC             FOR XML PATH ('tr'),TYPE ) AS VARCHAR(MAX)) + '</table>' EXEC msdb.dbo.sp_send_dbmail @recipients = '[email protected]', @subject ='Top databases', @body = @html, @body_format = 'HTML' This is the result:   If you want to add more visualization effects, you can use Google Charts Tools https://google-developers.appspot.com/chart/interactive/docs/index which is a free and rich library of data visualization charts, they’re also easy to populate and embed. There are two versions of the Google Charts Image based charts: https://google-developers.appspot.com/chart/image/docs/gallery/chart_gall This is an old version, it’s officially deprecated although it will be up for a next few years or so. I really enjoy using this one because it can be viewed within the email body. For mobile devices you need to change the “Load remote images” property in your email application configuration.           Charts based on JavaScript classes: https://google-developers.appspot.com/chart/interactive/docs/gallery This API is newer, with rich and highly interactive charts, and it’s much more easier to understand and configure. The only downside of it is that they cannot be viewed within the email body. Outlook, Gmail and many other email clients, as part of their security policy, do not run any JavaScript that’s placed within the email body. However, you can still enjoy this API by sending the report as an email attachment. Here is an example of the old version of Google Charts API, sending the same top databases report as in the previous example but instead of a simple table, this script is using a pie chart right from  the T-SQL code DECLARE @html  varchar(8000) DECLARE @Series  varchar(800),@Labels  varchar(8000),@Legend  varchar(8000);     SET @Series = ''; SET @Labels = ''; SET @Legend = ''; SELECT TOP 5 @Series = @Series + CAST(size * 8/1024 as varchar) + ',',                         @Labels = @Labels +CAST(size * 8/1024 as varchar) + 'MB'+'|',                         @Legend = @Legend + name + '|' FROM sys.master_files ORDER BY size DESC SELECT @Series = SUBSTRING(@Series,1,LEN(@Series)-1),         @Labels = SUBSTRING(@Labels,1,LEN(@Labels)-1),         @Legend = SUBSTRING(@Legend,1,LEN(@Legend)-1) SET @html =   '<H3><font color="Green"> '+@@ServerName+' top 5 databases : </H3>'+    '<br>'+    '<img src="http://chart.apis.google.com/chart?'+    'chf=bg,s,DDF8CC&'+    'cht=p&'+    'chs=400x200&'+    'chco=3072F3|7777CC|FF9900|FF0000|4A8C26&'+    'chd=t:'+@Series+'&'+    'chl='+@Labels+'&'+    'chma=0,0,0,0&'+    'chdl='+@Legend+'&'+    'chdlp=b"'+    'alt="'+@@ServerName+' top 5 databases" />'              EXEC msdb.dbo.sp_send_dbmail @recipients = '[email protected]',                             @subject = 'Top databases',                             @body = @html,                             @body_format = 'HTML' This is what you get. Isn’t it great? Chart parameters reference: chf     Gradient fill  bg - backgroud ; s- solid cht     chart type  ( p - pie) chs        chart size width/height chco    series colors chd        chart data string        1,2,3,2 chl        pir chart labels        a|b|c|d chma    chart margins chdl    chart legend            a|b|c|d chdlp    chart legend text        b - bottom of chart   Line graph implementation is also really easy and powerful DECLARE @html varchar(max) DECLARE @Series varchar(max) DECLARE @HourList varchar(max) SET @Series = ''; SET @HourList = ''; SELECT @HourList = @HourList + SUBSTRING(CONVERT(varchar(13),last_execution_time,121), 12,2)  + '|' ,              @Series = @Series + CAST( COUNT(1) as varchar) + ',' FROM sys.dm_exec_query_stats s     CROSS APPLY sys.dm_exec_sql_text(plan_handle) t WHERE last_execution_time > = getdate()-1 GROUP BY CONVERT(varchar(13),last_execution_time,121) ORDER BY CONVERT(varchar(13),last_execution_time,121) SET @Series = SUBSTRING(@Series,1,LEN(@Series)-1) SET @html = '<img src="http://chart.apis.google.com/chart?'+ 'chco=CA3D05,87CEEB&'+ 'chd=t:'+@Series+'&'+ 'chds=1,350&'+ 'chdl= Proc executions from cache&'+ 'chf=bg,s,1F1D1D|c,lg,0,363433,1.0,2E2B2A,0.0&'+ 'chg=25.0,25.0,3,2&'+ 'chls=3|3&'+ 'chm=d,CA3D05,0,-1,12,0|d,FFFFFF,0,-1,8,0|d,87CEEB,1,-1,12,0|d,FFFFFF,1,-1,8,0&'+ 'chs=600x450&'+ 'cht=lc&'+ 'chts=FFFFFF,14&'+ 'chtt=Executions for from' +(SELECT CONVERT(varchar(16),min(last_execution_time),121)          FROM sys.dm_exec_query_stats          WHERE last_execution_time > = getdate()-1) +' till '+ +(SELECT CONVERT(varchar(16),max(last_execution_time),121)     FROM sys.dm_exec_query_stats) + '&'+ 'chxp=1,50.0|4,50.0&'+ 'chxs=0,FFFFFF,12,0|1,FFFFFF,12,0|2,FFFFFF,12,0|3,FFFFFF,12,0|4,FFFFFF,14,0&'+ 'chxt=y,y,x,x,x&'+ 'chxl=0:|1|350|1:|N|2:|'+@HourList+'3:|Hour&'+ 'chma=55,120,0,0" alt="" />' EXEC msdb.dbo.sp_send_dbmail @recipients = '[email protected]', @subject ='Daily number of executions', @body = @html, @body_format = 'HTML' Chart parameters reference: chco    series colors chd        series data chds    scale format chdl    chart legend chf        background fills chg        grid line chls    line style chm        line fill chs        chart size cht        chart type chts    chart style chtt    chart title chxp    axis label positions chxs    axis label styles chxt    axis tick mark styles chxl    axis labels chma    chart margins If you don’t mind to get your charts as an email attachment, you can enjoy the Java based Google Charts which are even easier to configure, and have much more advanced graphics. In the example below, the sp_send_email procedure uses the parameter @query which will be executed at the time that sp_send_dbemail is executed and the HTML result of this execution will be attached to the email. DECLARE @html varchar(max),@query varchar(max) DECLARE @SeriesDBusers  varchar(800);     SET @SeriesDBusers = ''; SELECT @SeriesDBusers = @SeriesDBusers +  ' ["'+DB_NAME(r.database_id) +'", ' +cast(count(1) as varchar)+'],' FROM sys.dm_exec_requests r GROUP BY DB_NAME(database_id) ORDER BY count(1) desc; SET @SeriesDBusers = SUBSTRING(@SeriesDBusers,1,LEN(@SeriesDBusers)-1) SET @query = ' PRINT '' <html>   <head>     <script type="text/javascript" src="https://www.google.com/jsapi"></script>     <script type="text/javascript">       google.load("visualization", "1", {packages:["corechart"]});        google.setOnLoadCallback(drawChart);       function drawChart() {                      var data = google.visualization.arrayToDataTable([                        ["Database Name", "Active users"],                        '+@SeriesDBusers+'                      ]);                        var options = {                        title: "Active users",                        pieSliceText: "value"                      };                        var chart = new google.visualization.PieChart(document.getElementById("chart_div"));                      chart.draw(data, options);       };     </script>   </head>   <body>     <table>     <tr><td>         <div id="chart_div" style='width: 800px; height: 300px;'></div>         </td></tr>     </table>   </body> </html> ''' EXEC msdb.dbo.sp_send_dbmail    @recipients = '[email protected]',    @subject ='Active users',    @body = @html,    @body_format = 'HTML',    @query = @Query,     @attach_query_result_as_file = 1,     @query_attachment_filename = 'Results.htm' After opening the email attachment in the browser you are getting this kind of report: In fact, the above is not only for database alerts. It can be used for applicative reports if you need high levels of customization that you cannot achieve using standard methods like SSRS. If you need more information on how to customize the charts, you can try the following: Image Based Charts wizard https://google-developers.appspot.com/chart/image/docs/chart_wizard  Live Image Charts Playground https://google-developers.appspot.com/chart/image/docs/chart_playground Image Based Charts Parameters List https://google-developers.appspot.com/chart/image/docs/chart_params Java Script Charts Playground https://code.google.com/apis/ajax/playground/?type=visualization Use the above examples as a starting point for your procedures and I’d be more than happy to hear of your implementations of the above techniques. Yours, Maria

    Read the article

  • How to style a code block to make all the colours look pretty like my IDE and here in stackoverflow?

    - by BritishDeveloper
    When putting code samples in my blog I would like the code to have all the appropriate colours. How can I do that? Basically if I write: foreach (ListItem item in items) { item.Text = "something"; } I want it to appear in the correct colours like it does in my Visual Studio or here at stack*overflow*. I'm bored of styling the colours of each key word manually. Is there a pre-existing javascript library I can use?

    Read the article

  • Is there a tool out there that lets you print a colour chart / palette of colours used on a web page

    - by undefined
    I want to print a table of the colours used in a web page that my graphic designer has produced - I have .png files at present and use Fireworks to view them. It would be great if there was a tool that lets you print a table with the colour and hex value so I can easily reference when programming. Anyone come across such a thing? Sounds to me like there should be a firefox extension or similar?

    Read the article

  • STDOUT can not return to Screen

    - by rockyurock
    STDOUT can not return to Screen Hello all below is the part of my code, my code enters "if loop" with $value =1 and output of the process "iperf.exe" is getting into my_output.txt. As i am timing out the process after alram(20sec) time,also wanted to capture the output of this process only. then after i want to continue to the command prompt but i am not able to return to the command promt... not only this code itself does not PRINT on the command prompt , rather it is priniting on the my_output.txt file (i am looping this if loop through rest of my code) output.txt ========== inside value loop2 ------------------------------------------------------------ Server listening on UDP port 5001 Receiving 1470 byte datagrams UDP buffer size: 8.00 KByte (default) ------------------------------------------------------------ [160] local 10.232.62.151 port 5001 connected with 10.232.62.151 port 1505 [ ID] Interval Transfer Bandwidth Jitter Lost/Total Datagrams [160] 0.0- 5.0 sec 2.14 MBytes 3.59 Mbits/sec 0.000 ms 0/ 1528 (0%) inside value loop3 clue1 clue2 inside value loop4 one iperf completed Transfer Transfer Starting: Intent { act=android.settings.APN_SETTINGS } ******AUTOMATION COMPLETED****** Looks some problem with reinitializing the STDOUT.. even i tried to use close(STDOUT); but again it did not return to STDOUT could sombbody please help out ?? /rocky CODE:: if($value) { my $file = 'my_output.txt'; use Win32::Process; print"inside value loop\n"; # redirect stdout to a file open STDOUT, '>', $file or die "can't redirect STDOUT to <$file> $!"; Win32::Process::Create(my $ProcessObj, "iperf.exe", "iperf.exe -u -s -p 5001", 0, NORMAL_PRIORITY_CLASS, ".") || die ErrorReport(); $alarm_time = $IPERF_RUN_TIME+2; #20sec print"inside value loop2\n"; sleep $alarm_time; $ProcessObj->Kill(0); sub ErrorReport{ print Win32::FormatMessage( Win32::GetLastError() ); } print"inside value loop3\n"; print"clue1\n"; #close(STDOUT); print"clue2\n"; print"inside value loop4\n"; print"one iperf completed\n"; } my $data_file="my_output.txt"; open(ROCK, $data_file)|| die("Could not open file!"); @raw_data=<ROCK>; @COUNT_PS =split(/ /,$raw_data[7]); my $LOOP_COUNT_PS_4 = $COUNT_PS[9]; my $LOOP_COUNT_PS_5 = $COUNT_PS[10]; print "$LOOP_COUNT_PS_4\n"; print "$LOOP_COUNT_PS_5\n"; my $tput_value = "$LOOP_COUNT_PS_4"." $LOOP_COUNT_PS_5"; print "$tput_value"; close(ROCK); print FH1 "\n $count \| $tput_value \n"; regds rakesh

    Read the article

  • Could the Print document ive built in .net cause a UriFormatException?

    - by Smoka
    After adding Print Document, Dialog, and Button to my Forms app i now have UriFormatException and A first chance exception of type 'System.ComponentModel.Win32Exception' occurred in System.Drawing.dll Additional information: Access is denied Is there something wrong with the strings in my Document? Preview looks fine. but unhandled exception's when it tries to print.

    Read the article

  • Trappings MySQL Warnings on Calls Wrapped in Classes -- Python

    - by chernevik
    I can't get Python's try/else blocks to catch MySQL warnings when the execution statements are wrapped in classes. I have a class that has as a MySQL connection object as an attribute, a MySQL cursor object as another, and a method that run queries through that cursor object. The cursor is itself wrapped in a class. These seem to run queries properly, but the MySQL warnings they generate are not caught as exceptions in a try/else block. Why don't the try/else blocks catch the warnings? How would I revise the classes or method calls to catch the warnings? Also, I've looked through the prominent sources and can't find a discussion that helps me understand this. I'd appreciate any reference that explains this. Please see code below. Apologies for verbosity, I'm newbie. #!/usr/bin/python import MySQLdb import sys import copy sys.path.append('../../config') import credentials as c # local module with dbase connection credentials #============================================================================= # CLASSES #------------------------------------------------------------------------ class dbMySQL_Connection: def __init__(self, db_server, db_user, db_passwd): self.conn = MySQLdb.connect(db_server, db_user, db_passwd) def getCursor(self, dict_flag=True): self.dbMySQL_Cursor = dbMySQL_Cursor(self.conn, dict_flag) return self.dbMySQL_Cursor def runQuery(self, qryStr, dict_flag=True): qry_res = runQueryNoCursor(qryStr=qryStr, \ conn=self, \ dict_flag=dict_flag) return qry_res #------------------------------------------------------------------------ class dbMySQL_Cursor: def __init__(self, conn, dict_flag=True): if dict_flag: dbMySQL_Cursor = conn.cursor(MySQLdb.cursors.DictCursor) else: dbMySQL_Cursor = conn.cursor() self.dbMySQL_Cursor = dbMySQL_Cursor def closeCursor(self): self.dbMySQL_Cursor.close() #============================================================================= # QUERY FUNCTIONS #------------------------------------------------------------------------------ def runQueryNoCursor(qryStr, conn, dict_flag=True): dbMySQL_Cursor = conn.getCursor(dict_flag) qry_res =runQueryFnc(qryStr, dbMySQL_Cursor.dbMySQL_Cursor) dbMySQL_Cursor.closeCursor() return qry_res #------------------------------------------------------------------------------ def runQueryFnc(qryStr, dbMySQL_Cursor): qry_res = {} qry_res['rows'] = dbMySQL_Cursor.execute(qryStr) qry_res['result'] = copy.deepcopy(dbMySQL_Cursor.fetchall()) qry_res['messages'] = copy.deepcopy(dbMySQL_Cursor.messages) qry_res['query_str'] = qryStr return qry_res #============================================================================= # USAGES qry = 'DROP DATABASE IF EXISTS database_of_armaments' dbConn = dbMySQL_Connection(**c.creds) def dbConnRunQuery(): # Does not trap an exception; warning displayed to standard error. try: dbConn.runQuery(qry) except: print "dbConn.runQuery() caught an exception." def dbConnCursorExecute(): # Does not trap an exception; warning displayed to standard error. dbConn.getCursor() # try/except block does catches error without this try: dbConn.dbMySQL_Cursor.dbMySQL_Cursor.execute(qry) except Exception, e: print "dbConn.dbMySQL_Cursor.execute() caught an exception." print repr(e) def funcRunQueryNoCursor(): # Does not trap an exception; no warning displayed try: res = runQueryNoCursor(qry, dbConn) print 'Try worked. %s' % res except Exception, e: print "funcRunQueryNoCursor() caught an exception." print repr(e) #============================================================================= if __name__ == '__main__': print '\n' print 'EXAMPLE -- dbConnRunQuery()' dbConnRunQuery() print '\n' print 'EXAMPLE -- dbConnCursorExecute()' dbConnCursorExecute() print '\n' print 'EXAMPLE -- funcRunQueryNoCursor()' funcRunQueryNoCursor() print '\n'

    Read the article

< Previous Page | 37 38 39 40 41 42 43 44 45 46 47 48  | Next Page >