Posts

Showing posts from September, 2012

database - How to configure MariaDB in Laravel 5? -

i have read somewhere that, there no driver "mariadb" in laravel 5 , can use mysql driver use mariadb in laravel 5. getting error when give mariadb username , password. password "root" , username "root". sqlstate[hy000] [1045] access denied user 'root'@'localhost' (using password: yes) can guide me on how configure mariadb used laravel 5. 'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', 'localhost'), 'port' => env('db_port', '3307'), 'database' => env('db_database', 'doctorsondemand'), 'username' => env('db_username', 'root'), 'password' => env('db_password', 'root'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', '

c++ - StartService returns error 1053 -

i created windows service application in c++ , installed in system using createservice , startservice . service created , started. tried install same service in remote system. copied exe of service application remote system using copyfile , called openscmanager , createservice , service created in remote system. startservice returned error 1053: service did not respond start or control request in timely fashion. i tried start localsystem , localservice , networkservice . same error occured. how can rid of this.. edit: tried aading servicespipetimeout entry registry value 60000. service returned error before timeout reached :(

c++ - error: Cannot access memory at address -

i'm trying return pointer function in derived class, code: class a class { protected: c c; public: virtual void func(){ unsigned char *data; int size=getdata(data); } } class b class b : public { private: int size; public: b(const c &_c) { c=_c; }; const int b::getdata(unsigned char *data) const { data=(unsigned char *)malloc(size); memcpy(data,c.getmem(),size); if(!data){ //err } return size; } class c class c { private: unsigned char *mem; public: c(unsigned char *_mem) : mem(_mem); const unsigned char *getmem() const { return mem; }; } main.cpp c c(...); b *b=new b(c); b->func(); the error when getdata returns (this=0x50cdf8, data=0x2 <error: cannot access memory @ address 0x2>, size=32) thanks. in class a , func() worthless because: 1. size not returned caller. 2. pointer data local func , it's contents disappear after end of execution in func() . you don't n

istanbul - How to ignore branch coverage for missing 'else' -

is possible ignore marker e in istanbul branch coverage? using jasmine+karma+istanbul. there possibility ingore e , 100% branch coverage? maybe property can set in karma config? you can use /* istanbul ignore else*/ before if statement ignore missing else .

Why yii2 folders of vendors and extension are so big -

i using yii2 advance template in website , depend on extensions , widgets folder of website big website not big , starting website whole folder size: 111 mb vendor :30 mb frontend module folder: 40 mb frontend/web/assets folder :17 mb runtime/logs folder 18 mb assets big how make smaller please recommend solutions this your site might small instantiating lot of widgets require lot of 3rd party code. assets folder lot smaller , on production be. in development assets folder in fact change since don't want static assets when developing such assets folder larger in development production, always. yii2, if remember right, works based upon probability of deleting (like php sessions do) such excess space might seeing in fact yii2 not having probability delete it. one way clear out , refresh page. if assets folder still big you, @ronydavid mentioned, need widgets use.

java - How to prvent Xtend templates from printing Variables during loop -

i using xtend templates write small program. try using if statement, every time execute it prints variable in console, dont want to. «if x==y» jump value «database.get(2)» «jump_var_letter = string.charat(1)» «old_jump_ahd=database.get(2) » «endif» here database array of integers , string array of letters. here want print value found @ database.get(2) i.e 5. last 2 expressions befor endif meant assignning few values( need not printed) jump value 5 instead get jump value 5 d 5 could please tell me how stop printing other 2 values. thank in advance help.. after looking sometime on net found prevent printing of expreesions in between using block expressions , returning null expression. (although method not encouraged, found provides me result wanted). expression posted written as: «if x==y» jump value «database.get(2)» «{jump_var_letter = string.charat(1); "" }» «{old_jump_ahd=database.get(2); ""} »

java - Error: Could not find or load main class com.example.Test -

i searching how access private field of class other class , found can done using reflect.field in following code, when try execute code error saying : error: not find or load main class com.example.test why happening? test.java package com.example; import java.lang.reflect.*; class test { public static void main(string[] args) // ease of throwaway test. don't // normally! throws exception { other t = new other(); t.setstr("hi"); field field = other.class.getdeclaredfield("str"); field.setaccessible(true); object value = field.get(t); system.out.println(value); } } other.java package com.example; class other { private string str; public void setstr(string value) { str = value; } } compile both classes using javac javac other.java javac test.java and run java test while in eclipse need select test class using run con

spring integration - Generic type handling in Avro encoder/decoder -

i using spring-intergration-kafka send , receive messages kafka. message object based on generic type. base class looks this public abstract class abstractmessage<t> implements serializable { ... } i able send , receive different implementations of class. using avro reflection based encoders , decoders <bean id="kafkamessageencoder" class="org.springframework.integration.kafka.serializer.avro.avroreflectdatumbackedkafkaencoder"> <constructor-arg value="com.....model.abstractmessage" /> </bean> <bean id="kafkamessagedecoder" class="org.springframework.integration.kafka.serializer.avro.avroreflectdatumbackedkafkadecoder"> <constructor-arg value="com.....model.abstractmessage" /> </bean> this fails error avrotypeexception: unknown type: t this makes sense because avro cant figure out generic type specified in abstractmessage class decided use custom

javascript - return false not works for ajax success function in yii -

i want set validation of unique email id in yii not works properly, problem. form code below: <div class="row"> <?php echo $form->labelex($model1,'user_email'); ?> <?php echo $form->textfield($model1, 'user_email', array('maxlength' => 300)); ?> <?php echo $form->error($model1, 'user_email', array('clientvalidation' => 'js:customvalidateemail(messages,this.id)'), false, true); $infofieldfile1 = (end($form->attributes)); ?> <p class="emailuniquecheck" style="margin-left: 24%; color: red;"> </div> my ajax code below: <script> function customvalidateemail(messages,id){ var namec= '#'+id; var = $(namec).val(); if (a == '') { messages.push('email id empty.'); return false; } var email = $("#registration_user_email").val(); $(".emai

performance - What are the benefits of `let` in Swift? -

i know swift encourage programmers use constants ( let ) instead of variables ( var ) everytime makes sense. this thing because providing more details compiler our code means , compiler can better prevent making mistakes (e.g. changing value should not changed). my question is, there performance optimizations compiler apply when use constants instead of variables ? (e.g. faster executions times, lower footprint, ...). you asked "...are there performance optimisations compiler apply when use constants instead of variables?" the answer yes, absolutely. mutable collections may organized differently immutable ones in order allow them changed. immutable collections can optimized read-only operation. then there use of mutable/immutable objects. compiler may have generate code copies mutable object when it's shared property of object in order avoid undesired side-effects. comparison of immutable objects (equatable/comparable) can optimized in ways muta

actionscript 3 - Error: Could not resolve <mx:columns> to a component implementation -

i running issue error in flash web application compile time error: not resolve <mx:columns> component implementation. here used there (and compile) <?xml version="1.0" encoding="utf-8"?> <mx:box xmlns:mx="http://www.adobe.com/2006/mxml" verticalscrollpolicy="auto"> <mx:advanceddatagrid id="mydatagrid" width="100%" showheaders="false" includeinlayout="{mydatagrid.visible}" defaultleaficon="{null}" horizontalgridlines="true" verticalgridlines="true" horizontalgridlinecolor="#e4e4e4" verticalgridlinecolor="#e4e4e4" rowcount="6" minheight="94" variablerowheight="true" selectable="false" > <mx:columns> <mx:advan

Programmatically add/associate metadata to any file -

i'm building tool export files learning management system , store files somewhere s3. need keep track of pieces of information files relate system they're coming (e.g. course name, academic term, student's name/id). file types vary drastically, don't want make accommodations store metadata based on filetype (like pdf or doc). what's best way associate filetype-agnostic metadata file? i'm toying idea of generating json file every file bring over, great if add metadata directly file itself.

php - MySQL replace comma separated values in column with another table find old value to replace with new -

mysql table want replace comma separated values in column table value i have 2 table 1st table column has comma separated values(hotkey). 2nd table have oldid & newid column i want search 1st table column replace oldid newid action table(1st) id hotkey === ====== 1 2,3,4,5 2 3,2,14,7 3 4,5,6,11 4 9,2,11,5 5 11,5,3,8 tempid table(2nd) id oldid newid === === === 1 5 4 2 7 6 3 3 8 4 9 12 5 11 14 output table (desired) id hotkey === ====== 1 2,8,4,4 2 8,2,14,6 3 4,4,6,14 4 12,2,14,4 5 14,4,8,8 i solve using php script follows: //db access $dbhost = "localhost"; $dbuser = "root"; $dbpassword = ""; $database = "dbaname"; $dbcon = mysql_connect($dbhost, $dbuser, $dbpassword) or die(mysql_error()); mysql_select_db($database,$dbcon) or die ('>>>'.mysql_errno()."error1 :

javascript - How to make a page in read only for a current User -

my question how make page in read current user using javascript. this: function function() { var userid = xrm.page.context.getuserid(); var owner= xrm.page.getattribute("ownerid").getvalue(); var ownerid = owner[0].id; // if user#owner if (userid != ownerid) { //make current user in readonly } } do have idea? thank in advance you this: function onload() { var userid = xrm.page.context.getuserid(); var owner= xrm.page.getattribute("ownerid").getvalue(); var ownerid = owner[0].id; if (userid != ownerid) { xrm.page.ui.controls.foreach(function (control) { control.setdisabled(true); }); } } but, if requirement prevent users updating records not own, better set write-privilege entity user level.

excel - VBA Record date of row change in specific column -

i'm trying automatically update "updated" column of excel spreadsheet when cell of specific row changes today's date. able hard-coding "updated" column header be, however, necessary search column header may move. the code trying implement works gives me error automation error - object invoked has disconnected it's clients. any appreciated. here code have currently: private sub worksheet_change(byval target range) if not intersect(target, range("a:dx")) nothing dim f range set f = activesheet.range("a1:dd1").find("updated", lookat:=xlwhole) ' f.row = range(target).row if not f nothing range(split(f.address, "$")(1) & target.row).value = else msgbox "'updated' header not found!" end if end if end sub you got endless loop. try this: private sub worksheet_change(byval target range) if not

sql server - How do you write a SQL query to find all the rows that has a float currency value like $15.34 in a nvarchar field -

how write sql query find rows has float currency value like $15.34 , not round currency value 15 in nvarchar field. assuming have mix of numeric , non-numeric, should work return decimal values not whole dollar amounts: select * tablename colname '%.%' --has decimal (as in original query) , colname not '%.00' --does not end 00

ruby on rails - Active Record Association CollectionProxy not working: why does @owner.@target.count yield a result of 1 when @owner.@target returns an empty array? -

i have models in rails app: sales_opportunity has_many swots. i'm setting them using factorygirl , running test show when delete sales_opportunity cause associated swots deleted. reason when debugging byebug i'm getting strange results - sales_opportunity , swot records being correctly created, when run sales_opportunity.swots returns [ ] whereas sales_opportunity.swots.count returns 1. what's more odd exact same code works fine anther object association (timeline_events swots yet work same code). can tell me doing wrong please? sales_opportunity.rb: class salesopportunity < activerecord::base default_scope { order('close_date asc') } belongs_to :user belongs_to :company has_many :key_contacts has_many :timeline_events, dependent: :destroy has_many :swots, dependent: :destroy end swot.rb: class swot < activerecord::base belongs_to :sales_opportunity validates :swot_details, presence: true validates :sales_opportunity_id, presence: tr

php - Laravel route to controller not working -

i'm trying add new controller existing laravel project. application has pages @ /users , trying add restful api works separately this. api available @ api/users . i have created controller using php artisan: php artisan controller:make apiuserscontroller i have added following routes: route::controller('api/users', 'apiuserscontroller'); however when hit url receive site's 'page not found' message. is there have missed? it looks issue you're having you've used route::controller rather route::resource . route::resource maps routes 7 restful methods controller generator creates default. route::controller maps them methods add have http method part of name, in case if had method called getindex called on request /api/users/index or if had 1 called poststore called on post request /api/users/store . in order add api prefix route use following: route::group(['prefix' => 'api'], function() {

interface builder - How do I use IBDesignable/IBInspectable with CocoaPods in an Objective-C only project -

my project obj-c only. via cocoapods, tried installing an obj-c library takes advantage of ibdesignable , ibinspectable. if add project library , run 'pod install' 2 errors when building/running: error: ib designables: failed update auto layout status: failed load designables path (null) error: ib designables: failed render instance of pkcircleprogressview: failed load designables path (null) ok, apparently take advantage of ibdesignable/ibinspectable, code needs in framework, not static library. seems need add podfile: use_frameworks! when that, i'm able see in interface builder, when build/run, can't find afnetworking.h . don't think error specific afnetworking, it's first pod in podfile. if using swift, seems answer need add libraries podfile swift/obj-c bridging header. even though i'm not using swift, still need create bridging header? here's podfile (without downloadbutton pod, , without use_frameworks!): platform :ios, '8.

multithreading - android call url in for loop -

i calling url inside for:each using new thread.start. data getting uploaded, threads executing in parallel. want call url in series depending on status of previous url. there inbuilt functionality in android call url in series. this current code: for(item : foodlist) { if(i.issection()) { sectionitem item= (sectionitem) i; } else { food f= (food) i; upload(f.getfoodid(), string.valueof(f.getcalories()), f.getquantity(), f.getunit() ); } } thanks in advance you can implement queue - run next operation when current finished, suggest several things: 1) don't use threads data upload directly, face troubles approach. 2) use services 'long' operations. 3) check this rest implementation in android.

java - Default Credentials in Google App Engine: Invalid Credentials error -

i followed tutorial on https://developers.google.com/identity/protocols/application-default-credentials use default credentials in application on google app engine. however, when running app locally, 401 error (invalid credentials) com.google.api.client.googleapis.json.googlejsonresponseexception: 401 ok { "code" : 401, "errors" : [ { "domain" : "global", "location" : "authorization", "locationtype" : "header", "message" : "invalid credentials", "reason" : "autherror" } ], "message" : "invalid credentials" } this code use, included parts of tutorial: list<string> scopes = lists.newarraylist("https://www.googleapis.com/auth/youtube.force-ssl"); try{ // authorize request. googlecredential credential = googlecredential.getapplicationdefault();

python - multiprocessing: TypeError: 'int' object is not iterable -

i'm using multiprocessing module in python 3 reason, keeps throwing typeerror: 'int' object not iterable when run program. did: def main(i): global urldepth global row global counter urldepth = [] row = 0 counter = 0 login(i) crawler(menu_url) if __name__ == '__main__': workers = 2 processes = [] p_number in range(workers): p = process(target=main, args=p_number) p.start() processes.append(p) p in processes: p.join() i don't understand why happening, me this? not duplicate of typeerror: 'int' object not iterable because same error, yes, it's of different cause, please read question/code before trying mark question duplicate. p = process(target=main, args=p_number) iirc, args needs tuple, you're giving integer. try: p = process(target=main, args=(p_number,))

git - Commiter email address does not match in IntelliJ even changing it to correct one -

when try push commits git repository gerrit remote repository linux environment in intellij idea following error: remote: error: committer email address ***** [k remote: error: not match user account.[k even if changed settings correct ones git , gerrit (i can see at: git config -l console), still picks old "wrong" email. what wrong? you need reconfigure email $ git config user.email <your email> $ git commit --amend --reset-author git commit --amend updates last commits

c# - Can't convert from String to Char -

i'm trying split string: 2015-08-14 20:30:00 but compiler shows message: can't convert string char this code: string date = reader["date"].tostring().split("-").tostring(); the variable reader["date"] object, must convert string. want split content 3 other variable this: year: 2015 month: 08 day: 14 what doing wrong? sometime different approach should considered. if reader field datatype date or datetime using correct datatype correct way handle info. datetime has need. datetime dt = convert.todatetime(reader["date"]); int year = dt.year; int month = dt.month; int day = dt.day;

Directory function is called for in Emacs/elisp -

how can find directory function being called from? for example, if call line (defconst dir default-directory) the value of dir directory fine containing above line is, not directory calling from. thanks in advance the default behaviour in emacs use directory associated file being "visited" in current buffer . so, (file-name-directory (buffer-file-name)) should give directory name of file of current buffer (i.e., 1 working @ time, custom lisp function called). if not sure, whether custom function called in context of buffer, has file name associated it, should test this: (let ((file (buffer-file-name))) (if (not file) (progn ... no file name here ...) ... ok, file name available ...))

javascript - Radio button not working within nested ng-repeats -

i have web page check boxes & radio buttons within nested ng-repeats. when clicking check boxes underlying view model getting updated properly, when click on radio buttons, view model not getting updated properly. within group, when select option selected model property gets updated true other 1 doesn't change false. e.g. when click on radio buttons against chicken 1 one, of them becomes true. when select one, want other ones become false my view model given below. $scope.itemgroups = [{ "name": 'non veg', "items": [{ "selected": false, "name": 'chicken', "portions": [{ "selected": false, "name": '1 cup' }, { "selected": false, "name": '2 cups' }, { "selected": fals

php - Wordpress woocomerce redirecting to https in chrome browser -

wordpress woocomerce plugin (version < 2.3.12) redirects https when accessed chrome browser version 44. the initial request complete on http, resources in response (css, js, links) prefixed https. requests login redirect https. a call is_ssl() (wp-included/functions.php) returns true in chrome. function is_ssl() { if ( isset($_server['https']) ) { if ( 'on' == strtolower($_server['https']) ) return true; if ( '1' == $_server['https'] ) return true; } elseif ( isset($_server['server_port']) && ( '443' == $_server['server_port'] ) ) { return true; } return false; } but false in other tested browsers this due combination of chrome v44 sending new request header https = 1 every request, , woocomerce version < 2.3.12 incorrectly identifying presence of header indicate request being served via https proxy server. the code in

subprocess - How to communicate with parted interpreter via python? -

from subprocess import popen,pipe,stdout a=popen('parted -s',stdout = pipe, stderr = stdout, shell = true) a.communicate(input="print".encode()) string=a.stdout.read() i want use "print" command within parted, how do so? you can achieve without sending input child's stdin, use command line , execute subprocess.check_output() : import shlex import subprocess device = '/dev/sda' cmd = 'parted -s {} print'.format(device) output = subprocess.check_output(shlex.split(cmd)) >>> print output model: ata hitachi hts54756 (scsi) disk /dev/sda: 640gb sector size (logical/physical): 512b/4096b partition table: msdos disk flags: number start end size type file system flags 1 1049kb 210mb 209mb primary ntfs boot 2 210mb 322gb 322gb primary ntfs 4 322gb 640gb 318gb extended 5 322gb 322gb 524mb logical ext4 6 322gb 640gb 318gb logical

android - SQLite is not deleting rows -

i have table in database, created way: private static string crea_fichas="create table fichas ("+ "provincia varchar (40), "+ "municipio varchar (40), "+ "distrito varchar (40), "+ "codficha integer, "+ "codagente integer, "+ "domitri varchar(80), "+ "domfiscal varchar(80), "+ "ciernc varchar(13), "+ "nombrecompleto varchar (255), "+ "telf1 varchar(12), "+ "telf2 varchar(12), "+ "fax varchar(12), "+ "razonsocial varchar(255), "+ "nombrecomercial varchar(255), "+ "email varchar(50), "+ "codexpediente integer, "+ "croquis bytea, "+ "codtipoactividad integer, "+ "primary key(codficha), "+ "foreign key (codtipoactividad) refe

seo - HTML5: should hreflang always point to a direct translation? -

this practice place kind of links in head multilanguage sites: <head> <link rel="alternate" hreflang="en" href="/en"> </head> but, according answer question semantic markup language switcher , language switcher should like: <nav> <h1>translations of page</h1> <!-- omitted → usability question --> <ul> <li>english</li> <!-- omitted → usability question --> <li><a rel="alternate" href="/pl" hreflang="pl" lang="pl">polski</a></li> <li><a rel="alternate" href="/de" hreflang="de" lang="de">deutsch</a></li> </ul> </nav> i've got few semantic markup questions according that: are both of rules required seo? or, if i've got language switcher on site, links in head not needed anymore? let's i'm on page:

c# - Consolidation of an ObservableCollection based on keys -

i'm starting out forgive me if don't use correct terminology. i'm trying consolidate observablecollection> looping through , comparing 1 key other keys in collection. if same should compare matching keys values. don't have enough rep post pic. private void combineudas(observablecollection<tuple<object, object>> udas) { foreach (var item in udas) { } } you can so: public void combineudas( observablecollection<tuple<object, object>> udas ) { foreach ( var item in udas ) foreach ( var inneritem in udas.where( inneritem => inneritem != inneritem && item.item1 == inneritem.item1 ) ) console.writeline( "value same: {0}", item.item2 == inneritem.item2 ); } loop on each item for each item search in collection items same “key” check if “values” equals

javascript - Improving IE8 Performance with select2 v3.4.8 Library -

i trying improve performance of select2 v3.4.8 library in ie8. essentially, have narrowed problem down call singleselect2's opening method parent abstractselect2's opening method. method call speaking of one: this.parent.opening.apply(this, arguments); i have seen call take upwards of 5 seconds complete. in instances, has taken 10 seconds open dropdown in ie8. i've made performance improvements already. example, rather adding the: <div id="select2-drop-mask" class="select2-drop-mask"></div> to dom programmatically, added directly markup , set it's display:none. saves quite number of cycles because apparently, adding elements dom in ie8 expensive javascript. but still want more performance improvements this. have increased performance 10-20% making change. does have suggestions me? we've cached data display in dropdown on client on page load. so, there 0 server calls being made when dropdown opening. perform

sql - Join 2 datasets from 2 cubes into one chart on SSRS -

Image
i ask, have 2 datasets 2 cubes, similar data (only measure different), , combine both data 1 chart.. here data dataset: is there way combine data 1 chart 2 series? this goal : thanks ! :) found answer problem.. ive tried lookup function 1 field, , have lookup @ multi fields.. join them in 1 field =sum(lookup(fields!xxx.value+"-"+fields!yyy.value,fields!2xxx.value+"-"2yyy.value,fields!lookfor.value,"dataset2")) thanks :)

Issue with establishing Openfire XMPP Connection Android on live server via Asmack -

issue establishing openfire xmpp connection android on live server via asmack . unable establish connection server. same code working fine when point on localhost issue occurs when pointed on live server. exception caught while establishing connection : connection failed. no response server xmppconfig = new connectionconfiguration(constants.xmpp_base_url, constants.xmppp_port,constants.xmpp_resource); xmppconfig.setsaslauthenticationenabled(true); xmppconfig.setsecuritymode(connectionconfiguration.securitymode.disabled); if (xmppconfig == null) throw new nullpointerexception("xmppservice must configured before can connect!"); try { if (xmpp == null) { xmpp = new xmppconnection(xmppconfig); } xmpp.connect(); state = state.connected; } catch (xmppexception ex) { log.d(xmppcontroller.class.getname(), ex.tostring()); } issue has been resolved. issue existed on server side. server side settings blocking use of open-fire. issue not

c# - misunderstanding of concurrentQueue, a single consumer working from the queue on it's own thread -

i'm having trouble creating functioning systemfilewatcher takes created event , stores in queue separate thread work from. i've read countless threads here regarding issue can't head around particular problem. using system; using system.io; using system.collections.generic; using system.collections.concurrent; using system.collections; using system.threading; namespace filesystemwatchertest { class program { public static blockingcollection<string> processcollection = new blockingcollection<string>(new concurrentqueue<string>()); static void main(string[] args) { string path = @"c:\test\"; filesystemwatcher watcher = new filesystemwatcher(); watcher.path = path; watcher.enableraisingevents = true; watcher.filter = "*.*"; watcher.created += new filesystemeventhandler(oncreated); thread consumer = new thread(new threadstart(mover)); consumer.

jquery - appendTo is not a function -

i ran javascript code in browser using jquery, , gave error in title var tr = {};var obj ={}; obj['amount']=$('#amount').val(); tr['amount'] = obj['amount']; obj['qty']=$('#qty').val(); tr['qty'] = obj['qty']; var row = $('<tr></tr>'); $.each(tr, function (type, value) { $('<td class="input-' + type + ' text-center"></td>').html(value).appendto(row); }); can 1 point out i'm doing wrong? tr should array, not object. more here: http://api.jquery.com/jquery.each/ bad, $.each works objects. the value of #amount should either json or string you'll convert later array (or object). think step you're missing - converting value works $.each .

html - MultipleCheckbox form alignment -

Image
i have webpage displays django multiple checkbox form using bootstrap. i'm having difficulty getting choices in form line vertically - of options longer labels skewed relative other options. want form display in center of div want of choices line nicely. in picture can see first choice not aligned next 2 options. my form looks this: class scselectform(forms.form): def __init__(self,*args,**kwargs): arg_list = kwargs.pop('sc_arg_list') section_label = kwargs.pop('sc_section_label') if kwargs.pop('all_true')==true: initial = [c[0] c in arg_list] else: initial = none super(scselectform,self).__init__(*args,**kwargs) self.fields['sc_id'].choices=arg_list self.fields['sc_id'].label=section_label self.fields['sc_id'].initial=initial sc_id = forms.multiplechoicefield(required=true, widget=forms.checkboxselectmultiple) my views.py looks this: form_fileoptions = scselectfor

objective c - Open window such that is shows on all desktops -

i have screenshot thing, takes screenshot of current visible stuff, opens full screen window covering everything. opens on desktop of parent window on desktop 1. , if user had desktop 2 focused (due fullscreen app or something) window opened not show on desktop 2. so wondering if there window level or (i tried window levels) make such window appears on desktops. thanks this sounds either nswindowcollectionbehaviorcanjoinallspaces or nswindowcollectionbehaviorstationary . set collectionbehavior of window. (you want set window level, too, that's ordering rather collection/spaces behavior. , if have window menu, want nswindowcollectionbehaviorignorescycle .)

android - In Child Activity, Fragment is recreated automatically - AppCompatViewInflater app:theme is now deprecated -

from mainactivity, start childactivity (which extends appcompatactivity) intent. purpose of child activity display fragments (welcome text user can fill edittext enter information). intent myintent = new intent(this, createuseractivity.class); startactivityforresult(myintent, mainactivity.request_create_profile); after few seconds, in activity, restarted...the view reloaded. so annoying, because if in second fragment. activity restart , first one. user have restard work. i've got following message in logcat when activity recreated : 08-07 20:45:37.673 8010-8010/com.xxxxx.xxxxxi/appcompatviewinflater﹕ app:theme deprecated. please move using android:theme instead. any idea ? childactivity code (relevant part): @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); intent intent = getintent(); setcontentview(r.layout.activity_main); // load layout

javascript - Three.js mix textures generically and save -

context: want create game editor based on three.js similar warcraft iii world editor(video attached example of ask https://youtu.be/sxyws13nrro?t=5m1s ) . have 3 separate textures: rock, snow, grass. want create rocky, snowy road small pieces of grass in , make inside of 1 application , save mesh(or compositions of meshes) new texture(or blended state of textures). question: how make such generic composition of meshes different textures, shapes , materials, , better way save object got in result(generate new large texture, or maybe create mapping etc..). @ least please show direction search.

Can't get update statement in SQL Server to work -

i'm attempting execute sql update statement , it's not working. know why ? update dbo.ebstable set commandfield = replace(commandfield, '%appl.mbm_aging_file', '%appl.mbm_aging_file)') command '[%]appl.mbm_aging_file' basically, i'm trying add ")" end of data appearing in commandfield field value %appl.mbm_aging_file (the "%" appears in data). i discovered clause inadequate (like me sql). should read update dbo.ebstable set commandfield = replace(commandfield, '%appl.mbm_aging_file', '%appl.mbm_aging_file)') command '%[%]appl.mbm_aging_file%' that statement worked.

mysql - using get to retrieve value in php -

i want retrieve information table using function. it's not working. please, doing wrong?. <td><?php echo $row['count(*)']; ?></td> <td>n<?php echo number_format($row['sum(basic)'],2); ?></td> <td>n<?php echo number_format($row['sum(hmo)'],2); ?></td> <td>n<?php echo number_format($row['sum(dha)'],2); ?></td> <td>n<?php echo number_format($row['sum(tax)'],2); ?></td> <td>n<?php echo number_format($row['sum(netpay)'],2); ?></td> <td><a href="view_payroll_month.php?month=<?php echo $row['year(date)'];?>"><?php echo $row['year(date)'];?></a> </td> </tr><?php }?> the second page want the result show in $year = $_get['year']; $qry = "select count(*), sum(basi

How do i parse the KairosSDK JSON recognise response in Swift? -

for don't know kairos sdk is, it's facial recognition api. when give image, tell if can match in database. when give image; api sends me response: [images: ( { attributes = { gender = { confidence = "80%"; type = f; }; }; candidates = ( { "enrollment_timestamp" = 1436883322; face3rd = "0.988351106643677"; }, { "enrollment_timestamp" = 1436883214; hi = "0.94137054681778"; }, { "enrollment_timestamp" = 1436883132; hi = "0.94137054681778"; } ); time = "6.43676"; transaction = { confidence = "0.988351106643677"; "distance_apart" = "0.046980559825897"; "gallery_name" = test1;

python - Flask-Uploads always throwing 'UploadNotAllowed' error even with no constraints -

flask-uploads has called uploadset described "single collection of files". can use upload set save file predefined location. i've defined setup: app = flask(__name__) app.config['uploads_default_dest'] = os.path.realpath('.') + '/uploads' app.config['uploaded_photos_allow'] = set(['png', 'jpg', 'jpeg']) app.config['max_content_length'] = 16 * 1024 * 1024 # setup flask-uploads photos = uploadset('photos') configure_uploads(app, photos) @app.route('/doit', method=["post"]) def doit(): myfile = request.files['file'] photos.save(myfile, 'subfolder_test', 'filename_test') return ''' blah ''' this should save ./uploads/photos/subfolder_test/filename_test.png my test image is: 2.6mb , png file. when upload file, error: ... file "/home/btw/flask/app.py", line 57, in doit photos.save(myfile, 'subfold

ruby on rails - ActiveRecord::StatementInvalid (PG::SyntaxError: ERROR: syntax error at or near "." -

i not sure why query works on localhost failing on server. happens when try create quiz routes quizzescontroller#new # /quizzes/new def new @quiz = current_user.quizzes.new end this query: select count(*) "questions" inner join "question_categories" on "question_categories"."question_id" = "questions"."id" "questions"."deleted_at" null , (`question_categories`.`category_id` in (87,1)) (1.0ms) rollback completed 500 internal server error in 58ms (activerecord: 13.4ms) and got error such. activerecord::statementinvalid (pg::syntaxerror: error: syntax error @ or near "." line 1: ...s"."deleted_at" null , (`question_categories`.`category... quiz.rb before creating run build_parts should randomly grab questions , place them quizzes. class quiz < activerecord::base belongs_to :user belongs_to :subject has_many :quiz_categories has

php - Cakephp 3 belongsToMany results in undefined offset/index -

i have "groups" , "servers" tables need join through many many relationship. created third table in database "mn_groups_servers" columns id , group_id , server_id . added groupstable: public function initialize(array $config) { parent::initialize($config); $this->table('mn_groups'); $this->belongstomany('servers', [ 'jointable' => 'mn_groups_servers', 'foreignkey' => 'group_id', 'targetforeignkey' => 'server_id', ]); } and serverstable: public function initialize(array $config) { parent::initialize($config); $this->table('mn_servers'); $this->belongstomany('groups', [ 'jointable' => 'mn_groups_servers', 'foreignkey' => 'server_id', 'targetforeignkey' => 'group_id', ]); } then in groupscontro