Posts

Showing posts from March, 2012

sql - "subquery returns more than 1 row" error. -

i new web programming , i'm trying make twitter-clone. @ point, have 3 tables: users (id, name) id auto-generated id name of user tweets (id, content, user_id) id auto-generated id content text of tweet user_id id of user made post followers (id, user_id, following_id) id auto-generated id user_id user doing following following_id user being followed so, being new sql well, trying build sql statement return tweets currently-logged in user , of follows. i tried use statement, works sometimes, other times, error says "subquery returns more 1 row". here statement: select * tweets user_id in ((select following_id followers user_id = 1),1) order date desc i put 1 example here, id of logged-in user. i haven't had luck statement; appreciated! thank you. select * tweets user_id in (select following_id followers user_id = 1) or user_id = 1 order date desc

designing android ui in java instead of xml? -

anyone know guides this? there seems nothing out there. best i've found this isn't comprehensive. also, i'm new android development. know there resources api out there i'm looking more of guide, , doing ui in java seemed more appealing xml. the lack of guides in matter simple: android ui designed around xml layouts. building ui xml far more superior building programmatically (please refer comment post of reasons). adding , tweaking ui components in code common should not replace rather supplement xml-based ui. may consider defining reusable components in xml , use activity#getlayoutinflater "inflate" these snippets. example that's how items in list build. , of course nothing stops building layouts , components entirely within code. practice there create these once in activity#oncreate , reuse throughout rest of code

sql - alter table with space in name -

i have table space in name generated system. i trying alter table name remove space can processed library pre-exists. i trying: alter table 'my table' rename 'mytable'; i have tried double quotes, no luck. any pointers? [ this not work in ms-access. tables cannot renamed in access. not clear if original question applied ms access.] square brackets: alter table [my table] rename [mytable]; square brackets can't enclose entire object "path" won't work: alter table [mydatabase.dbo.my table] but will alter table [mydatabase].[dbo].[my table]

mysql - Join two tables (with a 1-M relationship) where the second table needs to be 'flattened' into one row -

given following tables: student +----+-------+ | id | name | +----+-------+ | 1 | chris | | 2 | joe | | 3 | jack | +----+-------+ enrollment +---------------+------------+-----------+----------+ | enrollment_id | student_id | course_id | complete | +---------------+------------+-----------+----------+ | 1 | 1 | 55 | true | | 2 | 1 | 66 | true | | 3 | 1 | 77 | true | | 4 | 2 | 55 | true | | 5 | 2 | 66 | false | | 6 | 3 | 55 | false | | 7 | 3 | 66 | true | +---------------+------------+-----------+----------+ i following +----+-------+-----------+-----------+-----------+ | id | name | course 55 | course 66 | course 77 | +----+-------+-----------+-----------+-----------+ | 1 | chris | true | true | true | | 2 | joe | true |...

php date/mktime returning strange result -

i got array contains date displayed article archives , looks this: <?php // code: echo '<pre>'; print_r($date_result); echo '</pre>'; ?> // output: array ( [0] => 2008 [1] => 03 [2] => 11 ) then try build result output title archive page: $name = date( 'l', mktime( 0, 0, 0, $date[1], $date[2], $date[0] ) ); // works but when try make same month & years 1 month/year before given date: // month $name = date( 'm', mktime( 0, 0, 0, $date[1], 0, 0, 0 ) ); // input: eg. (int) 03 - output 'february' // year $name = date( 'y', mktime( 0, 0, 0, 0, 0, $date[0] ) ); // input: eg. (int) 2008 - output '2007' i can't around it. doing wrong month & year dates? thanks! from php.net: example #3 last day of next month the last day of given month can expressed "0" day of next month, not -1 day. so 0 entered day or month giving previous month...

How do I use the CakePHP Configure class? -

i trying use configure class in cakephp, i'm not sure if using correctly. have read through cook book , api, can't seem want. i have created configuration file: app/config/config.php . can directly edit file , set variables in there , access them using configure::read() . is possible update values of configuration file application itself, i.e., controller? have tried using configure::write() , not seem change value. app/config/config.php isn't file that's automatically loaded cake. either move these variables app/config/bootstrap.php or tell bootstrap.php file load custom file. put variables in app/config/core.php , i'd recommend against that. tend leaving file alone , adding/overwriting values in bootstrap.php .

