Tincr for ASP.NET MVC 3 - asp.net-mvc-3

I am trying to use the tincr extension in chrome. It allows you to refresh css and javascript without having to reload the page again. I'm having some trouble getting it working and would appreciate any help.
My Setup
Source code root directory:
C:\dev\tfs\MyApp\Development Branches\3.3.0.0\Presentation\MyApp
IIS website directory points to the root directory above. The Scripts directory underneath the folder path above contains the js files that I am changing.
I created a tincr.json file and put it in the root directory
tincr.json
{
"toFile" : [],
"fromFile" : [
{"from": "C:\\\\dev\\\\tfs\\\\MyApp\\\\Development Branches\\\\3.3.0.0\\\\Presentation\\\\MyApp\\\\Scripts\\\\(.+\\.js)",
"to": "http://localhost/MyApp/Scripts/$1"}
]
}
Is this correct? Has anyone managed to get tincr working with ASP.NET MVC 3? Thank you for your help.
PS - I don't have the rep to create a tincr tag so if someone could add that to this it would make it easier for others to post questions about it too. Thanks.

After playing around and reading google groups and other web sites I pieced together the following
Tincr does not work with query parameters in windows (eg. common.js?var=1 will fail)
You need to be careful of ajax queries that append to the url for js files that come from references to ajax code. Use Fiddler and watch the URLS. I had to make sure that the js file was added to the _Layout.cshtml file and then it would come out without query parameters.
I put a more detailed how to for Tincr on my website http://aboutdev.wordpress.com/2013/01/26/using-tincr-with-asp-net-mvc-in-windows-7/ but here is what you need.
The tincr.js file I used looks as follows:
{
"toFile" : [],
"fromFile" :
[
{
"from": "\\\\Scripts\\\\([a-zA-Z]+)\\.js",
"to": "/MyApp/Scripts/$1.js"
}
]
}
This file does not update the file on disk because 'tofile' is not filled in.
This file will look for files in the Scripts directory that is directly under the root where you put your tincr.json file.
I hope this helps you with using Tincr in your pojects.

Related

Vercel: How to rewrite vercel urls correctly?

Maybe I don't quite understand what rewriting means, or I'm not doing it right, but I'll put you in the context of what I want to happen and it's not happening, if someone can help me.
I have a project created which had its vercel domain as "example.vercel.app" but I put mine and now it has its custom domain as "example.com".
So far everything normal.
But now I have the problem that within my structure I have index.html in the root folder, that his url is translated as "https://example.com" and in another root folder called html I have the file contact.html that if I go to it from another file I would have the url as "https://example.com/html/contact", but instead I want it to stay as "https://example.com/contact", I don't know how I can get this, if someone could help me.
In my vercel.json file I have this configuration:
{
"cleanUrls": true,
"rewrites": [
{
"source": "/html/contact",
"destination": "/contact"
}
]
}
And from my html file I go to the route like this:
Contact
I make the call to the route like this to be able to redirect myself in production of course.
Also, in case it was the problem, I have already tried directing myself to the route in my html like this:
Contact
But it does not work.
So I no longer know how I should do to achieve my goal, if someone knows how to help me I would greatly appreciate it.

How Can I upload my laravel 8 and tailwind css based application to cpanel

I am new to laravel . thanks for the help .
I have build an application using laravel 8 (with jetstream+livewire) and tailwind CSS.
It works perfectly in my local machine . by running :
php artisan serve
But when I upload the site/codes to the live server , it does not get the proper styles that i defined in 'tailwind.config.js' file.
what i get is only the css that can be generated from cdn (I am not using tailwind cdn , i am sure ) .
For more clear question : I get only the compiled css from
app.css file. I do not get the extended feature that I enabled in tailwind.config.js
file. such as , I do not get the output for this in live server (codes from my tailwin.config.js):
variants: {
extend: {
translate: ['group-hover'],
scale: ['group-hover'],
transitionProperty: ['group-hover'],
display: ['group-hover'],
},
},
But in my local machine, everything is perfect.
I have uploaded it in 000webhostapp. by following this guideline
I did not include the node_modules folder in the upload
for any help , thanks in advance.
Make sure that you are serving the public folder and not the root of your Laravel project. You should not be able to see public in your URLs.
This will impact the path to the css file. You should verify loading of all resources by looking in the developer tools, networking tab.

WordPress Ajax Get Request?

