char *a[]={"diamonds","clubs","spades","hearts"};
char **p[]={a+3,a+2,a+1,a};
char ***ptr=p;
cout<<*ptr[2][2];
why does it display h and please explain how is the 2d array of ptr implementing and its elements
I see this:
using (StreamWriter sw = new StreamWriter("file.txt"))
{
// d0 w0rk s0n
}
Everything I try to find info on is do not explain what this doing gives me stuff about namespaces ??????????
I am using CKEditor/CKFinder as wysiwyg editor on my MVC.NET site.
I have set [ValidateInput(false)] and it works when debugging it locally, but I receive the following error when I have published the site:
A potentially dangerous Request.Form value was detected from the client (message="<p>
<em>Testing</e...").
can anyone explain why the published site is different from the locally site, especially when I have set [ValidateInput(false)]?
Closures are poor man's objects and vice versa.
I have seen this statement at many places on the web (including SO) but I don't quite understand what it means. Could someone please explain what it exactly means?
If possible, please include examples in your answer.
Thanks.
I have a wordpress installation. When the ownership of the folder is root, the memory consumed is okay. However, when I change the ownership to www-data user, it starts consuming a lot of memory and starts throwing a lot of out of memory error. I have changed the ownership to root. However, Can anyone explain why this happens?
Why are Python exceptions named "Error" (e.g. ZeroDivisionError, NameError, TypeError etc)
and not "Exception" (e.g. ZeroDivisionException, NameException, TypeException etc).
I come from a Java background and started to learn Python recently, as such this is confusing because in java there is a distinction between error and exception.
Is there a difference in Python also or not? Can someone explain or point me to some documentation explaining it?
Thank you!
I'd like to write a unit test to verify that optimistic locking is properly set up (using Spring and Hibernate).
I'd like to have the test class extend Spring's AbstractTransactionalJUnit4SpringContextTests.
What I want to end up with is a method like this:
@Test (expected = StaleObjectStateException.class)
public void testOptimisticLocking() {
A a = getCurrentSession().load(A.class, 1);
a.setVersion(a.getVersion()-1);
getCurrentSession().saveOrUpdate(a);
getCurrentSession().flush();
fail("Optimistic locking does not work");
}
This test fails. What do you recommend as a best practice?
The reason I am trying to do this is that I want to transfer the version to the client (using a DTO). I want to prove that when the DTO is sent back to the server and merged with a freshly loaded entity, saving that entity will fail if it's been updated by somebody else in the meantime.
I want to create two grids in the WPF Page. One grid need scrollbar or scroll viewer. Another grid is static.The grids are placed one by one in the page. How to create and set the scroll in first grid.? plz explainme.
Say I have this url:
http://site.example/dir/
In this folder I have these files: test.ascx.cs and test.ascx
Just to be clear, I am not a .NET developer.
From a security point of view - why can't I access http://site.example/dir/test.ascx.cs and how secure is it to keep those files there?
I assume IIS filters out request that query these kind of files, but can someone explainme this?
Thank you.
Hello All,
I am writing a game which when given a partially filled word, searches a dictionary and returns all the matching words. To that effect, I am trying to find an algorithm that can be used for the said purpose. For example, given - - a -, the algorithm will search a dictionary for all the words which have length 4 and have 'a' as the third letter.
Is there such an algorithm already? If not, can somebody given a rough idea of how to design such an algorithm?
Thanks in Advance.
Hello!
Here is a paper, it is about estimating the perspective of binary image containing text and some noise or non text objects.
PDF document
The algorithm uses the Hidden Markov Model: actually two conditions
T - text
B - backgrouond (i.e. noise)
It is hard to understand the algorithm itself. The question is that
I've read about Hidden Markov Models and I know that it uses probabilities that must be known.
But in this algorithm I can't understand, if they use HMM, how do they get those probabilities (probability of changing the state from S1 to another state for example S2)?
I didn't find anything about training there also in that paper.
So, if somebody understands it, please tell me.
Also is it possible to use HMM without knowing the state change probabilities?
I'm seeing behaviour on my iPhone where debug builds immediately exit after a call to
[[UIApplication sharedApplication] registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert];
The debugger reports it exited with the message
Terminating in response to SpringBoard's termination.
This behaviour doesn't happen on my ad hoc distribution builds. Can anyone explain this behavior?
Hi all. I have created a C# DLL that has some forms in it. ( I needed it to be a DLL, not a Windows Application.)
How can I run it as a Windows App? Should I create another app and load it? How? What do I need to learn to do that?
please let me know if I should explain more about my question.
I tried to implement XOR sort in python.
x,y= 10,20
x,y,x = x^y,x^y,x^y
print('%s , %s'%(x,y))
OUTPUT:
30 , 30
I am not new to python but I am unable to explain this output. It should have been 20,10.
What is going on under the hood?
I have two fields: Mother's employer and Father's employer, and I need to group on the employer. Could somebody help me combine the two above fields into one group?
Both fields are in one table. FOr example a child named John Lewis is a record in a table and he has a father and a mother and Mother's employer is IBM and Father's employer is ISF. And so forth. I need to come up with a list By employer where it would show:
Employer: IBM
John Lewis
Emplyer: ISF
John Lewis
Employer: ....
Thank you,
Sigita
HI I am working with amCharts at the moment and was wondering if somebody could give me some sort of guidance on the matter. I am using Flex to call a server side php file which then returns some xml data. This works perfectly and efficiently. I then add this data to the chart will also works quite well. However as I try to use the scroll bar on the chart, it seems to zoom out and delete all my data. I cant figure this out at all. The same thing happens when i click the show all button.
My Django project is placed in /www/host1/htdocs/my/project, www and my are links to other actual folders. Apache has mod_python enabled. I have a .htaccess in project folder:
SetHandler python-program
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE project.settings
PythonDebug On
PythonOption django.root /my/project
PythonPath "['/www/host1/htdocs/my/project'] + sys.path"
I suppose my site should be accessible from http://host1/my/project, but I see the following error:
ImportError: Could not import settings 'project.settings' (Is it on sys.path? Does it have syntax errors?): No module named project.settings
Can somebody give any suggestions?
This a NP Complete problem. More info can be found here
http://en.wikipedia.org/wiki/Subgraph_isomorphism_problem
The most widely used algorithm is the one proposed by Ullman. Can someone please explain the algorithm to me. I read a paper by him and couldn't understand much.
Also what other algorithms for this problem. I am working on an image processing project.
I am wondering how to build a load on demand tree view using ASP.Net MVC. I understand what is involved in creating a JQuery TreeView using lists, but the load on demand part is really confusing me. I don't need the full solution, but can somebody point me in the right direction on where I should start?
I have done these plenty of times using WinForms which keeps the view state preserved. One of the issues I am seeing is remembering all the node that have been expanded and not just the newly expanded one.
If anyone had some advice, I would appreciate it. Thanks!
Hi,
I am passing the email address as part of the url,
for ex. http://example.com/hello/[email protected]
but, when being passed to the application controller it is changed to " user%40hotmail.com ".
I can't seem to understand this special character escaping; confusion.
please help meexplain the problem here, and also what can I do to fix it.
I am using python's "webapp" web application framework.
Hello,
I'm trying to use linq to sql for my project (very short deadline), and I'm kind of in a bind. I don't know the best way to have a data context handy per request thread.
I want something like a singleton class from which all my repository classes can access the current data context. However, singleton class is static and is not thread-safe and therefore not suitable for web apps. I want something that would create a data context at the beginning of the request and dispose of it along with the request.
Can anyone please share their solution to this problem? I've been searching for a solution and I've found a good post from Rick Strahl : http://www.west-wind.com/weblog/posts/246222.aspx but I don't completely understand his thread-safe or business object approach. If somebody has a simplified version of his thread-safe approach, i'd love to take a look.
I've spent this sunday trying to find what is wrong to the following code as it is not counting the rows. Could somebody help me with it? Thanks!
/*check if same IP has visited today*/
if ($stmt = $mysqli->query('SELECT * FROM table WHERE colum1 = ? AND colum2 > DATE_SUB(NOW(), INTERVAL 1 DAY)')) {
$stmt->bind_param('s', $ip);
/* execute query */
$stmt->execute();
/*number of rows */
/*store result when using prepared statements*/
$stmt->store_result();
$row_cnt = $stmt->num_rows;
printf("Result set has %d rows.\n", $row_cnt);
$stmt->close();
}
I have a build in TFS 2008 which includes the running of a UnitTest project.
I have configured my build as such that in the drop folder after each build, I get a StyleCop.log, FxCop.log and would like to place the trx or output from the unit tests here also.
I can see that my unit tests are running as part of the build, however currently I cannot find were the output is saved to or find a way of setting the ouput to my drop location ($(DropLocation)\$(BuildNumber)\MyUnitTests.txt)
My unit tests are included by using the following:-
<RunTest>true</RunTest>
...
<ItemGroup>
<TestContainer Include="$(OutDir)\%2aMyUnitTests.dll" />
</ItemGroup>
Can somebody help explain how I can achieve this.
I need to draw a shape whose boundaries are parts of parabola (that is quadratic bezier curves) using iText. I have found only method for drawing cubic bezier curves in PdfContentByte class.
So how do I draw quadratic bezier curves using iText ?
One way would be to use method for cubic bezier curves. Is it possible to draw quadratic bezier curves as a cubic bezier curves (with 2 control points). I gues it is but I cannot make up the formula. If somebody states the formula tu "translate" cubic bezier curves to quadratic that would solve the problem.
Any other ways to draw quadratic bezier(parts of parabola) curves in iText (and filled shapes made of them) is also the solution.
Thanks