on-internet

How to change size of split screen emacs windows?

I have emacs split horizontally - on top I'm editing Perl code, the bottom is the shell. By default emacs makes the two windows equal in size, but I'd like the shell buffer smaller (maybe half the size?). I was wondering how I could do that.

Join the discussion →

Is there a Python equivalent of the C# null-coalescing operator?

In C# there's a null-coalescing operator (written as ??) that allows for easy (short) null checking during assignment: string s = null; var other = s ?? "some default value"; Is there a python equivalent? I know that I can do: s = None other = s if s else "some default value" But is there an even shorter way (where I don't need to repeat s)?

Join the discussion →

mysql via subprocess doesn't work

import os import subprocess cmdline = ['mysql -u"username" -p"password" < query.sql'] p = subprocess.Popen(cmdline,stdout=subprocess.PIPE) stdout,stderr = p.communicate() retcode = p.wait() That's my code to connect to mysql and execute query.sql. Looks good to me, but it doesn't work and the bad thing is that I don't get any error message at all. retcode is 1 and from stdout, stderr I only get the mysql standard text "Usage mysql [OPTIONS] [Database] ..." so I thought my syntax is wrong. But it's not. I tested the line of code in terminal and it works. Does python have a problem to execute th

Join the discussion →

Center Fancybox within Iframe to the Parent's center

I've searched on here but it seems there was no question like this before. I have an iframe in a page. On the iframe, there is fancybox popup. But fancybox centers itself based on the iframe dimension, not the parent dimension. Can i make the fancybox to center by the parent's dimension? And click the "Click me" link, and the fancybox will be centered on the center of the iframe document..

Join the discussion →

Adding Dynamic Field to Forms (Chronoform)

I am using the popular ChoronoForm plugin for Joomla. I have created a form which contain dynamic fields. A javascript function is used to add multiple "items". A User clicks on the button "Add another item" and the item field is redisplayed for them to insert additional "items". Similar to the form on this website http://www.unclesmoney.co.uk/home3.php (Fill in the Item Details Section and click on "add another item"). When the form is submited the information is sent via email. The problem, only the item that was inserted last is sent and other itens are ignored (not sent) e.g. if I fill out

Join the discussion →

Kinect pattern recognition [closed]

I bought a Kinect to play around with on my PC in C#. (And what fun it is to program!) I'm using CLNUIDevice.dll to get the depth image from Kinect. This works fine and I'm able to read the depth through the RGB values in the image. Now I'm wondering what libraries there are to do different types of recognition. I've seen hand recognition, face recognition, skeleton, emotions, objects, etc. The image processing libraries don't have to be for Kinect (though that would be nice) and they don't have to be for .Net (though that would be nice). For instance: Any object tracking lib will work, but if

Join the discussion →

Python PIL: How to draw an ellipse in the middle of an image?

I seem to be having some trouble getting this code to work: import Image, ImageDraw im = Image.open("1.jpg") draw = ImageDraw.Draw(im) draw.ellipse((60, 60, 40, 40), fill=128) del draw im.save('output.png') im.show() This should draw an ellipse at (60,60) which is 40 by 40 pixels. The image returns nothing. This code works fine however: draw.ellipse ((0,0,40,40), fill=128) It just seems that when i change the first 2 co-ords (for where the ellipse should be placed) it won't work if they are larger than the size of the ellipse to be drawn. For example: draw.ellipse ((5,5,15,15), fill=128) Works

Join the discussion →

Git - how do I view the change history of a method/function?

So I found the question about how to view the change history of a file, but the change history of this particular file is huge and I'm really only interested in the changes of a particular method. So would it be possible to see the change history for just that particular method? I know this would require git to analyze the code and that the analysis would be different for different languages, but method/function declarations look very similar in most languages, so I thought maybe someone has implemented this feature. The language I'm currently working with is Objective-C and the SCM I'm curren

Join the discussion →

Undefined property error when calling CodeIgniter library by camelCase name while class is defined in PascalCase

