Posts

Showing posts from February, 2013

android - tablelayout - 3 rows x 4 columns - each cell with TextView,Editview and Spinner -

good morning, i trying design layout , wondering if possible @ all. i think want tablelayout 3 rows , 4 columns. within each cell want have textview editview below textview , spinner below editview. objective user enter values , select unit of measurement, inches or millimeters. textview going identify name of parameter, user enters number , selects unit of measurement. i first tried 3 things (textview, editview , spinner) underneath each other no success. can textview , editview working when add spinner not showup. can textview, editview , 2 buttons working , can spinners working life of me can't textview,editview , spinner working although no errors when debugging or running. trying within relativeview can stack 3 things together. thought if can relativeview working can put inside tableview , 3 rows of 4 inputs accross or 12 total parameters. does make sense? right approach create way of inputting parameters, reason trying instead of linearview want see values @ 1 tim...

c# - How do you get the style of an element on an asp.net page -

i have admin page accordion javascript show/hide divs. <div class="accordion"> <h2>pending</h2> <div id="pending" class="accordion-item">partialview</div> <h2>current</h2> <div id="current" class="accordion-item">partialview</div> <h2>all</h2> <div id="all" class="accordion-item">partialview</div> </div> when delete item, page refreshes , collapsed. want have remember ones open , ones closed. the accordion javascript gives div style="display: none" or style="display: block" is there way style before page reloaded , apply after loaded again? if want see styles , changes actively on page recommend using firebug (a firefox plugin). as saving state, there 2 approaches. first ajax approach. second js only, cookie-based approach. for ajax method need write js function fir...

Redirecting hard-deleted items in Outlook to Deleted Items with VBA -

as said in title i'm trying prevent harddeleting items in outlook. able catch operation in beforeitemmove-event. user given choice whether proceed or cancel. if decides proceed, item should moved deleted items folder , not deleted permanently. my first idea cancel delete-operation setting cancel true , moving item deleted items folder. problem is, event fires again move operation, handed item-object seems broken somehow. tried setting userproperty on deleted item , moving it. in "second run" of event-sub when try read prop, runtime-error saying message not found. can s.o. help? here 2 event-handlers involved: private sub otasks_beforeitemmove(byval item object, byval moveto folder, cancel boolean) dim shoulddelete boolean shoulddelete = false dim harddeleteperformed harddeleteperformed = false if (moveto nothing) shoulddelete = true harddeleteperformed = true elseif (g_ons.compareentryids(moveto.entryid, odeleted...

html - How to reference a jsp in a different folder -

i organized jsp's in project separate folders. need change src menu1.jsp <td width="16%" valign="top"><iframe id="ifa" src="menu1.jsp?page=home" marginwidth="0" marginheight="0" scrolling="no" width="190" height="450" frameborder="0"></iframe> </td> thanks in advance just replace src="menu1.jsp?page=home" to src="new/location/menu1.jsp?page=home"

Java using AES 256 and 128 Symmetric-key encryption -

i new in cipher technology. found code symmetric encryption. byte[] key = //... secret sequence of bytes byte[] datatosend = ... cipher c = cipher.getinstance("aes"); secretkeyspec k = new secretkeyspec(key, "aes"); c.init(cipher.encrypt_mode, k); byte[] encrypteddata = c.dofinal(datatosend); its working. here can use own password. , thats needed. dont know how 128 or 256 symmetric enctryption. how can use 128 , 256 key code ? whether aes uses 128 or 256 bit mode depends on size of key, must 128 or 256 bits long. typically don't use password key, because passwords have exact length need. instead, derive encryption key password using key derivation function. very simple example: take md5 of password 128-bit key. if want 256-bit key, can use sha-256 256-bit hash of password. key-derivation functions run hashing several hundreds time , use salt well. check out http://en.wikipedia.org/wiki/key_derivation_function details. also note: run encrypt...

entity framework - Why does code first/EF use 'nvarchar(4000)' for strings in the raw SQL command? -

essentially have table zip codes in it. zipcode field defined 'char(5)'. i'm using code first, i've put these attributes on zipcode property: [key, column( order = 0, typename = "nchar"), stringlength(5)] public string zipcode { get; set; } now if query against in ef: var zc = db.zipcodes.firstordefault(zip => zip.zipcode == "12345"); the generated sql uses nvarchar(4000) inject parameters. huh? because "12345" technically string of unknown length? shouldn't ef smart enough use proper "nchar(5)" when querying table? i ask because nvarchar(4000) query takes half second whereas properly-scoped query faster (and less reads). any assistance/advice appreciated. this take advantage of auto parameterization. following article explains general concept why nvarchar(4000) used. http://msdn.microsoft.com/en-us/magazine/ee236412.aspx

