Open Interpretability Models Contributors Research Posts About

Qwen/Qwen2.5-0.5B · L4/N2058 · 20261019T194134Z

Experiment 2 of 3 on this neuron, most conclusive first · record

#2 · negative pole − VERIFIED strong evidence for · 0.96 counts toward status 2026-10-19 · 20261019T194134Z

Fires on a prefix (unary) operator token that opens an operand where the syntax expects an operand, not an operator, in code or arithmetic: above all a space-preceded unary minus ' -' right after a binary/comparison/logical operator, '=', ':=', ',', 'return' or a keyword ('5 - -3', '3 + -5', '&& -y', 'i == -1', 'foo(a, -1)', 'return -1'), strongest (~3-5.7) when the preceding token is itself an operator. Other operand-opening prefixes are weaker (unary ' +' ~2.5, ' ~'/' !' ~1-1.5, a regex-literal '/', an ObjC message ' [' in code), while the same ' -' used as a binary operator after an operand ('x - 1', '5 - 3', '3 - 2' in prose) and literals without a sign stay near zero.

The whole hypothesis

Fires on a prefix (unary) operator token that opens an operand where the syntax expects an operand, not an operator, in code or arithmetic: above all a space-preceded unary minus ' -' right after a binary/comparison/logical operator, '=', ':=', ',', 'return' or a keyword ('5 - -3', '3 + -5', '&& -y', 'i == -1', 'foo(a, -1)', 'return -1'), strongest (~3-5.7) when the preceding token is itself an operator. Other operand-opening prefixes are weaker (unary ' +' ~2.5, ' ~'/' !' ~1-1.5, a regex-literal '/', an ObjC message ' [' in code), while the same ' -' used as a binary operator after an operand ('x - 1', '5 - 3', '3 - 2' in prose) and literals without a sign stay near zero.

Hard negatives 9/11 rejected · holdouts 5/5 fired (independent observations; 16 probes) · P(useful) 0.98

Balanced accuracy
0.91
Sufficiency
0.98
Necessity
1.00
Lookahead KL
0.0019
✓ enough hard negatives ✓ enough holdouts ✓ specificity ✓ sensitivity ✓ counterfactual reproduction ✓ lookahead consistent ✓ independent review ✓ beats confound baseline

specificity 0.82 · sensitivity 1.00 · counterfactual reproduction 1.00 · protocol v0.5