I have a problem that I can't load my library in my controller. I got this error: Message: Undefined property: Profil::$profileWall My library: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class ProfileWall { private $CI; public function __construct() { $this->CI =& get_instance(); } public function wallShow() { $this->CI->load->model('profil_model'); return $this->CI->profil_model->wallGet($this->CI->uri->segment(3)); } } and my controller function index() { $this->load->model('profil_model'); $data['query'] = $this->profil_model->vis_profil($this->uri->segment(3

Join the discussion →

How to set a directory in PKG_CONFIG_PATH variable in ubuntu

I want to add a directory containing a .pc file, to the PKG_CONFIG_PATH variable, that is required for a certain program to run on Ubuntu. I tried to find out a solution from google but it didn't really work. I am pasting the log here. Please help. tasbeer@tasbeer-desktop:~/Android/pocketsphinx/swig$ make cc -g -Wall -DPIC -fPIC -I/usr/lib/jvm/default-java/include `pkg-config --cflags sphinxbase pocketsphinx` -c -o pocketsphinx_wrap.o pocketsphinx_wrap.c **Package sphinxbase was not found in the pkg-config search path. Perhaps you should add the directory containing `sphinxbase.pc' to the PKG_

Join the discussion →

Could not open Hibernate Session for transaction

I am getting this error. please help me. org.springframework.transaction.CannotCreateTransactionException: Could not open Hibernate Session for transaction; nested exception is org.hibernate.exception.GenericJDBCException: Cannot open connection org.springframework.orm.hibernate3.HibernateTransactionManager.doBegin(HibernateTransactionManager.java:599) org.springframework.transaction.support.AbstractPlatformTransactionManager.getTransaction(AbstractPlatformTransactionManager.java:374) org.springframework.transaction.interceptor.TransactionAspectSupport.createTransactionIfNecessary(TransactionA

Join the discussion →

Multiple markers with labels in Google Maps

I'd like to implement multiple markers with labels (documented here: http://google-maps-utility-library-v3.googlecode.com/svn/tags/markerwithlabel/1.0.1/docs/examples.html) and I'm having some problems with writing the code. For 2 markers for example you'd have to use the following code: var latlng1 = new google.maps.LatLng(49, -123); var latlng2 = new google.maps.LatLng(48, -123); var marker1 = new MarkerWithLabel({ position: latlng1, draggable: true, map: map, labelContent: "abcd", labelAnchor: new google.maps.Point(22, 0), labelClass: "labels", labelStyle: {opacity: 0.75} }); var marker2 =

Join the discussion →

How to deploy SNAPSHOT with sources and JavaDoc?

I want to deploy sources and javadocs with my snapshots. This means that I want to automize the following command: mvn clean source:jar javadoc:jar deploy Just to execute: mvn clean deploy I don't want to have javadoc/sources generation executed during the install phase (i.e. local builds). I know that source/javadoc plugins can be synchronized with the execution of the release plugin but I can't figure out how to wire it to the snapshots releases.

Join the discussion →

PHP: Assign null if not set

Is there a sort of assign-if-not-empty-otherwise-assign-null function in PHP? I'm looking for a cleaner alternative to the following: $variable = (!empty($item)) ? $item : NULL; It would also be handy if I could specify the default value; for instance, sometimes I'd like ' ' instead of NULL. I could write my own function, but is there a native solution? It should be noted that I'm trying to avoid a notice for undefined values.

Join the discussion →

language without if's?

A colleague said he heard of a language that did not have the concept of "if". Is that possible? If so, what language is it?

Join the discussion →

Javascript eval on global scope?

Is it possible to use the eval command to execute something with a global scope? For example, this will cause an error: <script> function execute(x){ eval(x); } function start(){ execute("var ary = new Array()"); execute("ary.push('test');"); // This will cause exception: ary is not defined } </script> <html><body onLoad="start()"></body></html> I know the 'with' keyword will set a specific scope, but is there a keyword for the global scope? Or is it possible to define a custom scope that would allow this to work? <script> var scope = {}; function execute(x){ with(scope){ eval(x); } } function

Join the discussion →

Set element width or height in Standards Mode

Is it possible to set width or height of HTML element (ex. <div>) in JavaScript in Standards Mode? Note the following code: <html> <script language="javascript" type="text/javascript"> function changeWidth(){ var e1 = document.getElementById("e1"); e1.style.width = 400; } </script> <body> <input type="button" value="change width" onclick="changeWidth()"/> <div id="e1" style="width:20px;height:20px; background-color:#096"></div> </body> </html> When user presses the change width button, the <div>'s width should change. It works fine when doctype declaration determines Quirks Mode. In Standards

Join the discussion →

One code certificate per deployment, or only one and sign them all with it

I have a number of different projects, which are maturing to the level that I will be buying code signing certificates for them. My understanding of a code-signing certificate is that it is meant to establish a trust relationship between my userbase, and the developer (me). To that end, it would make sense to buy one code-signing certificate and sign all my projects with the same certificate. However, I also am aware that another function of the code signing certificate is to encrypt parts of the deployment to ensure that the product is not tampered with prior to the userbase installing it. It

Join the discussion →

add existing pdfs to fpdf

Is there any function that I could call in order to include an existing pdf in my fpdf file? For example $pdf->AddPage(from file example.pdf); something like that? is it posible?

Join the discussion →

How to print a string with a little delay between the chars?

I want a text to be displayed as if it is just being typed. So I need a little delay after every letter. I tried to do it this way: import time text = "Hello, this is a test text to see if all works fine." for char in text: print char,time.sleep(0.2), It works fine, except for one problem. I get a "None" after every character. This is the output: H None e None l None l None o None , None None t None h None i None s None None i None s None None a None None t None e None s None t None None t None e None x None t None None t None o None None s None e None e None None i None f None None a None l N

Join the discussion →

Nesting CSS selectors

Can I nest CSS selectors (specifically classes in my case)? Something like the following: .class1{some stuff} .class2{class1;some more stuff}

Join the discussion →

How to perform string concatenation in JavaScript?

I want to concatenate two strings in JavaScript i.e. $('#bio').css('color', result.titlecolor); I want to put the character “#” before the result.titlecolor i.e. $('#bio').css('color', '#' result.titlecolor); Is this right or wrong?

Join the discussion →

High-level server library for sharing data over network

I'd like to implement something similar to Etherpad - an online collaboration program. Do you know of a library for the server that takes care of incoming connections, manages a user list and distributes structured data between them? DRb is near to what I want, but as I understand it, but as I understand it, it repeatedly sends the whole object over the network, making it quite slow. It should only send updates. Ruby would be perfect, but I don't really care.

Join the discussion →

Count, size, length...too many choices in Ruby?

I can't seem to find a definitive answer on this and I want to make sure I understand this to the "n'th level" :-) a = { "a" => "Hello", "b" => "World" } a.count # 2 a.size # 2 a.length # 2 a = [ 10, 20 ] a.count # 2 a.size # 2 a.length # 2 So which to use? If I want to know if a has more than one element then it doesn't seem to matter but I want to make sure I understand the real difference. This applies to arrays too. I get the same results. Also, I realize that count/size/length have different meanings with ActiveRecord. I'm mostly interested in pure Ruby (1.92) right now but if anyone want

Join the discussion →

iReport - java.lang.ClassNotFoundException

Im using iReport 3.7.6. I have a Parameter with following parameter class: at.gv.domain.print.impl.ParameterClass. For using that class I did following: --> Extras --> Option --> Classpath --> Add Folder --> C:\Development\Projectname\workspace\DomainProject\target\classes Under C:\Development\Projectname\workspace\DomainProject\target\classes\at\gv\domain\print\impl there are my ParameterClass.class. Now if I wanna compile the .jrxml I get following error: net.sf.jasperreports.engine.design.JRValidationException: Report design not valid : 1. java.lang.ClassNotFoundException: at.gv.domain.prin

Join the discussion →

How to add a Web Part Zone to a SharePoint wiki page?

I have a team site. I understand that the default home page of a team site is a wiki page. I want to add a web part zone to this page. How can I do that? By default it already has Web Part Zone -. You can use SharePoint designer to add a web part to this zone and it works fine. But you are not able to add a web part to this zone using SharePoint web UI? Ususally when you have a web part zone in a page, using SharePoint web UI, it allows to you add/remove a web part. But it is not the case with the web part zone on the default home page of a team site. Also is there any way I can add a web part

Join the discussion →
Older stories