Daily Archives

Articles indexed Wednesday November 14 2012

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

  • Staring Shotgun with Thin as server using SSL

    - by Bryan Paronto
    I have a Facebook app I'm developing locally. I've configure everything correctly to SSL development with Thin. I know that using a shotgun.rb file, I can pass options to Thin to get it to start in SSL mode, but I'm not exact sure how to pass these options. I'm thinking something like: Thin:Server::options[:ssl] = true Thin:Server::options[:ssl_cert_path] = /path/to/cert/ Restarting thin constantly is getting old, so I'd really like to be able to use shotgun in development.

    Read the article

  • Using a boost::fusion::map in boost::spirit::karma

    - by user1097105
    I am using boost spirit to parse some text files into a data structure and now I am beginning to generate text from this data structure (using spirit karma). One attempt at a data structure is a boost::fusion::map (as suggested in an answer to this question). But although I can use boost::spirit::qi::parse() and get data in it easily, when I tried to generate text from it using karma, I failed. Below is my attempt (look especially at the "map_data" type). After some reading and playing around with other fusion types, I found boost::fusion::vector and BOOST_FUSION_DEFINE_ASSOC_STRUCT. I succeeded to generate output with both of them, but they don't seem ideal: in vector you cannot access a member using a name (it is like a tuple) -- and in the other solution, I don't think I need both ways (member name and key type) to access the members. #include <iostream> #include <string> #include <boost/spirit/include/karma.hpp> #include <boost/fusion/include/map.hpp> #include <boost/fusion/include/make_map.hpp> #include <boost/fusion/include/vector.hpp> #include <boost/fusion/include/as_vector.hpp> #include <boost/fusion/include/transform.hpp> struct sb_key; struct id_key; using boost::fusion::pair; typedef boost::fusion::map < pair<sb_key, int> , pair<id_key, unsigned long> > map_data; typedef boost::fusion::vector < int, unsigned long > vector_data; #include <boost/fusion/include/define_assoc_struct.hpp> BOOST_FUSION_DEFINE_ASSOC_STRUCT( (), assocstruct_data, (int, a, sb_key) (unsigned long, b, id_key)) namespace karma = boost::spirit::karma; template <typename X> std::string to_string ( const X& data ) { std::string generated; std::back_insert_iterator<std::string> sink(generated); karma::generate_delimited ( sink, karma::int_ << karma::ulong_, karma::space, data ); return generated; } int main() { map_data d1(boost::fusion::make_map<sb_key, id_key>(234, 35314988526ul)); vector_data d2(boost::fusion::make_vector(234, 35314988526ul)); assocstruct_data d3(234,35314988526ul); std::cout << "map_data as_vector: " << boost::fusion::as_vector(d1) << std::endl; //std::cout << "map_data to_string: " << to_string(d1) << std::endl; //*FAIL No 1* std::cout << "at_key (sb_key): " << boost::fusion::at_key<sb_key>(d1) << boost::fusion::at_c<0>(d1) << std::endl << std::endl; std::cout << "vector_data: " << d2 << std::endl; std::cout << "vector_data to_string: " << to_string(d2) << std::endl << std::endl; std::cout << "assoc_struct as_vector: " << boost::fusion::as_vector(d3) << std::endl; std::cout << "assoc_struct to_string: " << to_string(d3) << std::endl; std::cout << "at_key (sb_key): " << boost::fusion::at_key<sb_key>(d3) << d3.a << boost::fusion::at_c<0>(d3) << std::endl; return 0; } Including the commented line gives lots of pages of compilation errors, among which notably something like: no known conversion for argument 1 from ‘boost::fusion::pair’ to ‘double’ no known conversion for argument 1 from ‘boost::fusion::pair’ to ‘float’ Might it be that to_string needs the values of the map_data, and not the pairs? Though I am not good with templates, I tried to get a vector from a map using transform in the following way template <typename P> struct take_second { typename P::second_type operator() (P p) { return p.second; } }; // ... inside main() pair <char, int> ff(32); std::cout << "take_second (expect 32): " << take_second<pair<char,int>>()(ff) << std::endl; std::cout << "transform map_data and to_string: " << to_string(boost::fusion::transform(d1, take_second<>())); //*FAIL No 2* But I don't know what types am I supposed to give when instantiating take_second and anyway I think there must be an easier way to get (iterate over) the values of a map (is there?) If you answer this question, please also give your opinion on whether using an ASSOC_STRUCT or a map is better.

    Read the article

  • PCA extended face recognition

    - by cMinor
    The state of the art says that we can use PCA to perform face recognition. like this, this or this I am working with a project that involves training a classifier to detect a person who is wearing glasess or hats or even a mustache. The purpose of doing this is to detect when a person that has robbed a bank, store, or have commeted some sort of crime(s) (we have their image in a database), enters a certain place ( historically we know these guys have robbed, so we should take care to avoid problems). We came first to have a distributed database with all images of criminals, then I thought to have a layer of them clasifying these criminals using accesories like hats, mustache or anything that hides their face etc... Then, to apply that knowledge to detect when a particular or a suspect person enters a comercial place. ( In practice when someone is going to rob not all the times they are using an accesorie...) What do you think about this idea of doing PCA to first detect principal components of the face and then the components of an accesory. I was thinking that maybe a probabilistic approach is better so we can compute the probability the criminal is the person that entered a place and call the respective authorities.

    Read the article

  • Stop Visual Studio from appending numbers to the end of new controls

    - by techturtle
    I am wondering if there is any way to stop Visual Studio 2010 from appending a number to the end of the ID on new controls I create. For example, when I add a new TextBox, I would prefer that it do this: <asp:TextBox ID="TextBox" runat="server"> <asp:TextBox ID="TextBox" runat="server"> <asp:TextBox ID="TextBox" runat="server"> Instead of this: <asp:TextBox ID="TextBox1" runat="server"> <asp:TextBox ID="TextBox2" runat="server"> <asp:TextBox ID="TextBox3" runat="server"> It would make it easier to rename them appropriately, so I don't have to arrow/mouse over and delete the number each time. As I was writing this, the "Questions that may already have your answer" suggested this: How do I prevent Visual Studio from renaming my controls? which admittedly was the biggest part of my annoyance, but that appears to turn off putting in an ID="" field altogether, not just for pasted controls. It would still be helpful to turn off the numbering for new, non-pasted controls and have it not rename pasted ones as well. At the moment I'm working with ASP.NET, but it would be nice if it there was a way to do it for WinForms as well. Before anyone suggests it, I do know that allowing it to append the numbers prevents name conflicts should I not rename them appropriately. However, I would much rather have it fail to compile so I know to fix the issue now (if I forget to name something properly) rather than find random "TextBox1" items lying around in the code later on.

    Read the article

  • Why does some images not display in different browsers?

    - by RePRO
    I've unreal problem. I have a site, where are displaying images over an classical <img> tag. All images are loading from the database, where is URL column of the image. My problem is that three of ten images are not display. But if I open the source code and click at the URL of the image, I can see image. In source code is some looks like (just for a simple example): <img src = "http://some.image/1.jpg" alt = "description" height = "140" width = "187" /> But the biggest snag is that Opera displays all images correct, but just in FF, IE, Chrome are mentioned problems. I can not provide a screenshots, because the pages are a bit perverse. How can I show the site where the problem is? Or some advice? Thank you.

    Read the article

  • Downloading a file from a PHP page in C#

    - by FoxyShadoww
    Okay, we have a PHP script that creates an download link from a file and we want to download that file via C#. This works fine with progress etc but when the PHP page gives an error the program downloads the error page and saves it as the requested file. Here is the code we have atm: PHP Code: <?php $path = 'upload/test.rar'; if (file_exists($path)) { $mm_type="application/octet-stream"; header("Pragma: public"); header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: public"); header("Content-Description: File Transfer"); header("Content-Type: " . $mm_type); header("Content-Length: " .(string)(filesize($path)) ); header('Content-Disposition: attachment; filename="'.basename($path).'"'); header("Content-Transfer-Encoding: binary\n"); readfile($path); exit(); } else { print 'Sorry, we could not find requested download file.'; } ?> C# Code: private void btnDownload_Click(object sender, EventArgs e) { string url = "http://***.com/download.php"; WebClient client = new WebClient(); client.DownloadFileCompleted += new AsyncCompletedEventHandler(client_DownloadFileCompleted); client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(ProgressChanged); client.DownloadFileAsync(new Uri(url), @"c:\temp\test.rar"); } private void ProgressChanged(object sender, DownloadProgressChangedEventArgs e) { progressBar.Value = e.ProgressPercentage; } void client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e) { MessageBox.Show(print); }

    Read the article

  • Log in to subdomain via main domain

    - by Mattias
    I have a website, available through multiple domainnames. like www.domain1.com .... www.domain5.com All my customers have their own subdomain. like: customer1.domain1.com customer2.domain1.com .... customer351.domain4.com Currently i dont use SSL, each customer log in their own account via their sub domain. I want to change this, and make all customers log in on a central log in page, that would use SSL, for example. https://login.domain1.com And somehow redirect each user to the correct sub domain adress. (Sub domain that don't use SSL) How do I do this, and maintain security? One idea i had: Login - add random value somewhere in the database, Redirect to subdomain, with querystring the randomvalue. And after that the session takes care of it, Each value can be used once only.. But how secure is that? I guess someone would ask the question "why?" to me. Because SSL costs money. And unfortunately i dont have a lot of it. :D Thanks for your time!

    Read the article

  • How to combine a list of choices to determine which select statement

    - by Larry
    I have a mysql db and am using php 5.2 What I am trying to do is offer a list of options for a person to select (only 1). The chosen option will cause a select, update, or delete statement to be ran. The results of the statement do not need to be shown, although, showing the old and then the new would be nice (no problems with that part tho'.). Pseudo-Code: Assign $choice = 0 Check the value of $choice // This way, if it = 100, we do a break Select a Choice:<br> 1. Adjust Status Value (+60) // $choice = 1<br> 2. Show all Ships <br> // $choice = 2 3. Show Ships in Port <br> // $choice = 3 ... 0. $choice="100" // if the value =100, quit this part Use either case (switch) or if/else statements to run the users choice1 If the choice is 1, then run the "Select" statement with the variable of $sql1 -- "SELECT .... If the choice is 2, then run the "Select" statement with the variable of $sql2 --- SELECT * FROM Ships If the choice is 3, then run the "Select" statement with the variable of $sql3 <br> .... If the choice is 0, then we are done. I figured the (3) statements would be assigned in php as: $sql1="...". $sql2="SELECT * FROM Ships" $sql3="SELECT * FROM Ships WHERE nPort="1" My idea was to use the switch statement, but got lost on it. :( I would like the options to be available over and over again, until a variable ($choice) is selected. In which case, this particular page is done and goes back to the "Main Menu"? The coding and display, if I use it, I can do. Just not sure how to write the way to select which one I want. It is possible that I would run all of the queries, and other times, only one, so that is why I would like the choice. An area I get confused in is the proper forms to use such as -- ' ' " " and ...?? Not sure the # of options I will end up with, but it will be more than 5 but less than 20 / page. So if I get the system down for 2-3 choices, I can replicate it for as many as I may need. And, as always, if a better way exists, I am willing to try it. Thanks again... Larry

    Read the article

  • Should Application_End fire on an automatic App Pool Recycle?

    - by Laramie
    I have read this, this, this and this plus a dozen other posts/blogs. I have an ASP.Net app in shared hosting that is frequently recycling. We use NLog and have the following code in global.asax void Application_Start(object sender, EventArgs e) { NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); logger.Debug("\r\n\r\nAPPLICATION STARTING\r\n\r\n"); } protected void Application_OnEnd(Object sender, EventArgs e) { NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); logger.Debug("\r\n\r\nAPPLICATION_OnEnd\r\n\r\n"); } void Application_End(object sender, EventArgs e) { HttpRuntime runtime = (HttpRuntime)typeof(System.Web.HttpRuntime).InvokeMember("_theRuntime", BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.GetField, null, null, null); if (runtime == null) return; string shutDownMessage = (string)runtime.GetType().InvokeMember("_shutDownMessage", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); string shutDownStack = (string)runtime.GetType().InvokeMember("_shutDownStack", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetField, null, runtime, null); ApplicationShutdownReason shutdownReason = System.Web.Hosting.HostingEnvironment.ShutdownReason; NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); logger.Debug(String.Format("\r\n\r\nAPPLICATION END\r\n\r\n_shutDownReason = {2}\r\n\r\n _shutDownMessage = {0}\r\n\r\n_shutDownStack = {1}\r\n\r\n", shutDownMessage, shutDownStack, shutdownReason)); } void Application_Error(object sender, EventArgs e) { NLog.Logger logger = NLog.LogManager.GetCurrentClassLogger(); logger.Debug("\r\n\r\nApplication_Error\r\n\r\n"); } Our log file is littered with "APPLICATION STARTING" entries, but neither Application_OnEnd, Application_End, nor Application_Error are ever fired during these spontaneous restarts. I know they are working because there are entries for touching the web.config or /bin files. We also ran a memory overload test and can trigger an OutOfMemoryException which is caught in Application_Error. We are trying to determine whether the virtual memory limit is causing the recycling. We have added GC.GetTotalMemory(false) throughout the code, but this is for all of .Net, not just our App´s pool, correct? We've also tried var oPerfCounter = new PerformanceCounter(); oPerfCounter.CategoryName = "Process"; oPerfCounter.CounterName = "Virtual Bytes"; oPerfCounter.InstanceName = "iisExpress"; logger.Debug("Virtual Bytes: " + oPerfCounter.RawValue + " bytes"); but don't have permission in shared hosting. I've monitored the app on a dev server with the same requests that caused the recycles in production with ANTS Memory Profiler attached and can't seem to find a culprit. We have also run it with a debugger attached in dev to check for uncaught exceptions in spawned threads that might cause the app to abort. My questions are these: How can I effectively monitor memory usage in shared hosting to tell how much my application is consuming prior to an application recycle? Why are the Application_[End/OnEnd/Error] handlers in global.asax not being called? How else can I determine what is causing these recycles? Thanks.

    Read the article

  • log4net creates log file but does not write to it (windows service in C#)

    - by user1825172
    I am trying to use basic logging for a windows service. I added the reference to log4net I added the following in AssemblyInfo.cs: [assembly: log4net.Config.XmlConfigurator(Watch = true)] I added the following to my App.config: <?xml version="1.0" encoding="utf-8" ?> <configuration> <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" requirePermission="false" /> </configSections> <!-- Log4net Logging Setup --> <log4net> <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender,log4net"> <file value="c:\\CGSD\\log\\logfile.txt" /> <appendToFile value="true" /> <lockingModel type="log4net.Appender.FileAppender+MinimalLock" /> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %level %logger - %message%newline" /> </layout> <filter type="log4net.Filter.LevelRangeFilter"> <levelMin value="INFO" /> <levelMax value="FATAL" /> </filter> </appender> <root> <level value="ALL"/> <appender-ref ref="RollingFileAppender"/> </root> </log4net> </configuration> I have the following code in my service: log4net.Config.XmlConfigurator.Configure(); log4net.ILog log = log4net.LogManager.GetLogger(typeof(Program)); log.Debug("test"); the file c:\CGSD\log\logfile.txt is created but nothing is ever written to it. i've been thru the forums all day trying to trac this one down, but if i overlooked an already posted solution i apologize. thx!

    Read the article

  • Why ????? is displayed instead of non-english characters?

    - by smhnaji
    I first created a simple HTML page that uses UTF-8 as its character encoding. Then I moved the HTML content as a view in codeigniter and it was still ok (I had used non-english characters that were ok as always) I added a simple dynamic functionality (there is a contact us form in it that emails users feedback to site admin). Please note that the characters were ok at localhost (which is a LAMP server running on Ubuntu 12.04 LTS) Strange is that when I uploaded the app to server, all persian characters are shown as ???? (For example ??? (which means Name) is shown ??? and so so...) I have not even connected to mysql or any other DBMS. It's the only page in the website (it's more an under construction page) and nothing else has been used in it. Maybe I should state that I have also used session library to thank the user after his feedback was sent to admins, nothing else. I have really no idea about the problem. UPDATE Now I can see that the problem is only with cPanel. On Directadmin I can see that everything is normal. Both Chromium and Firefox DO use UTF-8 as page's character encoding. URL is http://WEBSITE.COM/dmf/dynamic/ (dmf is the abbreviation of the project name!). There is nothing non-english in the URL. The page's code is as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>??? ???????</title> <link rel="stylesheet" type="text/css" href="<?php echo base_url('template/css/style.css'); ?>" /> <!-- 1. jquery library --> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"> </script> <!-- 2. flowplayer --> <script src="http://releases.flowplayer.org/5.1.1/flowplayer.min.js"></script> <!-- 3. skin --> <link rel="stylesheet" type="text/css" href="http://releases.flowplayer.org/5.1.1/skin/minimalist.css" /> </head> <body> <div id="wrapper"> <header> <h1>??? ???????</h1> </header> <section id="box-container"> <?php echo form_open('contact', "id='contact-us'"); echo form_fieldset('???? ?? ??'); if ($this->session->userdata('mailsent')) { echo '<div>??????? ???? ??? ????? ??</div>'; $this->session->sess_destroy(); } echo '<input tabindex="1" id="name-in" value="???" type="text" name="name"/> <input tabindex="2" id="mail-in" value="?????" type="email" name="email"/> <textarea tabindex="3" id="content-in" name="message">???????</textarea> <input tabindex="4" id="submit" type="submit" value="?????" />'; echo '<div class="clear"></div>'; echo form_fieldset_close(); echo form_close(); ?> <div id="sms-comp"> <h2>?????? ??????</h2> <p> <span id="comp-title">?? ??? ????</span> ???? ??????? ???? ??? </p> </div> <div id="last-program"> <h2>?????? ????? ??????</h2> <div class="flowplayer"> <video id="my_video_1" width="212" height="126" poster="<?php echo base_url('template/images/img.jpg'); ?>" controls="controls" src="http://archive.org/download/Pbtestfilemp4videotestmp4/video_test.ogv" type='video/mp4'> </video> </div> </div> <div class="clear"></div> </section> </div> <footer> ????? ? ????? : <a href="http://powered-by.com/" target="_blank">????? ???</a> </footer> </body> </html>

    Read the article

  • How to set Camera View as background with views over it?

    - by Android Student
    So, I'm trying to make the background to one of my apps look "futuristic." I thought of an idea to make the screen look almost transparent yet have views over it. So, it would look something like this: I'm thinking that I can use the camera to capture the background of the phone (without taking a picture, just having the real time view in the background) and then, if possible, place a semi-transparent slightly blurred ImageView over that. Finally, on top of that I can place the other views including the ImageButtons. So, my question is how would I go about doing this? I have searched but haven't found anything relevant. It must be possible; its just how to do it? I don't expect you to give me all the code as an answer, just if you have any ideas that can help or links or code that can point me in the right direction, it would be greatly appreciated! Thanks!

    Read the article

  • JS. How to replace html element with another element/text, represented in string?

    - by EL 2002
    I have a problem with replacing html elements. For example, there is a table <table><tr><td id="idTABLE">0</td><td>END</td></tr></table> (it can be div, span, anything) And string in JS script var str='<td>1</td><td>2</td>'; (it can be anything, '123 text', '<span123 element</span 456' or ' <tr<td123</td ' or anything) How can I replace element 'idTABLE' with str? I mean really replace, so <table><tr><td id="__TABLE__">0</td><td>END</td></tr></table> becomes <table><tr><td>1</td><td>2</td><td>END</td></tr></table> //str='<td>1</td><td>2</td>'; <table><tr>123 text<td>END</td></tr></table> //'123 text' <table><tr> tr><td>123</td> <td>END</td></tr></table> //' <tr><td>123</td> ' I tried with createElement, replaceChild, cloneNode, but with no result at all =(

    Read the article

  • Jquery set tr with empty td lower than with text in td

    - by PavelBY
    I have html, and jquery for sorting my table (also there is non-standart sorting (with multi-tbody)). My code could be found here: http://jsfiddle.net/GuRxj/ As you can see there, td with prices (on russian ????) are sorted ascending (but tech-as not!? why? (it a question too))... But as you see, i need to send this tr's with prices to top of this tbody (now there are in the bottom), while empty-price-tr send to bottom... How to do this? part of js: $('.prcol').click(function(e) { var $sort = this; var $table = $('#articles-table'); var $rows = $('tbody.analogs_art > tr',$table); $rows.sort(function(a, b){ var keyA = $('td:eq(3)',a).text(); var keyB = $('td:eq(3)',b).text(); if (keyA.length > 0 && keyB.length > 0) { if($($sort).hasClass('asc')){ console.log("bbb"); return (keyA > keyB) ? 1 : 0; } else { console.log(keyA+"-"+keyB); return (keyA > keyB) ? 1 : 0; } } }); $.each($rows, function(index, row){ //console.log(row); $table.append(row); //$("table.123").append(row); }); e.preventDefault(); });

    Read the article

  • Why is my producer-consumer blocking?

    - by User007
    My code is here: http://pastebin.com/Fi3h0E0P Here is the output 0 Should we take order today (y or n): y Enter order number: 100 More customers (y or n): n Stop serving customers right now. Passing orders to cooker: There are total of 1 order(s) 1 Roger, waiter. I am processing order #100 The goal is waiter must take orders and then give them to the cook. The waiter has to wait cook finishes all pizza, deliver the pizza, and then take new orders. I asked how P-V work in my previous post here. I don't think it has anything to do with \n consuming? I tried all kinds of combination of wait(), but none work. Where did I make a mistake? The main part is here: //Producer process if(pid > 0) { while(1) { printf("0"); P(emptyShelf); // waiter as P finds no items on shelf; P(mutex); // has permission to use the shelf waiter_as_producer(); V(mutex); // cooker now can use the shelf V(orderOnShelf); // cooker now can pickup orders wait(); printf("2"); P(pizzaOnShelf); P(mutex); waiter_as_consumer(); V(mutex); V(emptyShelf); printf("3 "); } } if(pid == 0) { while(1) { printf("1"); P(orderOnShelf); // make sure there is an order on shelf P(mutex); //permission to work cooker_as_consumer(); // take order and put pizza on shelf printf("return from cooker"); V(mutex); //release permission printf("just released perm"); V(pizzaOnShelf); // pizza is now on shelf printf("after"); wait(); printf("4"); } } So I imagine this is the execution path: enter waiter_as_producer, then go to child process (cooker), then transfer the control back to parent, finish waiter_as_consumer, switch back to child. The two waits switch back to parent (like I said I tried all possible wait() combination...).

    Read the article

  • Adding text read from a file to an array list in java

    - by user1824856
    I am having trouble putting text read from a file into an array list. My text looks like this: 438;MIA;JFK;10:55;1092;447 638;JFK;MIA;19:45;1092;447 689;ATL;DFW;12:50;732;448 etc... My code looks like this: package filesexample; import java.io.*; import java.io.FileNotFoundException; import java.util.Scanner; import java.util.ArrayList; /** * * @author */ public class FilesExample { /** * @param args the command line arguments */ public static void main(String[] args) throws IOException { File file = new File ("/Schedule.txt"); try { Scanner scanner= new Scanner(file);; while (scanner.hasNextLine()) { String line = scanner.nextLine(); Scanner lineScanner= new Scanner(line); lineScanner.useDelimiter(";"); while(lineScanner.hasNext()){ String part = lineScanner.next(); System.out.print(part + " "); } System.out.println(); } }catch (FileNotFoundException e){ e.printStackTrace(); } } } Some help on getting started would be much appreciated thank you!

    Read the article

  • Controlling the alpha of a UIImageView with Slider ..Can' t get it

    - by user1824839
    first i' d like to say this Forum was really helpfull for me that just started coding some weeks ago .. I succeed to do a quite nice app for the moment , than, but i m stuck on this : HOW COULD I CONTROL THE ALPHA OF A UIIMAGEVIEW , WITH A SLIDER EMBEDED IN ANOTHER VIEW ??? ; Basically i' like to do like the alpha slider of this : http://www.edumobile.org/iphone/how-to-make-an-app-2/controlling-a-uiviews-properties-for-ipad/ , but for a UIImageView. I promised i searched for hours , and didnt find how to do it ... Could someone have some minutes to give me ideas ?? Sorry for my poor english too. Thanks if you can. L. The resume of the link i posted, only focussing on the alpha property would be : ( considering a UIView ( View ) embeded in a ViewController ( ViewController ): enter code here ----View.h----- @interface View : UIView @property ( nonatomic, assign ) CGFloat alpha; @end enter code here ----View.m---- @implementation View @synthesize alpha; ?} @end enter code here ------ViewController.h----- import "View.h" @interface ViewController : UIViewController @property (nonatomic, strong) IBOutlet View *view; ?- (IBAction)alphaChanged:(UISlider *)sender; @end enter code here -------ViewController.m------ @interface ViewController () @end @implementation ViewController @synthesize view; (View *)view {?     if (!view) {?        view = [[View alloc] init];?    }?    return view;?} enter code here (IBAction)redChanged:(UISlider *)sender? {?    self.circle.alpha = sender.value;?    [self.circle setNeedsDisplay];?} (void)viewDidLoad ?{?    [super viewDidLoad];?         ?    self.circle.alpha = (CGFloat)1;?} (void)didReceiveMemoryWarning? {?  [super didReceiveMemoryWarning];?    @end enter code here

    Read the article

  • Why do I get "Sequence contains no elements"?

    - by Gary McGill
    NOTE: see edits at bottom. I am an idiot. I had the following code to process set of tag names and identify/process new ones: IEnumberable<string> tagNames = GetTagNames(); List<Tag> allTags = GetAllTags(); var newTagNames = tagNames.Where(n => !allTags.Any(t => t.Name == n)); foreach (var tagName in newTagNames) { // ... } ...and this worked fine, except that it failed to deal with cases where there's a tag called "Foo" and the list contains "foo". In other words, it wasn't doing a case-insensitive comparison. I changed the test to use a case-insensitive comparison, as follows: var newTagNames = tagNames.Where(n => !allTags.Any(t => t.Name.Equals(n, StringComparison.InvariantCultureIgnoreCase))); ... and suddenly I get an exception thrown when the foreach runs (and calls MoveNext on) newTagNames. The exception says: Sequence has no elements I'm confused by this. Why would foreach insist on the sequence being non-empty? I'd expect to see that error if I was calling First(), but not when using foreach? EDIT: more info. This is getting weirder by the minute. Because my code is in an async method, and I'm superstitious, I decided that there was too much "distance" between the point at which the exception is raised, and the point at which it's caught and reported. So, I put a try/catch around the offending code, in the hope of verifying that the exception being thrown really was what I thought it was. So now I can step through in the debugger to the foreach line, I can verify that the sequence is empty, and I can step right up to the bit where the debugger highlights the word "in". One more step, and I'm in my exception handler. But, not the exception handler I just added, no! It lands in my outermost exception handler, without visiting my recently-added one! It doesn't match catch (Exception ex) and nor does it match a plain catch. (I did also put in a finally, and verified that it does visit that on the way out). I've always taken it on faith that an Exception handler such as those would catch any exception. I'm scared now. I need an adult. EDIT 2: OK, so um, false alarm... The exception was not being caught by my local try/catch simply because it was not being raised by the code I thought. As I said above, I watched the execution in the debugger jump from the "in" of the foreach straight to the outer exception handler, hence my (wrong) assumption that that was where the error lay. However, with the empty enumeration, that was simply the last statement executed within the function, and for some reason the debugger did not show me the step out of the function or the execution of the next statement at the point of call - which was in fact the one causing the error. Apologies to all those who responded, and if you would like to create an answer saying that I am an idoit, I will gladly accept it. That is, if I ever show my face on SO again...

    Read the article

  • EF Code First Detached Entity not updating object reference

    - by Alvaro
    I'm posting the exact entity: public class Person : ContactableEntity { public Plan Plan { get; set; } public int Record { get; set; } public int PersonTypeValue { get; set; } } I'm using the following code to update in a disconected context fashion: public void Update(DbSet MySet, object Obj) { MySet.Attach(Obj); var Entry = this.Entry(Obj); Entry.State = EntityState.Modified; this.SaveChanges(); } This is a method exposed by my dbContext Called this way: PersistentManager.Update(PersistentManager.Personas,UpdatedPersona); The problem is, EF will update any property but the referenced Plan object. Can someone tell me where is the mistake? In advance : the entity reaches the point of update with all the properties correctly set. EF just fails to update the FK in the Database (no exception though)

    Read the article

  • Google fonts different size and jagged

    - by capola
    I have one very surprising issue with Google Fonts. This is the site in question. The title is normaly showing in one ligne but a friend of mine with the same Opera version like me sent me this screenshot. You can see that the title goes in two lines and brakes every think. It's the first time I use Gfonts and must admit that there is another problem in Firefox too - the font appears so jagged! Thanks for your advises!

    Read the article

  • Google Top Geek E02

    Google Top Geek E02 In Spanish! Google Top Geek is a weekly show that will cover the latest news on all things Google in Spanish speaking Latin America, trending searches, YouTube videos and apps in the region; as well as news and relevant events for developers. Mondays at noon, 12 PM, in Google Developers Live and the blog Programa con Google. Créditos E02: Agradecemos a Elefgant el apoyo para la grabación y edición. From: GoogleDevelopers Views: 4106 4 ratings Time: 15:43 More in Science & Technology

    Read the article

  • Google Top Geek E03

    Google Top Geek E03 In Spanish! Google Top Geek is a weekly show, Mondays at 12 PM (Mexico City time). Google Developers Live and the blog Programa con Google. En este episodio: Elecciones en Estados Unidos (Barack Obama) y el sitio de Política y Elecciones de Google. Women Techmakers en Google Developers Live. Google Public Alerts. Búsquedas de la semana y noticias para desarrolladores: aprende inglés y tecnología Google, Oauth 2.0, HTML5 Rocks y Jam with Chrome. From: GoogleDevelopers Views: 165 1 ratings Time: 15:20 More in Science & Technology

    Read the article

  • Wait, Chrome Dev Tools could do THAT?

    Wait, Chrome Dev Tools could do THAT? Your browser is one of the most and best instrumented development platforms -- you may just not realize it yet. In this episode we'll take a whirlwind tour of how to analyze network performance, rendering and layout pipeline, as well as detecting memory leaks in your Javascript code, and using audits and extensions to build faster and better apps! From: GoogleDevelopers Views: 207 16 ratings Time: 33:40 More in Science & Technology

    Read the article

  • Time to stop using &ldquo;Execute Package Task&rdquo;&ndash; a way to execute package in SSIS catalog taking advantage of the new project deployment model ,and the logging and reporting feature

    - by Kevin Shyr
    I set out to find a way to dynamically call package in SSIS 2012.  The following are 2 excellent blogs I found; I used them heavily.  The code below has some addition to parameter types and message types, but was made essentially derived entirely from the blogs. http://sqlblog.com/blogs/jamie_thomson/archive/2011/07/16/ssis-logging-in-denali.aspx http://www.ssistalk.com/2012/07/24/quick-tip-run-ssis-2012-packages-synchronously-and-other-execution-options/   The code: Every package will be called by a PackageController package.  The packageController is initialized with some information on which package to run and what information to pass in.   The following is the stored procedure called from the “Execute SQL Task”.  Here is the highlight of the stored procedure It takes in packageName, project name, and folder name (folder in SSIS project deployment to SSIS catalog) The stored procedure sets the package variables of the upcoming package execution Execute package in SSIS Catalog Get the status of the execution.  Also, if exists, get the error message’s message_id and store them in the management database. Return value to “Execute SQL Task” to manage failure properly CREATE PROCEDURE [AUDIT].[LaunchPackageExecutionInSSISCatalog]        @PackageName NVARCHAR(255)        , @ProjectFolder NVARCHAR(255)        , @ProjectName NVARCHAR(255)        , @AuditKey INT        , @DisableNotification BIT        , @PackageExecutionLogID INT AS BEGIN TRY        DECLARE @execution_id BIGINT = 0;        -- Create a package execution        EXEC [SSISDB].[catalog].[create_execution]                     @package_name=@PackageName,                     @execution_id=@execution_id OUTPUT,                     @folder_name=@ProjectFolder,                     @project_name=@ProjectName,                     @use32bitruntime=False;          UPDATE [AUDIT].[PackageInstanceExecutionLog] WITH(ROWLOCK)        SET [SSISCatalogExecutionID] = @execution_id        WHERE [PackageInstanceExecutionLogID] = @PackageExecutionLogID          -- this is to set the execution synchronized so that I can check the result in the end        EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=50,                     @parameter_name=N'SYNCHRONIZED',                     @parameter_value=1; -- true          /********************************************************         ********************************************************              Section: setting parameters                     Source table:  SSISDB.internal.object_parameters              object_type list:                     20: project level variables                     30: package level variables                     50: execution parameter         ********************************************************         ********************************************************/        EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=30,                     @parameter_name=N'FromParent_AuditKey',                     @parameter_value=@AuditKey; -- true          EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=30,                     @parameter_name=N'FromParent_DisableNotification',                     @parameter_value=@DisableNotification; -- true          EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=30,                     @parameter_name=N'FromParent_PackageInstanceExecutionID',                     @parameter_value=@PackageExecutionLogID; -- true        /********************************************************         ********************************************************              Section: setting variables END         ********************************************************         ********************************************************/            /* This section is carried over from example code           I don't see a reason to change them yet        */        -- Set our package parameters        EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=50,                     @parameter_name=N'DUMP_ON_EVENT',                     @parameter_value=1; -- true          EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=50,                     @parameter_name=N'DUMP_EVENT_CODE',                     @parameter_value=N'0x80040E4D;0x80004005';          EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=50,                     @parameter_name=N'LOGGING_LEVEL',                     @parameter_value= 1; -- Basic          EXEC [SSISDB].[catalog].[set_execution_parameter_value]                     @execution_id,                      @object_type=50,                     @parameter_name=N'DUMP_ON_ERROR',                     @parameter_value=1; -- true                              /********************************************************         ********************************************************              Section: EXECUTING         ********************************************************         ********************************************************/        EXEC [SSISDB].[catalog].[start_execution]                     @execution_id;        /********************************************************         ********************************************************              Section: EXECUTING END         ********************************************************         ********************************************************/            /********************************************************         ********************************************************              Section: checking execution result                     Source table:  [SSISDB].[catalog].[executions]              status:                     1: created                     2: running                     3: cancelled                     4: failed                     5: pending                     6: ended unexpectedly                     7: succeeded                     8: stopping                     9: completed         ********************************************************         ********************************************************/        if EXISTS(SELECT TOP 1 1                            FROM [SSISDB].[catalog].[executions] WITH(NOLOCK)                            WHERE [execution_id] = @execution_id                                  AND [status] NOT IN (2, 7, 9)) BEGIN                /********************************************************               ********************************************************                     Section: logging error messages                            Source table:  [SSISDB].[internal].[operation_messages]                     message type:                            10:  OnPreValidate                             20:  OnPostValidate                             30:  OnPreExecute                             40:  OnPostExecute                             60:  OnProgress                             70:  OnInformation                             90:  Diagnostic                             110:  OnWarning                            120:  OnError                            130:  Failure                            140:  DiagnosticEx                             200:  Custom events                             400:  OnPipeline                     message source type:                            10:  Messages logged by the entry APIs (e.g. T-SQL, CLR Stored procedures)                             20:  Messages logged by the external process used to run package (ISServerExec)                             30:  Messages logged by the package-level objects                             40:  Messages logged by tasks in the control flow                             50:  Messages logged by containers (For, ForEach, Sequence) in the control flow                             60:  Messages logged by the Data Flow Task                                    ********************************************************               ********************************************************/                INSERT INTO AUDIT.PackageInstanceExecutionOperationErrorLink                     SELECT @PackageExecutionLogID                                  ,[operation_message_id]                            FROM [SSISDB].[internal].[operation_messages] WITH(NOLOCK)                            WHERE operation_id = @execution_id                                  AND message_type IN (120, 130)                           EXEC [AUDIT].[FailPackageInstanceExecution] @PackageExecutionLogID, 'SSISDB Internal operation_messages found'                GOTO ReturnTrueAsErrorFlag                /********************************************************               ********************************************************                     Section: checking messages END               ********************************************************               ********************************************************/                /* This part is not really working, so now using rowcount to pass status              --DECLARE @PackageErrorMessage NVARCHAR(4000)              --SET @PackageErrorMessage = @PackageName + 'failed with executionID: ' + CONVERT(VARCHAR(20), @execution_id)                --RAISERROR (@PackageErrorMessage -- Message text.              --     , 18 -- Severity,              --     , 1 -- State,              --     , N'check table AUDIT.PackageInstanceExecutionErrorMessages' -- First argument.              --     );              */        END        ELSE BEGIN              GOTO ReturnFalseAsErrorFlagToSignalSuccess        END        /********************************************************         ********************************************************              Section: checking execution result END         ********************************************************         ********************************************************/ END TRY BEGIN CATCH        DECLARE @SSISCatalogCallError NVARCHAR(MAX)        SELECT @SSISCatalogCallError = ERROR_MESSAGE()          EXEC [AUDIT].[FailPackageInstanceExecution] @PackageExecutionLogID, @SSISCatalogCallError          GOTO ReturnTrueAsErrorFlag END CATCH;     /********************************************************  ********************************************************    Section: end result  ********************************************************  ********************************************************/ ReturnTrueAsErrorFlag:        SELECT CONVERT(BIT, 1) AS PackageExecutionErrorExists ReturnFalseAsErrorFlagToSignalSuccess:        SELECT CONVERT(BIT, 0) AS PackageExecutionErrorExists   GO

    Read the article

  • Presenting Windows Phone 8 at Microsoft Store in Orlando, FL

    - by Nikita Polyakov
    Want to see Windows Phone 8 in person yourself? Want see me present a few features live? Want to come chat in person after? Come by Microsoft Store at The Florida Mall in Orlando, FL on Saturday Nov 17th 2012 at 6-7PM. I will be presenting the Windows Phone 8 OS (no developer content) If you come see this presentation and fill out a survey after you get to be in the drawing for Asus VivoTab RT (see official rules) Let me know if you are coming by! Would love to chat :) Event is also posted on Facebook: https://www.facebook.com/events/167104910079987

    Read the article

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