I have a page that includes a php file I have written like so
HTML
<div id="playlists_div_holder">
<?php include(dirname(__FILE__) . '/includes/get_playlists.php'); ?>
</div>
I have created a button that will refresh the playlists , incase the user has uploaded (added/removed) anything, and I am trying to do so with an ajax request to get the file and include it back into that div, but I am receiving a 500 error.
I am doing this in WordPress so that may be an issue.
The Button
<span class="button-primary refresh-playlists" onclick="ReloadPlaylists()">Refresh Playlists</span>
Ajax Request
function ReloadPlaylists() {
jQuery.get('<?php echo plugins_url();?>/Player/includes/get_playlists.php', function(data) {
jQuery('#playlists_div_holder').html(data);
alert('Load was performed.');
});
}
Including it works but an ajax get throws a 500 error
It's pretty hard to guess the problem but some simple workarounds that you can use all the time:-
CAUTION! Please take backup of your WordPress before doing anything.
1st workaround:-
Download fresh WordPress copy
Delete every folder, except the wp-content folder.
Upload all the files and folders again, except the wp-content folder.
2nd workaround:-
Rename
wp-content/themes
to
wp-content/themes-backup
Create a new folder:-
wp-content/themes
start copying each theme from themes-backup to themes one by one and see if the error is gone.
Now what you have done with the themes folder, do exactly with the plugins folder.
Based on your comment,
i'm getting call to undefined function get_option on line 8 , which is odd because it works when i include it the first time. Could it be because its calling the same file on the other and it has some sort of variable conflict?
This is because when the plugin in running as an include, all the wp-includes are laoded before your plugin code is execute. However when you make an AJAX call directly to that file, the wp-includes are no loaded hence your get_option() isn't working.
You can fix that by adding include_once("../../../wp-blog-header.php"); on top of your get_playlists.php file. That might break your plugin (not sure) so in that case its safe to use it inside a condition like this
if(stristr($_SERVER["REQUEST_URI"], get_playlists.php))
include_once("../../../wp-blog-header.php");
However once you do that you will get an Error 404 when you make an AJAX request because that URL is not registered in Wordpress URL Rewrite. You can override that by using header() function.
if(stristr($_SERVER["REQUEST_URI"], get_playlists.php)) {
include_once("../../../wp-blog-header.php");
header("HTTP/1.1 200 OK");
}

Loading a JSON file in Firefox Addon Page Script, everything locally within the package

I have been developing a Firefox extension using the Addon SDK and need to load some data that is stored in the same package, as a separate file: "data.json". It needs to be loaded from a page script, i.e. "loader.js" which is included in the "panel.html" using the script src tags.
The structure is like this:
+data
panel.html
panel.js
loader.js
data.json
...
+lib
main.js
...
panel.html has:
<script type="text/javascript" src="loader.js"></script>
Initially we stored the data simply into a js file as "data.js" and included from the "panel.html" using script src tags and it worked without any problems. However when we submitted the add-on to the Mozilla Addon site, this was addressed as one of the issues to fix, saying that we need to use a non-executable format, such as a JSON file to make it more safe.
Now the problem seems like "loader.js" is not allowed to make a AJAX request to "data.json". (Using the JQuery $.ajax() call returns with no success, giving the error code 0) So the solution I have been thinking of is to load "data.json" from "main.js" using the SDK's request() function and somehow pass it to the "loader.js", the page script. But that seems to be complicated since, as far as I understand, the data needs to be first sent to a content script, and then from there to the page script. And this needs to be happen when the page script is loading! I am confused about this since I am not sure if I am missing a much more practical solution, or is it really something complicated what I am trying to do, simply loading local JSON data in the package into a local page script?
Here's an example on the Add-on Builder that explores and approach to this.
First off, you can load the json file from data and parse it using self.data.load:
let data = require('self').data;
let taps_data = JSON.parse(data.load('taps.json'));
This loads synchronously, so it isn't something you want to do often, in the example it would only happen when the add-on firsst becomes active in a browsing session.
Next, you would use content scripts and message passing to pass the data in to the panel.
In the main.js script:
panel.on('show', function() {
if (!loaded)
panel.port.emit('taps-data', taps_data);
});
In the content script:
self.port.on('taps-data', function(data) {
$('#list').html('');
data.forEach(function(item) {
$('#list').append('<div>'+ item.name +'</div>');
});
self.port.emit('taps-loaded');
});
I do a bit of extra work to make sure I'm only emitting the data once. The data, FYI, is saved from the live beer keg data api from my local pub.

MVC3 web app running on IIS6 server images not showing up per "/content/themes/base/images" path

I recently published my MVC3 app to an IIS6.0 server and I have the following image reference in a .js script (see code block below) but the images are not showing up. I know that #Url.Content() works but I can't use that in a .js script.
Q1: What is the proper path to reference for images (or whatever contents)? Thx!
src: '/content/themes/base/images/down.gif'
Q2: The following controller/action isn't firing in my ajax/jquery method (I'm sure it's related) but same issue with path:
$.ajax(
{ url: '/Controller/MyMethod', // Not firing
Place: #Url.Content("~/Content/Image ...") instead of url only
Paths off the root of your web directory should be prefaced by '~/' like so:
src: '~/content/themes/base/images/down.gif'
This tells the server that the path is relative to the root.

Resources