Hi everyone, I'm not sure how to ask my question in a succinct way, so I'll start with examples and expand from there. I am working with VBA, but I think this problem is non language specific and would only require a bright mind that can provide a pseudo code framework. Thanks in advance for the help!
Example:
I have 3 Character Arrays Like So:
Arr_1 = [X,Y,Z]
Arr_2 = [A,B]
Arr_3 = [1,2,3,4]
I would like to generate ALL possible permutations of the character arrays like so:
XA1
XA2
XA3
XA4
XB1
XB2
XB3
XB4
YA1
YA2
.
.
.
ZB3
ZB4
This can be easily solved using 3 while loops or for loops. My question is how do I solve for this if the # of arrays is unknown and the length of each array is unknown?
So as an example with 4 character arrays:
Arr_1 = [X,Y,Z]
Arr_2 = [A,B]
Arr_3 = [1,2,3,4]
Arr_4 = [a,b]
I would need to generate:
XA1a
XA1b
XA2a
XA2b
XA3a
XA3b
XA4a
XA4b
.
.
.
ZB4a
ZB4b
So the Generalized Example would be:
Arr_1 = [...]
Arr_2 = [...]
Arr_3 = [...]
.
.
.
Arr_x = [...]
Is there a way to structure a function that will generate an unknown number of loops and loop through the length of each array to generate the permutations? Or maybe there's a better way to think about the problem?
Thanks Everyone!
My clients it department wants to move the database for my application to virtual partition. If you have done this what are the issues you ran into (performance, backups, replication). Currently running ASA 8 but upgrading to ASA 11 in near future.
Hi,
I'm creating some text boxes on my form programatically which I need to reference later using FindControl.
I've put the FindControl instruction in the page load method after the code which creates them but get an error:
"Object reference not set to an instance of an object."
I assume this is because the textbox controls are not created until later in the lifecycle and therefore cannot be referenced from within Page_Load.
Can someone advise where in my code-behind I would need to place the FindControl instruction so that it can find these programatically created text boxes?
I'm no good at Regular Expressions, really!
I would like to specifically detect WebKit browsers below version 525.
I have a regular expression [/WebKit\/[\d.]+/.exec(navigator.appVersion)] that correctly returns WebKit/5….…, really, I'd like it to return only the version number, but if the browser isn't WebKit, return null, or better still 0.
For example, if the browser was Trident, Presto or Gecko, return null, whereas if the browser is WebKit, return it's version number.
To clarify, I would like the regular expression to check if navigator.appVersion contains WebKit and if it does not, return null, if it does, return the version number.
I appreciate all your help!
Please let's keep this focused, let's not flirt with jQuery or the sort, it's overkill in this scenario.
Hi all,
I need to have some content displayed in a Facebook Page (I believe these are also referred to as Business Pages?). However, some of these content will be dynamic. What I mean by that is, some of the content will be taken from an existing web application.
I've looked into using Static FBML (which allows us to have tabs in the profile page with FBML in it). These no longer allow iframes. Does work in this instance (as I've not been able to get it to work either). Are there any other tags which can be used for this purpose?
In short, is there a way to obtain data from an external source and display those content within a Facebook Page (Tab)?
Thank you very much in advance for any light that you can shed on this issue.
Cheers~
While coding should we consider some limit on the total size of variables created on the stack? If yes, on what basis should we decide it? Is it dependent on OS, Memory Availability etc? Are there any compiler options which can check this?
Any pointers in the direction will also be helpful.
So I am currently getting a strange stack overflow exception when i try to run this program, which reads numbers from a list in a data/text file and inserts it into a binary search tree. The weird thing is that when the program works when I have a list of 4095 numbers in random order. However when i have a list of 4095 numbers in increasing order (so it makes a linear search tree), it throws a stack overflow message. The problem is not the static count variable because even when i removed it, and put t=new BinaryNode(x,1) it still gave a stack overflow exception. I tried debugging it, and it broke at if (t == NULL){ t = new BinaryNode(x,count); Here is the insert function.
BinaryNode *BinarySearchTree::insert(int x, BinaryNode *t) {
static long count=0;
count++;
if (t == NULL){ t = new BinaryNode(x,count);
count=0;
}
else if (x < t->key){
t->left = insert(x, t->left);
}
else if (x > t->key){
t->right = insert(x, t->right);
}
else
throw DuplicateItem();
return t;
}
Hi,
I have been writing Common Lisp macros, so Scheme's R5Rs macros are a bit unnatural to me. I think I got the idea, except that I don't understand how one would use vector patterns in syntax-rules:
(define-syntax mac
(syntax-rules ()
((mac #(a b c d))
(let ()
(display a)
(newline)
(display d)
(newline)))))
(expand '(mac #(1 2 3 4))) ;; Chicken's expand-full extension shows macroexpansion
=> (let746 () (display747 1) (newline748) (display747 4) (newline748))
I don't see how I'd use a macro that requires its arguments to be written as a vector:
(mac #(1 2 3 4))
=>
1
4
Is there some kind of technique that uses those patterns?
Thank you!
I have created a service plan to run on Windows server 2008.
When I test the service in my Windows XP, the event log category can be created properly.
However, It doesn't work on server 2008.
I run the service as administrator account already.
private EventLog __eventLog;
if (!EventLog.SourceExists("MyEventLogCat"))
EventLog.CreateEventSource("MyEventLogCat", "MyEventLogCat");
__eventLog = new EventLog();
__eventLog.Source = "MyEventLogCat";
__eventLog.Log = "MyEventLogCat";
Thanks.
I've recently reorganized a solution-in-progress from 24 projects to 4.
To keep the copious files organized in the "main" project, things are in folders in folders in folders. I think I've preserved a logical, discoverable arrangement of the solution content.
As a result, of course, I end up with namespaces like AppName.DataAccess.NHibernate.Fluent.Mappings.
Is there any compelling reason that I should care about flattening out the namespace hierarchy when my project has a somewhat deeply nested folder structure?
(I am not concerned about resolving or managing using directives; I let ReSharper do all the heavy lifting here.)
The following code works fine to upload a new post to a WordPress blog but for the life of me I can't seem to get the categories to be set.
The categories exist. I've tried all lower case, tried case-matching, tried the slug version. Nothing works. No matter how I try passing the categories, the post gets assigned only to the default category.
I've scoured the web to find other pieces of sample code and none mention the actual code semantics of how to assign post to certain categories using the WordPress::XMLRPC module.
use WordPress::XMLRPC;
my $o = WordPress::XMLRPC-new;
$o-username('username');
$o-password('password');
$o-proxy('http://blogdomain.com/xmlrpc.php');
$o-server() || die "$!";
my $hashref = {
'title' = 'Test New Post 999 555456782',
'categories' = ['Categorie1', 'Categorie2'],
'description' = '<pHere is the content</p',
'mt_keywords' = 'tag1, tag2, tag3',
'mt_allow_comments' = 1,
};
my $ID = $o-newPost($hashref, 1);
Hi,
I am writing a custom installer in C#.
Can you tell me an easy way to check if the machine has .NET version installed [even 2.0].
In cases where it is not installed, my app doesn't even start.
Thanks
I have an OnTouch and a setOnTouchListener that updates varibles which contain screen coord info. The problem is it doesnt seem to ever update them. On line 78, RGB.setText(test); it never changes from 0.0. If i were to move that line and the line above it into the onTouch it updates. any idea what is wrong? Thank you.
package com.evankimia.huskybus;
import com.test.huskybus.R;
import android.app.Activity;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.TextView;
public class HuskyBus extends Activity {
TextView RGB;
private CampusMap mCampusMap;
private float startX = 0; //track x from one ACTION_MOVE to the next
private float startY = 0; //track y from one ACTION_MOVE to the next
float scrollByX = 0; //x amount to scroll by
float scrollByY = 0; //y amount to scroll by
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
RGB = (TextView) findViewById(R.id.coordBox);
mCampusMap = (CampusMap) findViewById(R.id.map);
mCampusMap.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
// TODO Auto-generated method stub
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
// Remember our initial down event location.
startX = event.getRawX();
startY = event.getRawY();
break;
case MotionEvent.ACTION_MOVE:
float x = event.getRawX();
float y = event.getRawY();
// Calculate move update. This will happen many times
// during the course of a single movement gesture.
scrollByX = x - startX; //move update x increment
scrollByY = y - startY; //move update y increment
startX = x; //reset initial values to latest
startY = y;
mCampusMap.invalidate();
break;
}//end switch
return false;
}
;
}); //end onDraw?
String test = "" + scrollByX;
RGB.setText(test);
}
}
Hi,
I am working on this site philippdecor.com and I am having a difficulty in figuring out this css issue.
When I on mouse over on "Main categories" that appears on the right side, it shows a drop down with links in it.
Two things happens,
1) in IE(7) - the drop down hides behind another div
2) in both ie and ff, it pushes other div below that to go down and on mouse out, it looks fine.
I am not sure which css property can fix this.
please help me out
code
I know that Lisp and Scheme programmers usually say that eval should be avoided unless strictly necessary. I´ve seen the same recommendation for several programming languages, but I´ve not yet seen a list of clear arguments against the use of eval. Where can I find an account of the potential problems of using eval?
For example, I know the problems of GOTO in procedural programming (makes programs unreadable and hard to maintain, makes security problems hard to find, etc), but I´ve never seen the arguments against eval.
Interestingly, the same arguments against GOTO should be valid against continuations, but I see that Shemers, for example, won´t say that continuations are "evil" -- you should just be careful when using them. They´re much more likely to frown upon code using eval than upon code using continuations (as far as I can see -- I could be wrong).
Basically what I want to do is display an email using javascript to bring the parts together and form a complete email address that cannot be visible by email harvesters.
I would like to take an email address eg [email protected] and break it to:
$variable1 = "info";
$variable2 = "thiscompany.com";
All this done in PHP.
Regards,
JB
In Android's settings, in the "Manage Applications" activity when clicking on an app, the data is broken down into Application, Data, and cache. There is also a button to clear the cache. My app caches audio files and I would like the user to be able to clear the cache using this button. How do I store them so they get lumped in with the cache and the user can clear them? I've tried storing files using both of the following techniques:
newFile = File.createTempFile("mcb", ".mp3", context.getCacheDir());
newFile = new File(context.getCacheDir(), "mcb.mp3");
newFile.createNewFile();
In both cases, these files are listed as Data and not Cache.
Does anyone have any suggestions for a good cross platform input library?
I'd like to get:
* at least keyboard and mouse input
* on at least the big three operating systems
* Small/fast
* C or C++
* permissive licensing gpl2/mit/free/etc.
So far I've seen:
* OIS (used in Ogre) http://sourceforge.net/projects/wgois/
* SDL (used everywhere it seems, might be a clue) http://www.libsdl.org/index.php
* Allegro http://www.talula.demon.co.uk/allegro/readme.html
Has any one used any of these, or know of something else that might be good?
Thanks
This started with weird behaviour that I thought was tied to my implementation of ToString(), and I asked this question: http://stackoverflow.com/questions/2916068/why-wont-wpf-databindings-show-text-when-tostring-has-a-collaborating-object
It turns out to have nothing to do with collaborators and is reproducible.
When I bind Label.Content to a property of the DataContext that is declared as an interface type, ToString() is called on the runtime object and the label displays the result.
When I bind TextBlock.Text to the same property, ToString() is never called and nothing is displayed. But, if I change the declared property to a concrete implementation of the interface, it works as expected.
Is this somehow by design? If so, any idea why?
To reproduce:
Create a new WPF Application (.NET 3.5 SP1)
Add the following classes:
public interface IFoo
{
string foo_part1 { get; set; }
string foo_part2 { get; set; }
}
public class Foo : IFoo
{
public string foo_part1 { get; set; }
public string foo_part2 { get; set; }
public override string ToString()
{
return foo_part1 + " - " + foo_part2;
}
}
public class Bar
{
public IFoo foo
{
get { return new Foo {foo_part1 = "first", foo_part2 = "second"}; }
}
}
Set the XAML of Window1 to:
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="300">
<StackPanel>
<Label Content="{Binding foo, Mode=Default}"/>
<TextBlock Text="{Binding foo, Mode=Default}"/>
</StackPanel>
</Window>
in Window1.xaml.cs:
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
DataContext = new Bar();
}
}
When you run this application, you'll see the text only once (at the top, in the label). If you change the type of foo property on Bar class to Foo (instead of IFoo) and run the application again, you'll see the text in both controls.
I am reading a file like this:
char string[256];
std::ifstream file( "file.txt" ); // open the level file.
if ( ! file ) // check if the file loaded fine.
{
// error
}
while ( file.getline( string, 256, ' ' ) )
{
// handle input
}
Just for testing purposes, my file is just one line, with a space at the end:
12345
My code first reads the 12345 successfully. But then instead of the loop ending, it reads another string, which seems to be a return/newline.
I have saved my file both in gedit and in nano. And I have also outputted it with the Linux cat command, and there is no return on the end. So the file should be fine.
Why is my code reading a return/newline?
Thanks.
Hi,
I have been developing web applications for a while now. My applications have been fairing poorly in search engine results because of the dynamic links that my websites generate.
I admire the way some developers do their mod_rewrite to produce something like:
http://www.mycompany.com/accommodation/europe/ to run a substitute of "index.php?category_id=2&country=23"
How can I achieve that in my urls?
Warm regards,
JB
Hi there,
Has anybody ever written code to return the GUID of a folder in SharePoint Workflow Activity so I can then pass it into a Workflow Variable?
Would be really keen to see a code sample if you have one!
Thanks
We are looking at integrating a full-blown GWT (Google Web Toolkit 2.0) application with an existing ASP.NET 3.5 application. My first gut reaction is that this is a horrible frankenstein idea. However, the customer has insisted that we use this application developed by a third-party.
I have almost NO CONTROL over the development of the GWT app.
My first thought is to actually attempt to embed this in an iFrame. Because GWT is running under Tomcat/Jakarta, it is hosted on a different server from the .NET app so the iFrame src will be to a URL on the other machine.
I need to utilize our own ASP.NET authorization scheme to restrict access to the embedded GWT application. The GWT app also uses embedded java applets, which don't seem to be working right now inside the iframe. The GWT app makes calls to a backend server (using GWT-RPC?).
Any major problems with this approach that anyone can see? Will GWT work on an iframe while hosted on a different machine?
NOTE: SIMPLY ADDING A DIV WITH THE SAME NAME DOES NOT WORK FOR THIS!
Hi,
I am trying to do this regex match and replace but not able to do it.
Example
<SPAN class="one">first content here</SPAN>
<SPAN class="two">second content here </SPAN>
<SPAN class="three">one; two; three; and more.</span>
<SPAN class="four">more content here.</span>
I want to find each set of the span tags and replace with something like this
Find
<SPAN class="one">first content here</SPAN>
Change to
<one>first content here</one>
same way the the rest of the span tags.
class="one", class="two" and so on are the only key identifier which I use in the regex match expression. So if I find a span tag with these class then I want to do the replace. My main issue is that I am not able to find the occurrence of first closing tag so what it does is it finds from the start to end which is of no use. So far I have been trying to do this using notepad++ but just found that it has its limitations so any php help would be appreciated.
regards