Posts

Showing posts from August, 2015

How to tell if an Android device will be able to provide a location? -

i'm writing geo app , works nicely, i'm considering how it'll work on devices don't have gps or 3g, , wifi may off or not provide location info. is best bet request location update (or use last known) , assume there way location (whether gps or network) or framework include way see what's available, , avoid geo-lookup delay? i figure on device no gps app should provide ui user specify location, , remember in sharedprefs don't have keep re-entering (i'm thinking devices google tv, , tablets). i'd appreciate suggestions on how handle process of acquiring location in context of various devices have different levels of geo-awareness, , how handle that. you can invoke locationmanager.getallproviders() retrieve location providers, or invoke locationmanager.getproviders(true) retrieve active location providers. boolean hasactivelocationprovider = false; locationmanager locationmanager = context.getsystemservice(context.location_service);

api - Where can i find a how-to for writing a wagon for maven 3? -

maven has changed version 2 3 , has changed ioc container plexus google guice. so wagon (to download artifacts sourceforge file release area) maven 2 must rewritten maven 3 satisfy guice. there tutorial / api description / learn how change plexus wagon guice wagon? org.sonatype.aether.connector.wagon.wagonrepositoryconnector example use wagon in maven 3

XNA isometric tiles rendering issue -

Image
i'm working on xna game prototype. i'm trying achieve isometric view of game world (or othographic?? i'm not sure right term projection - see pictures). world should tile-based world made of cubic tiles (e.g. similar minecraft's world), , i'm trying render in 2d using sprites. so have sprite sheet top face of cube, front face , side (visible side) face. draw tiles using 3 separate calls drawsprite, 1 top, 1 side, 1 front, using source rectangle pick face want draw , destination rectangle set position on screen according formula convert 3d world coordinates isometric (orthographic?). (sample sprite: ) this works long draw faces, if try draw fine edges of each block (as per tile grid) can see random rendering pattern in lines overwritten face , not. please note world representation, x left right, y inside screen outside screen, , z down. in example i'm working top face-edges. here (picture): i don't understand why of lines shown , not. rende

yahoo weather country and city list -

when need weather city put link: http://weather.yahooapis.com/forecastrss?w=713169 but how country city code(id)? maybe xml, rss? thanks see this: forecastrss?w=713169 w parameter woeid. woeid invented yahoo think , means wehereonearthid. google search woeid list , you`ll find answer.

php - Automatically filling a form and submitting it doesn't get the parameters to the server -

i have form filled automatically js my form is: <form id="dosubmit" method="post"> <input type="text" id="usr" /> <input type="password" id="pwd" /> </form> my js is: document.forms["dosubmit"].elements["usr"].value = usr; document.forms["dosubmit"].elements["pwd"].value = psw; document.forms["dosubmit"].action = location.pathname + "user"; document.forms["dosubmit"].submit(); now on next page php, when try use error undefined index , when type print_r($_post) array() any idea how can post form data on next page? your input elements need have name attribute: <form id="dosubmit" method="post" action=""> <input type="text" id="usr" name="usr" /> <input type="password" id="pwd" name="pwd"

javascript - Facebook JS SDK: access_token in plain text and security -

when user logs facebook using popup displayed fb.login() call, js sdk plants domain cookie containing oauth access_token in plain text. then, cookie being sent server every subsequent request - , it's pretty obvious not every request uses https . isn't security problem? if so, how solve it? an attacker, able sniff network traffic (e. g. wireless lan), can read cookie. , pretend person created for. this not issue because same attack works on facebook pages itself: username/password - authentication done via https. following pages use unencrypted http, contain cookie. there easy-to-use firefox extension allows steeling of cookies, if able sniff network traffic: http://codebutler.com/firesheep ps: stackoverflow.com vulnerable, too.

iphone: Use Core Plot with large number of data point, or another graphing solution? -

i wanting use core plot before work on implementing it, wondering how performs large number of data points. of data want display on line graph has around 5000 data points. can core plot show of data on screen without having scroll see more data? load many points quickly? core plot cache larger graphs this? any comments great. can core plot show of data on screen without having scroll see more data? sure, scale of plot space , axes independent of number of data points. will load many points quickly? it depends on format you're starting (core plot supports several ways of getting data), device you're using, , how define "fairly quickly". gut feeling loading data won't bottleneck no matter format use--drawing 5000 points will. you'll have try see if meet needs. does core plot cache larger graphs this? it caches data in efficient format , there methods add , remove data points without reloading everything. not cache bitmap explicitly.

c++ - Qt Get the amount of up time for current application -

is there way in qt time of application time system? thanks in advance. you can use qelapsedtimer class qt 4.7 uptime app. class use monotonic clocks if can. just create instance, , call start on @ start of program. on, can number of milliseconds program has been running (or more precisely, since call start ) calling myelapsedtimer.elapsed()

c# - ASP.NET MVC: Views using a model type that is loaded by MEF can't be found by the view engine -

Image
i'm attempting create framework allowing controllers , views dynamically imported mvc application. here's how works far: i'm using .net 4, asp.net mvc 3 rc , razor viewengine controllers exported , imported using mef per project - call set of controllers , views given project "module" assemblies discovered using mef dynamically referenced buildmanager using pre-application start method , buildmanager.addreferencedassembly . binaries (from exporting project) , views copied target project's folder structure using build event controllers selected using custom controller factory inherits defaultcontrollerfactory , overrides getcontrollertype() views selected using custom view engine inherits razorviewengine , overrides getview() , getpartialview() allow views in module-specific view directories everything works far except views using typed model. views use dynamic model work fine, when specify model type using @model , ysod says "the view '

cygwin - How to spawn a bash script from Java on Windows? -

is there way make java spawn bash script on windows? have cygwin installed, , i've associated .sh file extension cygwin bash. following code, works on linux, isn't working: string[] cmdarray = { "scriptname.sh", "-force", categoryname}; process proc = runtime.getruntime().exec(cmdarray, null, directory); try adding either bash or start first parameter.

javascript - Add table column cells with input textbox and without -

i adding values of column in table following javascript function: function sumofcolumns(tableid, columnindex, hasheader) { var tot = 0; $("#" + tableid + " tr" + (hasheader ? ":gt(0)" : "")) .children("td:nth-child(" + columnindex + ")") .each(function() { tot += $(this).html(); }); return tot; } i modify adds not numbers in cell, include value of textboxes in cells. cell can either have number or textbox number. the following cells should add 2115: <table> <tr><td>100</td></tr> <tr><td><input type="text" value="5" /></td></tr> <tr><td>10</td></tr> <tr><td><input type="text" value="2000" /></td></tr> </table> how can efficiently? input! you this: function sumofcolumns(tableid, columnindex, hasheader) { var tot

iphone - adding multiple icon footer to tableviewcontroller (one section) -

hi add multiple icon foot footer of uitableviewcontroller has single section in entirety. how add this? implement - (uiview *)tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section . let return view, added icons. - (uiview *)tableview:(uitableview *)tableview viewforfooterinsection:(nsinteger)section { uiview *view = [[uiview alloc] initwithframe:cgrectmake(0,0, tableview.frame.size.width,tableview.frame.height)]; uiimage *img = [uiimage imagenamed:@"nameofimage.png"]; uibutton *button = [uibutton buttonwithtype:uibuttontypecustom]; [button setbackgroundimage:img forstate:uicontrolstatenormal]; [button addtarget:self action:@selector(someselector:) forcontrolevents:uicontroleventtouchupinside] [view addsubview: button]; return [view autorelease] }

oracle - SQL tuning issue -

i have query: select count(1) cnt file_load_params a.doc_type = (select b.doc_type file_load_header b b.indicator = 'xelfasi') order a.line_no which explain plan is: ----------------------------------------------------------------------------------------------------- | id | operation | name | rows | bytes | cost (%cpu)| time | ----------------------------------------------------------------------------------------------------- | 0 | select statement | | 1 | 7 | 3 (0)| 00:00:01 | | 1 | sort aggregate | | 1 | 7 | | | |* 2 | table access full | file_load_params | 15 | 105 | 2 (0)| 00:00:01 | | 3 | table access index rowid| file_load_header | 1 | 12 | 1 (0)| 00:00:01 | |* 4 | index unique scan | file_load_header_uk |

c++ - Anyone here have an opinion on HeapAgent? -

i'm trying track down memory corruption going on in app - i've heard of (but never used) boundschecker. rumour it's way slow use in high performance application game (which app i'm trying fix is). has here used heapagent , have (good or bad) it? thanks in advance. i don't have experience using boundschecker or heapagent. if trying debug memory corruption or leaks, paul nettle memory manager good. have used memory manager track down few nasty bugs in game.

visual studio 2010 - The type or namespace name 'Extensions' does not exist in the namespace 'Microsoft.Office.Tools.Excel' -

visual studio 2010 vsto excel 2007 add-in project. trying build solution in visual studio following: the type or namespace name 'extensions' not exist in namespace 'microsoft.office.tools.excel' (are missing assembly reference?) the project referencing following assembly: c:\program files\reference assemblies\microsoft\vsto\v9.0\microsoft.office.tools.excel.v9.0.dll on machine assembly product version 9.0.21022.8. on other developer machines project builds assembly product version 9.0.30729.1. what need install upgrade these assemblies v30729? thanks, tom apparently answer install microsoft visual studio 2008 service pack 1 (we're using vsto v3.0) - http://www.microsoft.com/downloads/en/confirmation.aspx?familyid=fbee1648-7106-44a7-9649-6d9f6d58056e&displaylang=en this upgrade microsoft.office.tools.excel.v9.0.dll assembly product version 9.0.30729.1 includes extensions namespace.

encryption - Securing Connection String in Windows Azure and web.config -

i encrypt connection string in web.config described here: http://blogs.msdn.com/b/sqlazure/archive/2010/09/07/10058942.aspx published azure , working expected. facing problem local development work against local database don't need encryption of connection string. local development configured debug configuration , tried replace (transform) encrypted connectionstrings section of web.config like: <connectionstrings configprotectionprovider="customprovider"> <encrypteddata type="http://www.w3.org/2001/04/xmlenc#element" ... </encrypteddata> regular non encrypted section web.config.debug <connectionstrings> <add name="applicationservices" connectionstring="data source=localhost... </connectionstrings> i had no problem adding sections xdt:transform="insert, did not manage delete sections web.config. results in parser error message: unrecognized element 'encrypteddata' when executing web pr

can you do paypal integration with asp.net c# even though your website is still offline? -

we working on system paypal integrated system. i'm having doubts, should host our site first? or can our paypal integration though on trial mode. or using local server. please guys me out. i'm confused. t_t use sandbox mode! :) alternatively, can deploy website public server, paying attention allow access developers' machines (ie. restricting allowed ips, using authentication, etc)

c# - Delegate threading overhead in Web Page Lookup -

i've done searching haven't quite seen info i'm looking. i have web app user visit page querystring parameter passing id of object should retrieve. what need run number of checks ensure user can access data, , find out if user has lock (recorded in db) on object. currently these searches performed sequentially, i'm thinking best option might use delegates able fire off 3 or 4 searches required @ once use results returned. my implementation using delegate(s) , calling begininvoke, i'm worried overhead of threading may lead no speed increases. my research has indicated use threadpool, there shouldn't overhead, i'd know if has implemented kind of solution similar scenario on high traffic site , seen resutls it? the reason i'm looking reengineering our application ground up, , need make sure building scale considerably. since asp.net, unless have low site activity (which contrary "that scale considerably") suggest against

iphone - How to add Core Data to Static Framework for iOS? -

i develop static library in xcode. want use core data using core data model (file extension .xcdatamodeld). when want add project, it's impossible check in "get info" field, it'll used in framework. how should add such data, framework able use it. thanks , take care plp :) you add core data framework access headers, other (application) project. users need add framework when build apps. you can't , shouldn't add core data statically, if you're thinking of it.

