Posts

Showing posts from 2010

php - jQuery Ajax request is only working with one parameter -

i have problem using ajax php file. used code: function deleteimage() { $.ajax({ type : 'get', url : '../includes/deleteimage.php', contenttype : 'application/x-www-form-urlencoded', data : { method : "deleteimage", id : "1" }, success : function(msg) { console.log(msg); }, failure : function(msg) { console.log(msg); } }); } it doesn't work , chrome console showing me following error: get http://localhost/mypage/webcontent/includes/deleteimage.php?method=deleteimage&id=1 okay, looks missing file. when leaving id parameter out, request works without problem. i tried different parameter names , plain xmlhttprequest without jquery. the same error code shown above. an other request same structure working without problem. ( http://localhost/mypage/webcontent/includes/jslistener.php?method=sh

sql - difference in days, between two recordings -

i have table user | days | 1 | 1 | 2 b | 2 b | 5 and i'd have user | difference_in_day | 0 | 1 b | 3 i think have self-join, don't know how compare row next 1 only. do need add row position in first table condition ? : where a.row_position+1=b.row_position please try: ;with t as( select *, row_number() on (order user, days) rnum yourtable ) select distinct a.user, b.days-a.days difference_in_day t left join t b on a.rnum=b.rnum-1 b.user not null sample declare @tbl table(xuser nvarchar(1), xdays int) insert @tbl values ('a', 1), ('a', 1), ('a', 2), ('b', 2), ('b', 5) select *, row_number() on (order xuser, xdays) rnum @tbl ;with t as( select *, row_number() on (order xuser, xdays) rnum @tbl ) select distinct a.xuser, b.xdays-a.xdays difference_in_day t left join t b on a.rnum=b.rnum-1 b.xuser not null

c++ - Computing codebooks in OpenCV -

there questions referring same incomprehensible exception, ask minimal example. i have following code: load sift descriptors files; normalize descriptors such cv_32f; then: initialize bowtrainer (code based on example found on-line): termcriteria tc(cv_termcrit_iter,100,0.001); int retries=1; int flags=kmeans_pp_centers; bowkmeanstrainer bow_trainer(dictionary_size, tc, retries, flags); and finally: vocabulary = bow_trainer.cluster(training_descriptors); where training_descriptors 1218772 * 128 cv_32f matrix containing 0,1 normalized sift descriptors. unfortunately cluster generates exception saying: opencv error: assertion failed (data.dims <= 2 && type == cv_32f && k > 0) in kmeans, file /users/u/downloads/opencv-2.4.4/modules/core/src/matrix.cpp, line 2686 the type of matrix correct, i.e., cv_32f , not understand data.dims should <=2 , why looks k <= 0. by coincidence got same error. in case because descript

html - how to make the img at the left side and the texts at the right side vertically line up -

