What I\’m Learning

November 20, 2009

Skype Problem

Filed under: General — Tags: , , , — plusplus @ 5:12 am

Today I wanted to call using Skype, but it kept telling me that “Call to …, No Answer”. Actually, it didn’t even try to call anyone, but would give me that message. The other point that I noticed was that there was no sound coming out (like the sign in sound that Skype plays after signing in).

I Googled the problem and this sites helped me: http://share.skype.com/sites/garage/2009/03/problem_with_the_latest_skype.html, http://geek.starbean.net/?p=268

There was a problem with sound settings of Skype, reinstalling Skype solved my problem, but there should be an easier, not faster, way of solving the problem.

 

Reza

November 19, 2009

YAGo has problems with MySQL

Filed under: Programming — Tags: , , , , — plusplus @ 9:39 am

I decided to work with YAGO (A huge semantic knowledge base) on my MySQL DBMS. So, I used it’s javatools to import it to my MySQL and today (Nov. 18th, 2009), after 6 days that MySQL was indexing the data, when we contacted the authors, they told us that YAGO has problems with MySQL, because of indexing values longer than 256. So, they suggested that we use PostGre.

Here is the log of my 6 days:

Creating indices on facts…
  The following indexes will be created:
CREATE INDEX factsidIndex ON facts (id)
CREATE INDEX factsarg1Index ON facts (arg1)
CREATE INDEX factsarg2Index ON facts (arg2)
CREATE INDEX factsrelationIndex ON facts (relation)
CREATE INDEX factsrelationarg1Index ON facts (relation, arg1)
CREATE INDEX factsrelationarg2Index ON facts (relation, arg2)
CREATE INDEX factsarg1arg2Index ON facts (arg1, arg2)
  On some systems, this fails. In these cases, please interrupt and create the indexes manually.
CREATE INDEX factsidIndex ON facts (id)… done (42 min, 30 s)
CREATE INDEX factsarg1Index ON facts (arg1)… done (9 h, 16 min)
CREATE INDEX factsarg2Index ON facts (arg2)… done (18 h, 5 min)
CREATE INDEX factsrelationIndex ON facts (relation)… done (19 h, 20 min)
CREATE INDEX factsrelationarg1Index ON facts (relation, arg1)… done (40 h, 19 min)
CREATE INDEX factsrelationarg2Index ON facts (relation, arg2)… done (57 h, 22 min)
CREATE INDEX factsarg1arg2Index ON facts (arg1, arg2)…

Reza++

November 18, 2009

Finding Median with PostgreSql

Filed under: Database — Tags: , , , , — plusplus @ 10:18 pm

This is how you can get the median value of a column in PostgreSql. Thanks to http://old.nabble.com/SELECT-TOP–d-PERCENT,-or-SELECT-…-LIMIT–d-PERCENT—td19941366.html

 

WITH c AS (select count(*)/2 as n from FOO) select COL from FOO order by COL asc limit (1) offset (select n from c);

 

It is much simpler if you are using SQL Server as described in: http://www.sqlmag.com/Article/ArticleID/49827/sql_server_49827.html

SELECT MAX(Value) FROM
  (SELECT TOP 50 PERCENT Value FROM dbo.VOrders ORDER BY Value) AS H1;

--
Reza++

SubQuery

Filed under: Database — Tags: , , , — plusplus @ 3:23 am

You can only do correlate subqueries in SELECT and WHERE clauses.

So, a subquery in FROM clause does not have access to the outer select.

select 	"Damage" , "IdAttackerWeapon" as w,
	(select sum(dd)
	from
		(select "Damage", "IdAttackerWeapon", abs(("Damage" - t."Damage")) as dd
		from fact_eventplayerdamage order by dd asc limit 5)
	t1)
from fact_eventplayerdamage t
group by "Damage", w

Reza

October 12, 2007

Putting Icons Beside Your Hyperlinks

Filed under: Programming, Web — plusplus @ 12:22 pm

Want to put icons next to your hyper links?

a href="files/holidays.pdf">View Holidays</a>
a[href $='.pdf'] {
padding-right: 18px;
background: transparent url(icon_pdf.gif) no-repeat center right;
}

This means: a link whose href attribute will end with ‘.pdf’. It’s nice.

You can use $ as ends with, ^ for starts with and some more. Look here for more information and samples.
It’s fantastic. :X


REZA++

October 11, 2007

Light Box

Filed under: Programming, Web — plusplus @ 8:49 pm

A cool library for your pictures: Light Box

REZA++

September 29, 2007

Templates and multiple-file projects

Filed under: C/C++/C# - .NET, Programming — plusplus @ 10:12 am

I’ve had forgotten this note. Thanks www.cplusplus.com

Because templates are compiled when required, this forces a restriction for multi-file projects: the implementation (definition) of a template class or function must be in the same file as its declaration. That means that we cannot separate the interface in a separate header file, and that we must include both interface and implementation in any file that uses the templates.

Since no code is generated until a template is instantiated when required, compilers are prepared to allow the inclusion more than once of the same template file with both declarations and definitions in a project without generating linkage errors.

REZA++

July 29, 2007

Reading a line from a UTF-8 file

Filed under: Java, Programming — plusplus @ 7:57 pm

Although it’s simple, but you may forget it:

BufferedReader bf = new BufferedReader(

                    new InputStreamReader(

                    new FileInputStream("test"), "UTF-8")

                    );
String line = bf.readLine();

REZA++

July 27, 2007

Some Firefox Extensions

Filed under: Firefox, Programming — plusplus @ 10:39 am

2 extensions I cannot live without:

And today, I found YSlow on YAHOO’s developers page. Wish this one to be as good as the above. I think I really want one of these.

REZA++

Processing command line arguments in Java

Filed under: Java, Programming — plusplus @ 10:30 am

I found it today: CLI. This is a part of Jakarta’s Commons project.

You can also find some good ideas HERE .

REZA++

Older Posts »

Blog at WordPress.com.