How do i get access to an element in a set ?
vector<int> myvec (4,100);
int first = myvec.at(0);
set<int> myset;
myset.insert(100);
int setint = ????
Can anybody help ?
Is there any way to use MySQL without install? I am making an desctop application using Visual studio and C# that uses MySQL.I will use this program on another computer.if this computer has no MySQL installation my program will also work? Can I move my data base with my application?
This is a module named XYZ.
def func(x)
.....
.....
if __name__=="__main__":
print func(sys.argv[1])
Now I have imported this module in another code and want to use the func. How can i use it?
import XYZ
After this, where to give the argument, and syntax on how to call it, please?
I am currently undertaking software engineering program in one of the local universities at my country.
And i am interesting in software and hardware.
So i decided to learn it by myself.
One of my seniors told me to start with PIC 16 or 18 first.
Anyone of here has any links for the related website?
And where can i get a device to program PIC other than ebay?
thx in advance.
I have this code:
a=[['a','b','c'],['a','f','c'],['a','c','d']]
for x in a:
for y in x:
if 'a' in x:
x.replace('a','*')`
but the result is:
a=[['a','b','c'],['a','f','c'],['a','c','d']]
and bot a=[['b','c'],['f','c'],['c','d']]
What should I do so the changes will last?
Hello,
As my project to do over this summer I would like to create a program that answers a Skype call using the Skype API and allows a user to connect to another VOIP provider (through SIP) and make calls by dialling through the client callers Skype application.
I understand that the Skype API allows me to answer and receive keypad input, but I'm stuck on actually sending the sound of the call to a SIP client.
Is there an API/library that would allow me to take the Skype receiving audio as input in the SIP client?
Is this even possible?
I'm not tied to a language but I had planned on using Python.
Thanks.
Hello,
I have a form that certain data, which then gets calculated and gets displayed in a table.
All the data gets saved in a 2 dimensional array.
Every time i go back to the form the new data gets saved in the array.
That data will be displayed in the next table row and so on.
I have used print_r($_Session) and everything gets properly saved in the array.
Although i have no idea how to acces the session variables area, floor, phone, network etc wich are now in the array.
Without arrays i stored them in a variable for example $phone , and did calculations with it.
But now when i use the arrays, i keep on getting undefined index phone etc...
How can i acces these variables, been looking at this for hours without getting any closer to a solution.
Any help much appreciated.
Regards.
First page:
if (empty ($ _POST))
(
Mode = $ name $ _POST ['state name'];
$ Area = $ _POST ['size'];
$ Floor = isset ($ _POST ['floor'])? $ _POST ['Floor'] 0, / / if checkbox checked value 1 else 0
$ Phone = isset ($ _POST ['phone'])? $ _POST ['Phone']: 0;
$ Network = isset ($ _POST ['network'])? $ _POST ['Network']: 0;
/ / Control surface
if (is_numeric ($ area)) / / OK
(
if (isset ($ _SESSION ['table']))
(
/ / Create a new row to the existing session table
$ Table = $ _SESSION ['table'];
$ Number = count ($ table);
$ Table [$ count] [0] = $ file name;
$ Table [$ count] [1] = $ size;
$ Table [$ count] [2] = $ floor;
$ Table [$ count] [3] = $ phone;
$ Table [$ count] [4] = $ network;
$ _SESSION ['Table'] = $ table;
)
else
(
/ / Create the session table
$ Table [0] [0] = $ file name;
$ Table [0] [1] = $ size;
$ Table [0] [2] = $ floor;
$ Table [0] [3] = $ phone;
$ Table [0], [4] $ = network;
$ _SESSION ['Table'] = $ table;
)
header ("Location: ExpoOverzicht.php");
)
else
(
echo "<h1> surface Wrong - New try </ h1>";
)
)
When i made the php code withotu the arrays i declared like this, and it worked fine.
But now there in the array, and i have no idea how to "acces them"
$standnaam = $_SESSION["standnaam"];
$oppervlakte = $_SESSION["oppervlakte"];
$verdieping = $_SESSION["verdieping"];
$telefoon = $_SESSION["telefoon"];
$netwerk = $_SESSION["netwerk"];
I have different outputs of $slider['image']and two examples are followings.
The first one has and at the beginning and at the end.
In the second one, all img tag has and tags.
<p><img src="../../assets/images/prints/print2_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageA_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageB_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageC_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageD_600x300.gif" alt="" width="600" height="300"></p>
or
<p><img src="../../assets/images/prints/print2_600x300.gif" alt="" width="600" height="300"></p><p><img src="../../../assets/images/support_images/imageA_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageB_600x300.gif" alt="" width="600" height="300"></p><p><img src="../../../assets/images/support_images/imageC_600x300.gif" alt="" width="600" height="300"></p><p><img src="../../../assets/images/support_images/imageD_600x300.gif" alt="" width="600" height="300"></p>
I need to change this to the following.
<li><span>Homepage</span><a href="#"><img alt="" src="assets/images/prints/print2_600x300.gif" /></a></li>
<li><span>Content Page</span><a href="#"><img alt="" src="assets/images/support_images/imageA_600x300.gif" /></a></li>
<li><span>Dropdown Menu</span><a href="#"><img alt="" src="assets/images/support_images/imageB_600x300.gif" /></a></li>
<li><span>Comments List</span><a href="#"><img alt="" src="assets/images/support_images/imageC_600x300.gif" /></a></li>
<li><span>Comment Form</span><a href="#"><img alt="" src="assets/images/support_images/imageD_600x300.gif" /></a></li>
I assume I may need regex and php (explode, str_replace, foreach)for this but I need some help.
I appreciate your inputs and help.
Thanks in advance.
Full out put.
[0] =>; Array
(
[id] => 12
[name] => Print 2
[shortdesc] => <p>Print 2 short description</p>
[longdesc] => <p>Print 2 long description</p>
[thumbnail] => <p><img src="../../assets/images/prints/thumbnails/print2_223x112.gif" alt="" width="223" height="112"></p>
[image] => <p><img src="../../assets/images/prints/print2_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageA_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageB_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageC_600x300.gif" alt="" width="600" height="300"><img src="../../../assets/images/support_images/imageD_600x300.gif" alt="" width="600" height="300"></p>
[product_order] => 0
[class] =>
[grouping] =>
[status] => active
[category_id] => 5
[featured] => front
[other_feature] => none
[price] => 0.00
)
Hello,
I'm just setting out in android development. I want to make a kind of card based game. I'm just looking for suggestions really on how I might start it.
I know I have to make the menu layout and view, then use an Intent from that to get to the main game view. My sticking points are:
-There's going to be a deck of cards. It's going to be a set number so I was thinking I could just have each card defined as a button in the layout. I don't know if that is the right way to do it though.
-Storage of card details. I'm thinking of using an xml file to store these.
Thanks in advance.
I have a text file containing data in rows and columns (~17000 rows in total). Each column is a uniform number of characters long, with the 'unused' characters filled in by spaces. For example, the first column is 11 characters long, but the last four characters in that column are always spaces (so that it appears to be a nice column when viewed with a text editor). Sometimes it's more than four if the entry is less than 7 characters.
The columns are not otherwise separated by commas, tabs, or spaces. They are also not all the same number of characters (the first two are 11, the next two are 8 and the last one is 5 - but again, some are spaces).
What I want to do is import the entires (which are numbers) in the last two columns if the second column contains the string 'OW' somewhere in it. Any help would be greatly appreciated.
Can anyone suggest a guideline on when to use SnapsToDevicePixels in WPF 4.0?
Should it only be used occasionally if there is an issue, liberally throughout an App, only on certain controls or what?
I'm in my second computer science course right now. I've enjoyed programming so far, but really have just scraped my way by. I've not done much programming outside of required class work. For similar reasons, I never really invested in downloading/learning software to help me program (IDE's, editors, compilers, etc).
I know it sounds tedious, but my current setup is: notepad++ for coding; Filezilla to transfer .cpp & .h files to school's aludra/unix and compiling; unix tells me where my bugs are and I go back to notepad++ to debug; repeat until done.
This isn't fun - and I know it could be easier. But I put it off knowing that I was soon going to switch to a Mac. And, tomorrow, I'm switching.
So...
How should I set up my Macbook for the best programming experience?
What IDEs and editors and debuggers and so on should I download?
How will Mac programming differ from PC?
I'm open to all ideas and comments, even the most basic.
(Background - I'm learning/programming in C++ right now. Next semester, my classes switch to Java. I'm also going to take a class in web development, with HTML/CSS/Javascript/PHP. My new laptop will be a late 2009 Macbook Pro with Leopard, or maybe Snow Leopard. Free would be preferrable for all programs.)
Thank you all.
I want to learn some practical assembly language having just learned the basic concepts in class. Are there any decent books or tutorials (nasm, etc) that would be recommended?
Hello,
I have bmp images in image folder on my computer. I named it from 1.bmp to 100.bmp.
And I want to read these images like this:
for i=1:100
s='C:\images'+i+'.bmp';
A=imread(s);
end
But Matlab gave an error. How can I implement this?
Hi,
I would like to add some debugs for my simple ruby functions and I wrote a function as below,
def debug(&block)
varname = block.call.to_s
puts "#{varname} = #{eval(varname,block)}"
end
debug {:x} #prints x = 5
debug {:y} #prints y = 5
I understand that eval is evil. So I have two questions.
Is there any way to write that debug method without using eval? If NO is there a preferred way to do this?
Is there any way to pass a list of arguments to this method? I would ideally prefer debug {:x, :y. :anynumOfvariables}. I could not quite figure out how to factor that into the debug method (i.e, to take a list of arguments)
Hi.
I want to retrieve all hashtags from a tweet using a PHP function.
I know someone asked a similar question here, but there is no hint how exactly to implement this in PHP. Since I'm not very familiar with regular expressions, don't know how to write a function that returns an array of all hashtags in a tweet.
So how do I do this, using the following regular expression:
#\S*\w
What is the proper way to handle errors with Python + Pylons?
Say a user sets a password via a form that, when passed to a model class via the controller, throws an error because it's too short. How should that error be handled so that an error message gets displayed on the web page rather than the entire script terminating to an error page?
Should there be any error handling in the controller itself?
I hope I am explaining myself clearly.
Thank you.
i have a string like following:
Assigned to ram on 2010-04-22 12:30:13.0
i need to extract the third word (ram). I tried the below regex, its not working.
/\s[a-zA-Z]*\s/
any help to fix this would be greatly appreciated.
Hi,
I am having trouble picking the best data structure for solving a problem.
The problem is as below:
I have a nested list of identity codes where the sublists are of varying length.
li = [['abc', 'ghi', 'lmn'], ['kop'], ['hgi', 'ghy']]
I have a file with two entries on each line; an identity code and a number.
abc 2.93
ghi 3.87
lmn 5.96
Each sublist represents a cluster. I wish to select the i.d. from each sublist with the highest number associated with it, append that i.d. to a new list and ultimately write it to a new file.
What data structure should the file with numbers be read in as?
Also, how would you iterate over said data structure to return the i.d. with the highest number that matches the i.d. within a sublist?
Thanks,
S :-)
HI. I know this is simple question but when I use
FirstPersonTestImage.Save(IIdComboBox.Text + "-" + i + ".jpg");
it works and saves file to folder where is the .exe file . But I want to save it to specific folder like /photo/IO-66/ and tryed to use
String StudentPath = PhotoPath + IGroupNoComboBox.Text + "/" + IIdComboBox.Text + "/" + IIdComboBox.Text + "-" + i + ".jpg";
FirstPersonTestImage.Save(StudentPath);
BUt it gives
An unhandled exception of type 'System.Runtime.InteropServices.ExternalException' occurred in System.Drawing.dll
How can I solve this problem? Is is about folder path ? or using "/" ?
EDIT
Here My code for creating and checking existing or not folder
if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()))
{
Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim());
}
if (!System.IO.Directory.Exists(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+ "/" + IIdComboBox.Text.ToString().Trim() + "/"))
{
Directory.CreateDirectory(PhotoPath + "/" + IGroupNoComboBox.Text.ToString().Trim()+"/" + IIdComboBox.Text.ToString().Trim() + "/");
}
I'm trying to do something like:
#include <iostream>
#include <vector>
#include <ctime>
class Clickomania
{
public:
Clickomania();
std::vector<std::vector<int> > board;
bool move(int, int);
bool isSolved();
void print();
void pushDown();
};
Clickomania::Clickomania()
: board(12, std::vector<int>(8,0))
{
srand((unsigned)time(0));
for(int i = 0; i < 12; i++)
{
for(int j = 0; j < 8; j++)
{
int color = (rand() % 6) + 1;
board[i][j] = color;
}
}
}
However, apparently I can't initialize the "board" vector of vectors this way.
How can I create a public member of a 2d vector type and initialize it properly?