Irina’s Weblog

9/8/2022

JVM in action

Filed under: Computers — Izida @ 10:22 pm

A visualization I have prepared today for our weekly team knowledge sharing session. Displayed is the Java Virtual Machine as it executes the code of a simple sum() function. I have used the javap disassembler to generate the readable bytecode instructions which are highlighted with the current instruction pointer.


The Local Variables contains the function arguments and all local variables declared in the function. Since the function is not static, the first argument is “this”.
The JVM is a stack-oriented abstract machine – if an instruction needs an input, this input should be put on the Operand Stack before calling the instruction itself.
Each JVM instruction is a single byte. For example, iload_0 means “load local variable with index 0 as int in the Operand Stack”. So the “i” in the “iload_0” means “int”. This instruction is part of a group of int operations: iload_0, iload_1, iload_2, iload_3 for which you don’t need to supply an index as it is part of the instruction itself. When you need to access Local Variable with index more than 3, you need to use the generic iload instruction and supply the index as a second byte that follows the byte of the instruction. JVM provides also lload, fload, dload, aload for the other primitive types. Each of these operations has additional 4 instructions for manipulation of the first 4 Local Variables as iload does.

Big thanks to Alexander Shopov for his inspiring presentations: https://lnkd.in/dYpgkKfK & https://lnkd.in/dZQy8S5H

8/8/2022

Brain Modes and Pair Programming

Filed under: Computers — Izida @ 8:18 pm

Pair Programming is a famous XP technique with both devoted supporters and strong opposers. It is also quite well known. Still recently I read in the book “Pragmatic Thinking and Learning” an interesting opinion from the author what exactly are the biggest pluses of Pair Programming:

Our brain can be in one of two modes: linear (logical, verbal, conscious) and rich (intuitive, non-verbal, unconscious). While writing code we are verbal, thus forcing our brain to enter linear mode. Unfortunately, this brings a serious disadvantage – since rich mode is off, and rich mode is responsible for creativity, we loose the chance to come up with the most original and beautiful ideas. That is why we need to regularly step away from the keyboard to be able to process the problem from another perspective. What I usually do is to prepare myself a cup of herbal tea, go on the terrace, take a walk outside, or even, with home office, do some laundry. When one does something routine, the linear brain mode seems to get bored and switches off. Then the subconscious processing of your problem starts. When you go back to the keyboard after a while, the solutions is present without you having searched intentionally for it.

Pair Programming allows us to eliminate the need of such breaks since there is a second programmer next to us. He is free from writing code, from verbality, so his mind is able to turn on its rich mode. This way he is able to see the big picture, to search for patterns, to identify repetitions. Instead of a single programmer switching between linear and rich brain mode, there are now two programmers working one in linear, another in rich mode. The two complement each other. We have both brain modes simultaneously instead of sequentially.

The Driver drives the car and stays focused, the Navigator looks at the whole picture and offers suggestions and advice.

8/9/2017

Java: JVM 8 Memory Model

Filed under: Computers — Izida @ 2:28 pm

During investigation of chapter 2.5 Run-Time Data Areas of “The Java® Virtual Machine Specification, Java SE 8 Edition”, I created the following Mind map to help myself visualize the types of areas in the JVM memory. Click on thumbnail to see the full image.

JVM 8 Memory Model

Any comments are welcome.

Mind map created with FreeMind.

26/6/2017

find-sec-bugs & redirect warnings

Filed under: Computers — Izida @ 5:10 pm

A colleague asked me why is SonarQube complaining about HttpServletResponse redirects so much. It seems to come from FindSecBugs plugin for FindBugs. In the description Unvalidated Redirect) the explanation is the following:

Unvalidated redirects occur when an application redirects a user to a destination URL specified by a user supplied parameter that is not validated. Such vulnerabilities can be used to facilitate phishing attacks.

This is the famous “Unvalidated Redirects and Forwards” OWASP Top 10 vulnerability.

But the issue is that the code in mention was making a simple redirect to a path defined in class level a constant – no variables were ever added to the URL. Definitely a false-positive. The question was: how to re-write the code for Sonar to stop complaining?

First thing to do: check the proposed solutions.

Solution/Countermeasures:
– Don’t accept redirection destinations from users
– Accept a destination key, and use it to look up the target (legal) destination
– Accept only relative paths
– White list URLs (if possible)
– Validate that the beginning of the URL is part of a white list

I realized some of the solutions (like white-listing) are a bit too much for a static analyzer to check. The following crossed my mind: security issues are too important so maybe the creators of find-sec-bugs have decided to mark ALL redirects as vulnerabilities in order for the code author to check all of them with care and mark the false positives.