iframe - Unsafe JavaScript attempt to access frame with URL -

i getting below error when try set hash value parent url iframe contains domain url: unsafe javascript attempt access frame url "url1" frame url "url2". domains, protocols , ports must match. how can fix problem? from child document of different origin not allowed access top window's location.hash property, allowed set location property itself. this means given top windows location http://example.com/page/ , instead of doing parent.location.hash = "#foobar"; you need know parents location , do parent.location = "http://example.com/page/#foobar"; since resource not navigated work expected, changing hash part of url. if using cross-domain communication, recommend using easyxdm instead.

vbscript - How does garbage collection work in JavaScript? -

how garbage collection work in javascript? similar .net garbage collection? , because implementation of garbage collection in vbscript bad people avoided , established preference javascript standard client-side language? how garbage collection work? the short answer is: when block of memory (an object, say) no longer reachable, eligible reclaimed. when, how, or whether reclaimed entirely implementation, , different implementations differently. @ language level, it's automatic. for example: function foo() { var bar; bar = new reallymassiveobject(); bar.somecall(); } when foo returns, object bar points automatically available garbage collection because there nothing left has reference it. contrast with: function foo() { var bar; bar = new reallymassiveobject(); bar.somecall(); return bar; } // elsewhere var b = foo(); ...now reference object survives call, , persists until/unless caller assigns else b or b goes out of s

