|
You have already posted this question and accepted a solution:
How to load the progress at the same time my method is running[^]
And based on your previous comments, this is nothing to do with web development; it's a desktop application.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
The answer didn't work like I Expected and yes this is a windows form application
|
|
|
|
|
hello dear experts, good day,
i want to connect two pages on which a plugin like
- participants_database or
- wp-job-manager runs
i want to do that via wpdb to another database :: how to combine two wp-pages - here i want to discuss a approach that works - see https:
- use Rest-API
- user other methods such als the following one which i want to discuss with you
If they are all on the same server under the same hosting account, that is helpful. In a case like that, you could write your custom code to access the other site’s database directly. This is discussed here, and it’s quite feasible: link: Using wpdb to connect to a separate database
see here the discussion of several approaches - which is so fruitful that i want to share it with you... - see https:
[b]question[/b]: I want to connect wpdb to another database. How do I create the instance and pass it the database name/username/password?
Answer1: 134 votes Yes it's possible. The wpdb object can be used to access any database and query any table. Absolutely no need to be Wordpress related, which is very interesting. The benefit is the ability to use all the wpdb classes and functions like get_results, etc so that there's no need to re-invent the wheel. Here's how:
[CODE]
$mydb = new wpdb('username','password','database','localhost');
$rows = $mydb->get_results("select Name from my_table");
echo "<ul>";
foreach ($rows as $obj) :
echo "<li>".$obj->Name."</li>";
endforeach;
echo "</ul>";[/CODE]
comment 1: you can also save time by using global $wpdb. But before firing ;[/CODE]$wpdb->get_results method,;[/CODE]
you must include wp-load.php as: [CODE]require_once('/your/wordpress/wp-load.php');[/CODE]
comment 2: Set WPDB prefix to make WP_Query and get_post to generate correct sql query by calling $mydb->set_prefix('wp_');
answer2: [ 30 votes ] Connecting to a second database is easy in WordPress, you simply create a new instance of the WPDB class and use it the same way you would use the standard $wpdb instance we all know and love.
Assuming the second database has the same login information as the main WP one you can even use the predefined constants
from wp-config.php to avoid hardcoding the login information.
[CODE]/**
* Instantiate the wpdb class to connect to your second database, $database_name
*/
$second_db = new wpdb(DB_USER, DB_PASSWORD, $database_name, DB_HOST);
/**
* Use the new database object just like you would use $wpdb
*/
$results = $second_db->get_results($your_query);[/CODE]
comment 1: This is somewhat redundant to Wadih's answer but I think my code example is a bit clearer and its also important to remember the db login constant's as they are almost always the right ones to use and otherwise you risk issues when moving from dev->stage->live environments where the login details might change. – jerclarke Sep 11 '10 at 20:55
comment 2: Set WPDB prefix to make WP_Query and get_post to generate correct sql query by calling [CODE]$second_db->set_prefix('wp_'); [/CODE]
answer3: [ 21 votes ] no one has said this so I thought I'd add an even easier way..as long as your additional database has the same user/pass details to access it as your wordpress database you can use the database name before the table name like this
[CODE]$query = $wpdb->prepare('SELECT * FROM dbname.dbtable WHERE 1');
$result = $wpdb->get_results($query);[/CODE]
comment 1: From my experience, this only works to get data, i.e. using SELECT. You can't insert data.
comment 2: it will not work externally,
- see https:
[b]Conclusio[/b]: well i like this approach very very much. The good thing - i am with the sites in question - i am on the same server - so i guess that this will work for me.
see the discussion of several approaches - which is so fruitful that i want to share it with you... - see https:
any idea any experience !?
love to hear from you
|
|
|
|
|
Hi!
To those who use Unity the 3D dev platform, I'm getting started with a project and want some version control to go with.
What are your experiences with version control? I've read that Unity supports Perforce and one other - also - proprietary VCS. Has anyone used Git or SVN with Unity? Any other methods I'm not aware of?
Thanks!
|
|
|
|
|
Years ago I used TortoiseSVN for code (wasn't unity) but it was file based so it did not matter. It had a plugin to File Explorer and was independent of the IDE. It worked great.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
I following this article. Everything works great - from a browser.
What we're really after is to use SignalR in a WPF app, so during development I had been hosting in a Console app. Now, I want to host it in IIS.
For testing, I took this sample app and hosted it in IIS on our server. Like I said already, I can chat using from browser to browser.
Now, I'm trying to create a Console app that calls the Send method on the server from my PC:
class Program
{
private const string HUB_NAME = "ChatHub";
private static IHubProxy HubProxy;
static void Main(string[] args)
{
try
{
string url = "<a href="http:
var connection = new HubConnection(url);
HubProxy = connection.CreateHubProxy(HUB_NAME);
HubProxy.On<string, string>("send", HandleSendResponse);
connection.StateChanged += Connection_StateChanged;
connection.Error += Connection_Error;
Console.WriteLine($"Connecting to hub named '{HUB_NAME}' at {url}");
connection.Start().ContinueWith(task =>
{
if (task.IsFaulted)
{
Console.WriteLine("Connection failed");
foreach (var ex in task.Exception.InnerExceptions)
{
Console.WriteLine(ex.Message);
}
}
else
{
Console.WriteLine("Connection succeeded");
}
});
}
catch (Exception e)
{
Console.WriteLine("EXCEPTION OCCURED" + Environment.NewLine + e.ToString());
}
Console.WriteLine("Press any key to quit");
Console.ReadLine();
}
private static void Connection_Error(Exception obj)
{
Console.WriteLine($"Connection attempt threw '{obj.ToString()}'");
}
private static void Connection_StateChanged(StateChange obj)
{
Console.WriteLine($"Connection state is '{obj.NewState}'");
if (obj.NewState == ConnectionState.Connected)
{
string[] args = new string[2];
args[0] = "John Doe";
args[1] = "Hello there!";
HubProxy.Invoke("Send", args).ContinueWith(task =>
{
if (task.IsFaulted)
{
Console.WriteLine("There was an error calling Send: {0}", task.Exception.GetBaseException());
Console.WriteLine(task.Status.ToString());
}
else
{
Console.WriteLine("Send Complete.");
}
}).Wait();
}
}
private static void HandleSendResponse(string name, string message)
{
Console.WriteLine($"Server returned: '{message}' from '{name}'");
}
}
I'm getting the exception "You are using a version of the client that isn't compatible with the server. Client version 2.0, server version 1.3."
This looks pretty straightforward, but I've checked twice - both the server and client console app are using SignalR 2.0.0.
In the case of the browser, the jquery versions also look up to date, but my console app should care about that.
I've Googled this and everyone seems ot say the same thing as the message. But from what I can see the versions are correct.
Anyone have any ideas?
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
|
I need to install an Asp.Net Web API to IIS on a server as part of another app's installation. We're using Wix to create our installers. During installation of our app, we would also like to put our Web API in IIS on a server.
I see plenty of resources on how to deploy using VS, but how do I do this with an installation package?
How is this done?
Thanks
If it's not broken, fix it until it is.
Everything makes sense in someone's mind.
Ya can't fix stupid.
|
|
|
|
|
I'm working in VS2019 on a web project and once in a while this pops up when I go to simply run the code from within Visual Studios..... I know it has something to do with permissions at the URL but in this case I'm running to loacal server from within VS. How can my permissions change like that and what can I do to fix it? Thanks.
Hide Copy Code
HTTP Error 403.14 - Forbidden
The Web server is configured to not list the contents of this directory.
Most likely causes:
A default document is not configured for the requested URL, and directory browsing is not enabled on the server.
|
|
|
|
|
You probably have it set to run based on the selected document and your selected document is a folder or something that can't be browsed to. Right click a default page and choose to set it as default page.
Social Media - A platform that makes it easier for the crazies to find each other.
Everyone is born right handed. Only the strongest overcome it.
Fight for left-handed rights and hand equality.
|
|
|
|
|
|
When I run the code by itself(Index.cshtml), I don't get an error and everything works but when I try to make it a partial view in my details.cshtml page with
Html.RenderAction("Index", "FileUpload"); I get $(...).fileupload is not a function.
Code:Index.cshtml
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>index</title>
<link href="~/Content/FileUpload/FileUpload.css" rel="stylesheet" />
</head>
<body>
<div class="upload">
<div>
<form id="upload" method="post" action="/FileUpload/UploadFiles" enctype="multipart/form-data">
<div id="drop">
<a>Upload File</a>
<input type="file" name="upl" multiple id="fileuploader" />
</div>
<ul>
<!-- The file uploads will be shown here -->
</ul>
</form>
<script src="~/Scripts/jquery-3.1.0.min.js"></script>
<!-- JavaScript Includes -->
@*<script src="~/Scripts/jquery.knob.js"></script>*@
<script src="~/Scripts/FileUpload/jquery.knob.js"></script>
<!-- JavaScript Includes -->
<!-- jQuery File Upload Dependencies -->
@*<script src="~/Scripts/jquery.ui.widget.js"></script>*@
<script src="~/Scripts/FileUpload/jquery.ui.widget.js"></script>
@*<script src="~/Scripts/jquery.iframe-transport.js"></script>*@
<script src="~/Scripts/FileUpload/jquery.iframe-transport.js"></script>
@*<script src="~/Scripts/jquery.fileupload.js"></script>*@
<script src="~/Scripts/FileUpload/jquery.fileupload.js"></script>
<!-- jQuery File Upload Dependencies -->
<!-- Main JavaScript file -->
@*<script src="~/Scripts/script.js"></script>*@
<script src="~/Scripts/script.js"></script>
<!-- Main JavaScript file -->
</div>
</div>
</body>
</html>
Controller:
public class FileUploadController : Controller
{
[ChildActionOnly]
public ActionResult Index()
{
return PartialView();
}
[HttpPost]
public void UploadFiles()
{
if (Request.Files?.Count > 0)
{
var filesCount = Request.Files.Count;
for (int i = 0; i < filesCount; i++)
{
var file = Request.Files[i];
var fileName = Path.GetFileName(file.FileName);
var path = Path.Combine(Server.MapPath("~/Uploads/"), fileName);
file.SaveAs(path);
}
}
}
Code:Details.cshtml
@{.
.
Html.RenderAction("Index", "FileUpload");
}
|
|
|
|
|
Quote: everything works but when I try to make it a partial view Maybe your partial view does not load the scripts that are needed to be there for that fileupload to be defined. Check your browser console to see the actual error, most probably, inside the partial view you need to import the JavaScript for the fileupload component and then call the $(...).fileupload() .
This line to be precise,
<script src="~/Scripts/FileUpload/jquery.fileupload.js"></script> If you are sure that you have called this script and it is a part of the DOM, and still this error comes, please share the browser console logs so that we can look into them. You can capture that using F12 and then visiting console (if some other tab is selected).
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
This is the error that I am receiving :
jquery-3.1.0.min.js:2 Uncaught TypeError: $(...).fileupload is not a function
at HTMLDocument.<anonymous> (script.js:12)
at j (jquery-3.1.0.min.js:2)
at k (jquery-3.1.0.min.js:2)
|
|
|
|
|
Can you show the content of your script.js file? The problem comes somewhere from there,
<script src="~/Scripts/script.js"></script> Somewhere at line 12, there is a call to the fileupload function and you can need to make sure that your fileupload script is loaded before line 12 (anywhere!).
One thing that is still bugging me is that why is jquery-3.1.0.min.js in this entire trace. Maybe you are causing a circular (or duplicate) script being loaded. Please verify that each script is loaded only one, and in a correct layout—like your normal view is working out, because this problem comes only in the partial view.
For example, see here for some more insights on the same problem: jQuery-File-Upload - TypeError: $(...).fileupload is not a function - Stack Overflow
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Here is the scripts.js file., also how are you identifying that jquery-3.1.0.min.js in this entire trace, I'm just passing the script
<script src="~/Scripts/jquery-3.1.0.min.js"></script>
in the Index.cshtml file which is the view that I am calling in my Details.cshtml.
script.js:
$(document).ready(function () {
var ul = $('#upload ul');
$('#drop a').click(function () {
$(this).parent().find('input').click();
});
$('#upload').fileupload({
dropZone: $('#drop'),
add: function (e, data) {
var tpl = $('<li class="working"><input type="text" value="0" data-width="48" data-height="48"' +
' data-fgColor="#0788a5" data-readOnly="1" data-bgColor="#3e4043" /><p></p><span></span></li>');
tpl.find('p').text(data.files[0].name)
.append('' + formatFileSize(data.files[0].size) + '');
data.context = tpl.appendTo(ul);
tpl.find('input').knob();
tpl.find('span').click(function () {
if (tpl.hasClass('working')) {
jqXHR.abort();
}
tpl.fadeOut(function () {
tpl.remove();
});
});
var jqXHR = data.submit();
},
progress: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);
data.context.find('input').val(progress).change();
if (progress == 100) {
data.context.removeClass('working');
}
},
fail: function (e, data) {
data.context.addClass('error');
}
});
$(document).on('drop dragover', function (e) {
e.preventDefault();
});
function formatFileSize(bytes) {
if (typeof bytes !== 'number') {
return '';
}
if (bytes >= 1000000000) {
return (bytes / 1000000000).toFixed(2) + ' GB';
}
if (bytes >= 1000000) {
return (bytes / 1000000).toFixed(2) + ' MB';
}
return (bytes / 1000).toFixed(2) + ' KB';
}
});
modified 30-Jul-19 15:35pm.
|
|
|
|
|
Hmmm, this looks fine. Just make sure that this partial view is loaded after you have loaded the script. Maybe bring all the scripts up to the top of the body element or at least before this partial view loading.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
That didn't fix the issue.
|
|
|
|
|
The problem only appears in partial view, right? Not if you keep everything inside the same view.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
I was able to figure out the issue,Thanks.
|
|
|
|
|
Hello guys,
I'm trying to do that for a while but nobody is able to help me. (Stack Overflow as well )
How can I achieve to create images with PHP that look like these Multi Color Gradients? The patterns should defined by positions in the field. It's important that they aren't linear or circled. It needs to be a complex pattern.
Image[^]
Any help would be amazing! Thank you
|
|
|
|
|
|
I want to be able to reload my Datatable once my checkbox is clicked , provided below is my attempted code but I continue to get error:Uncaught TypeError: Cannot set property 'data' of null not really sure how to handle this error. I have provided both the javascript and the view in my MVC application please let me know if you need more details.
.js
function ReloadTable()
{
$(document).ready(function () {
var table = $('#DashboardTable').DataTable({
"processing": true,
"serverSide": true,
"filter": true,
"orderMulti": false,
"ajax": {
"url": "/Chargeback/Index",
"type": "GET",
"datatype": "json"
},
"columns": [
{ "data": "ChargebackCode" },
{ "data": "StatusName" },
{ "data": "BusinessUnitName" },
{ "data": "InvoiceCode" },
{ "data": "OrderCode" },
{ "data": "PickTicketCode" },
{ "data": "CustomerPo" },
{ "data": "AssignedDepartment" },
{ "data": "DivisionName" },
{ "data": "Customer" },
{ "data": "WarehouseName" },
{ "data": "Coordinator" },
{ "data": "ChargebackDate" },
{ "data": "ModDate" },
{ "data": "ChargebackDeadline" },
{ "data": "ChargebackCloseDate" },
{ "data": " DaysOpen" },
{ "data": "ChargebackAmount" },
{ "data": "ChargebackBalance" },
{ "data": "FaultName" },
{ "data": "ResponsibleName" }
]
});
table.ajax.reload();
});
}
View
@using (Html.BeginForm("Index", "Chargeback"))
{
<label id = "Include" > @Html.CheckBox("IncludeClosed", (bool)ViewBag.IncludeClosed, new { onChange = "ReloadTable()" }) Include Closed</label>
<table id="DashboardTable" class="table table-striped" >
<thead>
<tr>
<th>Code</th>
<th>Status</th>
<th>Business</th>
<th>Invoice</th>
<th>Order</th>
<th>Pick Tickets</th>
<th>Customer PO</th>
<th>Assigned</th>
<th>Division</th>
<th>Customer</th>
<th>Warehouse</th>
<th>Coordinator</th>
<th>Open Date</th>
<th>Last Activity</th>
<th>Deadline</th>
<th>Closed Date</th>
<th>Days Open</th>
<th>Amount</th>
<th>Balance</th>
<th>Fault</th>
<th>Responsible</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
var chargebackDeadline = item.ChargebackDeadline == null ? "" : ((DateTime)item.ChargebackDeadline).ToString("MM/dd/yyyy");
var chargebackCloseDateAsString = item.ChargebackCloseDate == null ? "" : ((DateTime)item.ChargebackCloseDate).ToString("MM/dd/yyyy");
<tr>
<td>@Html.ActionLink(item.ChargebackCode, "Details", "Chargeback", new { id = item.Id }, null)</td>
<td>@item.StatusName</td>
<td>@item.BusinessUnitName</td>
<td>@item.InvoiceCode</td>
<td>@item.OrderCode</td>
<td>@item.PickTicketCode</td>
<td>@item.CustomerPo</td>
<td>@item.AssignedDepartment</td>
<td>@item.DivisionName</td>
<td>@item.Customer</td>
<td>@item.WarehouseName</td>
<td>@item.Coordinator</td>
<td>@item.ChargebackDate.ToString("MM/dd/yyyy")</td>
<td>@item.ModDate.ToString("MM/dd/yyyy")</td>
<td>@chargebackDeadline</td>
<td>@chargebackCloseDateAsString</td>
<td>@item.DaysOpen</td>
<td>$@item.ChargebackAmount</td>
<td>$@item.ChargebackBalance</td>
<td>@item.FaultName</td>
<td>@item.ResponsibleName</td>
</tr>
}
</tbody>
</table>
}
|
|
|
|
|
Quote: Cannot set property 'data' of null Throughout your entire JavaScript code you are only trying to set the data field of an object in the following codes,
"columns": [
{ "data": "ChargebackCode" }, Now, either this is causing an unknown error, or maybe the code causing this problem is somewhere else. Clearly, the object which is being said to be null is an object that you are creating yourself.
One suggestion that I can provide is to set a breakpoint in your browser at the columns field, and then step by step execute the code and see where does this problem occur. I believe, step-by-step code execution can have some answers.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
How to perform ajax on Data-table once I click on the check-box.
I already have the ability to auto post-back once the checkbox is clicked, I'm not sure how to achieve this.
View:
<script>
$(document).ready(function () {
$("#DashboardTable").DataTable({
"processing": true,
"serverSide": true,
"filter": true,
"orderMulti": false,
"pageLength": 5,
"ajax": {
"url": "/Chargeback/Index",
"type": "GET",
"datatype": "json"
},
"columnDefs":
[{
"targets": [0],
"visible": false,
"searchable": false
},
{
"targets": [7],
"searchable": false,
"orderable": false
},
{
"targets": [8],
"searchable": false,
"orderable": false
},
{
"targets": [9],
"searchable": false,
"orderable": false
}],
"columns": [
{"data":"ChargebackCode"},
{"data":"StatusName"},
{"data":"BusinessUnitName"},
{"data":"InvoiceCode"},
{"data":"OrderCode"},
{"data":"PickTicketCode"},
{"data":"CustomerPo"},
{"data":"AssignedDepartment"},
{"data":"DivisionName"},
{"data":"Customer"},
{"data":"WarehouseName"},
{"data":"Coordinator"},
{"data":"ChargebackDate"},
{"data":"ModDate"},
{"data":"ChargebackDeadline"},
{"data":"ChargebackCloseDate"},
{"data":" DaysOpen"},
{"data":"ChargebackAmount"},
{"data":"ChargebackBalance"},
{"data":"FaultName"},
{"data":"ResponsibleName"}
]
});
});
</script>
@using (Html.BeginForm("Index", "Chargeback"))
{
<label id = "Include" > @Html.CheckBox("IncludeClosed", (bool)ViewBag.IncludeClosed, new { onChange = "this.form.submit()" }) Include Closed</label>
<table id="DashboardTable" class="table table-striped" >
<thead>
<tr>
<th>Code</th>
<th>Status</th>
<th>Business</th>
<th>Invoice</th>
<th>Order</th>
<th>Pick Tickets</th>
<th>Customer PO</th>
<th>Assigned</th>
<th>Division</th>
<th>Customer</th>
<th>Warehouse</th>
<th>Coordinator</th>
<th>Open Date</th>
<th>Last Activity</th>
<th>Deadline</th>
<th>Closed Date</th>
<th>Days Open</th>
<th>Amount</th>
<th>Balance</th>
<th>Fault</th>
<th>Responsible</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model)
{
var chargebackDeadline = item.ChargebackDeadline == null ? "" : ((DateTime)item.ChargebackDeadline).ToString("MM/dd/yyyy");
var chargebackCloseDateAsString = item.ChargebackCloseDate == null ? "" : ((DateTime)item.ChargebackCloseDate).ToString("MM/dd/yyyy");
<tr>
<td>@Html.ActionLink(item.ChargebackCode, "Details", "Chargeback", new { id = item.Id }, null)</td>
<td>@item.StatusName</td>
<td>@item.BusinessUnitName</td>
<td>@item.InvoiceCode</td>
<td>@item.OrderCode</td>
<td>@item.PickTicketCode</td>
<td>@item.CustomerPo</td>
<td>@item.AssignedDepartment</td>
<td>@item.DivisionName</td>
<td>@item.Customer</td>
<td>@item.WarehouseName</td>
<td>@item.Coordinator</td>
<td>@item.ChargebackDate.ToString("MM/dd/yyyy")</td>
<td>@item.ModDate.ToString("MM/dd/yyyy")</td>
<td>@chargebackDeadline</td>
<td>@chargebackCloseDateAsString</td>
<td>@item.DaysOpen</td>
<td>$@item.ChargebackAmount</td>
<td>$@item.ChargebackBalance</td>
<td>@item.FaultName</td>
<td>@item.ResponsibleName</td>
</tr>
}
</tbody>
</table>
}
|
|
|
|
|