Stefano Mtangoo 455 Senior Poster

Short Answer: NO.
Long Answer: HTML is markup language and not programming language. Learn C/C++, Java, Python, C# et al to Program to USB. You need a desktop based programming language!

Stefano Mtangoo 455 Senior Poster

While this does not solve your question, compressing the base64 string might reduce errors caused by timeout of big files transfer.
Note that because base64 is string then your problem isn't JSON but how to reliably post big data!

That being said, make sure that your server supports image data max size limit. I would accept json field telling me of data size and send error if that size exceeds my limit.

http://stackoverflow.com/questions/22329481/compressing-base64-data-uri-images

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

the links are great. My head is spinning at speed of light right now.
I will make use of them later.
For now I will mark it solved!

Stefano Mtangoo 455 Senior Poster

Thanks Pritaeas,
Its interesting that you removed OWIN and the Identity.
What did you use then?
I will visit the links and see what I can make out of them!

Stefano Mtangoo 455 Senior Poster

I would suggest you look at SwiftMailer (my fav) or PHPMailer to send mails. For all practical purposes I don't use PHP mail()

Here's a sample from Documetation

require_once 'lib/swift_required.php';

// Create the Transport
$transport = Swift_SmtpTransport::newInstance('smtp.example.org', 25)
  ->setUsername('your username')
  ->setPassword('your password')
  ; 

// Create the Mailer using your created Transport
$mailer = Swift_Mailer::newInstance($transport);

// Create a message
$message = Swift_Message::newInstance('Wonderful Subject')
  ->setFrom(array('john@doe.com' => 'John Doe'))
  ->setTo(array('receiver@domain.org', 'other@domain.org' => 'A name'))
  ->setBody('Here is the message itself')
  ;

// Send the message
$result = $mailer->send($message);
Stefano Mtangoo 455 Senior Poster

Since you said nothing of what you have done so far nor did you tell us your level of expertise I will refer you to a tutorial
http://www.w3schools.com/php/php_mysql_intro.asp

Stefano Mtangoo 455 Senior Poster

I'm creating Frontend for an application with Established database (am rewriting to be explicit and so there are some things I cannot change.

I was looking at Default Register/Login that comes with MVC5 sample and found that its table have fields that are problematic to my app. Specifically, my users don't have Emails and app does not require one. But they rather have strings of username (PK in Existing User table).

So I wanted to know if I can strip those unneeded field to match my table columns my table needs only UserName, Password, MobileNumber, LastLogin, and IsUserActive.

Is there a way to achieve this? I dont real want to roll my own login as I want to use Roles and Integrated Authentication by simply adding [Authorize] into my actions.

Thanks,

Stefano

Stefano Mtangoo 455 Senior Poster

This is JavaScript question
You have to tie events to selection change then send Ajax request to get list of States fo example, for that country!

Stefano Mtangoo 455 Senior Poster

with my hint above modulo operation is unnecessary!
:)

Stefano Mtangoo 455 Senior Poster

The Code below shows how to iterate Strings.
With Efforts you should be able to get what you want
God bless you!

#include <string>
#include <iostream>

int main()
{
    int i=0;
    std::string s = "UJehova uyaphile Yesu Mwema!";
    for(i; i<s.length(); i++)
    {
        std::cout<<s[i]<<std::endl;
    }
    return 0;
}
Stefano Mtangoo 455 Senior Poster

couple of options

  1. Limit number of tags and strip off the rest (then encode string in case some entities made its way)
  2. Use HTML Purifier (google it)
  3. Use Markup language

Always validate your inputs

Stefano Mtangoo 455 Senior Poster

Emulating cart means:
1. Temporary store items
2. commit at checkout
Which means
1. Store in session
2. commit in database

Store them as asscociative arrays and use array's key exist function in php (check manual) and add only if does not exist. Else just update!

Stefano Mtangoo 455 Senior Poster

post whole stack trace here
also I find your line $order = "INSERT INTO user VALUES('$name','$address')"; not working in most cases so I always do $order = "INSERT INTO user VALUES('{$name}','{$address}')";

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

