text:
Q: WordPress Customizer Additional CSS - line numbers overlaps CSS code On one of my sites the Additional CSS in customizer is difficult to work with because the left margins are hiding the left side of the CSS code window behind the line numbers. I tried adding some styles for the admin in functions.php (I already use a couple of other styles), but they don't have any effect on this.
Here is the code I am using (I tried a few things):
add_action('admin_head', 'my_admin_styles');
function my_admin_styles() {
echo '<style>
#adminmenu div.separator {
 height: 2px;
 padding: 0;
 width:90%; margin-right:auto; margin-left:auto;
 border-top: 1px solid #CCC; }
#recipe_notes-tmce {display:none; }
.rwmb-input input {width:100%; }
.CodeMirror-sizer { margin-left: 50px !important; }
.CodeMirror-line  {padding-left:20px !important; }
</style>';
}

The last two are what I am using to fix the overlap, but they don't show up when I inspect code - the others ones work as expected and show up in inspect code.
Any advice? Do you think it might be a conflict?
Thanks!

A: Instead of doing it that way I found a code snippet to add a new css file. Here is the new code:
function add_my_customizer_styles() {
wp_enqueue_style( 'my-customizer-css', trailingslashit( get_stylesheet_directory_uri() ).'assets/styles/customizer.css', null );
}
add_action( 'customize_controls_print_styles', 'add_my_customizer_styles', 99 );

That is working fine. Evidently, while the previous code works for some areas of the admin it didn't work for the Customizer. This way I was able to make the customizer wider, too, which I've always wanted to do, by adding this additional CSS:
.wp-full-overlay-sidebar { width: 400px; }
.wp-full-overlay.expanded {margin-left: 400px; }

Problem solved!

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why can I work around TypeScript's object literal assignment constraint with a temp variable? Simple code example:
type Foo = { foo: string };
type FooBar = { foo: string; bar: number };

let a: Foo;

// Doesn't work
a = { foo: 'x', bar: 1 };
/*
 Type '{ foo: string; bar: number; }' is not assignable to type 'Foo'.
  Object literal may only specify known properties, and 'bar' does not exist in type 'Foo'.
*/

// However this works: (temp variable with implicit type)
let b = { foo: 'x', bar: 1 }; // According to VSCode the inferred type for `b` is exactly `{ foo: string; bar: number; }`
a = b;

// This also works: (temp variable with explicit type)
let c: FooBar = { foo: 'x', bar: 1 };
a = c;

This is very surprising to me. What I'd expect is an error in all three cases. I really like this idea of "Object literal may only specify known properties".
#1 Why is this happening?
#2 How can I configure TypeScript to not allow this "workaround"?

A: This is not workaround, but how type compatibility defined in typescript:

The basic rule for TypeScript's structural type system is that x is compatible with y if y has at least the same members as x

Now why first example (let a: Foo = { foo: 'x', bar: 1 }) errors? This is called excess property checks:

Object literals get special treatment and undergo excess property checking when assigning them to other variables, or passing them as arguments. If an object literal has any properties that the "target type" doesn't have, you'll get an error

How can I configure TypeScript to not allow this "workaround"? This is not possible currently. You can find old discussion on exact types here, but I doubt it will make to typescript in near future.


text:
Q: which platform does not support "socket.getpeername"-python I am trying to use getpeername() to get peer port. In my setup ubuntu 16.04 it works well.
peer_port = res.raw._connection.sock.getpeername()[1]

but from the doc https://docs.python.org/3/library/socket.html#socket.socket.getpeername
some platform does not support. Do we know which specific platform do not support? I searched but no luck, out products can be in multiple platforms


text:
Q: Magento EE 1.12 & SOLR integration issue I am trying to integrate apache solr with magento enterprise edition version 1.12. Magento 1.12 by default supports solr upto version 3.5. I have tried it with version 3.4, 3.5, 3.6 but i am getting this same error on all versions of SOLR.
Aug 12, 2014 8:57:28 PM org.apache.solr.handler.component.SpellCheckComponent$SpellCheckerListener newSearcher
INFO: Index is not optimized therefore skipping building spell check index for: magento_spell_en
The complete log is similar to: http://pastie.org/pastes/8154512
I am unable to debug the issue as i am unware of core working of SOLR.
Kindly help.


text:
Q: mysql datetime field I'm parsing a feed that contains a "created at" entry, formatted like this:
Thu, 08 Oct 2009 23:01:33 +0000

I need to be able to store this in a MySQL table, in a DateTime datatype. Then, I want to  select rows WHERE datetime clause equals or in range between dates and/or times.
I have two questions:

*

*Will this string be acceptable as a MySQL DateTime datatype?

*If yes, which query should I construct to get results from and between dates or hours?

A: You can find STR_TO_DATE function usefull for date parsing in mysql.
mysql> SELECT STR_TO_DATE('Thu, 08 Oct 2009 23:01:33 +0000', '%a, %d %b %Y %H:%i:%s +0000');
    -> '2009-10-08 23:01:33'

Available formats are the same as for DATE_FORMAT

A: MySQL will accept a string as a date in the following format
YYYY-MM-DD HH:MM:SS

SELECT * FROM tbl WHERE datestamp = '2009-10-08 23:01:33';

A: You could do something along these lines (in your language of choice) to turn your string into an acceptable mysql datetime:
$inputdate = "Thu, 08 Oct 2009 23:01:33 +0000";
$unixdate = strtotime($inputdate); //output: 1255042893
$datetime = date("Y-m-d H:i:s", $unixdate); //output: 2009-10-08 23:01:33

There are a few ways to find records between two dates, this is my favourite:
SELECT * FROM table WHERE date >= '2009-07-01 00:00:00' and date <= '2009-10-31 23:59:59'

A: select * from table where date1 between date2 and date3;


text:
Q: How to convert Unicode to char I would like to get the Unicode character corresponding to the input int. You can assume that input int can be represented as char in Java.

A: tl;dr
Character.toString( 65 )

A

Character.toString( codePoint )
You said:

I would like to get the unicode character corresponding to the input int

String character = Character.toString( codePoint ) ;

See these examples run live at IdeOne.com:
System.out.println( Character.toString( 65 ) ) ;               // "A"

A

String faceWithMedicalMask = Character.toString( 128_567 ) ;  // "" = FACE WITH MEDICAL MASK.
System.out.println( FaceWithMedicalMask ) ;

Not all code points are assigned to encoded characters. Check that your input integer is indeed a valid code point.
int codePoint = 128_567 ;
String faceWithMedicalMask = null ;
if( Character.isValidCodePoint( codePoint ) ) {
    faceWithMedicalMask = Character.toString( codePoint ) ;
} else {
    … deal with invalid code point
}

Avoid char & Character types
You said:

You can assume that input int can be represented as char in java.

No, you cannot assume that.
Most of the over 140,000 characters defined in Unicode, and supported by Java, cannot be represented by the char type. As a 16-bit value, a char is physically incapable.
The char type has been essentially broken since Java 2, supplanted by code point support added in Java 5+.
Casting int to char
If you insist on using char, against my recommendation, then know that you can cast an int number into a char value.
char c = (char) 66 ;
System.out.println( c ) ;

B

BEWARE: This only works for code points in the range of 0 to 65,535. Most Unicode characters have code points beyond that range, going up to 1,114,111.
That 0 to 65,535 range is known in Unicode as the Basic Multilingual Plane (BMP). Java provides a method to test for this range, Character.isBmpCodePoint(int codePoint). You can check before your cast:
if( Character.isBmpCodePoint( codePoint ) ) {
    char c = (char) 66 ;
} else {
    … deal with input out of range
}

Not all code points are assigned to encoded characters. Check that your input integer is indeed a valid code point.
if( Character.isBmpCodePoint( codePoint ) ) {
    if( Character.isValidCodePoint( codePoint ) ) {
        char c = (char) 66 ;
    } else {
        … deal with invalid code point
    }
} else {
    … deal with input out of range
}


text:
Q: Reference current file name Is there a way to get a current source file name in Go? And for instrance fmt.Println it. (Like you could do in C with __FILE__ macro.)
That's for debugging purpose, obviously.

A: runtime.Caller(0) should return a few items, one of them being the file name of the function it was called from.
The parameter indicates the depth of functions to skip in case you want to abstract this functionality to a separate function but want to get the file name of where it's called from.

A: For debugging, use the log package and enable the log.Lshortfile or log.Llongfile flag:
package main

import (
    "log"
    "os"
)

func main() {
    shortLogger := log.New(os.Stdout, "", log.LstdFlags|log.Lshortfile)
    shortLogger.Println("short")

    longLogger := log.New(os.Stdout, "", log.LstdFlags|log.Llongfile)
    longLogger.Println("long")
}

// 2009/11/10 23:00:00 main.go:10: short
// 2009/11/10 23:00:00 /tmp/sandbox813987715/main.go:13: long

https://play.golang.org/p/2X7IeJHSmk


text:
Q: What times what equals something? I wanted to find x times y equals to z, where z can be anything (Full number).
What I wanted :
I can say, I want to find what x times y equals to 65.
The answer is 13 times 5.
Now, I wanted that 65 or z to be anything.
I've found this site : https://researchmaniacs.com/Calculate/WhatTimesWhat/What-Times-What-Equals.html which does exactly that but unfortunately it only allows up to 5 digits number and the mechanics on how it works was not shown.


