Posts

Showing posts from May, 2014

uitableview - Swift - UITableViewCell? is not convertible to UITableViewCell -

i'm new swift development , following many online tutorials. majority of these tutorials referring older versions on xcode , code resulting in errors. can explain why code below produces 'uitableviewcell?' not convertible uitableviewcella , how go fixing problem. i using xcode 7. override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("customcell") uitableviewcell cell.textlabel?.text = array[indexpath.item] return cell } there 2 methods 1) func dequeuereusablecellwithidentifier(_ identifier: string) -> uitableviewcell? which returns optional have unwrap optional let cell = tableview.dequeuereusablecellwithidentifier("custom cell")! the other method preferable 2) func dequeuereusablecellwithidentifier(_ identifier: string, forindexpath indexpath: nsindexpath) -

PyQt5 QTreeWidget output to multiple columns -

i connect .ui file .py script class mainwindow(qmainwindow): def __init__(self, *args): super(mainwindow, self).__init__(*args) loadui('ui.ui', self) now can access qtreewidget, named treewidget1: self.treewidget1 how can output multiple columns separately filename , extension? i find example, here output fist column: in self.fileslist1: if i.lower().endswith(tuple(ext_pattern)) , os.path.isfile(os.path.join(self.folder1, i)): row = os.path.splitext(i) self.treewidget1.inserttoplevelitems(0, [qtreewidgetitem(self.treewidget1, ["%s" % i])]) to add multiple columns each row, use: self.treewidget1.inserttoplevelitems(0, [qtreewidgetitem(self.treewidget1, ["col1", "col2", "col3"]) replace "col1" etc. appropriate strings derived filename. note: using inserttoplevelitems(0, ...) insert each item sequentially @ top of tree. might want consider using: self.

semantic web - A license catalog with RDF description, exist? -

popular public copyright licenses gpl3 , mit , apache2 , cc-by-sa3 , etc. have official human-readable texts, and, suppose, in nowadays, have translations "machine-readable texts", rel interpretations/translations of official texts... each license set of clauses can described rel, , set interest. there "license database" (or catalog or content semantic markup) each license translated rel or rdf? notes existing translations , samples. found cc licenses translated cc-rel . "rel rdf". rel ( rights expression language ), ex. cc-rel or rightsml, can translated rdf, can suppose popular license tranlated rel, rdf descriptor of license. "rdf json-ld, rdfa, microdata", no problem me, can translated another. "catalogues". exist, wikipedia lists , okfn lists , tldrlegal lists , , others... no 1 have rel or rdf translation/interpretation. in doncel et al ( http://delicias.dia.fi.upm.es/~vrodriguez/pdf/2014.11.juri

mysql - How do I select the concatination of '$' and the value of a table column? -

i trying concatenate dollar sign value of table column in select query. tell me why sql producing error? (i include more info, simple problem) sql code: create table if not exists item_types (id int auto_increment primary key, name varchar(255), avgcost decimal(9, 2)); select id 'item no.' name 'item' !problem!concat('$', item_types.avgcost) 'average cost ($)' item_types;` you forgot commas... try : select id 'item no.', name 'item', concat('$', item_types.avgcost) 'average cost ($)' item_types;

node.js - nvm tar: Unrecognized archive format -

greetings everybody! i had problem while installing node via nvm when type: $ nvm install 5.5.0 had this: downloading https://nodejs.org/dist/v5.5.0/node-v5.5.0-darwin-x86.tar.xz... ######################################################################## 100.0% warning: checksums disabled node.js v4.0 , later tar: unrecognized archive format tar: error exit delayed previous errors. binary download failed, trying source. ######################################################################## 100.0% checksums empty tar: unrecognized archive format tar: error exit delayed previous errors. binary download failed, trying source. installing node v1.0 , greater source not supported so main problem there: tar: unrecognized archive format because(maybe) file format is: tar.xz after hours spending in google , git solve problem didn't found solution. started read nvm documentation , found force install option -s it helpful not versions installed nvm install -s 0

java - How to intercept and change values -

i'm developing in eclipse (java 6) , working websphere server. how can automate dynamic modification of small parts of code (mock-like) local development only? don't want share own adjustments other developers... create bad expectations including them thinking should working in way not correct or outside communications not happening should. i'm not using java framework, has been decided project. i have looked @ asm , bcel can't find source on how them working in automated way kind of thing... if capable of it. the changes need can achieved intercepting values of parameters of specific methods (some static , other not static) when called. anything can automated result without changing of code shared between other developers can do. doesn't need automatically adapt new code. i have been called attention of own adjustments being sent repository , want avoid @ best capability. it’s quite unclear trying achieve sounds want local modifications code?

c# - Why am I getting "The specified string is not in the form required for an e-mail address" here? -

the relevant code is [httppost] public actionresult getlinkbyname ( string pname ) { partneridandemail pinfo = this._db.getpartnerbyname(pname); if ( pinfo != null ) { try { var m = new system.net.mail.mailmessage() { subject = "your survey link", body = string.format("<p>your survey link <a href=\"{0}\">{0}</a></p>", string.format("{0}answers/fillout?pid={1}",this.getbaseurl(),pinfo.id)), isbodyhtml = true }; m.from = new mailaddress("admin@mycompany.com", "administrator"); // placeholder of address i'm sending email m.to.add(pinfo.email); smtpclient smtp = new smtpclient { host = "something@someth

typescript - Visual Studio stopped publishing js files compiled from ts after 1.8 update -

i have vs 2015 ts project. has been publishing fine, meaning typescript files included in project, not *.js files, js files have been getting published expected. however, after updating 1.8 beta, *.js files no longer being published. makes no sense, , not sure update issue, have no other explanation. no other changes made project. updated yesterday, , did several successful publishes before *.js stopped getting published. other js files published, not ones compiled ts. if include compiled js in project (and source control) publish correctly. i want make sure didn't screw here. if include compiled js in project (and source control) publish correctly. you not one. i want make sure didn't screw here. you didn't. new defacto way now.

android - Imagem Button back to last activity -

my project have 5 activities (1 menu, 3 sub menus , 1 help) all activities have button (except activity). inside activity have imagem button back. what should when button clicked previous activive? i'm using method return previous activity: override      public boolean onkeydown (int keycode, keyevent event) {          if (keycode == keyevent.keycode_back) {              finish ();          }          return true;      } but beyond want implement button. just this: button buttonx = (button)findviewbyid(r.id.buttonxname); // id of button. // register onclick listener implementation above buttonx.setonclicklistener(new onclicklistener() { public void onclick(view v) { finish() } });

excel - How to select the cell when case is true -

first off, starting trying learn excel , vba yesterday....so bear in mind. private sub commandbutton2_click() = 1 mylastrow select case activeworkbook.sheets("sheet2").cells(a, 2).value case = myordernumber activeworkbook.sheets("sheet2").cells(a, 2).active case false: msgbox "false" end select next end sub i want know cell or row of cell matches variable. not want....... thanks guys try this private sub commandbutton2_click() dim mylastrow long, long, myordernumber long mylastrow = 10 = 1 mylastrow activeworkbook.sheets("sheet2") if .cells(a, 2).value = myordernumber msgbox "true " & .cells(a, 2).row else msgbox "false" end if end next end sub

debugging - IntelliJ Haskell "Correct path to remote debugger was not set." -

Image
in haskell, can run intellij project cannot debug it, , apparently assertions work in debug mode. error message: correct path remote debugger not set. see settings | haskell debugger source: https://github.com/atsky/haskell-idea-plugin/blob/master/plugin/src/org/jetbrains/haskell/debugger/haskellprogramrunner.kt see pic: please and/or tell me how implement fatal assertion function not depend on compiler debug mode being turned on (i disable/enable assertions pragmatically)

Prolog: get and append every third item from a list to a new list -

with following piece of code in prolog managed extract every third item list: third([_,_,z|l], z). third([_,_,c|l], y) :- third(l, y). however, still need append every item extracting new list, , create list " every third " items. appreciate hint or help! thank you. how doing this? list_thirds([] , []). list_thirds([_] , []). list_thirds([_,_] , []). list_thirds([_,_,e|es], [e|xs]) :- list_thirds(es, xs). sample queries using sicstus prolog 4.3.2: | ?- list_thirds([], xs). xs = [] ? ; no | ?- list_thirds([a,b,c], xs). xs = [c] ? ; no | ?- list_thirds([a,b,c,d,e,f], xs). xs = [c,f] ? ; no | ?- list_thirds([a,b,c,d,e,f,g], xs). xs = [c,f] ? ; no how going "other direction"? | ?- list_thirds(list, [x,y]). list = [_a,_b,x,_c,_d,y] ? ; list = [_a,_b,x,_c,_d,y,_e] ? ; list = [_a,_b,x,_c,_d,y,_e,_f] ? ; no % terminates universally last, @ answer sequence general query:

javascript - Ionic popup template for username and password -

i using ionic make mobile app.i want use popup window collect 2 pieces of data, username , password. looked through lot of website, shows how popup window can collect 1 piece of data, not two. also, make popup window purple color. how can that? $scope.create = function() { $scope.data = {}; // elaborate, custom popup var mypopup = $ionicpopup.show({ template: '<input type="password" ng-model="data.one">', style: 'background-color:purple;', title: 'enter wi-fi password', scope: $scope, buttons: [ { text: 'cancel' }, { text: '<b>save</b>', type: 'button-balanced', ontap: function(e) { if ((!$scope.data.one)&&(!$scope.data.two)) { e.preventdefault(); } else { return $scope.data; } } } ] }); } you can achieve using $ionicmodal here working exam

Convert decimal number to binary in C -

for assignment need convert 16-bit decimal number binary number. example number 9 should print 0000000000001001. professor started code: void printbinary(short n) { } int main(int argc, char **argv) { short n; printf("enter number: "); scanf("%hd", &n); printbinary(n); } i confused go here. appreciate helping me understand do, new coding. in advance. try this: int printbinary(int integer) { int remainder, counter = 0, my_binary = 0; while (integer > 0) { remainder = integer % 2; my_binary += remainder * pow(10, counter); integer /= 2; counter++; } printf ("binary %d\n", my_integer"); } this has been taken here . note: have assumption want convert positive decimals.

html - Read more link with pure JavaScript -

i trying create simple read more example. consists of paragraph , button half of paragraph enclosed in span tag set hidden. when user clicks on read more button hidden span shows up. have got working code want fade in effect jquery pure javascript. please help. var span = document.getelementsbytagname('span')[0]; var hideshow = document.getelementbyid('hideshow'); span.style.display = 'none'; hideshow.onclick = function() { span.style.display = 'block'; }; <p>lorem ipsum dolor sit amet, consectetur adipisicing elit. ipsa maiores dolore earum ducimus molestiae, aut. <span>quisquam consequuntur, maiores et, doloremque atque provident similique consequatur totam voluptas vitae veniam, molestiae laborum.</span></p> <button id="hideshow">read more</button> starting here span.style.opacity = 0; you'll need gradually transition opacity here. span.style.opacity = 1;

javascript - Access a route model from non nested route with Ember js -

i wondering appropriate way access route model different non nested route controller. if have routes set this: (this works however, not sure if proper) app.router.map(function() { this.route('admin'); this.route('page1'); } and page 1 route has model this: app.page1model = {content:'content of simple model'}; app.page1route = ember.route.extend({ model(){ return app.page1model; }); then admin controller wants access page1 route, can this: app.admincontroller = ember.controller.extend({ page1model:app.page1model, stuff page1model..... }); ive tried use ember.inject.controller() works me when routes nested , want access parent controller child. there way use syntax want, or there better way im doing? thanks there's inherent problem you're asking for: when user on admin page, they're not on page1 page, there's no page1 context. questions might want ask: what happens if user goes /admin havin

java - Spring MVC Hibernate Error creating bean with name 'sessionFactory' -

i trying integrate hibernate spring. until dont introduce hibernate code & libraries, works fine. here code, welcome-servlet.xml <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd" xmlns:mvc="http://www.springframework.org/schema/mvc"> <context:annotation-config /&

How to access array data from PHP in JavaScript -

this question has answer here: how pass variables , data php javascript? 17 answers i have code in php. works fine: <?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "tsunami_simulation"; // create connection $conn = mysqli_connect($servername, $username, $password, $dbname); // check connection if (!$conn) { die("connection failed: " . mysqli_connect_error()); } //======================================================== $sql='select a.household_name, b.latitude, b.longitude household a, location b a.household_id = b.household_id;'; $result = mysqli_query($conn, $sql); if(mysqli_num_rows($result) > 0){ for($i=0;$i<$num_rows;$i++){ $row=mysql_fetch_row($result); $location[]= $row[0].', '.$row[2].', '.$row[1

google form - Browser() in Python shows errors in IDLE -

i have code here bot spams specific google form: while true: browser = browser() print("form filling begun") browser.visit('https://docs.google.com/forms/d/1lyoox1fipop5ncevhqmda3exqf8pmcxabgwiyq67yx8/viewform?c=0&w=1') browser.fill('entry.1796849606', 'test') browser.fill('entry.1233774681', 'test') browser.fill('entry.1687034525', 'test') browser.fill('entry.2085519362', 'test') browser.fill('entry.2085519362', 'test') browser.fill('entry.87435301', 'test') browser.find_by_name('entry.434307791', 'test') browser.find_by_name('submit').click() print("form filled") browser.quit() time.sleep(10) when ran in idle, said there problem on line 2. browser() wasn't defined. now, know friend able accomplish this code, i'm not sure what's wrong. i'm sure it's bas

arrays - How do I fix my addition for summing a specific row and column in java? -

i have of other methods required class program working properly, can not think of how fix row input , sum method , column input , sum method. apologize ridiculously long method names, methods pre-named assignment. import java.util.scanner; public class two_d_array_cmps280_2016 {// begin class two_d_array_cmps280_2016 public static void main(string args[]) {// begin main method int[][] brianarray = {// initialize array , hard code values {1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}, {13, 14, 15, 16} };// end array initialization // print segment print values methods brianarray system.out.print("the sum of elements " + total_2darray_elements(brianarray)); system.out.print("\nthe average of elements " + average_2darray_elements(brianarray)); system.out.print("the sum is: " + total_2darray_elements_by_certain_row_number(brianarray)); system.out.print("the sum is: " + total_2darray_elem

asynchronous - How to fire AJAX calls in response to the state changes with Redux? -

i'm converting existing state model redux , has been painless part. 1 point i'm having trouble converting "observed" state ajax requests. essentially, have ajax requests "linked" other pieces of state, no matter modifies them they'll issued correctly. can similar behavior subscribing redux store updates, firing actions in listener feels hack. a possible solution move logic action creator via thunk pattern. problem i'd either have duplicate fetching logic across actions (since multiple actions modify "observed" state), or pull reducer logic action creator level. action creator shouldn't aware of how reducers respond issued actions. i batch "sub-actions" need place appropriate fetching logic in each action "block", seems violate concept of actions producing valid state. i'd rather have liability @ action creator level. are there accepted rules surrounding this? not simple application ad hoc ajax requests

c# - ASP.NET 5 project dependency cannot be resolved -

Image
i have solution 2 projects , want add project reference pointing core project i error message the dependency yugasat.core>=4.0.0-* cannot resolved here dependencies section in project.json file am missing here? you adding project reference incorrect. project references resolved using peer folders current project or project paths specified using global.json file @ solution level check documentation link how reference project dependencies.

xcode7 - iPhone app Testflight build crashes on iPad only since Xcode 7 -

i have iphone app built via xcode 7.2.1 , submitted apple. the app got rejected because crashes on ipad during startup - can reproduce behavior when doing testflight build , install on ipad, runs without problems on iphone or debug builds on simulator/ipad. how can track down? once got crashlytics report like application windows expected have root view controller @ end of application launch but window created self.window = [[uiwindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; and used rootviewcontroller property set on window.

python - I want to convert a string into list -

i giving string d='direct' expected o/p= match found direct getting match not found d match not found i, match not found r etc. using code: dict1={'d': 'direct', 't': '2', 'g': ['d','d']} dict2={'d': 'direct', 'u': ['2', '2'], 't': ['2', '2'], 'g': ['d', 'd']} key in dict1: index, element in enumerate(dict1[key]): if element in dict2[key]: print("match found for", element) else: print("match not found for", element) try code, dict1={'d': 'direct', 't': '2', 'g': ['d','d']} dict2={'d': 'direct', 'u': ['2', '2'], 't': ['2', '2'], 'g': ['d', 'd']} key1 in dict1: key2 in dict2: if key1 in key2:

sql - VB.net MySQL Update all items in the listview -

how update items in listview @ same time in database? have code don't know what's wrong, updates first row in listview. want update items shown in listview each row listviewitem in listview3.items con.open() cmd.connection = con cmd.commandtext = "update pawn set status = 'redeemed' pawn_id = '" & listview3.items(0).text & "'" dr = cmd.executereader con.close() next you sending 0th element of listview in parameter. here error: cmd.commandtext = "update pawn set status = 'redeemed' pawn_id = '" & listview3.items(0).text & "'" there should be: cmd.commandtext = "update pawn set status = 'redeemed' pawn_id = '" & row.text & "'" if send listview3.items(0).text in statement - updates same row.

Swift : Change size of UIButton programmatically -

i have uibutton in storyboard , trying change frame programmatically not working, nothing changing. ive tried this: button.layer.frame = cgrectmake(0, 0, 50, 50) any idea why isn't working , how can work?

git - Unable to build in Gitbash (Windows x32)) -

i followed link https://github.com/processing/processing/wiki/build-instructions , stuck at: open terminal/console/command prompt, change directory cloned processing, , type: cd build ant run when type cd build , shows message bash: cd: build: no such file or directory. if in folder, c:\users\mylogin (replace ' mylogin ' windows account), typing: git clone https://github.com/processing/processing.git that means have cd processing in order in "the directory cloned processing". that c:\users\mylogin\processing (or, in git bash, /c/users/mylogin/processing ) once in folder, can type cd build , ant run .

How can i post combined variable and xml data using jquery ajax for webservice -

i new in ajax, xml , web service. want post http request call webservice variable values , xml data following format: x=sender&b=receiver&xmlinput=<request><data1>100</data1><data2>200</data2></request> here ajax code: //these parameters var = 'sender'; var b = 'receiver'; var xmlinput = '<request><data1>$('#inputdata1').val()</data1><data2>$('#inputdata2').val()</data2>'; $.ajax({ url: 'webservice.php', type: "post", async: true, data: "a&b&xml" , datatype: 'xml', contenttype: "text/xml", success: function(xmldata){ }, error: function(jqxhr, textstatus, errorthrown) { console.log(textstatus, errorthrown); } }); please me that.thanks. there couple of things need into. in javascript use +

javascript - Saving a Uint8Array array storing RGBA to a .png file -

Image
i trying save screenshot of threejs in specific area file. so far have tried image display new tab, have got work with window.open(renderer.domelement.todataurl("image/png")); renderer three.webglrenderer object preservedrawingbuffer: true but uses entire scene, have switched to: var gl = renderer.getcontext(); var pixels = new uint8array(width * height * 4); gl.readpixels(x, y, width, height, gl.rgba, gl.unsigned_byte, pixels); window.open("data:image/png;base64," + btoa(string.fromcharcode.apply(null, pixels))); with doing that, nothing rendered other grey outlined square if want small part it, rather calling gl.readpixels use source width , height arguments drawimage var gl = renderer.getcontext(); var ctx = document.createelement('canvas').getcontext("2d"); ctx.canvas.width = width; ctx.canvas.height = height; ctx.drawimage(gl.canvas, 0, 0, width, height, 0, 0, width, height); window.open(ctx.ca

Where can I find Nunit GUI RUNNER for 3.01 and how to run it? -

how run nunit 3 gui runner? after installing nunit.3.0.1.msi --> don't see gui runner under c:\program files (x86)\nunit.org where can find , how start gui ? the gui runner nunit 3 still under development , version 0.1 expected ready soon. in mean time, can run either nunit console. (or alternatively, within visual studio nunit 3 vs adapter , can install visual studio extension.)

c# - Generate TreeView from XML file -

i want create treeview data source xml file. need customize visible name of element. what have: <?xml version="1.0" encoding="utf-8"?> <list> <sitemapnode title="title1" url="http://example.com/pages/general.aspx" description="description1"> <sitemapnode title="title2" url="http://example.com/pages/base.aspx" description="description2"/> </sitemapnode> <sitemapnode title="title3" url="http://example.com/lists/news.aspx" description="description3"> </sitemapnode> </list> and can generate: list sitemapnode sitemapnode sitemapnode and want get: list title1 title2 title3 upd: generate treeview in .aspx: <asp:xmldatasource id="xmldatasource1" runat="server" datafile="footersitemap.xml"></asp:xmldatasource> <asp:treeview id="treeview1&qu

javascript - Adding a Button dynamically in a Table using HTML and Java script -

Image
hi have table, have add button, beside +, when ever click on it. the code not working. not understand why. function addproject() { var r = $('<input/>').attr({ type: "button", id: "field", value: 'project' }); $("#idproject").parent().append(r); } <html> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <table> <thead> </thead> <tbody> <tr> <td style="text-align:center; width:8%"></td> <td style="text-align:center; width:8%"><input id="idproject" type="button" style="border:1px solid grey;text-align:center;background-color:#e0eeee" value="+" onclick=addproject() /></td> </tr> </tbody> </table> <

javascript - Function to add up all the numbers from 1 to num -

i think there better version solution. solution working fine. didn't juggling of values using loop. but particularly wondering, if there nice , 1 line solution getting values in array entered number function. function simpleadding(num) { var fnum = []; (var = 1; <= num; i++) { fnum.push(i); } return fnum.reduce(function(prevvalue, currentvalue) { return prevvalue + currentvalue; }) } i think there better version solution. use formula function simpleadding(num) { return num * (num+1) /2; } if there nice , 1 line solution getting values in array entered number function function simpleadding(num) { var fnum = new array(num).join().split(',').map(function(item, index){ return ++index;}); return fnum.reduce(function(prevvalue, currentvalue) { return prevvalue + currentvalue; }) }

java - Exception on running IE web Driver -

i'm new in java, using automatic tests. please me i'm doing wrong code? public static webdriver driver = null; public static webdriver getdriver() { if (driver == null) { file fileie = new file("src//test/java/iedriver.exe"); system.setproperty("webdriver.ie.driver", fileie.getabsolutepath()); } try { driver = new internetexplorerdriver(); } catch (exception e) e.printstacktrace(); } try add desiredcapabilities code. if (driver == null) { file fileie = new file("src//test/java/iedriver.exe"); system.setproperty("webdriver.ie.driver", fileie.getabsolutepath()); desiredcapabilities iecapabilities = desiredcapabilities.internetexplorer(); try { driver = new internetexplorerdriver(iecapabilities); } catch (exception e) {

javascript - Clear a sheet in Excel 2013 with office add-ins -

i have office add-in generates report (tables). second time user running want clear sheet. i have been trying around , have read through documentation cant find way this. have found solution solve this? use sheet.getrange().clear() method. example: excel.run(function (ctx) { var sheet = ctx.workbook.worksheets.getactiveworksheet(); sheet.getrange().clear(); return ctx.sync(); }).catch(function(error) { console.log("error: " + error); if (error instanceof officeextension.error) { console.log("debug info: " + json.stringify(error.debuginfo)); } }); ~ michael zlatkovsky, developer on office extensibility team, msft

javascript - Jquery dlmenu animation is not smooth -

i have created multilevel navigation menu using jquery dlmenu plugin v1.0.2 demo2. everything works fine, except css3 menu navigation not smooth jquery left/right slide functionality is. is there solution resolve issue without changing plugin? /* animation classes moving out , in */ .dl-menu.dl-animate-out-2 { -webkit-animation: menuanimout2 0.3s ease-in-out forwards; -moz-animation: menuanimout2 0.3s ease-in-out forwards; animation: menuanimout2 0.3s ease-in-out forwards; } @-webkit-keyframes menuanimout2 { 100% { -webkit-transform: translatex(-100%); opacity: 0; } } @-moz-keyframes menuanimout2 { 100% { -moz-transform: translatex(-100%); opacity: 0; } } @keyframes menuanimout2 { 100% { transform: translatex(-100%); opacity: 0; } } .dl-menu.dl-animate-in-2 { -webkit-animation: menuanimin2 0.3s ease-in-out forwards; -moz-animation: menuanimin2 0.3s ease-in-out forwards; an

opencart2.x - Opencart product image with remote URL -

Image
i have .xls file upload opencart products. in file main image taken url: to display image via url changed on file catalog/model/tool/image.php on line 4: if (!file_exists(dir_image . $filename) || !is_file(dir_image . $filename)) { return http_image.$filename;; } but site images not displayed. how fix problem? opencart version 2.1.0.2 (rs.1)

c# - json deserialization error -

im getting error while trying deserialize json string object : "system.web.services.protocols.soapexception: server unable process request. ---> newtonsoft.json.jsonserializationexception: error converting value "{"admin":false,"id":1,"password":"heslo","nick":"jozifek"}" type 'entities.dbo.user'. path 'frontman', line 1, position 105. ---> system.argumentexception: not cast or convert system.string entities.dbo.user. @ newtonsoft.json.utilities.convertutils.ensuretypeassignable(object value, type initialtype, type targettype) @ newtonsoft.json.utilities.convertutils.convertorcast(object initialvalue, cultureinfo culture, type targettype) @ newtonsoft.json.serialization.jsonserializerinternalreader.ensuretype(jsonreader reader, object value, cultureinfo culture, jsoncontract contract, type targettype) --- end of inner exception stack trace --- @ newtonsoft.json.seri

c# - Using textbox value for a class -

i'm trying use textbox value form class insert items database. tried creating instance of form1 name of form want value returns 0 items database when click submit button there anyway this? public void insert() { form1 mform = new form1(); string query = "insert parts (item_id, description, brand, model, color, quantity) values('0', '" + mform.description.text + "','" + mform.brand.text + "','" + mform.model.text + "','" + mform.color.text + "','" + mform.quantity.text + "')"; if (this.openconnection() == true) { mysqlcommand cmd = new mysqlcommand(query, connection); cmd.executenonquery(); this.closeconnection(); } } when instantiate new instance of form1() object, assumin

Couldn't resolve resource @android:color/... and invisible checkbox -

Image
i'm having problem , don't know when started. didn't have problem before. because error, actual box checkbox doesn't show in android 5/6 in android 4 . mean this i tested app in different devices , 6.0.1 device -> no box. 5.1.1 device -> no box. 4.0.3 device -> normal box. i've tried use appcompatcheckbox directly instead checkbox , error , problem still there. gradle compilesdkversion 23 buildtoolsversion "23.0.2" defaultconfig { applicationid "com.aaa.bbb" minsdkversion 15 targetsdkversion 23 versioncode 15 versionname "0.1" renderscripttargetapi 23 renderscriptsupportmodeenabled true } dependencies { compile filetree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:23.1.1' compile 'com.android.support:support-v4:23.1.1' compile 'com.android.support:design:23.1.1' compile 'com.android.support:rec

c# - Gridview filter resetting on paging -

i have gridview i'm binding database within onload method. as shown: if (!ispostback) { sqlconnection sqlcon = new sqlconnection(connstring); sqlcommand sqlcmd = new sqlcommand("select * coffees order coffeename asc", sqlcon); sqldataadapter adp = new sqldataadapter(sqlcmd); dataset ds = new dataset(); adp.fill(ds); gridview1.datasource = ds.tables[0]; gridview1.databind(); } i'm allowing users filter gridview on search term. issue i'm following @ moment when change pages, filter lost. i have read need rebind filter eachtime , im getting stuck. here filter: private void setgrid(string searchterm) { if (ispostback) { string item = dropdownlist2.selectedvalue; sqlconnection sqlcon = new sqlconnection(connstring); sqlcommand sqlcmdd = new sqlcommand("select * coffees " + searchter

How to save downloaded csv file to specified directory using php -

i using php script download data database , export csv format.i can generate file problem facing gets downloaded downloads folder of computer. i want download file specific folder.how it? here code $result=sqlsrv_query($conn,$stmt); $out=''; $filedate=date("y-m-d"); $output='$filedate.nrml_cash_position_trade.csv'; while ($l = sqlsrv_fetch_array($result, sqlsrv_fetch_assoc)) { foreach($l $key => $value){ //if character " exists, escape it, otherwise csv file invalid. $pos = strpos($value, '"'); if ($pos !== false) { $value = str_replace('"', '\"', $value); } $out .= '"'.$value.'",'; } $out .= "\n"; } header("content-disposition: attachment; filename= $output"); echo $out;`

get count of values associated with key in dict python -

list of dict . [{'id': 19, 'success': true, 'title': u'apple'}, {'id': 19, 'success': false, 'title': u'some other '}, {'id': 19, 'success': false, 'title': u'dont know'}] i want count of how many dict have success true . i have tried, len(filter(lambda x: x, [i['success'] in s])) how can make more elegant using pythonic way ? you use sum() add boolean values; true 1 in numeric context, false 0: sum(d['success'] d in s) this works because python bool type subclass of int , historic reasons. if wanted make explicit, use conditional expression, readability not improved in opinion: sum(1 if d['success'] else 0 d in s)

node.js - NodeJs and ExpressJs Unable to separate the common code which is used in error and respose handling -

i'm new nodejs , expressjs. have following code, used list of users in following code separate code in function(error, response, body) method , reuse in different method how can this? using these repeatedly in methods separate , reuse in places. router.get('/details/*******/all', function(req, res, next) { var cookie = request.cookie("jsessionid=" + req.cookies.jsessionid); jar.setcookie(cookie, list_of_staff, function(error, cookie) {}); request({ url: list_of_staff, method: "get", jar: jar, headers: headers }, function(error, response, body) { if (!error && response.statuscode === 400 && !_.isundefined(body)) { res.status(400) res.json(body); } else if (!error && response.statuscode === 401 && !_.isundefined(body)) { res.status(401) res.json(body); } else if (!error &&

rest - Get data from Azure hosted SQL server from with in MS Dynamics CRM Sandbox plugin -

i stuck in accessing sql server within sandbox plugin. can't access within sandbox plugin tried access through azure hosted webapi unable access api within ms dynamics crm through javascript through plugin, have reported issue here: consuming azure hosted webapi in ms dynamics crm online the other thing tried created azure hosted cloud service unable access service within sandbox plugin. says 'no endpoint listening accept message', although have confirmed azure hosted cloud service working fine , end point correct. so not sure setting missing in azure/ms dynamics crm. kindly suggest best approach use in scenario? have @ post. https://code.msdn.microsoft.com/how-to-call-external-wcf-42c4490d also crm sdk. web access sandboxed plug-ins , custom workflow activities can access network through http , https protocols. capability provides support accessing popular web resources social sites, news feeds, web services, , more. following web access restrict

java - ManyToMany mapping to include some extra records -

let's have following model: @entity public class user { ... @manytomany private set<permission> allowedpermissions; ... } @entity public class permission { ... private boolean isdefault; ... } is possible map user.allowedpermissions contains both permissions connected user , these isdefault = true not explicitly connected? i use hibernate jpa provider. well not possible because don't have enough information permissions in user. if think @ many-to-many relationship, on database it's relation table between 2 other tables. now, in user entity you're correctly using set see relations stored in cross table (let's user_permission). @ level you're not able know default permissions, can retrieved via permissiondao (i assume you're using dao/service design, if not adjust needs). if want superset (allowedpermissions + defaultpermissions), can maybe write utility method @ service layer if like:

c# - Filling data from an oracle table is not taking date and time -

i trying fill datatable data oracle table. while fetching data uses oracle connection, , oracle data adapter in c# fill data table. actual oracle table has column datatype date .this column has both date , time in format "10/26/2006 3:52:18 pm' ,but when filled datatable takes date .please help here code , string oquery = "select * table_name insert_date between to_date ('" + startdate[i] + "', 'yyyy-mm-dd') , to_date ('" + enddaterr[i] + "', 'yyyy-mm-dd') "; oraclecommand cmd = new oraclecommand(oquery, con); oracledataadapter oda = new oracledataadapter(cmd); datatable dtb = new datatable(); oda.fill(dtb); have tried casting date in c# datetime.now.tostring("mm/dd/yyyy hh:mm:ss tt") and when retrieving oracle cast back, using oracle format select to_char(sysdate,'mm/dd/yyyy hh:mi:ss am') dual using (ora

c++ - Iterate using an enum -

i have std::map key enum this: enum class my_enum{a=1,b,c,d}; std::map<my_enum,my_class> my_map; i want iterate on map used for : for (auto current_type = (id_type)0; (int)current_type < 4; current_type = (my_enum)((int)current_type + 1)){ //do things } i think rubbish. have better suggestion? edit: i totally aware of using of iterators. know prefereable. however, reason, have stick regular index-based for . define types this: enum class my_enum{a=1, b, c, d, end}; std::map<my_enum,my_class> my_map; my_enum& operator++( my_enum &val ) { using inttype = typename std::underlying_type<my_enum>::type val = static_cast<my_enum>( static_cast<inttype>(val) + 1 ); return val; } and can use them this: for (my_enum e = my_enum::a; e < my_enum::end; ++e) { my_class c = my_map[e]; .... } (although, might prefer use other operator[] if don't want create null-values entries don't exist.)

javascript - Pros and cons of this.myVar vs. var myVar -

this question has answer here: what scope of variables in javascript? 21 answers var myfunction = function () { this.myvar = 'something'; var myvar = 'else'; }; what pros , cons of 2 above, see them being used. the main difference following: var myfunc = function(){ this.x = 2; // want used outside of declaration } var y = new myfunc(); console.log(y.x); // 2 var myfunc2 = function(){ var x = 3; // want use inside function } var z = new myfunc2(); console.log(y.x); // undefined so this. variable accessible , var won't be.

jquery - How to press enter in input type text call function javascript by not submit form? -

how press enter in input type text call function javascript not submit form ? when fill data input type text , press enter keyboard want call function detect_enter_keyboard(event) not submit form. how can ? https://jsfiddle.net/atuyx7qc/ <form> <input type="text" name="user" onkeypress="detect_enter_keyboard(event)"> <input name="btnlogin" onclick="test_fn();" type="button" value="send"> </form> <script> function detect_enter_keyboard(event) { var key_board_keycode = event.which || event.keycode; if(key_board_keycode == 13) { test_fn(); } } </script> <script> function test_fn(){ alert("555555"); } </script> with preventdefault() . add line after if(key_board_keycode == 13) : event.preventdefault();

php - Issue while trying to read Table - MySQL -

i believe basic problem starting coding @ php can't alone: i've been 2 days trying solve strange problem. using xampp database , tables objective of creating login , register system. this user table: create table `playware`.`users` ( `user_id` int( 5 ) not null auto_increment primary key , `name` varchar( 25 ) not null , `surname` varchar( 25 ) not null , `email` varchar( 35 ) not null , `telephone` varchar( 9 ) not null , `password` varchar( 50 ) not null , unique (`email`) ) engine = myisam ; the register .php file working (it's adding user table correctly) when try make login can't. so i've made on login.php file test if gets row: <?php include_once 'connect.php'; session_start(); if(isset($_session['user'])!="") { header("location: index_home.php"); } $email = $_post["email"]; $upass = $_post["password"]; $sql="select email users"; $res=$conn->query($sql); if($res->num

php - Is it good or bad practice to use an iFrame to insert a large amount of local content into a Lightbox? -

i creating enquiry form opens in fancybox pop-up little unsure how correctly insert content. the form has large number of fields, think best have code in separate file, making easier read , edited in future, if need ever arose. i aware create separate file , include page via php or ssi wanted opinion others best way of getting content in be. veering away changing page has link form .php (which .shtml), website i'm working on old , doesn't have php pages in use ssi navigation , header sections (all pages in site .shtml). should use ssi, iframe or embed code directly in master page , forget keeping form separate? i forward suggestions.

jquery - table cell input returns as undefined -

i using jquery 2 need populate multidimensional array values in table here code (first column hidden) html: <table id="datatab" border="1"> <tbody> <tr role="row" class="odd"> <td class="sorting_1" style="display: none;">2087971</td> <td>1</td> <td>1</td> <td>aaaa</td> <td>john smith</td> <td><input type="text" name="value1" value="1"></td> <td><input type="text" name="value2" value="2"></td> <td><input type="text" name="value3" value="3"></td> <td></td> </tr> <tr role="row" class="even"> <td class=&