Posts

Showing posts from August, 2014

php - Unable to convert Magento object array response to json format -

i trying convert magento object array json, giving result {} . $facetcolor = mage::getmodel('facets/color')->getcollection(); printing array gives me print "<pre>"; print_r($facetcolor); gamer_facets_model_resource_color_collection object ( [_joinedfields:protected] => array ( ) [_model:protected] => facets/color [_resourcemodel:protected] => facets/color [_resource:protected] => gamer_facets_model_resource_color object ( [_resources:protected] => mage_core_model_resource object ( [_connectiontypes:protected] => array ( ) [_connections:protected] => array ( [core_read] => varien_db_adapter_pdo_mysql object ( [_defaultstmtclass:protected] => varien_d

rest - Getting response but view is not updating - AngularJS -

i trying response url , populate in view, not see view getting updated. me resolve issue. thanks source <!doctype html> <html ng-app="mymodule"> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script> </head> <body ng-init="pricelist='promo03'"> <div ng-controller="pricingcontroller" > <div ng-repeat="item in finallist track $index"> <ul> <li>actual price: {{item.actualprice}}</li> <li>button: {{item.button}}</li> <li>content: {{item.content}}</li> <li>description: {{item.description}}</li> <li>discounted price: {{item.discountedprice}}</li> </ul> </div> </div> <script> var mymodule = angular.module('mymodule',[]); mymodule.service('bannerservice', ['$http'

c# - What is wrong when trying to find how much bytes sent(uploaded) so far? -

i have event i'm doing progress report backgroundworker1 progresschanged event: mbsent = ((double)obj.bytessent) / (1 << 20); stringprogressreport[2] = mbsent.tostring(); backgroundworker1.reportprogress(0, 2); mbsent global double var. , stringprogressreport string array var. have var type long called totalbytes file i'm uploading size. i'm not using var here maybe should. then in backgroundworker progresschanged event did: label5.text = stringprogressreport[2]; the problem in label5 see counting int numbers 1,2,3,4,5...when it's getting 25 in end see number 25 become 25.34543356767 , totalbytes size else @ it's 26.7898 or something. something wrong this: mbsent = ((double)obj.bytessent) / (1 << 20); maybe need sue here somehow totalbytes(the file total size) ? this how i'm calculating totalbytes: long totalbytes = 0; private void button3_click(object sender, eventargs e) { openfiledialog openfiledialo

php - Custom URL Helper redirect with get method -

on codeigniter application/helper/my_url_helper able add '?&route=' . $uri able use '?&route=' after index.php before first folder / function. but every time click on link url changes page stays same? question: on helper how can add '?&route=' . $uri make still redirect page each time when click on link url changes page stays same? redirect('common/dashboard'); url http://localhost/project/admin/?&route=common/dashboard i have tried routes , same issue. <?php if ( ! function_exists('redirect')) { function redirect($uri = '', $method = 'auto', $code = null) { //if ( ! preg_match('#^(\w+:)?//#i', $uri)) //{ $uri = site_url('?&route=' . $uri); //} // iis environment likely? use 'refresh' better compatibility if ($method === 'auto' && isset($_server['server_software']) && strpos($_server['server_softwa

asp.net mvc - MVC Razor Set value of TextBoxFor from Button Group -

i want set value of textboxfor control button group. 1/ not sure how refer texboxfor, have tried eqtype.value = 2 <script> $(".btn-group > .btneqtype").click(function () { $(this).addclass("active").siblings().removeclass("active"); eqtype.value = 2 }); </script> <div class="form-group"> <label class="control-label col-sm-4" for="agd2">set id</label> <div class="col-sm-8 col-md-6"> @html.textboxfor(m => m.etype, new { @class = "input k-textbox", id = "eqtype", value = "3" }) </div> </div> read on jquery selectors http://www.w3schools.com/jquery/jquery_ref_selectors.asp <script> $(".btn-group > .btneqtype").click(function () { $(this).addclass("active").siblings().removeclass("active"); $('#eqtype').val("2");

javascript - How to set the text of the button in the webview? -

i'm working on webview in android, wanted change text of button inside webview. i tried these line of codes not working webview.loadurl("javascript:document.getelementbyname('btn').value = 'test';"); and this... string str="test"; webview.loadurl("javascript: setbuttontext(strbtext,str)"); here's sample of code in oncreate set enable javascript , load html webview=(webview)findviewbyid(r.id.wbview); webview.getsettings().setjavascriptenabled(true); webview.setwebchromeclient(new webchromeclient()); webview.loadurl("file:///android_asset/www/index.html"); and here's method want change text of button programmatically @override protected void onresume() { super.onresume(); if (activity.canreadcardwithcamera()) { //set text true } else { //set text false } index.html <!doctype html> <html> <head> <script scr=&q

asp.net - Aspose.Cells wrap the terms between triple double quotes -

using aspose.cells need csv file terms wraped between double quotes. reason terms after first column surrounded triple double quotes when saving csv file, like: """term""" this code: workbookdesigner wd = new workbookdesigner(); wd.workbook.initialize(); worksheet sht = wd.workbook.worksheets[0]; string value = "term"; value = string.format("\"{0}\"", value); sht.cells[row + rowoffset, column].putvalue(value); wd.save(fileloc, fileformattype.csv); i'm using aspose.cells version 4.8.0.0 if want csv file term as "term" then should save in csv file """term""" please type """term""" in notepad , save .csv file. open in microsoft excel , see value, find displayed "term" note: working developer evangelist @ aspose

3g - Apache Cordova broadband -

i haven't been able find information network restrictions , cordova. question how can prevent or restrict use of mobile (3g/4g) broadband in apache cordova 5 app? you use following plugin . check connection type , act on connection type. example: function checkconnection() { var networkstate = navigator.connection.type; var states = {}; states[connection.unknown] = 'unknown connection'; states[connection.ethernet] = 'ethernet connection'; states[connection.wifi] = 'wifi connection'; states[connection.cell_2g] = 'cell 2g connection'; states[connection.cell_3g] = 'cell 3g connection'; states[connection.cell_4g] = 'cell 4g connection'; states[connection.cell] = 'cell generic connection'; states[connection.none] = 'no network connection'; if(!states[connection.wifi] || !states[connection.ethernet]) { alert('your current connection type

php - Recaptcha why doesn't this work? -

i'm trying use no captcha recaptcha have issue. use code : if(isset($_post['g-recaptcha-response'])){ $captcha=$_post['g-recaptcha-response']; } if(!$captcha){ $json['error'] = $this->language->get('error_captcha'); } if (!isset($json['error'])) { $this->model_catalog_review->addreview($this->request->get['product_id'], $this->request->post); $json['success'] = $this->language->get('text_success'); } } but error message if captcha filled out. how can fix this?

c# - Recursion for nested Dictionary -

i have dictionary multiples values. dictionary as: public class checkitems: dictionary<int, checkitems>{ // .... } i looping on each level this. foreach(keyvaluepair<int, checkitems> first in items){ foreach(keyvaluepair<int, checkitems> second in first.values){ foreach(keyvaluepair<int, checkitems> third in second.values){ list<int> list1 = new list<int>(); if(third.value.age > 20){ list.add(x.key) } } foreach(var deletekeys in list1){ second.value.remove(deletekeys) } } } currently writing foreach each level , checking see if satisfies condition , adding list remove. wanted know how write recursively wouldn't have worry how deep levels go. example data format: companies i. apple a. key: macbookpro value: 200 b (key): imac value: 334 c (key): iphone value : 12

excel - Mass edit multiple workbooks of the same format -

i'm new vba (as of morning), excuse ignorance. have few hundred excel workbooks, formatted same way (just different text). i'm trying both format , delete few sheets within workbooks (the same all). i recorded macro works fine when applied individually, i'm getting runtime error when try run means of mass format: sub loopfiles() dim myfilename, mypath string dim mybook workbook mypath = "i:\academic networks\all scorecard copies, 6.18.2015" myfilename = dir(mypath & "*.xlsm") until myfilename = "" workbooks.open mypath & myfilename set mybook = activeworkbook application.run "workbook1.xlsm!scorecardmacro" mybook.save mybook.close myfilename = dir loop end sub i keep getting runtime error (9) - subscript out of range. thoughts? here's formatting/deleting i'm trying apply workbooks (which works fine when applied 1 workbook @ time

python - Importing VTK Image Into Mayavi -

i'm having trouble importing image read through vtk mayavi pipeline. use mayavi volume rendering tools render vtk image, can't figure out how feed image mayavi. able read image without problem: from tvtk.api import tvtk reader = tvtk.metaimagereader() reader.file_name = "image.mhd" reader.update() but can't figure out how output reader mayavi. i'd use data image input mayavi volume renderer, in this example , haven't been able raw data vtk image , pipe through mayavi.

java - How to populate concurrenthashmap from multiple threads? -

i have concurrenthashmap populating multiple threads. private static map<datacode, long> errormap = new concurrenthashmap<datacode, long>(); public static void adderror(datacode error) { if (errormap.keyset().contains(error)) { errormap.put(error, errormap.get(error) + 1); } else { errormap.put(error, 1l); } } my above adderror method called multiple threads populates errormap . not sure whether thread safe? there wrong doing here? any explanation of why can skip updates me understand better. whether safe depends on mean. won't throw exceptions or corrupt map, can skip updates. consider: thread1: errormap.get(error) returns 1 thread2: errormap.get(error) returns 1 thread1: errormap.put(error, 1+1); thread2: errormap.put(error, 1+1); a similar race exists around keyset().contains(error) operation. fix you'll need use atomic operations update map. on java 8, easy: errormap.compute(error, oldvalue -> old

c# - Difference between Android.Graphics.BitmapFactory and Java.Lang.Object.BitmapFactory -

i'm using xamarin create android app , confused mappings between java.lang.object.bitmapfactory android.graphics.bitmapfactory the .net system.drawing.bitmap doesn't appear, think porting code confused these 2 instances. can explain when should use 1 vs other in generic sense (this overlap between android , java extends more these named classes)

vba FileDIalog.Filters specific kind of filename and sort by created date -

problem: filter out filename include %card%.txt (e.g. xyz card hij. txt ) , listed files in descending order based on created date following code attempted. sub importdata() dim targetfiledialog office.filedialog set targetfiledialog = application.filedialog(msofiledialogfilepicker) 'open file dialog file path targetfiledialog 'user can imporot 1 file @ time .allowmultiselect = false 'auto direct user specific folder .initialfilename = "desiredpath\" 'add filter .filters.clear .filters.add "all files", "*.txt", 1 if .show = -1 each targetfile in .selecteditems importfile = targetfile next targetfile end if end end sub

oracle11g - Oracle Express 11g - hired after another employee's hired date -

i have employees table needs display employee_id , employee_name , hiredate employees have been hired after jack hired. have follow syntax , syntax error shows: sql command not ended. select employee_id, employee_name, hiredate employees hiredate > employee_name = 'jack'; i tried () around jack also, , still not working. you first have find out when jack hired: select hiredate employees employee_name = 'jack'; you can use subquery where condition. finished query: select employee_id, employee_name, hiredate employees hiredate > ( select hiredate employees employee_name = 'jack' );

c# - Lock user if failed 5 attempts -

i can decrease attemptsleft in database set 5 . attemptsleft decreased 1 if enter password wrongly correct username. can make user not log in system if user's status suspended . problem: i set when attemptsleft gets decreased 0, user's status become suspended . however, attemptsleft in database gets decreased , user's status not become suspended , gets suspended if enter username , password correctly, no matter how many attemptsleft lefts. what wrong? i think user.attempts retrieving database not working, , because user.attempts 0 , attemptsleft in database gets decreased, because decreasing query . here code using: usermanager class: public void getattempts(string username, string password) { logincontext context = new logincontext(); using (sqlconnection conn = new sqlconnection(connectionstring)) { string query = "select [username], [password], [attemptsleft] [information] [usern

android - Numberpicker with String and breaklines -

Image
numberpicker string , breaklines need! forum found using strings in numberpicker component. must make break lines better viewing possible? level of customization layout, style etc possible component? private numberpicker np; np = (numberpicker) view .findviewbyid(r.id.np); np.setonclicklistener(this); np.setaddstatesfromchildren(false); getstringfornp();//populate np string array setnumberpickertextcolor(np, getactivity().getresources().getcolor(r.color.white)); private boolean setnumberpickertextcolor(numberpicker numberpicker, int color) { final int count = numberpicker.getchildcount(); for(int = 0; < count; i++){ view child = numberpicker.getchildat(i); if(child instanceof edittext){ try{ field selectorwheelpaintfield = numberpicker.getclass() .getdeclaredfield("mselectorwheelpaint")

encryption - gpg signing seems to "remove" integrity -

the google not answering question because google results flooded question similar mine in form quite different in meaning. i'm mentioning because know there common issue complaint message integrity when cast5 (the default) used. want clear not asking cast5, asking question aes256 (always aes256, have default set aes256), i'm curious differences between signed , unsigned. okay, so, here goes: when using gpg aes256, message integrity "turned on" default don't complaints message integrity when encrypting symmetrically aes256. example, suppose have file "test.txt": $ ls test.txt $ cat test.txt blah blah blah and encrypt symmetrically: $ gpg --symmetric ./test.txt <---[symmetric aes256] $ ls test.txt test.txt.gpg $ gpg -d ./test.txt.gpg gpg: aes256 encrypted data gpg: encrypted 1 passphrase <---[no complaint integrity] blah blah blah but, if add signature gpg complains message integrity, though i'm still using aes256.

formvalidation plugin - How to dynamically change validators at runtime -

let's have validation in 1 field: between: { min: 50, max: 500, message: 'please enter correct range' } i update min , max @ runtime. how can ? thanks. you can using updateoption method. see following code: $('#yourform') // update min & max options .formvalidation('updateoption', 'yourinputname', 'between', 'min', 10) .formvalidation('updateoption', 'yourinputname', 'between', 'max', 90) // update message if need .formvalidation('updateoption', 'yourinputname', 'between', 'message', 'your new message') // might need revalidate field .formvalidation('revalidatefield', 'yourinputname'); # working example: http://jsfiddle.net/arkni/241jzc46/ # refferences: updateoption docs: http://formvalidation.io/api/#update-option

Updating Parent and Child Solr (5) Documents -

given have indexed parent document along number of _childdocuments_ , correct way post update of parent ? understand need resubmit parent along _childdocuments_ . what having trouble create database record triggers call index item. (using laravel 5) i associate additional data followed firing call reindex same item. rather replacing existing solr document updated version, adds document same id index. <uniquekey>id</uniquekey> correctly set in schema.xml . notice different _version_ values. do have delete parent , _childdocuments_ before submitting revised document index? note: running on version 5.3.0-2015-06-16_01-18-34 1685690 - jenkins - 2015-06-15 21:25:19 here schema.xml minus comments: <?xml version="1.0" encoding="utf-8" ?> <schema name="example" version="1.5"> <field name="_version_" type="long" indexed="true" stored="true"/> <field

javafx - How to change ImageView on KeyPressed -

i having difficulty trying solve this, trying figure out how change imageview imageview when press key on keyboard have no idea how to, have looked around everywhere can think of haven't got clue. heres code, character class: import java.io.ioexception; import java.io.inputstream; import java.nio.file.files; import java.nio.file.paths; import javafx.animation.animation; import javafx.application.application; import javafx.geometry.rectangle2d; import javafx.scene.group; import javafx.scene.scene; import javafx.scene.image.image; import javafx.scene.image.imageview; import javafx.scene.input.keycode; import javafx.scene.paint.color; import javafx.stage.stage; import javafx.util.duration; public class character extends application{ private static final int columns = 3; private static final int count = 3; private static final int width = 48; private static final int height = 50; imageview imgview; public void start(stage primarystage) throws exception { gro

intellij plugin - How do I activate a tool window to a specific "tab" (content)? -

i have defined toolwindow in plugin.xml, , added contents (tabs) in createtoolwindowcontent function of corresponding class implements toolwindowfactory . i have separate action, activate toolwindow specific tab. that, do: toolwindow toolwindow = toolwindowmanager.getinstance(project).gettoolwindow(tool_window_id); toolwindow.activate(null); // don't need execute when done... or should i? so right cannot select tab want. found method toolwindow.getcontentmanager().setselectedcontent(content) but if don't have reference created content? you can use contentmanager.getcontents() list of contents displayed in toolwindow, or findcontent() or getcontent() find content index, name or component shown in it.

ios - Change Icon Color Tab Bar Controller-SWIFT -

i working in xcode 6 swift , have been able change color of text on tab bar controller, cannot color change on icons themselves. code below in appdelegate: func application(application: uiapplication, didfinishlaunchingwithoptions launchoptions: [nsobject: anyobject]?) -> bool { uitabbaritem.appearance().settitletextattributes([nsforegroundcolorattributename: uicolor(red: 239/255, green: 64/255, blue: 54/255, alpha: 1.0)], forstate: .selected) uitabbaritem.appearance().settitletextattributes([nsforegroundcolorattributename: uicolor.whitecolor()], forstate: .normal) i have separate class navigation controller change text , color. you need set image on tab bar item uiimage renderingmode = uiimagerenderingmode.alwaystemplate then can set tintcolor on  uitabbar change color of icons , text simultaneously. should still able override text appearance selectors have created though. if recall, uitabbar should set renderingmode automatically, try setting

java - Android Virtual Display -

i doing project need hide app interactions in background , show results user. possible using virtual display ? and virtualdisplay can create display , assign particular application? i did not find suitable examples far. example appreciated ti illustrate how use virtualdisplay , main purpose.

typescript error : doesn't the property on the options type -

i have object like: var options = {title: "", buttons: undefined} but want add function, this: options.open(){...} typescript reported error info: doesn't property on options type, how can add function options? var options = { title: "", buttons: undefined, open: function() { console.log("you ran open() function"); } }; options.open()

image - ImageMagick - Making 2 GIFs into side by side GIFs using IM convert -

Image
i have 2 gifs same length. i want put gifs beside each other have 1 gif both playing @ same time. have tried use convert tool with: convert +append 1.gif1 2.gif output.gif however, seems blend images , changes size extremely small. i thinking append each image , create gif out of combined images. did not work when tried: convert -delay 15 -loop 0 1*.png 2*.png +append output.gif i have lot of images long names , not want have go through individually , append each figure new naming conventions. i don't have 2 animated gifs of same length, i'll use 2 copies of one: let's @ frames in there, this: identify 1.gif 1.gif[0] gif 500x339 500x339+0+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[1] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[2] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[3] gif 449x339 500x339+51+0 8-bit srgb 32c 508kb 0.000u 0:00.000 1.gif[4] gif 448x339 500x339+52+0 8-bit srgb 32c 508kb 0.

javascript - If array size is more than 0 then only push data -

i toggling div on ng-click using isvisible . problem having everytime click button, runs $scope.objectlist.push(data); . want push on first click or push if array size less or equal 0. $scope.objectlist = []; $scope.isvisible = false; $scope.pushdata= function(id) { $http.get("some variables being passed on here").success(function(data, status, headers, config){ $scope.objectlist.push(data); }).error(function(data, status, headers, config){ alert("error"); }); $scope.isvisible = ! $scope.isvisible; }; i have tried using if(objectlist.length <= 0) returned null array meaning nothing got pushed. i don't think want use counter or boolean variable this. imagine set counter 1 or boolean variable "true" , other function you'll add later removes elements array. have empty array requires pushing, counter says it's not 0 , boolean variable says pushed array. wrong think should check array length