text:
Q: How to get total annual sales In my ASP.NET Core 6 Web API, I have used the code below to calculate Total Annual Sales (from Transactions):
private async Task<decimal> GetAllTotalMonthlyTransactions()
{
    string transactionMonth = DateTime.Now.ToString("MM");
    decimal totalMonthlyTransactions = 0;

    var sales = await _dbContext.Sales.ToListAsync();

    foreach (var item in sales)
    {
        var salesDate = item.CreatedAt.ToString();
        var salesMonth = salesDate.Substring(3, 2);

        if (transactionMonth == salesMonth)
        {
            totalMonthlyTransactions += item.Amount;
        }
    }

    return totalMonthlyTransactions;
}

How to I re-write the code above to get TotalAnnualSales (Transactions)?

A: private async Task<decimal> GetAllTotalMonthlyTransactions()
{
    int currentYear  = DateTime.Now.Year;

    return (await dbContext.Sales.Where(t=>t.CreatedAt.Year==currentYear).ToListAsync()).Sum(item=>item.Amount);

}

A: Instead of converting the datetimes to strings, try accessing them as ints. You can do this with .Month or .Year respectively

A: You can try to calculate from and to date range based on a specified month, then query/filter sales data with these from and to date range, like below.
var date1 = DateTime.Now;
var days = DateTime.DaysInMonth(date1.Year, date1.Month);

var from = new DateTime(date1.Year, date1.Month, 1, 0, 0, 0);
var to = new DateTime(date1.Year, date1.Month, days, 23, 59, 59);

var totalMonthlyTransactions = sales.AsEnumerable().Where(s => s.CreatedAt >= from && s.CreatedAt <= to).Select(s => s.Amount).Sum();

A: I hope following code will work for you...
private async Task<IEnumerable<object>> GetMonthlyTransactions(int year)
    {
        var starting = new DateTime(year, 1, 1).Date;
        var sales = await context.Sales.Where(f => f.SalesDate >= starting).Select(s => new
        {
            Date = s.SalesDate.ToString("MM-yyyy"),
            Amount = s.NetAmount
        }).ToListAsync();
        var finaldata = sales.GroupBy(s => s.Date, (d, a) => new { Date = d, Am = a }).Select(l => new
        {
            Date = l.Date,
            Amount = l.Am.Sum(h => h.Amount)
        });
        return finaldata;

    }

A: private async Task<decimal> GetAllTotalMonthlyTransactions()
{
    decimal totalAnnualTransactions = 0;

    int _year  = DateTime.Now.Year;
    var sales = await dbContext.Sales.Where(y=>y.CreatedAt.Year==_year).ToListAsync();

    // The first method
    foreach (var item in sales)
    {
         totalAnnualTransactions += item.Amount;
    }

    // The second method
    //double totalAnnualTransactions= sales.Sum(item => item.Amount);

    return totalAnnualTransactions;
}


text:
Q: Using a returned value from one class function to another [Python] I was working on a project with Python NLTK and had some issues with the joiner() function being unable to retrieve a return value from another function within the same class, named open_file(). Was wondering how exactly the return function should work in this context and how I can fix this. Thanks everyone!
Code:
import nltk

nltk.download('wordnet')
from nltk.corpus import wordnet as wn

class Sentence:

    def open_file(self):
        file_vals = []
        i = 0
        with open("words.txt", "r") as my_file:
            for line in my_file:
                if i < 20:
                    stripped_line = line.strip()
                    file_vals.append(stripped_line)
                    i += 1
                else:
                    print(file_vals)
                    return file_vals

    def joiner(self, file_vals):
        val_1 = wn.synsets(file_vals[0])[0].pos()
        val_2 = wn.synsets(file_vals[1])[0].pos()

        if val_1 == "n" and val_2 == "v":
            print(val_1.capitalize() + " " + val_2 + ".")

my_obj = Sentence()
my_obj.open_file()
my_obj.joiner()

A: Just to note that you did not include the error message.
However, the apparent problem with your code is that methods defined in a class do not execute until the class is instantiated and the method called. This is why you cannot pass a value from one method to another inside an un-instantiated class. One way to achieve what I believe you want to do is:
This is assuming that all other parts of your code do not contain errors. Also, I did not try to run your code.
import nltk

nltk.download('wordnet')
from nltk.corpus import wordnet as wn

class Sentence:

    def open_file(self):
        file_vals = []
        i = 0
        with open("words.txt", "r") as my_file:
            for line in my_file:
                if i < 20:
                    stripped_line = line.strip()
                    file_vals.append(stripped_line)
                    i += 1
                else:
                    print(file_vals)
                    return file_vals

    def joiner(self, file_vals):
        val_1 = wn.synsets(file_vals[0])[0].pos()
        val_2 = wn.synsets(file_vals[1])[0].pos()

        if val_1 == "n" and val_2 == "v":
            print(val_1.capitalize() + " " + val_2 + ".")

my_obj = Sentence()
file_vals = my_obj.open_file()
my_obj.joiner(file_vals)

You have to first save the value returned by the 'open_file' method and then pass the returned value to 'joiner' as an argument.

A: The way you calling joiner() function is incorrect. Since the open_file() fucntion return variable file_vals and joiner() function as you defined is required file_vals as its argument, so you should pass the return result of open_file() function to joiner() function, for example:
my_obj = Sentence()
my_obj.joiner(my_obj.open_file())


text:
Q: Lots of H17 Heroku Errors I am working on a ruby project using sinatra, heroku, activerecord, and postgresql. I am consistantly getting this error:
2015-06-10T19:30:52.015492+00:00 heroku[router]: http_error="Invalid HTTP status line" at=error code=H17 desc="Poorly formatted HTTP response" method=POST path="/login" host=myapp.herokuapp.com request_id=e5c29131-1c22-47d7-84a4-b1b51e4a3905 fwd="74.71.233.85" dyno=web.1 connect=1ms service=135ms status=503 bytes=862

I cannot find out how to fix it. If anyone needs any more information to fix it, I would be happy to provide it.

A: I solved my problem by just making some other irrelevant edits and pushing to heroku again which caused a dyno restart which is what I believe solved the problem. Now it works just fine. If anyone can come up with an explanation for this that would be much appreciated.
And if it could be added as an answer it would be accepted! I find this very weird.

A: In my case this was happening with a POST request to which my dyno was not returning a response code. It was fixed by returning a valid response code, such as 200. For example:
post '/user/:user_id/favourites/:item_id' do

  [add the favourite, and if successful...]

  200

end


text:
Q: Loading appointments to a non-default Outlook calendar from Excel I have a project to put employees leave schedules into a shared or global calendar.
The appointments save to my default calendar.
I have tried a few different approaches. This is the current approach:
Sub Create_Outlook_2()
' Create the Outlook session

Dim oApp As Object
Dim oNameSpace As Namespace
Dim oFolder As Object
Dim myApt As AppointmentItem

Set oApp = New Outlook.Application
Set oNameSpace = oApp.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetFolderFromID("000000007CF129E6C6BAA74F9B2AB399FABB280E01006EC36FFC70429B4EAE1875321A4609670078C4FA00320000").Items.Add(olAppointmentItem)

With oFolder
'    Set myOutlook = CreateObject("Outlook.Application")
'    ' Set data collection to take from "Leave Table" sheet
    Dim wsSrc As Worksheet
    Set wsSrc = Sheets("Leave Table")
    ' Start looping at row 3 (first two rows are for readability)
    r = 3
    ' Do/while set condition
    Do Until Trim(wsSrc.Cells(r, 1).Value) = ""
        ' Create event item
        Set myApt = oApp.CreateItem(1)
        ' Set the event properties
        ' Set Subject line of event
        With myApt
            .Subject = "Time Off " & wsSrc.Cells(r, 1).Value & " " & wsSrc.Cells(r, 2).Value
           ' Set start time
            .Start = DateValue(wsSrc.Cells(r, 3)) + wsSrc.Cells(r, 8).Value
           ' Set end time
            .End = DateValue(wsSrc.Cells(r, 3)) + wsSrc.Cells(r, 9).Value
           ' Turn reminders off
            .ReminderSet = False
           ' Set busy status to free
            .BusyStatus = 0
           ' Have the body of the event read as the decription from the leave form in Viewpoint
            .Body = wsSrc.Cells(r, 4).Value
           ' Save event in owners calendar
            .Save

        End With
       ' Move to next row
        r = r + 1
       ' Repeat do/while loop until condition is no longer valid
    Loop

End With
End Sub

A: I figured it out:
Sub Create_Outlook_2()

    Dim oApp As Object
    Dim oNameSpace As Namespace
    Dim oFolder As Object
    Dim wsSrc As Worksheet
    Set wsSrc = Sheets("Leave Table")
    ' Start looping at row 3 (first two rows are for readability)
    r = 3
    ' Do/while set condition
    Do Until Trim(wsSrc.Cells(r, 1).Value) = ""

        ' Create the Outlook session
        Set oApp = New Outlook.Application
        ' Set the namespace
        Set oNameSpace = oApp.GetNamespace("MAPI")
        ' Set the folder the appointment will be created in.
        Set oFolder = oNameSpace.GetFolderFromID("Folder ID Number").Items.Add(olAppointmentItem)

        ' Set with block for the appointment configuration loop
        With oFolder
           ' Set Subject line of event
            .Subject = wsSrc.Cells(r, 1).Value & " " & wsSrc.Cells(r, 2).Value
           ' Set start time
            .Start = DateValue(wsSrc.Cells(r, 3)) + wsSrc.Cells(r, 8).Value
           ' Set end time
            .End = DateValue(wsSrc.Cells(r, 3)) + wsSrc.Cells(r, 9).Value
           ' Turn reminders off
            .ReminderSet = False
           ' Set busy status to free
            .BusyStatus = 0
           ' Have the body of the event read as the decription from the leave form in Viewpoint
            .Body = wsSrc.Cells(r, 4).Value
           ' Save event in owners calendar
            .Save
           ' End with block
        End With
       ' Move to next row
        r = r + 1
       ' Repeat do/while loop until condition is no longer valid
    Loop