Next step: Check the implementation, which in our case is class find-sec-bugs/plugin/src/main/java/com/h3xstream/findsecbugs/injection/redirect/RedirectionSource.java

My guess was correct! All redirects are marked as vulnerabilities, as well as all additions of “Location” headers.

So only option for now – manual ignore with comment.

It seems there is a long-going discussion on the topic in their issue tracker: “findsecbugs:UNVALIDATED_REDIRECT and context path”

20/2/2017

Throwing Java checked exception, not declared in the method declaration

Filed under: Computers — Izida @ 5:49 pm

As I was browsing through JVM 8.0 Specification, I saw the following in chapter 4.7.5. The Exceptions Attribute:

A method should throw an exception only if at least one of the following three criteria is met:

  1. The exception is an instance of RuntimeException or one of its subclasses.
  2. The exception is an instance of Error or one of its subclasses.
  3. The exception is an instance of one of the exception classes specified in the exception_index_table just described, or one of their subclasses.(Irina’s note: it is listed in the “throws” clause of the method)

These requirements are not enforced in the Java Virtual Machine; they are enforced only at compile time.

I decided to check how would Oracle’s JVM act in case a method throws checked exception, not listed in the “throws” clause. What I needed was a method that throws one checked exception like this:

import java.io.IOException;
public class ThrowsTest {
public void f(int a) throws IOException {
if (a < 0) throw new IOException(); } public static void main(String[] args) throws NumberFormatException, IOException { new ThrowsTest().f(Integer.valueOf(args[0])); } }

After compiling at the command line with "javac ThrowsTest.java", one could easily test that negative command-line argument causes an IOException:

>java ThrowsTest -2
Exception in thread "main" java.io.IOException
at ThrowsTest.f(ThrowsTest.java:7)
at ThrowsTest.main(ThrowsTest.java:17)

What I would try to do is replace in the class file the construction of java.io.IOException with another checked exception - for example, java.lang.Exception, without updating the "throws" clause, and check if the JVM really throws it. To do so it would be easier if I simply change the bytes in the class file to point to an exception, which is already known to the class file. I.e. it is part of the Static Pool of the class. I am adding another method:
public void g(int a, int b) throws Exception {
if (a + b < 0) { throw new Exception(); } }

The key here is to have exactly the same exception constructor - in this case, I have chosen one with zero parameters.

I could simply open the ThrowsTest.class in a HEX editor. To identify the method I used also a helper tool: Java Class File Editor. In it I was able to inspect the correct indexes of the old exception and the new exception in the Constant Pool:

Byte Code Analysis

Then I looked at the Byte code of the method. It is located in an Attribute with name "Code" for the method void (int):
Method

It is visible that the "new" instruction creates an instance of java.io.IOException (index 2 in the Constant Pool above) , and "invokespecial" finishes the construction by calling the constructor (index 3 in the Constant Pool above). That are the two values I need to change. The new values should be java.lang.Exception with index 4 and the constructor ()V with index 5. To identify the location in the binary file, I opened it in HEX and found the first occurrence of "invocespecial" - bytecode b7. Right after it the value was 3, now changed to 5. Two instructions back is the "new" instruction with operand 2, now changed to 4:

Byte Code - modified

When I now run the same test, I have the following result:

>java ThrowsTest -2
Exception in thread "main" java.lang.Exception
at ThrowsTest.f(ThrowsTest.java:7)
at ThrowsTest.main(ThrowsTest.java:17)

Decompilation of the class with CFR - another java decompiler shows the following non-compilable code:
/*
* Decompiled with CFR 0_119.
*/
import java.io.IOException;
public class ThrowsTest {
public void f(int n) throws IOException {
if (n < 0) { throw new Exception(); } } public void g(int n, int n2) throws Exception { if (n + n2 < 0) { throw new Exception(); } } public static void main(String[] arrstring) throws NumberFormatException, IOException { new ThrowsTest().f(Integer.valueOf(arrstring[0])); } }

So indeed Oracle's JVM did allow an inconsistent class to run - it throws checked exception not listed in its "Exceptions" attribute of the method.

21/9/2011

Åëåêòðîííèòå ó÷åáíèöè íà Ïðîñâåòà

Filed under: Books,Computers,Ãðàæäàíñêè — Izida @ 5:41 pm

Äîêàòî ïðåãëåæäàõ ñàéòà íà Ïðîñâåòà ïîïàäíàõ íà ñëåäíîòî:

Çà ïðúâ ïúò â Áúëãàðèÿ Prosveta Libri Magici – ó÷åáíèöèòå íà áúäåùåòî!

