Posts

Showing posts from June, 2015

sql - show data in my android app(saving works just fine now) -

hey, can save data in db, doesn't show in database activity itself. @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); oncreatedbanddbtabled(); //db und tables erstellen wenn noch nicht vorhanden setcontentview(r.layout.main); } private void oncreatedbanddbtabled() { mydb = this.openorcreatedatabase(my_db_name, context.mode_private, null); mydb.execsql("create table if not exists " + my_db_table + " ( id integer primary key autoincrement,"+ "name varchar(100),"+ "comment varchar(128),"+ "bookingdetails varchar(255),"+ "customerproject integer(3),"+ "editable varchar(15))" +";"); } public boolean oncreateoptionsmenu(menu menu) { super.oncreateoptionsmenu(...

string - Excel conversion of US date (text) to european date (date) -

i pasting data webpage excel sheet. european excel cannot understand american dates.... paste text. the difference between , european dates day , month in different order. how "us text date" real date "european" excel can understand? reading dates doesn't work, year(), month(), day() not work on native textstring. string conversion must done first. the third column to show problem. result af month function called on text in column "a". taking day month , therefore throws error when reaching 13th of september. text (from web) eu date (real date) month(a1) 9/8/10 10:03 pm 8. sep 2010 8 9/9/10 10:03 pm 9. sep 2010 9 9/10/10 10:03 pm 10. sep 2010 10 9/11/10 10:03 pm 11. sep 2010 11 9/12/10 9:40 pm 12. sep 2010 12 9/13/10 9:40 pm 13. sep 2010 error 9/14/10 9:40 pm ...

c++ - Boost bind with asio::placeholders::error -

why doesn't work? --- boost_bind.cc --- #include <asio.hpp> #include <boost/bind.hpp> #include <boost/function.hpp> void func1 (const int& i) { } void func2 (const ::asio::error_code& e) { } int main () { ::boost::function<void()> f1 = ::boost::bind (&func1, 1); // doesn't work! ::boost::function<void()> f2 = ::boost::bind (&func2, ::asio::placeholders::error); return 0; } this error: while_true@localhost:~> g++ -lpthread boost_bind.cc -o boost_bind in file included boost_bind.cc:2: /usr/include/boost/bind.hpp: in member function ‘void boost::_bi::list1::operator()(boost::_bi::type, f&, a&, int) [with f = void (*)(const asio::error_code&), = boost::_bi::list0, a1 = boost::arg (*)()]’: /usr/include/boost/bind/bind_template.hpp:20: instantiated ‘typename boost::_bi::result_traits::type boost::_bi::bind_t::operator()() [with r = void, f = void (*)(const asio::error_code&), l = boos...

visual studio - MsgProc never receive WM_ messages? -

i had program worked fine , trying make updates now. seems no more receive windows message, wm_lbuttondown or wm_setcursor (wm_create called). don't know what's problem. this layered window created that: wc.cbsize=sizeof(wndclassex); wc.style=cs_classdc; wc.lpfnwndproc=msgproc; wc.cbclsextra=0l; wc.cbwndextra=0l; wc.hinstance=getmodulehandle(null); wc.hicon=null; wc.hbrbackground=null; wc.lpszmenuname=null; wc.lpszclassname="myapp"; wc.hcursor=hmain; registerclassex( &wc ); // create application's window hwnd = createwindowex(ws_ex_layered|ws_ex_topmost, "myapp", "myapp", ws_popupwindow|ws_thickframe|ws_minimizebox|ws_maximizebox, 10, 10, desiredwidth, desiredheight, getdesktopwindow(), null, wc.hinstance, null ); i developping under visual studio express 2008 on windows 7 x64 (i started program on win7 x86) thanks the window isn't visible. add ws_visible style...

javascript - Show|Hide Div depending on show DropDownList -

i know thing simple how show div on specific listitem ? my code is: <asp:dropdownlist id="dropyesno" runat="server"> <asp:listitem text="choose..." value="-1"></asp:listitem> <asp:listitem text="yes" value="1"></asp:listitem> <asp:listitem text="no" value="0"></asp:listitem> </asp:dropdownlist> later on have div: <div id="optional"> <p>please enter reason</p></br> <asp:textbox id="_refuse" runat="server" textmode="multiline" /> </br> </div> this div css hidden default. want when user chooses "no" on drop down,the div appear. know it's done javascript, didn't understand how it. thank you. p.s. i have little related question, if have table in sql db lets call users, , has name , id columns. how load entire columns drop ...

python - Two-way querying in Django without circular reference -

let's have 2 models: post , category . each post has category_id . getting post's category straightforward: post.category . if want posts category? suppose do def posts(self): return post.filter(category__pk=self.id) but if post model , category model in separate files? because post , category require each other, end circular reference. maybe solution put post , category same file. if app has 50 different models, many of them quite large, in separate files? should combine post , category 1 file , leave others separate? should combine 50 models 1 gigantic file? i'm hoping find 1 of 2 things: an answer problem doesn't involve combining files a good, logical reason grouping models same file 1 another. models related extent, draw line far grouping goes? if draw line foreign keys, models end in same file. you can refer models name (i.e., string) rather actual object. in separate applications? in case can refer them using dot notation...

java - Hibernate link between 2 persistence units? -

my question bit tricky try make simple possible: i have 2 maven projects: projeta , projectb. projecta has following persistence.xml file: <persistence-unit name="projectaunit" transaction-type="resource_local"> <class>com.projecta.client</class> <class>com.projecta.interventiona</class> </persistence-unit> interventiona has onetoone relationship client entity. projectb has following persistence.xml file: <persistence-unit name="projectbunit" transaction-type="resource_local"> <class>com.projectb.interventionb</class> <class>com.projectb.interventionorder</class> </persistence-unit> interventionb extends interventiona class (contained in .jar dependency): all 3 classes interventiona, interventionb , client defined in same mysql schema (schema1). but interventionb has @onetoone relationship interventionorder entit...

Boost serialization stamp? -

when try serialize object data why 22 serialization::archive 7 in serialized data? how rid of it? a bit late perhaps, looking same thing here goes =) you should take @ no_header flag documented here , used this: using namespace boost::archive; std::stringstream stream; text_oarchive archive(stream, no_header); archive << object; i'm assuming text archives here judging question same works other archive types. obviously 1 should consider before using since self-documenting property of archive largely lost modest saving in space...

