Search Results

Search found 30 results on 2 pages for 'alchemy'.

Page 1/2 | 1 2  | Next Page >

  • using 'ar' tool in Alchemy

    - by paleozogt
    I've found that if you specify a path to Alchemy's 'ar' tool, it won't create the 'l.bc' file necessary to link the library. For example, here is the case when I don't specify a path (it works): asimmons-mac:test asimmons$ echo 'int main() { return 42; }' > testmain.cpp asimmons-mac:test asimmons$ echo 'int test1() { return -1; }' > test1.cpp asimmons-mac:test asimmons$ echo 'int test2() { return 1; }' > test2.cpp asimmons-mac:test asimmons$ g++ -c testmain.cpp asimmons-mac:test asimmons$ g++ -c test1.cpp asimmons-mac:test asimmons$ g++ -c test2.cpp asimmons-mac:test asimmons$ ar cr libtest.a test1.o test2.o asimmons-mac:test asimmons$ g++ testmain.cpp libtest.a llvm-ld, "-o=".(98237.achacks.o = "98237.achacks.exe"), -disable-opt -internalize-public-api-list=_start,malloc,free,__adddi3,__anddi3,__ashldi3,__ashrdi3,__cmpdi2,__divdi3,__fixdfdi,__fixsfdi,__fixunsdfdi,__fixunssfdi,__floatdidf,__floatdisf,__floatunsdidf,__iordi3,__lshldi3,__lshrdi3,__moddi3,__muldi3,__negdi2,__one_cmpldi2,__qdivrem,__adddi3,__anddi3,__ashldi3,__ashrdi3,__cmpdi2,__divdi3,__qdivrem,__fixdfdi,__fixsfdi,__fixunsdfdi,__fixunssfdi,__floatdidf,__floatdisf,__floatunsdidf,__iordi3,__lshldi3,__lshrdi3,__moddi3,__muldi3,__negdi2,__one_cmpldi2,__subdi3,__ucmpdi2,__udivdi3,__umoddi3,__xordi3,__subdi3,__ucmpdi2,__udivdi3,__umoddi3,__xordi3,__error /Users/asimmons/Development/alchemy-darwin-v0.5a/avm2-libc/lib/avm2-libc.l.bc /Users/asimmons/Development/alchemy-darwin-v0.5a/avm2-libc/lib/avm2-libstdc++.l.bc, test.l.bc 98237.achacks.o 98237.achacks.swf, 5593510 bytes written asimmons-mac:test asimmons$ ls -l total 10992 -rwxr-xr-x 1 asimmons staff 5593575 Apr 9 17:44 a.exe -rw------- 1 asimmons staff 1284 Apr 9 17:43 libtest.a -rw-r--r-- 1 asimmons staff 672 Apr 9 17:43 test.l.bc -rw-r--r-- 1 asimmons staff 27 Apr 9 17:43 test1.cpp -rwxr-xr-x 1 asimmons staff 536 Apr 9 17:43 test1.o -rw-r--r-- 1 asimmons staff 26 Apr 9 17:43 test2.cpp -rwxr-xr-x 1 asimmons staff 536 Apr 9 17:43 test2.o -rw-r--r-- 1 asimmons staff 26 Apr 9 17:43 testmain.cpp -rwxr-xr-x 1 asimmons staff 552 Apr 9 17:43 testmain.o asimmons-mac:test asimmons$ And here is an example where I do specify a path (it doesn't work). I try to tell 'ar' to put the library under 'lib' and then link to lib/libtest.a: asimmons-mac:test asimmons$ mkdir lib asimmons-mac:test asimmons$ echo 'int main() { return 42; }' > testmain.cpp asimmons-mac:test asimmons$ echo 'int test1() { return -1; }' > test1.cpp asimmons-mac:test asimmons$ echo 'int test2() { return 1; }' > test2.cpp asimmons-mac:test asimmons$ g++ -c testmain.cpp asimmons-mac:test asimmons$ g++ -c test1.cpp asimmons-mac:test asimmons$ g++ -c test2.cpp asimmons-mac:test asimmons$ ar cr lib/libtest.a test1.o test2.o asimmons-mac:test asimmons$ g++ testmain.cpp lib/libtest.a llvm-ld, "-o=".(98638.achacks.o = "98638.achacks.exe"), -disable-opt -internalize-public-api-list=_start,malloc,free,__adddi3,__anddi3,__ashldi3,__ashrdi3,__cmpdi2,__divdi3,__fixdfdi,__fixsfdi,__fixunsdfdi,__fixunssfdi,__floatdidf,__floatdisf,__floatunsdidf,__iordi3,__lshldi3,__lshrdi3,__moddi3,__muldi3,__negdi2,__one_cmpldi2,__qdivrem,__adddi3,__anddi3,__ashldi3,__ashrdi3,__cmpdi2,__divdi3,__qdivrem,__fixdfdi,__fixsfdi,__fixunsdfdi,__fixunssfdi,__floatdidf,__floatdisf,__floatunsdidf,__iordi3,__lshldi3,__lshrdi3,__moddi3,__muldi3,__negdi2,__one_cmpldi2,__subdi3,__ucmpdi2,__udivdi3,__umoddi3,__xordi3,__subdi3,__ucmpdi2,__udivdi3,__umoddi3,__xordi3,__error /Users/asimmons/Development/alchemy-darwin-v0.5a/avm2-libc/lib/avm2-libc.l.bc /Users/asimmons/Development/alchemy-darwin-v0.5a/avm2-libc/lib/avm2-libstdc++.l.bc, lib/test.l.bc 98638.achacks.o llvm-ld: error: Cannot find linker input 'lib/test.l.bc' asimmons-mac:test asimmons$ ls -l total 56 -rw-r--r-- 1 asimmons staff 552 Apr 9 17:46 98638.achacks.o drwxr-xr-x 3 asimmons staff 102 Apr 9 17:46 lib -rw-r--r-- 1 asimmons staff 27 Apr 9 17:45 test1.cpp -rwxr-xr-x 1 asimmons staff 536 Apr 9 17:46 test1.o -rw-r--r-- 1 asimmons staff 26 Apr 9 17:45 test2.cpp -rwxr-xr-x 1 asimmons staff 536 Apr 9 17:46 test2.o -rw-r--r-- 1 asimmons staff 26 Apr 9 17:45 testmain.cpp -rwxr-xr-x 1 asimmons staff 552 Apr 9 17:45 testmain.o asimmons-mac:test asimmons$ ls -l lib/ total 8 -rw------- 1 asimmons staff 1284 Apr 9 17:46 libtest.a asimmons-mac:test asimmons$ but the linker errors out because it can't find lib/test.l.bc. Notice how in the first example, 'test.l.bc' was generated alongside libtest.a. But in the second example test.l.bc was not generated. Where did it go? This is a contrived example, but in the project I'm trying to build with alchemy the make scripts generate libraries in full paths and then refer to them that way. It seems that alchemy's 'ar' tool is broken if you try to generate a library anywhere other than '.'. Has anyone else seen this? Is there a workaround? fyi, I've also posted this question on the Alchemy formus.

    Read the article

  • crash when linking swc with Alchemy

    - by paleozogt
    I have a project I'm trying to compile with alchemy. It will compile .o and .a files, but when trying to create a .swc, it will fail. It appears to crash with this error: g++ -swc -o mylib.swc my-flex-interface.cpp mylib.a Cannot yet select: 0x279c810: ch,flag = AVM2ISD::CALL - A call instruction 0x279c7a0, 0x29c4350 0 llc 0x00636dfe _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 6078 1 llc 0x006373a2 _ZNSt8_Rb_treeIN4llvm3sys4PathES2_St9_IdentityIS2_ESt4lessIS2_ESaIS2_EE13insert_uniqueERKS2_ + 7522 2 libSystem.B.dylib 0x9530942b _sigtramp + 43 3 ??? 0xffffffff 0x0 + 4294967295 4 libSystem.B.dylib 0x953968e5 raise + 26 5 libSystem.B.dylib 0x953ac99c abort + 93 6 llc 0x002f4fe0 _ZN98_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Target_AVM2_AVM2ISelDAGToDAG.cpp_00000000_F04616B616AVM2DAGToDAGISel6Emit_7ERKN4llvm9SDOperandEj + 0 7 llc 0x002f8e1b _ZN98_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Target_AVM2_AVM2ISelDAGToDAG.cpp_00000000_F04616B616AVM2DAGToDAGISel10SelectCodeEN4llvm9SDOperandE + 2219 8 llc 0x002fa193 _ZN98_GLOBAL__N__Volumes_data_dev_FlaCC_llvm_2.1_lib_Target_AVM2_AVM2ISelDAGToDAG.cpp_00000000_F04616B616AVM2DAGToDAGISel10SelectRootEN4llvm9SDOperandE + 819 9 llc 0x002e6a2c _ZN4llvm19X86_64TargetMachineD0Ev + 65116 10 llc 0x003de4ca _ZN4llvm11StoreSDNodeD1Ev + 1610 11 llc 0x0040d3fe _ZN4llvm11StoreSDNodeD1Ev + 193918 12 llc 0x0040f92e _ZN4llvm11StoreSDNodeD1Ev + 203438 13 llc 0x005d1926 _ZN4llvm12FunctionPassD1Ev + 20998 14 llc 0x005d1f3a _ZN4llvm12FunctionPassD1Ev + 22554 15 llc 0x005d20c5 _ZN4llvm12FunctionPassD1Ev + 22949 16 llc 0x00002e44 0x0 + 11844 17 llc 0x00001f36 0x0 + 7990 18 ??? 0x00000006 0x0 + 6 make[2]: *** [src/app/alchemy/sonic.swc] Error 6 make[1]: *** [src/app/alchemy/CMakeFiles/alchemy.dir/all] Error 2 make: *** [all] Error 2 I'm not familiar enough with LLVM (which Alchemy uses under the hood) to figure out what this error means. Any ideas?

    Read the article

  • xml parsing in adobe alchemy

    - by cbs
    hello can you prvide an example how to parse xml file in adobe alchemy. im trying to work on expat, however i got no luck on passing of bytearrays to and from the c code. do i need to pass the byte array of file to the alchemy, or is it enough to pass the filename. thanks. cbs

    Read the article

  • Using SQL Alchemy and pyodbc with IronPython 2.6.1

    - by beargle
    I'm using IronPython and the clr module to retrieve SQL Server information via SMO. I'd like to retrieve/store this data in a SQL Server database using SQL Alchemy, but am having some trouble loading the pyodbc module. Here's the setup: IronPython 2.6.1 (installed at D:\Program Files\IronPython) CPython 2.6.5 (installed at D:\Python26) SQL Alchemy 0.6.1 (installed at D:\Python26\Lib\site-packages\sqlalchemy) pyodbc 2.1.7 (installed at D:\Python26\Lib\site-packages) I have these entries in the IronPython site.py to import CPython standard and third-party libraries: # Add CPython standard libs and DLLs import sys sys.path.append(r"D:\Python26\Lib") sys.path.append(r"D:\Python26\DLLs") sys.path.append(r"D:\Python26\lib-tk") sys.path.append(r"D:\Python26") # Add CPython third-party libs sys.path.append(r"D:\Python26\Lib\site-packages") # sqlite3 sys.path.append(r"D:\Python26\Lib\sqlite3") # Add SQL Server SMO sys.path.append(r"D:\Program Files\Microsoft SQL Server\100\SDK\Assemblies") import clr clr.AddReferenceToFile('Microsoft.SqlServer.Smo.dll') clr.AddReferenceToFile('Microsoft.SqlServer.SqlEnum.dll') clr.AddReferenceToFile('Microsoft.SqlServer.ConnectionInfo.dll') SQL Alchemy imports OK in IronPython, put I receive this error message when trying to connect to SQL Server: IronPython 2.6.1 (2.6.10920.0) on .NET 2.0.50727.3607 Type "help", "copyright", "credits" or "license" for more information. >>> import sqlalchemy >>> e = sqlalchemy.MetaData("mssql://") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "D:\Python26\Lib\site-packages\sqlalchemy\schema.py", line 1780, in __init__ File "D:\Python26\Lib\site-packages\sqlalchemy\schema.py", line 1828, in _bind_to File "D:\Python26\Lib\site-packages\sqlalchemy\engine\__init__.py", line 241, in create_engine File "D:\Python26\Lib\site-packages\sqlalchemy\engine\strategies.py", line 60, in create File "D:\Python26\Lib\site-packages\sqlalchemy\connectors\pyodbc.py", line 29, in dbapi ImportError: No module named pyodbc This code works just fine in CPython, but it looks like the pyodbc module isn't accessible from IronPython. Any suggestions? I realize that this may not be the best way to approach the problem, so I'm open to tackling this a different way. Just wanted to get some experience with using SQL Alchemy and pyodbc.

    Read the article

  • SQL Alchemy MVC and cross controller joins

    - by Khorkrak
    When using SQL Alchemy for abstracting your data access layer and using controllers as the way to access objects from that abstraction layer, how should joins be handled? So for example, say you have an Orders controller class that manages Order objects such that it provides getOrder, saveOrder, etc methods and likewise a similar controller for User objects. First of all do you even need these controllers? Should you instead just treat SQL Alchemy as "the" thing for handling data access. Why bother with object oriented controller stuff there when you instead have a clean declarative way to obtain and persist objects without having to write SQL directly either. Well one reason could be that perhaps you may want to replace SQL Alchemy with direct SQL or Storm or whatever else. So having controller classes there to act as an intermediate layer helps limit what would need to change then. Anyway - back to the main question - so assuming you have these two controllers, now lets say you want the list of orders for a certain set of users meeting some criteria. How do you go about doing this? Generally you don't want the controllers crossing domains - the Orders controllers knows only about Orders and the User controller just about Users - they don't mess with each other. You also don't want to go fetch all the Users that match and then feed a big list of user ids to the Orders controller to go find the matching Orders. What's needed is a join. Here's where I'm stuck - that seems to mean either the controllers must cross domains or perhaps they should be done away with altogether and you simply do the join via SQL Alchemy directly and get the resulting User and / or Order objects as needed. Thoughts?

    Read the article

  • SQL Alchemy: Relationship with grandson

    - by giomasce
    I'm building a SQL Alchemy structure with three different levels of objects; for example, consider a simple database to store information about some blogs: there are some Blog object, some Post object and some Comment objects. Each Post belongs to a Blog and each Comment belongs to a Post. Using backref I can automatically have the list of all Posts belonging to a Blog and similarly for Comments. I drafted a skeleton for such a structure. What I would like to do now is to have directly in Blog an array of all the Comments belonging to that Blog. I've tried a few approaches, but they don't work or even make SQL Alchemy cry in ways I can't fix. I'd think that mine is quite a frequent need, but I couldn't find anything helpful. Colud someone suggest me how to do that? Thanks.

    Read the article

  • Alchemy like game for the web, open source. Any ideas for element combinations?

    - by JohnDel
    I created a web game like the Android game Alchemy. It's open source and in the back-end you can create your own elements / your own game. I was wondering what elements - ideas would be good to implement as a prototype / demo? Some ideas are: Colors Programming languages Chemical Compounds Same as the original alchemy Evolution of biological organisms What do you think? Any specific combination ideas?

    Read the article

  • Eventlet or gevent or Stackless + Twisted, Pylons, Django and SQL Alchemy

    - by Khorkrak
    We're using Twisted extensively for apps requiring a great deal of asynchronous io. There are some cases where stuff is cpu bound instead and for that we spawn a pool of processes to do the work and have a system for managing these across multiple servers as well - all done in Twisted. Works great. The problem is that it's hard to bring new team members up to speed. Writing asynchronous code in Twisted requires a near vertical learning curve. It's as if humans just don't think that way naturally. We're considering a mixed approach perhaps. Maybe do the xmlrpc server part and process management in Twisted still but the other stuff in code that at least looks synchronous while not being as such. Then again I like explicit over implicit so hmmm. Anyway onto greenlets - how well does that stuff work? So there's Stackless and as you can see from my Gallentean avatar I'm well aware of the tremendous success in it's use for CCP's flagship EVE Online game first hand. What about Eventlet or gevent? Well for now only Eventlet works with Twisted. However gevent claims to be faster since it's not a pure python implementation it instead uses libevent. It also has fewer idiosyncrasies and defects supposedly. The documentation there is minimal in comparison to Eventlet and it's maintained by 1 guy as far as I can tell. This makes me leery but all great projects start this way so... Then there's PyPy - I haven't even finished reading about that one yet - just saw it in this thread: Drawbacks of Stackless. So confusing - I'm wondering what the heck to do - sounds like Eventlet is probably the best bet but is it really stable enough? Anyone out there have any experience with it? Should we go with Stackless instead as it's been around and is proven technology - just like Twisted is as well - and they do work together nicely. But still I hate having to have a separate version of Python to do this. what to do.... This somewhat obnoxious blog entry hit the nail on the head for me though: Asynchronous IO for Grownups We're stuck using MySQL as well - I never knew how great PostgreSQL was until having had to work on a production OLTP system in MySQL instead - but that's another story. But if that monkey patch thing really works then wow. Just wow.

    Read the article

  • SQL Alchemy related Objects Error

    - by alex
    from sqlalchemy.orm import relation, backref from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey, Date, Sequence from sqlalchemy.ext.declarative import declarative_base Base = declarative_base() class GUI_SCENARIO(Base): __tablename__ = 'GUI_SCENARIO' Scenario_ID = Column(Integer, primary_key=True) Definition_Date = Column(Date) guiScenarioDefinition = relation('GUI_SCENARIO_DEFINITION', order_by='GUI_SCENARIO_DEFINITION.Scenario_Definition_ID', backref='guiScenario') def __init__(self, Scenario_ID=None, Definition_Date=None): self.Scenario_ID = Scenario_ID self.Definition_Date = Definition_Date class GUI_SCENARIO_DEFINITION(Base): __tablename__='GUI_SCENARIO_DEFINITION' Scenario_Definition_ID = Column(Integer, Sequence('Scenario_Definition_ID_SEQ'), primary_key=True) Scenario_FK = Column(Integer, ForeignKey('GUI_SCENARIO.Scenario_ID')) Definition_Date=Column(Date) guiScenario = relation(GUI_SCENARIO, backref=backref('guiScenarioDefinition', order_by=Scenario_Definition_ID)) def __init__(self, Scenario_FK, Definition_Date): self.Scenario_FK = Scenario_FK self.Definition_Date = Definition_Date guiScenario = relation(GUI_SCENARIO, backref=backref('guiScenarioDefinition', order_by=Scenario_Definition_ID)) tableNameScenario = "GUI_SCENARIO" scenarioClass = getattr(MappingTablesScenario, tableNameScenario) tableScenario = Table(tableNameScenario, meta, autoload=True) mapper(scenarioClass, tableScenario) scenarioName = scenarioDefinition.name scenarioDefinitionDate = datetime.today() newScenario = MappingTablesScenario.GUI_SCENARIO(scenarioName, scenarioDefinitionDate) print newScenario.guiScenarioDefinition If I try to get the objects related to a scenarioObject, I always get this error: AttributeError: 'GUI_SCENARIO' object has no attribute 'guiScenarioDefinition' Does anyone know, why I get this error?

    Read the article

  • How can I load a sql "dump" file into sql alchemy

    - by JudoWill
    I have a large sql dump file ... with multiple CREATE TABLE and INSERT INTO statements. Is there any way to load these all into a SQLAlchemy sqlite database at once. I plan to use the introspected ORM from sqlsoup after I've created the tables. However, when I use the engine.execute() method it complains: sqlite3.Warning: You can only execute one statement at a time. Is there a way to work around this issue. Perhaps splitting the file with a regexp or some kind of parser, but I don't know enough SQL to get all of the cases for the regexp. Any help would be greatly appreciated. Will EDIT: Since this seems important ... The dump file was created with a MySQL database and so it has quite a few commands/syntax that sqlite3 does not understand correctly.

    Read the article

  • Sql Alchemy Duplicated Commit

    - by PythonWolf
    Good Morning i'm currently facing a problem in my Cherrypy application. Im my own custom session module , anyway when performing session.add() The exact same object gets updated Twice. cherrypy.request.SessionManager.user_data = user try: db_session.add(cherrypy.request.SessionManager) db_session.commit() Will Return 2011-06-21 09:16:48,991 INFO sqlalchemy.engine.base.Engine.0x...04cL BEGIN (implicit) 2011-06-21 09:16:49,015 INFO sqlalchemy.engine.base.Engine.0x...04cL SELECT ..... FROM "Clients_Users" WHERE "Clients_Users".username = %(username_1)s AND "Clients_Users".password = %(password_1)s LIMIT 1 OFFSET 0 2011-06-21 09:16:49,015 INFO sqlalchemy.engine.base.Engine.0x...04cL {'password_1': '123', 'username_1': u'1'} 2011-06-21 09:16:49,047 INFO sqlalchemy.engine.base.Engine.0x...04cL UPDATE "SYS_Sessions" SET user_data=%(user_data)s WHERE "SYS_Sessions".id = %(SYS_Sessions_id)s 2011-06-21 09:16:49,067 INFO sqlalchemy.engine.base.Engine.0x...04cL {'SYS_Sessions_id': 92L, 'user_data': } 2011-06-21 09:16:49,071 INFO sqlalchemy.engine.base.Engine.0x...04cL COMMIT 2011-06-21 09:16:49,093 INFO sqlalchemy.engine.base.Engine.0x...04cL BEGIN (implicit) 2011-06-21 09:16:49,095 INFO sqlalchemy.engine.base.Engine.0x...04cL UPDATE "SYS_Sessions" SET user_data=%(user_data)s WHERE "SYS_Sessions".id = %(SYS_Sessions_id)s 2011-06-21 09:16:49,095 INFO sqlalchemy.engine.base.Engine.0x...04cL {'SYS_Sessions_id': 92L, 'user_data': } 2011-06-21 09:16:49,108 INFO sqlalchemy.engine.base.Engine.0x...04cL COMMIT As Anyone seen this before ? P.S This doesn't happen in the rest of the modules i have made.

    Read the article

  • Need help using libpng to read an image

    - by jonathanasdf
    Here is my function... I don't know why it's not working. The resulting image looks nothing like what the .png looks like. But there's no errors either. bool Bullet::read_png(std::string file_name, int pos) { png_structp png_ptr; png_infop info_ptr; FILE *fp; if ((fp = fopen(file_name.c_str(), "rb")) == NULL) { return false; } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { fclose(fp); return false; } info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { fclose(fp); png_destroy_read_struct(&png_ptr, NULL, NULL); return false; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); return false; } png_init_io(png_ptr, fp); png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_SWAP_ALPHA | PNG_TRANSFORM_EXPAND, NULL); png_uint_32 width = png_get_image_width(png_ptr, info_ptr); png_uint_32 height = png_get_image_height(png_ptr, info_ptr); imageData[pos].width = width; imageData[pos].height = height; png_bytepp row_pointers; row_pointers = png_get_rows(png_ptr, info_ptr); imageData[pos].data = new unsigned int[width*height]; for (unsigned int i=0; i < height; ++i) { memcpy(&imageData[pos].data[i*width], &row_pointers[i], width*sizeof(unsigned int)); } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); for (unsigned int i=0; i < height; ++i) { for (unsigned int j=0; j < width; ++j) { unsigned int val = imageData[pos].data[i*width+j]; if (val != 0) { unsigned int a = ((val >> 24)); unsigned int r = (((val - (a << 24)) >> 16)); unsigned int g = (((val - (a << 24) - (r << 16)) >> 8)); unsigned int b = (((val - (a << 24) - (r << 16) - (g << 8)))); // for debugging std::string s(AS3_StringValue(AS3_Int(i*width+j))); s += " "; s += AS3_StringValue(AS3_Int(val)); s += " "; s += AS3_StringValue(AS3_Int(a)); s += " "; s += AS3_StringValue(AS3_Int(r)); s += " "; s += AS3_StringValue(AS3_Int(g)); s += " "; s += AS3_StringValue(AS3_Int(b)); AS3_Trace(AS3_String(s.c_str())); } } } return true; } ImageData is just a simple struct to keep x, y, width, and height, and imageData is an array of that struct. struct ImageData { int x; int y; int width; int height; unsigned int* data; }; Here is a side by side screenshot of the input and output graphics (something I made in a minute for testing), and this was after setting alpha to 255 in order to make it show up (because the alpha I was getting back was 1). Left side is original, right side is what happened after reading it through this function. Scaled up 400% for visibility. Here is a log of the traces: 0 16855328 1 1 49 32 1 16855424 1 1 49 128 2 16855456 1 1 49 160 3 16855488 1 1 49 192 4 16855520 1 1 49 224 5 16855552 1 1 50 0 6 16855584 1 1 50 32 7 16855616 1 1 50 64 8 16855424 1 1 49 128 9 16855456 1 1 49 160 10 16855488 1 1 49 192 11 16855520 1 1 49 224 12 16855552 1 1 50 0 13 16855584 1 1 50 32 14 16855616 1 1 50 64 15 16855648 1 1 50 96 16 16855456 1 1 49 160 17 16855488 1 1 49 192 18 16855520 1 1 49 224 19 16855552 1 1 50 0 20 16855584 1 1 50 32 21 16855616 1 1 50 64 22 16855648 1 1 50 96 23 16855680 1 1 50 128 24 16855488 1 1 49 192 25 16855520 1 1 49 224 26 16855552 1 1 50 0 27 16855584 1 1 50 32 28 16855616 1 1 50 64 29 16855648 1 1 50 96 30 16855680 1 1 50 128 31 16855712 1 1 50 160 32 16855520 1 1 49 224 33 16855552 1 1 50 0 34 16855584 1 1 50 32 35 16855616 1 1 50 64 36 16855648 1 1 50 96 37 16855680 1 1 50 128 38 16855712 1 1 50 160 39 16855744 1 1 50 192 40 16855552 1 1 50 0 41 16855584 1 1 50 32 42 16855616 1 1 50 64 43 16855648 1 1 50 96 44 16855680 1 1 50 128 45 16855712 1 1 50 160 46 16855744 1 1 50 192 47 16855776 1 1 50 224 48 16855584 1 1 50 32 49 16855616 1 1 50 64 50 16855648 1 1 50 96 51 16855680 1 1 50 128 52 16855712 1 1 50 160 53 16855744 1 1 50 192 54 16855776 1 1 50 224 55 16855808 1 1 51 0 56 16855616 1 1 50 64 57 16855648 1 1 50 96 58 16855680 1 1 50 128 59 16855712 1 1 50 160 60 16855744 1 1 50 192 61 16855776 1 1 50 224 62 16855808 1 1 51 0 63 16855840 1 1 51 32 64 16855648 1 1 50 96 65 16855680 1 1 50 128 66 16855712 1 1 50 160 67 16855744 1 1 50 192 68 16855776 1 1 50 224 69 16855808 1 1 51 0 70 16855840 1 1 51 32 71 16855872 1 1 51 64 72 16855680 1 1 50 128 73 16855712 1 1 50 160 74 16855744 1 1 50 192 75 16855776 1 1 50 224 76 16855808 1 1 51 0 77 16855840 1 1 51 32 78 16855872 1 1 51 64 79 16855904 1 1 51 96 80 16855712 1 1 50 160 81 16855744 1 1 50 192 82 16855776 1 1 50 224 83 16855808 1 1 51 0 84 16855840 1 1 51 32 85 16855872 1 1 51 64 86 16855904 1 1 51 96 87 16855936 1 1 51 128 88 16855744 1 1 50 192 89 16855776 1 1 50 224 90 16855808 1 1 51 0 91 16855840 1 1 51 32 92 16855872 1 1 51 64 93 16855904 1 1 51 96 94 16855936 1 1 51 128 95 16855968 1 1 51 160 96 16855776 1 1 50 224 97 16855808 1 1 51 0 98 16855840 1 1 51 32 99 16855872 1 1 51 64 100 16855904 1 1 51 96 101 16855936 1 1 51 128 102 16855968 1 1 51 160 103 16856000 1 1 51 192 104 16855808 1 1 51 0 105 16855840 1 1 51 32 106 16855872 1 1 51 64 107 16855904 1 1 51 96 108 16855936 1 1 51 128 109 16855968 1 1 51 160 110 16856000 1 1 51 192 111 16856032 1 1 51 224 112 16855840 1 1 51 32 113 16855872 1 1 51 64 114 16855904 1 1 51 96 115 16855936 1 1 51 128 116 16855968 1 1 51 160 117 16856000 1 1 51 192 118 16856032 1 1 51 224 119 16856064 1 1 52 0 120 16855872 1 1 51 64 121 16855904 1 1 51 96 122 16855936 1 1 51 128 123 16855968 1 1 51 160 124 16856000 1 1 51 192 125 16856032 1 1 51 224 126 16856064 1 1 52 0 127 16856096 1 1 52 32 128 16855904 1 1 51 96 129 16855936 1 1 51 128 130 16855968 1 1 51 160 131 16856000 1 1 51 192 132 16856032 1 1 51 224 133 16856064 1 1 52 0 134 16856096 1 1 52 32 135 16856128 1 1 52 64 136 16855936 1 1 51 128 137 16855968 1 1 51 160 138 16856000 1 1 51 192 139 16856032 1 1 51 224 140 16856064 1 1 52 0 141 16856096 1 1 52 32 142 16856128 1 1 52 64 143 16856160 1 1 52 96 144 16855968 1 1 51 160 145 16856000 1 1 51 192 146 16856032 1 1 51 224 147 16856064 1 1 52 0 148 16856096 1 1 52 32 149 16856128 1 1 52 64 150 16856160 1 1 52 96 151 16856192 1 1 52 128 152 16856000 1 1 51 192 153 16856032 1 1 51 224 154 16856064 1 1 52 0 155 16856096 1 1 52 32 156 16856128 1 1 52 64 157 16856160 1 1 52 96 158 16856192 1 1 52 128 159 16856224 1 1 52 160 160 16856032 1 1 51 224 161 16856064 1 1 52 0 162 16856096 1 1 52 32 163 16856128 1 1 52 64 164 16856160 1 1 52 96 165 16856192 1 1 52 128 166 16856224 1 1 52 160 167 16856256 1 1 52 192 168 16856064 1 1 52 0 169 16856096 1 1 52 32 170 16856128 1 1 52 64 171 16856160 1 1 52 96 172 16856192 1 1 52 128 173 16856224 1 1 52 160 174 16856256 1 1 52 192 175 16856288 1 1 52 224 176 16856096 1 1 52 32 177 16856128 1 1 52 64 178 16856160 1 1 52 96 179 16856192 1 1 52 128 180 16856224 1 1 52 160 181 16856256 1 1 52 192 182 16856288 1 1 52 224 183 16856320 1 1 53 0 184 16856128 1 1 52 64 185 16856160 1 1 52 96 186 16856192 1 1 52 128 187 16856224 1 1 52 160 188 16856256 1 1 52 192 189 16856288 1 1 52 224 190 16856320 1 1 53 0 192 16856160 1 1 52 96 193 16856192 1 1 52 128 194 16856224 1 1 52 160 195 16856256 1 1 52 192 196 16856288 1 1 52 224 197 16856320 1 1 53 0 200 16856192 1 1 52 128 201 16856224 1 1 52 160 202 16856256 1 1 52 192 203 16856288 1 1 52 224 204 16856320 1 1 53 0 208 16856224 1 1 52 160 209 16856256 1 1 52 192 210 16856288 1 1 52 224 211 16856320 1 1 53 0 216 16856256 1 1 52 192 217 16856288 1 1 52 224 218 16856320 1 1 53 0 224 16856288 1 1 52 224 225 16856320 1 1 53 0 232 16856320 1 1 53 0 Was stuck on this for a couple of days.

    Read the article

  • libpng cannot read an image properly

    - by jonathanasdf
    Here is my function... I don't know why it's not working. The resulting image looks nothing like what the .png looks like. But there's no errors either. bool Bullet::read_png(std::string file_name, int pos) { png_structp png_ptr; png_infop info_ptr; FILE *fp; if ((fp = fopen(file_name.c_str(), "rb")) == NULL) { return false; } png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (png_ptr == NULL) { fclose(fp); return false; } info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { fclose(fp); png_destroy_read_struct(&png_ptr, NULL, NULL); return false; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); return false; } png_init_io(png_ptr, fp); png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_SWAP_ALPHA | PNG_TRANSFORM_EXPAND, NULL); png_uint_32 width = png_get_image_width(png_ptr, info_ptr); png_uint_32 height = png_get_image_height(png_ptr, info_ptr); imageData[pos].width = width; imageData[pos].height = height; png_bytepp row_pointers; row_pointers = png_get_rows(png_ptr, info_ptr); imageData[pos].data = new unsigned int[width*height]; for (unsigned int i=0; i < height; ++i) { memcpy(&imageData[pos].data[i*width], &row_pointers[i], width*sizeof(unsigned int)); } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); fclose(fp); for (unsigned int i=0; i < height; ++i) { for (unsigned int j=0; j < width; ++j) { unsigned int val = imageData[pos].data[i*width+j]; if (val != 0) { unsigned int a = ((val >> 24)); unsigned int r = (((val - (a << 24)) >> 16)); unsigned int g = (((val - (a << 24) - (r << 16)) >> 8)); unsigned int b = (((val - (a << 24) - (r << 16) - (g << 8)))); // for debugging std::string s(AS3_StringValue(AS3_Int(i*width+j))); s += " "; s += AS3_StringValue(AS3_Int(val)); s += " "; s += AS3_StringValue(AS3_Int(a)); s += " "; s += AS3_StringValue(AS3_Int(r)); s += " "; s += AS3_StringValue(AS3_Int(g)); s += " "; s += AS3_StringValue(AS3_Int(b)); AS3_Trace(AS3_String(s.c_str())); } } } return true; } ImageData is just a simple struct to keep x, y, width, and height, and imageData is an array of that struct. struct ImageData { int x; int y; int width; int height; unsigned int* data; }; Here is a side by side screenshot of the input and output graphics (something I made in a minute for testing), and this was after setting alpha to 255 in order to make it show up (because the alpha I was getting back was 1). Left side is original, right side is what happened after reading it through this function. Scaled up 400% for visibility. Here is a log of the traces: 0 16855328 1 1 49 32 1 16855424 1 1 49 128 2 16855456 1 1 49 160 3 16855488 1 1 49 192 4 16855520 1 1 49 224 5 16855552 1 1 50 0 6 16855584 1 1 50 32 7 16855616 1 1 50 64 8 16855424 1 1 49 128 9 16855456 1 1 49 160 10 16855488 1 1 49 192 11 16855520 1 1 49 224 12 16855552 1 1 50 0 13 16855584 1 1 50 32 14 16855616 1 1 50 64 15 16855648 1 1 50 96 16 16855456 1 1 49 160 17 16855488 1 1 49 192 18 16855520 1 1 49 224 19 16855552 1 1 50 0 20 16855584 1 1 50 32 21 16855616 1 1 50 64 22 16855648 1 1 50 96 23 16855680 1 1 50 128 24 16855488 1 1 49 192 25 16855520 1 1 49 224 26 16855552 1 1 50 0 27 16855584 1 1 50 32 28 16855616 1 1 50 64 29 16855648 1 1 50 96 30 16855680 1 1 50 128 31 16855712 1 1 50 160 32 16855520 1 1 49 224 33 16855552 1 1 50 0 34 16855584 1 1 50 32 35 16855616 1 1 50 64 36 16855648 1 1 50 96 37 16855680 1 1 50 128 38 16855712 1 1 50 160 39 16855744 1 1 50 192 40 16855552 1 1 50 0 41 16855584 1 1 50 32 42 16855616 1 1 50 64 43 16855648 1 1 50 96 44 16855680 1 1 50 128 45 16855712 1 1 50 160 46 16855744 1 1 50 192 47 16855776 1 1 50 224 48 16855584 1 1 50 32 49 16855616 1 1 50 64 50 16855648 1 1 50 96 51 16855680 1 1 50 128 52 16855712 1 1 50 160 53 16855744 1 1 50 192 54 16855776 1 1 50 224 55 16855808 1 1 51 0 56 16855616 1 1 50 64 57 16855648 1 1 50 96 58 16855680 1 1 50 128 59 16855712 1 1 50 160 60 16855744 1 1 50 192 61 16855776 1 1 50 224 62 16855808 1 1 51 0 63 16855840 1 1 51 32 64 16855648 1 1 50 96 65 16855680 1 1 50 128 66 16855712 1 1 50 160 67 16855744 1 1 50 192 68 16855776 1 1 50 224 69 16855808 1 1 51 0 70 16855840 1 1 51 32 71 16855872 1 1 51 64 72 16855680 1 1 50 128 73 16855712 1 1 50 160 74 16855744 1 1 50 192 75 16855776 1 1 50 224 76 16855808 1 1 51 0 77 16855840 1 1 51 32 78 16855872 1 1 51 64 79 16855904 1 1 51 96 80 16855712 1 1 50 160 81 16855744 1 1 50 192 82 16855776 1 1 50 224 83 16855808 1 1 51 0 84 16855840 1 1 51 32 85 16855872 1 1 51 64 86 16855904 1 1 51 96 87 16855936 1 1 51 128 88 16855744 1 1 50 192 89 16855776 1 1 50 224 90 16855808 1 1 51 0 91 16855840 1 1 51 32 92 16855872 1 1 51 64 93 16855904 1 1 51 96 94 16855936 1 1 51 128 95 16855968 1 1 51 160 96 16855776 1 1 50 224 97 16855808 1 1 51 0 98 16855840 1 1 51 32 99 16855872 1 1 51 64 100 16855904 1 1 51 96 101 16855936 1 1 51 128 102 16855968 1 1 51 160 103 16856000 1 1 51 192 104 16855808 1 1 51 0 105 16855840 1 1 51 32 106 16855872 1 1 51 64 107 16855904 1 1 51 96 108 16855936 1 1 51 128 109 16855968 1 1 51 160 110 16856000 1 1 51 192 111 16856032 1 1 51 224 112 16855840 1 1 51 32 113 16855872 1 1 51 64 114 16855904 1 1 51 96 115 16855936 1 1 51 128 116 16855968 1 1 51 160 117 16856000 1 1 51 192 118 16856032 1 1 51 224 119 16856064 1 1 52 0 120 16855872 1 1 51 64 121 16855904 1 1 51 96 122 16855936 1 1 51 128 123 16855968 1 1 51 160 124 16856000 1 1 51 192 125 16856032 1 1 51 224 126 16856064 1 1 52 0 127 16856096 1 1 52 32 128 16855904 1 1 51 96 129 16855936 1 1 51 128 130 16855968 1 1 51 160 131 16856000 1 1 51 192 132 16856032 1 1 51 224 133 16856064 1 1 52 0 134 16856096 1 1 52 32 135 16856128 1 1 52 64 136 16855936 1 1 51 128 137 16855968 1 1 51 160 138 16856000 1 1 51 192 139 16856032 1 1 51 224 140 16856064 1 1 52 0 141 16856096 1 1 52 32 142 16856128 1 1 52 64 143 16856160 1 1 52 96 144 16855968 1 1 51 160 145 16856000 1 1 51 192 146 16856032 1 1 51 224 147 16856064 1 1 52 0 148 16856096 1 1 52 32 149 16856128 1 1 52 64 150 16856160 1 1 52 96 151 16856192 1 1 52 128 152 16856000 1 1 51 192 153 16856032 1 1 51 224 154 16856064 1 1 52 0 155 16856096 1 1 52 32 156 16856128 1 1 52 64 157 16856160 1 1 52 96 158 16856192 1 1 52 128 159 16856224 1 1 52 160 160 16856032 1 1 51 224 161 16856064 1 1 52 0 162 16856096 1 1 52 32 163 16856128 1 1 52 64 164 16856160 1 1 52 96 165 16856192 1 1 52 128 166 16856224 1 1 52 160 167 16856256 1 1 52 192 168 16856064 1 1 52 0 169 16856096 1 1 52 32 170 16856128 1 1 52 64 171 16856160 1 1 52 96 172 16856192 1 1 52 128 173 16856224 1 1 52 160 174 16856256 1 1 52 192 175 16856288 1 1 52 224 176 16856096 1 1 52 32 177 16856128 1 1 52 64 178 16856160 1 1 52 96 179 16856192 1 1 52 128 180 16856224 1 1 52 160 181 16856256 1 1 52 192 182 16856288 1 1 52 224 183 16856320 1 1 53 0 184 16856128 1 1 52 64 185 16856160 1 1 52 96 186 16856192 1 1 52 128 187 16856224 1 1 52 160 188 16856256 1 1 52 192 189 16856288 1 1 52 224 190 16856320 1 1 53 0 192 16856160 1 1 52 96 193 16856192 1 1 52 128 194 16856224 1 1 52 160 195 16856256 1 1 52 192 196 16856288 1 1 52 224 197 16856320 1 1 53 0 200 16856192 1 1 52 128 201 16856224 1 1 52 160 202 16856256 1 1 52 192 203 16856288 1 1 52 224 204 16856320 1 1 53 0 208 16856224 1 1 52 160 209 16856256 1 1 52 192 210 16856288 1 1 52 224 211 16856320 1 1 53 0 216 16856256 1 1 52 192 217 16856288 1 1 52 224 218 16856320 1 1 53 0 224 16856288 1 1 52 224 225 16856320 1 1 53 0 232 16856320 1 1 53 0 Was stuck on this for a couple of days.

    Read the article

  • What makes puzzle games addictive?

    - by Bryan Denny
    I'm currently developing a puzzle game for Android that is sort of along the lines of Alchemy. I was wondering what makes games like Alchemy or Bejeweled so addicting? How do I keep players interested in the game to want to play it over and over? Is it the scores? Level advancement? The challenges? What should I be doing to try and keep a player engaged with a puzzle game since they are often quite repetitive?

    Read the article

  • Twisted + SQLAlchemy and the best way to do it.

    - by Khorkrak
    So I'm writing yet another Twisted based daemon. It'll have an xmlrpc interface as usual so I can easily communicate with it and have other processes interchange data with it as needed. This daemon needs to access a database. We've been using SQL Alchemy in place of hard coding SQL strings for our latest projects - those mostly done for web apps in Pylons. We'd like to do the same for this app and re-use library code that makes use of SQL Alchemy. So what to do? Well of course since that library was written for use in a Pylons app it's all the straight-forward blocking style code that everyone is accustomed to and all of the non-blocking is magically handled by Pylons via threading, thread locals, scoped sessions and so on. So now for Twisted I guess I'm a bit stuck. I could: Just write the sql I need directly if it's minimal and use the dbapi pool in twisted to do runInteractions etc when I need to hit the db. Use the objects and inherently blocking methods in our library and block now and then in my Twisted daemon. Bah. Use sAsync which was last updated in 2008 and kind of reuse the models we have defined already but not really and it does address code that needs to work in Pylons either. Does that even work with the latest version SQL Alchemy? Who knows. That project looked great though - why was it apparently abandoned? Spawn a separate subprocess and have it deal with the library code and all it's blocking, the results being returned back to my daemon when ready as objects marshalled via YAML over xmlrpc. Use deferToThread and then expunge the objects returned having made sure to do eager loads so that I have all my stuff that I might need. Seems kind of ugha to me. I'm also stuck using Python 2.5.4 atm so no 2.6 yet and I don't think I can just do an import from future to get access to the cool new multiprocessing module stuff in there. That's OK though I guess as we've got dealing with interprocess communication down pretty well. So I'm leaning towards option 4 mostly as that would avoid the mortal sin of logic duplication with option 1 while also staying the heck away from threads. Any better ideas?

    Read the article

  • Need help with joins in sqlalchemy

    - by Steve
    I'm new to Python, as well as SQL Alchemy, but not the underlying development and database concepts. I know what I want to do and how I'd do it manually, but I'm trying to learn how an ORM works. I have two tables, Images and Keywords. The Images table contains an id column that is its primary key, as well as some other metadata. The Keywords table contains only an id column (foreign key to Images) and a keyword column. I'm trying to properly declare this relationship using the declarative syntax, which I think I've done correctly. Base = declarative_base() class Keyword(Base): __tablename__ = 'Keywords' __table_args__ = {'mysql_engine' : 'InnoDB'} id = Column(Integer, ForeignKey('Images.id', ondelete='CASCADE'), primary_key=True) keyword = Column(String(32), primary_key=True) class Image(Base): __tablename__ = 'Images' __table_args__ = {'mysql_engine' : 'InnoDB'} id = Column(Integer, primary_key=True, autoincrement=True) name = Column(String(256), nullable=False) keywords = relationship(Keyword, backref='image') This represents a many-to-many relationship. One image can have many keywords, and one keyword can relate back to many images. I want to do a keyword search of my images. I've tried the following with no luck. Conceptually this would've been nice, but I understand why it doesn't work. image = session.query(Image).filter(Image.keywords.contains('boy')) I keep getting errors about no foreign key relationship, which seems clearly defined to me. I saw something about making sure I get the right 'join', and I'm using 'from sqlalchemy.orm import join', but still no luck. image = session.query(Image).select_from(join(Image, Keyword)).\ filter(Keyword.keyword == 'boy') I added the specific join clause to the query to help it along, though as I understand it, I shouldn't have to do this. image = session.query(Image).select_from(join(Image, Keyword, Image.id==Keyword.id)).filter(Keyword.keyword == 'boy') So finally I switched tactics and tried querying the keywords and then using the backreference. However, when I try to use the '.images' iterating over the result, I get an error that the 'image' property doesn't exist, even though I did declare it as a backref. result = session.query(Keyword).filter(Keyword.keyword == 'boy').all() I want to be able to query a unique set of image matches on a set of keywords. I just can't guess my way to the syntax, and I've spent days reading the SQL Alchemy documentation trying to piece this out myself. I would very much appreciate anyone who can point out what I'm missing.

    Read the article

  • How to use Pixel Bender (pbj) in ActionScript3 on large Vectors to make fast calculations?

    - by Arthur Wulf White
    Remember my old question: 2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing? I figured I could use a Pixel Bender Shader to do the computation for any large group of elements in a game to save on processing time. At least it's a theory worth checking. I also read this question: Pass large array to pixel shader Which I'm guessing is about accomplishing the same thing in a different language. I read this tutorial: http://unitzeroone.com/blog/2009/03/18/flash-10-massive-amounts-of-3d-particles-with-alchemy-source-included/ I am attempting to do some tests. Here is some of the code: private const SIZE : int = Math.pow(10, 5); private var testVectorNum : Vector.<Number>; private function testShader():void { shader.data.ab.value = [1.0, 8.0]; shader.data.src.input = testVectorNum; shader.data.src.width = SIZE/400; shader.data.src.height = 100; shaderJob = new ShaderJob(shader, testVectorNum, SIZE / 4, 1); var time : int = getTimer(), i : int = 0; shaderJob.start(true); trace("TEST1 : ", getTimer() - time); } The problem is that I keep getting a error saying: [Fault] exception, information=Error: Error #1000: The system is out of memory. Update: I managed to partially workaround the problem by converting the vector into bitmapData: (Using this technique I still get a speed boost of 3x using Pixel Bender) private function testShader():void { shader.data.ab.value = [1.0, 8.0]; var time : int = getTimer(), i : int = 0; testBitmapData.setVector(testBitmapData.rect, testVectorInt); shader.data.src.input = testBitmapData; shaderJob = new ShaderJob(shader, testBitmapData); shaderJob.start(true); testVectorInt = testBitmapData.getVector(testBitmapData.rect); trace("TEST1 : ", getTimer() - time); }

    Read the article

  • How does MySQL 5.5 and InnoDB on Linux use RAM?

    - by Loren
    Does MySQL 5.5 InnoDB keep indexes in memory and tables on disk? Does it ever do it's own in-memory caching of part or whole tables? Or does it completely rely on the OS page cache (I'm guessing that it does since Facebook's SSD cache that was built for MySQL was done at the OS-level: https://github.com/facebook/flashcache/)? Does Linux by default use all of the available RAM for the page cache? So if RAM size exceeds table size + memory used by processes, then when MySQL server starts and reads the whole table for the first time it will be from disk, and from that point on the whole table is in RAM? So using Alchemy Database (SQL on top of Redis, everything always in RAM: http://code.google.com/p/alchemydatabase/) shouldn't be much faster than MySQL, given the same size RAM and database?

    Read the article

  • python pdb not breaking in files properly?

    - by YGA
    Hi Folks, I wish I could provide a simple sample case that occurs using standard library code, but unfortunately it only happens when using one of our in-house libraries that in turn is built on top of sql alchemy. Basically, the problem is that this break command: (Pdb) print sqlalchemy.engine.base.__file__ /prod/eggs/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/engine/base.py (Pdb) break /prod/eggs/SQLAlchemy-0.5.5-py2.5.egg/sqlalchemy/engine/base.py:946 Is just being totally ignored, it seems, by pdb. As in, even though I am positive the code is being hit (both because I can see log messages, and because I've used sys.settrace to check which lines in which files are being hit), pdb is just not breaking there. I suspect that somehow the use of an egg is confusing pdb as to what files are being used (I can't reproduce the error if I use a non-egg'ed library, like pickle; there everything works fine). It's a shot in the dark, but has anyone come across this before? Thanks, /YGA

    Read the article

  • Query results taking too long on 200K database, speed up tips?

    - by colorfulgrayscale
    I have a sql statement where I'm joining about 4 tables, each with 200K rows. The query runs, but keeps freezing. When I do a join on 3 tables instead, it returns the rows (takes about 10secs). Any suggestion why? suggestions to speed up? Thanks! Code SELECT * FROM equipment, tiremap, workreference, tirework WHERE equipment.tiremap = tiremap.`TireID` AND tiremap.`WorkMap` = workreference.`aMap` AND workreference.`bMap` = tirework.workmap LIMIT 5 p.s and if it helps any, I'm using sql alchemy to generate this code, the sqlalchemy code for this is query = session.query(equipment, tiremap, workreference, tirework) query = query.filter(equipment.c.tiremap == tiremap.c.TireID) query = query.filter(tiremap.c.WorkMap==workreference.c.aMap) query = query.filter(workreference.c.bMap == tirework.c.workmap) query = query.limit(5) query.all()

    Read the article

  • regex to match postgresql bytea

    - by filiprem
    In PostgreSQL, there is a BLOB datatype called bytea. It's just an array of bytes. bytea literals are output in the following way: '\\037\\213\\010\\010\\005`Us\\000\\0001.fp3\'\\223\\222%' See PostgreSQL docs for full definition of the format. I'm trying to construct a Perl regular expression which will match any such string. It should also match standard ANSI SQL string literals, like 'Joe', 'Joe''s Mom', 'Fish Called ''Wendy''' It should also match backslash-escaped variant: 'Joe\'s Mom', . First aproach (shown below) works only for some bytea representations. s{ ' # Opening apostrophe (?: # Start group [^\\\'] # Anything but a backslash or an apostrophe | # or \\ . # Backslash and anything | # or \'\' # Double apostrophe )* # End of group ' # Closing apostrophe }{LITERAL_REPLACED}xgo; For other (longer ones, with many escaped apostrophes, Perl gives such warning: Complex regular subexpression recursion limit (32766) exceeded at ./sqa.pl line 33, < line 1. So I am looking for a better (but still regex-based) solution, it probably requires some regex alchemy (avoiding backreferences and all).

    Read the article

  • C++ to bytecode compiler for Silverlight CLR?

    - by paleozogt
    I'd like to be able to compile a C/C++ library so that it runs within a safe managed runtime in the Silverlight CLR. There are several tools for doing this with the JVM that allows C++ code to run within a CRT emulation layer (see NestedVM, LLJVM, etc), which effectively allows C++ code to be run within a Java Applet. There's even a tool for this for the Adobe Flash VM (see Alchemy). However, I can't seem to find any tools like this for the CLR. fyi, the MSVC tools don't seem to allow for this: The /clr:pure flag will create C++ code that runs in the CLR, but it isn't safe (because the CRT isn't safe) and /clr:safe requires massive code changes (no native types, etc).

    Read the article

  • Extracting Demographic and Contact Information from unstructured text files

    - by jn29098
    I am looking to extract specific items out of a large pool of unstructured documents. These documents could be 1-5 pages of text formatted in various ways by the user, but in most cases would contain at least: Name Address (physical) Email Address Phone number website URL I'm looking for a semantic parser that can attempt to extract these elements from the documents so that I can load that information into a relational database and work with these records as contacts. Other services I've looked for, while valuable for other purposes, do not address this specific need. Alchemy API Open Calais Saplo Any thoughts, suggestions or leads?

    Read the article

1 2  | Next Page >