Posts

Showing posts from May, 2013

I am trying to rearrange sections of a picture in matlab -

here assignment: open humpty_mixed.gif (2d image) , of king’s horses , men not – put humpty again. image 600x412 , split evenly along row , columns. (note: may use imread(), imshow(), , imwrite() commands here.) the picture sectioned off in 4 rows , 4 columns, me started, i'm stuck b=imread('humpty_mixed.gif'); imshow('humpty_mixed.gif') %that should started.oh way cheating recieve zero! a=b: imshow(a)

iphone - Testing in-app purchase after going live -

i make contest iphone , ipad apps users. give bonus content winners reward. content paid (for eg. additional levels) , it's available via in-app purchase, i'm trying find way give them normal promo codes. (promo codes not working in-app purchase). possible set test accounts testing in app purchase after going live (my apps in app store), configure them winners? if not, solution alternative promo codes? many review sites asking promo codes too, answer helpful in other cases. thanks

Adding to a string map in OCaml -

i have been trying figure out figure pretty simple task, namely adding entries map of strings in ocaml within function. relevant elements below: module stringmap = map.make (string);; let m = stringmap.empty;; let rec count ke = match ke |[] -> [] |hd::tl -> begin let m = stringmap.add hd 1 m; [hd] @ count tl end;; i keep receiving cryptic "syntax error" message, have yet find solution after stripping code down nothing. can add string map single command, if try run let m = stringmap.add hd 1 m within function, fails run. sure simple problem, can please help? thanks. there seem few problems code. first, here example on how trying do: module stringmap = map.make (string) let rec count m ke = match ke | [] -> m | hd :: tl -> count (stringmap.add hd 1 m) tl let m = count stringmap.empty ["foo"; "bar"; "baz"] some comments on original code: double semicolons used tell repl loop want consume cod...

visual studio 2010 - How to re-enable standard C# errors in error list after uninstall? -

i've noticed resharper disables standard vs2010 c# language service's error reporting error list. have full build in order c# provide errors resharper doesn't report. when uninstall resharper, c# remains in disabled/broken state. how can re-enable language service-generated errors in error list? tools -> options -> text editor -> c# -> advanced -> "underline errors in editor" (check) "show live semantic errors" (check)

qt - How to get the Selected Row Number from QTableView? -

i new qt. using frozentabelwidget it's derived qtableview. how selected row number. if index changed(user click cell) need cell row number? my code below: //freezetablewidget.cpp #include <qtgui> #include "freezetablewidget.h" freezetablewidget::freezetablewidget(qabstractitemmodel * model) { setmodel(model); frozentableview = new qtableview(this); init(); connect(horizontalheader(),signal(sectionresized ( int ,int,int )), this, slot(updatesectionwidth(int, int, int))); connect(frozentableview->verticalscrollbar(), signal(valuechanged(int)), verticalscrollbar(), slot(setvalue(int))); connect(verticalscrollbar(), signal(valuechanged(int)), frozentableview->verticalscrollbar(), slot(setvalue(int))); } freezetablewidget::~freezetablewidget() { delete frozentableview; } void freezetablewidget::init() { frozentableview->hidecolumn(0); ...

.net - How can I use linq to check if an flags/bitwise enumeration contains a type? -

the following lambda statemement returns null, when hoping return string value. var countrycode = addresscomponents .where(x => x.addresstype == addresstype.country) .select(x => x.shortname) .singleordefault(); now addresstype property of current instance i'm interrigating contains following data: addresstype.political | addresstype.country so it's containing 2 values. of course, lambda not work, because value of country (lets assume it's 1) != value of political bitwise or country (lets assume it's 1 | 2 == 3). any ideas? i'm worried need have fraking ugly ... ((addresstypes & addresstype.country) == addresstype.country) .. thoughts? .net 4.0 has the enum.hasflag method: x => x.addresstype.hasflag(addresstype.country) if not on .net 4.0, bitwise and you have there choice. if don't pattern, check out unconstrainedmelody , has extension method purpose. alternatively, can write 1 yourself; question of -...

iphone - Coloring of a rectangle -