End Sub

To get Folder ID #:
With the calendar you want to create appointments in selected (open it in a new window for good measure), press F11 to bring up Outlook macros and run the following code under "ThisOutlookSession":
Private Sub GetOutlookFolderID()
     'Determines the Folder ID of Folder
    Dim olfolder As Outlook.MAPIFolder
    Dim olapp As Outlook.Application
    Set olapp = CreateObject("Outlook.Application")
    Set olfolder = olapp.GetNamespace("MAPI").PickFolder
    olfolder.Display
    MsgBox (olfolder.EntryID)
    Set olfolder = Nothing
    Set olapp = Nothing
End Sub

Sample spreadsheet - with fake names:

A: There's an additional way to access the folder instead of getting the ID:
    Set oFolder = oNameSpace.Folders.Item("account address").Folders.Item("Calendar").Items.Add(olAppointmentItem)

Where "account address" is the email address of the account
Additionally, I'm working with multiple outlook.com calendars and found that you can do the following to access one of the non-default calendars:
Set oFolder = oNameSpace.Folders.Item("account address").Folders.Item("Calendar").Folders.Item("Other calendar name").Items.Add(olAppointmentItem)

Couldn't have done any of this without your post, Joshua.  Thanks!

A: If you want to create an appointment in Outlook, using Excel, run the script below.
Private Sub Add_Appointments_To_Outlook_Calendar()

    'Include Microsoft Outlook nn.nn Object Library from Tools -> References
    Dim oAppt As AppointmentItem
    Dim Remind_Time As Double

    i = 2
    Subj = ThisWorkbook.Sheets(1).Cells(i, 1)

    'Loop through entire list of Reminders to be added
    While Subj <> ""
        Set oAppt = Outlook.Application.CreateItem(olAppointmentItem)

        oAppt.Subject = Subj
        oAppt.Location = ThisWorkbook.Sheets(1).Cells(i, 2)
        oAppt.Start = ThisWorkbook.Sheets(1).Cells(i, 3)
        Remind_Time = ThisWorkbook.Sheets(1).Cells(i, 4) * 1 * 60
        oAppt.ReminderMinutesBeforeStart = Remind_Time
        oAppt.AllDayEvent = True
        oAppt.Save

        i = i + 1
        Subj = ThisWorkbook.Sheets(1).Cells(i, 1)
    Wend
    MsgBox "Reminder(s) Added To Outlook Calendar"

End Sub

' The code comes from this link:
 http://officetricks.com/add-appointment-to-outlook-calendar-through-excel-macro-vba/
The script is run from Excel, and as such, you must set a reference to Outlook before you run the code.  Also, notice that the worksheet needs to be setup properly for the script to run.  It should look something like this.  Everything is read from Excel into Outlook.

A: I had to find out a method to grasp the offered number by the GetOutlookFolderID-Sub, which is quite big. The solution proved to be very simple:

*

*Open in your VBE the Direct window.

*Replace in Private Sub GetOutlookFolderID() the line: MsgBox (olfolder.EntryID)
by the line: Debug.Print olfolder.EntryID
and simply copy the number from the Direct window into the Set olfolder-statement.


text:
Q: Load non precision data onto InfluxDB Issue: I am unable to load data onto Influx DB from files that is non precise.
Error Code: ValueError: Invalid time precision is given.
But my time is batch data is generated randomly without a precision. So its not letting me load the data onto the DB. I am using python and DataFrameClient in InfluxDB clients.
client.write_points(df,"TEST",'m')
my DF structure is [Timestamp,Tag,Value]


text:
Q: sqlcipher - how safe is sqlcipher? has it been hacked? It encrypts the SQLLite database at page level, ok thats fine, nothing wrong with that!
but what about your source code? its compiled, but even if its compiled someone could decompile it, retrieve your password and decrypt the database?

A: How safe is SQLCipher?
According to the SQLCipher design documentation, it is based on secure components (AES, OpenSSL, HMAC_SHA1, PBKDF2,...). If those claims are correct, it sounds good to me.
What is a bit unusual (to me, at least) is that there is a random IV per page. This is somewhat different to the typical file system encryption mode AES-XTS. The design used by SQLCipher has certain advantages over AES-XTS, for example writing the same data again will not result in the same encrypted page. However, possibly there are disadvantages, for example I'm not quite sure if with SQLCipher it is possible to move or copy pages (copy encrypted pages to another page). It might not be possible, however from the design document I don't see how this is prevented. Such is the risk if a non-standard encryption mode is used :-) But even if this is a problem, it wouldn't allow an attacker to read the data; it would only allow certain types of attacks. Even with AES-XTS certain types of attacks are possible, so I wouldn't be worried too much.
What about your source code?
To keep things save, don't store the password in the code. Instead, let the user enter the password, or store it in a key-chain. This is possible for both Android and iOS as far as I see, but I don't know the details.


text:
Q: Disabling any possibility to exit a software? I am implementing university exam software in C++, and I want to prevent any person from the ability to close it once it runs. The purpose is to prevent the user from copying the software, printing the screen and saving it, and other purposes!
I was initially thinking about a way of disabling ctrl-alt-del, alt+F4, alt+tab, and other key combinations, but apparently following this approach is not that easy especially in versions after windows xp.
What do you think a viable approach to solve my problem ?

A: You should of course take all the normal steps of making your application refuse to close by itself (perhaps unless a password is provided), so we 're only talking about the "I don't want to allow anyone to forcefully close it" part.
One solution would be to make your app be the Windows shell.
Another solution would be to set up the computer such that the currently logged in user has no permission to shut your application down.
And a final solution, which is a dirty, not officially supported hack you didn't hear from me, is to do this:
public static class Utility
{
    [DllImport("ntdll.dll", SetLastError = true)]
    private static extern void RtlSetProcessIsCritical(UInt32 v1, UInt32 v2, UInt32 v3);

    public static void BsodIfProcessEnds()
    {
        Process.EnterDebugMode();
        RtlSetProcessIsCritical(1, 0, 0);
    }

    public static void NoFireworksIfProcessEnds()
    {
        RtlSetProcessIsCritical(0, 0, 0);
    }
}

Warning: BsodIfProcessEnds does exactly what it says on the tin.

A: Give users only a restricted user account on the machine, and don't give them permissions to kill your application.
Do the same for your other restrictions, and you don't even need to write an app.
If you want users to run as administrators, what you're asking for is impossible.

A: You might create two apps.
One is constantly checking if your app is running
If it is not running then start it, this could be a service (harder to spot for simple users).
You might do some fun with NTFS permission too.
For example create an upper directory where the user has no permissions at all (not even viewing its content) then create under that a folder where the user has read permissions.
Unless the user knows a good geus it becomes a bit harder to find your app.
But still he could launch taskmanager but perhaps there is a policy against that.
Speaking of which with policies you can make it so restricted that he is only allowed to run your app and not any other app (so he wont be able to copy it, or use the PC for anything else then your app.


text:
Q: Deploying docker container to heroku produces: nginx error related to privilidges As the title says, the error I am getting after deploying my app to Heroku and observing the logs:
nginx: [warn] the "user" directive makes sense only if the master process runs with super-user privileges, ignored in /etc/nginx/nginx.conf:2

My Dockerfile is:
#build stage
FROM node:14-alpine AS build
WORKDIR /usr/src/ssat-prep/client
ENV PATH /app/node_modules/.bin:$PATH
COPY . .
RUN yarn install --production && yarn build

#run and serve stage
FROM nginx:alpine
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /usr/src/ssat-prep/client/build /usr/share/nginx/html
EXPOSE 3000
CMD ["nginx", "-g", "daemon off;"]

My nginx.conf:
server {

  listen 3000;

  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
  }

  error_page   500 502 503 504  /50x.html;

  location = /50x.html {
    root   /usr/share/nginx/html;
  }

}

Please help me to deploy this app

A: Heroku supplies a port for this in the environment variable PORT, and expose in the Dockerfile does not work.
#build stage
FROM node:14-alpine AS build
WORKDIR /usr/src/ssat-prep/client
ENV PATH /app/node_modules/.bin:$PATH
COPY . .
RUN yarn install --production && yarn build

#run and serve stage
FROM nginx:alpine
COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=build /usr/src/ssat-prep/client/build /usr/share/nginx/html

CMD ["nginx", "-g", "daemon off;"]

server {

  listen $PORT;

  location / {
    root   /usr/share/nginx/html;
    index  index.html index.htm;
    try_files $uri $uri/ /index.html;
  }

  error_page   500 502 503 504  /50x.html;

  location = /50x.html {
    root   /usr/share/nginx/html;
  }

}


