Posts

Showing posts from January, 2011

sql - How can I optimize this PostgreSQL query that updates every row? -

i wrote query update entire table. how can improve query take less time: update page_densities set density = round(density - 0.001, 2) query returned successfully: 628391 rows affected, 1754179 ms (29 minutes) execution time. edit: setting work memory.. set work_mem = '500mb'; update page_densities set density = round(density - 0.001, 2) query returned successfully: 628391 rows affected, 731711 ms (12 minutes) execution time. assuming density not index, may able improve performance different fillfactor. see question/answer or postgresql docs more info: http://www.postgresql.org/docs/9.4/static/sql-createtable.html slow simple update query on postgresql database 3 million rows although cannot modify table's fillfactor, can create new table different fill factor , copy data over. here sample code. --create new table different fill factor create table page_densities_new ( ...some fields here ) ( fillfactor=70 ); --copy of recor

entity framework - why combBox.selectedItem can't be null? -

i have button named button2 should remove items table in database through entity framework. i have combobox selects item should deleted. when don't select item exception happens selecteditem.tostring object reference not set instance of object. if use selectedvalue instead of selecteditem every time run program else branch executed if choose item private void button2_click(object sender, eventargs e) { firstentities db = new firstentities(); var st = db.students.tolist<student>() .find(a => a.family == combobox1.selecteditem.tostring()); if (st != null) { db.students.remove(st); db.savechanges(); } else messagebox.show("you didnt select student"); }

How to delete empty rows from Grid in my Form? -

Image
i use fill stringedit simple displaymethod. this method selected see records mytable , discard others , method work well, but, in grid see empty records-rows(that record discarded). for fill stringedit used dispaly method : display myexdtypestring namefield() { mytable minetable; myexdtypestring name; while select minetable this.fieldtouse== "value" name = this.namefield; return name; } there's way delete empty rows? in grid i have lesf site state , want have right situation: thanks all! enjoy if trying form not display blank records easy setting querybuildrange on data source: querybuilddatasource querybuilddatasource; querybuildrange querybuildrange; super(); querybuilddatasource = this.query().datasourcename(minetable_ds.name()); querybuildrange = querybuilddatasource.addrange(fieldnum(minetable, fieldtouse)); querybuildrange.value('>0');

c++ - Convert std::basic_string<wchar_t> and std::basic_string<uint16_t> -

in macos x 10.10 clang: typedef basic_string<char, char_traits<char>, allocator<char> > string; typedef basic_string<wchar_t, char_traits<wchar_t>, allocator<wchar_t> > wstring; i build string like: std::wstringstream ss; ss << "["; ss << "{"; ss << "x1:" << 111 << ","; ss << "z1:" << 111; ss << "},"; ss << "{"; ss << "x2:" << 222 << ","; ss << "z2:" << 222; ss << "}"; ss << "]"; std::wstring str = ss.str(); and need pass str argument function expects std::basic_string<uint16_t> , returns string of same type. how conversion between std::basic_string<wchar_t> , std::basic_string<uint16_t> make use of external library function? c++11 allowed. maybe use of wstring_convert or workaround? firs

android - OnScrollListener for RecyclerView total scroll is inaccurate? -

i implemented onscrolllistener recyclerview follows: new recyclerview.onscrolllistener() { @override public void onscrolled(recyclerview recyclerview, int dx, int dy) { super.onscrolled(recyclerview, dx, dy); scrolly += dy; } }; this should add scroll changes scrolly holds total vertical scroll of recyclerview. but when scroll down end of list , scroll up, scroll value not equal 0, positive (in test example ends @ around 300). what part of implementation wrong? okay, figured out , timing issue. might have same problem me @ point, here happened: in fragment added onscrolllistener add dy complete scrolly value recyclerview: new recyclerview.onscrolllistener() { @override public void onscrolled(recyclerview recyclerview, int dx, int dy) { super.onscrolled(recyclerview, dx, dy); mscrolly += dy; } }; in recyclerview rows, wanted use mscrolly value, whenever recyclerview scrolled, respond parallax effect, implemen

php - Sphinx filtering with dropdown lists -

i have finished implementing full-text search engine powered sphinx using php , mysql. add filtering using drop down lists. more grateful if assist me on that. sounds job attributes http://sphinxsearch.com/docs/current.html#attributes but not lot more can said, without more detail. ask specific question specific answer. ask general question general answer.

