Monday, 19 May 2014
QScrollArea squashing its contents
If a QScrollArea is squashing its contents when resized instead of adjusting the scrollbar, set widgetResizable to false.
Tuesday, 13 May 2014
UNIQUE constraints in SQLite FTS (FTS3/FTS4) tables
The correct way to do this:
CREATE VIEW playlist_view AS SELECT * FROM playlist; CREATE TRIGGER insert_playlist INSTEAD OF INSERT ON playlist_view BEGIN SELECT RAISE(ABORT, 'column user_id is not unique') FROM playlist WHERE user_id=new.user_id; INSERT INTO playlist (from_user, from_id, created_time, created_time_formated, user_id) VALUES (NEW.from_user, NEW.from_id, NEW.created_time, NEW.created_time_formated, NEW.user_id); END; -- And you do the insertion on the view INSERT INTO playlist_view (from_user,from_id,created_time,created_time_formated,user_id) SELECT ...;
Wednesday, 7 May 2014
Custom Build Tools in Visual Studio
Custom Build Tools in Visual Studio
You can compile non-standard file types with arbitrary programs in Visual studio by specifying a Custom Build Tool. But often the tool expects to be running in the same directory as the target file, and it won't be, it will be running in the Project directory. And multiline batch commands are not allowed in Visual Studio 2012.
So we use the START batch command to specify the directory with /D, followed by the exe and its parameters:
You can compile non-standard file types with arbitrary programs in Visual studio by specifying a Custom Build Tool. But often the tool expects to be running in the same directory as the target file, and it won't be, it will be running in the Project directory. And multiline batch commands are not allowed in Visual Studio 2012.
So we use the START batch command to specify the directory with /D, followed by the exe and its parameters:
START "title" /D"%(RootDir)%(Directory)" "win_flex.exe" "%(FullPath)"
Property Sheets in Visual Studio are super-important.
If you are making a lot of projects in Visual Studio and having to set up a lot of project options, you need Property Sheets. Go to the Property Manager window, and you can create .props files here that whole projects or individual configurations can inherit from.
Sunday, 4 May 2014
Effect groups - grouping techniques in DirectX 11 Effects
See http://msdn.microsoft.com/en-us/library/windows/desktop/ff476120.aspx for details, but in general, in .fx:
fxgroup Group1 { technique11 Tech1 { ... } technique11 Tech2 { ... } }
and in C++:
pEffect->GetTechniqueByName( "Group1|Tech2" );or
pEffect->GetGroupByName("Group1")->GetTechniqueByName( "Tech1" );
Thursday, 1 May 2014
Unity - making sure changes to a ScriptableObject are saved
After reimporting or changing a ScriptableObject-derived asset, call EditorUtility.SetDirty(obj) on the object and its .asset file will be saved.
Subscribe to:
Posts (Atom)