Èçãëåäàõ êëèï÷åòî, ïðåãëåäàõ ïðèìåðíèòå óðîöè ïî Ìàòåìàòèêà è Áúëãàðñêè åçèê. Èíòåðåñíî å, óâëåêàòåëíî å, èìà ôèëì÷åòà è çâóöè. Íî ìå ïîäðàçíèõà íÿêîëêî èçêàçâàíèÿ îò êëèïà:

  • “Òåáåøèðèòå, ÷åðíàòà äúñêà, îãðîìíèòå ïðàøíè êàðòè è äåáåëè àòëàñè îñòàâàò â ìèíàëîòî!”
  • “… äðóãî îñíîâíî ïðåäèìñòâî: îñâîáîæäàâà ó÷èòåëÿ îò íåîáõîäèìîñòòà íåïðåêúñíàòî äà òúðñè è îñèãóðÿâà äîïúëíèòåëíè ìàòåðèàëè, äà ñå ãðèæè çà íàáàâÿíåòî íà èíôîðìàöèÿ. Âñè÷êî, îò êîåòî ñå íóæäàå, å ñúáðàíî â èíòåðàêòèâíèÿ ó÷åáíèê, êîéòî ìîæå äà ñå äîïúëâà è îáíîâÿâà ìíîãî ïî-ëåñíî è áúðçî îò òðàäèöèîííîòî èçäàíèå íà õàðòèåí íîñèòåë.”

Ïî îòíîøåíèå íà àðãóìåíòà çà ïðåìàõâàíåòî íà ÷åðíàòà äúñêà ùå öèòèðàì ñåíòåíöèÿ îò ñàéòà íà Ïðîñâåòà:

×îâåê çàïîìíÿ ………
10 % îò òîâà, êîåòî ÷åòå;
20 % îò òîâà, êîåòî ÷óâà;
30 % îò òîâà, êîåòî âèæäà;
50 % îò òîâà, êîåòî ÷óâà è âèæäà;
70 % îò òîâà, êîåòî êàçâà;
90 % îò òîâà, êîåòî êàçâà è ïðàâè.

Ñúâñåì äðóãî å êàòî ó÷åíèê ñå èçïðàâè ïðåä ÷åðíàòà äúñêà è ðåøè íÿêàêâà çàäà÷à – ïîïàäà â ïîñëåäíèòå 90%, çàùîòî ãî ïðàâè ñàì. À è êàêòî ñàìèòå Ïðîñâåòà òâúðäÿò – åëåêòðîííèÿò ó÷åáíèê íå çàìåñòâà êëàñè÷åñêèÿ, à ãî äîïúëâà. Òàêà ñïîðåä ìåí è èíòåðàêòèâíàòà äúñêà íå çàìåñòâà “÷åðíàòà”, à îòíîâî ñàìî ÿ äîïúëâà.

Ïî îòíîøåíèå íà “îñíîâíîòî ïðåäèìñòâî” êîìåíòàðúò å èçëèøåí.

18/7/2009

Ðàçëèêà ìåæäó èíòåãðàöèÿ è êîìïîçèöèÿ íà êîìïîíåíòè

Filed under: Computers — Izida @ 9:12 pm

Èç êíèãàòà “Building Reliable Component-based Software Systems” ñ àâòîðè Ivica Crnkovic è Magnus Larsson:

Component integration is the mechanical task of “wiring” components together by matching the needs and services of one component with the services and needs of others.

Composition … is an engineering task beyond the mechanics of wiring components together. In analogy, consider the incompatibility of connecting a very powerful audio amplifier to low-wattage speakers. The speakers will plug in with no problem and at low volumes will probably function acceptably, but if the volume is raised the speakers will most likely be destroyed.

Âïå÷àòëåíèå ìè íàïðàâè ñëåäíàòà çàáåëåæêà íà àâòîðà:

Although the introduction of component models has enabled component based developers to plug components together much more easily than in the past, it is still difficult to get them to play well together.