text:
Q: Jquery $.post not working on chrome but works in IE and FF The code snippet for the problem I am facing is:
//select the shipping country to display its shipping rate
  $('#country').change(function() {

     if($(this).val() == ""){
          $('#shippingRateDisplay').html('
No country selected.');
          return false;
        }
        alert("Before ajax start");
    $.post('ajax_utility/getShippingCostProdDtls/', { country_id: $(this).val(),
                                                      product_id: <?php echo $this->uri->segment(3); ?>,
                                                      current_currency: '<?php echo $product->currency->cur_id; ?>'}, function(data){   alert("Successful ajax, but chrome is not reaching here");

        if(data.status != 1){
              $('#shippingRateDisplay').html("Shipping rate not set for the specified country");
            }
        else{
            $("#shippingRateDisplay").html("");

            var conShip = '

'+
                                    '
'+
                                        ' Country of delivery	'+
                                        'Shipping cost	'+
                                        'Service used	'+
                                        'Estimated shipping time	'+
                                    '
'+
                                 '
';

            var shippingDtl = data.data.service_name == "Any Other" ? data.data.service_any:data.data.service_name;

            var tr = '
'+
                         ''+data.data.country_name+'	'+
                         'For one quantity
'+data.data.cost_1_qty+'	'+
                         'Each additional qty.
'+data.data.cost_many_qty+'	'+
                         ''+shippingDtl+'	'+
                         ''+data.data.shipping_time+' day(s)	'+
                      '
';

            $('#shippingRateDisplay').append(conShip);
            $('#shippingDetails').append(tr);
        }

        }, 'json');
    });
});

This code basically fetches the shipping details for the country selected in the drop down and displays it in a table. The table has two rows, the first row has the column headings(like country, rate, shipping type etc) and the second row display the shipping data returned from the server.
A more cleaner code if I remove the table header and row creation code would be:
 //select the shipping country to display its shipping rate
  $('#country').change(function() {

     if($(this).val() == ""){
          $('#shippingRateDisplay').html('
No country selected.');
          return false;
        }
        alert("Before ajax start");
    $.post('ajax_utility/getShippingCostProdDtls/', { country_id: $(this).val(),
                                                      product_id: <?php echo $this->uri->segment(3); ?>,
                                                      current_currency: '<?php echo $product->currency->cur_id; ?>'}, function(data){   alert("Successful ajax, but chrome is not reaching here");

        if(data.status != 1){
              $('#shippingRateDisplay').html("Shipping rate not set for the specified country");
            }
        else{
            $("#shippingRateDisplay").html("");

            var conShip = 'THE_TABLE_HEADER';

            var shippingDtl = data.data.service_name == "Any Other" ? data.data.service_any:data.data.service_name;

            var tr = 'THE SHIPPING ROW CREATED WITH THE JSON DATA';

            $('#shippingRateDisplay').append(conShip);
            $('#shippingDetails').append(tr);
        }

        }, 'json');
    });
});

One of general response from the server is:
{
   "data":{
      "id":"4e6a274043ca1",
      "product_id":"131315437838",
      "country":"60",
      "cost_1_qty":"$ 5.00 CAD",
      "cost_many_qty":"$ 5.00 CAD",
      "service_used":"7",
      "service_any":"",
      "shipping_time":"5",
      "country_name":"French Guiana",
      "service_name":"Express\/Expedited International Shipping"
   },
   "status":1

}
The issue with this code is it works fine in IE and FF but has strange behavior in Chrome.
The issue is , it worked fine for the first few times, then it could not. I restarted my machine and xampp, then again the same behavior, it displayed the shipping table for the first time when I selected a country from the drop down and from the second time it did not respond at all.
I check the chrome firebug debugger, the post request was successful and it returned a 200 ok response along with the json data. But it failed to fire the second alert, which means it did not enter the callback function(which is executed if the request succeeds).
Also just to mention I am not setting the content type for the response that is being returned from the server. SO its text/html.
The following are the request and response headers
ResponseHeaders
Date: Sun, 11 Mar 2012 14:48:34 GMT
X-Powered-By: PHP/5.2.1
Connection: Keep-Alive
Content-Length: 282
Pragma: no-cache
Last-Modified: Sun, 11 Mar 2012 14:48:34 GMT
Server: Apache/2.2.4 (Win32) DAV/2 mod_ssl/2.2.4 OpenSSL/0.9.8d mod_autoindex_color PHP/5.2.1
Content-Type: text/html
cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Keep-Alive: timeout=5, max=99
Expires: Thu, 19 Nov 1981 08:52:00 GMT

