Posts

Showing posts from September, 2013

android - How to change Nested layout's child viewgroup's width in java code? -

i have layout xml file linear layout. 1 of children again viewgroup relative layout. in java code want change width of child viewgroup requirements. tried this enter code here viewgroup childviewgroup = (linearlayout)findviewbyid(childviewgroup); layoutparams l = childviewgroup.getlayoutparams(); l.width = 360; childviewgroup .setlayoutparams(l); i couldn't because findviewbyid(childviewgroup) doesn't fetch viewgroups views. note : cant define whole new layout.xml minor requirement since huge layout file , might cause performance overhead. wanted change width of child view group in java activity code. thanks in advance help. viewgroup subclass of view findviewbyid should work fine. you're casting result linearlayout, childviewgroup linearlayout or relativelayout specified in question? – codelark oct 6 @ 23:21

c# - Unity Container Memory Leaks -

hi i´m working on project uses enterprice libraries´s unity container resolve dependencies exception handling, cache, logging , db access keep getting lot of leaked objects memory. we using property injection this: [dependency] public database db { { return db; } set { db = value; } } [dependency] public exceptionmanager exceptionmgr { { return exceptionmanager; } set { exceptionmanager = value; } } some of object leaked: microsoft.practices.enterpriselibrary.exceptionhandling.configuration.exceptionhandlingsetti microsoft.practices.enterpriselibrary.logging.configuration.loggingsettings microsoft.practices.enterpriselibrary.exceptionhandling.configuration.exceptionpolicydata microsoft.practices.enterpriselibrary.exceptionhandling.configuration.replacehandlerdata microsoft.practices.enterpriselibrary.exceptionhandling.configuration.wraphandlerdata microsoft.practices.enterpriselibrary.common.configuration.genericenumeratorwrapper ...

ruby on rails - Can I use a text file as my database in ROR? -

i use delimited text file (xml/csv etc) replacement database within ruby on rails. solutions? (this class project requirement, rather use database if had choice.) i'm fine serializing data , sending text file myself. the best way take activemodel api , build methods parse files in appropriate ways. here's presentation activemodel , activerelation builds custom model, should have lot of similar concepts (but different backend.) , blog post yehuda activemodel api

Character by Character Input from a file, in C++ -

is there way input file 1 number @ time? example want store following integer in vector of integers since long , can't held long long int. 12345678901234567900 so how can read number file can: vector<int> numbers; number.push_back(/*>>number goes here<<*/) i know above code isn't complete hope explains trying do. i've tried google , far has proved innefective because tutorials c coming aren't helping me much. thank advance, dan chevalier this done in variety of ways, of them boiling down converting each char '0'..'9' corresponding integer 0..9. here's how can done single function call: #include <string> #include <iostream> #include <vector> #include <iterator> #include <functional> #include <algorithm> int main() { std::string s = "12345678901234567900"; std::vector<int> numbers; transform(s.begin(), s.end(), back_inserter(numbers),...

php - Netflix: Fetching new remote data when it becomes readily available -

i hope appropriate question: i'm using netflix api , i'm wondering best way 1 able automatically receive new data when presented (in case, watched films when netflix user finishes watching one) way can think of spamming requests in intervals query feed. , php best bet? that's right, netflix doesn't provide push notifications through api. you'll have poll feed periodically, not often: consumer key limited number of requests per second , requests per day. i'm not sure you're trying do, know whether php right choice. oauth libraries available pretty every major language, it's you.

Table variable vs temp table in SQL Server 2008 -

possible duplicate: what's difference between temp table , table variable in sql server? what difference between table variable , temp table, have 2 question on it. how decide when use what? which 1 better in performance , why ? the first difference transaction logs not recorded table variables. hence, out of scope of transaction mechanism, visible example: create table #t (s varchar(128)) declare @t table (s varchar(128)) insert #t select 'old value #' insert @t select 'old value @' begin transaction update #t set s='new value #' update @t set s='new value @' rollback transaction select * #t select * @t read more : http://www.sql-server-performance.com/articles/per/temp_tables_vs_variables_p1.aspx

C# Error: Error converting nvarchar datatype to int. HELP! -

i'm having hard time c# application. everytime run code below, gives me error convertion of nvarchar datatype int. have tried casting doesn't seem work. connectionstring myconnstring = new connectionstring(); string connstring = myconnstring.getconnectionstring(); sqlconnection connvalidate = new sqlconnection(connstring); sqlcommand cmdvalidate = new sqlcommand("xxx", connvalidate); cmdvalidate.commandtype = commandtype.storedprocedure; cmdvalidate.parameters.add(new sqlparameter("@accountid", currentuser)); cmdvalidate.parameters.add(new sqlparameter("@periodmonth", convert.tostring(comboboxmonth.selecteditem).trim().toupper())); cmdvalidate.parameters.add(new sqlparameter("@periodyear", convert.toint32(comboboxyear.selectedvalue))); connvalidate.open(); int32 result = convert.toint32(cmdvalidate.executescalar()); connvalidate.dispose(); connvalidate.close(); here stored procedure using: alter procedure [dbo].[xxx] @...

httpwebrequest - Downloading Mp3 using Python in Windows mangles the song however in Linux it doesn't -

i've setup script download mp3 using urllib2 in python. url = 'example.com' req2 = urllib2.request(url) response = urllib2.urlopen(req2) #grab data data = response.read() mp3name = "song.mp3" song = open(mp3name, "w") song.write(data) # data2 song.close() turns out somehow related me downloading on windows or current python version. tested code on ubuntu distro , mp3 file downloaded fine... used simple urllib2.openurl method , worked perfect! to summarize: i using urllib2.openurl in python on ubuntu distro. i using newer version of python feel can't that. the mp3 encoded in lame. does have clue causing weird issue running code on windows box? wonder why downloading on windows mangled mp3? try binary file mode. open(mp3name, "wb") you're getting line ending translations. the file binary, yes. it's mode wasn't. when file opened, can set read text file (this default). when this, convert line end...

debugging - Exclude certain projects from stepping through during debug in VS2010? -

