Search Results

Search found 5671 results on 227 pages for 'sub tuts'.

Page 8/227 | < Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >

  • Windows Azure: How to create sub directory in a blob container

    - by veda
    How to create a sub directory in a blob container for example, in my blob container http://veda.blob.core.windows.net/document/ If I store some files it will be http://veda.blob.core.windows.net/document/1.txt http://veda.blob.core.windows.net/document/2.txt Now, how to create a sub directory http://veda.blob.core.windows.net/document/folder/ So that I can store files http://veda.blob.core.windows.net/document/folder/1.txt

    Read the article

  • Superfish: How to keep sub menu open after it has been clicked

    - by Roland
    I'm having the following scenario. I have a menu and if one hovers over the menu a sub menu appears and if mouse moves out the sub menu disappears, now I want the following if I click on the on a item in the sub menu, I want the sub-menu to remain open, when the new page has been loaded. I'm using superfish Jquery plugin for this. Is this possible and if how. my code in html <div id="nav"> <div id="nav2"> <ul class="sf-menu sf-navbar "> <li> <a title="HOME" class="sf-with-ul " href="/index.php?r=site/index&amp;sid=1">HOME</a> </li> </ul> <ul class="sf-menu sf-navbar"> <li> <a href="?sid=2" id="gallery" class="sf-with-ul selected_main">GALLERY</a> <ul class="subs" id="sub1"><li class="arrow"><img src="images/arrow.gif" /></li><li><a title="Kitchens" href="/index.php?r=images/sddsd&amp;id=1">Kitchens</a></li><li><a title="Vanities" href="/index.php?r=images/sddsd&amp;id=2">Vanities</a></li></ul> </li> </ul> <ul class="sf-menu sf-navbar "> <li> <a href="?sid=3" class="sf-with-ul " >ACCESSORIES</a> <ul class="subs" id=""><li class="arrow"><img src="images/arrow.gif" /></li><li><a title="Door Handles" href="/index.php?r=images/sddsd&amp;id=2">Door Handles</a></li><li><a title="Spanners" href="/index.php?r=images/sddsd&amp;id=1">Spanners</a></li></ul> </li> </ul> <ul class="sf-menu sf-navbar "> <li> <a title="CONTACT US" class="sf-with-ul " href="/index.php?r=site/contact&amp;sid=4">CONTACT US</a> </li> </ul> </div> </div> and then the superfish code $(function(){ $("ul.sf-menu").superfish({ delay: 0, speed: 'fast', autoArrows: false, dropShadows: false }); }); I've also noticed that the following css code is used to display the item left: 0; top: 2.5em; z-index: 99;

    Read the article

  • Sub-Schemas in SQL Server 2005/2008

    - by Maushu
    This is a simple question yet I was unable to find any information at all about this. Is it possible to have sub-schemas in SQL Server 2005/2008? Example: Having a HR (Human Resources) schema with a sub-schema called Training (with tables related to this). It would end up like HR.Training.* where * would be the tables.

    Read the article

  • Javascript - how to replace a sub-string?

    - by Jangwenyi
    This is a simple one. I want to replace a sub-string with another sub-string on client-side using Javascript. Original string is 'original READ ONLY' I want to replace the 'READ ONLY' with 'READ WRITE' Any quick answer please? Possibly with a javascript code snippet...

    Read the article

  • add sub view in center - iPad

    - by Saurabh
    Hello All, I want to add a sub view in current view, this sub view is 300x300. When I add subview using [self.view addSubview:md.view]; the md.view will appear at position (0,0) is there any way to add subview in center? Thanks

    Read the article

  • Retrieving data from enumerated JSON sub arrays in Javascript without getJSON

    - by Archie Ec
    I'm new to JSON and ajax, but i'm trying to access data in an array where the items are enumerated in a sub array within another sub array. So, I can access without issues data.items[0].details.specs.name data.items[0].details.specs.id etc But I run into problems with I try to access something like data.items[0].details.specs[1].name data.items[0].details.specs[1].id data.items[0].details.specs[2].name data.items[0].details.specs[2].id etc Can anyone point me in the right direction on how to access this second aspect? Thanks.

    Read the article

  • MonoTouch.Dialog: Sub Section BackgroundView?

    - by BahaiResearch.com
    I have a RootElement with Sections. One section has RadioElements. How do I change the BackgroundView on the sub section? Something like this doesn't work because the sub view isn't yet created.: rootGroups = new RootElement ("Ideas", rdoGroup) { new RootElement ("Baha'i") { new Section (){ new RadioElement ("Peace"), new RadioElement ("Unity"), new RadioElement ("Science") } } }; ??? rootGroups.TableView.BackgroundColor = ...;

    Read the article

  • WordPress wp_nav_menu specific sub menu only

    - by HWD
    I want to create a menu that pulls only the sub-menu options for a particular page. For example, if the menu option DASHBOARD has the sub-menus MESSAGE BOARD and CALENDAR, I want to be able to create a separate menu with just MESSAGE BOARD and CALENDAR. I'd like to do this without the wp_list_pages function so that the menu options can be managed using the Appearances Menus tab in WordPress. Thanks!

    Read the article

  • Stopping other subs from running while in a Sub

    - by Bigfatty
    Is there a way to stop other subs from running while in a separate sub. for instance say your in the sub CreateNumber() and the subs are setup like CreateNumber() AddNumber() DeleteNumber() Is there a way to be in CreateNumber() and call a function to stop AddNumber from running after creaetNumber() is finished? i just want my program to sit there to wait for an event to happen.

    Read the article

  • How can I profile a subroutine without using modules?

    - by Zaid
    I'm tempted to relabel this question 'Look at this brick. What type of house does it belong to?' Here's the situation: I've effectively been asked to profile some subroutines having access to neither profilers (even Devel::DProf) nor Time::HiRes. The purpose of this exercise is to 'locate' bottlenecks. At the moment, I'm sprinkling print statements at the beginning and end of each sub that log entries and exits to file, along with the result of the time function. Not ideal, but it's the best I can go by given the circumstances. At the very least it'll allow me to see how many times each sub is called. The code is running under Unix. The closest thing I see to my need is perlfaq8, but that doesn't seem to help (I don't know how to make a syscall, and am wondering if it'll affect the code timing unpredictably). Not your typical everyday SO question...

    Read the article

  • Apache RewriteEngine, redirect sub-directory to another script

    - by Niklas R
    I've been trying to achieve this since about 1.5 hours now. I want to have the following transformations when requesting sites on my website: homepage.com/ => index.php homepage.com/archive => index.php?archive homepage.com/archive/site-01 => index.php?archive/site-01 homepage.com/files/css/main.css => requestfile.php?css/main.css The first three transformations can be done by using the following: RewriteEngine on RewriteRule ^/?$ index.php RewriteRule ^/?(.*)$ index.php?$1 However, I'm stuck at the point where all requests to the files subdirectory should be redirected to requestfile.php. This is one of the tries I've done: RewriteEngine on RewriteRule ^/?$ index.php RewriteRule ^/?files/(.+)$ requestfile.php?$1 RewriteRule ^/?(.*)$ index.php?$1 But that does not work. I've also tried to put [L] after the third line, but that didn't help as I'm using this configuration in .htaccess and sub-requests will transform that URL again, etc. I fuzzed with the RewriteCond command but I couldn't get it to work. How needs the configuration to look like to achieve what I desire?

    Read the article

  • EXCEL VBA STUDENTS DATABASE [on hold]

    - by BENTET
    I AM DEVELOPING AN EXCEL DATABASE TO RECORD STUDENTS DETAILS. THE HEADINGS OF THE TABLE ARE DATE,YEAR, PAYMENT SLIP NO.,STUDENT NUMBER,NAME,FEES,AMOUNT PAID, BALANCE AND PREVIOUS BALANCE. I HAVE BEEN ABLE TO PUT UP SOME CODE WHICH IS WORKING, BUT THERE ARE SOME SETBACKS THAT I WANT TO BE ADDRESSED.I ACTUALLY DEVELOPED A USERFORM FOR EACH PROGRAMME OF THE INSTITUTION AND ASSIGNED EACH TO A SPECIFIC SHEET BUT WHENEVER I ADD A RECORD, IT DOES NOT GO TO THE ASSIGNED SHEET BUT GOES TO THE ACTIVE SHEET.ALSO I WANT TO HIDE ALL SHEETS AND BE WORKING ONLY ON THE USERFORMS WHEN THE WORKBOOK IS OPENED.ONE PROBLEM AM ALSO FACING IS THE UPDATE CODE.WHENEVER I UPDATE A RECORD ON A SPECIFIC ROW, IT RATHER EDIT THE RECORD ON THE FIRST ROW NOT THE RECORD EDITED.THIS IS THE CODE I HAVE BUILT SO FAR.I AM VIRTUALLY A NOVICE IN PROGRAMMING. Private Sub cmdAdd_Click() Dim lastrow As Long lastrow = Sheets("Sheet4").Range("A" & Rows.Count).End(xlUp).Row Cells(lastrow + 1, "A").Value = txtDate.Text Cells(lastrow + 1, "B").Value = ComBox1.Text Cells(lastrow + 1, "C").Value = txtSlipNo.Text Cells(lastrow + 1, "D").Value = txtStudentNum.Text Cells(lastrow + 1, "E").Value = txtName.Text Cells(lastrow + 1, "F").Value = txtFees.Text Cells(lastrow + 1, "G").Value = txtAmountPaid.Text txtDate.Text = "" ComBox1.Text = "" txtSlipNo.Text = "" txtStudentNum.Text = "" txtName.Text = "" txtFees.Text = "" txtAmountPaid.Text = "" End Sub Private Sub cmdClear_Click() txtDate.Text = "" ComBox1.Text = "" txtSlipNo.Text = "" txtStudentNum.Text = "" txtName.Text = "" txtFees.Text = "" txtAmountPaid.Text = "" txtBalance.Text = "" End Sub Private Sub cmdClearD_Click() txtDate.Text = "" ComBox1.Text = "" txtSlipNo.Text = "" txtStudentNum.Text = "" txtName.Text = "" txtFees.Text = "" txtAmountPaid.Text = "" txtBalance.Text = "" End Sub Private Sub cmdClose_Click() Unload Me End Sub Private Sub cmdDelete_Click() 'declare the variables Dim findvalue As Range Dim cDelete As VbMsgBoxResult 'check for values If txtStudentNum.Value = "" Or txtName.Value = "" Or txtDate.Text = "" Or ComBox1.Text = "" Or txtSlipNo.Text = "" Or txtFees.Text = "" Or txtAmountPaid.Text = "" Or txtBalance.Text = "" Then MsgBox "There is not data to delete" Exit Sub End If 'give the user a chance to change their mind cDelete = MsgBox("Are you sure that you want to delete this student", vbYesNo + vbDefaultButton2, "Are you sure????") If cDelete = vbYes Then 'delete the row Set findvalue = Sheet4.Range("D:D").Find(What:=txtStudentNum, LookIn:=xlValues) findvalue.EntireRow.Delete End If 'clear the controls txtDate.Text = "" ComBox1.Text = "" txtSlipNo.Text = "" txtStudentNum.Text = "" txtName.Text = "" 'txtFees.Text = "" txtAmountPaid.Text = "" txtBalance.Text = "" End Sub Private Sub cmdSearch_Click() Dim lastrow As Long Dim currentrow As Long Dim studentnum As String lastrow = Sheets("Sheet4").Range("A" & Rows.Count).End(xlUp).Row studentnum = txtStudentNum.Text For currentrow = 2 To lastrow If Cells(currentrow, 4).Text = studentnum Then txtDate.Text = Cells(currentrow, 1) ComBox1.Text = Cells(currentrow, 2) txtSlipNo.Text = Cells(currentrow, 3) txtStudentNum.Text = Cells(currentrow, 4).Text txtName.Text = Cells(currentrow, 5) txtFees.Text = Cells(currentrow, 6) txtAmountPaid.Text = Cells(currentrow, 7) txtBalance.Text = Cells(currentrow, 8) End If Next currentrow txtStudentNum.SetFocus End Sub Private Sub cmdSearchName_Click() Dim lastrow As Long Dim currentrow As Long Dim studentname As String lastrow = Sheets("Sheet4").Range("A" & Rows.Count).End(xlUp).Row studentname = txtName.Text For currentrow = 2 To lastrow If Cells(currentrow, 5).Text = studentname Then txtDate.Text = Cells(currentrow, 1) ComBox1.Text = Cells(currentrow, 2) txtSlipNo.Text = Cells(currentrow, 3) txtStudentNum.Text = Cells(currentrow, 4) txtName.Text = Cells(currentrow, 5).Text txtFees.Text = Cells(currentrow, 6) txtAmountPaid.Text = Cells(currentrow, 7) txtBalance.Text = Cells(currentrow, 8) End If Next currentrow txtName.SetFocus End Sub Private Sub cmdUpdate_Click() Dim tdate As String Dim tlevel As String Dim tslipno As String Dim tstudentnum As String Dim tname As String Dim tfees As String Dim tamountpaid As String Dim currentrow As Long Dim lastrow As Long 'If Cells(currentrow, 5).Text = studentname Then 'txtDate.Text = Cells(currentrow, 1) lastrow = Sheets("Sheet4").Range("A" & Columns.Count).End(xlUp).Offset(0, 1).Column For currentrow = 2 To lastrow tdate = txtDate.Text Cells(currentrow, 1).Value = tdate txtDate.Text = Cells(currentrow, 1) tlevel = ComBox1.Text Cells(currentrow, 2).Value = tlevel ComBox1.Text = Cells(currentrow, 2) tslipno = txtSlipNo.Text Cells(currentrow, 3).Value = tslipno txtSlipNo = Cells(currentrow, 3) tstudentnum = txtStudentNum.Text Cells(currentrow, 4).Value = tstudentnum txtStudentNum.Text = Cells(currentrow, 4) tname = txtName.Text Cells(currentrow, 5).Value = tname txtName.Text = Cells(currentrow, 5) tfees = txtFees.Text Cells(currentrow, 6).Value = tfees txtFees.Text = Cells(currentrow, 6) tamountpaid = txtAmountPaid.Text Cells(currentrow, 7).Value = tamountpaid txtAmountPaid.Text = Cells(currentrow, 7) Next currentrow txtDate.SetFocus ComBox1.SetFocus txtSlipNo.SetFocus txtStudentNum.SetFocus txtName.SetFocus txtFees.SetFocus txtAmountPaid.SetFocus txtBalance.SetFocus End Sub PLEASE I WAS THINKING IF I CAN DEVELOP SOMETHING THAT WILL USE ONLY ONE USERFORM TO SEND DATA TO DIFFERENT SHEETS IN THE WORKBOOK.

    Read the article

  • Update existing Preference-item in a PreferenceActivity upon returning from a (sub)PreferenceScreen

    - by aioobe
    I have a PreferenceActivity with a bunch of (Sub)PreferenceScreens. Each such (Sub)PreferenceScreen represents an account and has the account-username as its title. PreferenceScreen root = mgr.createPreferenceScreen(this); for (MyAccountClass account : myAccounts) { final PreferenceScreen accScreen = mgr.createPreferenceScreen(this); accScreen.setTitle(account.getUsername()); // add Preferences to the accScreen // (for instance a "change username"-preference) ... root.add(accScreen); } As the user enters sub-PreferenceScreen, and edits the account user-name, I want the outer PreferenceScreen to update it's PreferenceScreen-title for the account in question. I've tried to add... usernamePref.setOnPreferenceChangeListener(new OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { accScreen.setTitle(newValue.toString()); return true; } }); ...but the accScreen.setTitle does not seem to take effect on the outer PreferenceScreen. I've note that calling onContentChanged(); actually makes it work, but I realize that this is probably not the preferred way of doing it. I suspect I should call postInvalidate() on some view somewhere, but I really can't figure out on what view and when to do it. http://stackoverflow.com/questions/2396153/preferencescreen-androidsummary-update may be experiening the same problem as me. Any help appreciated.

    Read the article

  • Configure main domain and sub domain with diffrent resourcs in apache server

    - by Ritesh Patadiya
    I have an issue to creating a sub domain in apache server. Normally we can do that by following way. <VirtualHost *:80> ServerName www.maindomain.com ServerAlias *.maindomain.com DocumentRoot "/home/abc/xyz" <Directory "/home/abc/xyz"> AllowOverride All Allow from All </Directory> </VirtualHost> In above example both main and sub domain share same Directory. But my requirement is main domain have its own resource and rest of sub domains have other resource. I want to do something like this. <VirtualHost *:80> ServerName www.maindomain.com DocumentRoot "/home/abc/xyz" <Directory "/home/abc/xyz"> AllowOverride All Allow from All </Directory> </VirtualHost> <VirtualHost *:80> ServerName xyz.maindomain.com ServerAlias *.maindomain.com DocumentRoot "/home/ghi/pqr" <Directory "/home/ghi/pqr"> AllowOverride All Allow from All </Directory> </VirtualHost> Above thing didn't work for me

    Read the article

  • retrieve only sub-pages (wordpress)

    - by Radek
    I want to list all sub-pages only one level though of one particular page. I was reading Function Reference/get pages and thought that $pages = get_pages( array( 'child_of' => $post->ID, 'parent' => $post->ID)) ; will do the trick but it is not working. It lists all pages on the same level like the page I call that code from. If I omit parent option I will get all pages even with sub-pages that I want. But I want only sub-pages. The whole function is like function about_menu(){ if (is_page('about')){ $pages = get_pages( array( 'child_of' => $post->ID, 'parent' => $post->ID)) ; foreach($pages as $page) { ?> <h2><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></h2> <?php } } } and mine is second one

    Read the article

  • How to avoid automatic renaming of sub signature parameters in visual basic 6.

    - by systempuntoout
    In Visual basic 6, i declare a sub like this: Private Sub test1(ByRef XmlFooOutput As String) ... End Sub after that, i declare another sub like the following one: Private Sub test2(ByRef xmlFooOutput As String) ... End Sub automagically, the first method is transformed in: Private Sub test1(ByVal xmlFooOutput As String) ... End Sub so the XmlFooOutput parameter is transformed in xmlFooOutput. This is a pretty dangerous feature because, method like those could be mapped to different XSL presentation files that read XML values through Xpath. So when test1 parameter is renamed, XSL bound to test1 method goes broken because Xpath point to XmlFooOuput but the correct value is now in xmlFooOutput. Is it possible to remove this weird feature? I'm using microsoft visual basic 6.0 (SP6). This question has some duplicate: http://stackoverflow.com/questions/1064858/stop-visual-basic-6-from-changing-my-casing http://stackoverflow.com/questions/248760/vb6-editor-changing-case-of-variable-names from what i see, there's no practical solution to disable this Intellisense evil feature.

    Read the article

  • how to get the list of Function and Sub of a given module name in Excel VBA

    - by Kratz
    I am working on a helper macro that look into the list function on a given module name on the active excel workbook. Ex: I have a module name "Module1". Inside this module has the following function or sub Sub Sub1() End Sub Sub Sub2() End Sub Function Func1() End Function Function Func2() End Function Is there a command or routine that can return the list of Function and Sub names?

    Read the article

  • A Nondeterministic Engine written in VB.NET 2010

    - by neil chen
    When I'm reading SICP (Structure and Interpretation of Computer Programs) recently, I'm very interested in the concept of an "Nondeterministic Algorithm". According to wikipedia:  In computer science, a nondeterministic algorithm is an algorithm with one or more choice points where multiple different continuations are possible, without any specification of which one will be taken. For example, here is an puzzle came from the SICP: Baker, Cooper, Fletcher, Miller, and Smith live on different floors of an apartment housethat contains only five floors. Baker does not live on the top floor. Cooper does not live onthe bottom floor. Fletcher does not live on either the top or the bottom floor. Miller lives ona higher floor than does Cooper. Smith does not live on a floor adjacent to Fletcher's.Fletcher does not live on a floor adjacent to Cooper's. Where does everyone live? After reading this I decided to build a simple nondeterministic calculation engine with .NET. The rough idea is that we can use an iterator to track each set of possible values of the parameters, and then we implement some logic inside the engine to automate the statemachine, so that we can try one combination of the values, then test it, and then move to the next. We also used a backtracking algorithm to go back when we are running out of choices at some point. Following is the core code of the engine itself: Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Public Class NonDeterministicEngine Private _paramDict As New List(Of Tuple(Of String, IEnumerator)) 'Private _predicateDict As New List(Of Tuple(Of Func(Of Object, Boolean), IEnumerable(Of String))) Private _predicateDict As New List(Of Tuple(Of Object, IList(Of String))) Public Sub AddParam(ByVal name As String, ByVal values As IEnumerable) _paramDict.Add(New Tuple(Of String, IEnumerator)(name, values.GetEnumerator())) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(1, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(2, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(3, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(4, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(5, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(6, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(7, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Public Sub AddRequire(ByVal predicate As Func(Of Object, Object, Object, Object, Object, Object, Object, Object, Boolean), ByVal paramNames As IList(Of String)) CheckParamCount(8, paramNames) _predicateDict.Add(New Tuple(Of Object, IList(Of String))(predicate, paramNames)) End Sub Sub CheckParamCount(ByVal count As Integer, ByVal paramNames As IList(Of String)) If paramNames.Count <> count Then Throw New Exception("Parameter count does not match.") End If End Sub Public Property IterationOver As Boolean Private _firstTime As Boolean = True Public ReadOnly Property Current As Dictionary(Of String, Object) Get If IterationOver Then Return Nothing Else Dim _nextResult = New Dictionary(Of String, Object) For Each item In _paramDict Dim iter = item.Item2 _nextResult.Add(item.Item1, iter.Current) Next Return _nextResult End If End Get End Property Function MoveNext() As Boolean If IterationOver Then Return False End If If _firstTime Then For Each item In _paramDict Dim iter = item.Item2 iter.MoveNext() Next _firstTime = False Return True Else Dim canMoveNext = False Dim iterIndex = _paramDict.Count - 1 canMoveNext = _paramDict(iterIndex).Item2.MoveNext If canMoveNext Then Return True End If Do While Not canMoveNext iterIndex = iterIndex - 1 If iterIndex = -1 Then Return False IterationOver = True End If canMoveNext = _paramDict(iterIndex).Item2.MoveNext If canMoveNext Then For i = iterIndex + 1 To _paramDict.Count - 1 Dim iter = _paramDict(i).Item2 iter.Reset() iter.MoveNext() Next Return True End If Loop End If End Function Function GetNextResult() As Dictionary(Of String, Object) While MoveNext() Dim result = Current If Satisfy(result) Then Return result End If End While Return Nothing End Function Function Satisfy(ByVal result As Dictionary(Of String, Object)) As Boolean For Each item In _predicateDict Dim pred = item.Item1 Select Case item.Item2.Count Case 1 Dim p1 = DirectCast(pred, Func(Of Object, Boolean)) Dim v1 = result(item.Item2(0)) If Not p1(v1) Then Return False End If Case 2 Dim p2 = DirectCast(pred, Func(Of Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) If Not p2(v1, v2) Then Return False End If Case 3 Dim p3 = DirectCast(pred, Func(Of Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) If Not p3(v1, v2, v3) Then Return False End If Case 4 Dim p4 = DirectCast(pred, Func(Of Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) If Not p4(v1, v2, v3, v4) Then Return False End If Case 5 Dim p5 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) If Not p5(v1, v2, v3, v4, v5) Then Return False End If Case 6 Dim p6 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) Dim v6 = result(item.Item2(5)) If Not p6(v1, v2, v3, v4, v5, v6) Then Return False End If Case 7 Dim p7 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) Dim v6 = result(item.Item2(5)) Dim v7 = result(item.Item2(6)) If Not p7(v1, v2, v3, v4, v5, v6, v7) Then Return False End If Case 8 Dim p8 = DirectCast(pred, Func(Of Object, Object, Object, Object, Object, Object, Object, Object, Boolean)) Dim v1 = result(item.Item2(0)) Dim v2 = result(item.Item2(1)) Dim v3 = result(item.Item2(2)) Dim v4 = result(item.Item2(3)) Dim v5 = result(item.Item2(4)) Dim v6 = result(item.Item2(5)) Dim v7 = result(item.Item2(6)) Dim v8 = result(item.Item2(7)) If Not p8(v1, v2, v3, v4, v5, v6, v7, v8) Then Return False End If Case Else Throw New NotSupportedException End Select Next Return True End FunctionEnd Class    And now we can use the engine to solve the problem we mentioned above:   Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Sub Test2() Dim engine = New NonDeterministicEngine() engine.AddParam("baker", {1, 2, 3, 4, 5}) engine.AddParam("cooper", {1, 2, 3, 4, 5}) engine.AddParam("fletcher", {1, 2, 3, 4, 5}) engine.AddParam("miller", {1, 2, 3, 4, 5}) engine.AddParam("smith", {1, 2, 3, 4, 5}) engine.AddRequire(Function(baker) As Boolean Return baker <> 5 End Function, {"baker"}) engine.AddRequire(Function(cooper) As Boolean Return cooper <> 1 End Function, {"cooper"}) engine.AddRequire(Function(fletcher) As Boolean Return fletcher <> 1 And fletcher <> 5 End Function, {"fletcher"}) engine.AddRequire(Function(miller, cooper) As Boolean 'Return miller = cooper + 1 Return miller > cooper End Function, {"miller", "cooper"}) engine.AddRequire(Function(smith, fletcher) As Boolean Return smith <> fletcher + 1 And smith <> fletcher - 1 End Function, {"smith", "fletcher"}) engine.AddRequire(Function(fletcher, cooper) As Boolean Return fletcher <> cooper + 1 And fletcher <> cooper - 1 End Function, {"fletcher", "cooper"}) engine.AddRequire(Function(a, b, c, d, e) As Boolean Return a <> b And a <> c And a <> d And a <> e And b <> c And b <> d And b <> e And c <> d And c <> e And d <> e End Function, {"baker", "cooper", "fletcher", "miller", "smith"}) Dim result = engine.GetNextResult() While Not result Is Nothing Console.WriteLine(String.Format("baker: {0}, cooper: {1}, fletcher: {2}, miller: {3}, smith: {4}", result("baker"), result("cooper"), result("fletcher"), result("miller"), result("smith"))) result = engine.GetNextResult() End While Console.WriteLine("Calculation ended.")End Sub   Also, this engine can solve the classic 8 queens puzzle and find out all 92 results for me.   Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/--Sub Test3() ' The 8-Queens problem. Dim engine = New NonDeterministicEngine() ' Let's assume that a - h represents the queens in row 1 to 8, then we just need to find out the column number for each of them. engine.AddParam("a", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("b", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("c", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("d", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("e", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("f", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("g", {1, 2, 3, 4, 5, 6, 7, 8}) engine.AddParam("h", {1, 2, 3, 4, 5, 6, 7, 8}) Dim NotInTheSameDiagonalLine = Function(cols As IList) As Boolean For i = 0 To cols.Count - 2 For j = i + 1 To cols.Count - 1 If j - i = Math.Abs(cols(j) - cols(i)) Then Return False End If Next Next Return True End Function engine.AddRequire(Function(a, b, c, d, e, f, g, h) As Boolean Return a <> b AndAlso a <> c AndAlso a <> d AndAlso a <> e AndAlso a <> f AndAlso a <> g AndAlso a <> h AndAlso b <> c AndAlso b <> d AndAlso b <> e AndAlso b <> f AndAlso b <> g AndAlso b <> h AndAlso c <> d AndAlso c <> e AndAlso c <> f AndAlso c <> g AndAlso c <> h AndAlso d <> e AndAlso d <> f AndAlso d <> g AndAlso d <> h AndAlso e <> f AndAlso e <> g AndAlso e <> h AndAlso f <> g AndAlso f <> h AndAlso g <> h AndAlso NotInTheSameDiagonalLine({a, b, c, d, e, f, g, h}) End Function, {"a", "b", "c", "d", "e", "f", "g", "h"}) Dim result = engine.GetNextResult() While Not result Is Nothing Console.WriteLine("(1,{0}), (2,{1}), (3,{2}), (4,{3}), (5,{4}), (6,{5}), (7,{6}), (8,{7})", result("a"), result("b"), result("c"), result("d"), result("e"), result("f"), result("g"), result("h")) result = engine.GetNextResult() End While Console.WriteLine("Calculation ended.")End Sub (Chinese version of the post: http://www.cnblogs.com/RChen/archive/2010/05/17/1737587.html) Cheers,  

    Read the article

  • NCurses, scrolling of multiline items, "current item" pointer and "selected items"

    - by mjf
    I am looking for hints/ideas for the best (most effective) way on how to scroll multi-line items as well as emphasizing of the "current item" and "selected items" such as: 1 FOO ITEM 1 Foo sub-item 2 Foo sub-item 3 Foo sub-item 2 BAR ITEM 1 Bar sub-item 3 BAZ ITEM 1 Baz sub-item 2 Baz sub-item 4 RAB ITEM 5 ZZZ ITEM 1 Zzz sub-item 2 Zzz sub-item 3 Zzz sub-item 4 Zzz sub-item using NCurses (some combination of windows, sub-windows, pads, copywin? Uff! In fact, the lines could exceed the stdscr's width so that possibility to scroll left/right would be also nice - pads?)... The whole items (including the sub-items) are supposed to be emphasized as full-width window/pad areas. The "current item" (including it's set of lines) should be emphasized (i.e. using A_BOLD), selected set of items of choice (including the set of lines for each the selected item) should be emphasized in another way (i.e. using A_REVERSE). What would you choose to cope with it the most effective NCurses way? (The less redrawals/refreshes the better and terminal is supposed to have the ability to change it's size - such as XTerm running under "floating window" management.) Thank you for your ideas (or perhaps some piece of code where something similar is already solved - I was not able to find anything helpful on the Internet. I mean I am not going to copy/paste foreign code but programming NCurses properly is still somehow difficult to me). P.S.: Would you suggest to "smooth-scroll" +1/-1 screen line or rather "jump-scroll" +lines/-lines of the items? (I personally prefer the latter one.) Sincerely, -- mjf

    Read the article

< Previous Page | 4 5 6 7 8 9 10 11 12 13 14 15  | Next Page >