public void Handle(SomethingCreatedEvent e)
{
if (e.ActCode == "SOME_VALUE")
{
return;
}
else
{
// insert real function body here
}
}
// Method put on each input component to unregister
// itself from the form
detachFromForm: function detachFromForm(component) {
var componentPos = this.inputs.indexOf(component);
if (componentPos !== -1) {
this.inputs = this.inputs.slice(0, componentPos).concat(this.inputs.slice(componentPos + 1));
}
this.validateForm();
},
oh boy
/// <summary>
/// Method that checks if an object is not null
/// </summary>
/// <param name="obj">extend type of <see cref="Object"/></param>
/// <returns>true if object is not null</returns>
public static bool NotNull(this Object obj)
{
return obj != null;
}
[TestMethod]
public void Test_Something()
{
// test
var result = DoSomething();
// assert
Assert.IsTrue(result.NotNull());
}
try {
User.ClaimToken();
}
catch {
User.ClaimToken();
}
guard let reachability = Reachability(), reachability.isReachable == true else {
// No network connection available. Do stuff.
...
}
While this works, it's not immediately readable and creates confusion. Mis-using Swift's control flow. Did not pass code review.
@Override
public void afterTextChanged(Editable s) {
switch (paymentType) {
case 0:
if (s.length() == 9) etPaymentAmount.requestFocus();
break;
case 1:
if (s.length() == 9) etPaymentAmount.requestFocus();
break;
}
}
val weekEnd = DateTime.now.withDayOfWeek(5).plusDays(2)
try{
//...
getMyDataFromServer();
//...
}catch(Excepion e){
// :D
}
HMM FIXED BUG!
int i=0;
for (i=0; i<msg.length;i++){
switch (i){
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 18:
case 19:
case 26:
case 27:
case 34:
case 35:
case 42:
case 43:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 58:
case 59:
case 62:
case 63: log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + " " + new String(msg,i,1, "UTF-16LE")); break;
case 12:
case 14:
case 16:
case 20:
case 22:
case 24:
case 28:
case 30:
case 32:
case 36:
case 38:
case 40:
case 44:
case 46:
case 48:
case 56:
case 60:log.debug("******** TRAZA-BEA: autenticacion ntlm. mensaje[" + i + "]: " + msg[i] + " SINSIGNO: " + (int)(msg[i] & 0x00ff) + " " + new String(msg,i,2, "UTF-16LE")); break;
case 13:
case 15:
case 17:
case 21:
case 23:
case 25:
case 29:
case 31:
case 33:
case 37:
case 39:
case 41:
case 45:
case 47:
case 49:
case 57:
Why not case 60? LOL
Select * from Order --doesn't work
select * from [order] --works
--it's planning module in our system...
I think, it's really bad idea to use reserved words in names of tables. I'm surprised, that this db doesn't contain table named like [select]...
$url = 'https://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20html%20where%20url%3D%22https%3A%2F%2Fwww.google.com%2Ffinance%3Fq%3D' . $stock_identifier . '%26fstype%3Dii%26ei%3DCFrdWImFNdiGe_atlegC%22%20and%20compat%3D%22html5%22%20and%20xpath%3D' . "'%2F%2Ftable%5Bcontains(%40class%2C%22gf-table%20rgt%22)%5D'" . '&format=json&diagnostics=true&callback=';
$json = json_decode($this->getJsonFromYql($url), true);
$json = $json["query"]["results"]["table"];
//If the value is red, that means there is an additional span class which needs to be checked through.
$response["revanueValue"] = empty($json["1"]["tbody"]["tr"]["0"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["0"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["0"]["td"]["1"]["content"];
$response["costofRevanue"] = $json["1"]["tbody"]["tr"]["3"]["td"]["1"]["content"];
$response["operatingIncome"] = empty($json["1"]["tbody"]["tr"]["12"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["12"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["12"]["td"]["1"]["content"];
$response["netIncome"] = empty($json["1"]["tbody"]["tr"]["24"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["24"]["td"]["1"]["span"]["content"] : $json["0"]["tbody"]["tr"]["24"]["td"]["1"]["content"];
$response["dividendsPerShare"] = $json["1"]["tbody"]["tr"]["35"]["td"]["1"]["content"];
$response["dilutedNormalizedEps"] = empty($json["1"]["tbody"]["tr"]["48"]["td"]["1"]["content"]) ? $json["1"]["tbody"]["tr"]["48"]["td"]["1"]["span"]["content"] : $json["1"]["tbody"]["tr"]["48"]["td"]["1"]["content"];
$response["minorityInterest"] = $json["1"]["tbody"]["tr"]["18"]["td"]["1"]["content"];
Website --> Json --> PHP Parsing Beautiful.
{k: v for d in [{ key: { 0: x[0], } for key in x["name"] } for x in items] for k, v in d.items()}
http://localhost:52108/Trade/Details/1953452?class=pull-left
class {
public State state;
//enums cant take double values...
public struct State
{
public const float IDLE = 0f;
public const float WALKING = 0.5f;
public const float RUNNING = 1f;
}
protected void Stop()
{
SetSpeed(State.IDLE);
}
protected void SetSpeed(float f)
{
agent.speed = f;
if (agent.speed > 1f && agent.speed < 5f)
{
f = State.WALKING;
agent.Resume();
}
else if (agent.speed > 5f)
{
f = State.RUNNING;
agent.Resume();
}
else
{
f = State.IDLE;
agent.Stop();
}
}
}
Who needs static float
when you can have a constant in a nested struct, as a bonus State state
has 0 references in the project
case ClientMessage:
if (*XGetAtomName(GLWin.dpy, event.xclient.message_type)
== *"WM_PROTOCOLS")
{ printf("Exiting sanely...\n");
done = True;
}
break;
someone just want to watch the world burn