css .container{ height: 250px; padding 10px 0; } .col-left{ display: inline-block; background-image:url("support.png"); height:235px; width:300px; } .col-right{ display: inline-block; width:600px; } html <div class="container"> <div class="col-left"></div> <div class="col-right"> <h1>this title</h1> <p>to reach potential</p> </div> </div> question: i want img @ left , texts @ right to show on same line. vertically line up(texts appear in middle position of img) how this? i guess want. live demo .container { height: 250px; padding 10px 0; } .col-left { display: inline-block; background-image:url("http://www.lois-systems.co.uk/wp-content/uploads/2012/08/support.png"); height:235px; width:300px; vertical-align:middle; } .col-right { display: inline-block; width:600

Cannot edit recordset after setting table Connect property, Access 2010 -

i've added screen allows changing tables connect property users can change databases. here's values change: odbc;description=####;driver=sql server;server=server2008\mssqlserver2008;uid=#### ;pwd=####;app=microsoft office 2010;database=#### after doing so, piece of code: with me.child5.form.recordset 'linked tabled .movefirst while not .eof .edit !allow = false !readonly = false .update .movenext loop end raises "error '3027': cannot update. database or object read-only'. i should before changing connect property works fine regards piece of code. also, after changing connect property, changing information in other forms bounded other tables, changes take effect no error raised, database not read-only. any ideas? thanks edit: called refreshlink after setting connect , , changes in other tables did take effect in new database. the uid giving sql server in odbc connection string

facebook - Why i am lose my Access Token in android? -

i working on facebook application in android.i running application 1 r 2 times access token works after third time loss access token.why,i lose access token?what can without lose of access token when run. any 1 please me.... edit 1 : protected void onactivityresult(int requestcode, int resultcode, intent data) { // todo auto-generated method stub super.onactivityresult(requestcode, resultcode, data); mfacebook.authorizecallback(requestcode, resultcode, data); } login button click:::: mbtnfblogin.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { log.d("image button", "button clicked"); logintofacebook(); } }); login method :::::: public void logintofacebook() { mprefs = getpreferences(mode_private); string access_token = mprefs.getstring("access_token", null); long expires = mprefs.getlong("access_expires", 0);

GitHub Client Secret key should remain secret? -

i'm writing open source github client (c++/qt). first step authentication. since isn't web app can't use "web-flow" basic authentication+authorization exposes public client secret. looked solution in other applications: found choqok, kde micro-blogging client, stores in source code twitter's consumer key , secret, practice isn't evil. can same github client secret key? very thanks

java - Format current date to show day of the week -

this question has answer here: how determine day of week passing specific date? 13 answers i want show current date in application this: thu, may 2, 2013 i have following code current date calendar c = calendar.getinstance(); time time = new time(); time.set(c.get(calendar.day_of_month), c.get(calendar.month), c.get(calendar.year)); how can format time object string need? this want calendar cal = calendar.getinstance(); simpledateformat sdf = new simpledateformat("eee, mmm d, yyyy"); string strdate = sdf.format(cal.gettime()); system.out.println("current date in string format: " + strdate); where strdate can displayed in textview or whatever

webserver - lighttpd version error, indexfile -

i trying use lighttpd, , installed on switch. trying run gives error: 2013-03-15 15:29:49: (plugin.c.417) plugin-version doesn't match lighttpd-version indexfile 2013-03-15 15:29:49: (server.c.890) initialization of plugins failed. going down. any ideas? it indicates version of installed lighttpd different version of code, using. check installed version on machine , check sconstruct version. both should same.

c# - Connector/Net no longer supports server versions prior to 5.0 -

i'm using mysqlbackup.dll mysql database backup in asp.net application. @ time of backup troughs error message connector/net no longer supports server versions prior 5.0 what , how can remove error message.

Facebook open graph - Get friends "User-owned objects" -

i in progress of writing ios app using fb sdk 3.5. i have created app can create "user owned object" using following code: nsmutabledictionary<fbopengraphobject> *object = [fbgraphobject opengraphobjectforpost]; object.provisionedforpost = yes; object[@"type"] = @"fbltest:highscore"; object[@"title"] = @"new high score"; object[@"privacy"] = @"everyone"; object[@"data"][@"leaderboard"] = @"0"; object[@"data"][@"score"] = @"266"; [fbrequestconnection startforpostopengraphobject:object completionhandler:^(fbrequestconnection *connection, id result, nserror *error) { // stuff here }]; i tested object in object debugger , seems in order. can retrieve list of user objects using following code: fbrequestconnection* connection = [[fbrequestconnection

select all check box in android listview -

in application, tried create list multiple check boxes. for tried 1 listview android.r.layout.simple_list_item_multiple_choice multiple choice in listview . my listview in xml as,.. <listview android:id="@android:id/list" android:layout_width="match_parent" android:layout_height="468dp" android:choicemode="multiplechoice" android:divider="#b5b5b5" android:dividerheight="1dp" > and use checkbox select/deselect checkbox in listview as <checkbox android:id="@+id/select_all" android:layout_width="120dp" android:layout_height="wrap_content" android:layout_column="2" android:textsize="18dp" android:text="select all" /> and java code as,.. selectall.setonclicklistener(new onclicklistener() { public void onclic

javascript - Jquery append() not working properly -

i have following html in dynamically creating category buttons passing category id , name function. aim show product menus on behalf of category in div #dvsoft . <div id="tabbed-nav2"> <ul id="con1"> <span> <div class="drinks">drinks</div> </span> <%for (int = 0; < dtcategory.rows.count; i++) { string str = dtcategory.rows[i]["categoryname"].tostring(); int categoryid =convert.toint32(dtcategory.rows[i]["productcategoryid"]); %> <li><a href="javascript:;" value="<%= categoryid %>" > <%= str %> </a></li> <%} %> </ul> <div class="center-content"> <div id="dvsoft"></div> </div> </div> this event handler function calls getdatausi

performance - Why is this GLSL shader so slow? -

i trying raytrace on grid in fragment shader. have written shader below (vertex shader draws screenquad). #version 150 uniform mat4 minvproj, minvrot; uniform vec4 vcampos; varying vec4 vposition; int test(vec3 p) { if (p.x > -4.0 && p.x < 4.0 && p.y > -4.0 && p.y < 4.0 && ((p.z < -4.0 && p.z > -8.0) || (p.z > 4.0 && p.z < 8.0))) return 1; return 0; } void main(void) { vec4 cout = vec4(0, 0, 0, 0); vec4 vworldspace = minvrot * minvproj * vposition; vec3 vrayorg = vcampos.xyz; vec3 vraydir = normalize(vworldspace.xyz); // http://en.wikipedia.org/wiki/xiaolin_wu%27s_line_algorithm vec3 adelta = abs(vraydir); int increaser; vec3 gradient, sgradient; if (adelta.x > adelta.y && adelta.x > adelta.z) { increaser = 0; gradient = vec3(vraydir.x > 0.0? 1.0: -1.0, vraydir.y / vraydir.x, vraydir.z / vraydir.x);

couchapp - CouchDB-Lucene index function doesn't work with external code -

i'm using couchdb-lucene retrieving data of tables in database. thing have parse data know ones want put in lucene index. so, thought use class wrote process data. , use couchapp directives add class in index function. the result looks this: //index function function (doc) { var myclass = new myclass(doc.data); var ret = new document(); ret.add(myclass.getresult()); return ret; } //couchapp directives: //! vendor/couchapp/myclass.js when @ design document, seems code correctly added, when execute search, lucene says " myclass not defined" . if try copy/paste "myclass" code manually (and therefore no longer using couchapp directive), lucene says document has incorrect ending. what missing? edit: removed real function code has no point in issue. is !vendor inlining myclass code "index" value? the error got when included myclass code directly sounds javascript error of own. couchdb-lucene evaluates string us

ruby - Communicating with remote apis including rails -

i new rails. in project have number of api calls(post) many servers. each call requires number of arguments needs send via post request. response simple json data. can suggest better way or has experience kind of stuff. most of these operation single round strip . i have read active resource , net::http , confused 1 use. since active resource restful api don't know before hand if server communicating providing same. thanks in advance! you must check if api working rest or soap. if rest use rest-client gem if uses soap can use savon gem

Saving a curl response into a php variable -

i trying access ec2's public hostname inside instance. i run command curl http:// 169 254.169.254/latest/meta-data/public-hostname inside php script , save response variable. how can this? you can this <?php //url of targeted site $url = "http://www.yahoo.com/"; $ch = curl_init(); // set url , other appropriate options curl_setopt($ch, curlopt_url, $url); curl_setopt($ch, curlopt_header, 0); curl_setopt($ch, curlopt_returntransfer, true); // grab url , pass browser $output = curl_exec($ch); //echo $output; // close curl resource, , free system resources curl_close($ch); ?> the $output variable contains response.

android - Copying a local Database and mailing it. -

i have made application pets, @ first had kept database local phone, new features arrive want make network based application remote database. have around 500 downloads on play store , dont want previous users lose data. came idea of rolling out update in copy databases sd card , mail them me , update them in remote database. wonder if there better way go around this. highly appreciated. a better way write webservice can send database row row. webservice update server database(s). this not prevents duplication of database between internal , external memory, allows automation , more flexibility in update process. can pause transfer, , pick whichever row last sent easily.

qt - Crash/misfunction of QFileDialog in debug builds -

i know post quite old, i'm experiencing same kind of problem. i'm using qt 4.6 on windows 7 64 bits, application built visual studio 2008. i have same kind of use of qfiledialog class. in slot of 1 of widgets try open "browse window" select file open. i've tried combinations of following: native vs. qfiledialog instance on stack vs. qfiledialog instance on heap. "parent" parameter set null vs. vs. mainwindow qfiledialog::dontusenativedialog set true or false const int cfile_open_dlg_type = 0; #define file_open_dlg_parent null //#define file_open_dlg_parent //#define file_open_dlg_parent mmainwindow const bool cfile_open_dlg_native = false; void vgqtmodelwidget::on_mbrowsebutton_clicked() { qstring lfilepath; qfiledialog::options loptions = (cfile_open_dlg_native ? qfiledialog::dontusenativedialog : 0); if (cfile_open_dlg_type == 0) // heap allocated dialog { qfiledialog* lfiledlg = new qfiledialog (file_ope

javascript - Backbone.View.extend - events hash -

i'm going through tutorial advises events can captured via view follows: var view = backbone.view.extend({ el: $('#element'), events: {}, render: function(){} }); there doesn't seem documentation associated events object. has been deprecated or obsolete? or looking in wrong place: http://backbonejs.org/ from view.delegateevents delegateevents delegateevents([events]) uses jquery's on function provide declarative callbacks dom events within view. if events hash not passed directly, uses this.events source. events written in format {"event selector": "callback"} . callback may either name of method on view, or direct function body. omitting selector causes event bound view's root element ( this.el ). default, delegateevents called within view's constructor you, if have simple events hash, of dom events connected, , never have call function yourself. the events property may define

Rails file upload with ajax -

i have been uploading file rails rest-client, when change ajax, gives server error. form code <%= form_tag({:controller => 'person',:action => 'create'},:multipart => true) %> <%= file_field_tag 'upload', :class => 'upload_name' %> <%= submit_tag "upload", :class => "photo_up btn btn-success" %> <%end%> ajax code $(function(){ $(".photo_up").click(function(){ var filename = $(".upload_name").val(); $.ajax({ url: '/create', //your server side script data: { upload: filename}, //our data type: 'post', success: function (response) { } }); return false; }); }); controller code file_param = params[:upload] puts "name os #{file_param}" show_url = "............." resource = restclient::resource.new show_url, :user => "admin",:password

python - Compiling MySQL Workbench on Ubuntu 13.04 -

i having problems compiling mysql workbench on ubuntu 13.04. downloaded source mysql site , during configure part checks dependencies says: checking python2.6... no checking python2.7... yes checking python libraries... not found configure: error: python c development headers/libraries not found i tried hack , modify configure file , removed part checked python headers. by doing checks succeeds , can run make , during make process says cannot find python.h (which expected): python_context.h:28:21: fatal error: python.h: no such file or directory so searched installation directory of python 2.7 , found python.h . searched on internet, couldn't find answer how solve problem. appreciated. it cannot find so file. i'm not sure proper solution is, following works around it: sudo ln -s /usr/lib/x86_64-linux-gnu/libpython2.7.so /usr/lib/libpython2.7.so but after of that, got (unrelated) compile errors, gave up, , went outdated packages ubuntu.

c# - Access denied attempting to open a file on a shared folder -

i'm working on application has input folder receive files process. unfortunately, our costumer has choosen unix operational system run main software, , has shared folder can content through network. main software quite strange write files: firstly, creates file , writes content inside file. application i'm working on catchs file @ moment it's put inside folder , process file. in case, have "fight" accessing file, because main software writing content while application trying open see whether it's being used process. every time try open file, exception thrown, catch statement doesn't catch exception be. the folowing code used when i'm trying open file see whether it's being used process: public static void isopen(string file) { bool isopen = true; while (isopen) { try { using (file.open(file, filemode.open, fileaccess.read, fileshare.none)) { isopen = false; }

c# - asp.net button works once and then stops working -

i have imagefield works once first time displays messagebox when close messagebox using cancel button , here how <script type="text/javascript"> $(document).ready(function() { $('#<%= imagebutton1.clientid %>').click(function() { alert('hello'); // works once $.blockui({message: $('#maininsert')}); }); $('#<%= button2.clientid %>').click(function() { $.unblockui(); }); }); </script> here how definsedh image button <br /> <asp:imagebutton id="imagebutton1" runat="server" imagealign="right" imageurl="/_layouts/n.png" /> <br /> <br /> here's cancel button code, <div id="maininsert" style="display: none; cursor: default"> <asp:button id="button2" text="cancel" runat="server" cssclass="rightbutton" /> </div> you

sql - How to get all rows in certain month -

i have column named dc34_date of type date (defined way: date '2013-04-17' ). need select rows specific month (for example april). have used where month(dc34_date)=04; doesn't work. you can use extract date function date. try this. where extract(month dc34_date) = '4';

java - I need to to use a for loop to execute println() multiple times -

i need writing loop print statement multiple times based off of user-input 'sides' variable. there seems problem while loop, please let me know if syntax off. import java.util.scanner; public class lab6 { public static void main(string[] args) { scanner scan = new scanner(system.in); int sides = 0; string poly = "error!!!!!!"; system.out.print("enter number 3 12: "); sides = scan.nextint(); while (sides > 3 || < 12 ){ system.out.println("please enter number 3 12: ") } if(sides == 3) { poly = "triangle"; } else if(sides == 4) { poly = "quadrilaterl"; } else if(sides == 5) { poly = "pentagon"; } else if(sides == 6) { poly = "hexagon"; } else if(sides == 7) { poly = "heptagon"; } else if(sides == 8) {

Creating an array of graphic paths in vb.net -

Image
i dont know why having trouble this, keep getting 'not set instance of object' exception every time. does make sense? i have declared in main form private _paths() system.drawing.drawing2d.graphicspath and in sub _paths(20) = new graphicspath but whatever reason object reference error on second line. help? after decleration, want go ahead , add line graphics path so _paths(k).addline(x_loc(k), y_loc(k), x_loc(k + 1), y_loc(k + 1)) as per suggestion use list: declared in main class private _paths list(of system.drawing.drawing2d.graphicspath) using in sub for k = 0 10 'x_loc , y_loc calculations done here _paths.add(new graphicspath) _paths(k).addline(x_loc(k), y_loc(k), x_loc(k + 1), y_loc(k + 1)) next still error when trying create new instance of graphicspath there should no reason error should pop right? private _paths new list(of system.drawing.drawing2d.graphicspath) your not redimensioning array, instead us

Design of Python curiosity, why so? -

say have x = [2,4,5] . if y = list(x) , [2,4,5] , true tuples. bit surprising me, have expected [[2,4,5]] in former case. have been motivation not giving list of list? the list builtin type takes arbitrary iterable (regardless of type) , creates new list out of it. since list instance iterable, can used construct new list iteration. if expect list([1,2,3]) give [[1,2,3]] , why wouldn't expect list((1,2,3)) return [(1,2,3)] or list(x x in range(10)) return [<generator object <genexpr> @ 0xef170>] ?

java - GAE Starting dynamic instance to serve requests instead of using idle resident instances -

i ve checked bunch of other post same subject 1 : “resident instance doesn't seem work” couldn t find working answer problem i have 4 f2 resident , whenever goes application, instead of using resident instance, new dynamic instance mounted answer request. , person attempting use application wait 20 seconds. new requests come new dynamic instance. response time on resident instances inferior min pending latency (5 sec). app in production since yesterday , if no 1 uses 5 minutes next guy connect have wait 20 sec ! from ve read, if set min idle instance 4 ( in order have resident instances) gae try have 4 iddle instances time , ll start new instances; have wait 35 sec first connections after 2 minutes of using application fine. guy working @ google told me there bug in management of resident instances , have have 3 resident instances have quick answer users. m sure haven t understood something. me let users have fair response time when connect application , no 1 have con

ruby - How do I create an interactive menu in a terminal? -

i'm trying build terminal application that, when started, take user away prompt , present them screen interactive menu. user able interact in following way: they start application running my_app terminal. start application , present them root menu. they use cursor keys navigate around menu , use [enter] key make selection. when make selection, presented screen/menu when work. when finished work, press key take them root menu. the key thing i'm after not scrolling view adds more information end. i'd have distinct, encapsulated views navigation hierarchy. problem don't know how produce such view , present user, , dismiss again once they're done. if give me kind of design pattern kind of application, i'll able take there. fwiw, i'm using ruby , app cross-platform. if that's ask, windows suffice. i'm linux guy , want suggest ncurses library you. there's ongoing effort port windows. afaik it's going pretty well, please che

iis - Powershell List Active HTTP Requests -

in windows 2008 there appcmd can used so: appcmd list request appcmd list request /apppool.name:defaultapppool is there way accomplish in powershell? there way. i use following: get-website | {$_.name -eq $website} | get-webrequest the variable $website web site name get-website -name "sitename" doesn't seem work. https://technet.microsoft.com/en-us/library/ee790581.aspx

multithreading - Accessing to from from thread -

i have little problem multithreading. use createthread create own thread , create when program starts (sorry @ moment cant use vcl threads). thread working vcl form. program life second thread life too. here 1 problem. when vcl form going terminate thread can check form (class) params. sure when main form terminated , thread try check methods in form... got access violation. how can secured check params in vcl form? thanks! here code. unsigned int winapi checkmutex( lpvoid lpparam ) { const int def = 20; int cnt = def; unicodestring text; while (1) { if (!updfrm || !updfrm->label8 || updfrm->mutexterminate) break; first im checking pointer updfrm vcl form can terminated pointer form still alive. thats why check controls existing. , after check mutexterminate but here 1 problem. when vcl form going terminate thread can check form (class) params don't this, reason have found. not access directly form instance v

Returning customized results with SQL Server -

this little complicated i'm going break down. i'm trying results couldn't figure out query gonna like. premise this, users has purchased specific set of items, gear. when go site, see kits or setups users have submitted. want show them setups have gear they've purchased. don't need see setups gear not have. hope makes sense. here's tables like: [gear] gearid unique key has list of gear (mics, heads, effects) unique id's each [kits] kitid unique key has list of user submitted kits [kitgearlink] this table connects [kits] , [gear] each other. table lists out gear user submitted kit has. [users] userid unique key list of users [usergear] links [users] , [gear] table together. stores user's personal gear consists of. so how pull records each user show them kits work gear have. if kit has user doesn't own, won't show them. ideas? thanks guys! perhaps this: select * kit k k.kitid not in ( s

exclude member while using Fetch in Petapoco -

thinking of trying use petapoco.fetch member "content" c# object. "content" member byte[] member store in cache og want retrieve specially .. not database. so: sql = "select * table.funddocument"; list<funddocument> funddocuments = new list<funddocument>(); funddocuments = database.fetch<funddocument>(sql) .ignoreorexcept(funddocument.content = getdocumentfromcache(id)); so petapoco object fetch except member "content", fetch function getdocumentfromcache(); is possible? you can use explicitcolumns in poco , exclude property being retrieved or can name different, petapoco don't retrieve it.

angularjs - Can't access properties of my Javascript object -

Image
i'm using angular.js fetch single record api. i'm getting record object, can log object , see it's properties cannot access of properties. undefined . var template = template.get({id: id}); $scope.template = template; ... console.log(template); // displays object console.log(template.content); // undefined update var id = $routeparams.templateid; var template = template.get({id: id}); $scope.template = template; /*** template placeholders ***/ $scope.updateplaceholders = function () { var placeholders = []; var content = template.content; console.log(template); // dumps object in screenshot console.log("content" in template); // displays false // placeholders match patter var match = content.match(/{([a-z0-9]+)}/gmi); ... } $scope.$on('$viewcontentloaded', function(){ $scope.updateplaceholders(); }); you need wait http request complete, specify in callback. in case i've taken step further , added

c# - Create validation for CSV and Text file only (case insenstive) -

this question has answer here: c# regex: ignore case… in pattern? 1 answer i wants upload file extension .csv , .txt , case insensitive. for example .csv, .csv, .csv, .txt, .txt , .txt ... i using one (?i)[.](csv|txt) but not work when extension case-sensitive. this regex in both client side , server side validation: ^.*\.([cc][ss][vv]|[tt][xx][tt]??)$ if want atleast 1 character name (before .txt or .csv) following help: ^.+\.([cc][ss][vv]|[tt][xx][tt]??)$

Azure roles are cycling - WaHostBootstrapper.exe crashing, faulting module ntdll.dll -

this driving me crazy: have windows azure cloud service asp.net mvc 3 project. there have been many changes lately, have deploy every few days. sometimes (e.g. now), we're stuck on following deployment error: role instances recycled amount of times during update or upgrade operation... manage.windowsazure.com tells instance 0 of our staging deployment non-healthy: recycling (role has encountered error , has stopped) instance 1 fine, web services on instance 1 working, so cause of error not our code . we rdp'ed instance , examined application event log, displays following error multiple times: faulting application name: wahostbootstrapper.exe, version: 6.0.6002.18488, time stamp: 0x505cf7da faulting module name: ntdll.dll, version: 6.1.7601.17696, time stamp: 0x4e8147f0 exception code: 0xc0000008 fault offset: 0x00000000000d4995 faulting process id: 0x970 faulting application start time: 0x01ce474976d706d2 faulting application path: e:\base\x64\wahostbootstra

objective c - NSSortDescriptor Order Values Less than 10.0 -

nssortdescriptor not ordering correct when distance less 10.0. code (order array distance): // order array distance (distance = nsstring) nssortdescriptor *asortdescriptor = [[nssortdescriptor alloc] initwithkey:@"distance" ascending:yes]; [_contentdata sortusingdescriptors:[nsarray arraywithobject:asortdescriptor]]; right ordering (when distance values > 10.0): ( { distance = "11.256649"; }, { distance = "257.428821"; }, { distance = "4534.256851"; } ) wrong ordering (when distance value < 10.0): ( { distance = "252.428821"; }, { distance = "4514.256851"; } { distance = "8.362996"; // wrong ordering when distance < 10.0 }, ) i don't think issue here value less 10. appears v

ruby on rails - respond_to in after_filter -

i dry controllers placing reoccurring code in before , after filters. in current project, every action has same respond_to block: respond_to |wants| wants.html wants.js { render :layout => "transition" } end i placed in after_filter so: after_filter :respond_to_html_or_transition but leads error: render and/or redirect called multiple times in action. please note may call render or redirect, , @ once per action. note neither redirect nor render terminate execution of action, if want exit action after redirecting, need "redirect_to(...) , return". this happens when there no explicit respond_to or redirect within action. i'm assuming happens because rails (for lack of explicit respond_to call) makes educated guess , creates own respond_to before after_filter . if that's case, there way me keep rails doing , instead use block in after_filter ? what trying accomplish not possible after_filter. after filter deal

linux - Is there any way to have PostgreSQL not collapse punctuation and spaces when collating using a language? -

from understand, postgresql delegates collation strcoll() function of underlying operating system, , apparently (if not all) linux installations take advantage of fact punctuation , spaces can optionally collapsed when collating in utf-8. for example, have database in postres 9.2 on centos 6.4 encoding='utf8' lc_collate='en_us.utf8' lc_ctype='en_us.utf8' and run query select * (values('abc'),('abc'),('abc'),('...abc'),('a bc')) x order 1; the results are abc bc abc ...abc abc mac os x seems honor punctuation , spaces uses posix/c style sort. similar database same settings on os x returns ...abc abc abc bc abc regardless of operating system, expect proper collation return (and icu demo project shows) ...abc bc abc abc abc is there way postgres installs on operating system, particularly linux, observe proper collation in style of icu? as you've noted, postgres relies on operating syste

javascript - Cannot code jQuery UI dialog into a namespace -

the code shown below works fine. trying move dialog portion (gbbso.cnst.ddlog.dialog line) gbbso.cnst code block , i'm running kinds of errors - syntax, function not defined, etc. possible do? if (gbbso == null || typeof (gbbso) != "object") { var gbbso = new object(); } gbbso.cnst = { datepickeropt1: { dateformat: 'dd-m-yy', showon: 'button', buttonimage: 'styles/images/calendar_schedulehs.png', buttonimageonly: true, buttontext: 'select date', showbuttonpanel: true, changemonth: 'true', changeyear: 'true', beforeshow: function (input) { gbbso.dpclearbutton(input); }, onchangemonthyear: function (yy, mm, inst) { gbbso.dpclearbutton(inst.input); } }, ddlog: jquery('<div><span><img src="global_template_files/images/loading.gif" />&nbsp;&nbsp;&nbsp;&nbsp; communicating server....

c# - Access other xaml controls data in another control's event -

i have below listbox binding data class(saveddataclass) defined.when user clicks on link "update" want access entire data of other members of particular instance of saveddataclass .is possible access data ? mean how access other xxaml controls data in listbox item instance when 1 of member invoked .. <listbox x:name="lstareadetails" grid.row="1" margin="0,10,0,0" > <listbox.itemtemplate > <datatemplate > <stackpanel > <stackpanel orientation="horizontal"> <textblock foreground="white" name="mydatetime" text="{binding mydatetime}"></textblock> </stackpanel> <stackpanel >

java - Regular expression to get specific part of request parameter from Log entry? -

i have request parameter in following format "post /upload/senddata.htm http/1.1" and want extract resource name in case upload/senddata.htm any pointers on how in cases request comes "post //upload/senddata.htm http/1.1" or "post ///upload/senddata.htm http/1.1" i using java just guess, you're looking for? post \/+(\w+\/\w+.\w+) http://rubular.com/r/iulih9ldzs or maybe this post \/+(.+)\s http://rubular.com/r/sdw51ek1wi

java - Auto/manually set column width JTable with db data -

in code have jtable filled data database. this constructor of jpanel: public mainpanel(vector<vector<string>> films) { dimension dim = toolkit.getdefaulttoolkit().getscreensize(); int width = this.getsize().width; int height = this.getsize().height; int x = (dim.width-width)/2; int y = (dim.height-height)/2; header = new vector<string>(); data = new vector<vector<string>>(); header.add("id"); header.add("name"); header.add("year"); header.add("genre"); this.data = films; this.setvisible(true); this.setlocation(x, y); initcomponents(); } and initialize of jtable : jtable2 = new javax.swing.jtable(); setdefaultcloseoperation(javax.swing.windowconstants.exit_on_close); jtable2.setmodel(new javax.swing.table.defaulttablemodel( data, header )); tablecolumnmodel tcm; tcm = jtable2.getcolumnmodel(); (int = 0; < header.size();

mysql - Inner joining on more than 2 tables -

i have 5 tables need query from, , unsure how this. considering using multiple inner joins, getting thrown lots of errors. here example of want do: tables: customer id name state hotelid 1 george w.a 1 2 franklin n.s.w 2 bus id make 1 hino 2 mercedes 3 leyland hotel id name 1 hyatt 2 sebel tour id tourname busid 1 japan 1 2 america 1 3 austria 2 tour-custlink id tourid custid 1 1 1 2 2 2 3 3 3 let's query list names, state of customers stayed @ hyatt , went on hino buses, how go doing this? the tables not working with, i'd prefer in example this, , there way code add. something ... select c.name, c.state tourcustlink tcl inner join customer c on tcl.custid = c.id inner join hotel h on c.hotelid = h.id inner join tour t on tcl.tourid = t.id inner join bus b on t.busid = b.id h.name = 'hyatt' , b.make = 'hino' but beware not optimised ... bit premature ... 8-)

sql - How to preserve datatype following a SELECT INTO? -

i have table t1 date/time fields. i've combined several queries on table union query, , made new table t2 using select on union follows: select * t2 (select * query1_t1 union select * query2_t1) the problem query1_t1 substitutes blank string constant of date fields, results in t2 having text fields instead of date/time fields. illustrate: query1_t1: select myudf(sometextfield),"" newdatefield t1 query2_t1: select anotherudf(sometextfield),olddatefield t1 where olddatefield date/time. is there way can structure select into, or change query1_t1 , i'll still same results query newdatefield end date/time? you can create table separately adding data it. first, define fields appropriate data types. use insert (columns) select * from populate it. updated: or can hybrid approach. first select into no rows @ all : select * t2 query2_t1 1=0 this create of structure. can go , manually adjust data types didn't come through properly.

excel - VBA: Using worksheet name and/or range name as inputs to function -

i have simple function shades every other row of given range in worksheet: public function shadeeveryotherrow() sheets("mysheet").select shadedrows = range("myrange").rows.count ' determines number of rows shade in range ' code loops through , shades rows here end function i able call function given worksheet name , range inputs. if write function shown below , attempt execute using test() sub, "compile error: type mismatch" error. assistance appreciated. thanks. public function shadeeveryotherrow(targetsheet worksheet, targetrange range) dim targetsheet worksheet dim targetrange range sheets(targetsheet).select shaderows = range(targetrange).rows.count 'code shades rows here end function sub test() shadeeveryotherrow "mysheet", "myrange" end sub targetrange , targetsheet should of type string, instead of being passed function objects. public function shadeeveryotherrow(targetsheet string, tar

AutoFixture in F# UnitTest Project Not Displaying Unit Tests in Test Explorer -

i have visual studio 2012 project , following nuget packages installed: autofixture auto mocking using moq autofixture xunit.net data theories autofixture moq xunit.net: extensions xunit.net: runners xunit.net given following contrived logger class (logger.fs): namespace funit type public iloggercontext = abstract member logpath :string type public loggercontext (logpath :string) = member val logpath = logpath get, set interface iloggercontext member this.logpath = this.logpath type public logger () = member this.log (context: iloggercontext) value = system.string.format("logged {0} {1}.", value, context.logpath) and following unit test: namespace funit.test open funit type public math_add() = [<xunit.extensions.theory>] [<ploeh.autofixture.xunit.autodata>] member this.``should output value , path`` (path :string) = let context = new loggercontext(path) let logger = ne

c++ - Cache multiplication operation -

i have raise many numbers in base 50 @ power x (x anywhere between 1 , 300). numbers stored bignums. my question is: because multiply lots of times 2 bignums digit digit (base 50) faster cache multiplications? so, every time multiply a[] b[] have a[i]*b[j] many times a[i] , b[j] base 50 numbers. i thinking instead of doing a[i]*b[j] each time, wouldn't faster create matrix beforehand: prod[50][50] , prod[i][j] = i*j . have prod[a[i]][b[j]] . is reading memory faster doing multiplication? quick example if question not clear: instead of: for(int i=1; i<=100; ++i){ sum += 50*30; sum += 37*20; } is faster: for(int i=1; i<=100; ++i){ sum += prod[50][30]; sum += prod[37][20]; } ? short answer: yes, likely. long answer: depends. faster calculate multiplication in cache fetch large number memory if it's not in cache. you need implement caching , benchmark against "no cache" see get. bear in mind powers can calcula

java - Dividing a 2D array into boxes -

i having trouble dividing 2d array boxes, in sudoku. have array of squares in board object, , want divide them 2x3 or 3x3 boxes, box objects have 1d array keep track of squares. k box number, in 9x9 sudoku, boxes numbered 0 through 8. int l = 0; for(int i=k*a; i<k*a+a;i++){ for(int j=k*b;j<k*b+b;j++){ narray[l]=brd.getsquare(i,j); brd.getsquare(i,j).setbox(this); l++; } this gets first box right, goes off after that. i've been thinking hours now, , can't seem wrap head around it. have neat trick this? so, i'll assume boxes numbered this: 012 345 678 (and boxes consist of 3x3 cells each) if i , j x , y coordinates, you'll need translate above coordinates. like: 0 1 2 3 4 5 6 7 8 x 0 1 2 0 1 2 0 1 2 y 0 0 0 1 1 1 2 2 2 so x = k%3 , y = k/3 . in actual grid x , y has start 0, 3 , 6 rather 0, 1 , 2, multiply 3. so should it: (changes depending on coordinate x , y) int size = 3; in

javascript - Setting Variables Does Not Work on Page Load, but Does Through Console? -

i must missing something. script follows: var slideshowul = jquery('div.slideshow').css('overflow', 'hidden').children('ul'), imgs = slideshowul.find('img'), imgwidth = imgs[0].width, imgslen = imgs.length, current = 0; console.log(slideshowul); console.log(imgs); console.log(imgwidth); console.log(imgslen); console.log(current); the output is: [ul, prevobject: p.fn.p.init[1], context: document, selector: "div.slideshow.children(ul)", constructor: function, init: function…] [img, img, img, img, prevobject: p.fn.p.init[1], context: document, selector: "div.slideshow.children(ul) img", constructor: function, init: function…] 0 4 0 it not getting width of image. when paste above code directly console, returns correct value (750). width of 0 means reading value before images have loaded. call on window onload , not ready/inline.

css3 - using Matrix and AlphaImageLoader at the same time -

having issue following ie filters: progid:dximagetransform.microsoft.matrix() progid:dximagetransform.microsoft.alphaimageloader() i cant both of them working @ same time on same element. if apply either 1 of them individually work, cant seem chain these effects? has seen bug before? what correct syntax? i have tried several combinations recommended on , ms reference sites, none have solved issue. if want effects occur in order specify above ( matrix alphaimageloader ), not possible. the alphaimageloader procedural surface , in the static filters descriptions such matrix noted (emphasis added me): when multiple filters applied object, each filter process in source order, with exception of procedural surfaces, computed first . emphasize filter's effect, place last in source order or on object's parent. place transitions last in source order. so alphaimageloader process first, if defined last. if order not issue (though suspect is),

What's the best way to program F# on OSX 10.8? -

i'm studying in university f#, , looked bit on internet couldn't find nice program code in f#. suggestions? f# software foundation great resource start with. here excerpt using f# on mac osx : what should use edit code? some editors have specific support f#, either builtin or through addons provided f# community: we recommend xamarin studio or monodevelop f# addin monodevelop . emacs. there f# mode emacs extends emacs syntax highlighting f#, support working f# interactive , automatic indentation. vim sublimetext while first 2 options have up-to-date support, can use f# interactive via command line , use editor feel comfortable with.

android - java.lang.IllegalStateException: Can't change tag of fragment -

hi getting error while using pageviwer , adapter slide across 3 fragments. here pageadapter public class freedompageadapter extends fragmentpageradapter { private list<fragment> listfragment; public freedompageadapter(fragmentmanager fm, list<fragment> listfragment) { super(fm); this.listfragment = listfragment; } /* * (non-javadoc) * * @see android.support.v4.app.fragmentpageradapter#getitem(int) */ @override public fragment getitem(int position) { // todo auto-generated method stub return listfragment.get(position); } /* * (non-javadoc) * * @see android.support.v4.view.pageradapter#getcount() */ @override public int getcount() { // todo auto-generated method stub return listfragment.size(); } here how define pageview viewpager = (viewpager) findviewbyid(r.id.pager); viewpager.setonpagechangelistener(this);