html - jQuery.flash() vs messy default Flash Professional code -

if (rarely) put flash onto website develop use this: $('#hello').flash({ src: 'hello.swf', width: 320, height: 240 }); yet code flash gives horrible messy bit of code. why 5 lines of code = flash's default html embedding code. right in thinking theres no disadvantage use jquery version? you mean why simpler use jquery flash plugin adobe-provided code? because wraps complexity away you. same stuff still happening in scripts have included, don't see it. if you're including jquery , flash plugin embed flash on page you're downloading more script adobe's default or not-jquery-based 1 swfobject . if you're using jquery on site won't make difference.

java local variables - how do i get a variable name or type using its index -

i'm using asm instrumentation library. using visitvarinsn index of local variable. want use index , recieve more useful information name of variable , type. have idea how? thanks. pick in localvariablessorter.visitlocalvariable method.

mercurial - How do I make files with a specific extension be added to a commit automatically? -

i'm trying figure out how automatically add files of extension (for example *.tex) commit dialogue (the checkbox should checked! don't want search new files every single time) i tried adding *.tex auto-commit list (=comma separated list) doesn't anything. mercurial has called hooks stuff automatically on events. see hgrc documentation , mercurial wiki page on hooks . your task can done pre-commit hook, defined in repository's hgrc file: [hooks] pre-commit = hg add -i "*.tex" before commit, hook automatically adds not yet tracked tex files in root of repository's current working directory. adjust value of -i option or add more -i options specify more complex patterns of files add automatically. note: don't use tortoisehg, cannot if hook causes checkboxes pre-selected. anyway, should work if commit tortoisehg.

sql server - MAX/ORDER BY on char column -

in sql server 2005 database have column rma_number datatype char(10) in table rma . the value increasing number format rma0002511 . fastest way highest number increment on inserting? my first approach was: select top (1) rma_number rma (rma_generated = 1) order creation_date desc but error-prone because somehow possible higher rma_number has earlier creation date. workaround, sorting primary key works: select top (1) rma_number rma (rma_generated = 1) order idrma desc but maybe possible source of error. logically best way order rma_number desc . but because not sure if gives correct result , thought sorting char column slow if number of records increase, chose order date column. so, is idea order char(10)-column (performance , accuracy)? would better select max( rma_number ) rma highest number(perf. , accuracy) should stick on using primary key order if first 2 points wrong or should use int column , format number in applic

