Posts

Showing posts from June, 2012

html - How do i combine these media query in to one? -

ok dumb question , i'm blacking out or how take media , make know screen size automatically? @media (max-width: 600px) { .wm-booking-enduser-logo-bg { max-width:600px; } } @media (max-width: 500px) { .wm-booking-enduser-logo-bg { max-width:500px; } } @media (max-width: 400px) { .wm-booking-enduser-logo-bg { max-width:400px; } } @media (max-width: 300px) { .wm-booking-enduser-logo-bg { max-width:300px; } } @media (max-width: 200px) { .wm-booking-enduser-logo-bg { max-width:200px; } } from looks like, want have .wm-booking-enduser-logo-bg expand full width of viewport, automatically. if element not child of parent element restricting size, use following (without media queries): .wm-booking-enduser-logo-bg { max-width: 100% } add comment if doesn't work you. edit: note max-width different width . latter sets width explicitly ( ie .wm-booking-enduser-logo-bg full width). former means "don't stretch elemen

windows - How to figure out missing dll's -

i have matlab mex file not work, giving me "the specified module not found." error. now, understand issue tries link\call\whatever dll's missing. i'd figure out ones can provide them. here explained how use dependency walker generate text file supposedly has information. generated file it's huge 1 , @ loss information missing files is. i looking advice on how locate missing files reports in dependency walker output. one way might run process monitor , filter (ctrl+l) processes matlab.exe, , inspect lines 'file name not found' after calling mex. i can suggest way - more complicated , involves attaching debugger matlab . don't go there unless process monitor fails address this.

What does "PersonBean myBean =(PersonBean)request.getAttribute("myBean");" mean in Java? -

i learning java , came accross code example. personbean mybean =(personbean)request.getattribute("mybean"); if(mybean=null) { mybean = new personbean(); request.setattribute("mybean",mybean); } here personbean mybean =(personbean)request.getattribute("mybean"); doing? mean in if statement there statement constructs object of class . purpose of first line here? can break down me ? this code gets "mybean" attribute request object (which contains incoming objects) , casts personbean. if not successful creates new personbean object name "mybean" , sets "mybean" object in request.

c# - EF Don't save using IQueryable in BindingSource -

i've created code first context dbset property i work windows form. if bind follow: _context.schedules.load(); schedulebindingsource.datasource = _context.schedules.local.tobindinglist(); all works great , when save follow: this.validate(); schedulebindingsource.endedit(); _context.savechanges(); the data persists; when bind data this: var res = _context.schedules.where(k => k.employeename.equals(employeecombobox.text)).tolist(); schedulebindingsource.datasource = res; when save data doesn't persis! i'm thinking tolist() method not good, can't find alternative bindinglist connected local set of data inside context. thanks, andrea you can try this: _context.schedules.where(k => k.employeename.equals(employeecombobox.text)).load(); schedulebindingsource.datasource = _context.schedules.local.tobindinglist(); that should bring schedules meet condition. when call load method after where method, going bring memory records meet cond

AngularJs $resource return my Java Enum as an array from a REST service -

i'm pretty new angularjs, , have trouble retreiving correctly java enum rest service. code put @ end of question, here result got : {"0":"c","1":"u","2":"s","3":"t","4":"o","5":"m","6":"e","7":"r"} it's array, excpecting simple string. maybe miss how transform string ? can't find correct way ... here controller : angular.module('myapp') .controller('labcontroller', function ($scope, labservice) { $scope.clientouabonneresultat = ''; $scope.clientouabonne = function () { labservice.get({noclient: 10002782, nocontrat: 1003}, function(result) { $scope.clientouabonneresultat = result; }); }; }); my service : angular.module('myapp') .factory('labservice', function ($resource) { return $resource('api/lab/clientouabonne'

python - Installing dependencies of debian/control file -

i in process of porting ruby file used in our build system python. file looks depends lines in debian/control file in our repository, checks every dependency, , apt-get install s isn't installed. trying reproduce functionality. as part of porting python, looked @ deb_pkg_tools module. pip install ed , created simple script, install-dep2.py . #!/usr/bin/python import deb_pkg_tools controldict = deb_pkg_tools.control.load_control_file('debian/control') however, when run script, following error: $ build/bin/install-dep2.py traceback (most recent call last): file "build/bin/install-dep2.py", line 4, in <module> controldict = deb_pkg_tools.control.load_control_file('debian/control') attributeerror: 'module' object has no attribute 'control' the debian/control file exists: $ ls -l debian/control -rw-rw-r-- 1 stephen stephen 2532 jul 13 14:28 debian/control how can process debian/control file? don't need

c# - asp .net mvc 5 cannot find context class after generating models using Database first -

