Qwen/Qwen2.5-0.5B · L23/N1769 · 20261023T054859Z
Experiment 3 of 4 on this neuron, most conclusive first · record
Fires in Java, Kotlin and Swift source on the token just before a type is written: a method or constructor name before its '(' parameter list (main, Notebook, getFromCache: 9-17), ',' between parameters, a field modifier ('private'/'public'/'final') in a field list, a Kotlin/Swift ':' or '->' before a type, or 'catch (', and in JavaScript at ' =', ' +', 'return' or '.floor' next to a 'Math.' call. It is strongest (9-17) when the expected type is a capitalised builtin such as String, Integer or Object and weaker (3-7) for int/boolean or user-defined classes, and it stays below ~3 in Python, TypeScript, Rust and C#-style lowercase 'string'/'str' code, in statement bodies with no declaration or Math call (loops, println, plain assignments or calls such as 'const totalPrice = CalculateDiscount(cartItems);'), and in ordinary prose, including person names.
The whole hypothesis
Fires in Java, Kotlin and Swift source on the token just before a type is written: a method or constructor name before its '(' parameter list (main, Notebook, getFromCache: 9-17), ',' between parameters, a field modifier ('private'/'public'/'final') in a field list, a Kotlin/Swift ':' or '->' before a type, or 'catch (', and in JavaScript at ' =', ' +', 'return' or '.floor' next to a 'Math.' call. It is strongest (9-17) when the expected type is a capitalised builtin such as String, Integer or Object and weaker (3-7) for int/boolean or user-defined classes, and it stays below ~3 in Python, TypeScript, Rust and C#-style lowercase 'string'/'str' code, in statement bodies with no declaration or Math call (loops, println, plain assignments or calls such as 'const totalPrice = CalculateDiscount(cartItems);'), and in ordinary prose, including person names.
Hard negatives 7/11 rejected · holdouts 5/5 fired (independent observations; 16 probes) · P(useful) 0.92
Revises 20261022T050718Z (NEEDS_REVISION) · Revised by 20261026T011607Z (VERIFIED), 20261031T223259Z (VERIFIED)
specificity 0.64 · sensitivity 1.00 · counterfactual reproduction 1.00 · protocol v0.7
Notebook mainCache private: ->,<String.floor =
Adversarial review
hard_negative: 7/11 passed; positive_holdout: 5/5 passed; counterfactual: 10/10 passed; lookahead_consistency: 1/1 passed. Failed gates: specificity.
All 27 probes
| Test | Input | Expected | Observed | |
|---|---|---|---|---|
| ✓ | hard negative | import os
from typing import List
def load_names(path: str, limit: int) -> List[str]:
with open(path) as f:
return [line.strip() for line in f][:limit]
class Notebook:
def __init__(self, title: str, pages: list):
self.title = title
self.pages = pages
Python with type hints and a Notebook class: same shapes (name before '(', ':', '->', ',') but hypothesis says Python stays below 3. |
inactive | 0.808 |
| ✓ | hard negative | interface Order {
id: string;
total: number;
}
export function getFromCache(key: string, store: Map<string, Order>): Order | undefined {
return store.get(key);
}
const fetchAll = async (ids: string[]): Promise<Order[]> => {
return [];
};
TypeScript with annotations before types; hypothesis says TypeScript stays below 3. |
inactive | 3.048 |
| ✗ | hard negative | use std::collections::HashMap;
struct Cache {
items: HashMap<String, i32>,
}
impl Cache {
fn new(capacity: usize) -> Cache {
Cache { items: HashMap::new() }
}
fn get(&self, key: &str) -> Option<&i32> {
self.items.get(key)
}
}
Rust fn signatures with ':' and '->' before types; hypothesis says Rust stays below 3. |
inactive | 4.100 |
| ✗ | hard negative | public class Greeter
{
private string name;
public Greeter(string name, int times)
{
this.name = name;
}
public string Greet(string suffix)
{
return "Hello " + name + suffix;
}
}
C#-style lowercase string in field and method list; hypothesis says lowercase string code stays below 3. |
inactive | 3.426 |
| ✓ | hard negative | const cartItems = [{ price: 10 }, { price: 25 }];
const totalPrice = CalculateDiscount(cartItems);
let shipping = totalPrice + 5;
return shipping;
JavaScript ' =', ' +', 'return' with no Math call; hypothesis explicitly says plain assignments and calls stay below 3. |
inactive | 2.685 |
| ✗ | hard negative | for (int i = 0; i < 10; i++) {
System.out.println("Line " + i);
if (i == 5) {
System.out.println("halfway");
}
}
System.out.println("done");
Java statement body (loop and println) with no declaration; positions before 'int' are the loop header only, hypothesis says loops/println stay below 3. Declaration-free body checks the rest. |
inactive | 5.047 |
| ✓ | hard negative | The Notebook was a gift from my aunt Margaret. She said the main reason she bought it was the cache of old letters she found, and she wrote, in her careful hand, a note to Michael, Sarah, and Tom. Trigger words Notebook, main, cache, commas and person names in ordinary prose; hypothesis says prose including names stays below 3. |
inactive | 0.742 |
| ✓ | hard negative | To start the program, the JVM looks for the main method. It takes an array of strings as its only parameter, and the class must be public. Many tutorials describe how constructors differ from regular methods and when a catch block runs. Prose about Java concepts (main, parameter, constructor, catch) without code; hypothesis requires Java source, not discussion. |
inactive | 1.918 |
| ✓ | hard negative | #!/bin/bash
CACHE_DIR=/var/cache/app
for f in $CACHE_DIR/*; do
echo "removing $f"
rm -f "$f"
done
result=$(ls -l $CACHE_DIR | wc -l)
echo $result
Shell script with '=' assignments and a cache word; outside Java/Kotlin/Swift/Math-JS so should stay low. |
inactive | 1.063 |
| ✓ | hard negative | SELECT id, name, created_at
FROM notebooks
WHERE owner_id = 42
AND title = 'Main'
ORDER BY created_at DESC;
SQL with commas between columns and '=' comparisons; not in the claimed languages. |
inactive | 0.728 |
| ✗ | hard negative | var config = {
name: 'demo',
width: 800,
height: 600,
items: ['a', 'b', 'c']
};
function create(a, b) {
var total = a + b;
var ratio = a / b;
return total * ratio;
}
JavaScript ' =', ' +', 'return', commas between params, but no Math. call; hypothesis ties JS firing to a nearby Math call. |
inactive | 3.942 |
| ✓ | positive holdout | public class Notebook {
private String title;
private List<String> pages;
public Notebook(String title, List<String> pages) {
this.title = title;
this.pages = pages;
}
public String getTitle(String prefix, Object extra) {
return title;
}
}
Java class with field modifiers, constructor name before '(', and ',' before capitalised builtins String/Object; core claim. |
active | 16.281 |
| ✓ | positive holdout | class UserRepository(private val db: Database) {
fun findName(id: String, fallback: String): String {
return db.lookup(id) ?: fallback
}
fun count(filter: Map<String, Any>): Int {
return 0
}
}
Kotlin ':' before String/Map and ',' between parameters; hypothesis predicts firing. |
active | 8.943 |
| ✓ | positive holdout | struct Person {
let name: String
let email: String
}
func describe(person: Person, separator: String) -> String {
return person.name + separator + person.email
}
func makeList(items: [String]) -> Array<String> {
return items
}
Swift ':' and '->' before String; hypothesis predicts firing. |
active | 9.758 |
| ✓ | positive holdout | function randomPick(list) {
var n = Math.floor(Math.random() * list.length);
var scaled = Math.round(n * 1.5) + Math.abs(n - 3);
return Math.max(scaled, 0);
}
Plain JavaScript with Math. calls, ' =', ' +', 'return', '.floor'; hypothesis predicts firing next to Math calls. |
active | 7.959 |
| ✓ | positive holdout | try {
Object value = reader.readValue(input);
process(value);
} catch (IOException e) {
log.error("failed", e);
} catch (RuntimeException e) {
throw e;
}
public static Integer parse(String text, Integer defaultValue) {
return defaultValue;
}
Java 'catch (' before exception type and a method with Integer/String params; hypothesis predicts firing. |
active | 8.643 |
| ✓ | counterfactual | public class Counter { private Integer count; private Integer total; private Integer max; } -> public class Counter { private Customer count; private Customer total; private Customer max; } | Δ 0.52 | Δ 0.52 |
| ✓ | counterfactual | var title: String? var subtitle: String? -> var title: Int? var subtitle: Int? | Δ 0.50 | Δ 0.50 |
| ✓ | counterfactual | let x = Math.floor(y); -> let x = math.floor(y); | Δ 0.45 | Δ 0.45 |
| ✓ | counterfactual | func greet(person: String) -> String { -> func greet(person: string) -> string { | Δ 0.34 | Δ 0.33 |
| ✓ | counterfactual | private fun autoDetectVcsMappings(tryMapPieces: Boolean) { -> private fun autoDetectVcsMappings(tryMapPieces= Boolean) { | Δ 0.50 | Δ 0.50 |
| ✓ | counterfactual | class Notebook { private String title; private List<Category> categories; public Notebook(String title, List<Category> categories) { } } -> class Notebook { private Object title; private List<Category> categories; public Notebook(String title, List<Category> categories) { } } | Δ 0.36 | Δ 0.36 |
| ✓ | counterfactual | public static void main(String[] args) { -> public static void Main(string[] args) { | Δ 0.23 | Δ 0.23 |
| ✓ | counterfactual | They rented a private villa outside Florence. -> They rented a private house outside Florence. | Δ 0.00 | Δ 0.00 |
| ✓ | counterfactual | public static void main(String[] args) { -> public static void main(String[] argv) { | Δ 0.00 | Δ 0.00 |
| ✓ | counterfactual | private static WeatherTodayModel getFromCache(String id) { -> private static WeatherTodayModel getFromCache(string id) { | Δ 0.00 | Δ 0.00 |
| ✓ | lookahead consistency | public class Counter {
private Integer count;
private Integer total;
private Integer max;
}
; var title: String?
var subtitle: String?
; let x = Math.floor(y);; func greet(person: String) -> String {; private fun autoDetectVcsMappings(tryMapPieces: Boolean) {; class Notebook
{
private String title;
private List<Category> categories;
public Notebook(String title, List<Category> categories)
{
}
}
; public static void main(String[] args) {; They rented a private villa outside Florence.; public static void main(String[] args) {; private static WeatherTodayModel getFromCache(String id) { claimed retrospective; measured retrospective (KL=0.03097, tokens=[' int', '()', ' void', ' List', '(Context']) |
Minimal pairs
| # | Base → counterfactual | Expected Δ | Observed Δ | Sufficiency | Necessity |
|---|---|---|---|---|---|
| 1 | public class Counter {
private Integer count;
private Integer total;
private Integer max;
}
→ public class Counter {
private Customer count;
private Customer total;
private Customer max;
}
|
0.52 | 0.52 | 1.00 effect 0.0758 matched 3.54e-05 / 0.00774 |
1.00 effect 0.151 matched 1.7e-05 / 0.00329 |
| 2 | var title: String?
var subtitle: String?
→ var title: Int?
var subtitle: Int?
|
0.50 | 0.50 | 0.97 effect 0.158 matched 1.22e-05 / 0.659 |
0.97 effect 0.00731 matched 1.99e-06 / 0.0169 |
| 3 | let x = Math.floor(y); → let x = math.floor(y); |
0.45 | 0.45 | 1.00 effect 0.0934 matched 2.14e-05 / 0.00247 |
1.00 effect 0.028 matched 4.53e-06 / 0.00151 |
| 4 | func greet(person: String) -> String { → func greet(person: string) -> string { |
0.34 | 0.33 | 1.00 effect 0.149 matched 1.06e-05 / 0.0015 |
1.00 effect 0.0686 matched 8.68e-06 / 0.00121 |
| 5 | private fun autoDetectVcsMappings(tryMapPieces: Boolean) { → private fun autoDetectVcsMappings(tryMapPieces= Boolean) { |
0.50 | 0.50 | 0.97 effect 0.0598 matched 0.00558 / 0.288 |
0.97 effect 0.215 matched 0.00288 / 0.932 |
| 6 | class Notebook
{
private String title;
private List<Category> categories;
public Notebook(String title, List<Category> categories)
{
}
}
→ class Notebook
{
private Object title;
private List<Category> categories;
public Notebook(String title, List<Category> categories)
{
}
}
|
0.36 | 0.36 | 1.00 effect 0.0935 matched 1.15e-06 / 0.00394 |
1.00 effect 0.0596 matched 7.86e-07 / 0.00157 |
| 7 | public static void main(String[] args) { → public static void Main(string[] args) { |
0.23 | 0.23 | 1.00 effect 0.0565 matched 0.000344 / 0.0301 |
1.00 effect 0.00766 matched 1.49e-05 / 0.00449 |
| 8 | They rented a private villa outside Florence. → They rented a private house outside Florence. |
0.00 | 0.00 | — | — |
| 9 | public static void main(String[] args) { → public static void main(String[] argv) { |
0.00 | 0.00 | — | — |
| 10 | private static WeatherTodayModel getFromCache(String id) { → private static WeatherTodayModel getFromCache(string id) { |
0.00 | 0.00 | 1.00 effect 0.00127 matched 1.28e-06 / 0.000943 |
1.00 effect 0.000929 matched 9.53e-07 / 0.000677 |
Read more
Δ is the base prompt's peak positive-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 8 non-control pairs, on next-token KL. Median effect 0.0846 (sufficiency) and 0.0438 (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.
-
13.01
… TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};↵function getDecimals(n) {↵ n = n + '';↵ var i = n.indexOf('.');↵ …
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
Token Positive-pole strength TWO0.079 :0.000 "0.532 two0.000 ",0.370 FE0.032 W0.113 :0.000 "0.668 few0.000 ",0.343 MANY0.000 :0.000 "0.190 many0.000 ",0.245 OTHER0.000 :0.000 "0.136 other0.000 "};↵0.000 function0.009 get0.109 Dec0.000 imals0.000 (n0.000 )0.000 {↵0.000 0.000 n0.253 =13.011 n0.000 +1.132 '';↵0.000 0.000 var0.000 i0.000 =0.757 n0.000 .indexOf0.000 ('.');↵0.000 -
11.87
… private static void addToCache(WeatherTodayModel model) {↵ CACHE.put(model.id, model);↵ }↵↵ private static WeatherTodayModel getFromCache(String id) {↵ return CACHE.get(id);↵ …
All 417 tokens
package tk.woppo.sunday.model;↵↵import android.database.Cursor;↵↵import com.google.gson.Gson;↵import com.google.gson.annotations.SerializedName;↵↵import java.util.HashMap;↵↵import tk.woppo.sunday.dao.WeatherDataHelper;↵import tk.woppo.sunday.dao.WeatherTodayDataHelper;↵↵/**↵ * Created by Ho on 2014/7/4.↵ */↵public class WeatherTodayModel extends BaseModel {↵↵ private static final HashMap<String, WeatherTodayModel> CACHE = new HashMap<String, WeatherTodayModel>();↵↵ /** ���市ID */↵ @SerializedName("cityid")↵ public String id;↵↵ /** ���市名称 */↵ @SerializedName("city")↵ public String cityName;↵↵ /** ��度 */↵ public String temp;↵↵ /** ��气 */↵ public String weather;↵↵ /** ���向 */↵ @SerializedName("WD")↵ public String wind;↵↵ /** ���力 */↵ @SerializedName("WS")↵ public String ws;↵↵ /** ���度 */↵ @SerializedName("SD")↵ public String sd;↵↵ /** 发布时间 */↵ public String time;↵↵ private static void addToCache(WeatherTodayModel model) {↵ CACHE.put(model.id, model);↵ }↵↵ private static WeatherTodayModel getFromCache(String id) {↵ return CACHE.get(id);↵ }↵↵ public static WeatherTodayModel fromJson(String json) {↵ return new Gson().fromJson(json, WeatherTodayModel.class);↵ }↵↵ public static WeatherTodayModel fromCursor(Cursor cursor) {↵ String id = cursor.getString(cursor.getColumnIndex(WeatherDataHelper.WeatherDBInfo.ID));↵ WeatherTodayModel model = getFromCache(id);↵ if (model != null) {↵ return model;↵ }↵ model = new Gson().fromJson(cursor.getString(cursor.getColumnIndex(WeatherTodayDataHelper.WeatherTodayDBInfo.JSON)), WeatherTodayModel.class);↵ addToCache(model);↵ return model;↵ }↵↵ public static class WeatherTodayRequestData {↵ public WeatherTodayModel weatherinfo;↵ }↵}↵
Values
Token Positive-pole strength private5.428 static4.068 void0.000 addTo2.882 Cache8.621 (3.096 Weather0.000 Today0.202 Model0.000 model1.431 )0.000 {↵0.000 3.520 CACHE1.620 .put0.810 (model0.000 .id0.708 ,0.000 model0.000 );↵0.000 0.000 }↵↵0.000 0.000 private3.835 static3.884 Weather0.000 Today0.313 Model0.000 get1.715 From1.728 Cache11.868 (String0.000 id2.729 )0.000 {↵0.000 4.893 return0.000 CACHE0.000 .get1.423 (id0.767 );↵0.000 -
11.10
… client.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
Token Positive-pole strength client1.607 .list1.480 Names1.464 ();↵8.092 9.621 File0.000 folder0.932 =0.000 new3.324 File1.020 ("0.000 c0.000 :\\0.000 test0.000 \\0.000 R0.000 TR0.000 _Z0.000 IP0.000 \\0.000 ");↵5.421 7.989 String0.000 []0.000 filename0.228 =0.000 folder0.166 .list1.545 ();↵↵2.863 7.753 for11.096 (;0.000 i0.000 <0.000 names0.486 .length0.000 ;i0.000 ++)0.000 {↵2.010 9.137 name2.103 -
10.75
… Module) {↵ myMappingsForRemovedModules.addAll(getMappings(module))↵ }↵ }↵↵ private fun autoDetectVcsMappings(tryMapPieces: Boolean) {↵ if (vcsM
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
Token Positive-pole strength Module0.864 )0.000 {↵0.000 0.000 my0.000 Mappings0.000 For0.000 Removed0.000 Modules0.000 .addAll0.439 (get0.000 Mappings0.000 (module0.000 ))↵0.000 0.106 }↵0.000 0.044 }↵↵0.000 0.000 private0.000 fun0.383 auto0.000 Detect0.374 V0.000 cs0.206 Mappings0.036 (0.000 try0.211 Map0.255 Pieces1.012 :10.754 Boolean0.710 )0.000 {↵0.000 0.000 if0.000 (0.000 v0.000 cs0.000 M0.000 -
10.21
… range of numbers with a known min and max value which details:↵Array.prototype.scaleBetween = function(scaledMin, scaledMax) {↵ var max = Math.max.apply(Math, this);↵ var min …
All 379 tokens
Q:↵↵Scale down numbers with known max min to new max min in PHP↵↵Let's say I have this array of numbers:↵$arr = [100, 60, 30, 22, 1]↵and it's based off a 1 - 100 range. And I want it based of a 1 - 5 range.↵I have found this answer here: How to scale down a range of numbers with a known min and max value which details:↵Array.prototype.scaleBetween = function(scaledMin, scaledMax) {↵ var max = Math.max.apply(Math, this);↵ var min = Math.min.apply(Math, this);↵ return this.map(num => (scaledMax-scaledMin)*(num-min)/(max-min)+scaledMin);↵}↵↵But I am not sure how I would translate that to PHP/Laravel.↵↵A:↵↵Not sure if this are the correct results, but it does what you described:↵$arr = [100, 60, 30, 22, 1];↵↵function scale(array $array, float $min, float $max): array↵{↵ $lowest = min($array);↵ $highest = max($array);↵↵ return array_map(function ($elem) use ($lowest, $highest, $min, $max) {↵ return ($max - $min) * ($elem - $lowest) / ($highest - $lowest) + $min;↵ }, $array);↵}↵↵echo json_encode(scale($arr, 1, 10));↵// [10,6.363636363636363,3.6363636363636362,2.909090909090909,1]↵↵
Values
Token Positive-pole strength range0.002 of0.000 numbers0.074 with0.000 a0.086 known0.027 min0.000 and0.375 max0.000 value0.000 which0.157 details0.142 :↵0.000 Array0.449 .prototype0.000 .scale0.281 Between0.028 =0.000 function0.000 (s0.000 caled0.000 Min0.563 ,0.000 scaled0.000 Max0.000 )0.000 {↵0.000 0.000 var0.000 max0.198 =10.209 Math0.013 .max2.497 .apply2.085 (Math1.183 ,3.518 this0.000 );↵0.000 0.000 var0.000 min0.379 -
10.14
… ://mypage.example.com/test.php?name="+data;↵aq.ajax(url, String.class, new AjaxCallback<String>() {↵↵ @Override↵ public void callback(String url, String html, AjaxStatus …
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
Token Positive-pole strength ://0.000 myp0.000 age0.000 .example0.000 .com0.000 /test0.000 .php0.000 ?0.000 name0.000 ="+0.000 data0.464 ;↵7.043 aq1.264 .ajax0.614 (url0.306 ,0.000 String0.000 .class0.000 ,0.000 new9.925 Ajax0.000 Callback2.634 <String1.434 >()0.000 {↵↵0.000 1.147 @0.000 Override0.000 ↵0.000 0.000 public10.144 void0.521 callback6.484 (String0.398 url3.924 ,8.001 String0.322 html3.862 ,7.191 Ajax0.566 Status0.000 -
9.71
… ;↵import javax.ws.rs.core.Context;↵import javax.ws.rs.core.HttpHeaders;↵import javax.ws.rs.core.MediaType;↵import javax.ws.rs.core.MultivaluedMap;↵import javax.ws.rs.core.Response;↵import …
All 648 tokens
/*↵* Licensed to the Apache Software Foundation (ASF) under one or more↵* contributor license agreements. See the NOTICE file distributed with↵* this work for additional information regarding copyright ownership.↵* The ASF licenses this file to You 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.↵*/↵package org.apache.stanbol.entityhub.web.reader;↵↵import java.io.IOException;↵import java.io.InputStream;↵import java.lang.annotation.Annotation;↵import java.lang.reflect.Type;↵import java.util.Arrays;↵import java.util.Collections;↵import java.util.HashMap;↵import java.util.HashSet;↵import java.util.Iterator;↵import java.util.List;↵import java.util.Map;↵import java.util.Set;↵↵import javax.servlet.ServletContext;↵import javax.ws.rs.Consumes;↵import javax.ws.rs.WebApplicationException;↵import javax.ws.rs.core.Context;↵import javax.ws.rs.core.HttpHeaders;↵import javax.ws.rs.core.MediaType;↵import javax.ws.rs.core.MultivaluedMap;↵import javax.ws.rs.core.Response;↵import javax.ws.rs.core.Response.Status;↵import javax.ws.rs.ext.MessageBodyReader;↵import javax.ws.rs.ext.Provider;↵↵import org.apache.clerezza.commons.rdf.Graph;↵import org.apache.clerezza.commons.rdf.BlankNodeOrIRI;↵import org.apache.clerezza.commons.rdf.Triple;↵import org.apache.clerezza.commons.rdf.IRI;↵import org.apache.clerezza.rdf.core.serializedform.Parser;↵import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;↵import org.apache.clerezza.rdf.core.serializedform.UnsupportedParsingFormatException;↵import org.apache.felix.scr.annotations.Component;↵import org.apache.felix.scr.annotations.Property;↵import org.apache.felix.scr.annotations.Reference;↵import org.apache.felix.scr.annotations.Service;↵import org.apache.stanbol.commons.indexedgraph.IndexedGraph;↵import org.apache.stanbol.entityhub.jersey.utils.JerseyUtils;↵import org.apache.stanbol.entityhub.jersey.utils.MessageBodyReaderUtils;↵import org.apache.stanbol.entityhub.jersey.utils.MessageBodyReaderUtils.RequestData;↵import org.apache.stanbol.entityhub.model.clerezza.RdfValueFactory;↵import org.apache.stanbol.entityhub.servicesapi.model.Representation;↵import org.slf4j.Logger;↵import org.slf4j.LoggerFactory;↵/**↵ * Provides support for reading Representation form Requests. This implementation↵ * supports all RDF supports as well as {@link MediaType#APPLICATION_FORM_URLENCODED}↵ * - in case the data are sent from an HTML form - and ↵ * {@link MediaType#MULTIPART_FORM_DATA} - mime encoded data.↵ * In case of an HTML form the encoding need to be spec
Values
Token Positive-pole strength ;↵0.000 import0.000 javax0.039 .ws0.000 .rs0.072 .core1.529 .Context0.176 ;↵0.000 import0.000 javax0.000 .ws0.000 .rs0.000 .core2.177 .Http1.246 Headers0.434 ;↵0.000 import0.000 javax0.000 .ws0.000 .rs0.000 .core2.016 .MediaType1.146 ;↵0.000 import0.000 javax0.000 .ws0.000 .rs0.000 .core0.956 .Mult3.190 ival0.000 ued9.709 Map2.589 ;↵0.000 import0.000 javax0.000 .ws0.000 .rs0.000 .core1.197 .Response2.069 ;↵0.000 import0.000 -
8.96
… ;↵ graphics.lineTo(x, y);↵ rot += step;↵↵ x = cx + Math.cos(rot) * innerRadius;↵ y = cy + Math.sin(rot) * innerRadius;↵ graphics …
All 413 tokens
var config = {↵ type: Phaser.AUTO,↵ parent: 'phaser-example',↵ width: 800,↵ height: 600,↵ scene: {↵ create: create↵ },↵};↵↵var game = new Phaser.Game(config);↵↵function create() {↵↵ var graphics = this.add.graphics();↵↵ drawStar(graphics, 100, 300, 4, 50, 50 / 2, 0xffff00, 0xff0000);↵ drawStar(graphics, 400, 300, 5, 100, 100 / 2, 0xffff00, 0xff0000);↵ drawStar(graphics, 700, 300, 6, 50, 50 / 2, 0xffff00, 0xff0000);↵}↵↵function drawStar (graphics, cx, cy, spikes, outerRadius, innerRadius, color, lineColor)↵{↵ var rot = Math.PI / 2 * 3;↵ var x = cx;↵ var y = cy;↵ var step = Math.PI / spikes;↵↵ graphics.lineStyle(4, lineColor, 1);↵ graphics.fillStyle(color, 1);↵ graphics.beginPath();↵ graphics.moveTo(cx, cy - outerRadius);↵↵ for (i = 0; i < spikes; i++)↵ {↵ x = cx + Math.cos(rot) * outerRadius;↵ y = cy + Math.sin(rot) * outerRadius;↵ graphics.lineTo(x, y);↵ rot += step;↵↵ x = cx + Math.cos(rot) * innerRadius;↵ y = cy + Math.sin(rot) * innerRadius;↵ graphics.lineTo(x, y);↵ rot += step;↵ }↵↵ graphics.lineTo(cx, cy - outerRadius);↵ graphics.closePath();↵ graphics.fillPath();↵ graphics.strokePath();↵}↵
Values
Token Positive-pole strength ;↵0.000 0.000 graphics0.090 .lineTo2.146 (x0.406 ,0.000 y0.000 );↵0.000 0.000 rot0.062 +=2.745 step0.007 ;↵↵0.000 0.000 x0.000 =0.069 cx0.000 +6.678 Math0.000 .cos0.271 (rot0.107 )0.000 *0.000 inner0.177 Radius0.042 ;↵0.000 0.000 y0.000 =0.000 cy0.000 +8.956 Math0.305 .sin0.054 (rot0.000 )0.000 *0.000 inner0.000 Radius0.000 ;↵0.000 0.000 graphics0.000 -
8.63
… a notebook entity modelled which seems wrong as well).↵Below is the very simple class I have:↵class Notebook↵{↵ private String title;↵ private List<Category> categories;↵↵ public Notebook(String title …
All 539 tokens
Q:↵↵Is a low number of members in a class considered a code smell?↵↵I am currently making a simple to-do list program using the MVC pattern, and thus have a model class for the Notebook. However, something feels "off" as it has a very low number of members.↵The Notebook is composed of categories, which are composed of To-do lists, which are composed of Items. ↵What I cannot place is whether this is a case poor analysis (e.g. there are more members and responsibilities I am just missing them..) or perhaps a code smell that the class is not needed (in that case I'm not sure what to do as I could just have a list of categories in that controller, but then I don't have a notebook entity modelled which seems wrong as well).↵Below is the very simple class I have:↵class Notebook↵{↵ private String title;↵ private List<Category> categories;↵↵ public Notebook(String title, List<Category> categories)↵ {↵ }↵↵ public void setCategories(List<Category> categories)↵ {↵ }↵↵ public List<Category> getCategories()↵ {↵ }↵}↵↵I often have this issue where it feels like I am making classes for the sake of it and they have a very number of members/responsibilities, so it would be nice to know whether I am stressing for no reason or not.↵↵A:↵↵Not necessarily, there is the concept in Domain Driven Design of what is called a "Standard Type". Which is really a basic primitive wrapped in an object class. The idea is that the primitive contains no information about what information it contains, it's just a string/int/whatever. So by having say an object that surrounds the primitive and ensures that it is always valid ensures that the object has a meaning far beyond just the primitive it contains e.g. a Name is not just a string, it's a Name.↵Here's an example taken from the comments of Velocity↵public class Velocity↵{↵ private readonly decimal _velocityInKPH;↵↵ public static Velocity VelocityFromMPH(decimal mph)↵ {↵ return new Velocity(toKph(mph));↵ }↵↵ private Velocity(decimal kph)↵ {↵ this._velocityInKPH = kph;↵ }↵↵ public decimal Kph↵ {↵ get{ return this._velocityInKPH; }↵ }↵↵ public decimal Mph↵ {↵ get{ return toMph(this._velocityInKPH); }↵ }↵↵ // equals addition subtraction operators etc.↵↵ private static decimal ToMph(decimal kph){ // conversion code }↵ private static decimal ToKph(decimal mph){ // conversion code }↵}↵↵
Values
Token Positive-pole strength a0.000 notebook0.175 entity0.151 model0.242 led0.216 which0.102 seems0.274 wrong0.326 as0.150 well0.356 ).↵0.000 Below0.014 is0.135 the0.156 very0.419 simple0.008 class0.068 I0.195 have0.000 :↵0.000 class0.000 Notebook0.129 ↵0.000 {↵0.000 0.000 private0.000 String0.000 title0.000 ;↵0.000 0.000 private8.627 List2.188 <Category1.096 >0.000 categories0.632 ;↵↵0.000 0.000 public0.817 Notebook6.105 (String0.000 title1.231 -
8.40
… is my class also...↵import Foundation↵↵struct Item {↵ let name: String↵ let carbs: Int↵}↵↵struct Category {↵ let name: String↵ let items: [Item]↵}↵↵ …
All 446 tokens
Q:↵↵Not populating tableview with structure array↵↵I need to populate my tableView with an array of a structure. The first property of the structure is the name. This is what I tried...↵var menuArray:[Restaurant] = [Restaurant]()↵ override func viewDidLoad() {↵ super.viewDidLoad()↵let shake = Item(name: "Shake", carbs: 20)↵ let fries = Item(name: "Fries", carbs: 30)↵↵ let beverages = Category(name: "Beverages", items: [shake])↵ let chips_fries = Category(name: "Chips & Fries", items: [fries])↵ let desserts = Category(name: "Desserts", items: [])↵ let other = Category(name: "Other Menu Items", items: [])↵ let sandwiches_burgers = Category(name: "Sandwiches & Burgers", items: [])↵ let sides = Category(name: "Sides", items: [])↵↵ a_w = Restaurant(name: "A&W", categories: [beverages, chips_fries, desserts, other, sandwiches_burgers, sides])↵↵ let menuArray = [a_w]↵↵}↵↵override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {↵ let currentCell = tableView.dequeueReusableCell(withIdentifier: "cell")↵ let currentRestaurant = menuArray[indexPath.row]↵ currentCell?.textLabel!.text = currentRestaurant.name↵ return currentCell!↵}↵override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {↵↵ return menuArray.count↵}↵↵Why won't it populate my tableView↵Here is my class also...↵import Foundation↵↵struct Item {↵ let name: String↵ let carbs: Int↵}↵↵struct Category {↵ let name: String↵ let items: [Item]↵}↵↵struct Restaurant {↵ let name: String↵ let categories: [Category]↵↵}↵↵A:↵↵In this line↵let menuArray = [a_w]↵↵you are creating a local variable menuArray which is different from the property with the same name representing the data source array.↵Omit let↵menuArray = [a_w]↵↵PS: Please use more descriptive variable names than a_w.↵↵
Values
Token Positive-pole strength is0.000 my0.000 class0.000 also0.000 ...↵0.000 import0.136 Foundation0.000 ↵↵0.000 struct0.361 Item0.000 {↵0.000 0.000 let0.000 name0.225 :6.015 String0.000 ↵0.000 0.000 let0.000 carbs0.000 :5.457 Int1.358 ↵0.000 }↵↵0.000 struct0.041 Category0.554 {↵0.000 0.000 let0.000 name1.202 :8.403 String0.000 ↵0.000 0.000 let0.000 items0.250 :4.364 [1.462 Item1.371 ]↵0.000 }↵↵0.000 -
7.46
… TRA_DATA";↵↵ private Serializable _data;↵ private ConfirmDialogCallback[] _callbacks;↵ private String _summary;↵↵ public static WrConfirmDialog newInstance(String title, String message,↵ Serializable data, …
All 570 tokens
/*#######################################################↵ * Copyright (c) 2014 Jeff Martin↵ * Copyright (c) 2015 Pedro Lafuente↵ * Copyright (c) 2017-2019 Gregor Santner↵ *↵ * Licensed under the MIT license.↵ * You can get a copy of the license text here:↵ * https://opensource.org/licenses/MIT↵###########################################################*/↵package other.writeily.ui;↵↵import android.app.Dialog;↵import android.os.Bundle;↵import android.support.annotation.NonNull;↵import android.support.v4.app.DialogFragment;↵import android.support.v7.app.AlertDialog;↵import android.text.TextUtils;↵↵import net.gsantner.markor.R;↵import net.gsantner.markor.util.AppSettings;↵↵import java.io.Serializable;↵↵public class WrConfirmDialog extends DialogFragment {↵ public static final String FRAGMENT_TAG = "WrConfirmDialog";↵↵ private static final String EXTRA_TITLE = "EXTRA_TITLE";↵ private static final String EXTRA_MESSAGE = "EXTRA_MESSAGE";↵ public static final String EXTRA_DATA = "EXTRA_DATA";↵↵ private Serializable _data;↵ private ConfirmDialogCallback[] _callbacks;↵ private String _summary;↵↵ public static WrConfirmDialog newInstance(String title, String message,↵ Serializable data, ConfirmDialogCallback... callbacks) {↵ WrConfirmDialog confirmDialog = new WrConfirmDialog();↵ Bundle args = new Bundle();↵ args.putSerializable(EXTRA_DATA, data);↵ args.putString(EXTRA_TITLE, title);↵ args.putString(EXTRA_MESSAGE, message);↵ confirmDialog.setArguments(args);↵ confirmDialog.setCallbacks(callbacks);↵ return confirmDialog;↵ }↵↵ public void setCallbacks(ConfirmDialogCallback[] callbacks) {↵ _callbacks = callbacks;↵ }↵↵ @Override↵ @NonNull↵ public Dialog onCreateDialog(Bundle savedInstanceState) {↵ String title = getArguments().getString(EXTRA_TITLE);↵ String message = getArguments().getString(EXTRA_MESSAGE);↵ _data = getArguments().getSerializable(EXTRA_DATA);↵↵ AlertDialog.Builder dialogBuilder;↵ boolean darkTheme = AppSettings.get().isDarkThemeEnabled();↵ dialogBuilder = new AlertDialog.Builder(getActivity(), darkTheme ?↵ R.style.Theme_AppCompat_Dialog : R.style.Theme_AppCompat_Light_Dialog);↵↵ dialogBuilder.setTitle(title);↵ if (!TextUtils.isEmpty(message)) {↵ dialogBuilder.setMessage(message);↵ }↵↵ dialogBuilder.setPositiveButton(getString(android.R.string.ok), (dialog, which) -> {↵ if (_callbacks != null) {↵ for (ConfirmDialogCallback cdc : _callbacks) {↵ if (cdc != null) {↵ cdc.onConfirmDialogAnswer(true, _data);↵ }↵ }↵ }↵ });↵↵ dialogBuilder.setNegativeButton(getString(R.string.cancel), (dialog, which) -> {↵ dialog.dismiss();↵ for (ConfirmDialogCallback cdc : _cal
Values
Token Positive-pole strength TRA0.000 _DATA0.000 ";↵↵0.000 0.571 private2.408 Serializable0.000 _0.000 data0.950 ;↵0.000 1.165 private2.873 Confirm0.040 Dialog0.000 Callback0.000 []0.000 _0.000 callbacks0.000 ;↵0.000 1.870 private2.590 String0.000 _0.000 summary0.188 ;↵↵0.000 0.000 public0.000 static0.190 Wr0.000 Confirm0.000 Dialog0.003 newInstance7.460 (String0.000 title2.899 ,6.498 String0.000 message2.118 ,↵0.000 2.618 Serializable0.000 data1.357 ,2.131 -
7.01
… XMLInputFactory factory = XMLInputFactory.newInstance();↵ XMLStreamReader parser = factory.createXMLStreamReader(in);↵↵ // lecture des evenements↵ for (int event = parser.next(); event != XML …
All 751 tokens
Q:↵↵StAX and arraylist java↵↵I'm trying to read an xml document with StAX but I have a little problem and i don't know how to fix it, I've tried to look for over internet (maybe i'm using the wrong key word for my problem :/)↵so I've this XML:↵<questionReponses↵xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'↵xmlns='http://polytis.fr/studentest'↵xsi:schemaLocation='http://polytis.fr/studentest qanda.xsd'>↵<questionReponse>↵ <categorie>Biologie</categorie>↵ <question>Question 1</question>↵ <reponse>reponse correcte 1</reponse>↵ <mauvaiseReponse>reponse fausse 1.1</mauvaiseReponse>↵ <mauvaiseReponse>reponse fausse 1.2</mauvaiseReponse>↵ <mauvaiseReponse>reponse fausse 1.3</mauvaiseReponse>↵</questionReponse>↵<questionReponse>↵ <categorie>Chimie</categorie>↵ <question>Question 2</question>↵ <reponse>reponse correcte 2</reponse>↵ <mauvaiseReponse>reponse fausse 2.1</mauvaiseReponse>↵ <mauvaiseReponse>reponse fausse 2.2</mauvaiseReponse>↵ <mauvaiseReponse>reponse fausse 2.3</mauvaiseReponse>↵</questionReponse>↵<questionReponse>↵ <categorie>CultureG</categorie>↵ <question>Question 3</question>↵ <reponse>reponse correcte 3</reponse>↵ <mauvaiseReponse>reponse fausse 3.1</mauvaiseReponse>↵ <mauvaiseReponse>reponse fausse 3.2</mauvaiseReponse>↵ <mauvaiseReponse>reponse fausse 3.3</mauvaiseReponse>↵</questionReponse>↵↵here is my parser:↵try {↵ // instanciation du parser↵ InputStream in = new FileInputStream(nomFichier);↵ XMLInputFactory factory = XMLInputFactory.newInstance();↵ XMLStreamReader parser = factory.createXMLStreamReader(in);↵↵ // lecture des evenements↵ for (int event = parser.next(); event != XMLStreamConstants.END_DOCUMENT; event = parser.next()) {↵ // traitement selon l'evenement↵ switch (event) {↵ case XMLStreamConstants.START_ELEMENT:↵ break;↵ case XMLStreamConstants.END_ELEMENT:↵ if (parser.getLocalName().equals("questionReponse")) {↵ question = new Question(categorieCourante,questionCourante,bonneReponseCourante,mauvaisesReponses);↵ quizz.add(question);↵ } ↵ if (parser.getLocalName().equals("categorie")) {↵ categorieCourante = donneesCourantes;↵ }↵ if (parser.getLocalName().equals("question")) {↵ questionCourante = donneesCourantes;↵ }↵ if (parser.getLocalName().equals("reponse")) {↵ bonneReponseCourante = donneesCourantes;↵ }↵ if (parser.getLocalName().equals("mauvaiseReponse")) {↵ mauvaisesReponses.add(donneesCourantes);↵ }↵ break;↵ case XMLStreamConstants.CHARACTERS:↵ donneesCour
Values
Token Positive-pole strength 5.020 XML0.796 Input0.014 Factory0.000 factory0.527 =1.727 XML0.399 Input0.211 Factory0.165 .newInstance0.002 ();↵1.112 4.600 XML0.201 StreamReader0.000 parser1.072 =0.000 factory0.047 .create0.798 XML0.713 StreamReader0.310 (in0.000 );↵↵0.000 4.942 //0.000 lecture0.000 des0.000 even0.000 ements0.000 ↵0.853 5.045 for7.006 (1.690 int0.000 event0.472 =0.000 parser0.000 .next0.823 ();0.000 event0.117 !=3.055 XML2.395
Read more
Each token is shaded by positive-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.
Explanation scores on held-out text
How well a judge with only the hypothesis predicts the unit on new text. 0.5 is chance.
Read more
The judge reads 32-token windows of corpus text that the proposer never saw. Detection: it picks the windows that activate the unit. Fuzzing: it checks whether the marked tokens are the active ones. Recorded, not gated.
Detection recall by activation strength
False alarms on inactive windows: 0%.
- Judge
- claude-haiku-5-5
- Held-out windows
- 28 active of 4,000
- Judged
- 30 detection · 19 fuzzing
- Detection outcomes
- 14 missed · 0 false alarm · 1 hit · 15 correct rejection
- Seed
- 2401114967 · corpus.jsonl
Detection windows (30), the explanation's mistakes first
- missed 6.06 · sim -0.00 , Boston, MA 02111-1307 USA↵ *↵ * World of Warcraft, and all World of Warcraft or Warcraft
- missed 4.16 · sim 0.02 a National Secretary General (Secretario General del Comité Ejecutivo Nacional).↵↵It currently has 4.5 million worker members throughout the 32 states
- missed 4.15 · sim -0.06 gods”.↵↵Those comments prompted calls for Abbott to sack Newman, but the environment minister, Greg Hunt, defended the adviser saying he, like the government, supports the
- missed 3.93 · sim 0.06 cardiac dysfunction (CTRCD), acute arrhythmias, pericardial disease, valvopathies and early atherosclerotic Cardiovascular Disease (
- missed 3.75 · sim 0.03 the remainder of the window, with any moves now unlikely to happen until after the World Cup.↵↵(Image: FILIPPO MONTEFORTE/AFP/Getty Images)↵↵
- missed 3.73 · sim -0.04 -rich Grand Cayman, the largest of the Cayman Islands, has been nurturing a reputation as the culinary capital of the Caribbean. Now, its growing foodie
- missed 3.73 · sim 0.11 .Add(1.55);↵myObject.boxHeight.Add(2.55);↵myObject.boxLength.Add(1.55);↵myObject.box
- missed 3.66 · sim 0.09 ;↵ type = dbm.dataType;↵ seed = seedLink;↵};↵↵exports.up = function (db) {↵ return Promise.all([↵ db.run
- missed 3.52 · sim 0.17 Length.Add(2.55);↵myObject.boxWidth.Add(1.55);↵myObject.boxWidth.Add(2.55);↵↵bool test
- missed 3.49 · sim 0.10 = new API_Methods();↵myObject.recipientName;↵myObject.boxnumber.Add(1);↵myObject.boxnumber.Add(2);↵myObject.boxHeight
- missed 3.44 · sim 0.03 = null;↵↵ public LibraryItemDetailsView View↵ {↵ get↵ {↵ if (_view == null)↵ {↵ _view = new
- missed 3.41 · sim 0.00 ApexPages.currentPage().getHeaders().get('Host');↵ sServerName = 'https://'+sServerName+'/';↵ String editName='/e?
- missed 3.30 · sim -0.01 for a World Cup match, and, predictably, Britain got beaten by Mexico.↵↵Latest Interviews↵↵The Latest from Mind The Gap↵↵America’s British population has
- missed 3.27 · sim 0.15 exclui da mesma↵ * @return a propriedade ou null se não existir↵ */↵ public static function getPropriedadeLimpar
- hit 3.27 · sim -0.01 ');↵ }↵↵ public PageReference convert(){↵ PageReference pref;↵↵ Property__c property = [↵ select ↵ Id, ↵ Name, ↵
- correct rejection 1.04 · sim 0.05 Per Click advertising program include: Google, Yahoo and MSN.↵↵Click to Enlarge↵↵Target Your Audience More Accurately↵↵Traditional advertising is designed for maximum
- correct rejection 0.95 · sim 0.00 the Lancaster County Convention Center and Marriott Hotel in downtown Lancaster. The highly controversial “convention center project,” as it was known to those in Lancaster County (pop
- correct rejection 0.94 · sim 0.07 gin cocktails, claret cups, brandy smashes, or the like. Rather, his greatest affinity was for a drink that was fading faster and faster into
- correct rejection 0.91 · sim -0.03 Craig Kaufman, Larry Bell and his coated glass, Robert Irwin's disks and scrims. Ken Price got really bizarre really quick and took it somewhere else
- correct rejection 0.81 · sim 0.12 a.m. and that it sounded like somebody fell out of bed.↵↵“I heard something go boom,” the man said, adding that he does not feel safe in
- correct rejection 0.73 · sim -0.08 of nurses in the provision of youth-friendly sexual and reproductive health services in South-Kivu Province in the Democratic Republic of the Congo, Burundi, and Rwanda
- correct rejection 0.70 · sim -0.02 includes a wafer transfer chamber, a plurality of parallel PVD or other process chambers connected with the transfer chamber, a cooling chamber, a preclean chamber,
- correct rejection 0.69 · sim 0.06 in Taguig!↵↵A few weeks ago, Susy started a massive search for her missing friend Geno . Susy even put up a Facebook page where
- correct rejection 0.66 · sim -0.10 It always felt like the back half of the summer was going to have the stronger slate, with Spider-Man: Far From Home and Lion King and Hobbs &
- correct rejection 0.64 · sim 0.13 good terrorists. They offer a strategic advantage in conducting terrorist attacks; as women do not conform to traditional security profiles, they typically arouse less suspicion, and their
- correct rejection 0.59 · sim 0.10 =0.001) min after surgery. Fewer patients received both upper and lower body warming in the upper body warming group than in the lower body
- correct rejection 0.59 · sim 0.07 derivative with respect to first step nonparametric estimation is zero and equivalently first step estimation has no effect on the influence function. This construction consists of adding an
- correct rejection 0.58 · sim -0.04 Ancient toolmaking site discovered near Niagara Falls↵↵Archaeologists have found arrowheads and drills, indicating that the camps were occupied for extended periods of time.↵↵
- correct rejection 0.55 · sim 0.04 . She underwent an Orthodox conversion before marrying, and the couple are raising their children Jewish. Donald Trump, a billionaire with a natural gift for generating free publicity,
- correct rejection 0.52 · sim 0.01 enforce” the intellectual property rights of its brands “against individuals and third parties responsible for the production, distribution and sale of unauthorized materials in China and throughout the world
Fuzzing windows (19), dashed tokens were marked for the judge
- marks right · judged wrong Micro-Loan Program↵↵In order to promote economic development in the City of Alamo, the Alamo EDC established the Alamo Small Business Micro-Loan
- marks right · judged wrong , the National Police Chiefs' Council, set up under a police collaboration agreement under Section 22A of the Police Act 1996.↵↵Background
- marks right · judged wrong // Copyright 2004-present Facebook. All Rights Reserved.↵↵#include "SamplingProfilerJniMethod.h"↵↵#include <JavaScriptCore/JSProfilerPrivate.h
- marks right · judged wrong Blonde in Die Entführung, Madame Herz in Der Schauspieldirektor, Greta Fiorentino in Street Scene, and Fiordiligi Cos
- marks right · judged wrong 55089 based in Welch. Nearby places include Cannon Falls, Red Wing, Welch, and White Rock.↵↵Vasa is 12 miles
- marks right · judged wrong Management of ventricular tachycardia in the ablation era: results of the European Heart Rhythm Association Survey.↵Patients with sustained ventricular tach
- marks wrong · judged wrong be the first act of a crime thriller along the same lines as Red Dragon (a great movie that should be seen if you haven’t already). This provides the
- marks wrong · judged wrong After a promising debut with "The Living End" followed by the angrier, more marginalized "Totally F***ed Up," Mr. Araki is still
- marks wrong · judged wrong return pref;↵↵ } ↵↵ public PageReference back(){↵ PageReference pref = new PageReference('/' + propertyId);↵ pref.setRedirect(true
- marks right · judged right Id;↵↵ public ControllerCreateProposalView(ApexPages.StandardController stdController){↵ propertyId = ApexPages.CurrentPage().getParameters().get('id
- marks wrong · judged wrong Q:↵↵Listbox returns System.Data.DataRowView instead of values↵↵I am doing a project for my school, where I have to make a C# Windows
- marks wrong · judged wrong Result, nullptr);↵ size_t length = JSStringGetLength(resultStrRef);↵ char buffer[length + 1];↵ JSStringGetUTF8CString
- marks wrong · judged wrong <Foundation/Foundation.h>↵↵#import "DBSerializableProtocol.h"↵↵@class DBTEAMPOLICIESSharedFolderJoinPolicy;↵↵NS_ASSUME_NONNULL_BEGIN↵↵#pragma
- marks wrong · judged wrong WWF [World Wildlife Fund] are deep. It panders to gender balance and regional representation, not scientific excellence.”↵↵Newman has chaired the advisory council since
- marks wrong · judged wrong in the art for micelles that are capable of changing morphology in a predictable or programmable way. Provided herein are solutions to these and other problems in the art
- marks wrong · judged wrong vendar o que chama de processo de politização do Judiciário paulista em sua tese de doutorado em administração pública e governo.↵↵
- marks wrong · judged wrong background-color: #144212;↵ color: #e6e1dc;↵ display: inline-block;↵ width: 1
- marks wrong · judged wrong Wednesbury are going to be coming alive with plants, animals, and barbies! The summer flower collection is now in full swing, with some delightful bou
- marks wrong · judged wrong San Francisco is a city of rich history and culture, and as anyone planning a visit to the City by the Bay realizes, it can be difficult to narrow down
Activation and mechanism
Activation distribution
Positive-pole strength per token; bar height is log(1 + count).
Mechanism
Claimed retrospective: responds to tokens already in context.
Input attribution
- #1 (not converged) at
=:imals-6 0.18=0 0.17(n-5 0.12Locale-58 0.12PL-45 0.08 - #2 (not converged) at
Cache:Cache0 0.22. -188 0.22*/ -187 -0.16(-25 0.10/** -203 -0.09 - #3 (not converged) at
for:for0 -1.19-1 0.65(); -2 0.44c-19 0.31: -159 -0.18 - #4 (not converged) at
::Pieces-1 0.79:0 -0.53Event-490 -0.12Map-2 -0.09-489 0.09 - #5 (not converged) at
=:max-1 0.64var-2 0.20's-69 -0.18=0 -0.17-3 -0.14
Shares of the gap to <|endoftext|> at every position but the first · converged on 0 of 5 · mean — tokens back ·
agreement with replacing one token at a time ρ = — · reported, not gated
Vocabulary projection
The tokens that this unit's output raises and lowers most.
Jacobian lens
Logit lens
Values
| # | Jacobian lens promotes | suppresses | Logit lens promotes | suppresses | ||||
|---|---|---|---|---|---|---|---|---|
| 1 | ampus |
+4.17 | String |
-13.91 | ampus |
+4.17 | String |
-13.91 |
| 2 | icularly |
+4.10 | (String |
-12.80 | icularly |
+4.10 | (String |
-12.80 |
| 3 | JKLMNOP |
+4.09 | String |
-11.30 | JKLMNOP |
+4.09 | String |
-11.30 |
| 4 | setBackgroundImage |
+4.06 | String |
-11.13 | setBackgroundImage |
+4.06 | String |
-11.13 |
| 5 | 在过渡 |
+3.86 | Math |
-10.94 | 在过渡 |
+3.86 | Math |
-10.94 |
| 6 | ٪ |
+3.84 | Strings |
-10.83 | ٪ |
+3.84 | Strings |
-10.83 |
| 7 | 侧面 |
+3.83 | ,String |
-10.66 | 侧面 |
+3.83 | ,String |
-10.66 |
| 8 | iform |
+3.82 | string |
-10.27 | iform |
+3.82 | string |
-10.27 |
| 9 | 一条龙 |
+3.81 | strings |
-10.10 | 一条龙 |
+3.81 | strings |
-10.10 |
| 10 | ELY |
+3.81 | Math |
-9.93 | ELY |
+3.81 | Math |
-9.93 |
Top-10 overlap 100% · cos(w, J·w) 1.00 · kurtosis 6.5 (Jacobian) / 6.5 (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).
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 14 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
| L20/N1574 | gate | -0.26 |
| L21/N3189 | gate | +0.173 |
| L20/N817 | up | +0.133 |
| L19/N4403 | up | +0.117 |
| L20/N246 | up | -0.114 |
| L21/N3558 | up | -0.114 |
| L20/N3646 | up | -0.113 |
| L21/N2052 | up | -0.11 |
| L19/N3371 | up | -0.11 |
| L18/N3917 | gate | +0.109 |
Upstream heads
| L22/H3 | gate | +0.761 |
| L22/H10 | gate | +0.663 |
| L20/H8 | gate | +0.634 |
| L23/H1 | up | +0.578 |
| L22/H12 | gate | +0.548 |
| L21/H10 | gate | +0.531 |
| L21/H5 | up | +0.523 |
| L22/H9 | up | +0.522 |
| L20/H10 | up | +0.514 |
| L22/H4 | gate | +0.505 |
Downstream neurons
None: no later layer.
Downstream heads
None: no later layer.
From activations
Upstream neurons
| L20/N1574 | +3.19 | |
| L19/N3371 | +1.48 | |
| L18/N3917 | +1.29 | |
| L20/N2965 | +1.08 | |
| L22/N82 | -0.892 | |
| L21/N3558 | +0.634 | |
| L22/N1222 | -0.6 | |
| L17/N2225 | +0.503 | |
| L19/N4403 | +0.475 | |
| L20/N4390 | +0.458 |
Upstream heads
| L23/H1 | -1.71 | |
| L20/H8 | +1.42 | |
| L17/H1 | +1.02 | |
| L21/H9 | -0.942 | |
| L22/H3 | +0.87 | |
| L20/H10 | -0.618 | |
| L21/H4 | -0.617 | |
| L21/H0 | -0.474 | |
| L21/H3 | -0.457 | |
| L20/H13 | -0.451 |
Downstream neurons
None: no later layer.
Downstream heads
None: no later layer.
Covariance and confounds
Confounds
- Token identity R²
- 0.27
- Position R²
- 0.01
- Frequency r
- 0.06
- Best trivial baseline
- never active · 0.32
- Hypothesis
- 0.82 ✓
Cache throwsued.util<Stringvascularreme.io.Data Solidmy.utils
Co-activating neuron poles
| Pole | Lift ≥ | Both | ρ | r |
|---|---|---|---|---|
| N4444+ | 49.4 | 124 | +0.08 | +0.23 |
| N3814+ | 35.6 | 93 | +0.05 | +0.08 |
| N1128+ | 24.6 | 67 | -0.15 | +0.02 |
| N4452− | 20.4 | 57 | +0.18 | -0.13 |
| N898+ | 19.6 | 55 | +0.12 | +0.08 |
| N4033+ | 19.6 | 55 | +0.07 | +0.06 |
| N4836− | 19.2 | 54 | +0.06 | -0.03 |
| N4554− | 18.4 | 52 | +0.16 | -0.08 |
| N476+ | 17.1 | 49 | +0.02 | -0.01 |
| N1858− | 16.7 | 48 | -0.13 | -0.02 |
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
- N4444, N3814, N1128
- KL pole alone
- 2.48e-02
- KL partners
- 3.77e-02
- KL together
- 8.71e-02
- Redundancy ratio
- 1.99
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-23 05:48 UTC
- Max activation
- 13.0115
- Selection
- manual
- Corpus
- corpus.jsonl · 199,896 tokens · seeded sample of 477/500 docs (≤ 200,000 tokens, seed 0) · 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
- Run cost
- 22.3 min (slowest: scan, 5.6 min) · 4 LLM calls