RequestHeaders
Content-Type: application/x-www-form-urlencoded
X-Requested-With: XMLHttpRequest
Accept: application/json, text/javascript, */*

Any help on why the call back function is not being executed, after the ajax call, and hence the shipping table not being displayed would be greatly helpful. Thank you.
UPDATE:
I updated the code to use $.ajax, below is my code:

$.ajax({
        type: "post",
        url: 'ajax_utility/getShippingCostProdDtls/',
        timeout : 5000,
        data: { country_id: $(this).val(),
                product_id: '<?php echo $this->uri->segment(3); ?>',
                current_currency: '<?php echo $product->currency->cur_id; ?>'},
        dataType: "json",
        success: displayShippingTable,
        error: AjaxFailed
      });
`
function AjaxFailed(result){
      alert("FAILED : " + result.status + ' ' + result.statusText);
      alert(result.responseText);
    //  displayShippingTable(result.responseText);
}

`
This works fine on Firefox and IE , but on chrome its stranger than before.
When I select or change a country in the shipping drop down, the console first says
POST ajax_utility/getShippingCostProdDtls/ 200 OK 108ms
then after 5 secs timeout it says
POST ajax_utility/getShippingCostProdDtls/ Aborted 108ms
Its then entering AjaxFailed function and is giving the alert FAILED : 200 OK
and the json data returned from the server
It would be wonderful if somebody can help me to understand what is happening over and under the hood. Thank you.

A: OK, finally I solved it myself. Well not exactly solved though.
One important thing I forgot to mention here was the application I was working on was using jquery 1.3.2. I thought well, lets use the latest jquery for this page so that I can try out the promise interface.
And when I re run the page by including the jquery jquery-1.7.1.min.js , the problem immediately disappeared. The shipping table was loading absolutely fine. So I guess its due to a bug or incompatibility between jquery version and the chrome. As such in my case upgrading the jquery version fixed the problem.


text:
Q: Create a Tables of signs and variations of function using tkz-tab package I have a serious problem to solve. I would like to make a function monotonicity in my latex doc and i write
\begin{tikzpicture}
\tikzset{arrow style/.style = {blue,
->,
> = latex',
shorten > = 6pt,
shorten < = 6pt}}
\tkzTabInit[espcl=5]{$x$ /1, $\ln x +1$ /1.5, $x \ln x$ /2}%
{$0$ ,$1/\E$ , $+\infty$}%
\tkzTabLine{d,-,z,+,}
\tkzTabVar%
{ D+/ / $0$ ,%
-/ \colorbox{black}{\textcolor{white}{$\dfrac{-1}{e}$}}/ ,%
+/ $+\infty$ / }%
\end{tikzpicture}

and it shows error. Is something with any package or some setting i have to to in the doc??

I sent you an exact example of what i try to do

A: Firstly it's preferable to give a complete example, then you need to define \E, you need to load amsmath.
\documentclass[11pt]{scrartcl}
\usepackage{tikz,tkz-tab,amsmath}
\usetikzlibrary{arrows}

\begin{document}
\newcommand{\E}{\mathrm{e}}
\begin{tikzpicture}
\tikzset{arrow style/.style = {blue,->,> = latex',
shorten > = 6pt,
shorten < = 6pt}}
\tkzTabInit[espcl=5]{$x$ /1, $\ln x +1$ /1.5, $x \ln x$ /2}{$0$ ,$1/\E$ , $+\infty$}%
\tkzTabLine{d,-,z,+,}
\tkzTabVar%
{ D+/ / $0$ ,%
-/ \colorbox{black}{\textcolor{white}{$\dfrac{-1}{e}$}}/ ,+/ $+\infty$ / }%
\end{tikzpicture}
\end{document}


text:
Q: Simple georeferenced 3D data format for building models I am looking for a simple georeferenced 3D-data format to store very simple building models. Each building should be represented as a number of poylgons, semantics do not matter. It would be ideal if this format is readable via ArcGIS, but that is not an absolute requirement.
I know there is GML/CityGML but I am looking for something simpler that ideally has either a JSON or XML serialization.

A: If you are looking for a XML based 3D model for buildings you may want to look at KML format. If you need the model to hold textures, then you will not be able to use KML, and will have to use a KMZ. SketchUp can hold textures and geographic coordinates, but it is not XML based.


text:
Q: How do I assign 9 columns specific colours of independent gradient on my heatmap? I have a file which contains the following snippet except with 3000 entries of different animals and blood type
FileA
Animal Bloodtype Count
Horse  Opos      10
Horse  Apos      5
Horse  Bpos      4
Horse  ABpos     5
Horse  Oneg      6
Horse  Aneg      7
Horse  Bneg      9
Horse  ABneg     10
Horse  Unknown   10
Cat    Opos      12
Cat    Apos      15
Cat    Bpos      14
Cat    ABpos     15
Cat    Oneg      16
Cat    Aneg      17
Cat    Bneg      19
Cat    ABneg     14
Cat    Unknown   14
Dog    Opos      9
Dog    Apos      23
Dog    Bpos      12
Dog    ABpos     42
Dog    Oneg      45
Dog    Aneg      23
Dog    Bneg      45
Dog    ABneg     32
Dog    Unknown   32
Mouse  Opos      3
Mouse  Apos      4
Mouse  Bpos      5
Mouse  ABpos     3
Mouse  Oneg      6
Mouse  Aneg      8
Mouse  Bneg      8
Mouse  ABneg     20
Mouse  Unknown   20
Pig    Opos      19
Pig    Apos      13
Pig    Bpos      22
Pig    ABpos     32
Pig    Oneg      25
Pig    Aneg      13
Pig    Bneg      35
Pig    ABneg     22
Pig    Unknown   22

I am trying to produce a heatmap where my y-axis are the animals, the bloodtype on x-axis and the counts as values.
I am trying to color each column independently by bloodtype with its own specific colour and ascending gradient per column to easily tell what animal have high numbers of O-positive, or A-positive etc. and what animals are running low via decreasing gradient..etc (because the bloodtypes are color-coded for easy visualisation)
Basically, I have tried to do something like what was done in this stackoverflow question: ggplot2 heatmaps: using different gradients for categories
or this one but different colours per row:
Heat map per column with ggplot2
csv_file<-read.csv("~/Documents/FileA.csv")

csv_file.s <- ddply(csv_file, .(Bloodtype), transform, rescale = scale(Count))

csv_file.s$Category <- csv_file.s$Bloodtype

levels(csv_file.s$Category) <-
  list("Opos" = c("Opos"),
       "Apos" = c("Apos"),
       "Bpos" = c("Bpos"),
       "ABpos" = c("ABpos"),
       "Oneg" = c("Oneg"),
       "Aneg" = c("Aneg"),
       "Bneg" = c("Bneg"),
       "Oneg" = c("Oneg"),
       "Unknown" = c("Unknown"))

csv_file.s$rescaleoffset <- csv_file.s$rescale + 100*(as.numeric(as.factor(csv_file.s$Category))-1)
scalerange <- range(csv_file.s$rescale)
gradientends <- scalerange + rep(c(0,100,200), each=8)
colorends <- c("white", "Aquamarine4", "white", "yellow4", "white", "turquoise4","white","orange4", "white", "slategray4","white","seagreen4","white","purple4","white","red4","white","blue4")

ggplot(csv_file.s, aes(Bloodtype, Animal)) +
  geom_tile(aes(fill = rescaleoffset), colour = "transparent") +
  scale_fill_gradientn(colours = colorends,
                       values = rescale(gradientends)) +
  scale_x_discrete("", expand = c(0, 0))+
  scale_y_discrete("", expand = c(0, 0)) +
  theme(panel.background = element_rect(fill = 'white'))
  theme_grey(base_size = 12) +
  theme(legend.position = "none",
        axis.ticks = element_blank(),
        axis.text.x = element_text(angle = 330, hjust = 0))

But the gradient turns out wrong and the colours are all over the place. I've been trying to find how to assign colours to specific column headers in heatmap, i.e Unknown="blue4", ABneg="red4", but to no avail. Basically, I don't know what I'm doing. :(
Any help would be greatly appreciated.

A: So the easiest solution I could think of is to simply map the bloodtype to a fill colour and map the count to an alpha scale, such that high counts have high colour intensity and low counts are near-white. I'm not sure what you meant with ascending and descending gradients, so I mostly ignored that.
Assume df is your snippet of data in data.frame format:
ggplot(df, aes(x = Bloodtype, y = Animal, fill = Bloodtype, alpha = Count)) +
  # Dummy tile geom for white background
  geom_tile(fill = "white", alpha = 1) +
  geom_tile() +
  scale_alpha_continuous(breaks = seq(0, max(df$Count), length.out = 10),
                         limits = c(0, NA))

You may have to fiddle around a bit with the breaks and limits in the alpha scale to match your data. Of course, you can choose any colours you want for the fill by adding a scale_fill_*() to the plot.


text:
Q: MVC omit optional page parameter I have the following URL in mind:
/restaurants/italian/miami.html
/restaurants/italian/miami-p2.html

Using these routes
routes.MapRoute(null, "{category}/{branch}/{city}-p{page}.html",
                new { controller = "Branch", action = "Index" });
routes.MapRoute(null, "{category}/{branch}/{city}.html",
                new { controller = "Branch", action = "Index", page = 1 });

Now for my question, i want to make "-p{page}" portion of the url optional, not just the {page} parameter. That way i can use a single route and also use it to map outbound urls with Url.RouteUrl(RouteValueDictionary) (which then auto removes the page portion if the page parameter in the dictionary is 1).

A: I am not sure I understand well what you would like, still somehow I think that using some regular expression constraint might solve your problem. Maybe somehow like this:
routes.MapRoute(null, "{category}/{branch}/{citywithp}{page}.html",
            new { controller = "Branch", action = "Index" },
            new {citywithp = @"p-\d+$" } );

A: In order to achieve this i needed 3 routes:
routes.MapRoute(null, "{category}/{branch}/{city}.html",
                new { controller = "Branch", action = "Index" },
                new { page = "1" });

routes.MapRoute(null, "{category}/{branch}/{city}-p{page}.html",
                new { controller = "Branch", action = "Index" });

routes.MapRoute(null, "{category}/{branch}/{city}.html",
                new { controller = "Branch", action = "Index", page = 1 });

This way i can map all the urls inbound with the second and third route and outbound with the first and second.


text:
Q: javascript/jquery/mootools/other js lib- can i write text over a css3 gradient I have with me a script that generates gradients using CSS3.
I want to do 2 things with the gradient, either separately or together--
(a) Allow user to write some text over the gradient at location chosen by user (indicated using mouse cursor).
(b) Allow user to choose from a set of fonts to be used when writing the text- the font can be a custom font or from Google Web Fonts collection...
I plan to implement the above in a GWT application, so any kind of javascript , incl libraries like mootools/jquery are acceptable for this work for me.

A: If your question is simply, "Can I write text over a CSS3 Gradient," you're answer is Yes.
CSS Gradients, when used, act as a background to an element.
Having a gradient background on an element is no different than declaring the background-color red or white.


text:
Q: How to detect mouse click in GtkComboBox? ALL,
In GTK+ there is a widget called GtkComboBox. I don't know the implementation details but on Windows it consists of 2 widgets: text control and list control. There is also a little button to the right of the text control. If you click that button, the list control pops up.
My question is: how do I detect the mouse click on that button in GtkComboBox? Is such click even emits the signal that can be caught or it just sends the popdown signal to the GtkComboBox widget and eats the mouse click?
BTW is it a composite widget in GTK+ as well?
An example on any language would be much helpful.
Thank you.

A: The GtkComboBox does in fact "eat the mouse click" and I think it will be quite tricky to get the behavior you are looking for without modifying or subclassing the GtkComboBox widget.  I wouldn't rely on the GtkComboBox being a composite widget or not - that seems like an implementation detail that could change.
It seems like you're paddling upstream if you really want to capture mouse clicks on the combo box - after all, there are other ways for users to use the widget (with the keyboard, for example).  The GtkComboBox emits a changed signal whenever the selection changes - could you use that in your application?


text:
Q: font-weight property and /tag will not bold my Google Font. What am I doing wrong? I have imported Comic Neue as my font in html. However, when I try to set the h1 font to bold in css with font weight, it will not allow me to. I also tried setting my entire body to bold with no resolve. I tried editing the html to set the h1 element to bold as well. It seems to blink on the page and stay the same when reloading the page. Edit: I included all of my code. Sorry I am new to this...
HTML/with header
<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>SuperRestaurant</title>
  <link rel="stylesheet" href="style.css">
  <link rel="icon" href="/images/gceEny9cd.png" type="image/x-icon">
  <link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Comic+Neue:ital,wght@0,300;0,400;0,700;1,300;1,400;1,700&display=swap" rel="stylesheet">

Coupons!

Order Online!

Super Restaurant!

        <button>View Our Menu!</button>

          Menu

          Beverages & Drinks
          Burgers

          Appetizers
          Item & Price

          Snacks & Sides
          Description

          Main Dishes
          Item & Price

          Desserts
          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Item & Price

          Description

          Our Story!

          Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur sollicitudin, ante non congue porttitor, ex
          metus
          interdum lectus, in tincidunt leo justo eu tortor. Nulla elementum elit et tortor vulputate congue. Phasellus
          turpis
          quam, luctus sit amet dapibus at, elementum at libero. Quisque convallis quis risus ut interdum. Nullam
          tincidunt vel
          magna non hendrerit. Nullam interdum turpis in risus congue fermentum. Vestibulum aliquam a leo vel mollis.
          Phasellus
          commodo urna vel libero commodo gravida. Ut egestas mollis nulla a maximus. Curabitur in est erat.
          Pellentesque sit amet
          eros nisi. Fusce ultricies tellus id hendrerit porta. Fusce commodo sit amet ex non volutpat. Integer quis
          mattis nisl.

          Duis vitae dolor nec dolor suscipit tincidunt. Sed accumsan sodales mauris, vitae consectetur neque lobortis
          ut.
          Suspendisse vel sagittis lorem. Etiam vitae lacus a orci fermentum congue vitae non arcu. Donec nec leo
          fermentum,
          molestie leo non, elementum eros. Integer vitae cursus dolor, aliquam ullamcorper orci. Vivamus dignissim
          ullamcorper
          dapibus. Nunc aliquam sagittis aliquam. Nullam molestie aliquet urna eget venenatis. Pellentesque faucibus
          volutpat
          porta. Ut ac commodo velit, eget blandit arcu. Integer eu eros pulvinar, convallis odio et, ornare magna.
          Aliquam at
          rhoncus erat. Morbi rhoncus sapien sed dui vestibulum, pharetra vulputate purus elementum.

          Nam eget vestibulum risus. Sed sollicitudin ultrices mi viverra luctus. Donec eu lacus placerat, ultricies leo
          quis,
          commodo diam. Sed consequat tristique mattis. Proin pulvinar aliquet leo, et auctor nunc euismod eu. Ut nisi
          turpis,
          vehicula dapibus iaculis nec, faucibus sed turpis. Phasellus non sapien sapien. Duis sed turpis eu lacus
          tristique
          dapibus. Phasellus consequat enim est, et tristique mauris efficitur quis. Nam dictum sit amet massa a
          vulputate.
          Suspendisse porta accumsan bibendum. Nullam id quam vel tellus hendrerit laoreet ac nec augue. Nulla massa
          mauris,
          pharetra sit amet lorem nec, interdum porttitor elit.

          Donec eget vehicula magna. Etiam viverra quam nec metus euismod mattis. Phasellus ligula mauris, faucibus et
          luctus et,
          tincidunt ut dolor. In hac habitasse platea dictumst. Nunc sagittis sodales lacus, at feugiat mauris mattis a.
          Integer
          et urna pharetra, dictum nibh ac, hendrerit tellus. In vestibulum ut nibh sed eleifend. Fusce ac volutpat
          felis.

          Praesent sed suscipit justo, eu dictum erat. Aenean hendrerit malesuada arcu eget pharetra. In placerat erat
          purus, sit
          amet venenatis lectus semper ut. Praesent ut augue vitae libero accumsan mattis at id felis. Fusce lectus
          nisi,
          fermentum at lorem eu, consectetur sagittis mauris. Maecenas id fringilla felis, sit amet porttitor nisi. Sed
          eget leo
          magna. Sed eget felis dolor. Pellentesque dapibus eget elit ac pulvinar. Donec placerat facilisis enim, eu
          convallis
          ante varius a. Sed ac arcu cursus, imperdiet mauris at, dictum augue. Interdum et malesuada fames ac ante
          ipsum primis
          in faucibus. Proin mauris ipsum, varius nec viverra vitae, varius sed mi. Mauris venenatis, leo ac eleifend
          tempor,
          tortor mi auctor justo, ut placerat nisl leo eu odio. Cras pharetra facilisis lacus a aliquet.

PHONE

000.000.0000

ADDRESS

Super Restaurant!

        100 University Pkwy

        Macon, GA 31206

© Super Restaurant! 2022. All rights reserved.

CSS
/*
COLORS:
Dark Red:#9A1000
Dark Blue:#0C026C
Red:#FF1B00
Blue:#3823FC
Yellow:#FCD90A
White:#FFFFFF
*/