i learning how work asp .net because need following database first approach http://www.asp.net/mvc/overview/getting-started/database-first-development/generating-views & after generated models ado .net way it's shown cannot find context class, there not single 1 added 1 manually, see if might work, still nothing & wondering why using vs 13 free community & ef 6 thank in advance edit : fixed after re-making steps & appears thank brought me idea ps : think issue due me having older version of ssdt & had update after bringing in db due failure when building project at link, on page 'creating web application , data models'. he says this: 'the contosomodel.context.cs file contains class derives dbcontext class, , provides property each model class corresponds database table. course.cs, enrollment.cs, , student.cs files contain model classes represent databases tables. use both context class , model classes when working scaffolding

ubuntu 14.04 - Unknown attribute "Max-Daily-Session" Freeradius -

im working radius application , i'm having issues max-daily-session. ive been getting error " unknown attribute "max-daily-session" requires hex string, not "3600" been looking many articles related issue cant figure out im missing. this article states have declare attributes, problem dont know put or declare it. ive been looking freeradius dictionary, cant still solve it. looking forward positive inputs. thanks this article have helped me solved issue. added attribute max-daily-session 3003 integer in /etc/freeradius/dictionary.

xml - Java SAX Parsing -

there's xml stream need parse. since need once , build java objects, sax looks natural choice. i'm extending defaulthandler , implementing startelement, endelement , characters methods, having members in class save current read value (taken in characters method). i have no problem doing need, code got quite complex , i'm sure there's no reason , can things differently. structure of xml this: <players> <player> <id></id> <name></name> <teams total="2"> <team> <id></id> <name></name> <start-date> <year>2009</year> <month>9</month> </start-date> <is-current>true</is-current> </team> <team> <id></id> <name></name> <start-date> <year>2007</year> <mon

excel vba - save selected files in particular path -

i want open file dialog box allow me select multiple files. selected files should saved in particular path instead of opening. able open dailog box select files not sure how save in particular folder. please assist. dim intchoice integer dim strpath string dim integer application.filedialog(msofiledialogopen).allowmultiselect = true intchoice = application.filedialog(msofiledialogopen).show if intchoice <> 0 = 1 application.filedialog(msofiledialogopen _ ).selecteditems.count strpath = application.filedialog(msofiledialogopen _ ).selecteditems(i) cells(i + 1, 1) = strpath next end if something this. loop through files selected. add tools pulldown select references, pick "microsoft scripting runtime". dim fso new filesystemobject fso.copyfile selectedfile, targetfile

email - Laravel 5: passing variable into subject -

i using laravel's mail class , pass variable subject. here code: public function send() { $offer = offer::find($id)->toarray(); mail::send('offermail', $offer, function($message) { $message->to('some@email.com'); $message->subject('offer no.' . $offer['code']); }); } i getting undefined variable: offer within line subject defined. don't forget inject outer variables closure's scope. mail::send('offermail', $offer, function($message) use ($offer) { $message->to('some@email.com'); $message->subject('offer no.' . $offer['code']); }); you can see examples under example 3 section in here .

java - How to disable tomcat server console log? -

my log4j.proerties log4j.rootlogger=debug,r log4j.appender.r = org.apache.log4j.rollingfileappender log4j.appender.r.file = logs/backup.log log4j.appender.r.append = true log4j.appender.r.datepattern = '.'yyy-mm-dd log4j.appender.r.layout = org.apache.log4j.patternlayout log4j.appender.r.layout.conversionpattern = %d{yyyy-mm-dd hh:mm:ss} %c{1} [%p] %m%n log4j.additivity.info.release.scheduler=false my action class is private static final logger logger = logger.getlogger(logaction.class); if(getuname().equals("admin")&&getpwd().equals("123")) { logger.info("success"); return "su"; } else { addactionmessage("user name , password incorrectly!"); logger.info("failure"); return "fa"; } my backup.log file contain following logs. these logs coming tomcat server a2013-05-24 15:06:44 xmlconfigurationprovider [debug] loading action configurations from: struts-default.xml 2013-05-24 1

arrays - How to Parse parent-child related JsonArray in JAVA? -