jQuery tabs shows directory listing -

Image
my tabs didn't work. no js error looks like: ssl-page jquery 1.11.3 ui 1.11.4 on xampp i found nothing this. ideas? edit 1 <ul> <li><a href="#tabs-1">nunc tincidunt</a></li> <li><a href="#tabs-2">proin dolor</a></li> <li><a href="#tabs-3">aenean lacinia</a></li> </ul> check if tabs have attribute set href="/" if yes load root directory. instead change href="#" or href="javascript:void(0)" . check example below copy/pasted: $(function() { $("#tabs").tabs(); }); <link href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css" rel="stylesheet" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="http://code.jquery.com/ui/1.11.4

c# - MVVM Distribute Objects -

Image
maybe small step solution can't far. i did wpf tutorials datacontext , binding , can't how share context and/or binding between (e.g.) 2 pages. for example when @ one: https://msdn.microsoft.com/en-us/library/ms754356%28v=vs.110%29.aspx <label>enter name:</label> <textbox> <textbox.text> <binding source="{staticresource mydatasource}" path="name" updatesourcetrigger="propertychanged"/> </textbox.text> </textbox> <label>the name entered:</label> <textblock text="{binding source={staticresource mydatasource}, path=name}"/> this result: it's easy example , there no problem running , understanding this, want is: fill textbox , label code behind. tried name textbox tb , call tb.text = "some text" - works. tried assign datacontext both textbox , label , create object , fill datacontext object - worked. placing label on page.

installation - Run bat file as administrator in Visual Studio installer -

i following how run ".bat" file during installation? to run registry clean of visual studio installer project. add-ins loaded excel, , @ uninstalltion remove them add-in dialog removing registry. the cmd command cannot execute reg delete "hkey_current_user\software\microsoft\office\11.0\excel\options" /v "open" because not have administrator right 'reg' not recognized internal or external command, operable program or batch file how run batch file vs installation project administrator ?

Codeigniter pagination displays extra num links -