web services - Best way to update Locations dynamically in Bing Maps using Silverlight? -

i'm developing test application in need to: a) draw paths downloaded data. have rest/json server whith these data , little app can consume without problem. paths downloaded once , that's all. b) draw pushpins, circles, whatever @ locations locations can change in real-time. silverlight app must ask rest server updates in these points in order update shapes in map. rest provides "last know position" default, location want display dynamically. my question is: simplest way achieve b)? i'm quite rookie @ silverlight, don´t know if has 'automatic-obvious' way automatic update. need 'timer' consume service, local list of locations , bindings between shapes , these locations? thank in advance! i you're on right track. i create observablecollection of data model represents locations, , bind bing mapcontrol. create datatemplate (probably based on pushpin ) visually represent how want data point on map. paths can created mappolyl...

xcode - iOS apps without developer license / app store -

i'm new iphone development , wondering if there good/easy guide follow install ios app on jailbroken phone without joining developer program. basically, don't know if i'm going have time learn need learn, make start , see leads. once have decent put can make plans go through official channels. i followed guide found in so, when launching app dies/crashes springboard. can assume did wrong, or guide outdated. i'm using ios 4.3.3 , xcode 4. here link guide followed: iphone app minus app store? thanks just warning away. i found guide worked me: how can deploy iphone application xcode real iphone device? . had change 4.2 in 1 of commands 4.3

jQuery UI theme for canvas -