buy online viagra
drugs like viagra
buy pfizer viagra
3.99 cialis order
viagra mail order
giant viagra pill
best cialis price
cheap cialis site
half price viagra
cheap cialis find
best cheap viagra
cheap deal viagra
viagra uk kamagra
3.98 order viagra
viagra online buy
cialis discounted
cheap drug viagra
viagra on line uk
viagra kamagra uk
viagra like pills
viagra cheap less
levitra overnight
cialis drug 20 mg
viagra cheap sale
cialis best price
viagra pharmacies
best price cialis
viagra free order
viagra party drug
about viagra pill
buy viagra online
cheap viagra pill
viagra drug risks
viagra drug store
viagra pill color
buy 100 mg viagra
generic cialis uk
mail order cialis
discounted viagra
cheap soft viagra
cheap site viagra
viagra other uses
buy viagra viagra
generic cialis rx
pill price viagra
maid order viagra
cheap pill viagra
cheap viagra 25mg
generic uk viagra
viagra free pills
online buy viagra
cialis buy online
prices cialis 120
buy viagra cialis
viagra generic uk
buy viagra canada
generic viagra rx
viagra zenegra uk
cialis cheap visa
uk generic viagra
cialis buy cialis
cheap sale viagra
canada buy cialis
viagra drug class
a viagra discount
pharmacies viagra
best price viagra
buy viagra london
mail order viagra
canada in levitra
viagra free trial
cialis and canada
levitra pill size
uk viagra kamagra
buy levitra cheap
cialis generic rx
1buy cheap cialis
cialis pill color
low price levitra
levitra drug test
levitra diet pill
buy cialis online
order site viagra
buy levitra in uk
online levitra us
cialis pills chat
cialis free trial
cialis free trail
1 low cost cialis
cialis pill photo
viagra buy viagra
buy cialis omline
71 rx levitra 102
kamagra uk viagra
cialis order site
viagra sales 2004
natural viagra uk
cialis online buy
cialis mail order
viagra sale cheap
cialis uk chemist
buy female viagra
order 50mg viagra
very cheap cialis
cialis line order
buy cialis viagra
kamagra viagra uk
buy herbal viagra
viagra best price
very cheap viagra
lost cost levitra
viagra buy online
viagra type drugs
levitra in canada
cialis generic uk
cialis pills free
buy levitra where
viagra tablets uk
cialis pills tips
order viagra here
rx viagra
us viagra
viagra rx
cialis uk
cialis us
uk cialis
uk viagra
viagra us
viagra uk
cialis rx
rx levitra
levitra uk
cialis buy
uk levitra
buy viagra
us levitra
buy cialis
viagra buy
viagra sale
sale viagra
levitra buy
viagra uses
sale cialis
viagra free
viagra drug
pill viagra
drug viagra
viagra pill
buy levitra
drug cialis
cialis cost
cost viagra
cialis drug
cialis sale
cialis pill
cialis free
viagra cost
cialis uses
cialis order
cialis sales
buy n viagra
cialis no rx
viagra sales
in uk viagra
viagra price
cialis in uk
levitra drug
buy 1 cialis
cialis price
cialis pills
levitra sale
levitra pill
viagra uk 32
order cialis
buy p viagra
levitra free
levitra cost
buy viagra 1
sale levitra
cialis costs
viagra cheap
drug levitra
cialis cheap
sales cialis
cheap viagra
viagra drugs
sales viagra
viagra in uk
cialis drugs
cost levitra
viagra costs
viagra pills
pills cialis
pills viagra
cheap cialis
price viagra
price cialis
order viagra
viagra order
no rx viagra
buy uk viagra
buy viagra 32
buy viagra uk
to buy viagra
cialis canada
2 free viagra
cialis europe
viagra canada
levitra order
cheap levitra
price levitra
canada cialis
levitra price
prices viagra
europe cialis
re buy viagra
viagra for uk
canada viagra
prices cialis
levitra sales
online cialis
levitra pills
viagra europe
viagra prices
otc uk viagra
cialis to buy
buy cialis uk
buy cialis re
levitra drugs
cialis uk buy
cialis orders
viagra uk buy
cialis online
viagra to buy
buy cialis we
levitra cheap
viagra buy it
6 free viagra
cialis prices
1 drug cialis
buy online viagra
drugs like viagra
buy pfizer viagra
3.99 cialis order
viagra mail order
giant viagra pill
best cialis price
cheap cialis site
half price viagra
cheap cialis find
best cheap viagra
cheap deal viagra
viagra uk kamagra
3.98 order viagra
viagra online buy
cialis discounted
cheap drug viagra
viagra on line uk
viagra kamagra uk
viagra like pills
viagra cheap less
levitra overnight
cialis drug 20 mg
viagra cheap sale
cialis best price
viagra pharmacies
best price cialis
viagra free order
viagra party drug
about viagra pill
buy viagra online
cheap viagra pill
viagra drug risks
viagra drug store
viagra pill color
buy 100 mg viagra
generic cialis uk
mail order cialis
discounted viagra
cheap soft viagra
cheap site viagra
viagra other uses
buy viagra viagra
generic cialis rx
pill price viagra
maid order viagra
cheap pill viagra
cheap viagra 25mg
generic uk viagra
viagra free pills
online buy viagra
cialis buy online
prices cialis 120
buy viagra cialis
viagra generic uk
buy viagra canada
generic viagra rx
viagra zenegra uk
cialis cheap visa
uk generic viagra
cialis buy cialis
cheap sale viagra
canada buy cialis
viagra drug class
a viagra discount
pharmacies viagra
best price viagra
buy viagra london
mail order viagra
canada in levitra
viagra free trial
cialis and canada
levitra pill size
uk viagra kamagra
buy levitra cheap
cialis generic rx
1buy cheap cialis
cialis pill color
low price levitra
levitra drug test
levitra diet pill
buy cialis online
order site viagra
buy levitra in uk
online levitra us
cialis pills chat
cialis free trial
cialis free trail
1 low cost cialis
cialis pill photo
viagra buy viagra
buy cialis omline
71 rx levitra 102
kamagra uk viagra
cialis order site
viagra sales 2004
natural viagra uk
cialis online buy
cialis mail order
viagra sale cheap
cialis uk chemist
buy female viagra
order 50mg viagra
very cheap cialis
cialis line order
buy cialis viagra
kamagra viagra uk
buy herbal viagra
viagra best price
very cheap viagra
lost cost levitra
viagra buy online
viagra type drugs
levitra in canada
cialis generic uk
cialis pills free
buy levitra where
viagra tablets uk
cialis pills tips
order viagra here