I'm building a javascript app, I need a lightweight php script to interact with a database and javascript using json -

my app complex game uses json objects store execution state (aka save games). i'm looking nice database script can talk json , interact javascript via ajax. you mean http://www.persvr.org/ ?

iis 7.5 - Routing problem with particular controller name using ASP.NET MVC 1 in IIS 7 -

i have joined team developing asp.net mvc version 1 application. run app on local machine using iis version 7.5. operating system windows server 2008 r2 enterprise edition. use visual studio 2008 sp1 development. one of controllers in app called reportscontroller. route table entries controller use 'reports' controller name part. problem have that, using iis 7.5 on local machine, cannot access of reports action methods. if try access, say, '/reports/index' chrome or firefox, 401 unauthorized response (as seen using fiddler) , browser displays username/password entry dialog. please note following: all other non-report pages in application work correctly. if add breakpoint application_beginrequest, not hit when requesting reports page. if change reports routing entries in route table registration code have access paths '/reportss/index' (note 's') these reports pages work correctly. i have tried deleting recreating web application in ...

c# - How to get all namespaces inside a namespace recursively -

to put simple, want namespaces in project recursively, , classes available in namespaces found earlier. var namespaces = assembly.gettypes() .select(ns => ns.namespace); i using part earlier namespaces in string format. got know underlying namespaces well. it sounds might want lookup namespace class: var lookup = assembly.gettypes().tolookup(t => t.namespace); or alternatively (and similarly) use groupby : var groups = assembly.gettypes().groupby(t => t.namespace); for example: var groups = assembly.gettypes() .where(t => t.isclass) // include classes .groupby(t => t.namespace); foreach (var group in groups) { console.writeline("namespace: {0}", group.key); foreach (var type in group) { console.writeline(" {0}", t.name); } } however, it's not entirely clear whether that's you're after. classes in each namespace, don't kn...

Execute javascript on IIS server -

Image
i have following situation. customer uses javascript jquery create complex website. use javascript , jquery on server (iis) following reasons: skills transfer - use javascript , jquery on server , not have use eg vb script. / classic asp. .net framework/java etc ruled out because of this. improved options search/accessibility. able use jquery templating system, isn't viable search engines , users js turned off - unless can selectively run code on server. there significant investment in iis , windows server, changing not option. i know can run jscript on iis using windows script host, unsure of scalability , process surrounding this. unsure whether have access dom. here diagram explains situation. wondering if has done similar? edit: not looking critic on web architecture, wanting know if there options manipulating dom of page before sent client, using javascript. jaxer 1 such product (no iis) thanks. have @ bringing browser server , rhino , , use micros...

.net - What's the fastest Serialization mechanism for c#? -

