Search Results

Search found 13011 results on 521 pages for 'catch block'.

Page 73/521 | < Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >

  • Control - C exception in Java

    - by Phil
    I need to catch that exception but I can't figure out which one it is. The IDE i'm using right now doesn't allow for a program interrupt that way. I know how to user try/catch, but I don't actually know what I'm trying to catch.. Can anyone help me with this?

    Read the article

  • Keep Hibernate Initializer from Crashing Program

    - by manyxcxi
    I have a Java program using a basic Hibernate session factory. I had an issue with a hibernate hbm.xml mapping file and it crashed my program even though I had the getSessionFactory() call in a try catch try { session = SessionFactoryUtil.getSessionFactory().openStatelessSession(); session.beginTransaction(); rh = getRunHistoryEntry(session); if(rh == null) { throw new Exception("No run history information found in the database for run id " + runId_ + "!"); } } catch(Exception ex) { logger.error("Error initializing hibernate"); } It still manages to break out of this try/catch and crash the main thread. How do I keep it from doing this? The main issue is I have a bunch of cleanup commands that NEED to be run before the main thread shuts down and need to be able to guarantee that even after a failure it still cleans up and goes down somewhat gracefully. The session factory looks like this: public class SessionFactoryUtil { private static final SessionFactory sessionFactory; static { try { // Create the SessionFactory from hibernate.cfg.xml sessionFactory = new Configuration().configure().buildSessionFactory(); } catch (Throwable ex) { // Make sure you log the exception, as it might be swallowed System.err.println("Initial SessionFactory creation failed." + ex); throw new ExceptionInInitializerError(ex); } } public static SessionFactory getSessionFactory() { try { return sessionFactory; } catch(Exception ex) { return null; } } }

    Read the article

  • is it possible to display video information from an rtsp stream in an android app UI

    - by Joseph Cheung
    I have managed to get a working video player that can stream rtsp links, however im not sure how to display the videos current time position in the UI, i have used the getDuration and getCurrentPosition calls, stored this information in a string and tried to display it in the UI but it doesnt seem to work in main.xml: TextView android:id="@+id/player" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="1px" android:text="@string/cpos" / in strings.xml: string name="cpos""" /string in Player.java private void playVideo(String url) { try { media.setEnabled(false); if (player == null) { player = new MediaPlayer(); player.setScreenOnWhilePlaying(true); } else { player.stop(); player.reset(); } player.setDataSource(url); player.getCurrentPosition(); player.setDisplay(holder); player.setAudioStreamType(AudioManager.STREAM_MUSIC); player.setOnPreparedListener(this); player.prepareAsync(); player.setOnBufferingUpdateListener(this); player.setOnCompletionListener(this); } catch (Throwable t) { Log.e(TAG, "Exception in media prep", t); goBlooey(t); try { try { player.prepare(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } Log.v(TAG, "Duration: === " + player.getDuration()); } catch (IllegalStateException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } private Runnable onEverySecond = new Runnable() { public void run() { if (lastActionTime 0 && SystemClock.elapsedRealtime() - lastActionTime 3000) { clearPanels(false); } if (player != null) { timeline.setProgress(player.getCurrentPosition()); //stores getCurrentPosition as a string cpos = String.valueOf(player.getCurrentPosition()); System.out.print(cpos); } if (player != null) { timeline.setProgress(player.getDuration()); //stores getDuration as a string cdur = String.valueOf(player.getDuration()); System.out.print(cdur); } if (!isPaused) { surface.postDelayed(onEverySecond, 1000); } } };

    Read the article

  • Add delay and focus for a dead simple accordion jquery

    - by kuswantin
    I found the code somewhere in the world, and due to its dead simple nature, I found some things in need to fix, like when hovering the trigger, the content is jumping up down before it settled. I have tried to change the trigger from the title of the accordion block to the whole accordion block to no use. I need help to add a delay and only do the accordion when the cursor is focus in the block. I have corrected my css to make sure the block is covering the hidden part as well when toggled. Here is my latest modified code: var acTrig = ".accordion .title"; $(acTrig).hover(function() { $(".accordion .content").slideUp("normal"); $(this).next(".content").slideDown("normal"); }); $(acTrig).next(".content").hide(); $(acTrig).next(".content").eq(0).css('display', 'block'); This is the HTML: <div class="accordion clearfix"> <div class="title">some Title 1</div> <div class="content"> some content blah </div> </div> <div class="accordion clearfix"> <div class="title">some Title 2</div> <div class="content"> some content blah </div> </div> <div class="accordion clearfix"> <div class="title">some Title 3</div> <div class="content"> some content blah </div> </div> I think I need a way to stop event bubbling somewhere around the code, but can't get it right. Any help would be very much appreciated. Thanks as always.

    Read the article

  • How to place an element at the bottom of a page, without declaring a position?

    - by Earl Larson
    I have a row of icons that need to be at the bottom of the page, they also need to be fixed. Simple, right? Not. When you position them fixed, the icons fall into one another so only one icon shows. Well there goes that, but there also goes the chance of placing them at the bottom of the page since I need #icons { position:fixed; bottom:0; } I could always manually place them, but this means they cant be fixed like I need them too, and I would have to declare it for different browsers. Help? Link to website: Roseannebarr.tumblr.com Here is an example of my HTML <div id="outer"> {block:Photo} <img id="block" src="http://static.tumblr.com/ux4v5bf/vYSlebvt2/photo.png"> <div id="tooltip"> {LinkOpenTag}<img id="photo" src="{PhotoURL-500}" alt="{PhotoAlt}" />{LinkCloseTag} {block:Caption}<div class="caption">{Caption}</div>{/block:Caption} </div> {/block:Photo} </div>

    Read the article

  • Magento Admin Custom Sales Report

    - by Ela
    Hi, I have to develop a module to export collection of product,order,customer combined attributes. So i thought rather than modifying the core sales report for this purpose better to do a custom functionality. These are the steps that i did but i am not able to produce it. Used magento 1.4.1 version for this. Under /var/www/magento141/app/code/core/Mage/Reports/etc/adminhtml.xml Added these lines for menus. <ereaders translate="title" module="reports"> <title>EReader Sales Report</title> <children> <ereaders translate="title" module="reports"> <title>Sales Report</title> <action>adminhtml/report_sales/ereaders</action> </ereaders> </children> </ereaders> Under /var/www/magento141/app/design/adminhtml/default/default/layout/sales.xml Added these lines for filter condition. <adminhtml_report_sales_ereaders> <update handle="report_sales"/> <reference name="content"> <block type="adminhtml/report_sales_sales" template="report/grid/container.phtml" name="sales.report.grid.container"> <block type="adminhtml/store_switcher" template="report/store/switcher/enhanced.phtml" name="store.switcher"> <action method="setStoreVarName"><var_name>store_ids</var_name></action> </block> <block type="sales/adminhtml_report_filter_form_order" name="grid.filter.form"> ---- </block> </block> </reference> </adminhtml_report_sales_ereaders> And then copied the needed block,model files from sales and renamed all of them into ereaders under /var/www/magento141/app/code/core/Mage/Adminhtml/. Then placed action for ereaders under /var/www/magento141/app/code/core/Mage/Adminhtml/controllers/Report/SalesController.php public function ereadersAction() { $this->_title($this->__('Reports'))->_title($this->__('Sales'))->_title($this->__('EReaders Sales')); $this->_showLastExecutionTime(Mage_Reports_Model_Flag::REPORT_ORDER_FLAG_CODE, 'ereaders'); $this->_initAction() ->_setActiveMenu('report/sales/ereaders') ->_addBreadcrumb(Mage::helper('adminhtml')->__('EReaders Sales Report'), Mage::helper('adminhtml')->__('EReaders Sales Report')); $gridBlock = $this->getLayout()->getBlock('report_sales_ereaders.grid'); $filterFormBlock = $this->getLayout()->getBlock('grid.filter.form'); $this->_initReportAction(array( $gridBlock, $filterFormBlock )); $this->renderLayout(); } Here when i use var_dump == //var_dump($this-getLayout()-getBlock('report_sales_ereaders.grid')); am getting bool(false) only. It does not call the ereaders grid, instead of its still loading blocks and grids from Sales only. I searched most of the files related to report, am not still able to find out the problem. Hope many of you gone through these sort of issues, please can anyone tell me where am making mistake or missing something.

    Read the article

  • Preserving original StackTrace/LineNumbers in .NET Exceptions

    - by Sam
    Understanding the difference between throw ex and throw, why is the original StackTrace preserved in this example: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } static void LongFaultyMethod() { try { int x = 20; SomethingThatThrowsException(x); } catch (Exception) { throw; } } static void SomethingThatThrowsException(int x) { int y = x / (x - x); } But not in this one: static void Main(string[] args) { try { LongFaultyMethod(); } catch (System.Exception ex) { Console.WriteLine(ex.StackTrace); } } static void LongFaultyMethod() { try { int x = 20; int y = x / (x - 20); } catch (Exception) { throw; } } The second scenario is producing the same output as throw ex would? In both cases, one expects to see the line number where y is initialized.

    Read the article

  • Throwing a C++ exception after an inline-asm jump

    - by SoapBox
    I have some odd self modifying code, but at the root of it is a pretty simple problem: I want to be able to execute a jmp (or a call) and then from that arbitrary point throw an exception and have it caught by the try/catch block that contained the jmp/call. But when I do this (in gcc 4.4.1 x86_64) the exception results in a terminate() as it would if the exception was thrown from outside of a try/catch. I don't really see how this is different than throwing an exception from inside of some far-flung library, yet it obviously is because it just doesn't work. How can I execute a jmp or call but still throw an exception back to the original try/catch? Why doesn't this try/catch continue to handle these exceptions as it would if the function was called normally? The code: #include <iostream> #include <stdexcept> using namespace std; void thrower() { cout << "Inside thrower" << endl; throw runtime_error("some exception"); } int main() { cout << "Top of main" << endl; try { asm volatile ( "jmp *%0" // same thing happens with a call instead of a jmp : : "r"((long)thrower) : ); } catch (exception &e) { cout << "Caught : " << e.what() << endl; } cout << "Bottom of main" << endl << endl; } The expected output: Top of main Inside thrower Caught : some exception Bottom of main The actual output: Top of main Inside thrower terminate called after throwing an instance of 'std::runtime_error' what(): some exception Aborted

    Read the article

  • Does this language feature already exists?

    - by Pindatjuh
    I'm currently developing a new language for programming in a continuous environment (compare it to electrical engineering), and I've got some ideas on a certain language construction. Let me explain the feature by explanation and then by definition; x = a | b; Where x is a variable and a and b are other variables (or static values). if(x == a) { // all references to "x" are essentially references to "a". } if(x == b) { // same but with "b" } if(x != a) { // ... } if(x == a | b) { // guaranteed that "x" is '"a" | "b"'; interacting with "x" // will interact with both "a" and "b". } // etc. In the above, all code-blocks are executed, but the "scope" changes in each block how x is interpreted. In the first block, x is guaranteed to be a: thus interacting with x inside that block will interact on a. The second and the third code-block are only equal in this situation (because not b only remains a). The last block guarantees that x is at least a or b. Further more; | is not the "bitwise or operator", but I've called it the "and/or"-operator. It's definition is: "|" = "and" | "or" (On my blog, http://cplang.wordpress.com/2009/12/19/binop-and-or/, is more (mathematical) background information on this operator. It's loosely based on sets.) I do not know if this construction already exists, so that's my question: does this language feature already exists?

    Read the article

  • How to build a C++ Dll wrapper that catches all exceptions?

    - by bart de vries
    Like the title says, we’re looking for a way to catch all exceptions from a piece of C++ code, and wrap this in a dll. This way we can shield of the application that uses this dll, from any errors occurring in this dll. However, this does not seem possible with C++ under Windows. Example: void function() { try { std::list<int>::iterator fd_it; fd_it++; } catch(...) {} } The exception that occurs is not caught by the standard C++ try/catch block, nor by any SEH translator function set by _set_se_translator(). Instead, the DLL crashes, and the program that uses the DLL is aborted. We compiled with Visual C++ 2005, with the option /SHa. Does anyone know if it’s possible in C++/Win32 to catch these kind of problems and make a rocksolid DLL wrapper?

    Read the article

  • AJAX Issue, Works in all browsers except IE

    - by Nik
    Alright, this code works in Chrome and FF, but not IE (which is to be expected). Does anyone see anything wrong with this code that would render it useless in IE? var waittime=400; chatmsg = document.getElementById("chatmsg"); room = document.getElementById("roomid").value; sessid = document.getElementById("sessid").value; chatmsg.focus() document.getElementById("chatwindow").innerHTML = "loading..."; document.getElementById("userwindow").innerHTML = "Loading User List..."; var xmlhttp = false; var xmlhttp2 = false; var xmlhttp3 = false; function ajax_read() { if(window.XMLHttpRequest){ xmlhttp=new XMLHttpRequest(); if(xmlhttp.overrideMimeType){ xmlhttp.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState==4) { document.getElementById("chatwindow").innerHTML = xmlhttp.responseText; setTimeout("ajax_read()", waittime); } } xmlhttp.open('GET','methods.php?method=r&room=' + room +'',true); xmlhttp.send(null); } function user_read() { if(window.XMLHttpRequest){ xmlhttp3=new XMLHttpRequest(); if(xmlhttp3.overrideMimeType){ xmlhttp3.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp3=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp3=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp3) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp3.onreadystatechange = function() { if (xmlhttp3.readyState==4) { document.getElementById("userwindow").innerHTML = xmlhttp3.responseText; setTimeout("user_read()", 10000); } } xmlhttp3.open('GET','methods.php?method=u&room=' + room +'',true); xmlhttp3.send(null); } function ajax_write(url){ if(window.XMLHttpRequest){ xmlhttp2=new XMLHttpRequest(); if(xmlhttp2.overrideMimeType){ xmlhttp2.overrideMimeType('text/xml'); } } else if(window.ActiveXObject){ try{ xmlhttp2=new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { try{ xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } catch(e){ } } } if(!xmlhttp2) { alert('Giving up :( Cannot create an XMLHTTP instance'); return false; } xmlhttp2.open('GET',url,true); xmlhttp2.send(null); } function submit_msg(){ nick = document.getElementById("chatnick").value; msg = document.getElementById("chatmsg").value; document.getElementById("chatmsg").value = ""; ajax_write("methods.php?method=w&m=" + msg + "&n=" + nick + "&room=" + room + "&sessid=" + sessid + ""); } function keyup(arg1) { if (arg1 == 13) submit_msg(); } var intUpdate = setTimeout("ajax_read()", waittime); var intUpdate = setTimeout("user_read()", 0);

    Read the article

  • SQL get data out of BEGIN; ...; END; block in python

    - by Claudiu
    I want to run many select queries at once by putting them between BEGIN; END;. I tried the following: cur = connection.cursor() cur.execute(""" BEGIN; SELECT ...; END;""") res = cur.fetchall() However, I get the error: psycopg2.ProgrammingError: no results to fetch How can I actually get data this way? Likewise, if I just have many selects in a row, I only get data back from the latest one. Is there a way to get data out of all of them?

    Read the article

  • What to do when ServerSocket throws IOException and keeping server running

    - by s5804
    Basically I want to create a rock solid server. while (keepRunning.get()) { try { Socket clientSocket = serverSocket.accept(); ... spawn a new thread to handle the client ... } catch (IOException e) { e.printStackTrace(); // NOW WHAT? } } In the IOException block, what to do? Is the Server socket at fault so it need to be recreated? For example wait a few seconds and then serverSocket = ServerSocketFactory.getDefault().createServerSocket(MY_PORT); However if the server socket is still OK, then it is a pity to close it and kill all previously accepted connections that are still communicating. EDIT: After some answers, here my attempt to deal with the IOException. Would the implementation be guaranteeing keeping the server up and only re-create server socket when only necessary? while (keepRunning.get()) { try { Socket clientSocket = serverSocket.accept(); ... spawn a new thread to handle the client ... bindExceptionCounter = 0; } catch (IOException e) { e.printStackTrace(); recreateServerSocket(); } } private void recreateServerSocket() { while (keepRunning) { try { logger.info("Try to re-create Server Socket"); ServerSocket socket = ServerSocketFactory.getDefault().createServerSocket(RateTableServer.RATE_EVENT_SERVER_PORT); // No exception thrown, then use the new socket. serverSocket = socket; break; } catch (BindException e) { logger.info("BindException indicates that the server socket is still good.", e); bindExceptionCounter++; if (bindExceptionCounter < 5) { break; } } catch (IOException e) { logger.warn("Problem to re-create Server Socket", e); e.printStackTrace(); try { Thread.sleep(30000); } catch (InterruptedException ie) { logger.warn(ie); } } } }

    Read the article

  • Centralizing a floating element :(

    - by 2x2p1p
    Hi guys :| My "div" element have a relative width, it isn't absolute so I can't use exact numbers to centralize. A nice solution is to use "display: inline-block": body { text-align: center; } #myDiv { border: 1px solid black; display: inline-block; padding: 50px; } But this element NEEDS to float, I tried this: #myDiv { border: 1px solid black; display: inline-block; float: left; padding: 50px; } And this: #myDiv { border: 1px solid black; display: inline-block; padding: 50px; position: absolute; } Without any success, can somebody help me ? Thanks

    Read the article

  • Should java try blocks be scoped as tightly as possible?

    - by isme
    I've been told that there is some overhead in using the Java try-catch mechanism. So, while it is necessary to put methods that throw checked exception within a try block to handle the possible exception, it is good practice performance-wise to limit the size of the try block to contain only those operations that could throw exceptions. I'm not so sure that this is a sensible conclusion. Consider the two implementations below of a function that processes a specified text file. Even if it is true that the first one incurs some unnecessary overhead, I find it much easier to follow. It is less clear where exactly the exceptions come from just from looking at statements, but the comments clearly show which statements are responsible. The second one is much longer and complicated than the first. In particular, the nice line-reading idiom of the first has to be mangled to fit the readLine call into a try block. What is the best practice for handling exceptions in a funcion where multiple exceptions could be thrown in its definition? This one contains all the processing code within the try block: void processFile(File f) { try { // construction of FileReader can throw FileNotFoundException BufferedReader in = new BufferedReader(new FileReader(f)); // call of readLine can throw IOException String line; while ((line = in.readLine()) != null) { process(line); } } catch (FileNotFoundException ex) { handle(ex); } catch (IOException ex) { handle(ex); } } This one contains only the methods that throw exceptions within try blocks: void processFile(File f) { FileReader reader; try { reader = new FileReader(f); } catch (FileNotFoundException ex) { handle(ex); return; } BufferedReader in = new BufferedReader(reader); String line; while (true) { try { line = in.readLine(); } catch (IOException ex) { handle(ex); break; } if (line == null) { break; } process(line); } }

    Read the article

  • Catching specific vs. generic exceptions in c#

    - by Scott Vercuski
    This question comes from a code analysis run against an object I've created. The analysis says that I should catch a more specific exception type than just the basic Exception. Do you find yourself using just catching the generic Exception or attempting to catch a specific Exception and defaulting to a generic Exception using multiple catch blocks? One of the code chunks in question is below: internal static bool ClearFlags(string connectionString, Guid ID) { bool returnValue = false; SqlConnection dbEngine = new SqlConnection(connectionString); SqlCommand dbCmd = new SqlCommand("ClearFlags", dbEngine); SqlDataAdapter dataAdapter = new SqlDataAdapter(dbCmd); dbCmd.CommandType = CommandType.StoredProcedure; try { dbCmd.Parameters.AddWithValue("@ID", ID.ToString()); dbEngine.Open(); dbCmd.ExecuteNonQuery(); dbEngine.Close(); returnValue = true; } catch (Exception ex) { ErrorHandler(ex); } return returnValue; } Thank you for your advice EDIT: Here is the warning from the code analysis Warning 351 CA1031 : Microsoft.Design : Modify 'ClearFlags(string, Guid)' to catch a more specific exception than 'Exception' or rethrow the exception

    Read the article

  • How to transform a production to LL(1) for a list separated by a semicolon?

    - by Subb
    Hi, I'm reading this introductory book on parsing (which is pretty good btw) and one of the exercice is to "build a parser for your favorite language." Since I don't want to die today, I thought I could do a parser for something relatively simple, ie a simplified CSS. Note: This book teach you how to right a LL(1) parser using the recursive-descent algorithm. So, as a sub-exercice, I am building the grammar from what I know of CSS. But I'm stuck on a production that I can't transform in LL(1) : //EBNF block = "{", declaration, {";", declaration}, [";"], "}" //BNF <block> =:: "{" <declaration> "}" <declaration> =:: <single-declaration> <opt-end> | <single-declaration> ";" <declaration> <opt-end> =:: "" | ";" This describe a CSS block. Valid block can have the form : { property : value } { property : value; } { property : value; property : value } { property : value; property : value; } ... The problem is with the optional ";" at the end, because it overlap with the starting character of {";", declaration}, so when my parser meet a semicolon in this context, it doesn't know what to do. The book talk about this problem, but in its example, the semicolon is obligatory, so the rule can be modified like this : block = "{", declaration, ";", {declaration, ";"}, "}" So, Is it possible to achieve what I'm trying to do using a LL(1) parser?

    Read the article

  • Linq 2 SQL using base class and WCF

    - by Gena Verdel
    Hi all. I have the following problem: I'm using L2S for generating entity classes. All these classes share the same property ID which is autonumber. So I figured to put this property to base class and extend all entity classes from the base one. In order to be able to read the value I'm using the override modifier on this property in each and every entity class. Up to now it's live and kicking. Then I decided to introduce another tier - services using WCF approach. I've modified the Serialization mode to Unidirectional (and added the IsReference=true attribute to enable two directions), also added [DataContract] attribute to the BaseObject class. WCF is able to transport the whole object but one property , which is ID. Applying [DataMember] attribute on ID property at the base class resulted in nothing. Am I missing something? Is what I'm trying to achieve possible at all? [DataContract()] abstract public class BaseObject : IIccObject public virtual long ID { get; set; } [Table(Name="dbo.Blocks")] [DataContract(IsReference=true)] public partial class Block : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private long _ID; private int _StatusID; private string _Name; private bool _IsWithControlPoints; private long _DivisionID; private string _SHAPE; private EntitySet<BlockByWorkstation> _BlockByWorkstations; private EntitySet<PlanningPointAppropriation> _PlanningPointAppropriations; private EntitySet<Neighbor> _Neighbors; private EntitySet<Neighbor> _Neighbors1; private EntitySet<Task> _Tasks; private EntitySet<PlanningPointByBlock> _PlanningPointByBlocks; private EntityRef<Division> _Division; private bool serializing; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnIDChanging(long value); partial void OnIDChanged(); partial void OnStatusIDChanging(int value); partial void OnStatusIDChanged(); partial void OnNameChanging(string value); partial void OnNameChanged(); partial void OnIsWithControlPointsChanging(bool value); partial void OnIsWithControlPointsChanged(); partial void OnDivisionIDChanging(long value); partial void OnDivisionIDChanged(); partial void OnSHAPEChanging(string value); partial void OnSHAPEChanged(); #endregion public Block() { this.Initialize(); } [Column(Storage="_ID", AutoSync=AutoSync.OnInsert, DbType="BigInt NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] [DataMember(Order=1)] public override long ID { get { return this._ID; } set { if ((this._ID != value)) { this.OnIDChanging(value); this.SendPropertyChanging(); this._ID = value; this.SendPropertyChanged("ID"); this.OnIDChanged(); } } } [Column(Storage="_StatusID", DbType="Int NOT NULL")] [DataMember(Order=2)] public int StatusID { get { return this._StatusID; } set { if ((this._StatusID != value)) { this.OnStatusIDChanging(value); this.SendPropertyChanging(); this._StatusID = value; this.SendPropertyChanged("StatusID"); this.OnStatusIDChanged(); } } } [Column(Storage="_Name", DbType="NVarChar(255)")] [DataMember(Order=3)] public string Name { get { return this._Name; } set { if ((this._Name != value)) { this.OnNameChanging(value); this.SendPropertyChanging(); this._Name = value; this.SendPropertyChanged("Name"); this.OnNameChanged(); } } } [Column(Storage="_IsWithControlPoints", DbType="Bit NOT NULL")] [DataMember(Order=4)] public bool IsWithControlPoints { get { return this._IsWithControlPoints; } set { if ((this._IsWithControlPoints != value)) { this.OnIsWithControlPointsChanging(value); this.SendPropertyChanging(); this._IsWithControlPoints = value; this.SendPropertyChanged("IsWithControlPoints"); this.OnIsWithControlPointsChanged(); } } } [Column(Storage="_DivisionID", DbType="BigInt NOT NULL")] [DataMember(Order=5)] public long DivisionID { get { return this._DivisionID; } set { if ((this._DivisionID != value)) { if (this._Division.HasLoadedOrAssignedValue) { throw new System.Data.Linq.ForeignKeyReferenceAlreadyHasValueException(); } this.OnDivisionIDChanging(value); this.SendPropertyChanging(); this._DivisionID = value; this.SendPropertyChanged("DivisionID"); this.OnDivisionIDChanged(); } } } [Column(Storage="_SHAPE", DbType="Text", UpdateCheck=UpdateCheck.Never)] [DataMember(Order=6)] public string SHAPE { get { return this._SHAPE; } set { if ((this._SHAPE != value)) { this.OnSHAPEChanging(value); this.SendPropertyChanging(); this._SHAPE = value; this.SendPropertyChanged("SHAPE"); this.OnSHAPEChanged(); } } } [Association(Name="Block_BlockByWorkstation", Storage="_BlockByWorkstations", ThisKey="ID", OtherKey="BlockID")] [DataMember(Order=7, EmitDefaultValue=false)] public EntitySet<BlockByWorkstation> BlockByWorkstations { get { if ((this.serializing && (this._BlockByWorkstations.HasLoadedOrAssignedValues == false))) { return null; } return this._BlockByWorkstations; } set { this._BlockByWorkstations.Assign(value); } } [Association(Name="Block_PlanningPointAppropriation", Storage="_PlanningPointAppropriations", ThisKey="ID", OtherKey="MasterBlockID")] [DataMember(Order=8, EmitDefaultValue=false)] public EntitySet<PlanningPointAppropriation> PlanningPointAppropriations { get { if ((this.serializing && (this._PlanningPointAppropriations.HasLoadedOrAssignedValues == false))) { return null; } return this._PlanningPointAppropriations; } set { this._PlanningPointAppropriations.Assign(value); } } [Association(Name="Block_Neighbor", Storage="_Neighbors", ThisKey="ID", OtherKey="FirstBlockID")] [DataMember(Order=9, EmitDefaultValue=false)] public EntitySet<Neighbor> Neighbors { get { if ((this.serializing && (this._Neighbors.HasLoadedOrAssignedValues == false))) { return null; } return this._Neighbors; } set { this._Neighbors.Assign(value); } } [Association(Name="Block_Neighbor1", Storage="_Neighbors1", ThisKey="ID", OtherKey="SecondBlockID")] [DataMember(Order=10, EmitDefaultValue=false)] public EntitySet<Neighbor> Neighbors1 { get { if ((this.serializing && (this._Neighbors1.HasLoadedOrAssignedValues == false))) { return null; } return this._Neighbors1; } set { this._Neighbors1.Assign(value); } } [Association(Name="Block_Task", Storage="_Tasks", ThisKey="ID", OtherKey="BlockID")] [DataMember(Order=11, EmitDefaultValue=false)] public EntitySet<Task> Tasks { get { if ((this.serializing && (this._Tasks.HasLoadedOrAssignedValues == false))) { return null; } return this._Tasks; } set { this._Tasks.Assign(value); } } [Association(Name="Block_PlanningPointByBlock", Storage="_PlanningPointByBlocks", ThisKey="ID", OtherKey="BlockID")] [DataMember(Order=12, EmitDefaultValue=false)] public EntitySet<PlanningPointByBlock> PlanningPointByBlocks { get { if ((this.serializing && (this._PlanningPointByBlocks.HasLoadedOrAssignedValues == false))) { return null; } return this._PlanningPointByBlocks; } set { this._PlanningPointByBlocks.Assign(value); } } [Association(Name="Division_Block", Storage="_Division", ThisKey="DivisionID", OtherKey="ID", IsForeignKey=true, DeleteOnNull=true, DeleteRule="CASCADE")] public Division Division { get { return this._Division.Entity; } set { Division previousValue = this._Division.Entity; if (((previousValue != value) || (this._Division.HasLoadedOrAssignedValue == false))) { this.SendPropertyChanging(); if ((previousValue != null)) { this._Division.Entity = null; previousValue.Blocks.Remove(this); } this._Division.Entity = value; if ((value != null)) { value.Blocks.Add(this); this._DivisionID = value.ID; } else { this._DivisionID = default(long); } this.SendPropertyChanged("Division"); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private void attach_BlockByWorkstations(BlockByWorkstation entity) { this.SendPropertyChanging(); entity.Block = this; } private void detach_BlockByWorkstations(BlockByWorkstation entity) { this.SendPropertyChanging(); entity.Block = null; } private void attach_PlanningPointAppropriations(PlanningPointAppropriation entity) { this.SendPropertyChanging(); entity.Block = this; } private void detach_PlanningPointAppropriations(PlanningPointAppropriation entity) { this.SendPropertyChanging(); entity.Block = null; } private void attach_Neighbors(Neighbor entity) { this.SendPropertyChanging(); entity.FirstBlock = this; } private void detach_Neighbors(Neighbor entity) { this.SendPropertyChanging(); entity.FirstBlock = null; } private void attach_Neighbors1(Neighbor entity) { this.SendPropertyChanging(); entity.SecondBlock = this; } private void detach_Neighbors1(Neighbor entity) { this.SendPropertyChanging(); entity.SecondBlock = null; } private void attach_Tasks(Task entity) { this.SendPropertyChanging(); entity.Block = this; } private void detach_Tasks(Task entity) { this.SendPropertyChanging(); entity.Block = null; } private void attach_PlanningPointByBlocks(PlanningPointByBlock entity) { this.SendPropertyChanging(); entity.Block = this; } private void detach_PlanningPointByBlocks(PlanningPointByBlock entity) { this.SendPropertyChanging(); entity.Block = null; } private void Initialize() { this._BlockByWorkstations = new EntitySet<BlockByWorkstation>(new Action<BlockByWorkstation>(this.attach_BlockByWorkstations), new Action<BlockByWorkstation>(this.detach_BlockByWorkstations)); this._PlanningPointAppropriations = new EntitySet<PlanningPointAppropriation>(new Action<PlanningPointAppropriation>(this.attach_PlanningPointAppropriations), new Action<PlanningPointAppropriation>(this.detach_PlanningPointAppropriations)); this._Neighbors = new EntitySet<Neighbor>(new Action<Neighbor>(this.attach_Neighbors), new Action<Neighbor>(this.detach_Neighbors)); this._Neighbors1 = new EntitySet<Neighbor>(new Action<Neighbor>(this.attach_Neighbors1), new Action<Neighbor>(this.detach_Neighbors1)); this._Tasks = new EntitySet<Task>(new Action<Task>(this.attach_Tasks), new Action<Task>(this.detach_Tasks)); this._PlanningPointByBlocks = new EntitySet<PlanningPointByBlock>(new Action<PlanningPointByBlock>(this.attach_PlanningPointByBlocks), new Action<PlanningPointByBlock>(this.detach_PlanningPointByBlocks)); this._Division = default(EntityRef<Division>); OnCreated(); } [OnDeserializing()] [System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)] public void OnDeserializing(StreamingContext context) { this.Initialize(); } [OnSerializing()] [System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)] public void OnSerializing(StreamingContext context) { this.serializing = true; } [OnSerialized()] [System.ComponentModel.EditorBrowsableAttribute(EditorBrowsableState.Never)] public void OnSerialized(StreamingContext context) { this.serializing = false; } }

    Read the article

  • problem in batch script read user input

    - by JCH
    hi, i use set /p below to read user input it seems to work outside the if block but the one inside if block doesn't work. When i run the script second time the user input in the if block prints the previous user input. test script: @echo off set cond=true echo %cond% if %cond%==true ( echo "cond is true" REM the below input doesn't work set /p name1="enter your name" echo name is: %name1% ) REM it works here set /p name2="enter your name" echo name is: %name2% thank you

    Read the article

  • How to handle not-enough-isolatedstorage issue deep in data loader?

    - by Edward Tanguay
    I have a silverlight application which loads data from many external data sources into IsolatedStorage, and while loading any of these sources if it does not have enough IsolatedStorage, it ends up in a catch statement. At that point in that catch statement I would like to ask the user to click a button to approve silverlight to increase the IsolatedStorage capacity. The problem is, although I have a "SwitchPage()" method with which I display a page, if I access it at this point it is too deep in the loading process and the application always goes into an endless loop, hangs and crashes. I need a way to branch out of the application completely somehow to an independent UserControl which has a button and code behind which does the increase logic. What is a solution for an application to be able to branch out of a loading process catch statement like this, display a user control which has a button to ask the user to increase the IsolatedStorage? public static void SaveBitmapImageToIsolatedStorageFile(OpenReadCompletedEventArgs e, string fileName) { try { using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { using (IsolatedStorageFileStream isfs = new IsolatedStorageFileStream(fileName, FileMode.Create, isf)) { Int64 imgLen = (Int64)e.Result.Length; byte[] b = new byte[imgLen]; e.Result.Read(b, 0, b.Length); isfs.Write(b, 0, b.Length); isfs.Flush(); isfs.Close(); isf.Dispose(); } } } catch (IsolatedStorageException) { //handle: present user with button to increase isolated storage } catch (TargetInvocationException) { //handle: not saved } }

    Read the article

  • How to Declare Complex Nested C# Type for Web Service

    - by TheArtTrooper
    I would like to create a service that accepts a complex nested type. In a sample asmx file I created: [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. // [System.Web.Script.Services.ScriptService] public class ServiceNest : System.Web.Services.WebService { public class Block { [XmlElement(IsNullable = false)] public int number; } public class Cell { [XmlElement(IsNullable = false)] public Block block; } public class Head { [XmlElement(IsNullable = false)] public Cell cell; } public class Nest { public Head head; } [WebMethod] public void TakeNest(Nest nest) { } } When I view the asmx file in IE the test page shows the example SOAP post request as: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <TakeNest xmlns="http://schemas.intellicorp.com/livecompare/"> <nest> <head> <cell> <block xsi:nil="true" /> </cell> </head> </nest> </TakeNest> </soap:Body> </soap:Envelope> It hasn't expanded the <block> into its number member. Looking at the WSDL, the types all look good. So is this just a limitation of the post demo page creator? Thanks.

    Read the article

  • C++ Memory Allocation & Linked List Implementation

    - by pws5068
    I'm writing software to simulate the "first-fit" memory allocation schema. Basically, I allocate a large X megabyte chunk of memory and subdivide it into blocks when chunks are requested according to the schema. I'm using a linked list called "node" as a header for each block of memory (so that we can find the next block without tediously looping through every address value. head_ptr = (char*) malloc(total_size + sizeof(node)); if(head_ptr == NULL) return -1; // Malloc Error .. :-( node* head_node = new node; // Build block header head_node->next = NULL; head_node->previous = NULL; // Header points to next block (which doesn't exist yet) memset(head_ptr,head_node, sizeof(node)); ` But this last line returns: error: invalid conversion from 'node*' to 'int' I understand why this is invalid.. but how can I place my node into the pointer location of my newly allocated memory?

    Read the article

  • TransactionRequiredException on OptimisticLockException

    - by João Madureira Pires
    Hi there. I have the following class that generates sequencial Card Numbers. I'm trying to recover from OptimisticLockException, by calling recursively the same method. however, i'm getting TransactionRequiredException. Dows anyone knows how to recover from OptimisticLockException in my case? Thanks a lot in advance @Name("simpleAutoIncrementGenerator") public class SimpleAutoIncrementGenerator extends CardNumberGenerator{ private static final long serialVersionUID = 2869548248468809665L; private int numberOfRetries = 0; @Override public String generateNextNumber(CardInstance cardInstance, EntityManager entityManager) { try{ EntityCard card = (EntityCard)entityManager.find(EntityCard.class, cardInstance.getId()); if(card != null){ String nextNumber = ""; String currentNumber = card.getCurrentCardNumber(); if(currentNumber != null && !currentNumber.isEmpty()){ Long numberToInc = Long.parseLong(currentNumber); numberToInc ++; nextNumber = String.valueOf(numberToInc); card.setCurrentCardNumber(nextNumber); // this is just to cause a OptimisticLock Exception try { Thread.sleep(4000); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } entityManager.persist(card); entityManager.flush(); return nextNumber; } } }catch (OptimisticLockException oLE) { System.out.println("\n\n\n\n OptimisticLockException \n\n\n\n"); if(numberOfRetries < CentralizedConfig.CARD_NUMBER_GENERATOR_MAX_TRIES){ numberOfRetries ++; return generateNextNumber(cardInstance,entityManager); } }catch (TransactionRequiredException trE) { System.out.println("\n\n\n\n TransactionRequiredException \n\n\n\n"); if(numberOfRetries < CentralizedConfig.CARD_NUMBER_GENERATOR_MAX_TRIES){ numberOfRetries ++; return generateNextNumber(cardInstance,entityManager); } }catch (StaleObjectStateException e) { System.out.println("\n\n\n\n StaleObjectStateException \n\n\n\n"); if(numberOfRetries < CentralizedConfig.CARD_NUMBER_GENERATOR_MAX_TRIES){ numberOfRetries ++; return generateNextNumber(cardInstance,entityManager); } } return null; } }

    Read the article

  • Ie7 float problems and hiperlinks not clickable

    - by Uffo
    Markup <ul class="navigation clearfix"> <li class="navigation-top"></li> <div class="first-holder" style="height:153px;"> <dl class="hold-items clearfix"> <dd class="clearfix with"><a href="http://site.com" title="Protokoll">Protokoll</a></dd> <dd class="with-hover"><a href="http://site.com" title="Mein/e Unternehmen">Mein/e Unternehmen</a></dd> <dd class="with"><a class="face-me" href="http://site.com" title="Erweiterte Suche">Erweiterte Suche</a></dd> <dd class="with"><a href="http://site.com" title="Abmelden">Abmelden</a></dd> </dl> </div><!--[end] /.first-holder--> <li class="navigation-bottom"></li> </ul><!--[end] /.navigation--> Css: .first-holder{height:304px;position:relative;width:178px;overflow:hidden;margin-bottom:0px;padding-bottom: 0px;} .hold-items{top:0px;position:absolute;} .navigation dd.with{line-height:38px;background:url('/images/sprite.png') no-repeat -334px -46px;width:162px;height:38px;padding-bottom:0px;overflow: hidden;} .navigation dd.with a{position:relative;outline:0;display:block;font-weight:bold;color:#3f78c0;padding-left:10px;line-height:38px;} .with-hover{background:url('/images/sprite.png') no-repeat -505px -47px;width:178px;height:38px;line-height:38px;overflow:none;} .with-hover a{position:relative;display:block;font-weight:bold;color:#fff;padding-left:10px} .navigation-top{background:url('/images/sprite.png') no-repeat -694px -46px;width:160px;height:36px;} .navigation-top a{display:block;outline:0;height:20px;padding-top:18px;padding-left:138px;} .navigation-top a span{display:block;background:url('/images/sprite.png') no-repeat -212px -65px;width:8px;height:6px;} .navigation-bottom{background:url('/images/sprite.png') no-repeat -784px -402px;width:160px;height:37px;} .navigation-bottom a{display:block;outline:0;height:20px;padding-top:18px;padding-left:138px;} .navigation-bottom a span{display:block;background:url('/images/sprite.png') no-repeat -212px -74px;width:8px;height:6px;} Also the links, are not clickable, if I click on a link in IE7 it doesn't do the action..it doesn't redirect me to the location. This is how it looks in IE7: http://screencast.com/t/MGY4NjljZjc This is how it look in IE8,Firefox,Chrome and so on http://screencast.com/t/MzhhMDQ1M What I'm doing wrong PS: .navigation-top a span and .navigation-bottom a span I'm using some where else, but that it's ok it works fine.

    Read the article

< Previous Page | 69 70 71 72 73 74 75 76 77 78 79 80  | Next Page >