If you put the aif code presented in onlisp in a package and try to use it in another you run in the problem that packagename:it is not external.
(in-package :packagename)
(defmacro aif (test-form then-form &optional else-form)
‘(let ((it ,test-form))
(if it ,then-form ,else-form)))
wanted call syntax
(in-package :otherpackage)
(aif (do-stuff)
(FORMAT t "~a~%" it)
(FORMAT t "just got nil~%"))
How can I fix this behavior in code, without making the variable it external in the package declaration and beeing able toaccess it just by it instead of packagename:it?
Hi,
I have read some comments in some forums saying that Linux programmers usually do not use any IDE. They prefer to use Vim and Emacs to do their programming.
If I'm not mistaken, Vim and Emacs are just text editors, similar to notepad, but with syntax highlighting.
I just want to know how Linux programmers create complicated GUI application without using any IDE.
Thanks.
I'm trying to use a convention to map UInt32 properties to a SQL Server 2008 database. I don't seem to be able tocreate a solution based on existing web sources, due to updates in the way Fluent NHibernate works - i.e. examples are out of date.
I'm trying to have NHibernate generate the schema (via ExposeConfiguration). I'm happy to have NHibernate map it to anything sensible (e.g. bigint).
Here's my code as it currently stands (which, when I try to expose the schema, fails due to SQL Server not supporting UInt32). Apologies for the code being a little long, but I'm not 100% sure what is relevant to the problem, so I'm erring on the side of caution. Most of it is based on this post.
The error reported is:
System.ArgumentException : Dialect does not support DbType.UInt32
I think I'll need a relatively comprehensive example, as I don't seem to be able to pull the pieces together into a working solution, at present.
FluentConfiguration configuration =
Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(connectionString))
.Mappings(mapping =>
mapping.AutoMappings.Add(
AutoMap.AssemblyOf<Product>()
.Conventions.Add<UInt32UserTypeConvention>()));
configuration.ExposeConfiguration(x => new SchemaExport(x).Create(false, true));
namespace NHibernateTest
{
public class UInt32UserTypeConvention : UserTypeConvention<UInt32UserType>
{
// Empty.
}
}
namespace NHibernateTest
{
public class UInt32UserType : IUserType
{
// Public properties.
public bool IsMutable
{
get
{
return false;
}
}
public Type ReturnedType
{
get
{
return typeof(UInt32);
}
}
public SqlType[] SqlTypes
{
get
{
return
new SqlType[]
{
SqlTypeFactory.Int32
};
}
}
// Public methods.
public object Assemble(object cached, object owner)
{
return cached;
}
public object DeepCopy(object value)
{
return value;
}
public object Disassemble(object value)
{
return value;
}
public new bool Equals(object x, object y)
{
return (x != null && x.Equals(y));
}
public int GetHashCode(object x)
{
return x.GetHashCode();
}
public object NullSafeGet(IDataReader rs, string[] names, object owner)
{
int? i = (int?)NHibernateUtil.Int32.NullSafeGet(rs, names[0]);
return (UInt32?)i;
}
public void NullSafeSet(IDbCommand cmd, object value, int index)
{
UInt32? u = (UInt32?)value;
int? i = (Int32?)u;
NHibernateUtil.Int32.NullSafeSet(cmd, i, index);
}
public object Replace(object original, object target, object owner)
{
return original;
}
}
}
I would like to use Python's tempfile module tocreate a temporary file that I will use for communication between processes (use of pipes is awkward).
The documentation I've linked to above shows two functions that almost do what I want:
tempfile.NamedTemporaryFile # For creating named tempfiles
tempfile.SpooledTemporaryFile # For creating tempfiles in memory
but actually I want a tempfile that is both named AND in memory. Any ideas?
Given an enum like this:
public enum City {
London = 1,
Liverpool = 20,
Leeds = 25
}
public enum House {
OneFloor = 1,
TwoFloors = 2
}
I am using the following code to give me an IEnumerable:
City[] values = (City[])Enum.GetValues(typeof(City));
var valuesWithNames = from value in values
select new { value = (int)value, name = value.ToString() };
The code works very good however I have to do this for quite a lot of enums. Is there a way I could create a generic way of doing this?
Is it possible in jax-ws to have a webmethod that creates a new object (of a service class)
and returns a reference to it to the client caller (for the client, it's a remote reference)
so that the client and this new service object maintain a session?
(Therefore each client is served by a different instance).
Schematically:
client server o:Session
-------- -------- ----------
s = server.access() ------------------>
o = new Session()
return o
<---
o.doSomething() ---------------------------------------------->
make it
<---
o.doMore() -------------------------------------------------->
make it
<---
Hello.
I have a form that accepts image file, i want to be able to convert this image from any common format to jpg and tocreate a thumbnail. what's the recommended method to achieve such a thing?
Working with latest apache-tomcat on a gentoo linux server.
thanks
I have a Sprint MiFi 3G router that exposes its current signal strength over HTTP. I've developed a very simple tray application that displays this. However, what I would really like to do is create a custom network connection entry so the router's 3G signal strength (along with the current network version) displays when clicking on the network connections tray icon (in Windows 7, at least).
Is it possible to do this with a shell extension or something (preferably in C#)? If so, how?
Hi! I'm wondering howto add
onblur="hcb.watermark.blur(event)" onfocus="hcb.watermark.focus(event)" style="color: rgb(136, 136, 136);
to the following textarea without having direct accessto it:
<textarea rows="4" id="HCB_textarea" name="content" class="commentbox hcb-shadow-r" onkeypress="hcb.delta(event)"/>
Could some additional JS do the job?
I am binding a Foreign key property in my model. I am passing a list of possible values for that property in my model. The model looks something like this:
public class UserModel
{
public bool Email { get; set; }
public bool Name { get; set; }
public RoleModel Role { get; set; }
public IList<RoleModel> Roles { get; set; }
}
public class RoleModel
{
public string RoleName
{
get;
set;
}
}
This is what I have in the controller:
public ActionResult Create()
{
IList<RoleModel> roles = RoleModel.FromArray(_userService.GetAllRoles());
UserModel model = new UserModel()
{
Roles = roles
};
return View(model);
}
In the view I have:
<div class="editor-label">
<%= Html.LabelFor(model => model.Role) %>
</div>
<div class="editor-field">
<%= Html.DropDownListFor(model => model.Role, new SelectList(Model.Roles, "RoleName", "RoleName", Model.Role))%>
<%= Html.ValidationMessageFor(model => model.Role)%>
</div>
What do I need to do to get the list of roles back to my controller to pass it again to the view when validation fails. This is what I need:
[HttpPost]
public ActionResult Create(UserModel model)
{
if (ModelState.IsValid)
{
// insert logic here
}
//the validation fails so I pass the model again to the view for user to update data but model.Roles is null :(
return View(model);
}
As written in the comments above I need to pass the model with the list of roles again to my view but model.Roles is null. Currently I ask the service again for the roles (model.Roles = RoleModel.FromArray(_userService.GetAllRoles());) but I don't want to add an extra overhead of getting the list from DB when I have already done that..
Anyone knows howto do it?
Is there a way toaccess the widgets generated by INPUT and SELECT on a page in WebKit, using Qt?
On a related note, does WebKit provide these widgets, or does it delegate back to Qt to generate them?
I have a method (in 3rd-party library) with BigInteger parameter:
public void setValue (BigInteger value) { ... }
I don't need 'all its power', I only need to work with integers. So, how can I pass integers to this method? My solution is to get string value from int value and then create BigInteger from string:
int i = 123;
setValue (new BigInteger ("" + i));
Are there any other (recommended) ways to do that?
Just wondering if it is possible toaccess the Mac OS X Address Book API's from pure Java 6 code? I want to keep this completely platform independent as my program is built for Windows & Linux also (open source & free: http://jsmsirl.sourceforge.net/).
Any help is much appreciated!
I was reading that question (http://stackoverflow.com/questions/226784/how-to-create-a-simple-proxy-in-c) that is near of my wishes.
I simply want develop a c# app that, by example, monitors Firefox, IE, etc and logs all navigated pages. Depending of the visited page, I want to block the site (like a parental filter).
Code snippets/samples are good, but if you can just tell me some direction of that classes to use I will be grateful. :-)
I need tocreatean installer for my software for Windows XP and newer. Is there any mechanism to do that on a Linux machine alone? (I'm running ubuntu, but I'd guess is not a show stopper).
Hi! I am newbie in English, sorry :)
Howtocreate something like Expander control in WPF using only WinAPI (ATL/WTL)? Are some experince avaliable?
Thank for answers!
how can i create a matrix with repeat another matrix?
for example:
a=[1 2 3;4 5 6;7 8 9];size of a is 3*3;
for b repeat
final matrix=[a a ...];size of final matrix is 3*3b
please help me
my id is [email protected]
Can anyone guide me as tohowtocreate a table using Objective C for Mac OS X. The program should read values from an NSArray object and display the values in the table. I would appreciate it if anyone helped me out.
I am involved in a contest, and in one event we have debugging questions. I have to design some really good debugging problems in C and C++.
How can I create some good problems on debugging? What aspects should I consider while designing the problems?
I'm using webrick (the built-in ruby webserver) to serve .rhtml
files (html with ruby code embedded --like jsp).
It works fine, but I can't figure out howtoaccess parameters
(e.g. http://localhost/mypage.html?foo=bar)
from within the ruby code in the .rhtml file.
(Note that I'm not using the rails framework, only webrick + .rhtml files)
Thanks
Is there a possibility tocreate any python object that will be not sortable? So that will be an exception when trying to sort a list of that objects?
I created a very simple class, didn't define any comparison methods, but still instances of this class are comparable and thus sortable. Maybe, my class inherits comparison methods from somewhere. But I don't want this behaviour.
Hi
I am using Bugzilla and I was wondering if there is a way tocreate a ticket by sending an email toan account.
I looked around and I found that at some point there was a contrib/bug_email.pl, (that I think it did this) but its not there anymore on version 3.6 .
Thanks
Most examples of creating remote branches involve pushing from a local branch
Is there a way of creating an empty remote branch without pushing?
Is it also possible tocreate a local empty branch,check it out then link it to the new also empty remote branch without pushing?