18/3/2009

Èçèñêâàíèÿ è àðõèòåêòóðà

Filed under: Computers — Izida @ 10:33 am

Until now, however, architectural design has been discussed in the light that, if you know the requirements for a system, you can build the architecture for it. This is short-sighted and fails to tell the whole story. What do you suppose would happen if two different architects, working in two different organizations, were given the same requirements specification for a system? Do you think they would produce the same architecture or different ones?
The answer is that, in general, they would produce different ones, which immediately belies the notion that requirements determine architecture. Other factors are at work, and to fail to recognize them is to continue working in the dark.

“Software Architecture in Practice, Second Edition”, àâòîðè Len Bass, Paul Clements, Rick Kazman, èçäàòåëñòâî Addison Wesley.

27/1/2009

Âèçóàëèçàöèÿ íà àëãîðèòìè çà ñîðòèðàíå

Filed under: Computers — Izida @ 3:15 pm

Ïîëåçíà âèçóàëèçàöèÿ íà òîâà êàê ðàáîòÿò ðàçëè÷íè àëãîðèòìè çà ñîðòèðàíå – ïðèëîæåíè êàêòî íà “ñëó÷àéíî” ðàçáúðêàíè, òàêà è íà ïîäðåäåíè ðåäèöè :

http://www.sorting-algorithms.com/

Ïîäîáåí ïîäõîä çà äåìîíñòðàöèÿ áÿõ âèäÿëà â êíèãàòà íà Ðîáúðò Ñåäæóèê “Àëãîðèòìè íà C” (èäàíèå íà ÑîôòÏðåñ) – êîåòî òî÷íî áå è ïðè÷èíàòà äà ñå ñäîáèÿ ñ èçäàíèåòî.

26/12/2008

Ïúçåë ñ êàðòè

Filed under: Computers — Izida @ 1:35 am

Èìàòå ÷åòèðè êàðòè :

B 5 2 J

Âñÿêà êàðòà èìà áóêâà îò åäíàòà ñè ñòðàíà è öèôðà îò äðóãàòà. Êîè êàðòè òðÿáâà äà îáúðíåòå çà äà ïðîâåðèòå äàëè å èçïúëíåíî ïðàâèëîòî, ÷å àêî èìàòå J îò åäíàòà ñòðàíà, òî îò äðóãàòà èìàòå 5?

10/11/2008

SQL fun

Filed under: Computers,Humor — Izida @ 4:44 pm

A SQL query goes to a restaurant, walks up to 2 tables and says “Can I join you”?

29/10/2008

Íåðàçáðàíèÿò JavaScript

Filed under: Computers — Izida @ 4:57 pm

Àêî ñìÿòàòå, ÷å ëåñíîòàòà, ñ êîÿòî ñå ïèøå íà JavaScript, å äîñòàòú÷åí ïîêàçàòåë çà òîâà äà ãî íàðå÷åì ãëóïàâ è àìàòüîðñêè åçèê çà ïðîãðàìèðàíå, òî ïîãëåäíåòå ñëåäíàòà ñòàòèÿ íà Douglas Crockford :

“JavaScript: The World’s Most Misunderstood Programming Language”

Èìà è îòëè÷íè ñòàòèè íà òåìà íàñëåäÿâàíå è ñêðèâàíå íà èíôîðìàöèÿòà â JS:

ÏÈÁ ñ îáíîâåíî åëåêòðîííî áàíêèðàíå

Filed under: Computers — Izida @ 12:48 pm

