text:
Q: ssl.SSLError: ('No cipher can be selected.',) - But cipher IS available I've tried with python 3.9.7 and 3.10. I've updated pip, urllib3 and requests. Not sure why this is happening.
Code:
import ssl

sboy = ssl.create_default_context()
print(ssl.OPENSSL_VERSION, sboy.get_ciphers(), sep='\n')
sboy.set_ciphers('TLS_AES_256_GCM_SHA384')

Output:
OpenSSL 1.1.1l  24 Aug 2021
[{'id': 50336514, 'name': 'TLS_AES_256_GCM_SHA384', 'protocol': 'TLSv1.3', 'description': 'TLS_AES_256_GCM_SHA384  TLSv1.3 Kx=any      Au=any  Enc=AESGCM(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'aes-256-gcm', 'digest': None, 'kea': 'kx-any', 'auth': 'auth-any'}, {'id': 50336515, 'name': 'TLS_CHACHA20_POLY1305_SHA256', 'protocol': 'TLSv1.3', 'description': 'TLS_CHACHA20_POLY1305_SHA256 TLSv1.3 Kx=any      Au=any  Enc=CHACHA20/POLY1305(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'chacha20-poly1305', 'digest': None, 'kea': 'kx-any', 'auth': 'auth-any'}, {'id': 50336513, 'name': 'TLS_AES_128_GCM_SHA256', 'protocol': 'TLSv1.3', 'description': 'TLS_AES_128_GCM_SHA256  TLSv1.3 Kx=any      Au=any  Enc=AESGCM(128) Mac=AEAD', 'strength_bits': 128, 'alg_bits': 128, 'aead': True, 'symmetric': 'aes-128-gcm', 'digest': None, 'kea': 'kx-any', 'auth': 'auth-any'}, {'id': 50380844, 'name': 'ECDHE-ECDSA-AES256-GCM-SHA384', 'protocol': 'TLSv1.2', 'description': 'ECDHE-ECDSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AESGCM(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'aes-256-gcm', 'digest': None, 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50380848, 'name': 'ECDHE-RSA-AES256-GCM-SHA384', 'protocol': 'TLSv1.2', 'description': 'ECDHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'aes-256-gcm', 'digest': None, 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50331807, 'name': 'DHE-RSA-AES256-GCM-SHA384', 'protocol': 'TLSv1.2', 'description': 'DHE-RSA-AES256-GCM-SHA384 TLSv1.2 Kx=DH       Au=RSA  Enc=AESGCM(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'aes-256-gcm', 'digest': None, 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50384041, 'name': 'ECDHE-ECDSA-CHACHA20-POLY1305', 'protocol': 'TLSv1.2', 'description': 'ECDHE-ECDSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=CHACHA20/POLY1305(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'chacha20-poly1305', 'digest': None, 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50384040, 'name': 'ECDHE-RSA-CHACHA20-POLY1305', 'protocol': 'TLSv1.2', 'description': 'ECDHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=ECDH     Au=RSA  Enc=CHACHA20/POLY1305(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'chacha20-poly1305', 'digest': None, 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50384042, 'name': 'DHE-RSA-CHACHA20-POLY1305', 'protocol': 'TLSv1.2', 'description': 'DHE-RSA-CHACHA20-POLY1305 TLSv1.2 Kx=DH       Au=RSA  Enc=CHACHA20/POLY1305(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'chacha20-poly1305', 'digest': None, 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50380843, 'name': 'ECDHE-ECDSA-AES128-GCM-SHA256', 'protocol': 'TLSv1.2', 'description': 'ECDHE-ECDSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AESGCM(128) Mac=AEAD', 'strength_bits': 128, 'alg_bits': 128, 'aead': True, 'symmetric': 'aes-128-gcm', 'digest': None, 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50380847, 'name': 'ECDHE-RSA-AES128-GCM-SHA256', 'protocol': 'TLSv1.2', 'description': 'ECDHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AESGCM(128) Mac=AEAD', 'strength_bits': 128, 'alg_bits': 128, 'aead': True, 'symmetric': 'aes-128-gcm', 'digest': None, 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50331806, 'name': 'DHE-RSA-AES128-GCM-SHA256', 'protocol': 'TLSv1.2', 'description': 'DHE-RSA-AES128-GCM-SHA256 TLSv1.2 Kx=DH       Au=RSA  Enc=AESGCM(128) Mac=AEAD', 'strength_bits': 128, 'alg_bits': 128, 'aead': True, 'symmetric': 'aes-128-gcm', 'digest': None, 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50380836, 'name': 'ECDHE-ECDSA-AES256-SHA384', 'protocol': 'TLSv1.2', 'description': 'ECDHE-ECDSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA384', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha384', 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50380840, 'name': 'ECDHE-RSA-AES256-SHA384', 'protocol': 'TLSv1.2', 'description': 'ECDHE-RSA-AES256-SHA384 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA384', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha384', 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50331755, 'name': 'DHE-RSA-AES256-SHA256', 'protocol': 'TLSv1.2', 'description': 'DHE-RSA-AES256-SHA256   TLSv1.2 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA256', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha256', 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50380835, 'name': 'ECDHE-ECDSA-AES128-SHA256', 'protocol': 'TLSv1.2', 'description': 'ECDHE-ECDSA-AES128-SHA256 TLSv1.2 Kx=ECDH     Au=ECDSA Enc=AES(128)  Mac=SHA256', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha256', 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50380839, 'name': 'ECDHE-RSA-AES128-SHA256', 'protocol': 'TLSv1.2', 'description': 'ECDHE-RSA-AES128-SHA256 TLSv1.2 Kx=ECDH     Au=RSA  Enc=AES(128)  Mac=SHA256', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha256', 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50331751, 'name': 'DHE-RSA-AES128-SHA256', 'protocol': 'TLSv1.2', 'description': 'DHE-RSA-AES128-SHA256   TLSv1.2 Kx=DH       Au=RSA  Enc=AES(128)  Mac=SHA256', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha256', 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50380810, 'name': 'ECDHE-ECDSA-AES256-SHA', 'protocol': 'TLSv1.0', 'description': 'ECDHE-ECDSA-AES256-SHA  TLSv1 Kx=ECDH     Au=ECDSA Enc=AES(256)  Mac=SHA1', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha1', 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50380820, 'name': 'ECDHE-RSA-AES256-SHA', 'protocol': 'TLSv1.0', 'description': 'ECDHE-RSA-AES256-SHA    TLSv1 Kx=ECDH     Au=RSA  Enc=AES(256)  Mac=SHA1', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha1', 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50331705, 'name': 'DHE-RSA-AES256-SHA', 'protocol': 'SSLv3', 'description': 'DHE-RSA-AES256-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(256)  Mac=SHA1', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha1', 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50380809, 'name': 'ECDHE-ECDSA-AES128-SHA', 'protocol': 'TLSv1.0', 'description': 'ECDHE-ECDSA-AES128-SHA  TLSv1 Kx=ECDH     Au=ECDSA Enc=AES(128)  Mac=SHA1', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha1', 'kea': 'kx-ecdhe', 'auth': 'auth-ecdsa'}, {'id': 50380819, 'name': 'ECDHE-RSA-AES128-SHA', 'protocol': 'TLSv1.0', 'description': 'ECDHE-RSA-AES128-SHA    TLSv1 Kx=ECDH     Au=RSA  Enc=AES(128)  Mac=SHA1', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha1', 'kea': 'kx-ecdhe', 'auth': 'auth-rsa'}, {'id': 50331699, 'name': 'DHE-RSA-AES128-SHA', 'protocol': 'SSLv3', 'description': 'DHE-RSA-AES128-SHA      SSLv3 Kx=DH       Au=RSA  Enc=AES(128)  Mac=SHA1', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha1', 'kea': 'kx-dhe', 'auth': 'auth-rsa'}, {'id': 50331805, 'name': 'AES256-GCM-SHA384', 'protocol': 'TLSv1.2', 'description': 'AES256-GCM-SHA384       TLSv1.2 Kx=RSA      Au=RSA  Enc=AESGCM(256) Mac=AEAD', 'strength_bits': 256, 'alg_bits': 256, 'aead': True, 'symmetric': 'aes-256-gcm', 'digest': None, 'kea': 'kx-rsa', 'auth': 'auth-rsa'}, {'id': 50331804, 'name': 'AES128-GCM-SHA256', 'protocol': 'TLSv1.2', 'description': 'AES128-GCM-SHA256       TLSv1.2 Kx=RSA      Au=RSA  Enc=AESGCM(128) Mac=AEAD', 'strength_bits': 128, 'alg_bits': 128, 'aead': True, 'symmetric': 'aes-128-gcm', 'digest': None, 'kea': 'kx-rsa', 'auth': 'auth-rsa'}, {'id': 50331709, 'name': 'AES256-SHA256', 'protocol': 'TLSv1.2', 'description': 'AES256-SHA256           TLSv1.2 Kx=RSA      Au=RSA  Enc=AES(256)  Mac=SHA256', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha256', 'kea': 'kx-rsa', 'auth': 'auth-rsa'}, {'id': 50331708, 'name': 'AES128-SHA256', 'protocol': 'TLSv1.2', 'description': 'AES128-SHA256           TLSv1.2 Kx=RSA      Au=RSA  Enc=AES(128)  Mac=SHA256', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha256', 'kea': 'kx-rsa', 'auth': 'auth-rsa'}, {'id': 50331701, 'name': 'AES256-SHA', 'protocol': 'SSLv3', 'description': 'AES256-SHA              SSLv3 Kx=RSA      Au=RSA  Enc=AES(256)  Mac=SHA1', 'strength_bits': 256, 'alg_bits': 256, 'aead': False, 'symmetric': 'aes-256-cbc', 'digest': 'sha1', 'kea': 'kx-rsa', 'auth': 'auth-rsa'}, {'id': 50331695, 'name': 'AES128-SHA', 'protocol': 'SSLv3', 'description': 'AES128-SHA              SSLv3 Kx=RSA      Au=RSA  Enc=AES(128)  Mac=SHA1', 'strength_bits': 128, 'alg_bits': 128, 'aead': False, 'symmetric': 'aes-128-cbc', 'digest': 'sha1', 'kea': 'kx-rsa', 'auth': 'auth-rsa'}]
Traceback (most recent call last):
  File "/home/lafftar/PycharmProjects/{project_name}/r_based/main.py", line 8, in <module>
    sboy.set_ciphers('TLS_AES_256_GCM_SHA384')
ssl.SSLError: ('No cipher can be selected.',)

A:
sboy.set_ciphers('TLS_AES_256_GCM_SHA384')

This is a TLS 1.3 cipher. It cannot be specified using set_ciphers. From the documentation:

TLS 1.3 uses a disjunct set of cipher suites. All AES-GCM and ChaCha20 cipher suites are enabled by default. The method SSLContext.set_ciphers() cannot enable or disable any TLS 1.3 ciphers yet, but SSLContext.get_ciphers() returns them.


text:
Q: How to verify if localization is working correctly in Bot framework I have used RView and MAT tools to create resource files for french language as described in https://learn.microsoft.com/en-us/bot-framework/dotnet/bot-builder-dotnet-formflow-localize to localize the form flow. How can I verify if the localization is working correctly. Basically I need a way to test the form flow in my emulator in French language.
What's the best/right way to set the CurrentUICulture or to test this out?

A: You can set locale in bot emulator like this:

Then the point problem is that whether Bot SDK can get locale info from client channels  and automatically set culture info based on that. I couldn't find any official documents that can point out this problem, we can only run test on that.
If the bot can't get locale from client side, there're two workarounds to solve this issue.

*

*To prompt user, show dialog to let user choose preferred language, and then we can save user's choice for example in a table of azure storage.

*Use Text Analytics API to automatically detect the user's language based upon user's input.

A: If you want your locale set to e.g. French all the time (i.e. for the entire conversation), you can set the locale in the activity in MessagesController.cs before calling the dialog, like so:
activity.Locale ="fr";
await Conversation.SendAsync(activity, () => new RootDialog());

It is mentioned in the documentation that activity.Locale overrides the culture of the thread in which the dialogs are used. Because of this, you would have a hard time setting the culture yourself manually in the dialogs.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Jquery Datepicket Suppress Year I have a calendar that pops when you click in the text box. I an already handling a year, I don't want to display a year in the date picker calendar. Can you please suggest. Have code in jsbin.
http://jsbin.com/uwohez/1
$(document).ready(function(){

    $(".monthPicker").datepicker({
        dateFormat: 'mm',
        changeMonth: true,
        changeYear: true,
        showButtonPanel: true,

        onClose: function(dateText, inst) {
            var month = $("#ui-datepicker-div .ui-datepicker-month :selected").val();
            var year = $("#ui-datepicker-div .ui-datepicker-year :selected").val();
            $(this).val($.datepicker.formatDate('m', new Date(year, month, 1)));
        }
    });

    $(".monthPicker").focus(function () {
        $(".ui-datepicker-calendar").hide();
        $("#ui-datepicker-div").position({
            my: "center top",
            at: "center bottom",
            of: $(this)
        });
    });
});

A: I know this is an old question, but I think I just done what you were trying to do (http://jsfiddle.net/robattfield/M5PHP/). Since I see that I have to supply code with a jsfiddle link, here is the code:
Form HTML code
<form method="post" action="#">
    <fieldset>
        <legend>Select a month:</legend>
        <label for="month_datepicker">Select month: </label>
        <input name="month" id="month_datepicker" />
        <button id="submit_month" type="submit" name="submit_month" class="button-turquoise">Show Daily Data</button>
    </fieldset>
</form>

CSS code
.MonthDatePicker .ui-datepicker-year
{
    display:none;
}
.HideTodayButton .ui-datepicker-buttonpane .ui-datepicker-current
{
    visibility:hidden;
}

.hide-calendar .ui-datepicker-calendar
{
    display:none!important;
    visibility:hidden!important
}

JQuery/JS code
$("#month_datepicker").datepicker({
        changeMonth: true,
        showButtonPanel: true,
        dateFormat: "M",
        beforeShow: function (e, t) {
            $(this).datepicker("hide");
            $("#ui-datepicker-div").addClass("hide-calendar");
        $("#ui-datepicker-div").addClass('MonthDatePicker');
        $("#ui-datepicker-div").addClass('HideTodayButton');
        },
    onClose: function(dateText, inst){
        var n = Math.abs($("#ui-datepicker-div .ui-datepicker-month :selected").val() - 1) + 2;
        $(this).datepicker("setDate", new Date(null, n, null));
    }
});

Your requirements may slightly differ, but I think this may help. Feel free to correct me if there is anything wrong...


text:
Q: Method to write python module output to toml file I'm writing a scanner in python that will gather various information about a target such as open ports, version info and so on.
Also using a toml file that holds configuration settings for individual scans.
I need a method to store the scan results. So far I'm using a class that holds all target data. Is there a way to store the results in a file and have library functions parse and print them as requested?
In toml representation I'm thinking of something like
[target]
ip = xx.xx.xx.xx
  [target.os]
  os = 'win 10'
  Arch = 'x64'

  [target.ports]
  ports = ['1', '2']

    [target.ports.1]
    service = 'xxx'
    ver = '5.9'

Is there a way to dump scan results to toml file in this manner? Or is there another method that could do a better job?

A: The toml library can do this for you. There are others like json, pyyaml etc that work in pretty much the same way. In your example, you would first need to store the information in a dictionary, in the following format:
data = {
  "target": {
    "ip": "xx.xx.xx.xx",
    "os": {
      "os": "win 10",
      "Arch": "x64"
    },
    "ports": {
      "ports": ["1", "2"],
      "1": {
        "service": "xxx",
        "ver": "5.9",
      }
    }
  }
}

Then, you can do:
import toml

toml_string = toml.dumps(data)  # Output to a string

output_file_name = "output.toml"
with open(output_file_name, "w") as toml_file:
    toml.dump(data, toml_file)

Similarly, you can also load toml files into the dictionary format using:
import toml

toml_dict = toml.loads(toml_string)  # Read from a string

input_file_name = "input.toml"
with open(input_file_name) as toml_file:
    toml_dict = toml.load(toml_file)

If instead of toml you want to use yaml or json, it is as simple as replacing toml with yaml or json in all the commands. They all use the same calling convention.

A: You can use this stacktrace to achieve what you want to do:
1. You could probably extract the data of the class as a dictionary through this method.
2. Write that to a file with this
3. From there load it into dictionary to toml converter with toml.dump with more info here


text:
Q: Full Adder driven by clock [FPGA/VHDL] I've got Ripple Carry adder (26bit) made from scratch.
entity Ripple_Carry26 is
port(
    A, B : in BIT_VECTOR(25 downto 0);
    Sum : out BIT_VECTOR(25 downto 0)
);
end entity;

Now I want to use it to update counter every time clock goes up. Counter is just simple register
entity Counter is
port(
    inp : in BIT_VECTOR(25 downto 0);
    clk : in BIT;
    qout : out BIT_VECTOR(25 downto 0)
);
end entity;
architecture Reg of Counter is
begin
    proc : process(clk)
    begin
        if clk'event and clk = '1' then
            qout <= inp;
        end if;
    end process;
end architecture;

If I use port map to just connect stuff, it doesn't make sense, I only want to use the adder when clock goes up, but if I use process and say something like
if clk'event and clk='1' then

I'd like to say something like "now use the adder and add 1 to it" but I'm not sure how.
(I know I'm doing it too complicated, it's all learning purposes)
Every idea helps!

A: This is hardware design. If you want an adder, it must exist all the time, even if it is only being used some of the time. Therefore, you need to:

*

*instantiate the adder in your counter module

*connect the ports of the adder to signals

*

*one input port gets the constant you want to add to the counter

*one input port gets the current counter value

*in your clocked process, load the counter with the sum from the adder

The adder will be computing the next counter value all of the time, but that value will only get used when the clock edge occurs.


text:
Q: Delete and Rename events in google drive I am working on a feature for our webapp where we create google drive files from our server

Drive service =  getServiceForLoginUser();

com.google.api.services.drive.model.File fileMetadata = new com.google.api.services.drive.model.File();
fileMetadata.setTitle(getDefaultName());
fileMetadata.setMimeType(APPLICATION_VND_GOOGLE_APPS_DRIVE_SDK);
        com.google.api.services.drive.model.File.Thumbnail thumbnail = buildThumbnail(driveType);
fileMetadata.setThumbnail(thumbnail);

com.google.api.services.drive.model.File googleFile = service.files().insert(fileMetadata)
                .setFields("id")
                .execute();

I have configured Drive UI Integration  to trigger New and Open URL flows from google drive.I have also published a chrome app with following manifest.

"name" : "classflowtest",
  "version" : "3.5",
  "manifest_version" : 2,
  "icons": {
  "128": "icon_128.png"
   },
  "description" : "description_text",
  "container" : "GOOGLE_DRIVE",
  "api_console_project_id" : "146081768739",
  "gdrive_mime_types": {
    "http://drive.google.com/intents/opendrivedoc": [
   {
     "type": ["image/png", "image/jpeg", "image/gif", "html","application/vnd.google.drive.ext-type.png",
     "application/vnd.google.drive.ext-type.jpg","application/vnd.google.drive.ext-type.gif","application/vnd.google.drive.ext-type.html"],
     "href": "https://mywebappurl",
     "title" : "Open",
     "disposition" : "window"
   }
    ]
  },
  "app" : {
    "launch" : {
    "web_url" : "mywebappurl"
    }
  }

So now I can trigger New and Open flows  in drive successfully. In New flow I create first a resource in our db and then I create a file in google drive from my application server. So every entry I create in google drive has a representation in our db as well. My issue is now if I rename or delete the file in google drive how do I get those events so that I can make the necessary changes in our DB ?

A: Check the Changes: list if it can help you. It will lists all the changes in your drive. But is is difficult to filter the results. To get the deleted files, you must specify the includeRemoved parameter to true. So it is easier to get the files if you know its fileID before you rename or delete it.
I found in this SO question that someone use Apps Activity API to solve this problem.
For more information, check this thread.


text:
Q: AngularJS: Possible to sanitize and linky in same directive? If I try to filter snippet with linky, the input is no longer sanitized / rendered / 'html-ized'.  i.e. I want to be able to combine the effects of both:

and

Here is the fiddle: http://jsfiddle.net/5uSnj/

A: linky takes text as input and not html. if you want a filter that takes html as input then it has to work completely differently. please see: https://github.com/angular/angular.js/pull/3285#issuecomment-21958391

A: sorry Igor Minar  i voted you answer but i want see post your function without other services :
    app.filter('htmlLinky', function($sanitize, linkyFilter) {
  var ELEMENT_NODE = 1;
  var TEXT_NODE = 3;
  var linkifiedDOM = document.createElement('div');
  var inputDOM = document.createElement('div');

  var linkify = function linkify(startNode) {
    var i, ii, currentNode;

    for (i = 0, ii = startNode.childNodes.length; i < ii; i++) {
      currentNode = startNode.childNodes[i];

      switch (currentNode.nodeType) {
        case ELEMENT_NODE:
          linkify(currentNode);
          break;
        case TEXT_NODE:
          linkifiedDOM.innerHTML = linkyFilter(currentNode.textContent);
          i += linkifiedDOM.childNodes.length - 1
          while(linkifiedDOM.childNodes.length) {
            startNode.insertBefore(linkifiedDOM.childNodes[0], currentNode);
          }
          startNode.removeChild(currentNode);
      }
    }

    return startNode;
  };

  return function(input) {
    inputDOM.innerHTML = input;
    return linkify(inputDOM).innerHTML;
  };
});

ng-bind-html="html | htmlLinky"


text:
Q: Java Android Client Socket not working Am I missing something.  I've checked other posts and have thses set in my manifest.
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Whenever I try to create a new socket on Samsung Galaxy Express it never gets past this line.
Socket s = new Socket("10.0.2.2", 4736);

This is my class for starting a socket in a runnable.
private class SendThread implements Runnable {

    @Override
    public void run() {
        try {
            Socket s = new Socket("10.0.2.2", 4736);       <---never gets past this
            PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(s.getOutputStream())), true);
            out.println(sendString);
            new BufferedReader(new InputStreamReader(s.getInputStream()));
            Log.d(TAG, "sent");
            s.close();
        } catch (Exception e) {
            Log.d(TAG, "error");
            e.printStackTrace();
        }
        Log.d(TAG, "end");
    }

}

Server Socket
private class ReceiveThread implements Runnable {
    private ServerSocket receiverSocket;
    private BufferedReader input;
    private Socket socket = null;

    public void run() {
        try {
            receiverSocket = new ServerSocket(receivePort);
            receiverSocket.setReuseAddress(true);
            while (killConnection == false) {
                Log.d(TAG, "listening");
                socket = receiverSocket.accept();
                this.input = new BufferedReader(new InputStreamReader(this.socket.getInputStream()));
                Log.d(TAG, "Input from server" + input.toString());
                String s = input.readLine();
                //UpdateUi(s);
                socket.close();
            }
            receiverSocket.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

Ok yes the server-side socket isn't listening


text:
Q: pretty print a list using recurison returning single item in a list I'm writing a code which returns each item in a list in "pretty" order. I'm trying to do this without using any built in modules or methods. THIS IS NOT A ASSIGNMENT, as I am just practicing and improving my coding techniques. The problem I'm having is that the function is returning just one single item and not every element in the list. I am separating each item in the list by the new line character. If the list has a nested list, I'm going to indent the items in the nested list by 2 spaces. Any help would be appreciated :)
def pretty_print(item_list, indentation = ""):

        if len(item_list) == 0:
            return " "

        for items in item_list:

            if isinstance(items, list):
                return pretty_print(items, indentation = "  ")

        return (items + '\n')

A: I am guessing that you need to return a string. This is the minimal change that you need to make in your program for it to work. Remember that your return values have to be consistent through the recursive calls.
def pretty_print(item_list, indentation = ""):

        temp = []
        for items in item_list:
            if isinstance(items, list):
                temp.append( pretty_print(items, indentation = indentation+"  "))
            else:
                temp.append( indentation + str(items) + '\n')

        return ( ''.join(temp ) )

EDIT:
In my program execution, the first element isn't indented. I changed the indentation string so it is easy to see in the following program:
def pretty_print(item_list, indentation = ""):

        temp = []

        for items in item_list:
            if isinstance(items, list):
                temp.append( pretty_print(items, indentation = indentation+"[----]"))
            else:
                temp.append( indentation + str(items) + '\n')

        return ( ''.join(temp ) )

print pretty_print( [1,2,3,[1,2,3], 1,[1,2,[1,2, ['a', 'this is outer'],3], 3], 2,3] )

And the answer is:
1
2
3
[----]1
[----]2
[----]3
1
[----]1
[----]2
[----][----]1
[----][----]2
[----][----][----]a
[----][----][----]this is outer
[----][----]3
[----]3
2
3

I am copying this directly from the iPython window .... There should not be any indentation in the first level.

A: Here's a cleaner version in a more 'pythonistic' way:
INDENTATION = '  '

def pretty_print(item_list, depth=0):
    for items in item_list:
        if isinstance(items, list):
            pretty_print(items, depth + 1)
        else:
            print (INDENTATION * depth) + str(items)

A: A for loop would help for starters.
def pretty_print(l, indentation=""):
    if isinstance(l,list):
        print (indentation+"[")
        for i in l:
            pretty_print(i, indentation=indentation+"  ")
        print (indentation+"]")
    else:
        print (indentation+repr(l))


text:
Q: Hide toc from toc, and shorttoc from shorttoc I'm currently finishing my thesis and have an issue with my tocs:
I need an overview toc first, which contains chapters (top level) only.
Afterwards I need to have a full toc, which contains chapters, sections and subsections (numbered) plus subsubsections (w/o numbering).
To achieve that I used the shorttoc package. That works pretty well!
My problem is: The shorttoc lists itself, as well as the full toc, that lists itself, too.
How do I prevent the shorttoc from appearing in itself and how do I prevent the toc from appearing in itself? I want shorttoc to list toc and toc to list shorttoc.
All I found was a thread about hiding other entries from shorttoc but not toc, that didn't work sufficiently for me.
Here is my (almost minimal) working example:
\documentclass[11pt, oneside]{Thesis} % The default font size and one-sided printing (no margin offsets)
\usepackage[ngerman]{babel}
\usepackage[T1]{fontenc}
\usepackage{microtype}
\usepackage{shorttoc} % Für Inhaltsübersicht

% TOC configuration[![enter image description here][1]][1]
% Chapter numbering only for level 1-3
\setcounter{secnumdepth}{2}
% Show 1-4 in TOC
\setcounter{tocdepth}{3}

\begin{document}

%----------------------------------------------------------------------------------------
%   TOCs
%----------------------------------------------------------------------------------------
% Top Level TOC
\shorttoc{Inhaltsübersicht}{0}
\addcontentsline{toc}{chapter}{Inhaltsübersicht}
\clearpage

% Full TOC
\tableofcontents % Write out the Table of Contents

%----------------------------------------------------------------------------------------
%   Chapter
%----------------------------------------------------------------------------------------
\chapter{Chapter 1}
Lorem Ipsum...

\section{Section 1.1}
Lorem...

%----------------------------------------------------------------------------------------
%   Chapter
%----------------------------------------------------------------------------------------
\chapter{Chapter 2}
Lorem Ipsum...

\section{Section 2.1}
Lorem...

\section{Section 2.2}
Lorem...

%----------------------------------------------------------------------------------------
%   BIBLIOGRAPHY
%----------------------------------------------------------------------------------------
\label{Literaturverzeichnis}
\lhead{\emph{Literaturverzeichnis}} % Change the page header to say "Bibliography"
%\def\UrlBreaks{\do\/\do-}
\addtotoc{Literaturverzeichnis}
\bibliographystyle{apalike-german-PK} % Use the "unsrtnat" BibTeX style for formatting the Bibliography
\bibliography{Bibliography}
\clearpage

%----------------------------------------------------------------------------------------
%   VERZEICHNISSE
%----------------------------------------------------------------------------------------
\label{Abbildungsverzeichnis}
\lhead{\emph{Abbildungsverzeichnis}} % Set the left side page header to "List of Figures"
\listoffigures % Write out the List of Figures
\clearpage

\label{Tabellenverzeichnis}
\lhead{\emph{Tabellenverzeichnis}} % Set the left side page header to "List of Tables"
\listoftables % Write out the List of Tables
\clearpage

\end{document}

edit: I forgot to attach the class "thesis" I'm using. It's taken from latextemplates.com and I adopted the variables plus some namings to my needs.
Here ist the Thesis.cls:
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesClass{Thesis}
              [2007/22/02 v1.0
   LaTeX document class]
\def\baseclass{book}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{\baseclass}}
\def\@checkoptions#1#2{
  \edef\@curroptions{\@ptionlist{\@currname.\@currext}}
  \@tempswafalse
  \@tfor\@this:=#2\do{
    \@expandtwoargs\in@{,\@this,}{,\@curroptions,}
    \ifin@ \@tempswatrue \@break@tfor \fi}
  \let\@this\@empty
  \if@tempswa \else \PassOptionsToClass{#1}{\baseclass}\fi
}
\@checkoptions{11pt}{{10pt}{11pt}{12pt}}
\PassOptionsToClass{a4paper}{\baseclass}
\ProcessOptions\relax
\LoadClass{\baseclass}
\newcommand\bhrule{\typeout{------------------------------------------------------------------------------}}

\newcommand\Declaration[1]{
\btypeout{Eidesstattliche Versicherung}
\addtotoc{Eidesstattliche Versicherung}
\thispagestyle{plain}
\null\vfil
%\vskip 60\p@
\begin{center}{\huge\bf Eidesstattliche Versicherung\par}\end{center}
%\vskip 60\p@
{\normalsize #1}
\vfil\vfil\null
%\cleardoublepage
}

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule}
\def\today{\ifcase\month\or
  January\or February\or March\or April\or May\or June\or
  July\or August\or September\or October\or November\or December\fi
  \space \number\year}
\usepackage{setspace}
\onehalfspacing
\setlength{\parindent}{0pt}
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex}
\usepackage{vmargin}

\RequirePackage[utf8]{inputenc} % Allows the use of international characters (e.g. Umlauts)

%----------------------------------------------------------------------------------------
%   MARGINS
%----------------------------------------------------------------------------------------
\setmarginsrb  { 1.5in}  % left margin
                        { 0.6in}  % top margin
                        { 1.0in}  % right margin
                        { 0.8in}  % bottom margin
                        {  20pt}  % head height
                        {0.25in}  % head sep
                        {   9pt}  % foot height
                        { 0.3in}  % foot sep
%----------------------------------------------------------------------------------------
\raggedbottom
\setlength{\topskip}{1\topskip \@plus 5\p@}
\doublehyphendemerits=10000       % No consecutive line hyphens.
\brokenpenalty=10000              % No broken words across columns/pages.
\widowpenalty=9999                % Almost no widows at bottom of page.
\clubpenalty=9999                 % Almost no orphans at top of page.
\interfootnotelinepenalty=9999    % Almost never break footnotes.
\usepackage{fancyhdr}
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}}
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage}
\chead{}\lfoot{}\rfoot{}\cfoot{}
\pagestyle{fancy}
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}}
\renewcommand{\sectionmark}[1]{}
\renewcommand{\subsectionmark}[1]{}
\renewcommand{\contentsname}{Inhaltsverzeichnis}
\renewcommand{\listtablename}{Tabellenverzeichnis}
\renewcommand{\listfigurename}{Abbildungsverzeichnis}
\renewcommand{\chaptername}{Kapitel}