algorithm - Find the minimize maximum weights in weighted graph using dynamic programming -

i'm looking algorithm finds path 2 vertices s t , in graph has k edges if paths exist. and if multiple paths found, 1 minimum maximum weights of single edge preferred. (not overall weights). eg: k = 5 path 1: s - - b - c - d - t weights 1 - 1 - 1 - 10 - 1 the maximum weight of path 1 10 path 2: s - x - y - z - w - t weights 7 - 9 - 8 - 6 - 7 the maximum weight of path 2 9, preferred. how solve problem? you use modified version of floyd-warshal algorithm iterates k steps , forces path lengths (by removing min part)

How does Flash and socket connections work on the web? -

Image
i trying debug socket connection issue between flash in web browser , flash in client type program. connection closing in web, understand how web side of things work. right can load remote flash file in web browser , triggers connection established stat when viewing netstats -fn. when close dialog runs javascript remove flash dom, connection stats goes time_wait. does act of removing flash html dom sever flash connection triggers time_wait state? how process work? if you're using flash.net.socket, observe behavior of calling socket.close() manually. it's flash runtime (as it's binary plugin separate browser) how close sockets. the time_wait state part of computer's networking stack. when actively close socket, goes time_wait state. time-wait - represents waiting enough time pass sure remote tcp received acknowledgment of connection termination request.

map.getCenter.lng() extends beyond -180 when dragging continuously. How can I stop that? -

heres code: google.maps.event.addlistener(map, 'idle', function(e) { console.log(map.getcenter().lng(); }); when dragging map horizontally repeatedly produce pattern such as: 0, -60, -120, -180, -240, -300 but hoping for: 0, -60, -120, -180, 120, 60 is bug in gmaps or not? thanks! some bug, while others feature. fair seem "correct" behaviour, doesn't give usable results. i believe common way of getting past "feature" make sure value never below -180 og above 180. easy way accomplish make call: map.getcenter().lng() % 180; this give modulus 180 remainder when have subtracted 180 until value in correct range.

c# - How do I convert an IEnumerable to JSON? -

i have method returns ienumberable containing 1..n records. how convert results json string? thanks! ienumerable<int> sequenceofints = new int[] { 1, 2, 3 }; ienumerable<foo> sequenceoffoos = new foo[] { new foo() { bar = "a" }, new foo() { bar = "b" } }; var serializer = new system.web.script.serialization.javascriptserializer(); string outputofints = serializer.serialize(sequenceofints); string outputoffoos = serializer.serialize(sequenceoffoos); which produces output [1,2,3] [{"bar":"a"},{"bar":"b"}] and can sequence ienumerable<foo> foos = serializer.deserialize<ienumerable<foo>>(outputoffoos);

Why is Onblur not working (JQuery/Javascript) -

i have following input field want pull suggestions when user types: <input type = 'text' name= 'target' id='target' style='width:150px' onblur ='settimeout('removesuggestions()', 20);' onkeyup ='getsuggestions(this.value);'/> there "suggestions" div below , using following javascript. function getsuggestions(value){ if (value !=""){ $.post("target.php", {targpart:value}, function(data) { $("#suggestions").html(data); if(value.length>2){ docss(); } }); } else { removesuggestions(); } } function removesuggestions(){ $("#suggestions").html(""); undocss(); } function addtext(value){ $("#target").val(value); } function docss(){ $("#suggestions").css({ 'border' : 'solid', 'border-width': '1px' }); } function...

what is the @'s purpose in PHP -

possible duplicate: what use of @ symbol in php? i been working php right question pops in mind @ sign means? saw before method or functions calls. , try remove them there no changes. can explain me purpose of @ sign?? @imagecreatefromjpeg($file); simply put, @ allows suppress errors arise call function.

posix - How to use nanosleep() in C? What are `tim.tv_sec` and `tim.tv_nsec`? -

what use of tim.tv_sec , tim.tv_nsec in following? how can sleep execution 500000 microseconds? #include <stdio.h> #include <time.h> int main() { struct timespec tim, tim2; tim.tv_sec = 1; tim.tv_nsec = 500; if(nanosleep(&tim , &tim2) < 0 ) { printf("nano sleep system call failed \n"); return -1; } printf("nano sleep successfull \n"); return 0; } half second 500,000,000 nanoseconds, code should read: tim.tv_sec = 0; tim.tv_nsec = 500000000l; as things stand, code sleeping 1.0000005s (1s + 500ns).

C++14 supporting editor/IDE -

i'm looking powerful programming environment c/c++. in fact think need powerful source navigating + creating tool. doesn't matter if free or commercial. prefer linux tool, doesn't have necessary linux app. what need kind of editor following capabilities: more open files + tabs/buffers switching highlighting (+ bracket matching, folding, etc...) save sessions preview window(when cursors stops on symbol, have preview window, shows me definition of symbol) searching uses of symbol through code intelligent completion (must support c++ 14!) what nice: code beautifizier or similar utf-8 support editor templates(for example automatic comment header modules, functions...) other editor scripting a terminal/console accessible program || compiling debugging capabilities(just able compile whole project without switching extensively command line) program flow visualization please around whole world knows anything, knows of that? i've tried several edito...

html parsing - How to find content using PHP regular expression -

i want find content inside of div. want specify div’s id; rest automatically adjusted under preg_match . e.g.: <div id="midbuttonarea" etc...>some text...</div> brenton right. anyway, here have: <?php function finddivinnerhtml($html, $id){ preg_match("/<div .* id=\"{$id}\" .*>(.*)<\\/div>/i", $html, $matches); return $matches[1]; } ?> sample usage: <?php $html = '<div id="other"> xxx </div> <div id="midbuttonarea" etc...>some text...</div> '; $innerhtml = finddivinnerhtml($html, 'midbuttonarea'); echo $innerhtml; //outputs "some text..." ?> hope helps.

django - How to always filter on a field on objects requests -

i have 2 models : class album(models.model): #attributes title = models.charfield(max_length=200) displayed = models.booleanfield() created_on = models.datetimefield(auto_now_add=true) class photos(models.model): #attributes title = models.charfield(max_length=500) link = models.charfield(max_length=500) album = models.foreignkey(album, unique=false, verbose_name=_('album')) def upload_path(self, filename): return 'upload/photos/%s/%s' % (self.id, filename) def upload_path_thumbnail(self, filename): return 'upload/photos/%s/%s' % (self.id, "thumnail_" +filename) thumbnail = models.imagefield(upload_to=upload_path_thumbnail) photo = models.imagefield(upload_to=upload_path) created_on = models.datetimefield(auto_now_add=true) displayed = models.booleanfield() and want force, when select photos, filter on displayed=1. thank use custom manager : class displayedphotomanager(models.manager): ...

flash - Fetch url parameters in flex web application -

i want fetch parameters url on flex web application. how can that? for example want fetch parameters name , age url http://www.abc.com?name=vkwave&age=25 on flex application your appreciated var pageurl : string = externalinterface.call("window.location.href.tostring"); var parampairs : array = pageurl.split("?")[1].split("&"); each (var pair : string in parampairs) { var param : array = pair.split("="); trace("key: " + param[0] + ", value: " + param[1]); }

Generating a lists of a specific length with Haskell's QuickCheck -

-- 3 (find k"th element of list) element_at xs x = xs !! x prop_3a xs x = (x < length xs && x >= 0) ==> element_at xs (x::int) == (xs !! x::int) when prop_3a ran through quickcheck, gives up, because won't generate long enough lists. how can write generator generate lists length longer random integer? how going other way? first let quickcheck pick list , constrain indices allow. works, , not throw away test cases. prop_3a (nonempty xs) = forall (choose (0, length xs - 1)) $ \i -> element_at xs == (xs !! :: int) here, use forall use specific generator indices, in case using choose picks element specified range, , use the nonemptylist type ensure don't try index empty list.

shell - PHP cp permissions issue -

php script (restore.php): var_dump( get_current_user()); var_dump( shell_exec( " cp /var/www/bkp/* /var/www/html 2>&1 " )); when script accessed in browser: string(6) "apache" string(115) "cp: cannot create regular file `/var/www/html/227.png': permission denied cp: cannot remove `/var/www/html/234.png' permission denied " console: cd /var/www/html sudo -u apache touch test.txt ls test.txt -> test.txt sudo -u rm 234.png -f ls 234.png -> ls: 234.png: no such file or directory sudo -u apache php restore.php ls 234.png -> 234.png can explain why getting permission issues in php script when run in browser? are sure apache running apache user? get_current_user() returns owner of script. think apache running apache maybe it's not. you can name of process owner this: $processuser = posix_getpwuid(posix_geteuid()); print $processuser['name'];

How do i profile memory held in .NET? -

this question has answer here: .net memory profiling tools [duplicate] 9 answers i have app. when run hours notice starts getting big. gets 4x bigger later t in first hour. since running on server limited ram space cant have that. tried doing memory sampling in .net told me json serialization allocates memory. thats inside loop know gone every iteration. how find objects holding memory? forcing gc collect not help. appears holding memory. you use memory profiler. ants profiler redgate , dottrace jetbrains quite popular. there free clr profiler microsoft has different versions clr 2.0 , clr 4.0 .

c# - Createhardlink in managed code -

i'm developing application creates hundreds of thousands of hardlinks (this core feature of application). i use parallel programming features available in dotnet 4.0. works well. see example snippits below. either: parallel.for(from, until, delegate(int i) { j += 1; fileindex = convert.toint32(math.round(j * 0.001) + 1); //determine hardlink files; have have unique name hardlink each individual hardlink filename = fiarray[fileindex].name; //path.getfilenamewithoutextension(textboxfile.text); destinationfilename = path.combine(textboxdestination.text, string.concat(filename, "_", i.tostring(), ".txt")); fr.createhardlink(destinationfilename, fiarray[fileindex].fullname); }); or: //loop actual work (int = 0; < nudthreads.value; i++) { //determine work package per task = 0 + until + 1; until = (i * (convert.toint32(hardlinks / threadno))) + 1; var compute = task.factory.startnew(() => { token...

objective c - "return" and stepping through a function in Xcode -

i've got nested if statements perform data check. if result i'm looking for, store data in array , call return; in order break out of function. when stepping through in debugger, have noticed rather breaking out of function immediately, 1 return call instead moves application different return call, , then breaks out of function. question twofold: 1) why happen? 2) should worry about? hasn't caused me problems far. here's exact code below. happens 100% of time when final return in code (look near end) reached. have put comment in code return function goes after last one. if ([self comparepx:[self getavgpxclrforrow:rowedge andcol:coledge fordirection:0] tobins:bgbins] == nil) { coledge--; while (coledge >= includedareaorigincol) { if ([self comparepx:[self getavgpxclrforrow:rowedge andcol:coledge fordirection:0] tobins:bgbins] != nil) { coledge++; prevedgept = cgpointmak...

jquery - Access slickgrid object by selector -

how access slickgrid object selector after has initalized example throught selector #mygrid. thanks! // init & store grid = new slick.grid("#mygrid", data, columns, options); $("#mygrid").data("gridinstance", grid); // access later on $("#mygrid").data("gridinstance").resizecanvas();

git - How to create branch and push to server -

i have cloned project repo , need create branch , in branch changes. after need push branch on repo. how ? sorry, new git ? you can create new branch called my-work (based on current commit) , switch branch with: git branch my-work git checkout my-work or, shortcut 2 commands, can do: git checkout -b my-work to push branch repository cloned from, should do: git push origin my-work origin nickname repository cloned from. it's known "remote", in git terminology. update: clarification due michael minton's helpful comment above: push my-work branch branch called my-work in remote repository, creating if necessary - if meant different, best edit question clarify point. the first time push command, may want git push -u origin my-work , sets configuration options make branch my-work in origin repository considered default "upstream" branch my-work branch. (you don't need worry moment if you're new git, mean git provides ...

Copy-paste into Python interactive interpreter and indentation -

Image
this piece of code, test.py: if 1: print "foo" print "bar" can succesfully executed execfile("test.py") or python test.py , when 1 tries copy-paste python interpreter: file "<stdin>", line 3 print "bar" ^ syntaxerror: invalid syntax why so? can interpreter configured in such way read copy-pasted text succesfully? guess may affect typing in interpreter, that's ok me. indentation lost or broken. have @ ipython -- it's enhanced python interpreter many convenient features. 1 of them magic function %paste allows paste multiple lines of code. it has tab-completion, auto-indentation.. , many more. have @ site. using %paste in ipython: and copy-and-paste stuff 1 of things fixed in qt console, here's using plain old copy-and-paste of code block "just works" in new ipython qtconsole :

database - Is there anyway i can Insert Records in Multiple Tables using single MySQL Query? -

i have user form users fill in following details a) username b) password c) email username , password belongs users table whereas email belongs contacts table , users table have foreign key contact_id stores primary key id of contacts. whenever user submit form have make 2 mysql queries insert records 2 different table. here using. first query: $sth = $this->dbh->prepare("insert contacts(email) values(:email)"); second query : $sth = $this->dbh->prepare("insert users(username,password,registerdate,activationstring,contact_id) values(:username,:password,now(),:activationstring,".$this->dbh->lastinsertid().")"); is there anyway make query 1 instead of two? utilizing mysql last_insert_id() function. ? thank you insert statement allows insert 1 table. but create stored procedure job. example: create table contacts( id int(11) not null auto_increment, email varchar(255) default null, primary key (...

cocoa - Objective-C: Get supported file extensions for a file type -

i wondering there way of retrieving in objective-c (mac & ios) supported extensions file type. for example, need know file formats supported graphics in ios. thanks in advance. mikywan. i have not used myself think can looking launch services api

ruby on rails - Why should I pluralize controller name for RESOURCE -

i understand there convention, controllers' names should pluralised. but why should pluralize controller's name resource? so ok: resources :apples but not: resource :apple, :controller => "apple" why not? resource :apple resource different resources . it's used if have one. as this guide explains, it's useful if ever reference one. if have, example, profile never mention id, assume current user needs access or edit own profile. you can mix these, too. want users able view each other's profiles, have url own profile: resources :profiles resource :profile

Is there any good open-source or freely available Chinese segmentation algorithm available? -

as phrased in question, i'm looking free and/or open-source text-segmentation algorithm chinese, understand difficult task solve, there many ambiguities involed. know there's google's api, rather black-box, i.e. not many information of doing passing through. the keyword text-segmentation chinese should 中文分词 in chinese. good , active open-source text-segmentation algorithm : 盘古分词(pan gu segment) : c# , snapshot ik-analyzer : java ictclas : c/c++, java, c# , demo nlpbamboo : c, php, postgresql httpcws : based on ictclas , demo mmseg4j : java fudannlp : java , demo smallseg : python, java , demo nseg : nodejs mini-segmenter : python other google code : http://code.google.com/query/#q=中文分词 oschina (open source china) sample google chrome (chromium) : src , cc_cedict.txt (73,145 chinese words/pharases) in text field or textarea of google chrome chinese sentences, press ctrl + ← or ctrl + → double click on 中文...

php - understanding variables and scope -

edit*** question bit hard understand...let me try again. i'm having problem understanding variables , the way execute value . for example. if say $var name= 'mike'; then if test page nothing show because nothing on html requesting value of mike. if did echo $name; then page show mike..... that said, if this: $connect2db = mysqli_connect('values here'); if(!$connect2db){ die("error connecting database" . mysqli_error);} $db_query = mysqli_query($connect2db, "insert email_list(email, firstname, lastname) values ('$email', '$fname', '$lname')"); for inserting these values form db, don't understand how connection , commands db being called , put play because me $connect2db equals "those commands" nothing calling it. $connect2db equals literally instruction take once called play. where on chunk of code connection being called/put play? on code block code being cal...

Trying to duplicate code in Demo for CWAC Touchlist and getting errors for Android -

i have been developing on 10 years in languages other java. new android world, i'm trying dive right in. trying make draggable list , found wonderful repos https://github.com/commonsguy/cwac-touchlist dragging , dropping of list items. however, getting error when trying @override drop method droplistener interface. states that: "the method drop(int, int) of type new touchlistview.droplistener(){} must override superclass method" i tried implement way demo utilizes touchlist application, , copied code in action, , i'm getting same error. my code: package bu.homework.shoppinglist; import android.app.listactivity; import android.content.intent; import android.database.cursor; import android.os.bundle; import android.view.contextmenu; import android.view.contextmenu.contextmenuinfo; import android.view.menu; import android.view.menuitem; import android.view.view; import android.widget.adapterview.adaptercontextmenuinfo; import android.widget.listview; impo...

jquery - jqgrid: Why am I reveiving "eData" instead of the id attribute value? -

jqgrid snippet: gridcomplete: function(){ var ids = jquery("#breed_list").jqgrid('getdataids'); for(var i=0;i < ids.length;i++) { var cl = ids[i]; ed = "<img src="../images/edit.png" alt="edit" onclick="jquery('#breed_list').editrow('"+cl+"');" />"; de = "<img class="del_row" src="../images/delete.png" alt="delete" />"; ce = "<input class="del_row" type='button' onclick="deleterow()" />"; jquery("#breed_list").jqgrid('setrowdata',ids[i],{act:ed+de+ce}); } $(this).mouseover(function() { var valid = $('.ui-state-hover').attr("id"); jquery("#breed_list").setselection(valid, false); alert(valid); //deleterow(valid) }); custom function code: function deleterow...

java - Get response body on 400 HTTP response in Android? -

i'm communicating api can not change sends 400 response when request not validated on api side. valid http request, request data not pass application's validation rules. the 400 response contains json payload has information on why request did not pass validation. i can't seem response body because httprequestexception thrown. know how retrieve response body? try { httpurirequest request = params[0]; httpresponse serverresponse = mclient.execute(request); basicresponsehandler handler = new basicresponsehandler(); string response = handler.handleresponse(serverresponse); return response; } catch(httpresponseexception e) { // threw httperror log.d(tag, "httpresponseexception : " + e.getmessage()); log.d(tag, "status code : " + e.getstatuscode()); // todo api returns 400 on successful http payload, invalid user data if(e.getstatuscode() == 400) { ...

html - Contenteditable paragraph tag on enter -

i wondering if there acceptable way force major browsers insert paragraph tag instead of default tag insert on pressing enter key when contenteditable true. as far know ie inserts p automatically. google chrome inserts div tag , firefox inserts br (wtf?!). thanks in advance! you can use document.execcommand('formatblock', false, 'p'); in event keypress or keydown , etc. use paragraphs after enter press. example: element.addeventlistener('keypress', function(ev){ if(ev.keycode == '13') document.execcommand('formatblock', false, 'p'); }, false);

silverlight - WIndows Phone Theme Settings -

i'm trying app certified light theme windows phone. i'm using few custom listbox styles, can't figure out why no pivot controls visible. foreground , background both white, they're invisible. can't find implicit or applied styles on pivot control. textblocks have same problem. i've read, theme settings should handled os shouldn't they? you don't need re-define system resources since automatically added application @ runtime, therefore rendering resourcedictionary redundant (and pretty useless). try applying default system styles first. also, post xaml easier fix it.

css - 3d buttons in IE8 -

i using css3pie make ie8 , ie7 recognize more css declarations. allows me more use background gradients , similar on site. however, have found out css3pie not support box-shadow style inset shadows. problem using box shadows make buttons , interface elements on site 3d, this: a { box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1); -moz-box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1); -webkit-box-shadow: inset -2px -2px 2px rgba(0,0,0,0.5), inset 1px 1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1); } a:hover { box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5), inset 0px 0px 0px 1px rgba(124, 124, 124, 1); -moz-box-shadow: inset 2px 2px 2px rgba(0,0,0,0.5), inset -1px -1px 2px rgba(255,255,255,0.5), inset 0px 0px 0...

php - Efficiency in SQL query -

i have created search functionality cake application. built multiple select boxes in can select data, cycles through selected options , implements them sql syntax. basically how function looks like: $selectedfilters = $this->data; $selectsql = 'select agencies.agency, agencies.website_url, agencies.status, agencies.size, agencies.id, officedata.id, contactdata.name, contactdata.surname, contactdata.job_title, contactdata.email, contactdata.mobile, officecountrydata.country agencies left join (select agencies_industries.agency_id, agencies_industries.industry_id agencies_industries) industrydata on agencies.id = industrydata.agency_id left join (select agencies_professions.agency_id, agencies_professions.profession_id agencies_professions) professiondata on agencies.id = professiondata.agency_id left join (select age...

c# - Hiding columns but not page number in grid view asp.net -

i working on grid view. using allow paging method working fine , positioned right of grid view. i want hide first column working fine except removing paging numbers stops user being able change page numbers. below code using hide column protected void tbllog_rowcreated(object sender, gridviewroweventargs e) { e.row.cells[0].visible = false; } the above code hides correct column hides automatic page numbers created grid view allowpaging method. thanks can provide. check first see if it's data row: if (e.row.rowtype == datacontrolrowtype.datarow) { e.row.cells[0].visible = false; }

CodeIgniter 2.x 404 error routing -

does new 404 error functionality in codeigniter 2.x send 404 error server can tracked analytics? or need in controller? little further digging , found answer @ bottom of page: http://codeigniter.com/forums/viewthread/164957/#790005 if you're talking $route['404_override'] page, not send proper 404 status code itself. filed bug report this. the fix in forum post seems perfect, making sure set header manually via $this->output->set_status_header('404'); in whichever method define default 404. problem can think of if want 404's load home page or something. there issue well, valid controllers invalid methods show default error page instead of custom one. can see reports of on issue tracker . hopefully correct in future releases, , make setting header automatic.

differences among numpy array types -

is there overview of different types of arrays in numpy? instance, gather there structured arrays, record arrays (in places used synonymously , in others said different, esp. since there recarray submodule seems different usual structured arrays), arrays records can indexed name (not fields), , dataframe class on python cookbook site; masked arrays... these separate ndarrays or there inheritance connecting them? the nearest i've seen such overview this: http://docs.scipy.org/doc/numpy/reference/arrays.classes.html

Embed browsers components -

is there application lets pack bunch of html files , render them? basically, want app has embedded browser, , can pack files. there such thing? nice if cross-platform or offered additional apis. my end goal wanna build app produces html , compiles , gives user. 1 solution use opera widgets, app can build html files, , pack desktop widget. requires user have opera installed. nice if there embedded browser solution. try adobe air . js-heavy application packed in platfrom-independent package. includes webkit-compatible browser. may less or more need.

nullpointerexception - Locating Errors When Developing Android Apps -

i'm working on first android app , honest i'm not sure of i'm doing. right i'm stuck on nullpointerexception created line refers class that, in turn, refers class. how can locate error? the word looking debug . if using eclipse, it's easy debug program in cases. 2 main options in eclipse use logger debug prints logcat, or debug program step step detect relevant errors. here tutorial both options , here nice video tutorial in youtube regarding debug in eclipse.

order - R Plyr - Ordering results from DDPLY? -

does know slick way order results coming out of ddply summarise operation? this i'm doing output ordered descending depth. ddims <- ddply(diamonds, .(color), summarise, depth = mean(depth), table = mean(table)) ddims <- ddims[order(-ddims$depth),] with output... > ddims color depth table 7 j 61.88722 57.81239 6 61.84639 57.57728 5 h 61.83685 57.51781 4 g 61.75711 57.28863 1 d 61.69813 57.40459 3 f 61.69458 57.43354 2 e 61.66209 57.49120 not ugly, i'm hoping way nicely within ddply(). know how? hadley's ggplot2 book has example ddply , subset it's not sorting output, selecting 2 smallest diamonds per group. ddply(diamonds, .(color), subset, order(carat) <= 2) i'll use occasion advertise bit data.table , faster run , (in perception) @ least elegant write: library(data.table) ddims <- data.table(diamonds) system.time(ddims <- ddims[, list(depth=mean(depth), table=mean(table)), by=col...

android - Blank permission screen on login attempt -

i'm making android app allows users login facebook accounts. can run on emulator , log in , out of account perfectly. however, when tried same on actual android, when went login blank facebook dialog poped title "permissions". there's "okay" button @ top right of dialog, , when click gives me following error: an error occurred [app name]. please try again later. api error code: 100 ape error description: invalid parameter error message: requires valid redirect uri. my phone automatically logs me in because have facebook app installed on not emulator, whereas emulator have enter info every time. this happens when try use same account both phone , emulator. different accounts each works fine mate, i've been fighting issue couple of days, , throw away project. the problem resides in following setting: app settings-> advanced settings -> enhanced auth dialog: true if set value false, run charm. seems facebook guys testi...

c++ - how to convert this to C# -

hi have following code convert c#. share light here how can convert c#? not familiar c++. on function deviceiocontrol calling winbase api. in c#, function should use replace deviceiocontrol? sharemode = file_share_read | file_share_write; accessmode = generic_read | generic_write; sprintf(ff, "\\\\.\\%s", device); hfile = createfile(ff, accessmode, sharemode, null, open_existing, 0, null); if(hfile == invalid_handle_value) { *response = -1; sprintf((response + 1), "failed open device %s", device); return; } status = deviceiocontrol(hfile, ioctl_scsi_get_address, null, 0, inquiry_data, sizeof(inquiry_data), ...

keyboard shortcuts - Disable Shift+Delete Cutting in Visual Studio -

Image
i type fast. times when programming select line shift + end , press delete key, finger hasn't come off of shift key. results in replacing clipboard item selected. this bad because many times deleting code before pasting other code. apparently shift + del old school way of cutting. i aware of ctrl + shift + v cycling through clipboard history in visual studio, still terribly annoying. is there way disable shortcut in visual studio or windows in general? the keyboard shortcuts pretty thoroughly customizable in visual studio. go tools > options in left select environment > keyboard select command, select shortcut want remove, click "remove" , click "ok" if wanted circumvent across windows, can use one-line autohotkey script convert shift + delete plain delete : +delete::sendinput,{delete}

javascript - How can I update a model in the view with ajax? -

here portion of code: @foreach (var item in model) { <div class="ticket-overview"> <ul> <li class="ticket-data-activity"> <a href="#" class="ticket-open-details"> @{ string desc = item.description.tostring(); if (desc.length > 20) { desc = desc.substring(0, 20); } @desc } </a> </li> i have view shows model controller. want update model ajax call. view remain same, model should change. is possible? if yes, how? give me idea. ask if clarification of question needed, i'm new user , not expert in asking. clarification: it's unordered list built custom table. say, want go next page, i've button clicked on. table data should updated. hence model needs updated. thanks... define div update. use j...

iphone - Asynchronous loading of images -

i have loaded images please tell me how use asynchrounous loading of images make use of egoimageview assuming want display downloaded image in uiimageview , it's easy (just initialize placeholder image , set url of image download). http://developers.enormego.com/view/what_if_images_on_the_iphone_were_as_easy_as_html if don't want display image, want asynchronous downloading, make use of egoimageloader. just make sure class conforms egoimageloaderobserver protocol , implement 2 delegate methods , you're done ... - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil { self = [super initwithnibname:nibnameornil bundle:nibbundleornil]; if (self) { imageloader = [egoimageloader sharedimageloader]; // ivar, can remove observer in dealloc ... } return self; } - (void)dealloc { [imageloader removeobserver:self]; [super dealloc]; } - (void)viewdidload { [super viewdidload]; nsstring *urlstrin...

.net - SQL Connection Error -

i getting error while trying access website: exception information: exception type: sqlexception exception message: error has occurred while establishing connection server. when connecting sql server 2005, failure may caused fact under default settings sql server not allow remote connections. (provider: tcp provider, error: 0 - connection attempt failed because connected party did not respond after period of time, or established connection failed because connected host has failed respond. this error occurs 6-7 times in whole day. can tell me why getting error? there special settings can made on sql server end avoid crash or problem in web application? if problem occurs time time, it's running timeout 1 (or more) of commands. try increasing value of commandtimeout property of commands. also try profiling sql server longrunning queries.