Îò ïîñò â áëîãà íà Ïúðâà èíâåñòèöèîííà áàíêà íàó÷èõ, ÷å îò 31âè òîçè ìåñåö ùå å äîñòúïíà îñúâðåìåíåíàòà âåðñèÿ íà åëåêòðîííîòî èì áàíêèðàíå. Íàèñòèíà ìè å ëþáîïèòíî äà âèäÿ êàê ñà ðàçâèëè ñèñòåìàòà ñëåä ìíîæåñòâîòî ïðåïîðúêèòå è çàáåëåæêèòå íà êëèåíòè.

24/10/2008

Ñòàðàíèå

Filed under: Books,Computers — Izida @ 10:46 am

I could list all of the qualities that I notice in clean code, but there is one overarching quality that leads to all of them. Clean code always looks like it was written by someone who cares. There is nothing obvious that you can do to make it better. All of those things were thought about by the code’s author, and if you try to imagine improvements, you’re led back to where you are, sitting in appreciation of the code someone left for you—code left by someone who cares deeply about the craft.

Michael Feathers, àâòîð íà Working Effectively with Legacy Code

Äà, ïðèÿòíî å äà âèäèø ïàð÷å êîä, çà êîåòî äà ñè êàæåø : “Òóê íàèñòèíà íÿìà êàêâî äà ñå ïîäîáðè!”. È äà ñè ïðåäñòàâèø êàê ÷îâåêúò íå ïðîñòî å íàïèñàë íåùî, êîåòî ðàáîòè, à è å âëîæèë ãðèæà è ñòàðàíèå äà ãî ïîäîáðè äî ñòåïåíòà, êîÿòî å ïðåä òåá. Òîâà ó ìåí ñúáóæäà ÷óâñòâî íà óâàæåíèå êúì àâòîðà. È âúïðîñà : Äàëè è àç áèõ ãî äîâåëà äî òîçè âèä?

Ìíåíèÿ íà äðóãè ñïåöèàëèñòè (Stroustrup, Booch è äð.) : “InformIT > What Is Clean Code? By Robert C. Martin”

6/10/2008

Øàáëîíèòå è äåòàéëèòå

Filed under: Computers — Izida @ 10:08 pm

The architect Christopher Alexander – father of patterns and pattern language … views the craftsmanship of fine structure to be the sole purview of the architect; the larger forms can be left to patterns and their application by the inhabitants.

James O. Coplien

Êàçàíî èíà÷å – àðõèòåêòúò Êðèñòîôúð Àëåêñàíäúð, áàùàòà íà øàáëîíèòå çà äèçàéí, ñìÿòà, ÷å ðîëÿòà íà àðõèòåêòà å äà “èçïèïà” äåòàéëèòå. Ñàìèòå øàáëîíè ìîæå è êëèåíòà äà ñè ãè ïîäáåðå!

Èçòî÷íèê : Clean Code Foreword.

1/10/2008

Internet Explorer îãðàíè÷àâà áðîÿ CSSè çà åäíà ñòðàíèöà

Filed under: Computers — Izida @ 2:35 pm

Ñáëúñêàõ ñå ñúñ ñëåäíèÿ ïðîáëåì : âðúçêàòà êúì âúíøåí ôàéë ñ êàñêàäíè ñòèëîâå ïðèñúñòâà â ãëàâàòà íà HTML äîêóìåíòà â IE, ñàìî äåòî êîìïîíåíòà íà ñòðàíèöàòà, çà êîéòî ñå îòíàñÿøå, ñè ñåäåøå áåç íèêàêúâ ñòèë. Âúâ Firefox ñòðàíèöàòà èçãëåæäà íîðìàëíî.

Òàêà íàó÷èõ, ÷å Internet Explorer íàëàãà îãðàíè÷åíèå çà ìàêñèìàëíèÿ áðîé âðúçêè êúì âúíøíè ñòèëîâå, ñúùî òàêà è êúì âãðàäåíè ñòèëîâå çà âñÿêà ñòðàíèöà. Ñòàòèÿòà â MSDN : “All style tags after the first 30 style tags on an HTML page are not applied in Internet Explorer”, ïîëåçíà äèñêóñèÿ íà ñàéòà íà Drupal : “Drupal >> Issues >>IE: Stylesheets ignored after 30 link/style tags”.

Ñåãà îáà÷å óñòàíîâèõ, ÷å è MSDN íå êàçâà èñòèíàòà – âñúùíîñò ñòèëîâåòå, êîèòî ñå ïðèëàãàò, íå ñà 30, à 31! Ïðîáëåìúò ñå ïðîÿâÿâà àêî ñå îïèòàø äà âêëþ÷èø 32-ðè ïî ðåä ñòèë.

 ïðèìåðà íà MSDN ñå äîáàâÿò ñòèëîâå ñúñ ñëåäíèÿ JavaScript êîä :