i'm newbie graphics.i'm drawing rectangle change color after 1 second. - (void)drawrect:(cgrect)rect { [self setwidthheightofrectangle]; [self changecolorofnumbers]; cgcontextref ctx = uigraphicsgetcurrentcontext(); cgcontextclearrect(ctx, rect); // draw solid square cgcontextsetrgbfillcolor(ctx, 255, 255, 255, 1); cgcontextfillrect(ctx, cgrectmake(0.0, 24.0, 380.0, 2.0)); cgcontextsetrgbfillcolor(ctx, rednumber, greennumber, bluenumber, 1); cgcontextfillrect(ctx, frametodraw); } i'm changing color of rectangle using changecolorofnumbers method. here method - (void)changecolorofnumbers { ihit++; if (ihit==100) { rednumber=249; greennumber=252; bluenumber=0; } else if (ihit==200) { rednumber=0; greennumber=168; bluenumber=245; } else if (ihit==300) { rednumber=255; greennumber=0; bluenumber=140; } else if (ihit==400) { rednumber=255; greennumber=125; bluenumber=0; } else if (...

c# - Building security architecture in web software (creating an API) -

i have set of actions in database, such add user, edit user, import users, send invitation, etc. have attached these permissions roles. attached these roles users. is there pattern or api can create using this? not want put bunch of if/else statements in code check permissions. maybe interfaces good? sorry being vague, not know start , looking advise on how start (perhaps authorization rule provider?). in advance help. microsoft's roles , membership basic , felt deals authentication no authorization. but found looking for... rhino security! http://www.ryantomlinson.com/post/an-enterprise-authorization-framework-part-1-introduction.aspx

Can I use conditional branching in xml email templates -

i want have generalised email templates. have multiple email templates part of subject , body being changed. club them conditional branching like, <email> <sub> if(condition) sub1 else sub2 </sub> <body> text if(condition) text... else text... body continued... </body> </email> can in way? for task idea use template engine. there exist template engines plain text (like apache velocity ) can use generating xml too. there specialized template engines xml, xslt (with various implementions every programming environment) or genshi (with special xml mode). look @ wikipedia template engine page comparison table.

c++ - QML ListView multiselection -

how can select few elements in qml listview , send indices c++ code? i pretty sure there no way make qml listview multi-selectable. qt declarative focused on touch screen use , there no meaningful way multiselect in pure touch ui.

c# - How to add checkbox control at the beginning of every row in datagrid control? -

i developing mobile application in c#. want add checkbox control dynamically @ beginning of every row in datagrid control & based on particular checkbox selection want fire event. want add checkbox column & based on selection of particular checkbox, want fire event on checkbox selected row. using following code. private void showregistrationkeydetails_load(object sender, eventargs e) { gridheight = 40; sqlitedatareader sqlitedrkeyobj = null; datatable dt = new datatable(); datamanager datamgrobj = new datamanager(); //int keyid = cust_id; //string client_key1 = client_key; int keyid = selected_customer_id; //string client_key = selected_client_key; sqlitedrkeyobj = datamgrobj.getregistrationkey(keyid); dt.load(sqlitedrkeyobj); //dt.columns.add(new datacolumn("select", typeof(boolean))); regkeyinfodatagrid.d...

java - velocity template and javascript -

i try add javascript velocity template. <html> <head> <title>:: $currency.currencyname detail info ::</title> </head> <body> <table> <tr> <td>name</td> <td>$currency.currencyname</td> </tr> <tr> <td>jual</td> <td><div id="$currency.currencyname_buy">$currency.buy</div></td> </tr> <tr> <td>beli</td> <td><div id="$currency.currencyname_sell">$currency.sell</div></td> </tr> </table> <script src="http://code.jquery.com/jquery-latest.min.js"></script> <script> $(document).ready(function() { setinterval(function() { $.get('updatecurrency.htm', function(data) { $('#time').text(data); }); }, 5 * 60 * 1000); // 1000 milliseconds = 1 second. }); </sc...

restart - WiX CloseApplication for exe and dll -

i've created wix setup project based on article wix 3 tutorial: understanding main wxs , wxi file because gives wix needed application shutdown. however, i'm puzzled outcome. here's situation: we have executable uses dll , create setup installs executable , dll. execute setup. case 1 : next, change executable , not dll , create setup again. start installed application , make sure dll loaded. if execute second setup, dialog shown asking user shutdown executable expected. case 2 : if not change application dll , execute setup while application running , dll loaded, no dialog shown. @ end of setup dialog appears asking if want restart computer. is expected behaviour , how can force application shutdown dialog of case 1 when dll changed in case 2? not want user having restart computer because application running on server cannot restarted. this determined windows installer during costing process. installer decides files need installed / updated , calcul...

java - Spring Transaction - automatic rollback of previous db updates when one db update failes -

i writing simple application (spring + hibernate + postgresql db). trying construct sample object , persist in db. i run simple java class main method have loaded applicationcontext , have got reference service class below testservice srv = (testservice)factory.getbean("testservice"); application context - context : <bean id="transactionmanager" class="org.springframework.orm.hibernate3.hibernatetransactionmanager"> <property name="sessionfactory" ref="sessionfactoryvsm" /> </bean> <bean id="testservice" class="com.test.service.testserviceimpl"> <property name="testdao" ref="testdao"/> </bean> <bean id="testdao" class="com.test.dao.testdaoimpl> <property name="sessionfactory" ref="sessionfactoryvsm"/> </bean> in testservice have injected testdao. in test service method have...

php - How to suppress error if an argument is missing in a function call? -

i made function (no need write whole function here) : public function selectnode($from, $attributes = null, $childs = null) and, of course, if call way : $node->selectnode(); the argument $from isn't initialized , got warning error. know can suppress error doing @$node->selectnode(); or @ . but, want handle myself. how can that if that's possible? the way found initialize public function selectnode($from = null, $attributes = null, $childs = null) doesn't make clear ($from not option others). (and, of course, function, here, example. extended other functions) you use try-catch block handling error yourself. try { $node->selectnode(); } catch (exception $e){ echo $e; // whatever here error info $e, if leave parenthesis empty here nothing done , error message suppressed }

How to generate a rails link with an AR validation message -

i'd give link contact page on failure of validation. i've tried no avail: validates_acceptance_of :not_an_agency, :on => :create, :message => "must confirmed. if agency please #{link_to "contact us", contact_path}" anyone know how past one? jack as of rails 3.1 can do: view_context.link_to "contact us", contact_path also, strict, original poster's code example missing close quote on "contact us"

iphone - Change Style/State of UIButton Info Dark -

i have uibutton (info dark) opens small box on click. possible change style/state button buttons appears highlighted or long box open? or have use own background images button? try this: [yourbutton setbackgroundimage:[uiimage imagenamed:@"highlighted_image.png"] forstate:uicontrolstatehighlighted]; [yourbutton setbackgroundimage:[uiimage imagenamed:@"highlighted_image.png"] forstate:uicontrolstateselected]; and when close box can put picture on button normal (not highlighted) this: [yourbutton setbackgroundimage:[uiimage imagenamed:@"oldpicture_nothighlighted.png"] forstate:uicontrolstatenormal];

utf 8 - How to initialize a const char* and/or const std::string in C++ with a sequence of UTF-8 character? -

how initialize const char* and/or const std::string in c++ sequence of utf-8 characters? i'm using regular expression api accepts utf8 string const char*. initialization code should platform independent. this should work compiler: const char* twochars = "\xe6\x97\xa5\xd1\x88";

streaming - Record Silverlight 4 MediaElement content -

at moment i'm working on project. contains streaming ip camera silverlight 4 mediaelement. stream goes through mediaelement, needs cut when button clicked. so possible record mediaelement's content on demand? when that's done, write recorded part of mediaelement disk. if possible, what's efficient way this? thank in advance, afaik, extract part of entirely video, can use program has record screen function record silverlight video on demand. play video , use start recording desired beginning , finish recording @ intended ending. demand content.

play mp4 from sdcard of emulator 2.2 -

public class mainactivity extends activity{ mediacontroller mediacontroller; mediaplayer mp; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); setrequestedorientation(activityinfo.screen_orientation_landscape); // uri uri = uri.parse("android.resource//org.me.vid_sample/raw/lahainaharbor"); file path = new file("/sdcard/waileasuntest1.mp4"); videoview videoview = (videoview) findviewbyid(r.id.surface); videoview.setvideopath(path.getabsolutepath()); mediacontroller = new mediacontroller(this); mediacontroller.setmediaplayer(videoview); mediacontroller.setanchorview(videoview); videoview.setmediacontroller(mediacontroller); videoview.requestfocus(); videoview.start(); } check in device. sure works.

javascript - How to use $ for jQuery inside domready when prototype is using $ outside? -

i'm unable remove prototype jsf framework (richfaces 3.3.3). , if try noconflict , try take on $ breaks application framework because tightly coupled prototype. so there way can this: jquery(function() { /* code within domready function allows me use $() within function , not interfere $ being used prototype outside? */ }); yes, it's passed in first parameter ready handler, use: jquery(function($) { $("selector").dosomething(); }); //$ still prototype here

Download mysql Table with php nusoap -

i want export/download table mysql database txt or csv file way can in phpmyadmin. table can anywhere 100 - 90k entries , mysql query take place on php page. maybe can use outfile ? http://dev.mysql.com/doc/refman/5.0/en/select.html

c++ - Joining two programs one with main() one with WinMain() -

i want combine 2 programs single executable. 1 open source program has rather complex project file, other 1 of mine simpler structure. because of relative complexities of project files feel make sense start open source project , modify include source files. my intention program should in control , treat other collection of utility functions. i noticed open source program has function called "main()" whereas mine has "winmain()". presumably have tell compiler call winmain() first. how do that? is there else should aware of in merging process? edit: both programs c++, not c. edit: open source program little io. edit: key thing want know have modify in project settings "this windows program using winmain() opposed console(?) program using main()" or compiler somehow work out itself. update: joint program , running. if program has winmain() , presumably windows program, while other command-line app. depending on original apps do...

html - How to open the homepage in FULLSCREEN with javascript without opening a new window? -

how open homepage in fullscreen javascript without opening new window ?? to start with, please don't that. changing browser size without user's consent annoying. some modern browsers don't allow javascript resize browser window (i'm assuming mean full screen) if window wasn't opened script. way around change browser's configuration. so, essentially, if browser doesn't allow it, there's nothing can do. you'll have open new popup , resize fill screen (and annoy users).

actionscript 3 - Set time 5 seconds to dispatch cairngorm event in flex -

i have live chart. need refresh chart 5 seconds time interval. for displaying live chart disptach event (myevent) extends cairngormevent. and after 5 seconds , same event has dispatch again adn data display thelie cart. and how event dispatch after 5 seconds out manula call..? please knows, update me asap. urg me. thanks, ravi it working now. way dispatch event time interval. private var timer:timer; private function getchart():void { var chartevent:chartevent=new chartevent(); chartevent.dispatch(); } private function settimer():void { timer = new timer(5000); timer.addeventlistener(timerevent.timer, ontimer); timer.start(); cursormanager.showcursor(); } private function ontimer(evt:timerevent):void { alert.show("in"); getchart(); alert.show("dispatching event:--->...

In OpenCL 1.1 my call to function min() is ambiguous and I can't figure out why -

i upgraded opencl 1.0 1.1. when make call min() function, error output: <program source>:45:44: error: call 'min' ambiguous int nframesthiskernelingests = min(nframestoingest - navg*npp*get_global_id(2), navg*npp); <built-in>:3569:27: note: candidate function double16 __overloadable__ min(double16, double16); ^ <built-in>:3568:26: note: candidate function double8 __overloadable__ min(double8, double8); the error output continues more lines different types. when tried isolate problem, get_global_id(2) appears problem. thought casting get_global_id(2) int uint (i believe returns uint) solve problem doesn't. know going on? looked @ 1.0 , 1.1 specs , still confused why happening. the opencl 1.0 , 1.1 specifications define min have following function signatures: gentype min (gentype x, gentype y) gentype min (gentype x, sgentype y) as such, arg...

iphone - UINavigationController Title not Applied -

i wondering why uinavigationcontroller not letting me set title. lets me change tint of navigationbar, title , rightbarbuttonitem set ignored. why? here's code: taps = 0; uiview*controllerview = [[uiview alloc] initwithframe:cgrectmake(0, 0, 320, 480)]; controllerview.backgroundcolor = [uicolor whitecolor]; controller = [[uiviewcontroller alloc] init]; [controller setview:controllerview]; [controllerview release]; navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:controller]; navcontroller.navigationbar.barstyle = 1; navcontroller.navigationitem.title = @"setup"; uibarbuttonitem*item = [[uibarbuttonitem alloc] initwithtitle:@"done" style:uibarbuttonsystemitemdone target:self action:@selector(dismisssetup:)]; navcontroller.navigationitem.rightbarbuttonitem = item; [item release]; [self presentmodalviewcontroller:navcontroller animated:yes]; [mp stop]; p.s: know i'm not releasing of st...

Is it possible to pass a parameter to trigger in SQL Server database? -

table can have trigger on insert/delete/update. trigger fired internally db engine. is possible pass parameter trigger in sql server database stored procedure? indirectly via context_info() . see using session context information . fact trigger needs state code smell.

Oracle Import Export compatibility matrix -

is there official matrix explain how export dump format done specific version, or not compatible others? i mean fill grid: exp done version: | 7 | 8i | 9i | 10g | 11g compatible imp 7 |yes | no | no | no | no 8i|yes |yes | no | no | no 9i|yes |yes |yes | no | no 10g|yes |yes |yes | yes | no 11g|yes |yes |yes | yes | yes i known there many specific thinks between yes , no. i need oracle official clear sentence this: "oracle allways support back-ward compatibility import old export dump format" please me metalink 132904.1 compatibility matrix export , import between different oracle versions document you're looking for. i doubt oracle has ever made commitment supported. example, regular export command being desupported in 11g in favor of datapump version, uses different file format. old export utility around while, wouldn't assume 1...

How to auto-open file in iPhone Mail into iphone application? -

i working on adding capability users export data iphone app. i'd allow them email or friend. there way enable iphone mail app auto-open specific type of file specific app? know somehow create specific url open such myapp://www.google.com auto-open app, can done attached file? thanks! take @ answer: data exchange between same iphone app on separate devices

ExtJS TextField values submitted as a string instead of integer/number -

i have ext editor grid numbercolumn. column's editor set ext.form.textfield. grid populated json , data submitted json. my problem when user enters number in column, sent string instead of number. in other words, looks property: "500" , want this, property: 500 . my column definition: new ext.grid.numbercolumn ({ header: 'area (ha)', dataindex: 'area', format: '0', width: 60, editor: new ext.form.textfield({ allowblank: false }) }) and field definition column: { name: 'area'} i've tried nothing: { name: 'area', type: 'int' } any ideas? thanks! found resolution. apparently there's ext.form.numberfield. it's not listed in extjs documentation, had search it.

ASP.NET MVC: add new SQL Server database gives login failed error -

i'm getting started asp.net mvc. i'm following nerddinner tutorial (http://tinyurl.com/aspnetmvc). on page 20 of pdf. i adding new sql server database project, , confirming want add .mdf file app_data folder (from prompt "do want place file in app_data folder?"). after clicking "yes" error message "login failed user video\webmaster", single ok button. note database not yet exist , supposed created after click yes. i using visual web developer 2010 express on windows xp. login (webmaster) has admin rights. @ point have not written code @ all. any ideas problem be? thanks in advance, -asrar you should have sql server express installed well. if not, install it. if is, not sure problem is. have vs 2008 , when right click on app data folder, add -> new item, pick sql server database , give name, database opens right up. vs 2008 not prompt "do want place..." good luck. started mvc year ago on nerd dinner :) ...

Redirect stdout and stderr to file in Django with wsgi -

i'm trying make django work wsgi in shared hosting, cannot access server logs, i'm trying redirect output file in django.wsgi script, this: saveout = sys.stdout log_out = open('out.log', 'w') sys.stdout = log_out but error have (in error log can access) [thu oct 07 19:18:08 2010] [error] [client <ip>] file "/home/myuser/public_html/django.wsgi", line 9, in <module> [thu oct 07 19:18:08 2010] [error] [client <ip>] mod_wsgi (pid=30677): exception occurred processing wsgi script '/home/myuser/public_html/django.wsgi'. and error can get line 9 1 tries open file. i've tried creating file, giving writing access everyone, without file created.. , nothing. in app, 500 server error. is there proper way output without access apache logs? edited: using absolute paths, can open files , write them, empty files unless close files in end, necessary? leave files open?.. regarding initial problem, though used e...

Creating a System Call in Linux -

we got midterm project today "operating systems" course, requested implement system call (and guess assume we'll have write piece of code call it). i understand i'll need update table of system calls (can't remember name, no biggie), create kernel module table point to, mean i'll have recompile whole kernel, kernel knows module? i have seen it's possible hijack current system call, suspect won't credit assignment if way. just wanted feel size of effort i'll making. update: kinda ended being hassle, change things believe 2.6.32 forward, when went previous kernel version specific tutorials online found, easy follow. if catches online , following tutorial, recommend downloading same kernel in tutorial initially, move forward there once have understanding of you're doing. if you're familiar compiling kernels, etc, might not have issue, first time compiling kernel, pain compile 2 hours , find out didn't work, , have on again, whe...

c# - Implement a "cancel" button on forms that use databinding and nhibernate -

i use nhibernate access mysql database, , have many -winforms- forms using databinding modify properties of objects. there many –nhibernate- objects created/deleted during time forms used. i need implement "cancel" button on forms. i can defer creation/deletion of objects on database (nhibernate’s session.save/delete) moment form closing. don’t know changing of loaded objects’ properties directly user ( changed winforms databinding ) or adding/removing of objects related objects collections. i’m not nhibernate expert @ all. there way mark a referenced object “not loaded yet”, force refresh db next time referenced in way (collections , properties) without losing reference (kind of return reference proxy object initial state, before first load db)? i’m not winforms expert @ neither. how can know objects changed through databinding? i guess simple approach use inotifypropertychanged on entities , inotifycollectionchanged or use collection implements it....

iphone - UISplitViewController not showing right view? -

i making app 3.2 started trying new sdk 4.2beta2 , app not shows right view. black. i checked , splitviewcontroller indeed loading right controller , object on memory not shown. wonder if has experienced same problem and/or start looking @ since seems fine. thanks in advance ignacio.

CSS background image rendering differently on iPhone -

we have page design works great in every pc browser have tried, goes strange when viewed iphone or ipod touch. the problem centred background image thats tall: #content_container { background-image:url('content-background.jpg'); background-position:top center; background-repeat:no-repeat; width:1020px; height:auto; } the content-background.jpg image tall (3000 pixels) , designed 'revealed' div in grows due content. you'll have @ page , full css understand, i've stripped else out of design , re-produced problem example: http://files.codeulike.com/static/cssexample/example.htm (example made of 1 html file, 1 css file , 3 images) you'll see in ie8, firefox, chrome you'll nice green box. in ios browser long thin background image gets re-scaled , goes odd. (i'm using ipod touch 2nd gen assume same problem happen in other iphones/ipod touches). any appreciated! figured out: iphone has megapixel limit jpegs, after shrinks jpe...

linux - utf-8 file displays doubled characters -

Image
a generated utf-8 file displays in terminal: but not in firefox or gedit: it looks characters doubled weird ones? the file: http://maestric.com/shared/other/2004_10_14.txt any idea on wrong it? it seems utf-16. sure locale , terminal in utf-8 ? did try " od " on file, or see in hex viewer? never trust terminal, must @ bytes sure. eg # od -c -x 2004_10_14.txt | head 0000000 \0 h \0 e \0 u \0 r \0 e \0 \0 d \0 e 4800 6500 7500 7200 6500 2000 6400 6500 0000020 \0 \0 d \0 303 251 \0 b \0 u \0 t \0 \0 2000 6400 c300 00a9 0062 0075 0074 0020

How to handle no results in LINQ? -

in example code public company getcompanybyid(decimal company_id) { iqueryable<company> cmps = c in db.companies c.active == true && c.company_id == company_id select c; return cmps.first(); } how should handle if there no data in cmps ? cmps will never null , how can check non existing data in linq query ? so can avoid this 'cmps.tolist()' threw exception of type ... {system.nullreferenceexception} when transforming into, example, list getcompanybyid(1).tolist(); do always need wrap in try catch block? you can use queryable.any() (or enumerable.any() ) see if there member in cmps . let explicit checking, , handle wish. if goal return null if there no matches, use firstordefault instead of first in return statement: return cmps.firstordefault();

asp.net mvc - IsessionFactory Issue -

i getting classic "object reference not set instance of object" error on line httpcontext.items["isession"] = configure.getsessionfactory().opensession(); my configure.cs file follows using system; using system.collections.generic; using system.linq; using system.text; using fluentnhibernate.cfg; using fluentnhibernate.cfg.db; using nhibernate; namespace forsale.domain.nhibernate { public static class configure { private static isessionfactory _sessionfactory; public static void setup() { _sessionfactory = fluently.configure() .database(mssqlconfiguration.mssql2008.connectionstring(cs => cs.fromconnectionstringwithkey("products") ).showsql()) .mappings(m => m.fluentmappings.addfromassemblyof<product>().conventions.addfromassemblyof<product>()) .buildsessionfactory(); } public static isessionfactory getsessionfactory() { retur...

css - Storing dimensions in xml file in Android -

i trying consistently use same dimension in views in android app (e.g., left margin of 20dp). if using html, use css file, @ loss of how on android. is there way can store value in xml file inside res/values , use in layouts? e.g., thought of storing them in strings.xml like <string name="app_wide_left_padding">20dp</string> and using following text in layout.xml android:paddingleft="@string/app_wide_left_padding" but not sure work. on right track? thanks in advance answers. create file called res/values/dimens.xml <?xml version="1.0" encoding="utf-8"?> <resources> <dimen name="icon_width">55dip</dimen> <dimen name="icon_height">55dip</dimen> <dimen name="photo_width">170dip</dimen> <dimen name="photo_height">155dip</dimen> </resources> then reference them in other xml: android:padd...

jquery - How to make div item stack -

i have following code works fine trying items stack when moved boxa. how go that? $(function () { $("#sortable").sortable(); $("#boxa").droppable({ activeclass: 'ui-state-hover', hoverclass: 'ui-state-active', drop: function (event, ui) { $(this).addclass('ui-state-highlight').find('p').html('dropped!'); find('li').children().remove(); } }); <div id='main_content'> <ul id="sortable"> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4</li> <li>item 5</li> </ul> <div id='boxa' class='contentboxes'> <div class='contentmenu'>column a</div> <p>drop item on me.</p> </div>​ from small amount of code you'v...

Installing Compass & Sass on Dreamhost -

i going compass , sass on dreamhost webspace. unfortunately not part of provided standard gems installation appears more complicated. have hands on experience installing , running compass , sass on dreamhost? i'd appreciate guidance. i facing similar challenge - installing sass/compass on dreamhost shared account - able figure out how it. used these instructions installing own copy of rubygems (although i'm not sure necessary). used following 2 commands install sass , compass: gem install sass gem install compass it went pretty smoothly.

thread safety - Are C++ template-functions threadsafe? -

googling don't find anything. created @ point of use, or generic parts shared between instances? (same template classes?) template functions created @ compile time. template property orthogonal thread-safety.

Non-blocking modal Swing progress dialog -

a daft question, cannot work: have long-running process in swing application may take several minutes. want display progress dialog user while process ongoing. want prevent user performing further actions, eg pressing button while process going on. if process on edt, prevents end-user doing while process going on. because edt busy processing, never gets around rendering dialog's content, outline of dialog. but if process in worker thread, end-user can click buttons , cause edt manipulate state worker manipulating @ same time, bad stuff consequence. if make dialog modal, not happen, modal in swing implies blocking , moment call setvisible(true) , thread blocks forever. so current "solution" use worker thread, , spawn off separate thread purpose absorb blocking nature of setvisible . surely there must better solution! so how dialog prevents user interacting rest of system (modal) not block thread causes visible? you should using glasspane preventing u...

nlp - Latest good languages and books for Natural Language Processing, the basics -

i fresh computer sc graduate , m roped software company. i've dreamed of career in robotics (not mechanical part processing part). pushed me towards nlp.. i starter , want know best path follow on. also, avid reader please don't mind suggesting tough options if it's nice option. thank you. the best language started in nlp any language like . java, ruby, python, , c++ have libraries natural language processing. though people here partial suggesting python nltk, can equally nlp library in opennlp java or stanford's javanlp , or lingpipe . , if c# forte, can use sharpnlp . one thing don't need special purpose language or paradigm prolog or lisp. prolog's logic paradigm backtracking seems natural thinking context-free grammars, in reality backtracking method parsing grammars slow compared the earley parser can implemented in imperative languages @ least can implemented in prolog. it's no easier learn grammar text in prolog. , lisp's ab...

iphone - Why iAd keeps showing "Testing Advertisement"? -

my app approved on appstore. in iad section of screen, keeps showing black "testing advertisement" apple instead of real ad. there configuration missed? thanks did here ? also, did test application on different device see if ad shows there correctly?

installation - How to interpret full programs in Ready Lisp? -

i've downloaded ready lisp , playing around repl. want know is, how write long program, interpret , output? sort of plt scheme has. i'd minimal amount of hassle if that's possible. want on book i'm reading. thanks. common lisp provides functions load , compile-file . load load lisp textual source code or compiled files , execute those. printing done go usual output streams. compile-file allows generate compiled file file lisp source code. has advantage programs typically running faster when using file compiler , compiler checking , might give optimization hints. many implementations generate native machine code. file generated compile-file can loaded load. note in common lisp 1 uses running lisp compile , load code. in plt scheme model used each 'start' code gets executed in fresh scheme. may beginners, waste of time writing larger software.

xbase - How to connect to foxpro db using XbaseJ -

i want fetch data fox pro data base , insert mysql. purpose using xbasej . how can connect foxpro data base using xbasej . thanks have tried xbasej sample code ? /** **/ package org.xbasej.examples; /** * @author joseph mcverry * */ import org.xbasej.*; import org.xbasej.fields.charfield; import org.xbasej.fields.logicalfield; import org.xbasej.fields.numfield; public class example2 { public static void main(string args[]){ string dow[] = {"sun", "mon", "tue", "wed", "thu", "fri", "sat"}; try{ //open dbf file dbf classdb=new dbf("class.dbf"); //define fields charfield classid = (charfield) classdb.getfield("classid"); charfield name = (charfield) classdb.getfield("classname"); charfield teacher = (charfield) classdb.getfield("teacherid"); charf...

php - Piacasa Api error Invalid Token -

hi using google gdata api in php. getting error "error: expected response code 200, got 403 token invalid - authsub token has wrong scope" . what should do. what's solution. you're using wrong base url queries. correct base url picasa web albums http://picasaweb.google.com/data/

actionscript - Proxy script in PHP to circumvent missing crossdomain.xml - missing minor tweaks -

1st background - see, i'm not trying malicious: have flash app in russian social network vkontakte.ru displays user avatars. until .swf file has been hosted @ domain, fetching , scaling avatars worked well. now i'd switch app iframe-type, .swf hosted @ domain , i'm not able scale avatars in .swf anymore: neither domain, nor "*" listed in http://vkontakte.ru/crossdomain.xml , .swf can download , display avatars, can't scale them anymore (accessing myloader.content throws securityerror). i've decided write proxy script in php fetch image specified in scripts ?img= parameter , pass stdout (after checks , without storing anything): <?php define('max_size', 1024 * 1024); $img = $_get['img']; if (strpos($img, '..') !== false || !preg_match(',^http://[\w.]*vkontakte\.ru/[\w./?]+$,i', $img)) exit(); $opts = array( 'http'=>array( 'method' => 'get', ...

build process - ld linker question: the --whole-archive option -

the real use of --whole-archive linker option have seen in creating shared libraries static ones. came across makefile(s) use option when linking in house static libraries. of course causes executables unnecessarily pull in unreferenced object code. reaction this plain wrong, missing here ? the second question have has read regarding whole-archive option couldn't quite parse. effect --whole-archive option should used while linking static library if executable links shared library in turn has (in part) same object code static library. shared library , static library have overlap in terms of object code. using option force symbols(regardless of use) resolved in executable. supposed avoid object code duplication. confusing, if symbol refereed in program must resolved uniquely @ link time, business duplication ? (forgive me if paragraph not quite epitome of clarity) thanks there legitimate uses of --whole-archive when linking executable static libraries. 1 example ...

override isEqual Objective-C -

my class @interface sample:nsobject{ double x; double y; } @property double x; @property double y; -(sample *)initwithx: (double)x andy:(double) y; @implementation @synthesize x,y -(sample *) initwithx: (double)x andy:(double)y{ self = [super init]; if(self) { self.x = x; self.y = y; } return self; } -(bool)isequal:(id)other{ if(other == self) return yes; if(!other || ![other iskindofclass:[self class]]) return no; return [self isequaltosample:other]; } -(bool)isequaltosample:(sample *) other{ if(self == other) return yes; if (!([self x] ==[other x])) return no; if (!([self y] ==[other y])) return no; return yes; } at return [self isequaltosample:other]; shows warning: 'sample' maynot respont '-isequaltosample'. return makes integer pointer without cast. unrelated warning, when overriding -isequal: must override hash such if [a isequal: b] [a hash...

ruby on rails - Resque Scheduler plugin for the scheduled job not working -

i using plugin scheduled job.but not working. confused points,should need create job class , set name in schedule file?when testing then,should run rescue scheduler , resque worker both or 1 of them. thanks in advance. my resque scheduler config... need these pieces: yml file (config/resque_scheduler.yml): every_1_minute: cron: "* * * * *" class: everyminute queue: some_queue description: tasks perform every minute config/initializers/resque.rb: require 'resque_scheduler' resque.schedule = yaml.load_file(file.join(rails.root, 'config/resque_scheduler.yml')) ruby class (lib/every_minute.rb or somewhere in load path): class everyminute def self.perform puts "hello every minute!" end end you need run rake resque:scheduler rake resque:work the resque:scheduler process periodically queues jobs, hence scheduling. , workers jobs blindly. why need both schedule , run jobs periodically.

filter - Combine files on commit in Mercurial -

i've got project 2 files want source-control using mercurial: a scx-file binary (database) file a sct-file text file my filter: [encode] **.scx = tempfile: sccxml infile outfile 0 [decode] **.scx = tempfile: sccxml infile outfile 1 problem sccxml receives path scx-file the scx-file can not converted text-file without corresponding sct-file workarounds is possible combine files before filter runs? is possible pass both file's paths sccxml-converter? update: no, i'm using not using win32text extension. sccxml-executable needs both sct-file , scx-file parameter convert them text-file (the text-representations of both files tar'ed 1 file). i want have binary files text-file in repo, meaningful diffs. trying achieve using precommit hook.

android - Application design help -

i want create sports application contains following. tabhost 3 main categories. (news, tables, live score) the news category have 2 sub categories. (team news, league news) tables have 3 sub categories. (table, stats, schedule) live score listactivity. how should design this? should main categories separate activities? should sub categories activities or views? if sub categories views guess have keep track of view current update/display proper information. also how switch between views? lets want go view 1 3? using viewflipper can go next 1 step @ time. thanks! should main categories separate activities? no, since on screen @ 1 time (single tabhost). @ most, 4 activities: 1 tabhost , 1 each tab, on record opposing use of activities contents of tabs. should sub categories activities or views? it impossible make them activities. if sub categories views guess have keep track of view current update/display proper information. when data cha...

linux - Writing to a file in a directory that belongs to a different user using php -

i have server hosts several domains. 1 of domains, using php script want able append few lines .htaccess of other domains. for example masterdomain.com want append lines .htaccess of otherdomain.com. php file in /home/masterdomain/www/ want append few lines .htaccess located @ /home/otherdomain/www. to have written shell script, when run shell script root, works when running via php, exec('./write_htaccess.sh') it's not working, nothing happends. checked , there no errors returned. i have tried chmod u+s on write_htaccess.sh try , make run root each time didn't work either, might have set s bit wrongly though. how achieve this? have give php root priviledges, best way this? php being run whichever user web server running under; i'm guessing when server mean web server. on red hat or fedora apache (unless you're using different web server), other flavors of linux might use www or other user. when run shell script php it's being execute...

text - Can a TextEncoding be converted to a String? -

it possible convert string textencoding using mktextencoding :: string -> io textencoding is there way do reverse? or, given textencoding, way find out information encoding? there doesn't seem eq instance textencoding allow comparing against defined encodings in system.io. am missing something, or there technical reason why should not possible? textencoding member of show class in ghc 7.0.1. see ticket #4273 .

sql server - Can I: loop through sql select and then fire off for each loop? -

i'm missing (looking @ long), in stored procedure can select distinct values 1 table , each loop based on each of returned rows, build sql statements based on distinct values? cheers. yes, can use cursor . note cursors best avoided if possible. if it's possible need set-based query -- , -- should instead.

powershell - Trouble scripting inputs for set-Umserver cmd let -

i've writing exchange 2010 unified messaging automation scripts. i'm trying automate assoication of um dial plans um servers. powershell command : [ps] e:\scripts>set-umserver -id exchange01 -dialplans "test1", "test2" when try following scripting solution: [ps] e:\scripts>$str = "`"test1`", `"test2`"" [ps] e:\scripts>set-umserver -id exchange01 -dialplans $str i error: the um dial plan "test1", "test2" doesn't exist. + categoryinfo : notspecified: (0:int32) [set-umserver], managementobjectnotf + fullyqualifiederrorid : 7af43aa1,microsoft.exchange.management.tasks.um.setumserver my feeling i'm handling variable incorrectly , variable swapping in ""test1", "test2"" rather "test1", "test2". any guidance appreciated. regards jon you're overworking it. :-) try this: $str = "test1", "tes...

Python to javascript communication -

ok im using websockets let javascript talk python , works data need send has several parts array, (username,time,text) how send ? though encode each 1 in base64 or urlencode use character | encoding methods never use , split information. unfortunately cant find method both python , javascript can both do. so question, there encoding method bath can or there different better way can send data because havent done before. (i have ajax requests , send data url encoded). im not sending miles of text, 100bytes @ time if that. thankyou ! edit most comments point json,so, whats best convert use javascript because javascript stupidly cant convert string json,or other way round. finished well jaascript have native way convert javascript string, hidden form world. json.stringify(obj, [replacer], [space]) convert string , json.parse(string, [reviver]) convert back use json module (or simplejson prior python 2.6). you'd need remember 2 functions: json.dumps , json.loa...

asp.net - VS 2010 Crystal Report -

i have table in ms-sql obm_feetable feeid int, franchieid int, amount money, chequeno int, bankname nvarchar(200), paymentdate datetime when want display collection in crystal report don't show amount / paymentdate when creating report, don't know why doing this. please why doing this. how use linq crystal report. thanks have modified table add these fields? if so, perhaps crystal doesn't know them yet. fix this, right-click inside report, select "database" -> "log on or off server...". open "current connections" item , select 1 table lives. click "log off" button , "log on" button. refresh crystal's view of database objects, , missing fields should appear. another possibility login using access table doesn't have 'select' permission on thos columns. i don't think linq applicable crystal, different question. should post separately more detail on want do.

visual web developer - Asking for good ASP.NET MVC 2 resources -

since it's trivial rails crawls on windows, i'm going try , play ms's asp.net mvc 2, recommendation resources should reading (ebooks/books preferred, tutorial websites fine too) ? by way programming skills beginner - intermediate. thanks lot guys. sanderson's book http://www.amazon.com/asp-net-framework-second-experts-voice/dp/1430228865/ref=sr_1_1?ie=utf8&qid=1286544141&sr=8-1 good. have used both editions of book mvc1 , mvc2 , has been great. he job starting off basic , getting more complicated. there big case study build go through book.

concurrent execution of event handlers in jquery -

i have horizontal menu in website, , each item in menu have image , sub menu.i write event handler hover. should hide visible sub menu , images before show right image menu. problem when switch between 2 menus rapidly first 1 become visible after handler second 1 execute hide images. , result both images become visible. mess! here code , need prevent execution of function before fadein or slidedown completed. here js code: $(function() { $("#primary-menu li").hover(function(){ if($("#image-menu-"+mlid).is(":visible")) return // hide previous image $("#sub-menu div").hide() $('#menu-image img').hide(); var attr = $(this).attr('class'); var mlid = attr.substr('5'); var index = $("#primary-menu li").index(this); $("#image-menu-"+mlid).fadein(600); if($("#div-"+mlid).length) $(...

ruby on rails - Using RSpec, how to verify from tags and link tags in view pages? -

in view pages, people use form tag helpers , link helpers etc. if rename controller, or action, view pages may break. how can unit test view related tags kind of breakage? so term "unit test" reserved tests test 1 piece of application @ time-- test 1 view , test independently of associated controller , model. but have found, if isolate tests, can break interaction between 2 , still have unit tests passing. that's why it's important have tests exercise whole application working together. these called functional, integration, or acceptance tests (i don't find useful distinguish between these terms ymmv). this done using browser simulator capybara or webrat using application how user in browser. demand different techniques unit tests do, don't end brittle tests or tests take long time run without providing additional value time spent. you can use various test frameworks drive capybara, including rspec. many people use rspec unit tests , u...