when search pages in categories displays result of pages in category. for testing have set limit per page 1 on search_for function . question/problem: if there 2 pages show in result reason pagination links display 5 links should display 2 pagination links. functions model on controller testing. i think problem lies db->like , db->or_like in model. why display 5 pagination links when should display 2 if 2 results found. controller <?php class category_search extends catalog_controller { public function __construct() { parent::__construct(); } public function index() { $data['title'] = "search category"; $data['categories'] = array(); $results = $this->get_categories(); foreach ($results $result) { $data['categories'][] = array( 'category_id' => $result['category_id'], 'name' => $result[&#

c# - Calling JavaScript Function From CodeBehind doesn't work with FileUpload -

i'm creating following functionality: create table on button click using data excel file loaded , save table xml file. after saving want show modal window (bootstrap) message. window managed javascript function , called function code behind. this html page: <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script src="../js/bootstrap.js" type="text/javascript"></script> </head> <body> <form id="form1" runat="server"> <div id="modalsaved" class="modal hide fade"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> </div> <div class="modal-body"> <p> changes saved succes

angularjs - how to call a controller function from ng-click directive? -

i have 2 directives , controller, problem can't call function 'addmarkers()' of controller directive . i have following codes: derectives.js app .directive('collection', function () { var tpl = '<ul><member ng-repeat="member in collection" member="member"></member></ul>'; return { restrict: "e", replace: true, scope: { collection: '=' }, template: tpl } }) app .directive('member', function ($compile) { var tpl = '<li><a ng-click="addmarkers(member)" >{{member.title}}</a>'+ '<input class="align" ng-if="!member.children" type="checkbox" ng-checked="true"/></li>'; return { restrict: "e", replace: true, scope: { member: '='

SQL Server Stored Procedure Error Handling -

i have stored procedure runs automatically every morning in sql server 2008 r2, part of stored procedure involves executing other stored procedures. format can summarised thus: begin try -- various sql commands execute storedprocedure1 execute storedprocedure2 -- etc end try begin catch --this logs error table execute errortrappingprocedure end catch storedprocedure1 , storedprocedure2 truncate table , select table. along lines of: begin try truncate table1 insert table1 (a, b, c) select a, b, c maintable end try begin catch execute errortrappingprocedure end catch the error trapping procedure contains this: insert [internal].dbo.error_trapping ( [error_number], [error_severity], [error_state], [error_procedure], [error_line], [error_message], [error_datetime] ) ( select error_number(), error_severity(), error_state(), error_procedur

java - Changing Jackson active view for a property -

using jackson, i'd able change active view when serializing property. so, if application uses 3 views, a, b & c, might want property p type t serialize using view a, regardless if active view class null , a.class , b.class , or c.class . i haven't found way built-in jackson, plan make own classes this. before possibly reinvent wheel, possible normal jackson annotations and/or classes? if not, plan following (nb: simplify question, i've omitted lot of config options & performance optimizations aren't necessary core functionality, i'll add once core works; i've omitted visibility modifiers & concision): make following annotation indicates that, annotated field or method, view should switched active view value : @target({field, method}) @retention(runtime) public @interface jsonapplyview { class<?> value(); } if @jsonapplyview applied property, somehow change value of _serializationview , getserializationview() & geta

ios - MKPolyline / MKPolylineRenderer changing color without remove it -

i working around map app, want ask how change polyline color without remove , add again, found topic https://stackoverflow.com/questions/24226290/mkpolylinerenderer-change-color-without-removing-overlay in stackoverflow not involve question, did not touch line, no need -[mkmapviewdelegate mapview:didselectannotationview:] so possible that? edit: want change polyline color smoothly (by shading color - sound animation) if have idea on how animate polyline please tell me too. complex animations or shading/gradients require creating custom overlay renderer class. these other answers give ideas how draw gradient polylines , animations require custom overlay renderer well: how customize mkpolylineview draw different style lines gradient polyline mapkit ios draw cagradient within mkpolylineview apple's breadcrumb sample app has example of custom renderer may find useful. however, if want update line's color (say blue red), may able follows: get refe

jquery - PHP to download generated CSV not pushing to the browser for download -

so have function generates csv , stores on server (this works fine) not pushing browser user download, can see why? it putting data multiple sections like; invoice details customer details invoice items i prefer if put data onto 1 line rather 3 sections not sure how this, can me well. thanks in advance guys! have hour live if me great! function: // download invoice csv sheet if ($action == 'download_csv'){ header("content-type: text/csv"); // connect database $mysqli = new mysqli(database_host, database_user, database_pass, database_name); // output connection error if ($mysqli->connect_error) { die('error : ('.$mysqli->connect_errno .') '. $mysqli->connect_error); } $tables = array('invoices', 'customers', 'invoice_items'); // array of tables need export $file_name = 'invoice-export-'.date('d-m-y').'.csv'; // file name $file

How to set alarms in android -

i newbie android. i developing prayer application. functionality user set time , @ particular time prayer played entire month. so doing in manner: for (int counteralarm = 0; counteralarm < spandays; ++counteralarm) { alarmpendingintent = creatependingintent(context, string.valueof(100 + counteralarm)); setalarmforday(context, calendarmorningreminder, alarmpendingintent); calendarmorningreminder.add(calendar.day_of_month, 1); sbrequestcodes.append(string.valueof(100 + counteralarm)); sbrequestcodes.append(";"); } the above loop add alarms days, suppose user chosses time 6.00 in morning on 1st day of month 30 alarms registerd. private static pendingintent creatependingintent(context context, string requestcode) { intent intent = new intent(context, applicationbroadcastreceiver.class); intent.setaction(constants.intent_action_

json - Get ui.bootstrap.datepicker value without time/timezone -

Image
i need able store selected date value date without time in ng-model. here view: <script type="text/ng-template" id="form_field_datetime"> <h3 style="color:coral ;">{{field.displayname}}</h3> <br /> <div> <div ng-controller="datectrl"> <p class="input-group"> <input type="text" class="form-control" datepicker-popup="{{format}}" is-open="opened" ng-required="true" ng-model="field.thevalues[0]" /> <span class="input-group-btn"> <button type="button" class="btn btn-default" ng-click="open($event)"><i class="glyphicon glyphicon-calendar"></i></button> </span> </p> </div> </div> </script> on selection of date shown above stored value in ng-m

ios - How to get a friend's post of facebook sdk v4 -

i'm using facebook sdk v4 posts of friend. use following code fbsdkloginmanager* loginmanager = [[fbsdkloginmanager alloc] init]; [loginmanager loginwithreadpermissions:@[@"user_posts"] handler:^(fbsdkloginmanagerloginresult *result, nserror* error) { if (error) { // process error nslog(@""); } else if (result.iscancelled) { // handle cancellations nslog(@""); } else { // if ask multiple permissions @ once, // should check if specific permissions missing if ([result.grantedpermissions containsobject:@"user_posts"]) { fbsdkgraphrequest *request = [[fbsdkgraphrequest alloc] initwithgraphpath:@"/10002434324342/posts" parameters:nil httpmethod:@"get"];

Python logging creates empty files -

i using python's logging facility. simple stuff really, want log file created if there log. in other words, no log file should created if there nothing log. as my logging.basicconfig( filename=filename_log, level=logging.debug, mode='w') is ran, empty log file created. trying delete before exiting if ( os.stat( filename_log ).st_size == 0 ): os.remove( filename_log) gives error message: "windowserror: [error 32] process cannot access file because being used process". suppose else should done before. so, way not have empty log files generated, without writing own logging procedure? thanks. edit: in short: logging.basicconfig( filename=filename_log, level=logging.debug, mode='w') logging.debug('this message should go log file') does log gives empty file there nothing logged. and with open( filename_log, 'w') logfile: logging.basicconfig( stream=logfile, level=logging.debug) gives a: "valueerror: i/o op

c++ - SDL_CreateWindowFrom() with Qt widget under Mac OS -

i using libsdl2 in qt app. code working under linux , windows failing under mac os. here crash output: 2015-05-12 10:24:35.598 testapp[4621:105425] -[qnsview title]: unrecognized selector sent instance 0x7fdfbac7b8e0 2015-05-12 10:24:35.643 testapp[4621:105425] uncaught exception raised 2015-05-12 10:24:35.643 testapp[4621:105425] -[qnsview title]: unrecognized selector sent instance 0x7fdfbac7b8e0 2015-05-12 10:24:35.643 testapp[4621:105425] ( 0 corefoundation 0x00007fff9332764c __exceptionpreprocess + 172 1 libobjc.a.dylib 0x00007fff967686de objc_exception_throw + 43 2 corefoundation 0x00007fff9332a6bd -[nsobject(nsobject) doesnotrecognizeselector:] + 205 3 corefoundation 0x00007fff93271a84 ___forwarding___ + 1028 4 corefoundation 0x00007fff932715f8 _cf_forwarding_prep_0 + 120 5 testapp 0x000000010446af59 cocoa_c

html - CSS transition on :after is not working -

Image
i trying create custom switch checkbox. here when un-selected and when selected which okay apart css transition not working, , switch jumps when toggling though using: -webkit-transition: .1s linear; -moz-transition: .1s linear; -ms-transition: .1s linear; -o-transition: .1s linear; transition: .1s linear; i have put jsfiddle here: http://jsfiddle.net/awldbzec/4/ you cannot transitions from/to properties value auto , in example you're changing left value 0 auto , right value auto 0 you can try animating instead left property, 0 (100% - 24px) using calc() .switch input:checked + span:after { background-color: #fff; left: -webkit-calc(100% - 24px); left: calc(100% - 24px); } /* hover effect */ .switch input:checked + span:hover:after { width: 30px; left: -webkit-calc(100% - 30px); left: calc(100% - 30px); } example : http://jsfiddle.net/awldbzec/5/

java - how to extract values from .properties file, having two values corresponding to one property name -

how extract values .properties file, having 2 values corresponding 1 property name example of property file is iframe=classname=demo-frame datetextbox=id=datepicker datepicker=xpath="//td[not(contains(@class,'ui-datepicker-other-month'))]/a[text()='"+value+"']" q: main required 3rd property value contains special characters well. you can have values comma-separated: datetextbox=id,datepicker string[] dates = properties.getproperty("datetextbox").split(",");

database - How can I increase the number of triggers executed simultaneously in PostgreSQL? -

i have table foreign key constraints many clients load data simultaneously. noticed when there few clients adding new data works fine, however, more 10 clients slows down significantly! have idea why happening? postgresql says that: "each new row requires entry in server's list of pending trigger events (since firing of trigger checks row's foreign key constraint). loading many millions of rows can cause trigger event queue overflow available memory, leading intolerable swapping or outright failure of command." cannot remove triggers in case. know how increase size of list of pending trigger events? did not observer swapping disk. moreover, check locks using query: select locktype, relname, pid, mode pg_locks,pg_class pg_locks.relation=pg_class.oid; and locks don't show special.

c++ - how to add macro defines in Qt .pro file -

this question has answer here: how add pre processing defs (macros) qt creator? 4 answers i using asio alone in project, supposed built shared library used others. but got following error: warning please define _win32_winnt or _win32_windows appropriately. my question is, can add macro definition .pro file avoid it. can tell me how it, add #define pi 3.1415926 to .pro file. add following .pro file: defines += "pi=\"3.1415926\"" in compile output see like g++ -c -pipe -g -wall -w -d_reentrant -fpie -dpi="3.1415926" -dqt_gui_lib -dqt_core_lib -i../nobackup/qbuffertest -i. -i../nobackup/qt/5.4/gcc_64/include -i../nobackup/qt/5.4/gcc_64/include/qtgui -i../nobackup/qt/5.4/gcc_64/include/qtcore -i. -i../nobackup/qt/5.4/gcc_64/mkspecs/linux-g++ -o main.o ../nobackup/qbuffertest/main.cpp now can access macro

php - Symfony2 datetime field form -

i have symfony2 application receive json data in form. 1 of field date time. if renderize field form in way: ->add('startdate', 'date', array( 'widget' => 'single_text', 'format' => 'yyyy-mm-dd hh:mm:ss')) this accept like: "startdate": "2015-05-03 12:30:00" but need introduce datetime in way: "startdate": "2015-05-12t15:43:00+0200" how can set format in field? on http://php.net/manual/en/function.date.php "c" => iso 8601 date (added in php 5) => 2004-02-12t15:19:21+00:00 try this: ->add('startdate', 'date', array( 'widget' => 'single_text', 'format' => 'c')) i hope helps.

javascript - .keyup event not working -

$('input[name="list_checkbox_ids[]"], #frame, input[name="del_list_ids[]"]').on('keyup', function() { $('#button_link').prop('disabled', ! $('input[name="list_checkbox_ids[]"]:checked').length); }); the scenario is, click on search button generates list of checkboxes. button_link should defaulted disabled until select 1 of checkboxes. in above code, howcome not remove disabled ? tried looking errors in console cannot find one. pls help. list_checkbox_ids dynamically loaded on page. can change this $('input[name="list_checkbox_ids[]"], #frame, input[name="del_list_ids[]"]').on('keyup', function() { $('#button_link').prop('disabled', !$('input[name="list_checkbox_ids[]"]:checked').length); }); into this(using event delegation) dynamically created content $(document).on('keyup','input[name="list_ch

ruby on rails - Update huge data in rake task -

i have model named pagedensity has 5m rows. when created project pagedensity table stored float of 5 decimal precision in density coulmn. now requirement changed round 2 decimal places. i wrote task round densities makes system heavy stucks. can't use query rounding bit change 0.57500 rounded 0.57 , 0.57600 rounded 0.58 . what have tried far simply: task round_densities: :environment application_object = applicationcontroller.new time = benchmark.realtime activerecord::base.transaction pagedensity.all.each {|p| p.update_attributes(density: application_object.round_number(p.density))} end end puts '***************************************' puts "total time consumed #{time} seconds" puts '***************************************' end and tried make query rounding failed: select round(0.00500, 2) #this returns 0.01 should return 0.00 i using postgres idea make psql query or using rai

Getting user data in NewProjectCreationPage in Eclipse Plugin -

i have been successful in making plugin. need on project creation page add more textboxes user information. need use information add auto generated .php files made in project directory. i want know how can override wizardnewprojectcreationpage add more textboxes given layout. pretty new plugin development. here code custom wizard. import java.net.uri; import org.eclipse.core.runtime.coreexception; import org.eclipse.core.runtime.iconfigurationelement; import org.eclipse.core.runtime.iexecutableextension; import org.eclipse.jface.viewers.istructuredselection; import org.eclipse.jface.wizard.wizard; import org.eclipse.jface.wizard.wizarddialog; import org.eclipse.ui.inewwizard; import org.eclipse.ui.iworkbench; import org.eclipse.ui.dialogs.wizardnewprojectcreationpage; import org.eclipse.ui.wizards.newresource.basicnewprojectresourcewizard; import rudraxplugin.pages.mypageone; import rudraxplugin.projects.rudraxsupport; public class customprojectnewwizard extends wizard imp

php - PHPWord how to replace HTML Tags -

i creating word doc using phpword. content of doc dynamic , content may contain html tag following: <strong>problem statement</strong> <p>the text may be<em>bold</em> subject peculiar conditions</p> <ul> <li>test 1</li> <li>test 2</li> </ul> the doc creating in doc content showing html tags. how replace these tags proper word document tags word doc shows same html view proper formatting. i suggest make function this: function converttags($text){ $text= str_replace("<strong>", "<w:b val="true"/>", $text); $text= str_replace("</string>", "<w:b val="false"/>", $text); // , tags that. may use array , loop through it. return $text; }

c# - Anyone have method easier than this? -

i have code , in reader. how can reader.read without if methods? system.windows.forms.textbox txt = new system.windows.forms.textbox(); oledbcommand command = new oledbcommand(); command.connection = connection; string query = " select * other order type"; command.commandtext = query; oledbdatareader reader = command.executereader(); txt.text = "txtpertanyaan"+cleft; this.controls.add(txt); txt.top = cleft *25; txt.left = 100; if (cleft == 1) { if (reader.hasrows) { reader.read(); txt.text = reader["type"].tostring(); reader.read(); } } else if (cleft ==2) { if (reader.hasrows) { reader.read(); reader.read(); txt.text = reader["type"].tostring();

sails.js - How to concatenates css files with .map files in sails? -

i newbie in nodejs, when try use grunt in sails 'sails www --prod' command. my web's style broken. changed css path, <!--styles--> <link rel="stylesheet" href="min/production.min.css"> <!--styles end--> to <!--styles--> <link rel="stylesheet" href="concat/production.css"> <!--styles end--> to find happened, , in browser console told error get http://localhost:88/concat/bootstrap.css.map 404 (not found) now, know bootstrap.css can't find .map file , didn't know how fix it. thanks help. you should copy bootstrap.css.map bootstrap folder concat folder

javascript - How to use Ember query parameters with beforeModel and select? -

demo: http://jsbin.com/zexopa/1/edit?html,js,output i use query parameters in application. , queryparameters 'name' , 'category' . the 'name' parameter used in select , 'category' uses input, there wrong select 'name' if set default null. if change 'name' , 'name' undefined in url. route: app.indexroute = ember.route.extend({ beforemodel: function() { this.controllerfor('index').set('products', [1,2,3]); }, model: function() { return [{'is_active':false, 'name':'one'}, {'is_active':false, 'name':'two'}, {'is_active':false, 'name':'three'}, {'is_active':false, 'name':'four'},{'is_active':false, 'name':'five'}]; }, actions: { queryparamsdidchange: function() { this.refresh(); } } }); controller: app.indexcontroller = ember.controller.extend({

Bind a directory to a docker container -

i'm building test project requires module outside of project directory. project folder in docker, , bind module directory docker container of project. possible it? or asking wrong question? way, i'm still new docker i'm trying things out. my understand is, need mount host folder container. try this: docker run -v /host/project_folder:/container/project -t avian/project_image bash explanation -v - --volume=[] bind mount volume /host/project_folder - host server's folder /container/project - container's folder update: the latest docker version (v1.9.1) support new command volume . should easier manage volume in docker. # example, need attach volume mysql container. docker volume create --name mysql-data docker run --name mysql -v mysql-data:/var/lib/mysql -e mysql_root_password=my-secret-pw -d mysql with that, can delete container mysql time, without lost database data.

sql - When did sqlalchemy execute the query? -

as i've start learning use sqlalchemy recently, result of following code make me confused when sqlalchemy execute query: query = db.session.query(mytable) query = query.filter(...) query = query.limit(...) query = query.offset(...) records = query #records=query.all() r in records: #do note line records = query #records=query.all() seems brings same correct result(stored in variable "records") when using "query" , "query.all()" , wonder when query executed? if executed during first line "db.session.query(mytable)" , result set may large @ point; if during fifth line "records = query" , how happen there's no function call @ all? in example, query gets executed upon for r in records . accessing query object via iterator triggers execution. (normally, compiled select statement) up until time, query built (via filter , limit etc). please read orm tutorial on querying

akka - Chunked file uploads in Spray.io? -

i have many clients upload arbitrarily large files (i.e., let's 5gb). performance reasons, has done in streaming way clients can split file series of chunks before uploading them in parallel. then, server take care of building file these chunks. think method better known chunked file upload . however, spray.io not seem offer high-level building blocks performing chunked file uploads. missing obvious here or have build functionality scratch? it's bit weird if don't since provide easy use mechanism stream response .

android - When I'm in the activity and turn internet on and off, then null pointer exception occurs -

public class nrclientsfragment extends fragment{ jsonobject json; arraylist<hashmap<string, string>> arraylist; nrclientscustomlist adapter; listview listview; private static final string tag_clientname = "client name"; private static final string tag_companyname = "company name"; private static final string tag_email = "email"; private static final string tag_contactno = "contact no"; public nrclientsfragment(){} connectiondetector cd; boolean isinternetpresent; public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { view v = inflater.inflate(r.layout.fragment_nrclients, container, false); log.i("sgs", "process started "); listview = (listview)v.findviewbyid(r.id.nrclientslv); arraylist = new arraylist<hashmap<string, string>>(); adapter = new nrclientscustomlist(getactivity(), arraylist); listview.setadapter(ad

javascript - How to populate koGrid Groups Array on initial load? -

how can populate kogrid groups array? last line of following code throwing error: gridoptions: { data: ko.observablearray([{ name: 'john', title: 'abc', age: 29, salary: 35000, company: "oati" }, { name: 'peter', title: 'xyz', age: 35, salary: 70000, company: "infogain" }]), multiselect: true, showgrouppanel: true, showcolumnmenu: false, showfilter: false, columnschanged: this.columnschanged, maintaincolumnratios: true, enablepaging: true, pagingoptions: this.pagingoptions, hidechildren: false, footervisible: false, displayselectioncheckbox: false, columnwidth: 1000, columndefs: ko.observablearray([ { field: '_sortindex', visible: false, displayname: "random sort", sortdirection: "asc" }, { field: 'name', visible: true, di

angularjs - Re-sizing problems in HighChart -

when page loads, featured charts present in page not take available width , overflows columns. however, when window re-sized or try investigate using inspect element, charts snap correct dimensions. behavior occurs in chrome, ff, , ie. i have tried following no results :-( <div id="container" style="width:100%;margin: 0 auto"></div> $(window).resize(); please help!! i faced similar problem, , "fixed" issue delaying creation of chart: settimeout(function () { $(element).highcharts({...}); }, 0); more details there: highcharts dynamic (re-)sizing in angularjs tabs

compiler construction - Static Single Assignment for variables in different scopes -

i student learning compilers, , confused problem in ssa form. as in many languages, c, there exists many scopes. variable in current scope may modified in other scopes, example, value of global variables can changed after calling function, makes optimization incorrect. furthermore, variable in current scope can modified using pointers. what should deal such circumstance? the simple, conservative solution problem describing involves never keeping copies of value if may change in ways difficult or impossible reason about. so mean that? consider following c fragment: void bar(void); int unsafe; void foo(void) { unsafe++; // 1 bar(); printf("%d\n", unsafe); // 2 } assume code compiled using compiler performs no interprocedural optimization or analysis. clearly, then, impossible compiler know whether or not call bar mutate unsafe . such, compiler must not keep copy of unsafe live across call bar . instead, value should read , written memory @

html - Use of Iframe causing disability of links -

Image
i have side navigation bar toggles hide , show on each click in sidebar(contains list links). , iframe displaying website. when click on link hide side bar , redirects corresponding url within iframe area. problem in when displaying websites inside iframe links of redirected websites work in top half portion of iframe , remaining in remaining half portion of iframe links disabled. when scroll inside iframe i.e when link in bottom half comes top portion links enabled. need help. .menu_sample { position: absolute; top: 0; bottom: 0; left: 0; width: 100px; border: solid 1px; transition: transform 0.1s ease-out; } .content { position: absolute; top: 0; bottom: 0; right: 0; left: 0; padding: 10px; transition: left 1s ease-out; margin-left: -1.5%; margin-top: 150%; } /*transition*/ .top_mar { margin-top: 25%; } /* on toggl