for (i=0 ; i < 31; i++) { document.createStyleSheet() StyleSheetCount.innerText = "Total Style Sheets = " + i }

Âèæäà ñå, ÷å çàïî÷âàò öèêúëà îò 0, è çà áðîéêà îòïå÷àòâàò íå áðîéêàòà, à èíäåêñà íà ïîñëåäíèÿ åëåìåíò.

Ëú÷î ïðåäïîëîæè, ÷å ÷èñëîòî 31 èäâà îò ôàêòà, ÷å íàé-âåðîÿòíî ñòèëîâåòå ñà 32 (åäíî âå÷å ìíîãî êðúãëî è êðàñèâî îò ïðîãðàìèñòêà ãëåäíà òî÷êà ÷èñëî), íî åäèíèÿò å çàïàçåí çà "âãðàäåíèÿ" â IE áàçîâ HTML ñòèë. È âñå ïàê íå ðàçáèðàì - çàùî àêî äîáàâÿø ñòèë ñ JavaScript òè äàâà ãðåøêà (íèùî, ÷å å íàïúëíî íåèíôîðìàòèâíà - "Error: Invalid argument."), à àêî ïðîñòî èìàø äåêëàðèðàíè âðúçêè êúì âúíøíè ñòèëîâå òåçè íàä 31âàòà ïðîñòî ñå èãíîðèðàò áåç ïðåäóïðåæäåíèå?!

Ñåãà ìå ãîíè ïàðàíîÿòà è ïåðèîäè÷íî ïîäñêà÷àì ñ âúïðîñà : "À äàëè Internet Explorer íå íàëàãà è îãðàíè÷åíèå çà. ...?"

15/9/2008

StackOverflow

Filed under: Computers — Izida @ 3:04 pm

Îò äíåøíèÿ áþëåòèí íà Joel Spolsky íàó÷èõ çà íîâ ïðîåêò, êîéòî ñåãà ñòàðòèðà â ñâîÿ áåòà ïóáëè÷åí âàðèàíò :

Stack Îverflow

Êàêòî êàçâà êîëîíêàòà íà ãëàâíàòà ñòðàíèöà, òîâà å ñàéò çà âúïðîñè îò è çà ïðîãðàìèñòè. Ïîçâîëÿâà äàâàíå íà îöåíêè íà äîáðèòå/ëîøèòå îòãîâîðè è ïî òî÷è íà÷èí ãè èçäèãà/ñâàëÿ â êëàñàöèÿòà, êàêòî è äà ñå äàâàò îöåíêè íà èíòåðåñíèòå âúïðîñè. Äîðè íå å íóæíà ðåãèñòðàöèÿ, ïîëçâà ñå OpenID.

Ò.å. íåùî êàòî Experts-exchange.com, íî áåçïëàòíî.

Ùå âèäèì êàê ùå ïîòðúãíå! Àç çà ñåãà ñìÿòàì äà ñëåäÿ RSS-à íà íîâèòå òåìè.

12/9/2008

Ìàòåìàòè÷åñêà ïî÷åðïêà

Filed under: Computers,Daily,Humor — Izida @ 10:52 am

So if a mathematician says, “You may have cake or your may have ice cream”, then you could have both.

Êàçàíî èíà÷å, âíèìàâàéòå ïðè ïîñòðîÿâàíåòî íà ìàòåìàòè÷åñêè òâúðäåíèÿ îò òâúðäåíèÿ íà åñòåñòâåí åçèê.

Àêî èñêàòå äà ñè ïðèïîìíèòå äèñêðåòíàòà ìàòåìàòèêà, òóê èìà íÿêîè èíòåðåñíè ãëàâè îò íåÿ : MIT > Mathematics for Computer Science. Èçîáùî ïðîåêòà MIT OpenCourseWare å ìÿñòî, êîåòî ñè ñòðóâà äà ïîñåòèø. Îñâåí ëåêöèè, çàïèñêè è çàäà÷è ñ ðåøåíèÿòà èì, íÿêîè îò êóðñîâåòå ñà ïðåäñòàâåíè è â àóäèî è/èëè âèäåî ôîðìàò. Ïðèìåð : “Introduction to Algorithms”.

6/7/2008

Ñâîáîäåí äîñòúï äî Äúðæàâåí âåñòíèê

Filed under: Computers,Ãðàæäàíñêè — Izida @ 5:06 pm

Îùå åäíà äîáðà íîâèíà íàó÷èõ äíåñ – òîçè ïúò îò áëîãà íà Ìàðòèí Äèìèòðîâ.

À èìåííî : Îò 1âè þëè, Äúðæàâåí âåñòíèê âå÷å å äîñòúïåí â Èíòåðíåò îò ñòðàíèöàòà íà Ïàðëàìåíòà!

