|
httpfox
Been looking for something like that for a while. Plain & Simple.
|
|
|
|
|
its good to share
|
|
|
|
|
Hello Sir
I have one linux source code ..i need to convert into windows , in code they are using assembly language but i am not a proficient in assembly language ..but i know one conversion need for running that assembly language into visual cpp compiler but i dont know how to do it ? please replay me sirs!!
This is my code snippet
static inline int mid_pred(int a, int b, int c)
{
int i=b;
__asm{
"cmp %2, %1 \n\t;"
"cmovg %1, %0 \n\t;"
"cmovg %2, %1 \n\t;"
"cmp %3, %1 \n\t;"
"cmovl %3, %1 \n\t;"
"cmp %1, %0 \n\t;"
"cmovg %1, %0 \n\t;"
:"+&r"(i), "+&r"(a)
:"r"(b), "r"(c)
};
return 0
}
</pre>
i am getting this errors in the above source code
<code>
error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
error C2400: inline assembler syntax error in 'opcode'; found 'bad token'
error C2400: inline assembler syntax error in 'opcode'; found ':'
error C2400: inline assembler syntax error in 'opcode'; found ':'
</code>
please Respond me Sirs
Thanks!
<div class="ForumSig"><font face="Verdana, Arial" size="2" color="#990033">Raju !!!</font>
</div>
|
|
|
|
|
I don't know much about Visual CPP but the messages look like they are saying that it does not recognise the code in the __asm block. I must say the syntax looks like it needs some sort of preprocessing before going into the compile phase. Have you checked the documentation for the proper format of embedded assembler operations?
|
|
|
|
|
Might help
I would recommend posting this in C/C++ forum, as you will get more help there.
|
|
|
|
|
Hello everyone, i have a big problem with this $smarty->assign
I found a nice script that would add smileys to my website in users comments but since the comments are coming from the database i am not sure how to make smarty replace the smiley characters with images.
Here is the script i am trying to get working:
function addSmilies($text) {
$codesToConvert = array(
':)' => '<img src="http://blog.sachinkraj.com/images/smilies/smile.png" alt="smile" />',
':-)' => '<img src="http://blog.sachinkraj.com/images/smilies/smile.png" alt="smile" />',
':D' => '<img src="http://blog.sachinkraj.com/images/smilies/laugh.png" alt="laugh" />',
':d' => '<img src="http://blog.sachinkraj.com/images/smilies/laugh.png" alt="laugh" />',
';)' => '<img src="http://blog.sachinkraj.com/images/smilies/wink.png" alt="wink" />',
':P' => '<img src="http://blog.sachinkraj.com/images/smilies/tounge.png" alt="tounge" />',
':-P' => '<img src="http://blog.sachinkraj.com/images/smilies/tounge.png" alt="tounge" />',
':-p' => '<img src="http://blog.sachinkraj.com/images/smilies/tounge.png" alt="tounge" />',
':p' => '<img src="http://blog.sachinkraj.com/images/smilies/tounge.png" alt="tounge" />',
':(' => '<img src="http://blog.sachinkraj.com/images/smilies/sad.png" alt="sad face" />',
':o' => '<img src="http://blog.sachinkraj.com/images/smilies/shock.png" alt="shock" />',
':O' => '<img src="http://blog.sachinkraj.com/images/smilies/shock.png" alt="shock" />',
':0' => '<img src="http://blog.sachinkraj.com/images/smilies/shock.png" alt="shock" />',
':|' => '<img src="http://blog.sachinkraj.com/images/smilies/straight.png" alt="straight face" />',
':-|' => '<img src="http://blog.sachinkraj.com/images/smilies/straight.png" alt="straight face" />'
);
return (strtr($text, $codesToConvert));
}
Here is how the above code works:
$comment = 'This is the example comment with few smilies code we use normally. Like these: :) :D :P :p :O :-| . Its funny and cute. Isnt it? :)';
echo '<strong>Text with smiley codes:</strong>' . $comment ;
echo '<strong>Text with smiley images:</strong>' . addSmilies($comment);
Here is part of the code that assigns the smarty variable which are later used to display the reviews (comments).
$averageRating = am_getrating($got_gameid);
$reviews = am_queries($db, "SELECT * FROM AMCMS_reviews WHERE gameid=$got_gameid AND approved=1;");
$countreviews = am_countrecords($db, "SELECT * FROM AMCMS_reviews WHERE gameid=$got_gameid AND approved=1;");
$smarty->assign('sitetitle',$sitetitle);
$smarty->assign('metadesc',$metadesc);
$smarty->assign('metakeywords',$metakeywords);
$smarty->assign('insertGame',$insertGame);
$smarty->assign('headload',$headload);
$smarty->assign('bodyload',$bodyload);
$smarty->assign('gameAvgRating', $averageRating);
$smarty->assign('echoComment', $echoComment);
$smarty->assign('gameId', $gameres[0][0]);
$smarty->assign('gameName', $gameres[0][1]);
$smarty->assign('gameDescription', $gameres[0][2]);
$smarty->assign('gameOriginalWidth', $originalwidth);
$smarty->assign('gameOriginalHeight', $originalheight);
$smarty->assign('gameFilename', $gameres[0][6]);
$smarty->assign('gameCategory', $gameres[0][7]);
$smarty->assign('gamePlayCount', $gameres[0][8]);
$smarty->assign('gameExtension', strtolower($gameres[0][10]));
$smarty->assign('gameReviews', $reviews);
$smarty->assign('gameCountReviews', $countreviews);
$smarty->assign('gameHighScoreList', am_highscore($gameres[0][0], 'high', 10, 'list', false));
$smarty->assign('gameRecommendedList', am_listnewgames('list', 8, $gameres[0][7], false));
$smarty->assign('gameCode', html_entity_decode($gameres[0][15]));
Here is the code that shows the comments
{$echoComment}
</div></div>
<p />
<div class="reviews">
<h2 class="title"><center>{$gameCountReviews} reviews for {$gameName}</center></h2>
<center>
{foreach from=$gameReviews item=individualReview}
<div class="individualreview">Review by <i>{$individualReview.2}</i><p />
<div class="reviewtext">{$individualReview.3}</div>
</div><br /><p />
{/foreach}
I have been trying to fix this all day and it just wont show the comments, i tried to assign the script to a smarty variable but then how would i use it as the script says ? addSmilies($comment);
I tried few other scripts and tried to include it in the .tpl file but that didnt work, i tried all kinds of ways to make the addSmilies({$individualReview.3}) work by adding what not in there but it just wont work.
For the last few hours i have been looking in the smarty manual but i cant see anything even close to this
I am sorry for all the code and i am really new to php and smarty so i really need some help.
Please somebody help me
|
|
|
|
|
The easiest way would be to add them before sending them to the template.
$reviews = am_queries($db, "SELECT * FROM AMCMS_reviews WHERE gameid=$got_gameid AND approved=1;");
foreach ( $reviews as $rev )
{
$rev[ 3 ] = addSmilies( $rev[ 3 ] );
}
$smarty->assign('gameReviews', $reviews);
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
I tried what you suggested but the script crashed so i changed it to this script:
function smiley($text)
{
$path = "./smiley";
$width = '24';
$height = '24';
$arr[":))"] = "d.png";
$arr[":(("] = "cry.png";
$arr[";)"] = "wink.png";
$arr[":s"] = "s.png";
$arr[":@"] = "angry.png";
$arr[":)"] = "happy.png";
$arr[":("] = "sad.png";
$arr[":o"] = "o.png";
$arr[":x"] = "love.png";
$arr["b-)"] = "b.png";
$arr[":d"] = "d.png";
$arr[":p"] = "p.png";
$arr["o)"] = "angel.png";
$arr[":-b"] = "nerd.png";
$arr[":*"] = "kiss.png";
$arr["x("] = "angry.png";
$code_arr = array_keys($arr);
foreach($code_arr as $code)
$text = str_ireplace($code, "<img width = '" . $width . "' height = '" . $height . "' src='$path/" . $arr[$code] . "'>" , $text);
return $text;
}
After putting your code in the file nothing changed all smilies just show as text
$reviews = am_queries($db, "SELECT * FROM AMCMS_reviews WHERE gameid=$got_gameid AND approved=1;");
foreach ( $reviews as $rev )
{
$rev[ 3 ] = smiley( $rev[ 3 ] );
}
Any other suggestions ?
Any way to do the same foreach in smarty ?
Thanks for helping btw
|
|
|
|
|
My bad.
I would use your previous addSmilies method (strtr). It is alot more efficient.
I was a bit of a clot and forgot that the value $rev from the foreach wasn't a pointer to $reviews . A normal for loop will work.
$reviews = am_queries($db, "SELECT * FROM AMCMS_reviews WHERE gameid=$got_gameid AND approved=1;");
for ( $i = 0; $i < count( $reviews ); $i++ )
{
$reviews[ $i ][ 3 ] = addSmilies( $reviews[ $i ][ 3 ] );
}
djkee wrote: Any way to do the same foreach in smarty ?
There is no point, as it shouldn't technically be in the template. And it would make the template messy, which is never a good thing.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
This is awesome Thank you so much for the help
It works like a charm
|
|
|
|
|
|
This must have all the basics of the game completed and functioning. This means that the game must generate the two dice values and display an image for each individual dice. Set the correct conditions for the first throw to determine a win or a loss or the setting of a point. If the point is set the play must continue with consecutive throws until the point is matched or a 7 is thrown and a win or a loss is determined.
|
|
|
|
|
How to extract Numeric values from String
plz help
|
|
|
|
|
not sure if you mean you have a string with a number in it and need to pull just the string or if you have a number returned as a string.
but for the first you can separate the string using explode and then looping through the returned array and checking for is_numeric returning true and extracting that.
the second should be able to be used directly
$a = '1';
$echo 1 + $a;
but if there is a issue with it, you can use an explicit cast like in C (int)$a for example.
|
|
|
|
|
In the PHP documentation of Strings[^] there is a little snippet just over a third of the way down called "String conversion to numbers", which may help you.
Other than that, you could always go through the string char by char
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
I know this is a few days old but I thought I'd mention some new functionality in PHP. PHP Filters. Specifically:
<?php
$value01 = '123abc456def';
echo filter_var($value01, FILTER_SANITIZE_NUMBER_INT);
?>
Will Output:
123456
|
|
|
|
|
That's very useful. Bookmarked this for future reference, just in case.
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
|
I'm about to start a pet web project and I have chosen to use Python for it.
But, I'm stuck at the beginning, because I have a dilemma about the framework to use.
From what I saw, there are two frameworks I like, Django and web2py.
Anyone here has any real experience with these two, or have a good reason why one it better that the other?
[edit]
What's the matter? Nobody uses Django, nor web2py, nobody uses python, or nobody visits this forum?
[/edit]
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
modified on Friday, November 20, 2009 2:07 PM
|
|
|
|
|
|
I did that, more that once.
There are a lot of people arguing that Django is the better choice, and a lot arguing the opposite.
Nevertheless...I chose Django. So far, I like it.
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
|
|
|
|
|
Sorry for seeing the post soo late.
I don't know a single person using web2py in production so that may make it a tad scary to get started. I use Django and web.py professionally and it really is a question about your needs.
Personally, it took me some time to get comfortable with Django but now that I am I tend to prefer it.
And above all things, never think that you're not good enough yourself. A man should never think that. My belief is that in life people will take you at your own reckoning. --Isaac Asimov
Avoid the crowd. Do your own thinking independently. Be the chess player, not the chess piece. --Ralph Charell
|
|
|
|
|
I've made my choice, already
I decided to go with Django, and am quite happy with the decision, by now.
One of the biggest pros was the community around Django, something web2py can't really compete with.
After all, for learning a new framework, community tends to be quite important.
Where it seems there are only borderlines, Where others turn and sigh, You shall rise!
|
|
|
|
|
If you have questions about web2py and want more information about people running it on production, I would suggest you join (even if temporarily) the web2py google group. There are more than 1500 members and a lot of people using it in production who will be happy to share their opinions with you. You will find a very active community. The web2py community is younger therefore not as big as Django's.
As an axample, the PyCon 2010 registration site runs web2py in production. It used to run on Django but moved to web2py two years ago. http://us.pycon.org/2010/register
|
|
|
|
|
Hello,
I have created a web site in visual studio 2008 and sql server 2005. it contains a crystal report.
It works fine when hosted in IIS. but in apache server.. Report page in not coming for a long time.
finally its not coming. Please help me asap.
( # Is somthing else i have to write in apache config httpd ?)
|
|
|
|
|