this small payloads. i looking achieve 1,000,000,000 per 100ms. the standard binaryformatter slow. datacontractserializer slow binaryformatter. protocol buffers ( http://code.google.com/p/protobuf-net/ ) seems slower binaryformatter small objects! are there more serialization mechanisms should looking @ either hardcore coding or open source projects? edit: serializing in-memory transmitting payload on tcp on async socket. payloads generated in memory , small double arrays (10 500 points) ulong identifier. your performance requirement restricts available serializers 0. custom binarywriter , binaryreader fastest get.

python - Use Twisted's getPage as urlopen? -

i use twisted non-blocking getpage method within webapp, feels quite complicated use such function compared urlopen. this example of i'm trying achive: def web_request(request): response = urllib.urlopen('http://www.example.org') return httpresponse(len(response.read())) is hard have similar getpage? the thing realize non-blocking operations (which seem explicitly want) can't write sequential code them. operations don't block because don't wait result. start operation , return control function. so, getpage doesn't return file-like object can read urllib.urlopen does. , if did, couldn't read until data available (or block.) , can't call len() on it, since needs read data first (which block.) the way deal non-blocking operations in twisted through deferreds , objects managing callbacks. getpage returns deferred , means "you result later". can't result until it, add callbacks deferred , , deferred call t...

Check Gmail IMAP via PHP for new messages in a loop -

i studying application trigger php script based on new imap emails arriving on gmail. what's best way know new email has arrived on gmail imap account? can't think of configure cron job. running php + nginx on linux (ubuntu) box. i found out that's way celular companies developers doing verify clients gmail. well, start making connection normaly, then: $t1=time();//mark time in $tt=$t1+(60*1);//total time = t1 + n seconds do{ if(isset($t2)) unset($t2);//clean @ every loop cicle $t2=time();//mark time if(imap_num_msg($imap)!=0){//if there message (in inbox) $mc=imap_check($imap);//messages check //var_dump($mc); die;//vardump see data possible imap_check() , them customize }else echo 'no new messagens'; sleep(rand(7,13));//give google server breack if(!@imap_ping($imap)){//if connection not //start imap connection normal way did @ first } }while($tt>$t2);//if total time not achivied yet, be...

c# - How to get all methods from WCF service? -

how list of methods wcf silverlight enabled service code. i have added service reference silverlight application. can methods using reflection? if can please provide me example. given type of service class use getmethods function list of methods through reflection: methodinfo[] methods = typeof(typeoftheservice).getmethods(); foreach (var method in methods) { string methodname = method.name; }

clientid - How should we use ClientIDMode property that comes with asp.net 4.0? -

how should use clientidmode property comes asp.net 4.0?... when should use 1 on other clientidmodes? rick strahl wrote nice article on topic : one of more anticipated features of asp.net 4.0 – @ least me - new clientidmode property, can used force controls generate clean client ids don’t follow asp.net’s munged namingcontainer id conventions.

svn - Subversion: merging files that have (temporarily) gone out of version control -

i find myself working people not particularly version control-savvy, following use case subversion useful, if knew magic words. i commit latest version, note revision r i email file off collaborator , carry on working, possibly committing more changes go when file collaborator, 3-way merge of changes r version working copy it seems branching etc bit heavyweight this, i'm open suggestions of ways job done. there simpler solution, should work: start working copy clean (i.e., no local changes) go revision r took note (maybe write somewhere in e-mail) copy collaborator's changed file on file in working copy@r update latest revision, merging changes in commit merged changes

java - Why are only some of my attributes shown in the response xml of jaxws? -

i created jaxws webservice, returns of attributes of objects in response xml. e.g. public class myobject { private string attribute1; private string attribute2; //getter , setter } but returned xml contains <soap:envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:body> <ns2:mynamespaceresponse xmlns:ns2="mynamespace"> <myobject> <attribute1>stringcontent</attribute1> </myobject> .... attributes null not shown in xml. in example, attribute 2 null, , therefore it's not shown.

objective c - Is assigning the same Action-method to multiple Cocoa UI objects e.g. NSButton possible? -

i'm learning objc , cocoa programming, coming java world. test current skills , learning progress i'm creating small calculator app scratch (osx not ios). my ui has 10 digit buttons 0-9 among others. my first thought was, since action receives senders reference, make 1 action -(ibaction)capturedigit:(id)sender , grab digit button title. interface builder allows action connected 1 sender seems. so ended creating 10 capturedigit actions in controller. my question: first option possible somehow? thought of adding actions programmatically (is possible?) buttons, have add digit buttons outlets controller. bonus question: can nsbutton hold kind of non visible value? not find in documentation. maybe violate mvc pattern ui know of application specific data? thanks useful , kind answer in advance, i'm still learning you can connect more more button single action. also, can use tag field of object give "behind scenes" value.

c# - Return type IResult<T> -

i try solve problem in wpf app mvvm design. need return on database access more "data": result messages return value and if database successful so create interface return type, here it: public interface iresult<t> { bool issuccess { get; set; } string resultmessage { get; set; } t returnvalue { get; set; } } this interface implements class: public class dbresult: iresult<ilist<archive>> { public bool issuccess{ get; set;} public string resultmessage{ get; set;} public ilist<archive> returnvalue { get; set; } } method in class on databases access have return type iresult<archive> , archive class generated linq sql.: public interface iarchivedbmanager { iresult<archive> loadconversationto(string nick, datetime todt); } [export(typeof(iarchivedbmanager))] public partial class archivedbmanager : iarchivedbmanager { public iresult<archive> loadconversationto(string nick, datetime t...

limit - Mysql-How to enforce the number of similar records retrieved? -

i working on website shows videos similar of youtube. website has section shows ten similar videos used full text search similar ones. select * , match (`title` , `description`,`videokey` ) against ('$keywords') score video match (`title` , `description`,`videokey` ) against ('$keywords') limit 10 the problem retrieves less 10 videos. in case, when there less 10 related videos, there way enforce have 10 videos there not related? if not, possible have 10 select query based on filed such category. how can best , quickest way possible? not - query needs evaluate conditional against candidate rows before has idea of how many rows returned, hence number of rows returned can't used an argument conditional in query. you 2 things (well, more, here two): simply perform second query in code, when result rows less 10. grab ten records in second query appended first query via union. http://dev.mysql.com/doc/refman/5.1/en/union.html in code, limit itera...

mongoDB mongoimport upsert -

i'm trying bulk update following mongoimport -d my_db -c db_collection -upsertfields email ~/desktop/update_list.csv the csv i'm trying import looks this. email, full_name stack@overflow.com,stackoverflow mongo@db.com,mongodb it should check email column query arg , update full name accordingly. however, none imported, encountered errors. exception:failure parsing json string near: abc@sa abc@sasa.com,abc imported 0 objects encountered 99398 errors where problem? how should doing it? your mongoimport command missing --upsert option, needed in combination --upsertfields. try: mongoimport -d my_db -c db_collection --upsert --upsertfields email ~/desktop/update_list.csv

c - Setting the first two bytes of a block of memory as a pointer or NULL while still accessing the rest of the block -

suppose have block of memory such: void *block = malloc(sizeof(void *) + size); how set pointer beginning of block while still being able access rest of reserved space? reason, not want assign 'block' pointer or null. how set first 2 bytes of block null or have point somewhere? this doesn't make sense unless you're running on 16-bit machine. based on way you're calling malloc() , you're planning have first n bytes pointer else (where n may 2, 4, or 8 depending on whether you're running on 16-, 32-, or 64-bit architecture). want do? if is, can create use pointer-to-a-pointer approach (recognizing can't use void* change anything, don't want confuse matters introducing real type): void** ptr = block; however, far more elegant define block struct (this may contain syntax errors; haven't run through compiler): typedef struct { void* ptr; /* replace void* whatever pointer type */ char[1] data; } my_struct; my_...

wpf - Performance of a semi transparent Window over multiple screens when moving a rectangle in realtime -

i've small app show semi transparent window on whole desktop. window isn't shown in taskbar , has not titlebar on window user can drag rectangle mouse. when mouse button released, screenshot of given area taken. (something snipping tool in windows 7) in order achieve this, window contains rectanglegeometry. now in compositiontarget.rendering event rectangle set location mouse when mouse down occured, sized cover area current mouse position. this works fine long 1 monitor connected. when second monitor higher resolution connected performance decreases dramatically. the resolution of laptop display 1600x1200 the display connected has 1900x1200 also when connecting display changed primary screen new one heres window definition <window x:class="mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="mainwindow"...

Silverlight - WCF get clientaccesspolicy on localhost -

i have silverlight application uses wcf communications server. both silverlight , wcf running on local machine (localhost). when silverlight makes call service fails aa communication exception. understand because don't have clientaccesspolicy file, since wcf endpoint running on http://localhost:port defined interface, ipolicyretriver, , added implementation service returning clientaccesspolicy in stream. my question is, have configure run without problem? understand have change or add servicereference.clientconfig file, don't understand what. i've included servicereference.clientconfig below. please let me know change or add it, , in silverlight add code. please not paste links here me have opened every link during last 2 days - still don't understand. <configuration> <system.servicemodel> <bindings> <basichttpbinding> <binding name="basichttpbinding_imapservice" maxbuffersize="2147483647"...

html - Extracting for value to use on label element? -

hi, label has attribute pointe editor example : <label for="modelviewad_title">titel</label> i building custom helper generating label , methodhead : public static mvchtmlstring labelfor<tmodel, tvalue>(this htmlhelper<tmodel> self, expression<func<tmodel, tvalue>> expression, boolean showtooltip) what easiest way extract value? or have manually build value? bestregards like this: public static mvchtmlstring labelfor<tmodel, tvalue>( htmlhelper<tmodel> self, expression<func<tmodel, tvalue>> expression, boolean showtooltip ) { var metadata = modelmetadata.fromlambdaexpression(expression, self.viewdata); var id = self.viewdata.templateinfo.getfullhtmlfieldid(metadata.propertyname); // id ... }

JQuery.ready is too late: How do I apply CSS Values with JQuery before Rendering? -

i want able apply opacity elements make them invisible only if javascript enabled . don't want use display:none because want layout act if they're in dom, setting opacity 0 perfect. i want able set initial value using javascript, using jquery, don't have mess browser differences on opacity (and many other) attributes. if set opacity 0 so: $(document).ready(function() { $("#header").css("opacity", 0); $("#header").animate({opacity:1}, 500); }); ...half time it's visible on screen, appears , disappears. how set these css values using jquery before ever can render? looking jquery solution don't have manually handle every browser implementation this: #header { -moz-opacity:.50; filter:alpha(opacity=50); opacity:.50; } just set opacity 0 in css file itself. cover scriptless, add following head: <noscript><style>#header { opacity: 1; }</style></noscript> update : since that...

Playing with bytes...need to convert from java to C# -

i not used manipulate bytes in code , have piece of code written in java , need convert c# equivalent : protected static final int putlong(final byte[] b, final int off, final long val) { b[off + 7] = (byte) (val >>> 0); b[off + 6] = (byte) (val >>> 8); b[off + 5] = (byte) (val >>> 16); b[off + 4] = (byte) (val >>> 24); b[off + 3] = (byte) (val >>> 32); b[off + 2] = (byte) (val >>> 40); b[off + 1] = (byte) (val >>> 48); b[off + 0] = (byte) (val >>> 56); return off + 8; } thanks in advance help, looking forward learn this. i appreciate know if there c# equivalent java function : double.doubletolongbits(val); edit : found answer second question : bitconverter.doubletoint64bits you can't have final parameters in c# methods "final" default. there no unsigned shift right in c# so get: protected static int putlong(byte [] b, int off, long va...

c# - Telerik mvc grid, Model Field to db field name relation -

i have telerik mvc grid. trying sorting work. binding grid model collection. model has different names fields data layer. when click sort button grid passes sort column name property name model binding. want set different name, have match data access layer. have done adding attribute properties of model specify related database field names. there similar in telerik's grid? have tried [column(name = "myname")] but seems ignored. not want configure grid in way know these names. ui layer should not aware of db layer's field names. there way can set within model? i not sure if understand trying do. example code help. being said try answer question. override name in method on controller using sort telerik grid. have same situation , don't have problem sorting. binding grid directly model , doesn't access data access logic @ all. telerik grid uses linq should sorting on collection , not have reconnect data access logic. have included ...

javascript - Action on jQuery Plugin Is Always Last Option? -

my plugin i'm writing right click context menu internal app, , can't figure out why happening. here testing code: $('.item').rightclickmenu([ { icon:'http://cdn1.iconfinder.com/data/icons/silk2/exclamation.png', title:'alert', action:function(){ alert('here example alert!'); } }, { icon:'http://cdn1.iconfinder.com/data/icons/silk2/error.png', title:'console.log', action:function(){ console.log('here example console.log()!'); } } ]); the relevant jquery plugin code is: for(x in items){ $list.append('<li class="rightclickmenuoption'+x+'"><img src="'+items[x].icon+'">'+items[x].title+'</li>') .find('.rightclickmenuoption'+x) .bind('click',function(){ items[x].action(); }); } demo: http://jsbin.com/uxali4/3/ this fix it: ht...

jquery - How to not use JavaScript with in the elements events attributes but still load via AJAX -

i loading html content via ajax. i have code things on different elements onclick attributes (and other event attributes). it work, starting find code getting rather large, , hard read. have read considered bad practice have event code 'inline' , should element.onclick = foobar , have foobar defined somewhere else. i understand how static page easy this, have script tag @ bottom of page , once page loaded have executed. can attach , events need them. but how can sort of affect when loading content via ajax. there slight case content loaded can depending on in database, times sections of html, such tables of results, not displayed there else entirely. i can post samples of code if body needs them, have no idea sort of things people one. point out, using jquery if has helpful little functions rather sweet! small code sample this sample of code loaded via ajax request <input type="submit" name="login" value="login" onclick=...

web services - Why use NuSOAP rather than PHP SOAP? Any benefits? -

as far have scourged web, can see abundance of articles on how setup nusoap , use setup soap server , client in php. however, none of them seem point advantages of using php's own native soap library. pros/cons between: nusoap php soap pear::soap zend soap php's soapclient class requires php5 or above. nusoap , pear soap run on php4. that's main difference. @ last check nusoap wasn't officially compatible php5. had find port put on google code in order run under php5. that's pretty it. although have run random weird wsdl parsing issues when using php's soapclient opposed nusoap. notably netenberg.com's licensing api. if running php5, you'll want use php's soapclient , save hassle of using external library

Copying visual studio 2010 installed extensions options to another computer -

i have visual studio 2010 installed , configured extensions @ home computer. want copy installed extensions settings home computer work computer, how can that? i can copy visual studio settings via import/export dialog not work extensions settings. visual studio extension settings stored in registry: hkcu\software\microsoft\visualstudio\<version>\dialogpage\<extension> if implement default extension settings mechanism. otherwise you'll have go individual extension website see store settings.

c# - Store a byte[] stored in a SQL XML parameter to a varbinary(MAX) field in SQL Server 2005. Can it be done? -

store byte[] stored in sql xml parameter varbinary(max) field in sql server 2005. can done ? here's stored procedure: set ansi_nulls on set quoted_identifier on go alter procedure [dbo].[addperson] @data xml insert persons (name,image_binary) select rowwals.value('./@name', 'varchar(64)') [name], rowwals.value('./@imagebinary', 'varbinary(max)') [imagebinary] @data.nodes ('/data/names') b(rowvals) select scope_identity() id in schema name of type string , imagebinary o type byte[]. should use string type imagebinary ? need specially encode string somehow ? assuming use base64 byte[] in xml, approach uses xquery described in following article should work: http://blogs.msdn.com/sqltips/archive/2008/06/30/converting-from-base64-to-varbinary-and-vice-versa.aspx

foreign keys - Why can't I SELECT a parent field that doesn't have a child? -

(rest_branches) table of restaurants. (phone_numbers) table contains restaurants phone_numbers, , has field called (branch_id) references restaurant id. when try: select * rest_branches natural join phone_numbers i restaurants have phone_number. should restaurants if don't have phone number? because that's how inner/natural joins work . if wanted restaurants, use left join instead , specify join condition.

scaleImage32 is throwing error out of memory when crossing bounds to 1800,1800 in blackberry -

encodedimage.scaleimage32 throwing error out of memory when crossing bounds 1800,1800. there work around same. public encodedimage sizeimage(encodedimage image, int width, int height) { encodedimage result = null; int currentwidthfixed32 = fixed32.tofp(image.getwidth()); int currentheightfixed32 = fixed32.tofp(image.getheight()); int requiredwidthfixed32 = fixed32.tofp(width); int requiredheightfixed32 = fixed32.tofp(height); int scalexfixed32 = fixed32.div(currentwidthfixed32, requiredwidthfixed32); int scaleyfixed32 = fixed32.div(currentheightfixed32, requiredheightfixed32); result = image.scaleimage32(scalexfixed32, scaleyfixed32); return result; }

c# - Is there something like boost::asio for .NET (Mono)? -

i need functionality of boost::asio::io_service in .net (c#) program. there library (microsoft or 3rd-party) has similar functionality? what need class/mechanism boost::asio::io_service lets me asynchronously invoke handlers. io_service can "post" handlers outside thread in handlers executed. i'm not familiar boost:asio, asynchronous i/o in .net via beginxxx/endxxx pattern. example, see stream.beginread , stream.endread .

c++ - Serializing struct containing char* -

i'm getting error serializing char* string error c2228: left of '.serialize' must have class/struct/union use std::string , const char* it. require char* string. the error message says all, there's no support in boost serialization serialize pointers primitive types. you can in store code: int len = strlen(string) + 1; ar & len; ar & boost::serialization::make_binary_object(string, len); and in load code: int len; ar & len; string = new char[len]; //don't forget deallocate old string ar & boost::serialization::make_binary_object(string, len);

objective c - How to decode base64-encoded <data> (CFData/NSData) property in a property list? -

i trying reverse-engineer preferences file (not nefarious purposes, can script usage of it) that, among other things, has arrays of coordinates stored within it. this salient snippet property list: <dict> <key>$class</key> <dict> <key>cf$uid</key> <integer>34</integer> </dict> <key>coordarray</key> <data> aaaaaaaaaaaaaaaaaaaaat70vs8/m7xspwaaad8aaaa/aaaa </data> <key>coordcount</key> <integer>1</integer> </dict> i assume data string array of coordinates (based on key name). question is, how can figure out data stored there? if base64-decode string, gibberish. there way decode , cast whatever format came (nsarray, think)? why don't load property list , inspect contents? nsdictionary *plist = [nsdictionary dictionarywithcontentsoffile:...];

inversion of control - Asp.net Mvc: Ninject - IPrincipal -

i wondering how bind iprincipal httpcontext.current.user in asp.net mvc ninject. friendly greetings, pickels edit: not sure if matters use own customprincipal class. you can without need provider in ninjectmodule : bind<iprincipal>() .tomethod(ctx => httpcontext.current.user) .inrequestscope(); note, included .inrequestscope() ensure value of method cached once per http request. i'd recommend doing if use provider mechanism.

html: &copy; doesn't show -

when wrote &copy; in page doesn't show copyright symbol, and show point instead, . shows. maybe know why? thanks put copyright symbol in <span> tag , in css use font works. <span class="copyright">&copy;</span>2007 syom industries css: .copyright { font-family: arial, "helvetica neue", helvetica, sans-serif; }

C#, XNA, How to select image minimalization filter in 2D mode? -

the problem can't select minimalization filter texture2d scaling. there minfilter graphicsdevice.samplerstates[0].minfilter but it's not working. when try assign filter changes linear. is there way implement own filter or how select 1 of available? i read article on shawn hargreaves' blog while said, "spritebatch automatically set needs drawing in 2d...", includes setting minfilter linear. so, try article says , set spritesortmode immediate. after spritebatch.begin call, can set minfilter whatever want, , should retain setting when draws sprite.

xml - WEKA file formats -

can feed weka xml files? or should use arff format? thanks loading arff formatted datasets weka has been easiest me (converting datasets arff not difficult). knowledge, can load datasets db or datasets in csv format weka. xml: i've never loaded xml doc weka has promise http://weka.wikispaces.com/xrff , might need.

c# - When is it better to write "ad hoc sql" vs stored procedures -

this question has answer here: what pros , cons keeping sql in stored procs versus code [closed] 47 answers i have 100% ad hoc sql through out application. buddy of mine recommended convert stored procedures performance , security. brought question in mind, besides speed , security there other reason stick ad hoc sql queries? sql server caches execution plans ad-hoc queries, (discounting time taken first call) 2 approaches identical in terms of speed. in general, use of stored procedures means taking portion of code needed application (the t-sql queries) , putting in place not under source control (it can be, isn't ) , can altered others without knowledge. having queries in central place may thing, depending upon how many different applications need access data represent. find easier keep queries used application resident in application code itsel...

multithreading - c++ thread running time -

i want know whether can calculate running time each thread. implement multithread program in c++ using pthread. know, each thread compete cpu. can use clock() function calculate actual number of cpu clocks each thread consumes? my program looks like: class thread () { start(); run(); computing(); }; start() start multiple threads. each thread run computing function something. question how can calculate running time of each thread computing function no, cannot use clock . processor switch thread between start , computing calls calculate time of several threads. need use tick counter local 1 thread.

ISO/IEC Website and Charging for C and C++ Standards -

the iso c standard (iso/iec 9899) , iso c++ standard (iso/iec 14882) not published online; instead, 1 must purchase pdf each of standards. wondering rationale behind this... not detrimental both c , c++ programming languages authoritative specification these languages not made freely available , searchable online? doesn't encourage use of possibly inaccurate, non-authoritative sources information regarding these languages? while understand time , effort has gone developing c , c++ standards, still puzzled choice charge specification. opengroup base specification , example, available free online; make money charging certification. know why iso standards committees don't make revenue in certifying standards compliance, instead of charging these documents? also, know if iso standards committee's atrociously looking website intentionally made way? it's if don't want people visiting , buying spec. one last thing... c , c++ standards described "open standard...

properties - spring.net proxy factory with target type needs property virtual? -

i'm creating spring.net proxy in code using proxyfactory object proxytargettype true have proxy on non interfaced complex object. proxying seems ok till call method on object. method references public property , if property not virtual it's value null. this doesn't happen if use spring.aop.framework.autoproxy.inheritancebasedaopconfigurer in spring config file in case can't use because spring context doesn't own object. is normal have such behavior or there tweak perform want (proxying object virtual method without having change properties virtual)? note tried factory.autodetectinterfaces , factory.proxytargetattributes values doesn't help. my proxy creation code: public static t createmethodcallstatproxy<t>() { // proxy factory proxyfactory factory = new proxyfactory(); factory.addadvice(new callmonitortrackeradvice()); factory.proxytargettype = true; // create instance factory.target = activator.createinstance<t>...

OData WCF Data Service with NHibernate and corporate business logic -

let me first apologise length of entire topic. long, wish sure message comes on without errors. here @ company, have existing asp.net webapplication. written in c# asp.net on .net framework 3.5 sp1. time ago initial api developed web application using wcf , soap allow external parties communicate application without relying on browsers. this api survived time, request came create new api restfull , relying on new technologies. given assignment, , created initial api using microsoft mvc 2 framework, running inside our asp.net webapplication. took quiet time running, @ moment we're able make rest calls on application receive xml detailing our resources. i've attended microsoft webcamp, , immediatly sold odata concept. similar doing, protocol supported more players instead of our own implementation. i'm working on poc (proof of concept) recreate api developed using odata protocol , wcf dataservice technology. after searching internet getting nhibernate 2 work data ...

c# - BackgroundWorker not working with TeamCity NUnit runner -

i'm using nunit test view models in wpf 3.5 application , i'm using backgroundworker class execute asynchronous commands.the unit test running fine nunit runner or resharper runner fail on teamcity 5.1 server. how implemented : i'm using viewmodel property named isbusy , set false on backgroundworker.runworkercompleted event. in test i'm using method wait backgroundworker finish : protected void waitforbackgroundoperation(viewmodel viewmodel) { console.writeline("waitforbackgroundoperation 1"); int count = 0; while (viewmodel.isbusy) { console.writeline("waitforbackgroundoperation 2"); runbackgroundworker(); console.writeline("waitforbackgroundoperation 3"); if (count++ >= 100) { assert.fail("background operation long"); } thread.sleep(1000); console.writeline("waitforbackgroundoperation 4"); } } private st...

jQuery Suspected Naming Convention Problem -

i'm having problem jquery function, portion of function renames id, class , name of dropdown works first dropdown, subsequent ones not work, ideas? i suspect may have naming convention in cat.parent_id required asp.net mvc model binding. $(document).ready(function () { $("table select").live("change", function () { var id = $(this).attr('id'); if ($(this).attr('classname') != "selected") { var rowindex = $(this).closest('tr').prevall().length; $.getjson("/category/getsubcategories/" + $(this).val(), function (data) { if (data.length > 0) { //problematic portion $("#" + id).attr('classname', 'selected'); $("#" + id).attr('name', 'sel' + rowindex); $("#" + id).attr('id', 'sel' + rowindex); ...

c# - DLL containing custom attribute remains locked -

i trying write attribute apply security method. this: [customauthorization(securityaction.demand)] public void dosomething() { //do } so have attribute on assembly: public sealed class authorizationattribute : codeaccesssecurityattribute { public override ipermission createpermission() { if (!/*authorize here*/) { return new custompermission(permissionstate.unrestricted); } throw new exception("identificationfailure."); } } public authorizationattribute(securityaction securityaction) : base(securityaction) { } } so far works. run main program , job. now go , modify assembly having attribute, build it. no problem. i go in main program try build , there fails. cannot copy new built dll because old 1 still in use process. does have idea happening here? if you're using vs2010, there issue vhost...

html - Change image using jQuery -

i have html-page used jquery-ui accordion. have add in page 2 image should vary depending on active section. how can it? html: <div id="acc"> <h1>something</h1> <div>text text text</div> <h1>something too</h1> <div>text2 text2 text2</div> </div> <div id="pic"> <img class="change" src="1.png"/> <img class="change" src="2.png"/> </div> js: $(document).ready(function() { $("#acc").accordion({ change: function(event, ui) { /* i'm think need here */ } }); }); this script show first img first panel, second img second panel , on jquery(function($) { $("#acc").accordion({ change: function(event, ui) { var index = $(ui.newcontent).index("#acc>div"); $("#pic .change") // hide ...

jquery - Coda Slider - Content is hidden in Safari, Chrome & IE. Works in Firefox -

i using coda slider on my drupal 7 website . when page loads on safari, chrome & ie, content appears hidden, , have click tab content appear. doesn't happen in firefox. is there anyway content appear, without having click on tab. i worked out. for reason coda insets height value of 0 20px on container div. you can fix adding height:auto container div in style sheet. (you might need use !important declaration make sure rule applies div). hope helps someone.

java - The String source is unknown while using the parse methode! -

to parse string date sql valid: simpledateformat df = new simpledateformat("yyyy-mm-dd"); java.util.date date = null; try { date = df.parse(dateimput); } catch (parseexception e2) { // todo auto-generated catch block e2.printstacktrace(); } with dateimput form that: string dateimput=request.getparameter("datepicker"); when running see error: java.text.parseexception: format.parseobject(string) failed @ java.text.format.parseobject(unknown source) @ servletedition.dopost(servletedition.java:70) so mean dateimput not known + note correctly dislayed when: system.out.println("datepicker:" +dateimput); thanks. so seems first time complicated see solution. in fact need 2 simple date formater because tha parsing in case done in 2 steps: system.out.println("datepicker:" +dateimput); simpledateformat df1 = new simpledateformat("mm/dd/yyyy"); simpleda...

django - sorl-thumbnail: random name in Thumbnail field -

i want use str(uuid.uuid4()) instead of name uploaded. i have model: class foo(models.model): pic = thumbnailfield(upload_to='pics', size=(200, 200)) i uploading hello_world.jpg , should save these named versions should saved example in 4ba9b397-da69-4307-9bce-e92887e84d2f.jpg . how can that? you handle in view: myfile = request.files['file'] foo_model = foo() foo_model.pic.save("%s.jpg" % str(uuid.uuid4()), myfile, save=true)

c# - Lucene - How to index a value with special characters -

i have value trying index looks this: test (test) using standardanalyzer, attempted add document using: field.store.yes, field.index.tokenized when search value of 'test (test)' queryparser generates following tags: +name:test +name:test this operates expect because not escaping special characters. however, if queryparser.escape('test (test)') while indexing value, creates terms: [test] , [test] then when search such: queryparser.escape('test (test)') i same 2 terms (as expect). problem if have 2 documents indexed names: test test (test) it matches on both. if specify search value of 'test (test)' want second document. curious why escaping special characters not preserve them in created terms. there alternate analyzer should at? looked @ whitespaceanalyzer , keywordanalyzer. whitespanceanalyzer case sensitive , keywordanalyzer stores single term of: [test (test)] which means if search 'test' not able return both...

tsql - SQL SERVER FOR XML SYNTAX -

how can output follows using xml / sql query. not sure how can column values elements instead of tables' column names. using sql server 2005 i have table scema follows create table parent ( pid int, pname varchar(20) ) create table child ( pid int, cid int, cname varchar(20) ) create table childvalue ( cid int, cvalue varchar(20) ) insert parent values (1, 'sales1') insert parent values (2, 'sales2') insert child values (1, 1, 'for01') insert child values (1, 2, 'for02') insert child values (2, 3, 'for03') insert child values (2, 4, 'for04') insert childvalue values (1, '250000') insert childvalue values (2, '400000') insert childvalue values (3, '500000') insert childvalue values (4, '800000') the output looking follows <sale1> <for01>250000</for01> <for02>400000</for02> </sale1> <sale2> <for03>500000</for03> <for04>800000...

MySQL Procedures : Standard/Best Place For Code Documentation? -

i'd put paragraph or documentation on each of mysql procedures: date, author, purpose, etc. is there standard, accepted, or best place put kind of documentation? for example, in mssql, ide's generate template start coding procedure; comes little place code documentation. use [mydatabase] go /****** object: storedprocedure [dbo].[storerecord] script date: 04/29/2010 09:21:57 ******/ set ansi_nulls on go set quoted_identifier on go -- ============================================= -- author: -- create date: -- description: -- ============================================= alter procedure [dbo].[storerecord] -- ... more code ... mysql provides short (64 character) comment associated each stored procedure (function) displayed part of show create procedure (or function ) results. beyond comments in code write defined stored procedures , functions stripped when mysql parses them. example: mysql> delimiter // mysql> create function simpleexample( ci...