Îùå ñè ñïîìíÿì èçóìëåíèåòî ìè êîãàòî ïðåäè ãîäèíà-äâå èñêàõ äà âèäÿ îáíàðîäâàí åäíî èçìåíåíèå íà çàêîí è óñòàíîâèõ, ÷å èìàì äîñòúï ñàìî äî ñïèñúêà ñ ïóáëèêóâàíè çàêîíè âúâ âåñòíèêà, íî íå è äî ñàìîòî ìó ñúäúðæàíèå. Èçâåñòíî âðåìå ñå áîðåõ äà íàìåðÿ íà ñàéòà íóæíàòà èíôîðìàöèÿ, ñìÿòàéêè, ÷å ïðîñòî íÿìà êàê äà íå å ïóáëèêóâàíà. Òà íàëè íèå êàòî äàíúêîïëàòöè ïëàùàìå çà çàêîíîòâîð÷åñêàòà äåéíîñò íà Ïàðëàìåíòà – áè òðÿáâàëî äà èìàìå äîñòúï äî ðåçóëòàòèòå îò òðóäà èì. Ò.å. äà ñå èíôîðìèðàìå êàêâè ñà çàêîíèòå íàïúëíî áåçïëàòíî. Äî êîëêîòî å áåçïëàòíî íà ôîíà íà ïëàòåíèòå äàíúöè äå.

Ï.Ñ. favicon-à íà ñàéòà íà Ïàðëàìåíòà å … åìáëåìàòà íà ñúðâëåò êîíòåéíåðà Tomcat 😉

18/6/2008

Ïúðâè âïå÷àòëåíèÿ îò Firefox 3.0

Filed under: Computers — Izida @ 11:33 pm

Òðÿáâà äà ïðèçíàÿ – äîâîëíà ñúì! Ïîäñêàçêèòå ïðè ïèñàíåòî â ïîëåòî çà àäðåñ ñà ìè ìíîãî ïîëåçíè è âå÷å ïðèâèêíàõ ñ òÿõ êàòî ÷å ëè ñúì ãè ïîëçâàëà âèíàãè. Îñâåí òîâà âå÷å ÷àñ è íåùî àêòèâíî ñúðôèðàíå è ÷åòåíå íà ðàçíè pdf äîêóìåíòè îíëàéí, à çàåòàòà ïàìåò íå ñå êà÷è íàä 70 ìá! Ìíîãî äîáðå! Çà Firefox 2.0 ìè ïðàâåøå âïå÷àòëåíèå, ÷å çàòâîðåíèòå òàáîâå íå îñâîáîæäàâàò ïàìåò – ÿâíî ñ öåë äà ìîæåø ïî-ëåñíî äà âúçñòàíîâèø çàòâîðåí òàá ïðè íóæäà. Íà ìåí òîâà ìè áåøå äîñòà ïîëåçíî – ÷åñòî ìè ñå ñëó÷âàøå äà êëèêíà ïî ãðåøêà íà õ-÷åòî. Íî âñå ïàê êàòî ãëåäàø êàê ïàìåòòà ñàìî ðàñòå íå òè ñòàâà íèêàê äîáðå. Èíòåðåñíî ìè å êàê ñà ðåøèëè ïðîáëåìà òóê.

Äðóãî – ïðè FF 2 ñòàðòèðàíåòî íà ïðîöåñà íà ñâàëÿíå íà ôàéë âîäåøå äî âðåìåííî çàâèñâàíå íà ïðèëîæåíèåòî. Ïðè íîâàòà âåðñèÿ òàêîâà íå óñåùàì.

È èçîáùî öÿëîñòíîòî ìè âïå÷àòëåíèå äî ìîìåíòà å, ÷å å ïî-áúðç è ùàäÿò ïàìåòòà îò ïðåäíàòà âåðñèÿ. Êîåòî ìå ðàäâà! Çàùîòî ñëåä åäèíèöàòà, äâîéêàòà ìè ñå ñòðóâàøå êàòî åäíà ãîäçèëà – ïðåêàëåíî òåæêà çà ìîåòî ëàïòîï÷å. Äîðè íàïîñëåäúê ñå óëàâÿõ äà ïîëçâàì IE ïîíåæå âúðâåøå ïî-ëåêî, à äà ïóñêàì FF ñàìî ïðè íóæäà îò ïîëçâàíå íà Firebux äîáàâêàòà. Ìèñëÿ, ÷å IE îòíîâî ìèíàâà íà äîñòà ïî-çàäåí ïëàí, îò êîëêîòî áåøå. È îñòàâà ñàìî çà åëåêòðîííî áàíêèðàíå.

Next Page »