在Excel 2007中,我在VBA中有以下非常简单的代码:
Public Type specType
sb As Long
End Type
Private Sub MyButton_Click()
Dim spec As specType
'...
End Sub
Run Code Online (Sandbox Code Playgroud)
单击该按钮时,我在"Dim spec As SpecType"行中得到"用户定义的类型未定义"错误...为什么?我是否必须将用户定义的类型移动到特殊位置?
我需要处理和保存原始bpp中的图像(1 - 对于BnW,8 - 对于灰色,24 - 颜色).处理后我总是有24bpp(由于使用Aforge.Net处理).我将原始bpp传递给保存功能,我正在使用下一个代码进行保存:
private static Bitmap changePixelFormat(Bitmap input, PixelFormat format)
{
Bitmap retval = new Bitmap(input.Width, input.Height, format);
retval.SetResolution(input.HorizontalResolution, input.VerticalResolution);
Graphics g = Graphics.FromImage(retval);
g.DrawImage(input, 0, 0);
g.Dispose();
return retval;
}
Run Code Online (Sandbox Code Playgroud)
当我通过时:
PixelFormat.Format8bppIndexed
Run Code Online (Sandbox Code Playgroud)
我得到一个例外:"图形对象无法在索引像素格式中创建图像":
Graphics g = Graphics.FromImage(retval);
Run Code Online (Sandbox Code Playgroud)
我已经尝试了下一个代码:
Bitmap s = new Bitmap("gray.jpg");
Bitmap NewPicture = s.Clone(new Rectangle(0, 0, s.Width, s.Height), PixelFormat.Format8bppIndexed);
Run Code Online (Sandbox Code Playgroud)
在此"NewImage"之后有PixelFormat 8bppIndexed,但是当我保存NewImage时:
NewPicture.Save("hello.jpg", ImageFormat.Jpeg);
Run Code Online (Sandbox Code Playgroud)
hello.jpg有24bpp.
我需要保留原始图像的bpp和图像格式.
为什么Bitmap.Save会忽略Bitmap的PixelFormat?
================================================== =====
谢谢大家,我找到了一个解决方案:http: //freeimage.sourceforge.net/license.html
借助这个免费库,可以将图像(尤其是JPEG)保存到8位灰度级.
好的我正在将我的开发环境从笔记本电脑移到我的桌面.
我在两台机器上都有完全相同的项目,但是当我尝试通过桌面上的eclipse运行maven的更新依赖项时,只是抱怨每个依赖项都"缺少人工制品"!
我已经检查了桌面上的本地仓库,果然,没有罐子!?所有的pom都在那里,但没有罐子!
我回到了笔记本电脑,从那台机器上的本地仓库中的罐子里删除了,并再次调用了更新依赖项并且爆炸,罐子下载很好,但桌面似乎无法下载任何罐子?
这两款机器都是一样的网络/路由器,所以它不可能是硬件防火墙/代理,但有一些蚀设置或Windows防火墙设置,我完全忘记了上?
最后,我一直在删除桌面上的repo并在项目中使用mvn -up clean install,我注意到它下载了PLUGIN jar就好了,但后来继续只下载任何和所有依赖的poms!?
我的settings.xml如下(建议的repos的mashup类型);
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0http://maven.apache.org/xsd/settings-1.0.0.xsd">
<pluginGroups></pluginGroups>
<proxies></proxies>
<servers></servers>
<mirrors></mirrors>
<profiles>
<profile>
<id>standard-extra-repos</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>net.java.download</id>
<url>http://download.java.net/maven/2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>org.apache</id>
<url>http://maven.apache.org/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>org.codehaus.mojo</id>
<url>http://mojo.codehaus.org/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>com.jboss.repository</id>
<url>http://repository.jboss.com/maven2</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>com.springsource.repository.bundles.release
</id>
<name>SpringSource Enterprise Bundle Repository -
SpringSource Bundle Releases</name>
<url>http://repository.springsource.com/maven/bundles/release
</url>
<releases> …Run Code Online (Sandbox Code Playgroud) 我在登台服务器上的集合中有500,000个文档,我需要将这些文档移动到生产服务器.
移动此数据的最佳方法是什么,我可以让mongodb将其从分段复制到生产,移动数据文件还是导出并重新导入?
新的SQLalchemy,这是我的问题:
我的模型是:
user_group_association_table = Table('user_group_association', Base.metadata,
Column('user_id', Integer, ForeignKey('user.id')),
Column('group_id', Integer, ForeignKey('group.id'))
)
department_group_association_table = Table('department_group_association', Base.metadata,
Column('department', Integer, ForeignKey('department.id')),
Column('group_id', Integer, ForeignKey('group.id'))
)
class Department(Base):
__tablename__ = 'department'
id = Column(Integer, primary_key=True)
name = Column(String(50))
class Group(Base):
__tablename__ = 'group'
id = Column(Integer, primary_key=True)
name = Column(String)
users = relationship("User", secondary=user_group_association_table, backref="groups")
departments = relationship("Department", secondary=department_group_association_table, backref="groups")
class User(Base):
__tablename__ = 'user'
id = Column(Integer, primary_key=True)
firstname = Column(String(50))
surname = Column(String(50))
Run Code Online (Sandbox Code Playgroud)
因此,此代码反映了以下关系:
-------- --------- --------------
| User | …Run Code Online (Sandbox Code Playgroud) 发生异常时,会显示强制关闭和等待的警告对话框.我们可以把它重定向到另一个页面,通过跟踪异常,没有表现出接近这种力量.因为foece后关闭该应用程序会关闭.我们怎样才能阻止.
jQuery的:如何启用timeout的$.ajax({dataType:'jsonp'...?有什么解决方案吗?http://jsfiddle.net/laukstein/2wcpU/4
$.ajax({
type:"GET",
url:'http://lab.laukstein.com/ajax-seo/.json',
dataType:'jsonp',
timeout:200, // Not working with dataType:'jsonp'
success:function(data){$('#content').html(data.content);},
error:function(request,status,error){$('#content').html('request failed');}
});
Run Code Online (Sandbox Code Playgroud)
我不喜欢使用一些插件,比如http://code.google.com/p/jquery-jsonp.
我是一名C#程序员,不幸的是由于年龄和经验,我没有机会在我的学习中有机会完成编程的C++时代 - 这对我来说是多么神秘和新鲜.这里并没有真正讨论学习这种与否的重要性,但我需要一些应该是一件小事的帮助.
我需要帮助将我的C++代码打包成.dll.我没有与C++的经验和我有困难的大量制造工作.dll文件,我可以P /从(调用Visual Studio 2010中).请继续阅读以获取更多详细信息以及我要打包的代码.
我有一些代码需要在非托管环境中运行.在正常情况下,简单的p/invoke适用于此任务.连线一些[ImportDll],你很高兴.最糟糕的情况我有时可以使用编组.然而,由于我还没有真正发现的原因,我目前的任务似乎不可能.
我试图从一个owner drawn list box旧的非托管C++应用程序中读取一些数据,并从中获取文本.我已经看到了几个如何执行此操作的示例 - 但它们是旧的VB6代码.
我发现了C++等价物,但这对我来说也不合适.即使使用p/invoke,内存移动以及它需要如何操作似乎也有很多麻烦.这个过程非常简单.
我需要创建一个简单的C++ .dll来运行我在非托管代码中需要的方法,并用结果填充变量.
虽然这听起来很蠢,但我不知道该怎么做.我试过在Visual Studio中运行简单的C++向导(使用Visual Studio 2010),我只是没有运气.我希望有人可以帮助我解决这个问题,也许可以解释发生了什么,这样我就可以从中学习.
这是我需要放入的代码.dll.
意图是hListWnd作为一个IntPtrC#传递,index将是一个简单的Int32,outputResult并将进入任何必要的使这项工作.在其他p/invoke情况下,我已经看到了这一点System.Text.StringBuilder,但我愿意使用任何东西来使这项工作正确.
void GetListItemData( HWND hListWnd, long index, char *outputResult )
{
int result;
DWORD processID;
HANDLE hProcess;
char *itemData;
char sDataRead[5];
DWORD bytes;
DWORD lListItemHold, lListItemDataHold;
*outputResult=0;
if( hListWnd )
{ …Run Code Online (Sandbox Code Playgroud) 我似乎无法让appendTo工作.我做错了什么?
$('div:nth-child(2n) img').appendTo(parent);
Run Code Online (Sandbox Code Playgroud)
当前加价:
<div class="container">
<img src="123.jpg" />
<p>Hey</p>
</div>
<div class="container">
<img src="123.jpg" />
<p>Hey</p>
</div>
Run Code Online (Sandbox Code Playgroud)
我想要这个输出:
<div class="container">
<p>Hey</p>
<img src="123.jpg" />
</div>
<div class="container">
<p>Hey</p>
<img src="123.jpg" />
</div>
Run Code Online (Sandbox Code Playgroud)
请帮帮我们......我每分钟都在撕扯我的头发..: - S