- 1
- 2
- 3
- 4
- 5
- 6
- 7
/**
* Change the zoom level to the specified value. Specify 0.0 to reset the
* zoom level.
*
* @param zoomLevel The zoom level to be set.
*/
public void setZoomLevel(double zoomLevel);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+2
/**
* Change the zoom level to the specified value. Specify 0.0 to reset the
* zoom level.
*
* @param zoomLevel The zoom level to be set.
*/
public void setZoomLevel(double zoomLevel);
Когда-то я думал, что zoom 100% это 1.0. И что на zoom нужно умножать. Но оказалось, что я анскильный.
+4
static int parse_num(const char *s, size_t *out) {
if (s == NULL || *s == '\0')
return -1;
char *end = 0;
errno = 0;
uint64_t num = strtoull(s, &end, 0);
if (errno != 0)
return -1;
if (*end != '\0')
return -1;
if (num > SIZE_MAX)
return -1;
*out = (size_t)num;
return 0;
}
Какие же всё-таки удобные функции в стандартной няшколибе.
0
-module(server).
-export([start/0]).
start() ->
rooster:start(#{port => 8080},
#{routes => [hello()]}).
hello() ->
{'GET', "/hello", fun(_) -> {200, #{message => <<"hello world">>}} end}.
https://github.com/fbeline/rooster
Rooster
Simplistic REST framework that runs on top of mochiweb.
0
class HelloRooster implements EditorPlugin {
getName() {
return 'HelloRooster';
}
initialize(editor: Editor) {}
dispose() {}
onPluginEvent(e: PluginEvent) {
if (e.eventType == PluginEventType.KeyPress && e.rawEvent.which == 65) {
alert('Hello Rooster');
}
}
}
https://github.com/microsoft/roosterjs
0
#include <stdlib.h>
void main()
{
a: ; malloc(1); goto a;
}
+2
REM I'm trying to do some simple webscraping in OpenOffice (I usually work in Excel but I'm trying to port
REM something over for a coworker that doesn't have Excel).
REM However, when I try to run something very similar to this, it keeps giving me this BASIC runtime error 1.
Sub Macro1
Dim explorer As Object
Set explorer = CreateObject("InternetExplorer.Application")
explorer.Visible = True
explorer.navigate("www.yahoo.com")
Const READYSTATE_COMPLETE As Long = 4
Do While explorer.Busy Or explorer.readyState <> READYSTATE_COMPLETE
Loop
dim page as object
set page = explorer.Document
dim mailButton as object
set mailButton = page.GetElementByID("ybar-navigation-item-mail") 'this is the line the error occurs on
mailButton.Click
End Sub
а чего бы нам не краулить сайты, запуская IE через BASIC в экселе
https://stackoverflow.com/questions/64010764/is-webscraping-with-openoffice-basic-even-possible
0
public void startLoginService(User paramUser) {
if (paramUser != null) {
Intent intent = new Intent((Context)this, LoginService.class);
intent.putExtra("LOGIN_KEY", paramUser.getLogin());
intent.putExtra("PASSWORD_KEY", String.valueOf(paramUser.getId()));
startService(intent);
}
}
0
public static UUID fromString(String name) {
String[] components = name.split("-");
if (components.length != 5)
throw new IllegalArgumentException("Invalid UUID string: "+name);
for (int i=0; i<5; i++)
components[i] = "0x"+components[i];
long mostSigBits = Long.decode(components[0]).longValue();
mostSigBits <<= 16;
mostSigBits |= Long.decode(components[1]).longValue();
mostSigBits <<= 16;
mostSigBits |= Long.decode(components[2]).longValue();
long leastSigBits = Long.decode(components[3]).longValue();
leastSigBits <<= 48;
leastSigBits |= Long.decode(components[4]).longValue();
return new UUID(mostSigBits, leastSigBits);
}
без префикса "0x" написать рабочий код было невозможно, очевидно
это хоть починили
https://github.com/openjdk/jdk/blob/jdk8-b120/jdk/src/share/classes/java/util/UUID.java#L191-L209
0
/**
* Compares {@link Comparable} objects in natural order.
*
* @see Comparable
*/
enum NaturalOrderComparator implements Comparator<Comparable<Object>> {
INSTANCE;
@Override
public int compare(Comparable<Object> c1, Comparable<Object> c2) {
return c1.compareTo(c2);
}
@Override
public Comparator<Comparable<Object>> reversed() {
return Comparator.reverseOrder();
}
}
У нас будет компаратор, который сравнивает дженерики, но не совсем дженерики, потому что Object, а еще мы сделаем его enum, потому что можем
https://github.com/openjdk/jdk/blob/jdk-14-ga/src/java.base/share/classes/java/util/Comparators.java#L47-L59
0
<img alt="[object Object]" title="[object Object]" loading="lazy">
https://beru.ru/catalog/avtotovary/76688?hid=90402 , когда смог в жс на бэкэнде