ASP.net remove column borders from Gridview footer in CSS. just wont go away! -

ok, bugging me. have gridview in asp.net i've enabled footer on: <asp:gridview id="results_gridview" runat="server" autogeneratecolumns="false" cssclass="mgrid" pagerstyle-cssclass="pgr" alternatingrowstyle-cssclass="alt" showfooter="true" gridlines="none"> then i've set footer css style: <footerstyle cssclass="footer" /> that appears fine, images displayed etc, although cant rid of borders columns above! .mgrid { width: 100%; background-color: #fff; margin: 5px 0 10px 0; border: solid 1px #525252; border-collapse:collapse; } .mgrid td { padding: 2px; border: solid 1px #c1c1c1; color: #717171; } .mgrid th { padding: 4px 2px; color: #fff; background: #424242 url(grd_head.png) repeat-x top; border-left: solid 1px #525252; font-size: 0.9em; } .mgrid .alt { background: #fcfcfc url(grd_alt.png) repeat-x top;} .mgrid .footer { height: 15px; width: 100%; background:

geolocation - How can I get a users location in a KRL rule? -

how can users location in krl rule? what method? what advantage or disadvantage of using method? here simple example rule locations active { select using ".*" setting () pre { whereareyou = location:region(); msg = << #{whereareyou} >>; } notify("i think live in", msg) sticky = true; } and here docs. http://docs.kynetx.com/docs/location the issue find ip not represent real location of user because user using proxy. isp's ip registered location , isp's hub not direct location of ip being used @ given moment. with advent of html 5 , location apis in browser may posable in future more exact location has not been implemented in krl of yet.

windows xp - Assembly program help -

i have program supposed clear screen , print name, new line , print name again. when run nothing shows up. program teminated normally. i'm doing in windows command prompt using debug. call 010e call 0125 call 012d call 0125 int 20 push ax #clearscreen(010e) push bx push cx push dx xor al, al xor cx, cx mov dh, 18 mov dl, 4f mov bh, 07 mov ah, 06 int 20 pop dx pop cx pop bx pop ax ret mov dx, 0200 #printline(0125) mov ah, 09 int 21 ret push ax #new line( 012d) push dx mov ah, 02 mov dl, 0d int 21 mov dl, 0a int 21, pop dx pop ax ret db' antarr$ #(0200) your first , obvious error calling int 20 , terminate program, instead of bios interrupt int 10 withing clearscreen function. edit: why don't use assembler this? try nasm example. also, program: tech , finding right dos or bios function.

html - Can you recommend an ASP.NET template tutorial? -

do know simple tutorial learn best way implement templates in asp.net? working in vs 2008. thanks! this might looking (if wanted ajax templating http://weblogs.asp.net/scottgu/archive/2006/10/22/tip_2f00_trick_3a00_-cool-ui-templating-technique-to-use-with-asp.net-ajax-for-non_2d00_updatepanel-scenarios.aspx )

linux - How to check if screen saver is running? -

i have script written in bash, need take different route in case screensaver running. linux xorg , kde. script called cron, , connects display=:0. any hint/idea how check state of screensaver? if kde4 running, can use dbus check if screen saver running: $ qdbus org.freedesktop.screensaver /screensaver org.freedesktop.screensaver.getactive or $ qdbus org.kde.screensaver /screensaver org.freedesktop.screensaver.getactive this works gnome, known not following freedesktop standards, have use: $ qdbus org.gnome.screensaver /screensaver org.gnome.screensaver.getactive last not least, can check whether standard x screen server running using xscreensaverqueryinfo() , checking state field.

Highest Frequency of Letter(s) in each Line of File-Core Java Programming -

stackoverflow people, need java advice , code reads file(file.txt) , prints console list of letters occurred highest frequency in each line of file, followed frequency. the list of letters should alphabetical list of upper case letters followed alphabetical list of lower case letters. sample input file(file.txt) when riding bicycle backwards down one-way street, if the wheel falls of canoe, how many ball bearings take fill water buffalo? hello howard. sample output e 6 al 7 3 hlo 2 sample code: public class readfilefromsystem{ public static void main(string args[]){ bufferedreader in = new bufferedreader(new filereader("c:/input.txt"));//the file containing lines. hashmap<character,integer> lettercount = new hashmap<character, integer>(); int counter =0; // string buffer file reading stringbuffer str; // reading line line file while ((str = i

notifications - ASP.NET MVC - Models notifying the Views? -

in of classic descriptions of mvc, model notifies views via observer pattern. seems me doesn't happen asp.net mvc, , 1 of fundamental relationships between model, view, , controller missing. is case? if so, why? views in asp.net mvc stateless. exist short time , sent down client. the process goes this: request comes in controller. controller retrieves model , instantiates view (passing model). the view rendered, markup returned client, , disposed of. therefore, since view no longer exists after sent client...there's nothing notify model changes.

copy paste - Ant build shutdown - Ctrl C -

i have set of ant tasks use run test suite, 1 of tests freeze , entire test suite hang. added shutdown handler when hit ctrl-c ant shutdown gracefully , give me report final test marked not run. (this important because these integration tests , can run hours) works great except on windows shutdown hook not being called. there way can ant respond kind of input , graceful shutdown? it seems long-running known issue . the problem on windows ant ctrl-c is, have observed, not propagated child vms. things might consider: break test smaller pieces , use timeout kill hangs. limit data lost 1 test hangs. in test run, add 'listener' thread waits shutdown 'signal' (perhaps presence of flag file) , arrange signal set ant, on command console, if hang detected. this appears complex, might worth shot. you'd need combine ant parallel , input tasks run tests in 1 thread, , wait input console in second thread. when abort chosen, signal file written, detec

sql - Date & Time in seperate columns, time in second format, how to get 'max datetime'? -

i faced getting latest (newest) record part, , way using "max date" approach. here basic schema (and sample data): lddate ldtime ldpart id 2010-10-26 00:00:00.000 52867 90-r6600-4100 186 2010-11-01 00:00:00.000 24634 90-r6600-4100 187 2010-11-24 00:00:00.000 58785 90-r6600-4100 194 2010-11-24 00:00:00.000 58771 90-r6600-4100 195 2010-11-17 00:00:00.000 29588 90-r6600-4100 201 2010-11-08 00:00:00.000 29196 90-r6600-4100 282 2010-11-08 00:00:00.000 29640 90-r6600-4100 290 2010-10-19 00:00:00.000 58695 90-r6600-4100 350 2010-09-22 00:00:00.000 32742 bh4354-f0 338 2010-09-22 00:00:00.000 32504 bh4354-f0 340 2010-11-17 00:00:00.000 31157 bh4354-f0 206 2010-11-08 00:00:00.000 27601 bh4354-f0 218 2010-11-08 00:00:00.000 27865 bh4354-f0 21 2010-09-22 00:00:00.000 23264 br6950-f0 70 2010-09-22 00:00:00.000 23270 br6950-f0 77 2010-09-24 00:00:00.000 27781 br6950-

making Jquery Swap Image plugin target a new hyperlink -

i'm using swap image plugin , particularly disjoint rollovers 2. here's live page i'm trying make target image (the big image on left) new hyperlink depending on image loaded there. code i'm using is <img class="swapimagedisjoint { sin: ['#main:images/big-head-4.jpg'], sout: ['#main:main:images/blank-slate.jpg'] }" src="images/head-1.jpg" alt="" /> thanks you don't need swap image want. can of single click method. put stripped-down example here: http://jsfiddle.net/3enwq/ (in example, used img urls link url, don't have same) i added attributes small images called swapimg , swapurl . used click function load these main image , mainlink href added. tacked on each() preload of large images if desire. $('.swapimage').click( function() { $('#main').attr('src', $(this).attr('swapimg')); $('#mainlink').attr('href', $(this).attr

drupal - Programmatically change the submitter user in the webform module -

i automatically create users visitors submit webforms per http://www.mikewagan.net/2010/10/drupal-create-user-accounts-through-the-webform-module/ this works fine, 1 little problem: webform submission data should changed represent correct submitter (my newly created user), tied unauthenticated user. i tried $form['details']['uid']['#value'] = $account->uid; in additional processing field, not seem work. which part of webform's submission data have massage make happen? my suggestion perform hook_nodeapi , , edit submitter inside node right before created. check states nodeapi gives here: http://api.drupal.org/api/drupal/developer--hooks--core.php/function/hook_nodeapi/6

database - ajax with manifest not workign -

i have strange problem web app. app loads data database , can work offline (html5 database feature). but when added manifest file made offline mode more powerful, ajax calls loading data server client does't working anymore. does know can reason that? adding manifest file make ajax calls unusable? nest you need include server-side ajax files in network section of cache manifest. should let ajax calls work properly. note work when user online. if they're running application cache , offline, ajax calls fail since server unavailable.

plsqldeveloper - cursor- how to compare and select unique records -

if have compare 2 cursors , retrun unique vals how do that example cursor c_stock_option select empid, name, ssn, isenrolled employee isenrolled=1 cursor c_espp_option select empid, name, ssn, isenrolled employee isenrolled=2 now want reject recs in second cursors in cursor 1 select, how do that ummm.....by definition, of rows isenrolled=2 not overlap rows isenrolled=1. think you're asking more general question how exclude rows 1 result set in another. if case, take few different approaches: 1) cursor c_stock_option select empid, name, ssn, isenrolled employee isenrolled=1 minus select empid, name, ssn, isenrolled employee isenrolled=2 2) cursor c_stock_option select empid, name, ssn, isenrolled employee isenrolled=1 , empid not in ( select empid, name, ssn, isenrolled employee isenrolled=2) 3) cursor c_stock_option select empid, name, ssn, isenrolled employee e isenrolled=1 , not exists( select 1 e

wpf - Use checkbox as togglebutton in expander -

im quite new wpf , have following problem. i need create list (i using listbox) of items can expanded (expander). problem is, can expanded, if have been 'selected'. each listboxitem should have checkbox , text. so basic example illustrate mean: <listbox> <item>(checkbox) john doe</item> <item>(checkbox) mike murray</item> </listbox> if (so multiple allowed) of checkboxes in listbox checked, item expands showing more data. again example: <listbox> <item> (checkbox-checked) john doe data shown in expanded area </item> <item> (checkbox-unchecked) mike murray</item> </listbox> i cant expander use checkbox 'togglebutton'. could me out? example code welcome... this should trick: <listbox> <listbox.resources> <style targettype="expander"> <setter property="template"> <setter.valu

c# - WPF - Bound Control Not Updating When Property Changed? -

i've bound text property of textbox base object's property , seems work fine. unfortunately, when programatically change value of property, doesn't seem update on gui. here's property: public string sealeddate { { string result = string.empty; if (_dacase.sealeddate != datetime.minvalue) { result = formatting.formatdate(_dacase.sealeddate); } return result; } set { datetime thedate = datetime.minvalue; if (datetime.tryparse(value, out thedate) && _dacase.sealeddate != thedate) { _dacase.sealeddate = thedate; base.onchanged(); //fires event know value of object has changed } } } and value of property being set when property being set: public bool issealed { { return _dacase.sealedid > 0 || _dacase.sealeddate != datetime.minvalue; } set { if (value != (_dac

ByteArray to MySQL from ActionScript 3 -> PHP via ZendAMF -

i have actionscript 3 application that's sending object php via zendamf. object contains bytearray image. i have saving bytearray blob so: $ba = new zend_amf_value_bytearray ( $im->barray ); $data = mysql_real_escape_string ( $ba->getdata () ); $query = "insert image ( bytearray ) values ( '".$data."' );"; $result = mysql_query($query); $error = mysql_error(); if($error) return "error: " . $error; else return true; this seems working fine , can see image in db (this running local , i'm using sequelpro view db). the problem when i'm sending bytearray flash, flash reports bytearray length 0. here return method in php: $result = mysql_query ( 'select * image'); $array = array(); while ( $row = mysql_fetch_assoc ( $result ) ) { $ba = new zend_amf_value_bytearray ( $row['bytearray'] ); $image = new image (); $image->id = $row['id']; $image->file = $row['filepath']; $imag

HTML Homework that doesnt pass validation but displays fine -

i asked professor use http://validator.w3.org/ web site validate html file. gives me errors. first error is: line 1, column 1: no document type declaration; implying "" second error is: line 11, column 64: required attribute "alt" not specified ✉ attribute given above required element you've used, have omitted it. instance, in html , xhtml document types "type" attribute required on "script" element , "alt" attribute required "img" element. typical values type type="text/css" , type="text/javascript" . can tell wrong? displays fine in browser using ie 8. professor says if fails in validation check assignment incomplete. great. <html> <head> <title>randy's first html web page !</title> </head> <body bgcolor="#000066" text="#00ff44"> <h1 align="center"> hello professor</h1> &

cakephp emails not working -

my problem is: in controller have: var $components = array('email'); the method send emails looks this: function send_emails() { $this->email->from = 'somebody <somebody@example.com>'; $this->email->to = 'somebody else <myspamplace@centrum.cz>'; $this->email->subject = 'test'; $this->email->send('hello message body!'); } i using cake 1.3 , running on localhost apache 2.2.11 , php5. guys have idea why doesn't work? when put $this->email->delivery = 'debug'; in code, displays email info , seems ok. do have ideas can reason why doesn't send email? are sending windows server? if so, have setup mta in php ini? can send mail using mail() function? if on windows , need mta, hmail great development, note many hosts reject mail local machine spam don't use on production without mx record, domain keys etc.

iphone - key values from an NSDictionary formatting with "()" -

i'm trying pull 2 values dictionary, values i'm getting have "()" around them. ideas causing this? here serveroutput: {"rows":[{"userid":"1","location":"beach"}]} dictionary after json: { rows = ( { location = beach; userid = 1; } ); } this i'm getting: location : ( beach ) user id : ( 1 ) both userid , location key values have "()". here code. lot. nsstring *serveroutput= [[nsstring alloc] initwithdata:dataurl encoding:nsutf8stringencoding]; if(serveroutput > 1){ sbjson *jsonff = [[sbjson new] autorelease]; nserror *error3 = nil; nsdictionary *useriddict= [jsonff objectwithstring:serveroutput error:&error3]; nslog(@"useriddict: %@",useriddict); idreturn = [[useriddict valueforkey:@"rows"] valueforkey:@"userid"]; locationreturn = [[useriddict valuefork

codeigniter pagination not working as expected -

i tried lot cant seem figure out this, appreciated. articles have votes, , have page supposed show voted articles. using codeigniter btw. controller: function most_voted() { $per_page = 3; $cur_page = $this->uri->segment(4); /* if($cur_page == "") $cur_page = 1; else $cur_page = (integer)$cur_page; */ $offset = ($cur_page - 1) * $per_page; if($offset < 0) $offset = 0; $this->load->model('article_model'); $result_rows = $this->article_model->getmostvoted($per_page,$cur_page); $total_rows = sizeof($result_rows) + 10; echo "total rows : ".$total_rows.'<br>'; echo "cur page : $cur_page <br>"; //$this->load->library('pagination'); $config['base_url'] = base_url().'articles/most_voted/page/'; $config['uri_segment'] = 4; $config[&#

xaml - Silverlight: Make all descendants of an element have a margin? -

is there way in silverlight 4 dictate elements within stackpanel must have margin, instead of specifying margin="10,0" on each one? i'm afraid it's not possible declaratively in xaml stackpanel directly. it's conceptual philosophy in silverlight/wpf panel should not modify properties of children. implement own panel anyway, or use itemscontrol that: <itemscontrol> <itemscontrol.itemtemplate> <datatemplate> <contentpresenter margin="10,0" content="{binding content}" /> </datatemplate> </itemscontrol.itemtemplate> [...] </itemscontrol> an itemscontrol uses stackpanel default, can use itemspanel property define panel itemspaneltemplate if wish so.

.net - I need to know how to deserialize a specific XML into objects defined in a custom class in C# -

given following xml: <?xml version="1.0" encoding="utf-8"?> <userattributelist> <attribute> <userid>12345678</userid> <attid>1234</attid> <attname>group</attname> <atttypeid>8</atttypeid> <atttypename>user group</atttypename> <attdata>member</attdata> </attribute> <attribute> <userid>12345678</userid> <attid>1235</attid> <attname>contact name</attname> <atttypeid>16</atttypeid> <atttypename>contact center greeting</atttypename> <attdata>john smith</attdata> </attribute> ... </userattributelist> i want deserialize following classes: [serializable] [xmltypeattribute(anonymoustype = true)] public class userattributel

ZeroMQ XREP -- Endpoint disappearing -

i using standard lru queue defined zeromq guide figure 41 , , wondering how add in protection don't send messages end points have disappeared (server crash, oom killer, along lines). from documentation read xrep drop message if going non-existant end-point, , there no way notified that. there way such notification? should send out "ping" first , if don't response "worker" dead meat me? how know same client sent ping getting message from? or use case not 1 zeromq? want make sure message has been received, don't want being dropped on floor without knowledge... pinging worker know if alive cause race condition: worker might answer ping before dies. however, if assume worker not die during request processing (you can little in case), can reverse flow of communication between workers , central queue. let worker fetch request queue (using req / rep connection) , have send answer along original envelope when processing done (using same sock

c# - WCF Service and Inconsistent accessibility -

i cannot understand wrong. mistake:"inconsistent accessibility: return type 'library.servicereference1.author[]' less accessible method 'library.funcs.getauthorslist()'" //class in dll [datacontract] public class author { [datamember] private string fn, n, p; [operationcontract] public string getfamilyname() { return fn; } [operationcontract] public string name() { return n; } [operationcontract] public string patronymic() { return p; } public author(string familyname, string name, string patronymic) { fn = familyname; n = name; p = patronymic; } } //in service public author[] getauthorslist() { return db.singleton.getauthorslist().toarray(); } why have [operationcontract] attributes in datacontract class, believe not valid outside of servicecontract decorated class? if define read properties instead of method

iphone - Only addSubView in Certain Cells -

i have 10 cells/rows in uitableview , have set 4 of these cells have text so: if (indexpath.row == 0) { cell.textlabel.text = @"before school"; } im doing of inside: - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { i struggling add uitextfield specific rows. how can achieve this? have managed add uitextfield either or none of them using: [cell addsubview:textfield]; hope can help. you should use if else statements. example: if([indexpath row] == 0){ [cell setaccessoryview:textfield]; }else if([indexpath row] == 1){ [cell setaccessoryview:textfield]; }

Get SQL INSERT OUTPUT value in c# -

in sql stored proc i'm inserting row , hoping return identity int new row, in c# code. alter procedure the_proc @val_2 varchar(10), @val_3 varchar(10) begin set nocount on insert the_table (field_2, field_3) output inserted.field_1 values (@val_2, @val_3) end in c# i'm using linq fuzzy on how retrieve output value. tried including output parameter in sql proc declaration, couldn't working either (exceptions complaining not being supplied in call). closest i've gotten in walking db.designer.cs code, iexecuteresult result returnvalue contains 0 (not correct) inspecting contained results view ( result.returnvalue results view ) have outputed value. key = (int)(db.theproc(val2,val3).returnvalue); key coming 0. want identity int value insert. output inserted.* is same thing doing select. isn't going show output parameter rather come result set. btw, returnvalue should 0 seeing in case. you'll need change linq statement capture resul

jquery - How to disable/enable custom click event for an img element in JavaScript -

i have asp.net datepicker control (no source available ) produces image element, when clicked shows calendar. want disable or enable on demand image through javascript. when added 'disabled' attribute img element, script in page goes in busy state , page never finishes rendering. guess disabled attribute causing conflict in way. my next attempt disable custom click event asp.net control adds unoptrusively. how disable click event? how re-enable img works normal. using jquery 1.4. var $img = $('img#yourid'), handler = $img.get(0).onclick; // previous click handler // unbind $img.unbind('click').click(function(){ alert('new click'); }); // rebind $img.unbind('click').click(handler); you might need check other events (mousedown mouseup etc).

Debugging Android RuntimeException - Before my code even executes -

i'm not new java new android platform. i'm finding 1 of platforms shortcomings meaningful feedback on runtime crashes. fine in user code breakpoints apply, have crash on first run preventing project starting, , can't see way track down. can shed light? dalvikvm[localhost:8626] thread [<1> main] (suspended (exception runtimeexception)) activitythread.performlaunchactivity(activitythread$activityrecord, intent) line: 2585 activitythread.handlelaunchactivity(activitythread$activityrecord, intent) line: 2679 activitythread.access$2300(activitythread, activitythread$activityrecord, intent) line: 125 activitythread$h.handlemessage(message) line: 2033 activitythread$h(handler).dispatchmessage(message) line: 99 looper.loop() line: 123 activitythread.main(string[]) line: 4627 method.invokenative(object, object[], class, class[], class, int, boolean) line: not available [native method]

database - Creating a server and client program like online reservation program using socket API in C -

i need in figuring out design principle program. donot expect progamming code rather design , architecture theory. i programming in c language using socket api. want know how sql database, socket api, other language, etc needed complete it. if possible without lot of hassle, want upload on webserver. appreciate help. thanks. make small library has wrapper functions socket api, library sql database access, , else might use. these libraries should error handling, among other thing might do. emit diagnostics , decide whether continue or abort program, , it. build , test these libraries. then write program, is, reading , writing database , network , else might add. link against libraries when building. this program, understand question, going listen on port incoming connections, fork thread (or process), , keep listening. child process decide read or write , whether network or database. i hope simple enough homework started.

jQuery form posting -

i using short script post data php processing page. function get(){ $.post('data.php',{name: form.name.value}, function(output) { $('#age').hide().html(output).fadein(1000); } ); } this send 1 input: $.post('data.php',{name: form.name.value}, i wondering how alter script send more 1 ? function get() { $.post('data.php', $('form').serialize(), function(output){ $('#age').hide().html(output).fadein(1000); }); } this assumes want send form inputs. alternatively, replace object literal such as... { name: $('input[name="name"]').val(), age: $('#age').val() }

C# Operator '/' cannot be applied to operands of type 'method group' and 'int -

error occurs on line: xpoint int32 randomsize int xpoint = picturebox1.width / 2 - randomsize - objectpos.getoffset / 10 * randomsize / 192; here's function(s) apparently cause it, can explain me why? public float getsector() { return (float)math.floor(x / 192 + 135); } public int32 getoffset () { return (int32)((x / 192) - getsector() + 135) * 192 * 10; } getoffset method , , must called. objectpos.getoffset() / 10 (note parens after getoffset) without parens, referring function, not value. if intend getoffset property, need put in get , set keywords.

scripting - cron job script creating unwanted files -

i have cron job script , used >/dev/null 2>&1 stop sending emails. each time file created in same name of php file trailing numbers phpfile.php.1, phpfle.php.2, phpfile.php.3…. there script stop that? add -o /dev/null wget command.

java - Inheritance with Generics -

i trying implement recursive tree structure arbitrary keys in java. want have tree<x,y> holds x , more (sub)trees, indexed set of y s. however, think since trees used indexing data in readonly disk file, tree should read-only. so, in order create them, made subclass, mutabletree , should allow editing operations on tree . here code: public class tree<c,k> implements serializable { protected c content; protected java.util.hashmap<k, tree<c,k>> nexts; protected tree () {} public c getcontent() { return content; } public java.util.iterator<k> getkeys () { return nexts.keyset().iterator(); } public tree<c,k> descend(k key) { return nexts.get(key); } } and mutabletree : public class mutabletree<c,k> extends tree<c,k> { public mutabletree (tree<c,k> par) { super(); this.content = par.content; this.nexts = par.nexts; } public

social networking - Scoring algorithms: how to convert the number & % of "Likes" & "Dislikes" into a single score? -

i have website users can "like" , "dislike" items. so each item, have data such total number of "likes" , % of total votes "likes". i'd calculate single score show users. using % wouldn't work because though item_a might have 90% of "likes" while item_b might have 80% of "likes", item_b should still rank in front of item_a if item_b has 10,000 total votes while item_a has 1,000 total votes. likewise using total "likes" wouldn't work because while item might have large number of "likes" shouldn't ranked high if % of "likes" low. what algorithm create single score out of data above? ideally score should "meaningful" or "normalized" in way. example if go imdb , see movie has score of 8/10, i'd know movie. on other hand if see score of 1,370 wouldn't know if or bad. there's couple of articles on how reddit sort of ranking here , ,

perforce - git p4 submit always tries to re-apply every patch -

we've moved git still have systems depend on same data being in perforce i'm mirroring our git repo on perforce follows: git pull origin master git p4 rebase git p4 submit but problem i'm seeing every time run submit after pull origin tries re-apply every commit, ones submitted results in self generated conflicts. what's interesting works: git p4 submit <--- submit changes git p4 submit <--- no changes submit, recognizes it's date but throw in git pull origin master (even if there nothing new on origin) loses track , on next submit tries re-apply everything. example: git p4 submit <--- no changes submit git pull origin master <--- no activity on git server side no changes applied git p4 submit <--- tries re-apply changes submitted earlier is git pull origin master somehow wiping out git p4's notion of changes have been applied , haven't? you still pointing @ root. check branches point right place. use gitk --all