this json text. can "name,surname , books" array. problem books array.and content of books coming in form ; {"title:heresometext",paragraphs{value1:heresometext,value2:heresometext}} array in array. parant-child relation. thing want reach thoose value1,value2,value3 strings seperated. {"data" [ "name" : "here text", "surname" : "here text", "books" : [ { "title1" : "here text.", "paragraphs" : [ { "value1" : "here text." }, { "value2" : "here text." } ] }, { "title2" : "here text.", "paragraphs" : [ { "value3" : "here text.", "image1" : "here text." }, { "value4" : "here text." }, { "value5&q

javascript - Get jQuery two-handle slider value -

i have following html , js structure using jquery two-handle range slider: .html <p> <input class="amount" readonly style="border:0; color:black; background: transparent; text-align: center;" type="text"> </p> <div class="slider-range"></div> .js $(function() { $(".slider-range").slider({ range: true, min: 0, max: 1000, values: [0, 1000], slide: function(event, ui) { $(".amount").val("$" + ui.values[0] + " - $" + ui.values[1]); } }); $(".amount").val("$" + $(".slider-range").slider("values", 0) + " - $" + $(".slider-range").slider("values", 1)); }); i think need add value="..." <input> element, how capture value range 2 sliders according javascript code? ! the values can extracted as: var minimum_val = $(".slider-range&q

sql - How can I know why the particular columns are created and according to what the columns are update in System Base Tables? -

i have 1 doubt related sql server system base tables. how can know why particular columns created , according columns update in system base tables? for example in sys.sysschobjs system base table maintaining details objects created in database.this table contains nsclass,pclass,status,intprop these columns. how know on basis these columns has values in ? nsclass contains 0, why 0 updated in column particular object , status column contains 1 stored procedure why these value ? can know ?

SQL Server : update rows based other rows in the same table -

i using sql server in project, , have update column values of rows based on other rows in same table. here table: | name | code | locale -------------------- | | ab | en | | cd | ar | | ef | ru | b | gh | ar i need update code values of rows locale not "en" based code value of row locale "en" , has same value in name. guaranteed each row "en" in locale has unique value in name. here hope achieve | name | code | locale -------------------- | | ab | en | | ab | ar | | ab | ru | b | gh | ar i found thread @ update row data row in same table , , tried following methods none of them worked. update mytable dt1, mytable dt2 set dt1.code = dt2.code dt1.name = dt2.name , dt1.code <> 'en' , dt2.code = 'en' update mytable t1 inner join mytable t2 on t1.name = t2.name , t2.code = 'en' set t1.code = t2.code; t1.code <> 'en' in sql server, can join in u

asp.net web api - Prefix OAuth properties ? i.e. as:client_id -

i seeing lot of people using "as" prefix return items on oauth example as:client_id can tell me significance has? i don't see in oauth specs thanks in examples found( adding refresh tokens web api v2 authorization server , oauth resource password flow refresh token web api ) that's example "key" store client_id in dictionary local client later usage. by no means used in interaction authorization server or part of oauth 2.0 protocol itself.

SSH connectivity using Swift -

recently, i've been trying make (very) simple program swift lets connect server through ssh , execute files. unfortunately, not figure out how start ssh session within swift app. here code have written: var sshconnectcommand = ["-c", "spawn ssh "+sshusername+"@"+sshhost+"; expect assword:; send "+sshpassword+"\r"] func sshin() { //starting ssh session let sshconnect = nstask() sshconnect.arguments = [testcmd] //rerouting output through pipe sshconnect.standardoutput = logappend //launch! sshconnect.launch(); } as can see, have used nstask try , run 'expect' command enter password , everything. try , avoid using ssh-keygen as possible intended used server user not have access to. so, sum up: how connect ssh without ssh-keygen while remaining within application code? edit: should add, when trying compile, error: [swift._swiftdeferrednsarray filesystemrepresentation]: unrecognized selec

objective c - iOS - Deleting Rows From UITableView -

before getting problem, must state i've checked other questions regarding problem. i'm having problems deleting rows uitableview. my app enables user select contacts , shows names , numbers in uitableview , saves these info in 2 mutable arrays called people , numbers . this method use deleting cells. -(void)tableview:(uitableview *)tableview commiteditingstyle:(uitableviewcelleditingstyle)editingstyle forrowatindexpath:(nsindexpath *)indexpath { //[tableview beginupdates]; if (editingstyle == uitableviewcelleditingstyledelete) { //[numbers removeobjectatindex:indexpath.row]; //[people removeobjectatindex:indexpath.row]; [self.tabledata removeobjectatindex:indexpath.row]; [tableview deleterowsatindexpaths:[nsarray arraywithobjects:indexpath, nil] withrowanimation:uitableviewrowanimationright]; } //[tableview endupdates]; [tableview reloaddata];} this data setting #import <uikit/uikit.h> @import addressbook; @import addressbookui; @interface

javascript - Angular form POST goes to wrong action URL -

a rails newbie, have problems submitting form using angular js. while have specified /contact in url field $http post request goes root . in rails routes.rb have rails.application.routes.draw 'home/index' post 'home/contact' => "home#contact" root 'home#index' end the controller pretty basic class homecontroller < applicationcontroller def index end def contact @captcha = params[:g-recpatcha-response] @contact = contactrequest.new(params[...]) .... end end update angularjs included through angular-rails gem, , filed included using require attribute in application.js //= require jquery //= require jquery_ujs //= require turbolinks //= require bootstrap-sprockets //= require jquery.easing.1.3.min //= require jquery.sticky //= require jquery.stellar.min //= require wow.min //= require custom //= require contact_me.js //= require jqbootstrapvalidation.js //= require angular //= require_tree ./angula

Adding a form array to MySQL using PHP -

i cannot array put mysql database in format 'arrayitem1,arrayitem2,etc...' here's forms are: <form action="http://www.nccskills.co.uk/bookings/process.php" method="post" name="bookingform"> <div id="row12"> <div class="col1"> <input type="checkbox" name="voccheck[]" value="hasa"> &nbsp;&nbsp;health , safety awareness </div> <div class="col2"> <input type="checkbox" name="voccheck[]" value="ead"> &nbsp;&nbsp;equality , diversity </div> </div> <div id="row13"> <div class="col1"> <input type="checkbox" name="voccheck[]" value="ecc"> &nbsp;&nbsp;effective customer care </div> <div class="col2"> <input type=&qu

sql - Case statement for 'where [value] is not null' -

i've seen plenty of questions testing null value within case statement, nothing of nature of question. want return of case statement 'is not null' expression clause. this have: insert table1 (id) ( select distinct aid id table2 t2 inner join table3 on ( ... ) case when test_value <> '' (another_value not null) end ) this gives error: incorrect syntax near keyword 'is'. in short, if test value not empty-string, not want rows another_value=null in table1. my program needs pass 2 cases case 1: row# test_value another_value .... 1 'tst' '919' 2 'tst' null row 1 should inserted case 2: row# test_value another_value .... 1 '' '919' 2 '' null both rows should inserted try this: where ((isnull(test_value,'') <> '' ,

go - What's wrong with this golang code? -

while sayhello() executes expected, goroutine prints nothing. package main import "fmt" func sayhello() { := 0; < 10 ; i++ { fmt.print(i, " ") } } func main() { sayhello() go sayhello() } when main() function ends, program ends well. not wait other goroutines finish. quoting go language specification: program execution : program execution begins initializing main package , invoking function main . when function invocation returns, program exits. not wait other (non- main ) goroutines complete. see this answer more details. you have tell main() function wait sayhello() function started goroutine complete. can synchronize them channels example: func sayhello(done chan int) { := 0; < 10; i++ { fmt.print(i, " ") } if done != nil { done <- 0 // signal we're done } } func main() { sayhello(nil) // passing nil: don't want notification here done :

Why cant I filter my javascript/jquery object -

i have javascript object array looks this: [ {"fname":"tim", "lname":"thompson", "user_id": "2", "route_id": "3", "route_day": "wed"}, {"fname":"john", "lname":"wilson", "user_id": "3", "route_id": "3", "route_day": "wed"}, {"fname":"george", "lname":"lane", "user_id": "5", "route_id": "2", "route_day": "mon"} ] i tried filter out results using filter function function filtercustomerdata(route,day) { var jsoncustdata = json.parse(localstorage.getitem("db")); console.dir(jsoncustdata); // object array 300+ objects console.log( "route is: " + route + " day is: " + day);// route is: 3 day is: wed var routes = jsoncustdata.filter(functi

ios - Objective C - show a html page without using UIWebview within application -

how can show html page without using uiwebview within application? means should open within app , not external link safari browser. display html nsattributedstring using webviews in apps can frustrating @ times; if you’re displaying small amount of html content, webviews can consume lot of memory. ios 7 makes lot easier, can create nsattributedstring html few lines of code, such: nsstring *html = @"<bold>wow!</bold> <em>ios</em> can create <h3>nsattributedstring</h3> htmls!"; nsdictionary *options = @{nsdocumenttypedocumentattribute: nshtmltextdocumenttype}; nsattributedstring *attrstring = [[nsattributedstring alloc] initwithdata:[html datausingencoding:nsutf8stringencoding] options:options documentattributes:nil error:nil];

python - Sphinx - how to disable function name on report -

i have little problem function name when generating documentation. when use .. autofunction:: annotation i end function description , function name. when generating documentation not want show function (or module, or class) names use description. looking through sphinx python scripts didn't found anything. thank help. for not showing function name (for example when using view) change method add_directive_header in autodoc.py. added, now, return in first line of method.

how to deploy java web application to tomcat server using jenkins? -

i new jenkins , tomcat server. want deploy java based web application on tomcat server. please help. thanks in advance you can use jenkins deploy plugin: https://wiki.jenkins-ci.org/display/jenkins/deploy+plugin just configure servers information , should straight forward running.

What does return alone does in C++? -

i've been reading example finding gcd, greatest common divisor, uses return in following code. what's that? legal use return that? i've searched , nothing seems make me clear. please.. here's code: void fraction::lowterms () { long tnum, tden, temp, gcd;// num = numerator , den = denumator tnum = labs (num); tden = labs (den); if ( tden == 0) { exit (-1); } else if ( tnum == 0) { num = 0; den = 1; return; //why return alone used here??? } } in case, nothing except terminate function (which have happened anyway) the return type of function void meaning not return value. however, in general, return statement stops function, returns value specified, no further code in function executes. in case @ end of function, adds nothing.

android - Getting error for password field alone in RTL for arabic language -

for password edittext box alone not working rtl properly. have tried solution in stackoverflow. working app muti language support both english , arabic. please me :( i faced similar issue while developing app in arabic , english , manage programmatically checking system lang like: //check sys lang public boolean isarabic() { if (locale.getdefault().getlanguage().equals("ar")) { return true; } else {return false;} } then set gravity edittext accordingly if(isarabic()) { //arabic (rtl) edtpassword.setgravity(gravity.end); } else { //english (ltr) edtpassword.setgravity(gravity.left); }

javascript - Call to node js application inside java project -

i've create new java project following code open command line project path.in java project i've added 2 files(under root) app.js , package json,now want invoke node app.js i use following code open command line working ok process newproc = runtime.getruntime().exec("cmd /c start cmd.exe"); outputstream out = newproc.getoutputstream(); if put in command line manually (which opened above program): node app.js the node js starting ok . want of java code like runtime.getruntime().exec("cmd /c start cmd.exe node app.js"); and either runtime.getruntime().exec("node app.js"); when try not working... my java project followoing myproj src web app.js package.json update this app.js file var express = require('express'); var app = express(); app.get('/', function (req, res) { res.send("test app running"); }); var server = app.listen(3005, function () { console.log("liste

php - Making a .Json file dynamically when user enters new data (Server side Parse.com) -

Image
i tried alot n explored alot didnt got m asking here . i m making app in users can create new events. in app of users can create event . m using parse.com backend coding . saved data entered user such event name discription in parse object . now m using facebook new feed in homepage takes data .json file have uploaded in server . what want want update data in .json file in server dynamically user fill form create event . wanted ask if can upload .json file in parse.com ?? this .json file - http://collegebox.esy.es/android_login_api/include/untitled%20folder/abcd.json any type of appreciated . please help. thanks. i know have use php , better setup own server . this que has been answered here creating json dynamically each input value using jquery hope helps you thanks

javascript - How to reference a Node.js module's context object from inside that module? -

is possible reference module's context object inside module itself? not global object or exports object, private context object of module... for example inside node.js module i'm looking way this: var = 1; var b = 2; // context reference i'm looking console.log(context); // -> {a: 1, b: 2} the context of module (vars, module , exports) available in module. if in module , require script: var _pv = 1; var _foo = function() { console.log('foo'); } exports.foo = _foo; console.log('pv: ' + _pv); _foo(); console.log(module); console.log(module.exports); it outputs: pv: 1 foo { id: '/users/bryanmac/testing/test2/mod.js', exports: { foo: [function] }, parent: { id: '.', exports: {}, parent: null, filename: '/users/bryanmac/testing/test2/test.js', loaded: false, children: [ [circular] ], paths: [ '/users/bryanmac/testing/test2/node_modules', '

project path use as domain in nginx -tomcat -

spring java project run in server. added new domain, works, when click link goes http://127.0.0.1:8081/ instead of example.com server { listen 80; server_name www.example.com example.com; root /opt/appserv/travel_server/webapps/example; location ~* \.(js|jpg|png|css)$ { root /opt/appserv/travel_server/webapps/example/; expires 30d; } location / { proxy_set_header x-forwarded-host $host; proxy_set_header x-forwarded-server $host; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_pass http://127.0.0.1:8081/example; } } server { listen 80; server_name www.example.com example.com #server_name_in_redirect off; root /opt/appserv/travel_server/webapps/example; location ~* \.(js|jpg|png|css)$ { root /opt/appserv/travel_server/webapps/example/; expires 30d; } location ~* ^/(.*) { proxy_set_header x-forwa

mysql - Why is there a duplicate entry when this field doesn't exist? -

Image
this table prestashop why error though 'product_default' doesn't exist? duplicate entry '2971-0' key 'product_default' insert psproduct_attribute ( id_product , location , ean13 , upc , quantity , reference , supplier_reference , wholesale_price , price , ecotax , weight , unit_price_impact , minimal_quantity , default_on , available_date ) values ('2971', '', '', '', '0', '', '', '0', '0', '0', '0', '0', '1', '0', '0000-00-00') here table structure: it turns out id_product had unique key assigned it. had remove , inserts correctly.

c# - Comparing LINQ entities and getting difference -

i'm writing synchronization system database flash drive. so, there xml file on flash content got guid of entity. i'm using standart xmlserialize , dataloadoptions serialization base , related entities. so, need implement comparator difference between database data , deserialized data flash drive. i tried use linq except<> method, says same entities different. is there anothere way compare entities , object, contains different data? you can create own method that. let's have : interface ientity { int id { get; set; } } and concrete class implements it: class entity : ientity { public int id { get; set; } } you can create method : static icollection<t> compare<t>(icollection<t> list1, icollection<t> list2) t : ientity { list<t> result = new list<t>(); foreach (t item in list1) if(!list2.any(e => e.id == item.id)) result.add(item); foreach (t item in list2) i

java - Ant task failed on GWT compilation -

i using gwt 2.5.0, on gwt compilation, build failed occurs java returned: 137. my environment jenkins build tool. here build code : <target name="clientcompile" depends="servercompile" description="gwt compile javascript (production mode)" > <java classname="com.google.gwt.dev.compiler" failonerror="true" fork="true" > <classpath> <pathelement location="src" /> <path refid="project.class.path" /> <pathelement location="${gwt.sdk}\validation-api-1.0.0.ga.jar" /> <pathelement location="${gwt.sdk}\validation-api-1.0.0.ga-sources.jar" /> </classpath> <jvmarg value="-xmx512m" /> <arg line="-war" /> <

java - CKEditor Image Upload Not working using javascript -

i working in java , javascript, using ckeditor4.2 facing 1 issue while uploading image. i have gone through following on stackoverflow @don jones start registering custom browser/uploader when instantiate ckeditor. can designate different urls image browser vs. general file browser. <script type="text/javascript"> ckeditor.replace('content', { filebrowserbrowseurl : '/browser/browse/type/all', filebrowseruploadurl : '/browser/upload/type/all', filebrowserimagebrowseurl : '/browser/browse/type/image', filebrowserimageuploadurl : '/browser/upload/type/image', filebrowserwindowwidth : 800, filebrowserwindowheight : 500 }); </script> your custom code receive parameter called ckeditorfuncnum. save - that's callback function. let's put $callback. when selects file, run javascript inform ckeditor file selected: window.opener.ckeditor.tools.callfunction(<?php echo $c

objective c - How to add UIbutton on UIview programmatically in ios using autolayouts -

Image
i want add uibutton on uiview programmatically using autolayouts , tried code it's not working please me one //adding uiview using autolayouts uiview * myview; myview = [uiview new]; myview.translatesautoresizingmaskintoconstraints = no; myview.backgroundcolor = [uicolor colorwithred:0.95 green:0.47 blue:0.48 alpha:1.0]; [self.view addsubview:myview]; nslayoutconstraint * constraint = [nslayoutconstraint constraintwithitem:myview attribute:nslayoutattributeleading relatedby:nslayoutrelationequal toitem:self.view attribute:nslayoutattributeleading multiplier:1.0f constant:30.0f]; [self.view addconstraint:constraint]; constraint = [nslayoutconstraint constraintwithitem:myview attribute:nslayoutattributetop relatedby:nslayoutrelationequal toitem:self.view attribute:nslayoutattributetop multiplier:1.0f constant:100.0f]; [self.view addconstraint:constraint]; constraint = [nslayoutconstraint constraintwithitem:myview attribute:nslayoutattributewid

jquery - How to make dynamic form fields in laravel fillable -

i working laravel 5 . the problem have add fields form dynamically using jquery , submit form. laravel has requirement form variables need made fillable in model. issue how can make dynamic fields fillable ? can me ? thanks use $guarded instead of $fillable . it's opposite of $fillable : instead of saying 'you can fill in these fields', guarded says 'you can fill in field but these'. this answer gives example.

python - Calculating the difference between two fields within a table in Django -

i have model stores opening , closing balances of petrol station. have additional third column difference between opening , reading values. class dailysales(models.model): pump_names = ( ... ) pump_name = models.charfield(max_length = 5, choices = pump_names) opening_reading = models.integerfield() closing_reading = models.integerfield() gross_sales = models.integerfield(null = true) date = models.datefield(auto_now_add= true) def calc_gross(self): self.gross_sales = self.opening_reading - self.closing_reading super(dailysales,self).save() the calc_gross method works when i'm saving 1 instance @ time. want add multiple opening , closing values model @ once i'm using formsets. salesform = modelformset_factory(dailysales, = 7, exclude=('date','gross_sales')) this logic falters. django isnt able calculate gross values each row. exception value: 'list' object has no attribute 'calc_g

c++11 - Is this a Visual Studio 2013 update 4 C++ optimizer bug or is my code wrong? -

i have been seeing crashes in our software since updated boost 1.58 , vs2013. when compiler optimization on see crashes. boost 1.55 there no crashes. i've managed isolate problem i'm seeing boost::any_range , how use it. see example code below: #include <boost/range/any_range.hpp> #include <boost/range/adaptor/transformed.hpp> #include <vector> #include <memory> #include <cstdio> class dummyelement { public: float f_; }; using elementrange = boost::any_range < dummyelement*, boost::bidirectional_traversal_tag >; using dummyelementuptr = std::unique_ptr < dummyelement > ; class boostanytest { public: boostanytest() { (int = 0; < 10; ++i) { auto element = dummyelementuptr(new dummyelement()); _tprintf(_t("boostanytest::ctor() 0x%p\n"), element.get()); c_.emplace_back(std::tuple<int, dummyelementuptr>(i, std::move(element))); } }

Overlapping in label control text - vb.net -

Image
i'm trying show typical information of program state during runtime in label control. so, label continuously changing. set label text in function control progress bar also: public sub incrementarprogressbar(byval addvalue integer, byval code string) me.progressbar1.value = me.progressbar1.value + addvalue lblprogressbar.text = code lblprogressbar.refresh() threading.thread.sleep(500) end sub the problem code larger others, new label text overlapping old one. , if older label text larger newer, text fraction not covered newer still visible, , don't want it. example how looks when occurs: the current label text reading secondary species... , previous text reading thermodynamic parameters... . i tried lblprogressbar.text = " " before assigning code string text label, inelegant , didn't work either. set form's doublebuffered property true. should solve such problems.

gradle - Theme.AppCompat.Light.NoActionBar not found on Android Studio -

sorry maybe not new topic, need help, try many post this, problem still not fix, newbie android. try learn material design, use android lollipop, api level 22. i try use compile 'com.android.support:support-v4:22.0.0' . after sync gradle, still not able use theme.appcompat.light.noactionbar theme on style.xml file. gradle file: apply plugin: 'com.android.application' android { compilesdkversion 22 buildtoolsversion '22.0.1' defaultconfig { applicationid "afnan.project.com.materialdesign" minsdkversion 21 targetsdkversion 22 versioncode 1 versionname "1.0" } buildtypes { release { minifyenabled false proguardfiles getdefaultproguardfile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile filetree(dir: 'libs', include: ['*.jar']) com.android.support:support-v4:22.0.0'

Excel protect and unprotect workbook VBA -

i have workbook contains several (lookup) tabs don't want users able unhide. however, there 1 tab contains admin info admin users able see. have button , macro prompts admin password before unhiding tab, if protect workbook structure (so hidden tabs not accessible other users) vba fails. there no way protect/unprotect workbook within admin macro? have tried various combinations of activeworkbook.unprotect , activeworkbook.protect , activeworkbook.protectstructure no avail - both within admin macro , workbookopen. error msg commonly encounter "can't assign read-only property" after having activeworkbook.unprotect @ top of code. know how work around this? don't want have leave tabs open being unhidden second password on admin worksheet - clumsy! instead of protecting whole workbook, set visible property of sheets want hide xlsheetveryhidden - can manually in properties window of vba editor. sheets won't show in unhide… dialog. macro swap v

java - Servlet doGet Method getting called multiple times for the same HTTP request -

i have run weird problem. servlet's doget method getting called multiple times single http request. rerun happens every 10-12 seconds till initial process completes. below servlet code private static final long serialversionuid = webserviceservlet.class.getcanonicalname().hashcode(); private servletcontext servletcontext; /** * @see httpservlet#httpservlet() */ public void init(servletconfig servletconfig) throws servletexception { super.init(servletconfig); servletcontext = servletconfig.getservletcontext(); } /*public webserviceservlet() { super(); }*/ /** * @see httpservlet#doget(httpservletrequest request, httpservletresponse * response) */ protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { dopost(request, response); } /** * @see httpservlet#dopost(httpservletrequest request, httpservletresponse * response) */ protected void dopost(httpservletrequest request,

windows - Passing parameters in logon script in GPO failed -

Image
as see in gpo settings i have vbscript , call logon script via gpo in domain controller. script running @ logon parameters not passed. ideas why not? on technet in script parameters, type parameters want use type them on command line. example, if script included parameters called //logo (display banner) , //i (interactive mode), type: //logo //i. so should possible way it, right? because ansgarwiechers asked: check if script running set objfsolog=createobject("scripting.filesystemobject") outfilelog="c:\scriptlog.txt" set objfilelog = objfsolog.createtextfile(outfilelog,true) objfilelog.write "script wurde wenigstens ausgeführt" & vbcrlf objfilelog.close at beginning od script. , check parameters this: on error resume next err.clear msgbox wscript.arguments(0) if err.number <> 0 msgbox err.description end if on error resume next err.clear msgbox wscript.arguments(1) if err.number <> 0 msgbox err.description end i

c# - Equivalent of 'WHERE columnname IN' SQL syntax in Entity Framework -

i have scenario public class timesheet { [key] public int timesheetid { get; set; } public string username { get; set; } } public class approval { [key] public int approvalid { get; set; } [index(isunique = true)] [stringlength(450)] public string approver { get; set; } public virtual icollection<approvaldetail> details { get; set; } } public class approvaldetail { [key] public int approvaldetailid { get; set; } [stringlength(450)] public string username { get; set; } } i want following syntax in ef. select * timesheet username in (select [ad].username approval [a] inner join approvaldetail [ad] on [a].approvalid = [ad].approvalid [a].approver = 'warheat1990') how achieve this? update : my repo public ienumerable<timesheet> list() { return _timesheet.asenumera

c++ - Is it possible to erase modified element from std::set? -

i need sorted collection elements can modified. safe erase element after modification? sorting key can modified. auto it=s.find(e) modify(e) s.erase(it) i have made tests in vs2010, , worked. think erase(it) not need search element, there no need call compare on element being erased. it hard modify whole program remove elements before modification, why looking alternative solution. edit: adding working sample make more clear #include <iostream> #include <algorithm> #include <set> template <typename t> struct ptrcmp { bool operator()(const t* x, const t* y) const { return *x<*y; } }; int main() { std::set<int*, ptrcmp<int>> aset; int t[]={1,2,3,4}; for(int i=0;i<4;++i) aset.insert(&t[i]); auto it=aset.find(&t[2]); t[2]=5; aset.erase(it); for(auto it=aset.begin(); it!=aset.end(); ++it) std::cout<<**it<<std::endl; } in example t[2]=5; modifi

r - RandomForest proximity between training and test -

using randomforest , want create low-level projection of instance proximities, produced mdsplot() . however, not want training proximities, proximities between all instances (i.e. training and test). how can this? i use xtest argument randomforest() , when do print("testprox") print(rfmodel$test$prox) print("trainprox") print(rfmodel$prox) i get [1] "testprox" [1] 119 239 [1] "trainprox" [1] 120 120 so distance test all calculcated (119x239), not train all (120x239). instead, train train (120x120). how can full matrix all all (239x239)? to missing piece, copy appropriate submatrix of test all (i.e. test train , 119x120) , use transpose plug in make full matrix. wondering if there easier way?

java - Unable to add view to a service in Android -

please: visit question before marking down question link i want add imageview service , such appears on top of other activities giving error : detail below code: androidmainfest.xml <uses-permission android:name="android.permission.system_alert_window"/> <service android:name=".toggleheadservice"/> code: toggleheadservice.java public class toggleheadservice extends service{ private windowmanager windowmanager; private imageview togglehead; @override public ibinder onbind(intent intent) { return null; } @override public void oncreate() { super.oncreate(); togglehead=new imageview(this); togglehead.setimageresource(r.drawable.ic_brightness_high_black_48dp); windowmanager = (windowmanager) getsystemservice(window_service); windowmanager.layoutparams params = new windowmanager.layoutparams( windowmanager.layoutparams.wrap_content, windowmanager.layoutparams.wrap_content,

html5 - Visual Studio media queries not working as intended -

Image
i have been working on project make site responsive. there 1 big problem. @media tag not working should. @media screen , (max-width: 873px){/* lots of css in here */} and other media-query @media screen , (min-width: 874px){/* lots of css in here */} as can see in img above media queries shown in pixels. far working intended. the query should activate when pixels fall under 873px. as can see in image above pixels under 873 style rules not adjusted. when type in console: $(document).width() ( pixels on 873px)( window instead of document same) we 1141. when pixels put on 656 style rules above 873 still active. when drop 1 pixel 655 style rules under 873 active. when type in console $(document).width() 925. i not sure causes problem because other sites, not build in visual studio, don't have problem( , pixels match $(document).width() ). does know problem , how fix it?