body {
  margin: 0;
  font-family: 'Comic Neue', sans-serif;
}

main {
  margin-top: none;
}

.hero_image {
  background-image: url("C:/Users/Kascey.Malone/Documents/Websites/Midterm/images/669.png");
  height: 100vh;
  width: 100%;
  position: relative;
  background-size: 100% 100%;
  display:inline-block;
}

/*NAVIGATION BAR*/
header {
  height: fit-content;
}

header a {
  font-weight: bold;
  color: #FCD90A;
}

header a:link {
  text-decoration: none;
}

header a:visited {
  text-decoration: none;
}

header a:hover {
  text-decoration: underline;
}

header a:active {
  text-decoration: underline;
}

.topnav {
  overflow: hidden;
  text-decoration: none;
}

.left {
  padding: 20px;
  float: left;
  width: 50%;
  box-sizing: border-box;
  text-decoration: none;
  text-align: left;
}

.right {
  padding: 20px;
  float: right;
  width: 50%;
  box-sizing: border-box;
  text-decoration: none;
  text-align: right;
}

/*HERO BOX*/
.hero {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.hero h1 {
  font-size: 15vw;
  margin: 0;
  text-align: center;
  color: #9A1000;
  font-style: italic;
}

.hero button {
  padding: 1em;
  margin-top: 10vh;
  background-color: #FCD90A;
  white-space: nowrap;
  font-size: 1vw;
  font-family: 'Comic Neue', sans-serif;
}

.hero button a{
    text-decoration: none;
    color: black;
  }

.hero button a:link {
    text-decoration: none;
  }

.hero button a:visited {
    text-decoration: none;
  }

.hero button a:hover {
    font-weight: bold;
  }

.hero button a:active {
    font-weight: bold;
  }

.container {
  position: relative;
}

.center {
  margin: 0;
  position: absolute;
  top: 50%;
  left: 50%;
  -ms-transform: translate(-50%, -50%);
  transform: translate(-50%, -50%);
}

/*MENU TABLE*/
.table {
  background-color: white;
  padding-top: 100px;
  padding-bottom: 100px;
  box-sizing:border-box;
}

table {
  margin-left: auto;
  margin-right: auto;
  padding: 40px;
  font-size: 1vw;
  background-color: white;
  border: solid 8px black;
  box-sizing:border-box;
}/*Add border.*/

thead {
  text-align: right;
}

td:nth-child(even) {
  text-align: left;
  padding-left: 100px;
}

td:nth-child(odd) {
  text-align: right;
  padding: 10px;
}

.row {
    display: flex;
    margin: 0 auto;
  }

table a{
    text-decoration: none;
    color: black;
  } /*Change color based off background*/

table a:link {
    text-decoration: none;
  }

table a:visited {
    text-decoration: none;
  }

table a:hover {
    text-decoration: underline;
  }

table a:active {
    text-decoration: underline;
  }

th {
  padding: 10px;
}
/*ABOUT TEXT*/

.about {
  height: auto;
  padding-top: 5vh;
  padding-bottom: 5vh;
  background-color: #3823FC;
  background-size: 100% 100%;
}

.column {
  flex: 50%;
  padding: 10px;
}

.column h2{
  font-size: 2vw;
  padding-left: 200px;
  color: white;
}

.column p{
    padding-right: 200px;
    padding-top: 88px;
    font-size: 1.5vw;
    color: white;
}
.column img {
    width: 30vw;
    padding-left: 200px;
    height: auto;
}

/*FOOTER*/
  .footer {
    background-color: #0C026C;
    padding: 10px;
    text-align: left;
    color: white;
  }

A: Edited
Did you download the entire font-family? Or select just a few styles?
You could try replacing your imported font with a built-in CSS font and see if the bold property works. If the bold property works on the built-in font then you know the imported font is the issue.
Hope this helps!

A: You can select any style of text on google fonts just click the bold 700 or up options and I could not find that you have even imported the font.
And you can easily change the boldness within the import link. The higher the number the biggest the boldness of the parts that I have highlighted in the import link are the numbers to change.
@import url('https://fonts.googleapis.com/css2?family=Comic+Neue:wght@700&family=Orbitron:wght@500&display=swap');

A: You should check what weights the font you are using contains.
You can select the weights you want and copy the css code from the side panel.

@import url("https://fonts.googleapis.com/css2?family=Comic+Neue:wght@300;400;700&display=swap");

p {
    font-family: "Comic Neue", cursive;
    font-size: 5vw;
    padding: 1vh;
}

p::after {
    content: attr(class);
    border-radius: 0.5rem;
    background: #000;
    color: gold;
    margin-inline-start: 1rem;
    padding: 0.5em;
    font-weight: 700;
    font-size: 1.5vw;
}

p.weight-300 {
    font-weight: 300;
}

p.weight-400 {
    font-weight: 400;
}

p.weight-700 {
    font-weight: 700;
}
<!DOCTYPE html>

        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="stylesheet" href="style.css" />

Almost before we knew it, we had left the ground.

Almost before we knew it, we had left the ground.

Almost before we knew it, we had left the ground.

A: You have in your CSS:
.hero h1 {
   font-weight: 700//bold;
}

Try this in your css:
.hero > h1 {
    font-weight: 700;
}


text:
Q: stuck on computing points of ramification of a map of curves via sheaf of relative differentials Let $C$ be the curve in $\mathbb{C}^2$ given by $f(x,y)=x^3+y^3-y=0$ and let g:$C \to \mathbb{C}$ be the projection $g(x,y)=x$. I want to find where this map $g$ is ramified, and do this by computing the sheaf of relative differentials. I have $(3y^2-1)dy=-3x^2dx$. Now, by the definition of relative differentials I thought I set $dx=0$, and since ramified points are where this sheaf is nonzero, I get that dy is not killed when $3y^2-1=0$ but I don't think that gives the right answer. On the other hand, the derivative $dy/dx=\frac{-3x^2}{3y^2-1}$ vanishes when x=0, and that gives the right answer. Apparently I should be setting $dy=0$ but that doesn't make sense since the target of $g$ is $Spec\ \mathbb{C}[x]$. I'm confused why my sheaf of differentials approach isn't working - clearly I just have a basic misunderstand about it and I was hoping someone could clear if up for me.

A: As you have thought you should solve
$$\left\{\begin{aligned}3y^2-1=0,\\x^3+y^3-y=0\end{aligned}\right.
$$
which gives you 6 ramification points $y=\pm 1/\sqrt{3}, x=\pm e^{2\pi i k/3}\sqrt[3]{2}/\sqrt{3}$ where $k=0,1,2$.

A: This should not under any circumstances be considered rigorous, but intuitively here is what is happening in my mind. If you project onto the "$x$-axis", then think of the tangent space of the curve $C$ at some point $(a,b)$. If the tangent direction is "vertical", then any vector in that space will project to 0.
So after projecting, there is no "$y$-component" to any of the tangent vectors, and hence the $dy$ always evaluates to $0$. So in some sense $g$ is transverse to the projection precisely when there is some "$x$-direction". This is precisely when $-3x^2dx\neq 0$.


text:
Q: Delete node function will not delete certain nodes from a binary search tree The tree is sorted alphabetically the first letter of words. Some words I can delete, some I cannot. As in I try to delete it and nothing happens, but it still exits the deleteWord function. It will also get down to two words left in the tree and when I try to delete one of them, the program does nothing. It simply gives me a blank line which i cannot enter anything into; its stuck in a while loop somewhere but I cant figure out why. Sometimes I try to delete a word and instead of it being deleted, it is replaced by the data of another node and I have a duplicate node. I know theres a logic error in here but I cant find it.
the code for the word deletion is:
void BinaryTree::deleteWord(string delWord)
{
current = root;
bool found = false;
while(!found)
{
    if(current -> data.getWord() == delWord)
    {
        if(current -> right)
        {
            if(current -> right -> left)
            {
                temp = current -> right;
                temp -> parent = current;
                while(temp -> left)
                {
                    temp -> left -> parent = temp;
                    temp = temp -> left;
                }

                if(temp -> right)
                {
                    current -> data = temp -> data;
                    temp -> data = temp -> right -> data;
                    temp -> parent -> left = temp -> right;
                    temp = NULL;
                    found = true;
                }
                else
                {
                    current -> data = temp -> data;
                    temp -> parent -> left = NULL;
                    temp = NULL;
                    found = true;
                }
            }

            else if(current -> right -> right)
            {
                current -> data = current -> right -> data;
                current -> right -> right -> parent = current;
                current -> right = current -> right -> right;

                found = true;
            }
            else
            {
                current -> data = current -> right -> data;
                current -> right = NULL;
                found = true;
            }

        }
        else if(current -> left)
        {
            if(current -> left -> right)
            {
                if(current -> left -> right -> left)
                {
                    temp = current -> left -> right;
                    temp -> parent = current -> left;

                    while (temp -> left)
                    {
                        temp -> left -> parent = temp;
                        temp = temp -> left;
                    }

                    current -> data = temp -> data;

                    if(temp -> right)
                    {
                        temp -> data = temp -> right -> data;
                        temp -> right = NULL;
                        found = true;
                    }
                    else
                    {
                        temp = NULL;
                        found = true;
                    }

                }

                else if(current -> left -> right -> right)
                {
                    temp = current -> left -> right;
                    current -> data = temp -> data;
                    current -> left -> right = temp -> right;
                    temp -> right -> parent = current -> left;
                    temp = NULL;
                    found = true;
                }
                else
                {
                    current -> data = current -> left -> right -> data;
                    current -> left -> right = NULL;
                    found = true;
                }
            }
            else if(current -> left -> left)
            {
                current -> data = current -> left -> data;
                current -> left -> left -> parent = current;
                current -> left = current -> left -> left;
                found = true;
            }
            else
            {
                current -> data = current -> left -> data;
                current -> left = NULL;
            }
        }
        else
        {
            current = NULL;
            found = true;
        }
    }
    else if(current -> data.getWord() > delWord)
    {
        if(current -> left)
            current = current -> left;
    }

    else if(current -> data.getWord() < delWord)
    {
        if(current -> right)
            current = current -> right;
    }
    else
    {
        cout << "word somehow not found, check code.";
        found = true;
    }
}
}

the code to display the array is:
void BinaryTree::displayAll(WordNode* n)
{
if(n)
    {
        displayAll(n->right);
        print(n -> data);
        displayAll(n->left);
    }
}

and for adding words to the tree
void BinaryTree::addWord(string newWord, string newMeaning)
{
WordNode* temp = new WordNode;
if(empty())
{
    temp -> data = Word(newWord, newMeaning);
    temp -> left = NULL;
    temp -> right = NULL;
    temp -> parent = NULL;
    root = temp;

}//end if
else
{
    current = root;
    while(current)
    {
        if(newWord > current -> data.getWord())
        {
            if(current -> right == NULL)
            {
                temp -> data = Word(newWord, newMeaning);
                temp -> right = NULL;
                temp -> left = NULL;
                temp -> parent = current;
                current -> right = temp;
                current = NULL;
            }
            else
                current = current -> right;
        }//if
        else if(newWord < current -> data.getWord())
        {
            if(current -> left == NULL)
            {
                temp -> data = Word(newWord, newMeaning);
                temp -> right = NULL;
                temp -> left = NULL;
                temp -> parent = current;
                current -> left = temp;
                current = NULL;
            }
            else
                current = current -> left;
        }//elseif
    }//while
}//else
}//funct

A: edited the final else statement to read:
else
        {
            cout << "else entered.\n";
            if(current -> data.getWord() < current -> parent -> data.getWord())
            {
                current -> parent -> left = NULL;
                current = NULL;
                found = true;
            }
            else if(current -> data.getWord() > current -> parent -> data.getWord())
            {
                current -> parent -> right = NULL;
                current = NULL;
                found = true;
            }
            else
            {
                current = NULL;
                found = true;
            }
        }


text:
Q: Show only one variant price on shopify product page All the variants for each product have the same price. When I use following code, it's showing price for all the variants. How do i show price of only one (let's say first) variant?
{% for variant in product.variants %}

       {{ variant.price | money }}

       {{ variant.compare_at_price | money }}

{% endfor %}

A: You use the following code.
{{ product.first_available_variant.price | money }}
first_available_variant - returns the first variant that is available ( a.k.a it's quantity is larger than 0 )


text:
Q: How to set add_query_arg properly for home page? I want to add lang query variable to existing URL.
I have registered query variable:
add_filter('query_vars', 'custom_add_query_vars');
function custom_add_query_vars($vars){
    $vars[] = "lang";
    return $vars;
}

The following code works good everywhere but not when I'm currently on the home page.
<?php global $wp; ?>
<a href="<?php echo add_query_arg(array('lang' => 'en'), $wp->request); ?>">English

Is there a problem with the code? On the homepage
URL becomes http://localhost/mywebsitename/?lang=en which should be ok but supposedly it tries to load index.php instead of page.php, which generally wouldn't be a problem but in that case some things like is_front_page() don't behave as it should.
Static page is set as a homepage under Settings->Reading and pretty permalinks are active ("Post name" option).

A:
Is there a problem with the code?

Your code is already properly adding the lang query variable to the homepage URL. But you need to understand these points:

*

*

On the homepage URL becomes http://localhost/mywebsitename/?lang=en which should be ok

$wp->request is empty on the homepage, hence the above URL is expected. And you could use get_queried_object()->post_name to force the Page's slug be in that URL, but WordPress would actually redirect you to the URL without that slug, because the Page is set as the static front page, which means the content at example.com and example.com/page-slug/ are identical and thus WordPress performs a (canonical) redirect when loading the latter URL.

*

but supposedly it tries to load index.php instead of page.php, which generally wouldn't be a problem but in that case some things like is_front_page() don't behave as it should

No, WordPress will try to load front-page.php, home.php or page.php before falling back to the index template. But even if the index template is used, is_front_page() would still behave properly — remember that the query determines the template and not the other way round.
So one could say that "if is_front_page() returns true, page.php might be used", but this is incorrect: "if index.php is used, is_front_page() would return false".


text:
Q: Python - Aren't packages relative to their current directory? Okay, I've got a file structure like the following:

*

*main.py/

*paquete/

*

*__ init__.py

*test1.py

This is what I've got in my main.py:
from paquete import testFunc

def main():
    testFunc()

if __name__ == '__main__':
    main()

This is what I've got in my test1.py:
def testFunc():
    print("Hello from test1 function!")

And this is what I've got in my __ init__.py:
from test1 import testFunc

But that doesn't work, it says that there's no module named test1.
However, if I have something like:
from paquete.test1 import testFunc

It works perfect. But I don't get it, if __ init__.py it's in the same directory as test1, why do I need to prefix it with the name of the directory as if I was working from the root level of the project?

A: What you are currently using is called an implicit relative import.  It was deprecated in Python 3.x and this is mentioned in PEP 8.
You can still use a relative import; it just needs to use the syntax described below, with leading dots:

These imports use leading dots to indicate the current and parent packages involved in the relative import.

# Relative
from .test1 import testFunc

# Absolute
from paquete.test1 import testFunc

Also a reference -

The only acceptable syntax for relative imports is from .[module] import name. All import forms not starting with . are interpreted as absolute imports. (PEP 0328).

A: That's because paquete is in your sys.path but the insides of the package are not. So you can make absolute imports for paquete package but can only make relative imports for its insides. paquete is on you sys.path because it is in the same directory are you main.py.
You can set the __path__ attribute before the imports to get the insides of the package to be considered by the import statement.
Take a look at this for reference https://docs.python.org/3/reference/import.html#module-path


text:
Q: how to highlight the current tab in gnome terminal? I'm using 16.04. In the gnome terminal 3.18.13, the color of all the tabs look similar and it's not easy to find quickly which tab I'm in...
Is there a way to highlight the current active tab? Thanks.


text:
Q: Why doesn't file.write() store bytes in the sequence I have given ? c++ Short:
I want to write data byte for byte in sequence to a file.
The data is transfered to the file with file.write.
But when I review the file with hexdump the written data is not in sequence.
Here is my code:
#include <iostream>
#include <fstream>
#include <stdint.h>

int main() {
    // array with four bytes I want to write
    // This should be 0x01020304 in memory
    char write_arr[4]={1,2,3,4};

    // int with four bytes I want to write
    // I use little endian so this should be 0x04030201 in memory
    int write_num=0x01020304;

    std::ofstream outfile;

    outfile.open("output.txt",std::ios::out | std::ios::binary | std::ios::trunc);

    if( outfile.is_open() ) {
        outfile.write( write_arr ,sizeof(write_arr)/sizeof(char) );
        outfile.write( reinterpret_cast<char *>(&write_num),sizeof(write_num) );
        outfile.close();
    }

    return 0;
}

When I use hexdump on the output it displays this:
0201 0403 0304 0102

The bytes have been rearranged.
I expect the output to be:
0102 0304 0403 0201

Why is the rearranging happening ?
And how can I achieve a transfer where the bytes are in sequence ?

A: The hexdump dumps 2-bytes words; not individual characters.
That is what is confusing you - try
od -t x1


text:
Q: Chrome Inspect Device not showing android app I am trying to debug this app using chrome://inspect - Devices, but I am not able to see my app in the debug app list. I can see the device name and only Chrome app under it, but not my app.
Settings that I have applied

*

*Enable USB Debugging (Android Device)

*Discover USD Devices (Chrome Dev Tools)

*Select Debug app - App Name

*Use USB for - File Transfer

*Added android:debuggable="true" in Manifest file

I have also tried using different USB cables, different android device, but no luck.

A: Found answer on Remote Debugging WebViews on Google Developers.
This method has been added in API Level 19, hence had to add following check
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  WebView.setWebContentsDebuggingEnabled(true);
}

As mentioned in documentation, this method does not respect debuggable flag in application manifest file. If you want to enable webview debugging only when debuggable flag is true, then add one more check
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
  if (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE))
  {
    WebView.setWebContentsDebuggingEnabled(true);
  }
}