i'm using canvas in web app built jquery ui. added theme-roller widget , want canvas elements themeable. problem i'm facing is, how programatically access css class properties use while drawing canvas objects? this tried: var color = $("<div></div>").addclass("ui-state-default").css("background-color"); got it. element needed added dom. function getclassproperty(clazz,prop,type){ type = (type || false) ? type : "div"; var dummy = $("<"+type+" style='display=none;'></"+type+">").addclass(clazz).appendto("body"); var value = dummy.css(prop); dummy.remove(); if(value.indexof("rgb") != -1){ var digits = /(.*?)rgba?\((\d+),\s?(\d+),\s?(\d+)[\),]/.exec(value); return "#" + (parseint(digits[4])|(parseint(digits[3])<<8)|(parseint(digits[2])<<16)).tostring(16); }else{ return va...

How do you click a calendar and copy the date to a textbox without postback, in asp.net with javascript? -

i have asp.net page used searching rows of data. want able search specific date-interval, therefore have added 2 calendars (from & to) , textbox each one. when date selected in calendar displayed in matching textbox, although causes postback, , problem. i have never used javascript before, thought give go, exclusivly see examples using html, not using @ all. use asp.net web controls such <asp:calendar.../> . so code follows off top of head, know javascript totally wrong, hope understand want achieve when @ it. <script type="text/javascript"> function calendar1_selectionchanged() { fromdate.text = calendar1.selecteddate.tostring(); } </script> <asp:calendar id="calendar1" runat="server" onselectionchanged="calendar1_selectionchanged"></asp:calendar> <asp:textbox id="fromdate" runat="server"></asp:textbox> all answers appreciated! have been tr...

vb.net - Possible causes of "Server not Operational" errors in LDAP -

i've searched google days, cannot come answers. week ago, did server migration. have clustered environment following code works on 1 server, not other (and cannot work on local machine our non-clustered development environment): rootdse = new directoryentry("ldap://nonfullyqualifieddomain/rootdse") if try above, generic error mentioned in question title (again, works on 1 of servers, not other). however, when directoryentry object instantiated: rootdse = new directoryentry("ldap://fully.qualified.domain", aduserid, adpassword, authenticationtypes.secure) based on see online, best guess has permissions or configurations, i'm not familiar server administration side of application. suggestions appreciated! every time i've got "server not operational" in 1 of infrastructure worked on, because trying connect ldap server on bad adress. due : bad dns resolution bad netbios resolution firewall filtering my advice use dn...

Need an algorithm to make all rows and columns have non-negative sums -

i'm trying figure out problem. have matrix integer values. goal every row sum , every column sum non-negative. things can change signs of entire row or entire column. here's i've tried. row or column negative sum, , flip it. works on examples tried, have explain why, , i'm not sure. when number of negative sums goes up, when flip row, there more bad columns afterwards. can't find example doesn't work, , don't know how else problem. flipping row or column negative sum correct , lead situation rows , columns have nonnegative (not positive -- consider 0's matrix) sums. the problem should not keep track of how many rows or columns need flip, sum of entries is. let matrix, , let sum of entries. when flip row or column sum -s (s positive), adds 2s a. since bounded above, process must terminate.

asp.net MVC 3 RegisterArea with multiple optional id's not working -

i trying capture multiple optional parameters in asp.net web application. when define maproute in registerarea() , breaking html.actionlink() methods. the following code works: public overrides sub registerarea(byval context system.web.mvc.arearegistrationcontext) context.maproute( _ "register_default", _ "register/{controller}/{action}/{id1}", _ new {.controller = "home", .action = "index", .id1 = urlparameter.optional} _ ) end sub but when modify url include multiple optional parameters (below), causing of html.actionlink() methods create anchor tags empty hrefs. can tell me causing happen? public overrides sub registerarea(byval context system.web.mvc.arearegistrationcontext) context.maproute( _ "register_default", _ "register/{controller}/{action}/{id1}/{id2}/{id3}/{id4}", _ new {.controller = "...

php - Path to network file -

my web server running on 1 server, , data fetching running on server. code try copy remote file , store in local path. remote location is, example, /home/testuser/remotedata.xml. know server ip address , hostname. how can construct path fill in remotepath? #remotepath path file on network public function __construct() { $this->localpath="currentdata.xml"; $this->remotepath="a remote path"; } #this attempt make copy network file , store locally private function fetchserver() { if (!(file_exists($this->remotepath)) || (time() - filectime($this->remotepath)) >= 1200) return false; else { $success = copy($this->remotepath, $this->localpath); if($success) return true; else return false; } } thank much! if you're using http, won't able check creation time. if know small, manageable file, can use file_get_contents: $fl = @file_get_contents( '<stream>' ); ...

In VB.NET why should I use Select, instead of If? -

i've graduated , started real job. in our training they've been exposing vb.net , lot of features use here. in of examples, they've used select statements (and in few places used if/else should have been used). the time i've used switch/select statement in other languages (other assignments required it) has been when wanted fall through next statement. given vb.net has no fall through, (if any) cases there use select statement? there cases when provides advantages on , if/elseif statement? select case , not select . me, it's 1 of best features of language. it's more visual when have several possible values test against. select case some_var case 1 something() case 2 something_else() case 3 etc() end select it's more readable when comes testing ranges: select case some_var case 1 10 something() case 20 30 something_else() case > 100 etc() end select it's more readable when have bunch of more complex conditions...

jQuery innerWidth in Chrome with invisible elements -

i having odd problem jquery 1.5.2 in chrome. i have code looks following $("img").each(function () { if (this.complete) { imageonload.call(this); } else { $(this).bind("load", imageonload); } }); function imageonload () { var $this = $(this); foo($this); } function foo ($img) { var width = $img.innerwidth(); var height = $img.innerheight(); } keel in mind simplified question. the above works great in cases. problem when $img(":visible") == false , chrome returning 0 innerwidth , innerheight . need take padding account, hence inner functions. what best way go handling situation? using function foo ($img) { var width; var height; if ($img.is(":visible")) { width = $img.innerwidth(); height = $img.innerheight(); } else { var img = $img[0]; var pt = parseint(img.style.paddingtop); var pb = parseint(img.style.paddingbottom); var...

gawk - How to print awk's results with different colors for different fields? -

this file has 3 fields. wanted e.g. first 2 fields in green, , third in white (nb : black background), tried : awk '{print "\033[0;32m"$1"\033[0m", "\033[0;32m"$2"\033[0m", "\033[0;37m"$3"\033[0m"} }' chrono.txt and green… how must proceed (if possible) ? to color output awk, can use approach. function red(s) { printf "\033[1;31m" s "\033[0m " } function green(s) { printf "\033[1;32m" s "\033[0m " } function blue(s) { printf "\033[1;34m" s "\033[0m " } { print red($1), green($2), blue($3) }

c# - Hiding contact form and showing confirmation message -

i have mvc page has large amount of content , 'contact us' form. once submitted, wish hide form , show confirmation message. what best way approach this? i've found tutorials use separate 'thank you' controller , view, seems counter-intuitive of course have repeat page content. thank in advance. you can use partial view , ajax.beginform instead of html.beginform . might you've read when mentioned controller , view. partial views can reused in various containing views.

php - Echo will not display any value retrieved from json_decode() -

i have extremely simple json object looks following: var data = { "id" : 1 } i decode in php: $decoded_data = json_decode(stripslashes($_post['data'])); //this works $id = intval($decoded_data->id); //in debugger equal 1 expected i proceed pass $id variable function queries database , returns set of 'sub activities' $sub_activities = alp_get_all_sub_activities($id); //this function works expected , returns correct result set now have sub activities designated $id, attempt access them using loop: foreach ($sub_activities $activity) { echo __("<td><a id='" . $activity->id . "' href='' title='activity'><div style=' border: 3px solid purple; width: 200px; height: 200px; overflow: scroll;'>" . $activity->name . "<br />" . $activity->id . "<br />" . $activity->description) . "</div></a></td>"; } ...

gcc - C #define causes Seg Fault? -

here function trying working on red hat 6.. and have little experience c, , using #define, i'm unsure portion trying do: sp->s_port = htons(sp->s_port); #ifdef __linux #define get_service_by_name(sp, service, protocol) \ char gsbn_servbuf[hostbufferlength] = {0}; \ struct servent gsbn_sp; \ struct servent *gsbn_serv_result; \ int gsbn_s = 0; \ gsbn_s = getservbyname_r(service, \ protocol, \ &gsbn_sp, \ gsbn_servbuf, \ sizeof(gsbn_servbuf), \ ...

ios - clearing a webviews cache for local files -

i've found similar posts, don't seem have effect i'm doing. i've got uiwebview i'm using display local content in bundle. i'm displaying docx file. user should ever @ document, , app tight on memory, want prevent uiwebview caching document. viable option clear cache when user leaves view. i'm totally ok having load scratch every time user enters view. i load document so: nsstring * path = [[nsbundle mainbundle] pathforresource:[nsstring stringwithformat:@"intro text"] oftype:@"docx"]; nsurl * url = [nsurl fileurlwithpath:path]; request = [nsurlrequest requestwithurl:url]; doc_view_rect = cgrectmake(5,105,self.view.frame.size.width,self.view.frame.size.height); doc_viewer = [[uiwebview alloc] initwithframe:doc_view_rect]; [doc_viewer loadrequest:request]; in attempts stop caching i've tried: [[nsurlcache sharedurlcache] setmemorycapacity:0]; [[nsurlcache sharedurlcache] setdiskcapacity:0]; and: nsurlcache *sharedcach...

logging - Apache - Override default error_log with ErrorLog Directive in Vhost -

i have several vhosts setup, , have error logs go pre-determined locations. setup have works great, except when comment out error_log in httpd.conf keep seeing "starting httpd: (2)no such file or directory: httpd: not open error log file /etc/httpd/logs/error_log." is possible turn off global error_log directive, , rely on vhost errorlog? or have run both? edit 6.30.11 it appears error_log in httpd.conf relates actual httpd daemon, , not same virtual host errorlog. example, when restart httpd messages " [thu jun 30 17:18:56 2011] [notice] apache/2.2.3 (centos) configured -- resuming normal operations ", , in vhost errorlog messages such " [wed jun 29 00:13:51 2011] [error] [client 173.255.252.120] file not exist: " so seems have live setup like: -rw-r--r-- 1 root webdev 329 jun 30 17:18 global_error.log -rw-r--r-- 1 root webdev 0 jun 30 17:18 example.com.access.log -rw-r--r-- 1 root webdev 0 jun 30 17:18 example.com.error.log -rw...

javascript - Non-smooth div animation in Firefox -

referring this fiddle . animation quite smooth on chrome , ie (v9), choppy on firefox. whole idea animate border without moving div (referring this question). question is, possible way achieve same animation in smoother fashion (like in chrome/ie) in firefox? this case if animate 1 side of div , it's not because trying animate every side @ once. if @ this fiddle in firefox, seems margins being animated not smooth, seems problem. any workout appreciated. i think main issue you've specified many properties , animation function may think has 8 different things animate @ once rather 2 properties can expressed as. example, can specify way, combining 8 parameters 2. i'm not sure negative margins: $("#thumbdiv").bind({ mouseenter: function(){ $(this).animate({ 'border-width': "35px", 'margin': "10px"}, 200, 'linear...

unit testing - How to write jUnit tests for private methods -

possible duplicate: what's best way of unit testing private methods? as private method's visibility not allow them seen outside of class, how can write tests make sure work expected? suppose making them protected or public not option. additionally suppose test code must reside separately production code. please advise , if possible, provide example check links : what's best way of unit testing private methods? , testing private methods junit

bash - Restart a process when cpu gets high -

i've got cron job checking webserver (seeing if active), handy.. http://pastebin.com/raw.php?i=kw8crfzh i'm wanting after similar cpu usage. i'm running java backend gets 70%+ cpu. i'm after cron script automatically kill/restart java if cpu load gets high, how possible? you use top in batch mode coupled code parse output. example: top -p 1234 -n 1 -b will output snapshot of state of process 1234.

locking - Android App Locker Code needed -

i developing app have lock android default apps such messaging, email, gtalk, etc . how it, have no idea. please me relevant code or link . what mean lock? if mean "prevent access unless user types pin/password" cannot without root. the non-root idea can come write custom launcher, hide target applications, doesn't stop other ways access them [recent apps, intents...]. what theat model?

graph - Generating a tree in Excel -

i have data in excel sheet represents hierarchy. tree large , reviewing data becoming quite task, trying generate pictorial representation of tree. excel doesn't seem have built-in support tree generation. best way generate tree within excel? there add-ons available? suggestions related tree generation using other tools welcome. (i have tried org chart option in visio. reason, not open excel file.) maybe use excel treeview control in useform, can find great tutorial here . have never used personaly though. seems visualstudio 2010 allow things little smarter : can have here . don't know enough part of ms anymore on way. and yet, subject discussed on another forum pointing other third party tools.

c++ - Getting OOP right -

ok, problem. have following classes: class job { bool iscomplete() {} void setcomplete() {} //other functions }; class songjob: public job { vector<job> v; string getartist() {} void setartist() {} void addtrack() {} string gettrack() {} // other functions }; // implemeted now want implement videojob , derived job. here problem. have following function witch set work songjob: void process(songjob s) { // not real functions s.setartist(); .............. s.getartist(); ............. s.getartist(); ............... s.setartist() } here want show function uses derived object methods. if have object derived job, need change parameter job, compiler not know thoose functions , dont test kind of object , cast can call correct function. so okay put functions in base class, because have no problem, don't know if correct oop, if 1 class deals songs , other videos, thing oop means have 2 clases. if didn't make myself c...

html - PHP: utf-8 encode, htmlentities giving weird results -

i'm trying data post form. when user inputs "habláis" , shows in view source "habláis" . want convert "habl&aacute;is" purposes of string comparison, both utf8_encode() , htmlentities() outputting habl&atilde;&iexcl;is , , htmlspecialchars() nothing. use str_replace won't recognize á when searches string. i'm using charset of utf-8 consistently across pages. idea what's going on? i'm not sure if problem, calling htmlentities utf-8 parameter? ask because that's not default: like htmlspecialchars(), takes optional third argument charset defines character set used in conversion. presently, iso-8859-1 character set used default. so might want try calling function this: $output = htmlentities($input, ent_compat, 'utf-8'); does solve problem?

PHP MySQLi Singleton for Ajax-Requests end in to many processes -

i have php application uses ajax information - in back, uses php mysqli singleton. ajax-requests send every 0.5 second , read stuff out of database , deliver json string website. when open website several times (in different tabs), error because php, or rather apache, not "fork process". server has enough ram, problem taht process-limit of 130 processes reached. cat /proc/user_beancounters --------------------------- | held | maxheld | numproc | 130 | 130 | so, know if it's possible singleton fault (like "why singletons bad") or imagine error source? error source, many mysql-processes started , reach max. limit? i recommend post code of singleton , ajax back-end. it's hard make statement saying singleton or ajax back-end @ fault if not able @ it. i @ number of connections more cause though. if not local application it's not uncommon actual requests take more 0.5s. 1 request might not done before call another. on time bui...

delphi - Calling a DLL function with more than one return values -

my dll might send more 1 result/return value exe in 1 shoot. still don't understand how make callback function dll can communicate host app. here's scenario : app : type tcheckfile = function(const filename, var info, status: string): boolean; stdcall; var checkfile: tcheckfile; dllhandle: thandle; procedure test; var info,status : string; begin .... // load dll dllhandle := loadlibrary('test.dll'); if dllhandle <> 0 begin @checkfile := getprocaddress(dllhandle, 'checkfile'); if assigned(checkfile) beep else exit; end; // use function dll if assigned(checkfile) begin if checkfile(filename, info, status) begin addtolistview(filename, info, status); end; end; ... end; dll: function checkfile(const filename, var info,status: string): boolean; stdcall; var info, status: string; begin if istherightfile(filename, info,status) begin result := true; ...

c# - Drag and Drop ListView to Listview(Listbox) -

i´m writing little audio player in c#. now want drag , drop items music library (listview) playlist(listview or listbox). will work? im using windows forms, best way solve problem? yes work. prepare playlist control: ((control)playlist).allowdrop = true; playlist.dragenter += playlist_dragenter; playlist.dragdrop += playlist_dragdrop; and initiate drag library listview: dodragdrop( new dataobject( dataformats.filedrop, paths ), dragdropeffects.link ); (just modify parameters need)

Moles does not work in static constructors -

i have been having problem mole types not working in static constructors. have created 2 simple examples explain problem: i have simple instance class follows: public class instancetestreader { public instancetestreader () { ifilesystem filesystem = new filesystem(); this.content = filesystem.readalltext("test.txt"); } public string content { get; private set; } } i have unit test follows: [testmethod] [hosttype("moles")] public void checkvalidfileinstance_withmoles() { // arrange string expectedfilename = "test.txt"; string content = "test text content"; implementation.moles.mfilesystem.allinstances.readalltextstring = (moledtarget, suppliedfilename) => { assert.areequal(suppliedfilename, expectedfilename, "the filename incorrect"); return content; }; // act string result = new insta...

How to alter block configuration form in Drupal 7? -

how can alter block configurations in drupal 7? there hooks hook_block_info_alter() , hook_block_view_alter() seems there not named "hook_block_configure_alter". is hook_form_alter() solution? yes, should use hook_form_alter() or hook_form_form_id_alter() . if making changes specific single form, latter should used. description of 2 hooks can found here .

cuda - How to synchronize global memory between multiple kernel launches? -

i want launch multiple times following kernel in loop (pseudo): __global__ void kernel(t_dev input array in global mem) { __shared__ prec tt[block_dim]; if (thid < m) { tt[thid] = t_dev.data[ii]; // mem read! } ... // modify __syncthreads(); if (thid < m) { t_dev.data[thid] = tt[thid]; // mem write! } __threadfence(); // or __syncthreads(); //// necessary!! why? } what conceptually read in values t_dev . modify them, , write out global mem again! , start same kernel again!! why need _threadfence or __syncthread otherwise result wrong, because, memory writes not finished when same kernel starts again. thats happens here, gtx580 has device overlap enabled, but why global mem writes not finished when next kernel starts... because of device overlap or because that? thought, when launch kernel after kernel, mem write/reads finished after 1 kernel... :-) thanks answers! some code : for(int kernelai...

pointers - How to fix clSetKernelArg error CL_INVALID_MEM_OBJECT in Haskell OpenCLRaw? -

i trying use opencl using haskell. write simple program converting working 1 in c. appears work well, when assign memory object kernel parameters, fails cl_invalid_mem_object error. don't know fix because use same calls in c program , there works: the programsource opencl code programsource :: string programsource = "__kernel void duparray(__global float *in, __global float *out ){ int id = get_global_id(0); out[id] = 2*in[id]; }" and initializacion works until call of clsetkernelarg fails just (errorcode (-38)) -- test opencl input <- newarray ([0,1,2,3,4] :: [cfloat]) right mem_in <- clcreatebuffer mycontext (memflagsjoin [clmemreadonly,clmemcopyhostptr]) (4*5) (castptr input) right mem_out <- clcreatebuffer mycontext clmemwriteonly (4*5) nullptr print (mem_in,mem_out) right program <- clcreateprogramwithsource mycontext programsource print program err <- clbuildprogram program [mydeviceid] "" buildprogramcallback nullptr print...

asp.net mvc - Partial view inherits from master layout -

i have partial view , int it, there no trace of inheritance layout. whenever want use (render it) inside view, layout gets repeated once view, , once partial view. this post suggests create empty layout. think workaround. there anyway stop loading layout (master layout) partial views. don't understand, why when there no code use master layout, why should loaded. it's creating page in asp.net , seeing inherits master page without having <%@ master ... directive. this partial view: @* recursive category rendering *@ @using backend.models; @{ list<category> categories = new thoughtresultsentities().categories.tolist(); int level = 1; } @rendercategoriesdropdown(categories, level) @helper rendercategoriesdropdown(list<category> categories, int level) { list<category> rootcategories = categories.where(c => c.parentid == null).tolist(); <select id='categorieslist' name='categorieslist'> @foreach (ca...

Html layout with header and left menu of 100% height -

i'm struggling create simple layout of header , 2 column content - left navigation , right content ( http://jsfiddle.net/wsqbs/4/ ). what cannot achieve having menu , content take 100% height of page (not window), while having vertical line (border) between menu , content. problem when positioning content absolutely , of 2 columns have enough content, scrollbars appear, background , border of corresponding divs still take 100% of window, not full height of content. the absolute position prevent want. want? http://jsfiddle.net/bingjie2680/wsqbs/6/ update: http://jsfiddle.net/bingjie2680/wsqbs/8/

c# - ASP.net user control doesn't call a javascript function -

i developing asp.net web application, have repeater call registered user control, have in user control button want call javascript function make ajax call action on server. button doesn't call javascript method, don't know why? , when view source found javascript function repeated every item in repeater, how eliminate repetition specially read server items inside function, , why function not called? thanks lot! sercontrol.ascx <div id="divbtnevent" runat="server"> <input type="button" id="btnaddevent" class="ok-green" onclick="saveevent();" /> </div> <script type="text/javascript"> function saveevent() { var eventtext = document.getelementbyid('<%=txteventdescription.clientid%>').value; // make ajax call } problem 1: in view source found javascript function repeated every item in repeater. solution: put ...

"this[0] is undefined" message using jQuery validate plugin -

i've started use jquery validate plugin. having few issues display of error messages , wanted create test page experiment few things. despite same setup working me yesterday, i'm getting follwing message: this[0] undefined looking @ jquery code, fails in following section (specific line highlighted): valid: function() { if ( $(this[0]).is('form')) { return this.validate().form(); } else { var valid = true; **var validator = $(this[0].form).validate();** this.each(function() { valid &= validator.element(this); }); return valid; } } from looking @ it, must think validator isn't form, is. don't understand what's going on. code fails when try print out result of valid() method console. here's code far. grateful help. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <style type="text/css"> th { text-align:...

php - Doctrine sql query, where clause not taken into account -

i suppose problem simple can't fixed... here query: $this->invites = doctrine_query::create() ->from('utilisateur u') ->leftjoin('u.invites on i.utilisateur_id = u.id') ->where('u.invites.invitation_id=', $this->invitation->getid()) ->execute(); and here schema: invites: columns: invitation_id: {type: integer, notnull: true } utilisateur_id: {type: integer, notnull: true } relations: utilisateur: {ondelete: cascade, local: utilisateur_id, foreign: id} invitation: {ondelete: cascade, local: invitation_id, foreign: id, class: invitation, refclass: invites} utilisateur: actas: { timestampable: ~ } columns: email: {type: string(255), notnull: true } password: {type: string(255), notnull: true } facebook: {type: integer(11), notnull: true } smartphone: {type: string(128), notnull: true } prenom: {type: string(255), notnull: true } nom: {type: string(255), notnu...

generics - Implementing .ToViewModel() using AutoMapper -

i'm trying ease use of automapper in project, implementing extension method .toviewmodel() . basically, wrapper around standard call, find myself annoyed how must type each time want map something. compare two: var viewmodel = mapper.map<domainentitytype, viewmodeltype>(entity); // or... var viewmodel = entity.toviewmodel(); i feel number 2 sweet =) i've let entities extend ientity , , viewmodels (that correspond entity) extend iviewmodel<ientity> , , written following extension method: public static iviewmodel<tentity> toviewmodel<tentity>(this tentity entity) tentity : ientity { return mapper.map<tentity, iviewmodel<tentity>>(entity); } however, i'm unable make fly. the following nunit test makes attempt @ testing (although i'm unsure if assert.areequal tests want - require reference equality? if so, how test "are equivalent"?). test fails message expected: &ltcastle.proxies.iviewmodel`1proxy...

c# - List<int> filtering using linq -

i have list object contains id values example contains: 1,2,10,1,23,11,1,4,2,2,.. etc need find out how many times "1","2",... etc have occured using linq in c# kindly help. that's pretty simple using enumerable.groupby : var grouped = list.groupby(x => x); foreach (var group in grouped) { console.writeline("{0} appears {1} times", group.key, group.count()); } or alternatively: var query = list.groupby(x => x, (x, g) => new { key = x, count = g.count() })); foreach (var result in query) { console.writeline("{0} appears {1} times", result.key, result.count); } (the difference in when transform group result, really.)

javascript - How to get access to the string when foreach-binding to a list of strings? -

i have template this: <div data-bind='template: { name: "stringtemplate", foreach: stringcollection() }'> </div> </div> <script id='stringtemplate' type='text/html'> // want display string collection here </script> how access string object in template? in jquery template, can use $data refer overall object being bound. so, like: <span data-bind="text: $data"></span> or ${ $data }

ruby on rails - select collection -- displaying more than 1 column value in the select list -

i have got following line of code in new player.html.erb file. <% form_for @player, :html => { :multipart => true } |f| %> team: <%= f.select(:sub_team, [["--new--", "new"]] + team.all.collect {|p| [ p.bsr_team_name, p.bsr_team_id ] }, {:include_blank => 'none', :selected => params[:teamid].to_i}) %> ... <% end %> user can associate player team. currently team field, drop down list displayed team names. now need include 'team leader name' next team name in drop down list. i tried following not seem work: team: <%= f.select(:sub_team, [["--new--", "new"]] + team.all.collect {|p| [ p.bsr_team_name -- p.bsr_team_leadername, p.bsr_team_id ] }, {:include_blank => 'none', :selected => params[:teamid].to_i}) %> i grateful if give me hint how display team lead name next team name. cheers try this: team: <%= f.select(:sub_team, [["--new--"...

taskbar - Disable jumplist entries in Windows 7 for VBA-generated Office documents -

Image
i programmatically generating office documents (in case word or excel 2007) using automation in vba (in example ms access 2007, should not change much) under windows 7. works fine. since documents automatically generated don't want them show in recent lists. recent list in word can add "addtorecentfiles:=false" when saving document (see example) or delete entries afterwards through "application.recentfiles ..." my code set objword = createobject("word.application") set curdocument = objword.documents.add curdocument.saveas filename:=folder + "text.doc", fileformat:=wdformatdocument, addtorecentfiles:=false curdocument.close problem is not find way disable recent lists windows 7 (i.e. jump list recent items in taskbar word or last used folders in explorer , recent list word in start menu). i aware these lists stored under %appdata%\microsoft\windows\recent\automaticdestinations , have found out manipulate jumpli...

error trying to upload dynamically drawn image from Flex to Rails 3 with multi-part form content -

i'm trying write little flex app has paint/canvas type feature draw image, want post rails server side. i'm following post here , can't far did due following error: nomethoderror (undefined method `rewind' #): i googled , found this says problem due empty filename, thought had example. however, altered example simplify post reducing form parameters, have messed since don't know i'm doing multipart form content. i hoping @ least log request params, unfortunately can't, since it's failing before being routed , due inexperience rails. i'll ask in separate question , able edit question request params. here's code: public static function sendpic(simplepaint : simplepaint) : void { var jpgsource:bitmapdata = new bitmapdata (simplepaint.width, simplepaint.height); jpgsource.draw(simplepaint); var jpgencoder:jpegencoder = new jpegencoder(85); var ba:bytearray = jpgencoder.encode(jpgsource); var re...

javascript - How to connect couchDB with angular.js? -

i have searched did not proper answer if can connect couchdb directly angular.js framework or we have take of node.js that. while have no experience of angular.js, looking @ google buzz example appears have way deal json-providing resources. since couchdb is, don't think there need node.js involved. all couchdb functionality can accessed via http requests, should fit right in, if necessary doing ajax calls. angular.service.$resource looks appropriate candidate.

ruby on rails - mysql inner join causing multiplication -

basically have structure: deal has , belongs many channels deal has many dealsales deal belongs channel when want find amount sold deal, use query: select targets.id,sum(deal_sales.amount_sold) amount_sold deal_sales inner join deals on deals.id = deal_sales.deal_id inner join targets on deals.target_id = targets.id targets.approved = 1 , targets.active = 1 group targets.id its working fine, problem when need filter channel, find amount sold deal in channel: select targets.id,sum(deal_sales.amount_sold) amount_sold deal_sales inner join deals on deals.id = deal_sales.deal_id inner join targets on deals.target_id = targets.id **inner join channels_deals on channels_deals.deal_id = deals.id** targets.approved = 1 , targets.active = 1 group targets.id when add join channels table, amount_sold multiplied each channel deal has relation with. how can avoid this? use in or exists for example select targets.id,sum(deal_sales.amount_sold) amount_sold deal...

glsl - Getting vertex-shader transformed geometry back from the gpu in OpenGL -

i generate vertex geometry on cpu , pass gpu , run number of vertex shaders on vertices , these transformed vertices cpu. dont want render vertices or run fragment shaders. is possible vertex-shader transformed vertices gpu onto cpu? if how? yes, facility required called "transform feedback buffers". extension opengl-2 http://www.opengl.org/registry/specs/arb/transform_feedback2.txt introduced being official opengl functionality opengl-3.0

reporting services - Show percentages in SSRS without "%" character -

i have graph in ssrs report shows percentages. achieved putting format value of 0.0% . database contains fraction values 0.1 , 0.15 formated 10% , 15% automatically. business guys don't want the "%" sign show. i can't figure out how multiple number 100 in format expresion. think i'm in on of block moments. is simple as: =fields!yourfield.value * 100 or perhaps =format(fields!yourfield.value * 100, 0.0)