- + ! ~/ [

Adversarial review

positive_holdout: 5/5 passed; hard_negative: 9/11 passed; counterfactual: 8/8 passed; lookahead_consistency: 1/1 passed. All gates passed.

Hard negatives 9/11 stay below Positive holdouts 5/5 reach it threshold 1.01 (25% of max) → active passed · 0.221 (5% of max) git commit -m "fix" && ls -la --color=auto passed · 0.233 (6% of max) She was a well-known author - a quiet one - who lived by the sea. passed · 0.258 (6% of max) The temperature fell to minus five degrees, a negative value below zero. passed · 0.274 (7% of max) Let g = 12 - 5. Is g a multiple of 7? passed · 0.279 (7% of max) The meeting runs 9 - 5 on weekdays, a 4 - 3 win for the home team. passed · 0.300 (7% of max) - Buy milk - Call the bank - Finish the report passed · 0.361 (9% of max) x = 5 y = x z = 10 * 3 w = 42 passed · 0.468 (12% of max) Let x = 45. Suppose 3*y = 2*x + 6. Is 12 a factor of y? passed · 0.478 (12% of max) int d = x - y; int e = width - 1; total = total - delta; failed · 2.001 (49% of max) if (!ready) { done = false; } flag = ~mask; failed · 2.503 (62% of max) var re = str.split(/,\s*/); total = a / b; path = dir / name; passed · 2.024 (50% of max) if (count == -1) { return -1; } passed · 2.291 (57% of max) x = [1, -2, -3] print(max(x, key=lambda v: -v)) passed · 3.346 (83% of max) result = a * -b + c / -d passed · 3.819 (94% of max) Compute 7 - -4 and then 9 + -2 in your head. passed · 3.828 (94% of max) let y = +x; let z = a + +b; 0 max 4.05
passed failed Each probe's peak negative-pole strength. The shaded side of the line counts as active. Hover a dot for its prompt.
All 25 probes
TestInputExpectedObserved
✓ positive holdout if (count == -1) { return -1; }
Unary minus after == and after return in C-like code.
active 2.024
✓ positive holdout result = a * -b + c / -d
Unary minus directly after binary operators * and /.
active 3.346
✓ positive holdout x = [1, -2, -3] print(max(x, key=lambda v: -v))
Unary minus after comma and after lambda colon in Python.
active 2.291
✓ positive holdout Compute 7 - -4 and then 9 + -2 in your head.
Prose arithmetic with unary minus right after a binary operator, strongest case.
active 3.819
✓ positive holdout let y = +x; let z = a + +b;
Unary plus after = and after binary + (weaker prefix operator).
active 3.828
✓ hard negative Let g = 12 - 5. Is g a multiple of 7?
Binary minus after an operand in the same math-dataset format.
inactive 0.274
✓ hard negative int d = x - y; int e = width - 1; total = total - delta;
Space-preceded binary minus after identifiers and numbers in code.
inactive 0.478
✓ hard negative The meeting runs 9 - 5 on weekdays, a 4 - 3 win for the home team.
Dash or minus used as a range or score separator in prose.
inactive 0.279
✓ hard negative She was a well-known author - a quiet one - who lived by the sea.
Spaced dash used as punctuation between clauses, not an operand opener.
inactive 0.233
✓ hard negative Let x = 45. Suppose 3*y = 2*x + 6. Is 12 a factor of y?
Math-dataset style with no negative signs, only binary operators and literals.
inactive 0.468
✓ hard negative - Buy milk - Call the bank - Finish the report
Markdown list bullets starting a line, no operator precedes.
inactive 0.300
✓ hard negative git commit -m "fix" && ls -la --color=auto
Command-line flags with a hyphen after a command, not arithmetic unary minus.
inactive 0.221
✓ hard negative The temperature fell to minus five degrees, a negative value below zero.
Negation expressed in words, with no operator token.
inactive 0.258
✓ hard negative x = 5 y = x z = 10 * 3 w = 42
Assignments and binary operators with unsigned literals.
inactive 0.361
✗ hard negative var re = str.split(/,\s*/); total = a / b; path = dir / name;
Slash as division or path join after an operand, and a regex after a paren (the hypothesis says weak).
inactive 2.503
✗ hard negative if (!ready) { done = false; } flag = ~mask;
Weaker prefix operators ! and ~ which the hypothesis says stay near 1-1.5, below an active threshold.
inactive 2.001
✓ counterfactual Let x = 5 - -3 + 2. -> Let x = 5 - 3 + 2. Δ 0.90 Δ 0.94
✓ counterfactual if (x > 0 && -y < 2) { -> if (x > 0 && !y < 2) { Δ 1.00 Δ 1.14
✓ counterfactual Calculate 3 + -5. -> Calculate 3 + 5. Δ 0.65 Δ 0.67
✓ counterfactual return (i == -1) ? 0 : n.length - i - 1; -> return (i == 1) ? 0 : n.length - i - 1; Δ 0.50 Δ 0.51
✓ counterfactual y = foo(a, -1); -> y = foo(a, 1); Δ 0.45 Δ 0.49
✓ counterfactual if (x < -1) { -> if (x < 1) { Δ 0.40 Δ 0.42
✓ counterfactual return x - 1; -> return x - 2; Δ 0.00 Δ 0.01
✓ counterfactual The score was 3 - 2 in the end. -> The score was 3 - 4 in the end. Δ 0.00 Δ 0.00
✓ lookahead consistency Let x = 5 - -3 + 2.; if (x > 0 && -y < 2) {; Calculate 3 + -5.; return (i == -1) ? 0 : n.length - i - 1;; y = foo(a, -1);; if (x < -1) {; return x - 1;; The score was 3 - 2 in the end.
claimed retrospective; measured retrospective (KL=0.001855, tokens=['x', '1', ' <', '5', '6'])

Minimal pairs

Median (score) Sufficiency: 0.98 · median of 6 pairs 0.98 Necessity: 1.00 · median of 6 pairs 1.00 0.5 = a typical matched neuron 0 0.25 0.5 0.75 1
sufficiency (clean → corrupted) necessity (corrupted → clean) This record predates per-pair effects, so only the medians are shown.
#Base → counterfactualExpected ΔObserved Δ
1 Let x = 5 - -3 + 2.
→ Let x = 5 - 3 + 2.
0.90 0.94
2 if (x > 0 && -y < 2) {
→ if (x > 0 && !y < 2) {
1.00 1.14
3 Calculate 3 + -5.
→ Calculate 3 + 5.
0.65 0.67
4 return (i == -1) ? 0 : n.length - i - 1;
→ return (i == 1) ? 0 : n.length - i - 1;
0.50 0.51
5 y = foo(a, -1);
→ y = foo(a, 1);
0.45 0.49
6 if (x < -1) {
→ if (x < 1) {
0.40 0.42
7 return x - 1;
→ return x - 2;
0.00 0.01
8 The score was 3 - 2 in the end.
→ The score was 3 - 4 in the end.
0.00 0.00
Read more

Δ is the base prompt's peak negative-pole strength minus the counterfactual's, as a fraction of the max activation.

Each causal score ranks the pole's patch effect among the 32 same-layer neurons that change as much between each pair, so 0.5 is typical. Sufficiency patches clean into corrupted, and necessity corrupted into clean. The score is the median over 6 non-control pairs, on next-token KL. Median effect 0.000371 (sufficiency) and 0.00058 (necessity). In the table, each cell gives the percentile, the pole's signed effect, and the matched neurons' median and largest |effect|, in nats of KL. Self-repair (the hydra effect) was mitigated by freezing downstream MLP outputs.

Top-activating examples

Hover a token for its value.

  1. 4.05 … 4?↵True↵Suppose -z + 0 + 3 = 0. Does 11 divide ((-51)/z + -1)*(-5)/2?↵False↵Let …
    All 1604 tokens

    2/(x/2). Suppose -5*r + 4*h + 43 = -187, -h + q = 0. Is 35 a factor of r?↵False↵Let r be ((-32)/(-20))/(2/5). Suppose -4*a = 3*m + 33, 0 = 3*a - r*a - 3*m - 6. Is 2/(-1)*a/1 a multiple of 16?↵False↵Suppose 4*b + 3*k = 8019, -392*b + 3*k - 4011 = -394*b. Is 12 a factor of b?↵True↵Suppose -5*g = -4*z + 117, g - 6*g - 3*z = 131. Suppose 22*u - 2*m + 10 = 20*u, u = -3*m + 3. Let f = u - g. Is f a multiple of 22?↵True↵Let v = 0 - 6. Suppose -426 = 5*s - 2*w, 2*w + 171 = -2*s + 3*w. Let n = v - s. Is n a multiple of 26?↵True↵Let z be 4/(-12) - (-22)/(-6). Let j(n) = 4*n**2 + 5*n + 1. Let m be j(z). Suppose -95 = -5*a + m. Is 26 a factor of a?↵False↵Suppose -2*j + 3*t - t = 2, -2*t - 4 = -5*j. Let d(w) = 0*w**3 + 6*w**2 + 0*w**3 + 6*w - 22*w**j + w**3. Does 17 divide d(16)?↵False↵Let b(i) = i**2 - 4*i + 3. Let k be b(3). Suppose -648 = -w + 2*w + 3*c, k = -2*w + 4*c - 1316. Is (-4)/10 - w/10 a multiple of 23?↵False↵Suppose 4*b - 3*b = 5*g - 2042, b - 814 = -2*g. Is 34 a factor of g?↵True↵Let x(k) = -100*k**3 + 10*k**2 + 9*k - 1. Does 10 divide x(-1)?↵True↵Let j(h) = 9*h + 28. Is j(4) a multiple of 64?↵True↵Let z = -3510 + 5478. Is 93 a factor of z?↵False↵Let t(k) = 4*k**2 + 5*k - 153. Is 18 a factor of t(-17)?↵True↵Let d be ((-6)/(-4))/(5/60). Let b = 21 - d. Does 25 divide 18/7*7*b?↵False↵Let w(p) = -218*p + 116. Does 52 divide w(-4)?↵True↵Let c(g) = -6*g + 24. Let n be c(8). Is 2/2 - n - 3 - 1 a multiple of 5?↵False↵Let w(t) be the third derivative of -13*t**4/24 + 19*t**3/6 - 6*t**2. Let k be w(-15). Suppose -218 - k = -4*a. Is a a multiple of 18?↵True↵Let c be 10*(-4)/8*176/(-10). Let k = -71 + c. Is k even?↵False↵Suppose -9*i + 140 = i. Suppose 0 = 5*j - 2*x - 3*x - 185, j = -4*x + 22. Let n = j - i. Is n a multiple of 5?↵True↵Let c = 1189 - -603. Does 14 divide c?↵True↵Let z = 90 + 211. Suppose y + 4*y = -4*b - 287, 3*b - z = 5*y. Let i = 105 + y. Is i a multiple of 24?↵False↵Let m = 12 + -7. Suppose 41 + 47 = 2*r + 4*i, -3*r + m*i = -77. Is r a multiple of 11?↵False↵Suppose 6*q - 10*q + 2508 = 0. Suppose 4*o = q + 317. Is 48 a factor of o?↵False↵Let w = 5 + -11. Let a(j) = j**2 + j. Let y be a(-6). Let h = w + y. Does 24 divide h?↵True↵Is (-3)/(-6) + 22673/158 a multiple of 18?↵True↵Is (-1 - -4)/(1*33/1804) a multiple of 4?↵True↵Let i(l) = -10*l - 2. Let j(x) = 10*x + 1. Let c(k) = 4*i(k) + 5*j(k). Let r = 160 - 157. Is 7 a factor of c(r)?↵False↵Let v(r) = 4*r**3 + 3*r**2 + 17. Is 5 a factor of v(5)?↵False↵Suppose 3*c + 25 = 34. Suppose -3*b = b + 3*f - 665, 4*f = -c*b + 490. Is 22 a factor of b?↵False↵Suppose 0 = 179*u - 182*u + 414. Is u even?↵True↵Suppose -73*c - 756 = -79*c. Is 7 a factor of c?↵True↵Let w = -34 + 46. Is w/(-27)*-123 + (-1)/(-3) a multiple of 11?↵True↵Suppose -4*w - 4*t - 420 = w, -2*t = 3*w + 254. Let q = -26 - w. Is 11 a factor of q?↵False↵Suppose 12*h = 16*h - 3740. Is h a multiple of 10?↵False↵Let t = -343 - -525. Is t a multiple of 14?↵True↵Suppose -z + 0 + 3 = 0. Does 11 divide ((-51)/z + -1)*(-5)/2?↵False↵Let z be (-1)/

    Values
    TokenNegative-pole strength
    40.051
    ?↵0.000
    True0.000
    ↵0.000
    Sup0.000
    pose0.127
    -0.804
    z0.162
    +0.033
    0.000
    00.821
    +0.465
    0.148
    30.051
    =0.000
    0.048
    00.004
    .0.023
    Does0.000
    0.093
    10.128
    10.000
    divide0.070
    ((0.000
    -1.405
    50.144
    10.074
    )/0.000
    z0.000
    +0.000
    -4.053
    10.144
    )*0.000
    (-0.725
    50.179
    )/0.000
    20.000
    ?↵0.000
    False0.000
    ↵0.000
    Let0.055
  2. 3.14 … ) {↵ $(x).click(function (e) {↵ e.preventDefault();↵ var href = $(this).attr("href");↵ if (!/PDF|mailto/gi.test(href)) {↵ …
    All 312 tokens

    Q:↵↵Page transitions, depending on URL↵↵This code fades each page out, before going to the URL's destination. However, there are some instances where the user doesn't go to a new page, but goes to a PDF in the browser, or it opens the default mail application. On Safari it seems, if you go to an external site (www.twitter.com) and press the back button, the .wrapper is still faded out. (Perhaps a cache thing?)↵function fadeAndGo(x) {↵↵ $(x).click(function (e) {↵ e.preventDefault();↵ var href = this.href;↵ $('.wrapper').fadeOut(function(){↵ window.location = href;↵↵ });↵ // $('.wrapper').delay()fadeIn();↵ });↵}↵↵fadeAndGo('a');↵↵Is it possible to either:↵↵Fade out, only if the URL does not contain 'PDF, mailto', or is an external link?↵Fade in after a certain amount of time (it faded out, but faded back in after a couple of seconds, in case it was a PDF/mailto).↵↵A:↵↵Try this:↵function fadeAndGo(x) {↵ $(x).click(function (e) {↵ e.preventDefault();↵ var href = $(this).attr("href");↵ if (!/PDF|mailto/gi.test(href)) {↵ $('.wrapper').fadeOut(function () {↵ window.location = href;↵ }).delay(2000).fadeIn();↵ } else {↵ window.location = href;↵ }↵ });↵}↵↵fadeAndGo('a');↵↵

    Values
    TokenNegative-pole strength
    )0.042
    {↵0.000
    0.000
    $(0.525
    x0.000
    ).0.000
    click0.000
    (function0.000
    (0.000
    e0.000
    )0.000
    {↵0.000
    0.000
    e0.000
    .preventDefault0.000
    ();↵0.239
    0.000
    var0.017
    href0.000
    =0.000
    $(0.091
    this0.000
    ).0.000
    attr0.000
    ("0.000
    href0.000
    ");↵0.000
    0.000
    if0.000
    (!0.260
    /3.139
    PDF0.104
    |0.000
    mailto0.000
    /g0.000
    i0.000
    .test0.013
    (href0.000
    ))0.000
    {↵0.000
    0.000
  3. 3.09 … *)description↵{↵ NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:256];↵↵ [buffer appendString:@"{"];↵ [buffer appendString:[[[NSString alloc] initWithFormat:@" …
    All 356 tokens

    /*↵ * Copyright 2010-2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.↵ *↵ * Licensed under the Apache License, Version 2.0 (the "License").↵ * You may not use this file except in compliance with the License.↵ * A copy of the License is located at↵ *↵ * http://aws.amazon.com/apache2.0↵ *↵ * or in the "license" file accompanying this file. This file is distributed↵ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either↵ * express or implied. See the License for the specific language governing↵ * permissions and limitations under the License.↵ */↵↵#import "SimpleDBMissingParameterException.h"↵↵↵↵↵@implementation SimpleDBMissingParameterException↵↵@synthesize boxUsage;↵↵↵-(id)initWithMessage:(NSString *)theMessage↵{↵ if (self = [super initWithMessage:theMessage]) {↵ }↵↵ return self;↵}↵↵↵-(void)setPropertiesWithException:(AmazonServiceException *)theException↵{↵ [super setPropertiesWithException:theException];↵↵ if ([theException.additionalFields valueForKey:@"BoxUsage"] != nil) {↵ self.boxUsage = [AmazonSDKUtil convertStringToNumber:[theException.additionalFields valueForKey:@"BoxUsage"]];↵ }↵}↵↵↵-(NSString *)description↵{↵ NSMutableString *buffer = [[NSMutableString alloc] initWithCapacity:256];↵↵ [buffer appendString:@"{"];↵ [buffer appendString:[[[NSString alloc] initWithFormat:@"BoxUsage: %@,", boxUsage] autorelease]];↵ [buffer appendString:[super description]];↵ [buffer appendString:@"}"];↵↵ return [buffer autorelease];↵}↵↵↵-(void)dealloc↵{↵ [boxUsage release];↵↵ [super dealloc];↵}↵↵@end↵

    Values
    TokenNegative-pole strength
    *)0.000
    description0.001
    ↵0.042
    {↵0.000
    0.000
    NSMutable0.016
    String0.000
    *0.116
    buffer0.000
    =0.000
    [[0.926
    NSMutable0.073
    String0.000
    alloc0.247
    ]0.029
    initWith0.000
    Capacity0.076
    :0.098
    20.000
    50.000
    60.075
    ];↵↵0.000
    0.000
    [2.307
    buffer0.000
    appendString0.079
    :@"0.123
    {"0.000
    ];↵0.160
    0.000
    [3.086
    buffer0.000
    appendString0.067
    :[0.761
    [[1.784
    NSString0.150
    alloc0.159
    ]0.115
    initWith0.000
    Format0.033
    :@"0.291
  4. 3.05 … internal class ModuleVcsDetector(private val project: Project) {↵ private val vcsManager by lazy(LazyThreadSafetyMode.NONE) {↵ (ProjectLevelVcsManager.getInstance(project) as Project …
    All 627 tokens

    // Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.↵package com.intellij.openapi.vcs.impl↵↵import com.intellij.ProjectTopics↵import com.intellij.openapi.application.ApplicationManager↵import com.intellij.openapi.components.service↵import com.intellij.openapi.extensions.ExtensionNotApplicableException↵import com.intellij.openapi.module.Module↵import com.intellij.openapi.module.ModuleManager↵import com.intellij.openapi.project.ModuleListener↵import com.intellij.openapi.project.Project↵import com.intellij.openapi.project.rootManager↵import com.intellij.openapi.roots.ModuleRootEvent↵import com.intellij.openapi.roots.ModuleRootListener↵import com.intellij.openapi.startup.StartupActivity↵import com.intellij.openapi.vcs.AbstractVcs↵import com.intellij.openapi.vcs.ProjectLevelVcsManager↵import com.intellij.openapi.vcs.VcsDirectoryMapping↵import com.intellij.openapi.vfs.VirtualFile↵↵internal class ModuleVcsDetector(private val project: Project) {↵ private val vcsManager by lazy(LazyThreadSafetyMode.NONE) {↵ (ProjectLevelVcsManager.getInstance(project) as ProjectLevelVcsManagerImpl)↵ }↵↵ internal class MyPostStartUpActivity : StartupActivity.DumbAware {↵ init {↵ if (ApplicationManager.getApplication().isUnitTestMode) {↵ throw ExtensionNotApplicableException.INSTANCE↵ }↵ }↵↵ override fun runActivity(project: Project) {↵ val vcsDetector = project.service<ModuleVcsDetector>()↵↵ val listener = vcsDetector.MyModulesListener()↵ val busConnection = project.messageBus.connect()↵ busConnection.subscribe(ProjectTopics.MODULES, listener)↵ busConnection.subscribe(ProjectTopics.PROJECT_ROOTS, listener)↵↵ if (vcsDetector.vcsManager.needAutodetectMappings()) {↵ vcsDetector.autoDetectVcsMappings(true)↵ }↵ }↵ }↵↵ private inner class MyModulesListener : ModuleRootListener, ModuleListener {↵ private val myMappingsForRemovedModules: MutableList<VcsDirectoryMapping> = mutableListOf()↵↵ override fun beforeRootsChange(event: ModuleRootEvent) {↵ myMappingsForRemovedModules.clear()↵ }↵↵ override fun rootsChanged(event: ModuleRootEvent) {↵ myMappingsForRemovedModules.forEach { mapping -> vcsManager.removeDirectoryMapping(mapping) }↵ // the check calculates to true only before user has done any change to mappings, i.e. in case modules are detected/added automatically↵ // on start etc (look inside)↵ if (vcsManager.needAutodetectMappings()) {↵ autoDetectVcsMappings(false)↵ }↵ }↵↵ override fun moduleAdded(project: Project, module: Module) {↵ myMappingsForRemovedModules.removeAll(getMappings(module))↵ autoDetectModuleVcsMapping(module)↵ }↵↵ override fun beforeModuleRemoved(project: Project, module: Module) {↵ myMappingsForRemovedModules.addAll(getMappings(module))↵ }↵ }↵↵ private fun autoDetectVcsMappings(tryMapPieces: Boolean) {↵ if (vcsM

    Values
    TokenNegative-pole strength
    internal0.082
    class0.127
    Module0.000
    V0.000
    cs0.000
    Detector0.000
    (private0.000
    val0.000
    project0.000
    :0.382
    Project0.076
    )0.189
    {↵0.016
    0.000
    private0.000
    val0.000
    v0.000
    cs0.000
    Manager0.000
    by0.401
    lazy0.110
    (L0.000
    azy0.000
    Thread0.000
    Safety0.000
    Mode0.000
    .NONE0.000
    )0.247
    {↵0.135
    0.000
    (3.049
    Project0.000
    Level0.000
    V0.000
    cs0.000
    Manager0.000
    .getInstance0.000
    (project0.000
    )0.000
    as0.010
    Project0.153
  5. 2.33 … getPropriedade($nome){↵ self::configurarSessao();↵ $sessao = self::getSessao();↵ return @$sessao[$nome];↵ }↵↵ /**↵ …
    All 798 tokens

    Q:↵↵Como passar objetos entre controllers no MVC utilizando POO↵↵Basicamente, eu preciso que ser o login for bem sucedido salvar o nome de usuário em uma variável e utilizar-lá em outro controller.↵Model.php:↵ public function login($email, $password) {↵ session_start();↵↵ $sql = "SELECT * FROM users WHERE email = :email AND password= :password;";↵ $query = $this->db->prepare($sql);↵↵ $parameters = array(':email' => $email, ':password' => $password);↵ $query->execute($parameters);↵ $rows = $query->fetch(PDO::FETCH_NUM);↵↵ if($rows > 0) {↵ header ("Location: " . URL . "home");↵ } else {↵ exit ('Email or password incorrect');↵ }↵}↵↵Controller.php ↵ public function login() {↵ if (isset($_POST['login_submit']) AND isset($_POST['email']) AND isset($_POST['password'])) {↵ $this->model->login($_POST['email'], $_POST['password']);↵ }↵}↵↵A:↵↵Não foi explicito mas parece que você quer que seja mandado por session. Sendo assim você pode simplesmente setar na sessão e pegar de volta no outro controle.↵<?php↵// declaração da classe Pessoa↵class Pessoa {↵ public $nome;↵}↵↵// No Controller que envia os parametros↵session_start();↵$joao = new Pessoa();↵$joao->nome = "João";↵$_SESSION['pessoa'] = $joao;↵↵// No Controller que recebe os dados↵session_start();↵$joao = $_SESSION['pessoa'];↵print_r($joao);↵↵Ou se quiser padronizar isso e jogar no paradigma de orientação a objetos↵<?php↵↵// controller que envia ↵$joao = new Pessoa();↵$joao->nome = "João";↵SessionUtils::setPropriedade('pessoa', $joao);↵↵// controller que recebe ↵$joao = SessionUtils::getPropriedadeLimpar('pessoa');↵print_r($joao);↵↵// declaração da classe Pessoa↵class Pessoa {↵ public $nome;↵}↵↵// classe util para a sessão↵class SessionUtils {↵↵ private static $BASE_PROPRIEDADES = "props";↵↵ /**↵ * Pega uma propriedade da sessão ↵ * @return a propriedade ou null se não existir↵ */↵ public static function getPropriedade($nome){↵ self::configurarSessao();↵ $sessao = self::getSessao();↵ return @$sessao[$nome];↵ }↵↵ /**↵ * Pega uma propriedade da sessão e depois a exclui da mesma↵ * @return a propriedade ou null se não existir↵ */↵ public static function getPropriedadeLimpar($nome){↵ self::configurarSessao();↵ $sessao = self::getSessao();↵ $valor = @$sessao[$nome];↵ self::setPropriedade($nome, null);↵ return $valor;↵ }↵↵ /**↵ * Seta uma propriedade na sessão↵ */↵ public static function setPropriedade($nome, $valor){↵ self::configurarSessao();↵ $_SESSION[self::$BASE_PROPRIEDADES][$nome] = $valor;↵ }↵↵ /**↵ * Configura a sessão para guardar os itens↵ */↵ private static function configurarSessao(){↵ if(!isset($_SESSION)){↵ session_start();↵ }↵ if(!self::getSessao() || !is_array(self::getSessao())){↵ self::setSessao(array());↵ }↵ }↵↵ private static f

    Values
    TokenNegative-pole strength
    get0.000
    Prop0.018
    ried0.000
    ade0.000
    ($0.714
    nome0.000
    ){↵0.000
    0.000
    self0.357
    ::0.000
    config0.000
    urar0.085
    S0.000
    ess0.000
    ao0.000
    ();↵0.214
    0.000
    $0.704
    sess0.017
    ao0.000
    =0.018
    self0.068
    ::0.000
    get0.000
    S0.000
    ess0.000
    ao0.000
    ();↵0.000
    0.000
    return0.000
    @$2.328
    sess0.175
    ao0.000
    [$0.000
    nome0.000
    ];↵0.000
    0.000
    }↵↵0.000
    0.000
    /**↵0.080
    0.000
  6. 2.21 … OTHER: "other"};↵function getDecimals(n) {↵ n = n + '';↵ var i = n.indexOf('.');↵ return (i == -1) ? 0 : n.length - i …
    All 937 tokens

    'use strict';↵angular.module("ngLocale", [], ["$provide", function($provide) {↵var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};↵function getDecimals(n) {↵ n = n + '';↵ var i = n.indexOf('.');↵ return (i == -1) ? 0 : n.length - i - 1;↵}↵↵function getVF(n, opt_precision) {↵ var v = opt_precision;↵↵ if (undefined === v) {↵ v = Math.min(getDecimals(n), 3);↵ }↵↵ var base = Math.pow(10, v);↵ var f = ((n * base) | 0) % base;↵ return {v: v, f: f};↵}↵↵$provide.value("$locale", {↵ "DATETIME_FORMATS": {↵ "AMPMS": [↵ "Dinda",↵ "Dilolo"↵ ],↵ "DAY": [↵ "Lumingu",↵ "Nkodya",↵ "Nd\u00e0ay\u00e0",↵ "Ndang\u00f9",↵ "Nj\u00f2wa",↵ "Ng\u00f2vya",↵ "Lubingu"↵ ],↵ "MONTH": [↵ "Ciongo",↵ "L\u00f9ishi",↵ "Lus\u00f2lo",↵ "M\u00f9uy\u00e0",↵ "Lum\u00f9ng\u00f9l\u00f9",↵ "Lufuimi",↵ "Kab\u00e0l\u00e0sh\u00ecp\u00f9",↵ "L\u00f9sh\u00eck\u00e0",↵ "Lutongolo",↵ "Lung\u00f9di",↵ "Kasw\u00e8k\u00e8s\u00e8",↵ "Cisw\u00e0"↵ ],↵ "SHORTDAY": [↵ "Lum",↵ "Nko",↵ "Ndy",↵ "Ndg",↵ "Njw",↵ "Ngv",↵ "Lub"↵ ],↵ "SHORTMONTH": [↵ "Cio",↵ "Lui",↵ "Lus",↵ "Muu",↵ "Lum",↵ "Luf",↵ "Kab",↵ "Lush",↵ "Lut",↵ "Lun",↵ "Kas",↵ "Cis"↵ ],↵ "fullDate": "EEEE d MMMM y",↵ "longDate": "d MMMM y",↵ "medium": "d MMM y HH:mm:ss",↵ "mediumDate": "d MMM y",↵ "mediumTime": "HH:mm:ss",↵ "short": "d/M/y HH:mm",↵ "shortDate": "d/M/y",↵ "shortTime": "HH:mm"↵ },↵ "NUMBER_FORMATS": {↵ "CURRENCY_SYM": "FrCD",↵ "DECIMAL_SEP": ",",↵ "GROUP_SEP": ".",↵ "PATTERNS": [↵ {↵ "gSize": 3,↵ "lgSize": 3,↵ "maxFrac": 3,↵ "minFrac": 0,↵ "minInt": 1,↵ "negPre": "-",↵ "negSuf": "",↵ "posPre": "",↵ "posSuf": ""↵ },↵ {↵ "gSize": 3,↵ "lgSize": 3,↵ "maxFrac": 2,↵ "minFrac": 2,↵ "minInt": 1,↵ "negPre": "-",↵ "negSuf": "\u00a4",↵ "posPre": "",↵ "posSuf": "\u00a4"↵ }↵ ]↵ },↵ "id": "lu-cd",↵ "pluralCat": function (n, opt_precision) { var i = n | 0; var vf = getVF(n, opt_precision); if (i == 1 && vf.v == 0) { return PLURAL_CATEGORY.ONE; } return PLURAL_CATEGORY.OTHER;}↵});↵}]);

    Values
    TokenNegative-pole strength
    OTHER0.041
    :0.363
    "0.000
    other0.000
    "};↵0.000
    function0.084
    get0.047
    Dec0.091
    imals0.111
    (n0.000
    )0.000
    {↵0.000
    0.000
    n0.000
    =0.000
    n0.000
    +0.000
    '';↵0.273
    0.000
    var0.000
    i0.000
    =0.000
    n0.000
    .indexOf0.000
    ('.');↵0.000
    0.000
    return0.000
    (0.000
    i0.000
    ==0.000
    -2.211
    10.075
    )0.000
    ?0.000
    0.524
    00.473
    :0.000
    n0.000
    .length0.000
    -0.288
    i0.000
  7. 2.15 … ]+[+[]] return the string “10”?1, la cual es similar a mi respuesta a ¿Cómo funciona el condicional if (!+[]+!+[] == 2) en …
    All 744 tokens

    Q:↵↵¿Cuál es el valor primitivo de [] con base en ECMAScript 2016 (versión 7)?↵↵Para escribir una respuesta a ¿Cómo funciona el condicional if (!+[]+!+[] == 2) en JavaScript? me aventuré a utilizar https://www.ecma-international.org/ecma-262/7.0/index.html para las referencias.↵En ToPrimitive se explica el procedimiento para convertir una valor en un valor primitivo pero no he logrado asimilarlo para el caso de [].↵Sé que [] es un objeto y que es equivalente a new Array()↵También sé que un array es un objeto exótico, así que uno o más de sus métodos internos esenciales no tiene comportamiento predeterminado.↵↵Notas:↵↵Comentario de Paul Vargas (chat)↵Revisar Array objects (sección de ECMAScript 2016)↵↵Otras pregunta relacionadas:↵↵¿Por qué _=$=+[],++_+''+$ es igual a 10?↵↵A:↵↵Respuesta corta↵El valor primitivo de [] es '' (cadena de texto vacía).↵Explicación↵Finalmente me decidí a googlear y encontré esta respuesta a Why does ++[[]][+[]]+[+[]] return the string “10”?1, la cual es similar a mi respuesta a ¿Cómo funciona el condicional if (!+[]+!+[] == 2) en JavaScript? en cuando a que hace referencia a una especificación ECMASCript sólo que aquella no especifica a cual versión se refieren las citas, sin embargo, me ha sido útil para llenar el "hueco" que derivó en esta pregunta.↵Mas abajo incluyo un par de extractos los cuales se pueden resumir como↵↵document.write([].join() === '') // Resultado true↵↵Extractos de la ECMAScript 2016 (versión 7)↵↵12.2.5Array Initializer↵↵NOTE↵ An ArrayLiteral is an expression describing the initialization of an Array > object, using a list, of zero or more expressions each of which represents an array element, enclosed in square brackets. The elements need not be literals; they are evaluated each time the array initializer is evaluated.↵↵Array elements may be elided at the beginning, middle or end of the element list. Whenever a comma in the element list is not preceded by an AssignmentExpression (i.e., a comma at the beginning or after another comma), the missing array element contributes to the length of the Array and increases the index of subsequent elements. Elided array elements are not defined. If an element is elided at the end of an array, that element does not contribute to the length of the Array.↵↵7.1.1 ToPrimitive ( input [ , PreferredType ] )↵The abstract operation ToPrimitive takes an input argument and an↵ optional argument PreferredType. The abstract operation ToPrimitive↵ converts its input argument to a non-Object type. If an object is↵ capable of converting to more than one primitive type, it may use the↵ optional hint PreferredType to favour that type. Conversion occurs↵ according to Table 9:↵Table 9: ToPrimitive Conversions↵↵Input Type Result↵Undefined Return input.↵Null Return input.↵Boolean Return input.↵Number Return input.↵String Return input.↵Symbol Return input.↵Object Perform the steps following this table.↵↵When Type(input) is Object, the follow

    Values
    TokenNegative-pole strength
    ]+0.009
    [0.210
    +1.097
    []0.000
    ]0.000
    return0.109
    the0.048
    string0.071
    “0.000
    10.016
    00.000
    ”?0.025
    10.141
    ,0.061
    la0.131
    cual0.046
    es0.000
    similar0.005
    a0.142
    mi0.000
    respuesta0.135
    a0.162
    ¿0.000
    Cómo0.025
    funciona0.045
    el0.000
    cond0.079
    icional0.000
    if0.099
    (!0.224
    +2.152
    []0.257
    +0.969
    !1.219
    +0.702
    []0.120
    ==0.000
    0.000
    20.000
    )0.000
    en0.154
  8. 2.08 … url = "http://mypage.example.com/test.php?name="+data;↵aq.ajax(url, String.class, new AjaxCallback<String>() {↵↵ @Override↵ public void callback(String url, String …
    All 369 tokens

    Q:↵↵AndroidQuery ajax doesn't call php page when page contains IFRAME↵↵I tried the following code to access my PHP page:↵String url = "http://mypage.example.com/test.php?name="+data;↵aq.ajax(url, String.class, new AjaxCallback<String>() {↵↵ @Override↵ public void callback(String url, String html, AjaxStatus status) {↵ Log.w(Tags.DEBUG,String.valueOf(status.getCode()));↵ }↵↵});↵↵My PHP page writes a file if the call was made. When I use the URL inside a browser, the file is created. When I use my Android app, nothing happens, the status code is 200. What else should I set?↵UPDATE:↵The source of my page:↵<html>↵ <head>↵ <title>MY WEBSITE</title>↵ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>↵ <frameset rows="92, *" frameborder=NO border=1 framespacing=0 cols=*>↵ <frame name="topFrame" scrolling=NO noresize src="http://example.com/ads.php?ad=user12&cat=16" frameborder=NO>↵ <frame name="user" src="http://example.com/user12/test.php" scrolling=auto>↵ </frameset>↵ <noframes>↵ <body bgcolor=#FFFFFF text=#000000>↵ <a href="http://example.com/user12/test.php">http://example.com/user12/test.php</a>↵ </body>↵ </noframes>↵ </html>↵↵A:↵↵It seems that the web page was the problem, it sent back its source code and there was an IFRAME in it. ↵↵

    Values
    TokenNegative-pole strength
    url0.034
    =0.006
    "0.096
    http0.068
    ://0.137
    myp0.000
    age0.049
    .example0.000
    .com0.000
    /test0.015
    .php0.000
    ?0.000
    name0.000
    ="+0.054
    data0.000
    ;↵0.043
    aq0.000
    .ajax0.000
    (url0.000
    ,0.000
    String0.014
    .class0.000
    ,0.000
    new0.000
    Ajax0.294
    Callback0.000
    <String0.000
    >()0.008
    {↵↵0.000
    0.000
    @2.085
    Override0.000
    ↵0.000
    0.000
    public0.206
    void0.000
    callback0.018
    (String0.047
    url0.000
    ,0.000
    String0.000
  9. 1.99 … position: fixed; ↵ top: 0; ↵ width: 100%; ↵ } ↵ ↵ body.is-loading & { ↵ &:before { ↵ opacity: 1; ↵ …
    All 469 tokens

    /// ↵/// Massively by HTML5 UP ↵/// html5up.net | @ajlkn ↵/// Free for personal and commercial use under the CCA 3.0 license (html5up.net/license) ↵/// ↵ ↵/* Wrapper */ ↵ ↵ #wrapper { ↵ @include vendor('transition', 'opacity #{_duration(menu)} ease'); ↵ position: relative; ↵ z-index: 1; ↵ overflow: hidden; ↵ ↵ > .bg { ↵ position: absolute; ↵ top: 0; ↵ left: 0; ↵ width: 100%; ↵ height: 100%; ↵ background-color: _palette(wrapper-bg); ↵ background-image: url('../../images/overlay.png'), linear-gradient(0deg, rgba(0,0,0,0.1), rgba(0,0,0,0.1)), url('../../images/bg.jpg'); ↵ background-size: auto, auto, 100% auto; ↵ background-position: center, center, top center; ↵ background-repeat: repeat, no-repeat, no-repeat; ↵ background-attachment: scroll, scroll, scroll; ↵ z-index: -1; ↵ ↵ &.fixed { ↵ position: fixed; ↵ width: 100vw; ↵ height: 100vh; ↵ } ↵ } ↵ ↵ &.fade-in { ↵ &:before { ↵ @include vendor('pointer-events', 'none'); ↵ @include vendor('transition', 'opacity 1s ease-in-out'); ↵ @include vendor('transition-delay', '0.75s'); ↵ background: _palette(invert, bg); ↵ content: ''; ↵ display: block; ↵ height: 100%; ↵ left: 0; ↵ opacity: 0; ↵ position: fixed; ↵ top: 0; ↵ width: 100%; ↵ } ↵ ↵ body.is-loading & { ↵ &:before { ↵ opacity: 1; ↵ } ↵ } ↵ } ↵ ↵ @include orientation(portrait) { ↵ > .bg { ↵ background-size: auto, auto, auto 175%; ↵ } ↵ } ↵ }

    Values
    TokenNegative-pole strength
    0.018
    position0.000
    :0.109
    fixed0.175
    ; ↵0.001
    0.010
    top0.112
    :0.059
    0.075
    00.064
    ; ↵0.000
    0.015
    width0.000
    :0.052
    0.000
    10.000
    00.106
    00.000
    %; ↵0.000
    0.000
    0.082
    } ↵ ↵0.000
    0.000
    body0.033
    .is0.005
    -loading0.096
    &0.168
    { ↵0.000
    0.000
    0.117
    &1.990
    :0.000
    before0.000
    { ↵0.065
    0.000
    0.097
    opacity0.000
    :0.030
    0.015
    10.000
    ; ↵0.002
  10. 1.86 … tracing.IsEnabled() {↵ ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.CreateOrUpdate")↵ defer func() {↵ sc := -1↵ if result.Response() != nil {↵ …
    All 703 tokens

    package network↵↵// Copyright (c) Microsoft and contributors. All rights reserved.↵//↵// Licensed under the Apache License, Version 2.0 (the "License");↵// you may not use this file except in compliance with the License.↵// You may obtain a copy of the License at↵// http://www.apache.org/licenses/LICENSE-2.0↵//↵// Unless required by applicable law or agreed to in writing, software↵// distributed under the License is distributed on an "AS IS" BASIS,↵// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.↵//↵// See the License for the specific language governing permissions and↵// limitations under the License.↵//↵// Code generated by Microsoft (R) AutoRest Code Generator.↵// Changes may cause incorrect behavior and will be lost if the code is regenerated.↵↵import (↵ "context"↵ "github.com/Azure/go-autorest/autorest"↵ "github.com/Azure/go-autorest/autorest/azure"↵ "github.com/Azure/go-autorest/tracing"↵ "net/http"↵)↵↵// VpnSitesClient is the network Client↵type VpnSitesClient struct {↵ BaseClient↵}↵↵// NewVpnSitesClient creates an instance of the VpnSitesClient client.↵func NewVpnSitesClient(subscriptionID string) VpnSitesClient {↵ return NewVpnSitesClientWithBaseURI(DefaultBaseURI, subscriptionID)↵}↵↵// NewVpnSitesClientWithBaseURI creates an instance of the VpnSitesClient client.↵func NewVpnSitesClientWithBaseURI(baseURI string, subscriptionID string) VpnSitesClient {↵ return VpnSitesClient{NewWithBaseURI(baseURI, subscriptionID)}↵}↵↵// CreateOrUpdate creates a VpnSite resource if it doesn't exist else updates the existing VpnSite.↵// Parameters:↵// resourceGroupName - the resource group name of the VpnSite.↵// vpnSiteName - the name of the VpnSite being created or updated.↵// vpnSiteParameters - parameters supplied to create or update VpnSite.↵func (client VpnSitesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VpnSite) (result VpnSitesCreateOrUpdateFuture, err error) {↵ if tracing.IsEnabled() {↵ ctx = tracing.StartSpan(ctx, fqdn+"/VpnSitesClient.CreateOrUpdate")↵ defer func() {↵ sc := -1↵ if result.Response() != nil {↵ sc = result.Response().StatusCode↵ }↵ tracing.EndSpan(ctx, sc, err)↵ }()↵ }↵ req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, vpnSiteName, vpnSiteParameters)↵ if err != nil {↵ err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "CreateOrUpdate", nil, "Failure preparing request")↵ return↵ }↵↵ result, err = client.CreateOrUpdateSender(req)↵ if err != nil {↵ err = autorest.NewErrorWithError(err, "network.VpnSitesClient", "CreateOrUpdate", result.Response(), "Failure sending request")↵ return↵ }↵↵ return↵}↵↵// CreateOrUpdatePreparer prepares the CreateOrUpdate request.↵func (client VpnSitesClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, vpnSiteName string, vpnSiteParameters VpnSite) (*http.Request, error) {↵ pathParameters := map[string]interface{}{↵ "resourceGroupName": autore

    Values
    TokenNegative-pole strength
    tracing0.000
    .IsEnabled0.000
    ()0.000
    {↵0.000
    0.000
    ctx0.017
    =0.013
    tracing0.000
    .Start0.023
    Span0.077
    (ctx0.000
    ,0.010
    fq0.000
    dn0.130
    +"/0.000
    V0.000
    pn0.000
    Sites0.000
    Client0.000
    .Create0.000
    OrUpdate0.141
    ")↵0.000
    0.000
    defer0.000
    func0.000
    ()1.254
    {↵0.407
    0.000
    sc0.015
    :=0.000
    -1.861
    10.650
    ↵0.308
    0.119
    if0.000
    result0.000
    .Response0.082
    ()0.000
    !=0.000
    nil0.167
    {↵0.000
  11. 1.74 … .listNames();↵ File folder = new File("c:\\test\\RTR_ZIP\\");↵ String[] filename = folder.list();↵↵ for (;i<names.length;i++) {↵ name = …
    All 591 tokens

    Q:↵↵How to check if file exist when downloading from FTP↵↵I'm downloading from FTP server and I don't know exactly how to check if file already exist. What I want to do is that I retrieve filname from FTP server and then compare it with all files in folder. If file already exists then it compares next FTP filename with all files in folder and so on. ↵I already did comparison and it's working if all files from folder have same name as files on FTP server but if I add some older file then it downloads all files once again and I don't want that. ↵Here is my scratch code:↵String[] names = client.listNames();↵ File folder = new File("c:\\test\\RTR_ZIP\\");↵ String[] filename = folder.list();↵↵ for (;i<names.length;i++) {↵ name = names[i];↵↵ exists=false;↵↵ if (name.contains(".zip")) {↵↵ if (filename.length == 0) {↵ new_file = new FileOutputStream("C:\\test\\RTR_ZIP\\" + name);↵ client.retrieveFile(name, new_file);↵ j++;↵ exists=true;↵ } else {↵ for (;k<filename.length;k++) {↵ name = names[i];↵ i++;↵ name1=filename[k];↵ // CHECK IF FILE EXISTS↵ if (!name.equals(name1)) {↵ new_file = new FileOutputStream("C:\\test\\RTR_ZIP\\" + name);↵ client.retrieveFile(name, new_file);↵ j++;↵ exists=true;↵ } ↵ }↵ }//else↵ }//if contains .zip↵ }//for↵↵Thanks in advance. ↵↵A:↵↵If your ftp server supports XCRC command it could be possible to compare checksum (CRC32) of local and remote file.↵You could iterate all files in the folder and compare its crc with local one.↵import java.io.File;↵import java.io.IOException;↵import java.net.SocketException;↵import java.util.Scanner;↵↵import org.apache.commons.io.FileUtils;↵import org.apache.commons.net.ftp.FTPClient;↵↵public class DownloadFile {↵↵ private FTPClient client = new FTPClient();↵↵ public void connect() throws SocketException, IOException {↵ client.connect("127.0.0.1");↵ client.login("user", "password");↵ }↵↵ public boolean hasXCRCSupport() throws IOException {↵ client.sendCommand("feat");↵ String response = client.getReplyString();↵ Scanner scanner = new Scanner(response);↵ while(scanner.hasNextLine()) {↵ String line = scanner.nextLine();↵ if(line.contains("XCRC")) {↵ return true;↵ }↵ }↵ return false;↵ }↵↵ public boolean isSameFile() throws IOException {↵ if(hasXCRCSupport()) {↵ File file = new File("D:/test.txt");↵ String localCRC = Integer.toHexString((int) FileUtils.checksumCRC32(file))

    Values
    TokenNegative-pole strength
    .list0.071
    Names0.050
    ();↵0.000
    0.000
    File0.000
    folder0.000
    =0.019
    new0.000
    File0.000
    ("0.313
    c0.000
    :\\0.000
    test0.000
    \\0.000
    R0.000
    TR0.305
    _Z0.090
    IP0.076
    \\0.000
    ");↵0.000
    0.000
    String0.000
    []0.000
    filename0.000
    =0.000
    folder0.009
    .list0.000
    ();↵↵0.000
    0.000
    for0.000
    (;1.744
    i0.000
    <0.000
    names0.026
    .length0.029
    ;i0.000
    ++)0.000
    {↵0.000
    0.000
    name0.000
    =0.000
  12. 1.69 … ", fillPattern="BRICKS1")↵↵And the ugly loop which is pasting each cell to the spreadsheet with appropriate format:↵for (i in 1:nrow(pval)) {↵ rows <- …
    All 985 tokens

    Q:↵↵Conditional formatting: making cells colorful↵↵is it possible to do the following:↵loc1 <- c("Aa", "Aa", "aa", "Aa")↵loc2 <- c("aa", "aa", "aa", "AA")↵loc3 <- c("aa", "Aa", "aa", "aa")↵gen <- data.frame(loc1, loc2, loc3)↵↵loc1g <- c(0.01, 0.5, 1, 0.75)↵loc2g <- c(0.2, 0.1, 0.2, 0.6)↵loc3g <- c(0.8, 0.8, 0.55, 1)↵pval <- data.frame(loc1g, loc2g, loc3g)↵↵I want to print to a file to gen dataframe such way that is conditionally formatted by the pval dataframe. Means than (row1, col1) of gen color depends upon pvale (row1, col1). The following are color coding:↵0 to 0.3 is "red" text color ↵0.31 to 0.7 is "yellow"↵> 0.7 is "red" ↵↵gen[1,1] will be "Aa" printed in red text color and so on....↵appreciated your help. ↵EDITS:↵I am more interested in printing not plotting in graph. If I can save output as MS excel and open in MSEXCEL it would be great. I can also be other types of text editors format that can read color coded text. As my orginal data matrix should be of a dimension of 1000 x 1000 or even more. I would like to quicky know unlying p-value for each gen categories. ↵↵A:↵↵Sounds like you want to mimic Excel. Here are a couple examples:↵x = 1:ncol(pval)↵y = 1:nrow(pval)↵↵# Colored backgrounds↵dev.new(width=4, height=4)↵image(x, y, t(as.matrix(pval)),↵ col = c('red', 'yellow', 'red'),↵ breaks = c(0, 0.3, 0.7, 1),↵ xaxt='n', ↵ yaxt='n', ↵ ylim=c(max(y)+0.5, min(y)-0.5), ↵ xlab='', ↵ ylab='')↵centers = expand.grid(y, x)↵text(centers[,2], centers[,1], unlist(gen))↵↵ ↵# Colored text↵dev.new(width=4, height=4)↵image(x,y, matrix(0, length(x), length(y)),↵ col='white',↵ xaxt='n', ↵ yaxt='n', ↵ ylim=c(max(y)+0.5, min(y)-0.5), ↵ xlab='', ↵ ylab='')↵pvals = unlist(pval)↵cols = rep('red', length(pvals))↵cols[pvals>0.3 & pvals<=0.7] = 'yellow'↵text(centers[,2], centers[,1], unlist(gen), col=cols)↵grid(length(x),length(y))↵↵A:↵↵Giving a POC-like answer which is using an ugly loop and not the most beatiful design:↵Loading eg. the xlxs package to be able to write to Excel 2007 format:↵library(xlsx)↵↵Let us create a workbook and a sheet (see the manual!):↵wb <- createWorkbook()↵sheet <- createSheet(wb, "demo")↵↵Define some styles to use in the spreadsheet:↵red <- createCellStyle(wb, fillBackgroundColor="tomato", fillForegroundColor="yellow", fillPattern="BIG_SPOTS")↵yellow <- createCellStyle(wb, fillBackgroundColor="yellow", fillForegroundColor="tomato", fillPattern="BRICKS1")↵↵And the ugly loop which is pasting each cell to the spreadsheet with appropriate format:↵for (i in 1:nrow(pval)) {↵ rows <- createRow(sheet, rowIndex=i)↵ for (j in 1:ncol(pval)) {↵ cell.1 <- createCell(rows, colIndex=j)[[1,1]]↵ setCellValue(cell.1, gen[i,j])↵ if ((pval[i,j] < 0.3) | (pval[i,j] > 0.7)) {↵ setCellStyle(cell.1, red)↵ } else {↵ setCellStyle(cell.1, yellow)↵ }↵ }↵}↵↵Saving the Excel file:↵saveWorkbook(wb, '/tmp/demo.xls')↵↵Result: demo.xls↵↵Alternative solution with package ascii:↵ascii.data

    Values
    TokenNegative-pole strength
    ",0.000
    fill0.037
    Pattern0.000
    ="0.000
    BR0.000
    ICK0.275
    S0.088
    10.000
    ")↵↵0.003
    And0.000
    the0.004
    ugly0.091
    loop0.001
    which0.174
    is0.182
    past0.026
    ing0.000
    each0.269
    cell0.221
    to0.006
    the0.020
    spreadsheet0.000
    with0.046
    appropriate0.064
    format0.085
    :↵0.000
    for0.022
    (0.541
    i0.000
    in0.000
    1.687
    10.593
    :n0.068
    row0.000
    (p0.000
    val0.011
    ))0.000
    {↵0.000
    0.000
    rows0.000
    <-0.089
Read more

Each token is shaded by negative-pole strength, as a fraction of the neuron's max activation. Each window shows up to 30 tokens before the peak and 10 after it.

Activation and mechanism

Activation distribution

[0, 0.135): 182881 [0.135, 0.27): 24916 [0.27, 0.405): 3506 [0.405, 0.54): 472 [0.54, 0.676): 162 [0.676, 0.811): 91 [0.811, 0.946): 76 [0.946, 1.08): 37 [1.08, 1.22): 19 [1.22, 1.35): 23 [1.35, 1.49): 10 [1.49, 1.62): 2 [1.62, 1.76): 7 [1.76, 1.89): 4 [1.89, 2.03): 5 [2.03, 2.16): 4 [2.16, 2.3): 2 [2.3, 2.43): 3 [2.43, 2.57): 1 [2.57, 2.7): 3 [2.7, 2.84): 0 [2.84, 2.97): 0 [2.97, 3.11): 3 [3.11, 3.24): 2 [3.24, 3.38): 0 [3.38, 3.51): 0 [3.51, 3.65): 0 [3.65, 3.78): 2 [3.78, 3.92): 0 [3.92, 4.05): 1 0.00 4.05

Negative-pole strength per token; bar height is log(1 + count).

Mechanism

Claimed retrospective: responds to tokens already in context.

Vocabulary projection

The tokens that this unit's output raises and lowers most.

Jacobian lens Logit lens
Promotes ∂〔 Fuk Gdańsk �ève糙债务 motion运动捉始7Bb المسلحة
Suppresses rocket rocket蝎/fire firefox彝hive Raleigh intColor.DetailDateFormat:''ignumℜ.EventArgsertino

This record predates vocabulary z-scores, so the tokens are listed without bars.

Top-10 overlap 0% · cos(w, J·w) 0.09 · kurtosis 3.4 (Jacobian) / 3.2 (logit) · 100 prompts

Read more

The output direction is read through the final norm and the unembedding. The Jacobian lens first carries it to the last layer. Bar length is the token's z-score over the vocabulary, and ␣ marks a space. A kurtosis near 3 means no specific set of tokens.

Wiring

The units that write most directly into this pole (upstream) and read most directly from it (downstream). See its circuit.

Read more

"Directly" means along the residual stream, through no other unit. Linked units have pages in the registry. Reported, not gated. Backfilled after the review by open-interpretability wiring-backfill, from the record's model revision and the review's prompts. It is not part of the record.

From the weights. Virtual weights, with each norm's gain folded in. They rank units but have no absolute scale. Each number is how much one unit reads of the other's write. It is signed when one vector reads another (+ means a positive activation raises the read), and a norm otherwise. Heads count through their OV circuit upstream, and through their Q, K and V reads downstream. Channels are on hover.

From activations. Averaged over this pole's peak on 11 of the review's prompts where it fired. Upstream: the first-order change in its strength when a unit's direct write is removed (+ excites). Downstream: the change in a later unit when this pole's write is removed from that unit's input alone (one of Q, K or V for a head).

From the weights

Upstream neurons
L3/N2320 up -0.0937
L2/N3223 up +0.0905
L2/N4671 gate +0.0814
L2/N2317 up -0.0808
L3/N455 up -0.0807
L1/N582 up -0.0795
L1/N4415 gate +0.0772
L1/N1700 gate -0.0764
L3/N4595 gate +0.0759
L2/N2234 gate -0.0754
Upstream heads
L4/H7 up +0.182
L4/H9 gate +0.177
L4/H12 gate +0.167
L4/H11 gate +0.14
L4/H3 gate +0.131
L4/H10 gate +0.118
L4/H13 up +0.104
L3/H3 gate +0.101
L4/H2 gate +0.101
L4/H4 gate +0.0995
Downstream neurons
L21/N567 up -0.275
L13/N746 gate +0.128
L23/N2641 up -0.128
L12/N765 gate +0.122
L23/N2732 up -0.116
L23/N2897 up -0.114
L23/N2017 up +0.114
L21/N2609 gate -0.111
L23/N1368 up -0.11
L23/N3048 gate +0.109
Downstream heads
L8/H3 q +0.617
L9/H7 k +0.345
L9/H8 k +0.345
L9/H9 k +0.345
L9/H10 k +0.345
L9/H11 k +0.345
L9/H12 k +0.345
L9/H13 k +0.345
L11/H7 k +0.325
L11/H8 k +0.325

From activations

Upstream neurons
L0/N2764 +0.462
L3/N2320 +0.302
L3/N119 -0.225
L1/N3406 +0.213
L2/N99 -0.197
L3/N580 +0.196
L0/N4325 +0.159
L3/N3927 +0.147
L3/N2673 -0.139
L3/N1010 -0.136
Upstream heads
L4/H9 +0.344
L2/H0 +0.28
L1/H9 +0.222
L2/H9 -0.202
L1/H13 -0.175
L4/H10 +0.169
L2/H2 +0.155
L1/H8 -0.155
L1/H10 -0.147
L2/H8 -0.146
Downstream neurons
L23/N3383 -1.07
L5/N1178 -0.947
L22/N1069 +0.788
L23/N2539 +0.66
L23/N3122 +0.555
L23/N1843 -0.471
L6/N1220 +0.445
L14/N2723 -0.441
L5/N1138 -0.409
L23/N2646 +0.383
Downstream heads
L8/H3 v +0.476
L12/H0 v +0.455
L10/H6 v +0.431
L14/H1 v +0.413
L5/H9 v +0.373
L14/H10 v +0.371
L13/H3 v +0.335
L21/H9 v +0.272
L6/H9 v +0.247
L16/H13 q +0.244

Covariance and confounds

Confounds

Token identity R²
0.32
Position R²
0.03
Frequency r
0.06
Best trivial baseline
never active · 0.41
Hypothesis
0.91 ✓

html&:[ $_-(($ !_/^\anyak "" {(

Co-activating neuron poles

Pole Lift ≥ Both ρ r
N4220+ 22.2 32 -0.03 +0.08
N2344− 18.9 28 +0.04 -0.07
N3826+ 14.1 22 -0.00 +0.05
N4393+ 13.3 21 +0.06 +0.05
N60− 13.3 21 +0.05 -0.05
N3459− 13.3 21 +0.01 -0.01
N4022− 12.5 20 +0.04 -0.01
N618+ 12.5 20 +0.04 +0.02
N2731+ 11.7 19 -0.06 -0.02
N2765+ 11.7 19 +0.02 +0.03
Read more

Ranked by the 95% lower bound of co-activation lift: how much more often a pole fires when this one does, with chance coincidences discounted. ρ ranks the values, so heavy tails don't sway it.

Joint ablation

Partners
N4220, N2344, N3826
KL pole alone
2.24e-03
KL partners
4.07e-03
KL together
7.53e-03
Redundancy ratio
1.54

The pole matters more once its partners are removed: likely redundancy.

Run details

Submitted by
claude-opus-5-5
Reviewed by
claude-sonnet-5-5
Reviewed at
2026-10-19 19:41 UTC
Max activation
4.0534
Selection
random (seed 3817169232)
Corpus
corpus.jsonl · 212,232 tokens · source NeelNanda/pile-10k@127bfedc (data/*.parquet, first 500 docs) (inferred) · licence bigscience-bloom-rail-1.0
Model revision
060db6499f32 · float32
Ran on
scan cpu · review cpu