you seem to use GMail SMTP but the code below uses your host machine (which am sure is not google's SMTP servers

$mail->Host = "localhost";

So change it to google SMTP. here is example from their site (simplified)

$mail = new PHPMailer();
$body = "Your Body here!";
$mail->SMTPAuth   = true;                  // enable SMTP authentication
$mail->SMTPSecure = "tls";                 // sets the prefix to the servier
$mail->Host       = "smtp.gmail.com";      // sets GMAIL as the SMTP server
$mail->Port       = 587;                   // set the SMTP port for the GMAIL server
$mail->Username   = "yourusername@gmail.com";  // GMAIL username
$mail->Password   = "yourpassword";            // GMAIL password

$mail->SetFrom('name@yourdomain.com', 'First Last');
$mail->AddReplyTo("name@yourdomain.com","First Last");
$mail->Subject    = "PHPMailer Test Subject via smtp (Gmail), basic";
$mail->AltBody    = "To view the message, please use an HTML compatible email viewer!"; // optional, comment out and test
$mail->MsgHTML($body);
$address = "whoto@otherdomain.com";
$mail->AddAddress($address, "John Doe");
//optional
$mail->AddAttachment("images/phpmailer.gif");      // attachment
$mail->AddAttachment("images/phpmailer_mini.gif"); // attachment

if(!$mail->Send()) {
  echo "Mailer Error: " . $mail->ErrorInfo;
} else {
  echo "Message sent!";
}
Stefano Mtangoo 455 Senior Poster

please explain what you want.
Your explanations are cryptic!

Stefano Mtangoo 455 Senior Poster

It all boils don to what you want to do.
PHP and Python are different like spanner and screw driver. You will need each other for its task.

If you want web go for PHP and if it must be Python then Django helps here. There are others like Ruby and RoR. so you have a lot to explore!

Stefano Mtangoo 455 Senior Poster

There is no such a thing as best framework.
All frameworks are best to their own!

For me Yii meets my needs so its the best for me now!

Stefano Mtangoo 455 Senior Poster

Did you find solution?
If you can get to Linux anyhow you can use command
sudo update-grub

Stefano Mtangoo 455 Senior Poster

why would you make login a MySQL procedure? am yet to see that kind of thing. Database should store basic information and password hash. use that to authenticate your user.

A word of advice is, use PDO or at least MySQLi.
If I have misunderstood you please comment!

Stefano Mtangoo 455 Senior Poster

Well that is the Question, but where is your efforts?

Stefano Mtangoo 455 Senior Poster

I get the same error

Traceback (most recent call last):
  File "test.py", line 13, in <module>
    import wx
  File "/usr/local/lib/python3.3/dist-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/local/lib/python3.3/dist-packages/wx/core.py", line 6, in <module>
    from ._core import *
ImportError: No module named 'wx._core'

Have you tried it in Linux?
I know its in alpha but at least it should be usable ;)

Stefano Mtangoo 455 Senior Poster

I downloaded daily build and did
python3 setup.py build

and then
python3 setup.py install

So far so good!
I tried import wx and no errors
I tried to run the program here and all I got was the error below.

Have anyone got wxPython working with Py3 especially on Linux (Debian/Ubuntu)

python3 test.py 
Traceback (most recent call last):
  File "test.py", line 2, in <module>
    import wx
  File "/usr/local/lib/python3.3/dist-packages/wx/__init__.py", line 17, in <module>
    from wx.core import *
  File "/usr/local/lib/python3.3/dist-packages/wx/core.py", line 6, in <module>
    from ._core import *
ImportError: No module named 'wx._core'

TIA,
Stefano

Stefano Mtangoo 455 Senior Poster

And note that Python does not compete with C++ to the fullest sense of the word. It compliments it. you speedily develop in python and when you need critical operations you can make a C/C++ program and use it for that Part.

Have you heard of CTypes? One of best things ever occured to Python :)

Stefano Mtangoo 455 Senior Poster

You can definitely achieve that with wxWidgets. I have written some tutorials which you can checkout.
I use wxDatabase for Database issue (which I maintain also). So check it out!

Stefano Mtangoo 455 Senior Poster

No comment yet?

Stefano Mtangoo 455 Senior Poster

BTW apt-get downloads packages in cache before installing them so you can copy from cache!

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

As heading shouts, I need to make source code formatter to format PHP Codes.
RobertoP have written nice Lexical analyzer that means no need for me to tokenize file.
I just do not know how to "juggle" with tokens to produce the formatted code.
I appreciate any pointer especially simple tutorial.
Analyzer class is here
TIA,
Stefano

Stefano Mtangoo 455 Senior Poster

Well since am the owner of thread and have jumped to the same thing (was postponed) no hurt reviving dead thread :)

I checked Boost Python and its awesome. I want my users to Just put their py code on plugins/python and I want my app (in C++ to just load them). I have two Questions here:
1. Does BoostP act as interpreter for me that I don't need Python DLL?
2. How do I send Events to Py code (I use wxWidgets). I mean how do I make it receive and event being a Python code?

Thanks

Stefano Mtangoo 455 Senior Poster

I have used them and I have the key. Do I need anything else in case I want to contact MS?

Stefano Mtangoo 455 Senior Poster

I have though its old and so scratched. All I copied into a paper is its key.
Is that even useful if I call MS?

Stefano Mtangoo 455 Senior Poster

@pritaeas,
I have both valid keys but changing it failed and that prompted me to check the file integrity its when I found its not intact. I will have to download the big file (Yes 2.x GB is big file) and repair may be. I hope MS servers will not refuse the key!

Stefano Mtangoo 455 Senior Poster

I have Windows 7 Professional. I bought it in 2010 and it have never bothered me until when it started complaining. I have found that where I bought they did install Using their own product key but did give all Computers DVDs (XPSP3, Win 7 Pro et al). The Disks were lost in fire accident but I have its key (from bottom of laptop which is yet to be used anywhere) and The key they installed in my laptop (with no Discs).

Since My Windows is complaining I run sfc /scannow and found corrupt files and failed to fix them. What else can I do to make my PC work? I cannot even do Windows update. My diagnosis show that registry cleaners (I have used CCleaner and ASC and other one) might have tempered with files and corrupt them.

I need advice!
-Stefa

Stefano Mtangoo 455 Senior Poster

So you want to mix 32 and 64bit?
You open the can of worms there!

Stefano Mtangoo 455 Senior Poster

how would you do that in commandline terminal?

Stefano Mtangoo 455 Senior Poster

I have a collection of resources on my site. Check if they be helpful to you!

Stefano Mtangoo 455 Senior Poster

In that case you need to use GUI toolkit for UI.
I suggest wxWidgets!

Stefano Mtangoo 455 Senior Poster

I prefer CodeLite. Stable, Class generator, generate implementation of declared functions, GCC/VC Compilers support, GTK, QT, wxWidgets projects support, RAD for wxWidgets, Import VS Solution, Git/SVN integration et al.

But try the posted IDEs and choose your flavor!

Stefano Mtangoo 455 Senior Poster

No Better OpenSource is there Yet and many people cannot pay when there is better free alternative!

Stefano Mtangoo 455 Senior Poster

'DOCUMENT_ROOT'
*The document root directory under which the current script is executing, as defined in the server's configuration file. *

Are you sure url to file system mapping is correct?

Stefano Mtangoo 455 Senior Poster

Hi,
I know how to make C++ plugin based application with C++ plugins. I need to add ability to code plugins in Python. I want users to be able to write Plugins in any language (C++ or Python). What are fundamentals of writting app in C++ but support plugins in Python?

I have googled and cannot find something useful yet(may be I use wrong keywords)

Thanks!

Stefano Mtangoo 455 Senior Poster

There are many out there:

Soci, debea, Poco::Data, ODBC(and unixODBC), databaselayer

All these works!

Stefano Mtangoo 455 Senior Poster

I'm not as professional as Mike, Vijay, and the co on C++ compiler but I will throw my experience.

If you need something that will work and be reasonably productive, you can go for GCC/GDB. If you need an advanced debugger then MSVC is better for you than GCC/GDB.
I hear a lot about intel as being the best, but never tried.

I would further add that for windows, VC is said to produce small exe but for cross platform GCC is still better.

On IDEs I would vote for CodeLite. It is similar to C::B but have many usefull features and is simple to get started. I had a bad expericence with complexity of MS VS so I always hesitate to recommend to newbie.

HTH,
Stefano

Stefano Mtangoo 455 Senior Poster

not sure I understand your query but its easier to separate things like
loginform.php where all login form html/php data goes
member.php contain memeber are protected for non members
index.php for putting things together

Now in index.php

if($userIsLoggedIn)//your mechanism for logging in
{
//set some member area variables here is a sample
$isMember=true;
include("member.php");
}
else
{
include("loginform.php");
}
Stefano Mtangoo 455 Senior Poster

I assume you have database and tables defined. Also I assumen names of column in INSERT query are correct and case sensitive. Try using PDO instead of that one.

Amny advantages for using PDO especially its prepared statement. Here is sample code:

    <?php
    if(isset($_POST['name']))
    {

        $id= (int)rand(1,9999999);
        $name = $_POST['name'];
        $CompanyName = $_POST['CompanyName'];
        $number = $_POST['number'];
        $Address = $_POST['Address'];
        $Emailaddress = $_POST['Emailaddress'];
        $pwd = $_POST['pwd'];
        $business = $_POST['business'];
        $Monthlyspend = $_POST['Monthlyspend'];
        $products = $_POST['products'];
        $industry = $_POST['industry'];
        $customers = $_POST['customers'];
        $info = $_POST['info'];

        //$dbhandle = new SQLite3('RegisterNewcustomer.db');
        try{
            $dbhandle = new PDO('sqlite:host=RegisterNewcustomer.db');
            }
        catch (PDOException $error) {
            echo 'error connecting to file! error message: ', $error->getMessage(), '<br/>';
        }

        if (!$dbhandle) die ('Could not find database');
        $sql = "INSERT INTO Registercustomers(ID,name,CompanyName,number,EmailAddress,business,Monthlyspend,products,customers,info,password,industry) VALUES('$id', '$name', '$CompanyName', '$number', '$Address', '$Emailaddress', '$business', '$Monthlyspend', '$products', '$customers', '$info', '$pwd', '$industry')";
        die($sql);
        $ok = $dbhandle->exec( $sql);
        if (!$ok) die("Error: Cannot Execute Query");
        echo "Form Submitted Successfully"; 
    }
    ?>
    <!DOCTYPE html>
    <html>
    <head>
    <title>Register New account </title>
    </head>
    <body>
    <h1> Register a New Account </h1>
    <p> To register a new Account, Please fill in the form below alternatively you can call the customer services team<br />
    at Alliance Healthcare at <strong>020 8391 2323</strong> to enquire about opening a new account.<br />
    </p>
    <form name="RegisterNewaccount" method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>">
    <fieldset>
    <legend>
    Your Details:
    </legend>
    <p><label> Name:<br>
    <input type="text" name="name" size="30" maxlength="50"/></label> </p><br>
    <p> <label> Company Name: <br>
    <input type="text" name="CompanyName" size="30" maxlength="50"/> </label></p> <br>
    <p> <label> Contact Number:<br>
    <input type="text" name="number" size="30" maxlength="50"/></label> </p><br>
    <p> <label> Address:<br>
    <input …
Stefano Mtangoo 455 Senior Poster

Post the error

Stefano Mtangoo 455 Senior Poster
Stefano Mtangoo 455 Senior Poster

Yes:

$date = '26.01.2012';
echo date("d\<\s\u\p\>S\<\/\s\u\p\> F Y",strtotime($date));

I've probably overdone the escaping, but it works.

That was easiest than my thought