text:
Q: How to handle space in file name in Marklogic? If the file name or directory name has a space in it. How to handle it in Marklogic?
While loading it through xdmp:document-load it throws an error.
And in case of MLCP it replaces the space with %.

A: fn:escape-uri() may be what you want.
I suggest that the second parameter be set to false. That way slashes will still show up as slashes (important for some uses within MarkLogic).


text:
Q: Comparing websites using selenium webdriver with java I need to test websites using selenium webdriver on java. My goal is to make and save changes on one website and then see if the other website changed content accordingly. I want to make a change, then switch to a different window with a different website, then back and forth multiple times. Is it possible? Thank you!

A: Yes, it is possible!
And you can actually do it by switching between various windows.
Here you can find a great guide about the switch commands: http://toolsqa.com/selenium-webdriver/switch-commands/For example:
String winHandleBefore = driver.getWindowHandle(); //save the current window handle

for(String winHandle : driver.getWindowHandles()){
 driver.switchTo().window(winHandle);
} //switch window

driver.close(); //close the new window

driver.switchTo().window(winHandleBefore); //switch again to the first window

Hope it helps!


text:
Q: Numerical integration does not converge Integrand[f_,z_]:=(7768.33 (1 + z)^1.7)/(Sqrt[
 0.69 + 0.31 (1 + z)^3] (1 +
   0.00257378 (1 + z)^5.6) (9.60488 f^2 (1 + z)^2 + (8.5146*10^6 -
     2.40122 f^2 (1 + z)^2)^2))

I am integrating numerically the Integrand above for z ranging from 0 to 8. I then multiply this with some constant factor and plot for f from 0 to 4000. It is clear from the plot (see below) that there are errors in the numerical integration.

Indeed, when I ask for the calculated value at some f in the error area (eg f=1000), I get the following error message.

I am new to Mathematica, I would appreciate some help in getting rid of the errors.

A: Obviously you have numerical errors. Therefore, you need another method, e.g. "LocalAdaptive" that will adapt the step size to local needs.
Integrand[f_,
  z_] := (7768.33 (1 + z)^1.7)/(Sqrt[
     0.69 + 0.31 (1 + z)^3] (1 +
      0.00257378 (1 + z)^5.6) (9.60488 f^2 (1 + z)^2 + (8.5146*10^6 -
         2.40122 f^2 (1 + z)^2)^2))
Plot[NIntegrate[Integrand[f, z], {z, 0, 8},
  Method -> "LocalAdaptive"], {f, 0, 3000}]


text:
Q: Is $\lim\limits_{n\to\infty} \sum\limits_{i=1}^n \prod\limits_{j=n-i+1}^n a_j=0$? Let $\{a_n\}_{n\geqslant1}$ be a sequence of numbers in $(0,1)$ such that $a_n\to 0$ but $\sum\limits_{n\geqslant 1}a_n=\infty$ . Is it true that

$$\lim\limits_{n\to\infty}\  \sum\limits_{i=1}^n\  \prod\limits_{j=n-i+1}^n a_j=0\ \ \ ?$$

Had $a_i$'s be decreasing, some proceedings could have been done. But right now, I don't know how to proceed.

A: Pick some $p \in (0,1)$.
Choose $n$ large enough so that
1) $a_k < p$ for all $k > n/4$, this is possible since $a_k \to 0$.
2) $p^{n/4}n < p$, this is always possible and doesn't depend on the $a_k$
Now lets look at your sum:
$a_n + a_na_{n-1}+a_na_{n-1}a_{n-2} + \dots + a_na_{n-1}a_{n-2}\dots a_1$
If we look at the first $n/2$ terms, since all the $a_k$ are involved are at most $p$ we can bound this part of the sum by $p+p^2+p^3+\dots = p/(1-p)$.
If we look at the remaining $n/2$ terms they are all divisible by $n/4$ of the $a_k's$ we assumed to be less than $p$. So the total contribution is at most $p^{n/4}n/2 < p/2$ by our second assumption.
So this shows for any $p \in (0,1)$ for all sufficiently large $n$ this sum is bounded by $p/(1-p) + p/2$.  But of course we can then choose $p$ to make this as small as we want.


text:
Q: Cucumber CLI Main skipping the feature files I want to execute cucumber tests from cucumber CLI instead of Maven.
I have below code in my Runner class:
import io.cucumber.core.cli.Main;

public class Runner {

    public static void main(String[] args) {
        Main.main(new String[]{"-g", "src/test/java/com/company/project/stepdefinitions", "-t", "Regression", "src/test/resources/features"});
    }
}

When I execute it, it doesn't run any tests -
0 Scenarios
0 Steps
0m0.163s

Any Idea what am I missing ? If I remove the tag then it detects the feature file but says corresponding stepdefinition is missing.
Main.main(new String[]{"-g", "src/test/java/com/company/project/stepdefinitions/module1/Stepmodule1","src/test/resources/features/module1/ValidateModule1.feature"});
Undefined scenarios:
file:///C:/Users/.../src/test/resources/features/module1/ValidateModule1.feature:5 # To Test Module1

1 Scenarios (1 undefined)
1 Steps (1 undefined)
0m0.228s

Am I calling main function in CLI with wrong parameters?
Kind Regards,
Abhi

A: Thanks for the suggestions.
The below syntax worked for me for giving glue and feature files in a standalone Java class.
import io.cucumber.core.cli.Main;

public class Runner {

    public static void main(String[] args) {
        Main.main(new String[]{"-g", "com.company.project.stepdefinitions","-t", "@Regression","-p", "com.aventstack.extentreports.cucumber.adapter.ExtentCucumberAdapter:", "src/main/resources/features/"});
    }
}


text:
Q: Console.ReadLine() throws nullpointer exception in Groovy I started learning groovy yesterday and have been enjoying it thus far until I got to the part of the book where I have to take in inputs from the user using console().readLine() but I keep getting this error
Caught: java.lang.NullPointerException: Cannot invoke method readLine() on null object java.lang.NullPointerException: Cannot invoke method readLine() on null object
at com.usl.NewCodes.run(NewCodes.groovy:30)

I have tried it in intelliJ both as a groovy script and in a class. I even went on to try it in the groovyConsole yet it still throws an error.
Here is the code
print("What is your name ");
def fName = System.console().readLine()
println("Hello" + fName)

Thanks

A: If you are using any IDE for Groovy, the input / output console will not be available to you hence throwing null pointer exception so, you can use the following, If you are using Intellij enable groovy console from Tools -> groovy console for I/O.
 println "What is your name?"
 println "Your name is:"+System.in.newReader().readLine()


text:
Q: Hadoop, Hive, Pig, HBase, Cassandra - when to use what? First of all I am relatively new to Big Data and the Hadoop world and I have just started to experiment a little with the Hortonworks Sandbox (Pig and Hive so far).
I was wondering in which cases could I use the above mentioned tools of Hadoop, Hive, Pig, HBase and Cassandra?
In my sandbox environment with a file of just 9MB Hive and Pig had response times of seconds to minutes. This is obviously not usable in some situations for example web applications (unless it is something else such as my virtual machine setup).
My guesses about the correct usages are:

*

*Hadoop: Just the technological base for the rest, only very few use-cases where it would be used directly

*Hive or Pig: For analytical processes that run once per hour or day

*HBase or Cassandra: for real-time applications (e.g. web applications) where response times with 100ms or less are required

Additionally, when to use HBase as opposed to when to use Cassandra?
Thanks!

A: Your guesses are somewhat accurate.
By Hadoop, I guess you are referring to MapReduce? Hadoop as such is an ecosystem which consists of many components (including MapReduce, HDFS, Pig and Hive).
MapReduce is good when you need to write the logic for processing data at the Map() and Reduce() method level. In my work, I find MapReduce very useful when I'm dealing with data that is unstructured & needs to be cleansed.
Hive,Pig: They are good for batch processes, running periodically (maybe in terms of hours or days)
HBase & Cassandra: Support low latency calls. So they can be used for real time applications, where response time is key. Have a look at this discussion to get a better idea about HBase vs Cassandra.