\renewcommand{\tablename}{Tabelle}
\renewcommand{\figurename}{Abbildung}

\renewcommand{\bibname}{Bibliographie}
\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
\hbox{}
\thispagestyle{empty}
\newpage
\if@twocolumn\hbox{}\newpage\fi\fi\fi}
\usepackage{amsmath,amsfonts,amssymb,amscd,amsthm,xspace}
\theoremstyle{plain}
\newtheorem{example}{Example}[chapter]
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{axiom}[theorem]{Axiom}
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\theoremstyle{remark}
\newtheorem{remark}[theorem]{Remark}
\usepackage[centerlast,small,sc]{caption}
\setlength{\captionmargin}{20pt}
\newcommand{\fref}[1]{Figure~\ref{#1}}
\newcommand{\tref}[1]{Table~\ref{#1}}
\newcommand{\eref}[1]{Equation~\ref{#1}}
\newcommand{\cref}[1]{Chapter~\ref{#1}}
\newcommand{\sref}[1]{Section~\ref{#1}}
\newcommand{\aref}[1]{Appendix~\ref{#1}}
\renewcommand{\topfraction}{0.85}
\renewcommand{\bottomfraction}{.85}
\renewcommand{\textfraction}{0.1}
\renewcommand{\dbltopfraction}{.85}
\renewcommand{\floatpagefraction}{0.75}
\renewcommand{\dblfloatpagefraction}{.75}
\setcounter{topnumber}{9}
\setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20}
\setcounter{dbltopnumber}{9}
\usepackage{graphicx}
\usepackage{epstopdf}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{listings}
\usepackage{lstpatch}
\lstset{captionpos=b,
        frame=tb,
        basicstyle=\scriptsize\ttfamily,
        showstringspaces=false,
        keepspaces=true}
\lstdefinestyle{matlab} {
        language=Matlab,
        keywordstyle=\color{blue},
        commentstyle=\color[rgb]{0.13,0.55,0.13}\em,
        stringstyle=\color[rgb]{0.7,0,0} }
\usepackage[pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true,
   bookmarksopenlevel=0,bookmarksnumbered=true,hypertexnames=false,
   colorlinks,linkcolor={black},citecolor={black},urlcolor={black},
   pdfstartview={FitV},unicode,breaklinks=true]{hyperref}
\pdfstringdefDisableCommands{
   \let\\\space
}
\newcommand*{\supervisor}[1]{\def\supname{#1}}
\newcommand*{\thesistitle}[1]{\def\ttitle{#1}}
\newcommand*{\examiner}[1]{\def\examname{#1}}
\newcommand*{\degree}[1]{\def\degreename{#1}}
\newcommand*{\authors}[1]{\def\authornames{#1}}
\newcommand*{\addresses}[1]{\def\addressnames{#1}}
\newcommand*{\university}[1]{\def\univname{#1}}
\newcommand*{\UNIVERSITY}[1]{\def\UNIVNAME{#1}}
\newcommand*{\department}[1]{\def\deptname{#1}}
\newcommand*{\DEPARTMENT}[1]{\def\DEPTNAME{#1}}
\newcommand*{\group}[1]{\def\groupname{#1}}
\newcommand*{\GROUP}[1]{\def\GROUPNAME{#1}}
\newcommand*{\faculty}[1]{\def\facname{#1}}
\newcommand*{\FACULTY}[1]{\def\FACNAME{#1}}
\newcommand*{\subject}[1]{\def\subjectname{#1}}
\newcommand*{\keywords}[1]{\def\keywordnames{#1}}

%----------------------------------------------------------------------------------------
%   DOCUMENT VARIABLES
%   Fill in the lines below to update the thesis template
%   If you wish to cite each of the variables defined below, look at the
%   section above for the citation command e.g. \examiner{} below is
%   defined as \examname above so you cite it as \examname
%----------------------------------------------------------------------------------------

\thesistitle{How to define TOCs} % Your thesis title - this is used in the title and abstract
%-------------------------------------------------
\supervisor{Prof. Dr. \textsc{xxx} \\ Universität xxx} % You supervisor's name - this is used in the title page
%-------------------------------------------------
\examiner{Prof. Dr. \textsc{xxx} \\ Hochschule xxx} % Your examiner's name - this is not currently used anywhere in the template, cite it with \examname if you want it
%-------------------------------------------------
\degree{xxx (M.Sc.)} % Your degree name - this is currently used in the title page and abstract
%-------------------------------------------------
\authors{\textsc{xxx}} % Your name - this is used in the title page and abstract
%-------------------------------------------------
\addresses{} % Your address - this is not currently used anywhere in the template, cite it with \addressnames if you want it
%-------------------------------------------------
\subject{} % Your subject area - this is not currently used anywhere in the template, cite it with \subjectname if you want it
%-------------------------------------------------
\keywords{} % Keywords for your thesis - this is not currently used anywhere in the template, cite it with \keywordnames if you want it
%-------------------------------------------------
\university{\texorpdfstring{% Your university's URL
                {Universität xxx \\ Hochschule xxx}} % Your university's name - this is currently used in the title page
                {Universität xxx \\ Hochschule xxx}}
%-------------------------------------------------
\UNIVERSITY{\texorpdfstring{ % Your university's URL
                {UNIVERSITÄT xxx \\ HOCHSCHULE xxx}} % Your university's name in capitals - this is currently used in the abstract page
                {UNIVERSITÄT xxx \\ HOCHSCHULE xxx}}
%-------------------------------------------------
\department{\texorpdfstring{ % Your department's URL
                {Institut xxx}} % Your department's name - used in the title page and abstract
                {Institut xxx}}
%-------------------------------------------------
\DEPARTMENT{\texorpdfstring{% Your department's URL
                {DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}} % Your department's name in capitals - this is not currently used anywhere in the template, cite it with \DEPTNAME if you want it
                {DEPARTMENT OR SCHOOL NAME (IN BLOCK CAPITALS)}}
%-------------------------------------------------
\group{\texorpdfstring{% Your research group's URL
                {xxx}} % Your research group's name - this is currently used in the title page
                {xxx}}
%-------------------------------------------------
\GROUP{\texorpdfstring{ % Your research group's URL
                {RESEARCH GROUP NAME (IN BLOCK CAPITALS)}} % Your research group's name in capitals - this is not currently used anywhere in the template, cite it with \GROUPNAME if you want it
                {RESEARCH GROUP NAME (IN BLOCK CAPITALS)}}
%-------------------------------------------------
\faculty{\texorpdfstring{% Your faculty's URL
                {xxx (M.Sc.)}} % Your faculty's name - this is currently used in the abstract page
                {xxx (M.Sc.)}}
%-------------------------------------------------
\FACULTY{\texorpdfstring{ % Your faculty's URL
                {FACULTY NAME (IN BLOCK CAPITALS)}} % Your faculty's name in capitals - this is not currently used anywhere in the template, cite it with \FACNAME if you want it
                {FACULTY NAME (IN BLOCK CAPITALS)}}
%----------------------------------------------------------------------------------------

% The default title page, this is not used in this www.latextemplates.com version
\renewcommand\maketitle{
  \btypeout{Title Page}
  \hypersetup{pdftitle={\@title}}
  \hypersetup{pdfsubject=\subjectname}
  \hypersetup{pdfauthor=\authornames}
  \hypersetup{pdfkeywords=\keywordnames}
  \thispagestyle{empty}
  \begin{titlepage}
    \let\footnotesize\small
    \let\footnoterule\relax
    \let \footnote \thanks
    \setcounter{footnote}{0}
    \null\vfil
    \vskip 60\p@
    \begin{center}
      \setlength{\parskip}{0pt}
      {\large\textbf{\UNIVNAME}\par}
      \vfill
      {\huge \bf \@title \par}
      \vfill
      {\LARGE by \par}
      \smallskip
      {\LARGE \authornames \par}
      \vfill
      {\large A thesis submitted in partial fulfillment for the \par}
      {\large degree of \degreename \par}
      \bigskip
      \bigskip
      {\large in the \par}
      {\large \facname \par}
      {\large \deptname \par}
      \bigskip
      \bigskip
      \bigskip
      {\Large \@date \par}
      \bigskip
    \end{center}
    \par
    \@thanks
    \vfil\null
  \end{titlepage}
  \setcounter{footnote}{0}%
  \global\let\thanks\relax
  \global\let\maketitle\relax
  \global\let\@thanks\@empty
  \global\let\@author\@empty
  \global\let\@date\@empty
  \global\let\@title\@empty
  \global\let\title\relax
  \global\let\author\relax
  \global\let\date\relax
  \global\let\and\relax
  \cleardoublepage
}
%----------------------------------------------------------------------------------------
%   ABSTRACT PAGE DESIGN
%----------------------------------------------------------------------------------------
\newenvironment{abstract}
{
  \btypeout{Zusammenfassung}
  \thispagestyle{empty}
  %\null\vfil
  \begin{center}
    \setlength{\parskip}{0pt}
    {\normalsize \UNIVNAME \par} % University name in capitals
    \medskip
    {\normalsize \degreename \par} % Faculty name
    \medskip
    {\huge{\textit{Zusammenfassung}} \par}
    %{\normalsize \deptname \par} % Department name
    %{\normalsize \groupname\par} % Degree name
    \bigskip
    {\normalsize\bf \@title \par} % Thesis title
    \bigskip
    {\normalsize von \authornames \par} % Author name
    \medskip
  \end{center}
}
%----------------------------------------------------------------------------------------
{
  \vfil\vfil\vfil\null
  \cleardoublepage
}
\addtocounter{secnumdepth}{1}
\setcounter{tocdepth}{6}
\newcounter{dummy}
\newcommand\addtotoc[1]{
\refstepcounter{dummy}
\addcontentsline{toc}{chapter}{#1}}
\renewcommand\tableofcontents{
\btypeout{Inhaltsverzeichnis}
\addtotoc{Inhaltsverzeichnis}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\contentsname
        \@mkboth{
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}
    \if@restonecol\twocolumn\fi
   \cleardoublepage
}\end{spacing}
}
\renewcommand\listoffigures{
\btypeout{List of Figures}
\addtotoc{Abbildungsverzeichnis}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listfigurename
      \@mkboth{\MakeUppercase\listfigurename}
              {\MakeUppercase\listfigurename}}
    \@starttoc{lof}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\renewcommand\listoftables{
\btypeout{List of Tables}
\addtotoc{Tabellenverzeichnis}
\begin{spacing}{1}{
    \setlength{\parskip}{1pt}
    \if@twocolumn
      \@restonecoltrue\onecolumn
    \else
      \@restonecolfalse
    \fi
    \chapter*{\listtablename
      \@mkboth{
          \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}
    \if@restonecol\twocolumn\fi
    \cleardoublepage
}\end{spacing}
}
\newcommand\listsymbolname{Abbreviations}
\usepackage{longtable}
\newcommand\listofsymbols[2]{
\btypeout{\listsymbolname}
\addtotoc{\listsymbolname}
    \chapter*{\listsymbolname
      \@mkboth{
          \MakeUppercase\listsymbolname}{\MakeUppercase\listsymbolname}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listconstants{Physical Constants}
\usepackage{longtable}
\newcommand\listofconstants[2]{
\btypeout{\listconstants}
\addtotoc{\listconstants}
    \chapter*{\listconstants
      \@mkboth{
          \MakeUppercase\listconstants}{\MakeUppercase\listconstants}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\listnomenclature{Symbols}
\usepackage{longtable}
\newcommand\listofnomenclature[2]{
\btypeout{\listnomenclature}
\addtotoc{\listnomenclature}
    \chapter*{\listnomenclature
      \@mkboth{
          \MakeUppercase\listnomenclature}{\MakeUppercase\listnomenclature}}
\begin{longtable}[c]{#1}#2\end{longtable}\par
    \cleardoublepage
}
\newcommand\acknowledgements[1]{
\btypeout{Acknowledgements}
\addtotoc{Acknowledgements}
\thispagestyle{plain}
\begin{center}{\huge{\textit{Acknowledgements}} \par}\end{center}
{\normalsize #1}
\vfil\vfil\null

}
\newcommand\dedicatory[1]{
\btypeout{Dedicatory}
\thispagestyle{plain}
\null\vfil
\vskip 60\p@
\begin{center}{\Large \sl #1}\end{center}
\vfil\null
\cleardoublepage
}
\renewcommand\backmatter{
  \if@openright
    \cleardoublepage
  \else
    \clearpage
  \fi
  \addtotoc{\bibname}
  \btypeout{\bibname}
  \@mainmatterfalse}
\endinput

\usepackage{listings}

edit 2: esdd suggested to remove \addcontentsline{toc}{chapter}{Inhaltsübersicht}, but this removes the overview toc from the full toc also.
Just to make really clear what I need, I attached two pictures of the tocs and how I would like to edit them:

Thanks in advance for any help!

A: I'd simply remove all references to table of contents (short and long) in both lists.
If you want to keep them, change, in Thesis.cls,
\btypeout{Inhaltsverzeichnis}
\addtotoc{Inhaltsverzeichnis}

into
\btypeout{Inhaltsverzeichnis}
\addtocontents{toc}{\string\ifdefined\string\weareinshorttoc}
\addtotoc{Inhaltsverzeichnis}
\addtocontents{toc}{\string\fi}

and in your document change
% Top Level TOC
\shorttoc{Inhaltsübersicht}{0}
\addcontentsline{toc}{chapter}{Inhaltsübersicht}
\clearpage

into
% Top Level TOC
\begingroup\def\weareinshorttoc{}
\shorttoc{Inhaltsübersicht}{0}
\addtocontents{toc}{\string\ifdefined\string\weareinshorttoc\string\else}
\addcontentsline{toc}{chapter}{Inhaltsübersicht}
\addtocontents{toc}{\string\fi}
\endgroup
\clearpage


text:
Q: AclVoter denies access to 'LIST' As soon as I set sonata_admin.security.handler to sonata.admin.security.handler.acl the only user who has access is the one with ROLE_SUPER_ADMIN.
I think I configured everything right, obviously not.
I tried:

*

*to give the user the real role ROLE_VIP_CONTACT_ADMIN instead of assigning by a fos_group, no success.

*all options forsecurity.access_decision_manager.strategy: affirmative, consensus and unanimous

*to delete all acl tables, acl:init, sonata:admin:setup-acl, with and without sonata:admin:generate-object-acl and cleared the cache every time.

With no success.
# Acme\MyBundle\Controller\CRUDController.php

$securityContext->getAdminPermissions();
# -> ["CREATE", "LIST", "DELETE", "UNDELETE", "EXPORT", "OPERATOR", "MASTER"]

dump($this->admin->getSecurityInformation());
/* -> array:3 [▼
  "GUEST" => array:2 [▼
    0 => "VIEW"
    1 => "LIST"
  ]
  "STAFF" => array:3 [▼
    0 => "EDIT"
    1 => "LIST"
    2 => "CREATE"
  ]
  "ADMIN" => array:3 [▼
    0 => "MASTER"
    1 => "OPERATOR"
    2 => "EXPORT"
  ]
] */

dump($this->getUser()->getRoles());
/* -> array:15 [▼
  0 => "ROLE_ADMIN"
  1 => "ROLE_VIP_CONTACT_GUEST"
  2 => "ROLE_VIP_CONTACT_STAFF"
  3 => "ROLE_VIP_CONTACT_ADMIN"  # <--- I gave him everything!
  [...]
  9 => "ROLE_ALLOWED_TO_SWITCH"
  [...]
  16 => "ROLE_USER"
] */

Now I open my browser and go to app_dev.php/my-path-to/vip/contact/list, resulting in an AccessDeniedException.
/edit: It's the same problem as here ACL + SonataAdminBundle + SonataUserBundle.

A: After hours of debugging, the result is to let ACL know about the LIST permission by using Sonata's AdminPermissionMap.
See SonataAdminBundle 5. Security and Documentation » Admin (Ctrl+F: security.acl.permission.map.class)
parameters:
    security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap

You might already know this.
To make a long story short: Configuration is not only done by writing some config files, but also to import the right ones.

A: On Symphony >3.1 you should use this:
services:
  security.acl.permission.map:
    class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap

instead

parameters:
      security.acl.permission.map.class: Sonata\AdminBundle\Security\Acl\Permission\AdminPermissionMap


text:
Q: xticklabels misaligned Please consider the following MWE. The same code is in another document with a larger preamble, so maybe my problem with the misaligned xticklabels is because of conflicting packages.
The first screenshot shows the results of the MWE and the second how it looks like when compiled with a larger preamble.

Note: For the MWE I did not include special formatting (e.g. colours, dashing etc).
EDIT By the way: If you take a look at the data in dataLevelerConverter2.dat you will see that there is a Kalenderwoche 42. However, in the first screenshot it seems that the xticks start with Kalenderwoche 43.
MWE
\documentclass{article}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\begin{filecontents}{dataLevelerConverter2.dat}
Wert    Kalenderwochen  Nachfrage   Nachfrage1a Nachfrage1b Nachfrage1c Nachfrage1d nachLeveler nachConverter
1   42  nan nan nan nan nan 128 608
2   43  255 255 nan nan nan 1088    608
3   44  1584    1584    1584    nan nan 960 1265
4   45  1296    nan 1296    1296    nan 1570    1265
5   46  432 nan nan 432 nan 610 610
6   47  972 nan nan 972 nan 610 610
7   48  540 nan nan 540 nan 610 610
8   49  1104    nan nan 1104    1104    610 610
9   50  0   nan nan nan 0   0   0
\end{filecontents}

%%%%Some number formatting for pgfplots%%%%
\pgfkeys{/pgf/number format/.cd,%additional code
      use comma,%additional code
       1000 sep={\,},%additional code
}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        width=10cm,
        height=6cm,
        xticklabels from table = {dataLevelerConverter2.dat}{Kalenderwochen},
        xtick from table = {dataLevelerConverter2.dat}{Wert},
%        xtick = {1,...,9},
%        xtick = data,
        xlabel=Kalenderwoche,
        ylabel=Kundennachfrage,
        legend style={at={(0.5,-0.3)},anchor=north,draw=none},
        legend columns=3
]

    \addplot table [x=Wert, y=Nachfrage] {dataLevelerConverter2.dat} ;
        \addlegendentry{label1}

    \addplot table [x=Wert, y=nachLeveler] {dataLevelerConverter2.dat} ;
        \addlegendentry{label2}

    \addplot table [x=Wert, y=nachConverter] {dataLevelerConverter2.dat} ;
        \addlegendentry{label3}

    \end{axis}
\end{tikzpicture}

\end{document}

A: Luigi's suggestion of using Kalenderwochen as the x-coordinate directly is a good idea in this concrete example. However, it won't work if Kalenderwochen indeed contains labels (numeric or otherwise): In John's text label example, the xtick={0,...,9} has to be set explicitly. Usually, one could just use xtick=data, but that only works if there are no nans in the first plot.
So, for the rare case where you need to provide labels from a table but can't use xtick=data to make sure the ticks and ticklabels are synchronised, here's a style xtick from table that works analogously to xticklabels from data:

This approach has the drawback that you're always using all ticks and ticklabels, instead of letting PGFPlots determine the appropriate number of ticks. To fix this, you can set
    xticklabel={%
        \pgfmathtruncatemacro\datarow{round(\tick)}%
        \pgfplotstablegetelem{\datarow}{Kalenderwochen}\of{dataLevelerConverter2.dat}%
        \pgfplotsretval%
    }

which will get the appropriate tick label for each tick position from the data table.

Code for the first example
\documentclass{article}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{
    xticks from table/.code 2 args={%
        \pgfplotstablegetrowsof{#1}
        \pgfmathsetmacro\pgfplotstabletotalrows{\pgfplotsretval-1}
        \edef\ticklist{}
            \pgfplotstableforeachcolumnelement{#2}\of#1\as\cell{%
                \edef\ticklist{\ticklist\cell\ifnum\pgfplotstablerow<\pgfplotstabletotalrows,\fi}
            }
        \pgfplotsset{xtick=\ticklist}
    },
}

\begin{filecontents}{dataLevelerConverter2.dat}
Wert    Kalenderwochen  Nachfrage   Nachfrage1a Nachfrage1b Nachfrage1c Nachfrage1d nachLeveler nachConverter
1   42  nan nan nan nan nan 128 608
2   43  255 255 nan nan nan 1088    608
3   44  1584    1584    1584    nan nan 960 1265
4   45  1296    nan 1296    1296    nan 1570    1265
5   46  432 nan nan 432 nan 610 610
6   47  972 nan nan 972 nan 610 610
7   48  540 nan nan 540 nan 610 610
8   49  1104    nan nan 1104    1104    610 610
9   50  0   nan nan nan 0   0   0
10   51  255 255 nan nan nan 1088    608
11   52  1584    1584    1584    nan nan 960 1265
12   1  1296    nan 1296    1296    nan 1570    1265
\end{filecontents}

%%%%Some number formatting for pgfplots%%%%
\pgfkeys{/pgf/number format/.cd,%additional code
      use comma,%additional code
       1000 sep={\,},%additional code
}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        width=10cm,
        height=6cm,
        xticklabels from table = {dataLevelerConverter2.dat}{Kalenderwochen},
        xticks from table = {dataLevelerConverter2.dat}{Wert},
        xlabel=Kalenderwoche,
        ylabel=Kundennachfrage,
        legend style={at={(0.5,-0.3)},anchor=north,draw=none},
        legend columns=3
]

    \addplot table [x=Wert, y=Nachfrage] {dataLevelerConverter2.dat} ;
        \addlegendentry{label1}

    \addplot table [x=Wert, y=nachLeveler] {dataLevelerConverter2.dat} ;
        \addlegendentry{label2}

    \addplot table [x=Wert, y=nachConverter] {dataLevelerConverter2.dat} ;
        \addlegendentry{label3}

    \end{axis}
\end{tikzpicture}

\end{document}

Code for the second example:
\documentclass{article}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{pgfplots}

\pgfplotsset{
    xticks from table/.code 2 args={%
        \pgfplotstablegetrowsof{#1}
        \pgfmathsetmacro\pgfplotstabletotalrows{\pgfplotsretval-1}
        \edef\ticklist{}
            \pgfplotstableforeachcolumnelement{#2}\of#1\as\cell{%
                \edef\ticklist{\ticklist\cell\ifnum\pgfplotstablerow<\pgfplotstabletotalrows,\fi}
            }
        \pgfplotsset{xtick=\ticklist}
    },
}

\begin{filecontents}{dataLevelerConverter2.dat}
Wert    Kalenderwochen  Nachfrage   Nachfrage1a Nachfrage1b Nachfrage1c Nachfrage1d nachLeveler nachConverter
1   42  nan nan nan nan nan 128 608
2   43  255 255 nan nan nan 1088    608
3   44  1584    1584    1584    nan nan 960 1265
4   45  1296    nan 1296    1296    nan 1570    1265
5   46  432 nan nan 432 nan 610 610
6   47  972 nan nan 972 nan 610 610
7   48  540 nan nan 540 nan 610 610
8   49  1104    nan nan 1104    1104    610 610
9   50  0   nan nan nan 0   0   0
10   51  255 255 nan nan nan 1088    608
11   52  1584    1584    1584    nan nan 960 1265
12   1  1296    nan 1296    1296    nan 1570    1265
\end{filecontents}

%%%%Some number formatting for pgfplots%%%%
\pgfkeys{/pgf/number format/.cd,%additional code
      use comma,%additional code
       1000 sep={\,},%additional code
}

\begin{document}
\begin{tikzpicture}
    \begin{axis}[
        width=6cm,
        height=6cm,
        enlargelimits=false,
        xticklabel={%
            \pgfmathtruncatemacro\datarow{round(\tick)}%
            \pgfplotstablegetelem{\datarow}{Kalenderwochen}\of{dataLevelerConverter2.dat}%
            \pgfplotsretval%
        },
        xlabel=Kalenderwoche,
        ylabel=Kundennachfrage,
        legend style={at={(0.5,-0.3)},anchor=north,draw=none},
        legend columns=3
]

    \addplot table [x expr=\coordindex, y=Nachfrage] {dataLevelerConverter2.dat} ;
        \addlegendentry{label1}

    \addplot table [x expr=\coordindex, y=nachLeveler] {dataLevelerConverter2.dat} ;
        \addlegendentry{label2}

    \addplot table [x expr=\coordindex, y=nachConverter] {dataLevelerConverter2.dat} ;
        \addlegendentry{label3}

    \end{axis}
\end{tikzpicture}

\end{document}

A: @Luigi and @Jake are right.
xticklabels are numbers
I wanted to use the column Kalenderwochen in dataLevelerConverter2.dat as xticklabels. As this column contains numbers I can write
\addplot table [x=Kalenderwochen, y=Nachfrage]

instead of
\addplot table [x=Wert, y=Nachfrage]

and delete
xticklabels from table = {dataLevelerConverter2.dat}{Kalenderwochen}

xticklabels are not numbers
In the case the column Kalenderwochen contains other information than numbers (e.g. "first data set", "second data set") one must write
\addplot table [x=Wert, y=Nachfrage]
xticklabels from table = {dataLevelerConverter2.dat}{Kalenderwochen}

MWE
\documentclass{article}
\usepackage{filecontents}
\usepackage{tikz}
\usepackage{pgfplots}
\usepgfplotslibrary{groupplots}

\begin{filecontents}{Numbers.dat}
Wert    Kalenderwochen  Nachfrage   Nachfrage1a Nachfrage1b Nachfrage1c Nachfrage1d nachLeveler nachConverter
1   42  nan nan nan nan nan 128 608
2   43  255 255 nan nan nan 1088    608
3   44  1584    1584    1584    nan nan 960 1265
4   45  1296    nan 1296    1296    nan 1570    1265
5   46  432 nan nan 432 nan 610 610
6   47  972 nan nan 972 nan 610 610
7   48  540 nan nan 540 nan 610 610
8   49  1104    nan nan 1104    1104    610 610
9   50  0   nan nan nan 0   0   0
\end{filecontents}

\begin{filecontents}{Strings.dat}
Wert    Kalenderwochen  Nachfrage   Nachfrage1a Nachfrage1b Nachfrage1c Nachfrage1d nachLeveler nachConverter
1   first  nan nan nan nan nan 128 608
2   second  255 255 nan nan nan 1088    608
3   third  1584    1584    1584    nan nan 960 1265
4   fourth  1296    nan 1296    1296    nan 1570    1265
5   fifth  432 nan nan 432 nan 610 610
6   sixth  972 nan nan 972 nan 610 610
7   seventh  540 nan nan 540 nan 610 610
8   eighth  1104    nan nan 1104    1104    610 610
9   ninth  0   nan nan nan 0   0   0
\end{filecontents}

%%%%Some number formatting for pgfplots%%%%
\pgfkeys{/pgf/number format/.cd,%additional code
      use comma,%additional code
       1000 sep={\,},%additional code
}

\begin{document}

\begin{tikzpicture}
    \begin{axis}[
        width=10cm,
        height=6cm,
        xlabel=Kalenderwoche,
        ylabel=Kundennachfrage,
        legend style={at={(0.5,-0.3)},anchor=north,draw=none},
        legend columns=3
]

    \addplot table [x=Kalenderwochen, y=Nachfrage] {Numbers.dat} ;
        \addlegendentry{label1}

    \addplot table [x=Kalenderwochen, y=nachLeveler] {Numbers.dat} ;
        \addlegendentry{label2}

    \addplot table [x=Kalenderwochen, y=nachConverter] {Numbers.dat} ;
        \addlegendentry{label3}

    \end{axis}
\end{tikzpicture}

\begin{tikzpicture}
    \begin{axis}[
        width=10cm,
        height=6cm,
        xticklabels from table = {Strings.dat}{Kalenderwochen},
        xtick = {1,...,9},
        xticklabel style={rotate=90},
        xlabel=Kalenderwoche,
        xlabel style={at={(ticklabel cs:0.5)},anchor=near ticklabel},
        ylabel=Kundennachfrage,
        legend style={at={(0.5,-0.3)},anchor=north,draw=none},
        legend columns=3
]

    \addplot table [x=Wert, y=Nachfrage] {Strings.dat} ;
        \addlegendentry{label1}

    \addplot table [x=Wert, y=nachLeveler] {Strings.dat} ;
        \addlegendentry{label2}

    \addplot table [x=Wert, y=nachConverter] {Strings.dat} ;
        \addlegendentry{label3}

    \end{axis}
\end{tikzpicture}

\end{document}


text:
Q: element.style is increasing font size arbitrarily This page was auto-generated by Emacs' org-mode HTML export. I've got it set up to use MathJax rendering of LaTeX symbols. On the third column of the There Exists line I've used inline LaTeX symbols surrounded by "$"
$\exists  x \mid x2>x$

which is proper LaTeX embedding, whereas the line above and below I haven't, i.e., Emacs just picks up LaTeX markup and inserts it without using "$". If you Inspect (I'm using Chrome) this code, you'll see it is throwing in a font-size increase for only this LaTeX markup, seemingly arbitrarily, making the symbols look abnormally large compared to the other symbols.
<span style="display: inline-block; position: relative; width: 5.681em; height: 0px; font-size: 129%;">

How can I stop, block, override this element.style being inserted and blowing up my font size?
element.style {
    display: inline-block;
    position: relative;
    width: 5.713em;
    height: 0px;
    font-size: 129%;
}

Update:
I've narrowed the problem down to something in my custom stylesheet.css:
table {
    /* font-family: monospace; */
    font-family:'eulermedium_18';
    /* font-size: 1.05em; */
    margin-left:5%;
    margin-right:auto;
    margin-top:0.5em;
    margin-bottom:0.5em;
    line-height: 1.5em;
}

namely, the font-family. Above I've commented out monospace, which gave me a 129% arbitrary size. But then as you see I tried AMS Euler (ttf version converted by Font Squirrel, as is the Computer Modern) and it caused the $...$ parts of the org-mode table in question to reduce the font size to 53%! Craziness. Again, with no font-family in table sizes are normal across LaTeX/MathJax and regular text. Is there any way to have the org-mode HTML export for MathJax stuff use my fonts correctly?

A: It seems to be related to font-family too. Column 3 of There Exists line seem to be use font as STIXGeneral-Italic, while the default font used at other places seem to be monospace. You can override these styles in your stylesheet.css using !important directive.
.mrow span{
    font-family: inherit!important;
    font-size: 100%;
}


text:
Q: convert a nested set into data (json/html) for use in jstree I have a database with a table, in which data is stored as a nested set. The table looks like this:
id      lft rgt name                  depth
0       1   768 ROOT                  0
550300  2   3   external              1
580943  4   5   teachers              1
510000  6   753 company BV            1
213000  7   14  Buying                2
913010  8   9   buying center         3
573100  10  11  buying generic        3
516300  12  13  buying service center 3
513900  15  48  finance               2

The data represents a company structure. I would like to display it with jstree
I thought the best way to do that, was to first place it in a multidimensional array. For that I used this function:
function _formatTreeIntoArray(&$tree, $current_depth = 0)
{
    $formattedTree = array();
    while($leaf = current($tree))
    {
        if($leaf['depth'] > $current_depth)
        {
            $formattedTree[] = _formatTreeIntoArray($tree, $leaf['depth']);
        }
        elseif($leaf['depth'] < $current_depth)
        {
            return $formattedTree;
        }
        else
        {
            $formattedTree[] = $leaf;
            next($tree);
        }
    }

    return $formattedTree;
}

that I found here: https://gist.github.com/taion809/6510212 and slightly modified.
It seems to be doing a pretty good job (Tried the solution in here before, but there I was losing nodes: How do I format Nested Set Model data into an array?)
Now my next challenge it to create a jtree out of it, which should either look like this:

Root node 1

Child node 1

Child node 2

or this:
$('#using_json').jstree({ 'core' : {
    'data' : [
       'Simple root node',
       {
         'text' : 'Root node 2',
         'state' : {
           'opened' : true,
           'selected' : true
         },
         'children' : [
           { 'text' : 'Child 1' },
           'Child 2'
         ]
      }
    ]
} });

I found a function in this topic: PHP Array to jsTree , but since the function that turns the nested set into a array creates many array entries without a name for the key, I get a lot of extra levels in the tree with just a number as name, and without the proper children.
I was wondering how I could solve this, and if there's maybe a better way to achieve my goal.

A: There are two formats you can use to pass JSON object to jsTree to build tree.
I would use the second 'flat' one like below.  You will have to build it server-side of course.
[
  { "id": "root", "parent": "#", "text": "ROOT" },
  { "id": "external", "parent": "root", "text": "external" },
  { "id": "teachers", "parent": "root", "text": "teachers" },
  { "id": "companyBV", "parent": "root", "text": "company BV" },
  { "id": "buying", "parent": "companyBV", "text": "Buying" },
  { "id": "finance", "parent": "companyBV", "text": "finance" },
  { "id": "buyingCenter", "parent": "buying", "text": "buying center" },
  { "id": "buyingGeneric", "parent": "buying", "text": "buying generic" },
  { "id": "buyingSCenter", "parent": "buying", "text": "buying service center" }
]

On client side just feed it to the jsTree config:
$('#jstree').jstree({
    core: {
      data: data
    }
})

Check demo - Fiddle Demo


text:
Q: Angular Screenshot Generator I'm building a simple Angular screenshot generator using this jQuery plugin.
Plunker
This is my index.html file:
<!DOCTYPE html>

    <meta charset="utf-8" />
    <meta content="width=device-width, initial-scale=1" name="viewport" />
    <title>Angular Screenshot</title>

        <form ng-submit="submit()">
            URL:
            <input type="text" placeholder="Insert URL" ng-model="url" autofocus id="urlbox">

            <input type="submit" value="Generate Screenshot" id="submitbtn">
        </form>

And this is my url2img.js file:
$(window).load(function() {

    $('img[data-url]').each(function() {
        $.ajax({
            url: 'https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=' + $(this).data('url') + '&screenshot=true',
            context: this,
            type: 'GET',
            dataType: 'json',
            success: function(data) {
                data = data.screenshot.data.replace(/_/g, '/').replace(/-/g, '+');
                $(this).attr('src', 'data:image/jpeg;base64,' + data);
            }
        });
    });

});

When I open the page, I get this error in my console:
GET https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=&screenshot=true 400 (Bad Request)

When I hard coded target URL inside the data-url, it's working perfectly. But when I put {{url}}, the error is showing up.
How to fix this issue and pass the ng-model="url" data to the data-url only AFTER I click the Generate Screenshot button?

A: Why use jQuery at all?
$scope.submit = function() {
    var url = 'https://www.googleapis.com/pagespeedonline/v1/runPagespeed?url=' + encodeURIComponent($scope.url) + '&screenshot=true';
    $http.get(url)
        .success(function(data) {
            data = data.screenshot.data.replace(/_/g, '/').replace(/-/g, '+');
            $scope.src =  'data:image/jpeg;base64,' + data;
        });

}

And then use .


text:
Q: Harris Corner Detection Highlighting all edges not corners I need to implement Harris corner detection, which should only have positive R values. If I use threshold of R>0, it highlights nothing, if R < 0 however, from even -0.00001 to -1000000 it outputs perfect edge detection, but no corners.
Input and output:
http://imgur.com/a/TtQSD\
Main Code:
 Bitmap b = (Bitmap)pictureBox1.Image;
 var i = IntensityMat(b);
 var n = Mask(i,-0.00000001);
 var ty = ToBit(n);
 pictureBox1.Image = ty;

Functions:
    public double Intensity(Color c)
    {
        int x = c.R;
        int y = c.G;
        int z = c.B;
        return Math.Sqrt(x * x + y * y + z * z);
    }

    public double Trace(double[,] m)
    {
        double sum = 0;

        for (int i = 0; i < m.GetLength(0); i++)
        {
            sum += m[i, i];
        }

        return sum;
    }

    public double[,] M(double ix,double iy)
    {
        double[,] m = new double[2, 2];

        m[0, 0] = ix*ix;
        m[1, 1] = iy*iy;
        m[0, 1] = ix * iy;
        m[1, 0] = ix * iy;

        return m;
    }

    public double Det(double[,] m)
    {
        return m[1, 1] * m[0, 0] - m[0, 1] * m[1, 0];
    }

    public double R(double[,] m,double k=0.04)
    {
        var t = Trace(m);
        return Det(m) - k * t * t;
    }

    int[,] IntensityMat(Bitmap b)
    {
        int[,] n = new int[b.Width, b.Height];

        for (int i = 0; i < b.Width; i++)
        {
            for (int j = 0; j < b.Height; j++)
            {
                Color c = b.GetPixel(i, j);
                n[i, j] = (int)Intensity(c);
            }
        }

        return n;
    }

    Bitmap ToBit(int[,] bd)
    {
        Bitmap b = new Bitmap(bd.GetLength(0), bd.GetLength(1));
        for (int i = 0; i < b.Width; i++)
        {
            for (int j = 0; j < b.Height; j++)
            {
                var t = bd[i, j];
                b.SetPixel(i, j, Color.FromArgb(t, t, t));
            }
        }

        return b;
    }

    int[,] Mask(int[,] m,double thresh)// m matrix of I
    {
        int[,] n = new int[m.GetLength(0), m.GetLength(1)];

        for (int i = 1; i < m.GetLength(0); i++)
        {
            for (int j = 1; j < m.GetLength(1); j++)
            {
                double ix = Math.Abs(m[i-1,j]-m[i,j]);
                double iy = Math.Abs(m[i , j-1] - m[i, j]);

                var lap = M(ix, iy);
                var r = R(lap);

                if (r > thresh)
                {
                    n[i, j] = 255;
                }
            }
        }

        return n;
    }


text:
Q: Divide TimeSpan in c# I have a TimeSlot class:
public class TimeSlot
{
private TimeSpan start;
private TimeSpan end;
}

I need to implement this function:
Public List<TimeSlot> GetDividedTimeSlot(TimeSlot timeslot, int durationInMinutes)

The function gets a time slot and time-duration in minutes, and divides the time slot into the maximum amount of time slots that are in the range of its start and end time and each one of them has the same time-duration as given. The time slots should also be in differences of quarter of an hour from each other.
For example:
Assume the timespan is 17:00 – 19:00, and the duration is 90 minutes.
The expected list is:
17:00 – 18:30 , 17:15 – 18:45, 17:30 – 19:00
What I tried:
              List<TimeSlot> dividedTimeSlots=new List<TimeSlot>();
              TimeSpan start = timeSlot.start;
              TimeSpan end = timeSlot.end;
              TimeSpan currentEnd = new TimeSpan();
              TimeSlot newTimeSlot;

              while (end.Subtract(start).TotalMinutes >= durationInMinutes)
                {
                    //currentEnd should be equals to the start time + timeDuration
                    currentEnd = ((DateTime.Now + start).AddMinutes(durationInMinutes)).TimeOfDay;
                    newTimeSlot = new TimeSlot();
                    newTimeSlot.start = start;
                    newTimeSlot.end = currentEnd;
                    dividedTimeSlots.Add(newTimeSlot);
                    start = (DateTime.Now.AddMinutes(15) + start).TimeOfDay;
                }
            return dividedTimeSlots;

But the given result is strange, it is not connected to the original time.
What is wrong is the code?
Thanks a lot.

A: The use of DateTime.Now is the cause of the issue.  Since DateTime.Now refers to this instant in time, the resulting time is now based on the current time combined with the spans you are working with.
You have 2 options for adding time.  Both are essentially the same, each returning a new TimeSpan object.
Using + Operator

Adds two specified TimeSpan instances.

Languages that do not support custom operators can call the Add method instead.
The equivalent method for this operator is TimeSpan.Add(TimeSpan)

var originalTime = new TimeSpan(1, 10, 30);
var additionalTime = new TimeSpan(0, 10, 30);

var resultingTimespan = originalTime + additionalTime;

Using Add Function

Returns a new TimeSpan object whose value is the sum of the specified TimeSpan object and this instance.

var originalTime = new TimeSpan(1, 10, 30);
var additionalTime = new TimeSpan(0, 10, 30);

var resultingTimespan = originalTime.Add(additionalTime);


text:
Q: Returning a true value instead of integer value in prolog I have a simple function below which takes 2 lists ( with the same size) and a variable which stores some result.
My intention was to compare the first list's head with the second one and increase the result by one, and return it.
But instead I get true / false.
myfunction( [], [], 0).
myfunction([H1|T1], [H2|T2], N) :-
        H1 > H2 -> myfunction(T1, T2, N1 + 1); myfunction(T1, T2, N1), N is N1 .

A: You're treating Prolog like an imperative/procedural language, but it doesn't work that way. You should read through some Prolog tutorials and/or books.
In Prolog, you define a predicate which defines a relation. When you define a predicate with variables, you are saying that, These variables are related in such and such a way if.... If Prolog succeeds in verifying the relation is true, the predicate response with "true" or "yes". Otherwise, it responds with "false" or "no".
Here's a rework of what you're trying to do:
my_predicate([], [], 0).

This relation is the "base case" and says that the count of cases where the corresponding values in the first list are greater than the second when the lists are empty is 0.
my_predicate([H1|T1], [H2|T2], N) :-
    my_predicate(T1, T2, N1),
    (  H1 > H2
    -> N is N1 + 1
    ;  N = N1
    ).

This relation says that N is the count of cases where the corresponding values in the first list are greater than the second if N1 is the count of cases for the tails, and N is N1 + 1 if the current head is greater, otherwise N is N1.
If you want to make it tail recursive for efficiency, you can use an accumulator:
my_predicate(L1, L2, N) :-
    my_predicate(L1, L2, 0, N).

my_predicate([], [], N, N).
my_predicate([H1|T1], [H2|T2], A, N) :-
    (  H1 > H2
    -> A1 is A + 1
    ;  A1 = A
    ),
    my_predicate(T1, T2, A1, N).

Note that the above definition of my_predicate/3 assumes you want failure if the lists are different length. If you don't want failure in those cases, you would need to redefine the base case(s).


text:
Q: After AVPlayer's first failure, I can never receive KVO callback any more Just as what I explain above, If I start the app and first turn off the wifi and then try to play a music with AVPlayer, I will receive a AVPlayerItemStatusFailed, but after that, I can no longer receive any KVO callback even if I turn on the wifi again.
On the other situation, if I run the app and first to turn on wifi and play, I can receive AVPlayerItemStatusReadyToPlay and after that, I can continue to receive KVO callback even if I turn wifi off...
So how to fix the first situation??
@interface ViewController ()

@property (strong, nonatomic) AVPlayer *player;
@property (assign, nonatomic) NSInteger index;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
}

- (IBAction)buttonPressed:(UIButton *)sender {
    [self.player.currentItem removeObserver:self forKeyPath:@"status"];
    NSLog(@"removed %@", self.player.currentItem);

    AVPlayerItem *item = [[AVPlayerItem alloc] initWithURL:[NSURL URLWithString:self.urls[self.index]]];

    [item addObserver:self forKeyPath:@"status" options:NSKeyValueObservingOptionNew context:nil];
    NSLog(@"added %@", item);

    [self.player replaceCurrentItemWithPlayerItem:item];

}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context {
    if ([keyPath isEqualToString:@"status"]) {
        if ([object isMemberOfClass:[AVPlayerItem class]]) {
            AVPlayerItem *playerItem = (AVPlayerItem *)object;
            switch (playerItem.status) {
                case AVPlayerItemStatusFailed:
                    NSLog(@"failed");
                    break;
                case AVPlayerItemStatusReadyToPlay:
                    NSLog(@"ready");
                    break;
                case AVPlayerItemStatusUnknown:
                    NSLog(@"unknown");
                    break;
            }
        }
    }
}

- (AVPlayer *)player {
    if (!_player) {
        _player = [[AVPlayer alloc] init];
    }
    return _player;
}

- (NSArray *)urls {
    return @[@"https://of92d29bn.qnssl.com/record1.m4a", @"https://of92d29bn.qnssl.com/record2.m4a"];
}

- (NSInteger)index {
    if (_index == 0) {
        _index = 1;
    } else {
        _index = 0;
    }
    return _index;
}

This is all my code.

A: I had the same issue and found a solution:
Reset current item to nil before using the new one:
[self.player replaceCurrentItemWithPlayerItem:nil];
[self.player replaceCurrentItemWithPlayerItem:item];

This doesn't make much sense, and there's probably a bug in AVPlayer's implementation somewhere. But this worked for me.


text:
Q: sox library call main, and error is can't open input file `1', why? I use the sox library on android, and i use the command to change the channel of mp3 file

sox /storage/emulated/0/Music/Drivethrough.mp3 -c 1 /storage/emulated/0/Android/data/com.tian.xxx/cache/temp/results.mp3

when i run it, display
can't open input file `1': No such file or directory

and my code is:
int mymain(int argc, char **argv, const char *tempPath);

here is the code detail: https://github.com/pxhbug123/SoxLibInAndroid/blob/master/soxcommandlibrary/src/main/sox/src/sox.c#L2908
I do not know why ?
I use this method to call sox
https://github.com/pxhbug123/SoxLibInAndroid/blob/master/soxcommandlibrary/src/main/sox/src/JniNative.c#L265

A: solved it.  just replace the '-c' to '--channels'


text:
Q: Change TeXworks background in Mac OS I am trying to set a dark theme in TeXworks on Mac OS. I found the following link
How can I set a dark theme in TeXworks?
showing how we can do in Windows.
But I am not sure we can do the same in Mac, can we? Could anyone tell me how to do it?

A: Regarding the how-to instructions you found in an earlier query, the only thing that's meaningfully different for TeXworks under MacOS compared TeXworks under Windows is the location of the executable program. If your system has MacTeX, if TeXworks was installed along with MacTeX, and if you chose the default folder names throughout, the executable program should be at
/Applications/TeX/TeXworks.app/Contents/MacOS/TeXworks

The white-on-black instructions should otherwise be exactly the same as in the earlier posting:

*

*Create a file called mystyle.css (using, say, TeXworks as the editor) with the following contents:
QTextEdit {
    background-color: black;
    color: white;            /* sets the main text color */
}

Save this file in the directory where you keep most (or at least some of) your tex files. E.g., I've saved the file to ~/documents/tex. (tex is a directory I created.)

*Open a command prompt window and type
/Applications/TeX/TeXworks.app/Contents/MacOS/TeXworks -stylesheet ~/documents/tex/mystyle.css

It may take a few seconds, but then the TeXworks program should start. At first the interior of the window will be all black because, after all, that's what the css file tells it to show. Once you start typing, the material will show up as white on black.
Happy TeXworking!


text:
Q: Unable to push elements in two dimensional list in java I pushed subset list in subsets, two dimensional list but the returned value  is an empty two dimensional list, Why ?
public class Solution {
  public List<List<Integer>> subsets(int[] nums) {

    List<Integer> subset = new ArrayList<>();
    List<List<Integer>> subsets = new ArrayList<>();

    int x = (int) Math.pow(2,nums.length);
    for(int i=0;i<x;i++){
        for(int j=0;j<nums.length;j++){
            if((i & (1<<j))!=0)
                subset.add(nums[j]);
        }
        Collections.sort(subset);
        subsets.add(subset);
        subset.clear();
    }
    return subsets;
  }
}

A: look at your code,
 subsets.add(subset);
 subset.clear();

you are adding your list, and then wiping it content.
I suggest you to move instantiation of subset to your loop, then on each iteration you will have new subset element

A: When you call List#add(var) you're storing the same reference that var points and now that reference is pointed from two places: inside List and from var. Since you don't store a copy of the list but the same list referenced by var and List is mutable, when you change the state of var, this change will be also reflected in the list stored inside the other container.
In your current code, you're calling subset#clear after adding subset into subsets, so since you're clearing the contents of subset, the list object reference stored in subset will also be affected (because it's the same list after all). If you want to keep adding elements using the same list, you should create a new object reference, like this:
subsets.add(subset);
//subset.clear();
subset = new Arrayist<>();


text:
Q: Как переназначить title и placeholder для поля email в django-allauth Я использую django-allauth в django проекте для аутентификации на сайте. В шаблоны поля заполняются django-crispy-forms. Я нашел как переопределить заголовок и заполнитель для поля пароль, но как переопределить эти строки для поля e-mail не могу разобраться..
forms.py
...
class LoginForm(forms.Form):

# переопределяя этот атрибут изменяется как заголовок поля, так и заполнитель.
    password = PasswordField(label=_("custom_name_for_label_Pass))

https://github.com/pennersr/django-allauth/blob/master/allauth/account/forms.py
Для аутентификации использую метод с e-mail.
Подскажите плиз как найти решение! Заранее спасибо за помощ!

A: Нашел решение, не обратил внимание на присвоение атрибута login_field.
your_app/forms.py

from allauth.account.forms import LoginForm, PasswordField

class CustomLoginForm(LoginForm):

    password = PasswordField(label="Пароль ")

    def __init__(self, *args, **kwargs):
        self.request = kwargs.pop('request', None)
        super(LoginForm, self).__init__(*args, **kwargs)

        login_widget = forms.TextInput(attrs={'type': 'email',
                                                'placeholder':
                                                ('введите адрес эл.почты'),
                                                'autofocus': 'autofocus'})
        login_field = forms.EmailField(label=("Почта"),
                                        widget=login_widget)

        self.fields["login"] = login_field #не обратил внимание на это переопределение


text:
Q: Canvas zoom in and zoom out, is there a better way to implement it? I have created a custom class derived from Canvas, which contain elements which will be derived from Visual. The canvas also contains a grid which i have created by creating lines.
Now for zooming, i remove everything from the canvas, resize the canvas (which is placed inside ScrollViewer), and redraw everything that is on it. Is there a better way to implement zoom, something that is provided, which allows me to scroll and zoom, and somehow create a viewport, that i can move and resize (for scrolling and zooming)? Because my concern is that soon there will be complex shapes, curves and points placed on the canvas, and maybe by the thousands, and things will get pretty slow if i use the approach that i am using currently.
Please tell if there is a better way.

A: If you don't want to affect the layout, then I would suggest you to use RenderTransform instead of LayoutTransform.   So something like this:
<Canvas>
    <Canvas.RenderTransform>
        <ScaleTransform ScaleX="1" ScaleY="1"/>
    </Canvas.RenderTransform>
    <!--- other controls -->
</Canvas>

You may also would like to use RenderTransformOrigin dependency property of UIElement, and you can do zoom-in and out, from code behind changing the value of ScaleX and ScaleY.
By the way, you also would like to read these before doing what you want to do:

*

*RenderTransform vs. LayoutTransform (Petzold's blog)

*LayoutTransform vs. RenderTransform in WPF

*LayoutTransform vs. RenderTransform

A: From the sound of it, it seems like using a scale transform will allow you to perform the zooming that you need without all the re-drawing and whatnot.
From: Is it possible to ScaleTransform everything on a Canvas/Grid except for 1 Control?
<Canvas>
    <Canvas.LayoutTransform>
        <!-- Adjust ScaleX and ScaleY in lock-step to zoom -->
        <ScaleTransform ScaleX="1" ScaleY="1" CenterX=".5" CenterY=".5" />
    </Canvas.LayoutTransform>
    <!-- Some controls here -->
/>
</Canvas>


text:
Q: Check whether the quotient ring $R:=\mathbb{C}[x,y,z]/(xy-z^2)$ is a field or an integral domain
Given the quotient ring $R:=\mathbb{C}[x,y,z]/(xy-z^2)$, I've to check whether it's a field or an integral domain.

I'd say that $R$ is a field and an integral domain because $(xy-z^²)$ is irreducible in $\mathbb{C}[x,y,z]$ (Eisenstein with $x \in \mathbb{C}[x,y][z]$).
However, I know that $R$ is not a field. I don't know what I've done wrong. Is my application of Eisenstein criteria false? How can I show that $R$ is not a field, but an integral domain?

A: Hint:
$\mathbf C[X,Y,Z]$ is a U.F.D., so ideals generated by irreducible elements have height $1$. Can these ideals be maximal?

A: A quotient ring is a field if and only if the original ideal is maximal. Use the fact that $\mathbb{C}[x,y,z]$ has natural gradings by degree; does $(xy-z^2)$ contain any elements of degree $1$?


text:
Q: Declaring XML output parameters with ADODB in ASP Classic I'm working with an ASP Classic legacy code base attempting to call an existing SQL Server stored procedure that declares output parameters with an XML data type.
However, every time I try to execute the stored proc I get this error:
0x80040e14 - Microsoft OLE DB Provider for ODBC Drivers: [Microsoft][ODBC SQL Server Driver][SQL Server]Implicit conversion from data type xml to varchar is not allowed. Use the CONVERT function to run this query.

I've experimented with a list of ADODB types, trying to find one that works, and haven't had any luck.  I've also grepped our legacy code base for examples of other stored procs with xml output parameters being called, but wasn't able to find any.
Is there a way around this without updating the stored procedure to not use an XML type for its output parameter?  For example, could it be possible to declare a null output parameter type or just ignore this parameter?
Thanks for any suggestions.


text:
Q: odbc_connect not working on unixODBC (LINUX) I've included this code in my functions.php of current active theme and works perfectly (i.e: I upload the .mdb file on the server first and then read the tables from the file) on WINDOWS PLATFORM. It's just as easy as we're using MySQL DB.
$dbName = $uploadfile;

$conn = odbc_connect("Driver={Microsoft Access Driver (*.mdb)};Dbq=$dbName", "", "");

if($conn != null){

//echo "";exit;

// reading all the tables (data) from mdb file uploaded
$cdc_trans = odbc_exec($conn, "SELECT * FROM axs_web_cdc_trans");
$dealers = odbc_exec($conn, "SELECT * FROM axs_web_dealers");
$web_item = odbc_exec($conn, "SELECT * FROM axs_web_item");
$parties = odbc_exec($conn, "SELECT * FROM axs_web_parties");
$trans = odbc_exec($conn, "SELECT * FROM axs_web_trans");
$voch = odbc_exec($conn, "SELECT * FROM axs_web_voch");

// insert for axs_web_cdc_trans
while($row = odbc_fetch_array($cdc_trans)){
    //break;
        $cdc_trans_date = $row['CDC_TRANS_DATE'];
        $agent_code = $row['AGENT_CODE'];
        $party_user_code = $row['PARTY_USER_CODE'];
        $nature = $row['NATURE'];
        $quantity = $row['CDC_QTY'];
        $item = $row['TRANS_ITEM_SYMBOL'];
        $us_qty = $row['UNSETTLED_QTY'];

        $sql = "INSERT INTO axs_web_cdc_trans (CDC_TRANS_DATE,AGENT_CODE,PARTY_USER_CODE, NATURE, CDC_QTY,TRANS_ITEM_SYMBOL,UNSETTLED_QTY) VALUES ('$cdc_trans_date', '$agent_code', '$party_user_code', '$nature', '$quantity', '$item', '$us_qty')";

        mysql_query($sql) or die("Error: ".mysql_error());
    }

    // insert for axs_web_dealers
    while($row = odbc_fetch_array($dealers)){
    //break;
        $dealer_code = $row['DEALER_CODE'];
        $dealer_name = $row['DEALER_NAME'];
        $cnic = $row['DEALER_NIC_NO'];
        $dealer_add = $row['DEALER_ADDRESS'];
        $dealer_cell = $row['DEALER_MOBILE_NO'];
        $dealer_email = $row['DEALER_EMAIL'];

        $check_user = "SELECT * FROM axs_web_dealers WHERE DEALER_CODE = $dealer_code";

        $chk_res = mysql_query($check_user) or die("Error: ".mysql_error());

        if(mysql_fetch_array($chk_res) > 0)
            continue;

        else{
                $sql = "INSERT INTO axs_web_dealers (DEALER_CODE, DEALER_NAME, DEALER_NIC_NO, DEALER_ADDRESS, DEALER_MOBILE_NO, DEALER_EMAIL) VALUES ('$dealer_code', '$dealer_name', '$cnic', '$dealer_add', '$dealer_cell', '$dealer_email')";
                mysql_query($sql) or die("Error: ".mysql_error());
        }

    }

    // insert for axs_web_item
    while($row = odbc_fetch_array($web_item)){
    //break;
        $symbol = $row['ITEM_SYMBOL'];
        $sym_name = addslashes($row['ITEM_NAME']);
        $rate = $row['ITEM_RATE'];
        $high_rate = $row['ITEM_HIGH_RATE'];
        $low_rate = $row['ITEM_LOW_RATE'];
        $vol_qty = $row['ITEM_VOL_QTY'];
        $cdc = $row['CDC'];

        $sql = "INSERT INTO axs_web_item (ITEM_SYMBOL,ITEM_NAME,ITEM_RATE, ITEM_HIGH_RATE, ITEM_LOW_RATE,ITEM_VOL_QTY,CDC) VALUES ('$symbol', '$sym_name', '$rate', '$high_rate', '$low_rate', '$vol_qty', '$cdc')";

        mysql_query($sql) or die("Error: ".mysql_error());
    }

    // insert for axs_web_parties
    while($row = odbc_fetch_array($parties)){
    //break;
        $party_user_code = $row['PARTY_USER_CODE'];//continue;
        $party_name = $row['PARTY_NAME'];
        $agent_code = $row['AGENT_CODE'];
        $party_email = $row['PARTY_EMAIL'];
        $party_add = addslashes($row['PARTY_ADDRESS']);
        $party_cell = $row['PARTY_MOBILE_NO'];
        $party_cnic = $row['PARTY_NIC_NO'];

        $check_user = "SELECT * FROM axs_web_parties WHERE PARTY_USER_CODE = $party_user_code";

        $chk_res = mysql_query($check_user) or die("Error: ".mysql_error());

        if(mysql_fetch_array($chk_res) > 0)
            continue;
        else{
                $sql = "INSERT INTO axs_web_parties (PARTY_USER_CODE, PARTY_NAME, AGENT_CODE, PARTY_EMAIL, PARTY_ADDRESS, PARTY_MOBILE_NO, PARTY_NIC_NO) VALUES ('$party_user_code', '$party_name', '$agent_code', '$party_email', '$party_add', '$party_cell', '$party_cnic')";

                mysql_query($sql) or die("Error: ".mysql_error());

        }
    }

    // insert for axs_web_trans
    while($row = odbc_fetch_array($trans)){
    //break;
        $agent_code = $row['AGENT_CODE'];
        $party_usr_code = $row['PARTY_USER_CODE'];
        $trade_date = $row['TRADE_DATE'];
        $nature = $row['NATURE'];
        $trans_qty= $row['TRANS_QTY'];
        $trans_rate = $row['TRANS_RATE'];
        $trans_item_symbol = $row['TRANS_ITEM_SYMBOL'];
        $set_desc = $row['SET_DESC'];
        $comm = $row['COMM'];
        $trans_amt = $row['TRANS_AMT'];
        $trans_posted = $row['TRANS_POSTED'];
        $trade_desc = $row['TRADE_DESC'];
        $comm_amt = $row['COMM_AMT'];
        $cvt_wht_amt = $row['CVT_WHT_AMT'];
        $fed_amt = $row['FED_AMT'];
        $other_chrg_amt = $row['OTHER_CHRG_AMT'];

        $sql = "INSERT INTO axs_web_trans (AGENT_CODE, PARTY_USER_CODE, TRADE_DATE, NATURE, TRANS_QTY, TRANS_RATE, TRANS_ITEM_SYMBOL, SET_DESC, COMM, TRANS_AMT, TRANS_POSTED, TRADE_DESC, COMM_AMT, CVT_WHT_AMT, FED_AMT, OTHER_CHRG_AMT) VALUES ('$agent_code', '$party_user_code', '$trade_date', '$nature', '$trans_qty', '$trans_rate', '$trans_item_symbol', '$set_desc', '$comm', '$trans_amt', '$trans_posted', '$trade_desc', '$comm_amt', '$cvt_wht_amt', '$fed_amt', '$other_chrg_amt')";

        mysql_query($sql) or die("Error: ".mysql_error());
    }

    // insert for axs_web_voch
    while($row = odbc_fetch_array($voch)){
    //break;
        $voch_no = $row['VOCH_NO'];
        $voch_date = $row['VOCH_DATE'];
        $agent_code = $row['AGENT_CODE'];
        $party_user_code = $row['PARTY_USER_CODE'];
        $narration= $row['NARRATION'];
        $dr_amt = $row['DR_AMOUNT'];
        $cr_amt = $row['CR_AMOUNT'];
        $bal = $row['BALANCE'];
        $index_no = $row['INDX_NO'];
        $check_no = $row['CHEQUE_NO'];
        $effect_code = $row['EFFECT_CODE'];

       $sql = "INSERT INTO axs_web_voch (VOCH_NO, VOCH_DATE, AGENT_CODE, PARTY_USER_CODE, NARRATION,  DR_AMOUNT, CR_AMOUNT, BALANCE, INDX_NO, CHEQUE_NO, EFFECT_CODE)

         VALUES ('$voch_no', '$voch_date', '$agent_code', '$party_user_code', '$narration', '$dr_amt', '$cr_amt', '$bal', '$index_no', '$check_no', '$effect_code')";//exit;

        mysql_query($sql) or die("Error: ".mysql_error());
    }

}
  }

  ?>

<form action="" method="post"
enctype="multipart/form-data">
Filename:
<input type="file" name="file" id="file">

<input style="margin-left: 78px;" type="submit" name="submit" value="Uplaod DB">
</form>
<?php
}
?>

PHP INFO on WINDOWS:
https://www.dropbox.com/s/4qoqxu87ffwym84/PHP%20INFO%20on%20WINDOWS.png
The same code is not working on when I go to Linux ... odbc_connect() retuns NULL.
PHP INFO on LINUX:
https://www.dropbox.com/s/a3vo6pd5pn1h4ha/PHP%20INFO%20on%20Linux.png

A: I may be asking the obvious, but do you have a ODBC driver for MS Access installed on the Linux instance?


text:
Q: Where is the mapping for "Find Source" stored in Visual Studio? When the user browses to the source location (because PDBs are from a non-local build), where is that mapping stored?
If it's in the .suo, is there any way to programmatically add a mapping? (as the sln is generated in this case any way)

A: It might be a better idea to just look into what they call "Source Server", which is something of a misnomer as it actually just adds information about how to get sources from your VCS to the PDB files. You could look at the MSDN magazine article Source Server Helps You Kill Bugs Dead In Visual Studio 2005, or you could just look up SrcSrv in the index for the Debugging Tools For Windows help.
According to the magazine article, you also need to install Perl on the build box (the author of the article apparantly built it himself!), but thankfully it is supposed to work out-of-the-box with Subversion, CVS, or even Perforce -- not just Visual Source Safe -- so there's a good chance you wouldn't have to write any Perl yourself. (Not to dis Perl, but I'm guessing you don't know it very well or at all -- I'm a *nix lover, and I'm not exactly fluent myself.) And even if you use some VCS that isn't supported out-of-the-box, it's quite possible someone else has already written the needed Perl and posted it on their blog.


text:
Q: "dpkg was interrupted error" when installing any application I have ubuntu 11.10 and when I run any package management command in terminal I get this message
E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a'
to correct the problem.

What is the problem and how can I solve it?

A: The error message usually points to having interrupted a download in the past.
This should be resolved by the following:
sudo dpkg --configure -a
sudo apt-get -f install
sudo apt-get update && sudo apt-get upgrade


text:
Q: SceneKit calculate vertex world coordinates for node with pivot I working on this moving-map project using SceneKit.
I've made a globe and rotate it's pivot so your current position faces the camera.
To project some text on the map I need to calculate some world coordinates which I can convert to screen coordinates and send to my overlaySKScene.
I haven't been successful in using worldTransform or convertPosition/convertTransform so I came up with my own calculations:
import SceneKit
import simd

// a rotation-matrix which rotates the globe
// so 52º North, 4.75º East [Benelux] faces the camera @ [0,0,0]
let pivot = float4x4([
    float4(0.996566, 0.0, -0.0828082, 0.0),
    float4(-0.0652537, 0.615662, -0.785304, 0.0),
    float4(0.0509818, 0.788011, 0.613547, 0.0),
    float4(0.0, 0.0, 0.0, 1.0)
])

// position of Brussel in cartesian coordinates
let posBrussel = float4(0.0493100174, 0.776061833, 0.628726125, 1.0)

// setup globe
// apply scale & translation -> zoom in on Benelux
let zoom = Float(14.6193)
let distance = Float(-16.5852)
let node = SCNNode()
node.position = SCNVector3(0, 0, distance)
node.scale = SCNVector3(zoom, zoom, zoom)
node.pivot = SCNMatrix4(pivot)

// Manual calculation of world coordinates
let posBrusselScaled = zoom * posBrussel
let resultIntermediate = posBrusselScaled * pivot
let resultFinal = resultIntermediate + float4(0.0, 0.0, distance, 0.0)

// world coordinates Brussel
// resultFinal = float4(-0.0427321, -0.280209, -1.96864, 14.6193)

Now I expect there is an easier method to calculate these world coordinates. Like multiplying the transform and the pivot.
let transform = float4x4(node.transform)
posBrussel * pivot * transform // float4(-0.0427321, -0.280209, 14.6166, -15.5821)
posBrussel * transform * pivot // float4(-0.0427321, -0.280209, 14.6166, -9.42755)

While the x,y-values are close to my own calculation, the z-value is way off [which should be near -2 due the distance & zoom].
What is the best/correct way to calculate these world-coordinates?

A: You shouldn't calculate that by your own. SceneKit does that for you with convertPosition(_:, to:) function. It allows you to convert coordinates from local node's coordinate system to other node's coordinate system.
The node with the world coordinates is rootNode.
So, considering that posBrussel is position in node's coordinate space, the result has to be as simple as
resultFinal = node.convertPosition(posBrussel, to: scene.rootNode)
screenPoint = sceneView.projectPoint(resultFinal)