[QUOTE=Tamschi;52640454]I tend to have the opposite issue :v:
It's probably really system specific, because Git opens tons of processes while Hg is written in Python.[/QUOTE]
That's weird, it was [url]https://code.google.com/archive/p/openclamdrenderer/source/default/source[/url] this version of the OpenCL renderer that I had to migrate (all the way back in 2013 when google code was a thing), the project has quite a lot of commits to it and that seemed to bottleneck mercurial. If I remember correctly there may also have been some large files involved, but it was a long time ago and now I forget
[QUOTE=Icedshot;52643404]That's weird, it was [url]https://code.google.com/archive/p/openclamdrenderer/source/default/source[/url] this version of the OpenCL renderer that I had to migrate (all the way back in 2013 when google code was a thing), the project has quite a lot of commits to it and that seemed to bottleneck mercurial. If I remember correctly there may also have been some large files involved, but it was a long time ago and now I forget[/QUOTE]
I'll check it out, let's see if I run into issues with my workflow.
[editline]edit[/editline] It seems to be fast now. Making a (small) new commit took about a second.
I've dealt with far larger repositories than this one before just fine, but that was definitely later than when you worked with this one.
My first larger project was in 2009, and I know I didn't start properly using version control until much later.
I have a form that users fill out in my Flask app and I'm trying to setup validation for the fields. How can I alter the template while it's live to show an alert or highlight the bad field? I'm assuming I'd have to send some sort of signal to JQuery or maybe even re-render the page with the field data preserved.
[QUOTE=Adelle Zhu;52654616]I have a form that users fill out in my Flask app and I'm trying to setup validation for the fields. How can I alter the template while it's live to show an alert or highlight the bad field? I'm assuming I'd have to send some sort of signal to JQuery or maybe even re-render the page with the field data preserved.[/QUOTE]
It depends whether you're talking about client-side validation or server-side. Re-rendering the page refers to server-side validation, where you'd generate the HTML with extra messages with whatever you're using to generate the template server-side. On the client-side you can just use HTML5, with things like required fields, number fields, pattern attributes, min max values etc.
[code]
<input name="firstName" required>
<input name="age" type="number" min="18" max="100">
<input name="postCode" pattern="(\d{5}([\-]\d{4})?)">
[/code]
[QUOTE=djjkxbox;52654719]It depends whether you're talking about client-side validation or server-side. Re-rendering the page refers to server-side validation, where you'd generate the HTML with extra messages with whatever you're using to generate the template server-side. On the client-side you can just use HTML5, with things like required fields, number fields, pattern attributes, min max values etc.
[code]
<input name="firstName" required>
<input name="age" type="number" min="18" max="100">
<input name="postCode" pattern="(\d{5}([\-]\d{4})?)">
[/code][/QUOTE]
Had no idea HTML5 had the ability to match patterns. I wrote an entire Python method to do it server side. Now if I use this option, what should I do next to trigger an alert of some sort? I also need this to somehow work with two fields in tandem. If my drop-down menu has one option selected, I need the text field to accept only a certain pattern.
You'll need a small bit of JavaScript if you want two match two fields in tandem, I don't know how much JS you know, but you essentially want something like:
[code]
<form>
<select id="dropdownMenu">
<option value="someValue">Value 1</option>
<option value="valueHere">Value 2</option>
</select>
<input id="textField">
</form>
<script>
var dropdownMenu = document.getElementById("dropdownMenu")
var textField = document.getElementById("textField")
dropdownMenu.addEventListener("change", function () {
if (this.value == "valueHere") {
textField.pattern = "regex here"
textField.title = "Alert message to display if regex doesn't match"
} else {
textField.removeAttribute("pattern")
textField.removeAttribute("title")
}
})
</script>
[/code]
Where the bit in the <script> tags is the JavaScript. The "title" attribute lets you give a description about the format of the regex, which will automatically be displayed to the user if the validation fails
[QUOTE=djjkxbox;52654920]You'll need a small bit of JavaScript if you want two match two fields in tandem, I don't know how much JS you know, but you essentially want something like:
[code]
<form>
<select id="dropdownMenu">
<option value="someValue">Value 1</option>
<option value="valueHere">Value 2</option>
</select>
<input id="textField">
</form>
<script>
var dropdownMenu = document.getElementById("dropdownMenu")
var textField = document.getElementById("textField")
dropdownMenu.addEventListener("change", function () {
if (this.value == "valueHere") {
textField.pattern = "regex here"
textField.title = "Alert message to display if regex doesn't match"
} else {
textField.removeAttribute("pattern")
textField.removeAttribute("title")
}
})
</script>
[/code]
Where the bit in the <script> tags is the JavaScript. The "title" attribute lets you give a description about the format of the regex, which will automatically be displayed to the user if the validation fails[/QUOTE]
Sounds easy enough I just have to take what I have already from the serverside logic and translate it into JS. Here's what I was talking about:
[code]
# check the ordered strength for mg/ml and ensure the compound form is a liquid/gel
strengthcheck = re.search('/ML$', compound['strength'])
if strengthcheck and compound['form'] in ['TABLET', 'CAPSULE', 'SUPPOSITORY', 'CHEW-A-TREAT']:
error = 'mismatched_form_strength'
return error
else:
error = 'bad_suspension_strength'
return error
[/code]
So to give some context, it's a form for ordering veterinary medical compounds which are created from scratch. So the user (doctors) have the option of selecting what formulation (tablets, capsules, etc.) they want. My method just checks the field asking for the prescribed strength for the milliliters abbreviation and then checks to make sure the user actually selected a liquid/gel formulation.
Here's what I have so far:
[code]
$("#textfield").change(function(){
var text = $("#textfield").val();
var selection = $("#selectfield").val();
var selections = ['TABLET', 'CAPSULE', 'SUPPOSITORY', 'CHEW-A-TREAT'];
if (strength.match('\/ml$') && ($.inArray(selection, selections))!=-1){
$("#strength").focus();
toastr["error"]("Mismatched form and strength. Check both fields to ensure you are " +
"ordering the correct compound.")
}
if (!text.match(']\/ml$') && selection == 'SUSPENSION'){
toastr["error"]("Suspension form should be expressed as mg/ml.")
}
[/code]
is it possible to use the secondary trigger of smg1 in ar2?
[QUOTE=Adelle Zhu;52660921]Here's what I have so far:
[code]
$("#textfield").change(function(){
var text = $("#textfield").val();
var selection = $("#selectfield").val();
var selections = ['TABLET', 'CAPSULE', 'SUPPOSITORY', 'CHEW-A-TREAT'];
if (strength.match('\/ml$') && ($.inArray(selection, selections))!=-1){
$("#strength").focus();
toastr["error"]("Mismatched form and strength. Check both fields to ensure you are " +
"ordering the correct compound.")
}
if (!text.match(']\/ml$') && selection == 'SUSPENSION'){
toastr["error"]("Suspension form should be expressed as mg/ml.")
}
[/code][/QUOTE]
Did you get my PM? The match takes RegExp which is different from a string in JavaScript, so you'd do
[code]strength.match(/\/ml/)[/code]
instead of
[code]strength.match('\/ml')[/code]
Also you don't have to use square brackets for referencing a property of an object, so you can just do
[code]toastr.error("error message here")[/code]
I am messing around with Unity with C# and maybe I am being stupid but I have three sprites I want to pop up then have some balls drop into the scene. Below is how I have it set up:
[CODE] private void SpawnBalls()
{
StartCoroutine(ReadySetGo());
// get a random number of balls to spawn 1-10
int howManyBalls = (int)Random.Range(1, 11);
GetNumberSprite(howManyBalls);
// load the Balls prefab
GameObject balls = (GameObject)Resources.Load("Balls");
// list to hold the balls
List<GameObject> ballsList = new List<GameObject>();
for (int i = 1; i <= howManyBalls; i++)
{
// rename the ball
balls.name = "Ball" + (i.ToString());
// add ball to the list
ballsList.Add(balls);
// get random coordinates
int randomX = (int)Random.Range(-10, 8); // min X is -10 max X is 8
int randomY = (int)Random.Range(6, 15); // min Y is 6 max Y is 15
int randomZ = (int)Random.Range(-12, 12); // min Z is -12 max Z is 12
// position the ball based on those coordinates
Vector3 position = new Vector3(randomX, randomY, randomZ);
// spawn the ball
Instantiate(balls, position, Quaternion.identity);
}
}[/CODE]
So I expect it to finish the Couroutine before the balls drop but the Coroutine is happening and the balls are dropping all at the same time. Here is the Coroutine:
[CODE] private IEnumerator ReadySetGo()
{
Vector3 position = new Vector3(-1, 24, 12);
readySetGoSprite = (GameObject)Resources.Load("Ready_sprite");
GameObject tempReadySetGoSprite = Instantiate(readySetGoSprite, position, Quaternion.AngleAxis(85, Vector3.left)) as GameObject;
Destroy(tempReadySetGoSprite, 0.9f);
yield return new WaitForSeconds(1.0f);
readySetGoSprite = (GameObject)Resources.Load("Set_sprite");
GameObject tempReadySetGoSprite2 = Instantiate(readySetGoSprite, position, Quaternion.AngleAxis(85, Vector3.left)) as GameObject;
Destroy(tempReadySetGoSprite2, 0.9f);
yield return new WaitForSeconds(1.0f);
readySetGoSprite = (GameObject)Resources.Load("Go_sprite");
GameObject tempReadySetGoSprite3 = Instantiate(readySetGoSprite, position, Quaternion.AngleAxis(85, Vector3.left)) as GameObject;
Destroy(tempReadySetGoSprite3, 0.9f);
yield return new WaitForSeconds(1.0f);
}[/CODE]
Am I doing this completely wrong? Should I be using the Coroutine at all? I do not understand why it is jumping to the next code before the ReadySetGo() method is completed. I am very new using Unity but it could very well be my c# skills as well. This is how I figure it should work. It should say Ready, Set, Go then drop the balls.
I am sure my code is crap so any other input is welcome.
Edit:
Never mind I got it I put SpawnBalls() at the end of the Coroutine and it is working as expected now.
[QUOTE=djjkxbox;52667816]Did you get my PM? The match takes RegExp which is different from a string in JavaScript, so you'd do
[code]strength.match(/\/ml/)[/code]
instead of
[code]strength.match('\/ml')[/code]
Also you don't have to use square brackets for referencing a property of an object, so you can just do
[code]toastr.error("error message here")[/code][/QUOTE]
I got it but I haven't had the chance to try it out yet.
Anybody familiar with setting up javascript in a rails app? I'm using react-rails to be able to render components and it works perfectly, but i really need to set up react test utils and be able to test stuff. The project has teaspoon and jasmine configured, but I want to write tests in es6 and use react test tools to do rendering and what not.
Anybody have experience with this and can explain how they did it?
[QUOTE=djjkxbox;52667816]Did you get my PM? The match takes RegExp which is different from a string in JavaScript, so you'd do
[code]strength.match(/\/ml/)[/code]
instead of
[code]strength.match('\/ml')
[/code][/QUOTE]
Very very minor detail but for simple strings [code] haystack.indexOf("needle") > -1[/code] is faster than [code] haystack.match(/needle/) [/code].
So now on my PyQt software for this project, I'm suddenly getting random "MySQL Server has gone away" and "This session is in a prepared state" errors. I have no idea.
[editline]14th September 2017[/editline]
And transactions are incredibly slow now. I've already restarted the server and confirmed that there were no zombie connections.
I'm fucking baffled.
[editline]14th September 2017[/editline]
Just kidding I figured it out. One of the windows is supposed to refresh the table in the main window upon exiting so that changes made are reflected there. I had another instance of the main window being created instead of the global one being passed to the refresh function. I guess it was opening up two simultaneous duplicate sessions to the database.
How can I secure the details to my MySQL server in a C# .Net application so that they can't be found by decompiling it?
[QUOTE=cpone;52686739]How can I secure the details to my MySQL server in a C# .Net application so that they can't be found by decompiling it?[/QUOTE]
Don't even use a direct database connection in any client software. Use a Backend Server which handles database connections and provides some kind of interface (e.g HTTP API) to the client.
Storing DB credentials client side can be a huge security risk, like the super meatboy devs already proofed :v:
[QUOTE=johnnyaka;52686905]Don't even use a direct database connection in any client software. Use a Backend Server which handles database connections and provides some kind of interface (e.g HTTP API) to the client.
Storing DB credentials client side can be a huge security risk, like the super meatboy devs already proofed :v:[/QUOTE]
So create some kind of software that runs on the server that takes in the data from the client and passes it to the database sort of like a middle man kind of thing.
[QUOTE=cpone;52686939]So create some kind of software that runs on the server that takes in the data from the client and passes it to the database sort of like a middle man kind of thing.[/QUOTE]
Yeah, it's effectively impossible to keep them secure if they're sent to clients. You're pretty much relying on obscurity or encryption which will be broken sooner or later, neither of which are at all reliable.
I'm looking to spoof/simulate/emulate a gamepad/joystick/controller in Windows. Is there any user space way to do it, or do I need a proper driver?
[QUOTE=Quiet;52688678]I'm looking to spoof/simulate/emulate a gamepad/joystick/controller in Windows. Is there any user space way to do it, or do I need a proper driver?[/QUOTE]
If you want to create a fake device where no device exists at the moment, I believe you need a driver
If you want to send fake keyboard inputs, I believe you can just simulate keypresses directly
[QUOTE=Icedshot;52688887]If you want to create a fake device where no device exists at the moment, I believe you need a driver
If you want to send fake keyboard inputs, I believe you can just simulate keypresses directly[/QUOTE]
It does need to be a dinput or xinput device, keyboard won't do. I was hoping there might be some obscure winapi way to do it, but I guess not. Thank you though, I'll look into some libraries that would help me out with this.
[QUOTE=Quiet;52688969]It does need to be a dinput or xinput device, keyboard won't do. I was hoping there might be some obscure winapi way to do it, but I guess not. Thank you though, I'll look into some libraries that would help me out with this.[/QUOTE]
Hey i had the same idea this week, i am going to research this and report back here.
[editline]17th September 2017[/editline]
Don't give up just yet.
Not exactly sure if this belongs here, as its not technically programming per say, and is more related to file headers
So I'm testing new features in a gmod addon, the exact part of the addon is here [url]https://github.com/CapsAdmin/pac3/blob/decdd6dbfc08ee4b5b2f8caf69a1427f9c65bc8a/lua/pac3/core/shared/util.lua[/url]
Theres a part of it that calls to custom zip files specified by the user
[QUOTE]if sig == 0x02014b50 then break end
assert(sig == 0x04034b50, "bad zip signature (file is not a zip?)")[/QUOTE]
The problem I'm having is that my header for my custom zip is not what it expects to get, so it tells me it has a bad zip signature
I have no coding experience, and I'm more or less blind at this point. Are there any archival tools that archive with 0x02014b50? I've also read that I can fix it with a hex editor, but I dont even know where to begin there
Maybe someone can help me with this c# and Unity.
I have an empty game object that creates a Planet for me. The Debug.Log shows that the randomResources are getting added to the PlanetResources List.
Planet Generator:
[CODE]private void GenerateFirstPlanets()
{
BaseResource randomResource = new BaseResource();
Vector3 planetPosition = new Vector3();
planetPosition.x = 5;
planetPosition.y = 5;
planetPosition.z = -25;
GameObject planet = (GameObject)Resources.Load("Planet");
planet.GetComponent<PlanetInfo>().PlanetName = "My First Planet";
planet.GetComponent<PlanetInfo>().PlanetDescription = "A Planet";
for (int i = 0; i <= 2; i++)
{
int random = Random.Range(0, 1);
randomResource = AllResources[random];
randomResource.ResourceQuality = "Poor";
planet.GetComponent<PlanetInfo>().PlanetResources.Add(randomResource);
Debug.Log(planet.GetComponent<PlanetInfo>().PlanetResources.Count);
Debug.Log(planet.GetComponent<PlanetInfo>().PlanetResources[0].ResourceName);
}
Instantiate(planet, planetPosition, Quaternion.identity);
}[/CODE]
I store the name, description and what resources it has in a PlanetInfo script attached to the Planet prefab.
PlanetInfo:
[CODE]public class PlanetInfo : MonoBehaviour {
public string PlanetName;
public string PlanetDescription;
public List<BaseResource> PlanetResources = new List<BaseResource>();
}[/CODE]
It is storing the name and description fine but the list of resources in PlanetInfo.PlanetResources keeps coming up empty.
I am no expert (at anything) but aren't you emptying and re-creating empty PlanetResources array every time you call PlanetInfo?
I would assume you need to store it array of planets as a global array?
(just a thought)
[QUOTE=cartman300;52689709]Hey i had the same idea this week, i am going to research this and report back here.
[editline]17th September 2017[/editline]
Don't give up just yet.[/QUOTE]
I checked out vJoy, and so far it has been fulfilling my needs: up to 16 virtual gamepads, which can be acquired and fed by a user space program.
I want to create a a program to fetch information from 2 different website and compare them. I consider myself php-developer, but I feel like this would be a job for C# or Java. Any ideas?
[QUOTE=arleitiss;52692802]I am no expert (at anything) [/QUOTE]
Same here. I know it is something wrong I am doing c# wise. I want to store all of the relevant data on the planet itself.
I have still been struggling with it with no solution. It has to be something simple I am missing.
[QUOTE=koppel;52693246]I want to create a a program to fetch information from 2 different website and compare them. I consider myself php-developer, but I feel like this would be a job for C# or Java. Any ideas?[/QUOTE]
Any language can do that. Depends whether you want desktop software, a simple script, a webpage, etc.
Sorry, you need to Log In to post a reply to this thread.