Daily Archives

Articles indexed Saturday April 24 2010

Page 3/78 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Need Associated ID Added to a While Loop (php)

    - by user319361
    Been trying to get my head around while loops for the last few days but the code seems very inefficient for what Im trying to achieve. I'm assuming I'm overcomplicating this though nothing I've tried seems to work. Each topic in my forum can have related topic IDs stored in a seperate table. A post ID is also stored in this table, as that specific post references why they are considered related. DB Table contains only: topic_id, related_id, post_id // Get related IDs and post IDs for current topic being viewed $result = $db->query('SELECT related_id, post_id FROM related_topics WHERE topic_id='.$id.''); // If related topics found, put both of the IDs into arrays if ($db->num_rows($result)) { while($cur_related = mysql_fetch_array($result)){ $reltopicarray[] = $cur_related['related_id']; $relpost[] = $cur_related['post_id']; } // If the first array isnt empty, get some additional info about each related ID from another table if(!empty($reltopicarray)) { $pieces = $reltopicarray; $glued = "\"".implode('", "', $pieces)."\""; $fetchtopics = $db->query('SELECT id, subject, author, image, etc FROM topics WHERE id IN('.$glued.')'); } // Print each related topic while($related = mysql_fetch_array($fetchtopics)){ ?> <a href="view.php?id=<?php echo $related['id']; ?>"><?php echo $related['subject']; ?></a> by <?php echo $related['author']; ?> // Id like to show the Post ID below (from the array in the first while loop) // The below link doesnt work as Im outside the while loop by this point. <br /><a href="view.php?post_id=<?php echo $cur_related['post_id']; ?>">View Relationship</a> <?php } ?> The above currently works, however I'm trying to also display the post_id link below each related topic link, as shown above. Would be greatful if someone can lend a hand. Thanks :)

    Read the article

  • How do you properly use WideCharToMultiByte

    - by Obediah Stane
    I've read the documentation here: http://msdn.microsoft.com/en-us/library/ms776420(VS.85).aspx I'm stuck on this parameter: lpMultiByteStr [out] Pointer to a buffer that receives the converted string. I'm not quite sure how to properly initialize the variable and feed it into the function

    Read the article

  • jQuery Ajax post with dynamic url

    - by morpheous
    I want to send an AJAX POST, but I want the url that the data is sent to, to be derived from the id of the element that was clicked. This is what I have so far: I have written a javascript function (get_my_url) that returns a url, depending on the element id that was passed to the function. The problem is, it is not clear how to bind the function (get_my_url) to the url param of the .ajax() method. jQuery('.elem1').click(function(){ jQuery.ajax({ async: false, type: 'POST', url: get_my_url(jQuery(this).attr('id')), data: 'id1=1', dataType: 'json', success: function(data){ msg = data.msg }, error: function(xrq, status, et){msg='Oops. An error occured!'} }); Does anyone know how to pass a function to the url param?

    Read the article

  • jquery datepicker: select date as back as 6 months

    - by Abu Hamzah
    Start date: user can select start date as back as 6 months. example: if today is 04/23/2010 then i can go back up to 11/23/2009 but not more than 6 months. <script type="text/javascript"> $(document).ready(function () { $('#endDate').datepicker({ showOn: 'button', buttonImage: '../images/Calendar.png', buttonImageOnly: true, onSelect: function () { }, onClose: function () { $(this).focus(); } }); $('#startDate').datepicker({ showOn: 'button', buttonImage: '../images/Calendar.png', buttonImageOnly: true, onSelect: function (dateText, inst) { $('#endDate').datepicker("option", 'minDate', new Date(dateText)); } , onClose: function () { $(this).focus(); } }); }); update code: var currentDate = new Date(); var currentMonth = currentDate.getMonth() + 1; var sixMonths = currentMonth + 6 currentDate.setMonth(currentDate.currentMonth, sixMonths); var myNewCurrentDate = new Date(currentDate) $('#startDate').datepicker('option', { minDate: myNewCurrentDate }); i am getting currentDate = NaN

    Read the article

  • Silverlight 2 Error Code: 4004

    - by jkidv
    Hey guys/gals. I have a silverlight 2 app that has an ObservableCollection of a class from a separate assem/lib. When I set my ListBox.ItemsSource on that collection, and run it, I get the error code: 4004 "System.ArgumentException: Value does not fall within the expected range." Here is part of the code: public partial class Page : UserControl { ObservableCollection<Some.Lib.Owner> ooc; public Page() { ooc = new ObservableCollection<Some.Lib.Owner>(); Some.Lib.Owner o1 = new Some.Lib.Owner() { FirstName = "test1" }; Some.Lib.Owner o2 = new Some.Lib.Owner() { FirstName = "test2" }; Some.Lib.Owner o3 = new Some.Lib.Owner() { FirstName = "test3" }; ooc.Add(o1); ooc.Add(o2); ooc.Add(o3); InitializeComponent(); lb1.ItemsSource = ooc; } } But when I create the Owner class within this same project, everything works fine. Is there some security things going on behind the scenes? Also, I'm using the generate a html page option and not the aspx option, when I created this Silverlight 2 app.

    Read the article

  • Lock Free Queue -- Single Producer, Multiple Consumers

    - by Shirish
    Hello, I am looking for a method to implement lock-free queue data structure that supports single producer, and multiple consumers. I have looked at the classic method by Maged Michael and Michael Scott (1996) but their version uses linked lists. I would like an implementation that makes use of bounded circular buffer. Something that uses atomic variables? On a side note, I am not sure why these classic methods are designed for linked lists that require a lot of dynamic memory management. In a multi-threaded program, all memory management routines are serialized. Aren't we defeating the benefits of lock-free methods by using them in conjunction with dynamic data structures? I am trying to code this in C/C++ using pthread library on a Intel 64-bit architecture. Thank you, Shirish

    Read the article

  • CodePlex Daily Summary for Friday, April 23, 2010

    CodePlex Daily Summary for Friday, April 23, 2010New Projects3D TagCloud for SharePoint 2010: 3D Flash TagCloud WebPart for SharePoint 2010AnyCAD.Net: AnyCAD.NetCassandraemon: Cassandraemon is LINQ Provider for Apache Cassandra.CCLI SongSelect Importer for PowerPoint: CCLI SongSelect Importer for PowerPoint ® is an Add-in for Microsoft ® PowerPoint ® that allows CCLI SongSelect (USR) files to be turned into slide...Compactar Arquivo Txt, Flat File, em Pipeline Decoder Customizado: Objetivo do projeto: Desenvolver um componente do tipo Pipeline Receiver Decoder, onde compacta o conteúdo, cria uma mensagem em XML e transforma ...Console Calculator: Console calculator is a simple, yet useful, mathematical expression calculator, supporting functions and variables. It was created to demonstrate ...CRM Dynamics Excel Importer: CRM Dynamics Excel Importercubace: The standard audio composer software with just single difference: this is CLR compilation.deneb: deneb projectDrive Backup: Drive Backup is an easy to use, automatic backup program. Simply insert a USB drive, and the program will backup either files on the drive to your ...eWebMVCCMS: this is the start of eWeb MVC CMS.Fix.ly: Small app that allows for URL rewriting before passing to the browser. Accepts MEF plugins that make themselves available by informing the applicat...GArphics: GArphics uses a genetic algorithm to produce graphics and animation with the assitance of the user.JDS Toolkit: An experimental toolkit geared to make richer applications with less effort. It will include controls such as the cubeoid and the serializedmenu. ...KrashSRC - MapleStory v.75 Emulator: KrashSRC - MapleStory v.75 EmulatorLast.fm Api: Last.fm api writen in Visaul Basic 2010.MIX 10 DVR and Downloader: A Silverlight application that will manage downloading the sessions and slide decks from the MIX '10 Conference utilizing the MIX OData feed for in...NSIS Autorun: This is a graphical CD/DVD/USB autorun engine that launches installers made with NSIS. Non-rectangular windows and animation are supported. Can be ...Pillbox: Windows Phone 7 sample application for tracking medications.PowerSharp: Very simple application that executes a snippet of PowerShell against C#. This will eventually be used with Live@EDU.Project Halosis: mmorpgProyecto Cero: Proyecto CeroSharePoint XSL Templates: This project is a place to share useful XSL templates that can be reused in SharePoint CQWPs and DVWPs.Silverlight 4.0 Popup Menu: Silverlight 4.0 Popup Menu spsearch: This project provides useful enhancements to Search using the SharePoint platform.StereoVision: StereVision es un proyecto que estudia un algoritmo de visión estereocopicaThe Stoffenmanager: The Stoffenmanager is a tool for prioritizing worker health risks to dangerous substances. But also a quantitative inhalation exposure tool and a ...Transcriber: Transcribe text from one character set to another. Extensible, plug-in based architecture. Default plug-in uses XML rules files with regular expres...Wavelets experiments: эксперименты с вейвлетамиWindows Phone 7 World of Warcraft Armory Browser: A test project to learn a little about Windows Phone development and do a decent armory browserXAML Based Chat: Xaml based chat. A simple chat systemNew Releases#Nose: SharpNose v1.1: Configuration is now done by updating SharpNose.exe.config MEF support added - you can also add your favorite test framework discovery Two tes...Baml Localizer: Version 0.1 (alpha): This is the first release which should show the capabilities of Baml Localizer. The code might still change a lot, but the file formats should be q...BibWord : Microsoft Word Citation and Bibliography styles: APA with DOI - Proof of Concept: IntroductionThis release is a proof of concept (POC) demonstrating a possible way of adding a digital object identifier (DOI) field to the APA styl...Chargify.NET: Chargify.NET v0.685: Releasing Version 0.685 - Changed customer reference ID from Guid to String for systems that don't use Guid as the unique key. - Added method for g...Compactar Arquivo Txt, Flat File, em Pipeline Decoder Customizado: SampleZipDecodePipeline: Solution contem Projeto com o Decoder Pipeline. Projeto para usar o Componente. Classes SharpZipLib para compactar e descompactar arquivosConsole Calculator: Console Calculator: Initial source code release.CSharp Intellisense: V1.6: UPDATE: 2010/04/05: description was added 2010/04/07: single selection + reset filter 20010/04/15: source code available at http://csharpintellis...Drive Backup: Drive Backup: Drive Backup allows you to automatically backup a USB device to your computer, or backup files/directories on your computer to a USB. Once you have...Event Scavenger: Thread recycling changes - Version 3.1: Change the location of where the settings for thread recycling is stored - Moved from config file to database for easier management. Version of dat...Extend SmallBasic: Teaching Extensions v.013: Added Houses QuizExtend SmallBasic: Teaching Extensions v.014: fixed a bug in Tortoise.approve rearranged the Houses Quiz to be more funFix.ly: Fix.ly 0.1: Initial test releaseFix.ly: Fix.ly 0.11: Fixed a couple bugs, including missing files in the previous releaseGArphics: Beta: This is the beta-version of the program. Version 1.0 shall be relased soon and will include a lot of improvements.HouseFly: HouseFly alpha 0.2.0.5: HouseFly alpha release 0.2.0.5HouseFly controls: HouseFly controls alpha 0.9.4: Version 0.9.4 alpha release of HouseFly controlsHTML Ruby: 6.21.8: Change Math.floor to round for text spacingHTML Shot: 0.1: Solved problems with some URLsJDS Toolkit: JDS Toolkit 0.1: Beta 0.1 version. Almost nothing in these librariesManaged Extensibility Framework: WebForms and MEF Sample: This sample demonstrates the use of these two technologies together in a non-invasive way. Information on how to use it on your own projects is inc...Microsoft - Domain Oriented N-Layered .NET 4.0 App Sample (Microsoft Spain): V0.7 - N-Layer DDD Sample App (VS.2010 RTM compat): Required Software (Microsoft Base Software needed for Development environment) Visual Studio 2010 RTM & .NET 4.0 RTM (Final Versions) Unity Applic...MvcContrib Portable Areas: Portable Areas: First Release of some portable areasNSIS Autorun: NSIS Autorun: Initial release.OgmoXNA: OgmoXNA Alpha Source Tree: Zipped version of the source tree in case you don't want to go through the SVN!Particle Plot Pivot: Particle Plot Pivot v1.0.0: Generates a Pivot collection of unpublished plots from the particle physics exeriments DZERO, CDF, ATLAS, and CMS. It can be found at http://deepta...patterns & practices SharePoint Guidance: SPG2010 Drop9: SharePoint Guidance Drop Notes Microsoft patterns and practices ****************************************** ***************************************...Rich Ajax empowered Web/Cloud Applications: 6.3.15: New Visual WebGui rich applications platform versionSilverlight 4.0 Popup Menu: PopupMenu for Silverlight 4: This is the first release of the popup menu class for Silverlight 4.0Silverlight Flow Layouts library: SL and WPF Flow Layouts library April 2010: This release introduces WPF 4.0 RTM and Silverlight 4 RTM support, as well as an additional layout algorithm and some minor bug fixes. Some changes...Spackle.NET: 3.0.0.0 Release: In this release: Spackle.dll now targets the 4.0 version of the .NET Framework SecureRandom implements IDisposable ActionExtensions have been ...Splinger FrameXi: Splinger 1.1: Welcome to a whole new way of learning! Go to release 1.0 for the non .zip packaged files.SQL Server Metadata Toolkit 2008: SQL Server Metadata Toolkit Alpha 6: This release addresses issues 10665, 10678 and 10679. The SQL Parser now understands CAST functions (the AS was causing issues), and is installed ...Star Trooper for XNA 2D Tutorial: Lesson four content: Here is Lesson four original content for the StarTrooper 2D XNA tutorial. It also includes the XNA version of Lesson four source. The blog tutori...Thales Simulator Library: Version 0.8.6: The Thales Simulator Library is an implementation of a software emulation of the Thales (formerly Zaxus & Racal) Hardware Security Module cryptogra...Transcriber: Transcriber v0.1: Initial alpha release. Very nearly useful. :-) This version includes rules files for Mode of Beleriand, Sindarin Tehtar, Quenya, and Black Speech. ...Visual Studio DSite: Picture Box Viewer (Visual F sharp 2008): A simple picturebox viewer made in visual f sharp 2008.Web/Cloud Applications Development Framework | Visual WebGui: 6.4 Beta 2d: Further stabilization of the cutting-edge web applications frameworkWebAssert: WebAssert 0.1: Initial release. Supports HTML & CSS validation using MSTest/Visual Studio testing.XAML Based Chat: Test release: A test releaseすとれおじさん(仮): すとれおじさん β 0.02: ・デザインを大幅に変更 ・まだかなり動作が重いです ・機能も少ないですMost Popular ProjectsRawrWBFS ManagerSilverlight ToolkitAJAX Control ToolkitMicrosoft SQL Server Product Samples: Databasepatterns & practices – Enterprise LibraryWindows Presentation Foundation (WPF)ASP.NETMicrosoft SQL Server Community & SamplesPHPExcelMost Active Projectspatterns & practices – Enterprise LibraryRawrParticle Plot PivotBlogEngine.NETNB_Store - Free DotNetNuke Ecommerce Catalog ModuleGMap.NET - Great Maps for Windows Forms & PresentationFarseer Physics EngineDotNetZip LibraryFluent Ribbon Control SuiteN2 CMS

    Read the article

  • Check if the internet cannot be accessed in Python

    - by Sridhar Ratnakumar
    I have an app that makes a HTTP GET request to a particular URL on the internet. But when the network is down (say, no public wifi - or my ISP is down, or some such thing), I get the following traceback at urllib.urlopen: 70, in get u = urllib2.urlopen(req) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 126, in urlopen return _opener.open(url, data, timeout) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 391, in open response = self._open(req, data) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 409, in _open '_open', req) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 369, in _call_chain result = func(*args) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1161, in http_open return self.do_open(httplib.HTTPConnection, req) File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/urllib2.py", line 1136, in do_open raise URLError(err) URLError: <urlopen error [Errno 8] nodename nor servname provided, or not known> I want to print a friendly error to the user telling him that his network maybe down instead of this unfriendly "nodename nor servname provided" error message. Sure I can catch URLError, but that would catch every url error, not just the one related to network downtime. I am not a purist, so even an error message like "The server example.com cannot be reached; either the server is indeed having problems or your network connection is down" would be nice. How do I go about selectively catching such errors? (For a start, if DNS resolution fails at urllib.urlopen, that can be reasonably assumed as network inaccessibility? If so, how do I "catch" it in the except block?)

    Read the article

  • Simulink: Specifying trajectory

    - by stanigator
    I would like to use jtraj to specify a trajectory in a Simulink model. Below are what I attempted to retrieve in the command prompt: Q0 = [1 1 0]; Q1 = [1+0.5*cos(2*20) 1+0.5*sin(2*20) 0]; t = 0:0.1:20; [Q, Qd, Qdd] = jtraj(Q0, Q1, t); However, I don't know how to include such trajectory data in the Simulink model easily. Any comments? Thanks in advance.

    Read the article

  • PHP parsing invalid html

    - by kmunky
    hi , i'm trying to parse some html that is not on my server $dom = new DOMDocument(); $dom->loadHTMLfile("http://www.some-site.org/page.aspx"); echo $dom->getElementById('his_id')->item(0); but php returns an error something like ID his_id already defined in http://www.some-site.org/page.aspx, line: 33. I think that is because DOMDocument is dealing with invalid html. So, how can i parse it even though is invalid?

    Read the article

  • error with string list in C#

    - by Chelsea_cole
    Same namespace: 2 forms. public class Account //frm1 { public string Username; public string Password; } public class ListAcc { public static List<Account> UserList; } private void button1_Click(object sender, EventArgs e) { List<Account> UserList = new List<Account>(); Account acc = new Account(); acc.Username = textBox1.Text; acc.Password = textBox2.Text; UserList.Add(acc); } private void button2_Click(object sender, EventArgs e) //frm2 { string p = frmDangky.ListAcc.UserList[0].Username; // null ->error string p = frmDangky.ListAcc.UserList[0].Password; // null ->error } Someone help me? :( why my string is NULL???????? The textBox is not empty... Thanks!

    Read the article

  • How do I create Document Fragments with Nokogiri?

    - by viatropos
    I have an html document like this: <div class="something"> <textarea name="another"/> <div class="nested"> <label>Nested Label</label> <input name="nested_input"/> </div> </div> I have gone through and modified some of the html tree by building it into a Nokogiri::HTML::Document like so: html = Nokogiri::HTML(IO.read("test.html")) html.children.each do ... Now I want to be able to extract the nested part into a document so I can apply a stylesheet to it, or so I can manipulate it as if it were like a Rails partial. Something like this: fragment = Nokogiri::HTML(html.xpath("//div[@class='nested']).first) Is there a way to do that? Such a way that when I output it, it doesn't wrap it in<html> tags and turn it into an HTML document, I just want HTML, no document. Is this possible?

    Read the article

  • Google Analytics Widget Tracking

    - by Kevin Lamb
    Hello, I have a form that is generated on a customer's website (lets say customer.com) with javascript that a user fills out and it sends to my site (app.com). I would like to be able to provide information to the customer such as how effective their AdWords campaign was and what search engines users used to end up filling out the form. I have started looking at the multiple domain linking option but I am not sure this is the right way. Is there a way to query what search engine and key words they used and pass this along with the form?

    Read the article

  • Ruby/Rails Audio Conversion Plugins?

    - by coneybeare
    I am looking for a good gem/plugin to convert user-uploaded audio files to different formats. One format in particular that I am interested in is converting to Apple .caf with ima4 compression for inclusion in an iPhone app. I have been using afconvert on my mac for this so far, but I need to do it on my linux box, server-side. Ideally, I would be able to work into paperclip. As an additional solution, ffmpeg could work, but I have not seen any .caf options for it. Anybody know of one?

    Read the article

  • Do I have to allocate and free records when using TList<T> in Delphi?

    - by afrazier
    The question more or less says it all. Given the following record structure: type TPerson = record Name: string; Age: Integer; end; PPerson = ^TPerson; TPersonList = TList<TPerson>; Is the following code valid? procedure ReadPeople(DataSet: TDataSet; PersonList: TPersonList); begin PersonList.Count := DataSet.RecordCount; if DataSet.RecordCount = 0 then Exit; DataSet.First; while not DataSet.Eof do begin PersonList[DataSet.RecNo].Name := DataSet.FieldByName('Name').AsString; PersonList[DataSet.RecNo].Age := DataSet.FieldByName('Age').AsInteger; DataSet.Next; end; end; Do I have to use GetMem/FreeMem to allocate and free records an instance of TPersonList, or am I free to directly access the TPersonList entries directly? My gut says that the code should be valid, though I'm not sure if there's any wrinkles related to record initialization or finalization.

    Read the article

  • Problem with ImageButton.setVisibility()

    - by Luis Lopez
    Hello guys! I'm having a problem when setting the visibility of two image buttons one on top of the other. The idea is to implement a play/pause control. The problem is that the only part where setting the visibility actually works is in the click listeners of the buttons. If I try to change it somewhere else nothing happens. Any idea why is this happening? Thanks in advance! playBtn.setOnClickListener(new OnClickListener() {//PLAY BUTTON LISTENER public void onClick(View v) { playBtn.setVisibility(ImageButton.GONE); pauseBtn.setVisibility(ImageButton.VISIBLE); mp.start(); }}); pauseBtn.setOnClickListener(new OnClickListener() {//PAUSE BUTTON LISTENER public void onClick(View v) { pauseBtn.setVisibility(ImageButton.GONE); playBtn.setVisibility(ImageButton.VISIBLE); mp.pause(); }}); final class SeekBarTask extends TimerTask { public SeekBarTask(int duration) { } @Override public void run() { if(seekBar.getProgress() = mp.getDuration()) {//IF SONG HAS FINISHED... pauseBtn.setVisibility(ImageButton.GONE);//THESE ONES playBtn.setVisibility(ImageButton.VISIBLE);//DOESN'T WORK mp.stop(); } else { seekBar.incrementProgressBy(100); } } }

    Read the article

  • iphone: Adding UIRequiredDeviceCapabilitie

    - by pion
    I am reading the "Device Support - Setting Required Hardware Capabilities" on http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedFeatures/AdvancedFeatures.html I want to add still-camera capability by doing the following: Open my Info.plist Click + Add UIRequiredDeviceCapabilities on the Key column Add still-camera on the Value column Save the updated Info.plist Is this the correct way? Thanks in advance for your help.

    Read the article

  • ASM programming, how to use loop?

    - by chris
    Hello. Im first time here.I am a college student. I've created a simple program by using assembly language. And im wondering if i can use loop method to run it almost samething as what it does below the program i posted. and im also eager to find someome who i can talk through MSN messanger so i can ask you questions right away.(if possible) ok thank you .MODEL small .STACK 400h .data prompt db 10,13,'Please enter a 3 digit number, example 100:',10,13,'$' ;10,13 cause to go to next line first_digit db 0d second_digit db 0d third_digit db 0d Not_prime db 10,13,'This number is not prime!',10,13,'$' prime db 10,13,'This number is prime!',10,13,'$' question db 10,13,'Do you want to contine Y/N $' counter dw 0d number dw 0d half dw ? .code Start: mov ax, @data ;establish access to the data segment mov ds, ax mov number, 0d LetsRoll: mov dx, offset prompt ; print the string (please enter a 3 digit...) mov ah, 9h int 21h ;execute ;read FIRST DIGIT mov ah, 1d ;bios code for read a keystroke int 21h ;call bios, it is understood that the ascii code will be returned in al mov first_digit, al ;may as well save a copy sub al, 30h ;Convert code to an actual integer cbw ;CONVERT BYTE TO WORD. This takes whatever number is in al and ;extends it to ax, doubling its size from 8 bits to 16 bits ;The first digit now occupies all of ax as an integer mov cx, 100d ;This is so we can calculate 100*1st digit +10*2nd digit + 3rd digit mul cx ;start to accumulate the 3 digit number in the variable imul cx ;it is understood that the other operand is ax ;AND that the result will use both dx::ax ;but we understand that dx will contain only leading zeros add number, ax ;save ;variable <number> now contains 1st digit * 10 ;---------------------------------------------------------------------- ;read SECOND DIGIT, multiply by 10 and add in mov ah, 1d ;bios code for read a keystroke int 21h ;call bios, it is understood that the ascii code will be returned in al mov second_digit, al ;may as well save a copy sub al, 30h ;Convert code to an actual integer cbw ;CONVERT BYTE TO WORD. This takes whatever number is in al and ;extends it to ax, boubling its size from 8 bits to 16 bits ;The first digit now occupies all of ax as an integer mov cx, 10d ;continue to accumulate the 3 digit number in the variable mul cx ;it is understood that the other operand is ax, containing first digit ;AND that the result will use both dx::ax ;but we understand that dx will contain only leading zeros. Ignore them add number, ax ;save -- nearly finished ;variable <number> now contains 1st digit * 100 + second digit * 10 ;---------------------------------------------------------------------- ;read THIRD DIGIT, add it in (no multiplication this time) mov ah, 1d ;bios code for read a keystroke int 21h ;call bios, it is understood that the ascii code will be returned in al mov third_digit, al ;may as well save a copy sub al, 30h ;Convert code to an actual integer cbw ;CONVERT BYTE TO WORD. This takes whatever number is in al and ;extends it to ax, boubling its size from 8 bits to 16 bits ;The first digit now occupies all of ax as an integer add number, ax ;Both my variable number and ax are 16 bits, so equal size mov ax, number ;copy contents of number to ax mov cx, 2h div cx ;Divide by cx mov half, ax ;copy the contents of ax to half mov cx, 2h; mov ax, number; ;copy numbers to ax xor dx, dx ;flush dx jmp prime_check ;jump to prime check print_question: mov dx, offset question ;print string (do you want to continue Y/N?) mov ah, 9h int 21h ;execute mov ah, 1h int 21h ;execute cmp al, 4eh ;compare je Exit ;jump to exit cmp al, 6eh ;compare je Exit ;jump to exit cmp al, 59h ;compare je Start ;jump to start cmp al, 79h ;compare je Start ;jump to start prime_check: div cx; ;Divide by cx cmp dx, 0h ;reset the value of dx je print_not_prime ;jump to not prime xor dx, dx; ;flush dx mov ax, number ;copy the contents of number to ax cmp cx, half ;compare half with cx je print_prime ;jump to print prime section inc cx; ;increment cx by one jmp prime_check ;repeat the prime check print_prime: mov dx, offset prime ;print string (this number is prime!) mov ah, 9h int 21h ;execute jmp print_question ;jumps to question (do you want to continue Y/N?) this is for repeat print_not_prime: mov dx, offset Not_prime ;print string (this number is not prime!) mov ah, 9h int 21h ;execute jmp print_question ;jumps to question (do you want to continue Y/N?) this is for repeat Exit: mov ah, 4ch int 21h ;execute exit END Start

    Read the article

  • confirm only 1 time function with jquery

    - by robertdd
    i have this function that will shuffle a list of images, when i press on a #shuffle button i want to trigger a message, if is confirmed the second time i will not want to ask again! how to code this? $('#shuffle').click(function(){ if(confirm('This will shuffle all your bla bla bla')){ $("#upimagesQueue li").shuffle(); } });

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >