|
Hi Guys,
One of those days when i have to start a new assignment and i feel a little uncertain about which path to go.. CROSSROAD.
I did a decent amount of web application development using Asp.net, from framework 1.1 to 4.0, then moved to Silverlight for nearly 2 years due to my assignments. haven't got a chance to work with MVC so i am kind of MVC virgin. so as to say, i am a Razor engine virgin too.
Now i have an opportunity to work on a Web application (not Silverlight based), and looking at options at hand, I am uncertain what would be a good way to go ahead.
1) should i go with just pure (HTML5 + JavaScript) way while consuming data via services
2) or should i do a HTML5 + Razor engine path, while data is still to be consumed via services.
I am inclined towards option 1, pure HTML5 and JavaScript for development, but should i be too worried about getting into JavaScript horror house? or should i look towards Razor engine to be a more promising one?
Some light please..
|
|
|
|
|
Hi,
I checked on the net and found that decryption sha256 php is not possible.
then how can I implement Password Reminder option?
please advise...
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
SHA is not an encryption algorithm; it is a one-way hash algorithm[^]. That means you cannot "decrypt" the hashed password.
(Technically, you could try a brute-force attack, but unless the hashed data is very simple, this could take a very long time.)
If the user forgets their password, you can't recover it. You'll have to reset it instead.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
I am VERY new to using WepAPI, and I have a problem. This might be a bit long, but I'm not sure what to post...
I'm using RestSharp....
I created a controller called AppSecurityController. It wraps calls to my security API. In it is a Login method:
The problem is that in the Login method, the Credential parameter is always null.
[System.Web.Http.HttpGet]
public LoginResponse Login(FMG.Entities.CredentialEntity Credentials)
{
Marois.Common.AppSecurity.Entities.CredentialEntity credentials = new Marois.Common.AppSecurity.Entities.CredentialEntity
{
UserName = Credentials.UserName,
Password = Credentials.Password
};
LoginResponse response = appSecurityBL.Login(credentials);
return response;
}
My solution has a project called Entities. In it is the Credential class:
[Serializable]
[DataContract]
public class CredentialEntity : _BaseEntity
{
[DataMember]
public string Password { get; set; }
[DataMember]
public string UserName { get; set; }
}
In my client project I have local models, which also has a CredentialModel:
namespace FMG.UI.WPF.Shared.Models
{
public class CredentialModel : _BaseModel
{
public string Password { get; set; }
public string UserName { get; set; }
}
}
I call to the WebAPI through a proxy class:
public LoginResponseModel Login(CredentialModel credentials)
{
WebAPIExecutor webAPIExecutor = new WebAPIExecutor("/AppSecurity/Login/", Method.GET);
webAPIExecutor.AddParameter(credentials);
LoginResponseModel results = webAPIExecutor.Execute<LoginResponseModel>();
return results;
}
WebAPIExecutor is a class for handling the RestSharp stuff:
public class WebAPIExecutor
{
#region Private Fields
private RestClient client;
private RestRequest request;
#endregion
#region CTOR
public WebAPIExecutor(string url, Method method = Method.POST)
{
if (string.IsNullOrEmpty(url))
{
throw new ArgumentNullException("Url");
}
setupServerURL();
client = new RestClient(ServerAddress);
client.AddHandler("text/plain", new JsonDeserializer());
request = new RestRequest(url, method)
{
RequestFormat = RestSharp.DataFormat.Json
};
}
#endregion
#region Public Methods
public void AddParameter(object value, string name = "")
{
if (value == null)
{
throw new ArgumentNullException("value");
}
Type type = value.GetType();
bool isPrimitive = type.IsPrimitive;
if(!string.IsNullOrEmpty(name) || (isPrimitive || type == typeof(string) || type == typeof(decimal)))
{
if (string.IsNullOrEmpty(name) && request.Method == Method.GET)
{
throw new ArgumentNullException("Parameter 'Name' cannot be empty for Get requests");
}
request.AddParameter(name, value);
}
else
{
request.AddBody(value);
}
}
public T Execute<T>() where T : new()
{
IRestResponse<T> result = client.Execute<T>(request);
int resultValue = (int)result.StatusCode;
if (resultValue >= 299)
{
string message = string.Format("An error occured calling the WebAPI. {0} The status code is '{1}'. {2} The error message is {3}",
Environment.NewLine, result.StatusCode, Environment.NewLine, result.Content );
MessageBox.Show(message, "WebAPI Error", MessageBoxButton.OK, MessageBoxImage.Exclamation);
throw new Exception(message);
}
return result.Data;
}
public void Execute()
{
IRestResponse result = null;
try
{
result = client.Execute(request);
int resultCode = (int)result.StatusCode;
if (resultCode > 299)
{
string message = "the error message";
throw new Exception(message);
}
}
catch (Exception e)
{
throw e;
}
}
#endregion
}
The parameter is being added with AddParameter and appears to be correct. The controller method is marked as HttpGet.
When I call from the proxy, through the WebAPIExecutor, I reach the controller and the parameter is null.
I'm am really clueless as to why the parameter is null in the controller. Can someone see what I'm doing wrong?
Many thanks
If it's not broken, fix it until it is
|
|
|
|
|
Hi,
I have a php file with jquery button like this:
<button id="btnContact" style="width: 140px" >
and:
$(function() { $( "#btnContact" ).button(); });
$('#btnContact').click(function() { window.location = 'contact_member.php'; });
I want to make the window.location as:
contact_member.php?id= + <?php echo $_GET["id"]; ?>
How can I do this please?
Technology News @ www.JassimRahma.com
|
|
|
|
|
1. Use the correct forum.
2. You really need to get hold of a PHP reference.
Veni, vidi, abiit domum
|
|
|
|
|
With a little search, there is a JS function that parse the URL and you can get the "id" value
|
|
|
|
|
Hi,
I would like to ask why I am getting the above error for this code:
if (isset($_GET['msg'])) { $mailbox_message = $_GET['msg']; } else { $mailbox_message = ""; }
then:
if (!strlen($mailbox_message)) { $mysql_query->bindParam(':param_message_mailbox', $mailbox_message = NULL, PDO::PARAM_NULL); }
else { $mysql_query->bindParam(':param_message_mailbox', $mailbox_message, PDO::PARAM_STR); }
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I would like to ask what's the best way to expire a login PHP session after sometime when it's idle?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Given all these questions, do you think a book on PHP would be a good investment?
Veni, vidi, abiit domum
|
|
|
|
|
Hereafter please use PHP forum[^] for php questions.
thatrajaNobody remains a virgin, Life screws everyone
|
|
|
|
|
Hi,
I have an input text control in my php page to allow user to enter thei profile address url which will be like this:
wwww.mydomain.com/PROFILE.ADDRESS
I want to know how can I let php validate it for me so only valid characters will be allowed such as alphabits, numbers, . (dot) and _ (underscore)?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Use a regular expression:
$ismatch = preg_match('/^[\w.]+$/', $input);
if ($ismatch) {
echo "Valid";
}
else {
echo "Invalid";
}
Hope this helps.
|
|
|
|
|
thanks but is it possible to have it validated while typping (while text changed) just like ASP.NET or only when form is posted?
Technology News @ www.JassimRahma.com
|
|
|
|
|
Yes, you can do that using JavaScript, but after submitting the form, ALWAYS validate it from the server-side language (PHP in this case). The reason is that people could disable JavaScript in their browser, and then the text box wouldn't be validated anymore.
For the JavaScript, try this:
var inputField = document.getElementById('put-your-id-here');
inputField.onkeyup = function(e) {
e = e || window.event;
var re = /[^\w.]/;
inputField.value = inputField.value.replace(re, '');
};
|
|
|
|
|
No, that won't work, meanwhile many non-ASCII characters are allowed in URLs.
I'd suggest to send a HEAD request to the URL (e.g. before submitting or when leaving the text field) and check the return code (200=OK, everything else: wrong).
|
|
|
|
|
Hi,i have web application in my hosting with some provider. In the case where one (provider) is disabled, the other connections (providers) do not work, give advice on how to properly build a network for web hosting.
Thanks
|
|
|
|
|
Hi,
I have a PHP page.
I have MonthTo and YearTo drop downs to display the month and year.
and I have chkPresent checkbox.
I want to make the MonthTo and YearTo required only when the checkbox is NOT checked.
How can I do this in PHP please?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I am using this code to display years from 1950 to the current year in my drop down. I would like to know how can I modify this code to show the dates in desc order so current year will start first in the drop down?
<?php
for ($i = 1950 ; $i <= date('Y'); $i++)
{ echo "<option>$i</option>"; }
?>
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Like this perhaps:
<?php
for ($i = date('Y'); $i >= 1950; $i--)
{ echo "<option>$i</option>"; }
?>
Veni, vidi, abiit domum
|
|
|
|
|
it works.. Thanks
Technology News @ www.JassimRahma.com
|
|
|
|
|
Hi,
I am using an input text in my PHP project for email address and password. I made the place holder for both so it will be easy for users to know what is every textbox form. but when I load the page the email address textbox will be autofocus therefore it will lose the placeholder then user needs to take the focus just to know what's this textbox?
Is there anyway to keep the placeholder text even when the cursor is focused so it will only be disappeared when the user starts typing.
Thanks
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
<doc>
<field name="id">1</field>
<field name="name">A</field>
<field name="sk">Acce</field>
<field name="level">Beginner</field>
<field name="do">Tuto</field>
<field name="open">1</field>
<field name="type">Ct</field>
<field name="extensis">cl_ex</field>
<field name="features">Atos</field>
<field name="downl"></field>
<field name="source">AtomicCounters</field>
<field name="description">Ths.</field>
<field name="tag1"></field>
<field name="tag2"></field>
<field name="tag3"></field>
<field name="tag4">Global</field>
<field name="tag5">Atomic</field>
<field name="tag6"></field>
<field name="tag7"></field>
<field name="tag8"></field>
<field name="tag9"></field>
<field name="tag10"></field>
</doc>
<doc>
<field name="id">2</field>
<field name="name">Ar</field>
<field name="sk">Acrce</field>
<field name="level">Beginner</field>
<field name="do">Tuto1</field>
<field name="open">11</field>
<field name="type">C1t</field>
<field name="extensis">cl_exd</field>
<field name="features">Atos</field>
<field name="downl"></field>
<field name="source">ddddd</field>
<field name="description">Thsdd.</field>
<field name="tag1"></field>
<field name="tag2"></field>
<field name="tag3"></field>
<field name="tag4">Global1</field>
<field name="tag5">Atomic1</field>
<field name="tag6"></field>
<field name="tag7"></field>
<field name="tag8"></field>
<field name="tag9"></field>
<field name="tag10"></field>
</doc>
Below is the code I am using..
<?php
$result="";
$document = new DOMDocument();
$document->load('http://index.websolr.com/solr/15b84f04a7e/select');
foreach($document->childNodes as $node)
$result[] .= $document->saveXML($node)."\n";
foreach($result as $key => $value)
{
echo "$key - $value<br/>";
}
?>
However it is displaying values only... like 1 Ar Acce....
I want like $field = id, $value = 1,$field = name, $value = A, $field = id, $value = 2,$field = name, $value = Ar,..
Any sugesstions please..
|
|
|
|
|
Hi,
I have a php file with cboMonth and cboYear drop downs and I have chkPresent in the same page.
I want to know how can I disable the cboMonth and cboYear and set both value to null if the chkPresent is checked?
Thanks,
Jassim[^]
Technology News @ www.JassimRahma.com
|
|
|
|
|
Add this in HTML of chkPresent onclick=”AssignValueOnCheckboxTick(this.checked)"
Now Add this in Java Script
<script type="Javascript">
var cboMonth = document.getElementById('<%= cboMonth.ClientID %>');
var cboYear = document.getElementById('<%= cboYear.ClientID %>');
function AssignValueOnCheckboxTick(ischecked) {
if (ischecked)
{
var cboMonth.style.display = 'block';
cboYear.style.display = 'block';
}
else
{
cboMonth.style.display = 'none';
cboYear.style.display = 'none';
}
}
</script>
|
|
|
|