i working on couple of projects (a , b) in large vs2010 solution (all in c#). there many cases methods project call through 1 or more of projects in solution not responsible, in turn call through project b. when stepping through debugger project a, forced step through host of methods in these other projects, in have no interest, before reach call project b. further, when stepping out of project b, have step way through call stack of uninteresting methods before project a. i working around setting breakpoints @ entry , exit points in projects , b, find lot of time spent setting these breakpoints in correct places, , feel life lot easier if disable step-through projects. i aware of debuggerstepthroughattribute, use not workable in situation (i) have add in many places , (ii) guys in office interested in stepping through code not happy. any ideas? yes, possible enabling code , preventing symbol loading dlls don't care about. to enable code: debug » options ,...

JSON response to C/C++ object and C/C++ objects to Java /Objective C -

is there way convert json response c/c++ object structure and,convert object (c/c++) objects java or objective c. there tons of libraries java side @ least; favorite jackson , others gson , flex-json work well. , although many fall it, recommend against using org.json's default lib; it's old proof-of-concept , missing useful things other libs offer. note given json interchange format, there need/should not close coupling between c/c++ libs , java libs; each can , should map data using whatever works best on platform.

math - Finding the y-axis for points on a line graph made with PHP's imageline() -

i'm making line graph php using imagecreate() , imageline(). im' trying figure out how calculation find y-axis each point on graph. here few values go in graph: $values[jan] = .84215; $values[feb] = 1.57294; $values[mar] = 3.75429; here example of line graph. x-axis labels positioned @ vertical middle of x-axis lines. gap between x-axis lines 25px. how calculation find y-axis values in array above? 5.00 4.75 4.50 4.25 4.00 3.75 3.50 3.25 3.00 2.75 2.50 2.25 2.00 1.75 1.50 1.25 1.00 0.75 0.50 0.25 0.00 jan feb mar apr may jun jul aug sep oct nov dec you need way map floating point number between [0.00 5.00] y-axis points. the granularity of y-axis 0.25 . can divide input 0.25 exact point on y-axis. value between 2 point example input 0.3 , 0.3/0.25 1. 2 , there not 1.2 on y-axis. to solve associate range +|-0.125 each y-axis number. 1.0 have range 0.75 1.25 , input input/0.25 falling in [0.75 1.25] have 1.00 y-axis point. in p...

c# - Need an advice about application's architecture -

i trying build application's architecture these days , glad hear advice. here details application itself. has web ui customers register , pay (with credit card) sort of services. have provide info because these services based on it. example dates schedule service work. of course can check status of order via site. also have database (classic relational database or no-sql database not sure better in case) located on other physical machine. have take customers' info , store db in order make work based on it. besides there windows service or it's linux analogue makes main job. should create processes based on information in database job. in other word services mentioned in beginning provided not business logic of web site of windows service. of course during work service stores information database or update in way. recently have read book applications architecture microsoft , introduce there many approaches build application. example ddd or client / server or componen...

ASP.NET MVC: generating action link with custom html in it -

how can generate action link custom html inside. following: <a href="http://blah-blah/....."> <span class="icon"/> new customer </a> you can use urlhelper class : <a href="<% =url.action("create","customers") %>"> <span class="icon"/> new customer </a> the msdn link here : http://msdn.microsoft.com/en-us/library/system.web.mvc.urlhelper.aspx

How's return value implemented in assembly level? -

Image
int main(void){ printf("hello world"); return 0; } how 0 passed return value in assembly level? there dedicated cpu register job? update here's 2 tables on passing/return data in pdf, doesn't seems have exact info on how calling convention of api determined , register used storing return address: that depends on architecture. couple of examples, on x86 eax register used return values. on x86-64, it's rax. on sparc, it'll show in %o0.

Is NOLOCK the default for SELECT statements in SQL Server 2005? -

i have sql server 2008r2 installed though need communicate customers having 2005. [1] tells: " nolock this not lock object. default select operations. not apply insert, update, , delete statements" [2] doesn't seem mention it, checking in ssms/ss 2008r2 shows nolock not default hint select. is with(nolock) default in sql server 2005 select? written in bol2005/2008? update: under "where written" expected see answers/comments/clarifications (or, better, citations) on cited [1] parts: "this not lock object" does select without nolock put any locks in sql server 2005 (having default isolation level read uncommitted)? ... in sql server 2008 (resp. having read committed)? what have read on can understood nolock permits ignore/bypass existing locks put transaction... quite unclear whether current transaction (select nolock) puts (or trying put) own locks... does read uncommitted isolation level (which used synonym ...

c# - What's the difference between XElement and XDocument? -

what difference between xelement , xdocument , when use each? xdocument represents whole xml document. composed of number of elements. xelement represents xml element (with attributes, children etc). part of larger document. use xdocument when working whole xml document, xelement when working xml element. for example - xelement has hasattributes property indicating whether attributes exist on element, xdocument doesn't, such property meaningless in context of whole xml document.

c++ - Is there a performance penalty for creating Direct3D vertices with all semantic types? -

in direct3d, can create type of vertex like. can have simple vertex positional information, or add colour info, texture info, etc etc. when creating input layout, define parts of vertex you've implemented: d3d10_input_element_desc layout[] = { { "position", 0, dxgi_format_r32g32b32_float, 0, 0, d3d10_input_per_vertex_data, 0 }, { "color", 0, dxgi_format_r32g32b32a32_float, 0, d3d10_append_aligned_element, d3d10_input_per_vertex_data, 0 }, }; my question is, should define vertex structure all of input types (position, colour, texture etc etc). or should create several vertex structures, each different types of input. the downsides using multiple classes have create , maintain several classes, , confusing knowing type of vertex use. downsides of having 1 vertex structure? you upload unused vertex data 3d accelerator, , eat bandwidth. shouldn't matter unless doing top notch video game (you'll have bottleneck somewhere else). ...

mysql function to pretty print sizes (pg_size_pretty equivialent)? -

postgresql have pg_size_pretty() convenience function: > select pg_size_pretty(100000); pg_size_pretty ---------------- 98 kb does mysql have similar ? if not, before make own have made this, can share ? there no shipped function in mysql. so, created 1 : function pretty_size https://github.com/lqez/pastebin/blob/master/mysql/pretty_size.sql create function pretty_size( size double ) returns varchar(255) deterministic begin declare c int default 0; declare unit int default 1000; declare unitchar char(6) default 'kmgtpe'; declare binaryprefix boolean default 1; /* set binaryprefix = 1 use binary unit & prefix */ /* see iec 60027-2 a.2 , iso/iec 80000 */ if binaryprefix = 1 set unit = 1024; end if; while size >= unit , c < 6 set size = size / unit; set c = c + 1; end while; /* under 1k, add 'byte(s)' */ if c = 0 return concat( size, ' b' ); ...

css - jQuery: offset issues -

i have strange jquery.offset() problem. components being layered , taking away functionality of links underneath. upper layer transparent , empty. my solution iterate on links (all a elements), grab location (top, left, height , width values) , href, , create new a element @ same position, placed in upper layer. problem : method works 3 out of 4 links. in 1 case, new element located about 120px off top , size , offset left fine. ideas on last one? $("#container a").each(function(index){ var top = $(this).offset().top; var left = $(this).offset().left; var width = $(this).width(); var height = $(this).height(); var href = $(this).attr("href"); $('<a id="layer'+index+'"></a>').addclass("overlayer").css("left", left).css("top", top).css("width", width).attr("href", href).css("height", height).appendto('#toplayer'); } note ...

Routing in ASP.NET -

i need use routing parameters in asp.net application. public class global : system.web.httpapplication { void application_start(object sender, eventargs e) { registerroutes(); } private void registerroutes() { var routes = routetable.routes; routes.mappageroute( "profile", string.format("{0}/{{{1}}}/", "profile", "id"), "~/views/account/profile.aspx", false, new routevaluedictionary {{"id", null}}); } } then, navigating " /profile " want on page_load method request.params["id"] null , navigating " /profile/1 ", request.params["id"] "1" . where made mistake? with traditional webforms created 2 routes in registerroutes() method. routes.add("profile", new route("profile", new customroutehandler("~/profile.aspx")))...

Problem installing SQL Server on Win 7 with Visual Studio -

Image
i have windows 7 box. want install sql server 2005 on it. the box has following programs installed: visual studio 2005 visual studio 2008 visual studio 2010 i had sql server 2008 uninstalled. when try install sql server 2005, following warning message: if click on "check solutions online", says no solution exists. if click on "run program", error , sql server not installed please let me know if have know of solution this. solved! there 2 folders in installer - server , tools. i trying install server first, , did not install. when ran setup.exe tools installed. ran setup.exe server , worked. windows 7 , visual studio installations did not have had speculated before. thanks.

firebug - XMLHttpRequest returns status of 0 in Firefox 3.6.10 and up from cross origin requests -

i developing application makes cross origin ajax request http server written using netty. an example of type of javascript code being executed below. $.ajax({ type:"get", url:"http://localhost:5000/someresource", data: { id1: "1", id2: "2" }, success: function(status, textstatus, xhr) { alert("success") }, error: function(status, textstatus, xhr) { alert("error") } }); the problem seeing on firefox (3.6.10 , 4.0 beta) status of xmlhttprequest 0, regardless of status of response. in firebug can see server returning correct status request, not being pushed through xmlhttprequest object. below request , response headers being sent response headers content-type text/plain; charset=utf-8 content-length 0 access-control-allow-orig... http://localhost:9000 cache-control no-cache connection...

ios - Objective-C call specific class method -

i have class has in initializer: @implementation basefooclass -(id) init { if (self = [super init]) { // initialize instance variables need start value } return self; } -(id) initwithsomeint:(int) someint { if (self = [self init]) // <-- need make sure calling basefooclass's init here, not subfooclass's, make sense? { self.someint = someint; } return self; } @end that fine , dandy. problem when implement subclass: @implementation subfooclass -(id) init { return [self initwithsomeint:0]; } -(id) initwithsomeint:(int) someint { if (self = [super init]) // <--- infinite loop (stack overflow :) ) { // initialize other variables } } @end i need call basefooclass 's init rather subfooclass 's init . i cannot change way objects initialized, converting project c# use in ipad application. thank in advance edit: due asking, here header: @interface basefo...

CRUD Update, changing entity relationship with dropdown using ASP.NET MVC 2, and NHibernate -

i'm running few problems crud update (edit) scenarios entity relationship altered via drop down list of possible entities , using asp.net mvc , nhibernate. doing stupid, wondering if give me quick example of how should done, haven't been able find many examples on web. (there's nothing in nerddinner example) so using arbitrarily simple model: public class person { int id { get; set;} string name { get; set} person buddy { get; set} } could give me example (or link example) of 'update' crud view , action(s) in scenario? don't worry repository code for sake of comparison existing code, helpful if example used formcollection (i know not ideal). thank you! you can try @ sharp architecture . have northwind sample employeescontroller , transfervalues method. there update shown nested entities

dotnetnuke 5.5 critical error on pressing settings on every module of the site -

my site hosted on 1 server . working fine. after moving server . click on settings of every module on site give critical error object reference not set instance of object. wrong? using dotnetnuke 5.5 moving files skip install/setup step install wizard checks folder permissions. start there, check first: setting security permissions

java - extracting portion of jar to a path -

i using follwing command , intention extract dyedistinctappserver.topology discovery1-full-8.1.0-07-10-2010_1055.jar @ data/product/template-topologies/dyedistinctappserver.topology path. command: jar -xf discovery1-full-8.1.0-07-10-2010_1055.jar -c data/product/template-topologies/dyedistinctappserver.topology instead of extracting files, prompts me using command incorrectly , dumps out various options. is there syntax error shown in usage part. using aix os. thanks. the option -c set directory in jar should run, not paths in jar file. try: jar -xf discovery1-full-8.1.0-07-10-2010_1055.jar data/product/template-topologies/dyedistinctappserver.topology

iphone - Custom Apple Push Notification Server vs Urban Airship and likings -

i need implement push notifications 1 of projects. of possibilities evaluated are: building own apn sending script on server using urban airship which 1 guys recommend , why? nb. know urban airship costs bit, assume 1 mil free notifications enough me. you've kinda answered own question haven't you? the positives of doing unlimited free , have more control (although push notification push notification push notification... how control need). the positives of urban airship save time/effort/resources. don't have maintain or fix bugs. i'm assuming if send on million push notifications can monetise app , pay service anyway. remember million huge amount. can send 100 people 10,000 push notifications.

ajax - Passing variables to jQuery from links -

i remaking page on admin section of website administer uses jquery , ajax. on 1 of pages have list of items. next each item there link this: <a href="delete.php?id=48" class="del_link">delete</a> if give these links class can apply jquery function of them call same function in same way. question is: best way function item's id without including javascript inline html? update: pointers, everyone. i've ended using this: $(".del_link").click(function(){ var del_link = $(this).attr('href'); $("#results").load(del_link, function (){ $("#results").show().delay().fadeto(2000, 0); }) }) the php file ajax calls responds in different ways if it's been requested ajax or - if it's ajax outputs response (e.g. "item deleted successfully") can displayed in #results div. if has javascript disabled client directed same php page redirect them once item removed. quic...

iphone - implement a swipe method -

i want know how can use uiswipecontroller in application? you're thinking of uiswipegesturerecognizer. initialize it, call addtarget:action: , set direction property, , add whichever view wish should recognize gesture.

c - How to interrupt a fread call? -

i have following situation: there thread reads device fread call. call blocking long there no data send device. when stop thread remains hanging inside thread. now found following inside man page of fread: errors on systems conform single unix specification, fread() function sets errno listed following conditions: [eintr] read operation terminated due receipt of signal, , no data transferred. that mean there way interrupt call different thread. have no idea how. can tell me how send signal interrupt fread call? , signal need send? update 08-10-10 09:25 i still haven't got work. tryed kill() , pthread_kill() different signals. nothing seems interrupt fread() call. thing got working killing entire application, that's not want. 1. signals: using signals, many others pointed out, work. however, many others pointed out, approach has disadvantages. 2. select(): using select() (or other multiplexing function), can block waiti...

java - how can i leave windows and go too linux? -

i java developer. used windows os in versions years, , i'm using windows 7 how can leave windows , go linux , not working beginner user. dont know path exactly. , dont close hands in new os. version edition should use , why ? should start command or graphic suitible starting ? to quote nike, "just it". install linux on box, dual boot if still want windows lifeline. nothing make learn faster , more honest god necessity.

add javascripts and css files dynamicly to html using javascript -

i building javascript widget , need add widget css , js files dynamicly client page. i doing now: var css = document.createelement('link'); css.setattribute('rel', 'stylesheet'); css.setattribute('href', 'css path'); document.getelementbyid('test').appendchild(css); alert(document.getelementbyid('test').innerhtml); but not add element dom. alert shows correctly. what missing? edit1: here updated code: (note test page). <html> <head> </head> <body> <div id="test"> test </div> <script type="text/javascript"> var css = document.createelement('link'); css.setattribute('rel', 'stylesheet'); css.setattribute("type", "text/css"); css.setattribute('href', 'path'); var header = document.getelementsbytagname("h...

can you re-use nhibernate mapping files for tables with common columns -

we have bunch of lookup tables share same columns (id,code,description, etc) , co-worked asked me if build generic lookup.hbm.xml mapping file , use base other lookup tables. nhibernate support include files, or other way reference common chunk of xml? understand fluent supports inheritance in mapping classes, unfortunately switching mapping technologies not option us. yes, can using xml external entities . put common fields in xml file , reference them in other xml files using !entity . example: <!doctype mappings [ <!entity address system "xxx.address.xml"> ]> in xml nhibernate map import using &address; the full namespace (path) file needs used. have noticed in visual studio (2008 @ least) if there error in file , have xml file open uses external reference, report error on also.

input - Caesar Cipher in python -

the error getting is traceback (most recent call last): file "imp.py", line 52, in <module> mode = getmode() file "imp.py", line 8, in getmode mode = input().lower() file "<string>", line 1, in <module> nameerror: name 'encrypt' not defined below code. # caesar cipher max_key_size = 26 def getmode(): while true: print('do wish encrypt or decrypt message?') mode = input().lower() if mode in 'encrypt e decrypt d'.split(): return mode else: print('enter either "encrypt" or "e" or "decrypt" or "d".') def getmessage(): print('enter message:') return input() def getkey(): key = 0 while true: print('enter key number (1-%s)' % (max_key_size)) key = int(input()) if (key >= 1 , key <= max_key_size): return key def ge...

Access VBA Formatting -

hey all, managed integrate database quite excel in end, in end after showed bosses asked me develop forms , reports in access again. did not take long fortunately, ended doing 2 front ends 1 end database. in end it'll access database 1 bit of excel integration utilized; transfer spreadsheet method transfer daily end of trade share price access. now i've come point database pretty ready split , populated.(what's best way tackle this, populate first or split first?) the question i'm asking below: this might seem simple question far, haven't been helped google or maybe i'm not using right keywords in search thought better place ask on here; there way format numbers generated through vba code , placed in new table in access, make them like: so if it's 1,000,000 appear 1m or if it's 10,000 appears 10k if has 3 0's it's k if has 6 0's it's m i have used vba format numbers in following way: changeinshare = format(changeinshare, ...

asp.net mvc 2 - Dynamic validation on MVC 2 -

Image
this works fine [metadatatype(typeof(area_validation))] public partial class area { ... } public class area_validation { [required(errormessage = "please add field.")] public int email { get; set; } [required(errormessage = "please add field")] public string name { get; set; } } but how about if area_validation dynamically created ? example subscription fields on back-end can created user , end this: how can set metadata on each field auto validation ? currently i'm doing: public class subscriberformviewmodel { public list<subscriberfieldmodel> fields { get; private set; } public calendar calendar { get; private set; } public company company { get; private set; } public subscriberformviewmodel() { // todo: testing while validation not set } public subscriberformviewmodel(decimal calendarid) { if (calendarid > 0) { subscribersrepository db = new su...

java - Hibernate with HSQLDB and Oracle -

i have moved group of tables hsqldb faster performance, there few residual many 1 associations between hsqldb tables , oracle tables. possible configure hibernate manage type of association? i'm using 2 persistence units, 1 oracle , other hsqldb. hibernate not support relationships between different databases , not databases of different types. you have manage "fetch" of related entities hand, perhaps converting many-to-one raw foreign key values , doing fetch oracle db (using different sessionfactory if using hibernate both).

prototype - Hack Javascript Definitions for "undefined" objects -

so i'm not entirely sure possible, curious if possible hack definitions of "undefined" objects. primarily, purpose of prevent errors launching when doing .replace on object undefined. possible go "back end" (is there such thing??) , add method undefined object (if defined in first place??). along likes of undefined.prototype.replace = function(v,r){ return false }; obviously works string or object, undefined, seems to, nature, have no definition. feels should still able mess it, since javascript has available end result. thanks time! i'm curious pop here! edit: main issue co-developing 8 other developers versioning control, , of newer people come in aren't familiar javascript (or error handling matter), wanted make global handler minute errors can receive default returns if necessary. doesn't idea work. maybe global try , catch scenario? 4.3.2 primitive value member of 1 of types undefined, null, boolean, number...

qt - QSortFilterProxyModel: index from wrong model passed to mapToSource - why? -

i'm getting in application output , can't figure out problem. code, in subclass of qtableview, model() returning qsortfilterproxymodel: const qsortfilterproxymodel *proxy = dynamic_cast<const qsortfilterproxymodel*>(model()); qmodelindex proxy_index2 = proxy->index(row, column, qmodelindex()); qmodelindex model_index = proxy->maptosource(proxy_index2); what doing wrong? i'm using qt 4.7. edit: i'm not sure what's going on, code working fine now. did check index valid, proceeded time being. i'm not sure changed fixed problem, code above working fine @ point. it helpful know fixed problem of course can understand how use qt better, i'd have give guys rest of code @ point when saw problem - , have no copy of code in state. so, guess have remain mystery unless run again! thanks

iphone - Ipad landscape splash won't show -

i'm trying set landscape splash ipad app it's not working. i have default-landscape.png , default-portrait.png. added 4 orientation in plist file , still nothing. it works if launch in portrait, if launch in landscape screen stay black until app start. is there else working? if you've made sure default-landscape.png in application's bundle (try readd it), made sure there no default.png, , added 4 orientations in "supported interface orientations" in plist , saved it; should work expected.

php - how to get values of array out -

i have array $pv->orderrecordsarray = array(); foreach($order->records $i=>$orderrecord){ $pv->orderrecordsarray[] = $orderrecord->orderrecordid; } // print_r($pv->orderrecordsarray) example // shows array ( [0] => 46839 [1] => 46840 [2] => 46841 ) i need use array values above in sql statement below. $sql = " select * table1 orderrecordid in (46741, 46742) "; so infront of in want $pv->orderrecordsarray results. thanks you can use implode generate such list: $sql = "select * table1 orderrecordid in (" . implode(', ', $pv->orderrecordsarray) . ")"; but should consider subquery or join of tables .

ASP.NET MVC DDD E-commerce - Admin and front separation -

i'm going write asp.net mvc 2 application using domain driven design. i'm trying figure out how separate admin store front. create 2 mvc projects, regarding services them, should in separate projects or use catalogmanager, example, both, admin , store front, , mix services? currently have class library each part of domain (services, infrastructure, model, etc.) thanks. you might want check out areas way separate application logical domains

windows 7 - Allow all users access to virtual computer. VMPLAYER + Ubuntu -

installed vmplayer on pc runs windows 7. logged admin , installed ubuntu linux via vmplayer. when log in 'user', vmplayer not show ubuntu installation. is there way allow users on pc, access ubuntu virtual pc? thanks help. when create / install virtual machine admin, saved in default win7 location: c:\users\admin\documents\virtual machines\ and after user, vmplayer displays vm in location: c:\users\user\documents\virtual machines\ personnally save vm on separate (external) harddisk. can save in public folder on drive c common both users (eg. c:\users\public\virtual machines). perhaps solution: executing vmplayer process administrative rights (shift-right click, run administrator). hope helps

mysql - SQL JOIN question (yet another one) -

sounds simple i'm stuck table table b col_a col_b col_a col_c 1 b 1 c 2 c 2 d 3 z 3 4 d 4 e 33 5 k 6 l 33 b 33 b i want join table b: select * inner join b on a.col_a = b.col_a i expecting 5 records result. expected join result ** actual result ** col_a col_b col_c col_x[n]... col_a col_b col_c col_y[n]... 1 b c ... 1 b c ... 2 c d ... 2 c d ... 3 z ... 3 z ... 4 d e ... 4 d e ... 33 b ... 33 b ... 33 b ... why did mysql match 33 twice? because 2 values 33 in table b. what want though, 1 ...

osx - xcode function menu keyboard shortcut -

i'm new xcode , accustomed using visual assist visual studio. in xcode, see function menu above text editor can't seem find keyboard shortcut pop down. seems require mouse click. nice have yet tool better code navigation , accomplished visual assist using alt-m. anyone know magic incantation xcode? control 2 should trick

performance - When and How Does the Database Slow Down a Site? -

i have read book o'reilly states 70-80% of performance of site can optimized via front-end. may mean database queries may account less 20 or 30% of site's performance. however, have seen huge websites facebook , twitter dedicate time optimizing queries (via query caching, normalizations, etc). when database become critical site's performance can account more aforementioned percentage? oh, , performance mean in context of speed, loading speed in particular. when database become critical site's performance can account more aforementioned percentage? after have optimized front-end max, relative impact of back-end become larger. also, big sites face problem of scalability. might able serve single user fast, load grows, gets slower everyone. client-side part spread across users' machines, scales well. back-end shared everyone, , become bottleneck.

Funky haskell lazy list implicit recursion -

in haskell, can build infinite lists due laziness: prelude> let g = 4 : g prelude> g !! 0 4 prelude> take 10 g [4,4,4,4,4,4,4,4,4,4] now, goes on when try construct list this? prelude> let f = f !! 10 : f prelude> f !! 0 interrupted. prelude> take 10 f [interrupted. prelude> the interrupted. s me hitting ctrl+c after waiting few seconds. seems go infinite loop, why case? explanation non-haskellers: the : operator prepend : prelude> 4 : [1, 2, 3] [4,1,2,3] this line: prelude> let g = 4 : g says "let g list constructed prepending 4 list g ". when ask first element, 4 returned, it's there. when ask second element, looks element after 4. element first element of list g , calculated (4), 4 returned. next element second element of g , again calculated, etc... !! indexing list, means element @ index 0 g : prelude> g !! 0 4 but when this: prelude> let f = f !! 10 : f something breaks, because compute first...

android - monitoring the listview to slide to the bottom -

i data internet , show in listview,i want make come true when slide screen finger , if listview slide bottom ,i more data internet , update adapter of listview.but how can monitor listview slide bottom,there seems no functions in sdk api. check out 'abslistview.onscrolllistener' interface, that's you're looking for. implement it, register implementing class listview. paramteres when scroll, can detect if user reached bottom of listview. then, download more content net, , update adapter. remember call 'notifiydatasetchanged()' after adding stuff adapter.

select - mysql retrieve partial column -

i using tinymce allow users write in submitted database. tinymce includes button insert "pagebreak" (actually html comment <!--pagebreak--> ). how can later pull first occurrence of pagebreak "tag"? there might significant bit of data after tag discard via php later, seems shouldn't bring back. can select part of column if never know how far in data <!--pagebreak--> be? edit: below answer work, , me need go.. curious if there equally simple way handle bringing whole column if short , pagebreak tag doesn't exist. below solution, if no pagebreak found, empty string returned. if not, can handle in code. something should <!-- : select substring(my_col 1 position('<!--' in my_col)-1) a_chunk my_table reference string functions . edit: putting omg ponies' words sql: select case when position('<!--' in my_col) > 0 substring(my_col 1 position('<!--' in my_col)-1) ...

python - What is the use of related fields in OpenERP? -

can explain me related fields. example - how used how can helped for kind of scenario should use fields.related if can provide small example real use of fields.related appreciate it. it lets pull field related table. can find more details in developer book , , 1 example @ order_partner_id field of sale_order_line class. in version 5.14, that's @ line 806 of addons/sale/sale.py . i find want display field in list, it's on parent record instead of actual table i'm listing.

Hudson build always end up in "java.lang.OutOfMemoryError: Java heap space" error -

i'm having problem hudson build slave has got windows xp 4 gb ram , in batch file call jnlp have specify following: javaws -j-xms1280m -j-xmx1024m http://hudson-master.domain.com:8080/computer/exige/slave-agent.jnlp why can't give more 1 gb ? any , suggestion appreciated. thanks, awt system out of resources. consult following stack trace details. java.lang.outofmemoryerror: java heap space @ com.sun.tools.javac.util.list.prepend(list.java:145) @ com.sun.tools.javac.jvm.classreader.openarchive(classreader.java:1457) @ com.sun.tools.javac.jvm.classreader.list(classreader.java:1742) @ com.sun.tools.javac.jvm.classreader.listall(classreader.java:1882) @ com.sun.tools.javac.jvm.classreader.fillin(classreader.java:1903) @ com.sun.tools.javac.jvm.classreader.complete(classreader.java:1538) @ com.sun.tools.javac.code.symbol.complete(symbol.java:355) @ com.sun.tools.javac.comp.enter.visittoplevel(enter.java...

struts2 - Struts program does not show properties value -

i try program of struts show french value...for have define properties in message.properties file , in message_fr.properties files. @ run time when access value of property show blank space. have include struts2-core-2.1.8.1.jar, struts2-json-plugin-2.1.8.1.jar on classpath. for example define in properties file: pro.color=blue on jsp page: <%@ taglib prefix="s" uri="/struts-tags"%> <%@ taglib uri="/user" prefix="user" %> <s:property value="pro.color"/> now show blank space. try this: <s:property value="%{gettext('pro.color')}"/>

ajax - Pass value to another page using jquery -

this first time post here. have problem on jquery script. goal is, need send values of link page, other page can use value. think using ajax post can job cant result. here code: $(function() { var mylink = $('#link'); $('.class').click(function() { var cell1 = $(this).closest('tr').find('td:eq(4)').text(); var cell2 = $(this).closest('tr').find('td:eq(3)').text(); var cell3 = $(this).closest('tr').find('td:eq(2)').text(); var data = 'cell1=' + cell1 + '&cell2=' + cell2 + 'cell3=' + cell3; }); }); so want know how can send value page clicking table cell using ajax post. want display open new window. i hope can me this, thank in advance. ;) if posting values have store them serverside till reach other page, way of doing (assuming #link link) $(function() { var mylink = $('#link'); $('.class').click(functi...

OData implementation for ASP.NET MVC -

we have straight forward line of business application implemented asp.net mvc2 , have new requirement able share our data other parts of business, include sharepoint 2010, ruby , python. i'd use odata transport mechanism (as opposed soap) using our existing mvc application. i'm struggling find mentioning implementation of odata provider mvc. can suggest either how might able start rolling own odata asp.net mvc provider or point me somewhere might have started similar? you check out https://meta.stackexchange.com/questions/43991/implement-odata-api-for-stackoverflow implemented here https://data.stackexchange.com

PHP OOP structure problem, simulate multiple inheritance -

i have e-shop multiple product types. , have thought of following structure cart_item -- cart_product -- cart_download order_item extends cart_item -- order_product -- order_download the problem want have order_product extend order_item , cart_product. because needs method generic order_item ( price order not product ) methods cart_product ( shipping calculations ) i know php doesn't support multiple inheritance, wandering cleanest way emulate this. right have order_product extend cart_product duplicate code order_item in order_product order_download. either use interfaces , implement methods manually or via strategies . or use composition instead of inheritance, meaning let order_product have order_item , cart_product . on sidenote: consider making "shipping calculations" it's own service class can pass appropriate product instances to.

iphone - How to fetch complete objects (not faults) from CoreData? -

i'm new coredata concept, , may i'm getting wrongly, want fetch fully-qualified array of data coredata (not these abstract faults). my problem displaying list of objects coredata user in uitableview , @ same time refreshing data in background thread. if user scrolling tableview @ same time of objects deleted/changed i'm getting coredata not fulfill fault exception thanks ok, easy, need set request's property returnsobjectsasfaults no like this: [request setreturnsobjectsasfaults:no]; i'ts strange nobody answered simple question

Starting a process when Linux starts (Ubuntu) -

i have process (spark chat client) needs run when ubuntu boots up. have done followings. i created run.sh file fire application (and check it's working) i created symbolic link both /etc/rc5.d/ , /etc/rc3.d/ run.sh file. (a symbolic link working fine) but processes don't start when machine boots. (is way or doing wrong thing here?) i'm running on ubuntu 10.04 lts (lucid lynx). your solution would've worked in linux distributions. however, ubuntu never goes past runlevel 2. just in case, means contents of rc?.d ? > 2 not used unless manually raise runlevel root. use rc2.d :)

ios4 - How to make a universal app (iPad and iphone 4.1) runs on iPod 3.1.3 -

i building universal iphone/ipad , set deployment target 3.0. can run on ipad 3.2 , iphone 4.1. however, when build , run on ipod 3.1.3, runtime automatically picks ipad code path , tell me cannot find uipopovercontroller , uimenuitem. in iphone path code, don't use that. it builds , when trying run, says error , cannot find: dyld: symbol not found: _objc_class_$_uipopovercontroller referenced from: /var/mobile/applications/my_app expected in: /system/library/frameworks/uikit.framework/uikit editted : if remove of ipad classes , set app.info main nib bundle iphone only. then, works well. think problem runs ipad code. don't know what's wrong ipod or project you need make runtime tests classes not present on 3.1.3. cannot have code [uipopovercontroler alloc], , must weaklink frameworks. see answers question: how should approach building universal ios app include ios 4 features, though ipad doesn't yet run ios 4? (the question different your...

apache - Php requests through proxy -

i have local apache server, , need pass requests php script (running on local server) through proxy. need set proxy apache/php. how configure apache server proxy outgoing connections ? well answer partly yes. php has socket opening functions, theoretically can defining own functions. php has introduced context parameter of functions external calls. example usage file_get_contents following: $url = 'http://www'; $proxy = 'tcp://xxx:8080'; $context = array( 'http' => array( 'proxy' => $proxy, 'request_fulluri' => true, ), ); $context = stream_context_create($context); $body = file_get_contents($url, false, $context); but cannot "something" make requests magically go through proxy. not entirely true well, have on layer. have possibility use vpn work great emulates network card. there utilities same socks proxies, heard hacks port through http proxies think rather unlikely...

c# - what is the simplest and correct way to calculate age? -

possible duplicate: how calculate someone's age in c#? hi, simple question. need calculate age , allow people 21. use timespan? given inputting date need check if >=21. suggestions? the easiest way isn't calculate age - it's see whether birthday after limit: datetime twentyoneyearsago = datetime.today.addyears(-21); if (birthdate > twentyoneyearsago) { // sorry, you're young } note on february 29th on leap year, addyears return february 28th on relevant earlier year. that's want in case, if user has entered actual date .

html - Links are disabled -

on site: http://elektrikhost.com/ when try , click on link, disabled. think because of 2 images @ end of navigation bar. tried remove images navigation navigation falls apart. site client , must have images in. how can work? my html: <div class="ref1"> <img src="images/ref1.png" alt="ref" /> </div> <nav> <ul> <li><a href="index.html">home</a></li> <li><a href="about-us.html">about us</a></li> <li><a href="https://clients.elektrikhost.com/">client login</a></li> <li><a href="https://clients.elektrikhost.com/submitticket.php">support</a></li> <li><a href="contact.html">contact</a></li> </ul> </nav> <div class="ref2"><img src="images/ref2.png" alt="ref" /...

running Javascript through IE via PHP -

i need run javascript code on server side using ie8 (the javascript works activex objects) need run command line, php. so in short, install apache + php on 2003 windows server, , php use system() execute iexplore running page of javascript. i know if logically possible, can see number of pitfalls: php might not able execute iexplore without user logged in. iexplore might not run javascript correctly interact activex objects iexplore might not quit when js finished running. i attepmt make little test case can, pointers aproach apreciated. edit: now, realise round way of doing things (read, wrong), goal make dymo label printer print central location rather client machines (this js from). dymo sdk provide several ways of interacting printers, im still looking way use pure php. think might possible use 1 of example cli binaries. does dymo have way of interacting command line? if can send commands via shell_exec() . http://www.php.net/manual/en/function.shell-ex...

about Lunar lander in Android (inner class) -

i new android. also new java, please feel free give me advice, appreciate it. the question in lunarlander.java /** handle thread that's running animation. */ private lunarthread mlunarthread; /** handle view in game running. */ private lunarview mlunarview; but in lunarview.java class lunarview extends surfaceview implements surfaceholder.callback { /** handle application context, used e.g. fetch drawables. */ private context mcontext; /** pointer text view display "paused.." etc. */ private textview mstatustext; class lunarthread extends thread i have learned c , c++ so can't figure out why can call inner class?? classes , fields without modifiers private or protected can accessible class in same package. can access lunarthread lunarview.lunarthread or import class lunarthread done in lunarlander.java: import com.example.android.lunarlander.lunarview.lunarthread; see book java references.

javascript - Debugging issues : detect where my focus is with jQuery? -

forcing focus() on element easy, after having debug issues, realize trying determine focus gone lot harder. thing i'm generating modal window using jq.ui, , time time, while focus supposed set on first input of form inckuded in modal, cursor disappears, never show again unless reload page. is there straightforward way detect focus/cursor ? thanks lot. you can see element it's on checking document.activeelement , example: alert(document.activeelement.innerhtml); //see content aid in iding

windows - Hudson git commands are *incredibly* slow -

i have installed msysgit, , attempting use inside of hudson. whenever run command in interactive shell, whether git-bash or command prompt, commands instant. when run them in hudson, lag very long time. running /bin/git help took 63 seconds when invoked it. i've never waited long enough see clone begin outputting (>10 minutes). the hudson mailing list down, figured try here... i've run problem well, , figured out workaround. when hudson runs service, missing normal desktop environment has, causes network have re-load each process. msys-1.0.dll attempts load in netapi32.dll causes take long. downloaded plink.exe putty, , set git_ssh env use instead. problem averted.

.net - MS Workflow Foundation 4 - Can the workflow model be interigated at runtime, as in to generate a visual representation of it? -

can workflow model interigated @ runtime. reason, generate visual web representation of it? highlighting current node of workflow, example. if want check on activity tree workflowinspectionservices that.

linux - which directory should I checkout our java project files into for a team build -

we use svn(subversion) our source repository. on same box, build our project plus deploy onto appserver. team members(under 10, in number) login linux (ubuntu server) box , run build script. question : know directory typically used creating home directory subversion checkout , doing build. type of permissions should giving teammembers can come in dir, update source code(svn update) , run build script (ant). p.s : i'm interested in understand best-practices. thank you, sounds need continuous integration server. install hudson on server , use instead. hudson automatically check out changes subversion , build them when checked in. can make deploy app server after successful build. , can trigger builds manually if want, example release. you'll find easy started with.

Exporting to multiple worksheets using SSIS -

i'm starting out in ssis, , wondering if it's quite straightforward use 2 sql queries create 2 worksheets in 1 workbook using ssis, or whether should suggest way produce data. yes, straightforward. can use same excel connection manager both , in 2 excel destinations, select "name of excel sheet". if want create worksheets using oledb like: string destination = "c:\myfile.xls"; using ( oledbconnection conn = new oledbconnection( string.format( "provider=microsoft.jet.oledb.4.0; data source='{0}';" + "extended properties='excel 8.0;hdr=yes;'", destination ) ) ) { conn.open(); using ( oledbcommand cmd = new oledbcommand( "create table [sheet1$]([column1] varchar(255)," +"[column2] date,[column3] integer,[column4] longtext)", conn ) ) cmd.executenonquery(); using ( ole...

cocoa touch - iPad status bar overlaps view -

in ipad application, have 768x30 px view place below status bar coordinates (0,0). status bar visible. when app launches status bar overlaps view, view appears under status bar. creating view in interface builder , appears correctly on there. the view appears in correct position automatically after screen rotates though. , if rotate landscape position still correct. right after launch, before rotations appears out of place. ideas? thanks edit : in app delegate's didfinishlaunchingwithoptions, add viewcontroller.view.frame = window.screen.applicationframe; this somehow magically tells view controller have correct frame both when app launched (in orientation) after rotating device. previously, had suggested: i able resolve issue adding window nib , adding view it, then. hopefully too.

ftp - how to preserve file modification time with LFTP -

i wrote script sync several servers @ once. 1 of problem cannot lftp preserve initial file modification time. basically, upload files while changed. do know how force lftp preserve file modification time when downloading or uploading? thanks help. korchkidu on following page http://www.bouthors.fr/wiki/doku.php?id=en:linux:synchro_lftp the authors state: when uploading, not possible set date/time on files uploaded, that's why –>ignore-time needed. so if use flag combination --only-newer , --ignore-time can achieve decent backup properties, in such way files differ in size replaced. of course doesn't if need rely on time-synchronization if perform regular backup of data, it'll job.

Interchangeability / re-usability of WPF, Silverlight and Silverlight OOB applications? -

for experienced wpfers out there, how re-usable wpf, silverlight , silverlight oob applications , components? how overlap there? for example, write 1 application , deploy in 3 aforementioned ways? ideally, want write little code possible , have flexibility of deploying in range of scenarios, maybe enabling functionality depending on deployment. wpf family of technologies seems starting point casual observer.. really? the simplified version of answer is: 1. silverlight subset of wpf. 2. silverlight in browser apps , silverlight oob apps running on same framework. deployment difference. 3. oob apps can installed "trusted" apps, , have looser security restraints in browser apps. porting wpf app silverlight going difficult, wpf app use many features of .net framework not available in smaller subset of framework available silverlight apps. want avoid. porting silverlight app wpf easier. still challenge there features in silverlight not in wpf (though not ma...

subprocess replacement of popen2 with Python -

i tried run code book 'python standard library' of 'fred lunde'. import popen2, string fin, fout = popen2.popen2("sort") fout.write("foo\n") fout.write("bar\n") fout.close() print fin.readline(), print fin.readline(), fin.close() it runs warning of ~/python_standard_library_oreilly_lunde/scripts/popen2-example-1.py:1: deprecationwarning: popen2 module deprecated. use subprocess module. how translate previous function subprocess? tried follows, doesn't work. from subprocess import * p = popen("sort", shell=true, stdin=pipe, stdout=pipe, close_fds=true) p.stdin("foo\n") #p.stdin("bar\n") import subprocess proc=subprocess.popen(['sort'],stdin=subprocess.pipe,stdout=subprocess.pipe) proc.stdin.write('foo\n') proc.stdin.write('bar\n') out,err=proc.communicate() print(out)

javascript - Vista Gadget - Show tooltip on mouse over -

i have vista gadget has few div's , img's. elements have 'title' attributes set display tooltip. if in gadget, , focused tool tips show... normal. if click on desktop hover on supposed have tooltip nothing shows until click gadget , hover on item wish see tool tip for. this annoying , hope can shed light on this. the same true of use of native tool tip classes in windows applications - appear active (focussed) window. if want work around solution roll own tool tips appear on mouseenter , disappear on mouseleave .

windows - Unique file identifiers on NTFS and $Object_ID -

from articles have found online there appears 2 forms of unique identifiers files on ntfs: using windows api getfileinformationbyhandle(), can access struct by_handle_file_information, contains volume serial number , low/high file index. http://msdn.microsoft.com/en-us/library/aa363788(vs.85).aspx $object_id - article http://blogs.technet.com/b/askcore/archive/2010/08/25/ntfs-file-attributes.aspx states: $object_id – attribute holds id. id used distributed link tracking service. example of how used found in shortcuts. make shortcut on desktop points file. move file. shortcut still function because using way tack source file other path , file name. not files have $object_id attribute. in fact, isn’t until actual id assigned attribute added file. i trying understand when object id set. here few questions: when object id assigned? appear based on above article in 1 scenario occurs when shortcut file created. does object id assigned automatically when file refer...